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
bd8efd5d1869449b85ec7778c13c127c01228b59
de3d91e6448e530845158fd8b524cb7d626c3339
/src/main/java/fleet/Main.java
704bb000db37023d2d3294ff379439183babc3a1
[]
no_license
OndraHo/Course
cc94ce46c42ece9c2bd7a0c49160d55c8ef22c18
1b5ab7892d40dd25fbd3a84bdfdbaeba2e9d3cd1
refs/heads/main
2023-06-27T22:37:18.206429
2021-07-26T16:55:55
2021-07-26T16:56:11
366,172,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,204
java
package fleet; import java.time.LocalDate; import java.util.ArrayList; import static fleet.CarReader.readCarList; /** * @author ondrej.hosek */ public class Main { public static final int LAST_CHECK_MONTHS = 11; public static void main(String[] args) { Car myCar = new Car(Brand.SEAT, "Leon", "1BX 6879", LocalDate.of(2021, 10, 10), 10); ArrayList<Car> carArrayList = readCarList("C:\\IdeaProjects\\Course\\src\\fleet\\cars.csv"); for (Car car : carArrayList) { if (lastCheckBeforeElevenMonths(car)) { System.out.println(car.getBrand() + " " + car.getModel() + " " + car.getLicencePlate()); } } ArrayList<Car> engetoFleet = new ArrayList<>(); for (int i = 0; i < 20; i++) { engetoFleet.add(new Car(Brand.HYUNDAI, "i40", licencePlateGenerator(i), LocalDate.now(), 40)); System.out.println(engetoFleet.get(i).getLicencePlate()); } } private static boolean lastCheckBeforeElevenMonths(final Car car) { return car.getLastCheckDate().isBefore(LocalDate.now().minusMonths(LAST_CHECK_MONTHS)); } private static String licencePlateGenerator(int i) { if (i == 0) return "ENGETO0" + ++i; if (i < 10) return "ENGETO0" + ++i; else return "ENGETO" + ++i; } }
[ "Ondrej.Hosek@embedit.cz" ]
Ondrej.Hosek@embedit.cz
a2e49c2ecc1ef3aad065efdf2b1c07b7c43dfffb
41fa0b9b224d74d18b192f22fce8d4562a3aed34
/data/codingbat-solution/Ap1Scoresincreasing.java
d29a4a4d7a98b50d0dde4c592a7ee6472edee188
[]
no_license
Jisoo-Min/Graph-Match
7f4e09ffa8e46bdfd058d4f0affa01109bf0d9bd
0975de0092348912aaea3351be744ad8b08822af
refs/heads/master
2022-04-09T17:46:51.610100
2020-01-25T06:19:38
2020-01-25T06:19:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
class Ap1Scoresincreasing{ /* Given an array of scores, return true if each score is equal or greater * than the one before. The array will be length 2 or more. */ public boolean scoresIncreasing(int[] scores) { for(int i = 1; i < scores.length; i++) { if(scores[i] < scores[i-1]) return false; } return true; } }
[ "jsmin0415@gmail.com" ]
jsmin0415@gmail.com
e317d88bf2a436ab3a8435c76b65312518646818
405b3f5b7cf052e240a413bf0929afecf8a32d0a
/src/env/Overlay.java
b8fb8d27679945237ea4b5a79d3c3343ba7bd6f1
[]
no_license
Mandrenkov/Geoscape
d8e303d2e6aa56ac4d4b3fe6218ae62e0c246eac
1647a0822b117316ef6e23c5b6ba00e1667bf603
refs/heads/master
2018-10-10T00:04:08.587805
2018-07-04T04:05:51
2018-07-04T04:05:51
79,867,817
2
0
null
null
null
null
UTF-8
Java
false
false
2,058
java
package env; import static org.lwjgl.opengl.GL11.*; import geo.Quad; import geo.Vertex; /** * The Overlay class represents a 2D screen overlay. */ public class Overlay implements Drawable { // Public members // ------------------------------------------------------------------------- /** * Constructs a new Overlay with the given Colour. * * @param colour The Colour of this Overlay. */ public Overlay(Colour colour) { this.colour = colour; } /** * Draws this Overlay. */ public void draw() { // Save and reset the states of the OpenGL modelview and projecton matrices. glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); // Apply a simple orthogonal projection to the OpenGL projection matrix. glOrtho(0, 1, 1, 0, -1, 1); // Switch the current matrix to the OpenGL modelview matrix. glMatrixMode(GL_MODELVIEW); // Draw a Quad that fills the entire screen with the colour of this Overlay. Quad quad = new Quad( new Vertex(0, 0, 0, this.colour), new Vertex(0, 1, 0, this.colour), new Vertex(1, 1, 0, this.colour), new Vertex(1, 0, 0, this.colour) ); quad.draw(); // Restore the states of the OpenGL projection and modelview matrices. glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); } /** * Returns the number of Polygons in this Overlay. * * @return The number of Polygons in this Overlay. */ public int polygons() { // The only polygon is the Quad that stretches across the screen. return 1; } // Private members // ------------------------------------------------------------------------- private Colour colour; }
[ "M.Andrenkov@gmail.com" ]
M.Andrenkov@gmail.com
d1d5475c39b5a75e261071b2080b7fe16cb59f06
c9a90fc323b1fb673cc25bfc74421767072cf8fd
/compiler/src/test/java/android/databinding/tool/reflection/SdkVersionTest.java
8c9114d5cc0ab5a7d36db017c12b2b74572e61a6
[]
no_license
DragonTotem/BindingSample
29dcb255a43c79ceba6b63e413f7dc6ed412341a
0e34d7a4c530804f9fb3aff33aa2d45630425606
refs/heads/master
2023-08-07T14:57:23.739000
2021-07-13T13:43:36
2021-07-13T13:43:36
381,400,939
2
0
null
null
null
null
UTF-8
Java
false
false
2,297
java
/* * Copyright (C) 2015 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 android.databinding.tool.reflection; import org.junit.Before; import org.junit.Test; import android.databinding.tool.reflection.java.JavaAnalyzer; import static org.junit.Assert.assertEquals; public class SdkVersionTest { @Before public void setUp() throws Exception { JavaAnalyzer.initForTests(); } @Test public void testApiVersionsFromResources() { SdkUtil.get().swapApiChecker(new SdkUtil.ApiChecker(null)); ModelClass view = ModelAnalyzer.getInstance().findClass("android.widget.TextView", null); ModelMethod isSuggestionsEnabled = view.getMethods("isSuggestionsEnabled", 0).get(0); assertEquals(14, SdkUtil.get().getMinApi(isSuggestionsEnabled)); } @Test public void testNewApiMethod() { ModelClass view = ModelAnalyzer.getInstance().findClass("android.view.View", null); ModelMethod setElevation = view.getMethods("setElevation", 1).get(0); assertEquals(21, SdkUtil.get().getMinApi(setElevation)); } @Test public void testCustomCode() { ModelClass view = ModelAnalyzer.getInstance() .findClass("android.databinding.tool.reflection.SdkVersionTest", null); ModelMethod setElevation = view.getMethods("testCustomCode", 0).get(0); assertEquals(1, SdkUtil.get().getMinApi(setElevation)); } @Test public void testSetForeground() { ModelClass view = ModelAnalyzer.getInstance() .findClass("android.widget.FrameLayout", null); ModelMethod setForeground = view.getMethods("setForegroundGravity", 1).get(0); assertEquals(1, SdkUtil.get().getMinApi(setForeground)); } }
[ "zbt_dragon@163.com" ]
zbt_dragon@163.com
d39511fc49ca13bb50ddb4a323d889c38ced124b
e587bdf8aa6e2f65566b630547c227933bb6b175
/client/src/messenger/controllers/DeleteChatController.java
62bd9961f5f808addaddb7568e77275753b70057
[]
no_license
memew1se/JavaMessenger
747ee6e7cac9818b2f306c0b8d997951e1f35b2b
a2b277dd0e60e35e716f16ad992ef52edecc409c
refs/heads/master
2023-04-26T07:38:18.010777
2021-05-04T21:35:54
2021-05-04T21:35:54
357,661,930
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package messenger.controllers; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.TextField; public class DeleteChatController extends BaseController { @FXML private TextField nicknameTextField; @FXML private Button deleteChatButton; @FXML public void deleteChatButtonHandler() { return; } }
[ "gogomecourier@gmail.com" ]
gogomecourier@gmail.com
bf6f992b292729c7554d832a4d2db56ecba1a53c
f71be0ba4ff19fa563f0f257451e5ecff138dddf
/jackknife-ioc/src/main/java/com/lwh/jackknife/ioc/inject/InjectAdapter.java
69060ce465bca544efb69626ba8f072842c13abc
[ "Apache-2.0" ]
permissive
JinHT1218/jackknife
030163ff42c5458288bb32d96ad4fa25b831ef87
e5e1bc5131b2476fc0165523dd8f80919a4af814
refs/heads/master
2020-04-07T11:28:26.684775
2018-11-18T12:50:26
2018-11-18T12:50:26
158,327,730
1
0
Apache-2.0
2018-11-20T03:49:52
2018-11-20T03:49:52
null
UTF-8
Java
false
false
1,273
java
/* * Copyright (C) 2018 The JackKnife 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.lwh.jackknife.ioc.inject; import com.lwh.jackknife.ioc.SupportV; import com.lwh.jackknife.ioc.bind.BindEvent; import com.lwh.jackknife.ioc.bind.BindLayout; import com.lwh.jackknife.ioc.bind.BindView; /** * The default implementation to decrease code. */ public abstract class InjectAdapter implements InjectHandler { @Override public String generateLayoutName(SupportV v) { return null; } @Override public void performInject(BindLayout bindLayout) { } @Override public void performInject(BindView bindView) { } @Override public void performInject(BindEvent bindEvent) { } }
[ "924666990@qq.com" ]
924666990@qq.com
3a5c2d6958defa64d2f84711b7cad1ee67367c25
c8d842f2d05ad4970868939b4226c8e63385f603
/qf/web/coursework/mvc/src/main/java/org/tud/zyao/service/impl/UserServiceImpl.java
9e548cc972098965ad76eae187b8d1eb9514e5ce
[]
no_license
ZhYao2015/2019summer
6cee8bfa2a9fd702fa4f7003e8fc6c0c3415c817
5c04a5acf6297aae6b23c71dfefa175c485d45f6
refs/heads/master
2022-06-26T22:52:47.402740
2019-08-07T01:58:17
2019-08-07T01:58:17
190,873,163
0
0
null
2022-06-17T02:22:50
2019-06-08T10:09:47
JavaScript
UTF-8
Java
false
false
860
java
package org.tud.zyao.service.impl; import java.util.List; import org.tud.zyao.dao.UserDao; import org.tud.zyao.dao.impl.UserDaoImpl; import org.tud.zyao.domain.User; import org.tud.zyao.service.UserService; public class UserServiceImpl implements UserService{ private UserDao userDao=new UserDaoImpl(); @Override public List<User> findAll() { // TODO Auto-generated method stub return userDao.findAll(); } @Override public User findId(int id) { // TODO Auto-generated method stub return userDao.findId(id); } @Override public void add(User user) { // TODO Auto-generated method stub userDao.add(user); } @Override public void update(User user) { // TODO Auto-generated method stub userDao.update(user); } @Override public void delete(int userId) { // TODO Auto-generated method stub userDao.delete(userId); } }
[ "l_coder@sina.cn" ]
l_coder@sina.cn
8af59c9936e31f57ef9b9a9da72cecc70568e653
43334ae5400646e072ce2c217cb6b647d9c50734
/src/main/java/org/drip/sample/fundinghistorical/CZKShapePreserving1YStart.java
bbc3482cb3d6378fad27d8e8419473fc109fe688
[ "Apache-2.0" ]
permissive
BukhariH/DROP
0e2f70ff441f082a88c7f26a840585fb593665fb
8770f84c747c41ed2022155fee1e6f63bb09f6fa
refs/heads/master
2020-03-30T06:27:29.042934
2018-09-29T06:13:19
2018-09-29T06:13:19
150,862,864
1
0
Apache-2.0
2018-09-29T12:37:29
2018-09-29T12:37:28
null
UTF-8
Java
false
false
7,135
java
package org.drip.sample.fundinghistorical; import java.util.Map; import org.drip.analytics.date.JulianDate; import org.drip.feed.loader.*; import org.drip.historical.state.FundingCurveMetrics; import org.drip.quant.common.FormatUtil; import org.drip.service.env.EnvManager; import org.drip.service.state.FundingCurveAPI; import org.drip.service.template.LatentMarketStateBuilder; /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! * Copyright (C) 2018 Lakshmi Krishnamurthy * Copyright (C) 2017 Lakshmi Krishnamurthy * Copyright (C) 2016 Lakshmi Krishnamurthy * * This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model * libraries targeting analysts and developers * https://lakshmidrip.github.io/DRIP/ * * DRIP is composed of four main libraries: * * - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ * - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ * - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ * - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ * * - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, * Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA * Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV * Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM * Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. * * - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy * Incorporator, Holdings Constraint, and Transaction Costs. * * - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. * * - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. * * 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. */ /** * CZKShapePreserving1YStart Generates the Historical CZK Shape Preserving Funding Curve Native Compounded * Forward Rate starting at 1Y Tenor. * * @author Lakshmi Krishnamurthy */ public class CZKShapePreserving1YStart { public static final void main ( final String[] astrArgs) throws Exception { EnvManager.InitEnv (""); String strCurrency = "CZK"; String strClosesLocation = "C:\\DRIP\\CreditAnalytics\\Daemons\\Transforms\\FundingStateMarks\\" + strCurrency + "ShapePreservingReconstitutor.csv"; String[] astrInTenor = new String[] { "1Y" }; String[] astrForTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", }; String[] astrFixFloatMaturityTenor = new String[] { "1Y", "2Y", "3Y", "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" }; CSVGrid csvGrid = CSVParser.StringGrid ( strClosesLocation, true ); JulianDate[] adtClose = csvGrid.dateArrayAtColumn (0); double[] adblFixFloatQuote1Y = csvGrid.doubleArrayAtColumn (1); double[] adblFixFloatQuote2Y = csvGrid.doubleArrayAtColumn (2); double[] adblFixFloatQuote3Y = csvGrid.doubleArrayAtColumn (3); double[] adblFixFloatQuote4Y = csvGrid.doubleArrayAtColumn (4); double[] adblFixFloatQuote5Y = csvGrid.doubleArrayAtColumn (5); double[] adblFixFloatQuote6Y = csvGrid.doubleArrayAtColumn (6); double[] adblFixFloatQuote7Y = csvGrid.doubleArrayAtColumn (7); double[] adblFixFloatQuote8Y = csvGrid.doubleArrayAtColumn (8); double[] adblFixFloatQuote9Y = csvGrid.doubleArrayAtColumn (9); double[] adblFixFloatQuote10Y = csvGrid.doubleArrayAtColumn (10); double[] adblFixFloatQuote11Y = csvGrid.doubleArrayAtColumn (11); double[] adblFixFloatQuote12Y = csvGrid.doubleArrayAtColumn (12); double[] adblFixFloatQuote15Y = csvGrid.doubleArrayAtColumn (13); double[] adblFixFloatQuote20Y = csvGrid.doubleArrayAtColumn (14); double[] adblFixFloatQuote25Y = csvGrid.doubleArrayAtColumn (15); double[] adblFixFloatQuote30Y = csvGrid.doubleArrayAtColumn (16); double[] adblFixFloatQuote40Y = csvGrid.doubleArrayAtColumn (17); double[] adblFixFloatQuote50Y = csvGrid.doubleArrayAtColumn (18); int iNumClose = adtClose.length; JulianDate[] adtSpot = new JulianDate[iNumClose]; double[][] aadblFixFloatQuote = new double[iNumClose][18]; for (int i = 0; i < iNumClose; ++i) { adtSpot[i] = adtClose[i]; aadblFixFloatQuote[i][0] = adblFixFloatQuote1Y[i]; aadblFixFloatQuote[i][1] = adblFixFloatQuote2Y[i]; aadblFixFloatQuote[i][2] = adblFixFloatQuote3Y[i]; aadblFixFloatQuote[i][3] = adblFixFloatQuote4Y[i]; aadblFixFloatQuote[i][4] = adblFixFloatQuote5Y[i]; aadblFixFloatQuote[i][5] = adblFixFloatQuote6Y[i]; aadblFixFloatQuote[i][6] = adblFixFloatQuote7Y[i]; aadblFixFloatQuote[i][7] = adblFixFloatQuote8Y[i]; aadblFixFloatQuote[i][8] = adblFixFloatQuote9Y[i]; aadblFixFloatQuote[i][9] = adblFixFloatQuote10Y[i]; aadblFixFloatQuote[i][10] = adblFixFloatQuote11Y[i]; aadblFixFloatQuote[i][11] = adblFixFloatQuote12Y[i]; aadblFixFloatQuote[i][12] = adblFixFloatQuote15Y[i]; aadblFixFloatQuote[i][13] = adblFixFloatQuote20Y[i]; aadblFixFloatQuote[i][14] = adblFixFloatQuote25Y[i]; aadblFixFloatQuote[i][15] = adblFixFloatQuote30Y[i]; aadblFixFloatQuote[i][16] = adblFixFloatQuote40Y[i]; aadblFixFloatQuote[i][17] = adblFixFloatQuote50Y[i]; } String strDump = "Date"; for (String strInTenor : astrInTenor) { for (String strForTenor : astrForTenor) strDump += "," + strInTenor + strForTenor; } System.out.println (strDump); Map<JulianDate, FundingCurveMetrics> mapFCM = FundingCurveAPI.HorizonMetrics ( adtSpot, astrFixFloatMaturityTenor, aadblFixFloatQuote, astrInTenor, astrForTenor, strCurrency, LatentMarketStateBuilder.SHAPE_PRESERVING ); for (int i = 0; i < iNumClose; ++i) { FundingCurveMetrics fcm = mapFCM.get (adtSpot[i]); strDump = adtSpot[i].toString(); for (String strInTenor : astrInTenor) { for (String strForTenor : astrForTenor) { try { strDump += "," + FormatUtil.FormatDouble ( fcm.nativeForwardRate ( strInTenor, strForTenor ), 1, 5, 100. ); } catch (Exception e) { } } } System.out.println (strDump); } } }
[ "lakshmi7977@gmail.com" ]
lakshmi7977@gmail.com
d0b7e90d22fcb5ceab8e9e7f76f128c1fbcbecf2
e2ff1453cf0ff014f4df1c66da42f346b5f3fc35
/src/main/java/org/gandhim/pso/PSODriver.java
b34cb6c8db800a5d6ac6c04a6a1ff30f72b6c687
[]
no_license
rubenqba/pso-example-java
d7a28d38b6c1beaa6549c582d7742d8b7727a377
fb3df9aa8753b658e1343dd9f96cfae388a4cbc6
refs/heads/master
2021-01-17T19:22:49.967259
2016-09-08T03:25:28
2016-09-08T03:25:28
67,656,716
0
0
null
2017-02-08T21:21:24
2016-09-08T01:23:41
Java
UTF-8
Java
false
false
331
java
package org.gandhim.pso; /* author: gandhi - gandhi.mtm [at] gmail [dot] com - Depok, Indonesia */ // this is a driver class to execute the PSO process public class PSODriver { public static void main(String args[]) { try { new PSOProcess().execute(); } catch (InterruptedException e) { e.printStackTrace(); } } }
[ "ruben1981@gmail.com" ]
ruben1981@gmail.com
d5ed5e854abf3bc105bb9c47e8ece8ca0ceb88ef
10c5fa5371d62526b2f6d1283af299e9c9e1951c
/src/main/java/at/srfg/indexing/model/common/IClassType.java
ad5d26d18d496c7dfed04043d38012717db09b04
[]
no_license
i-Asset/solr-model
42f1a3fc299f1613edd081a47383b9f2c94e0754
016d1c983fc0934cb68ec5cfc9ec8f3133bde0a6
refs/heads/master
2022-04-28T06:06:01.569564
2020-03-31T12:29:21
2020-03-31T12:29:21
249,653,527
0
0
null
2022-03-31T19:04:35
2020-03-24T08:33:36
Java
UTF-8
Java
false
false
914
java
package at.srfg.indexing.model.common; /** * * @author dglachs * */ public interface IClassType extends IConcept { /** * Name of the index collection */ String COLLECTION = "concept_class"; String TYPE_FIELD = "doctype"; String TYPE_VALUE = "class"; String PROPERTIES_FIELD = "properties"; /** * Holds the identifier of all direct * parents. E.g. reflects an "is a" * relationship. */ String PARENTS_FIELD = "parents"; /** * Holds the identifier of all * parents at any upper level. */ String ALL_PARENTS_FIELD = "allParents"; /** * Holds the identifier of all direct * children (only one level down) */ String CHILDREN_FIELD ="children"; /** * Holds the identifier of all children * at any level below the current. */ String ALL_CHILDREN_FIELD ="allChildren"; /** * Hierarchy level, zero or one * is the root level. */ String LEVEL_FIELD = "level"; }
[ "mathias.schmoigl@salzburgresearch.at" ]
mathias.schmoigl@salzburgresearch.at
cd2595702c80ca158949dbaae551bf45151ebe9b
5c8a3a1d1f81dd09b2d51aa1c7929ac88f9c86a8
/src/main/java/com/imocc/miaosha/result/Result.java
6dc130ea2e355aedb74bce3e9a4c906df79f35a3
[]
no_license
Dyson-x/miaosha
8c77bb45fd5d5734fb5684ec5f3d294d0c60f410
bd2837b98e81ec84ea5375b89f4d4612e8561bbb
refs/heads/master
2022-06-22T12:21:13.185947
2019-08-11T08:59:33
2019-08-11T08:59:33
200,467,715
0
0
null
null
null
null
UTF-8
Java
false
false
935
java
package com.imocc.miaosha.result; public class Result<T> { private int code; private String msg; private T data; /** * 成功时候的调用 * */ public static <T> Result<T> success(T data){ return new Result<T>(data); } /** * 失败时候的调用 * */ public static <T> Result<T> error(CodeMsg codeMsg){ return new Result<T>(codeMsg); } private Result(T data) { this.data = data; } private Result(int code, String msg) { this.code = code; this.msg = msg; } private Result(CodeMsg codeMsg) { if(codeMsg != null) { this.code = codeMsg.getCode(); this.msg = codeMsg.getMsg(); } } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getData() { return data; } public void setData(T data) { this.data = data; } }
[ "15229907309@sina.cn" ]
15229907309@sina.cn
490d2ba4e6bec7af3cc0d413a571fb582debe634
4c9d35da30abf3ec157e6bad03637ebea626da3f
/eclipse/src/org/ripple/power/server/chat/ChatMessage.java
3bfb169f3908b376c413eb39045b710b39507b7c
[ "Apache-2.0" ]
permissive
youweixue/RipplePower
9e6029b94a057e7109db5b0df3b9fd89c302f743
61c0422fa50c79533e9d6486386a517565cd46d2
refs/heads/master
2020-04-06T04:40:53.955070
2015-04-02T12:22:30
2015-04-02T12:22:30
33,860,735
0
0
null
2015-04-13T09:52:14
2015-04-13T09:52:11
null
UTF-8
Java
false
false
957
java
package org.ripple.power.server.chat; public class ChatMessage extends AMessage { private String msg; private short type; private String username; private String toUser; public ChatMessage() { super(); } public ChatMessage(short type, String msg, String username,String toUser) { super(); this.msg = msg; this.type = type; this.username = username; this.toUser = toUser; } @Override public short getMessageType() { return MessageType.CS_CHAT; } @Override public void readImpl() { this.type = readShort(); this.msg = readString(); this.username = readString(); this.toUser = readString(); } @Override public void writeImpl() { writeShort(type); writeString(msg); writeString(username); writeString(toUser); } public String getMsg() { return msg; } public short getType() { return type; } public String getUsername() { return username; } public String getToUser() { return toUser; } }
[ "longwind2012@hotmail.com" ]
longwind2012@hotmail.com
40f6b97663fca67a3026f55d4e69a63b4c53d451
f5cc4041a110fd30113d2100fabe70370313edbc
/src/cn/org/bjca/zk/platform/web/page/DepartmentPage.java
7976ae74ef59afc1b45cc364f629d10fd814185f
[]
no_license
redleaf106/zk-web
8ebc96dd1e61d713f2b117202ab8673194175c6c
ee17bf07b09fd770345890f8a725d07748ca7825
refs/heads/master
2021-06-27T06:43:15.857192
2020-01-14T06:00:15
2020-01-14T06:00:15
226,049,807
1
0
null
null
null
null
UTF-8
Java
false
false
930
java
/** * */ package cn.org.bjca.zk.platform.web.page; import com.cn.bjca.seal.esspdf.core.pagination.annotation.Paging; /*************************************************************************** * @文件名称: DepartmentPage.java * @包 路 径: cn.org.bjca.zk.platform.web.page * @版权所有:北京数字认证股份有限公司 (C) 2019 * * @类描述: * @版本: V2.0 * @创建人: gaozhijiang * @创建时间:2019年11月27日 ***************************************************************************/ @Paging(field = "pageVO") public class DepartmentPage <T> extends BasePage<T> { private static final long serialVersionUID = -6183879852924320372L; /** * 部门名称 */ private String departmentName; public String getDepartmentName() { return departmentName; } public void setDepartmentName(String departmentName) { this.departmentName = departmentName; } }
[ "10615135@qq.com" ]
10615135@qq.com
ab984e75b8ca29274f38cd890d95fa3b29e6ac87
05d241b44b60e666d4f732a265973d2308a82ca1
/src/main/java/org/jabosu/common/dao/cassandra/dao/AbstractDao.java
89c1e8250ac87fe31efed0412bd6a10fca2c9e1b
[]
no_license
satran004/jabosu-common
49d56a2c2d6979fe96cb121fc59ac70cb4e0aa2c
c95f85ee71502bc2ba596b181e71da40f725249e
refs/heads/master
2021-01-24T12:11:53.185987
2018-02-27T11:56:18
2018-02-27T11:56:18
123,122,252
0
0
null
null
null
null
UTF-8
Java
false
false
2,338
java
package org.jabosu.common.dao.cassandra.dao; import org.jabosu.common.dao.cassandra.dao.IDGenerator; import org.slf4j.LoggerFactory; /** * * @author satya */ public abstract class AbstractDao { private static org.slf4j.Logger logger = LoggerFactory.getLogger(AbstractDao.class.getName()); protected boolean updateBucketProps = false; public AbstractDao() { //update bucket property } // public abstract String getBucketName(); protected int dw() { return 0; } protected int w() { return 2; } protected int r() { return 2; } // protected boolean allowSibling() { // return false; // } // // protected ConflictResolver getConflictResolver() { // return null; // } // protected MutationProducer getMutationProducer() { // return null; // } // // protected Converter getConverter(String bucketName) { // return null; // } protected IDGenerator getIDGenerator() {return null;} // public Bucket getBucket(IRiakClient client, String bucketName) // throws DataAccessException { // // try { // Bucket bucket = client.fetchBucket(bucketName).execute(); // // if (bucket == null || !updateBucketProps) { // bucket = client.createBucket(bucketName) // .allowSiblings(allowSibling()) // .withRetrier(new DefaultRetrier(4)) // .r(r()) // .w(w()) // .dw(dw()) // .execute(); // // updateBucketProps = true; // } // // return bucket; // } catch (Exception e) { // throw new DataAccessException(e); // } // } // protected String getCountryBucketName(String countryCode) { // // if (countryCode == null) { // return getBucketName(); // } else { // return countryCode + "_" + getBucketName(); // } // } // protected IRiakClient getConnection() throws DataAccessException { // return RiakConnectionFactory.getInstance().getConnection(); // } // // protected void returnConnection(IRiakClient client) { // RiakConnectionFactory.getInstance().returnConnection(client); // } }
[ "tanay123" ]
tanay123
6543bd070832aa10c9dc9fbe3f71983e9b8abb94
335512eb4f78285d1221d5d17b92304be763d5cb
/src/edu/gestionpfe/controllers/StageController/AjoutertacheController.java
cc1976f751215af3bd4cbabd9277f9f99975a2d2
[]
no_license
Ouertani-Melek/GestionPfeJava
ce8e38efa1eed0b4ac1abcc9b6a3cca4c2164449
2db520492ddaf48639a073e21f2d909d7bb5bc9a
refs/heads/master
2021-02-16T16:57:02.812768
2018-04-11T10:22:30
2018-04-11T10:22:30
245,026,271
0
0
null
null
null
null
UTF-8
Java
false
false
4,840
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 edu.gestionpfe.controllers.StageController; import edu.gestionpfe.models.Tache; import edu.gestionpfe.services.TachesServices; import static edu.gestionpfe.services.TachesServices.idSt; import static edu.gestionpfe.controllers.StageController.ListstagesEncadrantController.ids; import static edu.gestionpfe.controllers.StageController.ListstagesEncadrantController.m; import java.io.File; import java.net.URL; import java.util.Optional; import java.util.Properties; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar; import javafx.scene.control.ButtonType; import javafx.scene.control.TextField; import javafx.scene.effect.Reflection; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** * FXML Controller class * * @author user */ public class AjoutertacheController implements Initializable { @FXML private TextField tache; @FXML private Button ajoutertache; private Alert add; private Alert problem; private ButtonType OK; private ButtonType Terminer; @FXML private Text tit; /** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { tit.setCache(true); tit.setFill(Color.RED); tit.setFont(Font.font("Serif", FontWeight.BOLD, 28)); Reflection r = new Reflection(); r.setFraction(0.7f); tit.setEffect(r); add= new Alert(Alert.AlertType.INFORMATION); add.setTitle("gestionPFE care"); add.setHeaderText("Ajout d'une Tache"); add.setContentText("-----Vous avez Ajouté une nouvelle Tache!------"); add.getButtonTypes().clear();// annuler button oui et non Terminer = new ButtonType("Terminer",ButtonBar.ButtonData.OK_DONE); add.getButtonTypes().addAll(Terminer); problem= new Alert(Alert.AlertType.ERROR); problem.setTitle("gestionPFE care"); problem.setHeaderText("Ajout d'une Tache"); problem.setContentText("-----Votre tache n'est pas valide!------"); problem.getButtonTypes().clear();// annuler button oui et non OK = new ButtonType("D'accord",ButtonBar.ButtonData.OK_DONE); problem.getButtonTypes().addAll(OK); } @FXML private void ajouterTaches(ActionEvent event) { TachesServices tach = new TachesServices(); Tache t =new Tache(ids,tache.getText(),false); if (!tache.getText().equalsIgnoreCase("") && !(tache.getText().startsWith(" "))) { tach.inserttache(t); Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { @Override public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("educarepfe@gmail.com","afk123456789"); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("educarepfe@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(m)); message.setSubject("GESTIONPFE tache"); message.setText("Vous avez une nouvelle tache : "+tache.getText()+"\n Cordialement,l'équipe AFK \n Année Scolaire 2017/2018 \n Esprit Ghazela"); Transport.send(message); } catch (MessagingException e) { throw new RuntimeException(e); } Optional<ButtonType> result= add.showAndWait(); } else { Optional<ButtonType> result= problem.showAndWait(); } } }
[ "nadhem.hagui@esprit.tn" ]
nadhem.hagui@esprit.tn
55eb535729913e7edfdad086a3848e05b0eea8c2
558e8c4a3e7673a8f5776622bc142681f2d07791
/src/com/ht/calltree/sys/dao/UserExtendMapper.java
da6933e0c6b96921779b0850fe43bd6973726d90
[]
no_license
abuzuiguai/test
66c610341ca00de3eed09fddf8cda64c0d330c02
368301c439d2e4443ec2f09eae835f1c10febca6
refs/heads/master
2021-01-23T20:12:53.838609
2015-08-17T09:22:08
2015-08-17T09:22:08
40,880,191
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
package com.ht.calltree.sys.dao; import com.ht.calltree.sys.model.UserExtend; public interface UserExtendMapper { int deleteByPrimaryKey(String staffId); int insert(UserExtend record); UserExtend selectByPrimaryKey(String staffId); int updateByPrimaryKey(UserExtend record); }
[ "34883107@qq.com" ]
34883107@qq.com
f2a04fa78ef8affeebfb99e161b135b1d79d43c8
f1579012bca9f00536c86ef0977cb8bca819cf46
/app/src/main/java/com/genius/memecreator/appUtils/DialogsViewManager.java
9efc7e009da4615d8910af9f23dd5c22f87a9626
[]
no_license
itsgeniuS/MemeCreator
d2092905b843b1a8216727da66c2cd9199d80077
e2fab0e99ab6a05ef00274fb7ff0e13befa143ca
refs/heads/master
2021-10-07T09:20:37.937018
2018-12-04T14:01:54
2018-12-04T14:01:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,215
java
package com.genius.memecreator.appUtils; import android.content.Context; import android.graphics.Typeface; import android.support.v7.widget.AppCompatButton; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.SeekBar; import android.widget.TextView; import com.genius.memecreator.R; public class DialogsViewManager { private Context context; private String viewName, viewId; private int textSize; private View view; private LayoutInflater layoutInflater; private DialogManagerListener dialogManagerListener; public DialogsViewManager(Context context, DialogManagerListener dialogManagerListener) { this.context = context; layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.dialogManagerListener = dialogManagerListener; } public View getViewForInput(int viewId) { switch (viewId) { case 0: view = viewForTextInput(); break; case 1: view = viewForFontSize(); break; } return view; } private View viewForFontSize() { View fontView = layoutInflater.inflate(R.layout.font_size_view, null); final TextView textView = fontView.findViewById(R.id.font_size_sample_text); SeekBar seekBar = fontView.findViewById(R.id.font_size_seek_bar); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { textSize = progress; textView.setTextSize(progress); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { textView.setTextSize(textSize); dialogManagerListener.onTextSizeChanged(textSize); } }); return fontView; } private View viewForTextInput() { View textInputView = layoutInflater.inflate(R.layout.text_dialog_input_layout, null); final EditText topEd = textInputView.findViewById(R.id.top_text_ed); final EditText bottomEd = textInputView.findViewById(R.id.bottom_text_ed); AppCompatButton okBtn = textInputView.findViewById(R.id.ok_btn); okBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogManagerListener.onTextReceived(topEd.getText().toString().trim(), bottomEd.getText().toString().trim()); } }); return textInputView; } public interface DialogManagerListener { void onTextReceived(String topText, String bottomText); void onTextSizeChanged(int textSize); void onFontChanged(Typeface chosenFont); void onAlignmentChanged(String alignment); void onStylesChanged(String style); void onTypoChanged(String typo); void onTextColorChanged(int textColor, int textBorderColor); } }
[ "geniuSkid03@users.noreply.github.com" ]
geniuSkid03@users.noreply.github.com
8d0a68d4a3db5846eae1ced69f609687ce802db7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/28/28_ea751b81abed396099e0beee9e5ca59b967df38a/MixtureModel/28_ea751b81abed396099e0beee9e5ca59b967df38a_MixtureModel_t.java
a4e9489ea85a5095ecfc12f5faf0a422295b27fb
[]
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
7,266
java
package core.evolution; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Random; public class MixtureModel { ///stop condition public double Eps = 0.01; ///max iterate number public int MaxIteration = 1000; //background distribution weight public double Lamda = 0.95; //how many themes public int K = 10; //theme weight for every document (number of article) * (k theme) public double pi[][]; //word distribution for themes (number of words) * (k theme) public double phi[][]; //all the words and TF of articles private List<Map<String,Integer>> Words = new ArrayList<Map<String,Integer>>(); private Map<String,Integer> Background = new LinkedHashMap<String,Integer>(); private List<String> WordsIdMap = new ArrayList<String>(); private Map<String,Integer> IdWordsMap = new HashMap<String,Integer>(); private long TotalWordNum; public MixtureModel(){ } ///constructor public MixtureModel(int k, double lamda){ this.K = k; this.Lamda = lamda; } ///constructor public MixtureModel(int k, double lamda,int maxIteration,double eps){ this.K = k; this.Lamda = lamda; this.MaxIteration = maxIteration; this.Eps = eps; } ///initialize the words map from a file private void initWords(String in){ BufferedReader br; try { br = new BufferedReader(new FileReader(in)); String line = ""; while((line = br.readLine()) != null){ Map<String,Integer> articleWords = new HashMap<String,Integer>(); String[] its = line.split("\t"); String[] words = its[3].split(" "); for(String wd : words){ if(wd.length() == 0) continue; if(Background.containsKey(wd)){ Background.put(wd, Background.get(wd) + 1); }else{ Background.put(wd, 1); IdWordsMap.put(wd, WordsIdMap.size()); WordsIdMap.add(wd); } if(articleWords.containsKey(wd)){ articleWords.put(wd, articleWords.get(wd) + 1); }else{ articleWords.put(wd, 1); } TotalWordNum++; } Words.add(articleWords); } br.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } //initialize some random value to arguments private void initPara(){ Random rd = new Random(new Date().getTime()); /// 0 stands for background pi = new double[Words.size()][K + 1]; phi = new double[Background.size() + 1][K + 1]; ///init of pi for(int i = 0 ;i < Words.size();i++){ double total_pi = 0; for(int j = 0 ;j<=K;j++){ pi[i][j] = rd.nextDouble(); total_pi+= pi[i][j]; } for(int j = 0 ;j<=K;j++){ pi[i][j] = pi[i][j] / total_pi; } } ///init of phi for(int i = 0 ;i < Background.size();i++){ double total_phi = 0; for(int j = 0 ;j<= K ;j++){ if(j == 0){ phi[i][j] = Background.get(WordsIdMap.get(i)) / (double)TotalWordNum; }else{ phi[i][j] = rd.nextDouble(); } total_phi+= phi[i][j]; } for(int j = 0 ;j<= K;j++){ phi[i][j] = phi[i][j] / total_phi; } } } private void init(){ initWords("D:\\ETT\\tianyi"); initPara(); } private void updatePara(){ ////update the p(z_dw = j) and p(z_dw = B) List<Map<String,List<Double>>> p_dw_t = new ArrayList<Map<String,List<Double>>>(); for(int i = 0 ;i < Words.size(); i++){ Map<String,List<Double>> dw_t = new HashMap<String,List<Double>>(); Map<String,Integer> wds = Words.get(i); Iterator<String> it_wds = wds.keySet().iterator(); while(it_wds.hasNext()){ String wd = it_wds.next(); List<Double> ts = new ArrayList<Double>(); double t_t = 0.0; double[] tmp_ts =new double[K+1]; for(int t = 0 ; t<= K ; t++){ //for background if(t == 0){ double up = Lamda * Background.get(wd) / TotalWordNum; double tmp_down = 0.0; for(int tt = 1 ; tt<= K ;tt ++){ tmp_down += pi[i][tt] * phi[IdWordsMap.get(wd)][tt]; } double down = up + (1-Lamda) * tmp_down; ts.add(up / down); }else{ double up = pi[i][t] * phi[IdWordsMap.get(wd)][t]; t_t += up; tmp_ts[t] = up; } } for(int t = 1 ;t <= K ;t++){ ts.add(tmp_ts[t] / t_t); } dw_t.put(wd, ts); } p_dw_t.add(dw_t); } ///update pi for(int i = 0 ; i< Words.size() ; i++){ Map<String,Integer> wds = Words.get(i); double[] tmp_pis = new double[K + 1]; double total_pis = 0.0; for(int t = 1 ; t <= K ;t ++){ double t_j = 0.0; Iterator<String> it_wds = wds.keySet().iterator(); while(it_wds.hasNext()){ String word = it_wds.next(); int count = wds.get(word); t_j += count * p_dw_t.get(i).get(word).get(t); } tmp_pis[t] = t_j; total_pis += t_j; } for(int t = 1 ;t <= K ;t++){ pi[i][t] = tmp_pis[t] / total_pis; } } ///update phi double[] tmp_pws = new double[K + 1]; for(int i = 1 ;i<= K ;i++){ for(int a = 0 ; a < Words.size(); a++){ Map<String,Integer> wds = Words.get(a); Iterator<String> it_wds = wds.keySet().iterator(); while(it_wds.hasNext()){ String word = it_wds.next(); tmp_pws[i] += wds.get(word) * (1 - p_dw_t.get(a).get(word).get(0)) * p_dw_t.get(a).get(word).get(i); } } } for(int i = 0 ; i< WordsIdMap.size(); i++){ String word = WordsIdMap.get(i); for(int t = 1 ; t<= K ;t++){ double tmp_s = 0.0; for(int j = 0 ; j< Words.size();j++){ if(Words.get(j).containsKey(word)){ tmp_s += Words.get(j).get(word) * (1- p_dw_t.get(j).get(word).get(0)) *p_dw_t.get(j).get(word).get(t); } } phi[i][t] = tmp_s / tmp_pws[t]; if(phi[i][t] == 0){ } } } } private void printTopWords(int N){ //sort double[][] keys = new double[K + 1][ N ]; int[][] vals = new int[K+1][N]; for(int t = 0 ; t<= K;t++){ for(int j = 0 ; j < N ;j++){ double max = -1; int index = 0; for(int i = 0 ; i< WordsIdMap.size(); i++){ if(phi[i][t] > max && j != 0 && phi[i][t] < keys[t][j - 1]){ max = phi[i][t]; index = i; }else if(j == 0){ if(phi[i][t] > max){ max = phi[i][t]; index = i; } } } keys[t][j] = max; vals[t][j] = index; } } for(int t = 0 ; t<= K ;t++){ for(int i = 0 ; i< N ;i ++){ System.out.print(WordsIdMap.get(vals[t][i]) + "\t" + keys[t][i]+"\t"); } System.out.println(); } } public static void main(String[] args){ MixtureModel mm = new MixtureModel(); mm.init(); mm.printTopWords(20); System.out.println("init ok ... "); for(int i = 0 ; i< 2000;i++){ System.out.println("iteration... " + i); mm.updatePara(); mm.printTopWords(10); System.out.println("-------------------"); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
349d99bf7eba56bf45134c4d092ce51d666e81b0
2a317cd5006075eeb8e9b282de69734aa6e2daf8
/com.bodaboda_source_code/sources/com/google/android/gms/games/internal/JingleLog.java
94f9898989aaef3fef77695c0995bccc8d975200
[]
no_license
Akuku25/bodaapp
ee1ed22b0ad05c11aa8c8d4595f5b50da338fbe0
c4f54b5325d035b54d0288a402558aa1592a165f
refs/heads/master
2020-04-28T03:52:04.729338
2019-03-11T08:24:30
2019-03-11T08:24:30
174,954,616
0
0
null
null
null
null
UTF-8
Java
false
false
226
java
package com.google.android.gms.games.internal; import com.google.android.gms.common.internal.zzp; public final class JingleLog { private static final zzp zzUh = new zzp("GamesJingle"); private JingleLog() { } }
[ "wanyama19@gmail.com" ]
wanyama19@gmail.com
bb4c0ff2f3e3fc830e3aca726dcbdff782f31384
4345057e9946f51157c58c99b2021939b306a395
/javapos/src/zipcodeTobarcode.java
f301931e5b53e5bcc7d029307d90ffc6aeee5dba
[]
no_license
845968074/login-home
8df431ecc8753ce33dc5ce590f447a3843619683
a220b152c931fa22334682f94b12f52b3e962127
refs/heads/master
2021-01-12T01:34:55.560526
2017-01-14T09:44:19
2017-01-14T09:44:19
78,405,361
0
0
null
null
null
null
UTF-8
Java
false
false
652
java
import java.lang.*; class zipcodeTobarcode extends translatezipcodeTobarcode { public String buildStringBarcode(String zipcode) { // translatezipcodeTobarcode code = new translatezipcodeTobarcode(); boolean hascodes =checkeFormatZip(zipcode); if (hascodes == true) { String codes = getFormatZipcode(zipcode); String ziptobarcode =matchbyTable(codes); System.out.println(ziptobarcode); return ziptobarcode; } else return "false"; } /* public static void main(String[] args) { new zipcodeTobarcode().buildStringBarcode("12345"); }*/ }
[ "845968074@qq.com" ]
845968074@qq.com
7c8d1b547d65763baefce639751ceb73c5f0d515
73186ff7312b99977776757683f28adec9dc071c
/src/com/jimmysun/algorithms/chapter1_1/Ex16.java
35130abbf6b15c101234cee44b852b81252dc407
[]
no_license
jimmysuncpt/Algorithms
0ad8bf404481d7048d279f29eb625432bff62530
c3efb947ba883e7b62937c8106bb03b9539a364c
refs/heads/master
2022-08-07T22:08:00.369189
2022-05-27T08:21:10
2022-05-27T08:21:10
71,335,054
2,473
834
null
2022-06-04T07:37:11
2016-10-19T08:23:45
Java
UTF-8
Java
false
false
275
java
package com.jimmysun.algorithms.chapter1_1; public class Ex16 { public static String exR1(int n) { if (n <= 0) { return ""; } return exR1(n - 3) + n + exR1(n - 2) + n; } public static void main(String[] args) { System.out.println(exR1(6)); } }
[ "jimmysuncpt@gmail.com" ]
jimmysuncpt@gmail.com
36dc851e353f8a96b2eef7b3fdc51419df0be4af
4e9cc5d6eb8ec75e717404c7d65ab07e8f749c83
/sdk-hook/src/main/java/com/dingtalk/api/request/OapiCateringUnfreezeRequest.java
c770ab72773113cf991c742bfd958e8b0b89318e
[]
no_license
cvdnn/ZtoneNetwork
38878e5d21a17d6fe69a107cfc901d310418e230
2b985cc83eb56d690ec3b7964301aeb4fda7b817
refs/heads/master
2023-05-03T16:41:01.132198
2021-05-19T07:35:58
2021-05-19T07:35:58
92,125,735
0
1
null
null
null
null
UTF-8
Java
false
false
2,726
java
package com.dingtalk.api.request; import com.taobao.api.internal.util.RequestCheckUtils; import java.util.Map; import java.util.List; import com.taobao.api.ApiRuleException; import com.taobao.api.BaseTaobaoRequest; import com.dingtalk.api.DingTalkConstants; import com.taobao.api.Constants; import com.taobao.api.internal.util.TaobaoHashMap; import com.taobao.api.internal.util.TaobaoUtils; import com.dingtalk.api.response.OapiCateringUnfreezeResponse; /** * TOP DingTalk-API: dingtalk.oapi.catering.unfreeze request * * @author top auto create * @since 1.0, 2019.10.11 */ public class OapiCateringUnfreezeRequest extends BaseTaobaoRequest<OapiCateringUnfreezeResponse> { /** * 订单编号 */ private String orderId; /** * 餐补规则编码 */ private String ruleCode; /** * 点餐人userid */ private String userid; public void setOrderId(String orderId) { this.orderId = orderId; } public String getOrderId() { return this.orderId; } public void setRuleCode(String ruleCode) { this.ruleCode = ruleCode; } public String getRuleCode() { return this.ruleCode; } public void setUserid(String userid) { this.userid = userid; } public String getUserid() { return this.userid; } public String getApiMethodName() { return "dingtalk.oapi.catering.unfreeze"; } private String topResponseType = Constants.RESPONSE_TYPE_DINGTALK_OAPI; public String getTopResponseType() { return this.topResponseType; } public void setTopResponseType(String topResponseType) { this.topResponseType = topResponseType; } public String getTopApiCallType() { return DingTalkConstants.CALL_TYPE_OAPI; } private String topHttpMethod = DingTalkConstants.HTTP_METHOD_POST; public String getTopHttpMethod() { return this.topHttpMethod; } public void setTopHttpMethod(String topHttpMethod) { this.topHttpMethod = topHttpMethod; } public void setHttpMethod(String httpMethod) { this.setTopHttpMethod(httpMethod); } public Map<String, String> getTextParams() { TaobaoHashMap txtParams = new TaobaoHashMap(); txtParams.put("order_id", this.orderId); txtParams.put("rule_code", this.ruleCode); txtParams.put("userid", this.userid); if(this.udfParams != null) { txtParams.putAll(this.udfParams); } return txtParams; } public Class<OapiCateringUnfreezeResponse> getResponseClass() { return OapiCateringUnfreezeResponse.class; } public void check() throws ApiRuleException { RequestCheckUtils.checkNotEmpty(orderId, "orderId"); RequestCheckUtils.checkNotEmpty(ruleCode, "ruleCode"); RequestCheckUtils.checkNotEmpty(userid, "userid"); } }
[ "cvvdnn@gmail.com" ]
cvvdnn@gmail.com
0d65444dc13969efeed080cbf0f889101abe516e
76b4bd508ef0c5519824dd653a1d4e1261ff1dc7
/pushBackend/src/main/java/de/tum/mw/ftm/praktikum/smartinsightphd/pushBackend/RegistrationEndpoint.java
ecb448a26ca1973660f93a6a56e04897eac0ab67
[]
no_license
rebeccaForster/SmartInsightPHD
ca39564f8b048d924dd191fed2f71e7238036c7b
4e473364c7fc2c671d6fe56c47a17b9f2d6e4bf6
refs/heads/master
2021-01-10T05:04:06.803889
2016-01-24T15:07:11
2016-01-24T15:07:11
48,944,730
0
1
null
null
null
null
UTF-8
Java
false
false
3,224
java
/* For step-by-step instructions on connecting your Android application to this backend module, see "App Engine Backend with Google Cloud Messaging" template documentation at https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints */ package de.tum.mw.ftm.praktikum.smartinsightphd.pushBackend; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import com.google.api.server.spi.response.CollectionResponse; import java.util.List; import java.util.logging.Logger; import javax.inject.Named; import static de.tum.mw.ftm.praktikum.smartinsightphd.pushBackend.OfyService.ofy; /** * A registration endpoint class we are exposing for a device's GCM registration id on the backend * * For more information, see * https://developers.google.com/appengine/docs/java/endpoints/ * * NOTE: This endpoint does not use any form of authorization or * authentication! If this app is deployed, anyone can access this endpoint! If * you'd like to add authentication, take a look at the documentation. */ @Api( name = "registration", version = "v1", namespace = @ApiNamespace( ownerDomain = "pushBackend.smartinsightphd.praktikum.ftm.mw.tum.de", ownerName = "pushBackend.smartinsightphd.praktikum.ftm.mw.tum.de", packagePath="" ) ) public class RegistrationEndpoint { private static final Logger log = Logger.getLogger(RegistrationEndpoint.class.getName()); /** * Register a device to the backend * * @param regId The Google Cloud Messaging registration Id to add */ @ApiMethod(name = "register") public void registerDevice(@Named("regId") String regId) { if(findRecord(regId) != null) { log.info("Device " + regId + " already registered, skipping register"); return; } RegistrationRecord record = new RegistrationRecord(); record.setRegId(regId); ofy().save().entity(record).now(); } /** * Unregister a device from the backend * * @param regId The Google Cloud Messaging registration Id to remove */ @ApiMethod(name = "unregister") public void unregisterDevice(@Named("regId") String regId) { RegistrationRecord record = findRecord(regId); if(record == null) { log.info("Device " + regId + " not registered, skipping unregister"); return; } ofy().delete().entity(record).now(); } /** * Return a collection of registered devices * * @param count The number of devices to list * @return a list of Google Cloud Messaging registration Ids */ @ApiMethod(name = "listDevices") public CollectionResponse<RegistrationRecord> listDevices(@Named("count") int count) { List<RegistrationRecord> records = ofy().load().type(RegistrationRecord.class).limit(count).list(); return CollectionResponse.<RegistrationRecord>builder().setItems(records).build(); } private RegistrationRecord findRecord(String regId) { return ofy().load().type(RegistrationRecord.class).filter("regId", regId).first().now(); } }
[ "marc.engelmann.92@gmail.com" ]
marc.engelmann.92@gmail.com
1a574dcef53e78c20e8dfedc64c8723e9f81bcca
d3a28949b79c14be9dbcbfb869af8deaaa4f4624
/app/src/main/java/com/avmoga/dpixel/sprites/InfectingFistSprite.java
73d15dd6bdaf32f0902185e592fb79c42d94044a
[]
no_license
Kryptos03/DeisticPixelDungeon-AS
489995aae046b185c7e568dbf36e7564b8c1d8fd
df46b8ca4549f1df2dc983a0f88adfad65dd0fc8
refs/heads/master
2020-04-21T22:43:17.477236
2016-10-18T13:41:04
2016-10-18T13:41:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,686
java
/* * Pixel Dungeon * Copyright (C) 2012-2014 Oleg Dolya * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> */ package com.avmoga.dpixel.sprites; import com.avmoga.dpixel.Assets; import com.watabou.noosa.Camera; import com.watabou.noosa.TextureFilm; public class InfectingFistSprite extends MobSprite { private static final float FALL_SPEED = 64; public InfectingFistSprite() { super(); texture(Assets.INFECTING); TextureFilm frames = new TextureFilm(texture, 24, 17); idle = new Animation(2, true); idle.frames(frames, 0, 0, 1); run = new Animation(3, true); run.frames(frames, 0, 1); attack = new Animation(2, false); attack.frames(frames, 0); die = new Animation(10, false); die.frames(frames, 0, 2, 3, 4); play(idle); } @Override public void attack(int cell) { super.attack(cell); speed.set(0, -FALL_SPEED); acc.set(0, FALL_SPEED * 4); } @Override public void onComplete(Animation anim) { super.onComplete(anim); if (anim == attack) { speed.set(0); acc.set(0); place(ch.pos); Camera.main.shake(4, 0.2f); } } }
[ "anoffcialemail@gmail.com" ]
anoffcialemail@gmail.com
af5f6a7c1b78a04452f6d6b9ab0c3a44737a29cf
31eddf900a215bea29b6018409f3dfb1710576ad
/EStore-master/src/com/xmut/estore/service/UserService.java
6b35cbf5f1d514a8db70e1610e90e751f4e7b370
[ "MIT" ]
permissive
panyongkang/gitRepository
d5817ce99e860b8a673d467c84264182bdf8274e
117aa7910028bed20000f39e9c6c7456196f186a
refs/heads/master
2022-12-24T05:33:10.142661
2020-04-17T10:51:50
2020-04-17T10:51:50
241,280,237
0
0
null
2022-12-16T04:46:18
2020-02-18T05:27:57
JavaScript
UTF-8
Java
false
false
2,780
java
package com.xmut.estore.service; import java.sql.SQLException; import java.util.Iterator; import java.util.Set; import com.xmut.estore.dao.ComputerDAO; import com.xmut.estore.dao.TradeDAO; import com.xmut.estore.dao.TradeItemDAO; import com.xmut.estore.dao.UserDAO; import com.xmut.estore.dao.impl.ComputerDAOImpl; import com.xmut.estore.dao.impl.TradeDAOImpl; import com.xmut.estore.dao.impl.TradeItemDAOImpl; import com.xmut.estore.dao.impl.UserDAOImpl; import com.xmut.estore.domain.Trade; import com.xmut.estore.domain.TradeItem; import com.xmut.estore.domain.User; public class UserService { private UserDAO userDAO = new UserDAOImpl(); /** * 通过用户名获取User对象 * @param username * @return */ public User getUserByUserName(String username){ return userDAO.getUser(username); } /** * 通过用户名和密码获取User对象 * @param username * @param password * @return */ public User getUserByUserNameAndPassword(String username,String password){ return userDAO.getUsernameAndPassword(username, password); } private TradeDAO tradeDAO = new TradeDAOImpl(); private TradeItemDAO tradeItemDAO = new TradeItemDAOImpl(); private ComputerDAO computerDAO = new ComputerDAOImpl(); public User getUserWithTrades(String username){ // ���� UserDAO �ķ�����ȡ User ���� User user = userDAO.getUser(username); if(user == null){ return null; } // ���� TradeDAO �ķ�����ȡ Trade �ļ��ϣ�����װ��Ϊ User ������ int userId = user.getUserId(); // ���� TradeItemDAO �ķ�����ȡÿһ�� Trade �е� TradeItem �ļ��ϣ�������װ��Ϊ Trade ������ Set<Trade> trades = tradeDAO.getTradesWithUserId(userId); if(trades != null){ Iterator<Trade> tradeIt = trades.iterator(); while(tradeIt.hasNext()){ Trade trade = tradeIt.next(); int tradeId = trade.getTradeId(); Set<TradeItem> items = tradeItemDAO.getTradeItemsWithTradeId(tradeId); if(items != null){ for(TradeItem item: items){ item.setComputer(computerDAO.getComputer(item.getComputerId())); } if(items != null && items.size() != 0){ trade.setItems(items); } } if(items == null || items.size() == 0){ tradeIt.remove(); } } } if(trades != null && trades.size() != 0){ user.setTrades(trades); } return user; } /** * 用户名是否存在 * @param username * @return * @throws SQLException */ public Boolean isExist(String username) throws SQLException { UserDAO dao=new UserDAOImpl(); Boolean isExist = false; isExist = dao.isExist(username); return isExist; } }
[ "2549315545@qq.com" ]
2549315545@qq.com
eb67c3c774c8f8cbf44729425da928c601b44caa
28bbedf1e54a4401a6b44935061a59dae5516f24
/books/java-io-2e/ioexamples/08/DoubleFilter.java
e215cee921f712a053c3a097ab3e474b501f59a6
[]
no_license
ZeeCee/Jafun
3cc8101f88f32ba8a946eb18b829bf8756f854f5
2993554f2471f8b75fca4430e3ddb6de2d7da4aa
refs/heads/master
2021-01-18T15:48:24.747528
2013-12-22T16:22:17
2013-12-22T16:22:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
package com.macfaq.io; import java.io.*; public class DoubleFilter extends DataFilter { public DoubleFilter(DataInputStream din) { super(din); } protected void fill() throws IOException { double number = din.readDouble(); String s = Double.toString(number) + System.getProperty("line.separator", "\r\n"); byte[] b = s.getBytes("8859_1"); buf = new int[b.length]; for (int i = 0; i < b.length; i++) { buf[i] = b[i]; } } }
[ "nprabhak@nprabhak-mn.local" ]
nprabhak@nprabhak-mn.local
2fe37ffa0b6252d286ebb6180257c1a1287f38ea
146433e240218ff5c4d8d26e80d4a7a3e15dce4b
/app/src/main/java/com/morristaedt/mirror/modules/GuageModule.java
d8e2dfd97d1838a31aa28f87fddda74963555502
[ "Apache-2.0" ]
permissive
jocoplan/HomeMirror
bb8a57b2bad3c1adf4446daca5ff7e7f942a5903
dd772ea79f3c762d44f03e03504163a109ec1ebe
refs/heads/master
2020-04-05T22:44:41.310763
2017-03-09T22:21:08
2017-03-09T22:21:08
42,329,096
0
0
null
2015-09-15T15:15:10
2015-09-11T19:51:36
Java
UTF-8
Java
false
false
3,726
java
package com.morristaedt.mirror.modules; import android.content.res.Resources; import android.os.AsyncTask; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.morristaedt.mirror.R; import com.morristaedt.mirror.requests.ForecastResponse; import org.w3c.dom.Document; import org.xml.sax.InputSource; import java.io.IOException; import java.io.StringReader; import java.util.Iterator; import javax.xml.namespace.NamespaceContext; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.ResponseBody; import retrofit.client.OkClient; /** * Created by orion on 2/26/16. */ public class GuageModule { public interface GuageListener { void receiveGuageHeight( String height ); } private static final BiMap<String, String> namespaces = HashBiMap.create(); static { namespaces.put("om","http://www.opengis.net/om/2.0"); namespaces.put("xlink","http://www.w3.org/1999/xlink"); namespaces.put("wml2","http://www.opengis.net/waterml/2.0"); } public static final void getGuageHeight( final Resources resources, final GuageListener listener ) { new AsyncTask<Void, Void, String>() { protected String doInBackground(Void... params) { OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url( resources.getString(R.string.usgs_endpoint) ) .build(); try { Response response = client.newCall(request).execute(); ResponseBody body = response.body(); String responseStr = body.string(); body.close(); return responseStr; } catch (IOException e) { e.printStackTrace(); return null; } } @Override protected void onPostExecute(String s) { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); xpath.setNamespaceContext( new NamespaceContext() { @Override public String getNamespaceURI(String prefix) { return namespaces.get(prefix); } @Override public String getPrefix(String namespaceURI) { return namespaces.inverse().get(namespaceURI); } @Override public Iterator getPrefixes(String namespaceURI) { return namespaces.keySet().iterator(); } }); String result = null; try { Document doc = (Document) xpath.evaluate("/", new InputSource( new StringReader(s) ), XPathConstants.NODE); String xPathStr = resources.getString(R.string.usgs_xpath); result = xpath.evaluate( xPathStr, doc); listener.receiveGuageHeight( String.format("%s ft", result) ); } catch (XPathExpressionException e) { e.printStackTrace(); } } }.execute(); } }
[ "jocoplan@gmail.com" ]
jocoplan@gmail.com
be98c254df3248aa3b5e86107088accad8cc26db
b51964d07b6ac3f607b9e21cfeb91c02fd2f755d
/src/lista/Ex07.java
8c3f62c2a23422de29c73d27eadeb6698e71e8cd
[]
no_license
jeanmbm/treino-logica-e-algoritmo
aab4fe9be2973a8720c6ab6917fced55877c4e22
292fc50dc1e8027ff6e278e9fc2ded32f582b021
refs/heads/main
2023-09-05T00:00:21.732324
2021-11-03T02:03:20
2021-11-03T02:03:20
417,664,801
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,642
java
package lista; import java.text.DecimalFormat; import java.util.Scanner; /* * Faça um algoritmo que leia três notas de um aluno, calcule e escreva a média final deste aluno. * Considerar que a média é ponderada e que o peso das notas é 2, 3 e 5. * * Make an algorithm that reads three grades from a student, calculates and writes that student's final grade. * Consider that the average is weighted and that the weight of the grades is 2, 3 and 5. * * */ public class Ex07 { public static void main(String[] args) { double firstNote, secondNote, thirdNote, finalAvarage; String name; DecimalFormat format = new DecimalFormat("#.##"); Scanner scan = new Scanner(System.in); System.out.print("Informe seu nome: \n(Enter your name): "); name = String.valueOf(scan.nextLine()); System.out.println(); System.out.print("Informe a nota da primeira avaliação \n(Inform the grade of the first evaluation): "); firstNote = scan.nextDouble(); System.out.println(); System.out.print("Informe a nota da segunda avaliação \n(Inform the grade of the second evaluation): "); secondNote = scan.nextDouble(); System.out.println(); System.out.print("Informe a nota da terceira avaliação \n(Inform the grade of the third evaluation): "); thirdNote = scan.nextDouble(); finalAvarage = ((2 * firstNote) + (3 * secondNote) + (5 * thirdNote)) / 10; System.out.println(); System.out.println("Olá " + name + ". Sua média final é " + format.format(finalAvarage)); System.out.println("Hello " + name + ". Your final avarage was " + format.format(finalAvarage)); } }
[ "jeanreal099@gmail.com" ]
jeanreal099@gmail.com
89bf3a83a58bee8cd86f163d5477d978c9b01cea
8f17729d23e887136ec0daaff9dd0d7a13fa3514
/bogdan_iavorskyi/src/main/java/hw6/notes/service/Menu.java
cb098c1e933f9069d3abf5d96df58479f6191c2b
[]
no_license
RAZER-KIEV/proff25
e3901518ac9655255abf9245c4c2f861ac1c5c9d
7e0c8811aad538d8ec67a77558a12f85f691edf6
refs/heads/master
2021-01-10T16:08:45.373377
2015-08-18T16:13:08
2015-08-18T16:13:08
47,151,116
1
0
null
null
null
null
UTF-8
Java
false
false
113
java
package hw6.notes.service; /* * Created on 18.06.15. */ public class Menu { public void main() { } }
[ "bosyi@bosyi" ]
bosyi@bosyi
7251a1b7a5e03dbb0155b126b42413e1db10a794
ab73204f7f5160dce3e3f9d1225c58e03d0cbbd1
/module2/src/B2/mang/thuchanh/UngDungCountNumberSinhVienPassed.java
8d139880e80fcf701f7bfbb76cd8d24638e4fdf4
[]
no_license
tra140395/C0520G1
b27544b0ac3e62a397a689129eb1c9a8ce1af208
b6e7becde2b1a84379397cf6394ab00b1fd703df
refs/heads/master
2022-11-17T19:30:18.938676
2020-07-02T10:22:48
2020-07-02T10:22:48
276,591,279
0
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
package B2.mang.thuchanh; import java.util.Scanner; public class UngDungCountNumberSinhVienPassed { public static void main(String[] args) { int size; int[] array; Scanner scanner =new Scanner(System.in); do{ System.out.println("nhap size: "); size=Integer.parseInt(scanner.nextLine()); if(size>30) System.out.println("size so Big"); }while (size>30); array= new int[size]; int i =0; while (i<array.length){ System.out.println("nhap diem cho sinh vien thu "+(i+1)+" :"); array[i]=scanner.nextInt(); i++; } int count =0; System.out.println("List of mark :"); for(int j=0;j<array.length;j++){ System.out.print(array[j]+"\t"); if(array[j]>5 && array[j]<=10){ count++; } } System.out.println("\n The number of students passing the exam is " + count); } }
[ "sontra140395@gmail.com" ]
sontra140395@gmail.com
0e36b2f848339563f679d4f2db2656f172ed1273
7588a8232cd85b1fb452b50421914524e6b34735
/src/main/java/com/hugui/crawler/html/BaoZhiIndex.java
909e51875914a649b78f915b8ada56066a750db7
[]
no_license
TrimGHU/crawler
885425e89458d81a28b0a159fee36e214f0dbfee
4eb356ebe60cd94c0dd88276f740fdac98e422cc
refs/heads/master
2020-05-22T22:48:20.062521
2019-05-14T05:54:36
2019-05-14T05:54:36
186,552,922
1
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package com.hugui.crawler.html; import java.util.List; import com.geccocrawler.gecco.annotation.Gecco; import com.geccocrawler.gecco.annotation.HtmlField; import com.geccocrawler.gecco.annotation.Request; import com.geccocrawler.gecco.request.HttpRequest; import com.geccocrawler.gecco.spider.HtmlBean; /** * Copyright © 2019 Obexx. All rights reserved. * * @Title: HuanqiushibaoIndex.java * @Prject: crawler * @Package: com.hugui.crawler.html * @Description: * @author: HuGui * @date: 2019年5月6日 下午4:57:50 * @version: V1.0 */ @Gecco(matchUrl = "http://www.jdqu.com", pipelines = { "consolePipeline", "baozhiIndex" }) public class BaoZhiIndex implements HtmlBean { private static final long serialVersionUID = 1L; @Request private HttpRequest httpRequest; @HtmlField(cssPath = "div.box:nth-child(1)") private List<BaoZhi> cankaoxiaoxi; @HtmlField(cssPath = "div.box:nth-child(4)") private List<BaoZhi> huanqiushibao; public HttpRequest getHttpRequest() { return httpRequest; } public List<BaoZhi> getCankaoxiaoxi() { return cankaoxiaoxi; } public void setCankaoxiaoxi(List<BaoZhi> cankaoxiaoxi) { this.cankaoxiaoxi = cankaoxiaoxi; } public List<BaoZhi> getHuanqiushibao() { return huanqiushibao; } public void setHuanqiushibao(List<BaoZhi> huanqiushibao) { this.huanqiushibao = huanqiushibao; } public void setHttpRequest(HttpRequest httpRequest) { this.httpRequest = httpRequest; } }
[ "gui.hu@obexx.com" ]
gui.hu@obexx.com
5d406fca61e1990ac4ce8f62bec0534f7f30ae39
53de8abfd7e9b6118cdd0594efac42506442c114
/semantic-annotation-pipeline/src/clus/algo/rules/ClusRuleInduce.java
4e1bbf9148bae210525faea3d9292174e2f87fe3
[]
no_license
KostovskaAna/MLC-data-catalog
b1bd6975880c99064852d5658a96946816c38ece
e272a679a5cf37df2bdb4d74a5dbe97df5a3089d
refs/heads/master
2023-08-28T00:25:14.488153
2021-10-28T13:13:20
2021-10-28T13:13:20
418,416,615
0
0
null
null
null
null
UTF-8
Java
false
false
50,505
java
/************************************************************************* * Clus - Software for Predictive Clustering * * Copyright (C) 2007 * * Katholieke Universiteit Leuven, Leuven, Belgium * * Jozef Stefan Institute, Ljubljana, Slovenia * * * * This program is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * * Contact information: <http://www.cs.kuleuven.be/~dtai/clus/>. * *************************************************************************/ /* * Created on May 1, 2005 */ package clus.algo.rules; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Random; import clus.algo.ClusInductionAlgorithm; import clus.algo.split.CurrentBestTestAndHeuristic; import clus.algo.tdidt.ClusNode; import clus.data.rows.RowData; import clus.data.type.ClusAttrType; import clus.data.type.ClusSchema; import clus.data.type.NominalAttrType; import clus.data.type.NumericAttrType; import clus.ext.beamsearch.ClusBeam; import clus.ext.beamsearch.ClusBeamModel; import clus.heuristic.ClusHeuristic; import clus.main.ClusRun; import clus.main.ClusStatManager; import clus.main.Settings; import clus.model.ClusModel; import clus.model.ClusModelInfo; import clus.model.test.NodeTest; import clus.selection.BaggingSelection; import clus.statistic.ClassificationStat; import clus.statistic.ClusStatistic; import clus.util.ClusException; import clus.util.tools.optimization.CallExternGD; import clus.util.tools.optimization.GDAlg; import clus.util.tools.optimization.OptAlg; import clus.util.tools.optimization.OptProbl; import clus.util.tools.optimization.de.DeAlg; public class ClusRuleInduce extends ClusInductionAlgorithm { protected boolean m_BeamChanged; protected FindBestTestRules m_FindBestTest; protected ClusHeuristic m_Heuristic; public ClusRuleInduce(ClusSchema schema, Settings sett) throws ClusException, IOException { super(schema, sett); m_FindBestTest = new FindBestTestRules(getStatManager()); } void resetAll() { m_BeamChanged = false; } public void setHeuristic(ClusHeuristic heur) { m_Heuristic = heur; } public double estimateBeamMeasure(ClusRule rule) { return m_Heuristic.calcHeuristic(null, rule.getClusteringStat(), null); } public boolean isBeamChanged() { return m_BeamChanged; } public void setBeamChanged(boolean change) { m_BeamChanged = change; } ClusBeam initializeBeam(RowData data) { Settings sett = getSettings(); ClusBeam beam = new ClusBeam(sett.getBeamWidth(), sett.getBeamRemoveEqualHeur()); ClusStatistic stat = createTotalClusteringStat(data); ClusRule rule = new ClusRule(getStatManager()); rule.setClusteringStat(stat); rule.setVisitor(data); double value = estimateBeamMeasure(rule); beam.addModel(new ClusBeamModel(value, rule)); return beam; } public void refineModel(ClusBeamModel model, ClusBeam beam, int model_idx) { ClusRule rule = (ClusRule) model.getModel(); RowData data = (RowData) rule.getVisitor(); if (m_FindBestTest.initSelectorAndStopCrit(rule.getClusteringStat(), data)) { model.setFinished(true); return; } CurrentBestTestAndHeuristic sel = m_FindBestTest.getBestTest(); ClusAttrType[] attrs = data.getSchema().getDescriptiveAttributes(); for (int i = 0; i < attrs.length; i++) { // if (Settings.VERBOSE > 1) System.out.print("\n Ref.Attribute: " + attrs[i].getName() + ": "); sel.resetBestTest(); double beam_min_value = beam.getMinValue(); sel.setBestHeur(beam_min_value); ClusAttrType at = attrs[i]; if (at instanceof NominalAttrType) m_FindBestTest.findNominal((NominalAttrType) at, data); else m_FindBestTest.findNumeric((NumericAttrType) at, data); if (sel.hasBestTest()) { NodeTest test = sel.updateTest(); if (Settings.VERBOSE > 0) System.out.println(" Test: " + test.getString() + " -> " + sel.m_BestHeur); // RowData subset = data.applyWeighted(test, ClusNode.YES); RowData subset = data.apply(test, ClusNode.YES); ClusRule ref_rule = rule.cloneRule(); ref_rule.addTest(test); ref_rule.setVisitor(subset); ref_rule.setClusteringStat(createTotalClusteringStat(subset)); // if (Settings.VERBOSE > 0) System.out.println(" Sanity.check.val: " + sel.m_BestHeur); if (getSettings().isHeurRuleDist()) { int[] subset_idx = new int[subset.getNbRows()]; for (int j = 0; j < subset_idx.length; j++) { subset_idx[j] = subset.getTuple(j).getIndex(); } ((ClusRuleHeuristicDispersion) m_Heuristic).setDataIndexes(subset_idx); } double new_heur; // Do a sanity check only for exact (non-approximative) heuristics if (getSettings().isTimeSeriesProtoComlexityExact()) { new_heur = sanityCheck(sel.m_BestHeur, ref_rule); // if (Settings.VERBOSE > 0) System.out.println(" Sanity.check.exp: " + new_heur); } else { new_heur = sel.m_BestHeur; } // Check for sure if _strictly_ better! if (new_heur > beam_min_value) { ClusBeamModel new_model = new ClusBeamModel(new_heur, ref_rule); new_model.setParentModelIndex(model_idx); beam.addModel(new_model); setBeamChanged(true); } } } } public void refineBeam(ClusBeam beam) { setBeamChanged(false); ArrayList models = beam.toArray(); for (int i = 0; i < models.size(); i++) { ClusBeamModel model = (ClusBeamModel) models.get(i); if (!(model.isRefined() || model.isFinished())) { // if (Settings.VERBOSE > 0) System.out.println(" Refine: model " + i); refineModel(model, beam, i); model.setRefined(true); model.setParentModelIndex(-1); } } } public ClusRule learnOneRule(RowData data) { ClusBeam beam = initializeBeam(data); int i = 0; System.out.print("Step: "); while (true) { if (Settings.VERBOSE > 0) { System.out.println("Step: " + i); } else { if (i != 0) { System.out.print(","); } System.out.print(i); } System.out.flush(); refineBeam(beam); if (!isBeamChanged()) { break; } i++; } System.out.println(); double best = beam.getBestModel().getValue(); double worst = beam.getWorstModel().getValue(); System.out.println("Worst = " + worst + " Best = " + best); ClusRule result = (ClusRule) beam.getBestAndSmallestModel().getModel(); // Create target statistic for rule RowData rule_data = (RowData) result.getVisitor(); result.setTargetStat(createTotalTargetStat(rule_data)); result.setVisitor(null); return result; } public ClusRule learnEmptyRule(RowData data) { ClusRule result = new ClusRule(getStatManager()); // Create target statistic for rule // RowData rule_data = (RowData)result.getVisitor(); // result.setTargetStat(m_Induce.createTotalTargetStat(rule_data)); // result.setVisitor(null); return result; } /** * Returns all the rules in the beam, not just the best one. * * @param data * @return array of rules */ public ClusRule[] learnBeamOfRules(RowData data) { ClusBeam beam = initializeBeam(data); int i = 0; System.out.print("Step: "); while (true) { if (Settings.VERBOSE > 0) { System.out.println("Step: " + i); } else { if (i != 0) { System.out.print(","); } System.out.print(i); } System.out.flush(); refineBeam(beam); if (!isBeamChanged()) { break; } i++; } System.out.println(); double best = beam.getBestModel().getValue(); double worst = beam.getWorstModel().getValue(); System.out.println("Worst = " + worst + " Best = " + best); ArrayList beam_models = beam.toArray(); ClusRule[] result = new ClusRule[beam_models.size()]; for (int j = 0; j < beam_models.size(); j++) { // Put better models first int k = beam_models.size() - j - 1; ClusRule rule = (ClusRule) ((ClusBeamModel) beam_models.get(k)).getModel(); // Create target statistic for this rule RowData rule_data = (RowData) rule.getVisitor(); rule.setTargetStat(createTotalTargetStat(rule_data)); rule.setVisitor(null); rule.simplify(); result[j] = rule; } return result; } /** * Standard covering algorithm for learning ordered rules. Data is removed * when it is covered. Default rule is added at the end. */ public void separateAndConquor(ClusRuleSet rset, RowData data) { int max_rules = getSettings().getMaxRulesNb(); int i = 0; // Learn the rules while ((data.getNbRows() > 0) && (i < max_rules)) { ClusRule rule = learnOneRule(data); if (rule.isEmpty()) { break; } else { rule.computePrediction(); rule.printModel(); System.out.println(); rset.add(rule); data = rule.removeCovered(data); i++; } } // The default rule // TODO: Investigate different possibilities for the default rule ClusStatistic left_over; if (data.getNbRows() > 0) { left_over = createTotalTargetStat(data); left_over.calcMean(); } else { System.out.println("All training examples covered - default rule on entire training set!"); rset.m_Comment = new String(" (on entire training set)"); left_over = getStatManager().getTrainSetStat(ClusAttrType.ATTR_USE_TARGET).cloneStat(); left_over.copy(getStatManager().getTrainSetStat(ClusAttrType.ATTR_USE_TARGET)); left_over.calcMean(); // left_over.setSumWeight(0); System.err.println(left_over.toString()); } System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Weighted covering algorithm for learning unordered rules. * Maximum number of rules can be given. Data is re-weighted when it is covered, * and removed when it is 'covered enough'. Default rule is added at the end. */ public void separateAndConquorWeighted(ClusRuleSet rset, RowData data) throws ClusException { int max_rules = getSettings().getMaxRulesNb(); int i = 0; RowData data_copy = data.deepCloneData(); // Taking copy of data. Probably not nice ArrayList bit_vect_array = new ArrayList(); // Learn the rules while ((data.getNbRows() > 0) && (i < max_rules)) { ClusRule rule = learnOneRule(data); if (rule.isEmpty()) { break; } else { rule.computePrediction(); if (Settings.isPrintAllRules()) rule.printModel(); System.out.println(); rset.add(rule); data = rule.reweighCovered(data); i++; if (getSettings().isHeurRuleDist()) { boolean[] bit_vect = new boolean[data_copy.getNbRows()]; for (int j = 0; j < bit_vect.length; j++) { if (!bit_vect[j]) { for (int k = 0; k < rset.getModelSize(); k++) { if (rset.getRule(k).covers(data_copy.getTuple(j))) { bit_vect[j] = true; break; } } } } bit_vect_array.add(bit_vect); ((ClusRuleHeuristicDispersion) m_Heuristic).setCoveredBitVectArray(bit_vect_array); } } } // The default rule // TODO: Investigate different possibilities for the default rule ClusStatistic left_over; if (data.getNbRows() > 0) { left_over = createTotalTargetStat(data); left_over.calcMean(); } else { System.out.println("All training examples covered - default rule on entire training set!"); rset.m_Comment = new String(" (on entire training set)"); left_over = getStatManager().getTrainSetStat(ClusAttrType.ATTR_USE_TARGET).cloneStat(); left_over.copy(getStatManager().getTrainSetStat(ClusAttrType.ATTR_USE_TARGET)); left_over.calcMean(); // left_over.setSumWeight(0); System.err.println(left_over.toString()); } System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Modified separateAndConquorWeighted method: Adds a rule to the rule set * only if it improves the rule set performance * * @param rset * @param data */ public void separateAndConquorAddRulesIfBetter(ClusRuleSet rset, RowData data) throws ClusException { int max_rules = getSettings().getMaxRulesNb(); int i = 0; RowData data_copy = data.deepCloneData(); ArrayList bit_vect_array = new ArrayList(); ClusStatistic left_over = createTotalTargetStat(data_copy); left_over.calcMean(); ClusStatistic new_left_over = left_over; rset.setTargetStat(left_over); double err_score = rset.computeErrorScore(data_copy); while ((data.getNbRows() > 0) && (i < max_rules)) { ClusRule rule = learnOneRule(data); if (rule.isEmpty()) { break; } else { rule.computePrediction(); ClusRuleSet new_rset = rset.cloneRuleSet(); new_rset.add(rule); data = rule.reweighCovered(data); left_over = new_left_over; new_left_over = createTotalTargetStat(data); new_left_over.calcMean(); new_rset.setTargetStat(new_left_over); double new_err_score = new_rset.computeErrorScore(data_copy); if ((err_score - new_err_score) > 1e-6) { i++; rule.printModel(); System.out.println(); err_score = new_err_score; rset.add(rule); if (getSettings().isHeurRuleDist()) { boolean[] bit_vect = new boolean[data_copy.getNbRows()]; for (int j = 0; j < bit_vect.length; j++) { if (!bit_vect[j]) { for (int k = 0; k < rset.getModelSize(); k++) { if (rset.getRule(k).covers(data_copy.getTuple(j))) { bit_vect[j] = true; break; } } } } bit_vect_array.add(bit_vect); ((ClusRuleHeuristicDispersion) m_Heuristic).setCoveredBitVectArray(bit_vect_array); } } else { break; } } } System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Modified separateAndConquorWeighted method: Adds a rule to the rule set * only if it improves the rule set performance or if they cover default class. * If not, it checks other rules in the beam. * * @param rset * @param data */ public void separateAndConquorAddRulesIfBetterFromBeam(ClusRuleSet rset, RowData data) throws ClusException { int max_rules = getSettings().getMaxRulesNb(); int i = 0; RowData data_copy = data.deepCloneData(); ArrayList bit_vect_array = new ArrayList(); ClusStatistic left_over = createTotalTargetStat(data); ClusStatistic new_left_over = left_over; left_over.calcMean(); rset.setTargetStat(left_over); int nb_tar = left_over.getNbAttributes(); boolean cls_task = false; if (left_over instanceof ClassificationStat) { cls_task = true; } int[] def_maj_class = new int[nb_tar]; if (cls_task) { for (int t = 0; t < nb_tar; t++) { def_maj_class[t] = left_over.getNominalPred()[t]; } } double err_score = rset.computeErrorScore(data); while ((data_copy.getNbRows() > 0) && (i < max_rules)) { ClusRule[] rules = learnBeamOfRules(data_copy); left_over = new_left_over; int rule_added = -1; // Check all rules in the beam for (int j = 0; j < rules.length; j++) { if (rules[j].isEmpty()) { continue; } else { rules[j].computePrediction(); ClusRuleSet new_rset = rset.cloneRuleSet(); new_rset.add(rules[j]); RowData data_copy2 = (RowData) data_copy.deepCloneData(); data_copy2 = rules[j].reweighCovered(data_copy2); ClusStatistic new_left_over2 = createTotalTargetStat(data_copy2); new_left_over2.calcMean(); new_rset.setTargetStat(new_left_over2); double new_err_score = new_rset.computeErrorScore(data); // Add the rule anyway if classifies to the default class boolean add_anyway = false; if (cls_task) { for (int t = 0; t < nb_tar; t++) { if (def_maj_class[t] == rules[j].getTargetStat().getNominalPred()[t]) { add_anyway = true; } } } if (((err_score - new_err_score) > 1e-6) || add_anyway) { err_score = new_err_score; rule_added = j; data_copy = data_copy2; new_left_over = new_left_over2; } } } if (rule_added != -1) { i++; rules[rule_added].printModel(); System.out.println(); rset.add(rules[rule_added]); if (getSettings().isHeurRuleDist()) { boolean[] bit_vect = new boolean[data.getNbRows()]; for (int j = 0; j < bit_vect.length; j++) { if (!bit_vect[j]) { for (int k = 0; k < rset.getModelSize(); k++) { if (rset.getRule(k).covers(data.getTuple(j))) { bit_vect[j] = true; break; } } } } bit_vect_array.add(bit_vect); ((ClusRuleHeuristicDispersion) m_Heuristic).setCoveredBitVectArray(bit_vect_array); } } else { break; } } System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * separateAndConquor method that induces rules on several bootstraped data subsets * * @param rset * @param data * @throws ClusException */ public void separateAndConquorBootstraped(ClusRuleSet rset, RowData data) throws ClusException { int nb_sets = 10; // TODO: parameter? int nb_rows = data.getNbRows(); int max_rules = getSettings().getMaxRulesNb(); max_rules /= nb_sets; RowData data_not_covered = (RowData) data.cloneData(); for (int z = 0; z < nb_sets; z++) { // Select the data using bootstrap RowData data_sel = (RowData) data.cloneData(); BaggingSelection msel = new BaggingSelection(nb_rows, getSettings().getEnsembleBagSize(), null); data_sel.update(msel); // Reset tuple indexes used in heuristic if (getSettings().isHeurRuleDist()) { int[] data_idx = new int[data_sel.getNbRows()]; for (int j = 0; j < data_sel.getNbRows(); j++) { data_sel.getTuple(j).setIndex(j); data_idx[j] = j; } ((ClusRuleHeuristicDispersion) m_Heuristic).setDataIndexes(data_idx); ((ClusRuleHeuristicDispersion) m_Heuristic).initCoveredBitVectArray(data_sel.getNbRows()); } // Induce the rules int i = 0; RowData data_sel_copy = (RowData) data_sel.cloneData(); // No need for deep clone here ArrayList bit_vect_array = new ArrayList(); while ((data_sel.getNbRows() > 0) && (i < max_rules)) { ClusRule rule = learnOneRule(data_sel); if (rule.isEmpty()) { break; } else { rule.computePrediction(); rule.printModel(); System.out.println(); rset.addIfUnique(rule); data_sel = rule.removeCovered(data_sel); data_not_covered = rule.removeCovered(data_not_covered); i++; if (getSettings().isHeurRuleDist()) { boolean[] bit_vect = new boolean[data_sel_copy.getNbRows()]; for (int j = 0; j < bit_vect.length; j++) { if (!bit_vect[j]) { for (int k = 0; k < rset.getModelSize(); k++) { if (rset.getRule(k).covers(data_sel_copy.getTuple(j))) { bit_vect[j] = true; break; } } } } bit_vect_array.add(bit_vect); ((ClusRuleHeuristicDispersion) m_Heuristic).setCoveredBitVectArray(bit_vect_array); } } } } ClusStatistic left_over = createTotalTargetStat(data_not_covered); left_over.calcMean(); System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Evaluates each rule in the context of a complete rule set. * Generates random rules that are added if they improve the performance. * Maybe only candidate rules are generated randomly. Then the best one * of the candidate rules could be selected. * Is put on with CoveringMethod = RandomRuleSet in settings file. * * @param rset * @param data */ public void separateAndConquorRandomly(ClusRuleSet rset, RowData data) throws ClusException { int nb_rules = 100; // TODO: parameter? int max_def_rules = 10; // TODO: parameter? ClusRule[] rules = new ClusRule[nb_rules]; Random rn = new Random(42); for (int k = 0; k < nb_rules; k++) { ClusRule rule = generateOneRandomRule(data, rn); rule.computePrediction(); rules[k] = rule; } int max_rules = getSettings().getMaxRulesNb(); int i = 0; RowData data_copy = data.deepCloneData(); ClusStatistic left_over = createTotalTargetStat(data); ClusStatistic new_left_over = left_over; left_over.calcMean(); rset.setTargetStat(left_over); int nb_tar = left_over.getNbAttributes(); boolean cls_task = false; if (left_over instanceof ClassificationStat) { cls_task = true; } int[] def_maj_class = new int[nb_tar]; if (cls_task) { for (int t = 0; t < nb_tar; t++) { def_maj_class[t] = left_over.getNominalPred()[t]; } } double err_score = rset.computeErrorScore(data); int nb_def_rules = 0; boolean add_anyway = false; while (i < max_rules) { left_over = new_left_over; int rule_added = -1; // Check all random rules for (int j = 0; j < rules.length; j++) { if ((rules[j] == null) || (rules[j].isEmpty())) { continue; } else { rules[j].computePrediction(); ClusRuleSet new_rset = rset.cloneRuleSet(); new_rset.add(rules[j]); RowData data_copy2 = (RowData) data_copy.deepCloneData(); data_copy2 = rules[j].reweighCovered(data_copy2); ClusStatistic new_left_over2 = createTotalTargetStat(data_copy2); new_left_over2.calcMean(); new_rset.setTargetStat(new_left_over2); double new_err_score = new_rset.computeErrorScore(data); // Add the rule anyway if classifies to the default class add_anyway = false; if (cls_task) { for (int t = 0; t < nb_tar; t++) { if (def_maj_class[t] == rules[j].getTargetStat().getNominalPred()[t]) { add_anyway = true; } } } double err_d = err_score - new_err_score; if ((err_d > 1e-6) || (nb_def_rules < max_def_rules)) { if (add_anyway) { nb_def_rules++; } err_score = new_err_score; rule_added = j; // System.err.println(err_score + " " + add_anyway + " " + j + " " + err_d); data_copy = data_copy2; new_left_over = new_left_over2; } } } if (rule_added != -1) { i++; rules[rule_added].printModel(); System.out.println(); rset.addIfUnique(rules[rule_added]); rules[rule_added] = null; } else { break; } } System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Modified separateAndConquorWeighted method: evaluates each rule in * the context of a complete rule set, it builds the default rule first. * If first learned rule is no good, it checks next rules in the beam. * * @param rset * @param data */ public void separateAndConquorAddRulesIfBetterFromBeam2(ClusRuleSet rset, RowData data) throws ClusException { int max_rules = getSettings().getMaxRulesNb(); int i = 0; RowData data_copy = data.deepCloneData(); ClusStatistic left_over = createTotalTargetStat(data); // ClusStatistic new_left_over = left_over; left_over.calcMean(); rset.setTargetStat(left_over); ClusRule empty_rule = learnEmptyRule(data_copy); empty_rule.setTargetStat(left_over); data_copy = empty_rule.reweighCovered(data_copy); double err_score = rset.computeErrorScore(data); while ((data.getNbRows() > 0) && (i < max_rules)) { ClusRule[] rules = learnBeamOfRules(data_copy); // left_over = new_left_over; int rule_added = -1; // Check all rules in the beam for (int j = 0; j < rules.length; j++) { if (rules[j].isEmpty()) { continue; } else { rules[j].computePrediction(); ClusRuleSet new_rset = rset.cloneRuleSet(); new_rset.add(rules[j]); RowData data_copy2 = data_copy.deepCloneData(); data_copy2 = rules[j].reweighCovered(data_copy2); // ClusStatistic new_left_over2 = m_Induce.createTotalTargetStat(data_copy2); // new_left_over2.calcMean(); // new_rset.setTargetStat(new_left_over2); new_rset.setTargetStat(left_over); double new_err_score = new_rset.computeErrorScore(data); if ((err_score - new_err_score) > 1e-6) { err_score = new_err_score; rule_added = j; data_copy = data_copy2; // new_left_over = new_left_over2; } } } if (rule_added != -1) { i++; rules[rule_added].printModel(); System.out.println(); rset.add(rules[rule_added]); } else { break; } } System.out.println("Left Over: " + left_over); // rset.setTargetStat(left_over); } public void separateAndConquorWithHeuristic(ClusRuleSet rset, RowData data) { int max_rules = getSettings().getMaxRulesNb(); ArrayList bit_vect_array = new ArrayList(); int i = 0; /* * getSettings().setCompHeurRuleDistPar(0.0); * while (i < max_rules) { * ClusRule rule = learnOneRule(data); * if (rule.isEmpty()) { * break; * } else if (!rset.unique(rule)) { * i++; * double val = getSettings().getCompHeurRuleDistPar(); * val += 1; * getSettings().setCompHeurRuleDistPar(val); * continue; * } else { * getSettings().setCompHeurRuleDistPar(1.0); */ while (i < max_rules) { /* * ClusRule rule = learnOneRule(data); * if (rule.isEmpty() || !rset.unique(rule)) { * break; */ ClusRule[] rules = learnBeamOfRules(data); ClusRule rule = rules[0]; for (int l = 0; l < rules.length - 1; l++) { rule = rules[l + 1]; if (rset.unique(rule)) { break; } } if (rule.isEmpty() || !rset.unique(rule)) { break; } else { rule.computePrediction(); rule.printModel(); System.out.println(); rset.add(rule); i++; boolean[] bit_vect = new boolean[data.getNbRows()]; for (int j = 0; j < bit_vect.length; j++) { if (!bit_vect[j]) { for (int k = 0; k < rset.getModelSize(); k++) { if (rset.getRule(k).covers(data.getTuple(j))) { bit_vect[j] = true; break; } } } } bit_vect_array.add(bit_vect); ((ClusRuleHeuristicDispersion) m_Heuristic).setCoveredBitVectArray(bit_vect_array); } } updateDefaultRule(rset, data); } public double sanityCheck(double value, ClusRule rule) { double expected = estimateBeamMeasure(rule); if (Math.abs(value - expected) > 1e-6) { System.out.println("Bug in heurisitc: " + value + " <> " + expected); PrintWriter wrt = new PrintWriter(System.out); rule.printModel(wrt); wrt.close(); System.out.flush(); System.exit(1); } return expected; } /** * Calls the appropriate rule learning method (e.g. standard covering, weighted covering, ...) * depending on parameters .s file. Default is weighted covering algorithm with unordered rules. * * @param run * The information about this run. Parameters etc. * @return * @throws ClusException * @throws IOException */ public ClusModel induce(ClusRun run) throws ClusException, IOException { int method = getSettings().getCoveringMethod(); int add_method = getSettings().getRuleAddingMethod(); RowData data = (RowData) run.getTrainingSet(); ClusStatistic stat = createTotalClusteringStat(data); m_FindBestTest.initSelectorAndSplit(stat); setHeuristic(m_FindBestTest.getBestTest().getHeuristic()); if (getSettings().isHeurRuleDist()) { int[] data_idx = new int[data.getNbRows()]; for (int i = 0; i < data.getNbRows(); i++) { data.getTuple(i).setIndex(i); data_idx[i] = i; } ((ClusRuleHeuristicDispersion) m_Heuristic).setDataIndexes(data_idx); ((ClusRuleHeuristicDispersion) m_Heuristic).initCoveredBitVectArray(data.getNbRows()); } /// Actual rule learning is called here with the given method. // Settings.* check if the given option is given on the command line ClusRuleSet rset = new ClusRuleSet(getStatManager()); if (method == Settings.COVERING_METHOD_STANDARD) { separateAndConquor(rset, data); } else if (method == Settings.COVERING_METHOD_BEAM_RULE_DEF_SET) { // Obsolete! separateAndConquorAddRulesIfBetterFromBeam2(rset, data); /** * Can be put on by CoveringMethod = RandomRuleSet */ } else if (method == Settings.COVERING_METHOD_RANDOM_RULE_SET) { separateAndConquorRandomly(rset, data); } else if (method == Settings.COVERING_METHOD_STANDARD_BOOTSTRAP) { separateAndConquorBootstraped(rset, data); } else if (method == Settings.COVERING_METHOD_HEURISTIC_ONLY) { separateAndConquorWithHeuristic(rset, data); } else if (add_method == Settings.RULE_ADDING_METHOD_IF_BETTER) { separateAndConquorAddRulesIfBetter(rset, data); } else if (add_method == Settings.RULE_ADDING_METHOD_IF_BETTER_BEAM) { separateAndConquorAddRulesIfBetterFromBeam(rset, data); } else { separateAndConquorWeighted(rset, data); } // The rule set was altered. Compute the means (predictions?) for rules again. rset.postProc(); // Optimizing rule set if (getSettings().isRulePredictionOptimized()) { rset = optimizeRuleSet(rset, data); } rset.setTrainErrorScore(); // Not always needed? rset.addDataToRules(data); // Computing dispersion if (getSettings().computeDispersion()) { rset.computeDispersion(ClusModel.TRAIN); rset.removeDataFromRules(); if (run.getTestIter() != null) { RowData testdata = (RowData) run.getTestSet(); rset.addDataToRules(testdata); rset.computeDispersion(ClusModel.TEST); rset.removeDataFromRules(); } } // Number rules (for output purpose in WritePredictions) rset.numberRules(); return rset; } /** * Optimize the weights of rules. * * @param rset * Rule set to be optimized * @param data * @return Optimized rule set * @throws ClusException * @throws IOException */ public ClusRuleSet optimizeRuleSet(ClusRuleSet rset, RowData data) throws ClusException, IOException { String fname = getSettings().getDataFile(); // PrintWriter wrt_pred = new PrintWriter(new OutputStreamWriter(new FileOutputStream(fname+".r-pred"))); PrintWriter wrt_pred = null; OptAlg optAlg = null; OptProbl.OptParam param = rset.giveFormForWeightOptimization(wrt_pred, data); ArrayList weights = null; if (Settings.VERBOSE > 0) System.out.println("Preparing for optimization."); // Find the rule weights with optimization algorithm. if (getSettings().getRulePredictionMethod() == Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED) { optAlg = (OptAlg) new GDAlg(getStatManager(), param, rset); } else if (getSettings().getRulePredictionMethod() == Settings.RULE_PREDICTION_METHOD_OPTIMIZED) { optAlg = (OptAlg) new DeAlg(getStatManager(), param, rset); } else if (getSettings().getRulePredictionMethod() == Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED_BINARY) { weights = CallExternGD.main(getStatManager(), param, rset); } if (Settings.VERBOSE > 0 && getSettings().getRulePredictionMethod() != Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED_BINARY) System.out.println("Preparations ended. Starting optimization."); if (getSettings().getRulePredictionMethod() != Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED_BINARY) { // If using external binary, optimization is already done. if (getSettings().getRulePredictionMethod() == Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED && getSettings().getOptGDNbOfTParameterTry() > 1) { // Running optimization multiple times and selecting the best one. GDAlg gdalg = (GDAlg) optAlg; double firstTVal = 1.0; double lastTVal = getSettings().getOptGDGradTreshold(); // What is the difference for intervals so that we get enough runs double interTVal = (lastTVal - firstTVal) / (getSettings().getOptGDNbOfTParameterTry() - 1); double minFitness = Double.POSITIVE_INFINITY; for (int iRun = 0; iRun < getSettings().getOptGDNbOfTParameterTry(); iRun++) { // To make sure the last value is accurate (not rounded imprecisely) if (iRun == getSettings().getOptGDNbOfTParameterTry() - 1) { getSettings().setOptGDGradTreshold(lastTVal); } else { getSettings().setOptGDGradTreshold(firstTVal + iRun * interTVal); } gdalg.initGDForNewRunWithSamePredictions(); ArrayList<Double> newWeights = gdalg.optimize(); if (Settings.VERBOSE > 0) System.err.print("\nThe T value " + (firstTVal + iRun * interTVal) + " has a test fitness: " + gdalg.getBestFitness()); if (gdalg.getBestFitness() < minFitness) { // Fitness is smaller than previously, store these weights weights = newWeights; minFitness = gdalg.getBestFitness(); rset.m_optWeightBestTValue = firstTVal + iRun * interTVal; rset.m_optWeightBestFitness = minFitness; if (Settings.VERBOSE > 0) System.err.print(" - best so far!"); // If fitness increasing, check if we are stopping early } else if (getSettings().getOptGDEarlyTTryStop() && gdalg.getBestFitness() > getSettings().getOptGDEarlyStopTreshold() * minFitness) { if (Settings.VERBOSE > 0) System.err.print(" - early T value stop reached."); break; } } getSettings().setOptGDGradTreshold(lastTVal); } else { // Running only once weights = optAlg.optimize(); } } for (int j = 0; j < rset.getModelSize(); j++) { rset.getRule(j).setOptWeight(((Double) weights.get(j)).doubleValue()); // Set the RULE weights } // Postprocessing if needed. -- Undo inside normalization on rule set if needed if (getSettings().getRulePredictionMethod() != Settings.RULE_PREDICTION_METHOD_GD_OPTIMIZED_BINARY) optAlg.postProcess(rset); // Print weights of all terms if (Settings.VERBOSE > 0) { System.out.print("\nThe weights for rules:"); for (int j = 0; j < weights.size(); j++) { System.out.print(((Double) weights.get(j)).doubleValue() + "; "); } System.out.print("\n"); } int indexOfLastHandledWeight = rset.removeLowWeightRules() + 1; // if needed, add implicit linear terms explicitly. this has to be done after removing low weight rules if (getSettings().getOptAddLinearTerms() == Settings.OPT_GD_ADD_LIN_YES_SAVE_MEMORY) { rset.addImplicitLinearTermsExplicitly(weights, indexOfLastHandledWeight); } // If linear terms are used, include the normalizing to their weights and the all covering rule if (getSettings().isOptAddLinearTerms() && getSettings().getOptNormalizeLinearTerms() == Settings.OPT_LIN_TERM_NORM_CONVERT) { rset.convertToPlainLinearTerms(); } RowData data_copy = (RowData) data.cloneData(); updateDefaultRule(rset, data_copy); // Just to show that the default rule is void. return rset; } /** * Updates the default rule. This is the rule that is used if no other rule covers the example. * For rule ensembles this is, in effect, void rule. */ public void updateDefaultRule(ClusRuleSet rset, RowData data) { for (int i = 0; i < rset.getModelSize(); i++) { data = rset.getRule(i).removeCovered(data); } ClusStatistic left_over = createTotalTargetStat(data); left_over.calcMean(); System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); } /** * Method that induces a specified number of random rules. * That is, the random attributes are chosen with random split points. * However, the predictions are the means of covered examples. * * @param cr * ClusRun * @return RuleSet */ public ClusModel induceRandomly(ClusRun run) throws ClusException, IOException { int number = getSettings().nbRandomRules(); RowData data = (RowData) run.getTrainingSet(); ClusStatistic stat = createTotalClusteringStat(data); m_FindBestTest.initSelectorAndSplit(stat); setHeuristic(m_FindBestTest.getBestTest().getHeuristic()); // ??? ClusRuleSet rset = new ClusRuleSet(getStatManager()); Random rn = new Random(42); for (int i = 0; i < number; i++) { ClusRule rule = generateOneRandomRule(data, rn); rule.computePrediction(); rule.printModel(); System.out.println(); if (!rset.addIfUnique(rule)) { i--; } } // The rule set changed, compute predictions (?) // This same may have been done on the rule.computePrediction() but not sure // For this rule set, postProc is not implemented (abstract function) // rset.postProc(); // Optimizing rule set if (getSettings().isRulePredictionOptimized()) { rset = optimizeRuleSet(rset, data); } ClusStatistic left_over = createTotalTargetStat(data); left_over.calcMean(); System.out.println("Left Over: " + left_over); rset.setTargetStat(left_over); rset.postProc(); rset.setTrainErrorScore(); // Not always needed? // Computing dispersion if (getSettings().computeDispersion()) { rset.addDataToRules(data); rset.computeDispersion(ClusModel.TRAIN); rset.removeDataFromRules(); if (run.getTestIter() != null) { RowData testdata = (RowData) run.getTestSet(); rset.addDataToRules(testdata); rset.computeDispersion(ClusModel.TEST); rset.removeDataFromRules(); } } return rset; } /** * Generates one random rule. * * @param data * @param rn * @return */ private ClusRule generateOneRandomRule(RowData data, Random rn) { // TODO: Remove/change the beam stuff!!! // Jans: Removed beam stuff (because was more difficult to debug) ClusStatManager mgr = getStatManager(); ClusRule result = new ClusRule(mgr); ClusAttrType[] attrs = data.getSchema().getDescriptiveAttributes(); // Pointer to the complete data set RowData orig_data = data; // Generate number of tests int nb_tests; if (attrs.length > 1) { nb_tests = rn.nextInt(attrs.length - 1) + 1; } else { nb_tests = 1; } // Generate attributes in these tests int[] test_atts = new int[nb_tests]; for (int i = 0; i < nb_tests; i++) { while (true) { int att_idx = rn.nextInt(attrs.length); boolean unique = true; for (int j = 0; j < i; j++) { if (att_idx == test_atts[j]) { unique = false; } } if (unique) { test_atts[i] = att_idx; break; } } } CurrentBestTestAndHeuristic sel = m_FindBestTest.getBestTest(); for (int i = 0; i < test_atts.length; i++) { result.setClusteringStat(createTotalClusteringStat(data)); if (m_FindBestTest.initSelectorAndStopCrit(result.getClusteringStat(), data)) { // Do not add test if stop criterion succeeds (???) break; } sel.resetBestTest(); sel.setBestHeur(Double.NEGATIVE_INFINITY); ClusAttrType at = attrs[test_atts[i]]; if (at instanceof NominalAttrType) { m_FindBestTest.findNominalRandom((NominalAttrType) at, data, rn); } else { m_FindBestTest.findNumericRandom((NumericAttrType) at, data, orig_data, rn); } if (sel.hasBestTest()) { NodeTest test = sel.updateTest(); if (Settings.VERBOSE > 0) System.out.println(" Test: " + test.getString() + " -> " + sel.m_BestHeur); result.addTest(test); // data = data.applyWeighted(test, ClusNode.YES); data = data.apply(test, ClusNode.YES); // ??? } } // Create target and clustering statistic for rule result.setTargetStat(createTotalTargetStat(data)); result.setClusteringStat(createTotalClusteringStat(data)); return result; } public ClusModel induceSingleUnpruned(ClusRun cr) throws ClusException, IOException, InterruptedException { // ClusRulesForAttrs rfa = new ClusRulesForAttrs(); // return rfa.constructRules(cr); resetAll(); if (!getSettings().isRandomRules()) { // Is the random rules given in the .s file return induce(cr); } else { return induceRandomly(cr); } } public void induceAll(ClusRun cr) throws ClusException, IOException, InterruptedException { // Set the defaults for heuristic RowData trainData = (RowData) cr.getTrainingSet(); getStatManager().getHeuristic().setTrainData(trainData); ClusStatistic trainStat = getStatManager().getTrainSetStat(ClusAttrType.ATTR_USE_CLUSTERING); double value = trainStat.getDispersion(getStatManager().getClusteringWeights(), trainData); getStatManager().getHeuristic().setTrainDataHeurValue(value); // Induce the model ClusModel model = induceSingleUnpruned(cr); // FIXME: implement cloneModel(); // cr.getModelInfo(ClusModels.ORIGINAL).setModel(model); // ClusModel pruned = model.cloneModel(); ClusModelInfo pruned_model = cr.addModelInfo(ClusModel.ORIGINAL); pruned_model.setModel(model); pruned_model.setName("Original"); } }
[ "anakostovska2@gmail.com" ]
anakostovska2@gmail.com
1901746b0121e51b444e69afe8722d98884d37ce
0ce99d5bf83e0e71b40afb8bfb14f44e281b1a31
/src/main/java/by/bsuir/spp/dao/connectionpool/IConnectionPool.java
dd92460e4b6971b227a069ec38ebec79ad234cce
[]
no_license
orangeStas/PostServiceWebApp
fe9cdce598fb0f813707bdbd287222d562819cf7
afe8fb0743c76d4078500f59c93ac514bc6bb165
refs/heads/master
2021-01-21T13:34:08.862542
2016-05-22T20:48:42
2016-05-22T20:48:42
51,303,652
0
5
null
2016-05-02T20:44:26
2016-02-08T14:48:20
Java
UTF-8
Java
false
false
369
java
package by.bsuir.spp.dao.connectionpool; import by.bsuir.spp.exception.dao.connectionpool.ConnectionPoolException; import java.sql.Connection; public interface IConnectionPool { void init() throws ConnectionPoolException; void dispose(); Connection getConnection() throws ConnectionPoolException; interface IPooledConnection extends Connection {} }
[ "orange.css@yandex.by" ]
orange.css@yandex.by
2e16b8848b3d675c58c34fd52969b8ea3788416e
c1261b2ce26630d40c9f5dcb5755a2775c00412c
/main.java
f75e5eb9149a673d59bee15043b04d064066d4da
[]
no_license
somanellipudi/Knight-s-Tour-On-A-Chess-Board
7aeed1f4ac4b74c141c3d23a4e2dbe82f3b6dfee
6949d9a65e277f105c4ab169b51381974bff6694
refs/heads/main
2023-02-08T12:44:31.521922
2020-12-27T21:07:37
2020-12-27T21:07:37
324,285,273
0
0
null
null
null
null
UTF-8
Java
false
false
1,481
java
/* * Complete the function below. */ static int find_number_of_reaches(int rows, int cols, int start_row, int start_col, int end_row, int end_col) { // Write your code here. int result = 0; //base case if(start_row == end_row && start_col == end_col){ return result; } Queue<int[]> q = new LinkedList<>(); boolean[][] visited = new boolean[rows][cols]; q.add(new int[] {start_row, start_col}); int[][] dir = { {1,2}, {1,-2}, {-1,2}, {-1,-2}, {2,1}, {2,-1}, {-2,1}, {-2,-1}}; visited[start_row][start_col] = true; while(!q.isEmpty()){ int[] node = q.remove(); visited[node[0]][node[1]] = true; if(node[0] == end_row && node[1] == end_col){ result++; } for(int j=0; j<= dir.length-1; j++){ int next_row = node[0] + dir[j][0]; int next_col = node[1] + dir[j][1]; if(next_row >= 0 && next_col >= 0 && next_row <= rows-1 && next_col <= cols-1 && visited[next_row][next_col] != true){ q.add(new int[] {next_row, next_col}); } } } if(result == 0){ return -1; } return result; }
[ "noreply@github.com" ]
somanellipudi.noreply@github.com
c017ede8e3fa2bcf6f1cb289c84c82b3bcc5fa60
7b6aacf3f0b53f76017ef645c456b31fe37c722d
/service-discovery-principal/src/main/java/microservice/MainController/MainController.java
51bfcd2812690c06d12dd0ca7f76c449c19a7ecf
[]
no_license
itqpleyva/spring_boot_eureka_service_discovery
8136ab68c826ab54c1b825b8f1b667b39e2c307d
5bc86c80f1208df07a1f4a0255db5224f59da219
refs/heads/master
2022-01-30T22:03:33.265863
2020-03-02T14:43:04
2020-03-02T14:43:04
244,524,973
2
0
null
2022-01-21T23:38:48
2020-03-03T02:41:13
Java
UTF-8
Java
false
false
1,185
java
package microservice.MainController; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import microservice.Models.Movie; @RestController @RequestMapping("/api") public class MainController { @Autowired RestTemplate restTemplate; @RequestMapping("/movies") public List<Object> test() { ResponseEntity<List<Object> > ratings_body = restTemplate.exchange("http://service-rating/api/ratings/", HttpMethod.GET, null, new ParameterizedTypeReference<List<Object>>() {}); List<Object> ratings = ratings_body.getBody(); ResponseEntity<List<Object> > movie_body = restTemplate.exchange("http://services-movies/api/movies/", HttpMethod.GET, null, new ParameterizedTypeReference<List<Object>>() {}); List<Object> movies = movie_body.getBody(); return movies; } }
[ "itqpleyva@gmail.com" ]
itqpleyva@gmail.com
439b9bcc40cae760f70591838d9622bcde4f98e4
9a1487c65dd71a0f636368a22a30a14c3305f06f
/src/main/java/cn/edu/seu/alumni_background/model/dto/accounts/brief_info/AccountBriefInfo.java
179dbd2290ca6ed474aec7b2d62dd15b5f149c5b
[]
no_license
zhanglirong1999/alumni_background_v2
acf913b49de0dc8a40ef935f3dda5481bc19b257
48544a016cc4345512ae52ff00dfaf68fe2e4bb7
refs/heads/master
2023-03-09T23:27:04.348207
2021-03-01T06:18:54
2021-03-01T06:18:54
315,189,652
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package cn.edu.seu.alumni_background.model.dto.accounts.brief_info; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class AccountBriefInfo { private Long accountId; private String avatar; private String name; private String selfDesc; private String college = null; private String eduInfo = null; private String city; private String company = null; private String position = null; private Boolean isVerified; public void fillEduInfo(AccountBriefEduInfo _eduInfo) { college = _eduInfo.getCollege(); eduInfo = _eduInfo.buildBriefEduInfo(); } public void fillJobInfo(AccountBriefJobInfo _jobInfo) { company = _jobInfo.getCompany(); position = _jobInfo.getPosition(); } }
[ "213182194@seu.edu.cn" ]
213182194@seu.edu.cn
5ce9e94c33cb9a7be4a6999e7e57271fad66a697
03ed88c601e948919cab1abe16a27555b695f9af
/src/main/java/me/egg82/echo/utils/DatabaseUtil.java
8c76d5390378f8b95dde85423771acbd693dd6de
[ "MIT" ]
permissive
egg82/ECHO-Java
9d57c1fe351d059eeb740cfad79b966a3def2135
6a5442f4afeffe9f84c0bc849a34575c25ca6785
refs/heads/main
2023-03-26T17:19:48.717053
2021-03-22T23:11:55
2021-03-22T23:11:55
333,619,415
0
0
null
null
null
null
UTF-8
Java
false
false
8,406
java
package me.egg82.echo.utils; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.Weigher; import com.google.common.hash.HashCode; import flexjson.JSONDeserializer; import flexjson.JSONSerializer; import me.egg82.echo.compression.ZstdCompressionStream; import me.egg82.echo.config.CachedConfig; import me.egg82.echo.config.ConfigUtil; import me.egg82.echo.core.NullablePair; import me.egg82.echo.storage.StorageService; import me.egg82.echo.storage.models.WebModel; import me.egg82.echo.web.transformers.InstantTransformer; import org.apache.commons.lang3.RandomStringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.time.Instant; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.TimeUnit; public class DatabaseUtil { private static final Logger logger = LoggerFactory.getLogger(DatabaseUtil.class); private static final ZstdCompressionStream ZSTD_COMPRESSION = new ZstdCompressionStream(); private static final Queue<MessageDigest> DIGESTS = new ConcurrentLinkedQueue<>(); private static final File PATH = new File(FileUtil.getCwd(), "web"); static { try { if (PATH.exists() && !PATH.isDirectory()) { Files.delete(PATH.toPath()); } if (!PATH.exists()) { if (!PATH.mkdirs()) { throw new IOException("Could not create parent directory structure."); } } } catch (IOException ex) { throw new IllegalStateException("Could not create PATH.", ex); } } private DatabaseUtil() { } public static <T> @Nullable T getModel(@NotNull String hash, @NotNull String service, @NotNull Class<T> modelClass) { byte[] retVal = getBytes(hash, service); if (retVal == null) { return null; } JSONDeserializer<T> modelDeserializer = new JSONDeserializer<>(); modelDeserializer.use(Instant.class, new InstantTransformer()); return modelDeserializer.deserialize(new String(retVal, StandardCharsets.UTF_8), modelClass); } public static <T> @Nullable T getModel(@NotNull String hash, @NotNull String service, @NotNull Class<T> modelClass, long cacheTimeMillis) { byte[] retVal = getBytes(hash, service, cacheTimeMillis); if (retVal == null) { return null; } JSONDeserializer<T> modelDeserializer = new JSONDeserializer<>(); modelDeserializer.use(Instant.class, new InstantTransformer()); return modelDeserializer.deserialize(new String(retVal, StandardCharsets.UTF_8), modelClass); } public static <T> void storeModel(@NotNull String hash, @NotNull String service, @NotNull T model) { JSONSerializer modelSerializer = new JSONSerializer(); modelSerializer.prettyPrint(false); modelSerializer.transform(new InstantTransformer(), Instant.class); storeBytes(hash, service, modelSerializer.exclude("*.class").deepSerialize(model).getBytes(StandardCharsets.UTF_8)); } public static @Nullable String getString(@NotNull String hash, @NotNull String service) { byte[] retVal = getBytes(hash, service); if (retVal == null) { return null; } return new String(retVal, StandardCharsets.UTF_8); } public static @Nullable String getString(@NotNull String hash, @NotNull String service, long cacheTimeMillis) { byte[] retVal = getBytes(hash, service, cacheTimeMillis); if (retVal == null) { return null; } return new String(retVal, StandardCharsets.UTF_8); } public static void storeString(@NotNull String hash, @NotNull String service, @NotNull String string) { storeBytes( hash, service, string.getBytes(StandardCharsets.UTF_8) ); } private static final Cache<NullablePair<String, String>, byte[]> dataCache = Caffeine.newBuilder() .expireAfterWrite(1L, TimeUnit.DAYS) .expireAfterAccess(4L, TimeUnit.HOURS) .maximumWeight(1024L * 1024L * 2L) // 2MB .weigher((Weigher<NullablePair<String, String>, byte[]>) (k, v) -> v.length) .build(); public static byte @Nullable [] getBytes(@NotNull String hash, @NotNull String service) { return dataCache.get(new NullablePair<>(hash, service), k -> { CachedConfig cachedConfig = ConfigUtil.getCachedConfig(); if (cachedConfig == null) { throw new IllegalStateException("Could not get cached config."); } for (StorageService s : cachedConfig.getStorage()) { WebModel model = s.getWebModel(hash, service); if (model != null) { File file = new File(PATH, model.getPath()); if (file.exists()) { try { return ZSTD_COMPRESSION.decompress(Files.readAllBytes(file.toPath())); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } } } } return null; }); } public static byte @Nullable [] getBytes(@NotNull String hash, @NotNull String service, long cacheTimeMillis) { return dataCache.get(new NullablePair<>(hash, service), k -> { CachedConfig cachedConfig = ConfigUtil.getCachedConfig(); if (cachedConfig == null) { throw new IllegalStateException("Could not get cached config."); } for (StorageService s : cachedConfig.getStorage()) { WebModel model = s.getWebModel(hash, service, cacheTimeMillis); if (model != null) { File file = new File(PATH, model.getPath()); if (file.exists()) { try { return ZSTD_COMPRESSION.decompress(Files.readAllBytes(file.toPath())); } catch (IOException ex) { logger.error(ex.getMessage(), ex); } } } } return null; }); } public static void storeBytes(@NotNull String hash, @NotNull String service, byte @NotNull [] data) { dataCache.put(new NullablePair<>(hash, service), data); String fileName; do { fileName = RandomStringUtils.randomAlphanumeric(18); } while (new File(PATH, fileName).exists()); try { Files.write(new File(PATH, fileName).toPath(), ZSTD_COMPRESSION.compress(data)); } catch (IOException ex) { throw new RuntimeException("Could not write file to disk.", ex); } CachedConfig cachedConfig = ConfigUtil.getCachedConfig(); if (cachedConfig == null) { throw new IllegalStateException("Could not get cached config."); } for (StorageService s : cachedConfig.getStorage()) { WebModel model = new WebModel(); model.setHash(hash); model.setService(service); model.setPath(fileName); s.storeModel(model); } } public static @NotNull String sha512(@NotNull String content) { return sha512(content.getBytes(StandardCharsets.UTF_8)); } public static @NotNull String sha512(byte @NotNull [] content) { MessageDigest digest = DIGESTS.poll(); if (digest == null) { try { digest = MessageDigest.getInstance("SHA-512"); } catch (NoSuchAlgorithmException ex) { throw new RuntimeException("Could not get SHA512.", ex); } } byte[] retVal = digest.digest(content); digest.reset(); DIGESTS.add(digest); return HashCode.fromBytes(retVal).toString(); } }
[ "eggys82@gmail.com" ]
eggys82@gmail.com
af827fc2714980d9fd116eab0ac4d9e1f5ab67d1
f86e106beea7bdd2f2ed7a50a0130b7a544c5c4c
/src/main/java/flyweight/State.java
b8a70c77288109eacbf35feea0f218876748909b
[]
no_license
gusstav0/gof
e8d3be55fc80501bfe068f2430f324dd396f9e15
12badf5d4f1a5eeae651f04ba94d89859a844d7d
refs/heads/master
2021-01-10T10:57:36.778922
2015-10-06T00:45:10
2015-10-06T00:45:10
43,722,460
0
0
null
null
null
null
UTF-8
Java
false
false
369
java
package flyweight; import java.io.File; import java.io.IOException; import java.io.Serializable; public interface State{ public static final int CONTACTS = 1; public static final int ADDRESSES = 2; public static final int MAXIMUM_STATE_VALUE = 2; public void save(File f, Serializable s, int type) throws IOException; public void edit(int type); }
[ "dudek_007@hotmail.com" ]
dudek_007@hotmail.com
3e2b7d7f7e13c4a122a838f763a728135b9a9606
d0dd3d47cc3e9a13cfb0ca725feda76a83ff6a43
/CS544EA/lab4/Lab4-Collections/src/main/java/edu/mum/cs544/Passenger.java
d749605782a975dd4b66b0ad9d9d86dc5daef627
[]
no_license
jij000/homework
cf014ef278ef33b106029707b221426cd8ca613b
e5af2d5e77795154ea4f278801b51f90abef2b1d
refs/heads/master
2022-12-25T14:58:14.821712
2020-09-27T18:55:42
2020-09-27T18:55:42
191,246,144
0
0
null
2022-12-16T00:36:49
2019-06-10T21:10:53
Java
UTF-8
Java
false
false
319
java
package edu.mum.cs544; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Data @NoArgsConstructor @Entity public class Passenger { @Id @GeneratedValue private Integer id; private String name; }
[ "jij000@gmail.com" ]
jij000@gmail.com
ee9eec797c3595bd31b08825f6b44396b3e7e4e9
ac539799d3f3ade856db58e4633d38cc643240f8
/src/main/java/cn/com/open/qti/FeedbackInlineType.java
e32b3630e79ce97cf42a53b3cca662fb56f7127b
[]
no_license
lucky126/openqti
bb30f5f320295496d090d52cd76513f9c2293f96
acd50ac4f0458397f96961c6acf9615b7f527ed2
refs/heads/master
2021-05-04T00:14:31.406316
2018-02-06T05:54:56
2018-02-06T05:54:56
120,408,412
0
0
null
null
null
null
UTF-8
Java
false
false
14,213
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2017.06.15 时间 10:58:25 AM CST // package cn.com.open.qti; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlMixed; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * <p>feedbackInline.Type complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="feedbackInline.Type"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;group ref="{http://www.open.com.cn/schemas/exam/openqti_v1}feedbackInline.ContentGroup"/> * &lt;attGroup ref="{http://www.open.com.cn/schemas/exam/openqti_v1}feedbackInline.AttrGroup"/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "feedbackInline.Type", propOrder = { "content" }) public class FeedbackInlineType { @XmlElementRefs({ @XmlElementRef(name = "acronym", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "sup", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "i", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "gap", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "include", namespace = "http://www.w3.org/2001/XInclude", type = JAXBElement.class, required = false), @XmlElementRef(name = "inlineChoiceInteraction", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "templateInline", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "sub", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "tt", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "feedbackInline", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "var", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "abbr", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "b", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "a", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "endAttemptInteraction", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "br", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "em", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "strong", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "span", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "samp", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "img", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "printedVariable", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "q", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "dfn", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "code", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "big", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "kbd", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "hottext", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "small", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "object", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "cite", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false), @XmlElementRef(name = "textEntryInteraction", namespace = "http://www.open.com.cn/schemas/exam/openqti_v1", type = JAXBElement.class, required = false) }) @XmlMixed protected List<Serializable> content; @XmlAttribute(name = "outcomeIdentifier", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String outcomeIdentifier; @XmlAttribute(name = "showHide", required = true) protected ShowHideType showHide; @XmlAttribute(name = "identifier", required = true) @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String identifier; @XmlAttribute(name = "id") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) protected String id; @XmlAttribute(name = "class") protected List<String> clazz; @XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace") @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlSchemaType(name = "language") protected String lang; @XmlAttribute(name = "label") protected String label; @XmlAttribute(name = "base", namespace = "http://www.w3.org/XML/1998/namespace") @XmlSchemaType(name = "anyURI") protected String base; /** * Gets the value of the content property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the content property. * * <p> * For example, to add a new item, do as follows: * <pre> * getContent().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code <}{@link AcronymType }{@code >} * {@link JAXBElement }{@code <}{@link SupType }{@code >} * {@link JAXBElement }{@code <}{@link IType }{@code >} * {@link JAXBElement }{@code <}{@link GapType }{@code >} * {@link JAXBElement }{@code <}{@link IncludeType }{@code >} * {@link JAXBElement }{@code <}{@link InlineChoiceInteractionType }{@code >} * {@link JAXBElement }{@code <}{@link TemplateInlineType }{@code >} * {@link JAXBElement }{@code <}{@link SubType }{@code >} * {@link JAXBElement }{@code <}{@link TtType }{@code >} * {@link JAXBElement }{@code <}{@link FeedbackInlineType }{@code >} * {@link JAXBElement }{@code <}{@link VarType }{@code >} * {@link JAXBElement }{@code <}{@link AbbrType }{@code >} * {@link JAXBElement }{@code <}{@link BType }{@code >} * {@link JAXBElement }{@code <}{@link AType }{@code >} * {@link JAXBElement }{@code <}{@link EndAttemptInteractionType }{@code >} * {@link JAXBElement }{@code <}{@link BrType }{@code >} * {@link JAXBElement }{@code <}{@link EmType }{@code >} * {@link JAXBElement }{@code <}{@link StrongType }{@code >} * {@link JAXBElement }{@code <}{@link SpanType }{@code >} * {@link JAXBElement }{@code <}{@link SampType }{@code >} * {@link JAXBElement }{@code <}{@link ImgType }{@code >} * {@link JAXBElement }{@code <}{@link PrintedVariableType }{@code >} * {@link JAXBElement }{@code <}{@link QType }{@code >} * {@link JAXBElement }{@code <}{@link DfnType }{@code >} * {@link JAXBElement }{@code <}{@link CodeType }{@code >} * {@link JAXBElement }{@code <}{@link BigType }{@code >} * {@link JAXBElement }{@code <}{@link KbdType }{@code >} * {@link String } * {@link JAXBElement }{@code <}{@link HottextType }{@code >} * {@link JAXBElement }{@code <}{@link SmallType }{@code >} * {@link JAXBElement }{@code <}{@link ObjectType }{@code >} * {@link JAXBElement }{@code <}{@link CiteType }{@code >} * {@link JAXBElement }{@code <}{@link TextEntryInteractionType }{@code >} * * */ public List<Serializable> getContent() { if (content == null) { content = new ArrayList<Serializable>(); } return this.content; } /** * 获取outcomeIdentifier属性的值。 * * @return * possible object is * {@link String } * */ public String getOutcomeIdentifier() { return outcomeIdentifier; } /** * 设置outcomeIdentifier属性的值。 * * @param value * allowed object is * {@link String } * */ public void setOutcomeIdentifier(String value) { this.outcomeIdentifier = value; } /** * 获取showHide属性的值。 * * @return * possible object is * {@link ShowHideType } * */ public ShowHideType getShowHide() { return showHide; } /** * 设置showHide属性的值。 * * @param value * allowed object is * {@link ShowHideType } * */ public void setShowHide(ShowHideType value) { this.showHide = value; } /** * 获取identifier属性的值。 * * @return * possible object is * {@link String } * */ public String getIdentifier() { return identifier; } /** * 设置identifier属性的值。 * * @param value * allowed object is * {@link String } * */ public void setIdentifier(String value) { this.identifier = value; } /** * 获取id属性的值。 * * @return * possible object is * {@link String } * */ public String getId() { return id; } /** * 设置id属性的值。 * * @param value * allowed object is * {@link String } * */ public void setId(String value) { this.id = value; } /** * Gets the value of the clazz property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the clazz property. * * <p> * For example, to add a new item, do as follows: * <pre> * getClazz().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getClazz() { if (clazz == null) { clazz = new ArrayList<String>(); } return this.clazz; } /** * 获取lang属性的值。 * * @return * possible object is * {@link String } * */ public String getLang() { return lang; } /** * 设置lang属性的值。 * * @param value * allowed object is * {@link String } * */ public void setLang(String value) { this.lang = value; } /** * 获取label属性的值。 * * @return * possible object is * {@link String } * */ public String getLabel() { return label; } /** * 设置label属性的值。 * * @param value * allowed object is * {@link String } * */ public void setLabel(String value) { this.label = value; } /** * 获取base属性的值。 * * @return * possible object is * {@link String } * */ public String getBase() { return base; } /** * 设置base属性的值。 * * @param value * allowed object is * {@link String } * */ public void setBase(String value) { this.base = value; } }
[ "lucky@126.com" ]
lucky@126.com
b27c07f770ebf5482d9516a5f465897f037084c4
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/median/1c2bb3a40a82cba97b2937bc6825903a28ecfe91f993fc177a0f2ae003bcc7b1073eb49e35d3f0f69d6b612e8347e9c1b93306bf25a7e5390098c1a06845baac/000/mutations/25/median_1c2bb3a4_000.java
9e9eb5558ecba6e13e4d0d36db12fc2ae47eb5cb
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,899
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class median_1c2bb3a4_000 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { median_1c2bb3a4_000 mainClass = new median_1c2bb3a4_000 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj x = new IntObj (), y = new IntObj (), z = new IntObj (); output += (String.format ("Please enter 3 numbers separated by spaces > ")); x.value = scanner.nextInt (); y.value = scanner.nextInt (); z.value = scanner.nextInt (); if (y.value) == (z.value) { output += (String.format ("%d is the median\n", x.value)); } if (x.value == z.value) { output += (String.format ("%d is the median\n", x.value)); } if (y.value == z.value) { output += (String.format ("%d is the median\n", y.value)); } if (true) return;; } }
[ "justinwm@163.com" ]
justinwm@163.com
6ce110afc387f926860269542010db24f48fcb77
c1d20609917174589c6562e0c905a1d16d98efd7
/1.JavaSyntax/src/com/javarush/task/task04/task0442/Solution.java
a410da4e3d8b4849a4134b642f382e0f8ee36b4f
[]
no_license
bolatashirbek/JavaRushTasks
5a459866ca85c3e7617f1b21f54031cb5db946c6
2b7bfc4290296695b4fd77f959479377a232f7cc
refs/heads/master
2022-11-26T03:51:39.613368
2020-07-23T12:10:24
2020-07-23T12:10:24
198,411,563
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.javarush.task.task04.task0442; /* Суммирование */ import java.io.*; public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int sum = 0; while (true) { int number = Integer.parseInt(reader.readLine()); sum += number; if (number == -1) { System.out.println(sum); break; } } } }
[ "bolat.89arys@mail.ru" ]
bolat.89arys@mail.ru
4a90f2bf3fa4f95992f0ef6fb9d2c54430a269ba
c5063aa6635d46c3fff05cb38de323845420e1bf
/src/main/java/com/mycompany/ejertestparam/NumComplejo.java
c440556f3e2af5471681f3b9da4d9f15c3869693
[]
no_license
LuisFerRosas/examenCom480
675ae024b3ca85bbc418df253d7cd0cfa017e2e4
f25852e8c7f75093e0685a5e02e305b2dfcdace6
refs/heads/main
2023-01-31T06:29:02.862937
2020-12-11T01:44:07
2020-12-11T01:44:07
320,436,717
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package com.mycompany.ejertestparam; public class NumComplejo { private int _parteReal; private int _parteImaginaria; public NumComplejo(int _parteReal,int _parteImaginaria) { this._parteReal = _parteReal; this._parteImaginaria = _parteImaginaria; } public int getParteReal() { return _parteReal; } public int getParteImaginaria() { return _parteImaginaria; } public NumComplejo sumar(NumComplejo c){ return new NumComplejo(this.getParteReal()+c.getParteReal(),this.getParteImaginaria()+c.getParteImaginaria()); } public NumComplejo restar(NumComplejo c){ return new NumComplejo(this.getParteReal()-c.getParteReal(),this.getParteImaginaria()-c.getParteImaginaria()); } }
[ "luis3658duran@gmail.com" ]
luis3658duran@gmail.com
0df5c3437a2fcf4c5da396c745e92e83d0868cb7
4f0f574c8c9c6cafbb74b1d241e0a94fb75ab8bf
/uriActivity/src/com/example/uriactivity/Main.java
c1fc5687dbed6afb2fc237a8052fb879a9e425bd
[]
no_license
Shuvnstuff/Projects
6bf79d71ab6f16fd5c681485bfac2368c7016f82
2007221bbbc77b79db06ec5a8bbc26787f79cc76
refs/heads/master
2020-07-14T21:47:27.000172
2020-01-07T16:35:28
2020-01-07T16:35:28
205,409,847
0
0
null
null
null
null
UTF-8
Java
false
false
3,076
java
package com.example.uriactivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.*; import android.net.*; import android.content.*; import android.annotation.SuppressLint; import android.app.*; @SuppressLint("NewApi") public class Main extends Activity implements OnClickListener{ Button webButton; Button dialButton; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = getIntent(); String action = intent.getAction(); if (action.equals(Intent.ACTION_MAIN)) { Toast testToast = Toast.makeText(this, "Ur mom", Toast.LENGTH_LONG); testToast.setGravity(android.view.Gravity.CENTER, 0, 0); testToast.show(); Intent implicitIntent = new Intent(); PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, implicitIntent, 0); Notification.Builder builder = new Notification.Builder(getApplicationContext()); builder.setSmallIcon(R.drawable.ic_launcher) ; builder.setTicker("Notify!"); builder.setContentTitle("You are Notified!"); builder.setContentText("Ur mom"); builder.setContentIntent(pendingIntent); builder.setAutoCancel(true); Notification notify = builder.build(); NotificationManager nm = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); nm.notify(0,notify); webButton = (Button)findViewById(R.id.button1); webButton.setOnClickListener(this); dialButton = (Button)findViewById(R.id.button2); dialButton.setOnClickListener(this); } else if (action.equals(Intent.ACTION_VIEW)){ Uri uri = intent.getData(); Bundle bun = intent.getExtras(); } else if (action.equals(Intent.ACTION_EDIT)){ Uri uri = intent.getData(); Bundle bun = intent.getExtras(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. MenuInflater mi = getMenuInflater(); mi.inflate(R.menu.actionbar, menu); return true; } public boolean onOptionsItemSelected(MenuItem menu) { if(item.getItemId() == R.id.actiondelete) { } else if (item.getItemId() == R.id.actionEdit) { } return super.onOptionsItemSelected(item); } public void onClick(View v) { if (v == webButton) { Uri uri = Uri.parse("https://www.amazon.com"); Intent viewIntent = new Intent(Intent.ACTION_VIEW,uri); startActivity(viewIntent); } if (v == dialButton) { Uri uri = Uri.parse("tel:1-435-850-8544"); try { Intent dialIntent = new Intent(Intent.ACTION_CALL,uri); startActivity(dialIntent); } catch(Exception e) { String errorMessage = e.getMessage(); } } } }
[ "tyson.miller@tooeleschools.org" ]
tyson.miller@tooeleschools.org
6424211717cae49c23c76337dd425767f8d8a951
117c4d7466582f2970d0188389ce3e7b2846efeb
/src/homeworks/lesson10/task4/TShirt.java
bf205339fab70cf71f3ef7a633a410be45e87547
[]
no_license
Metrauter/Ukrainian-IT_School
122b11ed1237ba47b1bb2f450b34b8ae98e2e3c9
722ca0ca6f1f7ffb7f39630f2eb185252d7f44ec
refs/heads/master
2020-03-22T04:09:16.265979
2018-09-17T18:21:37
2018-09-17T18:21:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package homeworks.lesson10.task4; public class TShirt extends Cloth implements ManCloth, WomanCloth { public TShirt(Size size, double price, String colour) { super(size, price, colour); } @Override public void clotheMan() { System.out.println("Одеваем футболку на мужчину " + getColour() + " цвета " + getSize() + " размера, стоимостью " + getPrice()); } @Override public void clotheWoman() { System.out.println("Одеваем футболку на женщину " + getColour() + " цвета " + getSize() + " размера, стоимостью " + getPrice()); } }
[ "Serg.ua92@gmail.com" ]
Serg.ua92@gmail.com
1a016b2afa5f9573774481f14692be4113f53411
7c890da84f919085a37f68608f724cb339e6a426
/zeusLamp/src/scripts/contentvalidation_stage/ContentValidation_locale_2.java
827c2c0a1b8b20ecb3809abe5a6c797010854bf8
[]
no_license
AnandSelenium/ZeusRepo
8da6921068f4ce4450c8f34706da0c52fdeb0bab
0a9bb33bdac31945b1b1a80e6475a390d1dc5d08
refs/heads/master
2020-03-23T21:38:11.536096
2018-07-24T07:26:48
2018-07-24T07:26:48
142,121,241
0
1
null
null
null
null
UTF-8
Java
false
false
4,878
java
package scripts.contentvalidation_stage; import org.openqa.selenium.JavascriptExecutor; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; import java.io.IOException; import org.testng.annotations.BeforeClass; import org.testng.annotations.Parameters; import classes.aem.AEMTechPaperPage; import classes.utilities.UtilityMethods; import com.arsin.ArsinSeleniumAPI; public class ContentValidation_locale_2{ ArsinSeleniumAPI oASelFW = null; @Parameters({ "prjName", "testEnvironment","instanceName","sauceUser","moduleName","testSetName"}) @BeforeClass public void oneTimeSetUp(String prjName,String testEnvironment,String instanceName,String sauceUser,String moduleName,String testSetName) throws InterruptedException { String[] environment=new ArsinSeleniumAPI().getEnvironment(testEnvironment,this.getClass().getName()); String os=environment[0];String browser=environment[1];String testCasename=this.getClass().getSimpleName(); oASelFW = new ArsinSeleniumAPI(prjName,testCasename,browser,os,instanceName,sauceUser,moduleName,testSetName); oASelFW.startSelenium(oASelFW.getURL("Content_Validation_URL2_Stage",oASelFW.instanceName)); } @SuppressWarnings("unused") @Test public void ContentValidation_locale_2() throws Exception { try { UtilityMethods utlmthds = new UtilityMethods(oASelFW); String[] urls = utlmthds.getValuesFromPropertiesFile("constant","Content_Validation_URL2_Stage").split(","); outer: for(int i=0;i<urls.length;i++) { try{ oASelFW.driver.get(urls[i]); Thread.sleep(20000); AEMTechPaperPage aemTpObj = new AEMTechPaperPage(oASelFW); String[] error_msg={"error_country","error_fname","error_lname","error_company_name","error_address1","error_city","error_Email","error_Phone","error_title","error_department","error_jobRole","error_relationshipVMware","error_numberEmployeesGlobal","error_respondents_comments"}; aemTpObj.click_Submit_locale(); JavascriptExecutor je = (JavascriptExecutor) oASelFW.driver; je.executeScript("window.scrollBy(0,-250)", ""); je.executeScript("window.scrollBy(0,-250)", ""); je.executeScript("window.scrollBy(0,-250)", ""); je.executeScript("window.scrollBy(0,-250)", ""); //Verifying Elements aemTpObj.verify_MainHeading("Contact Sales"); aemTpObj.verify_SubHeading("Tell Us About Yourself"); aemTpObj.verify_Description("Complete the form below to"); // aemTpObj.verify_Tags("Home"); // aemTpObj.verify_Tags("Company"); // aemTpObj.verify_Tags("Contact Sales"); //Error Validation aemTpObj.errorValidation(error_msg); //Form Filling aemTpObj.form_dropdown_locale("1","country","India"); Thread.sleep(3000); System.out.println("selected country"); aemTpObj.form_filling_locale("1", "First Name", "qa"); Thread.sleep(3000); aemTpObj.form_filling_locale("2", "Last Name", "test"); Thread.sleep(3000); aemTpObj.form_filling_locale("3", "Company", "VMware Software India Pvt Ltd"); Thread.sleep(3000); aemTpObj.form_filling_locale("4", "Address 1", "JP Nagar"); Thread.sleep(3000); aemTpObj.form_filling_locale("6", "City", "Bengaluru"); Thread.sleep(3000); aemTpObj.form_filling_locale("9", "Work Email", "qatest1215151@vmware.com"); Thread.sleep(3000); aemTpObj.form_filling_locale("10", "Business Number", "+918040440000"); Thread.sleep(3000); aemTpObj.form_filling_locale("11", "Job Title", "Test Manager"); Thread.sleep(3000); aemTpObj.form_dropdown_locale_second("2","department","IT - Project Management"); Thread.sleep(6000); aemTpObj.form_dropdown_locale_second("3","jobRole", "Analyst"); Thread.sleep(3000); aemTpObj.form_dropdown_locale_second("4","product_interest","Airwatch"); Thread.sleep(3000); /*aemTpObj.form_dropdown_locale_second("5","relationshipvmware","Customer"); Thread.sleep(3000); */ System.out.println("before VM informarion need"); aemTpObj.form_dropdown_locale_three("6","numberemployeesglobal","Less Than 100"); Thread.sleep(30000); aemTpObj.form_desc_locale("Thank You"); aemTpObj.checkbox_locale(); //click submit aemTpObj.click_Submit_locale(); Thread.sleep(70000); aemTpObj.verify_MainHeading_locale("Thank You For Contacting VMware!"); aemTpObj.get_URL(); } catch(Exception e) { continue outer; } if(oASelFW.sResultFlag.contains("Fail")) { oASelFW.testNgFail(); } } } catch (Exception e) { e.printStackTrace(); } } @AfterClass public void oneTearDown() throws IOException{ oASelFW.stopSelenium(); } }
[ "seleniumauto175@gmail.com" ]
seleniumauto175@gmail.com
426e9861f84635211f254a1a427afec73823fcfa
121842652a68a80cf7d669375a29b35e72395384
/src/main/java/com/example/Application.java
44ed7616abbb4c5a13b61b20ac5d4918bfe9a4ab
[]
no_license
ilnar1999/transfer-homework
454bebe835291e9e3965caba004229ede2484ba7
bd7eaa326a6d1eb30a9d262b54903e9cfddf61d2
refs/heads/master
2023-01-03T07:33:48.989945
2020-10-31T12:55:22
2020-10-31T12:55:22
306,318,156
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.example; import com.example.runnable.TransactingRunnable; import com.example.service.AccountService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Application { private static final int TRANSACTION_THREAD_COUNT = 20; private static final Logger logger = LoggerFactory.getLogger("file-logger"); public static void main(String[] args) throws InterruptedException { ExecutorService transactionExecutorService = Executors.newFixedThreadPool(TRANSACTION_THREAD_COUNT); AccountService accountService = new AccountService(); logger.info("initial count of money: {} total: {}", accountService.getAllBalances(), accountService.getTotalBalance()); for (int i = 0; i < TRANSACTION_THREAD_COUNT; i++) { transactionExecutorService.submit(new TransactingRunnable(accountService)); } Thread.sleep(1000); logger.info("final count of money: {} total: {}", accountService.getAllBalances(), accountService.getTotalBalance()); } }
[ "ilnar_khafizov@epam.com" ]
ilnar_khafizov@epam.com
7a13ba011cd275e8954d355017e026a2139903bc
e8aa716d4f49d7423fadcfb9e7e04ac3e37d7034
/ShopMall/src/com/j1823/ShoppingMall/test/Mytset.java
307e629e966dbc8b756ef549d0128b1a74b4e12d
[]
no_license
hmc1034399191/hmcRepository
aee811c4144b63ceb0cd61a1e4a3463bda38694c
0f0d9fbdbcba851a1442d2c2bd077753d35b371e
refs/heads/master
2020-04-24T03:11:32.852334
2019-02-21T01:15:58
2019-02-21T01:15:58
171,662,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,887
java
package com.j1823.ShoppingMall.test; import com.j1823.ShoppingMall.entity.UseresBeans; import com.j1823.ShoppingMall.service.UserService; import com.j1823.ShoppingMall.service.serviceimpl.UserServiceimpl; import com.mchange.v2.c3p0.ComboPooledDataSource; import org.junit.Test; import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Mytset { //测试连接是否正常 @Test public void conn() throws SQLException { DataSource ds = new ComboPooledDataSource();//c3p0自己去读配置文件 Connection con = ds.getConnection(); System.out.println("con:"+con); String sql="select * from Useres"; PreparedStatement pstm = con.prepareStatement(sql); ResultSet re = pstm.executeQuery(); while(re.next()){ System.out.println(re.getString(1)); System.out.println(re.getString(2)); } } @Test public void entity(){ String str="s"; String str2="se"; System.out.println(str==str2); } //检查能否正常插入用户信息 @Test//'张三','1034399191','123','男','110','湖南长沙','10357@qq.com' public void inserUser(){ UseresBeans ub = new UseresBeans(); ub.setU_name("李四"); ub.setU_usernum("0123"); ub.setU_pwd("123"); ub.setU_sex("男"); ub.setU_phone("120"); ub.setU_adds("湖南郴州"); ub.setU_emall("xx@xx.com"); UserService us=new UserServiceimpl(); int i = us.inserUser(ub); System.out.println(i); } //检查能否正常查询用户信息 @Test public void showone(){ UserService us=new UserServiceimpl(); UseresBeans ub = us.seleUser("0123"); System.out.println(ub.getU_name()); } }
[ "hmc@git.com" ]
hmc@git.com
b041eb159e458b90ed03a9cd256213b94b592429
98cb2afb67d9a91785e9338bb9df33bd81fc7670
/src/main/java/qasino/simulation/qasino/pipeline/AppendableSource.java
fc96ed4c6d86679d173f417a57180ce79851ea70
[ "MIT" ]
permissive
folkvir/qasino-simulation
31aa6e487c0e3217c7cce60e219bcf6d721106ea
2412d505381334b52048aefd44752109a6b0dc73
refs/heads/master
2020-04-06T10:20:11.411649
2019-04-30T16:08:45
2019-04-30T16:08:45
157,376,778
0
0
null
null
null
null
UTF-8
Java
false
false
1,952
java
package qasino.simulation.qasino.pipeline; import org.apache.jena.atlas.io.IndentedWriter; import org.apache.jena.graph.Triple; import org.apache.jena.shared.PrefixMapping; import org.apache.jena.sparql.core.Var; import org.apache.jena.sparql.engine.binding.Binding; import org.apache.jena.sparql.serializer.SerializationContext; import java.util.Deque; import java.util.LinkedList; import java.util.List; /** * A QueryIterator that yields bindings. Can be augmented with new Binding during query execution by calling the "append" method. * * @author Thomas Minier */ public class AppendableSource implements QueryIteratorPlus { private Triple triple; private List<Var> vars; private Deque<Binding> buffer; public AppendableSource(Triple triple, List<Var> vars) { this.triple = triple; this.vars = vars; buffer = new LinkedList<>(); // LinkedList because we just add and remove } public Triple getTriple() { return triple; } @Override public List<Var> getVars() { return vars; } public void append(Binding b) { buffer.addLast(b); } @Override public void output(IndentedWriter out, SerializationContext sCxt) { out.printf(buffer.toString()); } @Override public String toString(PrefixMapping pmap) { return "AppendableSource(" + triple.toString() + ")"; } @Override public Binding nextBinding() { return buffer.pop(); } @Override public void cancel() { // we cannot cancel a streaming pipeline } @Override public boolean hasNext() { return !buffer.isEmpty(); } @Override public Binding next() { return nextBinding(); } @Override public void output(IndentedWriter out) { out.printf(triple.toString()); } @Override public void close() { // we cannot close a streaming pipeline } }
[ "folkvir@outlook.fr" ]
folkvir@outlook.fr
fba01bb4ae38a4ec071e528e6392ea55aff6b1da
0f5c861cd3a2703ebdf7f76037643114f40f7155
/app/src/main/java/com/templar/sellerplatform/ui/adapter/OrderAdapter.java
0f7df063e046de01ba0e6a73601be386d58a661f
[]
no_license
ForeverLover/SellerPlatform
7cc94bd56e34ea84f92eab3375c4009d0058ad6b
3e2ae91dd1a7610f269d413263084c282a46a09c
refs/heads/master
2021-01-10T17:20:55.491980
2016-01-27T05:44:01
2016-01-27T05:44:01
47,595,617
0
0
null
null
null
null
UTF-8
Java
false
false
7,402
java
package com.templar.sellerplatform.ui.adapter; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.view.annotation.ViewInject; import com.templar.sellerplatform.R; import com.templar.sellerplatform.entity.Order; import com.templar.sellerplatform.utils.StringUtils; import com.templar.sellerplatform.widget.CustomListView; import java.util.List; /** * 项目:SellerPlatform * 作者:Hi-Templar * 创建时间:2015/12/17 17:32 * 描述: */ public class OrderAdapter extends BaseAdapter{ private Context mContext; private List<Order> orderList; private LayoutInflater mInflater; private OrderProductAdapter adapter; public OrderAdapter(Context mContext, List<Order> orderList) { this.mContext = mContext; this.orderList = orderList; mInflater=LayoutInflater.from(mContext); } @Override public int getCount() { return orderList.size(); } @Override public Order getItem(int position) { return orderList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder=null; if (convertView==null){ convertView=mInflater.inflate(R.layout.order_item_layout,null); holder=new ViewHolder(convertView); convertView.setTag(holder); }else{ holder= (ViewHolder) convertView.getTag(); holder.order_item_commonOp.setVisibility(View.GONE); holder.order_item_specialOp.setVisibility(View.GONE); } final Order order = getItem(position); if (order != null) { holder.order_addr_tv.setText(order.getOrderAddr()); holder.order_remark_tv.setText(order.getOrderRemark()); holder.order_item_orderNo.setText(order.getOrderNo()); holder.order_item_type.setText(order.getOrderType()); holder.order_item_buyerTime.setText(order.getBuyerName() + " - " + StringUtils.getTweenTime(order.getOrderTime(), mContext)); holder.order_item_totalPrice.setText(order.getOrderPrice() + mContext.getString(R.string.unit_yuan_text)); if (order.getProductList() != null && !order.getProductList().isEmpty()) { adapter = new OrderProductAdapter(order.getProductList(), mContext); holder.order_product_lv.setAdapter(adapter); } int currentState = order.getState(); switch (currentState) { case 0: holder.order_item_commonOp.setText(mContext.getString(R.string.order_state_accept)); holder.order_item_commonOp.setVisibility(View.VISIBLE); break; case 1: holder.order_item_specialOp.setText(mContext.getString(R.string.order_state_deal)); holder.order_item_specialOp.setVisibility(View.VISIBLE); break; case 2: holder.order_item_specialOp.setText(mContext.getString(R.string.order_state_take)); holder.order_item_specialOp.setVisibility(View.VISIBLE); break; case 3: holder.order_item_commonOp.setText(mContext.getString(R.string.order_state_unfinish)); holder.order_item_commonOp.setTextColor(mContext.getResources().getColor(R.color.white)); holder.order_item_commonOp.setBackgroundResource(R.drawable.btn_gray_bg); holder.order_item_commonOp.setVisibility(View.VISIBLE); holder.order_item_decline.setText(mContext.getString(R.string.order_decline_prefix).concat(order.getRemainingTime()).concat(mContext.getString(R.string.order_decline_suffix_minute))); holder.order_item_decline.setVisibility(View.VISIBLE); holder.order_item_specialOp.setText(mContext.getString(R.string.order_state_finished)); holder.order_item_specialOp.setTextColor(Color.parseColor("#cccccc")); holder.order_item_specialOp.setBackgroundResource(R.drawable.solid_rounded_box_gray); holder.order_item_specialOp.setVisibility(View.VISIBLE); break; case 4: holder.order_item_commonOp.setText(mContext.getString(R.string.order_state_unfinish)); holder.order_item_commonOp.setTextColor(mContext.getResources().getColor(R.color.white)); holder.order_item_commonOp.setBackgroundResource(R.drawable.btn_light_gray_bg); holder.order_item_commonOp.setVisibility(View.VISIBLE); holder.order_item_specialOp.setText(mContext.getString(R.string.order_state_finished)); holder.order_item_specialOp.setVisibility(View.VISIBLE); holder.order_item_decline.setText(mContext.getString(R.string.order_decline_prefix).concat(order.getRemainingTime()).concat(mContext.getString(R.string.order_decline_suffix_minute))); holder.order_item_decline.setVisibility(View.VISIBLE); break; case 5: holder.order_item_commonOp.setText(mContext.getString(R.string.order_state_finished)); holder.order_item_commonOp.setTextColor(Color.parseColor("#fdfdfd")); holder.order_item_commonOp.setBackgroundResource(R.drawable.btn_light_gray_bg); holder.order_item_commonOp.setVisibility(View.VISIBLE); break; } holder.order_item_commonOp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); holder.order_item_specialOp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } return convertView; } class ViewHolder{ @ViewInject(R.id.order_item_orderNo) private TextView order_item_orderNo; @ViewInject(R.id.order_item_buyerTime) private TextView order_item_buyerTime; @ViewInject(R.id.order_item_type) private TextView order_item_type; @ViewInject(R.id.order_addr_tv) private TextView order_addr_tv; @ViewInject(R.id.order_remark_tv) private TextView order_remark_tv; @ViewInject(R.id.order_item_totalPrice) private TextView order_item_totalPrice; @ViewInject(R.id.order_item_decline) private TextView order_item_decline; @ViewInject(R.id.order_item_commonOp) private TextView order_item_commonOp; @ViewInject(R.id.order_item_specialOp) private TextView order_item_specialOp; @ViewInject(R.id.order_product_lv) private CustomListView order_product_lv; public ViewHolder(View itemView) { ViewUtils.inject(this, itemView); } } }
[ "516885817@qq.com" ]
516885817@qq.com
6893cdb650cc33f6a215a6bb5968f2589fe4cf3f
2ee73c10aae5f38ada1b7164b60b228655ba879e
/src/main/java/com/tseong/learning/basic/nio/_06_GatherScatterDemo.java
96d26039b10066fb5d8e43591984fcaf80d2516f
[]
no_license
shawn-zhong/JavaLearning
f5f43da9d0b83036f29a0d650726976a40d96f83
7e124d294c736c4f2010043211aee389c71ad96f
refs/heads/master
2021-04-27T06:29:45.940324
2020-10-30T07:55:25
2020-10-30T07:55:25
122,615,400
1
0
null
2021-03-12T21:56:32
2018-02-23T11:55:41
Java
UTF-8
Java
false
false
3,996
java
package com.tseong.learning.basic.nio; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; /* scatter/gather指的在多个缓冲区上实现一个简单的I/O操作,比如从通道中读取数据到多个缓冲区,或从多个缓冲区中写入数据到通道; scatter(分散):指的是从通道中读取数据分散到多个缓冲区Buffer的过程,该过程会将每个缓存区填满,直至通道中无数据或缓冲区没有空间; gather(聚集):指的是将多个缓冲区Buffer聚集起来写入到通道的过程,该过程类似于将多个缓冲区的内容连接起来写入通道; */ public class _06_GatherScatterDemo { static private final int HEADER_LENGTH = 5; static private final int BODY_LENGTH = 10; public static void main(String[] args) throws Exception { int port = 8080; ServerSocketChannel ssc = ServerSocketChannel.open(); InetSocketAddress address = new InetSocketAddress(port); ssc.socket().bind(address); int messageLentgh = HEADER_LENGTH + BODY_LENGTH; ByteBuffer[] buffers = new ByteBuffer[2]; buffers[0] = ByteBuffer.allocate(HEADER_LENGTH); // header buffer buffers[1] = ByteBuffer.allocate(BODY_LENGTH); // body buffer SocketChannel sc = ssc.accept(); int byteRead = 0; while (byteRead < messageLentgh) { long r = sc.read(buffers); // scatter 读取 byteRead += r; System.out.println("r " + r); for (int i=0; i<buffers.length; i++) { ByteBuffer bb = buffers[i]; System.out.println("b" + i + " position : " + bb.position()); } } // pay message // flip buffer for (int i=0; i<buffers.length; i++) { ByteBuffer bb = buffers[i]; bb.flip(); } // scatter write long byteWrite = 0; while (byteWrite < messageLentgh) { long r = sc.write(buffers); // gather 写入 byteWrite += r; } // clear buffers for (int i=0; i<buffers.length; i++) { ByteBuffer bb = buffers[i]; bb.clear(); } System.out.println(byteRead + " " + byteWrite + " " + messageLentgh); } } /* public interface ScatteringByteChannel extends ReadableByteChannel { public long read(ByteBuffer[] dsts) throws IOException; public long read(ByteBuffer[] dsts, int offset, int length) throws IOException; } public interface GatheringByteChannel extends WritableByteChannel { public long write(ByteBuffer[] srcs) throws IOException; public long write(ByteBuffer[] srcs, int offset, int length) throws IOException; } 提醒下,带offset和length参数的read( ) 和write( )方法可以让我们只使用缓冲区数组的子集,注意这里的offset指的是缓冲区数组索引,而不是Buffer数据的索引,length指的是要使用的缓冲区数量; 如下代码,将会往通道写入第二个、第三个、第四个缓冲区内容; int bytesRead = channel.write (fiveBuffers, 1, 3); 注意,无论是scatter还是gather操作,都是按照buffer在数组中的顺序来依次读取或写入的; ByteBuffer header = ByteBuffer.allocate(128); ByteBuffer body = ByteBuffer.allocate(1024); //write data into buffers ByteBuffer[] bufferArray = { header, body }; channel.write(bufferArray); 以上代码会将header和body这两个缓冲区的数据写入到通道; 这里要特别注意的并不是所有数据都写入到通道,写入的数据要根据position和limit的值来判断,只有position和limit之间的数据才会被写入; 举个例子,假如以上header缓冲区中有128个字节数据,但此时position=0,limit=58;那么只有下标索引为0-57的数据才会被写入到通道中; */
[ "tseong@foxmail.com" ]
tseong@foxmail.com
d3da4b7477fb3246ffca640bfbe48fcdcce528c8
a28ec548b942eb9428ee15306c400edcbcb9cf07
/mybatis01-初识/src/main/java/com/kuang/utils/MybatisUtils.java
f5b09a8c085ca7c5868bfd5fb668e2005a7154b3
[]
no_license
Archer-Fang/mybatis-study
72192ba6b7d0833039545b85dfaa2bf9b45bdfc2
32fcc322832925188cc384e80ef78f17d5dbece9
refs/heads/main
2023-03-04T09:23:57.137734
2021-02-10T08:27:03
2021-02-10T08:27:03
334,070,879
1
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
package com.kuang.utils; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.IOException; import java.io.InputStream; /** * @author :fzj * @date :2021/1/8 */ //sqlSessionFactory --> sqlSession public class MybatisUtils { private static SqlSessionFactory sqlSessionFactory; static { try { //使用mybatis第一步:获取sqlSessionFactory对象 String resource = "mybatis-config.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); } catch (IOException e) { e.printStackTrace(); } } //获取SqlSession连接 public static SqlSession getSession(){ return sqlSessionFactory.openSession(); } public static void main(String[] args) { getSession(); } }
[ "1091053002@qq.com" ]
1091053002@qq.com
c7be8c6fa7b6167c4f4af63e2c5aabcea74ed786
caa81697008068d6ada496174974e4174c5ad3f5
/src/main/java/com/jingyunbank/etrade/goods/entity/GoodsDaoEntity.java
8f2c6b3846c68661f506ba7bd79ea7f3dbbe2685
[]
no_license
marktowhen/gule-trade
9abd7f7521031542eb5c3b2a30b1f924fdc94646
6cd70a414f5c2aad3a6c205c1ef7731626fdf267
refs/heads/master
2021-01-20T18:28:17.919193
2016-07-06T01:31:45
2016-07-06T01:31:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
288
java
package com.jingyunbank.etrade.goods.entity; import com.jingyunbank.etrade.api.goods.bo.BaseGoods; /** * * Title: DAO的商品类 * * @author duanxf * @date 2015年11月4日 */ public class GoodsDaoEntity extends BaseGoods { private static final long serialVersionUID = 1L; }
[ "duanxiaofeng@jingyunbank.com" ]
duanxiaofeng@jingyunbank.com
a5fec1ff2f49091a24a92cc5ffb0a820e46b662d
4636eb9cf8d28e4069d4a9e6199e3608c1a63cad
/src/main/java/bouzekri/khalil/myblog/config/DefaultProfileUtil.java
01b7d28a9f0b751e9e22294bfe2aacfa1527513c
[]
no_license
BulkSecurityGeneratorProject4/myblog
879c642c00dc7e613c64fed7fa42a78a8e0cc6fb
7f6c02c6a62ebab08b7733f3b1bbca3543567abd
refs/heads/master
2022-12-18T09:53:52.768006
2017-08-16T04:14:12
2017-08-16T04:14:12
296,669,168
0
0
null
2020-09-18T16:07:14
2020-09-18T16:07:13
null
UTF-8
Java
false
false
1,718
java
package bouzekri.khalil.myblog.config; import io.github.jhipster.config.JHipsterConstants; import org.springframework.boot.SpringApplication; import org.springframework.core.env.Environment; import java.util.*; /** * Utility class to load a Spring profile to be used as default * when there is no <code>spring.profiles.active</code> set in the environment or as command line argument. * If the value is not available in <code>application.yml</code> then <code>dev</code> profile will be used as default. */ public final class DefaultProfileUtil { private static final String SPRING_PROFILE_DEFAULT = "spring.profiles.default"; private DefaultProfileUtil() { } /** * Set a default to use when no profile is configured. * * @param app the Spring application */ public static void addDefaultProfile(SpringApplication app) { Map<String, Object> defProperties = new HashMap<>(); /* * The default profile to use when no other profiles are defined * This cannot be set in the <code>application.yml</code> file. * See https://github.com/spring-projects/spring-boot/issues/1219 */ defProperties.put(SPRING_PROFILE_DEFAULT, JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); app.setDefaultProperties(defProperties); } /** * Get the profiles that are applied else get default profiles. * * @param env spring environment * @return profiles */ public static String[] getActiveProfiles(Environment env) { String[] profiles = env.getActiveProfiles(); if (profiles.length == 0) { return env.getDefaultProfiles(); } return profiles; } }
[ "bouzekri.khalil@gmail.com" ]
bouzekri.khalil@gmail.com
3ba1343d16c53d53135ab4e2894f5e712351c17c
da0c75ecd1ec4bd305c18c8d55c470b881134fd2
/android/app/src/main/java/com/deckofcards/MainActivity.java
96b29e772f1bfc1bdb9eecaf856a75685f22d58d
[]
no_license
joypatel04/DeckOfCards
9e314e2ae3b40adfc0a7757f0341b077ea3967b4
88aa4f72ad365f270b28e92cb8ed2be47887c542
refs/heads/master
2023-03-04T12:04:27.848427
2021-02-10T09:37:02
2021-02-10T09:37:02
337,672,583
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package com.deckofcards; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "DeckOfCards"; } }
[ "joy@betterhalf.ai" ]
joy@betterhalf.ai
0a2a6d5e936c95dcb548b1b25c42d243e1b826fe
1c2f80c42d910e32b2af30ac42ebe032c236a832
/src/main/java/org/overbaard/jira/impl/OverbaardFacadeImpl.java
7db2563dcbd828d73b4b332f3c1b86a2aa162ab4
[]
no_license
kabir/overbaard-redux
09395946f14206573f4742c1b25698c2248615a7
963caca98ca84f1db98a3ee57485cc74b24f82f6
refs/heads/master
2020-12-03T01:57:38.586823
2018-05-01T16:34:21
2018-05-01T16:34:21
95,884,422
0
1
null
2018-03-21T16:01:53
2017-06-30T11:59:53
Java
UTF-8
Java
false
false
6,102
java
/* * Copyright 2016 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.overbaard.jira.impl; import java.io.InputStream; import java.util.jar.Manifest; import javax.inject.Inject; import javax.inject.Named; import org.jboss.dmr.ModelNode; import org.overbaard.jira.OverbaardLogger; import org.overbaard.jira.api.BoardConfigurationManager; import org.overbaard.jira.api.BoardManager; import org.overbaard.jira.api.JiraFacade; import org.overbaard.jira.api.UserAccessManager; import org.overbaard.jira.impl.config.BoardConfig; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import com.atlassian.jira.issue.search.SearchException; import com.atlassian.jira.user.ApplicationUser; @Named ("overbaardJiraFacade") public class OverbaardFacadeImpl implements JiraFacade, InitializingBean, DisposableBean { private final BoardConfigurationManager boardConfigurationManager; private final BoardManager boardManager; private final UserAccessManager userAccessManager; private static final String overbaardVersion; static { String version; try (InputStream stream = OverbaardFacadeImpl.class.getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF")) { Manifest manifest = null; if (stream != null) { manifest = new Manifest(stream); } version = manifest.getMainAttributes().getValue("Bundle-Version"); } catch (Exception e) { // ignored version = "Error"; } overbaardVersion = version; } @Inject public OverbaardFacadeImpl(final BoardConfigurationManager boardConfigurationManager, final BoardManager boardManager, final UserAccessManager userAccessManager) { this.boardConfigurationManager = boardConfigurationManager; this.boardManager = boardManager; this.userAccessManager = userAccessManager; } @Override public String getBoardConfigurations(ApplicationUser user) { return boardConfigurationManager.getBoardsJson(user, true); } @Override public String getBoardJsonForConfig(ApplicationUser user, int boardId) { return boardConfigurationManager.getBoardJsonConfig(user, boardId); } @Override public void saveBoardConfiguration(ApplicationUser user, int id, String jiraUrl, ModelNode config) { BoardConfig boardConfig = boardConfigurationManager.saveBoard(user, id, config); if (id >= 0) { //We are modifying a board's configuration. Delete the board config and board data to force a refresh. boardManager.deleteBoard(user, boardConfig.getCode()); } } @Override public void deleteBoardConfiguration(ApplicationUser user, int id) { final String code = boardConfigurationManager.deleteBoard(user, id); boardManager.deleteBoard(user, code); } @Override public String getBoardJson(ApplicationUser user, boolean backlog, String code) throws SearchException { try { return boardManager.getBoardJson(user, backlog, code); } catch (Exception e) { //Last parameter is the exception (it does not match a {} entry) OverbaardLogger.LOGGER.debug("BoardManagerImpl.handleEvent - Error loading board {}", code, e); if (e instanceof SearchException || e instanceof RuntimeException) { throw e; } throw new RuntimeException(e); } } @Override public String getBoardsForDisplay(ApplicationUser user) { return boardConfigurationManager.getBoardsJson(user, false); } @Override public String getChangesJson(ApplicationUser user, boolean backlog, String code, int viewId) throws SearchException { return boardManager.getChangesJson(user, backlog, code, viewId); } @Override public void saveCustomFieldId(ApplicationUser user, ModelNode idNode) { boardConfigurationManager.saveRankCustomFieldId(user, idNode); } @Override public String getStateHelpTexts(ApplicationUser user, String boardCode) { return boardConfigurationManager.getStateHelpTextsJson(user, boardCode); } @Override public String getOverbaardVersion() { return overbaardVersion; } @Override public void logUserAccess(ApplicationUser user, String boardCode, String userAgent) { userAccessManager.logUserAccess(user, boardCode, userAgent); } @Override public String getUserAccessJson(ApplicationUser user) { return userAccessManager.getUserAccessJson(user); } @Override public void updateParallelTaskForIssue(ApplicationUser user, String boardCode, String issueKey, int taskIndex, int optionIndex) throws SearchException{ try { boardManager.updateParallelTaskForIssue(user, boardCode, issueKey, taskIndex, optionIndex); } catch (Exception e) { //Last parameter is the exception (it does not match a {} entry) OverbaardLogger.LOGGER.debug("BoardManagerImpl.handleEvent - Error updating board {}", boardCode, e); if (e instanceof SearchException || e instanceof RuntimeException) { throw e; } throw new RuntimeException(e); } } @Override public void afterPropertiesSet() throws Exception { } @Override public void destroy() throws Exception { } }
[ "kkhan@redhat.com" ]
kkhan@redhat.com
01af60ae9334199a6a8d3e1ee932049e97775efe
7c4edc901b6f01ccc2de765e545916c4b5c1dfde
/Problems/ReverseStringWords.java
a145ed2e378d0fbbb5a5fb018778773a5eb15f05
[]
no_license
DamoneMX/practice-exercises
6ef9754e2e30195c2756c3346d0dc0aae97df041
1e91efaaf7caa0842f5fd82a2f1aa172428ba4c5
refs/heads/master
2021-01-25T04:01:49.729705
2014-12-06T20:43:53
2014-12-06T20:43:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
//TODO: REPEAT THIS! public class Solution { public String reverseWords(String s) { if(s.isEmpty() || s.length() == 0) return s; StringBuffer res = new StringBuffer(); int t, h; for(int i = s.length() - 1; i >= 0; i--) { while(i >= 0 && s.charAt(i) == ' ') i--; // set tail pointer if(i < 0) break; t = i; h = t; // set head pointer while(i >= 0 && s.charAt(i) != ' ') { h = i; i--; } // append this word (append a space if find more than two words) if(h <= t && res.length() > 0) res.append(' '); for(int j = h; j <= t; j++) { res.append(s.charAt(j)); } } return res.toString(); } }
[ "arie@dadabureau.com" ]
arie@dadabureau.com
35232b8f7c0c121660e644cbd76c54fb7fc5e011
78a1d443196d812f10852bb13b40e66d61e7de16
/src/main/java/org/atomic/java/catalog/collections/map/IdentityHashMapExample.java
2b37e87c4bd4dd8abac4528c3df4d5a601149b9e
[]
no_license
atomicworld/knowledge
645a29b81f527adb6e19f1eb5b64cd4f305440ff
354168221eb74c55e2cc43b2231abea6552c7cef
refs/heads/master
2020-05-09T18:00:43.416558
2019-05-12T11:02:30
2019-05-12T11:02:30
181,322,141
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
package org.atomic.java.catalog.collections.map; import java.util.IdentityHashMap; import java.util.Map; public class IdentityHashMapExample { public static void main(String[] args) { //IdentityHashMap使用=================================== Map<String, String> identityHashMap = new IdentityHashMap<>(); identityHashMap.put(new String("a"), "1"); identityHashMap.put(new String("a"), "2"); identityHashMap.put(new String("a"), "3"); System.out.println(identityHashMap.size()); //3 Map<Person, String> identityHashMap2 = new IdentityHashMap<>(); identityHashMap2.put(new Person(1), "1"); identityHashMap2.put(new Person(1), "2"); identityHashMap2.put(new Person(1), "3"); System.out.println(identityHashMap2.size()); //3 Map<PersonOverWrite, String> identityHashMap3 = new IdentityHashMap<>(); identityHashMap3.put(new PersonOverWrite(1), "1"); identityHashMap3.put(new PersonOverWrite(1), "2"); identityHashMap3.put(new PersonOverWrite(1), "3"); System.out.println(identityHashMap3.size()); //3 } }
[ "huangwen9@wanda.cn" ]
huangwen9@wanda.cn
7e9254834567cd2d89e14b2346fd5eee05e7746e
a8595c2b7a8f9ded844e7ace8517b4423a692736
/erp2_entity/src/main/java/com/itcast/erp/entity/Returnorderdetail.java
09e9fd4aa7a4ed1e28f24774c9007bcc9291e528
[]
no_license
yzzzyk/ERP
8c1971d81ddc9a52a8d3d0886debb5a2907086f4
cefdda7d03a86a65558b2b47806c540d7f9fe88d
refs/heads/master
2020-05-04T16:33:53.159083
2020-04-13T16:04:50
2020-04-13T16:04:50
179,281,282
0
0
null
null
null
null
UTF-8
Java
false
false
2,275
java
package com.itcast.erp.entity; import com.alibaba.fastjson.annotation.JSONField; /** * 退货订单明细实体类 * @author Administrator * */ public class Returnorderdetail { private Long uuid;//编号 private Long goodsuuid;//商品编号 private String goodsname;//商品名称 private Double price;//价格 private Long num;//数量 private Double money;//金额 private java.util.Date endtime;//结束日期 private Long ender;//库管员 private Long storeuuid;//仓库编号 private String state;//状态 /** * 1=已入库 */ public static final String STATE_IN="1"; /** * 0=未入库 */ public static final String STATE__NOT_IN="0"; /** * 0=未出库 */ public static final String STATE__NOT_OUT="0"; /** * 1=已出库 */ public static final String STATE__OUT="1"; //表达多对一 @JSONField(serialize=false) private Returnorders returnorders;//退货订单 public Long getUuid() { return uuid; } public void setUuid(Long uuid) { this.uuid = uuid; } public Long getGoodsuuid() { return goodsuuid; } public void setGoodsuuid(Long goodsuuid) { this.goodsuuid = goodsuuid; } public String getGoodsname() { return goodsname; } public void setGoodsname(String goodsname) { this.goodsname = goodsname; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public Long getNum() { return num; } public void setNum(Long num) { this.num = num; } public Double getMoney() { return money; } public void setMoney(Double money) { this.money = money; } public java.util.Date getEndtime() { return endtime; } public void setEndtime(java.util.Date endtime) { this.endtime = endtime; } public Long getEnder() { return ender; } public void setEnder(Long ender) { this.ender = ender; } public Long getStoreuuid() { return storeuuid; } public void setStoreuuid(Long storeuuid) { this.storeuuid = storeuuid; } public String getState() { return state; } public void setState(String state) { this.state = state; } public Returnorders getReturnorders() { return returnorders; } public void setReturnorders(Returnorders returnorders) { this.returnorders = returnorders; } }
[ "you@example.com" ]
you@example.com
807d4d2fcc8b26f606aba273abc6912629244238
f24971da11abd8baa2007952f3291f4cae145810
/Product/Production/Common/AurionCoreLib/src/main/java/org/alembic/aurion/hiem/adapter/unsubscribe/AdapterHiemUnsubscribeOrchImpl.java
58f130dcf513cde8a73a94936c7ebc8a71c1097d
[]
no_license
AurionProject/Aurion_4.1
88e912dd0f688dea2092c80aff3873ad438d5aa9
db21f7fe860550baa7942c1d78e49eab3ece82db
refs/heads/master
2021-01-17T15:41:34.372017
2015-12-21T21:09:42
2015-12-21T21:09:42
49,459,325
0
2
null
null
null
null
UTF-8
Java
false
false
738
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.alembic.aurion.hiem.adapter.unsubscribe; import org.alembic.aurion.common.nhinccommon.AssertionType; import org.alembic.aurion.hiem.consumerreference.ReferenceParametersElements; import org.oasis_open.docs.wsn.b_2.Unsubscribe; import org.oasis_open.docs.wsn.b_2.UnsubscribeResponse; /** * * @author JHOPPESC */ public class AdapterHiemUnsubscribeOrchImpl { public UnsubscribeResponse unsubscribe(Unsubscribe unsubscribeElement, ReferenceParametersElements referenceParametersElements, AssertionType assertion) { UnsubscribeResponse response = new UnsubscribeResponse(); return response; } }
[ "leswestberg@fake.com" ]
leswestberg@fake.com
9b0d2320703517474ebe4d1c09bc34be57713c70
d510789b626fc801ac9dd000a441703469665e39
/Java/04/04_praktiniai_loops/04_16.RepeatingBreakingAndRemembering/src/main/java/RepeatingBreakingAndRemembering.java
6594aea5171a5a2172fc7df2df004fe5fab10fc5
[ "MIT" ]
permissive
apuokenas/PROFKE
17817843f451390bb98b696cb61f0de8b1b82b3e
1309897ea5dd9e5871f5aef0acbad4b1b6e9acc6
refs/heads/master
2022-12-26T04:38:46.008048
2020-10-08T16:20:18
2020-10-08T16:20:18
294,228,422
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
import java.util.Scanner; public class RepeatingBreakingAndRemembering { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Give numbers:"); int number = 0; int sum = 0; int nos = 0; int evenNos = 0; int oddNos = 0; while (number != -1) { number = Integer.parseInt(scanner.nextLine()); if (number != -1) { sum = sum + number; nos = nos + 1; if (number % 2 == 0) { evenNos = evenNos + 1; } else { oddNos = oddNos + 1; } } } if (number == -1) { System.out.println("Thx! Bye!"); System.out.println("Sum: " + sum); System.out.println("Numbers: " + nos); System.out.println("Average: " + (double) sum / nos); System.out.println("Even: " + evenNos); System.out.println("Odd: " + oddNos); } scanner.close(); } }
[ "mantas@tumenas.eu" ]
mantas@tumenas.eu
dbdb52f68bedbf8733c24b43749424ea8550bc8b
b0cf3162cbd4f7f73db5c5f73c9ed3ba9118e99f
/service/src/main/java/com/mmf/db/dao/jpa/DisciplineTimeDaoImpl.java
c2358978b894a6e835f2b495c8406bee721d4405
[]
no_license
svoyteh/ownTranslator
3fa06749c1c5e8d13d2399d58b3a886cf5f5f1cd
67cff7f11076b90bfc4461c3c1537d2f39f04c07
refs/heads/master
2020-04-07T12:24:33.707653
2014-02-16T10:58:00
2014-02-16T10:58:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package com.mmf.db.dao.jpa; import com.mmf.db.dao.DisciplineTimeDao; import com.mmf.db.model.DisciplineTimeEntity; import javax.inject.Named; /** * User: svetlana.voyteh * Date: 20.03.13 */ @Named public class DisciplineTimeDaoImpl extends GenericJpaDao<Long, DisciplineTimeEntity> implements DisciplineTimeDao { @Override protected Class<DisciplineTimeEntity> getEntityClass() { return DisciplineTimeEntity.class; } }
[ "yasvedko@gmail.com" ]
yasvedko@gmail.com
575c197eb510fcd6465558a6b5cb4d6dd03e874c
5d632f8a23c6519987f6395bb833d765e4d415c9
/CafeProject/CafeProject/src/main/java/com/cafe/controller/HomeController.java
d51d0a2917d8523a356e511043ee0a0208e85447
[]
no_license
nvphap/CafeProject
48396cbbcc7a0beda576b62e6c8640657eca49f8
f227e518bac1e00a9ab1adc96adf47be0556e139
refs/heads/master
2021-01-21T13:36:49.426506
2016-05-01T07:14:46
2016-05-01T07:14:46
54,258,919
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
/** \* The LoginController is using for user login. * * @author DoanTT * DatHQ * @version 1.0 * @since 2015-05-04 * @update 2015-05-06 */ package com.cafe.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; 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.webflow.engine.model.Model; import com.cafe.base.controller.BaseController; /** * The login action. * * @author phap.nguyen * @version 1.0 * @since 2015-06-30 * @update */ @Controller public class HomeController extends BaseController { /** * The welcome action mapping home * * @author phap.nguyen * @date 2015-06-30 * */ private static Logger LOG; static { LOG = Logger.getLogger(HomeController.class); } @RequestMapping(value = "language", method = RequestMethod.GET) public String tranlate(HttpServletRequest request, Model model, HttpSession session, @RequestParam(value = "lang", required = false) final String sLanguage) { LOG.info("language"); return "redirect:/login?lang=" + sLanguage; } @RequestMapping(value = "/error", method = RequestMethod.GET) public String errorLogin(HttpSession session) { LOG.info("/error"); return "error"; } @RequestMapping(value = "/noPermission", method = RequestMethod.GET) public String hasNoPermission(HttpSession session) { LOG.info("/noPermission"); return "noPermission"; } @RequestMapping(value = "/home", method = RequestMethod.GET) public String home(HttpSession session) { LOG.info("/home"); return "redirect: /reservation/list/therapistTimeline"; } }
[ "nvphap@gmail.com" ]
nvphap@gmail.com
4a499bb26ef92499c8ca15c60b82cd183fd02789
a4d071750f5f725ef76e793e159bdd53b0082304
/src/main/java/com/wixct/blogapi/repository/package-info.java
309f67bb3e13d6ee4bc46d2128252ec33f09e017
[ "Apache-2.0" ]
permissive
wxcmyx/wixctapi
f13703c608bfc769e60994ae19e9c977590034f3
52f033de1912492ffd6c44b2003bb6b0b4cd85ce
refs/heads/master
2022-08-20T20:18:57.264394
2020-01-11T10:34:35
2020-01-11T10:34:35
163,984,596
0
0
Apache-2.0
2022-07-07T16:58:41
2019-01-03T14:39:18
Java
UTF-8
Java
false
false
77
java
/** * Spring Data JPA Repositories */ package com.wixct.blogapi.repository;
[ "wxcmyx@163.com" ]
wxcmyx@163.com
29c8b99a074963754dd217753917ef32616b6214
1766bda9966f5674eaa6fdb84e46277f5b3bc14b
/Main/src/appl/blackjack/strategies/BlackjackStrategyWizardOfOddsWizard.java
52fc3d5750b5f974cdbd22f837e1d7095fa47563
[]
no_license
bencw99/JavaWorkspace
5dd3fce99c0db44aa35e90ac84a29849ccda1bef
25ab355d42b49de965e753e9dea5188f90c5d61e
refs/heads/master
2020-05-19T21:46:31.576814
2014-08-27T15:10:29
2014-08-27T15:10:29
16,894,442
1
0
null
null
null
null
UTF-8
Java
false
false
3,510
java
package appl.blackjack.strategies; import appl.blackjack.BlackjackCard; import appl.blackjack.BlackjackHand; import appl.blackjack.strategies.BlackjackStrategy.Action; public class BlackjackStrategyWizardOfOddsWizard extends BlackjackStrategy { // Implements the Wizard Strategy from wizardofodds.com @Override public Action decide(BlackjackHand hand, BlackjackCard dealerUpCard) { if ((dealerUpCard.getValue() >= 2) && (dealerUpCard.getValue() <= 6)) { if (hand.canSplit()) { if ((hand.getCards().get(0).getValue() == 2) || (hand.getCards().get(0).getValue() == 3) || (hand.getCards().get(0).getValue() == 6) || (hand.getCards().get(0).getValue() == 7) || (hand.getCards().get(0).getValue() == 9) || (hand.getCards().get(0).getValue() == 8) || (hand.getCards().get(0).getValue() == 11)) { return Action.SPLIT; } } if (hand.hasSoftAce()) { if (hand.computeScore() <= 15) { return Action.HIT; } else if (hand.computeScore() <= 18) { return Action.DOUBLE; } else { return Action.STAND; } } else { if (hand.computeScore() <= 8) { return Action.HIT; } else if (hand.computeScore() <= 9) { return Action.DOUBLE; } else if (hand.computeScore() <= 11) { if (hand.computeScore() > dealerUpCard.getValue()) { return Action.DOUBLE; } else { return Action.HIT; } } else { return Action.STAND; } } } else { assert((dealerUpCard.getValue() >= 7) && (dealerUpCard.getValue() <= 11)); if (hand.canSplit()) { if ((hand.getCards().get(0).getValue() == 2) || (hand.getCards().get(0).getValue() == 3) || (hand.getCards().get(0).getValue() == 6) || (hand.getCards().get(0).getValue() == 7) || (hand.getCards().get(0).getValue() == 9)) { return Action.SPLIT; } } if (hand.hasSoftAce()) { if (hand.computeScore() <= 18) { return Action.HIT; } else { return Action.STAND; } } else { if (hand.computeScore() <= 9) { return Action.HIT; } else if (hand.computeScore() <= 11) { if (hand.computeScore() > dealerUpCard.getValue()) { return Action.DOUBLE; } else { return Action.HIT; } } else if (hand.computeScore() <= 16) { return Action.HIT; } else { return Action.STAND; } } } } }
[ "ben.cohenwang@gmail.com" ]
ben.cohenwang@gmail.com
0c7c423fdb5c94c327d38c6fcb2ceefae4bd3a43
63fcfae3196dff18bffe2e343d17de49e63ccf06
/australia/australia/src/main/java/steps/StepDef.java
a0c7ebc81756f9932dd946ff744616bbd9bc457e
[]
no_license
DeviVijayRaja/UIAutomation
3b80b30d89c4b7a27c12c3a54df910313843a6a5
b0f2047ea7bd50d69a629d78e25642a993f20e81
refs/heads/master
2020-04-22T01:18:44.161992
2019-02-10T18:55:01
2019-02-10T18:55:01
170,010,589
0
0
null
null
null
null
UTF-8
Java
false
false
2,661
java
package steps; import org.openqa.selenium.chrome.ChromeDriver; import cucumber.api.java.en.Given; import wdMethods.SeMethods; public class StepDef extends SeMethods { public ChromeDriver driver; public static String fName, lName, email; @Given("Open The Browser") public void openBrowser() { startApp("chrome", "http://automationpractice.com"); } @Given("Click on Sign in link") public void clickSignIn() { click(locateElement("linktext", "Sign in")); } @Given("Enter Email address as (.*)") public void enterEmail(String data) { typeWithTap(locateElement("id", "email_create"), data); } @Given("Click on Create an Account button") public void clickCreateAccount() { click(locateElement("id", "SubmitCreate")); } @Given("Verify Green or Red tick") public void verifyEmailBackColor() { } @Given("Enter Firstname as (.*)") public void enterFirstName(String data) { type(locateElement("id", "customer_firstname"), data); fName = data; } @Given("Enter Lastname as (.*)") public void enterLastName(String data) { type(locateElement("id", "customer_lastname"), data); lName = data; } @Given("Enter Password as (.*)") public void enterPassword(String data) { type(locateElement("id", "passwd"), data); } @Given("Verify Firstname,Lastname,Email pre-populated") public void verifyDetails() { verifyExactAttribute(locateElement("xpath", "//input[@id='firstname']"), "value", fName); verifyExactAttribute(locateElement("xpath", "//input[@id='lastname']"), "value", lName); } @Given("Enter Address as (.*)") public void enterAddress(String data) { type(locateElement("address1"), data); } @Given("Enter City as (.*)") public void enterCity(String data) { type(locateElement("city"), data); } @Given("Select State as (.*)") public void selectState(String data) { selectDropDownUsingText(locateElement("id_state"), data); } @Given("Enter Zipcode as (.*)") public void enterZipCode(String data) { type(locateElement("postcode"), data); } @Given("Select Country as (.*)") public void selectCountry(String value) { selectDropDownUsingText(locateElement("id","id_country"), value); } @Given("Enter MobilePhone as (.*)") public void enterMobile(String data) { type(locateElement("phone_mobile"), data); } @Given("Enter alias Address as (.*)") public void enterAlias(String data) { type(locateElement("alias"), data); } @Given("Verify whether Registration is successful") public void clickRegistration() { click(locateElement("submitAccount")); } }
[ "Devijay@LAPTOP-GHP05BCR" ]
Devijay@LAPTOP-GHP05BCR
89f760d3650cfc9ae15bdf66f7dbd913d3833c6f
5734cc40710959e0ac732bed140591714ff0f704
/app/src/main/java/com/incon/retrofitex/MyAdapter.java
474e5341e9d419971ccf58a6cbae755ad8214851
[]
no_license
ramumupparaju/RetrofitExample
32a7c68ddec03efda2d998921e00c4f6ea8599fd
bf89e5cd265b40026818384b13a873c027814625
refs/heads/master
2021-04-30T08:14:19.326227
2018-02-13T10:30:51
2018-02-13T10:30:51
121,369,313
0
0
null
null
null
null
UTF-8
Java
false
false
1,799
java
package com.incon.retrofitex; import android.content.Context; import android.media.Image; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.squareup.picasso.Picasso; import java.util.List; /** * Created by PC on 2/12/2018. */ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { List<Hero> heroLists; private Context context; public MyAdapter(List<Hero> heroLists, Context context) { this.heroLists = heroLists; this.context = context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.cardview,parent,false); return new ViewHolder(view); } @Override public void onBindViewHolder(ViewHolder holder, int position) { Hero hero=heroLists.get(position); holder.t1.setText(hero.getName()); holder.t2.setText(hero.getRealname()); Picasso.with(context).load(hero.getImageurl()).into(holder.imageView); // ApiClient.loadImageFromApi(holder.imageView.setImageResource(hero.getImageurl())); } @Override public int getItemCount() { return heroLists.size(); } public class ViewHolder extends RecyclerView.ViewHolder { public TextView t1,t2; public ImageView imageView; public ViewHolder(View itemView) { super(itemView); t1=(TextView)itemView.findViewById(R.id.text1); t2=(TextView)itemView.findViewById(R.id.text2); imageView=(ImageView)itemView.findViewById(R.id.image); } } }
[ "moonzdreamindia@gmail.com" ]
moonzdreamindia@gmail.com
7f81d79d5a197bc9820d695f3d8ff299adf8baa1
f9c0ac1ac905e0e3bca043e7860db45ce9844f2f
/src/main/java/com/liyanyan/currency/chapter08/RunnableDenyException.java
c8ab09a660edc54d68275c141e8ff31aab39f861
[]
no_license
WorseRole/JavaCurrency
712fc9bfe4f574b1dd6dc381deb22de31df654d0
579d06c03bd27c77a490fb8ee5e70e3b09aff764
refs/heads/master
2023-03-16T12:04:03.791905
2021-03-01T09:59:30
2021-03-01T09:59:30
276,548,518
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package com.liyanyan.currency.chapter08; /** * Created by liyanyan on 2020/6/3 12:42 上午 */ public class RunnableDenyException extends RuntimeException { public RunnableDenyException(String message) { super(message); } }
[ "worserole@qq.com" ]
worserole@qq.com
94316d75aa40251083e5e20227df79ace7db5424
406a874c492f8a0c7100b937226b1979fb16b17b
/JavaSamples/References/iaikPkcs11Wrapper1.2.17/java/src/iaik/pkcs/pkcs11/wrapper/CK_RSA_PKCS_OAEP_PARAMS.java
1f80020f151fe962cdf243ab12ee75243d065ce3
[ "BSD-2-Clause" ]
permissive
mrojas16/java-sample-programs
35f3bc9d0b67b26b16110cc7a7be5481b18d576a
c589b996796cf7d0248023c1c1e783c5bb86d085
refs/heads/master
2021-01-01T20:35:33.373048
2011-06-13T19:42:23
2011-06-13T19:42:23
33,686,513
0
1
null
null
null
null
ISO-8859-1
Java
false
false
4,450
java
/* Copyright (c) 2002 Graz University of Technology. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by IAIK of Graz University of * Technology." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "Graz University of Technology" and "IAIK of Graz University of * Technology" must not be used to endorse or promote products derived from * this software without prior written permission. * * 5. Products derived from this software may not be called * "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior * written permission of Graz University of Technology. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package iaik.pkcs.pkcs11.wrapper; /** * class CK_RSA_PKCS_OAEP_PARAMS provides the parameters to the * CKM_RSA_PKCS_OAEP mechanism.<p> * <B>PKCS#11 structure:</B> * <PRE> * typedef struct CK_RSA_PKCS_OAEP_PARAMS { * CK_MECHANISM_TYPE hashAlg; * CK_RSA_PKCS_OAEP_MGF_TYPE mgf; * CK_RSA_PKCS_OAEP_SOURCE_TYPE source; * CK_VOID_PTR pSourceData; * CK_ULONG ulSourceDataLen; * } CK_RSA_PKCS_OAEP_PARAMS; * </PRE> * * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at> * @author Martin Schläffer <schlaeff@sbox.tugraz.at> */ public class CK_RSA_PKCS_OAEP_PARAMS { /** * <B>PKCS#11:</B> * <PRE> * CK_MECHANISM_TYPE hashAlg; * </PRE> */ public long hashAlg; /** * <B>PKCS#11:</B> * <PRE> * CK_RSA_PKCS_OAEP_MGF_TYPE mgf; * </PRE> */ public long mgf; /** * <B>PKCS#11:</B> * <PRE> * CK_RSA_PKCS_OAEP_SOURCE_TYPE source; * </PRE> */ public long source; /** * <B>PKCS#11:</B> * <PRE> * CK_VOID_PTR pSourceData; * CK_ULONG ulSourceDataLen; * </PRE> */ public byte[] pSourceData; //CK_ULONG ulSourceDataLen; // ulSourceDataLen == pSourceData.length /** * Returns the string representation of CK_RSA_PKCS_OAEP_PARAMS. * * @return the string representation of CK_RSA_PKCS_OAEP_PARAMS */ public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(Constants.INDENT); buffer.append("hashAlg: "); buffer.append(hashAlg); buffer.append(Constants.NEWLINE); buffer.append(Constants.INDENT); buffer.append("mgf: "); buffer.append(mgf); buffer.append(Constants.NEWLINE); buffer.append(Constants.INDENT); buffer.append("source: "); buffer.append(source); buffer.append(Constants.NEWLINE); buffer.append(Constants.INDENT); buffer.append("pSourceData: "); buffer.append(pSourceData.toString()); buffer.append(Constants.NEWLINE); buffer.append(Constants.INDENT); buffer.append("pSourceDataLen: "); buffer.append(Functions.toHexString(pSourceData)); //buffer.append(Constants.NEWLINE); return buffer.toString() ; } }
[ "rafal.jackiewicz@gmail.com@6cd0eecc-fcc7-9c4d-a4d7-cddc772d36f4" ]
rafal.jackiewicz@gmail.com@6cd0eecc-fcc7-9c4d-a4d7-cddc772d36f4
998a092f9b36e3efb4cf3d12c8698125a05dc3d7
af578efc7d45c2d520e8503d2c49514f42cadf88
/Friday/Proxy/src/main/java/rest/ProxyResource.java
7ee9cdf27711a6280e8d623d3f905c951f3b3507
[]
no_license
Castau/Week39
b2a0af8fd7e9ff702b01b771c76af49240e32a2c
3b388b114ba1e9b518ca4eb1941d74c269a11951
refs/heads/master
2020-07-31T17:24:53.559377
2019-09-28T09:59:55
2019-09-28T09:59:55
210,692,786
0
0
null
2019-09-27T17:03:48
2019-09-24T20:34:17
HTML
UTF-8
Java
false
false
1,038
java
package rest; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; @Path("proxy") public class ProxyResource { @GET @Path("/url") @Produces({MediaType.APPLICATION_JSON}) public String proxymethod(@QueryParam("newurl") String newUrl) throws Exception { String url = newUrl; System.out.println("URL" + url); URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); return response.toString(); } }
[ "camilla.valerius@gmail.com" ]
camilla.valerius@gmail.com
bed60fecbcb4f6e1e707fd5ac65c5b484491f0e2
d9368906958abe94a69f68c15312686e7fedfc8a
/day16/src/api/io/rw03/FileWriterEx.java
267e5ebc62837a7ee81605a43ade3a17d30b1643
[]
no_license
ywh2995/Java
168f10d791e4623b478313fb11f11d996e206627
65888bbdde2687888362c6f6a1197b6ae013c1de
refs/heads/master
2022-11-07T01:54:02.217224
2020-06-26T03:59:58
2020-06-26T03:59:58
275,069,348
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
package api.io.rw03; import java.io.FileWriter; public class FileWriterEx { public static void main(String[] args) { /* * 문자를 써서 저장할 때 사용하는 클래스는 FileWriter클래스 입니다. * 기본적응로 2바이트 단위 처리 하기 에 문자 쓰기에 적합 */ FileWriter fw = null; try { fw = new FileWriter("D:\\course\\java\\test.txt"); String str = "집에\n가고싶다"; // \n 줄바꿈 \r 커서처음으로 옮김 fw.write(str); System.out.println("정상저장"); }catch(Exception e) { e.printStackTrace(); }finally { try { fw.close(); } catch (Exception e2) { } } } }
[ "ywh2995@hanmail.com" ]
ywh2995@hanmail.com
81468a5d1da72bbf5889f350f9587b9c94422f2f
092324cdfc3c4998ffc88d85816731dcdb49713d
/fj36-webservice/src/br/com/caelum/payfast/rest/PagamentoResource.java
a8ae3dc058d8757599096b37cd3e1718cf519094
[]
no_license
RodrigoFrancaBR/SOA_CAELUM
116ea3595a5352f11ee845e206a6f77ec6c99095
5af1e41277e2707629fe5a3898c19c4fca8e06b3
refs/heads/master
2020-12-28T11:04:31.440938
2020-02-13T00:09:44
2020-02-13T00:09:44
238,304,765
2
0
null
null
null
null
UTF-8
Java
false
false
1,985
java
package br.com.caelum.payfast.rest; import java.math.BigDecimal; import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import javax.ejb.Singleton; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import br.com.caelum.payfast.modelo.Pagamento; import br.com.caelum.payfast.modelo.Transacao; @Path("/pagamentos") @Singleton public class PagamentoResource { private Map<Integer, Pagamento> repositorio = new HashMap<>(); private Integer idPagamento = 1; public PagamentoResource() { Pagamento pagamento = new Pagamento(); pagamento.setId(idPagamento++); pagamento.setValor(BigDecimal.TEN); pagamento.comStatusCriado(); pagamento.setId(idPagamento++); repositorio.put(pagamento.getId(), pagamento); } @GET @Path("/{id}") @Produces({ MediaType.APPLICATION_JSON }) public Pagamento buscaPagamento(@PathParam("id") Integer id) { return repositorio.get(id); } @POST @Consumes({ MediaType.APPLICATION_JSON }) public Response criarPagamento(Transacao transacao) throws URISyntaxException { Pagamento pagamento = new Pagamento(); pagamento.setId(idPagamento++); pagamento.setValor(transacao.getValor()); pagamento.comStatusCriado(); repositorio.put(pagamento.getId(), pagamento); System.out.println("PAGAMENTO CRIADO" + pagamento); return Response.created(new URI("/pagamentos/" + pagamento.getId())).entity(pagamento) .type(MediaType.APPLICATION_JSON_TYPE).build(); } @PUT @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Pagamento confirmaPagamento(@PathParam("id") Integer pagamentoId) { Pagamento pagamento = repositorio.get(pagamentoId); pagamento.comStatusConfirmado(); System.out.println("PAGAMENTO CONFIRMADO" + pagamento); return pagamento; } }
[ "soa8872@caelum-sl2-mq15" ]
soa8872@caelum-sl2-mq15
0976e5048162f727cb4228d112287c6d687c9bc8
6d7097fb33f42d73a0357424cc091e327a44622c
/time_manage_backend/src/main/java/com/mj/time/controller/RecordController.java
4a6d784fb5a43afddb7755e21196ab95b30e7dbb
[]
no_license
shelimingming/time_manage
6e0e0fc8532bbbd39c1262e5b0ae429101a8b98c
e842463de92d09aee1fcd1bb4a5376aa47493204
refs/heads/main
2023-01-31T02:31:08.959260
2020-12-12T03:35:04
2020-12-12T03:35:04
312,552,804
0
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
package com.mj.time.controller; import com.mj.time.common.CommonResponse; import com.mj.time.controller.base.BaseController; import com.mj.time.domain.Record; import com.mj.time.service.RecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; @RestController @RequestMapping("/api/time/record") public class RecordController extends BaseController { @Autowired private RecordService recordService; @PostMapping public CommonResponse<Object> create(@RequestBody Record record) { record.setUserId(userId); recordService.addRecord(record); return new CommonResponse<Object>(); } @GetMapping public CommonResponse<List<Record>> query(Date beginTime,Date endTime,Integer tagId){ List<Record> recordList = recordService.selectRecord(userId, beginTime, endTime, tagId); return new CommonResponse<List<Record>>(recordList); } }
[ "shelimingming@qq.com" ]
shelimingming@qq.com
26ed2b6eaad1652efdc92824e939f271d03d0b58
0b6da394f147f8cd10f53ec1a3092a19a9fe6c80
/konstanz/eventdescriptors/NeutralSentimentEventDescriptor.java
decef88923db64661975365a786d103a77399f31
[]
no_license
ridzuan05/SparkEye
fa9b87bf676d1e989b944cf917ae890604d88514
75c64b74fc35fcb1fa95e5faf067de5bc5b74edc
refs/heads/master
2021-01-16T18:50:45.876557
2014-12-23T09:50:45
2014-12-23T09:50:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
468
java
package de.uni.konstanz.eventdescriptors; import java.util.List; import de.uni.konstanz.models.Tweet; public class NeutralSentimentEventDescriptor extends EventDescriptor { public NeutralSentimentEventDescriptor(List<Tweet> tweets, double classificationThreshold) { super(tweets, classificationThreshold); } @Override public double computeScore(List<Tweet> tweets) { return -1000000; } public String toString() { return "NeutralSentiment"; } }
[ "rakan.dirbas@gmail.com" ]
rakan.dirbas@gmail.com
42410860bbaf9e622da1ec6d212f0b0d17774f30
eaec4795e768f4631df4fae050fd95276cd3e01b
/src/cmps252/HW4_2/UnitTesting/record_3710.java
8b07312072e8a177143a983ed96cf4f9ec4c9830
[ "MIT" ]
permissive
baraabilal/cmps252_hw4.2
debf5ae34ce6a7ff8d3bce21b0345874223093bc
c436f6ae764de35562cf103b049abd7fe8826b2b
refs/heads/main
2023-01-04T13:02:13.126271
2020-11-03T16:32:35
2020-11-03T16:32:35
307,839,669
1
0
MIT
2020-10-27T22:07:57
2020-10-27T22:07:56
null
UTF-8
Java
false
false
2,453
java
package cmps252.HW4_2.UnitTesting; import static org.junit.jupiter.api.Assertions.*; import java.io.FileNotFoundException; import java.util.List; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import cmps252.HW4_2.Customer; import cmps252.HW4_2.FileParser; @Tag("2") class Record_3710 { private static List<Customer> customers; @BeforeAll public static void init() throws FileNotFoundException { customers = FileParser.getCustomers(Configuration.CSV_File); } @Test @DisplayName("Record 3710: FirstName is Noreen") void FirstNameOfRecord3710() { assertEquals("Noreen", customers.get(3709).getFirstName()); } @Test @DisplayName("Record 3710: LastName is Raynor") void LastNameOfRecord3710() { assertEquals("Raynor", customers.get(3709).getLastName()); } @Test @DisplayName("Record 3710: Company is Rosalyn Moss Travel") void CompanyOfRecord3710() { assertEquals("Rosalyn Moss Travel", customers.get(3709).getCompany()); } @Test @DisplayName("Record 3710: Address is 44777 S Grimmer Blvd #-c") void AddressOfRecord3710() { assertEquals("44777 S Grimmer Blvd #-c", customers.get(3709).getAddress()); } @Test @DisplayName("Record 3710: City is Fremont") void CityOfRecord3710() { assertEquals("Fremont", customers.get(3709).getCity()); } @Test @DisplayName("Record 3710: County is Alameda") void CountyOfRecord3710() { assertEquals("Alameda", customers.get(3709).getCounty()); } @Test @DisplayName("Record 3710: State is CA") void StateOfRecord3710() { assertEquals("CA", customers.get(3709).getState()); } @Test @DisplayName("Record 3710: ZIP is 94538") void ZIPOfRecord3710() { assertEquals("94538", customers.get(3709).getZIP()); } @Test @DisplayName("Record 3710: Phone is 510-794-0403") void PhoneOfRecord3710() { assertEquals("510-794-0403", customers.get(3709).getPhone()); } @Test @DisplayName("Record 3710: Fax is 510-794-8116") void FaxOfRecord3710() { assertEquals("510-794-8116", customers.get(3709).getFax()); } @Test @DisplayName("Record 3710: Email is noreen@raynor.com") void EmailOfRecord3710() { assertEquals("noreen@raynor.com", customers.get(3709).getEmail()); } @Test @DisplayName("Record 3710: Web is http://www.noreenraynor.com") void WebOfRecord3710() { assertEquals("http://www.noreenraynor.com", customers.get(3709).getWeb()); } }
[ "mbdeir@aub.edu.lb" ]
mbdeir@aub.edu.lb
3e58467b7c52050adfdd81199d0e8b61d599a276
51ec20146a13aef35ff8a47543da7caec5ca4fd4
/RN电商/ReactComponent/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java
baf40d9f6880b59b6308fe71f8e93f8d7ae9f04e
[ "MIT", "CC-BY-SA-4.0", "CC-BY-4.0", "CC-BY-NC-SA-4.0" ]
permissive
ios-zhouyu/RNDemo
ca0db99ead4f6ff087f1d9b7fca8e19fe7abb4aa
8cdf34557e17f29f450bc0b931de03d4f63cecaa
refs/heads/master
2022-10-22T21:59:36.006294
2019-08-26T12:25:51
2019-08-26T12:25:51
154,428,894
23
10
MIT
2022-10-12T00:09:07
2018-10-24T02:49:01
JavaScript
UTF-8
Java
false
false
8,986
java
/** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.facebook.react.views.scroll; import android.graphics.Color; import android.support.v4.view.ViewCompat; import android.util.DisplayMetrics; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; import com.facebook.react.uimanager.Spacing; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.react.uimanager.ViewGroupManager; import com.facebook.react.uimanager.ViewProps; import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactPropGroup; import com.facebook.yoga.YogaConstants; import java.util.ArrayList; import java.util.List; import javax.annotation.Nullable; /** * View manager for {@link ReactHorizontalScrollView} components. * * <p>Note that {@link ReactScrollView} and {@link ReactHorizontalScrollView} are exposed to JS * as a single ScrollView component, configured via the {@code horizontal} boolean property. */ @ReactModule(name = ReactHorizontalScrollViewManager.REACT_CLASS) public class ReactHorizontalScrollViewManager extends ViewGroupManager<ReactHorizontalScrollView> implements ReactScrollViewCommandHelper.ScrollCommandHandler<ReactHorizontalScrollView> { protected static final String REACT_CLASS = "AndroidHorizontalScrollView"; private static final int[] SPACING_TYPES = { Spacing.ALL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP, Spacing.BOTTOM, }; private @Nullable FpsListener mFpsListener = null; public ReactHorizontalScrollViewManager() { this(null); } public ReactHorizontalScrollViewManager(@Nullable FpsListener fpsListener) { mFpsListener = fpsListener; } @Override public String getName() { return REACT_CLASS; } @Override public ReactHorizontalScrollView createViewInstance(ThemedReactContext context) { return new ReactHorizontalScrollView(context, mFpsListener); } @ReactProp(name = "scrollEnabled", defaultBoolean = true) public void setScrollEnabled(ReactHorizontalScrollView view, boolean value) { view.setScrollEnabled(value); } @ReactProp(name = "showsHorizontalScrollIndicator") public void setShowsHorizontalScrollIndicator(ReactHorizontalScrollView view, boolean value) { view.setHorizontalScrollBarEnabled(value); } @ReactProp(name = "decelerationRate") public void setDecelerationRate(ReactHorizontalScrollView view, float decelerationRate) { view.setDecelerationRate(decelerationRate); } @ReactProp(name = "snapToInterval") public void setSnapToInterval(ReactHorizontalScrollView view, float snapToInterval) { // snapToInterval needs to be exposed as a float because of the Javascript interface. DisplayMetrics screenDisplayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics(); view.setSnapInterval((int) (snapToInterval * screenDisplayMetrics.density)); } @ReactProp(name = "snapToOffsets") public void setSnapToOffsets(ReactHorizontalScrollView view, @Nullable ReadableArray snapToOffsets) { DisplayMetrics screenDisplayMetrics = DisplayMetricsHolder.getScreenDisplayMetrics(); List<Integer> offsets = new ArrayList<Integer>(); for (int i = 0; i < snapToOffsets.size(); i++) { offsets.add((int) (snapToOffsets.getDouble(i) * screenDisplayMetrics.density)); } view.setSnapOffsets(offsets); } @ReactProp(name = ReactClippingViewGroupHelper.PROP_REMOVE_CLIPPED_SUBVIEWS) public void setRemoveClippedSubviews(ReactHorizontalScrollView view, boolean removeClippedSubviews) { view.setRemoveClippedSubviews(removeClippedSubviews); } /** * Computing momentum events is potentially expensive since we post a runnable on the UI thread * to see when it is done. We only do that if {@param sendMomentumEvents} is set to true. This * is handled automatically in js by checking if there is a listener on the momentum events. * * @param view * @param sendMomentumEvents */ @ReactProp(name = "sendMomentumEvents") public void setSendMomentumEvents(ReactHorizontalScrollView view, boolean sendMomentumEvents) { view.setSendMomentumEvents(sendMomentumEvents); } /** * Tag used for logging scroll performance on this scroll view. Will force momentum events to be * turned on (see setSendMomentumEvents). * * @param view * @param scrollPerfTag */ @ReactProp(name = "scrollPerfTag") public void setScrollPerfTag(ReactHorizontalScrollView view, String scrollPerfTag) { view.setScrollPerfTag(scrollPerfTag); } @ReactProp(name = "pagingEnabled") public void setPagingEnabled(ReactHorizontalScrollView view, boolean pagingEnabled) { view.setPagingEnabled(pagingEnabled); } /** * Controls overScroll behaviour */ @ReactProp(name = "overScrollMode") public void setOverScrollMode(ReactHorizontalScrollView view, String value) { view.setOverScrollMode(ReactScrollViewHelper.parseOverScrollMode(value)); } @ReactProp(name = "nestedScrollEnabled") public void setNestedScrollEnabled(ReactHorizontalScrollView view, boolean value) { ViewCompat.setNestedScrollingEnabled(view, value); } @Override public void receiveCommand( ReactHorizontalScrollView scrollView, int commandId, @Nullable ReadableArray args) { ReactScrollViewCommandHelper.receiveCommand(this, scrollView, commandId, args); } @Override public void flashScrollIndicators(ReactHorizontalScrollView scrollView) { scrollView.flashScrollIndicators(); } @Override public void scrollTo( ReactHorizontalScrollView scrollView, ReactScrollViewCommandHelper.ScrollToCommandData data) { if (data.mAnimated) { scrollView.smoothScrollTo(data.mDestX, data.mDestY); } else { scrollView.scrollTo(data.mDestX, data.mDestY); } } @Override public void scrollToEnd( ReactHorizontalScrollView scrollView, ReactScrollViewCommandHelper.ScrollToEndCommandData data) { // ScrollView always has one child - the scrollable area int right = scrollView.getChildAt(0).getWidth() + scrollView.getPaddingRight(); if (data.mAnimated) { scrollView.smoothScrollTo(right, scrollView.getScrollY()); } else { scrollView.scrollTo(right, scrollView.getScrollY()); } } /** * When set, fills the rest of the scrollview with a color to avoid setting a background and * creating unnecessary overdraw. * @param view * @param color */ @ReactProp(name = "endFillColor", defaultInt = Color.TRANSPARENT, customType = "Color") public void setBottomFillColor(ReactHorizontalScrollView view, int color) { view.setEndFillColor(color); } @ReactPropGroup(names = { ViewProps.BORDER_RADIUS, ViewProps.BORDER_TOP_LEFT_RADIUS, ViewProps.BORDER_TOP_RIGHT_RADIUS, ViewProps.BORDER_BOTTOM_RIGHT_RADIUS, ViewProps.BORDER_BOTTOM_LEFT_RADIUS }, defaultFloat = YogaConstants.UNDEFINED) public void setBorderRadius(ReactHorizontalScrollView view, int index, float borderRadius) { if (!YogaConstants.isUndefined(borderRadius)) { borderRadius = PixelUtil.toPixelFromDIP(borderRadius); } if (index == 0) { view.setBorderRadius(borderRadius); } else { view.setBorderRadius(borderRadius, index - 1); } } @ReactProp(name = "borderStyle") public void setBorderStyle(ReactHorizontalScrollView view, @Nullable String borderStyle) { view.setBorderStyle(borderStyle); } @ReactPropGroup(names = { ViewProps.BORDER_WIDTH, ViewProps.BORDER_LEFT_WIDTH, ViewProps.BORDER_RIGHT_WIDTH, ViewProps.BORDER_TOP_WIDTH, ViewProps.BORDER_BOTTOM_WIDTH, }, defaultFloat = YogaConstants.UNDEFINED) public void setBorderWidth(ReactHorizontalScrollView view, int index, float width) { if (!YogaConstants.isUndefined(width)) { width = PixelUtil.toPixelFromDIP(width); } view.setBorderWidth(SPACING_TYPES[index], width); } @ReactPropGroup(names = { "borderColor", "borderLeftColor", "borderRightColor", "borderTopColor", "borderBottomColor" }, customType = "Color") public void setBorderColor(ReactHorizontalScrollView view, int index, Integer color) { float rgbComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color & 0x00FFFFFF); float alphaComponent = color == null ? YogaConstants.UNDEFINED : (float) ((int)color >>> 24); view.setBorderColor(SPACING_TYPES[index], rgbComponent, alphaComponent); } @ReactProp(name = "overflow") public void setOverflow(ReactHorizontalScrollView view, @Nullable String overflow) { view.setOverflow(overflow); } }
[ "1512450002@qq.com" ]
1512450002@qq.com
03c6e1364b439a12b5b1873d4563b1202ec9a02e
7cbf404c2274f1619c5938d42633003af983deea
/DAOBulletin/src/test/App.java
fedc51492a513aa33d0261a5f85c16ac191ae959
[]
no_license
adeschaud/formulaire-bulletin
b165d571220c6063826a8a6a23c1922342ba6d91
d5497b424a9c70356cc4e700cbe281d1fca7d8bb
refs/heads/master
2020-04-15T22:41:48.352444
2019-01-24T17:59:00
2019-01-24T17:59:00
165,082,734
0
0
null
null
null
null
ISO-8859-1
Java
false
false
9,569
java
package test; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; // Classe de point d'entrée pour la mission 4 public class App { // Variable contenant l'interface graphique Formulaire form; // Variable contenant la connection à la base de donnée Connection conn = null; // Méthode main lançant l'application public static void main(String[] args) { new App(); } protected void insertBulletin() { String nom = form.getJtNom().getText(); String prenom = form.getJtPrenom().getText(); String note = form.getJtNote().getText(); String str = "INSERT INTO bulletin(`nom`,`prenom`,`note`) VALUES ('" + nom + "','" + prenom + "','" + note + "');"; Statement stmt = null; try { stmt = conn.createStatement(); int res = stmt.executeUpdate(str); System.out.println("Ligne :" + res); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { // Fermeture du statement stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } // Constructeur de la classe App public App() { // Récupération de la connection à la base de donnée getConnection(); // Instanciation de l'interface graphique form = new Formulaire(); // Ajout du Listener sur le bouton Annuler (ferme la connection et quitte) form.getJbAnnuler().addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent arg0) { // Fermeture de la connection à la base de donnée closeConnection(); System.exit(0); } @Override public void mouseEntered(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } }); // Ajout du Listener sur le bouton Valider (insère un nouveau bulletin en base) form.getJbValider().addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { insertBulletin(); } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }); /* -----> Code du menu avec la console <----- // Instanciation de l'objet permettant de récupérer la saisie console Scanner sc = new Scanner(System.in); // Tableau contenant les différentes action possibles ArrayList<String> menu = new ArrayList<String>(); menu.add("Voulez-vous vous connecter à la base de données ? "); // + ((conn != null)? "Connecté" : "Non connecté" ) menu.add("Voulez-vous créer la table \"bulletin\" ?"); menu.add("Voulez-vous insérer des valeurs ?"); menu.add("Voulez-vous effectuer une recherche par note ?"); menu.add("Voulez-vous effectuer une recherche de votree choix ?"); // Boucle de gestion des menus sur console int choice = 1; while (choice != 0) { int num = 1; // Lister les menus et récupérer le choix for(String str : menu) { System.out.println(num + "-" + str); num ++; } choice = sc.nextInt(); // Méthodes à appeler en fonction des choix switch(choice) { case 1: // Choix 1 : Création de la connexion @TODO: Afficher l'état de la connexion dans le menu getConnection(); break; case 2: // Choix 2 : Création de la table bulletin 'IF NOT EXISTS' createTable(); break; case 3: // Choix 3: Boucle d'insertion de bulletins insertValues(); break; case 4: // Choix 4 : Selection des bulletins dont la note est superieur à une note saisie doSearchNote(); break; case 5: // Choix 5 : Faire un select dynamique doSelect(); break; } } */ } // Methode pour réaliser un select dynamique private void doSelect() { String req = "SELECT * FROM bulletin WHERE "; Scanner sc = new Scanner(System.in); System.out.println("Voulez-vous créer une recherche par :"); System.out.println("1 - ID"); System.out.println("2 - Nom"); System.out.println("3 - Prénom"); System.out.println("4 - Note"); int choix = sc.nextInt(); sc = new Scanner(System.in); switch(choix) { case 1: System.out.println("Quel id ?"); req += " id = '" + sc.nextInt() + "';"; break; case 2: System.out.println("Quel nom ?"); req += " nom = '" + sc.nextLine() + "';"; break; case 3: System.out.println("Quel prénom ?"); req += " prenom = '" + sc.nextLine() + "';"; break; case 4: System.out.println("Quel note ?"); req += " note = '" + sc.nextInt() + "';"; break; } PreparedStatement stmt; try { stmt = conn.prepareStatement(req); ResultSet res = stmt.executeQuery(); //Affichage des resultats while(res.next()) { int id = res.getInt("id"); String nom = res.getString("nom"); String prenom = res.getString("prenom"); int note = res.getInt("note"); System.out.println(id + " - " + nom + " " + prenom + " " + note); } } catch (SQLException e) { e.printStackTrace(); } } // Méthode de recherche de note superieur à celle saisie par l'utilisateur private void doSearchNote() { // Récupération de la saisie utilisateur Scanner sc = new Scanner(System.in); System.out.println("Chercher des notes inferieur à : "); int min = sc.nextInt(); // Requête SQL de selection de bulletin dont la note est superieur à la saisie String str = "SELECT * FROM bulletin where note < ?"; PreparedStatement stmt; try { stmt = conn.prepareStatement(str); stmt.setInt(1, min); ResultSet res = stmt.executeQuery(); //Affichage des resultats while(res.next()) { int id = res.getInt("id"); String nom = res.getString("nom"); String prenom = res.getString("prenom"); int note = res.getInt("note"); System.out.println(id + " - " + nom + " " + prenom + " " + note); } } catch (SQLException e) { e.printStackTrace(); } } // Méthode d'insertion de valeur dans la talbe bulletin private void insertValues() { // Boucle permettant l'insertion de plusieurs valeurs int redo = 0; while (redo == 0) { // Récupération des données à insérer Scanner sc = new Scanner(System.in); System.out.println("Nom : "); String nom = sc.nextLine(); System.out.println("Prenom : "); String prenom = sc.nextLine(); System.out.println("Note : "); int note = sc.nextInt(); // Génération de la requète sql String str = "INSERT INTO bulletin(`nom`,`prenom`,`note`) VALUES ('" + nom + "','" + prenom + "','" + note + "');"; Statement stmt = null; try { stmt = conn.createStatement(); int res = stmt.executeUpdate(str); System.out.println("Ligne :" + res); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { // Fermeture du statement stmt.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // Choix de resaisir des valeurs ou de revenir au menu principal System.out.println("Voulez-vous continuer à insérer des bulletins ?\n1 - Oui\n2 - Non"); redo = sc.nextInt()-1; } } // Méthode de création de la table bulletin si elle n'existe pas déjà private void createTable() { // Création de la requête sql String str = "CREATE TABLE IF NOT EXISTS bulletin (" + "id int(10) AUTO_INCREMENT PRIMARY KEY NOT NULL," + "nom varchar(30)," + "prenom varchar(30)," + "note int(2)" + ");"; try { Statement stmt = conn.createStatement(); boolean res = stmt.execute(str); System.out.println("Ligne :" + res); } catch (SQLException e) { e.printStackTrace(); } } // Methode de création de la connexion à la base private void getConnection() { try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Pilote chargé"); String url="jdbc:mysql://localhost/test"; //url de la base this.conn = DriverManager.getConnection(url,"root",""); }catch(ClassNotFoundException | SQLException e){ System.out.println("Pilote non trouvé. "+e.getMessage()); } } // Méthode de fermeture de la connexion private void closeConnection() { try { this.conn.close(); } catch (SQLException e) { e.printStackTrace(); } } }
[ "noreply@github.com" ]
adeschaud.noreply@github.com
5b2a8e394b30b137e916b7770fb22f9541523e6b
cf9d1872d63c5b69171d25429faff23a516dedb6
/PetriNet.diagram/src/yeah/petrinet/diagram/part/PetrinetDiagramEditorPlugin.java
560bf1f9af7b5d648ab4136cdbf081ba9e4bc506
[]
no_license
Mkiza/MBSE
b3f6778556b92d0b7070414e8afe979111cf97e8
9751f86c6d3031939865f0a127e30030a67ff94b
refs/heads/master
2016-08-12T16:43:15.712358
2016-03-02T13:04:06
2016-03-02T13:04:06
51,582,709
0
0
null
null
null
null
UTF-8
Java
false
false
6,923
java
package yeah.petrinet.diagram.part; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.edit.provider.ComposedAdapterFactory; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; import org.eclipse.gmf.tooling.runtime.LogHelper; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; import yeah.petrinet.diagram.edit.policies.PetrinetBaseItemSemanticEditPolicy; import yeah.petrinet.diagram.expressions.PetrinetOCLFactory; import yeah.petrinet.diagram.providers.ElementInitializers; import yeah.petrinet.provider.PetrinetItemProviderAdapterFactory; /** * @generated */ public class PetrinetDiagramEditorPlugin extends AbstractUIPlugin { /** * @generated */ public static final String ID = "PetriNet.diagram"; //$NON-NLS-1$ /** * @generated */ private LogHelper myLogHelper; /** * @generated */ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID); /** * @generated */ private static PetrinetDiagramEditorPlugin instance; /** * @generated */ private ComposedAdapterFactory adapterFactory; /** * @generated */ private PetrinetDocumentProvider documentProvider; /** * @generated */ private PetrinetBaseItemSemanticEditPolicy.LinkConstraints linkConstraints; /** * @generated */ private ElementInitializers initializers; /** * @generated */ private PetrinetOCLFactory oclFactory; /** * @generated */ public PetrinetDiagramEditorPlugin() { } /** * @generated */ public void start(BundleContext context) throws Exception { super.start(context); instance = this; myLogHelper = new LogHelper(this); PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); adapterFactory = createAdapterFactory(); } /** * @generated */ public void stop(BundleContext context) throws Exception { adapterFactory.dispose(); adapterFactory = null; linkConstraints = null; initializers = null; oclFactory = null; instance = null; super.stop(context); } /** * @generated */ public static PetrinetDiagramEditorPlugin getInstance() { return instance; } /** * @generated */ protected ComposedAdapterFactory createAdapterFactory() { ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>(); fillItemProviderFactories(factories); return new ComposedAdapterFactory(factories); } /** * @generated */ protected void fillItemProviderFactories(List<AdapterFactory> factories) { factories.add(new PetrinetItemProviderAdapterFactory()); factories.add(new ResourceItemProviderAdapterFactory()); factories.add(new ReflectiveItemProviderAdapterFactory()); } /** * @generated */ public AdapterFactory getItemProvidersAdapterFactory() { return adapterFactory; } /** * @generated */ public ImageDescriptor getItemImageDescriptor(Object item) { IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class); if (labelProvider != null) { return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item)); } return null; } /** * Returns an image descriptor for the image file at the given * plug-in relative path. * * @generated * @param path the path * @return the image descriptor */ public static ImageDescriptor getBundledImageDescriptor(String path) { return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path); } /** * Respects images residing in any plug-in. If path is relative, * then this bundle is looked up for the image, otherwise, for absolute * path, first segment is taken as id of plug-in with image * * @generated * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images * @return the image descriptor */ public static ImageDescriptor findImageDescriptor(String path) { final IPath p = new Path(path); if (p.isAbsolute() && p.segmentCount() > 1) { return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString()); } else { return getBundledImageDescriptor(p.makeAbsolute().toString()); } } /** * Returns an image for the image file at the given plug-in relative path. * Client do not need to dispose this image. Images will be disposed automatically. * * @generated * @param path the path * @return image instance */ public Image getBundledImage(String path) { Image image = getImageRegistry().get(path); if (image == null) { getImageRegistry().put(path, getBundledImageDescriptor(path)); image = getImageRegistry().get(path); } return image; } /** * Returns string from plug-in's resource bundle * * @generated */ public static String getString(String key) { return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$ } /** * @generated */ public PetrinetDocumentProvider getDocumentProvider() { if (documentProvider == null) { documentProvider = new PetrinetDocumentProvider(); } return documentProvider; } /** * @generated */ public PetrinetBaseItemSemanticEditPolicy.LinkConstraints getLinkConstraints() { return linkConstraints; } /** * @generated */ public void setLinkConstraints(PetrinetBaseItemSemanticEditPolicy.LinkConstraints lc) { this.linkConstraints = lc; } /** * @generated */ public ElementInitializers getElementInitializers() { return initializers; } /** * @generated */ public void setElementInitializers(ElementInitializers i) { this.initializers = i; } /** * @generated */ public PetrinetOCLFactory getPetrinetOCLFactory() { return oclFactory; } /** * @generated */ public void setPetrinetOCLFactory(PetrinetOCLFactory f) { this.oclFactory = f; } /** * @generated */ public void logError(String error) { getLogHelper().logError(error, null); } /** * @generated */ public void logError(String error, Throwable throwable) { getLogHelper().logError(error, throwable); } /** * @generated */ public void logInfo(String message) { getLogHelper().logInfo(message, null); } /** * @generated */ public void logInfo(String message, Throwable throwable) { getLogHelper().logInfo(message, throwable); } /** * @generated */ public LogHelper getLogHelper() { return myLogHelper; } }
[ "Mkiza@10.16.107.117" ]
Mkiza@10.16.107.117
77213ca8c8d24be6bde95af5fd3aed55e0306f15
022980735384919a0e9084f57ea2f495b10c0d12
/src/ext-cttdt-lltnxp/ext-service/src/com/sgs/portlet/onedoorpccc/service/persistence/PmlPaintDocumentPersistence.java
3be7d69f1ac5623397cbc14033b0b017b355a39c
[]
no_license
thaond/nsscttdt
474d8e359f899d4ea6f48dd46ccd19bbcf34b73a
ae7dacc924efe578ce655ddfc455d10c953abbac
refs/heads/master
2021-01-10T03:00:24.086974
2011-02-19T09:18:34
2011-02-19T09:18:34
50,081,202
0
0
null
null
null
null
UTF-8
Java
false
false
7,379
java
package com.sgs.portlet.onedoorpccc.service.persistence; public interface PmlPaintDocumentPersistence { public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument create( long paintDocumentId); public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument remove( long paintDocumentId) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument remove( com.sgs.portlet.onedoorpccc.model.PmlPaintDocument pmlPaintDocument) throws com.liferay.portal.SystemException; /** * @deprecated Use <code>update(PmlPaintDocument pmlPaintDocument, boolean merge)</code>. */ public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument update( com.sgs.portlet.onedoorpccc.model.PmlPaintDocument pmlPaintDocument) throws com.liferay.portal.SystemException; /** * Add, update, or merge, the entity. This method also calls the model * listeners to trigger the proper events associated with adding, deleting, * or updating an entity. * * @param pmlPaintDocument the entity to add, update, or merge * @param merge boolean value for whether to merge the entity. The * default value is false. Setting merge to true is more * expensive and should only be true when pmlPaintDocument is * transient. See LEP-5473 for a detailed discussion of this * method. * @return true if the portlet can be displayed via Ajax */ public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument update( com.sgs.portlet.onedoorpccc.model.PmlPaintDocument pmlPaintDocument, boolean merge) throws com.liferay.portal.SystemException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument updateImpl( com.sgs.portlet.onedoorpccc.model.PmlPaintDocument pmlPaintDocument, boolean merge) throws com.liferay.portal.SystemException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument findByPrimaryKey( long paintDocumentId) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument fetchByPrimaryKey( long paintDocumentId) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByQuantity( int quantity) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByQuantity( int quantity, int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByQuantity( int quantity, int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument findByQuantity_First( int quantity, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument findByQuantity_Last( int quantity, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument[] findByQuantity_PrevAndNext( long paintDocumentId, int quantity, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByFileId( java.lang.String fileId) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByFileId( java.lang.String fileId, int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findByFileId( java.lang.String fileId, int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument findByFileId_First( java.lang.String fileId, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument findByFileId_Last( java.lang.String fileId, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public com.sgs.portlet.onedoorpccc.model.PmlPaintDocument[] findByFileId_PrevAndNext( long paintDocumentId, java.lang.String fileId, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException, com.sgs.portlet.onedoorpccc.NoSuchPmlPaintDocumentException; public java.util.List<Object> findWithDynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) throws com.liferay.portal.SystemException; public java.util.List<Object> findWithDynamicQuery( com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findAll() throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findAll( int start, int end) throws com.liferay.portal.SystemException; public java.util.List<com.sgs.portlet.onedoorpccc.model.PmlPaintDocument> findAll( int start, int end, com.liferay.portal.kernel.util.OrderByComparator obc) throws com.liferay.portal.SystemException; public void removeByQuantity(int quantity) throws com.liferay.portal.SystemException; public void removeByFileId(java.lang.String fileId) throws com.liferay.portal.SystemException; public void removeAll() throws com.liferay.portal.SystemException; public int countByQuantity(int quantity) throws com.liferay.portal.SystemException; public int countByFileId(java.lang.String fileId) throws com.liferay.portal.SystemException; public int countAll() throws com.liferay.portal.SystemException; public void registerListener( com.liferay.portal.model.ModelListener listener); public void unregisterListener( com.liferay.portal.model.ModelListener listener); }
[ "nguyentanmo@843501e3-6f96-e689-5e61-164601347e4e" ]
nguyentanmo@843501e3-6f96-e689-5e61-164601347e4e
cc8d1acf0c84f9e0e445609b7d3e78d527ef67e9
780bcbeaf206fd00d76b65a2bf8a3ff74f5a9e4b
/src/RCU.java
4d522467153b5f8d50a7e15e5f1b4b4a56a56b22
[]
no_license
gabrieldsumabat/RouteControl
ff2987a01129104c0dc0456751327c0d2cd54d73
db30d19c10e685693f13ce2fea6e5615a1e6ad4c
refs/heads/master
2021-09-13T09:31:30.745466
2018-04-27T20:55:19
2018-04-27T20:55:19
126,123,463
0
0
null
null
null
null
UTF-8
Java
false
false
5,405
java
import java.io.Serializable; import java.lang.System; import java.net.InetAddress; /** * RCU Class is a serializable object to be communicated between Route Controllers through Socket connections. * The RCU implements both Advertisement updates and RTT packets. */ public class RCU implements Serializable { //Serialized Object to be exchanged over Socket Connections private int RCID; // Source RCID private int LinkID; // Target ASNID private InetAddress targetIP;// Target IP Address private int LinkType; // (1)Overlay (2) Network private long LinkCost; // RTT Cost Function //RTT Variables private int RttFlag; // (0) Not in use (1) RTT_REQ (2) RTT_RES private long RttSent; // Time packet was sent private long RttReceived; // Time packet finished round trip //Route Advertisement private ASN[] advertisement; /** * Creates new RCU Packet * @param Source RCID of Source ASN * @param NextHop ASNID of target ASN * @param HopType 2 if target ASN has a RCID, 1 if ASN has no RCID * @param Cost Sender's Link Cost * @param RTT_Update RTT Flag, 1 for RTT_REQ and 0 for RCU Advertisement * @param target IP Address of target ASN */ public RCU(int Source, int NextHop, int HopType, long Cost, int RTT_Update, InetAddress target) { setRCID(Source); setLinkID(NextHop); setLinkType(HopType); setLinkCost(Cost); setTargetIP(target); setRttFlag(RTT_Update); if (RTT_Update == 1) { setRttSent(); } else if (RTT_Update == 0) { advertisement = RouteController.LocalConfig.addressBook; } } /** * Gets the Address Book advertised by ASN * @return Array of ASN known by sender */ public ASN[] getAd(){ return advertisement; } /** * Returns RCID of sending ASN * @return int RC ID */ public int getRCID() { return RCID; } /** * Updates RCU Sending RC ID value * @param RCID New int RC ID */ public void setRCID(int RCID) { this.RCID = RCID; } /** * Return ASNID of Target ASN * @return ASNID of Target ASN */ public int getLinkID() { return LinkID; } /** * Set Target ASN ID for RCU Packet * @param linkID ASNID of Target Network */ public void setLinkID(int linkID) { LinkID = linkID; } /** * Return Link Type * @return 1 if ASN with no RC, 2 if ASN with RC */ public int getLinkType() { return LinkType; } /** * Set the Link Type * @param linkType int representing the linkType. 1 if ASN without RC, 2 if ASN with RC */ public void setLinkType(int linkType) { LinkType = linkType; } /** * Returns Link Cost as a long * @return long LinkCost */ public long getLinkCost() { return LinkCost; } /** * Set RCU Link Cost * @param linkCost new long LinkCost value */ public void setLinkCost(long linkCost) { LinkCost = linkCost; } /** * Returns RttFlag * @return 0 if RCU Advertisement, 1 if RTT_REQ, 2 if RTT_RESP */ public int getRttFlag() { return RttFlag; } /** * Sets RttFlag to desired value. 0 for RCU Advertisement, 1 for RTT_REQ, 2 for RTT_RESP * @param rttFlag int from 0 to 2 */ public void setRttFlag(int rttFlag) { RttFlag = rttFlag; } /** * Return Time when RTT was Sent * @return time when RTT_REQ was sent */ public long getRttSent() { return RttSent; } /** * Sets the RttSent value to current millisecond */ public void setRttSent() { RttSent = System.currentTimeMillis(); } /** * Returns RTT Receive Time * @return long time when RTT is received */ public long getRttReceived() { return RttReceived; } /** * Set RttReceive time to current millisecond */ public void setRttReceived() { RttReceived = System.currentTimeMillis(); } /** * Returns RCU destination ASN InetAddress * @return */ public InetAddress getTargetIP() { return targetIP; } /** * Set destination InetAddress for packet * @param targetIP InetAddress of target ASN */ public void setTargetIP(InetAddress targetIP) { this.targetIP = targetIP; } /** * Returns the Round Trip Time * @return long Round Trip Time, -1 if RCU is an Advertisement update */ public long getRoundTripTime() { if (getRttFlag() != 0) { return getRttReceived() - getRttSent(); } else { return (-1); } } //METHODS TO ALLOW SERIALIZATION OF THE OBJECT @Override public int hashCode() { return RCID; } @Override public String toString() { return "\n\n\t RC ID: " + getRCID() + "\n\t Link ID: " + getLinkID() + "\n\t Link Type: " + getLinkType() + "\n\t Link Cost: " + getLinkCost() + "\n\t RTT Flag: " + getRttFlag() + "\n"; } }
[ "gabrieldsumabat@gmail.com" ]
gabrieldsumabat@gmail.com
d656c0381323ed056277d212f5054958df2884bf
bd35206e4b73defe40ee4fbf0e4bf45fcdc533dc
/src/main/java/org/pophealth/api/RewardsResource.java
e3698591d0ee40b7ccb2f1417374219a8117096d
[ "MIT" ]
permissive
eformat/pop-health-dashboard
0f82f43ddb6e763466bf89ac53e63473619efdcb
2504e285aa9b11a699bc0f3bd7990a7761dd172b
refs/heads/master
2022-11-23T08:29:54.356290
2020-07-28T21:03:26
2020-07-28T21:03:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,249
java
package org.pophealth.api; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.pophealth.model.Reward; import org.pophealth.model.RewardProgram; import org.pophealth.service.RewardsService; @Path("/rewards") public class RewardsResource { @Inject RewardsService rewardService; @POST @Consumes(MediaType.APPLICATION_JSON) public void addRewards(List<Reward> rewards) { rewards.stream().forEach(reward -> rewardService.createReward(reward)); } @GET @Produces(MediaType.APPLICATION_JSON) public List<Reward> getRewards() { List<Reward> testRewards = new ArrayList<>(); // for(int i =0;i<20;i++){ // Reward test = new Reward(); // test.setCategory("Steps"); // test.setFulfilled(false); // test.setRewardName("3k Steps"); // test.setValue(100.0-i); // testRewards.add(test); // rewardService.createReward(test); // } return rewardService.getAllRewards(); } @GET @Path("/totalRewards") @Produces(MediaType.APPLICATION_JSON) public Double getTotalRewards() { return rewardService.getTotalRewards(); } @GET @Path("/unfufilled") @Produces(MediaType.APPLICATION_JSON) public Integer getUnfufilledRewards() { return rewardService.getUnfufilledRewards(); } @GET @Path("/categoryCounts") @Produces(MediaType.APPLICATION_JSON) public Map<String, Integer> getCategoryCounts() { return rewardService.getRewardCategories(); } @GET @Path("/rewardsBudget/{programId}") @Produces(MediaType.APPLICATION_JSON) public Double getRewardsBudget(@PathParam("programId")long programId) { return rewardService.getRewardsBudget(programId); } @POST @Path("/rewardsProgram") @Consumes(MediaType.APPLICATION_JSON) public void createRewardsProgram(RewardProgram program) { rewardService.createProgram(program); } }
[ "j.white@entando.com" ]
j.white@entando.com
20e458170092fff08e26a9377e85001033a06ef4
77173b5609ed10c78d4e74e3dceb115953f52e98
/src/main/java/com/imooc/o2o/service/UserAwardMapService.java
e3bd8fc722d2b1f52f6f9694e415b94859f455b6
[]
no_license
zhangdengtian/ideaO2o
1516bafd84c4bbd953ae1a0dbf49d39b65fc118e
5f1348fa266299529a1134a8483d651364d874b7
refs/heads/master
2020-05-27T06:19:58.087005
2019-05-25T03:49:50
2019-05-25T03:49:50
188,519,307
1
0
null
2019-05-25T04:12:01
2019-05-25T04:12:00
null
UTF-8
Java
false
false
1,515
java
package com.imooc.o2o.service; import com.imooc.o2o.dto.UserAwardMapExecution; import com.imooc.o2o.entity.UserAwardMap; import com.imooc.o2o.exceptions.UserAwardMapOperateException; /** * Created by Unruly Wind on 2019/3/10/010. * * @author BlueMelancholy * @desc: */ public interface UserAwardMapService { /** * 根据传入的查询条件分页获取映射列表及总数 * * @param userAwardCondition * @param pageIndex * @param pageSize * @return */ UserAwardMapExecution listUserAwardMap(UserAwardMap userAwardCondition, Integer pageIndex, Integer pageSize); /** * 根据传入的查询条件分页获取映射列表及总数 * * @param userAwardCondition * @param pageIndex * @param pageSize * @return */ UserAwardMapExecution listReceivedUserAwardMap(UserAwardMap userAwardCondition, Integer pageIndex, Integer pageSize); /** * 根据传入的Id获取映射信息 * * @param userAwardMapId * @return */ UserAwardMap getUserAwardMapById(long userAwardMapId); /** * 领取奖品,添加映射信息 * * @param userAwardMap * @return * @throws UserAwardMapOperateException */ UserAwardMapExecution addUserAwardMap(UserAwardMap userAwardMap) throws UserAwardMapOperateException; /** * 修改映射信息,这里主要修改奖品领取状态 * * @param userAwardMap * @return * @throws UserAwardMapOperateException */ UserAwardMapExecution modifyUserAwardMap(UserAwardMap userAwardMap) throws UserAwardMapOperateException; }
[ "17802532475@163.com" ]
17802532475@163.com
0c59f99e07a5bf5e4e1fdcba9c4986cef8d83672
eca7f6cc398f94257c96ca28ae230cc2f4ceb1b7
/app/src/debug/android/support/graphics/drawable/animated/R.java
f4dd4c19a0dd9c1d5252a754abfc47afda83c499
[]
no_license
Anywaygod123/WhatsappMonitoring2
ad47ea5d62cf5e82abdca21265942ff0fd5a5b56
8777863f08b80bf78666b3051093034f8888c98d
refs/heads/master
2023-01-07T05:54:50.906054
2020-11-06T15:36:21
2020-11-06T15:36:21
310,636,258
1
0
null
null
null
null
UTF-8
Java
false
false
7,630
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.graphics.drawable.animated; public final class R { public static final class attr { public static final int font = 0x7f030095; public static final int fontProviderAuthority = 0x7f030097; public static final int fontProviderCerts = 0x7f030098; public static final int fontProviderFetchStrategy = 0x7f030099; public static final int fontProviderFetchTimeout = 0x7f03009a; public static final int fontProviderPackage = 0x7f03009b; public static final int fontProviderQuery = 0x7f03009c; public static final int fontStyle = 0x7f03009d; public static final int fontWeight = 0x7f03009e; } public static final class bool { public static final int abc_action_bar_embed_tabs = 0x7f040000; } public static final class color { public static final int notification_action_color_filter = 0x7f050049; public static final int notification_icon_bg_color = 0x7f05004a; public static final int ripple_material_light = 0x7f050055; public static final int secondary_text_default_material_light = 0x7f050057; } public static final class dimen { public static final int compat_button_inset_horizontal_material = 0x7f06004c; public static final int compat_button_inset_vertical_material = 0x7f06004d; public static final int compat_button_padding_horizontal_material = 0x7f06004e; public static final int compat_button_padding_vertical_material = 0x7f06004f; public static final int compat_control_corner_material = 0x7f060050; public static final int notification_action_icon_size = 0x7f060089; public static final int notification_action_text_size = 0x7f06008a; public static final int notification_big_circle_margin = 0x7f06008b; public static final int notification_content_margin_start = 0x7f06008c; public static final int notification_large_icon_height = 0x7f06008d; public static final int notification_large_icon_width = 0x7f06008e; public static final int notification_main_column_padding_top = 0x7f06008f; public static final int notification_media_narrow_margin = 0x7f060090; public static final int notification_right_icon_size = 0x7f060091; public static final int notification_right_side_padding_top = 0x7f060092; public static final int notification_small_icon_background_padding = 0x7f060093; public static final int notification_small_icon_size_as_large = 0x7f060094; public static final int notification_subtext_size = 0x7f060095; public static final int notification_top_pad = 0x7f060096; public static final int notification_top_pad_large_text = 0x7f060097; } public static final class drawable { public static final int notification_action_background = 0x7f07006b; public static final int notification_bg = 0x7f07006c; public static final int notification_bg_low = 0x7f07006d; public static final int notification_bg_low_normal = 0x7f07006e; public static final int notification_bg_low_pressed = 0x7f07006f; public static final int notification_bg_normal = 0x7f070070; public static final int notification_bg_normal_pressed = 0x7f070071; public static final int notification_icon_background = 0x7f070072; public static final int notification_template_icon_bg = 0x7f070073; public static final int notification_template_icon_low_bg = 0x7f070074; public static final int notification_tile_bg = 0x7f070075; public static final int notify_panel_notification_icon_bg = 0x7f070076; } public static final class id { public static final int action_container = 0x7f08000e; public static final int action_divider = 0x7f080010; public static final int action_image = 0x7f080011; public static final int action_text = 0x7f080018; public static final int actions = 0x7f080019; public static final int async = 0x7f08001f; public static final int blocking = 0x7f080023; public static final int chronometer = 0x7f08002c; public static final int forever = 0x7f08004d; public static final int icon = 0x7f080053; public static final int icon_group = 0x7f080054; public static final int info = 0x7f080059; public static final int italic = 0x7f08005c; public static final int line1 = 0x7f080060; public static final int line3 = 0x7f080061; public static final int normal = 0x7f080074; public static final int notification_background = 0x7f080075; public static final int notification_main_column = 0x7f080076; public static final int notification_main_column_container = 0x7f080077; public static final int right_icon = 0x7f080083; public static final int right_side = 0x7f080084; public static final int text = 0x7f0800ae; public static final int text2 = 0x7f0800af; public static final int time = 0x7f0800b6; public static final int title = 0x7f0800b7; } public static final class integer { public static final int status_bar_notification_info_maxnum = 0x7f090009; } public static final class layout { public static final int notification_action = 0x7f0a002d; public static final int notification_action_tombstone = 0x7f0a002e; public static final int notification_template_custom_big = 0x7f0a0035; public static final int notification_template_icon_group = 0x7f0a0036; public static final int notification_template_part_chronometer = 0x7f0a003a; public static final int notification_template_part_time = 0x7f0a003b; } public static final class string { public static final int status_bar_notification_info_overflow = 0x7f0e0033; } public static final class style { public static final int TextAppearance_Compat_Notification = 0x7f0f0103; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0104; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0106; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0109; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f010b; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f0181; public static final int Widget_Compat_NotificationActionText = 0x7f0f0182; } public static final class styleable { public static final int[] FontFamily = { 0x7f030097, 0x7f030098, 0x7f030099, 0x7f03009a, 0x7f03009b, 0x7f03009c }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x7f030095, 0x7f03009d, 0x7f03009e }; public static final int FontFamilyFont_font = 0; public static final int FontFamilyFont_fontStyle = 1; public static final int FontFamilyFont_fontWeight = 2; } }
[ "72498513+Anywaygod123@users.noreply.github.com" ]
72498513+Anywaygod123@users.noreply.github.com
3b82aa82cfbb6240b09d8b1c669f32a470917d62
466affb16d00d7266314e4ca501f30e9d6edc414
/java/src/test/java/org/parboiled/transform/RuleMethodRewriterTest.java
602181061ea4a316a06066a26e167028367ad7c3
[ "Apache-2.0" ]
permissive
dumbyme/parboiled
05bf07903058e1988f0556f371248a7ddff95629
67ac85979de2c2f949ac7c7cc021ddb2af4e7af6
refs/heads/master
2021-01-18T06:09:14.218625
2011-04-08T16:13:51
2011-04-08T16:13:51
1,593,960
1
0
null
null
null
null
UTF-8
Java
false
false
7,858
java
/* * Copyright (C) 2009-2011 Mathias Doenitz * * 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.parboiled.transform; import org.parboiled.common.ImmutableList; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import java.io.IOException; import java.util.List; import static org.parboiled.transform.AsmTestUtils.getMethodInstructionList; import static org.testng.Assert.assertEquals; public class RuleMethodRewriterTest extends TransformationTest { private final List<RuleMethodProcessor> processors = ImmutableList.of( new UnusedLabelsRemover(), new ReturnInstructionUnifier(), new InstructionGraphCreator(), new ImplicitActionsConverter(), new InstructionGroupCreator(), new InstructionGroupPreparer(), new ActionClassGenerator(true), new VarInitClassGenerator(true), new RuleMethodRewriter(), new VarFramingGenerator() ); @BeforeClass public void setup() throws IOException { setup(TestParser.class); } @Test(dependsOnGroups = "primary") public void testRuleMethodRewriting() throws Exception { assertEquals(getMethodInstructionList(processMethod("RuleWithIndirectImplicitAction", processors)), "" + "Method 'RuleWithIndirectImplicitAction':\n" + " 0 ALOAD 0\n" + " 1 BIPUSH 97\n" + " 2 INVOKESTATIC java/lang/Character.valueOf (C)Ljava/lang/Character;\n" + " 3 BIPUSH 98\n" + " 4 INVOKESTATIC java/lang/Character.valueOf (C)Ljava/lang/Character;\n" + " 5 ICONST_1\n" + " 6 ANEWARRAY java/lang/Object\n" + " 7 DUP\n" + " 8 ICONST_0\n" + " 9 NEW org/parboiled/transform/Action$aqänW6YöJ6yk7FhN\n" + "10 DUP\n" + "11 LDC \"RuleWithIndirectImplicitAction_Action1\"\n" + "12 INVOKESPECIAL org/parboiled/transform/Action$aqänW6YöJ6yk7FhN.<init> (Ljava/lang/String;)V\n" + "13 DUP\n" + "14 ALOAD 0\n" + "15 PUTFIELD org/parboiled/transform/Action$aqänW6YöJ6yk7FhN.field$0 : Lorg/parboiled/transform/TestParser$$parboiled;\n" + "16 AASTORE\n" + "17 INVOKEVIRTUAL org/parboiled/transform/TestParser.Sequence (Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/parboiled/Rule;\n" + "18 ARETURN\n"); assertEquals(getMethodInstructionList(processMethod("RuleWithComplexActionSetup", processors)), "" + "Method 'RuleWithComplexActionSetup':\n" + " 0 BIPUSH 26\n" + " 1 ISTORE 2\n" + " 2 BIPUSH 18\n" + " 3 ISTORE 3\n" + " 4 NEW org/parboiled/support/Var\n" + " 5 DUP\n" + " 6 NEW org/parboiled/transform/VarInit$ojjPlntz5r61YBBm\n" + " 7 DUP\n" + " 8 LDC \"RuleWithComplexActionSetup_VarInit1\"\n" + " 9 INVOKESPECIAL org/parboiled/transform/VarInit$ojjPlntz5r61YBBm.<init> (Ljava/lang/String;)V\n" + "10 INVOKESPECIAL org/parboiled/support/Var.<init> (Lorg/parboiled/common/Factory;)V\n" + "11 ASTORE 4\n" + "12 ILOAD 2\n" + "13 ILOAD 1\n" + "14 IADD\n" + "15 ISTORE 2\n" + "16 ILOAD 3\n" + "17 ILOAD 2\n" + "18 ISUB\n" + "19 ISTORE 3\n" + "20 ALOAD 0\n" + "21 BIPUSH 97\n" + "22 ILOAD 2\n" + "23 IADD\n" + "24 INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;\n" + "25 NEW org/parboiled/transform/Action$HCsAlhftW7cYn1dT\n" + "26 DUP\n" + "27 LDC \"RuleWithComplexActionSetup_Action1\"\n" + "28 INVOKESPECIAL org/parboiled/transform/Action$HCsAlhftW7cYn1dT.<init> (Ljava/lang/String;)V\n" + "29 DUP\n" + "30 ILOAD 2\n" + "31 PUTFIELD org/parboiled/transform/Action$HCsAlhftW7cYn1dT.field$0 : I\n" + "32 DUP\n" + "33 ILOAD 1\n" + "34 PUTFIELD org/parboiled/transform/Action$HCsAlhftW7cYn1dT.field$1 : I\n" + "35 DUP\n" + "36 ILOAD 3\n" + "37 PUTFIELD org/parboiled/transform/Action$HCsAlhftW7cYn1dT.field$2 : I\n" + "38 ICONST_2\n" + "39 ANEWARRAY java/lang/Object\n" + "40 DUP\n" + "41 ICONST_0\n" + "42 ALOAD 4\n" + "43 AASTORE\n" + "44 DUP\n" + "45 ICONST_1\n" + "46 NEW org/parboiled/transform/Action$ARäVEaFtWytNAZGB\n" + "47 DUP\n" + "48 LDC \"RuleWithComplexActionSetup_Action2\"\n" + "49 INVOKESPECIAL org/parboiled/transform/Action$ARäVEaFtWytNAZGB.<init> (Ljava/lang/String;)V\n" + "50 DUP\n" + "51 ALOAD 0\n" + "52 PUTFIELD org/parboiled/transform/Action$ARäVEaFtWytNAZGB.field$0 : Lorg/parboiled/transform/TestParser$$parboiled;\n" + "53 DUP\n" + "54 ILOAD 1\n" + "55 PUTFIELD org/parboiled/transform/Action$ARäVEaFtWytNAZGB.field$1 : I\n" + "56 DUP\n" + "57 ALOAD 4\n" + "58 PUTFIELD org/parboiled/transform/Action$ARäVEaFtWytNAZGB.field$2 : Lorg/parboiled/support/Var;\n" + "59 DUP\n" + "60 ILOAD 2\n" + "61 PUTFIELD org/parboiled/transform/Action$ARäVEaFtWytNAZGB.field$3 : I\n" + "62 DUP\n" + "63 ILOAD 3\n" + "64 PUTFIELD org/parboiled/transform/Action$ARäVEaFtWytNAZGB.field$4 : I\n" + "65 AASTORE\n" + "66 INVOKEVIRTUAL org/parboiled/transform/TestParser.Sequence (Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Lorg/parboiled/Rule;\n" + "67 NEW org/parboiled/matchers/VarFramingMatcher\n" + "68 DUP_X1\n" + "69 SWAP\n" + "70 BIPUSH 1\n" + "71 ANEWARRAY org/parboiled/support/Var\n" + "72 DUP\n" + "73 BIPUSH 0\n" + "74 ALOAD 4\n" + "75 DUP\n" + "76 LDC \"RuleWithComplexActionSetup:string\"\n" + "77 INVOKEVIRTUAL org/parboiled/support/Var.setName (Ljava/lang/String;)V\n" + "78 AASTORE\n" + "79 INVOKESPECIAL org/parboiled/matchers/VarFramingMatcher.<init> (Lorg/parboiled/Rule;[Lorg/parboiled/support/Var;)V\n" + "80 ARETURN\n"); } }
[ "mathias@parboiled.org" ]
mathias@parboiled.org
7156a4d8dd4ac86e0a27f7bb0e75bfc8698bef4b
dd1dc7ab0354d99265bb8a919f188b97c2c0ec68
/app/src/main/java/isswatcher/manuelweb/at/Services/Models/IssLocation.java
19b2824af45dba0fed9afa015b443a64de47e00f
[]
no_license
manuelhintermayr/Android-ISS-Watcher
c43b7592a5ebcdcbe2cd43b612f34069135dd2cd
d6b01ad319c5d50f1f8129ce2f8f269081f62759
refs/heads/master
2020-04-19T11:29:31.290239
2019-02-27T12:49:31
2019-02-27T12:49:31
168,168,932
0
0
null
null
null
null
UTF-8
Java
false
false
899
java
package isswatcher.manuelweb.at.Services.Models; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class IssLocation { @SerializedName("iss_position") @Expose private IssPosition issPosition; @SerializedName("timestamp") @Expose private Integer timestamp; @SerializedName("message") @Expose private String message; public IssPosition getIssPosition() { return issPosition; } public void setIssPosition(IssPosition issPosition) { this.issPosition = issPosition; } public Integer getTimestamp() { return timestamp; } public void setTimestamp(Integer timestamp) { this.timestamp = timestamp; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }
[ "manuel@hintermayr.net" ]
manuel@hintermayr.net
dd2861c122b69d2d38e8e4dc3abffe22c9786107
379dd3e239dc3f3236e3e1304f8e611bf182e30e
/java-multi-thread-chapter02/src/main/java/t2/HasSelfPrivateNum.java
d65cd6792b4f0ad14c4da0df88c80b290f325113
[]
no_license
only3seconds/Multi-Thread
b11b12fbcd0e458c8202dac203a3b8089607aeff
d9e6291c539da38307e6347e4658222bbcc1119b
refs/heads/master
2020-12-30T15:42:49.296526
2017-10-01T06:49:10
2017-10-01T06:49:10
91,170,890
0
0
null
null
null
null
UTF-8
Java
false
false
454
java
package t2; public class HasSelfPrivateNum { private int num = 0; synchronized public void addI(String username){ try { if(username.equals("a")){ num=100; System.out.println("a set over!"); Thread.sleep(2000); } else { num=200; System.out.println("b set over!"); } System.out.println(username+" num= "+num); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "TripleP3@163.com" ]
TripleP3@163.com
599c91e9ad1312d415961154e9a059a7d7080e52
46167791cbfeebc8d3ddc97112764d7947fffa22
/quarkus/src/main/java/com/justexample/repository/Entity1043Repository.java
bbe485e90da7f85019d0f58a52a90174f2fbbe43
[]
no_license
kahlai/unrealistictest
4f668b4822a25b4c1f06c6b543a26506bb1f8870
fe30034b05f5aacd0ef69523479ae721e234995c
refs/heads/master
2023-08-25T09:32:16.059555
2021-11-09T08:17:22
2021-11-09T08:17:22
425,726,016
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package com.example.repository; import java.util.List; import com.example.entity.Entity1043; import org.springframework.data.jpa.repository.JpaRepository; public interface Entity1043Repository extends JpaRepository<Entity1043,Long>{ }
[ "laikahhoe@gmail.com" ]
laikahhoe@gmail.com
dc37b0ad3cb4e27687d1fe13f4942a80998b00c7
5af0568f8f5fc6419aa626531648ed19ba268beb
/egradle-plugin-main/src/main/java/de/jcup/egradle/core/Constants.java
077a3b3b1ff7772db39ac1cbfaf94984fa893dc8
[ "Apache-2.0" ]
permissive
wolfgang-ch/egradle
89a09287fa3cad93636b463baec31c5ddcb3cf6a
1bff129bf84c8b1ad465621ad6b8591717655b32
refs/heads/master
2021-01-20T08:14:05.987432
2017-05-03T07:44:10
2017-05-03T07:44:10
90,116,554
0
0
null
2017-05-03T06:38:54
2017-05-03T06:38:54
null
UTF-8
Java
false
false
1,183
java
/* * Copyright 2016 Albert Tregnaghi * * 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 de.jcup.egradle.core; public class Constants { public static final String VIRTUAL_ROOTPROJECT_NAME = "- virtual root project"; public static final String VIRTUAL_ROOTPROJECT_FOLDERNAME = ".egradle"; public static final String CONSOLE_FAILED = "[FAILED]"; public static final String CONSOLE_OK = "[OK]"; public static final String CONSOLE_WARNING = "[WARNING]"; /** * Validation output is shrinked to optimize validation performance. The value marks what is the limit of lines necessary to validate */ public static final int VALIDATION_OUTPUT_SHRINK_LIMIT = 25; }
[ "albert.tregnaghi@gmail.com" ]
albert.tregnaghi@gmail.com
4b07be0ec6c8bc0846caff8072fd380d84ee3f8b
c173832fd576d45c875063a1a480672fbd59ca04
/seguridad/localgismezcla/src/com/geopista/server/database/validacion/beans/V_casa_con_uso_bean.java
646d0d50ee1ff4e115d7a95e3046c5f7aa962d1a
[]
no_license
jormaral/allocalgis
1308616b0f3ac8aa68fb0820a7dfa89d5a64d0e6
bd5b454b9c2e8ee24f70017ae597a32301364a54
refs/heads/master
2021-01-16T18:08:36.542315
2016-04-12T11:43:18
2016-04-12T11:43:18
50,914,723
0
0
null
2016-02-02T11:04:27
2016-02-02T11:04:27
null
UTF-8
Java
false
false
1,390
java
package com.geopista.server.database.validacion.beans; public class V_casa_con_uso_bean { String clave="-"; String provincia="-"; String municipio="-"; String entidad="-"; String poblamient="-"; String orden_casa="-"; String uso="-"; int s_cubi; public String getClave() { return clave; } public void setClave(String clave) { this.clave = clave; } public String getProvincia() { return provincia; } public void setProvincia(String provincia) { this.provincia = provincia; } public String getMunicipio() { return municipio; } public void setMunicipio(String municipio) { this.municipio = municipio; } public String getEntidad() { return entidad; } public void setEntidad(String entidad) { this.entidad = entidad; } public String getPoblamient() { return poblamient; } public void setPoblamient(String poblamient) { this.poblamient = poblamient; } public String getOrden_casa() { return orden_casa; } public void setOrden_casa(String orden_casa) { this.orden_casa = orden_casa; } public String getUso() { return uso; } public void setUso(String uso) { this.uso = uso; } public int getS_cubi() { return s_cubi; } public void setS_cubi(int s_cubi) { this.s_cubi = s_cubi; } }
[ "jorge.martin@cenatic.es" ]
jorge.martin@cenatic.es
091b5003ec0cb3bcf191afc00e332fa815a9acb6
e85fdbb92e9f9d46974f3502d07390132115f02e
/PrimeiroIncremento/src/java/aplicacao/Fabrica.java
dc9812f6b76be2d1ab66a59336646bcef0025926
[]
no_license
matheusmf/ShoppingVirtual
1c8b74d6d6141255b3cd2c100f70786a852a59b1
42dfc2d66aea28c1a3ae6abc11e531a3a9e366cb
refs/heads/master
2021-01-04T14:07:23.225177
2010-12-05T19:23:12
2010-12-05T19:23:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,604
java
package aplicacao; import controladoresJpa.*; import controladoresJpa.exceptions.NonexistentEntityException; /** * * @author matheusmf */ public class Fabrica { private static Fabrica f = new Fabrica(); private Fabrica(){ } public static Fabrica getInstancia(){ return f; } public Loja criaLoja(String nome){ Loja loja = new Loja(); loja.setNome(nome); return loja; } public Produto criaProduto(String nome, int quantidade, double preco, String imagem, Loja loja){ Produto produto = new Produto(); produto.setNome(nome); produto.setQuantidade(quantidade); produto.setPreco(preco); produto.setImagem(imagem); produto.setLoja(loja); return produto; } public Carrinho criaCarrinho(){ return new Carrinho(); } public Pedido criaPedido(Carrinho carrinho, double valorTotal){ Pedido pedido = new Pedido(); pedido.setCarrinho(carrinho); pedido.setValorTotal(valorTotal); return pedido; } public Item criaItem(){ return new Item(); } public static void main(String[] args) throws NonexistentEntityException, Exception{ LojaJpaController lojaJpa = new LojaJpaController(); ProdutoJpaController produtoJpa = new ProdutoJpaController(); CarrinhoJpaController carrinhoJpa = new CarrinhoJpaController(); PedidoJpaController pedidoJpa = new PedidoJpaController(); Loja loja = Fabrica.getInstancia().criaLoja("Apple"); lojaJpa.create(loja); Produto produto1 = Fabrica.getInstancia().criaProduto("Iphone 3G", 10, 1299, "imgprodutos/Apple/iphone3g300x300.png", loja); produtoJpa.create(produto1); Produto produto2 = Fabrica.getInstancia().criaProduto("Macbook Pro", 5, 3799, "imgprodutos/Apple/macbook300x300.png", loja); produtoJpa.create(produto2); Produto produto3 = Fabrica.getInstancia().criaProduto("Ipod Classic", 8, 899, "imgprodutos/Apple/ipodclassic300x300.png", loja); produtoJpa.create(produto3); Produto produto4 = Fabrica.getInstancia().criaProduto("Mac Mini", 7, 2699, "imgprodutos/Apple/macmini300x300.png", loja); produtoJpa.create(produto4); Produto produto5 = Fabrica.getInstancia().criaProduto("Ipod Nano", 20, 549, "imgprodutos/Apple/ipodnano300x300.png", loja); produtoJpa.create(produto5); Produto produto6 = Fabrica.getInstancia().criaProduto("Macbook Air", 3, 3199, "imgprodutos/Apple/macbookair300x300.png", loja); produtoJpa.create(produto6); Produto produto7 = Fabrica.getInstancia().criaProduto("Mac Pro", 3, 8299, "imgprodutos/Apple/macpro300x300.png", loja); produtoJpa.create(produto7); Produto produto8 = Fabrica.getInstancia().criaProduto("Imac", 4, 4999, "imgprodutos/Apple/imac300x300.png", loja); produtoJpa.create(produto8); Carrinho carrinho = Fabrica.getInstancia().criaCarrinho(); carrinhoJpa.create(carrinho); /*ShoppingVirtual.getInstancia().adicionarItemCarrinho(carrinho, produto1.getId(), produto1.getPreco()); ShoppingVirtual.getInstancia().adicionarItemCarrinho(carrinho, produto2.getId(), produto2.getPreco()); ShoppingVirtual.getInstancia().finalizarCompra(carrinho);*/ //carrinho.adicionarItem(produto1.getId(), 1, produto1.getPreco()); //carrinhoJpa.edit(carrinho); //carrinho.finalizarCarrinho(); //Pedido pedido = pedidoJpa.findPedido(1); //pedido.finalizarPedido(); } }
[ "raullermen@gmail.com" ]
raullermen@gmail.com
118321e61cee0f0f5a2091a2cb0fe2f53c0c9029
59d56ad52a7e016883b56b73761104a17833a453
/src/main/java/com/whatever/SempService/ObjectFactory.java
734820f4c4b95df83769e78afd7f09420e2c6a6f
[]
no_license
zapho/cxf-client-quarkus
3c330a3a5f370cce21c5cd1477ffbe274d1bba59
6e147d44b9ea9cc455d52f0efe234ef787b336c4
refs/heads/master
2023-01-22T03:33:27.579072
2020-12-08T14:55:27
2020-12-08T14:55:27
319,641,033
0
0
null
null
null
null
UTF-8
Java
false
false
3,331
java
package com.whatever.SempService; import javax.xml.bind.annotation.XmlRegistry; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the com.whatever.SempService package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.whatever.SempService * */ public ObjectFactory() { } /** * Create an instance of {@link GetChildren } * */ public GetChildren createGetChildren() { return new GetChildren(); } /** * Create an instance of {@link SearchByIdResponse } * */ public SearchByIdResponse createSearchByIdResponse() { return new SearchByIdResponse(); } /** * Create an instance of {@link Semp } * */ public Semp createSemp() { return new Semp(); } /** * Create an instance of {@link GetParent } * */ public GetParent createGetParent() { return new GetParent(); } /** * Create an instance of {@link SearchById } * */ public SearchById createSearchById() { return new SearchById(); } /** * Create an instance of {@link SearchByName } * */ public SearchByName createSearchByName() { return new SearchByName(); } /** * Create an instance of {@link SearchByNameResponse } * */ public SearchByNameResponse createSearchByNameResponse() { return new SearchByNameResponse(); } /** * Create an instance of {@link ArrayOfSemp } * */ public ArrayOfSemp createArrayOfSemp() { return new ArrayOfSemp(); } /** * Create an instance of {@link GetChildrenResponse } * */ public GetChildrenResponse createGetChildrenResponse() { return new GetChildrenResponse(); } /** * Create an instance of {@link SearchByProductId } * */ public SearchByProductId createSearchByProductId() { return new SearchByProductId(); } /** * Create an instance of {@link GetParentResponse } * */ public GetParentResponse createGetParentResponse() { return new GetParentResponse(); } /** * Create an instance of {@link GetRootNode } * */ public GetRootNode createGetRootNode() { return new GetRootNode(); } /** * Create an instance of {@link GetRootNodeResponse } * */ public GetRootNodeResponse createGetRootNodeResponse() { return new GetRootNodeResponse(); } /** * Create an instance of {@link SearchByProductIdResponse } * */ public SearchByProductIdResponse createSearchByProductIdResponse() { return new SearchByProductIdResponse(); } }
[ "fabrice.aupert@dedalus-group.com" ]
fabrice.aupert@dedalus-group.com
106c8b722554481d844ebe901592486e5a3ce4b3
5e876ccbb08bc1de3c2f9e1ce374576e2edd223b
/SENG 275/jpacman/src/default-test/java/jpacman/board/BoardTest.java
4bfbe931888b729e88d322072c4303499f80f43a
[ "Apache-2.0" ]
permissive
amaanmakhani/Codingprojects
ccaaf367d1cb0229898541bd872abbcc7c63ac49
0b675e30223153e91daffed8812ce1ad0496aa74
refs/heads/master
2021-12-30T09:39:43.236320
2021-12-23T00:46:12
2021-12-23T00:46:12
153,844,959
1
1
null
2019-01-26T23:42:22
2018-10-19T21:39:32
C++
UTF-8
Java
false
false
1,474
java
package jpacman.board; import jpacman.board.Board; import jpacman.board.Square; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; /** * Test various aspects of board. * * @author Jeroen Roosen */ class BoardTest { private static final int MAX_WIDTH = 2; private static final int MAX_HEIGHT = 3; private final Square[][] grid = { { mock(Square.class), mock(Square.class), mock(Square.class) }, { mock(Square.class), mock(Square.class), mock(Square.class) }, }; private final Board board = new Board(grid); /** * Verifies the board has the correct width. */ @Test void verifyWidth() { assertThat(board.getWidth()).isEqualTo(MAX_WIDTH); } /** * Verifies the board has the correct height. */ @Test void verifyHeight() { assertThat(board.getHeight()).isEqualTo(MAX_HEIGHT); } /** * Verify that squares at key positions are properly set. * @param x Horizontal coordinate of relevant cell. * @param y Vertical coordinate of relevant cell. */ @ParameterizedTest @CsvSource({ "0, 0", "1, 2", "0, 1" }) void testSquareAt(int x, int y) { assertThat(board.squareAt(x, y)).isEqualTo(grid[x][y]); } }
[ "44305650+amaanmakhani@users.noreply.github.com" ]
44305650+amaanmakhani@users.noreply.github.com
dce4a810dd1b67f73df7a77e38a636a095c6a2df
98299ac9298b1a206237ffbc57b56309dc7e2715
/demoflavius/Android Solution/demoflavius/src/com/example/demoflavius/util/SoundManager.java
d62070f296af754e4e4be0dc4e4dc8ee7d5c7838
[]
no_license
arun1904/Chat-App
a39b8b157b8ff2a3b72d7a8397176ba7c55bb058
d7e73873dc8f8143a3ca8e3ac898040836ebd4c9
refs/heads/master
2021-01-22T01:39:09.302138
2014-05-15T20:02:21
2014-05-15T20:02:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
package com.example.demoflavius.util; import android.content.Context; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.SoundPool; import com.example.demoflavius.R; import com.example.demoflavius.application.MyApplication; public class SoundManager { private Context pContext; private SoundPool sndPool; private static float rate = 1.0f; private float masterVolume = 1.0f; private float leftVolume = 1.0f; private float rightVolume = 1.0f; private float balance = 0.5f; private static MediaPlayer mp; // Constructor, setup the audio manager and store the app context public SoundManager(Context appContext) { sndPool = new SoundPool(16, AudioManager.STREAM_MUSIC, 100); pContext = appContext; } // Load up a sound and return the id public int load(int sound_id) { return sndPool.load(pContext, sound_id, 1); } // Play a sound public void play(int sound_id) { sndPool.play(sound_id, leftVolume, rightVolume, 1, 0, rate); } // Set volume values based on existing balance value public void setVolume(float vol) { masterVolume = vol; if(balance < 1.0f) { leftVolume = masterVolume; rightVolume = masterVolume * balance; } else { rightVolume = masterVolume; leftVolume = masterVolume * ( 2.0f - balance ); } } public void setSpeed(float speed) { rate = speed; // Speed of zero is invalid if(rate < 0.01f) rate = 0.01f; // Speed has a maximum of 2.0 if(rate > 2.0f) rate = 2.0f; } public void setBalance(float balVal) { balance = balVal; // Recalculate volume levels setVolume(masterVolume); } // Free ALL the things! public void unloadAll() { sndPool.release(); } public static void playSound(int resId) { try { // Create an instance of our sound manger MyApplication.snd = new SoundManager(MyApplication.getCurrentActivity()); MyApplication.snd.load(R.raw.chat_sound); mp = MediaPlayer.create(MyApplication.getCurrentActivity(), resId); mp.start(); } catch(Exception ex) { ex.printStackTrace(); NotificationService.showDebugCrouton("failed at play Wav sound!"); } } public static void stopSound(){ mp.stop(); } }
[ "flaviusdemian91@hotmail.com" ]
flaviusdemian91@hotmail.com
d3b7c2b6e9f0f1d9c26258b8e9c5191e96a56357
594e02e5d665158f81b3eb0745398a4e4537a406
/DiseaseIdentification-master/DiseaseIdentification-master/app/src/main/java/com/example/ywang/diseaseidentification/adapter/SportCardsAdapter.java
c5774d337aad5319299d4fd1961db197ac6ba8cc
[ "Apache-2.0" ]
permissive
chengsiyuan123/Android--
cb63b218bf5a09d730c8617aba6582d03393ca4e
1843adfd92c1d6b852c60ec2863c3c22ef2f729c
refs/heads/master
2022-03-06T13:33:31.695931
2019-11-24T14:30:57
2019-11-24T14:30:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,497
java
package com.example.ywang.diseaseidentification.adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.example.ywang.diseaseidentification.R; import com.example.ywang.diseaseidentification.bean.baseData.cardData; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class SportCardsAdapter extends RecyclerView.Adapter<SportCardsAdapter.SportCardViewHolder> { private final List<cardData> mItems = new ArrayList<>(); private Context mContext; private OnItemClickListener mOnItemClickListener; public SportCardsAdapter(Context context) { mContext = context; } public boolean add(cardData item) { boolean isAdded = mItems.add(item); if (isAdded) { notifyDataSetChanged(); } return isAdded; } public void clear() { mItems.clear(); notifyDataSetChanged(); } public boolean addAll(Collection<cardData> items) { boolean isAdded = mItems.addAll(items); if (isAdded) { notifyDataSetChanged(); } return isAdded; } @NonNull @Override public SportCardViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_card, parent, false); return new SportCardViewHolder(view); } @Override public void onBindViewHolder(@NonNull final SportCardViewHolder holder, int position) { cardData item = mItems.get(position); Glide.with(mContext).load(item.getUrls()).into(holder.ivSportPreview); holder.tvTime.setText(item.getTime()); holder.tvDayPart.setText(item.getUtu()); holder.tvSportTitle.setText(item.getContent()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mOnItemClickListener != null) { mOnItemClickListener.onItemClicked(holder.getAdapterPosition(), holder.ivSportPreview); } } }); } @Override public int getItemCount() { return mItems.size(); } public OnItemClickListener getOnItemClickListener() { return mOnItemClickListener; } public void setOnItemClickListener(OnItemClickListener onItemClickListener) { mOnItemClickListener = onItemClickListener; } cardData getModelByPos(int pos) { return mItems.get(pos); } public interface OnItemClickListener { void onItemClicked(int pos, View view); } class SportCardViewHolder extends RecyclerView.ViewHolder { final TextView tvSportTitle; final TextView tvTime; final TextView tvDayPart; ImageView ivSportPreview; SportCardViewHolder(View itemView) { super(itemView); tvSportTitle = (TextView) itemView.findViewById(R.id.tvSportTitle); ivSportPreview = (ImageView) itemView.findViewById(R.id.ivSportPreview); tvTime = (TextView) itemView.findViewById(R.id.tvTime); tvDayPart = (TextView) itemView.findViewById(R.id.tvDayPart); } } }
[ "1577489928@qq.com" ]
1577489928@qq.com
fde931cef98cdda9e5363d728c11578efb0d39ba
f2890a388b806ff8158d79b5dc415d729b9cbd3a
/src/com/TestModify.java
5cfec9c00d53a47317396f8d3f66d18347ec7f24
[]
no_license
mapleKirito/BSMS_DataImport
50d3bfc274ac46bdbb3169a410f999a1424533b8
0b2c7db9d859fbd31c2b2542d96ec396159a70b4
refs/heads/master
2020-04-14T15:06:12.116408
2019-02-12T03:09:26
2019-02-12T03:09:26
163,916,090
0
0
null
null
null
null
UTF-8
Java
false
false
4,032
java
package com; import java.util.HashMap; import java.util.List; import java.util.Map; import test.db.DBConn; public class TestModify { public static void main(String[] args) { updatRoomProjec(); } @SuppressWarnings("unchecked") public static void updatRoomProjec(){ DBConn dbConn = DBConn.getInstance() ; Map<String,String> map = new HashMap<String, String>(); List<HashMap<String, String>> list = dbConn.select("select * from res_grade_relationship where GR_ResourceType='projection'"); int index = 0; for(Object o : list){ map = (HashMap<String, String>)o; String GR_Upload = map.get("GR_Upload").trim(); GR_Upload = GR_Upload.replace("FYS30000", "").replace("0100", "0000"); /*String PR_FileSwf = map.get("PR_FileSwf").trim(); PR_FileSwf = PR_FileSwf.replace("FYS30000", "").replace("0100", "0000");*/ long GR_ID = Long.parseLong(map.get("GR_ID").trim()); String sql1 = "update res_grade_relationship set GR_Upload ='"+GR_Upload+"' where GR_ResourceType='projection' and GR_ID="+GR_ID; System.out.println(sql1+"\n"); dbConn.update(sql1); } System.out.println(" --- " + index); } @SuppressWarnings("unchecked") public static void updatRoomRecomObser(){ DBConn dbConn = DBConn.getInstance() ; Map<String,String> map = new HashMap<String, String>(); List<HashMap<String, String>> list = dbConn.select("select * from res_observation_room where OR_Type = 1084 and OR_ID>=794"); int index = 0; for(Object o : list){ map = (HashMap<String, String>)o; String OR_Upload = map.get("OR_Upload").trim(); OR_Upload = OR_Upload.replace("GCS30000", ""); String OR_FileSwf = map.get("OR_FileSwf").trim(); OR_FileSwf = OR_FileSwf.replace("GCS30000", ""); long OR_ID = Long.parseLong(map.get("OR_ID").trim()); String sql = "update res_observation_room set OR_Upload='"+OR_Upload+"',OR_FileSwf='"+OR_FileSwf+"' where OR_ID="+OR_ID; String sql1 = "update res_resource set RR_Upload='"+OR_Upload+"',RR_FileSwf='"+OR_FileSwf+"' where RR_ResourceType = 'observation' and RR_ResourceID = "+OR_ID; System.out.println(sql); System.out.println(sql1+"\n"); dbConn.update(sql); dbConn.update(sql1); } System.out.println(" --- " + index); } @SuppressWarnings("unchecked") public static void updatRoomRecom(String room){ DBConn dbConn = DBConn.getInstance() ; Map<String,String> map = new HashMap<String, String>(); List<HashMap<String, String>> list = dbConn.select("select * from res_laboratory_room where LR_ID<=16"); int index = 0; for(Object o : list){ index++; map = (HashMap<String, String>)o; String LR_Upload = map.get("LR_Upload").trim(); String LR_FileSwfPath = map.get("LR_FileSwfPath").trim(); String LR_NO = map.get("LR_NO").trim(); long RE_RecommendID = Long.parseLong(map.get("LR_ID").trim()); LR_NO = LR_NO.replace("SYS3000001", "SYS0000000"); LR_Upload = LR_Upload.replace("SYS3000001", "00"); LR_FileSwfPath = LR_FileSwfPath.replace("SYS3000001", "00"); String sql = "update res_laboratory_room set LR_NO='"+LR_NO+"', LR_Upload='"+LR_Upload+"', LR_FileSwfPath = '"+LR_FileSwfPath+"' where LR_ID = " + RE_RecommendID; String sql1 = "update res_resource set RR_Upload='"+LR_Upload+"' where RR_ResourceType = 'laboratory' and RR_ResourceID = " + RE_RecommendID; System.out.println(sql); System.out.println(sql1+"\n"); dbConn.update(sql); dbConn.update(sql1); } System.out.println(room+" --- " + index); } public static String reResAbbreviated(String resType) { if("exhibition".equals(resType)) { return "er" ; }else if("observation".equals(resType)) { return "or" ; }else if("laboratory".equals(resType)) { return "lr" ; }else if("projection".equals(resType)) { return "pr" ; }else if("expand".equals(resType)) { return "er" ; } return resType ; } }
[ "myzhouye@gmail.com" ]
myzhouye@gmail.com
d001953b5a40453c2bffc4422a8442c13e21c527
1c85f6ba14b7762cf14fc5453b07a93dc735afc2
/java/elevator/test_lock.java
57ad91e570f318f4998665eaa306c8a3a96f3046
[]
no_license
jashook/ev6
557bceb82d4e0e241c51f7ba27cc4cfa00f98408
97e7787b23fae38719538daf19a6ab119519e662
refs/heads/master
2021-01-22T23:16:06.702451
2013-10-12T18:39:44
2013-10-12T18:39:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,900
java
//////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // // Author: Jarret Shook // // Module: test_lock.java // // Modifications: // // 4-April-13: Version 1.0: Created // // Timeperiod: ev6 // //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// import java.util.*; public class test_lock implements Runnable { private static ArrayList<Integer> _m_integer = new ArrayList<Integer>(); private static boolean _m_wait = true; private Object _m_lock = new Object(); public void run() { if (_m_wait) { synchronized (_m_lock) { System.out.println("Locked!"); try { Thread.sleep(10000); } catch(Exception e) { } for (Integer _Int : _m_integer) System.out.print(_Int.toString() + " "); System.out.println(); System.out.println("Unlocked!"); } } else { synchronized (_m_lock) { System.out.println("Locked!"); Integer _Int1 = _m_integer.get(2); System.out.println(_Int1.toString()); for (Integer _Int : _m_integer) System.out.print(_Int.toString() + " "); System.out.println(); System.out.println("Unlocked!"); } } } public static void main(String[] args) throws Exception { for (int i = 0; i < 10; ++i) _m_integer.add(new Integer(i)); Thread _Test = new Thread(new test_lock()); Thread _Test2 = new Thread(new test_lock()); _Test.start(); Thread.sleep(1000); _m_wait = false; _Test2.start(); _Test.join(); _Test2.join(); } }
[ "jashook@optonline.net" ]
jashook@optonline.net
73b28abb40c9c09f2d1c9bb064245d47916dc7d7
7314cabc8bc85b32f90215a688f7baa33f9a2f40
/4.JavaCollections/src/com/javarush/task/task34/task3413/SoftCache.java
b6d0bd6272d4e8b217dd64603bb6eb612a2a5cbd
[]
no_license
maksimkoniukhau/JavaRushTasks
dcfe5e431f176364b700142cc0a8c3f20e03f7a9
63ec1cd8ed150d0fa49c3a5239f1320abd0ea53a
refs/heads/master
2023-01-05T17:47:35.453864
2018-05-27T13:29:33
2018-05-27T13:29:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,045
java
package com.javarush.task.task34.task3413; import java.lang.ref.SoftReference; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; public class SoftCache { private Map<Long, SoftReference<AnyObject>> cacheMap = new ConcurrentHashMap<>(); public AnyObject get(Long key) { SoftReference<AnyObject> softReference = cacheMap.get(key); if (softReference == null) return null; return softReference.get(); } public AnyObject put(Long key, AnyObject value) { SoftReference<AnyObject> softReference = cacheMap.put(key, new SoftReference<>(value)); if (softReference == null) return null; AnyObject anyObject = softReference.get(); softReference.clear(); return anyObject; } public AnyObject remove(Long key) { SoftReference<AnyObject> softReference = cacheMap.remove(key); if (softReference == null) return null; AnyObject anyObject = softReference.get(); softReference.clear(); return anyObject; } }
[ "maksimys87051@gmail.com" ]
maksimys87051@gmail.com
ce45f84d4a9b63db459eddec1c0b6c982f7b7bae
b83aacc3501dc9857930424cb38f4c389d9055b1
/src/main/java/com/github/utils/RegularUtils.java
aff3f49547bbabc81ecaec4f9f1773e1a2f65b52
[]
no_license
Edward-Shaw/Excel4J
7ba65e215f6f6f42b40213b76183d1f174240f8e
d4363f0fa3a61c5858a5f1030077f45eab89a08b
refs/heads/master
2021-01-02T22:48:29.165169
2017-08-05T05:45:04
2017-08-05T05:45:04
99,397,418
1
0
null
2017-08-05T03:50:53
2017-08-05T03:50:53
null
UTF-8
Java
false
false
2,747
java
package com.github.utils; import com.github.exceptions.IllegalGroupIndexException; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <p>正则匹配相关工具</p> * author : Crab2Died</br> * date : 2017/5/24 9:43</br> */ public class RegularUtils { /** * <p>判断内容是否匹配</p></br> * author : Crab2Died</br> * date : 2017年06月02日 15:46:25</br> * * @param pattern 匹配目标内容 * @param reg 正则表达式 * @return 返回boolean */ static public boolean isMatched(String pattern, String reg) { Pattern compile = Pattern.compile(reg); return compile.matcher(pattern).matches(); } /** * <p>正则提取匹配到的内容</p> * <p>例如:</p> * </br> * author : Crab2Died</br> * date : 2017年06月02日 15:49:51</br> * * @param pattern 匹配目标内容 * @param reg 正则表达式 * @param group 提取内容索引 * @return 提取内容集合 * @throws {@link IllegalGroupIndexException} */ static public List<String> match(String pattern, String reg, int group) throws IllegalGroupIndexException { List<String> matchGroups = new ArrayList<>(); Pattern compile = Pattern.compile(reg); Matcher matcher = compile.matcher(pattern); if (group > matcher.groupCount() || group < 0) throw new IllegalGroupIndexException("Illegal match group :" + group); while (matcher.find()) { matchGroups.add(matcher.group(group)); } return matchGroups; } /** * <p>正则提取匹配到的内容,默认提取索引为0</p> * <p>例如:</p> * </br> * author : Crab2Died</br> * date : 2017年06月02日 15:49:51</br> * * @param pattern 匹配目标内容 * @param reg 正则表达式 * @return 提取内容集合 * @throws {@link IllegalGroupIndexException} */ static public String match(String pattern, String reg) { String match = null; try { List<String> matchs = match(pattern, reg, 0); if (null != matchs && matchs.size() > 0) { match = matchs.get(0); } } catch (IllegalGroupIndexException e) { e.printStackTrace(); } return match; } public static String converNumByReg(String number){ Pattern compile = Pattern.compile("^(\\d+)(\\.0*)?$"); Matcher matcher = compile.matcher(number); while (matcher.find()){ number = matcher.group(1); } return number; } }
[ "hwb9588@126.com" ]
hwb9588@126.com
c80782aeaa2f01190203ea84625e274c2776c07f
605d48bedbf480bbfc8a01436249cc255c538545
/app/src/main/java/com/tifaniwarnita/prome/Promo.java
2bbf8792caea43af2b831cecd81385ec75019b83
[]
no_license
tifaniwarnita/ProMe
a7739e56f3e96e2afdbba4e2d0c649a91505a476
d4b02a8a4104fa0cd3d1975852a9b5db2f196adf
refs/heads/master
2021-01-01T03:53:26.682695
2016-05-15T01:54:05
2016-05-15T01:54:05
58,298,251
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package com.tifaniwarnita.prome; import android.graphics.Bitmap; /** * Created by Tifani on 5/15/2016. */ public class Promo { private String title; private String period; private String category; private Bitmap bitmap; public Promo(String title, String period, String category, Bitmap bitmap) { this.title = title; this.period = period; this.category = category; this.bitmap = bitmap; } public String getTitle() { return title; } public String getPeriod() { return period; } public String getCategory() { return category; } public Bitmap getBitmap() { return bitmap; } }
[ "tiffayumuyuka@gmail.com" ]
tiffayumuyuka@gmail.com
358a086a410e0b984ed16265bcce237aacfcecf5
e61a3071999af95dee93d64642532c7ba16c4838
/app/src/main/java/com/apnatutorials/autocompletetextviewwithcustomadapter/Customer.java
8cf5e45317891e034e60abfb588f88248cee9b6b
[]
no_license
apnatutorials/AutoCompleteTextViewWithCustomAdapter
8466696bfb46f3b3018fc9012bab3f16bd5c0f6f
40942845a5cb6e9b6fc8ab6a19c5802d318e2506
refs/heads/master
2021-01-13T07:34:00.321381
2016-09-28T17:50:53
2016-09-28T17:50:53
69,488,948
0
0
null
null
null
null
UTF-8
Java
false
false
1,113
java
package com.apnatutorials.autocompletetextviewwithcustomadapter; public class Customer { private String firstName = ""; private String lastName = ""; private int id = 0; private int profilePic = -1; public Customer(String firstName, String lastName, int id, int pic) { this.firstName = firstName; this.lastName = lastName; this.id = id; this.profilePic = pic; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getProfilePic() { return profilePic; } public void setProfilePic(int profilePic) { this.profilePic = profilePic; } @Override public String toString() { return this.firstName + " " + this.lastName; } }
[ "apnasoftwarezone@gmail.com" ]
apnasoftwarezone@gmail.com