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
badb88141a3c14bce8803196e1572611f596c357
eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3
/tags/2011-04-20/seasar2-2.4.44/s2jdbc-gen/s2jdbc-gen/src/test/java/org/seasar/extension/jdbc/gen/internal/meta/DbTableMetaReaderImplTest.java
d2e59ab598af42059cf928b6ef44f82963119abf
[ "Apache-2.0" ]
permissive
svn2github/s2container
54ca27cf0c1200a93e1cb88884eb8226a9be677d
625adc6c4e1396654a7297d00ec206c077a78696
refs/heads/master
2020-06-04T17:15:02.140847
2013-08-09T09:38:15
2013-08-09T09:38:15
10,850,644
0
1
null
null
null
null
UTF-8
Java
false
false
12,916
java
/* * Copyright 2004-2011 the Seasar Foundation and the Others. * * 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.seasar.extension.jdbc.gen.internal.meta; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; import java.util.Arrays; import java.util.List; import java.util.Set; import org.junit.Test; import org.seasar.extension.jdbc.gen.internal.dialect.StandardGenDialect; import org.seasar.extension.jdbc.gen.meta.DbColumnMeta; import org.seasar.extension.jdbc.gen.meta.DbForeignKeyMeta; import org.seasar.extension.jdbc.gen.meta.DbTableMeta; import org.seasar.extension.jdbc.gen.meta.DbUniqueKeyMeta; import org.seasar.extension.jdbc.gen.mock.sql.GenMockDatabaseMetaData; import org.seasar.framework.mock.sql.MockDataSource; import org.seasar.framework.mock.sql.MockResultSet; import org.seasar.framework.util.ArrayMap; import static org.junit.Assert.*; /** * @author taedium * */ public class DbTableMetaReaderImplTest { /** * * @throws Exception */ @Test public void testGetPrimaryKeySet() throws Exception { final MockResultSet resultSet = new MockResultSet(); ArrayMap rowData = new ArrayMap(); rowData.put("COLUMN_NAME", "pk1"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("COLUMN_NAME", "pk2"); resultSet.addRowData(rowData); GenMockDatabaseMetaData metaData = new GenMockDatabaseMetaData() { @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { return resultSet; } }; DbTableMetaReaderImpl reader = new DbTableMetaReaderImpl( new MockDataSource(), new StandardGenDialect(), "schemaName", ".*", "", false); Set<String> list = reader.getPrimaryKeySet(metaData, new DbTableMeta()); assertEquals(2, list.size()); assertTrue(list.contains("pk1")); assertTrue(list.contains("pk2")); } /** * * @throws Exception */ @Test public void testGetDbColumnMetaList() throws Exception { final MockResultSet resultSet = new MockResultSet(); ArrayMap rowData = new ArrayMap(); rowData.put("COLUMN_NAME", "column1"); rowData.put("DATA_TYPE", Types.DECIMAL); rowData.put("TYPE_NAME", "DECIMAL"); rowData.put("COLUMN_SIZE", 10); rowData.put("DECIMAL_DIGITS", 3); rowData.put("NULLABLE", DatabaseMetaData.columnNoNulls); rowData.put("COLUMN_DEF", "10.5"); rowData.put("REMARKS", "comment1"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("COLUMN_NAME", "column2"); rowData.put("DATA_TYPE", Types.VARCHAR); rowData.put("TYPE_NAME", "VARCHAR"); rowData.put("COLUMN_SIZE", 10); rowData.put("DECIMAL_DIGITS", 0); rowData.put("NULLABLE", DatabaseMetaData.columnNullable); rowData.put("COLUMN_DEF", "aaa"); rowData.put("REMARKS", "comment2"); resultSet.addRowData(rowData); GenMockDatabaseMetaData metaData = new GenMockDatabaseMetaData() { @Override public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { return resultSet; } }; DbTableMetaReaderImpl reader = new DbTableMetaReaderImpl( new MockDataSource(), new StandardGenDialect(), "schemaName", ".*", "", true); List<DbColumnMeta> list = reader.getDbColumnMetaList(metaData, new DbTableMeta()); assertEquals(2, list.size()); DbColumnMeta columnMeta = list.get(0); assertEquals("column1", columnMeta.getName()); assertEquals(Types.DECIMAL, columnMeta.getSqlType()); assertEquals("DECIMAL", columnMeta.getTypeName()); assertEquals(10, columnMeta.getLength()); assertEquals(3, columnMeta.getScale()); assertFalse(columnMeta.isNullable()); assertEquals("10.5", columnMeta.getDefaultValue()); assertEquals("comment1", columnMeta.getComment()); columnMeta = list.get(1); assertEquals("column2", columnMeta.getName()); assertEquals(Types.VARCHAR, columnMeta.getSqlType()); assertEquals("VARCHAR", columnMeta.getTypeName()); assertEquals(10, columnMeta.getLength()); assertEquals(0, columnMeta.getScale()); assertTrue(columnMeta.isNullable()); assertEquals("aaa", columnMeta.getDefaultValue()); assertEquals("comment2", columnMeta.getComment()); } /** * * @throws Exception */ @Test public void testGetDbTableMetaList() throws Exception { final MockResultSet resultSet = new MockResultSet(); ArrayMap rowData = new ArrayMap(); rowData.put("TABLE_CAT", "catalog1"); rowData.put("TABLE_SCHEM", "schemaName1"); rowData.put("TABLE_NAME", "table1"); rowData.put("REMARKS", "comment1"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("TABLE_CAT", "catalog2"); rowData.put("TABLE_SCHEM", "schemaName2"); rowData.put("TABLE_NAME", "table2"); rowData.put("REMARKS", "comment2"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("TABLE_CAT", "catalog3"); rowData.put("TABLE_SCHEM", "schemaName3"); rowData.put("TABLE_NAME", "table3"); rowData.put("REMARKS", "comment3"); resultSet.addRowData(rowData); GenMockDatabaseMetaData metaData = new GenMockDatabaseMetaData() { @Override public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) throws SQLException { return resultSet; } }; DbTableMetaReaderImpl reader = new DbTableMetaReaderImpl( new MockDataSource(), new StandardGenDialect(), "schemaName", ".*", "TABLE3", true); List<DbTableMeta> list = reader.getDbTableMetaList(metaData, "schemaName"); assertEquals(2, list.size()); assertEquals("catalog1", list.get(0).getCatalogName()); assertEquals("schemaName1", list.get(0).getSchemaName()); assertEquals("table1", list.get(0).getName()); assertEquals("comment1", list.get(0).getComment()); assertEquals("catalog2", list.get(1).getCatalogName()); assertEquals("schemaName2", list.get(1).getSchemaName()); assertEquals("table2", list.get(1).getName()); assertEquals("comment2", list.get(1).getComment()); } /** * * @throws Exception */ @Test public void testGetDbForeignKeyMetaList() throws Exception { final MockResultSet resultSet = new MockResultSet(); ArrayMap rowData = new ArrayMap(); rowData.put("PKTABLE_CAT", "dept_catalog"); rowData.put("PKTABLE_SCHEM", "dept_schema"); rowData.put("PKTABLE_NAME", "dept"); rowData.put("PKCOLUMN_NAME", "dept_no"); rowData.put("FKCOLUMN_NAME", "dept_no_fk"); rowData.put("FK_NAME", "emp_fk1"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("PKTABLE_CAT", "dept_catalog"); rowData.put("PKTABLE_SCHEM", "dept_schema"); rowData.put("PKTABLE_NAME", "dept"); rowData.put("PKCOLUMN_NAME", "dept_name"); rowData.put("FKCOLUMN_NAME", "dept_name_fk"); rowData.put("FK_NAME", "emp_fk1"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("PKTABLE_CAT", "address_catalog"); rowData.put("PKTABLE_SCHEM", "address_schema"); rowData.put("PKTABLE_NAME", "address"); rowData.put("PKCOLUMN_NAME", "address_name"); rowData.put("FKCOLUMN_NAME", "address_name_fk"); rowData.put("FK_NAME", "emp_fk2"); resultSet.addRowData(rowData); GenMockDatabaseMetaData metaData = new GenMockDatabaseMetaData() { @Override public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { return resultSet; } }; DbTableMetaReaderImpl reader = new DbTableMetaReaderImpl( new MockDataSource(), new StandardGenDialect(), null, ".*", "", false); List<DbForeignKeyMeta> list = reader.getDbForeignKeyMetaList(metaData, new DbTableMeta()); assertEquals(2, list.size()); DbForeignKeyMeta fkMeta = list.get(0); assertEquals("emp_fk1", fkMeta.getName()); assertEquals("dept_catalog", fkMeta.getPrimaryKeyCatalogName()); assertEquals("dept_schema", fkMeta.getPrimaryKeySchemaName()); assertEquals("dept", fkMeta.getPrimaryKeyTableName()); assertEquals(2, fkMeta.getPrimaryKeyColumnNameList().size()); assertEquals(Arrays.asList("dept_no", "dept_name"), fkMeta .getPrimaryKeyColumnNameList()); assertEquals(2, fkMeta.getForeignKeyColumnNameList().size()); assertEquals(Arrays.asList("dept_no_fk", "dept_name_fk"), fkMeta .getForeignKeyColumnNameList()); fkMeta = list.get(1); assertEquals("emp_fk2", fkMeta.getName()); assertEquals("address_catalog", fkMeta.getPrimaryKeyCatalogName()); assertEquals("address_schema", fkMeta.getPrimaryKeySchemaName()); assertEquals("address", fkMeta.getPrimaryKeyTableName()); assertEquals(1, fkMeta.getPrimaryKeyColumnNameList().size()); assertEquals(Arrays.asList("address_name"), fkMeta .getPrimaryKeyColumnNameList()); assertEquals(1, fkMeta.getForeignKeyColumnNameList().size()); assertEquals(Arrays.asList("address_name_fk"), fkMeta .getForeignKeyColumnNameList()); } /** * * @throws Exception */ @Test public void testGetDbUniqueKeyMetaList() throws Exception { final MockResultSet resultSet = new MockResultSet(); ArrayMap rowData = new ArrayMap(); rowData.put("INDEX_NAME", "hoge"); rowData.put("COLUMN_NAME", "aaa"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("INDEX_NAME", "hoge"); rowData.put("COLUMN_NAME", "bbb"); resultSet.addRowData(rowData); rowData = new ArrayMap(); rowData.put("INDEX_NAME", "foo"); rowData.put("COLUMN_NAME", "ccc"); resultSet.addRowData(rowData); GenMockDatabaseMetaData metaData = new GenMockDatabaseMetaData() { @Override public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { return resultSet; } }; DbTableMetaReaderImpl reader = new DbTableMetaReaderImpl( new MockDataSource(), new StandardGenDialect(), null, ".*", "", false); List<DbUniqueKeyMeta> list = reader.getDbUniqueKeyMetaList(metaData, new DbTableMeta()); assertEquals(2, list.size()); DbUniqueKeyMeta ukMeta = list.get(0); assertEquals("hoge", ukMeta.getName()); assertEquals(2, ukMeta.getColumnNameList().size()); assertEquals("aaa", ukMeta.getColumnNameList().get(0)); assertEquals("bbb", ukMeta.getColumnNameList().get(1)); ukMeta = list.get(1); assertEquals("foo", ukMeta.getName()); assertEquals(1, ukMeta.getColumnNameList().size()); assertEquals("ccc", ukMeta.getColumnNameList().get(0)); } }
[ "koichik@319488c0-e101-0410-93bc-b5e51f62721a" ]
koichik@319488c0-e101-0410-93bc-b5e51f62721a
1de96ba1dd8648894e236c94dcc2bdc1d5932ae0
1cc62dd0af73cf3c1dd5bf4811cfa9f414e208c8
/app/src/main/java/life/corals/merchant/fcm/FcmConstants.java
b8a0608e2e42219d27260c65260f3493e375b2de
[]
no_license
Udhaya-kj/CMerchant
4b6aadd3e8028163d8b6836a1de6a46ced4b1211
7ed680179ce0bb71ce0f7401c3a377caa752d298
refs/heads/master
2021-03-08T06:08:31.620193
2020-03-21T10:44:45
2020-03-21T10:44:45
246,323,657
1
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package life.corals.merchant.fcm; public class FcmConstants { public static final String ACTION = "action"; public static final String ACTION_TOP_UP_SUCCESS = "TOP_UP_SUCCESS"; public static final String ACTION_PAYMENT_SUCCESS = "PAYMENT_SUCCESS"; public static final String PRODUCT_REDEEM_SUCCESS = "P_REDEEM_SUCCESS"; //fireBase notification types public static final String NOTIFICATION_TYPE = "notification-type"; public static final String ACTION_NOTIFICATION = "ACTION"; public static final String NOTIFY_NOTIFICATION = "NOTIFY"; public static final String POST_WALLET_BAL = "POST_WALLET_BAL"; public static final String POST_WALLET_EXPIRY_DATE = "POST_WALLET_EXPIRY_DATE"; //redeem product public static final String BALANCE_POINTS = "BAL_POINTS"; public static final String POINT_EXPIRY_DATE = "POINT_EXPIRY_DATE"; //notification filed public static final String MESSAGE_INTENT_ACTION = "android.intent.action.APP_MESSAGE"; public static final String TITLE = "title"; public static final String MESSAGE_BODY = "body"; public static final String SUB_TITLE = "sub_title"; public static final String IMAGE = "image"; public static final String MERCHANT_NAME = "merchantname"; public static final String NEW = "new"; public static final String SEEN = "seen"; public static final int APP_ALERT_MINUS_SIZE = 48; }
[ "udhayak448@gmail.com" ]
udhayak448@gmail.com
9c392e662e4871e0da42cb01a7c3c0c6459e0f2a
8627f583576c91739f577f4fb5fc4cc913439d7f
/1-LanguageBasics/陈明远-MF20330007/HomeWork.java
ad015472f95fe1f47c4c16ecd92539c6c128db2a
[]
no_license
cc250/java20-homework
5e9aafcd0066db72b92deadcf66382d97b5e7928
cad63af835876c8a471e4bb25f1fde5cd94fec6d
refs/heads/master
2022-12-14T18:50:28.946494
2020-09-13T14:00:58
2020-09-13T14:00:58
295,135,629
0
0
null
2020-09-13T11:19:33
2020-09-13T11:19:33
null
UTF-8
Java
false
false
724
java
import java.util.Collections; import java.util.Scanner; import java.util.ArrayList; public class HomeWork { public static void main(String[] args) { ArrayList array = new ArrayList(); Scanner in = new Scanner(System.in); System.out.println("Please intput array's length: "); int size = in.nextInt(); System.out.println("Please intput array's element: "); for(int i = 0; i < size; i++) { int num = in.nextInt(); array.add(num); } Collections.sort(array); System.out.println("After sorting, your array is: "); for(int i = 0; i < array.size(); i++) { System.out.print(array.get(i) + " "); } } }
[ "2643365253@qq.com" ]
2643365253@qq.com
4632f062acb253bd983c9326f0a56e9c32ec2db3
f085a02d05c1b1048b28f9104a2cd6dad3d84c3e
/src/model/factory/IEquipableItemFactory/LightFactory.java
d1a91496cef3ad51977b7dd8680186f5a1991b0f
[]
no_license
NelsonMQ/AlpacaProjectCC3002
88b327d085a4153bf28e6ac58420ae19e055a51f
900c38cef25c4e8694d6d16a3d490045adc7cd53
refs/heads/master
2022-03-31T06:25:28.848416
2019-12-13T16:24:51
2019-12-13T16:24:51
202,448,986
0
0
null
null
null
null
UTF-8
Java
false
false
458
java
package model.factory.IEquipableItemFactory; import model.items.Light; /** * This class represents the Light factory. * It can create the Light item of the game. * * @author Nelson Marambio * @since 2.1 */ public class LightFactory implements IEquipableItemFactory { /** * Creates a new Light item. * @return * The new Light */ @Override public Light create() { return new Light("Light",10,1,1); } }
[ "nmarambi@dcc.uchile.cl" ]
nmarambi@dcc.uchile.cl
ee67c13d5d96438990a7ee10132bfb8366e274dc
0bd993eba22b3d44b429afb56ff6e9899e61a501
/app/src/androidTest/java/com/example/speechtotextconvertor/ExampleInstrumentedTest.java
dba3fbd0340e7aabfa62d6b2dd687137461a3eb6
[]
no_license
dks2001/speech-to-text-convertor
8f721978da99270180f53f59a559cc0dcbb79a8e
991b59cec48d188e5900592c8d8e3e6c4dbfa366
refs/heads/master
2023-04-19T08:10:39.040874
2021-04-28T14:20:13
2021-04-28T14:20:13
362,494,396
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package com.example.speechtotextconvertor; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.speechtotextconvertor", appContext.getPackageName()); } }
[ "dheerendrak2001@gmail.com" ]
dheerendrak2001@gmail.com
12a924208e917cc6cf09e9975421ca01366398e2
af7d07279c42be675a3fe194ee3a097afe03d84e
/2 - Diagramas de Flujo/NaveOlvido.java
e8785d96d9abfa19aa6f21c725fffe7e7e14ff4b
[ "MIT" ]
permissive
cavigna/modulo_programacion_basica_en_java
5bf15cd561b1468ec7e685b473736b75135e5a96
122fa7854d79410c960a777ef859218bd20868da
refs/heads/main
2023-05-26T21:32:03.933006
2021-06-07T03:06:37
2021-06-07T03:06:37
362,890,003
0
0
null
null
null
null
UTF-8
Java
false
false
700
java
package com.nacho; public class NaveOlvido { public static double costoTotal(int cantPasajeros, String tipoBus, double cantKm){ double costo = 0; if (cantPasajeros>20){ switch (tipoBus) { case "A" -> costo = cantPasajeros * 200; case "B" -> costo = cantPasajeros * 250; case "C" -> costo = cantPasajeros * 300; } switch (tipoBus) { case "A" -> costo = 20 * 200; case "B" -> costo = 20 * 250; case "C" -> costo = 20 * 300; } } costo = costo * cantKm * cantPasajeros; return costo; } }
[ "40524472+cavigna@users.noreply.github.com" ]
40524472+cavigna@users.noreply.github.com
9811f55637aa504eb9cbba49cdadafb5ed66caf9
e86d7e5b03505e0ac583878a3a81841eb7fb1aa2
/Mobile ICP 7/CalanderAPP/app/src/test/java/com/example/pavankumarmanchala/calanderapp/ExampleUnitTest.java
5164b2ae8846b79bb19ec7a4cc9247e16013111c
[]
no_license
PavankumarManchala/CS5590_TEAM_12_ICP
465bb3ea53adfe5ff920c662dae4ef037beca04f
e041cc8eb9e1d9bc529d7e7b802d5a735ef0e983
refs/heads/master
2020-03-27T06:43:32.376463
2018-12-08T22:07:58
2018-12-08T22:07:58
146,130,188
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.pavankumarmanchala.calanderapp; 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); } }
[ "manchalapavankumar548@gmail.com" ]
manchalapavankumar548@gmail.com
bd507692ccc0599299a0da6ea69d443a5d26d6f6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/32/32_32389dc0a93db49be858ea1ee1b2e34b284a7fda/UnifiedGenotyperIntegrationTest/32_32389dc0a93db49be858ea1ee1b2e34b284a7fda_UnifiedGenotyperIntegrationTest_t.java
3024421b89cb502e15d628db1e4d4c35f740a904
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
11,432
java
package org.broadinstitute.sting.gatk.walkers.genotyper; import org.broadinstitute.sting.WalkerTest; import org.junit.Test; import java.util.Arrays; import java.util.HashMap; import java.util.Map; // ********************************************************************************** // // Note that this class also serves as an integration test for the VariantAnnotator! // // ********************************************************************************** // public class UnifiedGenotyperIntegrationTest extends WalkerTest { // -------------------------------------------------------------------------------------------------------------- // // testing pooled model // // -------------------------------------------------------------------------------------------------------------- // @Test // public void testPooled1() { // WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( // "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,023,000-10,024,000 -bm empirical -gm POOLED -ps 60 -confidence 30", 1, // Arrays.asList("c91f44a198cd7222520118726ea806ca")); // executeTest("testPooled1", spec); // } // -------------------------------------------------------------------------------------------------------------- // // testing joint estimation model // // -------------------------------------------------------------------------------------------------------------- @Test public void testMultiSamplePilot1Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam -varout %s -L 1:10,022,000-10,025,000", 1, Arrays.asList("d50ebc40d935ece7e57aafc7355bec77")); executeTest("testMultiSamplePilot1 - Joint Estimate", spec); } @Test public void testMultiSamplePilot2Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "pilot2_daughters.chr20.10k-11k.bam -varout %s -L 20:10,000,000-10,050,000", 1, Arrays.asList("2f113c2b1cd0d36522fc24e7784a2b7d")); executeTest("testMultiSamplePilot2 - Joint Estimate", spec); } @Test public void testSingleSamplePilot2Joint() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000", 1, Arrays.asList("4f08c27ada3ad1a33d12d106bc80dab6")); executeTest("testSingleSamplePilot2 - Joint Estimate", spec); } // -------------------------------------------------------------------------------------------------------------- // // testing joint estimation model // // -------------------------------------------------------------------------------------------------------------- @Test public void testParallelization() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,400,000 -nt 4", 1, Arrays.asList("d643e60343c05817dcb4fafb7870804d")); executeTest("test parallelization", spec); } // -------------------------------------------------------------------------------------------------------------- // // testing parameters // // -------------------------------------------------------------------------------------------------------------- @Test public void testParameter() { HashMap<String, String> e = new HashMap<String, String>(); e.put( "-genotype", "03e228232eeb0a32ea3791daec29248c" ); e.put( "-all_bases", "fe894f335e048d89fccd7a7b39a105a1" ); e.put( "--min_base_quality_score 26", "a1142c69f1951a05d5a33215c69133af" ); e.put( "--min_mapping_quality_score 26", "796d1ea790481a1a257609279f8076bb" ); e.put( "--max_mismatches_in_40bp_window 5", "379bd56d4402e974127e0677ff51d040" ); for ( Map.Entry<String, String> entry : e.entrySet() ) { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,010,000 " + entry.getKey(), 1, Arrays.asList(entry.getValue())); executeTest(String.format("testParameter[%s]", entry.getKey()), spec); } } @Test public void testConfidence() { WalkerTest.WalkerTestSpec spec1 = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,010,000 -stand_call_conf 10 ", 1, Arrays.asList("7b41dc669e8a0abde089d7aeedab2941")); executeTest("testConfidence1", spec1); WalkerTest.WalkerTestSpec spec2 = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,010,000 -stand_emit_conf 10 ", 1, Arrays.asList("258617b8de0e6468bf6a0c740b51676b")); executeTest("testConfidence2", spec2); } // -------------------------------------------------------------------------------------------------------------- // // testing beagle output // // -------------------------------------------------------------------------------------------------------------- @Test public void testOtherOutput() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper" + " -R " + oneKGLocation + "reference/human_b36_both.fasta" + " -I " + validationDataLocation + "low_coverage_CEU.chr1.10k-11k.bam" + " -varout /dev/null" + " -beagle %s" + " -L 1:10,023,400-10,024,000", 1, Arrays.asList("5077d80806e24865b5c12553843a5f85")); executeTest(String.format("testOtherOutput"), spec); } // -------------------------------------------------------------------------------------------------------------- // // testing other output formats // // -------------------------------------------------------------------------------------------------------------- @Test public void testOtherFormat() { HashMap<String, String> e = new HashMap<String, String>(); e.put( "GLF", "ddb1074b6f4a0fd1e15e4381476f1055" ); e.put( "GELI_BINARY", "764a0fed1b3cf089230fd91f3be9c2df" ); for ( Map.Entry<String, String> entry : e.entrySet() ) { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000 -vf " + entry.getKey(), 1, Arrays.asList(entry.getValue())); executeTest(String.format("testOtherFormat[%s]", entry.getKey()), spec); } } // --------------------------------------------- // // ALL REMAINING TESTS ARE OUTPUT IN GELI FORMAT // // --------------------------------------------- // // -------------------------------------------------------------------------------------------------------------- // // testing heterozygosity // // -------------------------------------------------------------------------------------------------------------- @Test public void testHeterozyosity() { HashMap<Double, String> e = new HashMap<Double, String>(); e.put( 0.01, "ee390f91867e8729b96220115e56ddb3" ); e.put( 1.0 / 1850, "f96ad0ed71449bdb16b0c5561303a05a" ); for ( Map.Entry<Double, String> entry : e.entrySet() ) { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -vf GELI -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000 --heterozygosity " + entry.getKey(), 1, Arrays.asList(entry.getValue())); executeTest(String.format("testHeterozyosity[%s]", entry.getKey()), spec); } } // -------------------------------------------------------------------------------------------------------------- // // testing other base calling models // // -------------------------------------------------------------------------------------------------------------- @Test public void testOtherBaseCallModel() { HashMap<String, String> e = new HashMap<String, String>(); e.put( "one_state", "bcc983210b576d9fd228a67c5b9f372a" ); e.put( "three_state", "2db3a5f3d46e13e2f44c34fbb7e7936f" ); for ( Map.Entry<String, String> entry : e.entrySet() ) { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper -vf GELI -R " + oneKGLocation + "reference/human_b36_both.fasta -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.SLX.bam -varout %s -L 1:10,000,000-10,100,000 -bm " + entry.getKey(), 1, Arrays.asList(entry.getValue())); executeTest(String.format("testOtherBaseCallModel[%s]", entry.getKey()), spec); } } // -------------------------------------------------------------------------------------------------------------- // // testing calls with SLX, 454, and SOLID data // // -------------------------------------------------------------------------------------------------------------- @Test public void testMultiTechnologies() { WalkerTest.WalkerTestSpec spec = new WalkerTest.WalkerTestSpec( "-T UnifiedGenotyper" + " -R " + oneKGLocation + "reference/human_b36_both.fasta" + " -I " + validationDataLocation + "NA12878.1kg.p2.chr1_10mb_11_mb.allTechs.bam" + " -varout %s" + " -L 1:10,000,000-10,100,000" + " -vf GELI", 1, Arrays.asList("f67c690bf2e4eee2bb7c58b6646a2a98")); executeTest(String.format("testMultiTechnologies"), spec); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
bf9a607eef9101001ddba48af174be6fb1d93468
fb44b73295580e47691adf287ce9ece076d47f3a
/src/main/java/chapter4/item17/constructor/Complex.java
b8c5fdc23a7f2e9a3071f71a54fba075002fd894
[]
no_license
azimbabu/effective-java
7920a47d2a7c273a8cfe5e6a8640da31f092701a
5b089ec4bc1ae838211cec1d94f575a7067ae69b
refs/heads/master
2021-07-17T22:11:01.751491
2021-06-01T01:33:28
2021-06-01T01:33:28
249,355,159
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package chapter4.item17.constructor; // Immutable complex number class public final class Complex { public static final Complex ZERO = new Complex(0, 0); public static final Complex ONE = new Complex(1, 0); public static final Complex I = new Complex(0, 1); private final double real; private final double imaginary; public Complex(double real, double imaginary) { this.real = real; this.imaginary = imaginary; } public double getReal() { return real; } public double getImaginary() { return imaginary; } public Complex plus(Complex complex) { return new Complex(real + complex.real, imaginary + complex.imaginary); } public Complex minus(Complex complex) { return new Complex(real - complex.real, imaginary - complex.imaginary); } public Complex times(Complex complex) { return new Complex( real * complex.real - imaginary * complex.imaginary, real * complex.imaginary + imaginary * complex.real); } public Complex dividedBy(Complex complex) { double denominator = complex.real * complex.real + complex.imaginary * complex.imaginary; return new Complex( (real * complex.real + imaginary * complex.imaginary) / denominator, (imaginary * complex.real - real * complex.imaginary) / denominator); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Complex)) { return false; } Complex complex = (Complex) o; return Double.compare(real, complex.real) == 0 && Double.compare(imaginary, complex.imaginary) == 0; } @Override public int hashCode() { return 31 * Double.hashCode(real) + Double.hashCode(imaginary); } @Override public String toString() { return "(" + real + " + " + imaginary + "i)"; } }
[ "fazle.azim@personalcapital.com" ]
fazle.azim@personalcapital.com
b0c8ca719a0c76487c1771792457b1e6f19ac0f8
35a828d374886ac72f14dfe53d2eda27758a3317
/app/src/main/java/com/rahtech/ideashub/SplashScreen.java
60ad6fe514589112b745a13def35aa06e10c8737
[]
no_license
RajasekharGuptha/IdeasHub
4484cd39e41094a8d885ca1abbc673b08df61c5c
eea061fb15d80421ff70cb913874c0731dfb24d1
refs/heads/master
2022-12-11T03:40:38.148486
2020-09-07T06:39:11
2020-09-07T06:39:11
293,443,321
0
0
null
null
null
null
UTF-8
Java
false
false
1,138
java
package com.rahtech.ideashub; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class SplashScreen extends AppCompatActivity { FirebaseAuth firebaseAuth=FirebaseAuth.getInstance(); FirebaseUser currentUser=firebaseAuth.getCurrentUser(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash_screen); firebaseAuth.addAuthStateListener(new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { if (firebaseAuth.getCurrentUser()==null){ startActivity(new Intent(SplashScreen.this,SignInActivity.class)); } else{ startActivity(new Intent(SplashScreen.this,MainActivity.class)); } } }); finish(); } }
[ "rajasekharmuppidi4@gmail.com" ]
rajasekharmuppidi4@gmail.com
b71c8260fcbe26b59436f5ed7845a9d446ad1dc5
c8a744c0ddc753513d3b81f9ecd37ae4424455e3
/boxinator-server/src/main/java/se/experis/boxinatorserver/controllers/CountryController.java
d64461b64048b6fcc45273d54a24862787574d26
[]
no_license
Dandandumdum/boxinator-server
48d1b9df7589103991d1bb9470808dbc73bfa47f
4ee566d942aafb38c33d887943453ef99086c877
refs/heads/main
2023-07-16T04:14:04.510940
2021-09-02T08:52:34
2021-09-02T08:52:34
402,355,712
0
0
null
null
null
null
UTF-8
Java
false
false
84
java
package se.experis.boxinatorserver.controllers; public class CountryController { }
[ "adamjohansson0716@gmail.com" ]
adamjohansson0716@gmail.com
676e945ff2733dc4d7b94546a16e57338b42043e
3c0c482f39ba554ac6d87464c3ebe1caf976f138
/ssh-common/src/main/java/com/hades/ssh/common/utils/LogUtils.java
a37d01e76d6720bd1a3a8f8239949e18f6a72fb3
[ "Apache-2.0" ]
permissive
XieleiFighting/ssh-framework
61a1786ef1e3a68665d09c3538b3d93379c4f67c
8399a38fe53b7b79fbe14222c567d2e35f011cbb
refs/heads/master
2021-01-20T20:29:17.105682
2016-08-09T06:41:30
2016-08-09T06:41:30
64,530,277
1
1
null
null
null
null
UTF-8
Java
false
false
4,910
java
package com.hades.ssh.common.utils; import com.alibaba.fastjson.JSON; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.apache.shiro.SecurityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Enumeration; import java.util.List; import java.util.Map; public class LogUtils { public static final Logger ERROR_LOG = LoggerFactory.getLogger("es-error"); public static final Logger ACCESS_LOG = LoggerFactory.getLogger("es-access"); /** * 记录访问日志 * [username][jsessionid][ip][accept][UserAgent][url][params][Referer] * * @param request */ public static void logAccess(HttpServletRequest request) { String username = getUsername(); String jsessionId = request.getRequestedSessionId(); String ip = IpUtils.getIpAddr(request); String accept = request.getHeader("accept"); String userAgent = request.getHeader("User-Agent"); String url = request.getRequestURI(); String params = getParams(request); String headers = getHeaders(request); StringBuilder s = new StringBuilder(); s.append(getBlock(username)); s.append(getBlock(jsessionId)); s.append(getBlock(ip)); s.append(getBlock(accept)); s.append(getBlock(userAgent)); s.append(getBlock(url)); s.append(getBlock(params)); s.append(getBlock(headers)); s.append(getBlock(request.getHeader("Referer"))); getAccessLog().info(s.toString()); } /** * 记录异常错误 * 格式 [exception] * * @param message * @param e */ public static void logError(String message, Throwable e) { String username = getUsername(); StringBuilder s = new StringBuilder(); s.append(getBlock("exception")); s.append(getBlock(username)); s.append(getBlock(message)); ERROR_LOG.error(s.toString(), e); } /** * 记录页面错误 * 错误日志记录 [page/eception][username][statusCode][errorMessage][servletName][uri][exceptionName][ip][exception] * * @param request */ public static void logPageError(HttpServletRequest request) { String username = getUsername(); Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code"); String message = (String) request.getAttribute("javax.servlet.error.message"); String uri = (String) request.getAttribute("javax.servlet.error.request_uri"); Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception"); if (statusCode == null) { statusCode = 0; } StringBuilder s = new StringBuilder(); s.append(getBlock(t == null ? "page" : "exception")); s.append(getBlock(username)); s.append(getBlock(statusCode)); s.append(getBlock(message)); s.append(getBlock(IpUtils.getIpAddr(request))); s.append(getBlock(uri)); s.append(getBlock(request.getHeader("Referer"))); StringWriter sw = new StringWriter(); while (t != null) { t.printStackTrace(new PrintWriter(sw)); t = t.getCause(); } s.append(getBlock(sw.toString())); getErrorLog().error(s.toString()); } public static String getBlock(Object msg) { if (msg == null) { msg = ""; } return "[" + msg.toString() + "]"; } protected static String getParams(HttpServletRequest request) { Map<String, String[]> params = request.getParameterMap(); return JSON.toJSONString(params); } private static String getHeaders(HttpServletRequest request) { Map<String, List<String>> headers = Maps.newHashMap(); Enumeration<String> namesEnumeration = request.getHeaderNames(); while(namesEnumeration.hasMoreElements()) { String name = namesEnumeration.nextElement(); Enumeration<String> valueEnumeration = request.getHeaders(name); List<String> values = Lists.newArrayList(); while(valueEnumeration.hasMoreElements()) { values.add(valueEnumeration.nextElement()); } headers.put(name, values); } return JSON.toJSONString(headers); } protected static String getUsername() { return (String) SecurityUtils.getSubject().getPrincipal(); } public static Logger getAccessLog() { return ACCESS_LOG; } public static Logger getErrorLog() { return ERROR_LOG; } }
[ "1069128287@qq.com" ]
1069128287@qq.com
ef6361998d0f65a100b6aeeda7382038ee4d21d8
926764a2e1f2a7b6220a91ed1f051bad03f8e345
/src/main/java/net/praqma/vcs/util/Cycle.java
75de8561927634d629d5b145627a2c812bb00955
[]
no_license
wolfgarnet/AbstractVcsApi
21f7225efa4ee6cd0d2d3349103d2d437e814a93
0289df7f20bdb26ecdd4ad649208ff3bbaf0e102
refs/heads/master
2021-01-17T22:18:00.916475
2012-06-16T16:04:41
2012-06-16T16:04:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,791
java
package net.praqma.vcs.util; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import java.util.List; import net.praqma.util.debug.Logger; import net.praqma.vcs.AVA; import net.praqma.vcs.model.AbstractBranch; import net.praqma.vcs.model.AbstractCommit; import net.praqma.vcs.model.AbstractReplay; import net.praqma.vcs.model.exceptions.UnableToCheckoutCommitException; import net.praqma.vcs.model.exceptions.UnableToReplayException; public class Cycle { private static Logger logger = Logger.getLogger(); public static void cycle( AbstractBranch branch, AbstractReplay replay, Integer interval ) throws UnableToCheckoutCommitException, UnableToReplayException, IOException, InterruptedException { cycle( branch, replay, interval, true ); } public static void cycle( AbstractBranch branch, AbstractReplay replay, Integer interval, boolean checkoutCommit ) throws UnableToCheckoutCommitException, UnableToReplayException, IOException, InterruptedException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); Date now = AVA.getInstance().getLastCommitDate( branch ); logger.debug( "LAST IS " + now ); Date before = null; while( true ) { if( now != null ) { logger.info( "Getting commits after " + now ); } /* Just to make sure, that now is really now, because we need now in getCommits, which can be lengthy */ before = new Date(); /* Retrieve all the latest changes for the source branch */ branch.update(); List<AbstractCommit> commits = branch.getCommits(false, now); for( int i = 0 ; i < commits.size() ; ++i ) { logger.info( "Commit " + ( i + 1 ) + "/" + commits.size() + ": " + commits.get( i ).getKey() ); /* Load the commit */ commits.get( i ).load(); branch.checkoutCommit( commits.get( i ) ); replay.replay( commits.get( i ) ); } /* Make now before */ now = before; AVA.getInstance().setLastCommitDate( branch, now ); if( interval != null ) { /* Interactive mode */ if( interval <= 0 ) { logger.info( "Press any key to continue" ); stdin.readLine(); } else { Thread.sleep( interval * 1000 ); } } else { /* Only one pass is needed */ return; } } } public static class Update implements Runnable { private List<AbstractCommit> commits; private AbstractBranch branch; private Date now; public Update( AbstractBranch branch, Date now ) { this.branch = branch; this.now = now; } public void run() { commits = branch.getCommits( false, now ); /* Update 'em */ for( AbstractCommit c : commits ) { c.load(); } } public List<AbstractCommit> getCommits() { return commits; } } }
[ "wolfgarnet@gmail.com" ]
wolfgarnet@gmail.com
106947f089fcd85040955277bdaca729963215ec
1913bb89853c848314f4ce43c0b49e3c0ac2b906
/src/product/inventory/Product.java
be3375efa39d4d2051c4d662f0fed8fdb2a12194
[]
no_license
jin-garcia/Product_Inventory
1e09e8e9d408f9f6bb47e17333ea2cf05db36a6e
63cc91e95f9bf7437bfc363adb874274ba70cd7c
refs/heads/master
2022-12-15T03:41:45.776570
2020-09-21T04:03:14
2020-09-21T04:03:14
297,004,906
0
0
null
null
null
null
UTF-8
Java
false
false
1,610
java
package product.inventory; //Class for the product. This class contains 4 elements: manufacturer, name, quantity and price. public class Product { //Declaration for privcate fields. These will represent the product's name, manufacturer, quantity, and price. private String name; private Double price; private Manufacturer manuFac; private int quantity; //Class constructor for product. public Product(String name, Double price, Manufacturer manuFac, int quantity) { this.name = name; this.price = price; this.manuFac = manuFac; this.quantity = quantity; } //Getter that returns product name. public String getName() { return name; } public Double getPrice() { return price; } public Manufacturer getManufacturer() { return manuFac; } public int getQuantity() { return quantity; } public void setName(String name) { this.name = name; } public void setPrice(Double price) { this.price = price; } public void setManufacturer(Manufacturer manuFac) { this.manuFac = manuFac; } public void setQuantity(int quantity) { this.quantity = quantity; } //Method for removing inventory from the quantity. public void sale(int numPurchased) { this.quantity -= numPurchased; } //Method for adding inventory to the product quantity. public void addInventory(int numAdd) { this.quantity += numAdd; } }
[ "13055@JG-MSI" ]
13055@JG-MSI
2a2cd747fd3cbc8685c2ddde06d6f03100d1b0ca
398b4828915e663544cacee4ad7305118b8e33ee
/src/model/ode/RK4Solver.java
901e340fa7b28c9ba6a08d0d494c0959474c15d3
[]
no_license
kgoba/HABPred
1930a0a0d06add641a2ecc90add6f01261b0c34f
c7bbb9aa5ac9601d84f11dd7f47c0244b4d38cec
refs/heads/master
2020-05-15T12:04:04.230240
2019-04-19T11:17:20
2019-04-19T11:17:20
182,253,364
1
0
null
null
null
null
UTF-8
Java
false
false
1,227
java
package model.ode; public class RK4Solver implements ODESolver { private double[] y; private double t; private double dtMax; private ODEProblem problem; public RK4Solver(ODEProblem problem, double maxTimestep) { this.dtMax = maxTimestep; this.problem = problem; reset(0); } @Override public void reset(double t0) { t = t0; y = problem.getInitialState(t0); } @Override public double[] solve(double t1) { while (t + dtMax < t1) { step(dtMax); } if (t1 - t > 0) { step(t1 - t); } return y; } private void step(double dt) { double[] ydot1 = problem.getDerivative(t, y); double[] y1 = y.clone(); for (int i = 0; i < y.length; i++) { y1[i] += ydot1[i] * dt / 2; } double[] y2 = y.clone(); double[] ydot2 = problem.getDerivative(t + dt/2, y1); for (int i = 0; i < y.length; i++) { y2[i] += ydot2[i] * dt / 2; } double[] y3 = y.clone(); double[] ydot3 = problem.getDerivative(t + dt/2, y2); for (int i = 0; i < y.length; i++) { y3[i] += ydot3[i] * dt; } double[] ydot4 = problem.getDerivative(t + dt, y3); for (int i = 0; i < y.length; i++) { y[i] += (ydot1[i] + 2 * ydot2[i] + 2 * ydot3[i] + ydot4[i]) * dt / 6; } t += dt; } }
[ "karlis.goba@live.com" ]
karlis.goba@live.com
a378c361ec40bb4743a0e9c1ea05eb368ac16bd5
70efcc03758e20c24b9b5b5bf77d8851a4027b50
/src/main/java/com/gdn/cc/designpattern/behavioral/command/CommandDesignPattern.java
a7e62dad75e4e129e7d6d1ad4cbe4fb562a50b2c
[]
no_license
felixwimpyw/design-pattern
d37050227ac00071220240f80c077321ec0e04b0
645511ca5c7c5b00b5997429b78b4a15e7b81e81
refs/heads/master
2022-11-20T02:30:33.660758
2019-10-11T07:19:34
2019-10-11T07:19:34
164,395,284
0
0
null
2022-11-16T11:47:39
2019-01-07T07:36:46
Java
UTF-8
Java
false
false
405
java
package com.gdn.cc.designpattern.behavioral.command; public class CommandDesignPattern { public CommandDesignPattern() { Stock abcStock = new Stock(); Order buyStockOrder = new BuyStock(abcStock); Order sellStockOrder = new SellStock(abcStock); Broker broker = new Broker(); broker.takeOrder(buyStockOrder); broker.takeOrder(sellStockOrder); broker.placeOrders(); } }
[ "felixwimpy@gmail.com" ]
felixwimpy@gmail.com
b32f2860f016d4ab626b0c550469bd10d070e978
af10e43252529568b7e83ee161165f52dc35bb0f
/services/payment-server/src/main/java/com/bsd/payment/server/enumm/RpcSignTypeEnum.java
4ca3c9e3e6c327d4f23daa3c799f180bf290f75d
[ "MIT" ]
permissive
footprintes/open-platform
e7bf80b41128b968846fa28d54d2b8a4b77c03d2
affac45dbac7aa03070eec31ca97c3ebf2dca03b
refs/heads/master
2022-04-10T17:31:03.201219
2020-04-03T04:58:28
2020-04-03T04:58:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.bsd.payment.server.enumm; /** * RPC通讯层签名计算方法枚举类 * * @author admin * @date 2016/5/4 */ public enum RpcSignTypeEnum { NOT_SIGN(0), SHA1_SIGN(1); private Integer code; private RpcSignTypeEnum(Integer code) { this.code = code; } public Integer getCode() { return this.code; } public static RpcSignTypeEnum getRpcSignTypeEnum(Integer code) { if (code == null) { return null; } RpcSignTypeEnum[] values = RpcSignTypeEnum.values(); for (RpcSignTypeEnum e : values) { if (e.getCode().equals(code)) { return e; } } return null; } }
[ "futustar@qq.com" ]
futustar@qq.com
9433fc5dcf1734ce54943384127dd8f23c1e1501
74707c79ef55ef56af6fc9048221c6575284f097
/src/test/java/nl/_42/qualityws/cleancode/shared/AbstractIntegrationTest.java
de2bd96905588634b2ef5d4d6f09d819fafdca1b
[]
no_license
42BV/quality-workshop-lisa
7480875c4440b5c9cf3463d6bb552f6666857117
955456d769a1c363c898f38f2ec091338c22da98
refs/heads/master
2020-07-20T05:16:27.820321
2017-06-21T13:03:58
2017-06-21T13:03:58
94,336,226
2
0
null
null
null
null
UTF-8
Java
false
false
668
java
package nl._42.qualityws.cleancode.shared; import nl._42.database.truncator.DatabaseTruncator; import org.junit.After; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @ActiveProfiles("test") @RunWith(SpringRunner.class) @SpringBootTest public abstract class AbstractIntegrationTest { @Autowired private DatabaseTruncator truncator; @After public void cleanUp() throws Exception { truncator.truncate(); } }
[ "bor.robert@gmail.com" ]
bor.robert@gmail.com
188bb2783493b1ffd492531c2841612732e42b84
72d624e56a15942355d3f34597eb5bd7e32f68fe
/src/eastyle/gopdefence/model/attack/MassPointAttack.java
5b81537d9e83f00d5013bffa49d37064b8979a83
[]
no_license
balakhonov/GameTD
c30115d6ef81bc900a50c62b64273b6055a230f2
301f440ea51c0e3293ab5875b1dcf5a4ba0e103d
refs/heads/master
2020-12-25T18:19:37.554645
2011-11-17T13:11:42
2011-11-17T13:11:42
2,409,623
3
0
null
null
null
null
UTF-8
Java
false
false
3,215
java
package eastyle.gopdefence.model.attack; import java.util.ArrayList; import org.anddev.andengine.entity.IEntity; import org.anddev.andengine.entity.sprite.Sprite; import eastyle.gopdefence.GameActivity; import eastyle.gopdefence.logic.Target; import eastyle.gopdefence.logic.Tower; import eastyle.gopdefence.view.GameZone; public class MassPointAttack implements AttackTypeInterface { public MassPointAttack() { } public void attack(final Tower tower, final Target target) { final float endX = target.getX(); final float endY = target.getY(); new Thread(new Runnable() { Sprite projectile = new Sprite(tower.getX(), tower.getY(), GameActivity.mBlueTargetTextureRegion); @Override public void run() { float step = 4; float boomRange = 200; projectile.setScale(0.4f); GameZone.gameMap.attachChild(projectile); GameZone.globalProjectile.add(projectile); while (true) { if (GameZone.isDestroy) break; try { // Thread.sleep(100); int sleepStep = 0; while (sleepStep < (100 / GameZone.gameSpeed)) { sleepStep += 5; Thread.sleep(5); // FIXME recount for stepsleep } if (projectile.getX() > endX) { projectile.setPosition(projectile.getX() - step, projectile.getY()); } if (projectile.getY() > endY) { projectile.setPosition(projectile.getX(), projectile.getY() - step); } if (projectile.getX() < endX) { projectile.setPosition(projectile.getX() + step, projectile.getY()); } if (projectile.getY() < endY) { projectile.setPosition(projectile.getX(), projectile.getY() + step); } if (Math.abs(projectile.getY() - endY) <= step && Math.abs(projectile.getX() - endX) <= step) { projectile.setAlpha(20); projectile.setScale(2); ArrayList<Target> targets = GameZone.globalTargets; // GameZone.globalTargets; for (Target _target : targets) { if (getDistance(projectile, _target) < boomRange) { _target.setHeals(_target.getHeals() - tower.getAttackDamage()); _target.viewHeals(); if (_target.getHeals() <= 0) { _target.killTarget(); if (target.isDestroied) { tower.setTargetCaptured(false); } } } } // Thread.sleep(200); sleepStep = 0; while (sleepStep < (200 / GameZone.gameSpeed)) { sleepStep += 5; GameZone.isPause(); Thread.sleep(5); } projectile.setVisible(false); break; } if (getDistance(target, tower) > tower.getAttackRange() || target.isDestroied) { tower.setTargetCaptured(false); } } catch (InterruptedException e) { e.printStackTrace(); } } //projectile.setVisible(false); } }).start(); } public float getDistance(final IEntity aTtower, final IEntity aTarget) { return (float) Math.sqrt(Math.pow((aTtower.getX() - aTarget.getX()), 2) + Math.pow((aTtower.getY() - aTarget.getY()), 2)); } @Override public void attackTarget(Tower tower, Target target) { attack(tower, target); } }
[ "rfanklaf@gmail.com" ]
rfanklaf@gmail.com
879b41db1228e83e161a7bebcbfd28ab280d3e53
75c5d070374aa680363f8e46f4bef91dfb0d49b3
/modulo5final/src/main/java/com/modulo5final/servicio/AccidentesServicioImpl.java
eba1cf6321b6ac8054cb7f08c088bd9fa2613ed7
[]
no_license
Alicepvilla/alicepvilla.github.io
232123b4ca0116c7e2a05ede39cbefe11a2cbd73
8bfaaac37a1f2d1211265f2ebe93e2d53ea61d69
refs/heads/master
2023-03-07T22:05:51.699653
2021-02-17T03:50:18
2021-02-17T03:50:18
339,598,835
0
0
null
null
null
null
UTF-8
Java
false
false
860
java
package com.modulo5final.servicio; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.modulo5final.modelo.Accidentes; import com.modulo5final.modelo.AccidentesRepositorio; @Service public class AccidentesServicioImpl implements AccidentesServicio{ @Autowired AccidentesRepositorio acci; @Override public Accidentes findAccidenteById(int idaccidente) { return acci.findOne(idaccidente); } @Override public List<Accidentes> listarAccidentes() { return (List<Accidentes>)acci.findAll(); } @Override public void agregarAccidente(Accidentes acc) { acci.save(acc); } @Override public void eliminarAccidente(int idaccidente) { acci.delete(idaccidente); } @Override public void editarAccidente(Accidentes ac) { acci.save(ac); } }
[ "alicia.villablanca@gmail.com" ]
alicia.villablanca@gmail.com
1cf309012f530ef4d0127096b3c28e62e37eaa3e
b631dd6a4c0ae1639677091c8b856941cbc7446c
/src/com/mvc/controller/loadMovies.java
8156f66897ea6e560e0f5bbbb792e4d97973cb75
[]
no_license
christianthomps/RETROCINEMA
185d2882da1f3684bea58d75a6af49ac8ec06c49
e61a691ba001e9044afe7acc81b1405b61b480ee
refs/heads/master
2020-04-08T23:49:55.572949
2018-12-03T01:22:38
2018-12-03T01:22:38
159,842,115
0
1
null
null
null
null
UTF-8
Java
false
false
2,400
java
package com.mvc.controller; import java.util.Collections; import java.util.Enumeration; import java.lang.String; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; public class loadMovies extends HttpServlet { public loadMovies() { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Movie movie = new Movie(); ArrayList<Movie> movies = movie.retrieveMoviesBasedOnStatus(1); ArrayList<String> movieHTML = new ArrayList<>(); int i = 0; String HTML; String allContent = ""; for(Movie m : movies){ HTML = "<form action=\"loadMovieInfo\" method=\"post\">" + "<div class=\"item\" id=\"movie" + i + "\">" + "<img class=\"moviePoster\" src=\"" + m.getTrailerPicLink() + "\">" + "<div class=\"movieTitleLink\">" + "<input type=\"hidden\" value=\"" + m.getTitle() + "\">" + m.getTitle() + "<br>" + "<button class=\"selectMovieButton\" type=\"submit\" name=\"" + m.getTitle() + "\" action=\"loadMovieInfo\">Select</button>" + "</div>" + "</div>" + "</form>"; movieHTML.add(HTML); i++; } for(String H : movieHTML){ allContent += H; } request.setAttribute("HTML", allContent); //Movie movie1 = movies.get(0); //request.setAttribute("movie1", movie1); /* Movie movie2 = movies.get(1); Movie movie3 = movies.get(2); Movie movie4 = movies.get(3); Movie movie5 = movies.get(4); request.setAttribute("movie2", movie2); request.setAttribute("movie3", movie3); request.setAttribute("movie4", movie4); request.setAttribute("movie5", movie5); */ RequestDispatcher rd = request.getRequestDispatcher("Browse.jsp"); rd.forward(request,response); } }
[ "clt61479@uga.edu" ]
clt61479@uga.edu
554ba06ae6553530180e600123568072429a7d87
a1786abb09217499f3110b257304bac52294a974
/src/robot/Place.java
b01c104acf8e68914257763c121cc92ee330a26d
[]
no_license
zhuohanl/Robot
9b12444ecc184ac6402ac711222ec155c907f02c
51267dd121a2c4bc37a58a7b8f135de6bcb48674
refs/heads/master
2021-04-26T22:58:07.031726
2018-03-05T10:43:28
2018-03-05T10:43:28
123,905,030
0
0
null
null
null
null
UTF-8
Java
false
false
3,086
java
/* * This is class for PLACE */ package robot; /** * * @author selinali */ public class Place { //fields public int x; public int y; public String face; //constructor public Place() { } public Place(int x, int y, String face) { this.x = x; this.y = y; this.face = face; } //getter and setter public int getX() { return x; } public int getY() { return y; } public String getFace() { return face; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void setFace(String face) { this.face = face; } @Override public String toString() { // return "Place{" + "x=" + x + ", y=" + y + ", face=" + face.toUpperCase() + '}'; return x + "," + y + "," + face.toUpperCase(); } public void report() { System.out.println("Output: " + this); } public void move() { int increment = 1; int min = 0; int max = 5; if (this.face.toLowerCase().equals("north")) { int newY = this.y + increment; if (newY >= min && newY <= max) { this.setY(newY); } else { this.reportFall(); } } else if (this.face.toLowerCase().equals("south")) { int newY = this.y - increment; if (newY >= min && newY <= max) { this.setY(newY); } else { this.reportFall(); } } else if (this.face.toLowerCase().equals("west")) { int newX = this.x - increment; if (newX >= min && newX <= max) { this.setX(newX); } else { this.reportFall(); } } else if (this.face.toLowerCase().equals("east")) { int newX = this.x + increment; if (newX >= min && newX <= max) { this.setX(newX); } else { this.reportFall(); } } } public void toLeft() { if (this.face.toLowerCase().equals("north")) { this.setFace("west"); } else if (this.face.toLowerCase().equals("west")) { this.setFace("south"); } else if (this.face.toLowerCase().equals("south")) { this.setFace("east"); } else if (this.face.toLowerCase().equals("east")) { this.setFace("north"); } } public void toRight() { if (this.face.toLowerCase().equals("north")) { this.setFace("east"); } else if (this.face.toLowerCase().equals("east")) { this.setFace("south"); } else if (this.face.toLowerCase().equals("south")) { this.setFace("west"); } else if (this.face.toLowerCase().equals("west")) { this.setFace("north"); } } public void reportFall() { System.out.println("Action prevented as the robot will fall out of the table"); } }
[ "lizhuohang.selina@gmail.com" ]
lizhuohang.selina@gmail.com
01d2d9374d23189950e005a22f515bb0595ba126
c3381ece1e660f2d626480152349262a511aefb5
/icefrog-collections/src/main/java/com/whaleal/icefrog/collections/LinkedListMultimap.java
d20133b88f8f8878958b1c47a9def764ba6c4f33
[ "Apache-2.0" ]
permissive
whaleal/icefrog
775e02be5b2fc8d04df1dd490aa765232cb0e6a4
c8dc384a3de1ed17077ff61ba733b1e2f37e32ab
refs/heads/v1-dev
2022-07-27T01:27:52.624849
2022-06-20T13:38:12
2022-06-20T13:38:12
414,203,703
9
5
Apache-2.0
2022-06-20T14:08:57
2021-10-06T12:30:31
Java
UTF-8
Java
false
false
29,522
java
package com.whaleal.icefrog.collections; import com.whaleal.icefrog.core.collection.ListUtil; import com.whaleal.icefrog.core.map.MapUtil; import com.whaleal.icefrog.core.util.FunctionUtil; import javax.annotation.CheckForNull; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.*; import java.util.Map.Entry; import java.util.function.Consumer; import static com.whaleal.icefrog.core.lang.Precondition.*; import static java.util.Collections.unmodifiableList; import static java.util.Objects.requireNonNull; /** * An implementation of {@code ListMultimap} that supports deterministic iteration order for both * keys and values. The iteration order is preserved across non-distinct key values. For example, * for the following multimap definition: * * <pre>{@code * Multimap<K, V> multimap = LinkedListMultimap.create(); * multimap.put(key1, foo); * multimap.put(key2, bar); * multimap.put(key1, baz); * }</pre> * <p> * ... the iteration order for {@link #keys()} is {@code [key1, key2, key1]}, and similarly for * {@link #entries()}. Unlike {@link LinkedHashMultimap}, the iteration order is kept consistent * between keys, entries and values. For example, calling: * * <pre>{@code * multimap.remove(key1, foo); * }</pre> * * <p>changes the entries iteration order to {@code [key2=bar, key1=baz]} and the key iteration * order to {@code [key2, key1]}. The {@link #entries()} iterator returns mutable map entries, and * {@link #replaceValues} attempts to preserve iteration order as much as possible. * * <p>The collections returned by {@link #keySet()} and iterate through the keys in * the order they were first added to the multimap. Similarly, {@link #get}, {@link #removeAll}, and * {@link #replaceValues} return collections that iterate through the values in the order they were * added. The collections generated by {@link #entries()}, {@link #keys()}, and * iterate across the key-value mappings in the order they were added to the multimap. * * <p>The {@link #values()} and {@link #entries()} methods both return a {@code List}, instead of * the {@code Collection} specified by the {@link ListMultimap} interface. * * <p>The methods {@link #get}, {@link #keySet()}, {@link #keys()}, , {@link * #entries()}, and return collections that are views of the multimap. If the * multimap is modified while an iteration over any of those collections is in progress, except * through the iterator's methods, the results of the iteration are undefined. * * <p>Keys and values may be null. All optional multimap methods are supported, and all returned * views are modifiable. * * <p>This class is not threadsafe when any concurrent operations update the multimap. Concurrent * read operations will work correctly. To allow concurrent update operations, wrap your multimap * with a call to {@link Multimaps#synchronizedListMultimap}. * * <p>See the Guava User Guide article on <a href= * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#multimap"> {@code * Multimap}</a>. */ public class LinkedListMultimap<K extends Object, V extends Object> extends AbstractMultimap<K, V> implements ListMultimap<K, V>, Serializable { /* * Order is maintained using a linked list containing all key-value pairs. In * addition, a series of disjoint linked lists of "siblings", each containing * the values for a specific key, is used to implement {@link * ValueForKeyIterator} in constant time. */ // java serialization not supported private static final long serialVersionUID = 0; @CheckForNull private transient Node<K, V> head; // the head for all keys @CheckForNull private transient Node<K, V> tail; // the tail for all keys private transient Map<K, KeyList<K, V>> keyToKeyList; private transient int size; /* * Tracks modifications to keyToKeyList so that addition or removal of keys invalidates * preexisting iterators. This does *not* track simple additions and removals of values * that are not the first to be added or last to be removed for their key. */ private transient int modCount; LinkedListMultimap() { this(12); } private LinkedListMultimap( int expectedKeys ) { keyToKeyList = Platform.newHashMap(expectedKeys); } private LinkedListMultimap( Multimap<? extends K, ? extends V> multimap ) { this(multimap.keySet().size()); putAll(multimap); } /** * Creates a new, empty {@code LinkedListMultimap} with the default initial capacity. */ public static <K extends Object, V extends Object> LinkedListMultimap<K, V> create() { return new LinkedListMultimap<>(); } /** * Constructs an empty {@code LinkedListMultimap} with enough capacity to hold the specified * number of keys without rehashing. * * @param expectedKeys the expected number of distinct keys * @throws IllegalArgumentException if {@code expectedKeys} is negative */ public static <K extends Object, V extends Object> LinkedListMultimap<K, V> create( int expectedKeys ) { return new LinkedListMultimap<>(expectedKeys); } /** * Constructs a {@code LinkedListMultimap} with the same mappings as the specified {@code * Multimap}. The new multimap has the same {@link Multimap#entries()} iteration order as the * input multimap. * * @param multimap the multimap whose contents are copied to this multimap */ public static <K extends Object, V extends Object> LinkedListMultimap<K, V> create( Multimap<? extends K, ? extends V> multimap ) { return new LinkedListMultimap<>(multimap); } /** * Adds a new node for the specified key-value pair before the specified {@code nextSibling} * element, or at the end of the list if {@code nextSibling} is null. Note: if {@code nextSibling} * is specified, it MUST be for an node for the same {@code key}! */ private Node<K, V> addNode( @ParametricNullness K key, @ParametricNullness V value, @CheckForNull Node<K, V> nextSibling ) { Node<K, V> node = new Node<>(key, value); if (head == null) { // empty list head = tail = node; keyToKeyList.put(key, new KeyList<K, V>(node)); modCount++; } else if (nextSibling == null) { // non-empty list, add to tail // requireNonNull is safe because the list is non-empty. requireNonNull(tail).next = node; node.previous = tail; tail = node; KeyList<K, V> keyList = keyToKeyList.get(key); if (keyList == null) { keyToKeyList.put(key, keyList = new KeyList<>(node)); modCount++; } else { keyList.count++; Node<K, V> keyTail = keyList.tail; keyTail.nextSibling = node; node.previousSibling = keyTail; keyList.tail = node; } } else { // non-empty list, insert before nextSibling /* * requireNonNull is safe as long as callers pass a nextSibling that (a) has the same key and * (b) is present in the multimap. (And they do, except maybe in case of concurrent * modification, in which case all bets are off.) */ KeyList<K, V> keyList = requireNonNull(keyToKeyList.get(key)); keyList.count++; node.previous = nextSibling.previous; node.previousSibling = nextSibling.previousSibling; node.next = nextSibling; node.nextSibling = nextSibling; if (nextSibling.previousSibling == null) { // nextSibling was key head keyList.head = node; } else { nextSibling.previousSibling.nextSibling = node; } if (nextSibling.previous == null) { // nextSibling was head head = node; } else { nextSibling.previous.next = node; } nextSibling.previous = node; nextSibling.previousSibling = node; } size++; return node; } /** * Removes the specified node from the linked list. This method is only intended to be used from * the {@code Iterator} classes. See also {@link LinkedListMultimap#removeAllNodes(Object)}. */ private void removeNode( Node<K, V> node ) { if (node.previous != null) { node.previous.next = node.next; } else { // node was head head = node.next; } if (node.next != null) { node.next.previous = node.previous; } else { // node was tail tail = node.previous; } if (node.previousSibling == null && node.nextSibling == null) { /* * requireNonNull is safe as long as we call removeNode only for nodes that are still in the * Multimap. This should be the case (except in case of concurrent modification, when all bets * are off). */ KeyList<K, V> keyList = requireNonNull(keyToKeyList.remove(node.key)); keyList.count = 0; modCount++; } else { // requireNonNull is safe (under the conditions listed in the comment in the branch above). KeyList<K, V> keyList = requireNonNull(keyToKeyList.get(node.key)); keyList.count--; if (node.previousSibling == null) { // requireNonNull is safe because we checked that not *both* siblings were null. keyList.head = requireNonNull(node.nextSibling); } else { node.previousSibling.nextSibling = node.nextSibling; } if (node.nextSibling == null) { // requireNonNull is safe because we checked that not *both* siblings were null. keyList.tail = requireNonNull(node.previousSibling); } else { node.nextSibling.previousSibling = node.previousSibling; } } size--; } /** * Removes all nodes for the specified key. */ private void removeAllNodes( @ParametricNullness K key ) { Iterators.clear(new ValueForKeyIterator(key)); } @Override public int size() { return size; } @Override public boolean isEmpty() { return head == null; } @Override public boolean containsKey( @CheckForNull Object key ) { return keyToKeyList.containsKey(key); } @Override public boolean containsValue( @CheckForNull Object value ) { return values().contains(value); } // Query Operations /** * Stores a key-value pair in the multimap. * * @param key key to store in the multimap * @param value value to store in the multimap * @return {@code true} always */ @Override public boolean put( @ParametricNullness K key, @ParametricNullness V value ) { addNode(key, value, null); return true; } /** * {@inheritDoc} * * <p>If any entries for the specified {@code key} already exist in the multimap, their values are * changed in-place without affecting the iteration order. * * <p>The returned list is immutable and implements {@link java.util.RandomAccess}. */ @Override public List<V> replaceValues( @ParametricNullness K key, Iterable<? extends V> values ) { List<V> oldValues = getCopy(key); ListIterator<V> keyValues = new ValueForKeyIterator(key); Iterator<? extends V> newValues = values.iterator(); // Replace existing values, if any. while (keyValues.hasNext() && newValues.hasNext()) { keyValues.next(); keyValues.set(newValues.next()); } // Remove remaining old values, if any. while (keyValues.hasNext()) { keyValues.next(); keyValues.remove(); } // Add remaining new values, if any. while (newValues.hasNext()) { keyValues.add(newValues.next()); } return oldValues; } private List<V> getCopy( @ParametricNullness K key ) { return unmodifiableList(ListUtil.list(false, new ValueForKeyIterator(key))); } /** * {@inheritDoc} * * <p>The returned list is immutable and implements {@link java.util.RandomAccess}. */ @Override public List<V> removeAll( Object key ) { /* * Safe because all we do is remove values for the key, not add them. (If we wanted to make sure * to call getCopy and removeAllNodes only with a true K, then we could check containsKey first. * But that check wouldn't eliminate the warnings.) */ @SuppressWarnings({"unchecked", "nullness"}) K castKey = (K) key; List<V> oldValues = getCopy(castKey); removeAllNodes(castKey); return oldValues; } // Modification Operations @Override public void clear() { head = null; tail = null; keyToKeyList.clear(); size = 0; modCount++; } // Bulk Operations /** * {@inheritDoc} * * <p>If the multimap is modified while an iteration over the list is in progress (except through * the iterator's own {@code add}, {@code set} or {@code remove} operations) the results of the * iteration are undefined. * * <p>The returned list is not serializable and does not have random access. */ @Override public List<V> get( @ParametricNullness final K key ) { return new AbstractSequentialList<V>() { @Override public int size() { KeyList<K, V> keyList = keyToKeyList.get(key); return (keyList == null) ? 0 : keyList.count; } @Override public ListIterator<V> listIterator( int index ) { return new ValueForKeyIterator(key, index); } }; } @Override Set<K> createKeySet() { class KeySetImpl extends SetUtil.ImprovedAbstractSet<K> { @Override public int size() { return keyToKeyList.size(); } @Override public Iterator<K> iterator() { return new DistinctKeyIterator(); } @Override public boolean contains( @CheckForNull Object key ) { // for performance return containsKey(key); } @Override public boolean remove( @CheckForNull Object o ) { // for performance return !LinkedListMultimap.this.removeAll(o).isEmpty(); } } return new KeySetImpl(); } @Override Multiset<K> createKeys() { return new Multimaps.Keys<K, V>(this); } /** * {@inheritDoc} * * <p>The iterator generated by the returned collection traverses the values in the order they * were added to the multimap. Because the values may have duplicates and follow the insertion * ordering, this method returns a {@link List}, instead of the {@link Collection} specified in * the {@link ListMultimap} interface. */ @Override public List<V> values() { return (List<V>) super.values(); } // Views @Override List<V> createValues() { class ValuesImpl extends AbstractSequentialList<V> { @Override public int size() { return size; } @Override public ListIterator<V> listIterator( int index ) { final NodeIterator nodeItr = new NodeIterator(index); return new com.whaleal.icefrog.core.collection.TransListIter<Entry<K, V>, V>(nodeItr,x->x.getValue()){ @Override public void set( @ParametricNullness V value ) { nodeItr.setValue(value); } }; } } return new ValuesImpl(); } /** * {@inheritDoc} * * <p>The iterator generated by the returned collection traverses the entries in the order they * were added to the multimap. Because the entries may have duplicates and follow the insertion * ordering, this method returns a {@link List}, instead of the {@link Collection} specified in * the {@link ListMultimap} interface. * * <p>An entry's {@link Entry#getKey} method always returns the same key, regardless of what * happens subsequently. As long as the corresponding key-value mapping is not removed from the * multimap, {@link Entry#getValue} returns the value from the multimap, which may change over * time, and {@link Entry#setValue} modifies that value. Removing the mapping from the multimap * does not alter the value returned by {@code getValue()}, though a subsequent {@code setValue()} * call won't update the multimap but will lead to a revised value being returned by {@code * getValue()}. */ @Override public List<Entry<K, V>> entries() { return (List<Entry<K, V>>) super.entries(); } @Override List<Entry<K, V>> createEntries() { class EntriesImpl extends AbstractSequentialList<Entry<K, V>> { @Override public int size() { return size; } @Override public ListIterator<Entry<K, V>> listIterator( int index ) { return new NodeIterator(index); } @Override public void forEach( Consumer<? super Entry<K, V>> action ) { checkNotNull(action); for (Node<K, V> node = head; node != null; node = node.next) { action.accept(node); } } } return new EntriesImpl(); } @Override Iterator<Entry<K, V>> entryIterator() { throw new AssertionError("should never be called"); } @Override Map<K, Collection<V>> createAsMap() { return new Multimaps.AsMap<>(this); } /** * @serialData the number of distinct keys, and then for each distinct key: the first key, the * number of values for that key, and the key's values, followed by successive keys and values * from the entries() ordering */ // java.io.ObjectOutputStream private void writeObject( ObjectOutputStream stream ) throws IOException { stream.defaultWriteObject(); stream.writeInt(size()); for (Entry<K, V> entry : entries()) { stream.writeObject(entry.getKey()); stream.writeObject(entry.getValue()); } } // java.io.ObjectInputStream private void readObject( ObjectInputStream stream ) throws IOException, ClassNotFoundException { stream.defaultReadObject(); keyToKeyList = MapUtil.newHashMap(true); int size = stream.readInt(); for (int i = 0; i < size; i++) { @SuppressWarnings("unchecked") // reading data stored by writeObject K key = (K) stream.readObject(); @SuppressWarnings("unchecked") // reading data stored by writeObject V value = (V) stream.readObject(); put(key, value); } } private static final class Node<K extends Object, V extends Object> extends AbstractMapEntry<K, V> { @ParametricNullness final K key; @ParametricNullness V value; @CheckForNull Node<K, V> next; // the next node (with any key) @CheckForNull Node<K, V> previous; // the previous node (with any key) @CheckForNull Node<K, V> nextSibling; // the next node with the same key @CheckForNull Node<K, V> previousSibling; // the previous node with the same key Node( @ParametricNullness K key, @ParametricNullness V value ) { this.key = key; this.value = value; } @Override @ParametricNullness public K getKey() { return key; } @Override @ParametricNullness public V getValue() { return value; } @Override @ParametricNullness public V setValue( @ParametricNullness V newValue ) { V result = value; this.value = newValue; return result; } } private static class KeyList<K extends Object, V extends Object> { Node<K, V> head; Node<K, V> tail; int count; KeyList( Node<K, V> firstNode ) { this.head = firstNode; this.tail = firstNode; firstNode.previousSibling = null; firstNode.nextSibling = null; this.count = 1; } } /** * An {@code Iterator} over all nodes. */ private class NodeIterator implements ListIterator<Entry<K, V>> { int nextIndex; @CheckForNull Node<K, V> next; @CheckForNull Node<K, V> current; @CheckForNull Node<K, V> previous; int expectedModCount = modCount; NodeIterator( int index ) { int size = size(); checkPositionIndex(index, size); if (index >= (size / 2)) { previous = tail; nextIndex = size; while (index++ < size) { previous(); } } else { next = head; while (index-- > 0) { next(); } } current = null; } private void checkForConcurrentModification() { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); } } @Override public boolean hasNext() { checkForConcurrentModification(); return next != null; } @Override public Node<K, V> next() { checkForConcurrentModification(); if (next == null) { throw new NoSuchElementException(); } previous = current = next; next = next.next; nextIndex++; return current; } @Override public void remove() { checkForConcurrentModification(); checkState(current != null, "no calls to next() since the last call to remove()"); if (current != next) { // after call to next() previous = current.previous; nextIndex--; } else { // after call to previous() next = current.next; } removeNode(current); current = null; expectedModCount = modCount; } @Override public boolean hasPrevious() { checkForConcurrentModification(); return previous != null; } @Override public Node<K, V> previous() { checkForConcurrentModification(); if (previous == null) { throw new NoSuchElementException(); } next = current = previous; previous = previous.previous; nextIndex--; return current; } @Override public int nextIndex() { return nextIndex; } @Override public int previousIndex() { return nextIndex - 1; } @Override public void set( Entry<K, V> e ) { throw new UnsupportedOperationException(); } @Override public void add( Entry<K, V> e ) { throw new UnsupportedOperationException(); } void setValue( @ParametricNullness V value ) { checkState(current != null); current.value = value; } } /** * An {@code Iterator} over distinct keys in key head order. */ private class DistinctKeyIterator implements Iterator<K> { final Set<K> seenKeys = SetUtil.newHashSetWithExpectedSize(keySet().size()); @CheckForNull Node<K, V> next = head; @CheckForNull Node<K, V> current; int expectedModCount = modCount; private void checkForConcurrentModification() { if (modCount != expectedModCount) { throw new ConcurrentModificationException(); } } @Override public boolean hasNext() { checkForConcurrentModification(); return next != null; } @Override @ParametricNullness public K next() { checkForConcurrentModification(); if (next == null) { throw new NoSuchElementException(); } current = next; seenKeys.add(current.key); do { // skip ahead to next unseen key next = next.next; } while ((next != null) && !seenKeys.add(next.key)); return current.key; } @Override public void remove() { checkForConcurrentModification(); checkState(current != null, "no calls to next() since the last call to remove()"); removeAllNodes(current.key); current = null; expectedModCount = modCount; } } /** * A {@code ListIterator} over values for a specified key. */ private class ValueForKeyIterator implements ListIterator<V> { @ParametricNullness final K key; int nextIndex; @CheckForNull Node<K, V> next; @CheckForNull Node<K, V> current; @CheckForNull Node<K, V> previous; /** * Constructs a new iterator over all values for the specified key. */ ValueForKeyIterator( @ParametricNullness K key ) { this.key = key; KeyList<K, V> keyList = keyToKeyList.get(key); next = (keyList == null) ? null : keyList.head; } /** * Constructs a new iterator over all values for the specified key starting at the specified * index. This constructor is optimized so that it starts at either the head or the tail, * depending on which is closer to the specified index. This allows adds to the tail to be done * in constant time. * * @throws IndexOutOfBoundsException if index is invalid */ public ValueForKeyIterator( @ParametricNullness K key, int index ) { KeyList<K, V> keyList = keyToKeyList.get(key); int size = (keyList == null) ? 0 : keyList.count; checkPositionIndex(index, size); if (index >= (size / 2)) { previous = (keyList == null) ? null : keyList.tail; nextIndex = size; while (index++ < size) { previous(); } } else { next = (keyList == null) ? null : keyList.head; while (index-- > 0) { next(); } } this.key = key; current = null; } @Override public boolean hasNext() { return next != null; } @Override @ParametricNullness public V next() { if (next == null) { throw new NoSuchElementException(); } previous = current = next; next = next.nextSibling; nextIndex++; return current.value; } @Override public boolean hasPrevious() { return previous != null; } @Override @ParametricNullness public V previous() { if (previous == null) { throw new NoSuchElementException(); } next = current = previous; previous = previous.previousSibling; nextIndex--; return current.value; } @Override public int nextIndex() { return nextIndex; } @Override public int previousIndex() { return nextIndex - 1; } @Override public void remove() { checkState(current != null, "no calls to next() since the last call to remove()"); if (current != next) { // after call to next() previous = current.previousSibling; nextIndex--; } else { // after call to previous() next = current.nextSibling; } removeNode(current); current = null; } @Override public void set( @ParametricNullness V value ) { checkState(current != null); current.value = value; } @Override public void add( @ParametricNullness V value ) { previous = addNode(key, value, next); nextIndex++; current = null; } } }
[ "hbn.king@gmail.com" ]
hbn.king@gmail.com
44bc8d60c6aa22dfa5367d16950a66d20e12212b
2bf3206c45fb9cc967d6d271fb7a896720a61558
/src-tutorial/de/jreality/tutorial/intro/Intro02.java
33aac1383a484ea1b82ef4d097270addc938fb6f
[]
no_license
jpginc/csse3002-java
736e6163d789ab10d31f00675d893c149f257333
d9ead8964e8782e75fcce2e1a4889baebea89b7b
refs/heads/master
2016-09-06T19:26:07.601557
2015-06-03T15:17:00
2015-06-03T15:17:00
34,435,177
2
1
null
2015-05-12T13:11:22
2015-04-23T05:13:53
Java
UTF-8
Java
false
false
1,120
java
package de.jreality.tutorial.intro; import java.io.IOException; import java.net.URL; import de.jreality.plugin.JRViewer; import de.jreality.reader.Readers; import de.jreality.scene.SceneGraphComponent; import de.jreality.util.Input; /** * This class contains the second in a series of 8 simple introductory examples which mimic the * functionality of the * <a href="http://www3.math.tu-berlin.de/jreality/mediawiki/index.php/User_Tutorial"> jReality User Tutorial *</a>. ViewerApp with dodecahedron, navigator, and bean shell. * * @author Charles Gunn * */ public class Intro02 { public static void main(String[] args) { JRViewer.display(readDodec()); } private static SceneGraphComponent readDodec() { URL url = Intro02.class.getResource("dodec.off"); SceneGraphComponent sgc = null; try { sgc = Readers.read(Input.getInput(url)); // alternative to access the file as a URL // sgc = Readers.read(Input.getInput("http://www3.math.tu-berlin.de/jreality/download/data/dodec.off")); sgc.setName("Dodecahedron"); } catch (IOException e) { e.printStackTrace(); } return sgc; } }
[ "joshua.graham@jpginc.com.au" ]
joshua.graham@jpginc.com.au
d671b271f0faf08bf6522b7988690aa4a56ae83e
5283a4b4c8b1d710e0eff8ff0b1538a4e89ae164
/Simulado1_FrotaVeiculos/Frota.java
f55f86d18b4a88e2c3cc8741cae6e932e4bb39f8
[]
no_license
ateixeiraleal/PPOO_20182
f302e8d641e3de5db70f752cda4bd86d2734ce13
edc379d21603a467cc22beb8febe4a0506fd2e2f
refs/heads/master
2023-03-28T09:03:40.518323
2021-03-30T20:13:55
2021-03-30T20:13:55
353,027,461
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
import java.util.ArrayList; public class Frota { ArrayList<Veiculo> frota; public Frota() { this.frota = new ArrayList<Veiculo>(); } public void adicionarVeiculo(Veiculo v) { frota.add(v); } public void exibirVeiculos() { for(Veiculo v: frota) { System.out.println(v.toString()); } } }
[ "andersonpains@yahoo.com.br" ]
andersonpains@yahoo.com.br
435fca36520da970506d96ec8254c8579f490dd5
2794128d7d747171f421307608ed4508d8fa156a
/ExtraTorches/common/quickie/spyobird/ExtraTorches/ExtraTorches.java
7776079af43d34d7ff054941a0decb77fb67e856
[]
no_license
Spyobird/QuickieMods
7403821c18c8b9cf203dd3e65e159513113d14eb
a902240612b1cac9784336e08ed8fd8033b7a034
refs/heads/master
2021-01-13T02:36:01.534741
2013-10-04T11:16:28
2013-10-04T11:16:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,135
java
package quickie.spyobird.ExtraTorches; import net.minecraft.block.Block; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "ExtraTorches", name = "Extra Torches", version = "1.0.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class ExtraTorches { @Instance("ExtraTorches") public static ExtraTorches instance; public static Block GlowstoneTorch; @EventHandler public void load(FMLInitializationEvent event) { GlowstoneTorch = new BlockGlowstoneTorch(2048); GameRegistry.registerBlock(GlowstoneTorch, "GlowstoneTorch"); } @EventHandler public static void load(FMLPostInitializationEvent event) { LanguageRegistry.addName(GlowstoneTorch, "Glowstone Torch"); } }
[ "elliotlimzy@gmail.com" ]
elliotlimzy@gmail.com
75b364290d3faf7c693ef02b0ed69221fe2095fe
e679e9f563cef53abcbc956ea7d966fd181fe170
/src/eap-common/src/main/java/com/mk/eap/common/utils/AuthorizedInterceptor.java
dce8a21a3513127f4ad89f1f33299b9b8c3daf9b
[ "MIT" ]
permissive
mk-js/mk-eap
312d25ca9100fdbd6e655514868fbb669a5462f5
e2dca4a0dfc252ed99347170813e64e4fcf12dde
refs/heads/master
2020-04-12T22:00:45.334523
2018-12-27T08:55:04
2018-12-27T08:55:04
162,778,800
0
0
null
null
null
null
UTF-8
Java
false
false
4,210
java
package com.mk.eap.common.utils; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import com.alibaba.fastjson.JSON; import com.mk.eap.common.domain.ApiResult; import com.mk.eap.common.domain.BusinessException; public class AuthorizedInterceptor extends HandlerInterceptorAdapter { private final Logger log = LoggerFactory.getLogger(AuthorizedInterceptor.class); @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { //log.info("==============执行顺序: 3、afterCompletion================"); super.afterCompletion(request, response, handler, ex); } @Override public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { super.afterConcurrentHandlingStarted(request, response, handler); } /** * 在业务处理器处理请求执行完成后,生成视图之前执行的动作 * 可在modelAndView中加入数据,比如当前时间 */ @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { /*log.info("==============执行顺序: 2、postHandle================"); if(modelAndView != null){ //加入当前时间 modelAndView.addObject("var", "测试postHandle"); } */ super.postHandle(request, response, handler, modelAndView); } /** * 在业务处理器处理请求之前被调用 * 如果返回false * 从当前的拦截器往回执行所有拦截器的afterCompletion(),再退出拦截器链 * 如果返回true * 执行下一个拦截器,直到所有的拦截器都执行完毕 * 再执行被拦截的Controller * 然后进入拦截器链, * 从最后一个拦截器往回执行所有的postHandle() * 接着再从最后一个拦截器往回执行所有的afterCompletion() */ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { ApiResult result = null; String token = request.getHeader("token"); if(token == null){ token = request.getParameter("token"); } if(token == null){ token = request.getHeader("access_token"); } if(token == null){ token = request.getParameter("access_token"); } if(!StringUtil.isEmtryStr(token)){ try{ List<Long> ids= StringTokenizer.Default.getIdsArray(token); //[userId,orgId,versionId,appId,extId] Long userId = ids.get(0), orgId = ids.get(1), versionId =ids.get(2), appId = null , extId = null; Long version = VersionUtil.getVersionLong(); if(version!=null && !versionId.equals(-1L) && !versionId.equals(version)){ throw BusinessException.ServerVersionChanged.setData(VersionUtil.getVersion()); } if(ids.size()>3){ appId = ids.get(3); extId = ids.get(3);//兼容移动端 } if(ids.size()>4){ extId = ids.get(4); } request.getSession().setAttribute("userId",userId); request.getSession().setAttribute("orgId",orgId); request.getSession().setAttribute("appId",appId); request.getSession().setAttribute("extId",extId); }catch(Exception ex){ result = new ApiResult(); result.setError(ex); } }else{ // 定义返回对象 result = new ApiResult(); result.setValue(false); result.setError(BusinessException.UnLoginedException); } if(result != null){ //返回 response.setCharacterEncoding("UTF-8"); response.getWriter().print(JSON.toJSONString(result.getResult())); return false; } return super.preHandle(request, response, handler); } }
[ "lsg@rrtimes.com" ]
lsg@rrtimes.com
5f50032c5c3f20cfa3f39f4bfeba1cf5ed12058d
420243e4b6ed45656a4440b6734690ff3a13cdb1
/src/main/java/com/kwgdev/brewery/microbeerorderservice/domain/BeerOrder.java
c7136a01a46309265e810aa0ae3e81462d18643e
[]
no_license
kawgh1/micro-beer-order-service
a9ac7dcf7bace0ab3853035d4b879848893c4320
a77648e512aebebc0b2ba22c0adc9f32e4856eb5
refs/heads/master
2023-02-19T21:37:56.041145
2021-01-18T14:39:44
2021-01-18T14:39:44
329,754,639
0
0
null
null
null
null
UTF-8
Java
false
false
1,542
java
package com.kwgdev.brewery.microbeerorderservice.domain; /** * created by kw on 1/14/2021 @ 7:20 PM */ import lombok.*; import org.hibernate.annotations.*; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.*; import java.sql.Timestamp; import java.util.Set; import java.util.UUID; /** * Created by jt on 2019-01-26. */ @Getter @Setter @Entity @ToString @NoArgsConstructor @AllArgsConstructor @Builder @Proxy(lazy = false) public class BeerOrder { @Id @GeneratedValue(generator = "UUID") @GenericGenerator( name = "UUID", strategy = "org.hibernate.id.UUIDGenerator" ) @Type(type="org.hibernate.type.UUIDCharType") @Column(length = 36, columnDefinition = "varchar(36)", updatable = false, nullable = false ) private UUID id; @Version private Long version; @CreationTimestamp @Column(updatable = false) private Timestamp createdDate; @UpdateTimestamp private Timestamp lastModifiedDate; public boolean isNew() { return this.id == null; } private String customerRef; @ManyToOne(fetch = FetchType.EAGER) @Fetch(FetchMode.JOIN) private Customer customer; @OneToMany(mappedBy = "beerOrder", cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) @Fetch(FetchMode.JOIN) private Set<BeerOrderLine> beerOrderLines; @Enumerated(EnumType.STRING) private BeerOrderStatusEnum orderStatus = BeerOrderStatusEnum.NEW; private String orderStatusCallbackUrl; }
[ "thrwwy216@tutanota.com" ]
thrwwy216@tutanota.com
7960a66f7c5fde81d9b3177d98595d34f7492db4
bb1bd77f9a38c965f37137c983cc2ce77488b9ea
/eas-service/src/com/itsol/eas/bo/Intern05ImportorderBO.java
304f9d5b59b8a956d5035753b61e4ab355a18c7a
[]
no_license
truongbb/itsol-intern-mockup-2
21abba489e324d98d7e21f1489794f2fdfedfeff
efa7e3c0b37491dfb2501f6dc121d581dd8baf13
refs/heads/master
2022-03-23T04:15:36.834867
2019-12-15T04:15:48
2019-12-15T04:15:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,378
java
/* * Copyright 2011 Viettel Telecom. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package com.itsol.eas.bo; import com.itsol.eas.dto.Intern05ImportorderDTO; import com.viettel.service.base.model.BaseFWModelImpl; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Parameter; @Entity @Table(name = "INTERN05_IMPORTORDER") @SuppressWarnings("serial") /** * * @author: DATNQ * @version: 1.0 * @since: 1.0 */ public class Intern05ImportorderBO extends BaseFWModelImpl { private java.lang.Long imId; private java.lang.String unit; private java.lang.Long quantity; private java.lang.Float unitPrice; private java.util.Date createDate; private java.lang.String note; private java.lang.Long emId; private java.lang.Long prId; private java.lang.Long suId; public Intern05ImportorderBO() { setColId("imId"); setColName("imId"); setUniqueColumn(new String[] { "imId" }); } @Id @GeneratedValue(generator = "sequence") @GenericGenerator(name = "sequence", strategy = "sequence", parameters = { @Parameter(name = "sequence", value = "INTERN05_IMPORTORDER_SEQ") }) @Column(name = "IM_ID", length = 22) public java.lang.Long getImId() { return imId; } public void setImId(java.lang.Long imId) { this.imId = imId; } @Column(name = "UNIT", length = 10) public java.lang.String getUnit() { return unit; } public void setUnit(java.lang.String unit) { this.unit = unit; } @Column(name = "QUANTITY", length = 10) public java.lang.Long getQuantity() { return quantity; } public void setQuantity(java.lang.Long quantity) { this.quantity = quantity; } @Column(name = "UNIT_PRICE", length = 22) public java.lang.Float getUnitPrice() { return unitPrice; } public void setUnitPrice(java.lang.Float unitPrice) { this.unitPrice = unitPrice; } @Column(name = "CREATE_DATE", length = 7) public java.util.Date getCreateDate() { return createDate; } public void setCreateDate(java.util.Date createDate) { this.createDate = createDate; } @Column(name = "NOTE", length = 510) public java.lang.String getNote() { return note; } public void setNote(java.lang.String note) { this.note = note; } @Column(name = "EM_ID", length = 22) public java.lang.Long getEmId() { return emId; } public void setEmId(java.lang.Long emId) { this.emId = emId; } @Column(name = "PR_ID", length = 22) public java.lang.Long getPrId() { return prId; } public void setPrId(java.lang.Long prId) { this.prId = prId; } @Column(name = "SU_ID", length = 22) public java.lang.Long getSuId() { return suId; } public void setSuId(java.lang.Long suId) { this.suId = suId; } @Override public Intern05ImportorderDTO toDTO() { Intern05ImportorderDTO intern05ImportorderDTO = new Intern05ImportorderDTO(); // set cac gia tri intern05ImportorderDTO.setImId(this.imId); intern05ImportorderDTO.setUnit(this.unit); intern05ImportorderDTO.setQuantity(this.quantity); intern05ImportorderDTO.setUnitPrice(this.unitPrice); intern05ImportorderDTO.setCreateDate(this.createDate); intern05ImportorderDTO.setNote(this.note); return intern05ImportorderDTO; } }
[ "truongbb@itsol.vn" ]
truongbb@itsol.vn
590b2b69d7e0b29f7154cc6a7fe0c3321c27bec9
7f62c0d458af7a487a684601651293dd2d3abddb
/src/main/java/com/sdwfqin/spring_boot_demo/utils/exception/ServiceException.java
15fd0c0b81759de8b57b9755acd8898540b9474c
[]
no_license
sdwfqin/spring_boot_demo
60e7a875ef22a33feb13866ae17540f9ca33ecee
8461302bd4c800ed1e124cff7d3237b1199ff63d
refs/heads/master
2022-06-23T18:12:14.539957
2022-05-23T00:49:41
2022-05-23T00:49:41
207,287,675
0
0
null
2022-05-23T00:49:42
2019-09-09T10:52:50
Java
UTF-8
Java
false
false
592
java
package com.sdwfqin.spring_boot_demo.utils.exception; import com.sdwfqin.spring_boot_demo.enums.ResultEnum; /** * 自定义服务异常,必须继承RuntimeException * <p> * * @author 张钦 * @date 2019/8/30 */ public class ServiceException extends RuntimeException { private Integer code; public ServiceException(ResultEnum resultErrorEnum) { super(resultErrorEnum.getMsg()); this.code = resultErrorEnum.getCode(); } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } }
[ "sdwfqin@gmail.com" ]
sdwfqin@gmail.com
b321dd3ca03d8e00ee0a4a2793fa035fcf4ce590
3de05438fe2cb2a6426e674379eb8f1b50383fcf
/src/test/java/com/mindtree/talent/TalentApplicationTests.java
2799ef0dadb8fc9f106ad4469c010c9c0b83fa1c
[]
no_license
mishraaman469/Talent2
705e7b70ff02f5b89755299a8f0225c1df6b01e6
4fce8f9a0964f165f3aad8369c65cfe41c1c9872
refs/heads/master
2023-05-31T12:21:04.710877
2021-07-12T06:52:59
2021-07-12T06:52:59
385,150,688
0
0
null
null
null
null
UTF-8
Java
false
false
211
java
package com.mindtree.talent; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class TalentApplicationTests { @Test void contextLoads() { } }
[ "mishraaman469@gmail.com" ]
mishraaman469@gmail.com
58fce97db7475e17095429347b122a606fea652a
ce9d55bfe24682813cadc946b41f9e4b01a2fc35
/app/src/main/java/com/example/foodol/models/FoodItem.java
702eb49f158bf60e0e086467eb9e257d3f6cb9fa
[]
no_license
akshhack/foodol
881950337806088d18f6c88b279d037a15d2c8f7
6bb83de69cfc3470e284bca4194942c4ac9bd3ae
refs/heads/master
2022-04-17T08:46:14.550733
2020-04-19T16:37:08
2020-04-19T16:37:08
257,049,648
0
0
null
null
null
null
UTF-8
Java
false
false
1,468
java
package com.example.foodol.models; import android.os.Parcel; import android.os.Parcelable; public class FoodItem implements Parcelable { private String foodItem; private int quantity; private FoodContact provider; FoodItem() {} public FoodItem(String foodItem, int quantity, FoodContact provider) { this.foodItem = foodItem; this.quantity = quantity; this.provider = provider; } public String getFoodItem() { return foodItem; } public FoodContact getProvider() { return provider; } public int getQuantity() { return quantity; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this.foodItem); dest.writeInt(this.quantity); dest.writeParcelable(this.provider, flags); } protected FoodItem(Parcel in) { this.foodItem = in.readString(); this.quantity = in.readInt(); this.provider = in.readParcelable(FoodContact.class.getClassLoader()); } public static final Parcelable.Creator<FoodItem> CREATOR = new Parcelable.Creator<FoodItem>() { @Override public FoodItem createFromParcel(Parcel source) { return new FoodItem(source); } @Override public FoodItem[] newArray(int size) { return new FoodItem[size]; } }; }
[ "akshatprakash@Akshats-MacBook-Pro.local" ]
akshatprakash@Akshats-MacBook-Pro.local
77290693c1e34a1c2f4fd43284279db779ee5155
1fc1bc95e0eea6431d826968f9d1c66f19bc3da9
/disfrutapp/src/com/disfruta/bean/logistica/Almacen.java
bc3f4c3d1909a2c25f94f1b1321b0fdd2661c344
[]
no_license
josejuape/ProjectDisfrutapp
e4f6e1a726754a11c14a1204119a854093e385c7
2cf41c2bf470c0cc59ccd85513e84c606f06b69e
refs/heads/master
2020-12-24T15:31:13.810491
2015-04-14T14:17:57
2015-04-14T14:17:57
29,478,188
0
0
null
null
null
null
UTF-8
Java
false
false
2,558
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.disfruta.bean.logistica; import com.disfruta.bean.xtbc.Local; import com.disfruta.bean.xtbc.Ubigeo; /** * * @author Juape */ public class Almacen { protected int id; protected String descripcion; protected String ubicacion; protected String telefono; protected String direccion1; protected String referencia1; protected String direccion2; protected String referencia2; protected String recepcion; protected Local local; protected Ubigeo ubigeo; protected String tipoOperacion; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getDescripcion() { return descripcion; } public void setDescripcion(String descripcion) { this.descripcion = descripcion; } public Local getLocal() { return local; } public void setLocal(Local local) { this.local = local; } public String getUbicacion() { return ubicacion; } public void setUbicacion(String ubicacion) { this.ubicacion = ubicacion; } public String getTelefono() { return telefono; } public void setTelefono(String telefono) { this.telefono = telefono; } public String getDireccion1() { return direccion1; } public void setDireccion1(String direccion1) { this.direccion1 = direccion1; } public String getReferencia1() { return referencia1; } public void setReferencia1(String referencia1) { this.referencia1 = referencia1; } public String getDireccion2() { return direccion2; } public void setDireccion2(String direccion2) { this.direccion2 = direccion2; } public String getReferencia2() { return referencia2; } public void setReferencia2(String referencia2) { this.referencia2 = referencia2; } public String getTipoOperacion() { return tipoOperacion; } public void setTipoOperacion(String tipoOperacion) { this.tipoOperacion = tipoOperacion; } public String getRecepcion() { return recepcion; } public void setRecepcion(String recepcion) { this.recepcion = recepcion; } public Ubigeo getUbigeo() { return ubigeo; } public void setUbigeo(Ubigeo ubigeo) { this.ubigeo = ubigeo; } }
[ "josejuape@gmail.com" ]
josejuape@gmail.com
ddec2d4d35d21f57f57a029096af8fcb89ad233c
b70fc8c1747972db4bea3092e0eb089c7a95e5c8
/Server/src/es/dam/openpad/Debugger.java
144118c936cc52f8b6c0c9fc9a920d1e9a86084c
[ "Apache-2.0" ]
permissive
nirodg/openpad
f19be878832ae14fc74d0254c34b7af4d6017c92
230407f4d91b9f1de9b7ce79d1f3ef0326119280
refs/heads/master
2016-09-06T18:01:58.083383
2014-04-30T09:19:18
2014-04-30T09:19:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package es.dam.openpad; public class Debugger { static int msgs; public static void setMsgs(int n) { msgs = n; } public static void print(String msg) { if(0 < msgs) { System.err.println("D"+msgs+": "+msg); msgs--; } } }
[ "dorin.bg@aol.com" ]
dorin.bg@aol.com
30de3eb5b59888c060a8800e25880bc1820d523b
2481fe780a6399cef73a014f8139c95c74d1c9dc
/app/src/main/java/com/example/john/todo/Constants.java
cf189d7ae26e0ab045a91648fb7b4f9606a134f2
[]
no_license
jgasao07/To_Do
3d5d956138789144690f79153e9b23d95de88de2
dab9bcd00f9443a71baf6b6d0590ee06472b706e
refs/heads/master
2021-01-01T04:45:31.147417
2016-04-29T17:53:28
2016-04-29T17:53:28
57,270,135
0
0
null
null
null
null
UTF-8
Java
false
false
191
java
package com.example.john.todo; /** * Created by JOHN on 4/27/2016. */ public class Constants { public static final String FIREBASE_URL = "https://to-do-app-tutorial.firebaseio.com"; }
[ "gasao@wisc.edu" ]
gasao@wisc.edu
6761c43d8a346b04e184e246ecc9a3fdff1db6f7
63041448202976207d42dd363c6698818c65767a
/src/main/java/com/example/wbdvsp2102rribeiroseerverjava/repositories/WidgetRepository.java
245ddee590ec2d16b3adb9ca9f31cba0c92992c8
[]
no_license
rubenribeiro/wbdv-sp21-02-rribeiro-server-java
d1cb21af28e4a73a2b9702caaf14a30a61b05d5d
8f3710e579882eb972325fa1e6984ddc6ac0c2d8
refs/heads/main
2023-04-06T10:04:49.959383
2021-04-02T23:54:26
2021-04-02T23:54:26
334,457,530
0
0
null
null
null
null
UTF-8
Java
false
false
794
java
package com.example.wbdvsp2102rribeiroseerverjava.repositories; import com.example.wbdvsp2102rribeiroseerverjava.models.Widget; import org.springframework.data.repository.CrudRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.util.List; public interface WidgetRepository extends CrudRepository<Widget, Long> { @Query("SELECT widget FROM Widget widget") public List<Widget> findAllWidgets(); @Query(value="SELECT * FROM widgets WHERE id=:wid", nativeQuery = true) public Widget findWidgetById(@Param("wid") Long widgetId); @Query(value="SELECT * FROM widgets WHERE topic_id=:tid", nativeQuery = true) public List<Widget> findWidgetsForTopic(@Param("tid") String topicId); }
[ "rubenribeiro@outlook.com" ]
rubenribeiro@outlook.com
b8dfaede0769f32e31d86d1c20ef46a8ca828304
b2bef6f2f2dde8f915fdd9ea337c7dc5df27ec62
/src/java/phuchgt/controller/GetShoppingHistoryController.java
c4e09f24b4581fe179ae201410432ac45c402a83
[]
no_license
mevrthisbang/LabJavaWebHanaShop
163f6c65ef3d03e321ede8560017c42240e48085
10af08a74a552171849b325e7fd7d54bbb09f361
refs/heads/master
2023-04-09T05:05:26.728877
2021-04-14T14:56:46
2021-04-14T14:56:46
334,153,412
1
0
null
null
null
null
UTF-8
Java
false
false
4,123
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 phuchgt.controller; import java.io.IOException; import java.util.HashMap; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import phuchgt.dao.FoodDAO; import phuchgt.dao.OrderDAO; import phuchgt.dto.AccountDTO; import phuchgt.dto.FoodDTO; import phuchgt.dto.OrderDTO; /** * * @author mevrthisbang */ public class GetShoppingHistoryController extends HttpServlet { private static final String ERROR = "error.jsp"; private static final String OKAY = "shoppingHistory.jsp"; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String url = ERROR; try { HttpSession session = request.getSession(); AccountDTO loginUser = (AccountDTO) session.getAttribute("USER"); if (loginUser != null && loginUser.getRole().equals("user")) { String date = request.getParameter("datePicker"); String name = request.getParameter("txtName"); OrderDAO orderDAO = new OrderDAO(); List<OrderDTO> listOrders = null; if (date == null && name == null || date.isEmpty() && name.isEmpty()) { listOrders = orderDAO.getOrderHistoryByUsername(loginUser.getUsername()); } else { listOrders = orderDAO.searchOrderHistory(name, date, loginUser.getUsername()); } if (listOrders != null && !listOrders.isEmpty()) { HashMap<OrderDTO, List<FoodDTO>> listOrderswithFood = new HashMap<>(); for (OrderDTO orderDTO : listOrders) { FoodDAO foodDAO = new FoodDAO(); List<FoodDTO> listFoodByOrderID = foodDAO.getFoodByOrderID(orderDTO.getOrderID()); listOrderswithFood.put(orderDTO, listFoodByOrderID); } request.setAttribute("SHOPPINGHISTORY", listOrderswithFood); } url = OKAY; } else { request.setAttribute("ERROR", "You do not have permission to do this."); } } catch (Exception e) { log("ERROR at GetShoppingHistoryController: " + e.getMessage()); } finally { request.getRequestDispatcher(url).forward(request, response); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "65884017+mevrthisbang@users.noreply.github.com" ]
65884017+mevrthisbang@users.noreply.github.com
c997daeb64ce977ec7bb32024f7c47081e67f37f
c2f65b700a3f77db0f98a831fb8f4db4d46d6357
/app/src/main/java/com/lenovo/studentClient/activity/IpSetActivity.java
17fe4eee4babf9f4f12009bf27e32068c08176e9
[]
no_license
tang16966/YYZYStudentDemo
edb8dedbc628ea3e9a03722a33d2db554c6b65a9
97906021640e66be99489af51790fa9b44333ee3
refs/heads/master
2020-05-24T01:28:22.231730
2019-05-17T00:33:23
2019-05-17T00:33:23
187,035,470
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package com.lenovo.studentClient.activity; import android.os.Bundle; import android.view.View; import com.lenovo.studentClient.R; /** * ip设置activity,包涵网络连接方式切换,IP设置 */ public class IpSetActivity extends BaseActivity { @Override protected void initializeWithState(Bundle savedInstanceState) { } @Override protected String getLayoutTitle() { return getString(R.string.title_ip); } @Override protected void onAfter() { // finish(); } @Override protected void initData() { } @Override protected void initView() { } @Override protected int getLayoutId() { return R.layout.activity_ipset; } @Override public void onClick(View v) { } }
[ "1914252033@qq.com" ]
1914252033@qq.com
bf43d89873055b930ee866604a04ce76616e81f2
cb158a57cd413eacf6fa5f792da0459b9a9d2426
/src/main/java/com/frank/api/gateway/auth/model/AppInfo.java
3d752b989fa7b5432d6ec89928a0c56f9855804b
[]
no_license
FrancisMurphy/frank-api-gateway
c28624ead2680a07d8ddb289cea39744775f67fa
bbcc37f0e74e73984b52754a0b1fa259db830182
refs/heads/master
2022-11-15T17:00:13.966897
2020-06-01T03:39:35
2020-06-01T03:39:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package com.frank.api.gateway.auth.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.ToString; import org.springframework.data.annotation.Id; import java.util.Date; /** * @author frank */ @Data @ToString @AllArgsConstructor public class AppInfo { /** * 应用id */ @Id private String appId; /** * 应用密钥 */ private String secret; /** * 应用类型 */ private Integer type; private Date createTime; private Date updateTime; public AppInfo() { } public AppInfo(AppInfo appInfo) { this.appId = appInfo.getAppId(); this.secret = appInfo.getSecret(); this.type = appInfo.getType(); this.createTime = appInfo.getCreateTime(); this.updateTime = appInfo.getUpdateTime(); } }
[ "zhumingxu666@outlook.com" ]
zhumingxu666@outlook.com
19aabe4b96d019d4240310c4f4b2fead3e158160
8eae6a70ff8db7fa8c856ddac03c81b18feec53d
/Movies/Sources/er/movies/components/MovieDetail.java
5af3ebfe5a9e88fe224d5714d2264fa94bbfbd43
[]
no_license
Xyrality/dbunit-example
b2a835cadf948ebea348f99570a63862ea70676e
18237c1f9c65dee32517101354a35058f339310f
refs/heads/master
2016-09-01T19:43:44.706758
2015-04-26T11:03:10
2015-04-26T11:03:10
34,606,906
0
0
null
null
null
null
UTF-8
Java
false
false
2,251
java
package er.movies.components; import webobjectsexamples.businesslogic.movies.common.Movie; import webobjectsexamples.businesslogic.movies.common.MovieRole; import webobjectsexamples.businesslogic.movies.common.Talent; import com.webobjects.appserver.WOActionResults; import com.webobjects.appserver.WOContext; import com.webobjects.appserver.WORedirect; import com.webobjects.appserver.WOResponse; import com.webobjects.eocontrol.EOEditingContext; import com.webobjects.foundation.NSArray; import er.extensions.appserver.ERXResponseRewriter; import er.extensions.components.ERXComponent; import er.extensions.eof.ERXEC; import er.extensions.foundation.ERXStringUtilities; import er.movies.Session; public class MovieDetail extends ERXComponent { public Talent directorItem; public MovieRole movieRoleItem; private EOEditingContext editingContext; public MovieDetail(WOContext context) { super(context); } @Override public void appendToResponse(WOResponse response, WOContext context) { super.appendToResponse(response, context); ERXResponseRewriter.addStylesheetResourceInHead(response, context, "app", "MovieDetail.css"); } public EOEditingContext editingContext() { if (editingContext == null) editingContext = ERXEC.newEditingContext(); return editingContext; } public Movie movie() { return ((Session)session()).movieDisplayGroup().selectedObject().localInstanceIn(editingContext()); } // public ERTaggable<Movie> movieTaggable() { // return movie().taggable(); // } public WOActionResults returnToList() { editingContext = null; ((Session)session()).movieDisplayGroup().setSelectedObject(null); return null; } public NSArray<MovieRole> movieRolesSorted() { return movie().roles(null, MovieRole.TALENT.dot(Talent.LAST_NAME).ascInsensitives(), false); } public WOActionResults saveChanges() { editingContext().saveChanges(); return null; } public WOActionResults discardChanges() { editingContext().revert(); return null; } public WOActionResults imageBrowser() { WORedirect redirect = new WORedirect(context()); redirect.setUrl("http://images.google.com/images?q=movie+" + ERXStringUtilities.urlEncode(movie().title())); return redirect; } }
[ "giancarlo.dessena@xyrality.com" ]
giancarlo.dessena@xyrality.com
69b486725fd9593de2b193cf09d8195e2f7c96ff
a5b850d4669ab59f967315d5adb87fa39907b5fe
/src/main/java/learn/lists/AddTwoNumbersII.java
d7e28ac302b581b5b8caa4afc04e18662550c219
[]
no_license
alexcmd/algorithms
e0d93ff959a3fc8d8f535b1e28715d550496e2f5
aad351ac696c67232a38269a6ef5086a84397a5b
refs/heads/master
2021-05-26T05:17:34.665137
2021-02-24T14:42:28
2021-02-24T14:42:28
127,564,031
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package learn.lists; import learn.common.ListNode; import java.util.LinkedList; import java.util.Stack; public class AddTwoNumbersII { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { LinkedList<Integer> stack1 = new LinkedList<>(); LinkedList<Integer> stack2 = new LinkedList<>(); while (l1!=null){ stack1.push(l1.val); l1 = l1.next; } while (l2!=null){ stack2.push(l2.val); l2 = l2.next; } ListNode cur = new ListNode(); int next=0; while (!stack1.isEmpty() || !stack2.isEmpty()){ int s1 = 0; if (!stack1.isEmpty()) s1 = stack1.pop(); int s2 =0; if (!stack2.isEmpty()) s2 = stack2.pop(); int sum = s1+s2+next; cur.val = sum %10; next = sum / 10; cur = new ListNode(0, cur); } if (next!=0){ cur.val=next; cur = new ListNode(0, cur); } return cur.next; } }
[ "alexcmd@gmail.com" ]
alexcmd@gmail.com
4567a49c3c15e4a9d77d0aadc49529d7c3c6308a
ff4976f4c68ba7bfa4289bd0ad37d9605aef95da
/app/src/main/java/com/example/administrator/themeanime/adapter/AdapterListView.java
5562dff0e4249080105ad17c14c4081c6aee3fe2
[]
no_license
cleverSheep/ThemeAnime
228804b207510c96a1e8e6e7b4a9064e2c807493
09236dbd26c036b077be9fda4171fe886866fda5
refs/heads/master
2020-07-31T14:35:16.909799
2018-06-27T14:34:12
2018-06-27T14:34:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,983
java
package com.example.administrator.themeanime.adapter; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.example.administrator.themeanime.R; import com.example.administrator.themeanime.activity.ListActivity; import com.example.administrator.themeanime.activity.MenuActivity; import java.util.ArrayList; /** * Created by Administrator on 26/12/2017. */ public class AdapterListView extends ArrayAdapter<ItemListView> { private LayoutInflater layoutInflater; private ArrayList<ItemListView> itemListViews; private TextView textView; private Context context; public AdapterListView(@NonNull Context context, @NonNull ArrayList<ItemListView> objects) { super(context, android.R.layout.simple_list_item_1, objects); layoutInflater = LayoutInflater.from(context); this.itemListViews = objects; this.context = context; } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { convertView = layoutInflater.inflate(R.layout.item_listview, parent, false); textView = convertView.findViewById(R.id.txtReview); final ItemListView itemListView = itemListViews.get(position); textView.setText(itemListView.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, ListActivity.class); intent.putExtra("URL", itemListView.getUrl()); intent.putExtra("TITLE", itemListView.getName()); context.startActivity(intent); } }); return convertView; } }
[ "ochung3@gmail.com" ]
ochung3@gmail.com
983d971956ff8af8548f4bc84e39bea69664a937
1f8579ab8d126d829658d711ff23f478554f5503
/src/main/java/at/ac/tuwien/inso/indoor/sensorserver/persistence/dao/ServerConfigDao.java
9b01c7ff95387a3786df9e9ef2155858c2846cfd
[]
no_license
IanMadlenya/indoor-positioning
23aa6990409ce15dbd165d7071717881ce8590e0
0eb73cef1f50ece5d839ef7f0ae0176f47c3429b
refs/heads/master
2021-04-06T19:57:02.829089
2016-10-08T20:47:06
2016-10-08T20:47:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package at.ac.tuwien.inso.indoor.sensorserver.persistence.dao; import at.ac.tuwien.inso.indoor.sensorserver.services.ServerConfig; import at.ac.tuwien.inso.indoor.sensorserver.persistence.couchdb.DB; import org.ektorp.support.CouchDbRepositorySupport; import java.util.List; import java.util.UUID; /** * Created by PatrickF on 08.09.2014. */ public class ServerConfigDao extends CouchDbRepositorySupport<ServerConfig> { public ServerConfigDao() { super(ServerConfig.class, DB.getInstance().getMainDB()); } public ServerConfig getServerConfig() { List<ServerConfig> list= getAll(); if(!list.isEmpty()) { return list.get(list.size()-1); } return null; } public void setNewServerConfig(ServerConfig config) { clearConfig(); if(config.getId() == null) config.setId(UUID.randomUUID().toString()); config.setRevision(null); add(config); } public void clearConfig() { for (ServerConfig serverConfig : getAll()) { remove(serverConfig); } } }
[ "patrick.favre@rise-world.com" ]
patrick.favre@rise-world.com
acfd7811c13b0110ba39a4e2c3ff334cf80f2b0b
94881e907245782c056cb4bc82b77ba5dbd35082
/src/test/java/com/caijx/controller/GirlControllerTest.java
4882967d8ccc68a9fce41f3a1ef2694cec3550ef
[]
no_license
SmileCJX/springBoot
cd2148e566465bca9953cc5937ba3a390515a09f
8f2f435de84a430f637d2e7e01339c3403257e90
refs/heads/master
2021-01-20T06:11:16.770872
2018-07-03T14:57:19
2018-07-03T14:57:19
101,492,186
0
0
null
null
null
null
UTF-8
Java
false
false
1,012
java
package com.caijx.controller; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.result.MockMvcResultMatchers; /** * Created by Administrator on 2017/9/6/006. */ @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class GirlControllerTest { @Autowired private MockMvc mvc; @Test public void girlList() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/girls")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().string("abc")); } }
[ "1092925421@qq.com" ]
1092925421@qq.com
138d39f9889e774f3ec977ee4f8cdd32ee1ed4e6
147b89e3df9d1f5ea37790c173f14f6f21ae13a0
/AppUpdate.java
2b13683aecbf52c667cfe685548483c5c0633d0f
[]
no_license
xiangqiz/xiangqiz.github.io
ebee680b3b0abd0cfbdc4e1477e5f9972e1675f7
15319d2caf6426692fcd2a1deb53b7b8d6cf3788
refs/heads/master
2023-04-29T17:52:36.168916
2022-03-28T12:39:27
2022-03-28T12:39:27
131,728,027
0
0
null
2023-04-14T17:46:21
2018-05-01T15:14:21
JavaScript
UTF-8
Java
false
false
8,226
java
package com.benx.appupdate; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import net.dongliu.apk.parser.ApkParser; import net.dongliu.apk.parser.bean.ApkMeta; import org.apache.commons.fileupload.DefaultFileItemFactory; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.starit.core.dao.JdbcDAOImpl; /** * @author Qi * */ @Controller @RequestMapping("appupdate") public class AppUpdate { private final String APP_BASEPATH = "/home/wdli/EOS5_3_5_MOBILE/jboss-3.2.5/server/default/deploy/eos4jboss/default.war/androidRest/page/"; @Autowired private JdbcDAOImpl jdbcDao; @RequestMapping public String index() { return "appUpdate"; } /** * 上传文件 * * @param req * @param type * @return * @throws FileUploadException */ @RequestMapping(value = "upload", method = RequestMethod.POST) @ResponseBody public Map<String, String> upload(HttpServletRequest req, @RequestParam String type) throws FileUploadException { Map<String, String> map = new HashMap<String, String>(); System.out.println(type); // 文件上传类 ServletFileUpload upload = new ServletFileUpload( new DefaultFileItemFactory()); // 解决上传文件名的中文乱码 // upload.setHeaderEncoding("UTF-8"); if ("".equals(type) || !ServletFileUpload.isMultipartContent(req)) { // 按照传统方式获取数据 return map; } String fileName = APP_BASEPATH + type; String packageName = null; String versionName = null; // 接收用户上传信息 try { List<FileItem> items = upload.parseRequest(req); System.out.println("items.size>>>>>>" + items.size()); // 遍历items for (FileItem item : items) { // 一般表单域 if (item.isFormField()) { String name = item.getFieldName(); String date = item.getString(); System.out.println("isFormField(name: " + name + " date: " + date); } else { // 若是文件域则把文件保存到d盘临时文件夹 @SuppressWarnings("unused") String fieldName = item.getFieldName(); // 上传的文件名 String originalFilename = item.getName(); if (originalFilename == null || originalFilename.trim().equals("")) { continue; } // 得到上传文件的扩展名 String fileExtName = originalFilename .substring(originalFilename.lastIndexOf(".") + 1); if (fileExtName.equalsIgnoreCase("ipa")) { fileName += ".ipa.TMP"; } if (fileExtName.equalsIgnoreCase("apk")) { fileName += ".apk.TMP"; } // 上传的文件类型 String contentType = item.getContentType(); // 上传的文件大小 long sizeInBytes = item.getSize(); System.out.println(originalFilename + ", contentType: " + contentType + ", sizeInBytes: " + sizeInBytes); File file = new File(fileName); item.write(file); // 删除处理文件上传时生成的临时文件 item.delete(); } } if (fileName.endsWith(".apk.TMP")) { ApkParser apkFile = new ApkParser(new File(fileName)); ApkMeta apkMeta = apkFile.getApkMeta(); packageName = apkMeta.getPackageName(); versionName = apkMeta.getVersionName(); apkFile.close(); } map.put("appVersion", versionName); map.put("packageName", packageName); } catch (Exception e) { e.printStackTrace(); } return map; } /** * 升级操作 * * @param appName * @param appVersion * @param upgradeContent * @param keypass * @return * @throws UnsupportedEncodingException */ @RequestMapping(value = "update", method = RequestMethod.POST) @ResponseBody public Map<String, String> update(@RequestParam String appName, @RequestParam String appVersion, @RequestParam String upgradeContent, @RequestParam String keypass) throws UnsupportedEncodingException { Map<String, String> result = new LinkedHashMap<String, String>(); if (!"ustcinfo".equalsIgnoreCase(keypass)) { result.put("MSG", "error!"); return result; } String ipaName = APP_BASEPATH + appName + ".ipa"; String ipaNameTMP = APP_BASEPATH + appName + ".ipa.TMP"; String ipaNameBak = APP_BASEPATH + appName + ".ipaV"; String apkName = APP_BASEPATH + appName + ".apk"; String apkNameTMP = APP_BASEPATH + appName + ".apk.TMP"; String apkNameBak = APP_BASEPATH + appName + ".apkV"; File apkFileTMP = new File(apkNameTMP); if (!apkFileTMP.exists()) { result.put("MSG", "重复提交?"); return result; } // 获取旧版本号 File apkFile = new File(apkName); try { ApkParser apkParser = new ApkParser(apkFile); ApkMeta apkMeta = apkParser.getApkMeta(); apkParser.close(); String oldAppVersionName = apkMeta.getVersionName(); ipaNameBak += oldAppVersionName; apkNameBak += oldAppVersionName; result.put("getOldAppVersionName", oldAppVersionName); } catch (IOException e) { result.put("getOldAppVersionName", "error!"); result.put("MSG", e.getMessage()); return result; } // 备份旧版本,重命名为原文件名+V版本号,GZISAS.apkV1.0 File ipaFile = new File(ipaName); if (ipaFile.exists()) { File ipaFileBak = new File(ipaNameBak); if (ipaFileBak.exists()) { ipaFileBak.delete(); } boolean ipaRenameSuccess = ipaFile.renameTo(ipaFileBak); result.put("ipaBakSuccess", String.valueOf(ipaRenameSuccess)); } if (apkFile.exists()) { File apkFileBak = new File(apkNameBak); if (apkFileBak.exists()) { apkFileBak.delete(); } boolean apkRenameSuccess = apkFile.renameTo(apkFileBak); result.put("apkBakSuccess", String.valueOf(apkRenameSuccess)); } // 替换原文件 File ipaFileTMP = new File(ipaNameTMP); if (ipaFileTMP.exists()) { boolean ipaRenameSuccess = ipaFileTMP.renameTo(ipaFile); result.put("ipaReplaceSuccess", String.valueOf(ipaRenameSuccess)); } boolean apkRenameSuccess = false; if (apkFileTMP.exists()) { apkRenameSuccess = apkFileTMP.renameTo(apkFile); result.put("apkReplaceSuccess", String.valueOf(apkRenameSuccess)); } // 修改数据库提示升级 if (apkRenameSuccess) { Map<String, String> paramMap = new HashMap<String, String>(); String sql = null; paramMap.put("appversion", appVersion); paramMap.put("upgradecontent", new String(upgradeContent.getBytes("ISO-8859-1"), "GBK")); if (appName.equalsIgnoreCase("INTELL_GZISAS")) { sql = "UPDATE SGDD.APP_VERSION T SET T.EDITIONNUM = :appversion, T.UPDATECONTENT = :upgradecontent WHERE T.UPDATEPLATFORM IN ('android_new', 'ios_new')"; } if (appName.equalsIgnoreCase("GZISAS")) { sql = "UPDATE SGDD.APP_VERSION T SET T.EDITIONNUM = :appversion, T.UPDATECONTENT = :upgradecontent WHERE T.UPDATEPLATFORM IN ('android', 'ios')"; } boolean update = jdbcDao.update(sql, paramMap); result.put("updateSuccess", String.valueOf(update)); } return result; } public static void main(String[] args) throws IOException { String fileName = "D:\\Users\\Qi\\Desktop\\GZISAS.apk"; File file = new File(fileName); System.out.println(file.getAbsolutePath()); ApkParser apkFile = new ApkParser(file); ApkMeta apkMeta = apkFile.getApkMeta(); String packageName = apkMeta.getPackageName(); String versionName = apkMeta.getVersionName(); System.out.println(packageName); System.out.println(versionName); } }
[ "0b5_1072122210_xiangqiz@git.cloud.tencent.com" ]
0b5_1072122210_xiangqiz@git.cloud.tencent.com
f80b5544a288fdf6476a39d53ea2a7d7d675b5de
1220e89da4e8e945e1560d8d48f2fe8ea6b1614a
/packages/PicturePlayer/src/org/geometerplus/zlibrary/ui/android/application/ZLAndroidApplicationWindow.java
0746872f7752da14e9365ad5663a26b99703cd7d
[]
no_license
youhandcn/android_device_onda_ondamid
04a23b87a6c20bd5cea4a3accf5dfea962bfa97e
14356de4893306f73d4fb1d0aa443684d52270c6
refs/heads/master
2020-04-14T16:55:06.793452
2013-08-27T14:31:28
2013-08-27T14:31:28
12,407,224
2
0
null
null
null
null
UTF-8
Java
false
false
4,832
java
/* * Copyright (C) 2007-2010 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package org.geometerplus.zlibrary.ui.android.application; import java.util.*; import android.view.Menu; import android.view.MenuItem; import org.geometerplus.zlibrary.core.application.ZLApplication; import org.geometerplus.zlibrary.core.application.ZLApplicationWindow; import org.geometerplus.zlibrary.core.library.ZLibrary; import org.geometerplus.zlibrary.ui.android.view.ZLAndroidViewWidget; import org.geometerplus.zlibrary.ui.android.view.ZLAndroidWidget; import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary; import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication; import com.amlogic.PicturePlayer.R; public final class ZLAndroidApplicationWindow extends ZLApplicationWindow { private final HashMap<MenuItem,ZLApplication.Menubar.PlainItem> myMenuItemMap = new HashMap<MenuItem,ZLApplication.Menubar.PlainItem>(); private class MenuBuilder extends ZLApplication.MenuVisitor { private int myItemCount = Menu.FIRST; private final Stack<Menu> myMenuStack = new Stack<Menu>(); private MenuBuilder(Menu menu) { myMenuStack.push(menu); } //Override protected void processSubmenuBeforeItems(ZLApplication.Menubar.Submenu submenu) { myMenuStack.push(myMenuStack.peek().addSubMenu(0, myItemCount++, Menu.NONE, submenu.getMenuName())); } //Override protected void processSubmenuAfterItems(ZLApplication.Menubar.Submenu submenu) { myMenuStack.pop(); } //Override protected void processItem(ZLApplication.Menubar.PlainItem item) { MenuItem menuItem = myMenuStack.peek().add(0, myItemCount++, Menu.NONE, item.getTitle()); try { final String fieldName = "ic_menu_" + item.getActionId().toLowerCase(); menuItem.setIcon(R.drawable.class.getField(fieldName).getInt(null)); } catch (NoSuchFieldException e) { } catch (IllegalAccessException e) { } menuItem.setOnMenuItemClickListener(myMenuListener); myMenuItemMap.put(menuItem, item); } } private final MenuItem.OnMenuItemClickListener myMenuListener = new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { getApplication().doAction(myMenuItemMap.get(item).getActionId()); return true; } }; public ZLAndroidApplicationWindow(ZLApplication application) { super(application); } public void buildMenu(Menu menu) { new MenuBuilder(menu).processMenu(getApplication()); refreshMenu(); } //Override protected void refreshMenu() { for (Map.Entry<MenuItem,ZLApplication.Menubar.PlainItem> entry : myMenuItemMap.entrySet()) { final String actionId = entry.getValue().getActionId(); final ZLApplication application = getApplication(); entry.getKey().setVisible(application.isActionVisible(actionId) && application.isActionEnabled(actionId)); } } //Override public void initMenu() { // TODO: implement } private ZLAndroidViewWidget myViewWidget; protected ZLAndroidViewWidget getViewWidget() { if (myViewWidget == null) { myViewWidget = new ZLAndroidViewWidget(); } return myViewWidget; } //Override protected void repaintView() { final ZLAndroidWidget widget = ((ZLAndroidLibrary)ZLibrary.Instance()).getWidget(); // I'm not sure about threads, so postInvalidate() is used instead of invalidate() if(widget != null) widget.postInvalidate(); } //Override protected void scrollViewTo(int viewPage, int shift) { getViewWidget().scrollTo(viewPage, shift); } //Override protected void startViewAutoScrolling(int viewPage) { getViewWidget().startAutoScrolling(viewPage); } //Override public void rotate() { ((ZLAndroidLibrary)ZLibrary.Instance()).rotateScreen(); } //Override public boolean canRotate() { return !ZLAndroidApplication.Instance().AutoOrientationOption.getValue(); } //Override public void close() { ((ZLAndroidLibrary)ZLibrary.Instance()).finish(); } private int myBatteryLevel; //Override protected int getBatteryLevel() { return myBatteryLevel; } public void setBatteryLevel(int percent) { myBatteryLevel = percent; } }
[ "nrsdroid@gmail.com" ]
nrsdroid@gmail.com
26dcfb19b604d8a30ecd72ca672e1517197d5f5e
0bc19cb63b9164a6e96542269c56efb5443e5470
/src/剑指offer/offer_26_树的子结构_important.java
3d8cd12c90ee46e836ac8bcd575295ed4cd9cc7c
[]
no_license
Polaris-Chen/LeetCode
cdb0c0b8f016802085a124975d099b58deb9ec2d
ec81d3032aa902764d5e4defdb0eb8a4bbe83bea
refs/heads/master
2023-06-25T06:07:31.699630
2021-07-26T04:15:22
2021-07-26T04:15:22
389,504,701
0
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package 剑指offer; //这题的核心就是要捋清思路,首先要看以root为根的A树能不能和B树匹配, // 再迭代看看以root的左右子树为根的A树能不能匹配 //然后能不能匹配则要再搞一个方法,因为又要迭代查看左右节点的val值是否匹配 public class offer_26_树的子结构_important { public static class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } public boolean isSubStructure(TreeNode A, TreeNode B) { if (A==null||B==null){ return false; } return aux_isSubStructure(A,B)||isSubStructure(A.left,B)||isSubStructure(A.right,B); } public boolean aux_isSubStructure(TreeNode A, TreeNode B) { //如果B为空证明到底了,因为B的每一个点都没有发现值不同,也就是一直没有进入下面那个if if (B==null){ return true; } //如果A空B不空或者值不同,就不用看了 if (A==null||A.val != B.val){ return false; } return aux_isSubStructure(A.left,B.left)&&aux_isSubStructure(A.right,B.right); } }
[ "409744612@qq.com" ]
409744612@qq.com
eedd47a05ec1785cff56e5567ca3ac22bd2b307f
5bb4a4b0364ec05ffb422d8b2e76374e81c8c979
/sdk/network/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/network/v2020_04_01/PolicySettings.java
32aecacd4731ce2c01a831c92f06f66c718ca4eb
[ "MIT", "LicenseRef-scancode-generic-cla", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer", "LGPL-2.1-or-later", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
FabianMeiswinkel/azure-sdk-for-java
bd14579af2f7bc63e5c27c319e2653db990056f1
41d99a9945a527b6d3cc7e1366e1d9696941dbe3
refs/heads/main
2023-08-04T20:38:27.012783
2020-07-15T21:56:57
2020-07-15T21:56:57
251,590,939
3
1
MIT
2023-09-02T00:50:23
2020-03-31T12:05:12
Java
UTF-8
Java
false
false
4,123
java
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.network.v2020_04_01; import com.fasterxml.jackson.annotation.JsonProperty; /** * Defines contents of a web application firewall global configuration. */ public class PolicySettings { /** * The state of the policy. Possible values include: 'Disabled', 'Enabled'. */ @JsonProperty(value = "state") private WebApplicationFirewallEnabledState state; /** * The mode of the policy. Possible values include: 'Prevention', * 'Detection'. */ @JsonProperty(value = "mode") private WebApplicationFirewallMode mode; /** * Whether to allow WAF to check request Body. */ @JsonProperty(value = "requestBodyCheck") private Boolean requestBodyCheck; /** * Maximum request body size in Kb for WAF. */ @JsonProperty(value = "maxRequestBodySizeInKb") private Integer maxRequestBodySizeInKb; /** * Maximum file upload size in Mb for WAF. */ @JsonProperty(value = "fileUploadLimitInMb") private Integer fileUploadLimitInMb; /** * Get the state of the policy. Possible values include: 'Disabled', 'Enabled'. * * @return the state value */ public WebApplicationFirewallEnabledState state() { return this.state; } /** * Set the state of the policy. Possible values include: 'Disabled', 'Enabled'. * * @param state the state value to set * @return the PolicySettings object itself. */ public PolicySettings withState(WebApplicationFirewallEnabledState state) { this.state = state; return this; } /** * Get the mode of the policy. Possible values include: 'Prevention', 'Detection'. * * @return the mode value */ public WebApplicationFirewallMode mode() { return this.mode; } /** * Set the mode of the policy. Possible values include: 'Prevention', 'Detection'. * * @param mode the mode value to set * @return the PolicySettings object itself. */ public PolicySettings withMode(WebApplicationFirewallMode mode) { this.mode = mode; return this; } /** * Get whether to allow WAF to check request Body. * * @return the requestBodyCheck value */ public Boolean requestBodyCheck() { return this.requestBodyCheck; } /** * Set whether to allow WAF to check request Body. * * @param requestBodyCheck the requestBodyCheck value to set * @return the PolicySettings object itself. */ public PolicySettings withRequestBodyCheck(Boolean requestBodyCheck) { this.requestBodyCheck = requestBodyCheck; return this; } /** * Get maximum request body size in Kb for WAF. * * @return the maxRequestBodySizeInKb value */ public Integer maxRequestBodySizeInKb() { return this.maxRequestBodySizeInKb; } /** * Set maximum request body size in Kb for WAF. * * @param maxRequestBodySizeInKb the maxRequestBodySizeInKb value to set * @return the PolicySettings object itself. */ public PolicySettings withMaxRequestBodySizeInKb(Integer maxRequestBodySizeInKb) { this.maxRequestBodySizeInKb = maxRequestBodySizeInKb; return this; } /** * Get maximum file upload size in Mb for WAF. * * @return the fileUploadLimitInMb value */ public Integer fileUploadLimitInMb() { return this.fileUploadLimitInMb; } /** * Set maximum file upload size in Mb for WAF. * * @param fileUploadLimitInMb the fileUploadLimitInMb value to set * @return the PolicySettings object itself. */ public PolicySettings withFileUploadLimitInMb(Integer fileUploadLimitInMb) { this.fileUploadLimitInMb = fileUploadLimitInMb; return this; } }
[ "noreply@github.com" ]
FabianMeiswinkel.noreply@github.com
d45c1bd023aa28eb353dc1515ef6765e277c3009
b77cfc30259af9e90d7c5b339ba74ce3d3438533
/src/main/java/com/everteam/dsar/web/rest/errors/FieldErrorVM.java
6aefafe01cdb539ba259652ee9a8c96a7ef9a86d
[]
no_license
fernandogumma/dsar
3da49636ea1b776539bc3b69f61357f761296c3d
23803093be151e7fcb0d57d74139318d90003515
refs/heads/master
2022-12-26T08:04:20.346497
2019-11-18T11:44:11
2019-11-18T11:44:11
222,435,989
0
0
null
2022-12-16T04:41:53
2019-11-18T11:44:02
Java
UTF-8
Java
false
false
649
java
package com.everteam.dsar.web.rest.errors; import java.io.Serializable; public class FieldErrorVM implements Serializable { private static final long serialVersionUID = 1L; private final String objectName; private final String field; private final String message; public FieldErrorVM(String dto, String field, String message) { this.objectName = dto; this.field = field; this.message = message; } public String getObjectName() { return objectName; } public String getField() { return field; } public String getMessage() { return message; } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
0a93cc871a98a4165730dca43e470564efb56135
8c99f97891d62d0dd996b1e062e17ad26532d6e7
/InfoPubLib/src/com/routon/inforelease/json/ClassInfoListBean.java
58900d19dd330a1d2b2c37f111a947f078f7eb2b
[ "Apache-2.0" ]
permissive
wyl710819/MyProject
0e2af8d521f975d718cae581b17f8797f1f92435
3001137d1593a8fac48a3c7ad2d278fab8f03711
refs/heads/master
2020-03-30T07:55:16.548450
2018-09-30T14:58:35
2018-09-30T14:58:35
150,974,722
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.routon.inforelease.json; import java.util.List; import com.routon.json.BaseBean; public class ClassInfoListBean extends BaseBean{ public List<ClassInfoListdatasBean> datas; public int page; public int pageSize; public int fullListSize; };
[ "841914025@qq.com" ]
841914025@qq.com
8db6e2a1a17e72b18e33fce65db7b828abe7a83b
31820e9fdff55452f0beeb6984f2e2166facd2fe
/app/src/main/java/com/aqinga/greendao/MainActivity.java
1391aa7fdc33700ff6df86a259a7e90e93e6fb2f
[]
no_license
Zhangqingling1/GreenDao
7064b85f338c058026bb47ca7c329d0635b4a416
b679e611a8310ada8708448c687f2bebd07d9337
refs/heads/master
2021-07-12T10:39:39.711649
2017-10-13T06:29:32
2017-10-13T06:29:32
106,786,639
0
0
null
null
null
null
UTF-8
Java
false
false
3,478
java
package com.aqinga.greendao; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import com.aqinga.greendaodemo.greendao.gen.UserDao; import java.util.List; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private EditText edname; private Button intert; private Button delete; private Button uadate; private List<User> list; private MyAdapter adapter; private ListView listview; private EditText newname; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initview(); initdata(); } private void initdata() { //拿到一个集合 list = GreenDaoManger.getInstance().getDaoSession().getUserDao().queryBuilder().build().list(); adapter = new MyAdapter(this,list); listview.setAdapter(adapter); } //添加 public void intert(Long id,String name){ UserDao userDao = GreenDaoManger.getInstance().getDaoSession().getUserDao(); User user = new User(id,name); userDao.insert(user); list.clear(); list.addAll(userDao.queryBuilder().build().list()); adapter.notifyDataSetChanged(); } public void delete(String name){ UserDao userDao = GreenDaoManger.getInstance().getDaoSession().getUserDao(); List<User> list1 = userDao.queryBuilder().where(UserDao.Properties.Name.eq(name)).build().list(); if (list1!=null){ for (User user:list1) { userDao.deleteByKey(user.getId()); list.remove(user); } adapter.notifyDataSetChanged(); } } public void update(String name,String newsname){ UserDao userDao = GreenDaoManger.getInstance().getDaoSession().getUserDao(); List<User> list2 = userDao.queryBuilder().where(UserDao.Properties.Name.eq(name)).build().list(); if (list2!=null){ for (User user:list2) { user.setName(newsname); userDao.update(user); } adapter.notifyDataSetChanged(); Toast.makeText(this,"修改成功",Toast.LENGTH_SHORT).show(); }else { Toast.makeText(this,"修改失败",Toast.LENGTH_SHORT).show(); } } private void initview() { edname = (EditText) findViewById(R.id.et_Name); intert = (Button) findViewById(R.id.intert); delete = (Button) findViewById(R.id.delete); uadate = (Button) findViewById(R.id.update); newname = (EditText) findViewById(R.id.newsname); listview = (ListView) findViewById(R.id.list_view); intert.setOnClickListener(this); delete.setOnClickListener(this); uadate.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.intert: intert(null,edname.getText().toString().trim()); break; case R.id.delete: delete(edname.getText().toString().trim()); break; case R.id.update: update(edname.getText().toString(),newname.getText().toString().trim()); break; } } }
[ "17600920523@189.cn" ]
17600920523@189.cn
e2441f7f411defbd97353b95f5964266370efc4f
867ce62d2739cbba4c6e05719a23bbd99700b0b4
/korea/src/korea/테스트.java
a281f97d6190d4aefc213a7369bba0a34806a79c
[]
no_license
joyesung/java-db
c3847b15d4b683c34d93b0ec665448e94c664d75
86b43125b5ce4d21129b42e39ca225fe73789ca2
refs/heads/master
2023-01-03T12:30:40.738153
2019-07-19T06:39:25
2019-07-19T06:39:25
178,324,369
0
0
null
2022-12-16T00:57:20
2019-03-29T03:17:51
Java
UTF-8
Java
false
false
138
java
package korea; public class 테스트 { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "frog0039@naver.com" ]
frog0039@naver.com
a30f07478d3f886d269fb257fac188853bce6027
fe7b4809ce3913a195c413f8153fc5ba948a7d48
/Problem17.java
2446c297addeae14e4c54388b9f99b560554ed32
[]
no_license
jacksondelametter/ProjectUelur
86bd9407064ee4224caef4caa5521a511ec1a76c
ed697cb3232fe66027c5ee4ed3c8cf39aa3241c2
refs/heads/master
2020-08-30T20:57:12.674576
2016-09-03T20:47:35
2016-09-03T20:47:35
67,310,673
0
0
null
null
null
null
UTF-8
Java
false
false
2,767
java
import com.intellij.openapi.vcs.history.VcsRevisionNumber; /** * Created by Jackson on 5/22/16. */ public class Problem17 { static String[] singleDigitNums = {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; static String[] teenDigitNums = {"Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"}; static String[] doubleDigitNums = {"","Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"}; public static void main(String[] args){ String number; String word; int letterCount = 0; for(int i=1;i<=1000;i++){ word = getWord(i + ""); System.out.println(word); letterCount += word.length(); } System.out.println("The letter count is " + letterCount); } public static String getWord(String number){ String word; int numberCount = number.length(); if(numberCount == 1) word = singleDigitWord(number); else if(numberCount == 2) word = doubleDigitWord(number); else if(numberCount == 3) word = tripleDigitWord(number); else word = "Onethousand"; return word; } public static String singleDigitWord(String number){ String word = ""; for(int i=1;i<=9;i++){ if(Integer.parseInt(number) == i){ word = singleDigitNums[i - 1]; break; } } return word; } public static String doubleDigitWord(String number){ int tensPlaceInt = Integer.parseInt(number.charAt(0) + ""); int onesPlaceInt = Integer.parseInt(number.charAt(1) + ""); String tensPlaceString = ""; String onesPlaceString = ""; if(tensPlaceInt == 1) return teenDigitNums[Integer.parseInt(number) - 10]; for(int i=1;i<=9;i++){ if(onesPlaceInt == i) onesPlaceString = singleDigitNums[i - 1]; if(tensPlaceInt == i) tensPlaceString = doubleDigitNums[i - 1]; } return tensPlaceString + onesPlaceString; } public static String tripleDigitWord(String number){ int oneHundredsPlaceInt = Integer.parseInt(number.charAt(0) + ""); String oneHundredsPlaceString = ""; String onesAndTensPlace = doubleDigitWord(number.substring(1)); String word; for(int i=1;i<=9;i++){ if(oneHundredsPlaceInt == i) oneHundredsPlaceString = singleDigitNums[i - 1] + "Hundred"; } word = oneHundredsPlaceString + onesAndTensPlace; if(!onesAndTensPlace.equals("")) word = oneHundredsPlaceString + "and" + onesAndTensPlace; else word = oneHundredsPlaceString + onesAndTensPlace; return word; } }
[ "jacksondelametter@gmail.com" ]
jacksondelametter@gmail.com
86dcfa3fa878ac16524262d20221b0196ecca5d8
2800920f14f5f32d5a1c12c8f2f9fb72e943d2cb
/Man.java
b39d28d21cf42cc23d1b834408bc83628ebff602
[]
no_license
parthdesai97/SokobanGame
1e0275bdad0e733e023dbb18bba420b678ab7a97
b58a1e8fbabf1c3c02ebcaa38d5e8292499eaa44
refs/heads/master
2021-01-10T05:23:34.864293
2016-03-21T21:13:06
2016-03-21T21:13:06
54,422,449
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
//---------------------------------------------------------------80 columns---| /* comp285 Man.java * -------------- */ class Man extends Thing { public Man(Square sq, Sokoban g) { super(sq, g); } public boolean doMove(Move m) { int direction = m.getDirection(); Move undo = null; if (!m.getIsUndo()) { undo = new Move(Location.reverseDirection(m.getDirection()), true); } Location newLoc = square.getLocation().adjacentLocation(direction); if (game.inBounds(newLoc)) { Square newSquare = game.squareAt(newLoc); if (!m.getIsUndo()) undo.setPushed(newSquare.getContents()); if (newSquare.pushContents(direction)) { if (!m.getIsUndo()) game.addMove(undo); return newSquare.addContents(this); } else if (newSquare.canEnter()) { if (!m.getIsUndo()) undo.setPushed(null); boolean returnValue = newSquare.addContents(this); if (m.getIsUndo() && m.getPushed() != null) { game.squareAt(m.getPushed().getLocation().adjacentLocation(direction)).addContents(m.getPushed()); } if (!m.getIsUndo()) game.addMove(undo); return returnValue; } } return false; } public String getImageName() { return "Man"; } public boolean move(Move m) { return doMove(m); } }
[ "pdesai@g.hmc.edu" ]
pdesai@g.hmc.edu
54bb13b8edf9a3c0aa1b3d83b795c9cf68bf47a7
274835af3cfe3bda4f8ba63c8e585d1806225194
/ListDemo.java
29dc741c1228813d99d3003a2c67a48053df5168
[]
no_license
1234655/Gade-Manvitha
9ce0658f86a172625d7c47d246fe481ddf8cfdac
2b418dcd879c1e34f2422dbb61f1f08c49c3c8e9
refs/heads/main
2023-01-03T06:31:00.709321
2020-11-03T10:23:35
2020-11-03T10:23:35
307,997,319
0
1
null
null
null
null
UTF-8
Java
false
false
686
java
package Employee; import java.util.ArrayList; import java.util.Enumeration; import java.util.Queue; import java.util.Vector; public class ListDemo { public static void main(String args[]) { Vector<Integer> sh = new Vector<Integer>(); sh.add(12); sh.add(13); sh.add(14); sh.add(15); sh.add(16); sh.add(17); sh.add(18); sh.add(19); sh.add(20); System.out.println(sh); sh.add(3,92);//adds 92 at 3rd position System.out.println(sh); System.out.println(sh.get(5));//returns the element with 5th position Enumeration<Integer> ee=sh.elements(); while(ee.hasMoreElements()) { System.out.println(ee.nextElement()); } } }
[ "noreply@github.com" ]
1234655.noreply@github.com
406e29a06d4ee97c47c3f03a93c83ab9fe584e5d
9cc96f4988b2b349e95dd1e6339b57d473a81218
/app/src/main/java/com/example/travelpartner/Account.java
8c1a59da182f8c4ff3fb429f5283827c8e6440f1
[]
no_license
HarshiD123/MAD_Project
1bfd966cff950bb15555ea1b41e333178d900995
ba240ceddcc498c0651bc49bac760eb418fa8fe1
refs/heads/master
2023-04-23T19:11:05.023094
2021-05-14T08:46:31
2021-05-14T08:46:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,891
java
package com.example.travelpartner; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class Account extends AppCompatActivity { EditText name,uname,email,password,cnumber; String UN; DatabaseReference dbacc; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_account); name=findViewById(R.id.name); uname=findViewById(R.id.username); email=findViewById(R.id.email); password=findViewById(R.id.password); cnumber=findViewById(R.id.contactnumber); UN=getIntent().getStringExtra("Username"); dbacc= FirebaseDatabase.getInstance().getReference().child("Users").child(UN); dbacc.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot snapshot) { if(snapshot.hasChildren()) { name.setText(snapshot.child("fname").getValue().toString()); uname.setText(snapshot.child("fname").getValue().toString()+snapshot.child("lname").getValue().toString()); email.setText(snapshot.child("email").getValue().toString()+".com"); password.setText(snapshot.child("password").getValue().toString()); cnumber.setText(snapshot.child("phone").getValue().toString()); } } @Override public void onCancelled(@NonNull DatabaseError error) { } }); BottomNavigationView btmnavi=findViewById(R.id.bottom_navigation); btmnavi.setSelectedItemId(R.id.account); btmnavi.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()){ case R.id.home: startActivity(new Intent(getApplicationContext(),MainActivity.class)); overridePendingTransition(0,0); return true; case R.id.account: return true; case R.id.booking: startActivity(new Intent(getApplicationContext(),Booking_Home.class)); overridePendingTransition(0,0); return true; case R.id.rent: startActivity(new Intent(getApplicationContext(),Rent.class)); overridePendingTransition(0,0); return true; case R.id.share: startActivity(new Intent(getApplicationContext(),Share.class)); overridePendingTransition(0,0); return true; } return false; } }); } public void reqests(View view) { Intent intent=new Intent(this,share_request_display.class); startActivity(intent); } }
[ "harshanabuddhika9@gmail.com" ]
harshanabuddhika9@gmail.com
f1fde92bb2b03f28f95bfe7ebebb4508bf984a80
a4e09b5e4e0c15873511dbe7baf056e2f86f5c90
/VideoPlayer 4/app/src/main/java/com/vcooline/li/videoplayer/bean/WorkCommentsBean.java
91a553e28c1e7e892919d5475bd10aba30f1a0db
[]
no_license
snoylee/VideoPlayer
90847921f8b81ed31df864993eace8cdeb25ef5f
2597b100e9bdad4830803e6c627a2a3f99a2478d
refs/heads/master
2021-01-21T20:42:23.706493
2017-06-18T07:23:47
2017-06-18T07:23:47
94,671,848
0
1
null
null
null
null
UTF-8
Java
false
false
2,834
java
package com.vcooline.li.videoplayer.bean; import com.vcooline.li.videoplayer.tools.JSONUtil; import org.json.JSONObject; /** * Created by Trace on 2014/8/31. */ public class WorkCommentsBean { public int getId() { return id; } public void setId(int id) { this.id = id; } public String getWorkName() { return workName; } public void setWorkName(String workName) { this.workName = workName; } public String getWorkPic() { return workPic; } public void setWorkPic(String workPic) { this.workPic = workPic; } public String getPersionId() { return persionId; } public void setPersionId(String persionId) { this.persionId = persionId; } public String getPersionName() { return persionName; } public void setPersionName(String persionName) { this.persionName = persionName; } public boolean isCommited() { return isCommited; } public void setCommited(boolean isCommited) { this.isCommited = isCommited; } public String getCommitText() { return commitText; } public void setCommitText(String commitText) { this.commitText = commitText; } public long getCreateTime() { return createTime; } public void setCreateTime(long createTime) { this.createTime = createTime; } public long getUpdateTime() { return updateTime; } public void setUpdateTime(long updateTime) { this.updateTime = updateTime; } private int id; private String workName; private String workPic; private String persionId; private String persionName; private boolean isCommited; private String commitText; private long createTime; private long updateTime; public static WorkCommentsBean getWorkComment(JSONObject jsonObject){ WorkCommentsBean workCommentsBean = new WorkCommentsBean(); JSONUtil jsonUtil = new JSONUtil(jsonObject); workCommentsBean.setId(jsonUtil.optInteger("id")); workCommentsBean.setWorkName(jsonUtil.optString("workName")); workCommentsBean.setWorkPic(jsonUtil.optString("workPic")); workCommentsBean.setPersionId(jsonUtil.optString("personId")); workCommentsBean.setPersionName(jsonUtil.optString("personName")); workCommentsBean.setCommited(jsonUtil.optBoolean("isComment")); workCommentsBean.setUpdateTime(jsonUtil.optLong("createAt")); workCommentsBean.setUpdateTime(jsonUtil.optLong("updateAt")); workCommentsBean.setCommitText(jsonUtil.optString("commentInfo")); return workCommentsBean; } }
[ "litieshan549860123@126.com" ]
litieshan549860123@126.com
35884b973f319541c431d9a600a3709327ea67d1
92d556db9fb543493ac4f3a27346c5fa908ca7b1
/src/com/xiuye/constant/CONSTANT_POOL.java
d8c27becef10fd39877d35b2f93b05b2c50c7585
[]
no_license
XiuyeXYE/JavaClassFile
e570ff3c5f96a614fe8a477509e796135bca7b66
144381c49cd6c06265ce95ac68d6f172e78d852e
refs/heads/master
2020-03-08T09:26:10.571917
2018-04-05T09:43:38
2018-04-05T09:43:38
128,047,078
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.xiuye.constant; import java.util.ArrayList; import java.util.List; import com.xiuye.constant.info.CONSTANT_info; public final class CONSTANT_POOL { private List<CONSTANT_info> const_info; public CONSTANT_POOL() { this.const_info = new ArrayList<>(); } public void add_Constant_info(CONSTANT_info info){ const_info.add(info); } //u2 public int length(){ return const_info.size(); } public List<CONSTANT_info> getAllConstInfos(){ return const_info; } }
[ "xiuye_engineer@outlook.com" ]
xiuye_engineer@outlook.com
b766278aa90e86d6aada8a290cf10ec6be835110
828bc04856605869a6605f9a97678a426607ef9f
/app/src/main/java/com/android/incallui/CallCardPresenter.java
e3c336b58bdb8803a257e343261ddb1b249829ac
[]
no_license
artillerymans/Dialer_Support
14925695e8b6a7d12d33973c665e6e06b082019a
c460b7b9a9a1da0c0d91aaf253098b96a5c5d384
refs/heads/master
2022-11-23T07:55:11.819343
2020-08-02T05:57:26
2020-08-02T05:57:26
284,218,783
1
0
null
null
null
null
UTF-8
Java
false
false
45,337
java
/* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.incallui; import static com.android.contacts.common.compat.CallCompat.Details.PROPERTY_ENTERPRISE_CALL; import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; import android.hardware.display.DisplayManager; import android.os.BatteryManager; import android.os.Handler; import android.os.Trace; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.content.ContextCompat; import android.telecom.Call.Details; import android.telecom.StatusHints; import android.telecom.TelecomManager; import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.text.TextUtils; import android.view.Display; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import com.android.contacts.common.ContactsUtils; import com.android.dialer.R; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderComponent; import com.android.dialer.contacts.ContactsComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumberutil.PhoneNumberHelper; import com.android.dialer.postcall.PostCall; import com.android.dialer.preferredsim.suggestion.SuggestionProvider; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallDetailsListener; import com.android.incallui.InCallPresenter.InCallEventListener; import com.android.incallui.InCallPresenter.InCallState; import com.android.incallui.InCallPresenter.InCallStateListener; import com.android.incallui.InCallPresenter.IncomingCallListener; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; import com.android.incallui.call.DialerCallListener; import com.android.incallui.call.state.DialerCallState; import com.android.incallui.calllocation.CallLocation; import com.android.incallui.calllocation.CallLocationComponent; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.InCallScreen; import com.android.incallui.incall.protocol.InCallScreenDelegate; import com.android.incallui.incall.protocol.PrimaryCallState; import com.android.incallui.incall.protocol.PrimaryCallState.ButtonState; import com.android.incallui.incall.protocol.PrimaryInfo; import com.android.incallui.incall.protocol.SecondaryInfo; import com.android.incallui.videotech.utils.SessionModificationState; import java.lang.ref.WeakReference; /** * Controller for the Call Card Fragment. This class listens for changes to InCallState and passes * it along to the fragment. */ public class CallCardPresenter implements InCallStateListener, IncomingCallListener, InCallDetailsListener, InCallEventListener, InCallScreenDelegate, DialerCallListener { /** * Amount of time to wait before sending an announcement via the accessibility manager. When the * call state changes to an outgoing or incoming state for the first time, the UI can often be * changing due to call updates or contact lookup. This allows the UI to settle to a stable state * to ensure that the correct information is announced. */ private static final long ACCESSIBILITY_ANNOUNCEMENT_DELAY_MILLIS = 500; /** Flag to allow the user's current location to be shown during emergency calls. */ private static final String CONFIG_ENABLE_EMERGENCY_LOCATION = "config_enable_emergency_location"; private static final boolean CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT = true; /** * Make it possible to not get location during an emergency call if the battery is too low, since * doing so could trigger gps and thus potentially cause the phone to die in the middle of the * call. */ private static final String CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION = "min_battery_percent_for_emergency_location"; private static final long CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT = 10; private final Context context; private final Handler handler = new Handler(); private DialerCall primary; private String primaryNumber; private DialerCall secondary; private String secondaryNumber; private ContactCacheEntry primaryContactInfo; private ContactCacheEntry secondaryContactInfo; private boolean isFullscreen = false; private InCallScreen inCallScreen; private boolean isInCallScreenReady; private boolean shouldSendAccessibilityEvent; @NonNull private final CallLocation callLocation; private final Runnable sendAccessibilityEventRunnable = new Runnable() { @Override public void run() { shouldSendAccessibilityEvent = !sendAccessibilityEvent(context, getUi()); LogUtil.i( "CallCardPresenter.sendAccessibilityEventRunnable", "still should send: %b", shouldSendAccessibilityEvent); if (!shouldSendAccessibilityEvent) { handler.removeCallbacks(this); } } }; public CallCardPresenter(Context context) { LogUtil.i("CallCardPresenter.constructor", null); this.context = Assert.isNotNull(context).getApplicationContext(); callLocation = CallLocationComponent.get(this.context).getCallLocation(); } private static boolean hasCallSubject(DialerCall call) { return !TextUtils.isEmpty(call.getCallSubject()); } @Override public void onInCallScreenDelegateInit(InCallScreen inCallScreen) { Assert.isNotNull(inCallScreen); this.inCallScreen = inCallScreen; // Call may be null if disconnect happened already. DialerCall call = CallList.getInstance().getFirstCall(); if (call != null) { primary = call; if (shouldShowNoteSentToast(primary)) { this.inCallScreen.showNoteSentToast(); } call.addListener(this); // start processing lookups right away. if (!call.isConferenceCall()) { startContactInfoSearch(call, true, call.getState() == DialerCallState.INCOMING); } else { updateContactEntry(null, true); } } onStateChange(null, InCallPresenter.getInstance().getInCallState(), CallList.getInstance()); } @Override public void onInCallScreenReady() { LogUtil.i("CallCardPresenter.onInCallScreenReady", null); Assert.checkState(!isInCallScreenReady); // Contact search may have completed before ui is ready. if (primaryContactInfo != null) { updatePrimaryDisplayInfo(); } // Register for call state changes last InCallPresenter.getInstance().addListener(this); InCallPresenter.getInstance().addIncomingCallListener(this); InCallPresenter.getInstance().addDetailsListener(this); InCallPresenter.getInstance().addInCallEventListener(this); isInCallScreenReady = true; // Log location impressions if (isOutgoingEmergencyCall(primary)) { Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NEW_EMERGENCY_CALL); } else if (isIncomingEmergencyCall(primary) || isIncomingEmergencyCall(secondary)) { Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CALLBACK); } // Showing the location may have been skipped if the UI wasn't ready during previous layout. if (shouldShowLocation()) { inCallScreen.showLocationUi(getLocationFragment()); // Log location impressions if (!hasLocationPermission()) { Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_NO_LOCATION_PERMISSION); } else if (isBatteryTooLowForEmergencyLocation()) { Logger.get(context) .logImpression(DialerImpression.Type.EMERGENCY_BATTERY_TOO_LOW_TO_GET_LOCATION); } else if (!callLocation.canGetLocation(context)) { Logger.get(context).logImpression(DialerImpression.Type.EMERGENCY_CANT_GET_LOCATION); } } } @Override public void onInCallScreenUnready() { LogUtil.i("CallCardPresenter.onInCallScreenUnready", null); Assert.checkState(isInCallScreenReady); // stop getting call state changes InCallPresenter.getInstance().removeListener(this); InCallPresenter.getInstance().removeIncomingCallListener(this); InCallPresenter.getInstance().removeDetailsListener(this); InCallPresenter.getInstance().removeInCallEventListener(this); if (primary != null) { primary.removeListener(this); } callLocation.close(); primary = null; primaryContactInfo = null; secondaryContactInfo = null; isInCallScreenReady = false; } @Override public void onIncomingCall(InCallState oldState, InCallState newState, DialerCall call) { // same logic should happen as with onStateChange() onStateChange(oldState, newState, CallList.getInstance()); } @Override public void onStateChange(InCallState oldState, InCallState newState, CallList callList) { Trace.beginSection("CallCardPresenter.onStateChange"); LogUtil.v("CallCardPresenter.onStateChange", "oldState: %s, newState: %s", oldState, newState); if (inCallScreen == null) { Trace.endSection(); return; } DialerCall primary = null; DialerCall secondary = null; if (newState == InCallState.INCOMING) { primary = callList.getIncomingCall(); } else if (newState == InCallState.PENDING_OUTGOING || newState == InCallState.OUTGOING) { primary = callList.getOutgoingCall(); if (primary == null) { primary = callList.getPendingOutgoingCall(); } // getCallToDisplay doesn't go through outgoing or incoming calls. It will return the // highest priority call to display as the secondary call. secondary = InCallPresenter.getCallToDisplay(callList, null, true); } else if (newState == InCallState.INCALL) { primary = InCallPresenter.getCallToDisplay(callList, null, false); secondary = InCallPresenter.getCallToDisplay(callList, primary, true); } LogUtil.v("CallCardPresenter.onStateChange", "primary call: " + primary); LogUtil.v("CallCardPresenter.onStateChange", "secondary call: " + secondary); String primaryNumber = null; String secondaryNumber = null; if (primary != null) { primaryNumber = primary.getNumber(); } if (secondary != null) { secondaryNumber = secondary.getNumber(); } final boolean primaryChanged = !(DialerCall.areSame(this.primary, primary) && TextUtils.equals(this.primaryNumber, primaryNumber)); final boolean secondaryChanged = !(DialerCall.areSame(this.secondary, secondary) && TextUtils.equals(this.secondaryNumber, secondaryNumber)); this.secondary = secondary; this.secondaryNumber = secondaryNumber; DialerCall previousPrimary = this.primary; this.primary = primary; this.primaryNumber = primaryNumber; if (this.primary != null) { inCallScreen.updateInCallScreenColors(); } if (primaryChanged && shouldShowNoteSentToast(primary)) { inCallScreen.showNoteSentToast(); } // Refresh primary call information if either: // 1. Primary call changed. // 2. The call's ability to manage conference has changed. if (shouldRefreshPrimaryInfo(primaryChanged)) { // primary call has changed if (previousPrimary != null) { previousPrimary.removeListener(this); } this.primary.addListener(this); primaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.primary); updatePrimaryDisplayInfo(); maybeStartSearch(this.primary, true); } if (previousPrimary != null && this.primary == null) { previousPrimary.removeListener(this); } if (secondaryChanged) { if (this.secondary == null) { // Secondary call may have ended. Update the ui. secondaryContactInfo = null; updateSecondaryDisplayInfo(); } else { // secondary call has changed secondaryContactInfo = ContactInfoCache.buildCacheEntryFromCall(context, this.secondary); updateSecondaryDisplayInfo(); maybeStartSearch(this.secondary, false); } } // Set the call state int callState = DialerCallState.IDLE; if (this.primary != null) { callState = this.primary.getState(); updatePrimaryCallState(); } else { getUi().setCallState(PrimaryCallState.empty()); } maybeShowManageConferenceCallButton(); // Hide the end call button instantly if we're receiving an incoming call. getUi() .setEndCallButtonEnabled( shouldShowEndCallButton(this.primary, callState), callState != DialerCallState.INCOMING /* animate */); maybeSendAccessibilityEvent(oldState, newState, primaryChanged); Trace.endSection(); } @Override public void onDetailsChanged(DialerCall call, Details details) { updatePrimaryCallState(); if (call.can(Details.CAPABILITY_MANAGE_CONFERENCE) != details.can(Details.CAPABILITY_MANAGE_CONFERENCE)) { maybeShowManageConferenceCallButton(); } } @Override public void onDialerCallDisconnect() {} @Override public void onDialerCallUpdate() { // No-op; specific call updates handled elsewhere. } @Override public void onWiFiToLteHandover() {} @Override public void onHandoverToWifiFailure() {} @Override public void onInternationalCallOnWifi() {} @Override public void onEnrichedCallSessionUpdate() { LogUtil.enterBlock("CallCardPresenter.onEnrichedCallSessionUpdate"); updatePrimaryDisplayInfo(); } /** Handles a change to the child number by refreshing the primary call info. */ @Override public void onDialerCallChildNumberChange() { LogUtil.v("CallCardPresenter.onDialerCallChildNumberChange", ""); if (primary == null) { return; } updatePrimaryDisplayInfo(); } /** Handles a change to the last forwarding number by refreshing the primary call info. */ @Override public void onDialerCallLastForwardedNumberChange() { LogUtil.v("CallCardPresenter.onDialerCallLastForwardedNumberChange", ""); if (primary == null) { return; } updatePrimaryDisplayInfo(); updatePrimaryCallState(); } @Override public void onDialerCallUpgradeToVideo() {} /** Handles a change to the session modification state for a call. */ @Override public void onDialerCallSessionModificationStateChange() { LogUtil.enterBlock("CallCardPresenter.onDialerCallSessionModificationStateChange"); if (primary == null) { return; } getUi() .setEndCallButtonEnabled( primary.getVideoTech().getSessionModificationState() != SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST, true /* shouldAnimate */); updatePrimaryCallState(); } private boolean shouldRefreshPrimaryInfo(boolean primaryChanged) { if (primary == null) { return false; } return primaryChanged || inCallScreen.isManageConferenceVisible() != shouldShowManageConference(); } private void updatePrimaryCallState() { if (getUi() != null && primary != null) { boolean isWorkCall = primary.hasProperty(PROPERTY_ENTERPRISE_CALL) || (primaryContactInfo != null && primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); boolean isHdAudioCall = isPrimaryCallActive() && primary.hasProperty(Details.PROPERTY_HIGH_DEF_AUDIO); boolean isAttemptingHdAudioCall = !isHdAudioCall && !primary.hasProperty(DialerCall.PROPERTY_CODEC_KNOWN) && MotorolaUtils.shouldBlinkHdIconWhenConnectingCall(context); boolean isBusiness = primaryContactInfo != null && primaryContactInfo.isBusiness; // Check for video state change and update the visibility of the contact photo. The contact // photo is hidden when the incoming video surface is shown. // The contact photo visibility can also change in setPrimary(). boolean shouldShowContactPhoto = !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState()); getUi() .setCallState( PrimaryCallState.builder() .setState(primary.getState()) .setIsVideoCall(primary.isVideoCall()) .setSessionModificationState(primary.getVideoTech().getSessionModificationState()) .setDisconnectCause(primary.getDisconnectCause()) .setConnectionLabel(getConnectionLabel()) .setPrimaryColor( InCallPresenter.getInstance().getThemeColorManager().getPrimaryColor()) .setSimSuggestionReason(getSimSuggestionReason()) .setConnectionIcon(getCallStateIcon()) .setGatewayNumber(getGatewayNumber()) .setCallSubject(shouldShowCallSubject(primary) ? primary.getCallSubject() : null) .setCallbackNumber( PhoneNumberHelper.formatNumber( context, primary.getCallbackNumber(), primary.getSimCountryIso())) .setIsWifi(primary.hasProperty(Details.PROPERTY_WIFI)) .setIsConference( primary.isConferenceCall() && !primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE)) .setIsWorkCall(isWorkCall) .setIsHdAttempting(isAttemptingHdAudioCall) .setIsHdAudioCall(isHdAudioCall) .setIsForwardedNumber( !TextUtils.isEmpty(primary.getLastForwardedNumber()) || primary.isCallForwarded()) .setShouldShowContactPhoto(shouldShowContactPhoto) .setConnectTimeMillis(primary.getConnectTimeMillis()) .setIsVoiceMailNumber(primary.isVoiceMailNumber()) .setIsRemotelyHeld(primary.isRemotelyHeld()) .setIsBusinessNumber(isBusiness) .setSupportsCallOnHold(supports2ndCallOnHold()) .setSwapToSecondaryButtonState(getSwapToSecondaryButtonState()) .setIsAssistedDialed(primary.isAssistedDialed()) .setCustomLabel(null) .setAssistedDialingExtras(primary.getAssistedDialingExtras()) .build()); InCallActivity activity = (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity()); if (activity != null) { activity.onPrimaryCallStateChanged(); } } } private @ButtonState int getSwapToSecondaryButtonState() { if (secondary == null) { return ButtonState.NOT_SUPPORT; } if (primary.getState() == DialerCallState.ACTIVE) { return ButtonState.ENABLED; } return ButtonState.DISABLED; } /** Only show the conference call button if we can manage the conference. */ private void maybeShowManageConferenceCallButton() { getUi().showManageConferenceCallButton(shouldShowManageConference()); } /** * Determines if the manage conference button should be visible, based on the current primary * call. * * @return {@code True} if the manage conference button should be visible. */ private boolean shouldShowManageConference() { if (primary == null) { return false; } return primary.can(android.telecom.Call.Details.CAPABILITY_MANAGE_CONFERENCE) && !isFullscreen; } private boolean supports2ndCallOnHold() { DialerCall firstCall = CallList.getInstance().getActiveOrBackgroundCall(); DialerCall incomingCall = CallList.getInstance().getIncomingCall(); if (firstCall != null && incomingCall != null && firstCall != incomingCall) { return incomingCall.can(Details.CAPABILITY_HOLD); } return true; } @Override public void onCallStateButtonClicked() { Intent broadcastIntent = Bindings.get(context).getCallStateButtonBroadcastIntent(context); if (broadcastIntent != null) { LogUtil.v( "CallCardPresenter.onCallStateButtonClicked", "sending call state button broadcast: " + broadcastIntent); context.sendBroadcast(broadcastIntent, Manifest.permission.READ_PHONE_STATE); } } @Override public void onManageConferenceClicked() { InCallActivity activity = (InCallActivity) (inCallScreen.getInCallScreenFragment().getActivity()); activity.showConferenceFragment(true); } @Override public void onShrinkAnimationComplete() { InCallPresenter.getInstance().onShrinkAnimationComplete(); } private void maybeStartSearch(DialerCall call, boolean isPrimary) { // no need to start search for conference calls which show generic info. if (call != null && !call.isConferenceCall()) { startContactInfoSearch(call, isPrimary, call.getState() == DialerCallState.INCOMING); } } /** Starts a query for more contact data for the save primary and secondary calls. */ private void startContactInfoSearch( final DialerCall call, final boolean isPrimary, boolean isIncoming) { final ContactInfoCache cache = ContactInfoCache.getInstance(context); cache.findInfo(call, isIncoming, new ContactLookupCallback(this, isPrimary)); } private void onContactInfoComplete(String callId, ContactCacheEntry entry, boolean isPrimary) { final boolean entryMatchesExistingCall = (isPrimary && primary != null && TextUtils.equals(callId, primary.getId())) || (!isPrimary && secondary != null && TextUtils.equals(callId, secondary.getId())); if (entryMatchesExistingCall) { updateContactEntry(entry, isPrimary); } else { LogUtil.e( "CallCardPresenter.onContactInfoComplete", "dropping stale contact lookup info for " + callId); } final DialerCall call = CallList.getInstance().getCallById(callId); if (call != null) { call.getLogState().contactLookupResult = entry.contactLookupResult; } if (entry.lookupUri != null) { CallerInfoUtils.sendViewNotification(context, entry.lookupUri); } } private void onImageLoadComplete(String callId, ContactCacheEntry entry) { if (getUi() == null) { return; } if (entry.photo != null) { if (primary != null && callId.equals(primary.getId())) { updateContactEntry(entry, true /* isPrimary */); } else if (secondary != null && callId.equals(secondary.getId())) { updateContactEntry(entry, false /* isPrimary */); } } } private void updateContactEntry(ContactCacheEntry entry, boolean isPrimary) { if (isPrimary) { primaryContactInfo = entry; updatePrimaryDisplayInfo(); } else { secondaryContactInfo = entry; updateSecondaryDisplayInfo(); } } private void updatePrimaryDisplayInfo() { if (inCallScreen == null) { // TODO: May also occur if search result comes back after ui is destroyed. Look into // removing that case completely. LogUtil.v( "CallCardPresenter.updatePrimaryDisplayInfo", "updatePrimaryDisplayInfo called but ui is null!"); return; } if (primary == null) { // Clear the primary display info. inCallScreen.setPrimary(PrimaryInfo.empty()); return; } // Hide the contact photo if we are in a video call and the incoming video surface is // showing. boolean showContactPhoto = !VideoCallPresenter.showIncomingVideo(primary.getVideoState(), primary.getState()); // DialerCall placed through a work phone account. boolean hasWorkCallProperty = primary.hasProperty(PROPERTY_ENTERPRISE_CALL); MultimediaData multimediaData = null; if (primary.getEnrichedCallSession() != null) { multimediaData = primary.getEnrichedCallSession().getMultimediaData(); } if (primary.isConferenceCall()) { LogUtil.v( "CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for conference call."); inCallScreen.setPrimary( PrimaryInfo.builder() .setName( CallerInfoUtils.getConferenceString( context, primary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE))) .setNameIsNumber(false) .setPhotoType(ContactPhotoType.DEFAULT_PLACEHOLDER) .setIsSipCall(false) .setIsContactPhotoShown(showContactPhoto) .setIsWorkCall(hasWorkCallProperty) .setIsSpam(false) .setIsLocalContact(false) .setAnsweringDisconnectsOngoingCall(false) .setShouldShowLocation(shouldShowLocation()) .setShowInCallButtonGrid(true) .setNumberPresentation(primary.getNumberPresentation()) .build()); } else if (primaryContactInfo != null) { LogUtil.v( "CallCardPresenter.updatePrimaryDisplayInfo", "update primary display info for " + primaryContactInfo); String name = getNameForCall(primaryContactInfo); String number; boolean isChildNumberShown = !TextUtils.isEmpty(primary.getChildNumber()); boolean isForwardedNumberShown = !TextUtils.isEmpty(primary.getLastForwardedNumber()); boolean isCallSubjectShown = shouldShowCallSubject(primary); if (isCallSubjectShown) { number = null; } else if (isChildNumberShown) { number = context.getString(R.string.child_number, primary.getChildNumber()); } else if (isForwardedNumberShown) { // Use last forwarded number instead of second line, if present. number = primary.getLastForwardedNumber(); } else { number = primaryContactInfo.number; } boolean nameIsNumber = name != null && name.equals(primaryContactInfo.number); // DialerCall with caller that is a work contact. boolean isWorkContact = (primaryContactInfo.userType == ContactsUtils.USER_TYPE_WORK); inCallScreen.setPrimary( PrimaryInfo.builder() .setNumber(number) .setName(primary.updateNameIfRestricted(name)) .setNameIsNumber(nameIsNumber) .setLocation( shouldShowLocationAsLabel(nameIsNumber, primaryContactInfo.shouldShowLocation) ? primaryContactInfo.location : null) .setLabel(isChildNumberShown || isCallSubjectShown ? null : primaryContactInfo.label) .setPhoto(primaryContactInfo.photo) .setPhotoUri(primaryContactInfo.displayPhotoUri) .setPhotoType(primaryContactInfo.photoType) .setIsSipCall(primaryContactInfo.isSipCall) .setIsContactPhotoShown(showContactPhoto) .setIsWorkCall(hasWorkCallProperty || isWorkContact) .setIsSpam(primary.isSpam()) .setIsLocalContact(primaryContactInfo.isLocalContact()) .setAnsweringDisconnectsOngoingCall(primary.answeringDisconnectsForegroundVideoCall()) .setShouldShowLocation(shouldShowLocation()) .setContactInfoLookupKey(primaryContactInfo.lookupKey) .setMultimediaData(multimediaData) .setShowInCallButtonGrid(true) .setNumberPresentation(primary.getNumberPresentation()) .build()); } else { // Clear the primary display info. inCallScreen.setPrimary(PrimaryInfo.empty()); } if (isInCallScreenReady) { inCallScreen.showLocationUi(getLocationFragment()); } else { LogUtil.i("CallCardPresenter.updatePrimaryDisplayInfo", "UI not ready, not showing location"); } } private static boolean shouldShowLocationAsLabel( boolean nameIsNumber, boolean shouldShowLocation) { if (nameIsNumber) { return true; } if (shouldShowLocation) { return true; } return false; } private Fragment getLocationFragment() { if (!shouldShowLocation()) { return null; } LogUtil.i("CallCardPresenter.getLocationFragment", "returning location fragment"); return callLocation.getLocationFragment(context); } private boolean shouldShowLocation() { if (!ConfigProviderComponent.get(context) .getConfigProvider() .getBoolean(CONFIG_ENABLE_EMERGENCY_LOCATION, CONFIG_ENABLE_EMERGENCY_LOCATION_DEFAULT)) { LogUtil.i("CallCardPresenter.getLocationFragment", "disabled by config."); return false; } if (!isPotentialEmergencyCall()) { LogUtil.i("CallCardPresenter.getLocationFragment", "shouldn't show location"); return false; } if (!hasLocationPermission()) { LogUtil.i("CallCardPresenter.getLocationFragment", "no location permission."); return false; } if (isBatteryTooLowForEmergencyLocation()) { LogUtil.i("CallCardPresenter.getLocationFragment", "low battery."); return false; } if (inCallScreen.getInCallScreenFragment().getActivity().isInMultiWindowMode()) { LogUtil.i("CallCardPresenter.getLocationFragment", "in multi-window mode"); return false; } if (primary.isVideoCall()) { LogUtil.i("CallCardPresenter.getLocationFragment", "emergency video calls not supported"); return false; } if (!callLocation.canGetLocation(context)) { LogUtil.i("CallCardPresenter.getLocationFragment", "can't get current location"); return false; } return true; } private boolean isPotentialEmergencyCall() { if (isOutgoingEmergencyCall(primary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "new emergency call"); return true; } else if (isIncomingEmergencyCall(primary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "potential emergency callback"); return true; } else if (isIncomingEmergencyCall(secondary)) { LogUtil.i("CallCardPresenter.shouldShowLocation", "has potential emergency callback"); return true; } return false; } private static boolean isOutgoingEmergencyCall(@Nullable DialerCall call) { return call != null && !call.isIncoming() && call.isEmergencyCall(); } private static boolean isIncomingEmergencyCall(@Nullable DialerCall call) { return call != null && call.isIncoming() && call.isPotentialEmergencyCallback(); } private boolean hasLocationPermission() { return ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED; } private boolean isBatteryTooLowForEmergencyLocation() { Intent batteryStatus = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1); if (status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL) { // Plugged in or full battery return false; } int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1); int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1); float batteryPercent = (100f * level) / scale; long threshold = ConfigProviderComponent.get(context) .getConfigProvider() .getLong( CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION, CONFIG_MIN_BATTERY_PERCENT_FOR_EMERGENCY_LOCATION_DEFAULT); LogUtil.i( "CallCardPresenter.isBatteryTooLowForEmergencyLocation", "percent charged: " + batteryPercent + ", min required charge: " + threshold); return batteryPercent < threshold; } private void updateSecondaryDisplayInfo() { if (inCallScreen == null) { return; } if (secondary == null) { // Clear the secondary display info. inCallScreen.setSecondary(SecondaryInfo.builder().setIsFullscreen(isFullscreen).build()); return; } if (secondary.isMergeInProcess()) { LogUtil.i( "CallCardPresenter.updateSecondaryDisplayInfo", "secondary call is merge in process, clearing info"); inCallScreen.setSecondary(SecondaryInfo.builder().setIsFullscreen(isFullscreen).build()); return; } if (secondary.isConferenceCall()) { inCallScreen.setSecondary( SecondaryInfo.builder() .setShouldShow(true) .setName( CallerInfoUtils.getConferenceString( context, secondary.hasProperty(Details.PROPERTY_GENERIC_CONFERENCE))) .setProviderLabel(secondary.getCallProviderLabel()) .setIsConference(true) .setIsVideoCall(secondary.isVideoCall()) .setIsFullscreen(isFullscreen) .build()); } else if (secondaryContactInfo != null) { LogUtil.v("CallCardPresenter.updateSecondaryDisplayInfo", "" + secondaryContactInfo); String name = getNameForCall(secondaryContactInfo); boolean nameIsNumber = name != null && name.equals(secondaryContactInfo.number); inCallScreen.setSecondary( SecondaryInfo.builder() .setShouldShow(true) .setName(secondary.updateNameIfRestricted(name)) .setNameIsNumber(nameIsNumber) .setLabel(secondaryContactInfo.label) .setProviderLabel(secondary.getCallProviderLabel()) .setIsVideoCall(secondary.isVideoCall()) .setIsFullscreen(isFullscreen) .build()); } else { // Clear the secondary display info. inCallScreen.setSecondary(SecondaryInfo.builder().setIsFullscreen(isFullscreen).build()); } } /** Returns the gateway number for any existing outgoing call. */ private String getGatewayNumber() { if (hasOutgoingGatewayCall()) { return DialerCall.getNumberFromHandle(primary.getGatewayInfo().getGatewayAddress()); } return null; } /** * Returns the label (line of text above the number/name) for any given call. For example, * "calling via [Account/Google Voice]" for outgoing calls. */ private String getConnectionLabel() { if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { return null; } StatusHints statusHints = primary.getStatusHints(); if (statusHints != null && !TextUtils.isEmpty(statusHints.getLabel())) { return statusHints.getLabel().toString(); } if (hasOutgoingGatewayCall() && getUi() != null) { // Return the label for the gateway app on outgoing calls. final PackageManager pm = context.getPackageManager(); try { ApplicationInfo info = pm.getApplicationInfo(primary.getGatewayInfo().getGatewayProviderPackageName(), 0); return pm.getApplicationLabel(info).toString(); } catch (PackageManager.NameNotFoundException e) { LogUtil.e("CallCardPresenter.getConnectionLabel", "gateway Application Not Found.", e); return null; } } return primary.getCallProviderLabel(); } @Nullable private SuggestionProvider.Reason getSimSuggestionReason() { String value = primary.getIntentExtras().getString(SuggestionProvider.EXTRA_SIM_SUGGESTION_REASON); if (value == null) { return null; } try { return SuggestionProvider.Reason.valueOf(value); } catch (IllegalArgumentException e) { LogUtil.e("CallCardPresenter.getConnectionLabel", "unknown reason " + value); return null; } } private Drawable getCallStateIcon() { // Return connection icon if one exists. StatusHints statusHints = primary.getStatusHints(); if (statusHints != null && statusHints.getIcon() != null) { Drawable icon = statusHints.getIcon().loadDrawable(context); if (icon != null) { return icon; } } return null; } private boolean hasOutgoingGatewayCall() { // We only display the gateway information while STATE_DIALING so return false for any other // call state. // TODO: mPrimary can be null because this is called from updatePrimaryDisplayInfo which // is also called after a contact search completes (call is not present yet). Split the // UI update so it can receive independent updates. if (primary == null) { return false; } return DialerCallState.isDialing(primary.getState()) && primary.getGatewayInfo() != null && !primary.getGatewayInfo().isEmpty(); } /** Gets the name to display for the call. */ private String getNameForCall(ContactCacheEntry contactInfo) { String preferredName = ContactsComponent.get(context) .contactDisplayPreferences() .getDisplayName(contactInfo.namePrimary, contactInfo.nameAlternative); if (TextUtils.isEmpty(preferredName)) { return TextUtils.isEmpty(contactInfo.number) ? null : BidiFormatter.getInstance() .unicodeWrap(contactInfo.number, TextDirectionHeuristics.LTR); } return preferredName; } @Override public void onSecondaryInfoClicked() { if (secondary == null) { LogUtil.e( "CallCardPresenter.onSecondaryInfoClicked", "secondary info clicked but no secondary call."); return; } Logger.get(context) .logCallImpression( DialerImpression.Type.IN_CALL_SWAP_SECONDARY_BUTTON_PRESSED, primary.getUniqueCallId(), primary.getTimeAddedMs()); LogUtil.i( "CallCardPresenter.onSecondaryInfoClicked", "swapping call to foreground: " + secondary); secondary.unhold(); } @Override public void onEndCallClicked() { LogUtil.i("CallCardPresenter.onEndCallClicked", "disconnecting call: " + primary); if (primary != null) { primary.disconnect(); } PostCall.onDisconnectPressed(context); } /** * Handles a change to the fullscreen mode of the in-call UI. * * @param isFullscreenMode {@code True} if the in-call UI is entering full screen mode. */ @Override public void onFullscreenModeChanged(boolean isFullscreenMode) { isFullscreen = isFullscreenMode; if (inCallScreen == null) { return; } maybeShowManageConferenceCallButton(); } private boolean isPrimaryCallActive() { return primary != null && primary.getState() == DialerCallState.ACTIVE; } private boolean shouldShowEndCallButton(DialerCall primary, int callState) { if (primary == null) { return false; } if ((!DialerCallState.isConnectingOrConnected(callState) && callState != DialerCallState.DISCONNECTING && callState != DialerCallState.DISCONNECTED) || callState == DialerCallState.INCOMING) { return false; } if (this.primary.getVideoTech().getSessionModificationState() == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { return false; } return true; } @Override public void onInCallScreenResumed() { updatePrimaryDisplayInfo(); if (shouldSendAccessibilityEvent) { handler.postDelayed(sendAccessibilityEventRunnable, ACCESSIBILITY_ANNOUNCEMENT_DELAY_MILLIS); } } @Override public void onInCallScreenPaused() {} static boolean sendAccessibilityEvent(Context context, InCallScreen inCallScreen) { AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); if (!am.isEnabled()) { LogUtil.w("CallCardPresenter.sendAccessibilityEvent", "accessibility is off"); return false; } if (inCallScreen == null) { LogUtil.w("CallCardPresenter.sendAccessibilityEvent", "incallscreen is null"); return false; } Fragment fragment = inCallScreen.getInCallScreenFragment(); if (fragment == null || fragment.getView() == null || fragment.getView().getParent() == null) { LogUtil.w("CallCardPresenter.sendAccessibilityEvent", "fragment/view/parent is null"); return false; } DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY); boolean screenIsOn = display.getState() == Display.STATE_ON; LogUtil.d("CallCardPresenter.sendAccessibilityEvent", "screen is on: %b", screenIsOn); if (!screenIsOn) { return false; } AccessibilityEvent event = AccessibilityEvent.obtain(AccessibilityEvent.TYPE_ANNOUNCEMENT); inCallScreen.dispatchPopulateAccessibilityEvent(event); View view = inCallScreen.getInCallScreenFragment().getView(); view.getParent().requestSendAccessibilityEvent(view, event); return true; } private void maybeSendAccessibilityEvent( InCallState oldState, final InCallState newState, boolean primaryChanged) { shouldSendAccessibilityEvent = false; if (context == null) { return; } final AccessibilityManager am = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); if (!am.isEnabled()) { return; } // Announce the current call if it's new incoming/outgoing call or primary call is changed // due to switching calls between two ongoing calls (one is on hold). if ((oldState != InCallState.OUTGOING && newState == InCallState.OUTGOING) || (oldState != InCallState.INCOMING && newState == InCallState.INCOMING) || primaryChanged) { LogUtil.i( "CallCardPresenter.maybeSendAccessibilityEvent", "schedule accessibility announcement"); shouldSendAccessibilityEvent = true; handler.postDelayed(sendAccessibilityEventRunnable, ACCESSIBILITY_ANNOUNCEMENT_DELAY_MILLIS); } } /** * Determines whether the call subject should be visible on the UI. For the call subject to be * visible, the call has to be in an incoming or waiting state, and the subject must not be empty. * * @param call The call. * @return {@code true} if the subject should be shown, {@code false} otherwise. */ private boolean shouldShowCallSubject(DialerCall call) { if (call == null) { return false; } boolean isIncomingOrWaiting = primary.getState() == DialerCallState.INCOMING || primary.getState() == DialerCallState.CALL_WAITING; return isIncomingOrWaiting && !TextUtils.isEmpty(call.getCallSubject()) && call.getNumberPresentation() == TelecomManager.PRESENTATION_ALLOWED && call.isCallSubjectSupported(); } /** * Determines whether the "note sent" toast should be shown. It should be shown for a new outgoing * call with a subject. * * @param call The call * @return {@code true} if the toast should be shown, {@code false} otherwise. */ private boolean shouldShowNoteSentToast(DialerCall call) { return call != null && hasCallSubject(call) && (call.getState() == DialerCallState.DIALING || call.getState() == DialerCallState.CONNECTING); } private InCallScreen getUi() { return inCallScreen; } /** Callback for contact lookup. */ public static class ContactLookupCallback implements ContactInfoCacheCallback { private final WeakReference<CallCardPresenter> callCardPresenter; private final boolean isPrimary; public ContactLookupCallback(CallCardPresenter callCardPresenter, boolean isPrimary) { this.callCardPresenter = new WeakReference<CallCardPresenter>(callCardPresenter); this.isPrimary = isPrimary; } @Override public void onContactInfoComplete(String callId, ContactCacheEntry entry) { CallCardPresenter presenter = callCardPresenter.get(); if (presenter != null) { presenter.onContactInfoComplete(callId, entry, isPrimary); } } @Override public void onImageLoadComplete(String callId, ContactCacheEntry entry) { CallCardPresenter presenter = callCardPresenter.get(); if (presenter != null) { presenter.onImageLoadComplete(callId, entry); } } } }
[ "zhiwei.zhurj@gmail.com" ]
zhiwei.zhurj@gmail.com
69446b14335a7b25f60885695cad657759709458
db47b768e5358fdf9403f835076bb076ba3e7b3f
/CSC230/Assignment-1/Question1.java
a989924492d49e32edb491b09ba0b53941aebb01
[]
no_license
WahabEhsan/CSC230
512ee19177a9fcc515e0772b09deba8c89c8914d
83d59a088eff0454839933d7ac4cfdf2480a82a2
refs/heads/master
2020-03-17T16:56:23.883282
2018-05-17T22:25:16
2018-05-17T22:25:16
133,768,509
0
0
null
null
null
null
UTF-8
Java
false
false
2,028
java
package question1; import java.util.Scanner; /** * This programs separates each digits given by a tab. * * @author WahabEhsan */ public class Question1 { /** * This is the main method that has a scanner and passes in integer to * Separator method to get answer that is printed. * * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int digits = input.nextInt(); System.out.print(Separator(digits)); } /** *Max size of the digit. */ public static final int maxSizeOfDigit = 99999; /** * This constant tells the number of digits that are going to be separated. */ public static final int numberOfDigits = 5; /** * This Constant is used when decrementing the the divider so it corresponds * the number. */ public static final int decrement = 10; /** * This constant is the starting value of the divisor so the digits can be * separated and is decremented by the constant decrement. */ public static int divider = 100000; /** * This method separates, the digits given, by a tab and are in the same * order as given. * * @param digits The numbers given to be separated * @return The String value of the answer as they are all combined integers. */ public static String Separator(int digits) { if (digits < maxSizeOfDigit) { String answer = ""; int temp; for (int i = 0; i < numberOfDigits; i++) { divider = divider / decrement;//decrements the divider according to the number of digits temp = digits / divider; answer += temp + "\t"; digits = digits - temp * divider;//subtracts the first number in the digit after setting it to answer variable } return answer; } else { return "Not valid digit"; } } }
[ "noreply@github.com" ]
WahabEhsan.noreply@github.com
553214dcfeb141cae3a4218ab01267ed5ec87f29
8bc49736983749ece5cc7eccaa64b54e6f5a7bc3
/Shopping_bakend/src/test/java/NareshIt/Shopping_bakend/AppTest.java
7672ed32795dfcb55c10f05996cb2aef853b3ac9
[]
no_license
ajabhi/Online-Shopping
5e1f6a830a790264c9e82af119ddeaba8800cafd
2e2eaeb6b3e3321ed631b18b34b4aaaf3c0ee2b1
refs/heads/master
2020-04-23T12:12:35.236746
2019-03-10T11:21:45
2019-03-10T11:21:45
171,160,863
0
0
null
null
null
null
UTF-8
Java
false
false
690
java
package NareshIt.Shopping_bakend; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "abhiraj9673@gmail.com" ]
abhiraj9673@gmail.com
2be321942b44b4a71730aee94791cf29cde98e2c
f4f9cd41f7d9adb4faca4bf131bc55f6bb5efab5
/HackerEarth/Flop Flip.java
4fbf2ee23b17fadbeb08175ab1d8349c9e9556c2
[]
no_license
BhanuPrakashNani/Competitive_coding
c6b13fb1ef893218c77d5c381f3046f72ea5a2b8
80f856e889cdf34469e142556f464d5f6be0bf8d
refs/heads/master
2020-03-27T06:21:22.671216
2017-09-11T09:20:44
2017-09-11T09:20:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
// Flop Flip // https://www.hackerearth.com/problem/algorithm/flip-flop-6/ import java.util.*; import java.io.*; class TestClass { public static void main(String args[] )throws IOException { Scanner s=new Scanner(System.in); int n=s.nextInt(); while(n!=0) { int c=0,j=0,t=0; char chx; String ss=s.next(); int l=ss.length(); for(int i=0;i<l-1;i++) { char ch=ss.charAt(i); if(ch=='X') { chx='X'; } else chx='Y'; for( t=i+1;t<l;t++) { if(ss.charAt(t)==chx) c++; else { i=i+(t-i)-1; break; } break; } } System.out.println(c); n--; } } }
[ "ankitjain28may77@gmail.com" ]
ankitjain28may77@gmail.com
434ddbb63ea5c5b2cff63ca983f5c31ace8cc0e4
f2a5541d8bb0764f3b4965aae6c5c447f328f828
/java/algorithms/warmups/lonelyinteger/lonelyintegerfirst.java
03c8cfb19a6223eed927f35859b31b53452aacb7
[ "MIT" ]
permissive
mbchoa/hackerrank
68a72fb61f73e7a565e7b4365ecb03b1f559aa9c
5c5ea115274ddc4607339675510e8b89e742e21a
refs/heads/master
2018-12-30T00:44:37.003805
2015-04-14T18:07:10
2015-04-14T18:07:10
31,973,394
0
0
null
null
null
null
UTF-8
Java
false
false
1,791
java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class LonelyIntegerFirst { private static Scanner stdin = new Scanner(System.in); public static void main(String[] args){ int numIntegers = getNumberOfIntegers(); String integerSet = getIntegerSet(); String[] integerSetSplit = splitIntegerSet(integerSet); Map<Integer, Integer> integerFrequencyMap = new HashMap<Integer, Integer>(); populateFrequencyMapWithSet(integerFrequencyMap, integerSetSplit, numIntegers); System.out.println(findLonelyIntegerFromMap(integerFrequencyMap)); } private static int findLonelyIntegerFromMap(Map<Integer, Integer> frequencyMap){ int lonelyInteger = 0; for (Map.Entry<Integer, Integer> entry : frequencyMap.entrySet()) { if(entry.getValue() == 1) { lonelyInteger = entry.getKey(); break; } } return lonelyInteger; } private static void populateFrequencyMapWithSet(Map<Integer, Integer> frequencyMap, String[] integerSet, int numIntegers){ for(int i = 0; i < numIntegers; ++i){ int integerKey = Integer.parseInt(integerSet[i]); int numIntegerOccurrence; try{ numIntegerOccurrence = (int)frequencyMap.get(integerKey); }catch(NullPointerException e){ numIntegerOccurrence = 0; } if(frequencyMap.containsKey(integerKey) == false){ frequencyMap.put(integerKey, 1); }else{ frequencyMap.put(integerKey, ++numIntegerOccurrence); } } } private static String[] splitIntegerSet(String integerSet) { if(integerSet != null){ return integerSet.split(" "); }else{ return null; } } private static int getNumberOfIntegers(){ return Integer.parseInt(stdin.nextLine()); } private static String getIntegerSet(){ return stdin.nextLine(); } }
[ "mbchoa@gmail.com" ]
mbchoa@gmail.com
ff021719881876f284427b8fe161bba2317e5c2b
d90a5bb42ff1b392b23222cedb7bee9cc8dec7da
/src/main/java/org/snpeff/nextProt/NextProtDb.java
4a760258bfe5b48c4ad78e18abebde159180804e
[ "MIT" ]
permissive
MariusDanner/SnpEff
362c55da02ef95f09dc2358e2c1467b20ccd90c9
90eb8866c25398e66ceeccf4f5d35f1e88872ebb
refs/heads/master
2023-04-25T07:57:26.108185
2021-05-11T08:39:16
2021-05-11T08:39:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,997
java
package org.snpeff.nextProt; import java.io.File; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.snpeff.snpEffect.Config; import org.snpeff.util.Log; /** * Parse NetxProt XML file and build a database * * http://www.nextprot.org/ * * @author pablocingolani */ public class NextProtDb { boolean debug; boolean verbose; String xmlDirName; Config config; NextProtMarkerFactory markersFactory; public NextProtDb(String xmlDirName, Config config) { this.config = config; this.xmlDirName = xmlDirName; this.markersFactory = new NextProtMarkerFactory(config); } /** * Parse all XML files in a directory */ public boolean parse() { if (verbose) Log.info("done"); // Parse all XML files in directory if (verbose) Log.info("Reading NextProt files from directory '" + xmlDirName + "'"); String files[] = (new File(xmlDirName)).list(); if (files != null) { for (String xmlFileName : files) { if (verbose) Log.info("\tNextProt file '" + xmlFileName + "'"); if (xmlFileName.endsWith(".xml.gz") || xmlFileName.endsWith(".xml")) { String path = xmlDirName + "/" + xmlFileName; parse(path); } } } else Log.fatalError("No XML files found in directory '" + xmlDirName + "'"); return true; } /** * Parse a single NextProt XML file */ void parse(String xmlFileName) { try { // Load document if (verbose) Log.info("Reading file:" + xmlFileName); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); SAXParser saxParser = factory.newSAXParser(); File file = new File(xmlFileName); saxParser.parse(file, new NextProtHandler(markersFactory)); // specify handler } catch (Exception e) { throw new RuntimeException(e); } } public void saveDatabase() { markersFactory.saveDatabase(); } public void setDebug(boolean debug) { this.debug = debug; } public void setVerbose(boolean verbose) { this.verbose = verbose; } }
[ "pablo.e.cingolani@gmail.com" ]
pablo.e.cingolani@gmail.com
78118999189917b67c60c8bbfbc28344b14802a7
3b2733db7eecc0fca276d42989c80db19b912e57
/simple/src/test/java/com/template/SimpleApplicationTests.java
dc4014a04607cf700b944aeaaf34224e680bf65c
[]
no_license
pugaman/project-templates
ff525e77676e97e87e2a23e50ecb276d3edd834b
e126a2eba52fcb90ba8587e0741b769805317ffb
refs/heads/master
2020-12-24T11:06:24.543577
2017-03-13T13:06:34
2017-03-13T13:06:34
73,200,950
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.template; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SimpleApplicationTests { @Test public void contextLoads() { } }
[ "noreply@github.com" ]
pugaman.noreply@github.com
8c548a46ffc626545f6cde0aa92e93caf1b396b3
680e36ae41fd40213c4e7ccaa071bff4ebc233d9
/app/src/main/java/com/stu/feisuo/walldemo/BatteryReceiver.java
a19327a4e916f472fd6af281242d1615bd311af9
[]
no_license
feisuo/wallPaper
59783ddd61573c582a7424fa7193dfcbe5dd315c
1c6153f62c0e8524b2d67edcaa0b5779b90ea1ee
refs/heads/master
2021-01-10T11:28:10.524723
2015-11-19T01:24:39
2015-11-19T01:24:39
36,610,982
4
1
null
null
null
null
UTF-8
Java
false
false
2,159
java
package com.stu.feisuo.walldemo; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.BatteryManager; /** * @author cedarrapidsboy * Provider for battery information. * */ public class BatteryReceiver extends BroadcastReceiver { private static final String DEUTERIUM_STOPPED = "Deuterium refill stopped"; private static final String DEUTERIUM_FULL = "Deuterium tanks full"; private static final String DEUTERIUM_FLOW_NORMAL = "Deuterium flow normal"; private static final String DEUTERIUM_REFILLING = "Refilling deuterium"; private static final String DEUTERIUM_STATUS_UNKNOWN = "Deuterium status unknown"; private int level = 0; private String status = DEUTERIUM_STATUS_UNKNOWN; private double eV = 0.0d; @Override public void onReceive(Context context, Intent intent) { level = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, 0); status = DEUTERIUM_STATUS_UNKNOWN; eV = 0.0d; int s = intent.getIntExtra(BatteryManager.EXTRA_STATUS, 0); switch (s) { case BatteryManager.BATTERY_STATUS_CHARGING: status = DEUTERIUM_REFILLING; break; case BatteryManager.BATTERY_STATUS_DISCHARGING: status = DEUTERIUM_FLOW_NORMAL; break; case BatteryManager.BATTERY_STATUS_FULL: status = DEUTERIUM_FULL; break; case BatteryManager.BATTERY_STATUS_NOT_CHARGING: status = DEUTERIUM_STOPPED; break; case BatteryManager.BATTERY_STATUS_UNKNOWN: status = DEUTERIUM_STATUS_UNKNOWN; break; } int i = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, 0); eV = DateCalc.roundToDecimals(i / 1000d, 2); } /** * @return battery percentage (0-100) */ public int getBatteryLevel(){ return level; } /** * @return battery voltage */ public double geteV(){ return eV; } /** * @return lcars-themed battery status message */ public String getStatus(){ return status; } /** * @param threshold percentage (<=) that will trigger a true * @return true if battery level is below or equal to threshold */ public boolean isBatteryLow(int threshold){ if (level <= threshold){ return true; } return false; } }
[ "feisuo.liu@gmail.com" ]
feisuo.liu@gmail.com
5ec447e719406a5482bfe28923961916317d7248
e0123fd31efa5ccf4b5c1a669725e1da7a30d3e9
/src/Thread/GetAlbumCover.java
4a9699a60e819ed58c9e6734c88896b5b7c19ddb
[]
no_license
TuasnAnh/spotify-c-server
ea1fe10ad32342c0b803a9a6ee78a1f38699d0d0
471b8444b85575f0abdbdc00fcba44e441e4e636
refs/heads/master
2023-02-23T01:05:44.370241
2021-01-25T14:42:41
2021-01-25T14:42:41
332,777,641
0
0
null
null
null
null
UTF-8
Java
false
false
1,933
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 Thread; import dao.SongDao; import daoImp.SongDaoImplement; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.net.Socket; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; /** * * @author ADMIN */ public class GetAlbumCover extends Thread { Socket serverSocket; DataInputStream clientReq; DataOutputStream clientRes; SongDao songDao = new SongDaoImplement(); public GetAlbumCover(Socket serverSocket) throws IOException { this.serverSocket = serverSocket; this.clientReq = new DataInputStream(serverSocket.getInputStream()); this.clientRes = new DataOutputStream(serverSocket.getOutputStream()); } @Override public void run() { try { int songId = clientReq.readInt(); String imgUrl = songDao.getImgUrl(songId); if (imgUrl != null) { BufferedImage image = ImageIO.read(new File(imgUrl)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "jpeg", baos); int size = baos.size(); clientRes.writeInt(size); clientRes.write(baos.toByteArray(), 0, size); clientRes.flush(); System.out.println("send image success"); } serverSocket.close(); clientReq.close(); clientRes.close(); } catch (IOException ex) { Logger.getLogger(GetAlbumCover.class.getName()).log(Level.SEVERE, null, ex); } } }
[ "tuananhblablo@gmail.com" ]
tuananhblablo@gmail.com
3acd788ffbdb10b20cce9d00c1262d86930e6823
f001bf66741ba59e3c7504e258f12d10e92eb179
/examples/v1/azure-integration/UpdateAzureIntegration.java
30cdd065c4d485d26f86940a535ca4e79c0f9e95
[ "Apache-2.0", "BSD-3-Clause", "EPL-1.0", "EPL-2.0", "MPL-2.0" ]
permissive
DataDog/datadog-api-client-java
367f6d7ebe1d123d15b7ba73c5568c89996c0485
5db90676fd1b5b138eb809171580ac2cda6b5572
refs/heads/master
2023-08-18T07:46:43.521340
2023-08-17T20:12:41
2023-08-17T20:12:41
193,793,890
43
31
Apache-2.0
2023-09-14T20:25:20
2019-06-25T22:54:41
Java
UTF-8
Java
false
false
1,540
java
// Update an Azure integration returns "OK" response import com.datadog.api.client.ApiClient; import com.datadog.api.client.ApiException; import com.datadog.api.client.v1.api.AzureIntegrationApi; import com.datadog.api.client.v1.model.AzureAccount; import java.util.Collections; public class Example { public static void main(String[] args) { ApiClient defaultClient = ApiClient.getDefaultApiClient(); AzureIntegrationApi apiInstance = new AzureIntegrationApi(defaultClient); AzureAccount body = new AzureAccount() .appServicePlanFilters("key:value,filter:example") .automute(true) .clientId("testc7f6-1234-5678-9101-3fcbf464test") .clientSecret("testingx./Sw*g/Y33t..R1cH+hScMDt") .cspmEnabled(true) .customMetricsEnabled(true) .errors(Collections.singletonList("*")) .hostFilters("key:value,filter:example") .newClientId("new1c7f6-1234-5678-9101-3fcbf464test") .newTenantName("new1c44-1234-5678-9101-cc00736ftest") .tenantName("testc44-1234-5678-9101-cc00736ftest"); try { apiInstance.updateAzureIntegration(body); } catch (ApiException e) { System.err.println("Exception when calling AzureIntegrationApi#updateAzureIntegration"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } }
[ "noreply@github.com" ]
DataDog.noreply@github.com
149f1073b96232ce01154c47b94940af2bfcddcc
24a7bb6337ce87ccd6d9f6dfaf8b5f2cd10d7e14
/src/d1_thread/Test/Test3.java
dda4004ce0ed08386ca16955a0df34dbe576df0f
[]
no_license
RanMoAnRan/april
e843c4a9f0595819b4e05d65a7a5244156b48e54
c1e2e54e8db8f36769c23fd8db915c071d68c595
refs/heads/master
2020-05-09T22:20:30.852193
2019-04-21T15:49:16
2019-04-21T15:49:16
181,468,437
2
1
null
null
null
null
UTF-8
Java
false
false
1,955
java
package d1_thread.Test; public class Test3 implements Runnable { /*请按要求编写多线程应用程序,模拟多个人通过一个山洞: 1.这个山洞每次只能通过一个人,每个人通过山洞的时间为5秒; 2.随机生成10个人,同时准备过此山洞,并且定义一个变量用于记录通过隧道的人数。显示每次通过山洞人的姓名,和通过顺序;*/ /* public static int people = 100;//人数 int count = 0; @Override public void run() { while (true) { synchronized (this) { if (people > 0) { try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } count++; System.out.println(Thread.currentThread().getName() + "第" + count + "通过山洞"); people--; }else { break; } } } }*/ int count=1; @Override public void run() { synchronized (this) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(Thread.currentThread().getName() + "第" + count + "通过隧道"); count++; } } public static void main(String[] args) { Test3 home3 = new Test3(); /* Thread thread = new Thread(home3); thread.setName("zhangshan"); thread.start(); Thread thread2 = new Thread(home3); thread2.setName("liso"); thread2.start(); Thread thread3 = new Thread(home3); thread3.setName("wangwu"); thread3.start();*/ for (int i = 0; i < 10; i++) { new Thread(home3,"people"+i).start(); } } }
[ "yj453485453" ]
yj453485453
7d4464ff0c4c23e1e67df2798e9f1c54f7880197
42dbb004e597e17b6f291dc3aed00006149418fd
/src/Member/MemberDAO.java
09aaf61e30266fc18757c6e1c57dcc4829a24577
[]
no_license
nanamiurakami/Leeson
4da8301a400b01d89018b2eeaa6990ceae175631
2230c7d93806c82de461889d874484c25ec37d45
refs/heads/master
2022-06-09T03:31:03.648447
2020-05-12T04:47:04
2020-05-12T04:47:04
257,788,668
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
package Member; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; public class MemberDAO { static final String URL = "jdbc:mysql://localhost/club?useSSL=false"; static final String USER = "java"; static final String PASS = "pass"; public ArrayList<Member> findAll() { ArrayList<Member> list = new ArrayList<>(); try (Connection con = DriverManager.getConnection(URL,USER,PASS);){ String sql = "SELECT * FROM member"; PreparedStatement stmt = con.prepareStatement(sql); ResultSet rs = stmt.executeQuery(); while (rs.next()) { int mid = rs.getInt("mid"); String name = rs.getString("name"); String adr =rs.getString("adr"); Member m = new Member (mid,name,adr); list.add(m); } stmt.close(); } catch (SQLException e) { System.out.println("findAllエラー:"+e.getMessage()); } return list; } public Member findByMid(int mid) { Member m = null; try (Connection con = DriverManager.getConnection(URL,USER,PASS);){ String sql = "SELECT * FROM member WHERE mid=?"; PreparedStatement stmt = con.prepareStatement(sql); stmt.setInt(1, mid); ResultSet rs = stmt.executeQuery(); if(rs.next()) { String name = rs.getString("name"); String adr=rs.getString("adr"); m = new Member(mid,name,adr); } stmt.close(); } catch (SQLException e) { System.out.println("findByMidエラー:"+e.getMessage()); } return m; } }
[ "edu09@EDUPC09.n00d01.kis.co.jp" ]
edu09@EDUPC09.n00d01.kis.co.jp
3b3b72c635213351a834bb40d61c17c78543a15d
998b4c5c4949ce7f562f16918349b2a5eca78178
/app/src/main/java/com/com/baidu/mapapi/clusterutil/clustering/view/ClusterRenderer.java
ddeaf42418622f69f827dd6012d719aa6657ba63
[]
no_license
yufeilong92/markercluster2
4c5d1ea7da3b83a6cd9d43b40057f2b5347c4330
dc06487a8d50aaf609bbfcb84b6d8c796d62bdc1
refs/heads/master
2022-12-30T13:41:00.499452
2020-10-27T03:13:22
2020-10-27T03:13:22
307,572,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,210
java
/* * Copyright (C) 2015 Baidu, Inc. All Rights Reserved. */ package com.com.baidu.mapapi.clusterutil.clustering.view; import com.com.baidu.mapapi.clusterutil.clustering.Cluster; import com.com.baidu.mapapi.clusterutil.clustering.ClusterItem; import com.com.baidu.mapapi.clusterutil.clustering.ClusterManager; import java.util.Set; /** * Renders clusters. */ public interface ClusterRenderer<T extends ClusterItem> { /** * Called when the view needs to be updated because new clusters need to be displayed. * @param clusters the clusters to be displayed. */ void onClustersChanged(Set<? extends Cluster<T>> clusters); void setOnClusterClickListener(ClusterManager.OnClusterClickListener<T> listener); void setOnClusterInfoWindowClickListener(ClusterManager.OnClusterInfoWindowClickListener<T> listener); void setOnClusterItemClickListener(ClusterManager.OnClusterItemClickListener<T> listener); void setOnClusterItemInfoWindowClickListener(ClusterManager.OnClusterItemInfoWindowClickListener<T> listener); /** * Called when the view is added. */ void onAdd(); /** * Called when the view is removed. */ void onRemove(); }
[ "931697478@qq.com" ]
931697478@qq.com
001f3927887119ccad7d382417e9c1b7c0c6549c
aa1a8961ceb9c5a366b2efa776d029a4631a0b64
/src/com/huidian/day6/demo01/Student.java
c41e55ede06c6b7749807d88ce5b20f82e984b28
[]
no_license
lingweiov/java1
7e62305808be7a5ae0b6700217b30a4f9508feb8
5800955cd297215e5e17055c440b919df9be6a3f
refs/heads/master
2020-09-13T18:38:59.453987
2019-12-09T13:15:36
2019-12-09T13:15:37
222,870,718
0
0
null
null
null
null
UTF-8
Java
false
false
801
java
package com.huidian.day6.demo01;/* @outhor shkstart @date 2019/11/20-22:50 类的总结 1.所有的成员变量都要用private关键字修饰 2,为每一个成员变量编写一对getter/setter方法(获取和设置) 3.编写一个无参数的构造方法 4.编写一个全参数的构造方法 这样就是一个标准的类也叫java bean */ public class Student { private String name; private int age; public Student(String name, int age) { this.name = name; this.age = age; } public Student() { } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "lingweiov@foxmail.com" ]
lingweiov@foxmail.com
06ea735394c6c89a47b4907e90624854ad1990d5
acd7ac771fd84167a6e5f10fe98dbcb934a46f58
/src/java/actions/task/TaskTable.java
3116218edb932c598a0ca37b676b2c09cde7b647
[]
no_license
skuarch/samUrlMonitor
3e2fda93e9148ac0448461b934e2ff9c5f8ed7cd
ca1826a73dbfa11131a9661c7d9dfb39072d90b4
refs/heads/master
2021-01-25T06:05:42.394619
2013-10-22T23:23:42
2013-10-22T23:23:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,253
java
package actions.task; import com.opensymphony.xwork2.ActionSupport; import java.util.ArrayList; import model.beans.Task; import model.common.ModelTask; import org.apache.log4j.Logger; /** * * @author skuarch */ public class TaskTable extends ActionSupport{ private static final Logger logger = Logger.getLogger(TaskTable.class); private ArrayList<Task> tasks = null; //========================================================================== public TaskTable() { } //========================================================================== @Override public String execute() throws Exception { try { tasks = ModelTask.getTasks(); } catch (Exception e) { logger.error("TaskTable",e); } return super.execute(); //To change body of generated methods, choose Tools | Templates. } // end execute //========================================================================== public ArrayList<Task> getTasks() { return tasks; } public void setTasks(ArrayList<Task> tasks) { this.tasks = tasks; } } // end class
[ "skuarch@yahoo.com.mx" ]
skuarch@yahoo.com.mx
b3dfe5d069e95a18dc7cc20a519044bda74d31ff
e2f42a7412d686eaa1c18c72276f7b3432a50a30
/src/samb/client/game/Table.java
cbafbc6f7095f6daee69e99e54d4ee9447ef1feb
[]
no_license
pySam1459/NEA
33774bff1db2fab002f94a94900a091e3e002ab4
dfc890538986aa2fc861fe000b1b1f06a938eafd
refs/heads/main
2023-04-15T18:32:13.785635
2021-04-19T17:48:35
2021-04-19T17:48:35
331,248,971
1
0
null
null
null
null
UTF-8
Java
false
false
20,323
java
package samb.client.game; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Point; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import samb.client.main.Client; import samb.client.main.Window; import samb.client.page.GamePage; import samb.client.page.widget.Widget; import samb.client.utils.Consts; import samb.client.utils.ImageLoader; import samb.client.utils.Maths; import samb.com.server.info.Foul; import samb.com.server.info.GameInfo; import samb.com.server.info.GameState; import samb.com.server.info.Message; import samb.com.server.info.UpdateInfo; import samb.com.server.info.Win; import samb.com.server.packet.Header; import samb.com.server.packet.Packet; import samb.com.server.packet.UHeader; import samb.com.utils.Circle; import samb.com.utils.data.Dimf; import samb.com.utils.data.Line; import samb.com.utils.data.Pointf; import samb.com.utils.enums.TableUseCase; public class Table extends Widget { /* This subclass handles the table object, updating, ticking, rendering and most game events * I have programmed this table so that a Table object can be used players, spectators or users practising. * I decided to render the balls on a large image (2048 x 1024) and re-scale it to the shape of the table * being rendered on the window * This can cause some complexity with scaling issues, but it reduces the complexity of ball co-ordates and different sized windows * */ public static final Dimension tdim = new Dimension(2048, 1024); private static final Dimension imgDim = new Dimension(1566, 860); private static final Dimension imgBDim = new Dimension(1408, 704); private static Dimf bdim; private static Pointf bxy; public static final Line[] cushions = getCushions(); private static Table thisTable; public TableUseCase tuc; public boolean turn = false; private String turnName = ""; private boolean simulate=true, cuePlacement=false, allowPlacement=true, doCheck = false, allowAim = true, potted=false; public boolean hasCollided = false, wrongFirstCollision = false; private Foul foul; private Cue cue; private Ball cueBall; private Pointf cueBallPlacement; private List<Ball> balls; private UpdateInfo updateInfo; private Pocket[] pockets; private GamePage gp; private GameState state; public Table(GamePage gp) { super(calculateRect(3*Window.dim.width/4)); Table.thisTable = this; this.gp = gp; this.state = gp.state; this.cue = new Cue(); this.balls = new ArrayList<>(); createPockets(); } @Override public void tick() { tickUpdate(); aim(); simulate(); checkNewAim(); } // Tick Methods private void tickUpdate() { // If an update Packet exists, this method will use it and update the table if(updateInfo != null) { switch(updateInfo.header) { case velocity: cueBall.vx = updateInfo.vx; cueBall.vy = updateInfo.vy; cueBall.moving = true; allowAim = false; doCheck = true; break; case placement: // cue has been placed Ball b = new Ball(new Circle(updateInfo.xy.x, updateInfo.xy.y, Circle.DEFAULT_BALL_RADIUS, 0), balls); balls.add(b); cueBall = b; break; case win: endGame(updateInfo.win, updateInfo.winner); break; } updateInfo = null; } } private void aim() { // This method controls how the user aims the cue, // first getting an angle "set", then changing the "power" and finally shooting if(tuc != TableUseCase.spectating) { cue.show = (tuc == TableUseCase.practicing || turn) && allowAim && !cuePlacement && simulate; if(cue.show) { if(!cue.set) { Pointf xy = getMouseOnTable(); cue.angle = Maths.getAngle(new Pointf(cueBall.x, cueBall.y), xy); cue.start = xy; // User sets cue angle if(Client.getMouse().left && Client.getMouse().forleft < 2) { // if single left click cue.set = true; cue.startDist = Maths.getDis(xy.x, xy.y, cueBall.x, cueBall.y); } } else if(Client.getMouse().left) { // adjusting power Pointf xy = getMouseOnTable(); cue.power = Maths.getDis(cue.start.x, cue.start.y, xy.x, xy.y); } else if(!Client.getMouse().left && cue.power > 5) { // user let go of mouse left shoot(); } else { // half reset cue, keep showing cue.halfReset(); } } else if(cuePlacement) { // If a foul{potCue, wrongHit} has occurred, the opposition is allowed to placed the cue on the table cueBallPlacement = getMouseOnTable(); allowPlacement = checkAllowPlacement(); if(Client.getMouse().left && Client.getMouse().forleft < 2 && allowPlacement) { // if user has placed Packet p = new Packet(Header.updateGame); p.updateInfo = new UpdateInfo(UHeader.placement, cueBallPlacement); sendUpdate(p); cuePlacement = false; } } } } private void shoot() { // This methods sends an update packet to the host about the new velocity of the cue ball double[] vel = Maths.getVelocity(cue.angle, cue.power); Packet p = createUpdate(vel); sendUpdate(p); cue.reset(); } private void simulate() { // Balls tick and update separately as collision equations use un-updated values // The for FINE_TUNE loop is used to reduce the distance travelled by the balls per 'move method' // so that the collisions are more realistic and that balls don't 'teleport' past a boundary or another ball for(int i=0; i<Consts.FINE_TUNE_ITERS; i++) { for(Ball b: balls) { b.tick(); } for(Ball b: balls) { b.update(); } } for(Pocket p: pockets) { p.tick(); } } private void checkNewAim() { // This method checks whether the player is allowed to aim or whether to wait // ie when the balls are still moving = wait if(tuc != TableUseCase.spectating && doCheck) { boolean newAim = true; for(Ball b: balls) { if(b.moving) { newAim = false; } } allowAim = newAim; if(allowAim && simulate) { // Turn ends endTurn(); doCheck = false; } } } private void endTurn() { // This method is called at the end of a player's turn // It will handle any fouls/losses and turn switches if(foul == null) { if(!hasCollided) { // If the cue ball didn't collide, a foul has occurred warnMessage(String.format("FOUL: No ball was struck by %s", turnName)); foul(Foul.noHit); } else if(wrongFirstCollision) { // If the cue ball collided with the wrong colour ball warnMessage(String.format("FOUL: %s struck the wrong colour ball", turnName)); foul(Foul.wrongHit); } } if(foul != null) { // if a foul has occured dealWithFoul(this.foul, turn); } if((!potted || foul != null) && tuc != TableUseCase.practicing) { // Swap turns this.turn = !turn; this.turnName = gp.getTurnName(); if(state.turnCol != 0) { state.turnCol = state.turnCol == 1 ? 2 : 1; } } // reset foul flags hasCollided = false; wrongFirstCollision = false; potted = false; this.foul = null; } public void endGame(Win win, String winner) { // Called when a player has won simulate = false; gp.endGame(win, winner); } private boolean checkAllowPlacement() { // Checks whether the cue ball is allowed to be placed on point p Pointf p = cueBallPlacement; double r = Ball.DEFAULT_BALL_RADIUS+1; Circle c = new Circle(p.x, p.y, r, 0); if(p.x < r || p.x > tdim.width-r || p.y < r || p.y > tdim.height-r) { // on table return false; } for(Ball b: balls) { // not overlapping another ball if(Maths.circle2(b, c)) { return false; } } return true; } // Fouls public void checkCollisionFoul(Ball b) { // This method is called by a ball when it has collided with another ball if(!hasCollided) { if(b.col == 3) { // hit black ball first if(getTurnScore() != 7) { wrongFirstCollision = true; } } else if(state.turnCol != b.col && state.turnCol != 0){ wrongFirstCollision = true; } } hasCollided = true; } private void foul(Foul foul) { this.foul = foul; } private void dealWithFoul(Foul foul, boolean self) { // This method deals with each foul/loss after a player's turn switch(foul) { case potCue: // foul, cue ball is moved afterwards case wrongHit: if(!self || tuc == TableUseCase.practicing) { cuePlacement = true; } if(cueBall != null && balls.contains(cueBall)) { balls.remove(cueBall); } break; default: break; } } public void pocket(Ball b) { // This method is called when a ball is pocketed balls.remove(b); if(b.col == 0) { // Cue Ball warnMessage(String.format("FOUL: %s potted the Cue ball", turnName)); foul(Foul.potCue); } else if (b.col == 3) { // 8 Ball if(getTurnScore() >= 7) { if(state.turnCol == 1) { gp.state.redBlack = true; } else if(state.turnCol == 2) { gp.state.yellowBlack=true; } warnMessage(String.format("WIN: %s potted the 8 ball", turnName)); win(gp.getTurnID(), Win.pottedAll); // turn player wins } else { warnMessage(String.format("LOSS: %s potted the 8 ball", turnName)); win(gp.getNotTurnID(), Win.pottedBlack); // not turn player wins } } else { if(b.col == 1) { // Red Ball gp.state.red++; // increase score potted = true; warnMessage(String.format("%s potted a red", turnName)); if(gp.state.redID == null && tuc != TableUseCase.practicing) { gp.state.redID = gp.getTurnID(); // Sets who's got what colour gp.state.yellowID = gp.getNotTurnID(); gp.setMenuTitleColours(); state.turnCol = 1; // what colour is the player who's turn it is, is String msg = String.format("Therefore %s's colour is red and %s's colour is yellow", turnName, gp.getNotTurnName()); gp.addChat(new Message(msg, "$BOLD NOSPACE$")); } } else if(b.col == 2) { // Yellow Ball gp.state.yellow++; potted = true; warnMessage(String.format("%s potted a yellow", turnName)); if(gp.state.yellowID == null && tuc != TableUseCase.practicing) { gp.state.yellowID = gp.getTurnID(); gp.state.redID = gp.getNotTurnID(); gp.setMenuTitleColours(); state.turnCol = 2; String msg = String.format("Therefore %s's colour is yellow and %s's colour is red", turnName, gp.getNotTurnName()); gp.addChat(new Message(msg, "$BOLD NOSPACE$")); } } if(state.turnCol != b.col && state.turnCol != 0 && tuc != TableUseCase.practicing) { foul(Foul.potWrong); warnMessage(String.format("FOUL: %s potted the wrong colour", turnName)); } } } public void win(String wid, Win win) { // This method is called when a win is 'detected', an update is sent to the host this.state.win = win; if((turn || win == Win.forfeit) && tuc == TableUseCase.playing) { Packet p = new Packet(Header.updateGame); p.updateInfo = new UpdateInfo(UHeader.win, win, wid); p.gameState = state; Client.getClient().server.send(p); } else if(tuc == TableUseCase.practicing) { updateInfo = new UpdateInfo(UHeader.win, win, wid); } } public void rack(GameInfo gi) { // To "rack" is to set up the table, therefore all the relevant ball info is transfered to the table this.balls = new ArrayList<>(); Ball b; for(Circle c: gi.balls) { b = new Ball(c, this.balls); balls.add(b); if(c.col == 0) { // If the ball is the cue ball cueBall = b; } } } // Update Methods public void update(UpdateInfo upinfo) { this.updateInfo = upinfo; } public Packet createUpdate(double[] vel) { // This method creates an update Packet, sends the velocity of the cue ball Packet p = new Packet(Header.updateGame); p.updateInfo = new UpdateInfo(UHeader.velocity, vel[0], vel[1]); return p; } private void sendUpdate(Packet p) { // This method sends an update packet to the host (or back to itself if practising) if(tuc == TableUseCase.playing) { Client.getClient().server.send(p); } else if(tuc == TableUseCase.practicing) { updateInfo = p.updateInfo; } } private void warnMessage(String msg) { if(simulate) { // sends a bold message to the chat gp.addChat(new Message(msg, "$BOLD$")); } } // Getters (sort of) public List<Circle> getCircles() { // This method converts the balls to Circle objects (less data to send) List<Circle> circles = new ArrayList<>(); for(Ball b: balls) { circles.add(b); } return circles; } public Ball[] getBalls() { // Returns and array of Ball objects return balls.toArray(new Ball[0]); } private Pointf getMouseOnTable() { // Returns the mouse's XY on the table Point p = Client.getMouse().getXY(); return toTable(new Pointf(p.x-rect[0], p.y-rect[1])); } private int getTurnScore() { // returns the current player's score return state.turnCol == 1 ? gp.state.red : gp.state.yellow; } // Render Methods @Override public void render(Graphics2D graph) { // The render method is called by the GamePage object and must render // the table image -> the balls -> the cue -> any WidgetAnimations BufferedImage img = new BufferedImage(rect[2], rect[3], BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D) img.getGraphics(); g.drawImage(ImageLoader.get("table.png"), 0, 0, rect[2], rect[3], null); renderBalls(g); graph.drawImage(img, rect[0], rect[1], rect[2], rect[3], null); super.animRender(graph); // Renders any animations renderCue(graph); } private void renderBalls(Graphics2D g) { final int buffer = 64; // the buffer allows the balls going into pockets to be rendered // The ballsImg is 2048x1024, so it needs to be scaled down to bdim BufferedImage ballsImg = getBallsImage(buffer); g.drawImage(ballsImg, (int)bxy.x-buffer, (int)bxy.y-buffer, (int)bdim.width+buffer*2, (int)bdim.height+buffer*2, null); } private BufferedImage getBallsImage(int buffer) { // This method returns an image with the balls scaled to their position on the table final int scaledBuffer = (int) (buffer * (tdim.width / bdim.width)); BufferedImage img = new BufferedImage(tdim.width + scaledBuffer*2, tdim.height + scaledBuffer*2, BufferedImage.TYPE_INT_ARGB); Graphics2D g = (Graphics2D) img.getGraphics(); // Renders balls for(Ball b: balls) { b.render(g, scaledBuffer); } // Renders the cue "in hand" if(cuePlacement && cueBallPlacement != null && simulate) { g.setColor(Ball.colours[0]); g.fillOval((int)(cueBallPlacement.x-Circle.DEFAULT_BALL_RADIUS+scaledBuffer), (int)(cueBallPlacement.y-Circle.DEFAULT_BALL_RADIUS+scaledBuffer), (int)Circle.DEFAULT_BALL_RADIUS*2, (int)Circle.DEFAULT_BALL_RADIUS*2); if(!allowPlacement) { // if the cue is in an invalid spot, display with red tint g.setColor(new Color(255, 0, 0, 127)); g.fillOval((int)(cueBallPlacement.x-Circle.DEFAULT_BALL_RADIUS+scaledBuffer), (int)(cueBallPlacement.y-Circle.DEFAULT_BALL_RADIUS+scaledBuffer), (int)Circle.DEFAULT_BALL_RADIUS*2, (int)Circle.DEFAULT_BALL_RADIUS*2); } } return img; } private void renderCue(Graphics2D g) { // Currently, the cue is rendered with 2 colours lines, instead of an image (maybe change later) if(cue.show) { // Some constant to modifiy the length, thickness, offset of the cue final double projectionLength = 384; final double cueLength = 256; final double offset = Ball.DEFAULT_BALL_RADIUS*1.5; Pointf cueft = fromTable(new Pointf(cueBall.x, cueBall.y)); cueft.x += rect[0]; cueft.y += rect[1]; // Line 1 Handle double[] start = Maths.getProjection(cue.angle, cue.power/2 + offset, cueft); double[] end = Maths.getProjection(cue.angle, cue.power/2 + projectionLength + offset, cueft); g.setStroke(Consts.cueStroke); g.setColor(Color.GRAY); g.drawLine((int)start[0], (int)start[1], (int)end[0], (int)end[1]); // Line 2 Cue 'barrel' start = Maths.getProjection(cue.angle, cue.power/2 + offset, cueft); end = Maths.getProjection(cue.angle, cue.power/2 + cueLength + offset, cueft); g.setColor(Color.YELLOW); g.drawLine((int)start[0], (int)start[1], (int)end[0], (int)end[1]); // Shot Line Projection g.setStroke(Consts.cueProjectionStroke); final double angle = cue.angle + Math.PI; start = Maths.getProjection(angle, offset, cueft); end = Maths.getProjection(angle, offset + 1500, cueft); g.setColor(new Color(127, 127, 127, 127)); g.drawLine((int)start[0], (int)start[1], (int)end[0], (int)end[1]); } } // Some methods to map points to and from the table dimensions public Pointf toTable(Pointf p) { return new Pointf((p.x - bxy.x) * (tdim.width / bdim.width), (p.y - bxy.y) * (tdim.height / bdim.height)); } public Pointf fromTable(Pointf p) { return new Pointf(p.x * (bdim.width / tdim.width) + bxy.x, p.y * (bdim.height / tdim.height) + bxy.y); } // Initialization methods private static int[] calculateRect(int maxWidth) { // Returns the rectangle which the table will take up on the screen final int buffer = 48; // {gw, gh} is the width and height of the rendered table final int gw = maxWidth - buffer*2; final int gh = gw * imgDim.height / imgDim.width; // bdim and bxy is the boundary dimensions and top left coords (boundary for the balls, ie the cushions) bdim = new Dimf(imgBDim.width * (double)gw/imgDim.width, imgBDim.height * (double)gh/imgDim.height); bxy = new Pointf((gw - bdim.width) / 2.0, (gh - bdim.height) / 2.0); return new int[] {buffer, Window.dim.height/2 - gh/2, gw, gh}; } public void setUseCase(GameInfo gi, String id) { // Determines the use of the table (playing, spectating, practicing) tuc = gi.tuc; if(gi.tuc == TableUseCase.practicing) { turn = true; } else if(gi.tuc == TableUseCase.playing) { turn = gi.u1.id.equals(id); } else if(gi.tuc == TableUseCase.spectating) { turn = false; } turnName = gp.getTurnName(); } public void setState(GameState state) { // Sets the state of the table (used by spectators) gp.state = state; this.state = state; if(state.turnCol != 0) { gp.setMenuTitleColours(); } } // These methods are at the bottom as they take up space and look ugly private void createPockets() { int r = 96, off=38; this.pockets = new Pocket[] { new Pocket(-off, -off, r, this), new Pocket(tdim.width/2, -60, 64, this), new Pocket(tdim.width+off, -off, r, this), new Pocket(-off, tdim.height+off, r, this), new Pocket(tdim.width/2, tdim.height+60, 64, this), new Pocket(tdim.width+off, tdim.height+off, r, this) }; } private static Line[] getCushions() { // These are the coordinates for each cushion, including pocket cushions return new Line[] { new Line(40, -39, 80, 0), new Line(80, 0, 964, 0), new Line(964, 0, 973, -29), new Line(1075, -28, 1082, 0), new Line(1082, 0, 1966, 0), new Line(1966, 0, 2002, -35), new Line(2088, 41, 2048, 85), new Line(2048, 85, 2048, 941), new Line(2048, 941, 2078, 970), new Line(45, 1058, 82, 1023), new Line(82, 1023, 967, 1023), new Line(967, 1023, 975, 1051), new Line(1075, 1058, 1082, 1025), new Line(1082, 1025, 1970, 1025), new Line(1970, 1025, 2000, 1054), new Line(-25, 54, 0, 81), new Line(0, 81, 0, 938), new Line(0, 938, -25, 966) }; } // Object Getter public static Table getTable() { return Table.thisTable; } }
[ "pysam9011@gmail.com" ]
pysam9011@gmail.com
a7f62778fe7259b3d600f075822955a704be5c65
fde90c6b3afc2091dd0ad14dfc84b81c3ab52a04
/temperature.java
1b1639b10c9e3fb64b9fd5f76f8bda287119b5dd
[]
no_license
zahoorgabol/Java-Practice
3d299561693cf0eeee9a855294f31dc3c5b33ae9
eb1633c9c699c6aebe6d4ea976e8c851e8f1a17e
refs/heads/master
2023-09-05T04:26:34.464821
2021-11-26T06:08:11
2021-11-26T06:08:11
431,918,667
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
import javax.swing.*; class Temperature { public static void main (String ar[]) { String a=JOptionPane.showInputDialog(" fahr: "); int b=Integer.parseInt(a); int kelvin=b*255; JOptionPane.showMessageDialog(null, " kelvin: " + kelvin); } }
[ "zahoorgabole@gmail.com" ]
zahoorgabole@gmail.com
7fb0195bc2df31c6dd8308685ee56be6ff08d103
bcaf35190cfd8b115e212b1929c10c48a81f51e5
/src/main/java/org/opencloudb/sqlengine/SQLJob.java
fe3d8bc430c53e6572258ad9b68e317ec354090d
[ "Apache-2.0" ]
permissive
aslijiasheng/Mycat-Server
837476326778d4c5448a5e72e7521b55bed7ea98
11f7bb2046e9bee770a1eb69b8043227bb7466f9
refs/heads/master
2021-01-17T21:38:15.530912
2015-02-10T15:39:26
2015-02-10T15:39:26
30,711,898
1
0
null
2015-02-12T16:35:11
2015-02-12T16:35:11
null
UTF-8
Java
false
false
3,502
java
package org.opencloudb.sqlengine; import java.io.UnsupportedEncodingException; import java.util.List; import org.opencloudb.MycatConfig; import org.opencloudb.MycatServer; import org.opencloudb.backend.BackendConnection; import org.opencloudb.backend.ConnectionMeta; import org.opencloudb.backend.PhysicalDBNode; import org.opencloudb.mysql.nio.handler.ResponseHandler; import org.opencloudb.net.mysql.ErrorPacket; import org.opencloudb.route.RouteResultsetNode; import org.opencloudb.server.ServerConnection; import org.opencloudb.server.parser.ServerParse; public class SQLJob implements ResponseHandler, Runnable { private final String sql; private final String dataNode; private final SQLJobHandler jobHandler; private final EngineCtx ctx; private final int id; public SQLJob(int id, String sql, String dataNode, SQLJobHandler jobHandler, EngineCtx ctx) { super(); this.id = id; this.sql = sql; this.dataNode = dataNode; this.jobHandler = jobHandler; this.ctx = ctx; } public void run() { RouteResultsetNode node = new RouteResultsetNode(dataNode, ServerParse.SELECT, sql); // create new connection ServerConnection sc = ctx.getSession().getSource(); MycatConfig conf = MycatServer.getInstance().getConfig(); PhysicalDBNode dn = conf.getDataNodes().get(node.getName()); ConnectionMeta conMeta = new ConnectionMeta(dn.getDatabase(), sc.getCharset(), sc.getCharsetIndex(), true); try { dn.getConnection(conMeta, node, this, node); } catch (Exception e) { EngineCtx.LOGGER.info("can't get connection for sql ,error:" + e); doFinished(true); } } @Override public void connectionAcquired(final BackendConnection conn) { if (EngineCtx.LOGGER.isDebugEnabled()) { EngineCtx.LOGGER.debug("con query sql:" + sql + " to con:" + conn); } conn.setResponseHandler(this); try { conn.query(sql); } catch (UnsupportedEncodingException e) { doFinished(true); } } private void doFinished(boolean failed) { jobHandler.finished(dataNode, failed); ctx.onJobFinished(this); } @Override public void connectionError(Throwable e, BackendConnection conn) { EngineCtx.LOGGER.info("can't get connection for sql :" + sql); doFinished(true); } @Override public void errorResponse(byte[] err, BackendConnection conn) { ErrorPacket errPg = new ErrorPacket(); errPg.read(err); EngineCtx.LOGGER.info("error response " + new String(errPg.message) + " from of sql :" + sql + " at con:" + conn); conn.release(); doFinished(true); } @Override public void okResponse(byte[] ok, BackendConnection conn) { // not called for query sql } @Override public void fieldEofResponse(byte[] header, List<byte[]> fields, byte[] eof, BackendConnection conn) { jobHandler.onHeader(dataNode, header, fields); } @Override public void rowResponse(byte[] row, BackendConnection conn) { boolean finsihed = jobHandler.onRowData(dataNode, row); if (finsihed) { conn.close("not needed by user proc"); doFinished(false); } } @Override public void rowEofResponse(byte[] eof, BackendConnection conn) { conn.release(); doFinished(false); } @Override public void writeQueueAvailable() { } @Override public void connectionClose(BackendConnection conn, String reason) { doFinished(true); } public int getId() { return id; } @Override public String toString() { return "SQLJob [ id=" + id + ",dataNode=" + dataNode + ",sql=" + sql + ", jobHandler=" + jobHandler + "]"; } }
[ "linzhiqiang0514@163.com" ]
linzhiqiang0514@163.com
571c5b26e52c8549e455ade55f5e46378fac83fe
a57bcd1cf5aee51312e1d500213e8c39dd8dd434
/Adhoc/src/Arrays/MissingNumber.java
f44f097482be54570cdd1d1a031977905053d1d2
[]
no_license
arpitaggarwal1248/DataStructures
7bb340eaa91bc232278a83c460db49d892adf60e
b4bf63f24826e2592fc09af8c88ba80b535570d8
refs/heads/master
2021-06-22T01:42:24.533874
2021-06-14T13:54:21
2021-06-14T13:54:21
200,827,002
0
0
null
null
null
null
UTF-8
Java
false
false
1,922
java
/* * Decompiled with CFR 0.145. * * Could not load the following classes: * Arrays.MissingNumber */ package Arrays; import java.io.PrintStream; /* * Exception performing whole class analysis ignored. */ public class MissingNumber { public static void main(String[] args) { int[] array1 = new int[]{9, 7, 8, 5, 4, 6, 2, 3, 1}; int[] array2 = new int[]{1, 2, 4, 6, 3, 7, 8}; int mu = MissingNumber.missingNumberInSingleArraysEfficientSolution((int[])array2, (int)(array2.length - 1)); System.out.println(mu); } private static int missingNumberInSingleArraysEfficientSolution(int[] arr, int size) { int a = 0; int b = size - 1; int mid = 0; while (b - a > 1) { mid = (a + b) / 2; if (arr[mid] - mid != arr[a] - a) { b = mid; continue; } if (arr[mid] - mid == arr[b] - b) continue; a = mid; } return arr[mid] + 1; } private static void missingNumberInSingleArray(int[] array2) { int n = array2.length; int result = 0; for (int u : array2) { result += u; } int nSum = (n + 1) * (n + 2) / 2; System.out.println(nSum - result); } private static void missingNumberInDuplicateArray(int[] array1, int[] array2) { int result = 0; for (int u : array1) { result += u; } for (int v : array2) { result -= v; } System.out.println(result); } private static void missingNumberInDuplicateArrayWithoutArthematicOperation(int[] array1, int[] array2) { int result = array1[0]; for (int i = 1; i < array1.length; ++i) { result ^= array1[i]; } for (int v : array2) { result ^= v; } System.out.println(result); } }
[ "arpit.aggarwal@oyorooms.com" ]
arpit.aggarwal@oyorooms.com
9bfcdfffaa5fbfc8352b0c1d691758331c45e1d4
8371b1d138bcb489493f9b8695ef938517c74565
/Submissions/jojo2357/src/com/github/jojo2357/scarystuff/graphics/Point.java
9e33bf8ee10a9ea57df8aa52fa050e02c370b3ff
[ "MIT" ]
permissive
AndreaGajic/Hackathon-Submissions
9b6021e6a7973f32ac784a82e5fde0c7c0c1dc1a
557a827ff83f8be1d0a25657cd18144ce93eeecf
refs/heads/main
2023-01-08T21:49:47.394824
2020-11-10T00:16:07
2020-11-10T00:16:07
311,306,572
0
0
MIT
2020-11-09T10:45:27
2020-11-09T10:45:27
null
UTF-8
Java
false
false
2,499
java
package src.com.github.jojo2357.scarystuff.graphics; public class Point { private float x; private float y; public Point(float x, float y) { this.x = x; this.y = y; } public Point(int x, int y) { this((float)x, (float)y); } public Point() { this(0, 0); } public Point(double x, double y) { this((float)x, (float)y); } public float getX() { return this.x; } public float getY() { return this.y; } public Point subtract(Point other) { return new Point(this.x - other.getX(), this.y - other.getY()); } public Point add(Point other) { return new Point(this.x + other.getX(), this.y + other.getY()); } @Override public boolean equals(Object other) { if (other == null || !(other instanceof Point)) return false; return ((Point) other).x == this.x && ((Point) other).y == this.y; } public Point stepX(int stepAmt) { this.x += stepAmt; return this; } public Point stepY(int stepAmt) { this.y += stepAmt; return this; } public Point step(int stepAmt) { this.stepX(stepAmt); this.stepY(stepAmt); return this; } public Point step(int xAmt, int yAmt) { this.stepX(xAmt); this.stepY(yAmt); return this; } public Point copy() { return new Point(this.x, this.y); } public boolean isInBoundingBox(Point coordinates, Dimensions buttonDimensions, float correctionFactor) { return this.x > correctionFactor * (coordinates.x - buttonDimensions.getWidth() / 2.0) && this.x < correctionFactor * (coordinates.x + buttonDimensions.getWidth() / 2.0) && this.y > correctionFactor * (coordinates.y - buttonDimensions.getHeight() / 2.0) && this.y < correctionFactor * (coordinates.y + buttonDimensions.getHeight() / 2.0); } public Point multiply(float factor) { this.x *= factor; this.y *= factor; return this; } public double distanceFrom(Point otherPosition) { return Math.sqrt(Math.pow(this.x - otherPosition.x, 2) + Math.pow(this.y - otherPosition.y, 2)); } @Override public String toString(){ return "Point (" + this.x + ", " + this.y + ")"; } public Point setX(float x){ this.x = x; return this; } public Point setY(float y){ this.y = y; return this; } }
[ "66704796+jojo2357@users.noreply.github.com" ]
66704796+jojo2357@users.noreply.github.com
d12954740915247eb5af404b12c44183e3079895
98e5ab52c5c5e794baf0108117db72191c22974f
/src/lk/ijse/git/controller/DashbordController.java
34df3e802c0b66aed1d0affc776aae21c8562080
[ "Apache-2.0" ]
permissive
GDSE-54-NIPUN/GDSE-54
0103e496b4d0fbb655af92adf2dd2ca98c3a6384
d26e8a7d4a4e49f1dd1a861eb23183f9ac6d20fe
refs/heads/main
2023-07-02T08:01:36.861492
2021-08-07T06:53:33
2021-08-07T06:53:33
393,573,302
0
0
null
null
null
null
UTF-8
Java
false
false
1,711
java
/* * * * * * * * * --------------------------------------------------------------------------------------------- * * * * * * Copyright (c) IJSE-intern. All rights reserved. * * * * * * Licensed under the MIT License. See License.txt in the project root for license information. * * * * * --------------------------------------------------------------------------------------------/ * * * * * */ package lk.ijse.git.controller; import com.jfoenix.controls.JFXButton; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; import java.net.URL; import java.util.ResourceBundle; /** * @author : Nipun Chathuranga <nipunc1999@gmail.com> * @since : 8/7/2021 **/ public class DashbordController implements Initializable { @FXML private JFXButton btnCustomer; @FXML private JFXButton btnItem; private Stage stage = new Stage(); @Override public void initialize(URL location, ResourceBundle resources) { } public void customer(ActionEvent actionEvent) throws IOException { Parent root = FXMLLoader.load(CustomerController.class.getResource("/lk/ijse/git/view/CustomerForm.fxml")); Scene temp = new Scene(root); stage.setScene(temp); stage.show(); } public void item(ActionEvent actionEvent) throws IOException { Parent root = FXMLLoader.load(ItemController.class.getResource("/lk/ijse/git/view/ItemForm.fxml")); Scene temp = new Scene(root); stage.setScene(temp); stage.show(); } }
[ "nipunc1999@gmail.com" ]
nipunc1999@gmail.com
20af74aee28753196ffc4cfff704823ef4320688
87b45a771bbe829f4ea47c6ade8404b6ffa77432
/src/main/java/reactor/BootStrap.java
acfdeb78bf8e7ccef48821066c224a11e0fa5eac
[]
no_license
cwx1848495412/AboutNIO
95a721e54038ed8268fea288b218508c51c1e601
417aeaba057059f019e45d1cd53726dc6fb6852b
refs/heads/main
2023-01-07T07:41:37.198883
2020-11-08T13:31:09
2020-11-08T13:31:09
306,517,696
1
0
null
null
null
null
UTF-8
Java
false
false
2,079
java
package reactor; import reactor.EventThreadGroup.AcceptThreadGroup; import reactor.EventThreadGroup.ReadThreadGroup; import reactor.EventThreadGroup.WriteThreadGroup; /** * @Auther: 苏察哈尔丶灿 * @Date: 2020/11/8 15:28 * @Slogan: 我自横刀向天笑,笑完我就去睡觉。 */ public class BootStrap { private int port; private int threadPoolSize; public AcceptThreadGroup acceptThreadGroup = new AcceptThreadGroup(); public ReadThreadGroup readThreadGroup = new ReadThreadGroup(); public WriteThreadGroup writeThreadGroup = new WriteThreadGroup(); public BootStrap bindPort(int port) { this.port = port; return this; } public BootStrap bindThreadPoolSize(int threadPoolSize) { this.threadPoolSize = threadPoolSize; return this; } /** * 启动服务器 * * @return */ public BootStrap start() throws Exception { startAcceptThreadGroup(); startReadThreadGroup(); startWriteThreadGroup(); return this; } /** * 启动 accept 线程组 * * @throws Exception */ private void startAcceptThreadGroup() throws Exception { // 设置端口 acceptThreadGroup.setPort(port); // 设置读的线程组 acceptThreadGroup.setReadThreadGroup(readThreadGroup); acceptThreadGroup.initThreads(1); acceptThreadGroup.startThreads(); } /** * 启动 read 线程组 * * @throws Exception */ private void startReadThreadGroup() throws Exception { readThreadGroup.setWriteThreadGroup(writeThreadGroup); readThreadGroup.initThreads(threadPoolSize); readThreadGroup.startThreads(); } /** * 启动 write 线程组 * * @throws Exception */ private void startWriteThreadGroup() throws Exception { writeThreadGroup.initThreads(threadPoolSize); writeThreadGroup.startThreads(); } public synchronized void sync() throws Exception { this.wait(); } }
[ "m15291337738@163.com" ]
m15291337738@163.com
7d1af31ba79447a2ecddb6470be09d14889ec469
fff7dc45864634db3efc39732d327fe1f04c0c2d
/src/main/java/nl/lotrac/bv/service/FileStorageService.java
a01043c123512d00c2aefe5d3786482dde503ea8
[]
no_license
robwfranke/file-upload-backend-01
48365c037f29a5586795d629491710be2e8562a9
bd9ad7c9eaef166e1618084d401617d0b34b4f2c
refs/heads/master
2023-06-03T01:39:45.724419
2021-06-24T14:11:58
2021-06-24T14:11:58
379,850,376
0
0
null
null
null
null
UTF-8
Java
false
false
987
java
package nl.lotrac.bv.service; import java.io.IOException; import java.util.stream.Stream; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; import nl.lotrac.bv.model.FileDB; import nl.lotrac.bv.repository.FileDBRepository; @Service public class FileStorageService { @Autowired private FileDBRepository fileDBRepository; public FileDB store(MultipartFile file) throws IOException { String fileName = StringUtils.cleanPath(file.getOriginalFilename()); FileDB FileDB = new FileDB(fileName, file.getContentType(), file.getBytes()); return fileDBRepository.save(FileDB); } public FileDB getFile(String id) { return fileDBRepository.findById(id).get(); } public Stream<FileDB> getAllFiles() { return fileDBRepository.findAll().stream(); } }
[ "robwfranke@gmail.com" ]
robwfranke@gmail.com
15d3867ba32c487949034e8be34ebad840bbe8ca
539b1110b2a4afa0933feee9dab9318cad259d8f
/demo-algorithm/src/main/java/com/handy/demo/algorithm/tree/btree/RedBlackTree.java
59597c3d4ca92634b800953a37c0d869cfc81ee5
[]
no_license
lhrimperial/demo
31783b5e508541634efaa401ff873e3156a2dcbb
03400825e2321baa549dde953a07c931b7a85aaf
refs/heads/master
2021-01-16T17:55:13.723635
2017-12-08T14:26:32
2017-12-08T14:26:32
100,023,093
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package com.handy.demo.algorithm.tree.btree; import java.util.TreeMap; /** * @author longhairen * @create 2017-10-05 8:25 * @description **/ public class RedBlackTree { public static void main(String[] args) { TreeMap treeMap = null; } }
[ "lhr9563215@163.com" ]
lhr9563215@163.com
8434901978a7108cb9b5a3c66e4e3f1a5f4d4558
854b4226a8d96566166a1f764e603226f8bf9bb4
/hw16-message-system/web-app/src/main/java/ru/otus/java/ageev/service/front/impl/FrontendServiceImpl.java
883931f5f9dcf2ddd8a5bce7696295ae927b0bc7
[]
no_license
anatolyageev/otus_java_hw
e6904e238f771f23ca52a2292746cadf9cc55100
e0c989eb3594395cabb6b59f28f3a874c7e076dd
refs/heads/main
2023-06-08T13:19:20.353406
2021-06-21T19:14:50
2021-06-21T19:14:50
332,255,219
0
0
null
2021-06-21T19:14:51
2021-01-23T16:27:04
Java
UTF-8
Java
false
false
2,327
java
package ru.otus.java.ageev.service.front.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import ru.otus.java.ageev.dto.ClientList; import ru.otus.java.ageev.dto.ClientMessageDto; import ru.otus.java.ageev.service.front.FrontendService; import ru.otus.messagesystem.client.MessageCallback; import ru.otus.messagesystem.client.MsClient; import ru.otus.messagesystem.message.Message; import ru.otus.messagesystem.message.MessageType; import java.util.ArrayList; @Service public class FrontendServiceImpl implements FrontendService { private static final Logger logger = LoggerFactory.getLogger(FrontendServiceImpl.class); private final MsClient msClient; private final String databaseService; public FrontendServiceImpl(@Qualifier("frontClient") MsClient msClient, @Value("${app.dbService}") String databaseService) { this.msClient = msClient; this.databaseService = databaseService; } @Override public void saveClient(ClientMessageDto client, MessageCallback<ClientMessageDto> dataConsumer) { logger.info("saveClient() clientDto: {}", client.toString()); Message outMsg = msClient.produceMessage(databaseService, client, MessageType.USER_SAVE, dataConsumer); msClient.sendMessage(outMsg); } @Override public void getClient(long id, MessageCallback<ClientMessageDto> dataConsumer) { ClientMessageDto clientDto = new ClientMessageDto(); logger.info("getClient() clientDto: {}", clientDto.toString()); clientDto.setId(id); logger.info("getClient() clientDto: {}", clientDto.toString()); Message outMsg = msClient.produceMessage(databaseService, clientDto, MessageType.USER_DATA, dataConsumer); msClient.sendMessage(outMsg); } @Override public void findAll(MessageCallback<ClientList> clientListMessageCallback) { logger.info("findAll() clientListMessageCallback: {}", clientListMessageCallback); Message outMsg = msClient.produceMessage(databaseService, new ClientList(new ArrayList<>()), MessageType.USER_ALL, clientListMessageCallback); msClient.sendMessage(outMsg); } }
[ "noreply@github.com" ]
anatolyageev.noreply@github.com
601f69f1cfda7d0b494efa6eeeddd8b6abe4c2e9
ee3a4166695dba1d05c5ef0d3cd8643fa9fc2af6
/src/main/java/com/jiga/springbootrabbitmqex/config/MessagingConfig.java
f9efc59dd4022c8b4878549238840adbfda52d9f
[]
no_license
jigarsinhsolanki/springboot-rabbitmq-ex
6912e92fbcdba4f5de7f099c79724cf115d23144
8a18dcf0d4af6e6e5b18accc913916eeb61feddc
refs/heads/master
2023-03-08T17:50:23.614845
2021-02-13T18:17:28
2021-02-13T18:17:28
338,638,955
0
0
null
null
null
null
UTF-8
Java
false
false
1,400
java
package com.jiga.springbootrabbitmqex.config; import org.springframework.amqp.core.*; import org.springframework.amqp.rabbit.connection.ConnectionFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; import org.springframework.amqp.support.converter.MessageConverter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class MessagingConfig { public static final String QUEUE="newQueue"; public static final String Exchange="newExchange"; public static final String ROUTING_KEY="newRoutingKey"; @Bean public Queue queue(){ return new Queue(QUEUE); } @Bean public TopicExchange topicExchange(){ return new TopicExchange(Exchange); } @Bean public Binding binding(Queue queue, TopicExchange topicExchange){ return BindingBuilder.bind(queue).to(topicExchange).with(ROUTING_KEY); } @Bean public MessageConverter converter(){ return new Jackson2JsonMessageConverter(); } public AmqpTemplate template(ConnectionFactory connectionFactory){ final RabbitTemplate rabbitTemplate= new RabbitTemplate(connectionFactory); rabbitTemplate.setMessageConverter(converter()); return rabbitTemplate; } }
[ "JigarmSolanki22@gmail.com" ]
JigarmSolanki22@gmail.com
ff67e474430263bbb53c19967af9100f92523744
548a1b731709a376e079e1f0417cc401cce70aaf
/src/main/java/collectionsclass/Book.java
d59f88873ad50561244c7b2dff4cf6d611adb045
[]
no_license
egydGIT/javaBackend
0e96c6b2bab639ccdb4631b481b69a2205d3963c
be22a7148e10fb6da019a74e916dcd353fb53e70
refs/heads/master
2023-06-25T00:41:32.443210
2021-07-11T12:33:10
2021-07-11T12:33:10
309,369,092
0
0
null
null
null
null
UTF-8
Java
false
false
1,321
java
package collectionsclass; import java.util.Objects; public class Book implements Comparable<Book> { private int id; private String author; private String title; public Book(int id, String author, String title) { this.id = id; this.author = author; this.title = title; } @Override public int compareTo(Book o) { return Integer.valueOf(this.getId()).compareTo(Integer.valueOf(o.getId())); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Book book = (Book) o; return id == book.id; } @Override public int hashCode() { //return Objects.hash(id); return id; // ? } @Override public String toString() { return id + " " + author + " " + title; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } }
[ "egyd.eszter@gmail.com" ]
egyd.eszter@gmail.com
5669d22b0baed233faef98cb7f6309ab888e905f
9e63738da9f54aefac4ce596a413adc9307f0518
/ssu-main/src/main/java/tasks/model/Product.java
c59da2e6be72749372676ee4ab84a00615e5bbb3
[]
no_license
miffn3/java-ssu
c6c65cb829301745498f6c32cb6abeec0ca4b61d
8881c6bf3cae24b77f5d1b34a9d14b01e97f3e3a
refs/heads/master
2022-07-08T02:04:46.993486
2020-04-02T19:53:46
2020-04-02T19:53:46
237,593,893
0
0
null
2022-06-21T03:06:44
2020-02-01T09:50:21
Java
UTF-8
Java
false
false
1,319
java
package tasks.model; public class Product { private String name; private double price; private int yearOfProduction; public Product() { } public Product(String name, int price, int yearOfProduction) { this.name = name; this.price = price; this.yearOfProduction = yearOfProduction; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getYearOfProduction() { return yearOfProduction; } public void setYearOfProduction(int yearOfProduction) { this.yearOfProduction = yearOfProduction; } public int yearsToProduction(int currentYear) { return currentYear - this.yearOfProduction; } public void changePrice(int currentYear) { if (yearsToProduction(currentYear) == 0) { this.setPrice(this.price * 1.2d); } } @Override public String toString() { return "Models.Product{" + "name='" + name + '\'' + ", price=" + price + ", yearOfProduction=" + yearOfProduction + '}'; } }
[ "miffn3@yandex.ru" ]
miffn3@yandex.ru
8ae12c88380708e0dc9886c63675bf35110e2d31
0bb748f35da4f882a6ed6710039d7c1833331651
/app/src/main/java/com/codepath/nytimessearch/activites/ArticleActivity.java
6db429c2910244629d3aafe6fd77b2b635bf5df3
[ "Apache-2.0" ]
permissive
KemleyNieva/NYTimesSearch
822980b87e6a3630035dfe998ea40368150d87fa
94fd31f22ea9ff017ae2f9b44a574a0a4e056e21
refs/heads/master
2020-02-26T14:37:25.197331
2016-06-24T23:05:35
2016-06-24T23:05:35
61,587,386
0
0
null
null
null
null
UTF-8
Java
false
false
2,579
java
package com.codepath.nytimessearch.activites; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ShareActionProvider; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.webkit.WebViewClient; import com.codepath.nytimessearch.Article; import com.codepath.nytimessearch.R; import org.parceler.Parcel; import org.parceler.Parcels; import butterknife.BindView; import butterknife.ButterKnife; public class ArticleActivity extends AppCompatActivity { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.wvArticle) WebView webView; //@BindView(R.id.wvArticle) WebView wvArticle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_article); ButterKnife.bind(this); //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); Article article = (Article) Parcels.unwrap(getIntent().getParcelableExtra("article")); //WebView webView = (WebView) findViewById(R.id.wvArticle); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); webView.loadUrl(article.getWebUrl()); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_item, menu); MenuItem item = menu.findItem(R.id.menu_item_share); ShareActionProvider miShare = (ShareActionProvider) MenuItemCompat.getActionProvider(item); Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); // get reference to WebView //WebView wvArticle = (WebView) findViewById(R.id.wvArticle); // pass in the URL currently being used by the WebView if(webView != null) { shareIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl()); miShare.setShareIntent(shareIntent); } return super.onCreateOptionsMenu(menu); } }
[ "kemleynieva@fb.com" ]
kemleynieva@fb.com
8b77332b6389b61bd4a1a5574373053eb7c28641
bbef9ca66647426d5f77857f762a1f01a4274bb7
/publicapi/src/main/java/com/zjt/pojo/Pojo.java
3ec3f34c7ba2348b037d29c833792590ddcccc32
[]
no_license
HeNanFei/MicroService
f762f9d5bf39e0b2f88e21c8583c45bf590b7c33
a15acc00ac2898092a6a10a2696c993b035e8075
refs/heads/master
2022-07-15T10:24:26.959624
2019-12-12T13:34:43
2019-12-12T13:34:43
227,095,100
1
0
null
2022-06-21T02:25:11
2019-12-10T10:51:25
Java
UTF-8
Java
false
false
45
java
package com.zjt.pojo; public class Pojo { }
[ "872060821@qq.com" ]
872060821@qq.com
e9f582a5fbc2d134e7b6be332648612acca0d53a
7aff172792324ec7d7e652503eb3366545a69865
/target/.generated/com/anova/anovacloud/client/application/user/UserDetailView_lastName_Context.java
59916b343153e39c0e62b91d728323fa606a2daa
[]
no_license
fanmotan/anova-anovacloud
d72eaa1b0f16fa789cdfdd4f7ab4bec016595a03
d890fd3fff8ab1ae6b6d27e99c1b9d88586846cd
refs/heads/master
2021-01-22T06:44:21.591625
2014-10-13T17:07:05
2014-10-13T17:07:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
965
java
package com.anova.anovacloud.client.application.user; public class UserDetailView_lastName_Context extends com.google.gwt.editor.client.impl.AbstractEditorContext<java.lang.String> { private final com.anova.anovacloud.shared.dto.UserDto parent; public UserDetailView_lastName_Context(com.anova.anovacloud.shared.dto.UserDto parent, com.google.gwt.editor.client.Editor<java.lang.String> editor, String path) { super(editor,path); this.parent = parent; } @Override public boolean canSetInModel() { return parent != null && true && true; } @Override public java.lang.String checkAssignment(Object value) { return (java.lang.String) value; } @Override public Class getEditedType() { return java.lang.String.class; } @Override public java.lang.String getFromModel() { return (parent != null && true) ? parent.getLastName() : null; } @Override public void setInModel(java.lang.String data) { parent.setLastName(data); } }
[ "mo_fan123@yahoo.com" ]
mo_fan123@yahoo.com
ad36645c4e1d578472a07a554d87db1c0f8681b7
836fc62dff4d7f77da5bc726625b09ac3b938101
/src/mainpkg/SearchDepth.java
e0af7ad224f59dda45f4481563e52c938294e584
[ "Apache-2.0" ]
permissive
NFS002/Email-Crawler
ff2c1d3e1fe877462902e602dbb4914e4194679b
17011a8c087ec3c76676e04fbc1f1c7f28e06f5c
refs/heads/master
2021-06-28T06:06:20.073029
2017-09-18T16:05:33
2017-09-18T16:05:33
103,955,042
1
0
null
null
null
null
UTF-8
Java
false
false
129
java
package mainpkg; /** * Created by apple on 5/2/17. */ public enum SearchDepth { CURRENT, SUPER_DOMAIN, DEEP; }
[ "noreply@github.com" ]
NFS002.noreply@github.com
1086df66208c66850199004c7f0ac4725cd5cb4c
38c4451ab626dcdc101a11b18e248d33fd8a52e0
/tokens/apache-cassandra-1.2.0/test/unit/org/apache/cassandra/service/RemoveTest.java
71c32d0fe691db77d2628200bd233bd58e1d9e95
[]
no_license
habeascorpus/habeascorpus-data
47da7c08d0f357938c502bae030d5fb8f44f5e01
536d55729f3110aee058ad009bcba3e063b39450
refs/heads/master
2020-06-04T10:17:20.102451
2013-02-19T15:19:21
2013-02-19T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,957
java
package TokenNamepackage org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT service TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT io TokenNameIdentifier . TokenNameDOT IOException TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT InetAddress TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT ArrayList TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT Collections TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT List TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT UUID TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier . TokenNameDOT concurrent TokenNameIdentifier . TokenNameDOT atomic TokenNameIdentifier . TokenNameDOT AtomicBoolean TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT After TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT AfterClass TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT Before TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT BeforeClass TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT Test TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT SchemaLoader TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT Util TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT exceptions TokenNameIdentifier . TokenNameDOT ConfigurationException TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT dht TokenNameIdentifier . TokenNameDOT IPartitioner TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT dht TokenNameIdentifier . TokenNameDOT RandomPartitioner TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT dht TokenNameIdentifier . TokenNameDOT Token TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT gms TokenNameIdentifier . TokenNameDOT Gossiper TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT locator TokenNameIdentifier . TokenNameDOT TokenMetadata TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT MessageIn TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT MessageOut TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT MessagingService TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT sink TokenNameIdentifier . TokenNameDOT IMessageSink TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT net TokenNameIdentifier . TokenNameDOT sink TokenNameIdentifier . TokenNameDOT SinkManager TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT streaming TokenNameIdentifier . TokenNameDOT StreamUtil TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT cassandra TokenNameIdentifier . TokenNameDOT utils TokenNameIdentifier . TokenNameDOT FBUtilities TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport static TokenNamestatic org TokenNameIdentifier . TokenNameDOT junit TokenNameIdentifier . TokenNameDOT Assert TokenNameIdentifier . TokenNameDOT * TokenNameMULTIPLY ; TokenNameSEMICOLON public TokenNamepublic class TokenNameclass RemoveTest TokenNameIdentifier { TokenNameLBRACE static TokenNamestatic final TokenNamefinal IPartitioner TokenNameIdentifier partitioner TokenNameIdentifier = TokenNameEQUAL new TokenNamenew RandomPartitioner TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON StorageService TokenNameIdentifier ss TokenNameIdentifier = TokenNameEQUAL StorageService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier ; TokenNameSEMICOLON TokenMetadata TokenNameIdentifier tmd TokenNameIdentifier = TokenNameEQUAL ss TokenNameIdentifier . TokenNameDOT getTokenMetadata TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON static TokenNamestatic IPartitioner TokenNameIdentifier oldPartitioner TokenNameIdentifier ; TokenNameSEMICOLON ArrayList TokenNameIdentifier < TokenNameLESS Token TokenNameIdentifier > TokenNameGREATER endpointTokens TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier < TokenNameLESS Token TokenNameIdentifier > TokenNameGREATER ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON ArrayList TokenNameIdentifier < TokenNameLESS Token TokenNameIdentifier > TokenNameGREATER keyTokens TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier < TokenNameLESS Token TokenNameIdentifier > TokenNameGREATER ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON List TokenNameIdentifier < TokenNameLESS InetAddress TokenNameIdentifier > TokenNameGREATER hosts TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier < TokenNameLESS InetAddress TokenNameIdentifier > TokenNameGREATER ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON List TokenNameIdentifier < TokenNameLESS UUID TokenNameIdentifier > TokenNameGREATER hostIds TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier < TokenNameLESS UUID TokenNameIdentifier > TokenNameGREATER ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON InetAddress TokenNameIdentifier removalhost TokenNameIdentifier ; TokenNameSEMICOLON UUID TokenNameIdentifier removalId TokenNameIdentifier ; TokenNameSEMICOLON @ TokenNameAT BeforeClass TokenNameIdentifier public TokenNamepublic static TokenNamestatic void TokenNamevoid setupClass TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN throws TokenNamethrows IOException TokenNameIdentifier { TokenNameLBRACE oldPartitioner TokenNameIdentifier = TokenNameEQUAL StorageService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier . TokenNameDOT setPartitionerUnsafe TokenNameIdentifier ( TokenNameLPAREN partitioner TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON SchemaLoader TokenNameIdentifier . TokenNameDOT loadSchema TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT AfterClass TokenNameIdentifier public TokenNamepublic static TokenNamestatic void TokenNamevoid tearDownClass TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE StorageService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier . TokenNameDOT setPartitionerUnsafe TokenNameIdentifier ( TokenNameLPAREN oldPartitioner TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON SchemaLoader TokenNameIdentifier . TokenNameDOT stopGossiper TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT Before TokenNameIdentifier public TokenNamepublic void TokenNamevoid setup TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN throws TokenNamethrows IOException TokenNameIdentifier , TokenNameCOMMA ConfigurationException TokenNameIdentifier { TokenNameLBRACE tmd TokenNameIdentifier . TokenNameDOT clearUnsafe TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON Util TokenNameIdentifier . TokenNameDOT createInitialRing TokenNameIdentifier ( TokenNameLPAREN ss TokenNameIdentifier , TokenNameCOMMA partitioner TokenNameIdentifier , TokenNameCOMMA endpointTokens TokenNameIdentifier , TokenNameCOMMA keyTokens TokenNameIdentifier , TokenNameCOMMA hosts TokenNameIdentifier , TokenNameCOMMA hostIds TokenNameIdentifier , TokenNameCOMMA 6 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON MessagingService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT listen TokenNameIdentifier ( TokenNameLPAREN FBUtilities TokenNameIdentifier . TokenNameDOT getBroadcastAddress TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON Gossiper TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier . TokenNameDOT start TokenNameIdentifier ( TokenNameLPAREN 1 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON removalhost TokenNameIdentifier = TokenNameEQUAL hosts TokenNameIdentifier . TokenNameDOT get TokenNameIdentifier ( TokenNameLPAREN 5 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON hosts TokenNameIdentifier . TokenNameDOT remove TokenNameIdentifier ( TokenNameLPAREN removalhost TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON removalId TokenNameIdentifier = TokenNameEQUAL hostIds TokenNameIdentifier . TokenNameDOT get TokenNameIdentifier ( TokenNameLPAREN 5 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON hostIds TokenNameIdentifier . TokenNameDOT remove TokenNameIdentifier ( TokenNameLPAREN removalId TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT After TokenNameIdentifier public TokenNamepublic void TokenNamevoid tearDown TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE SinkManager TokenNameIdentifier . TokenNameDOT clear TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON MessagingService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT clearCallbacksUnsafe TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON MessagingService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT shutdown TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT Test TokenNameIdentifier ( TokenNameLPAREN expected TokenNameIdentifier = TokenNameEQUAL UnsupportedOperationException TokenNameIdentifier . TokenNameDOT class TokenNameclass ) TokenNameRPAREN public TokenNamepublic void TokenNamevoid testBadHostId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE ss TokenNameIdentifier . TokenNameDOT removeNode TokenNameIdentifier ( TokenNameLPAREN "ffffffff-aaaa-aaaa-aaaa-ffffffffffff" TokenNameStringLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT Test TokenNameIdentifier ( TokenNameLPAREN expected TokenNameIdentifier = TokenNameEQUAL UnsupportedOperationException TokenNameIdentifier . TokenNameDOT class TokenNameclass ) TokenNameRPAREN public TokenNamepublic void TokenNamevoid testLocalHostId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE ss TokenNameIdentifier . TokenNameDOT removeNode TokenNameIdentifier ( TokenNameLPAREN hostIds TokenNameIdentifier . TokenNameDOT get TokenNameIdentifier ( TokenNameLPAREN 0 TokenNameIntegerLiteral ) TokenNameRPAREN . TokenNameDOT toString TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE @ TokenNameAT Test TokenNameIdentifier public TokenNamepublic void TokenNamevoid testRemoveHostId TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN throws TokenNamethrows InterruptedException TokenNameIdentifier { TokenNameLBRACE ReplicationSink TokenNameIdentifier rSink TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ReplicationSink TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON SinkManager TokenNameIdentifier . TokenNameDOT add TokenNameIdentifier ( TokenNameLPAREN rSink TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON final TokenNamefinal AtomicBoolean TokenNameIdentifier success TokenNameIdentifier = TokenNameEQUAL new TokenNamenew AtomicBoolean TokenNameIdentifier ( TokenNameLPAREN false TokenNamefalse ) TokenNameRPAREN ; TokenNameSEMICOLON Thread TokenNameIdentifier remover TokenNameIdentifier = TokenNameEQUAL new TokenNamenew Thread TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE public TokenNamepublic void TokenNamevoid run TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE try TokenNametry { TokenNameLBRACE ss TokenNameIdentifier . TokenNameDOT removeNode TokenNameIdentifier ( TokenNameLPAREN removalId TokenNameIdentifier . TokenNameDOT toString TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE catch TokenNamecatch ( TokenNameLPAREN Exception TokenNameIdentifier e TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE System TokenNameIdentifier . TokenNameDOT err TokenNameIdentifier . TokenNameDOT println TokenNameIdentifier ( TokenNameLPAREN e TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON e TokenNameIdentifier . TokenNameDOT printStackTrace TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON return TokenNamereturn ; TokenNameSEMICOLON } TokenNameRBRACE success TokenNameIdentifier . TokenNameDOT set TokenNameIdentifier ( TokenNameLPAREN true TokenNametrue ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE ; TokenNameSEMICOLON remover TokenNameIdentifier . TokenNameDOT start TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON Thread TokenNameIdentifier . TokenNameDOT sleep TokenNameIdentifier ( TokenNameLPAREN 1000 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON assertTrue TokenNameIdentifier ( TokenNameLPAREN tmd TokenNameIdentifier . TokenNameDOT isLeaving TokenNameIdentifier ( TokenNameLPAREN removalhost TokenNameIdentifier ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON assertEquals TokenNameIdentifier ( TokenNameLPAREN 1 TokenNameIntegerLiteral , TokenNameCOMMA tmd TokenNameIdentifier . TokenNameDOT getLeavingEndpoints TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT size TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON for TokenNamefor ( TokenNameLPAREN InetAddress TokenNameIdentifier host TokenNameIdentifier : TokenNameCOLON hosts TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE MessageOut TokenNameIdentifier msg TokenNameIdentifier = TokenNameEQUAL new TokenNamenew MessageOut TokenNameIdentifier ( TokenNameLPAREN host TokenNameIdentifier , TokenNameCOMMA MessagingService TokenNameIdentifier . TokenNameDOT Verb TokenNameIdentifier . TokenNameDOT REPLICATION_FINISHED TokenNameIdentifier , TokenNameCOMMA null TokenNamenull , TokenNameCOMMA null TokenNamenull , TokenNameCOMMA Collections TokenNameIdentifier . TokenNameDOT < TokenNameLESS String TokenNameIdentifier , TokenNameCOMMA byte TokenNamebyte [ TokenNameLBRACKET ] TokenNameRBRACKET > TokenNameGREATER emptyMap TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON MessagingService TokenNameIdentifier . TokenNameDOT instance TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT sendRR TokenNameIdentifier ( TokenNameLPAREN msg TokenNameIdentifier , TokenNameCOMMA FBUtilities TokenNameIdentifier . TokenNameDOT getBroadcastAddress TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE remover TokenNameIdentifier . TokenNameDOT join TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON assertTrue TokenNameIdentifier ( TokenNameLPAREN success TokenNameIdentifier . TokenNameDOT get TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON assertTrue TokenNameIdentifier ( TokenNameLPAREN tmd TokenNameIdentifier . TokenNameDOT getLeavingEndpoints TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT isEmpty TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE class TokenNameclass ReplicationSink TokenNameIdentifier implements TokenNameimplements IMessageSink TokenNameIdentifier { TokenNameLBRACE public TokenNamepublic MessageIn TokenNameIdentifier handleMessage TokenNameIdentifier ( TokenNameLPAREN MessageIn TokenNameIdentifier msg TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier id TokenNameIdentifier , TokenNameCOMMA InetAddress TokenNameIdentifier to TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE if TokenNameif ( TokenNameLPAREN ! TokenNameNOT msg TokenNameIdentifier . TokenNameDOT verb TokenNameIdentifier . TokenNameDOT equals TokenNameIdentifier ( TokenNameLPAREN MessagingService TokenNameIdentifier . TokenNameDOT Verb TokenNameIdentifier . TokenNameDOT STREAM_REQUEST TokenNameIdentifier ) TokenNameRPAREN ) TokenNameRPAREN return TokenNamereturn msg TokenNameIdentifier ; TokenNameSEMICOLON StreamUtil TokenNameIdentifier . TokenNameDOT finishStreamRequest TokenNameIdentifier ( TokenNameLPAREN msg TokenNameIdentifier , TokenNameCOMMA to TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON return TokenNamereturn null TokenNamenull ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic MessageOut TokenNameIdentifier handleMessage TokenNameIdentifier ( TokenNameLPAREN MessageOut TokenNameIdentifier msg TokenNameIdentifier , TokenNameCOMMA String TokenNameIdentifier id TokenNameIdentifier , TokenNameCOMMA InetAddress TokenNameIdentifier to TokenNameIdentifier ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn msg TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE } TokenNameRBRACE
[ "pschulam@gmail.com" ]
pschulam@gmail.com
78fab4162c2de637e8307c8ed59307cb3f974bc5
7afb6a151f75c0803f1da9e444fd94000bbf23cb
/src/com/syntax/class01/LunchChromeBrowser.java
37b46dd1caf84ea4f27b3410dc26847a18f8af3a
[]
no_license
miltaf/SeleniumJavaBatch6
00b6e1b49a3af4c0e01f27c4814c9d142e526457
39b4e1c1f2e66453ac0ff488d3ab78fb6730ab47
refs/heads/master
2022-10-14T09:11:47.107840
2020-06-15T22:56:04
2020-06-15T22:56:04
258,096,399
1
0
null
null
null
null
UTF-8
Java
false
false
793
java
package com.syntax.class01; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class LunchChromeBrowser { public static void main(String[] args) { //For Windows users. drivers\\chromedriver.exe //Or \\Users\\syntax\\eclipse-workspace\\SeleniumBatchVI\\drivers\\chromedriver.exe //for Mac users drivers/chromedriver //Making connection to the driver System.setProperty("webdriver.chrome.driver", "drivers/chromedriver"); //opening the browser by calling the constructor of ChromeDriver class and upcasting. WebDriver driver=new ChromeDriver(); driver.get("https://www.google.com"); String url=driver.getCurrentUrl(); System.out.println(url); System.out.println(driver.getTitle()); } }
[ "mahboob.iltaf@gmail.com" ]
mahboob.iltaf@gmail.com
db589bcc3a5ce5fad2eccc3ac9f35ba7c91aff42
8d29d75396ae7aa0eae511497046f59d499b19fe
/RobotWars/src/Vector.java
a3713cc03ebb82402c143050ff6a2cda08b64d69
[]
no_license
hosseinmp76/foroughmand-java-961-gitlab
25e769c6e52e9b2930fe07d21f05a025724dff23
892b1afeaca7d6230540a180dde3d907c1fdc702
refs/heads/master
2020-07-27T04:25:06.123416
2017-12-09T21:07:11
2017-12-09T21:07:11
208,867,226
0
0
null
null
null
null
UTF-8
Java
false
false
617
java
public class Vector { private int x; private int y; public Vector(int x, int y) { this.x = x; this.y = y; } public void set(int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public double size() { return Math.sqrt(x * x + y * y); } public Vector multiplyTo(double v) { return new Vector((int)(x * v), (int)(y * v)); } }
[ "foroughmand@gmail.com" ]
foroughmand@gmail.com
3522158961ed7f5fbe144fdbb60cab5ddca66c4e
5f51597d57692b3eab24b325cbc3659513fde4ea
/app/src/main/java/com/onetapgaming/onetapwinning/util/Base64.java
9f41900b709013bdaa5c21c88b6e858b9b183994
[]
no_license
PHPRules/OneTapGaming
6d034186cde755efdba5f2a27276ed5b381b081b
52d7f4cb7c6c10c0344e2e3933d89a3f428a718f
refs/heads/master
2021-01-15T09:52:46.319009
2015-06-11T19:41:49
2015-06-11T19:41:49
23,941,925
0
0
null
null
null
null
UTF-8
Java
false
false
24,276
java
// Portions copyright 2002, Google, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.onetapgaming.onetapwinning.util; // This code was converted from code at http://iharder.sourceforge.net/base64/ // Lots of extraneous features were removed. /* The original code said: * <p> * I am placing this code in the Public Domain. Do with it as you will. * This software comes with no guarantees or warranties but with * plenty of well-wishing instead! * Please visit * <a href="http://iharder.net/xmlizable">http://iharder.net/xmlizable</a> * periodically to check for updates or to contribute improvements. * </p> * * @author Robert Harder * @author rharder@usa.net * @version 1.3 */ /** * Base64 converter class. This code is not a complete MIME encoder; * it simply converts binary data to base64 data and back. * * <p>Note {@link CharBase64} is a GWT-compatible implementation of this * class. */ public class Base64 { /** Specify encoding (value is {@code true}). */ public final static boolean ENCODE = true; /** Specify decoding (value is {@code false}). */ public final static boolean DECODE = false; /** The equals sign (=) as a byte. */ private final static byte EQUALS_SIGN = (byte) '='; /** The new line character (\n) as a byte. */ private final static byte NEW_LINE = (byte) '\n'; /** * The 64 valid Base64 values. */ private final static byte[] ALPHABET = {(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '+', (byte) '/'}; /** * The 64 valid web safe Base64 values. */ private final static byte[] WEBSAFE_ALPHABET = {(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '-', (byte) '_'}; /** * Translates a Base64 value to either its 6-bit reconstruction value * or a negative number indicating some other meaning. **/ private final static byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8 -5, -5, // Whitespace: Tab and Linefeed -9, -9, // Decimal 11 - 12 -5, // Whitespace: Carriage Return -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26 -9, -9, -9, -9, -9, // Decimal 27 - 31 -5, // Whitespace: Space -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42 62, // Plus sign at decimal 43 -9, -9, -9, // Decimal 44 - 46 63, // Slash at decimal 47 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine -9, -9, -9, // Decimal 58 - 60 -1, // Equals sign at decimal 61 -9, -9, -9, // Decimal 62 - 64 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N' 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z' -9, -9, -9, -9, -9, -9, // Decimal 91 - 96 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm' 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z' -9, -9, -9, -9, -9 // Decimal 123 - 127 /* ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */ }; /** The web safe decodabet */ private final static byte[] WEBSAFE_DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8 -5, -5, // Whitespace: Tab and Linefeed -9, -9, // Decimal 11 - 12 -5, // Whitespace: Carriage Return -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26 -9, -9, -9, -9, -9, // Decimal 27 - 31 -5, // Whitespace: Space -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 44 62, // Dash '-' sign at decimal 45 -9, -9, // Decimal 46-47 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine -9, -9, -9, // Decimal 58 - 60 -1, // Equals sign at decimal 61 -9, -9, -9, // Decimal 62 - 64 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N' 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z' -9, -9, -9, -9, // Decimal 91-94 63, // Underscore '_' at decimal 95 -9, // Decimal 96 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm' 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z' -9, -9, -9, -9, -9 // Decimal 123 - 127 /* ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 128 - 139 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */ }; // Indicates white space in encoding private final static byte WHITE_SPACE_ENC = -5; // Indicates equals sign in encoding private final static byte EQUALS_SIGN_ENC = -1; /** Defeats instantiation. */ private Base64() { } /* ******** E N C O D I N G M E T H O D S ******** */ /** * Encodes up to three bytes of the array <var>source</var> * and writes the resulting four Base64 bytes to <var>destination</var>. * The source and destination arrays can be manipulated * anywhere along their length by specifying * <var>srcOffset</var> and <var>destOffset</var>. * This method does not check to make sure your arrays * are large enough to accommodate <var>srcOffset</var> + 3 for * the <var>source</var> array or <var>destOffset</var> + 4 for * the <var>destination</var> array. * The actual number of significant bytes in your array is * given by <var>numSigBytes</var>. * * @param source the array to convert * @param srcOffset the index where conversion begins * @param numSigBytes the number of significant bytes in your array * @param destination the array to hold the conversion * @param destOffset the index where output will be put * @param alphabet is the encoding alphabet * @return the <var>destination</var> array * @since 1.3 */ private static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, byte[] alphabet) { // 1 2 3 // 01234567890123456789012345678901 Bit position // --------000000001111111122222222 Array position from threeBytes // --------| || || || | Six bit groups to index alphabet // >>18 >>12 >> 6 >> 0 Right shift necessary // 0x3f 0x3f 0x3f Additional AND // Create buffer with zero-padding if there are only one or two // significant bytes passed in the array. // We have to shift left 24 in order to flush out the 1's that appear // when Java treats a value as negative that is cast from a byte to an int. int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0); switch (numSigBytes) { case 3: destination[destOffset] = alphabet[(inBuff >>> 18)]; destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f]; destination[destOffset + 3] = alphabet[(inBuff) & 0x3f]; return destination; case 2: destination[destOffset] = alphabet[(inBuff >>> 18)]; destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = alphabet[(inBuff >>> 6) & 0x3f]; destination[destOffset + 3] = EQUALS_SIGN; return destination; case 1: destination[destOffset] = alphabet[(inBuff >>> 18)]; destination[destOffset + 1] = alphabet[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = EQUALS_SIGN; destination[destOffset + 3] = EQUALS_SIGN; return destination; default: return destination; } // end switch } // end encode3to4 /** * Encodes a byte array into Base64 notation. * Equivalent to calling * {@code encodeBytes(source, 0, source.length)} * * @param source The data to convert * @since 1.4 */ public static String encode(byte[] source) { return encode(source, 0, source.length, ALPHABET, true); } /** * Encodes a byte array into web safe Base64 notation. * * @param source The data to convert * @param doPadding is {@code true} to pad result with '=' chars * if it does not fall on 3 byte boundaries */ public static String encodeWebSafe(byte[] source, boolean doPadding) { return encode(source, 0, source.length, WEBSAFE_ALPHABET, doPadding); } /** * Encodes a byte array into Base64 notation. * * @param source the data to convert * @param off offset in array where conversion should begin * @param len length of data to convert * @param alphabet the encoding alphabet * @param doPadding is {@code true} to pad result with '=' chars * if it does not fall on 3 byte boundaries * @since 1.4 */ public static String encode(byte[] source, int off, int len, byte[] alphabet, boolean doPadding) { byte[] outBuff = encode(source, off, len, alphabet, Integer.MAX_VALUE); int outLen = outBuff.length; // If doPadding is false, set length to truncate '=' // padding characters while (doPadding == false && outLen > 0) { if (outBuff[outLen - 1] != '=') { break; } outLen -= 1; } return new String(outBuff, 0, outLen); } /** * Encodes a byte array into Base64 notation. * * @param source the data to convert * @param off offset in array where conversion should begin * @param len length of data to convert * @param alphabet is the encoding alphabet * @param maxLineLength maximum length of one line. * @return the BASE64-encoded byte array */ public static byte[] encode(byte[] source, int off, int len, byte[] alphabet, int maxLineLength) { int lenDiv3 = (len + 2) / 3; // ceil(len / 3) int len43 = lenDiv3 * 4; byte[] outBuff = new byte[len43 // Main 4:3 + (len43 / maxLineLength)]; // New lines int d = 0; int e = 0; int len2 = len - 2; int lineLength = 0; for (; d < len2; d += 3, e += 4) { // The following block of code is the same as // encode3to4( source, d + off, 3, outBuff, e, alphabet ); // but inlined for faster encoding (~20% improvement) int inBuff = ((source[d + off] << 24) >>> 8) | ((source[d + 1 + off] << 24) >>> 16) | ((source[d + 2 + off] << 24) >>> 24); outBuff[e] = alphabet[(inBuff >>> 18)]; outBuff[e + 1] = alphabet[(inBuff >>> 12) & 0x3f]; outBuff[e + 2] = alphabet[(inBuff >>> 6) & 0x3f]; outBuff[e + 3] = alphabet[(inBuff) & 0x3f]; lineLength += 4; if (lineLength == maxLineLength) { outBuff[e + 4] = NEW_LINE; e++; lineLength = 0; } // end if: end of line } // end for: each piece of array if (d < len) { encode3to4(source, d + off, len - d, outBuff, e, alphabet); lineLength += 4; if (lineLength == maxLineLength) { // Add a last newline outBuff[e + 4] = NEW_LINE; e++; } e += 4; } assert (e == outBuff.length); return outBuff; } /* ******** D E C O D I N G M E T H O D S ******** */ /** * Decodes four bytes from array <var>source</var> * and writes the resulting bytes (up to three of them) * to <var>destination</var>. * The source and destination arrays can be manipulated * anywhere along their length by specifying * <var>srcOffset</var> and <var>destOffset</var>. * This method does not check to make sure your arrays * are large enough to accommodate <var>srcOffset</var> + 4 for * the <var>source</var> array or <var>destOffset</var> + 3 for * the <var>destination</var> array. * This method returns the actual number of bytes that * were converted from the Base64 encoding. * * * @param source the array to convert * @param srcOffset the index where conversion begins * @param destination the array to hold the conversion * @param destOffset the index where output will be put * @param decodabet the decodabet for decoding Base64 content * @return the number of decoded bytes converted * @since 1.3 */ private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset, byte[] decodabet) { // Example: Dk== if (source[srcOffset + 2] == EQUALS_SIGN) { int outBuff = ((decodabet[source[srcOffset]] << 24) >>> 6) | ((decodabet[source[srcOffset + 1]] << 24) >>> 12); destination[destOffset] = (byte) (outBuff >>> 16); return 1; } else if (source[srcOffset + 3] == EQUALS_SIGN) { // Example: DkL= int outBuff = ((decodabet[source[srcOffset]] << 24) >>> 6) | ((decodabet[source[srcOffset + 1]] << 24) >>> 12) | ((decodabet[source[srcOffset + 2]] << 24) >>> 18); destination[destOffset] = (byte) (outBuff >>> 16); destination[destOffset + 1] = (byte) (outBuff >>> 8); return 2; } else { // Example: DkLE int outBuff = ((decodabet[source[srcOffset]] << 24) >>> 6) | ((decodabet[source[srcOffset + 1]] << 24) >>> 12) | ((decodabet[source[srcOffset + 2]] << 24) >>> 18) | ((decodabet[source[srcOffset + 3]] << 24) >>> 24); destination[destOffset] = (byte) (outBuff >> 16); destination[destOffset + 1] = (byte) (outBuff >> 8); destination[destOffset + 2] = (byte) (outBuff); return 3; } } // end decodeToBytes /** * Decodes data from Base64 notation. * * @param s the string to decode (decoded in default encoding) * @return the decoded data * @since 1.4 */ public static byte[] decode(String s) throws Base64DecoderException { byte[] bytes = s.getBytes(); return decode(bytes, 0, bytes.length); } /** * Decodes data from web safe Base64 notation. * Web safe encoding uses '-' instead of '+', '_' instead of '/' * * @param s the string to decode (decoded in default encoding) * @return the decoded data */ public static byte[] decodeWebSafe(String s) throws Base64DecoderException { byte[] bytes = s.getBytes(); return decodeWebSafe(bytes, 0, bytes.length); } /** * Decodes Base64 content in byte array format and returns * the decoded byte array. * * @param source The Base64 encoded data * @return decoded data * @since 1.3 * @throws Base64DecoderException */ public static byte[] decode(byte[] source) throws Base64DecoderException { return decode(source, 0, source.length); } /** * Decodes web safe Base64 content in byte array format and returns * the decoded data. * Web safe encoding uses '-' instead of '+', '_' instead of '/' * * @param source the string to decode (decoded in default encoding) * @return the decoded data */ public static byte[] decodeWebSafe(byte[] source) throws Base64DecoderException { return decodeWebSafe(source, 0, source.length); } /** * Decodes Base64 content in byte array format and returns * the decoded byte array. * * @param source the Base64 encoded data * @param off the offset of where to begin decoding * @param len the length of characters to decode * @return decoded data * @since 1.3 * @throws Base64DecoderException */ public static byte[] decode(byte[] source, int off, int len) throws Base64DecoderException { return decode(source, off, len, DECODABET); } /** * Decodes web safe Base64 content in byte array format and returns * the decoded byte array. * Web safe encoding uses '-' instead of '+', '_' instead of '/' * * @param source the Base64 encoded data * @param off the offset of where to begin decoding * @param len the length of characters to decode * @return decoded data */ public static byte[] decodeWebSafe(byte[] source, int off, int len) throws Base64DecoderException { return decode(source, off, len, WEBSAFE_DECODABET); } /** * Decodes Base64 content using the supplied decodabet and returns * the decoded byte array. * * @param source the Base64 encoded data * @param off the offset of where to begin decoding * @param len the length of characters to decode * @param decodabet the decodabet for decoding Base64 content * @return decoded data */ public static byte[] decode(byte[] source, int off, int len, byte[] decodabet) throws Base64DecoderException { int len34 = len * 3 / 4; byte[] outBuff = new byte[2 + len34]; // Upper limit on size of output int outBuffPosn = 0; byte[] b4 = new byte[4]; int b4Posn = 0; int i = 0; byte sbiCrop = 0; byte sbiDecode = 0; for (i = 0; i < len; i++) { sbiCrop = (byte) (source[i + off] & 0x7f); // Only the low seven bits sbiDecode = decodabet[sbiCrop]; if (sbiDecode >= WHITE_SPACE_ENC) { // White space Equals sign or better if (sbiDecode >= EQUALS_SIGN_ENC) { // An equals sign (for padding) must not occur at position 0 or 1 // and must be the last byte[s] in the encoded value if (sbiCrop == EQUALS_SIGN) { int bytesLeft = len - i; byte lastByte = (byte) (source[len - 1 + off] & 0x7f); if (b4Posn == 0 || b4Posn == 1) { throw new Base64DecoderException( "invalid padding byte '=' at byte offset " + i); } else if ((b4Posn == 3 && bytesLeft > 2) || (b4Posn == 4 && bytesLeft > 1)) { throw new Base64DecoderException( "padding byte '=' falsely signals end of encoded value " + "at offset " + i); } else if (lastByte != EQUALS_SIGN && lastByte != NEW_LINE) { throw new Base64DecoderException( "encoded value has invalid trailing byte"); } break; } b4[b4Posn++] = sbiCrop; if (b4Posn == 4) { outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet); b4Posn = 0; } } } else { throw new Base64DecoderException("Bad Base64 input character at " + i + ": " + source[i + off] + "(decimal)"); } } // Because web safe encoding allows non padding base64 encodes, we // need to pad the rest of the b4 buffer with equal signs when // b4Posn != 0. There can be at most 2 equal signs at the end of // four characters, so the b4 buffer must have two or three // characters. This also catches the case where the input is // padded with EQUALS_SIGN if (b4Posn != 0) { if (b4Posn == 1) { throw new Base64DecoderException("single trailing character at offset " + (len - 1)); } b4[b4Posn++] = EQUALS_SIGN; outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn, decodabet); } byte[] out = new byte[outBuffPosn]; System.arraycopy(outBuff, 0, out, 0, outBuffPosn); return out; } }
[ "jchodyniecki@gmail.com" ]
jchodyniecki@gmail.com
98029863e083e542236e260e13ba84eb900bc146
c919b0c5930539c396deb95cc8093b08a6c9959a
/practice6.8/src/com/fqy/prestatment/PreStatementUpdateTest.java
9d581edc879f582bce4a97a84f05c02217481ed4
[]
no_license
fqy1994/JDBCPractice
b8c551fde47d72532fe54a119cb72e3dbcee2008
a1c284d63f374b93720afd2b720a0444c8a3ed25
refs/heads/master
2023-05-14T00:32:44.019417
2021-06-10T11:10:11
2021-06-10T11:10:11
375,052,792
0
0
null
null
null
null
UTF-8
Java
false
false
3,770
java
package com.fqy.prestatment; import com.fqy.connection.ConnectionTest; import com.fqy.util.JDBCUtils; import org.junit.Test; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Properties; /** * @author fan_jennifer * @create 2021-06-2021/6/8 21:39 * 插入 * 占位符的使用 * 日期的转换 * 通用化打包 * for循环事从0开始的,但是ps参数列表数是从1开始的要注意 */ public class PreStatementUpdateTest { /** * 通用代码设置 */ @Test public void commonTest() { String sql = " delete from customers where id = ?"; JDBCUtils.update(sql,3); String sql1 = "update `order` set order_name = ? where order_id = ?"; JDBCUtils.update(sql1,"DD","2"); } /** * 修改记录 */ @Test public void updateTest() throws SQLException, IOException, ClassNotFoundException { Connection conn = null; PreparedStatement ps = null; try { //获取数据库的连接 conn = JDBCUtils.getConnection(); //预编译sql语句,返回preparestatment的实例,已经携带了要做的事 String sql = "update customers set name = ? where id = ?"; ps = conn.prepareStatement(sql); //填充占位符 ps.setObject(1, "王一博"); ps.setObject(2,18); //执行 ps.execute(); } catch (Exception e) { e.printStackTrace(); } finally { JDBCUtils.closeResource(conn,ps); } //资源的关闭 } /** * 增加记录 */ @Test public void insertTest() throws IOException, ClassNotFoundException, SQLException { Connection conn = null; PreparedStatement ps = null; try { //读取配置文件的基本信息 Properties pro = new Properties(); InputStream is = ConnectionTest.class.getClassLoader().getResourceAsStream("jdbc.properties"); pro.load(is); String user = pro.getProperty("user"); String password = pro.getProperty("password"); String url = pro.getProperty("url"); String driver = pro.getProperty("driver"); //加载驱动 Class.forName(driver); //获取连接 conn = DriverManager.getConnection(url, user, password); //System.out.println("conn = " + conn); //预编译sql语句,返回preparedstatemnt实例 String sql = "insert into customers(name,email,birth)values(?,?,?) "; ps = conn.prepareStatement(sql); //填充占位符:从1开始 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse("1982-02-03"); ps.setString(1, "周杰论"); ps.setString(2, "123@.com"); ps.setDate(3, new java.sql.Date(date.getTime())); ps.execute(); } catch (ParseException e) { e.printStackTrace(); } finally { try { if (ps != null) { ps.close(); } } catch (SQLException throwables) { throwables.printStackTrace(); } try { if (conn != null) { conn.close(); } } catch (SQLException throwables) { throwables.printStackTrace(); } } } }
[ "jane_glb@aliyun.com" ]
jane_glb@aliyun.com
8690f587c840f5ae5f0dfed81f8c28f2fbe64dae
8a389005e6f2e4ef9842d98ccb9062b8020cd59a
/src/main/java/sibbo/bitmessage/data/Database.java
6fb442d16e273c97ef478dea5048f099e92c55c8
[ "MIT" ]
permissive
lijiajia2023/JBitmessage
e71a21928ddd256c445094f9fee3cd03ae812c13
d316a395839f2cbdb50ded3b0b89254f2342dd4a
refs/heads/master
2023-07-21T01:27:03.497917
2013-08-31T17:30:35
2013-08-31T17:30:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
package sibbo.bitmessage.data; import java.util.logging.Logger; import sibbo.bitmessage.network.protocol.InventoryVectorMessage; import sibbo.bitmessage.network.protocol.POWMessage; /** * Class that manages a connection to a database. It creates several prepared * statements to make operations fast and secure. * * @author Sebastian Schmidt * @version 1.0 * */ public class Database { /** * Creates a new database with the given name or connects to the existing * one. Note that the user used for connecting must have the rights to * create a new database if it is not already created. * * @param path * The name of the database. */ public Database(String name) { // TODO Auto-generated constructor stub } private static final Logger LOG = Logger.getLogger(Database.class.getName()); /** * Reads the object with the given hash from the database. * * @param m * The hash. * @return The object with the given hash or null, if there is no object * with the given hash. */ public POWMessage getObject(InventoryVectorMessage m) { return null; // TODO Auto-generated method stub } }
[ "isibboi@gmail.com" ]
isibboi@gmail.com
f5294b0dbcf55080f29262797b67456e0fa04f24
29d25699a214c68792084f9e77008459ddd07535
/CalculatorTriDegree.java
c538fa6c4e4b6fcf3c79464b6b28f144b98cb675
[]
no_license
muhammadikram10/CalculatorIkram
293676e528e954d5fb80e95ac03e44d034c37d9f
e392d6749359667abaeb0e109e6dfdd13097ce30
refs/heads/master
2023-05-05T08:01:40.309503
2021-05-29T11:07:42
2021-05-29T11:07:42
371,950,103
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
import java.lang.Math; /** * class CalculatorTriDegree * * @author FarasatulMunawarah * @version 0.1 */ public class CalculatorTriDegree extends CalculatorTrigonometri { // instance variables - replace the example below with your own /** * Constructor for objects of class CalculatorTriDegree */ public CalculatorTriDegree() { } /** * konversi * * @param double sudut * @return void */ public void konversi(double sudut) { super.sudut = Math.toRadians(sudut); } }
[ "user@DESKTOP-9648BGC" ]
user@DESKTOP-9648BGC
ffbb4b7527cba8b26ab53a00be9690f35b6daefe
cfb9ee8baa685dc62e7785b212de4be2dd81d8a4
/src/main/java/com/altova/text/edi/DataTypeValidatorTime.java
94372b8018377b384b05c91b0debc54b3b5f6efd
[]
no_license
grdBracari/ehrm-exam-management-services
5258a5f3f77dd6efd165aac50c2c354670be765c
6c5e83b65e6d96d3aeed340485965a763399caf2
refs/heads/master
2022-10-25T20:27:54.090924
2020-06-09T14:10:22
2020-06-09T14:10:22
268,542,100
0
0
null
2020-06-01T14:16:50
2020-06-01T14:16:49
null
UTF-8
Java
false
false
2,470
java
//////////////////////////////////////////////////////////////////////// // // DataTypeValidatorTime.java // // This file was generated by MapForce 2020r2. // // YOU SHOULD NOT MODIFY THIS FILE, BECAUSE IT WILL BE // OVERWRITTEN WHEN YOU RE-RUN CODE GENERATION. // // Refer to the MapForce Documentation for further details. // http://www.altova.com/mapforce // //////////////////////////////////////////////////////////////////////// package com.altova.text.edi; import com.altova.text.ITextNode; public class DataTypeValidatorTime extends DataTypeValidator { public DataTypeValidatorTime (int minLength, int maxLength) { super (minLength, maxLength, null); } public boolean makeValidOnRead (StringBuffer s, Parser.Context context, Scanner.State beforeRead) { String sValue = s.toString(); int effLen = effectiveLength(s, context.getScanner().getServiceChars().getReleaseCharacter()); validateLength(effLen, sValue, context, beforeRead); if (!EDIDateTimeHelpers.IsTimeCorrect( sValue)) context.handleError( Parser.ErrorType.InvalidTime, ErrorMessages.GetInvalidTimeMessage( context.getParticle().getName(), sValue, "time" ), new ErrorPosition( beforeRead ), sValue ); while (Character.isWhitespace(s.charAt(0))) s.deleteCharAt(0); int len = s.length(); s.insert(2, ':'); if (len > 4) s.insert(5, ':'); else s.append(":00"); if (len > 6) s.insert(8, '.'); return true; } public boolean makeValidOnWrite (StringBuffer s, ITextNode node, Writer writer, boolean esc) { return makeValidOnWrite(s, node, writer); } public boolean makeValidOnWrite (StringBuffer s, ITextNode node, Writer writer) { // TOD: local time????? int i=0; while (i < s.length()) if (s.charAt(i) == ':' || s.charAt(i) == '.') s.deleteCharAt(i); else i++; i = s.indexOf("Z"); if (i == -1) i = s.indexOf("-"); if (i == -1) i = s.indexOf("+"); if (i != -1) s.setLength(i); if (s.length() > getMaxLength()) { if (getMaxLength() > 6 && s.charAt(getMaxLength()) >= '5') { java.math.BigDecimal d = new java.math.BigDecimal("0." + s.substring(6)); d = d.setScale(getMaxLength() - 6, java.math.RoundingMode.HALF_UP); s.setLength(6); String frac = d.toString(); s.append(frac.substring(2)); } else s.setLength(getMaxLength()); } while (s.length() > 6 && s.charAt(s.length()-1) == '0') s.setLength(s.length()-1); return true; } }
[ "pgrazaitis@gmail.com" ]
pgrazaitis@gmail.com
7129b63411cadfba4f58598dc50f24657b05143b
2ce9ba2bf30ac063813370bb6a1d6bf463bb4c41
/workspace/gestorWeb/control/src/main/java/es/salazaryasociados/control/GenericJPADao.java
ca5397d10c4daf05c6f6c7cd1280e038797cf5b2
[]
no_license
LuisLozano/GestorWeb
a4369f95c58015e537a34cc0f8f087b7424e6861
c4673ded406a3f23f924aee171ad595db7bf61d6
refs/heads/master
2021-01-10T16:58:14.298405
2017-11-24T22:28:03
2017-11-24T22:28:36
52,603,942
0
0
null
null
null
null
UTF-8
Java
false
false
7,723
java
package es.salazaryasociados.control; import java.lang.reflect.ParameterizedType; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.persistence.EntityGraph; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceException; import javax.persistence.Query; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import javax.validation.ConstraintViolation; import javax.validation.Validation; import javax.validation.ValidationException; import javax.validation.Validator; import javax.validation.ValidatorFactory; import es.salazaryasociados.control.exceptions.DataException; import es.salazaryasociados.control.exceptions.GestorErrors; public abstract class GenericJPADao <T> implements IGenericDao<T>{ private static Validator validator; @PersistenceContext(unitName="salazarPU") protected EntityManager em; public EntityManager getEm() { return em; } public void setEm(EntityManager em) { this.em = em; } protected Class<T> entityClass; public Class<T> getEntityClass() { return entityClass; } public void setEntityClass(Class<T> entityClass) { this.entityClass = entityClass; } public GenericJPADao() { ParameterizedType genericSuperclass = (ParameterizedType) getClass().getGenericSuperclass(); this.entityClass = (Class<T>) genericSuperclass.getActualTypeArguments()[0]; } public GenericJPADao(Class clazz) { this.entityClass = clazz; } public void setEntityManager(EntityManager em) { this.em = em; } public T persist(T item) throws DataException { T result = item; if (item == null) throw new PersistenceException("Item may not be null"); validate(item); em.persist(item); return result; } public T update(T item) { if (item == null) throw new PersistenceException("Item may not be null"); validate(item); em.merge(item); return item; } public List<T> getAll(int pageSize, int first, final Map<String, Object> params, String order, boolean desc) throws DataException{ StringBuffer queryString = new StringBuffer("SELECT o from "); queryString.append(entityClass.getSimpleName()); queryString.append(" o "); queryString.append(this.getWhere(params)); queryString.append(orderBy(order, desc)); try{ Query query = em.createQuery(queryString.toString()); setQueryParameters(query, params); if (pageSize > 0 && first >= 0) { query.setFirstResult(first); query.setMaxResults(pageSize); } return query.getResultList(); }catch(Exception e) { throw new DataException(GestorErrors.UNKNOWN_EXCEPTION, e); } } public long getCount (final Map<String, Object> params) throws DataException { StringBuffer queryString = new StringBuffer("SELECT count(o) from "); queryString.append(entityClass.getSimpleName()); queryString.append(" o "); queryString.append(this.getWhere(params)); try{ Query query = em.createQuery(queryString.toString()); setQueryParameters(query, params); return ((Long)query.getSingleResult()).longValue(); }catch(Exception e) { throw new DataException(GestorErrors.UNKNOWN_EXCEPTION, e); } } protected String orderBy(String order, boolean desc) { String result = ""; if (order != null && order.length() > 0) { result += " order by o." + order; if (desc) { result += " desc"; } } return result; } protected String getWhere(Map<String, Object> params) { String result = ""; if (params != null && params.size() > 0) { result += "where "; int i = 0; for (String field : params.keySet()) { Object value = params.get(field); if (value instanceof String) { String strVal = ((String)params.get(field)).toUpperCase(); result += "UPPER(o." + field + ") like \'%" + strVal + "%\'"; } else { result += "o." + field + "=:p" + field; } i++; if (i < params.size()) { result += " and "; } } } return result; } protected void setQueryParameters(Query query, Map<String, Object> params) { if (params != null && params.size() > 0) { for (String field : params.keySet()) { Object value = params.get(field); if (value instanceof String) { } else { query.setParameter("p" + field, params.get(field)); } } } } public T getById(Integer id, String ... fetchs) throws DataException{ if (id == null) throw new PersistenceException("Id may not be null"); T result = null; if (fetchs != null){ EntityGraph<T> graph = em.createEntityGraph(entityClass); try { for (String fetch : fetchs){ graph.addSubgraph(fetch); } Map<String, Object> hints = new HashMap<String, Object>(); hints.put("javax.persistence.loadgraph", graph); result = em.find(entityClass, id, hints); }catch(IllegalArgumentException | IllegalStateException e) { throw new PersistenceException("Error al obtener el objeto por su id.", e); } } else { result = em.find(entityClass, id); } return result; } public void delete(T item) { if (item == null) throw new PersistenceException("Item may not be null"); em.remove(em.merge(item)); } public List<T> findByAttributes(Map<String, String> attributes, int pageSize, int first) { //set up the Criteria query CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<T> cq = cb.createQuery(getEntityClass()); Root<T> foo = cq.from(getEntityClass()); List<Predicate> predicates = new ArrayList<Predicate>(); for(String s : attributes.keySet()) { if(foo.get(s) != null){ predicates.add(cb.like(foo.get(s), "%" + attributes.get(s) + "%" )); } } cq.where(predicates.toArray(new Predicate[]{})); TypedQuery<T> q = em.createQuery(cq); if (first >= 0 && pageSize > 0) { q.setFirstResult(first); q.setMaxResults(pageSize); } return q.getResultList(); } protected static void validate(Object o) throws ValidationException { if (validator == null) { ValidatorFactory factory = Validation.byDefaultProvider().providerResolver(new OsgiValidationProvider()).configure() .buildValidatorFactory(); validator = factory.getValidator(); } Set<ConstraintViolation<Object>> validatorResult = validator.validate(o); if (!validatorResult.isEmpty()) { StringBuffer sb = new StringBuffer(); for (ConstraintViolation<Object> v : validatorResult) { sb.append(v.getMessage() + ". "); } String msg = sb.toString().substring(0, sb.toString().length() - 1); throw new ValidationException(msg); } } }
[ "Luis Lozano@Conejo" ]
Luis Lozano@Conejo
32ebc95926e9c60ffb2b46cc08a54004be77d420
40c513406db7ea9091af4a78afec23cb52c0b786
/app/src/main/java/com/beksultan/qr_pay/ui/authorization/AuthorizationView.java
274e98effef57845a579e7bf410b1a1d15e9b45b
[]
no_license
skykz/QR_pay_oil
fcfe78d8148f65bbdedf3a72acaaa5e40ddab8c6
6b578184444568ce71d6f7758fc9fb0ed60f6dd4
refs/heads/master
2020-07-31T07:56:12.578191
2019-09-24T07:18:24
2019-09-24T07:18:24
210,537,283
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.beksultan.qr_pay.ui.authorization; import com.arellomobile.mvp.MvpView; interface AuthorizationView extends MvpView { void onSuccessSignIn(); void onFailedApiService(String error); }
[ "erasylgeso@gmail.com" ]
erasylgeso@gmail.com