blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
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
sequencelengths
1
1
author_id
stringlengths
0
313
8180746bb7c9222b1b87516c4f603342f4b634af
b0f12498038fea32e5471f25ad2106d349c9dde0
/app/src/main/java/br/com/thiengo/opessistema/domain/Opcao.java
41912f0b439d0b58e3cb459ebd5e2b3fff0dfeb9
[]
no_license
viniciusthiengo/opcoes-sistema-status-itens-list
7b9107f71f718b7d2a0296c5a7f2e0347032a617
4b905e95d8be7fc25501cf56cd1784c571ceea50
refs/heads/master
2021-01-17T04:29:34.171171
2020-05-14T15:44:12
2020-05-14T15:44:12
82,966,098
1
2
null
null
null
null
UTF-8
Java
false
false
507
java
package br.com.thiengo.opessistema.domain; public class Opcao { private String nome; private boolean status; public Opcao( String nome, boolean status ){ this.nome = nome; this.status = status; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public boolean ehStatus() { return status; } public void setStatus(boolean status) { this.status = status; } }
a3a8f3a40b689370c2d2919737eaed4a04fb49ae
3fe8e5db53dc425afdb24303f2f6926cade14f04
/user/newZXingQrCode/src/main/java/com/zxing/camera/CameraConfigurationManager.java
5c76f8b9dbc8f826bed669f38b1dbb5ddf988470
[]
no_license
llorch19/ezt_user_code
087a9474a301d8d8fef7bd1172d6c836373c2faf
ee82f4bfbbd14c81976be1275dcd4fc49f6b1753
refs/heads/master
2021-06-01T09:40:19.437831
2016-08-10T02:33:35
2016-08-10T02:33:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,356
java
package com.zxing.camera; import java.util.regex.Pattern; import android.content.Context; import android.graphics.Point; import android.hardware.Camera; import android.os.Build; import android.util.Log; import android.view.Display; import android.view.WindowManager; final class CameraConfigurationManager { private static final String TAG = CameraConfigurationManager.class.getSimpleName(); private static final int TEN_DESIRED_ZOOM = 27; private static final int DESIRED_SHARPNESS = 30; private static final Pattern COMMA_PATTERN = Pattern.compile(","); private final Context context; private Point screenResolution; private Point cameraResolution; private int previewFormat; private String previewFormatString; CameraConfigurationManager(Context context) { this.context = context; } /** * Reads, one time, values from the camera that are needed by the app. */ void initFromCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); previewFormat = parameters.getPreviewFormat(); previewFormatString = parameters.get("preview-format"); Log.d(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); screenResolution = new Point(display.getWidth(), display.getHeight()); Log.d(TAG, "Screen resolution: " + screenResolution); cameraResolution = getCameraResolution(parameters, screenResolution); Log.d(TAG, "Camera resolution: " + screenResolution); } /** * Sets the camera up to take preview images which are used for both preview and decoding. * We detect the preview format here so that buildLuminanceSource() can build an appropriate * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest, * and the planar Y can be used for barcode scanning without a copy in some cases. */ void setDesiredCameraParameters(Camera camera) { Camera.Parameters parameters = camera.getParameters(); Log.d(TAG, "Setting preview size: " + cameraResolution); parameters.setPreviewSize(cameraResolution.x, cameraResolution.y); setFlash(parameters); setZoom(parameters); //setSharpness(parameters); //modify here camera.setDisplayOrientation(90); camera.setParameters(parameters); } Point getCameraResolution() { return cameraResolution; } Point getScreenResolution() { return screenResolution; } int getPreviewFormat() { return previewFormat; } String getPreviewFormatString() { return previewFormatString; } private static Point getCameraResolution(Camera.Parameters parameters, Point screenResolution) { String previewSizeValueString = parameters.get("preview-size-values"); // saw this on Xperia if (previewSizeValueString == null) { previewSizeValueString = parameters.get("preview-size-value"); } Point cameraResolution = null; if (previewSizeValueString != null) { Log.d(TAG, "preview-size-values parameter: " + previewSizeValueString); cameraResolution = findBestPreviewSizeValue(previewSizeValueString, screenResolution); } if (cameraResolution == null) { // Ensure that the camera resolution is a multiple of 8, as the screen may not be. cameraResolution = new Point( (screenResolution.x >> 3) << 3, (screenResolution.y >> 3) << 3); } return cameraResolution; } private static Point findBestPreviewSizeValue(CharSequence previewSizeValueString, Point screenResolution) { int bestX = 0; int bestY = 0; int diff = Integer.MAX_VALUE; for (String previewSize : COMMA_PATTERN.split(previewSizeValueString)) { previewSize = previewSize.trim(); int dimPosition = previewSize.indexOf('x'); if (dimPosition < 0) { Log.w(TAG, "Bad preview-size: " + previewSize); continue; } int newX; int newY; try { newX = Integer.parseInt(previewSize.substring(0, dimPosition)); newY = Integer.parseInt(previewSize.substring(dimPosition + 1)); } catch (NumberFormatException nfe) { Log.w(TAG, "Bad preview-size: " + previewSize); continue; } int newDiff = Math.abs(newX - screenResolution.x) + Math.abs(newY - screenResolution.y); if (newDiff == 0) { bestX = newX; bestY = newY; break; } else if (newDiff < diff) { bestX = newX; bestY = newY; diff = newDiff; } } if (bestX > 0 && bestY > 0) { return new Point(bestX, bestY); } return null; } private static int findBestMotZoomValue(CharSequence stringValues, int tenDesiredZoom) { int tenBestValue = 0; for (String stringValue : COMMA_PATTERN.split(stringValues)) { stringValue = stringValue.trim(); double value; try { value = Double.parseDouble(stringValue); } catch (NumberFormatException nfe) { return tenDesiredZoom; } int tenValue = (int) (10.0 * value); if (Math.abs(tenDesiredZoom - value) < Math.abs(tenDesiredZoom - tenBestValue)) { tenBestValue = tenValue; } } return tenBestValue; } private void setFlash(Camera.Parameters parameters) { // FIXME: This is a hack to turn the flash off on the Samsung Galaxy. // And this is a hack-hack to work around a different value on the Behold II // Restrict Behold II check to Cupcake, per Samsung's advice //if (Build.MODEL.contains("Behold II") && // CameraManager.SDK_INT == Build.VERSION_CODES.CUPCAKE) { if (Build.MODEL.contains("Behold II") && CameraManager.SDK_INT == 3) { // 3 = Cupcake parameters.set("flash-value", 1); } else { parameters.set("flash-value", 2); } // This is the standard setting to turn the flash off that all devices should honor. parameters.set("flash-mode", "off"); } private void setZoom(Camera.Parameters parameters) { String zoomSupportedString = parameters.get("zoom-supported"); if (zoomSupportedString != null && !Boolean.parseBoolean(zoomSupportedString)) { return; } int tenDesiredZoom = TEN_DESIRED_ZOOM; String maxZoomString = parameters.get("max-zoom"); if (maxZoomString != null) { try { int tenMaxZoom = (int) (10.0 * Double.parseDouble(maxZoomString)); if (tenDesiredZoom > tenMaxZoom) { tenDesiredZoom = tenMaxZoom; } } catch (NumberFormatException nfe) { Log.w(TAG, "Bad max-zoom: " + maxZoomString); } } String takingPictureZoomMaxString = parameters.get("taking-picture-zoom-max"); if (takingPictureZoomMaxString != null) { try { int tenMaxZoom = Integer.parseInt(takingPictureZoomMaxString); if (tenDesiredZoom > tenMaxZoom) { tenDesiredZoom = tenMaxZoom; } } catch (NumberFormatException nfe) { Log.w(TAG, "Bad taking-picture-zoom-max: " + takingPictureZoomMaxString); } } String motZoomValuesString = parameters.get("mot-zoom-values"); if (motZoomValuesString != null) { tenDesiredZoom = findBestMotZoomValue(motZoomValuesString, tenDesiredZoom); } String motZoomStepString = parameters.get("mot-zoom-step"); if (motZoomStepString != null) { try { double motZoomStep = Double.parseDouble(motZoomStepString.trim()); int tenZoomStep = (int) (10.0 * motZoomStep); if (tenZoomStep > 1) { tenDesiredZoom -= tenDesiredZoom % tenZoomStep; } } catch (NumberFormatException nfe) { // continue } } // Set zoom. This helps encourage the user to pull back. // Some devices like the Behold have a zoom parameter if (maxZoomString != null || motZoomValuesString != null) { parameters.set("zoom", String.valueOf(tenDesiredZoom / 10.0)); } // Most devices, like the Hero, appear to expose this zoom parameter. // It takes on values like "27" which appears to mean 2.7x zoom if (takingPictureZoomMaxString != null) { parameters.set("taking-picture-zoom", tenDesiredZoom); } } public static int getDesiredSharpness() { return DESIRED_SHARPNESS; } }
398194dd6c5fe7bb7fffff71e53211c8eca60b5b
dbc4036d98d9ee4981cbd15e062d36e4cb6216a9
/src/main/java/zhiyiting2/app/model/AppResponseModel.java
38357d6ff17501caf4d2fdb9f478d23a954d9f17
[]
no_license
Jlin0114/autotest
826a347e247eff4b689f4f19a9bef93b84f84f03
f0c0650530bd1047b662aee7d2e1842ad7e95ea6
refs/heads/master
2023-03-14T06:17:14.475715
2020-08-19T10:37:09
2020-08-19T10:37:09
344,986,247
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package zhiyiting2.app.model; public class AppResponseModel { private String fileId; private String code; private String message; public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getFileId() { return fileId; } public void setFileId(String fileId) { this.fileId = fileId; } }
3a06a70e1f9354156b39025097256f7504c860e7
61914dc8961d6cfc0c684dd768d1d64591c40bab
/javaSE_76_day10/src/Test04/Test04.java
e80d3a7701cac3ba5f0864947c7d20d019b53729
[]
no_license
fuqingge/learn
cc9c523b8a1dfe4f55005dfd402fbb8703e881db
25cb8dae1566e84f2ad646aae74a351f403337ec
refs/heads/master
2020-05-14T13:23:19.105856
2019-05-16T16:01:16
2019-05-16T16:01:16
181,802,296
1
0
null
null
null
null
UTF-8
Java
false
false
840
java
package Test04; import java.util.ArrayList; import java.util.stream.Stream; /* 已知ArrayList集合中有如下元素{陈玄风、梅超风、陆乘风、曲灵风、武眠风、冯默风、罗玉风},使用Stream 1、取出前2个元素并在控制台打印输出。 2、取出后2个元素并在控制台打印输出。 */ public class Test04 { public static void main(String[] args) { ArrayList<String> list = new ArrayList<String>(); list.add("陈玄风"); list.add("梅超风"); list.add("陆乘风"); list.add("曲灵风"); list.add("武眠风"); list.add("冯默风"); list.add("罗玉风"); list.stream().limit(2).forEach((s) -> System.out.println(s)); list.stream().skip(list.size() - 2).forEach((s) -> System.out.println(s)); } }
d6cbfca097c90c2c5ece1875bce7332562140f65
0006bf6d48b7052bb8ee8db753f6772ef472a283
/simple-validator-core/src/main/java/com/github/wautsns/simplevalidator/constraint/enumeration/codeofenum/VCodeOfEnum.java
4d0bbf5d04ad72ca435f6c234f68c162458b234d
[ "Apache-2.0" ]
permissive
wautsns/simple-validator
ac0f57559e3b0ffa95462403d469f8cd76084644
56cb42ff99b17d87ab308f3c0695c5da64709043
refs/heads/master
2021-01-14T07:22:59.024826
2020-07-25T15:13:36
2020-07-25T15:13:36
242,638,039
1
0
null
null
null
null
UTF-8
Java
false
false
2,684
java
/* * Copyright 2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.wautsns.simplevalidator.constraint.enumeration.codeofenum; import com.github.wautsns.simplevalidator.constraint.AConstraint; import com.github.wautsns.simplevalidator.kernal.criterion.factory.basic.CriterionFactory; import com.github.wautsns.simplevalidator.kernal.failure.Formatters; import com.github.wautsns.templatemessage.variable.Variable; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.Collections; import java.util.LinkedList; import java.util.List; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.RUNTIME; /** * VCodeOfEnum. * * @author wautsns * @since Mar 11, 2020 */ @Documented @Retention(RUNTIME) @Target({ FIELD, METHOD, PARAMETER, ANNOTATION_TYPE, TYPE_USE }) @AConstraint public @interface VCodeOfEnum { /** * Message(template). * * @return message(template) */ String message() default "[`VCodeOfEnum`]"; /** * Order of the constraint. * * @return order of the constraint */ int order() default 0; Class<? extends Enum<? extends CodableEnum<?>>> value(); String[] include() default {}; String[] exclude() default {}; // #################### extra ####################################################### /** Built-in criterion factories. */ List<CriterionFactory<VCodeOfEnum, ?, ?>> CRITERION_FACTORIES = new LinkedList<>(Collections.singletonList( VCodeOfEnumCriterionFactoryForAnyType.INSTANCE )); // ==================== variables =================================================== /** Variables: optionalValues. */ Variable<Object[]> OPTIONAL_VALUES = new Variable<>("optionalValues", Formatters.VALUES_NO_OPTIONAL_VALUE); }
867972fcd485d12a4a308f543443bfce2f3cddb5
9f9bf8d9d59c7c63ecaa87ebc7b15f0d28070b1a
/src/main/java/com/yitongyin/modules/ad/dao/BusMaterialTypeDao.java
d51e26f4135b44f614624b62c4a622ea002a1359
[]
no_license
cll-dev/web-app
b4323a68ea6e1678b013cb03cd00bd0839cff2cb
6cb5aac72708a995ff428c73162dca36352d0d84
refs/heads/master
2022-12-22T16:08:17.333495
2020-09-22T07:32:38
2020-09-22T07:32:38
297,571,850
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.yitongyin.modules.ad.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.yitongyin.modules.ad.entity.BusMaterialTypeEntity; import org.apache.ibatis.annotations.Mapper; @Mapper public interface BusMaterialTypeDao extends BaseMapper<BusMaterialTypeEntity> { }
5317d1e794f396152a35d67095a5991213f242bf
29acc5b6a535dfbff7c625f5513871ba55554dd2
/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/ListAppendFunction.java
ed1d6773aa68e6b5468e16b0f2c706a36a5bbeff
[ "JSON", "Apache-2.0" ]
permissive
joecastro/aws-sdk-java
b2d25f6a503110d156853836b49390d2889c4177
fdbff1d42a73081035fa7b0f172b9b5c30edf41f
refs/heads/master
2021-01-21T16:52:46.982971
2016-01-11T22:55:28
2016-01-11T22:55:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
/* * Copyright 2015-2016 Amazon Technologies, 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://aws.amazon.com/apache2.0 * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES * OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and * limitations under the License. */ package com.amazonaws.services.dynamodbv2.xspec; import com.amazonaws.annotation.Beta; /** * Represents the <a href= * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.Modifying.html" * >list_append(operand, operand)</a> function in building expression. * <p> * "list_append (operand, operand) ??? This function evaluates to a list with a * new element added to it. You can append the new element to the start or the * end of the list by reversing the order of the operands." * <p> * This object is as immutable (or unmodifiable) as the values in it's operands. */ @Beta public final class ListAppendFunction extends FunctionOperand { private final Operand first; private final Operand second; ListAppendFunction(Operand first, Operand second) { this.first = first; this.second = second; } @Override String asSubstituted(SubstitutionContext context) { return "list_append(" + first.asSubstituted(context) + ", " + second.asSubstituted(context) + ")"; } }
73a4888b8dfccee7af93e6d0ffd0b23ff32a9ac2
49d4fff6891f407c7388c1a9046ee0846412fc96
/src/main/java/com/bbw/webshopbackend/model/ProductRepository.java
015d7b31a27bcb63349fd7ed9dec67c0c2cb986c
[]
no_license
malte1koelle/webshop-backend
421a7f28dd43769d9eb83c8b4f9924abef37a4d1
2d52894eeb778dbb7881bf734548e8d9e401198e
refs/heads/master
2021-01-14T17:59:02.937303
2020-03-30T11:42:40
2020-03-30T11:42:40
242,704,525
0
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.bbw.webshopbackend.model; import org.springframework.data.repository.CrudRepository; // This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository // CRUD refers Create, Read, Update, Delete public interface ProductRepository extends CrudRepository<Product, Integer> { }
0cd0dcff7968b250759f8a5d087820957db65a40
36c831d781a5ec7669185cf27c5f91bfb9e61cd8
/mvn_plugins/as3Ncss-maven-plugin/src/test/java/com/adobe/ac/ncss/files/TestMxml.java
db0dab42e2a265feeecc3b6448c971591fbb5934
[]
no_license
francoisledroff/fna-v2
96d380829a9c9188422868622a742b35a0ec6946
9b58849aecf852504f1077c34c7eaa9ac33060e2
refs/heads/master
2021-01-10T11:46:36.452179
2016-01-16T17:33:34
2016-01-16T17:33:34
49,782,667
0
0
null
null
null
null
UTF-8
Java
false
false
1,863
java
package com.adobe.ac.ncss.files; import java.io.File; import java.net.URISyntaxException; import junit.framework.TestCase; import org.junit.Test; import com.adobe.ac.ncss.utils.FileUtils; public class TestMxml extends TestCase { @Test public void testGetFunctionsCount() throws URISyntaxException { Mxml iterationsList = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationsList.mxml" ).toURI() ) ) );; Mxml iterationView = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationView.mxml" ).toURI() ) ) );; assertEquals( 2, iterationsList.getFunctionsCount() ); assertEquals( 2, iterationView.getFunctionsCount() ); } @Test public void testGetLinesOfCode() throws URISyntaxException { Mxml iterationsList = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationsList.mxml" ).toURI() ) ) );; Mxml iterationView = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationView.mxml" ).toURI() ) ) );; assertEquals( 40, iterationsList.getLinesOfCode() ); assertEquals( 87, iterationView.getLinesOfCode() ); } @Test public void testGetLinesOfComments() throws URISyntaxException { Mxml iterationsList = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationsList.mxml" ).toURI() ) ) );; Mxml iterationView = new Mxml( FileUtils.readFile( new File( this.getClass().getResource( "/com/adobe/ac/ncss/mxml/IterationView.mxml" ).toURI() ) ) );; assertEquals( 2, iterationsList.getLinesOfComments() ); assertEquals( 0, iterationView.getLinesOfComments() ); } }
[ "francois.le.droff@7c565b1c-5fee-11de-92c7-cf56be1892c0" ]
francois.le.droff@7c565b1c-5fee-11de-92c7-cf56be1892c0
1a225b980b5f8d9599cd08ad1ab66a430cb336c6
23b6d6971a66cf057d1846e3b9523f2ad4e05f61
/MLMN-Statistics/src/vn/com/vhc/vmsc2/statistics/dao/MonitorKpi2gMailDAO.java
23be442dc712268d0c8ca7c7a1bdbf8276a64eea
[]
no_license
vhctrungnq/mlmn
943f5a44f24625cfac0edc06a0d1b114f808dfb8
d3ba1f6eebe2e38cdc8053f470f0b99931085629
refs/heads/master
2020-03-22T13:48:30.767393
2018-07-08T05:14:12
2018-07-08T05:14:12
140,132,808
0
1
null
2018-07-08T05:29:27
2018-07-08T02:57:06
Java
UTF-8
Java
false
false
778
java
package vn.com.vhc.vmsc2.statistics.dao; import java.util.List; import vn.com.vhc.vmsc2.statistics.domain.MonitorKpi2gMail; public interface MonitorKpi2gMailDAO { /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table MONITOR_KPI_2G_MAIL * * @ibatorgenerated Fri May 11 15:57:17 ICT 2018 */ void insert(MonitorKpi2gMail record); /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table MONITOR_KPI_2G_MAIL * * @ibatorgenerated Fri May 11 15:57:17 ICT 2018 */ void insertSelective(MonitorKpi2gMail record); List<MonitorKpi2gMail> getDataList(String startDate, String endDate); }
bf003fce737a768c6eff15e120128fb5c49a6085
8ce12b0d45705150d0015225fe4731315ed73279
/SeriesTracker/app/src/main/java/com/movile/up/seriestracker/business/restclients/UpdateRestClient.java
8a27eeb8d6544bc980d2bf6ff6e4736f07087ad9
[]
no_license
vitorandrietta/MovileUP
5eced3763f58bfb58992c90db074dd1643be263f
9827cb560ca61de406989a2261180102ef8e2394
refs/heads/master
2020-04-25T05:37:23.883971
2015-07-30T15:57:19
2015-07-30T15:57:19
38,892,186
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package com.movile.up.seriestracker.business.restclients; import android.content.Context; import com.movile.up.seriestracker.R; import com.movile.up.seriestracker.interfaces.rest.UpdatesRemoteService; import com.movile.up.seriestracker.model.models.ShowUpdate; import retrofit.RestAdapter; /** * Created by android on 7/23/15. */ public class UpdateRestClient { public static ShowUpdate getLastUpdate(Context context) { RestAdapter mAdapter = new RestAdapter.Builder().setEndpoint(context.getString(R.string.api_url_updates)).build(); UpdatesRemoteService service = mAdapter.create(UpdatesRemoteService.class); return service.getLatest(); } }
964c15f1e2140ff382612ae7a7878eb67b5e6816
72b6316321f45d650cbed01bcfb25c5015a64556
/4.JavaCollections/src/com/javarush/task/task32/task3205/Solution.java
62e90d931562c4a88c58763bbb22a1897825fce2
[]
no_license
whiskels/JavaRush
b7e21760c10f5d88da26261640024168052dd8d5
aaed9ee89249bdce0240fcdb3364741901311428
refs/heads/master
2022-11-27T19:55:55.788739
2020-08-08T12:50:04
2020-08-08T12:50:04
257,210,203
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package com.javarush.task.task32.task3205; import java.lang.reflect.Proxy; /* Создание прокси-объекта */ public class Solution { public static void main(String[] args) { SomeInterfaceWithMethods obj = getProxy(); obj.stringMethodWithoutArgs(); obj.voidMethodWithIntArg(1); /* expected output stringMethodWithoutArgs in inside stringMethodWithoutArgs stringMethodWithoutArgs out voidMethodWithIntArg in inside voidMethodWithIntArg inside voidMethodWithoutArgs voidMethodWithIntArg out */ } public static SomeInterfaceWithMethods getProxy() { SomeInterfaceWithMethods impl = new SomeInterfaceWithMethodsImpl(); SomeInterfaceWithMethods proxy = (SomeInterfaceWithMethods) Proxy.newProxyInstance(impl.getClass().getClassLoader(), impl.getClass().getInterfaces(), new CustomInvocationHandler(impl)); return proxy; } }
22c71a099fa62efa2608174170de60a868bf49ab
f61f16b03d4a73ca19c5e2e5fb22deae12d96af3
/src/javaFundamental/CompareTo.java
cf590d9cace50513d2e6ca68224ba1fc13e128ba
[]
no_license
cayori/kh
47d49d50597aa3d618443f9f9d24bc2f27952e4f
19df8a004956b46b139133cb4b7ec1b263f782c6
refs/heads/master
2021-07-04T04:24:55.124924
2017-09-25T23:54:08
2017-09-25T23:54:08
103,261,961
0
0
null
null
null
null
UTF-8
Java
false
false
197
java
package javaFundamental; public class CompareTo { public static void main(String[] args) { int c; String s1 = "A"; String s2 = "Z"; c = s1.compareTo(s2); System.out.println(c); } }
6ebc9a01a753dc4635e12a0b29c9630ec956f179
b41cde8d057cf54c2e9b0995d35d053e31f04a2a
/sdk/src/main/java/com/google/cloud/dataflow/sdk/util/NoopStager.java
b54018c49c4d98381fd0d605a2e50f4ddf677274
[ "Apache-2.0" ]
permissive
mxm/DataflowJavaSDK
37d00fe3c1fb0cdd61e0fe248224d8b74c96d120
1a4a54a9b81568af549b7cf5ac893517e5febf3b
refs/heads/master
2021-01-15T21:08:00.879690
2015-02-20T13:47:56
2015-02-20T13:48:49
31,066,732
0
0
null
2015-02-20T13:49:22
2015-02-20T13:49:21
null
UTF-8
Java
false
false
1,166
java
/* * Copyright (C) 2014 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.google.cloud.dataflow.sdk.util; import com.google.api.services.dataflow.model.DataflowPackage; import com.google.cloud.dataflow.sdk.options.PipelineOptions; import java.util.ArrayList; import java.util.List; /** * Do-nothing stager class. stageFiles() does nothing and returns an empty list of packages. */ class NoopStager implements Stager { public static NoopStager fromOptions(PipelineOptions options) { return new NoopStager(); } @Override public List<DataflowPackage> stageFiles() { return new ArrayList<DataflowPackage>(); } }
32039d4ca20c2d0259d2e76c1e9bf55445657699
c49aace871dfa8b64a6881c0ad34827a654a664f
/ClientApplication/src/com/clientapplication/User.java
1d36c162fbbd52852e5553db2ea2115fcfbcd221
[]
no_license
J-Sob/Klient-serwer-projekt
f5502acd2d8f0ece79ad11d1ba46f82748512884
0853c95d6d42985237a1edde04142d0552c23618
refs/heads/main
2023-06-10T01:16:35.198926
2021-07-03T17:48:22
2021-07-03T17:48:22
348,755,576
0
0
null
2021-07-03T15:23:46
2021-03-17T15:16:11
Java
UTF-8
Java
false
false
1,349
java
package com.clientapplication; import java.util.Vector; public class User { int id; String login; String password; Vector<Product> usersProducts; double totalPrice; public User(int id, String login, String password) { this.id = id; this.login = login; this.password = password; this.totalPrice = 0; this.usersProducts = new Vector<>(); } public void clearProducts(){ usersProducts.clear(); totalPrice = 0; } public void addProduct(Product product){ this.usersProducts.add(product); totalPrice += product.getPrice(); } public void removeProduct(int index){ totalPrice -= usersProducts.get(index).getPrice(); this.usersProducts.remove(index); } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getId() { return id; } public void setId(int id) { this.id = id; } public Vector<Product> getUsersProducts() { return usersProducts; } public double getTotalPrice() { return totalPrice; } }
3adb1d844749303c256a72a5ac3fb3d1606594e5
37ba349c621c9bafa9e6526ba8f49f3c0460e0ef
/mdsp-logfilling/src/main/java/com/pzoom/mdsp/logfilling/ZkState.java
a709c3e04826ee6423624fb213dd7860820df1b8
[]
no_license
whantt/mdsp-logfilling
357b0892efd499e828be8e546a3ce23bade65150
f3bbd75a40e5f088c7ba9a058163c5199614ff20
refs/heads/master
2020-03-20T20:00:11.143551
2014-11-19T02:15:50
2014-11-19T02:15:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,452
java
package com.pzoom.mdsp.logfilling; import java.nio.charset.Charset; import java.util.Map; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.retry.RetryNTimes; import org.apache.zookeeper.CreateMode; import org.json.simple.JSONValue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.pzoom.mdsp.util.ConstData; /** * zk状态 初始化CuratorFramework 读和写zk的JSON * * @author chenbaoyu * */ public class ZkState { public static final Logger LOG = LoggerFactory.getLogger(ZkState.class); private CuratorFramework curator = null; public ZkState(String offsetZkStr) { try { curator = newCurator(offsetZkStr); curator.start(); } catch (Exception e) { throw new RuntimeException(e); } } private CuratorFramework newCurator(String offsetZkStr) throws Exception { return CuratorFrameworkFactory.newClient(offsetZkStr, ConstData.SESSION_TIMEOUT, 150000, new RetryNTimes( ConstData.RETRY_TIMES, ConstData.RETRY_INTERVAL)); } public CuratorFramework getCurator() { assert curator != null; return curator; } public void writeJSON(String path, Map<Object, Object> data) { LOG.info("Writing " + path + " the data " + data.toString()); writeBytes(path, JSONValue.toJSONString(data).getBytes(Charset.forName("UTF-8"))); } /** * writeJson * * @param path * @param bytes */ public void writeBytes(String path, byte[] bytes) { try { if (curator.checkExists().forPath(path) == null) { curator.create().creatingParentsIfNeeded() .withMode(CreateMode.PERSISTENT).forPath(path, bytes); } else { curator.setData().forPath(path, bytes); } } catch (Exception e) { throw new RuntimeException(e); } } public Map<Object, Object> readJSON(String path) { try { byte[] b = readBytes(path); if (b == null) { return null; } return (Map<Object, Object>) JSONValue .parse(new String(b, "UTF-8")); } catch (Exception e) { throw new RuntimeException(e); } } /** * readJson * * @param path * @return */ public byte[] readBytes(String path) { try { if (curator.checkExists().forPath(path) != null) { return curator.getData().forPath(path); } else { return null; } } catch (Exception e) { throw new RuntimeException(e); } } public void close() { curator.close(); curator = null; } }
fe1444b21f84787ac962723f3d5ba70f92531ee2
43e40aeb45adf70ae447366e8b3c221e1bcec6c2
/biomedicus-core/src/main/java/edu/umn/biomedicus/spelling/SpellCorrector.java
d8d1f3e07e2e637ccb3ad309423f711b838836e9
[ "Apache-2.0" ]
permissive
chengniu/biomedicus
b3c30fd6e9377ef05424af2e3c58fcca6b6575ef
e3d55820128f33b474ee3adc4ac59168e1627b23
refs/heads/master
2021-01-21T15:44:48.543900
2017-04-26T16:02:06
2017-04-26T16:02:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
/* * Copyright (c) 2016 Regents of the University of Minnesota. * * 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 edu.umn.biomedicus.spelling; import edu.umn.biomedicus.application.DocumentProcessor; import edu.umn.biomedicus.exc.BiomedicusException; public class SpellCorrector implements DocumentProcessor { @Override public void process() throws BiomedicusException { } }
60adf13b59e132d4435300d64a87db1b152bccee
001c851acf7411a89fe0e32cf4babba8afdba730
/.svn/pristine/0f/0fd5b5cbbdbab89f8473e243db672cefec9268ec.svn-base
b48d0333d011a995b2df0dc4bfe6180b34aa0943
[]
no_license
dingxuejin/weihuapin
ee0447c7b86c0867515624a0b79250ee80cf19b0
80cb8a11322084b1cd69ec3fd9ea6b7af69bb11d
refs/heads/master
2020-03-21T09:01:32.363316
2018-07-04T03:25:11
2018-07-04T03:25:11
138,379,752
0
0
null
null
null
null
UTF-8
Java
false
false
2,838
package com.mobiusVision.controller.TbBusiness; import com.mobiusVision.pojo.TbBusiness.TbBusinessBq; import com.mobiusVision.pojo.TbBusiness.TbBusinessBqTBR; import com.mobiusVision.service.TbBusiness.TbBusinessBqService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; /** * @Author: zhangzhirong * @Description:人员标签相关Controller * @Date:Created in 10:28 2018/6/20/020 * @Modify By: **/ @Api(description ="人员标签相关接口") @Controller public class TbBusinessBqController { private TbBusinessBqService tbBusinessBqService=new TbBusinessBqService(); //通过driver_id和label_source查询tb_business_bq表中所有数据 //label_source=null则返回系统评价,否则返回单人评价 @ApiOperation(value = "查询人员自身标签和同事评论标签数据", notes = "label_source为空则返回自身标签,否则返回某个同事对他所有的评论标签",httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "driver_id", value = "人员编号", required = true, dataType = "String",defaultValue = "201408000001"), @ApiImplicitParam(paramType="query", name = "label_source", value = "标签来源", required = false, dataType = "String",defaultValue = ""), }) @RequestMapping("/TbBusinessBqByIAS") public @ResponseBody List<TbBusinessBq> findAllByDriverIdAndLabelSource(String driver_id, String label_source){ if(driver_id==null) return null; List<TbBusinessBq> tbBusinessBqList=tbBusinessBqService.findAllByDriverIdAndLabelSource(driver_id,label_source); return tbBusinessBqList; } //通过driver_id和label_source=system和label_source与driver_id关联查询tb_business_bq表和tb_basic_ryjb表中最新数据(去重条件Label_source) @ApiOperation(value = "查询人员不同的同事最新评论标签数据", notes = "",httpMethod = "GET") @ApiImplicitParams({ @ApiImplicitParam(paramType="query", name = "driver_id", value = "人员编号", required = true, dataType = "String",defaultValue = "201408000001"), }) @RequestMapping("/TbBusinessBqTBRByI") public @ResponseBody List<TbBusinessBqTBR> findAllByDriverIdAndNotSystemAndTBR(String driver_id){ if(driver_id==null) return null; List<TbBusinessBqTBR> tbBusinessBqTBRList=tbBusinessBqService.findAllByDriverIdAndNotSystemAndTBR(driver_id); return tbBusinessBqTBRList; } }
8cfe86f90ae5c09e110a4838d91fcd0be3372e24
b611a4f586d5ab6cfd717b8879a6a8e9b6e5ae2d
/LibraryManagementSystem/src/cn/bms/utils/ServiceUtils.java
ecdc3729cf861d90519352c13a16431fceb423c6
[]
no_license
czkct/java
0a0faeb29af83068c2a34617bde8fc4cdb4600f0
f61548936e2728b905a878d04289a1c07cecdc55
refs/heads/master
2020-12-25T15:09:06.177074
2016-11-06T17:03:24
2016-11-06T17:03:24
68,092,814
0
1
null
null
null
null
UTF-8
Java
false
false
593
java
package cn.bms.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import Decoder.BASE64Encoder; //import sun.misc.BASE64Encoder; //将密码用编码包装起来,然后在存入数据文件中 public class ServiceUtils { public static String md5(String message){ try { MessageDigest md = MessageDigest.getInstance("md5"); byte md5[] = md.digest(message.getBytes()); BASE64Encoder encoder = new BASE64Encoder(); return encoder.encode(md5); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } } }
560b8ab4b93c3916e1c8db2815bbf50da938a9d9
4b2aa05c35dabb0eb1a553abdfe393211a9a16c8
/Project 3/src/code/Driver.java
7e3b310b8af599a2a894d91fd194d7ea0b57b30d
[]
no_license
amymalia/ICS-311
1b4f368205a5e1e8ba8dab3cbb3814168f8bd50b
2d04ac6fd7d90beeb16b8f703f8e71c7add8a71f
refs/heads/master
2021-01-22T15:43:40.077494
2013-12-14T00:21:26
2013-12-14T00:21:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,861
java
package code; /* * Copyright (c) 2013, Erika Nana * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of Project 1 nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Erika Nana ''AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL Erika Nana BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.util.Scanner; /** * Driver that allows the user to analyze the various graphs. * @author Erika Nana */ public class Driver { /** The input reader. */ static Scanner inputReader = new Scanner(System.in); /** * The main method. * * @param args the arguments */ public static void main(String[] args) { DirectedGraph graph; while (true) { System.out.println("What would you like to do?"); System.out.println("Options available: analyzeGraph, quit"); String choice = inputReader.nextLine(); if (!Utils.isEnum(choice)) { System.out.println("That command is not recognized\n"); continue; } if (Utils.Command.valueOf(choice).equals(Utils.Command.quit)) { graph = null; System.out.println("Goodbye!"); break; } else { System.out.println("Type in the name of the graph: "); String fileName = inputReader.nextLine(); graph = VNAParser.generateGraph(fileName); if (graph == null) { System.out.println("File not found! Please try again\n"); continue; } if (Utils.Command.valueOf(choice).equals(Utils.Command.analyzeGraph)) { Utils.printTable(graph, fileName); System.out.println("\n"); graph = null; } } } } }
08b0b7e44cd6bf7703c5acf0c3af060b52b26f72
30ceb7c346b3a5c3d8932655d8bd1e9813b3e6b0
/CPUSchedulingSimulator/src/com/jimweller/cpuscheduler/MultilevelPriorityAlgorithm2.java
4fea34c6fdf747d45b8d42593cfe0e51617d35ee
[]
no_license
jmasukawa/cs143a
8865b05cb12eced9d9d273756768e5183c5c5cad
b5e75896809a24b8351ea8d5b2e038ef30036ea4
refs/heads/master
2021-05-27T00:29:21.051829
2013-10-22T00:57:16
2013-10-22T00:57:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,831
java
/** MultilevelPriorityAlgorithm2.java * * * @author: Jon Masukawa (33128396), Yan Zhao (31018809) * Group #32 * * Winter 2013 * */ package com.jimweller.cpuscheduler; public class MultilevelPriorityAlgorithm2 extends RoundRobinSchedulingAlgorithm implements OptionallyPreemptiveSchedulingAlgorithm { /** The boolean value that toggles preemptiveness. */ private boolean preemptive; private SJFSchedulingAlgorithm jobs1; private RoundRobinSchedulingAlgorithm jobs2; private RoundRobinSchedulingAlgorithm jobs3; public MultilevelPriorityAlgorithm2() { this.jobs1 = new SJFSchedulingAlgorithm(); this.jobs2 = new RoundRobinSchedulingAlgorithm(); this.jobs3 = new RoundRobinSchedulingAlgorithm(); this.jobs3.setQuantum(jobs2.getQuantum() * 2); this.activeJob = null; } @Override public void addJob(Process p) { if (p.getPriorityWeight() <= 3) jobs1.addJob(p); else if (p.getPriorityWeight() <= 6){ jobs2.addJob(p); } else if (p.getPriorityWeight() <= 9){ jobs3.addJob(p); } } @Override public boolean removeJob(Process p) { if (p.getPriorityWeight() <= 3) return jobs1.removeJob(p); else if (p.getPriorityWeight() <= 6) { return jobs2.removeJob(p); } else return jobs3.removeJob(p); } @Override public Process getNextJob(long currentTime) { // If no activeJob or job is finished, get the next one if(activeJob == null || activeJob.isFinished()) { activeJob = jobs1.getNextJob(currentTime); } if (activeJob == null || activeJob.isFinished()) { activeJob = jobs2.getNextJob(currentTime); } if (activeJob == null || activeJob.isFinished()) { activeJob = jobs3.getNextJob(currentTime); } // If preemptive if (preemptive) { activeJob = null; activeJob = jobs1.getNextJob(currentTime); if (activeJob == null || activeJob.isFinished()) { activeJob = jobs2.getNextJob(currentTime); } if (activeJob == null || activeJob.isFinished()) { activeJob = jobs3.getNextJob(currentTime); } } else { // If activeJob, do work if (activeJob.getPriorityWeight() <= 3) { activeJob = jobs1.getNextJob(currentTime); } else if (activeJob.getPriorityWeight() <= 6) { activeJob = jobs2.getNextJob(currentTime); } else if (activeJob.getPriorityWeight() <= 9) { activeJob = jobs3.getNextJob(currentTime); } } return activeJob; } @Override public String getName() { return "Multi-level Priority Algorithm (SJF, RR, 2xRR)"; } @Override public void transferJobsTo(SchedulingAlgorithm otherAlg) { jobs1.transferJobsTo(otherAlg); jobs2.transferJobsTo(otherAlg); jobs3.transferJobsTo(otherAlg); } @Override public boolean isPreemptive() { return preemptive; } @Override public void setPreemptive(boolean v) { preemptive = v; } }
da8819eb1f86add77a811cf11ad0879949b84442
ccf94dcb6b1500fcbbd56964ae8c4832a496b8b3
/java/baiduads-sdk-auto/src/test/java/com/baidu/dev2/api/sdk/searchfeed/model/GetOcpcTransFeedResponseWrapperTest.java
b10e4375e58daa79ec7572a74fe5528441845100
[ "Apache-2.0" ]
permissive
baidu/baiduads-sdk
24c36b5cf3da9362ec5c8ecd417ff280421198ff
176363de5e8a4e98aaca039e4300703c3964c1c7
refs/heads/main
2023-06-08T15:40:24.787863
2023-05-20T03:40:51
2023-05-20T03:40:51
446,718,177
16
11
Apache-2.0
2023-06-02T05:19:40
2022-01-11T07:23:17
Python
UTF-8
Java
false
false
1,504
java
/* * dev2 api schema * 'dev2.baidu.com' api schema * * The version of the OpenAPI document: 1.0.1-SNAPSHOT * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package com.baidu.dev2.api.sdk.searchfeed.model; import com.baidu.dev2.api.sdk.searchfeed.model.GetOcpcTransFeedResponseWrapperBody; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; /** * Model tests for GetOcpcTransFeedResponseWrapper */ public class GetOcpcTransFeedResponseWrapperTest { private final GetOcpcTransFeedResponseWrapper model = new GetOcpcTransFeedResponseWrapper(); /** * Model tests for GetOcpcTransFeedResponseWrapper */ @Test public void testGetOcpcTransFeedResponseWrapper() { // TODO: test GetOcpcTransFeedResponseWrapper } /** * Test the property 'header' */ @Test public void headerTest() { // TODO: test header } /** * Test the property 'body' */ @Test public void bodyTest() { // TODO: test body } }
e02f40963caf7677292ec6dd6c52bdca6ecac8da
77e35d78fd2547049cc66becebf6040487321ed5
/Desktop/daily_report_system-master/daily_report_system/src/filters/LoginFilter.java
1567957c9ed177d20ae5b8eaf7d61cb89ca73b17
[]
no_license
masaaki-kawanishi/daily_report_system
cc45f684141117312957006e5f554d73d8fa5e9c
05a1467012ec575e1e9b45a1e46a09d358353eb4
refs/heads/master
2020-03-26T03:08:56.894067
2018-08-18T13:30:05
2018-08-18T13:30:05
144,440,550
0
0
null
null
null
null
UTF-8
Java
false
false
1,984
java
package filters; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import models.Employee; /** * Servlet Filter implementation class LoginFilter */ @WebFilter("/*") public class LoginFilter implements Filter { /** * Default constructor. */ public LoginFilter() { // TODO Auto-generated constructor stub } /** * @see Filter#destroy() */ public void destroy() { // TODO Auto-generated method stub } /** * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) */ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String context_path = ((HttpServletRequest)request).getContextPath(); String servlet_path = ((HttpServletRequest)request).getServletPath(); if(!servlet_path.matches("/css.*")) { HttpSession session = ((HttpServletRequest)request).getSession(); Employee e = (Employee)session.getAttribute("login_employee"); if(!servlet_path.equals("/login")){ if(e == null) { ((HttpServletResponse)response).sendRedirect(context_path + "/login"); return; } if(servlet_path.matches("/employees.*")&& e.getAdmin_flag() == 0) { ((HttpServletResponse)response).sendRedirect(context_path + "/"); return; } } else { if(e != null) { ((HttpServletResponse)response).sendRedirect(context_path + "/"); return; } } } chain.doFilter(request,response); } /** * @see Filter#init(FilterConfig) */ public void init(FilterConfig fConfig) throws ServletException { // TODO Auto-generated method stub } }
a0b110eb19d673547c3425f54a1f2df5108156f1
f9bfd316b865e7ea702d1e9c33694a5ee8909554
/eureka/src/main/java/eurekademo/EurekaApplication.java
1112bc1ae487f21e3d3a6c1bd32c166e51757dbc
[]
no_license
viren1990/feign-eureka-spring-resilience4j
c49703a6dd3fd134c7a859ebfd511d2ffa382ae0
cb954cbe2119a35a5b48b224251797322f47ac91
refs/heads/master
2020-06-28T22:54:50.970353
2019-08-09T10:08:18
2019-08-09T10:08:18
200,363,638
0
0
null
null
null
null
UTF-8
Java
false
false
446
java
package eurekademo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; /** * * @author Viren * */ @SpringBootApplication @EnableEurekaServer public class EurekaApplication { public static void main(String[] args) throws Exception { SpringApplication.run(EurekaApplication.class, args); } }
e8fde722de7a702348daf41c6a63cfeff4b369ec
fde10a2a5e9afbeda949af2e654d2baadae7d262
/android/src/de/mi/ur/SettingsFragment.java
fd9f63ec14725a97323a8ae0804567489aa11100
[]
no_license
Maxikilliane/NerdyNumeralChallenge
d75b55086a254a3b8a7e8f6adb5f52684afb0d00
3b7a18d33365bca993e3e17a5c6fb63ffeb06a4c
refs/heads/master
2020-04-12T06:14:38.175051
2016-09-30T18:22:52
2016-09-30T18:22:52
64,584,855
1
0
null
null
null
null
UTF-8
Java
false
false
371
java
package de.mi.ur; import android.os.Bundle; import android.preference.PreferenceFragment; /** * Created by Anna-Marie on 10.08.2016. */ public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); } }
80d89ea39b2b72fc2accb8e6b70e7965bf09ab0b
ed7dc923814f6878020ee915d078cf486c30fc46
/INDIVIDUAL EXPERIMENTS/org.xtext.example.mydsl.referencesuntyped.ui/xtend-gen/org/xtext/example/mydsl/referencesuntyped/ui/outline/MyDslOutlineTreeProvider.java
2eddab2d96286078bb7bee69a42534bead37f846
[]
no_license
a24ibrah/XMLText
2aca934ddc42e98233af541f8c57f359ed19dd1f
fa03e63b0ac004da015a7c1844c5f7d374bca9fc
refs/heads/master
2020-07-23T18:57:15.976381
2017-06-02T15:20:31
2017-06-02T15:20:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
/** * generated by Xtext */ package org.xtext.example.mydsl.referencesuntyped.ui.outline; import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; /** * Customization of the default outline structure. * * see http://www.eclipse.org/Xtext/documentation.html#outline */ @SuppressWarnings("all") public class MyDslOutlineTreeProvider extends DefaultOutlineTreeProvider { }
9b7d4fad02da22354aaac04fb8379347de891bd4
111502d7df4510f3d345f3bcf8d82438fba9f35c
/src/enitity/asycuda/valuationItem_childs/ItemOtherCost.java
4652635f5a7b21726c07dcb6383780ef914a642c
[]
no_license
sc001cs/AsycudaXML
cdddd1c72faa2e2ccd854814bd77d9ea791f3548
bcf873ff2bd191481e0cb166dc55287a74f58f01
refs/heads/master
2021-01-12T11:00:51.733293
2017-01-11T21:51:31
2017-01-11T21:51:31
75,483,705
1
0
null
null
null
null
UTF-8
Java
false
false
1,529
java
package enitity.asycuda.valuationItem_childs; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlElement; public class ItemOtherCost { private BigDecimal Amount_national_currency; private String Amount_foreign_currency; private String Currency_code; private String Currency_name; private String Currency_rate; public BigDecimal getAmount_national_currency() { return Amount_national_currency; } @XmlElement(nillable = true, name = "Amount_national_currency") public void setAmount_national_currency(BigDecimal amount_national_currency) { Amount_national_currency = amount_national_currency; } public String getAmount_foreign_currency() { return Amount_foreign_currency; } @XmlElement(nillable = true, name = "Amount_foreign_currency") public void setAmount_foreign_currency(String amount_foreign_currency) { Amount_foreign_currency = amount_foreign_currency; } public String getCurrency_code() { return Currency_code; } @XmlElement(nillable = true, name = "Currency_code") public void setCurrency_code(String currency_code) { Currency_code = currency_code; } public String getCurrency_name() { return Currency_name; } @XmlElement(nillable = true, name = "Currency_name") public void setCurrency_name(String currency_name) { Currency_name = currency_name; } public String getCurrency_rate() { return Currency_rate; } @XmlElement(nillable = true, name = "Currency_rate") public void setCurrency_rate(String currency_rate) { Currency_rate = currency_rate; } }
3539af50f1934da75cc6402a73d18cf29c67ca65
234465c6ecd3c4ec072bb269cd2523823a911a73
/app/src/main/java/com/example/attendance/UserManager.java
3c09f704476313101f8dc606f9fb0b410e253f0a
[]
no_license
nichousha1935/Attendance
692f74ed4809d7753b59e6fca44a327069d7414e
664af2018a343f865ed5122afafcff9e56f5ae9e
refs/heads/master
2021-04-10T15:30:40.358724
2020-11-04T09:46:14
2020-11-04T09:46:14
248,943,474
0
0
null
null
null
null
UTF-8
Java
false
false
1,998
java
package com.example.attendance; import android.content.Context; import android.content.SharedPreferences; public class UserManager { private UserInfo userInfo=new UserInfo(); private SharedPreferences userSharedPreferences; private static final String USER_SETTING = "user_setting"; private UserManager() { } private static class HolderUserManager { private static final UserManager userManager = new UserManager(); } public static UserManager getInstance() { return HolderUserManager.userManager; } public void saveUserInfo(Context context, UserInfo userInfo) { userSharedPreferences = context.getSharedPreferences(USER_SETTING, Context.MODE_PRIVATE); SharedPreferences.Editor editor = userSharedPreferences.edit(); editor.putString("userName", userInfo.getUserName()); editor.putString("phoneNumber", userInfo.getPhoneNumber()); editor.putString("phoneModel", userInfo.getPhoneModel()); editor.putInt("loginId", userInfo.getLoginId()); editor.putString("headImgUrl", userInfo.getHeadImgUrl()); editor.commit(); } public UserInfo getUserInfo(Context context) { userSharedPreferences = context.getSharedPreferences(USER_SETTING, Context.MODE_PRIVATE); userInfo.setUserName(userSharedPreferences.getString("userName","")); userInfo.setPhoneNumber(userSharedPreferences.getString("phoneNumber","")); userInfo.setPhoneModel(userSharedPreferences.getString("phoneModel","")); userInfo.setLoginId(userSharedPreferences.getInt("loginId",0)); userInfo.setHeadImgUrl(userSharedPreferences.getString("headImgUrl","")); return userInfo; } public void loginOut(Context context){ userSharedPreferences = context.getSharedPreferences(USER_SETTING, Context.MODE_PRIVATE); SharedPreferences.Editor editor = userSharedPreferences.edit(); editor.clear(); editor.commit(); } }
67ab9ec00089362f201d3b9337e741ae1dc38e6e
d4896a7eb2ee39cca5734585a28ca79bd6cc78da
/sources/androidx/media2/player/exoplayer/TrackSelector.java
22a35ffc832bbcc9029b78097b1c548a6f849d6a
[]
no_license
zadweb/zadedu.apk
a235ad005829e6e34ac525cbb3aeca3164cf88be
8f89db0590333929897217631b162e39cb2fe51d
refs/heads/master
2023-08-13T03:03:37.015952
2021-10-12T21:22:59
2021-10-12T21:22:59
416,498,604
0
0
null
null
null
null
UTF-8
Java
false
false
15,446
java
package androidx.media2.player.exoplayer; import android.media.MediaFormat; import androidx.core.util.Preconditions; import androidx.media2.exoplayer.external.Format; import androidx.media2.exoplayer.external.Player; import androidx.media2.exoplayer.external.source.TrackGroupArray; import androidx.media2.exoplayer.external.trackselection.DefaultTrackSelector; import androidx.media2.exoplayer.external.trackselection.MappingTrackSelector; import androidx.media2.exoplayer.external.trackselection.TrackSelection; import androidx.media2.exoplayer.external.trackselection.TrackSelectionArray; import androidx.media2.player.MediaPlayer2; import androidx.media2.player.common.TrackInfoImpl; import java.util.ArrayList; import java.util.List; /* access modifiers changed from: package-private */ public final class TrackSelector { private final List<MediaPlayer2.TrackInfo> mAudioTrackInfos = new ArrayList(); private final DefaultTrackSelector mDefaultTrackSelector = new DefaultTrackSelector(); private final List<InternalTextTrackInfo> mInternalTextTrackInfos = new ArrayList(); private final List<MediaPlayer2.TrackInfo> mMetadataTrackInfos = new ArrayList(); private boolean mPendingMetadataUpdate; private int mPlayerTextTrackIndex = -1; private int mSelectedAudioTrackIndex = -1; private int mSelectedMetadataTrackIndex = -1; private int mSelectedTextTrackIndex = -1; private int mSelectedVideoTrackIndex = -1; private final TextRenderer mTextRenderer; private final List<MediaPlayer2.TrackInfo> mTextTrackInfos = new ArrayList(); private final List<MediaPlayer2.TrackInfo> mVideoTrackInfos = new ArrayList(); TrackSelector(TextRenderer textRenderer) { this.mTextRenderer = textRenderer; this.mDefaultTrackSelector.setParameters(new DefaultTrackSelector.ParametersBuilder().setSelectUndeterminedTextLanguage(true).setRendererDisabled(3, true)); } public DefaultTrackSelector getPlayerTrackSelector() { return this.mDefaultTrackSelector; } public void handlePlayerTracksChanged(Player player) { int i; int i2; int i3; this.mPendingMetadataUpdate = true; DefaultTrackSelector defaultTrackSelector = this.mDefaultTrackSelector; defaultTrackSelector.setParameters(defaultTrackSelector.buildUponParameters().clearSelectionOverrides()); int i4 = -1; this.mSelectedAudioTrackIndex = -1; this.mSelectedVideoTrackIndex = -1; this.mSelectedMetadataTrackIndex = -1; this.mPlayerTextTrackIndex = -1; this.mSelectedTextTrackIndex = -1; this.mAudioTrackInfos.clear(); this.mVideoTrackInfos.clear(); this.mMetadataTrackInfos.clear(); this.mInternalTextTrackInfos.clear(); this.mTextRenderer.clearSelection(); MappingTrackSelector.MappedTrackInfo currentMappedTrackInfo = this.mDefaultTrackSelector.getCurrentMappedTrackInfo(); if (currentMappedTrackInfo != null) { TrackGroupArray trackGroups = currentMappedTrackInfo.getTrackGroups(1); for (int i5 = 0; i5 < trackGroups.length; i5++) { this.mAudioTrackInfos.add(new TrackInfoImpl(2, ExoPlayerUtils.getMediaFormat(trackGroups.get(i5).getFormat(0)))); } TrackGroupArray trackGroups2 = currentMappedTrackInfo.getTrackGroups(0); for (int i6 = 0; i6 < trackGroups2.length; i6++) { this.mVideoTrackInfos.add(new TrackInfoImpl(1, ExoPlayerUtils.getMediaFormat(trackGroups2.get(i6).getFormat(0)))); } TrackGroupArray trackGroups3 = currentMappedTrackInfo.getTrackGroups(3); for (int i7 = 0; i7 < trackGroups3.length; i7++) { this.mMetadataTrackInfos.add(new TrackInfoImpl(5, ExoPlayerUtils.getMediaFormat(trackGroups3.get(i7).getFormat(0)))); } TrackSelectionArray currentTrackSelections = player.getCurrentTrackSelections(); TrackSelection trackSelection = currentTrackSelections.get(1); if (trackSelection == null) { i = -1; } else { i = trackGroups.indexOf(trackSelection.getTrackGroup()); } this.mSelectedAudioTrackIndex = i; TrackSelection trackSelection2 = currentTrackSelections.get(0); if (trackSelection2 == null) { i2 = -1; } else { i2 = trackGroups2.indexOf(trackSelection2.getTrackGroup()); } this.mSelectedVideoTrackIndex = i2; TrackSelection trackSelection3 = currentTrackSelections.get(3); if (trackSelection3 == null) { i3 = -1; } else { i3 = trackGroups3.indexOf(trackSelection3.getTrackGroup()); } this.mSelectedMetadataTrackIndex = i3; TrackGroupArray trackGroups4 = currentMappedTrackInfo.getTrackGroups(2); for (int i8 = 0; i8 < trackGroups4.length; i8++) { Format format = (Format) Preconditions.checkNotNull(trackGroups4.get(i8).getFormat(0)); InternalTextTrackInfo internalTextTrackInfo = new InternalTextTrackInfo(i8, getTextTrackType(format.sampleMimeType), format, -1); this.mInternalTextTrackInfos.add(internalTextTrackInfo); this.mTextTrackInfos.add(internalTextTrackInfo.mTrackInfo); } TrackSelection trackSelection4 = currentTrackSelections.get(2); if (trackSelection4 != null) { i4 = trackGroups4.indexOf(trackSelection4.getTrackGroup()); } this.mPlayerTextTrackIndex = i4; } } public void handleTextRendererChannelAvailable(int i, int i2) { boolean z = false; int i3 = 0; while (true) { if (i3 >= this.mInternalTextTrackInfos.size()) { break; } InternalTextTrackInfo internalTextTrackInfo = this.mInternalTextTrackInfos.get(i3); if (internalTextTrackInfo.mType == i && internalTextTrackInfo.mChannel == -1) { this.mInternalTextTrackInfos.set(i3, new InternalTextTrackInfo(internalTextTrackInfo.mPlayerTrackIndex, i, internalTextTrackInfo.mFormat, i2)); if (this.mSelectedTextTrackIndex == i3) { this.mTextRenderer.select(i, i2); } z = true; } else { i3++; } } if (!z) { InternalTextTrackInfo internalTextTrackInfo2 = new InternalTextTrackInfo(this.mPlayerTextTrackIndex, i, null, i2); this.mInternalTextTrackInfos.add(internalTextTrackInfo2); this.mTextTrackInfos.add(internalTextTrackInfo2.mTrackInfo); this.mPendingMetadataUpdate = true; } } public boolean hasPendingMetadataUpdate() { boolean z = this.mPendingMetadataUpdate; this.mPendingMetadataUpdate = false; return z; } public int getSelectedTrack(int i) { int size; int i2; if (i == 1) { size = this.mAudioTrackInfos.size(); i2 = this.mSelectedVideoTrackIndex; } else if (i == 2) { return this.mSelectedAudioTrackIndex; } else { if (i == 4) { size = this.mAudioTrackInfos.size() + this.mVideoTrackInfos.size() + this.mMetadataTrackInfos.size(); i2 = this.mSelectedTextTrackIndex; } else if (i != 5) { return -1; } else { size = this.mAudioTrackInfos.size() + this.mVideoTrackInfos.size(); i2 = this.mSelectedMetadataTrackIndex; } } return size + i2; } public List<MediaPlayer2.TrackInfo> getTrackInfos() { ArrayList arrayList = new ArrayList(this.mVideoTrackInfos.size() + this.mAudioTrackInfos.size() + this.mMetadataTrackInfos.size() + this.mInternalTextTrackInfos.size()); arrayList.addAll(this.mVideoTrackInfos); arrayList.addAll(this.mAudioTrackInfos); arrayList.addAll(this.mMetadataTrackInfos); arrayList.addAll(this.mTextTrackInfos); return arrayList; } public void selectTrack(int i) { Preconditions.checkArgument(i >= this.mVideoTrackInfos.size(), "Video track selection is not supported"); int size = i - this.mVideoTrackInfos.size(); if (size < this.mAudioTrackInfos.size()) { this.mSelectedAudioTrackIndex = size; TrackGroupArray trackGroups = ((MappingTrackSelector.MappedTrackInfo) Preconditions.checkNotNull(this.mDefaultTrackSelector.getCurrentMappedTrackInfo())).getTrackGroups(1); int i2 = trackGroups.get(size).length; int[] iArr = new int[i2]; for (int i3 = 0; i3 < i2; i3++) { iArr[i3] = i3; } DefaultTrackSelector.SelectionOverride selectionOverride = new DefaultTrackSelector.SelectionOverride(size, iArr); DefaultTrackSelector defaultTrackSelector = this.mDefaultTrackSelector; defaultTrackSelector.setParameters(defaultTrackSelector.buildUponParameters().setSelectionOverride(1, trackGroups, selectionOverride).build()); return; } int size2 = size - this.mAudioTrackInfos.size(); if (size2 < this.mMetadataTrackInfos.size()) { this.mSelectedMetadataTrackIndex = size2; TrackGroupArray trackGroups2 = ((MappingTrackSelector.MappedTrackInfo) Preconditions.checkNotNull(this.mDefaultTrackSelector.getCurrentMappedTrackInfo())).getTrackGroups(3); DefaultTrackSelector.SelectionOverride selectionOverride2 = new DefaultTrackSelector.SelectionOverride(size2, 0); DefaultTrackSelector defaultTrackSelector2 = this.mDefaultTrackSelector; defaultTrackSelector2.setParameters(defaultTrackSelector2.buildUponParameters().setRendererDisabled(3, false).setSelectionOverride(3, trackGroups2, selectionOverride2).build()); return; } int size3 = size2 - this.mMetadataTrackInfos.size(); Preconditions.checkArgument(size3 < this.mInternalTextTrackInfos.size()); InternalTextTrackInfo internalTextTrackInfo = this.mInternalTextTrackInfos.get(size3); if (this.mPlayerTextTrackIndex != internalTextTrackInfo.mPlayerTrackIndex) { this.mTextRenderer.clearSelection(); this.mPlayerTextTrackIndex = internalTextTrackInfo.mPlayerTrackIndex; TrackGroupArray trackGroups3 = ((MappingTrackSelector.MappedTrackInfo) Preconditions.checkNotNull(this.mDefaultTrackSelector.getCurrentMappedTrackInfo())).getTrackGroups(2); DefaultTrackSelector.SelectionOverride selectionOverride3 = new DefaultTrackSelector.SelectionOverride(this.mPlayerTextTrackIndex, 0); DefaultTrackSelector defaultTrackSelector3 = this.mDefaultTrackSelector; defaultTrackSelector3.setParameters(defaultTrackSelector3.buildUponParameters().setSelectionOverride(2, trackGroups3, selectionOverride3).build()); } if (internalTextTrackInfo.mChannel != -1) { this.mTextRenderer.select(internalTextTrackInfo.mType, internalTextTrackInfo.mChannel); } this.mSelectedTextTrackIndex = size3; } public void deselectTrack(int i) { boolean z = false; Preconditions.checkArgument(i >= this.mVideoTrackInfos.size(), "Video track deselection is not supported"); int size = i - this.mVideoTrackInfos.size(); Preconditions.checkArgument(size >= this.mAudioTrackInfos.size(), "Audio track deselection is not supported"); int size2 = size - this.mAudioTrackInfos.size(); if (size2 < this.mMetadataTrackInfos.size()) { this.mSelectedMetadataTrackIndex = -1; DefaultTrackSelector defaultTrackSelector = this.mDefaultTrackSelector; defaultTrackSelector.setParameters(defaultTrackSelector.buildUponParameters().setRendererDisabled(3, true)); return; } if (size2 - this.mMetadataTrackInfos.size() == this.mSelectedTextTrackIndex) { z = true; } Preconditions.checkArgument(z); this.mTextRenderer.clearSelection(); this.mSelectedTextTrackIndex = -1; } /* JADX WARNING: Removed duplicated region for block: B:17:0x0038 */ /* JADX WARNING: Removed duplicated region for block: B:23:0x0055 A[RETURN] */ private static int getTextTrackType(String str) { char c; int hashCode = str.hashCode(); if (hashCode != -1004728940) { if (hashCode != 1566015601) { if (hashCode == 1566016562 && str.equals("application/cea-708")) { c = 1; if (c != 0) { return 0; } if (c == 1) { return 1; } if (c == 2) { return 2; } throw new IllegalArgumentException("Unexpected text MIME type " + str); } } else if (str.equals("application/cea-608")) { c = 0; if (c != 0) { } } } else if (str.equals("text/vtt")) { c = 2; if (c != 0) { } } c = 65535; if (c != 0) { } } public static final class InternalTextTrackInfo { public final int mChannel; public final Format mFormat; public final int mPlayerTrackIndex; public final TrackInfoImpl mTrackInfo; public final int mType; InternalTextTrackInfo(int i, int i2, Format format, int i3) { String str; this.mPlayerTrackIndex = i; int i4 = 1; if (i2 == 0 && i3 == 0) { i4 = 5; } else if (!(i2 == 1 && i3 == 1)) { i4 = format == null ? 0 : format.selectionFlags; } if (format == null) { str = "und"; } else { str = format.language; } this.mTrackInfo = getTrackInfo(i2, str, i4); this.mType = i2; this.mChannel = i3; this.mFormat = format; } static TrackInfoImpl getTrackInfo(int i, String str, int i2) { MediaFormat mediaFormat = new MediaFormat(); int i3 = 1; if (i == 0) { mediaFormat.setString("mime", "text/cea-608"); } else if (i == 1) { mediaFormat.setString("mime", "text/cea-708"); } else if (i == 2) { mediaFormat.setString("mime", "text/vtt"); } else { throw new IllegalStateException(); } mediaFormat.setString("language", str); int i4 = 0; mediaFormat.setInteger("is-forced-subtitle", (i2 & 2) != 0 ? 1 : 0); mediaFormat.setInteger("is-autoselect", (i2 & 4) != 0 ? 1 : 0); if ((i2 & 1) == 0) { i3 = 0; } mediaFormat.setInteger("is-default", i3); if (i != 2) { i4 = 4; } return new TrackInfoImpl(i4, mediaFormat); } } }
3c3140a3dc649f82257dd40bcb433b1ae4e3d6ae
d6b3ca8f02b06d31c640e2f08acea0262fddae59
/javaproject/src/javabasics/WhileLoop.java
dc79e38ee53647035fb7adf5cd7d1a440f0b8375
[]
no_license
SreejaJoginipally/helloworld
53aef6a024bf8d0cf330ac05f4e4726fdcf90dd7
1530228b5e6dedbcc989875f5716e1590ea7183d
refs/heads/master
2023-01-22T05:06:15.919175
2020-12-05T23:17:50
2020-12-05T23:17:50
317,356,310
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package javabasics; public class WhileLoop { public static void main(String[] args) { int a = 100; //while(a>=50) { do { a-=5; System.out.println(a); }while(a>=50); } }
3602c58c460a2c86b183b36d8b2e8ed9d5525629
d1bd1246f161b77efb418a9c24ee544d59fd1d20
/java/Tools/src/com/drew/metadata/exif/ExifThumbnailDirectory.java
9c2dfad4a2fb86ceec1e89d24d00dc2cc90f3279
[]
no_license
navychen2003/javen
f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a
a3c2312bc24356b1c58b1664543364bfc80e816d
refs/heads/master
2021-01-20T12:12:46.040953
2015-03-03T06:14:46
2015-03-03T06:14:46
30,912,222
0
1
null
2023-03-20T11:55:50
2015-02-17T10:24:28
Java
UTF-8
Java
false
false
14,989
java
/* * Copyright 2002-2012 Drew Noakes * * 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. * * More information about this project is available at: * * http://drewnoakes.com/code/exif/ * http://code.google.com/p/metadata-extractor/ */ package com.drew.metadata.exif; import com.drew.lang.annotations.NotNull; import com.drew.lang.annotations.Nullable; import com.drew.metadata.Directory; import com.drew.metadata.MetadataException; import java.io.FileOutputStream; import java.io.IOException; import java.util.HashMap; /** * One of several Exif directories. Otherwise known as IFD1, this directory holds information about an embedded thumbnail image. * * @author Drew Noakes http://drewnoakes.com */ public class ExifThumbnailDirectory extends Directory { public static final int TAG_THUMBNAIL_IMAGE_WIDTH = 0x0100; public static final int TAG_THUMBNAIL_IMAGE_HEIGHT = 0x0101; /** * When image format is no compression, this value shows the number of bits * per component for each pixel. Usually this value is '8,8,8'. */ public static final int TAG_BITS_PER_SAMPLE = 0x0102; /** * Shows compression method for Thumbnail. * 1 = Uncompressed * 2 = CCITT 1D * 3 = T4/Group 3 Fax * 4 = T6/Group 4 Fax * 5 = LZW * 6 = JPEG (old-style) * 7 = JPEG * 8 = Adobe Deflate * 9 = JBIG B&W * 10 = JBIG Color * 32766 = Next * 32771 = CCIRLEW * 32773 = PackBits * 32809 = Thunderscan * 32895 = IT8CTPAD * 32896 = IT8LW * 32897 = IT8MP * 32898 = IT8BL * 32908 = PixarFilm * 32909 = PixarLog * 32946 = Deflate * 32947 = DCS * 34661 = JBIG * 34676 = SGILog * 34677 = SGILog24 * 34712 = JPEG 2000 * 34713 = Nikon NEF Compressed */ public static final int TAG_THUMBNAIL_COMPRESSION = 0x0103; /** * Shows the color space of the image data components. * 0 = WhiteIsZero * 1 = BlackIsZero * 2 = RGB * 3 = RGB Palette * 4 = Transparency Mask * 5 = CMYK * 6 = YCbCr * 8 = CIELab * 9 = ICCLab * 10 = ITULab * 32803 = Color Filter Array * 32844 = Pixar LogL * 32845 = Pixar LogLuv * 34892 = Linear Raw */ public static final int TAG_PHOTOMETRIC_INTERPRETATION = 0x0106; /** The position in the file of raster data. */ public static final int TAG_STRIP_OFFSETS = 0x0111; public static final int TAG_ORIENTATION = 0x0112; /** Each pixel is composed of this many samples. */ public static final int TAG_SAMPLES_PER_PIXEL = 0x0115; /** The raster is codified by a single block of data holding this many rows. */ public static final int TAG_ROWS_PER_STRIP = 0x116; /** The size of the raster data in bytes. */ public static final int TAG_STRIP_BYTE_COUNTS = 0x0117; /** * When image format is no compression YCbCr, this value shows byte aligns of * YCbCr data. If value is '1', Y/Cb/Cr value is chunky format, contiguous for * each subsampling pixel. If value is '2', Y/Cb/Cr value is separated and * stored to Y plane/Cb plane/Cr plane format. */ public static final int TAG_X_RESOLUTION = 0x011A; public static final int TAG_Y_RESOLUTION = 0x011B; public static final int TAG_PLANAR_CONFIGURATION = 0x011C; public static final int TAG_RESOLUTION_UNIT = 0x0128; /** The offset to thumbnail image bytes. */ public static final int TAG_THUMBNAIL_OFFSET = 0x0201; /** The size of the thumbnail image data in bytes. */ public static final int TAG_THUMBNAIL_LENGTH = 0x0202; public static final int TAG_YCBCR_COEFFICIENTS = 0x0211; public static final int TAG_YCBCR_SUBSAMPLING = 0x0212; public static final int TAG_YCBCR_POSITIONING = 0x0213; public static final int TAG_REFERENCE_BLACK_WHITE = 0x0214; @NotNull protected static final HashMap<Integer, String> _tagNameMap = new HashMap<Integer, String>(); static { _tagNameMap.put(TAG_THUMBNAIL_IMAGE_WIDTH, "Thumbnail Image Width"); _tagNameMap.put(TAG_THUMBNAIL_IMAGE_HEIGHT, "Thumbnail Image Height"); _tagNameMap.put(TAG_BITS_PER_SAMPLE, "Bits Per Sample"); _tagNameMap.put(TAG_THUMBNAIL_COMPRESSION, "Thumbnail Compression"); _tagNameMap.put(TAG_PHOTOMETRIC_INTERPRETATION, "Photometric Interpretation"); _tagNameMap.put(TAG_STRIP_OFFSETS, "Strip Offsets"); _tagNameMap.put(TAG_ORIENTATION, "Orientation"); _tagNameMap.put(TAG_SAMPLES_PER_PIXEL, "Samples Per Pixel"); _tagNameMap.put(TAG_ROWS_PER_STRIP, "Rows Per Strip"); _tagNameMap.put(TAG_STRIP_BYTE_COUNTS, "Strip Byte Counts"); _tagNameMap.put(TAG_X_RESOLUTION, "X Resolution"); _tagNameMap.put(TAG_Y_RESOLUTION, "Y Resolution"); _tagNameMap.put(TAG_PLANAR_CONFIGURATION, "Planar Configuration"); _tagNameMap.put(TAG_RESOLUTION_UNIT, "Resolution Unit"); _tagNameMap.put(TAG_THUMBNAIL_OFFSET, "Thumbnail Offset"); _tagNameMap.put(TAG_THUMBNAIL_LENGTH, "Thumbnail Length"); _tagNameMap.put(TAG_YCBCR_COEFFICIENTS, "YCbCr Coefficients"); _tagNameMap.put(TAG_YCBCR_SUBSAMPLING, "YCbCr Sub-Sampling"); _tagNameMap.put(TAG_YCBCR_POSITIONING, "YCbCr Positioning"); _tagNameMap.put(TAG_REFERENCE_BLACK_WHITE, "Reference Black/White"); } @Nullable private byte[] _thumbnailData; public ExifThumbnailDirectory() { this.setDescriptor(new ExifThumbnailDescriptor(this)); } @NotNull public String getName() { return "Exif Thumbnail"; } @NotNull protected HashMap<Integer, String> getTagNameMap() { return _tagNameMap; } public boolean hasThumbnailData() { return _thumbnailData != null; } @Nullable public byte[] getThumbnailData() { return _thumbnailData; } public void setThumbnailData(@Nullable byte[] data) { _thumbnailData = data; } public void writeThumbnail(@NotNull String filename) throws MetadataException, IOException { byte[] data = _thumbnailData; if (data==null) throw new MetadataException("No thumbnail data exists."); FileOutputStream stream = null; try { stream = new FileOutputStream(filename); stream.write(data); } finally { if (stream!=null) stream.close(); } } /* // This thumbnail extraction code is not complete, and is included to assist anyone who feels like looking into // it. Please share any progress with the original author, and hence the community. Thanks. public Image getThumbnailImage() throws MetadataException { if (!hasThumbnailData()) return null; int compression = 0; try { compression = this.getInt(ExifSubIFDDirectory.TAG_COMPRESSION); } catch (Throwable e) { this.addError("Unable to determine thumbnail type " + e.getMessage()); } final byte[] thumbnailBytes = getThumbnailData(); if (compression == ExifSubIFDDirectory.COMPRESSION_JPEG) { // JPEG Thumbnail // operate directly on thumbnailBytes return decodeBytesAsImage(thumbnailBytes); } else if (compression == ExifSubIFDDirectory.COMPRESSION_NONE) { // uncompressed thumbnail (raw RGB data) if (!this.containsTag(ExifSubIFDDirectory.TAG_PHOTOMETRIC_INTERPRETATION)) return null; try { // If the image is RGB format, then convert it to a bitmap final int photometricInterpretation = this.getInt(ExifSubIFDDirectory.TAG_PHOTOMETRIC_INTERPRETATION); if (photometricInterpretation == ExifSubIFDDirectory.PHOTOMETRIC_INTERPRETATION_RGB) { // RGB Image image = createImageFromRawRgb(thumbnailBytes); return image; } else if (photometricInterpretation == ExifSubIFDDirectory.PHOTOMETRIC_INTERPRETATION_YCBCR) { // YCbCr Image image = createImageFromRawYCbCr(thumbnailBytes); return image; } else if (photometricInterpretation == ExifSubIFDDirectory.PHOTOMETRIC_INTERPRETATION_MONOCHROME) { // Monochrome return null; } } catch (Throwable e) { this.addError("Unable to extract thumbnail: " + e.getMessage()); } } return null; } /** * Handle the YCbCr thumbnail encoding used by Ricoh RDC4200/4300, Fuji DS-7/300 and DX-5/7/9 cameras. * * At DX-5/7/9, YCbCrSubsampling(0x0212) has values of '2,1', PlanarConfiguration(0x011c) has a value '1'. So the * data align of this image is below. * * Y(0,0),Y(1,0),Cb(0,0),Cr(0,0), Y(2,0),Y(3,0),Cb(2,0),Cr(3.0), Y(4,0),Y(5,0),Cb(4,0),Cr(4,0). . . . * * The numbers in parenthesis are pixel coordinates. DX series' YCbCrCoefficients(0x0211) has values '0.299/0.587/0.114', * ReferenceBlackWhite(0x0214) has values '0,255,128,255,128,255'. Therefore to convert from Y/Cb/Cr to RGB is; * * B(0,0)=(Cb-128)*(2-0.114*2)+Y(0,0) * R(0,0)=(Cr-128)*(2-0.299*2)+Y(0,0) * G(0,0)=(Y(0,0)-0.114*B(0,0)-0.299*R(0,0))/0.587 * * Horizontal subsampling is a value '2', so you can calculate B(1,0)/R(1,0)/G(1,0) by using the Y(1,0) and Cr(0,0)/Cb(0,0). * Repeat this conversion by value of ImageWidth(0x0100) and ImageLength(0x0101). * * @param thumbnailBytes * @return * @throws com.drew.metadata.MetadataException * / private Image createImageFromRawYCbCr(byte[] thumbnailBytes) throws MetadataException { /* Y = 0.257R + 0.504G + 0.098B + 16 Cb = -0.148R - 0.291G + 0.439B + 128 Cr = 0.439R - 0.368G - 0.071B + 128 G = 1.164(Y-16) - 0.391(Cb-128) - 0.813(Cr-128) R = 1.164(Y-16) + 1.596(Cr-128) B = 1.164(Y-16) + 2.018(Cb-128) R, G and B range from 0 to 255. Y ranges from 16 to 235. Cb and Cr range from 16 to 240. http://www.faqs.org/faqs/graphics/colorspace-faq/ * / int length = thumbnailBytes.length; // this.getInt(ExifSubIFDDirectory.TAG_STRIP_BYTE_COUNTS); final int imageWidth = this.getInt(ExifSubIFDDirectory.TAG_THUMBNAIL_IMAGE_WIDTH); final int imageHeight = this.getInt(ExifSubIFDDirectory.TAG_THUMBNAIL_IMAGE_HEIGHT); // final int headerLength = 54; // byte[] result = new byte[length + headerLength]; // // Add a windows BMP header described: // // http://www.onicos.com/staff/iz/formats/bmp.html // result[0] = 'B'; // result[1] = 'M'; // File Type identifier // result[3] = (byte)(result.length / 256); // result[2] = (byte)result.length; // result[10] = (byte)headerLength; // result[14] = 40; // MS Windows BMP header // result[18] = (byte)imageWidth; // result[22] = (byte)imageHeight; // result[26] = 1; // 1 Plane // result[28] = 24; // Colour depth // result[34] = (byte)length; // result[35] = (byte)(length / 256); final BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); // order is YCbCr and image is upside down, bitmaps are BGR //// for (int i = headerLength, dataOffset = length; i<result.length; i += 3, dataOffset -= 3) // { // final int y = thumbnailBytes[dataOffset - 2] & 0xFF; // final int cb = thumbnailBytes[dataOffset - 1] & 0xFF; // final int cr = thumbnailBytes[dataOffset] & 0xFF; // if (y<16 || y>235 || cb<16 || cb>240 || cr<16 || cr>240) // "".toString(); // // int g = (int)(1.164*(y-16) - 0.391*(cb-128) - 0.813*(cr-128)); // int r = (int)(1.164*(y-16) + 1.596*(cr-128)); // int b = (int)(1.164*(y-16) + 2.018*(cb-128)); // //// result[i] = (byte)b; //// result[i + 1] = (byte)g; //// result[i + 2] = (byte)r; // // // TODO compose the image here // image.setRGB(1, 2, 3); // } return image; } /** * Creates a thumbnail image in (Windows) BMP format from raw RGB data. * @param thumbnailBytes * @return * @throws com.drew.metadata.MetadataException * / private Image createImageFromRawRgb(byte[] thumbnailBytes) throws MetadataException { final int length = thumbnailBytes.length; // this.getInt(ExifSubIFDDirectory.TAG_STRIP_BYTE_COUNTS); final int imageWidth = this.getInt(ExifSubIFDDirectory.TAG_THUMBNAIL_IMAGE_WIDTH); final int imageHeight = this.getInt(ExifSubIFDDirectory.TAG_THUMBNAIL_IMAGE_HEIGHT); // final int headerLength = 54; // final byte[] result = new byte[length + headerLength]; // // Add a windows BMP header described: // // http://www.onicos.com/staff/iz/formats/bmp.html // result[0] = 'B'; // result[1] = 'M'; // File Type identifier // result[3] = (byte)(result.length / 256); // result[2] = (byte)result.length; // result[10] = (byte)headerLength; // result[14] = 40; // MS Windows BMP header // result[18] = (byte)imageWidth; // result[22] = (byte)imageHeight; // result[26] = 1; // 1 Plane // result[28] = 24; // Colour depth // result[34] = (byte)length; // result[35] = (byte)(length / 256); final BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); // order is RGB and image is upside down, bitmaps are BGR // for (int i = headerLength, dataOffset = length; i<result.length; i += 3, dataOffset -= 3) // { // byte b = thumbnailBytes[dataOffset - 2]; // byte g = thumbnailBytes[dataOffset - 1]; // byte r = thumbnailBytes[dataOffset]; // // // TODO compose the image here // image.setRGB(1, 2, 3); // } return image; } */ }
79cdf2a60d984740b49ad9a744ffd5fd09bc4e77
6e7abb512dfe0ad03c07cbc10e5ca57e22dc3377
/wifiin-global/src/test/java/com/wifiin/httpclient/HttpClientTest.java
dda9de4dfec288ad1796e12ed37b032208bb7fa3
[]
no_license
heianxing/wifiin-core
be3dbaf9a9d84a962c8ed6692c1dade1bf608119
bc3b81a38fa74b1a5bd269d17f358a163295bea5
refs/heads/master
2020-11-26T18:51:37.112911
2017-08-26T08:55:59
2017-08-26T08:55:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,636
java
package com.wifiin.httpclient; import java.io.IOException; import java.net.ProxySelector; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLContext; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; import org.apache.http.HttpVersion; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.config.ConnectionConfig; import org.apache.http.config.Registry; import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.HttpClientConnectionManager; import org.apache.http.conn.routing.HttpRoutePlanner; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.LayeredConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; import org.apache.http.impl.conn.DefaultProxyRoutePlanner; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.impl.conn.SystemDefaultRoutePlanner; import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; import org.apache.http.ssl.SSLContexts; import org.apache.http.util.EntityUtils; import org.junit.Test; import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.Maps; import com.wifiin.common.GlobalObject; import com.wifiin.util.Help; import com.wifiin.util.ShutdownHookUtil; import com.wifiin.util.net.http.HttpClient; //public class HttpClientTest{ // private static final String USER_AGENT="User-Agent"; // private static final String DEFAULT_USER_AGENT="WifiinCore-HttpClient"; // private static final String REQUEST_COOKIE_HEADER="Cookie"; // private static final String RESPONSE_COOKIE_HEADER="Set-Cookie"; // private static final String CONTENT_TYPE="Content-Type"; // private static final String CONNECTION="Connection"; // private static final String ACCEPT_CHARSET="Accept-Charset"; // private static final String NO_PROXY=""; // private static final Registry<ConnectionSocketFactory> REGISTRY; // private static final PoolingHttpClientConnectionManager POOLED_CONNECTION_MANAGER; // private static final Map<String,CloseableHttpClient> HTTP_MAP=Maps.newConcurrentMap(); // static{ // RegistryBuilder<ConnectionSocketFactory> registryBuilder = RegistryBuilder.<ConnectionSocketFactory>create(); // SSLContext sslContext = SSLContexts.createDefault(); //// SSLContext sslContext = SSLContexts.custom().useProtocol("https").loadTrustMaterial(trustStore, anyTrustStrategy).build(); // LayeredConnectionSocketFactory sslSF = new SSLConnectionSocketFactory(sslContext); // registryBuilder.register("https", sslSF); // ConnectionSocketFactory plainSF = new PlainConnectionSocketFactory(); // registryBuilder.register("http", plainSF); // REGISTRY = registryBuilder.build(); // POOLED_CONNECTION_MANAGER = new PoolingHttpClientConnectionManager(REGISTRY); // ShutdownHookUtil.addHook(()->{ // HTTP_MAP.values().forEach((http)->{ // try{ // http.close(); // }catch(IOException e){} // }); // }); // } // private String url; // private String charset; // private Map<String,String> cookies; // private Map<String,String> headers; // private HttpRequestBase requestData; // private HttpEntity requestEntity; // private HttpEntity responseEntity; // private String proxyHost=""; // private int proxyPort; // private boolean useProxy; // private boolean pooled; // private String contentType; // private String userAgent; // private StatusLine status; // private HttpVersion httpVersion; // private Header[] responseHeaders; // private Map<String,List<Header>> responseHeaderMap; // private HttpClientContext context=HttpClientContext.create(); // private int bufferSize=4128; // private int retryCount=3; // private int connectionRequestTimeout=5000; // private int connectTimeout=5000; // private int socketTimeout=5000; // private long connectionLiveMinutes=1; // private int maxConnTotal=1000; // private int maxConnPerRoute=1000; // private long connectLiveTime=5000; // @Test // public void testHttpClientWithoutPool() throws IOException{ // HttpClient http=null; // Map m=Maps.newHashMap(); // m.put("a",1); // for(int i=0;i<10;i++){ // http=new HttpClient("http://172.16.1.7:18010/sdk/test.do",false); //// http.setHttpVersion(HttpVersion.HTTP_1_0); // http.addHeader(HTTP.CONN_DIRECTIVE,HTTP.CONN_CLOSE); // http.setContentType("application/json; charset=UTF-8"); // http.addHeader("Hello-Wifiin","World"); // http.jsonEntity(m); // String result=http.post(); // System.out.println("AAAAAAAAAA"+result+" "+http.getStatus()); // } // } // @Test // public void testApacheHttpClient() throws ClientProtocolException, IOException{ // Map m=Maps.newHashMap(); // m.put("a",1); // for(int i=0;i<10;i++){ // try(CloseableHttpClient http=createHttpClient(new BasicHttpClientConnectionManager(REGISTRY))){ // HttpPost post = new HttpPost("http://172.16.1.7:18010/sdk/test.do"); // post.setEntity(new StringEntity(GlobalObject.getJsonMapper().writeValueAsString(m),StandardCharsets.UTF_8)); // post.setHeader("Hello","World"); // post.setHeader(HTTP.CONTENT_TYPE,"application/json; charset=UTF-8"); // post.setHeader(HTTP.CONN_DIRECTIVE,HTTP.CONN_CLOSE); // post.setHeader(HTTP.USER_AGENT,"HttpClient-Test"); // post.setProtocolVersion(HttpVersion.HTTP_1_0); // try(CloseableHttpResponse result=http.execute(post)){ // System.out.println("BBBBBBBBBBBB"+EntityUtils.toString(result.getEntity(),StandardCharsets.UTF_8)+" "+result.getStatusLine()); // } // } // } // // } // private CloseableHttpClient createHttpClient(HttpClientConnectionManager httpClientConnectionManager){ // HttpClientBuilder httpClientBuilder=HttpClients.custom().setDefaultRequestConfig( // RequestConfig.custom().setConnectionRequestTimeout(connectionRequestTimeout).setConnectTimeout(connectTimeout).setSocketTimeout(socketTimeout).build()) // .setRetryHandler((IOException exception,int executionCount,HttpContext context)->{ // if (executionCount > retryCount) { // return false; // } // if (exception instanceof org.apache.http.NoHttpResponseException) { // return true; // } // return false; // }) // .setDefaultConnectionConfig(ConnectionConfig.custom().setBufferSize(bufferSize).setCharset(StandardCharsets.UTF_8).build()) // .setConnectionTimeToLive(connectionLiveMinutes,TimeUnit.MINUTES) // .setConnectionManager(httpClientConnectionManager) // .setMaxConnTotal(maxConnTotal).setMaxConnPerRoute(maxConnPerRoute); // boolean proxy=Help.isNotEmpty(proxyHost) && proxyPort>0; // if(useProxy || proxy){ // HttpRoutePlanner routePlanner; // if(proxy){ // HttpHost proxyHost = new HttpHost(this.proxyHost,this.proxyPort); // routePlanner = new DefaultProxyRoutePlanner(proxyHost); // }else{ // routePlanner = new SystemDefaultRoutePlanner(ProxySelector.getDefault()); // } // httpClientBuilder.setRoutePlanner(routePlanner); // } // return httpClientBuilder.build(); // } //}
caf285bf4e51887ac2f9980aa816503886512d31
05b37b4f67d389f8620f7ab403c390b5818b55a1
/livecoding/src/main/java/com/digitalinnovation/livecoding/config/VillainsTable.java
711932e6461b5a6cae50f500609156e9da90dae4
[ "MIT" ]
permissive
Cleython-Enginner/Heroes-SpringWebflux-API
358a627d76f81542790facbc5784707b148f2f09
95f54d0f2a3fa2bfcd3956f033222a69da0ebf66
refs/heads/main
2023-07-15T22:58:17.959115
2021-08-20T01:45:52
2021-08-20T01:45:52
386,990,626
0
0
null
2021-08-20T01:45:52
2021-07-17T16:41:21
Java
UTF-8
Java
false
false
1,989
java
package com.digitalinnovation.livecoding.config; import java.util.Arrays; import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.amazonaws.services.dynamodbv2.document.Table; import com.amazonaws.services.dynamodbv2.model.AttributeDefinition; import com.amazonaws.services.dynamodbv2.model.KeySchemaElement; import com.amazonaws.services.dynamodbv2.model.KeyType; import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput; import com.amazonaws.services.dynamodbv2.model.ScalarAttributeType; import static com.digitalinnovation.livecoding.constants.HeroesConstant.ENDPOINT_DYNAMO; import static com.digitalinnovation.livecoding.constants.HeroesConstant.REGION_DYNAMO; public class VillainsTable { public static void main(String[] args) throws Exception { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard() .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(ENDPOINT_DYNAMO, REGION_DYNAMO)) .build(); DynamoDB dynamoDB = new DynamoDB(client); String tableName = "Villains_Api_Table"; try { System.out.println("Criando tabela, aguarde..."); Table table = dynamoDB.createTable(tableName, Arrays.asList(new KeySchemaElement("id", KeyType.HASH) ), Arrays.asList(new AttributeDefinition("id", ScalarAttributeType.S) ), new ProvisionedThroughput(5L, 5L)); table.waitForActive(); System.out.println("Successo " + table.getDescription().getTableStatus()); } catch (Exception e) { System.err.println("Não foi possível criar a tabela"); System.err.println(e.getMessage()); } } }
211d92508803273a6e09497bdbb5569749ab25ba
44e0b10a1e98587ea4cf9067b0de39937f5de081
/src/main/java/com/cdkj/ylq/dto/res/XN802167Res.java
431c38f42a33c5d34f78c72c61b256dcc608440d
[]
no_license
ibisTime/xn-ylq
96df9254746f4d7017865f45908a9d93269d3876
937e475780d80c1fb29659878effd060e28a1b94
refs/heads/master
2021-01-16T11:29:30.662194
2018-01-05T09:57:20
2018-01-05T09:57:20
99,996,279
0
6
null
null
null
null
UTF-8
Java
false
false
623
java
/** * @Title XN802166Res.java * @Package com.std.account.dto.res * @Description * @author leo(haiqing) * @date 2017年9月15日 下午12:54:59 * @version V1.0 */ package com.cdkj.ylq.dto.res; /** * @author: haiqingzheng * @since: 2017年9月15日 下午12:54:59 * @history: */ public class XN802167Res { private boolean isSuccess; public XN802167Res(boolean isSuccess) { super(); this.isSuccess = isSuccess; } public boolean isSuccess() { return isSuccess; } public void setSuccess(boolean isSuccess) { this.isSuccess = isSuccess; } }
9bffc7580335394341f1037d9d7007355c5f5ae1
10186b7d128e5e61f6baf491e0947db76b0dadbc
/org/apache/xerces/parsers/AbstractXMLDocumentParser.java
aafff9431f44a7f75f0abe2ea302121e103c1b34
[ "SMLNJ", "Apache-1.1", "Apache-2.0", "BSD-2-Clause" ]
permissive
MewX/contendo-viewer-v1.6.3
7aa1021e8290378315a480ede6640fd1ef5fdfd7
69fba3cea4f9a43e48f43148774cfa61b388e7de
refs/heads/main
2022-07-30T04:51:40.637912
2021-03-28T05:06:26
2021-03-28T05:06:26
351,630,911
2
0
Apache-2.0
2021-10-12T22:24:53
2021-03-26T01:53:24
Java
UTF-8
Java
false
false
7,755
java
package org.apache.xerces.parsers; import org.apache.xerces.xni.Augmentations; import org.apache.xerces.xni.NamespaceContext; import org.apache.xerces.xni.QName; import org.apache.xerces.xni.XMLAttributes; import org.apache.xerces.xni.XMLDTDContentModelHandler; import org.apache.xerces.xni.XMLDTDHandler; import org.apache.xerces.xni.XMLDocumentHandler; import org.apache.xerces.xni.XMLLocator; import org.apache.xerces.xni.XMLResourceIdentifier; import org.apache.xerces.xni.XMLString; import org.apache.xerces.xni.XNIException; import org.apache.xerces.xni.parser.XMLDTDContentModelSource; import org.apache.xerces.xni.parser.XMLDTDSource; import org.apache.xerces.xni.parser.XMLDocumentSource; import org.apache.xerces.xni.parser.XMLParserConfiguration; public abstract class AbstractXMLDocumentParser extends XMLParser implements XMLDTDContentModelHandler, XMLDTDHandler, XMLDocumentHandler { protected boolean fInDTD; protected XMLDocumentSource fDocumentSource; protected XMLDTDSource fDTDSource; protected XMLDTDContentModelSource fDTDContentModelSource; protected AbstractXMLDocumentParser(XMLParserConfiguration paramXMLParserConfiguration) { super(paramXMLParserConfiguration); paramXMLParserConfiguration.setDocumentHandler(this); paramXMLParserConfiguration.setDTDHandler(this); paramXMLParserConfiguration.setDTDContentModelHandler(this); } public void startDocument(XMLLocator paramXMLLocator, String paramString, NamespaceContext paramNamespaceContext, Augmentations paramAugmentations) throws XNIException {} public void xmlDecl(String paramString1, String paramString2, String paramString3, Augmentations paramAugmentations) throws XNIException {} public void doctypeDecl(String paramString1, String paramString2, String paramString3, Augmentations paramAugmentations) throws XNIException {} public void startElement(QName paramQName, XMLAttributes paramXMLAttributes, Augmentations paramAugmentations) throws XNIException {} public void emptyElement(QName paramQName, XMLAttributes paramXMLAttributes, Augmentations paramAugmentations) throws XNIException { startElement(paramQName, paramXMLAttributes, paramAugmentations); endElement(paramQName, paramAugmentations); } public void characters(XMLString paramXMLString, Augmentations paramAugmentations) throws XNIException {} public void ignorableWhitespace(XMLString paramXMLString, Augmentations paramAugmentations) throws XNIException {} public void endElement(QName paramQName, Augmentations paramAugmentations) throws XNIException {} public void startCDATA(Augmentations paramAugmentations) throws XNIException {} public void endCDATA(Augmentations paramAugmentations) throws XNIException {} public void endDocument(Augmentations paramAugmentations) throws XNIException {} public void startGeneralEntity(String paramString1, XMLResourceIdentifier paramXMLResourceIdentifier, String paramString2, Augmentations paramAugmentations) throws XNIException {} public void textDecl(String paramString1, String paramString2, Augmentations paramAugmentations) throws XNIException {} public void endGeneralEntity(String paramString, Augmentations paramAugmentations) throws XNIException {} public void comment(XMLString paramXMLString, Augmentations paramAugmentations) throws XNIException {} public void processingInstruction(String paramString, XMLString paramXMLString, Augmentations paramAugmentations) throws XNIException {} public void setDocumentSource(XMLDocumentSource paramXMLDocumentSource) { this.fDocumentSource = paramXMLDocumentSource; } public XMLDocumentSource getDocumentSource() { return this.fDocumentSource; } public void startDTD(XMLLocator paramXMLLocator, Augmentations paramAugmentations) throws XNIException { this.fInDTD = true; } public void startExternalSubset(XMLResourceIdentifier paramXMLResourceIdentifier, Augmentations paramAugmentations) throws XNIException {} public void endExternalSubset(Augmentations paramAugmentations) throws XNIException {} public void startParameterEntity(String paramString1, XMLResourceIdentifier paramXMLResourceIdentifier, String paramString2, Augmentations paramAugmentations) throws XNIException {} public void endParameterEntity(String paramString, Augmentations paramAugmentations) throws XNIException {} public void ignoredCharacters(XMLString paramXMLString, Augmentations paramAugmentations) throws XNIException {} public void elementDecl(String paramString1, String paramString2, Augmentations paramAugmentations) throws XNIException {} public void startAttlist(String paramString, Augmentations paramAugmentations) throws XNIException {} public void attributeDecl(String paramString1, String paramString2, String paramString3, String[] paramArrayOfString, String paramString4, XMLString paramXMLString1, XMLString paramXMLString2, Augmentations paramAugmentations) throws XNIException {} public void endAttlist(Augmentations paramAugmentations) throws XNIException {} public void internalEntityDecl(String paramString, XMLString paramXMLString1, XMLString paramXMLString2, Augmentations paramAugmentations) throws XNIException {} public void externalEntityDecl(String paramString, XMLResourceIdentifier paramXMLResourceIdentifier, Augmentations paramAugmentations) throws XNIException {} public void unparsedEntityDecl(String paramString1, XMLResourceIdentifier paramXMLResourceIdentifier, String paramString2, Augmentations paramAugmentations) throws XNIException {} public void notationDecl(String paramString, XMLResourceIdentifier paramXMLResourceIdentifier, Augmentations paramAugmentations) throws XNIException {} public void startConditional(short paramShort, Augmentations paramAugmentations) throws XNIException {} public void endConditional(Augmentations paramAugmentations) throws XNIException {} public void endDTD(Augmentations paramAugmentations) throws XNIException { this.fInDTD = false; } public void setDTDSource(XMLDTDSource paramXMLDTDSource) { this.fDTDSource = paramXMLDTDSource; } public XMLDTDSource getDTDSource() { return this.fDTDSource; } public void startContentModel(String paramString, Augmentations paramAugmentations) throws XNIException {} public void any(Augmentations paramAugmentations) throws XNIException {} public void empty(Augmentations paramAugmentations) throws XNIException {} public void startGroup(Augmentations paramAugmentations) throws XNIException {} public void pcdata(Augmentations paramAugmentations) throws XNIException {} public void element(String paramString, Augmentations paramAugmentations) throws XNIException {} public void separator(short paramShort, Augmentations paramAugmentations) throws XNIException {} public void occurrence(short paramShort, Augmentations paramAugmentations) throws XNIException {} public void endGroup(Augmentations paramAugmentations) throws XNIException {} public void endContentModel(Augmentations paramAugmentations) throws XNIException {} public void setDTDContentModelSource(XMLDTDContentModelSource paramXMLDTDContentModelSource) { this.fDTDContentModelSource = paramXMLDTDContentModelSource; } public XMLDTDContentModelSource getDTDContentModelSource() { return this.fDTDContentModelSource; } protected void reset() throws XNIException { super.reset(); this.fInDTD = false; } } /* Location: /mnt/r/ConTenDoViewer.jar!/org/apache/xerces/parsers/AbstractXMLDocumentParser.class * Java compiler version: 3 (47.0) * JD-Core Version: 1.1.3 */
3f2fb4446105803bcf4d87d5bc16acf5120832b3
a84b34374159afd1719c2f7ee1b99a602147ae86
/src/mazeducks/Loading.java
b6982fac0316e8ebd3cde10d6f6c396b070b633e
[]
no_license
Kunal-khanwalkar/MAZEducks
c3d92526abe3bd53e77ca5d7f4404b3192a01149
061704f7b1b876296674f2878101cb17e5b9f9de
refs/heads/master
2020-11-25T09:27:15.637209
2020-04-08T13:24:04
2020-04-08T13:24:04
228,596,051
0
0
null
null
null
null
UTF-8
Java
false
false
3,541
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 mazeducks; /** * * @author Medha Joshi */ public class Loading extends javax.swing.JFrame { /** * Creates new form Loading */ public Loading() { initComponents(); new Loading().setVisible(true); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setPreferredSize(new java.awt.Dimension(1080, 1080)); getContentPane().setLayout(null); jLabel2.setBackground(new java.awt.Color(255, 255, 255)); jLabel2.setFont(new java.awt.Font("C39HrP24DlTt", 0, 48)); // NOI18N jLabel2.setText("Loading"); getContentPane().add(jLabel2); jLabel2.setBounds(370, 140, 260, 80); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mazeducks/ezgif.com-gif-maker.gif"))); // NOI18N getContentPane().add(jLabel1); jLabel1.setBounds(0, 0, 1080, 1080); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Loading.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Loading.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Loading.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Loading.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ /*java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Loading().setVisible(true); } });*/ } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; // End of variables declaration//GEN-END:variables }
e38c37a4d8efd7ef7dc81a54f366278e9b9db518
1f568b8e67952c2837c176339708cde4f235b018
/test/ru/job4j/array/SwitchArrayTest.java
d0cfe20dd1d9b07b33377af47c52dd4143c3c0d9
[]
no_license
AlexKennethMiles/job4j_elementary_practice
896cf452cff5695401bd0bcb395cff550994ee13
b2429e8ea8e74149fd907908bc0ea4cad94113ff
refs/heads/master
2023-05-21T09:54:19.426413
2021-06-14T19:59:37
2021-06-14T19:59:37
333,356,363
0
0
null
null
null
null
UTF-8
Java
false
false
1,026
java
package ru.job4j.array; import org.junit.Test; import static org.hamcrest.core.Is.is; import static org.junit.Assert.*; public class SwitchArrayTest { @Test public void whenSwap0to3() { int[] input = {1, 2, 3, 4}; int[] expect = {4, 2, 3, 1}; int[] rsl = SwitchArray.swap(input, 0, input.length - 1); assertThat(rsl, is(expect)); } @Test public void whenSwap1to3() { int[] input = {0, 1, 2, 3}; int[] expect = {0, 3, 2, 1}; int[] rsl = SwitchArray.swap(input, 1, 3); assertThat(rsl, is(expect)); } @Test public void whenSwap0to0() { int[] input = {0, 1, 2, 3, 4}; int[] expect = {0, 1, 2, 3, 4}; int[] rsl = SwitchArray.swap(input, 0, 0); assertThat(rsl, is(expect)); } @Test public void whenSwap4to1() { int[] input = {0, 1, 2, 3, 4}; int[] expect = {0, 4, 2, 3, 1}; int[] rsl = SwitchArray.swap(input, 4, 1); assertThat(rsl, is(expect)); } }
5000481109114c2db18e97bae104596c8453caca
ae276ef4fa493b2b8b5035ea346ac5e04d1df48e
/app/src/main/java/com/example/camirwin/invoicetracker/model/Services.java
3fe53f381350f82533bb1f5489d260e1d7328955
[]
no_license
Camirwin/OverTime
bb7c0d5be632f26e851962ee1646009c7b98f5a9
9423c6d7c4f81a7d1a13d3f97a6fba8bf9dddba2
refs/heads/master
2020-04-20T17:31:53.120804
2014-08-02T19:38:10
2014-08-02T19:38:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package com.example.camirwin.invoicetracker.model; import java.util.Date; public class Services { private Integer Id; private Integer ClientId; private Integer InvoiceId; private String Name; private Double Rate; private Long LastWorkedDate; private Double OutstandingBalance; public Integer getId() { return Id; } public void setId(Integer id) { Id = id; } public Integer getClientId() { return ClientId; } public void setClientId(Integer clientId) { ClientId = clientId; } public Integer getInvoiceId() { return InvoiceId; } public void setInvoiceId(Integer invoiceId) { InvoiceId = invoiceId; } public String getName() { return Name; } public void setName(String name) { Name = name; } public Double getRate() { return Rate; } public void setRate(Double rate) { Rate = rate; } public Long getLastWorkedDate() { return LastWorkedDate; } public void setLastWorkedDate(Long lastWorkedDate) { LastWorkedDate = lastWorkedDate; } public Double getOutstandingBalance() { return OutstandingBalance; } public void setOutstandingBalance(Double outstandingBalance) { OutstandingBalance = outstandingBalance; } public Date getLastWorkedAsDateObject() { return new Date(getLastWorkedDate()); } }
9287a3a7e42659d5d5445e37324343ef5cd62266
117e9d2e1e2200d6b5de1a8d80d3a94f061ee6c7
/src/serviceadaptor/document/ws/ObjectFactory.java
e152cec58fe0c1020755ce32c5e1eec57dddb702
[]
no_license
introsde-project-lifestylecoach-old/data-service
23e029070afc8944de866f99fe367e56fb2937ee
072b5dd8020cb5d5d000ba64b9c0a9ccd0b47882
refs/heads/master
2021-06-01T02:25:50.370091
2016-08-11T15:20:42
2016-08-11T15:20:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,880
java
package serviceadaptor.document.ws; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the serviceadaptor.document.ws 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 { private final static QName _GetMotivationPhrase_QNAME = new QName("http://ws.document.serviceadaptor/", "get_motivation_phrase"); private final static QName _GetMotivationPhraseResponse_QNAME = new QName("http://ws.document.serviceadaptor/", "get_motivation_phraseResponse"); private final static QName _GetUserFromRemoteResponse_QNAME = new QName("http://ws.document.serviceadaptor/", "get_user_from_remoteResponse"); private final static QName _SaveUserInRemoteResponse_QNAME = new QName("http://ws.document.serviceadaptor/", "save_user_in_remoteResponse"); private final static QName _GetUserFromRemote_QNAME = new QName("http://ws.document.serviceadaptor/", "get_user_from_remote"); private final static QName _SaveUserInRemote_QNAME = new QName("http://ws.document.serviceadaptor/", "save_user_in_remote"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: serviceadaptor.document.ws * */ public ObjectFactory() { } /** * Create an instance of {@link SaveUserInRemoteResponse } * */ public SaveUserInRemoteResponse createSaveUserInRemoteResponse() { return new SaveUserInRemoteResponse(); } /** * Create an instance of {@link GetUserFromRemote } * */ public GetUserFromRemote createGetUserFromRemote() { return new GetUserFromRemote(); } /** * Create an instance of {@link SaveUserInRemote } * */ public SaveUserInRemote createSaveUserInRemote() { return new SaveUserInRemote(); } /** * Create an instance of {@link GetMotivationPhraseResponse } * */ public GetMotivationPhraseResponse createGetMotivationPhraseResponse() { return new GetMotivationPhraseResponse(); } /** * Create an instance of {@link GetMotivationPhrase } * */ public GetMotivationPhrase createGetMotivationPhrase() { return new GetMotivationPhrase(); } /** * Create an instance of {@link GetUserFromRemoteResponse } * */ public GetUserFromRemoteResponse createGetUserFromRemoteResponse() { return new GetUserFromRemoteResponse(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link GetMotivationPhrase }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "get_motivation_phrase") public JAXBElement<GetMotivationPhrase> createGetMotivationPhrase(GetMotivationPhrase value) { return new JAXBElement<GetMotivationPhrase>(_GetMotivationPhrase_QNAME, GetMotivationPhrase.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link GetMotivationPhraseResponse }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "get_motivation_phraseResponse") public JAXBElement<GetMotivationPhraseResponse> createGetMotivationPhraseResponse(GetMotivationPhraseResponse value) { return new JAXBElement<GetMotivationPhraseResponse>(_GetMotivationPhraseResponse_QNAME, GetMotivationPhraseResponse.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link GetUserFromRemoteResponse }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "get_user_from_remoteResponse") public JAXBElement<GetUserFromRemoteResponse> createGetUserFromRemoteResponse(GetUserFromRemoteResponse value) { return new JAXBElement<GetUserFromRemoteResponse>(_GetUserFromRemoteResponse_QNAME, GetUserFromRemoteResponse.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link SaveUserInRemoteResponse }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "save_user_in_remoteResponse") public JAXBElement<SaveUserInRemoteResponse> createSaveUserInRemoteResponse(SaveUserInRemoteResponse value) { return new JAXBElement<SaveUserInRemoteResponse>(_SaveUserInRemoteResponse_QNAME, SaveUserInRemoteResponse.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link GetUserFromRemote }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "get_user_from_remote") public JAXBElement<GetUserFromRemote> createGetUserFromRemote(GetUserFromRemote value) { return new JAXBElement<GetUserFromRemote>(_GetUserFromRemote_QNAME, GetUserFromRemote.class, null, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link SaveUserInRemote }{@code >}} * */ @XmlElementDecl(namespace = "http://ws.document.serviceadaptor/", name = "save_user_in_remote") public JAXBElement<SaveUserInRemote> createSaveUserInRemote(SaveUserInRemote value) { return new JAXBElement<SaveUserInRemote>(_SaveUserInRemote_QNAME, SaveUserInRemote.class, null, value); } }
112058daba7d5fe57e56a0fcc8ec446492421246
bd59f9a9b7bf598a1168299dce0b1e07b91c8729
/src/main/java/com/geekq/miaosha/service/rpchander/RpcCompensateService.java
43fd0ff0bceb731b86d8a835e584d9899ce14f75
[]
no_license
jiayangchen/miaosha
8425be8ad35d4a512c8a53302c03b43517d94b98
3dc731e70195176f49d5e021e0af954368e74270
refs/heads/master
2020-04-18T01:01:10.107267
2019-01-22T15:19:03
2019-01-22T15:19:03
167,101,943
3
0
null
2019-01-23T02:21:49
2019-01-23T02:21:49
null
UTF-8
Java
false
false
3,770
java
package com.geekq.miaosha.service.rpchander; import com.geekq.miaosha.common.SnowflakeIdWorker; import com.geekq.miaosha.common.resultbean.ResultGeekQ; import com.geekq.miaosha.service.rpchander.enums.PlanStepStatus; import com.geekq.miaosha.service.rpchander.enums.PlanStepType; import com.geekq.miaosha.service.rpchander.vo.HandlerParam; import com.geekq.miaosha.service.rpchander.vo.PlanOrder; import com.geekq.miaosha.service.rpchander.vo.PlanStep; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; @Service public class RpcCompensateService { public ResultGeekQ<String> recharge(){ ResultGeekQ<String> result = ResultGeekQ.build(); /** * 各种校验check */ /** * 需要可加redis分布式锁 */ /** * 拦截 * 校验状态 -- init 或 ROLLING_BACK则 返回 * * 成功则返回已处理状态 */ /** * 生成订单和处理步骤 */ /** * 获取订单 */ long orderId = SnowflakeIdWorker.getOrderId(1,1); /** * 创建订单步骤 可定义一个VO * 一个planorder 对应多个planstep * 创建 PlanOrder 创建 planStep * createOrderStep(vo); */ // PlanOrder planOrder = new PlanOrder(); // planOrder.setCreateTime(new Date()); // planOrder.setVersion(0); // planOrder.setUserId(inputVo.getUserId()); // planOrder.setOrderNo(inputVo.getOrderNo()); // planOrder.setType(PlanOrderType.X_RECHARGE.name()); // planOrder.setParams(params); // planOrder.setStatus(PlanOrderStatus.INIT.name()); // planOrderDao.insertSelective(planOrder); // // List<PlanStep> steps = new ArrayList<>(); // //第一步请求民生 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_CMBC, PlanStepStatus.INIT)); // if (inputVo.getCouponId() != null) { // //第二步使用优惠券 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_USE_COUPON, PlanStepStatus.INIT)); // } // //第三步减扣主账户 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_POINT, PlanStepStatus.INIT)); // //第四部减扣子账户 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_SUB_POINT, PlanStepStatus.INIT)); // //第五步发送通知 // steps.add(planStepLogic.buildStep(planOrder.getId(), PlanStepType.X_RECHARGE_NOTIFY, PlanStepStatus.INIT)); // // planStepDao.batchInsert(steps); /** * * 调用Rpc接口 第几步错误则回滚前几步 * 并更新step状态 * * 然后定时任务去处理 状态为INIT与ROLLBACK的 状态订单 * * */ // HandlerParam handlerParam = new HandlerParam(); // handlerParam.setPlanOrder(planOrder); // AutoInvestPlanRechargeOrderInputVo inputVo = JsonUtil.jsonToBean(planOrder.getParams(), AutoInvestPlanRechargeOrderInputVo.class); // handlerParam.setInputVo(inputVo); // for (int i = 0; i < planStepList.size(); i++) { // PlanStep planStep = planStepList.get(i); // PlanStepType stepType = PlanStepType.valueOf(planStep.getType()); // xxx handler = (xxx) xxxx.getApplicationContext().getBean(stepType.getHandler()); // boolean handlerResult = handler.handle(handlerParam); // if (!handlerResult) { // break; // } // } return result; } }
7c02f2d59de97820a16483350e4db67e1b1afe20
94bf529e7a4753e69c4a4841fdbeaac9041357ff
/app/src/main/java/com/example/punit/app/NewsActivity.java
f8bc3f0129607e4948d829ae7c9be0f3b5b9a113
[]
no_license
Raghu15/App
6382489f91e74d7fe8b6faa5fc380fb051c61df5
1f7f2b70940af80f51d3e82d6831622b5610e0bb
refs/heads/master
2021-01-10T16:14:51.434485
2016-02-22T11:24:12
2016-02-22T11:24:12
52,268,560
0
0
null
null
null
null
UTF-8
Java
false
false
792
java
package com.example.punit.app; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; /** * Created by punit on 09/12/2015. */ public class NewsActivity extends AppCompatActivity { private TextView tvNews; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.news_activity_layout); tvNews = (TextView) findViewById(R.id.tvnews); Intent incommingIntentObject = getIntent(); setTitle(incommingIntentObject.getStringExtra(ActivityNavigator.NEWS_TYPE)); tvNews.setText(" I will show " + incommingIntentObject.getStringExtra(ActivityNavigator.NEWS_TYPE) + " news"); } }
2126960b85c90db0bf90677e502f8cc61f3ec841
0bf686492a9fadafadd3b5ab2398f8a13f69e521
/DesignPattern/src/CafeExample/Packing.java
e22ae3753613dfc9744ac305a717a67b0e8f5904
[]
no_license
ultracake/design_patterns
dceda0ccfb332c99fc21834c421347b223b513bd
d927ae96f0bb730ca9639ba3cb349e2b6c5aa548
refs/heads/main
2023-01-22T23:35:02.780772
2020-12-01T09:32:51
2020-12-01T09:32:51
300,525,957
0
0
null
null
null
null
UTF-8
Java
false
false
70
java
package CafeExample; public interface Packing { String pack(); }
6d5b1f353623e1b751a87b30628a219a98b13bdc
39cad3a0faad4d4c3dcb03686d52200bc56fba09
/src/main/java/com/test/taskmanager/domain/Process.java
f542da84324ffd958587b93fe3e8c8f4dbd691dd
[]
no_license
galegofer/taskmanager-test
2b39434a0f0af18341c1d5f47b4b2cb1348a6e83
8fb5c33799c783145bc1d670552b52f6166095b4
refs/heads/main
2023-07-01T04:41:13.187319
2021-08-04T14:16:54
2021-08-04T14:16:54
392,710,375
0
0
null
null
null
null
UTF-8
Java
false
false
1,904
java
package com.test.taskmanager.domain; import io.vavr.concurrent.Future; import java.time.LocalDateTime; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode.Exclude; import lombok.NonNull; import lombok.ToString; import lombok.Value; import lombok.With; import lombok.extern.slf4j.Slf4j; @Slf4j @Value @AllArgsConstructor @EqualsAndHashCode public class Process implements Runnable { long pid; @Exclude Priority priority; @Exclude AtomicBoolean running; @Exclude LocalDateTime creationTime; @With @Exclude @ToString.Exclude Future<Void> future; @Builder public Process(@NonNull Priority priority) { this.pid = PIDGenerator.getPid(); this.priority = priority; this.creationTime = LocalDateTime.now(); this.running = new AtomicBoolean(false); this.future = null; } @Override public void run() { log.debug("Executing task with PID: {}", pid); running.set(true); while (running.get()) { try { Thread.sleep(2000); } catch (InterruptedException ex) { log.warn("Task with PID: {} was interrupted", pid); running.set(false); } } } public boolean getRunning() { return running.get(); } public Process kill() { running.set(false); future.cancel(); log.info("Killed process with PID: {}, priority: {}", pid, priority); return this; } private static final class PIDGenerator { private static final AtomicLong pidCounter = new AtomicLong(0); public static long getPid() { return pidCounter.incrementAndGet(); } } }
6d56a48fe1a2033ca66c8c6d5af8edd89100e046
7569f9a68ea0ad651b39086ee549119de6d8af36
/cocoon-2.1.9/src/blocks/forms/java/org/apache/cocoon/forms/datatype/typeimpl/AbstractDatatype.java
00a039f97e2a7898680a78e5a9fa5ed4a566d063
[ "Apache-2.0" ]
permissive
tpso-src/cocoon
844357890f8565c4e7852d2459668ab875c3be39
f590cca695fd9930fbb98d86ae5f40afe399c6c2
refs/heads/master
2021-01-10T02:45:37.533684
2015-07-29T18:47:11
2015-07-29T18:47:11
44,549,791
0
0
null
null
null
null
UTF-8
Java
false
false
3,855
java
/* * Copyright 1999-2004 The Apache Software Foundation. * * 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.apache.cocoon.forms.datatype.typeimpl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import org.apache.cocoon.forms.datatype.Datatype; import org.apache.cocoon.forms.datatype.DatatypeBuilder; import org.apache.cocoon.forms.datatype.ValidationRule; import org.apache.cocoon.forms.datatype.convertor.Convertor; import org.apache.cocoon.forms.datatype.convertor.ConversionResult; import org.apache.cocoon.forms.validation.ValidationError; import org.apache.cocoon.forms.FormsConstants; import org.apache.cocoon.xml.AttributesImpl; import org.outerj.expression.ExpressionContext; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * Abstract base class for Datatype implementations. Most concreate datatypes * will derive from this class. * @version $Id: AbstractDatatype.java 370089 2006-01-18 09:26:09Z jbq $ */ public abstract class AbstractDatatype implements Datatype { private List validationRules = new ArrayList(); private boolean arrayType = false; private DatatypeBuilder builder; private Convertor convertor; public ValidationError validate(Object value, ExpressionContext expressionContext) { Iterator validationRulesIt = validationRules.iterator(); while (validationRulesIt.hasNext()) { ValidationRule validationRule = (ValidationRule)validationRulesIt.next(); ValidationError result = validationRule.validate(value, expressionContext); if (result != null) return result; } return null; } public void addValidationRule(ValidationRule validationRule) { validationRules.add(validationRule); } public boolean isArrayType() { return arrayType; } protected void setArrayType(boolean arrayType) { this.arrayType = arrayType; } public void setConvertor(Convertor convertor) { this.convertor = convertor; } protected void setBuilder(DatatypeBuilder builder) { this.builder = builder; } public Convertor getPlainConvertor() { return builder.getPlainConvertor(); } public DatatypeBuilder getBuilder() { return builder; } public Convertor getConvertor() { return convertor; } public ConversionResult convertFromString(String value, Locale locale) { return getConvertor().convertFromString(value, locale, null); } public String convertToString(Object value, Locale locale) { return getConvertor().convertToString(value, locale, null); } private static final String DATATYPE_EL = "datatype"; public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException { AttributesImpl attrs = new AttributesImpl(); attrs.addCDATAAttribute("type", getDescriptiveName()); contentHandler.startElement(FormsConstants.INSTANCE_NS, DATATYPE_EL, FormsConstants.INSTANCE_PREFIX_COLON + DATATYPE_EL, attrs); getConvertor().generateSaxFragment(contentHandler, locale); contentHandler.endElement(FormsConstants.INSTANCE_NS, DATATYPE_EL, FormsConstants.INSTANCE_PREFIX_COLON + DATATYPE_EL); } }
ff86ac24bf0a5409f26c27c97cee4e16f2517a95
36d818cbeda9fe07c3097e136beeaad33ab33cd9
/src/Design_Pattern/Implements/ConcreteProduct3.java
156baba8029658fbf3da7b1150973fc2d4945e7c
[]
no_license
XQLong/java_workplace
61a5cca83bc3da942779ececd1b871832d058d41
f8fd8a04c9a01f57a61efbd1e026fe6d83edd9b3
refs/heads/master
2020-03-28T19:23:16.464728
2019-10-22T02:35:37
2019-10-22T02:35:37
148,970,832
0
0
null
null
null
null
UTF-8
Java
false
false
192
java
package Design_Pattern.Implements; import Design_Pattern.Interface.Product; /** * @Author: xql * @Date: Created in 17:38 2019/7/10 */ public class ConcreteProduct3 implements Product { }
653e44fdd4108cef45f457ebf674618535c9656a
8a209eb061c755b8a09c2ab54158decc4213db8a
/src/main/java/com/luxoft/tradevalidator/repository/CCPairExceptionSpotTradeRepository.java
ed7ab037c536c872b20f5dd31c4f08d48e64bcab
[]
no_license
crafaelsouza/trade-validator
90fd070973acd254788b0ff337f9bd042db7143d
50295e1b8499ed1883bb4ec3774b4ab810f9500f
refs/heads/master
2020-03-27T02:14:13.282547
2018-08-28T15:03:38
2018-08-28T15:06:43
145,775,451
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package com.luxoft.tradevalidator.repository; import org.springframework.data.jpa.repository.JpaRepository; import com.luxoft.tradevalidator.domain.CCPairExceptionSpotTrade; public interface CCPairExceptionSpotTradeRepository extends JpaRepository<CCPairExceptionSpotTrade, Integer>{ }
ab4f0e6f1372d2424502a39e1664f38823a48255
a64fccb4ad2e2536d6d7959fcc8af27dcfe9f756
/src/main/java/com/example/demo/ProductoController.java
f6032f3641fe5abcae268b9beaffe08dbe49bbd5
[]
no_license
valenfv/gondola-rest-service
adfded1cf1ff0d008abe660b26237dc6cd7a617c
728b5b6874103a121910342a14a6701e713e9078
refs/heads/master
2020-09-16T06:18:37.422068
2019-11-26T15:57:38
2019-11-26T15:57:38
223,681,023
0
0
null
null
null
null
UTF-8
Java
false
false
1,098
java
package com.example.demo; import java.net.URISyntaxException; import java.util.ArrayList; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Example; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/productos") public class ProductoController { @Autowired private ProductoRepository pr; @RequestMapping("/") public String index() { return "index of Gondola"; } @RequestMapping("/barcode/{barCode}/lista/{lista}") public Producto get(@PathVariable String barCode, @PathVariable String lista) throws URISyntaxException{ return pr.findById(new ProductoId(barCode, lista)).orElse(null); } @PostMapping("/nuevo") public Producto nuevo(@RequestBody Producto nuevoProducto) { return pr.save(nuevoProducto); } }
d1bbb5df787a5ff13a7ab45ba6cc82957ba3df35
5ee3d519f28352139e79082e98dd67231fdc1aee
/src/main/java/com/nio/Marketing.java
91c9c1f37f67e6ef0f0e147ae9c7c347d1b9e829
[]
no_license
fruitfish/practice
305a684a24513c24af23820829e7aad494d19df9
bef0f8fa34a850443b67afcfe21f8a4d78321661
refs/heads/master
2022-06-16T06:19:18.959020
2020-08-26T14:53:54
2020-08-26T14:53:54
172,201,680
0
0
null
2022-06-10T19:57:14
2019-02-23T10:33:47
Java
UTF-8
Java
false
false
3,098
java
package com.nio; import java.nio.ByteBuffer; import java.nio.channels.GatheringByteChannel; import java.io.FileOutputStream; import java.util.Random; import java.util.List; import java.util.LinkedList; /** * Created by GanShu on 2018/12/10 0010. */ public class Marketing { private static final String DEMOGRAPHIC = "blahblah.txt"; // "Leverage frictionless methodologies" public static void main(String[] argv) throws Exception { int reps = 10; if (argv.length > 0) { reps = Integer.parseInt(argv[0]); } FileOutputStream fos = new FileOutputStream(DEMOGRAPHIC); GatheringByteChannel gatherChannel = fos.getChannel(); // Generate some brilliant marcom, er, repurposed content ByteBuffer[] bs = utterBS(reps); // Deliver the message to the waiting market while (gatherChannel.write(bs) > 0) { // Empty body // Loop until write( ) returns zero } System.out.println("Mindshare paradigms synergized to " + DEMOGRAPHIC); fos.close(); } // ------------------------------------------------ // These are just representative; add your own private static String[] col1 = { "Aggregate", "Enable", "Leverage", "Facilitate", "Synergize", "Repurpose", "Strategize", "Reinvent", "Harness" }; private static String[] col2 = { "cross-platform", "best-of-breed", "frictionless", "ubiquitous", "extensible", "compelling", "mission-critical", "collaborative", "integrated" }; private static String[] col3 = { "methodologies", "infomediaries", "platforms", "schemas", "mindshare", "paradigms", "functionalities", "web services", "infrastructures" }; private static String newline = System.getProperty("line.separator"); // The Marcom-atic 9000 private static ByteBuffer[] utterBS(int howMany) throws Exception { List list = new LinkedList(); for (int i = 0; i < howMany; i++) { list.add(pickRandom(col1, " ")); list.add(pickRandom(col2, " ")); list.add(pickRandom(col3, newline)); } ByteBuffer[] bufs = new ByteBuffer[list.size()]; list.toArray(bufs); return (bufs); } // The communications director private static Random rand = new Random(); // Pick one, make a buffer to hold it and the suffix, load it with // the byte equivalent of the strings (will not work properly for // non-Latin characters), then flip the loaded buffer so it's ready // to be drained private static ByteBuffer pickRandom(String[] strings, String suffix) throws Exception { String string = strings[rand.nextInt(strings.length)]; int total = string.length() + suffix.length(); ByteBuffer buf = ByteBuffer.allocate(total); buf.put(string.getBytes("US-ASCII")); buf.put(suffix.getBytes("US-ASCII")); buf.flip(); return (buf); } }
badcb80b3815a4d3976527a94830c60926d4dc7a
46b85208c7dfd1249ff5c2f263cdb0e742bff8da
/solon/src/main/java/org/noear/solon/core/util/IoUtil.java
5a5858fb379863415ff3b6f3cf9cccd3156ac31e
[ "Apache-2.0" ]
permissive
noear/solon
1c0a78c5ab2bec45a67fcf772f582f9cb4894fab
63f3f49cddcbfa8bd6d596998735f0704e8d43f8
refs/heads/master
2023-08-31T09:10:32.303640
2023-08-30T14:13:27
2023-08-30T14:13:27
140,086,420
1,687
187
Apache-2.0
2023-09-10T10:31:54
2018-07-07T13:23:50
Java
UTF-8
Java
false
false
2,625
java
package org.noear.solon.core.util; import org.noear.solon.Solon; import org.noear.solon.Utils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * 输入输出工具 * * @author noear * @since 2.4 */ public class IoUtil { public static String transferToString(InputStream ins) throws IOException { return transferToString(ins, Solon.encoding()); } /** * 将输入流转换为字符串 * * @param ins 输入流 * @param charset 字符集 */ public static String transferToString(InputStream ins, String charset) throws IOException { if (ins == null) { return null; } ByteArrayOutputStream outs = transferTo(ins, new ByteArrayOutputStream()); if (Utils.isEmpty(charset)) { return outs.toString(); } else { return outs.toString(charset); } } /** * 将输入流转换为byte数组 * * @param ins 输入流 */ public static byte[] transferToBytes(InputStream ins) throws IOException { if (ins == null) { return null; } return transferTo(ins, new ByteArrayOutputStream()).toByteArray(); } /** * 将输入流转换为输出流 * * @param ins 输入流 * @param out 输出流 */ public static <T extends OutputStream> T transferTo(InputStream ins, T out) throws IOException { if (ins == null || out == null) { return null; } int len = 0; byte[] buf = new byte[512]; while ((len = ins.read(buf)) != -1) { out.write(buf, 0, len); } return out; } /** * 将输入流转换为输出流 * * @param ins 输入流 * @param out 输出流 * @param start 开始位 * @param length 长度 */ public static <T extends OutputStream> T transferTo(InputStream ins, T out, long start, long length) throws IOException { int len = 0; byte[] buf = new byte[512]; int bufMax = buf.length; if (length < bufMax) { bufMax = (int) length; } if (start > 0) { ins.skip(start); } while ((len = ins.read(buf, 0, bufMax)) != -1) { out.write(buf, 0, len); length -= len; if (bufMax > length) { bufMax = (int) length; if (bufMax == 0) { break; } } } return out; } }
fea3efc31e29db7059e7c9d1bcb16d749afa2b66
e0538dd6c0498b08db57787352a3bdf4dedcdee9
/nsbaselibrary/src/test/java/com/red/dargon/nsbaselibrary/ExampleUnitTest.java
a0453f058c0ebe58d2d16ebb0fdddb3a00cd4677
[]
no_license
RedDargon/NSBaseProject
14b7275582169f23057b4fdb9f3a29e48f234edb
8d3fdcb33a0a4170a810e3e1efe4688f7564bdb0
refs/heads/master
2021-05-06T07:35:05.336743
2017-12-18T09:32:39
2017-12-18T09:32:39
113,954,843
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.red.dargon.nsbaselibrary; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
71adc535145f57e8692d5273f3df154a5d618fb6
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/validation/uk/gov/gchq/gaffer/sketches/datasketches/frequencies/serialisation/StringsSketchSerialiserTest.java
91211a5dd55846dd424bf57f4469f4d5e9a9d490
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,198
java
/** * Copyright 2017-2019 Crown Copyright * * 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 uk.gov.gchq.gaffer.sketches.datasketches.frequencies.serialisation; import com.yahoo.sketches.frequencies.ItemsSketch; import org.junit.Assert; import org.junit.Test; import uk.gov.gchq.gaffer.sketches.clearspring.cardinality.serialisation.ViaCalculatedValueSerialiserTest; public class StringsSketchSerialiserTest extends ViaCalculatedValueSerialiserTest<ItemsSketch<String>, Long> { @Test public void testCanHandleItemsSketch() { Assert.assertTrue(serialiser.canHandle(ItemsSketch.class)); Assert.assertFalse(serialiser.canHandle(String.class)); } }
4a64717220befe3459bb40bb6b2f53fa3cf91936
a7140a62a8d147d77e358191a85c03005ca10d64
/leetcode-algorithm/src/main/java/com/ly/string/Case27.java
2e3b4e98ac065c12a4d097a3588efc1cf2834fae
[]
no_license
tinyLuo/leetcode
1d49b9b6ecd2ccae9dd778af8583bf375b858ac0
814d71b8114227c3307fc77ee221973b3960545a
refs/heads/master
2020-04-19T08:39:31.151497
2019-04-15T13:57:40
2019-04-15T13:57:40
168,085,071
1
0
null
null
null
null
UTF-8
Java
false
false
418
java
package com.ly.string; public class Case27 { public static int removeElement(int[] nums, int val) { int i = 0; for (int j = 0; j < nums.length; j++) { if (nums[j] != val) { nums[i] = nums[j]; i++; } } return i; } public static void main(String[] args) { removeElement(new int[] { 3, 2, 2, 3 }, 3); } }
79c0346439a5aefecad5f9358ce4a31adfdcce81
bc3c96ec9312492b2f1784b106c5082f7cc2976c
/docroot/WEB-INF/service/com/lc/survey/NoSuchSurveyMainException.java
3ecc6981d7145d572a302d47cd5b638b1dbd7b74
[]
no_license
Whuzzup-design/LC-Survey
1c715438731a0a367640f88de1706122e138952b
b82a3913f89adce2a849c83fb0def331d2071b9c
refs/heads/master
2021-12-26T06:43:29.020753
2021-12-25T09:35:59
2021-12-25T09:35:59
240,186,947
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
/** * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.lc.survey; import com.liferay.portal.NoSuchModelException; /** * @author kevin */ public class NoSuchSurveyMainException extends NoSuchModelException { public NoSuchSurveyMainException() { super(); } public NoSuchSurveyMainException(String msg) { super(msg); } public NoSuchSurveyMainException(String msg, Throwable cause) { super(msg, cause); } public NoSuchSurveyMainException(Throwable cause) { super(cause); } }
a31827248748cad353b1913f895b923591efc515
1046433f0d315bf905fef6ab3d78dfa5ff0c77ef
/src/Test/wordcountinstring.java
086f20e1bf7e14cdaeff18ed9f697a70ca956b51
[]
no_license
varalakshmi2005/SeleniumPractise
f561315ae614889b5ef9f9c93f7b17a71c80063a
69f23f0ce5b4f455f697d1f7d1960142e9cd9e24
refs/heads/master
2023-03-05T03:41:11.500153
2021-02-21T14:29:31
2021-02-21T14:29:31
340,914,063
0
0
null
null
null
null
UTF-8
Java
false
false
426
java
package Test; import java.util.Scanner; public class wordcountinstring { public static void main(String[] args) { System.out.println("Enter the string"); Scanner src=new Scanner(System.in); String s=src.nextLine(); int count=1; for(int i=0;i<s.length()-1;i++) { if((s.charAt(i)==' ') && (s.charAt(i+1)!=' ')) { count++; } } System.out.println("Count the words :"+count); } }
9c4a06528801f7f04fe2d335cdeb5cffc5ef5083
588f7fbeda0bd597981bac6839c49c5299051b4a
/src/com/company/Main.java
5aa86aa4c57e73fe3b274220c4fd10be6e80ccb8
[]
no_license
UCGv2/StatesAndCapitalsMap-mthree-training
8419943a0fecaf5a27ccf6215b05a7bcdb144f61
313de41f3c574e107542798382cb286f8317fc70
refs/heads/main
2023-02-02T12:21:19.040294
2020-12-14T01:30:45
2020-12-14T01:30:45
321,199,465
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package com.company; import java.io.FileNotFoundException; import java.util.*; import java.io.File; public class Main { public static void main(String[] args) { Map<String, String> states = new HashMap<>(); populateMap(states); Set<String> skey = states.keySet(); System.out.println("States:"); System.out.println("======="); for(String s : skey){ System.out.println(s); } System.out.println(); System.out.println("Capitals:"); System.out.println("========="); for(String s : skey){ System.out.println(states.get(s)); } System.out.println(); System.out.println("States/Capital pairs:"); System.out.println("====================="); for(String s : skey){ System.out.println(s + " - " + states.get(s)); } } public static void populateMap(Map<String, String> map){ try { Scanner file = new Scanner(new File("Cities and Captials list.txt")); while(file.hasNextLine()){ String line = file.nextLine(); String[] thing = line.split(",", 3); map.put(thing[0],thing[1]); } file.close(); }catch(FileNotFoundException e){ System.out.println("Error"); e.printStackTrace(); } } }
6ebea153472a1f1f7dc3f6f6e443a3e411daf18f
b61123abafe1fc7a11770216fd133bd3e4620dbc
/sapint/src/com/sapint/BapiReturnCollection.java
e574aae0be88c39e30c898b0d6a5397ba1c0533b
[]
no_license
wwsheng009/sap-dev-workspace
cefb099cf6bc0c31400bdf0ff89bf3e14e9cf5d4
6392cbedcd4c6a48da5aa4ef8c1fb491bd3d2e3e
refs/heads/master
2023-03-07T07:59:01.157866
2013-05-12T03:03:12
2013-05-12T03:03:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
/** * */ package com.sapint; import java.util.ArrayList; /** * @author vincent * */ public class BapiReturnCollection extends ArrayList<BapiReturn> { @Override public BapiReturn get(int i){ return (BapiReturn) super.get(i); } // public boolean add(BapiReturn bapiReturn){ // return super.add(bapiReturn); // } }
7a37f6bed18527b753f84d057cedc2613bb08203
39ca712287c78ac6ae55887fe857318bf23ac9d7
/trunk/src/factory/ranger/view/VendorPanel.java
3280202cca7465884f76353e6e1344df5827c14e
[]
no_license
BGCX067/factory-ranger-svn-to-git
4415a52d3c3c6efa1d1a0fde5edaab223a0df6a2
b19a9160d974754d0b57c93a4a05fb8a8235bb80
refs/heads/master
2016-09-01T08:55:03.339705
2015-12-28T14:39:12
2015-12-28T14:39:12
48,871,930
0
0
null
null
null
null
UTF-8
Java
false
false
3,532
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package factory.ranger.view; import factory.ranger.model.ListVendor; import factory.ranger.model.Machine; import factory.ranger.model.Vendor; import factory.ranger.utility.Input; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Rectangle; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.ScrollPaneConstants; /** * * @author axioo */ public class VendorPanel extends JPanel{ public VendorPanel(){ } public String getString(Vendor vendor, int i){ String temp = ""; temp += "[vendor "+vendor.getName() +"]\n"; temp += " position\t\t: ("+vendor.getPosition().x+", "+vendor.getPosition().y+")\n"; temp += " available machines\t: "; Machine[] m = ListVendor.getSingleton().getListVendor().get(i).getListOfMachines(); for(int j=1; j<m.length; j++){ if(j<m.length-1) temp += vendor.getListOfMachines()[j].getNumber()+", "; else temp += vendor.getListOfMachines()[j].getNumber(); } temp += "\n"; return temp; } public JScrollPane getContent() throws IOException { Dimension d = new Dimension(570,360); JPanel panel = new JPanel(new GridBagLayout()); panel.setBounds(new Rectangle(d)); panel.setBackground(new Color(229, 224, 181)); //panel.setOpaque(false); GridBagConstraints gbc= new GridBagConstraints(); gbc.weightx = 1.0; gbc.gridx = 0; gbc.gridy = 0; gbc.anchor = GridBagConstraints.FIRST_LINE_START; //bottom of space for (int i=0;i<ListVendor.getSingleton().getListVendor().size();i++){ panel.add(getPanel(i, ListVendor.getSingleton().getListVendor().get(i)), gbc); gbc.gridy++; } return new JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED , ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); } private JPanel getPanel(int mesinke, Vendor vendor) throws IOException { JPanel panel = new JPanel(new GridBagLayout()); panel.setOpaque(false); GridBagConstraints gbc = new GridBagConstraints(); int x = 0; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 2; gbc.anchor = GridBagConstraints.FIRST_LINE_START; //bottom of space gbc.insets.set(15, 10, 0, 0); JTextArea no_machine = new JTextArea(); no_machine.setEditable(false); no_machine.setOpaque(false); no_machine.setFont(new Font("Trebuchet MS", 1, 18)); no_machine.setText(getString(vendor, mesinke)); no_machine.setLineWrap(true); no_machine.setBounds(new Rectangle(570, 350)); panel.add(no_machine, gbc); return panel; } public static void main(String[] args) throws IOException { JFrame f = new JFrame(); Input input = new Input("coba.txt"); VendorPanel vpanel = new VendorPanel(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(vpanel.getContent()); f.setSize(400,400); f.setLocation(200,200); f.setVisible(true); } }
59ab41a80148aad45ecf4a70bda5149f912b5dc9
87f1f9bf6dd18e2b605133bbfb859a021bc696d9
/hw06/src/main/java/hr/fer/zemris/java/hw06/shell/Environment.java
d2a5ddf5969ad04ea92aa230ac31ebc6fe962fa3
[]
no_license
staverm/Java-Course-FER-2020
0c9a52aaa1983ecd60d5fc8c5e2b0b9397f91289
a243242d2b5f1f87d556dcf401077bc5ffeed3c4
refs/heads/main
2023-01-04T01:48:02.744501
2020-10-28T17:55:06
2020-10-28T17:55:06
300,356,888
0
0
null
null
null
null
UTF-8
Java
false
false
2,251
java
package hr.fer.zemris.java.hw06.shell; import java.util.SortedMap; /** * Interface that represents the environment used for interaction with the user. * The environment serves as an intermediary for interaction between the user and * the program. * * @author Mauro Staver * */ public interface Environment { /** * Reads from Environment's input stream until a new line char is detected. * Returns a String with the read text. * * @return String - the read line * @throws ShellIOException if unable to read line from the stream */ String readLine() throws ShellIOException; /** * Writes the specified String to Environment's output stream. * * @param text String to write * @throws ShellIOException if unable to write to the stream */ void write(String text) throws ShellIOException; /** * Writes the specified String to Environment's output stream and adds a new * line char at the end. * * @param text String to write * @throws ShellIOException if unable to write to the stream */ void writeln(String text) throws ShellIOException; /** * Returns an unmodifiable map of all supported commands of MyShell. * Map keys are command names, and values are actual ShellCommand objects. * * @return unmodifiable map of all supported commands of MyShell. */ SortedMap<String, ShellCommand> commands(); /** * Returns the current MULTILINE symbol. * * @return the current MULTILINE symbol */ Character getMultilineSymbol(); /** * Sets the MULTILINE symbol to the specified symbol. * * @param symbol symbol to set the MULTILINE symbol */ void setMultilineSymbol(Character symbol); /** * Returns the current PROMPT symbol. * * @return the current PROMPT symbol */ Character getPromptSymbol(); /** * Sets the PROMPT symbol to the specified symbol. * * @param symbol symbol to set the PROMPT symbol */ void setPromptSymbol(Character symbol); /** * Returns the current MORELINES symbol. * * @return the current MORELINES symbol */ Character getMorelinesSymbol(); /** * Sets the MORELINES symbol to the specified symbol. * * @param symbol symbol to set the MORELINES symbol */ void setMorelinesSymbol(Character symbol); }
e390ae384cdefc69bc10db283288821c49291fb8
a0f280ce4a2aa529caf38539a82015c669e56280
/java project/src/Trees/NoOfNodes_BST.java
7389149a3f1bbd1d4b88ee89e5aa3ae7f4c1c494
[]
no_license
teja0404/hello-world
2eb0eb9475b5aa77fcce61b218f172a560339899
cc5b423bb720bdf5e167c100ab3189cd633ed3d3
refs/heads/master
2023-01-27T11:59:57.435661
2023-01-24T13:10:44
2023-01-24T13:10:44
128,071,714
0
0
null
2018-04-04T17:27:28
2018-04-04T14:10:45
null
UTF-8
Java
false
false
45
java
package Trees;public class NoOfNodes_BST { }
da2e50e71af41f52d0086af2a2157ba4e776ec1b
fd2aa5f7ec060ccee8bf42505cd900f82c16e1d7
/org-zorkclone/src/main/java/org/zorkclone/core/ActionParserHelper.java
c60cd3236831a3e50b5a5874ec7b9c5951e40cc4
[]
no_license
DbImko/ZorkClone
08df4703c0b7fc51a8851d8ebad0918a4b36e33c
acdb2d493fe91854498574f0451f48054c338c85
refs/heads/master
2020-05-20T06:56:18.315947
2013-05-15T16:38:53
2013-05-15T16:38:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,339
java
package org.zorkclone.core; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.zorkclone.core.model.ActionModel; import org.zorkclone.core.model.ActionType; public class ActionParserHelper { private static final String UPDATE_PATTERN = "Update (\\w*) to (\\w*)"; private static final String DELETE_PATTERN = "Delete (\\w*)"; private static final String ADD_PATTERN = "Add (\\w*) to (\\w*)"; public static ActionModel parse(String action) { if (action == null || action.isEmpty()) { return null; } Pattern pattern = Pattern.compile(UPDATE_PATTERN, Pattern.CASE_INSENSITIVE); Matcher m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.UPDATE); result.setItem(m.group(1)); result.setStatus(m.group(2)); return result; } pattern = Pattern.compile(DELETE_PATTERN, Pattern.CASE_INSENSITIVE); m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.DELETE); result.setItem(m.group(1)); return result; } pattern = Pattern.compile(ADD_PATTERN, Pattern.CASE_INSENSITIVE); m = pattern.matcher(action); if (m.find()) { ActionModel result = new ActionModel(ActionType.ADD); result.setItem(m.group(1)); result.setOwner(m.group(2)); return result; } return null; } }
97b3d3d003685f6cea1b1fcf703e78657b81e785
e4a38bb0be30d1eb86f86328bb89d53ff22eacce
/sensor-status/src/main/java/status/Splitter.java
6adf0d969a56789280c1119cf6b46dc5bc99a985
[]
no_license
ivishwa/sensor-status
a7d8c3be5dcc88b67c9f086d68c2b15e0f310dc0
9106886a4818fb2bbc13dc63026f75117ba429e4
refs/heads/master
2021-08-12T00:26:27.839047
2016-02-20T06:33:22
2016-02-20T06:33:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
868
java
package status; import cascading.operation.BaseOperation; import cascading.operation.Function; import cascading.operation.FunctionCall; import cascading.tuple.Tuple; import cascading.tuple.Fields; import cascading.flow.FlowProcess; import cascading.tuple.TupleEntry; public class Splitter extends BaseOperation implements Function{ public Splitter(Fields fieldDeclaration) { super(1,fieldDeclaration ); } public void operate( FlowProcess flowProcess, FunctionCall functionCall ) { // get the arguments TupleEntry TupleEntry arguments = functionCall.getArguments(); String[] tokens = arguments.getString(0).split(","); // create a Tuple to hold our result values Tuple result = new Tuple(); result.add(tokens[0]); result.add(tokens[1]); result.add(tokens[2]); // return the result Tuple functionCall.getOutputCollector().add( result ); } }
98c61f8ee54265e23002eace5f8357efe4ee8b0c
effac7ce1d4d943b6328b8ae4ae95d9a145ca751
/Teacher/app/src/main/java/com/example/psyyf2/dissertation/fragment/FragmentHomework.java
bf46b632c62b95b0795d55b20e973609f6e518bd
[]
no_license
Moiravan/Dissertation
ef469d7cb4990e4278f2973fa40ef1f8430d549d
75d798f06bba4c8443b22f154ce481e6cb304485
refs/heads/master
2020-04-21T10:54:33.342895
2019-02-07T01:19:13
2019-02-07T01:19:13
130,514,109
0
0
null
null
null
null
UTF-8
Java
false
false
6,841
java
package com.example.psyyf2.dissertation.fragment; import android.app.DatePickerDialog; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.text.InputType; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ListView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import com.example.psyyf2.dissertation.activity.HomeworkEdit; import com.example.psyyf2.dissertation.adapter.MyAdapterName; import com.example.psyyf2.dissertation.database.MyProviderContract; import com.example.psyyf2.dissertation.R; import java.util.Calendar; public class FragmentHomework extends Fragment { View inflate; private EditText date; String hDate; MyAdapterName dataAdapter; String status= ""; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { inflate = inflater.inflate(R.layout.activity_fragment_homework, null); Calendar c = Calendar.getInstance(); date = (EditText) inflate.findViewById(R.id.homedate1); date.setText(c.get(Calendar.YEAR) + "/" + (c.get(Calendar.MONTH) + 1) + "/" + c.get(Calendar.DAY_OF_MONTH)); date.setInputType(InputType.TYPE_NULL); //不显示系统输入键盘</span> hDate = date.getText().toString(); check(hDate, status); date.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (hasFocus) { showDatePickerDialog(); } } }); date.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub showDatePickerDialog(); } }); //use radio button to set limitations on listview RadioGroup radioGroup = (RadioGroup) inflate.findViewById(R.id.RadioGrade); final RadioButton all = (RadioButton) inflate.findViewById(R.id.buttonall1); final RadioButton release = (RadioButton) inflate.findViewById(R.id.buttonopen); final RadioButton notRelease = (RadioButton) inflate.findViewById(R.id.buttonclose); all.setChecked(true); radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if(checkedId == all.getId()) { status = ""; } else if (checkedId == release.getId()) { status ="" + "and" + " " + MyProviderContract.REA + "=" + "'" + "open" + "'" + " "; } else if (checkedId == notRelease.getId()) { status = "" + "and" + " " + MyProviderContract.REA + "=" + "'" + "close" + "'" + " "; } check(hDate, status); } }); return inflate; } public void check(String s, String statu) { String[] projection = new String[]{ MyProviderContract.Home_ID, MyProviderContract.C_ID, MyProviderContract.TITLE, MyProviderContract.DESCRIPTION, MyProviderContract.HDate, MyProviderContract.hGROUP, MyProviderContract.REA }; //display the information from database layout String colsToDisplay[] = new String[]{ MyProviderContract.Home_ID, MyProviderContract.TITLE, MyProviderContract.DESCRIPTION, MyProviderContract.hGROUP, MyProviderContract.C_ID, }; int[] colResIds = new int[]{ R.id.homeID, R.id.hometitle, R.id.homedescription, R.id.homegroup, R.id.obtainclassid1 }; Cursor cursor = FragmentHomework.this.getActivity().getContentResolver().query(MyProviderContract.Homework_URI, projection, MyProviderContract.HDate + "=" + "'" + s + "'" + " " + statu, null, null); //obtain context objection //set the class name dataAdapter = new MyAdapterName( this.getContext(), R.layout.db_homework_layout, cursor, colsToDisplay, colResIds, 0, "homework"); //load the listview and use setOnItemClickListener to manage each line ListView listView = (ListView) inflate.findViewById(R.id.homelist1); listView.setAdapter(dataAdapter); // dataAdapter.notifyDataSetChanged(); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> myAdapter, View myView, int myItemInt, long mylng) { Intent intent = new Intent(FragmentHomework.this.getContext(), HomeworkEdit.class); final String id = ((TextView) myView.findViewById(R.id.homeID)).getText().toString(); final String cid = ((TextView) myView.findViewById(R.id.obtainclassid1)).getText().toString(); final String groupname = ((TextView) myView.findViewById(R.id.homegroup)).getText().toString(); //get the text Bundle bundle = new Bundle(); bundle.putString("HID", id); bundle.putString("ID", cid); bundle.putString("GROUP", groupname); intent.putExtras(bundle); //send ID and Title to another activity startActivity(intent); } }); } private void showDatePickerDialog() { Calendar c = Calendar.getInstance(); new DatePickerDialog(FragmentHomework.this.getContext(), new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int month, int day) { // TODO Auto-generated method stub date.setText(year+"/"+(month+1)+ "/"+ day); hDate = year+"/"+(month+1)+ "/"+ day; check(hDate, status); } }, c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DAY_OF_MONTH)).show(); } }
cc496471de25baf162133435a6ab4bf7691f6ef8
df916e4d4bc27133d0913da30f5b1a308c45fd3c
/commonSources/src/message/RegisterAnswerMessage.java
a8f7cc428c35a9dcb8437e5aec8e3a5cb2c8cdef
[]
no_license
flisergio/CultureCenter
50a9df6fc83e3c23d8c94f4656f84263a6ef55a3
10f3a342f55160c82f42eccd3146d020da3ad2ff
refs/heads/master
2020-04-09T00:59:51.483871
2018-11-29T16:47:42
2018-11-29T16:47:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
549
java
package message; public class RegisterAnswerMessage extends Message { private static final long serialVersionUID = 577625073596981704L; private final boolean ok; private final int infoCode; public RegisterAnswerMessage(boolean ok) { this.ok = ok; this.infoCode = 0; } public RegisterAnswerMessage(boolean ok, int infoCode) { this.ok = ok; this.infoCode = infoCode; } public boolean isOk() { return ok; } public int getInfoCode() { return infoCode; } }
d28d82deb05bbd203d2943eebab51f76b340192f
1b6f94b3788b1592eaacbcf0ca474e1387ba98eb
/app/app/src/main/java/com/cppsystem/cppbus/util/OkhttpManager.java
28fd0b9d796d5222d2490a1166b0b42559b03cf9
[]
no_license
FandryNoutah/cpp-pay-tpe
09d294b4723b1979e1243a8f75a760975a98fbfe
43980787eea57fab18bd5b2f970f22db0ae1dadf
refs/heads/master
2023-07-01T10:36:38.289662
2021-08-03T11:07:21
2021-08-03T11:07:21
379,240,205
0
0
null
null
null
null
UTF-8
Java
false
false
4,882
java
/* * Copyright (c) 2021. * ******************************************************************************* * This software is full property of CPP-SYSTEM MADAGASCAR SARL * This project was initially developped by Andrinarivo Rakotozafinirina on 2020 * ************************************************************************************ */ package com.cppsystem.cppbus.util; import android.content.Context; import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.concurrent.TimeUnit; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import okhttp3.ConnectionPool; import okhttp3.OkHttpClient; import okhttp3.Protocol; public class OkhttpManager { static private OkhttpManager mOkhttpManager=null; private InputStream mTrustrCertificate; static public OkhttpManager getInstance() { if(mOkhttpManager==null) { mOkhttpManager=new OkhttpManager(); } return mOkhttpManager; } private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { try { KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream in = null; // By convention, 'null' creates an empty key store. keyStore.load(in, password); return keyStore; } catch (IOException e) { throw new AssertionError(e); } } private X509TrustManager trustManagerForCertificates(InputStream in) throws GeneralSecurityException { CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); Collection<? extends Certificate> certificates = certificateFactory.generateCertificates(in); if (certificates.isEmpty()) { throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } // Put the certificates a key store. char[] password = "password".toCharArray(); // Any password will work. KeyStore keyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { String certificateAlias = Integer.toString(index++); keyStore.setCertificateEntry(certificateAlias, certificate); } // Use it to build an X509 trust manager. KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); keyManagerFactory.init(keyStore, password); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); trustManagerFactory.init(keyStore); TrustManager[] trustManagers = trustManagerFactory.getTrustManagers(); if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) { throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers)); } return (X509TrustManager) trustManagers[0]; } public void setTrustrCertificates(InputStream in) { mTrustrCertificate=in; } public InputStream getTrustrCertificates() { return mTrustrCertificate; } public OkHttpClient.Builder build() { OkHttpClient.Builder okHttpClient=null; if(getTrustrCertificates()!=null) { X509TrustManager trustManager; SSLSocketFactory sslSocketFactory; try { trustManager = trustManagerForCertificates(getTrustrCertificates()); SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, new TrustManager[] { trustManager }, null); sslSocketFactory = sslContext.getSocketFactory(); } catch (GeneralSecurityException e) { throw new RuntimeException(e); } List<Protocol> listprotocol = new ArrayList<Protocol>(); listprotocol.add(Protocol.HTTP_1_1); okHttpClient = new OkHttpClient.Builder() .sslSocketFactory(sslSocketFactory, trustManager) .connectionPool(new ConnectionPool(0, 1, TimeUnit.NANOSECONDS)) // .retryOnConnectionFailure(false) .protocols(listprotocol); } else { okHttpClient = new OkHttpClient.Builder(); } return okHttpClient; } }
9b4c694d973613e83e507f334e625dd678ddefc0
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/transform/SoftwareTokenMFANotFoundExceptionUnmarshaller.java
c8a64529918e4a44b7f92a9e0b42b34f047ed44f
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,006
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.cognitoidp.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.cognitoidp.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * SoftwareTokenMFANotFoundException JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class SoftwareTokenMFANotFoundExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller { private SoftwareTokenMFANotFoundExceptionUnmarshaller() { super(com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException.class, "SoftwareTokenMFANotFoundException"); } @Override public com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception { com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException softwareTokenMFANotFoundException = new com.amazonaws.services.cognitoidp.model.SoftwareTokenMFANotFoundException( null); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return softwareTokenMFANotFoundException; } private static SoftwareTokenMFANotFoundExceptionUnmarshaller instance; public static SoftwareTokenMFANotFoundExceptionUnmarshaller getInstance() { if (instance == null) instance = new SoftwareTokenMFANotFoundExceptionUnmarshaller(); return instance; } }
[ "" ]
02eabb0269f54006c6b30c3974937413c3f8f409
c9ff26cd1055c64092b4fdefba860f8d4fb1ca82
/src/test/java/com/example/UndertowSSLDemo/UndertowSslDemoApplicationTests.java
11aa0ec21c45df8cc4e189bc9da9ad616758cc11
[]
no_license
JaxYoun/UndertowSSLDemo
607cd71b47d853095b562e215ae7425c4e82b426
98bfa31f3b440380de43322c6a1f0fbf066a476d
refs/heads/master
2021-04-27T03:57:36.965954
2019-07-31T03:59:38
2019-07-31T03:59:38
122,723,811
1
1
null
null
null
null
UTF-8
Java
false
false
353
java
package com.example.UndertowSSLDemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class UndertowSslDemoApplicationTests { @Test public void contextLoads() { } }
2ea70b854a34f965c43403bc4914abfed9c71039
6d0d0570086b285deeb29d44fd743f7bb189a73e
/src/com/willtaylor/Player.java
161eea597a1c7b16edaa7c91cdd6807b151473bb
[]
no_license
fire-at-will/Java_Snake
d6c4302c30084217e4391f3a66ef2172ec3bf572
c15b61f6818f09b7f61c67c9a6273aaf958911fd
refs/heads/master
2021-01-01T16:20:27.714682
2015-01-12T04:14:21
2015-01-12T04:14:21
29,115,701
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.willtaylor; import java.util.ArrayList; /** * Created by willtaylor on 9/5/14. */ public class Player { public Control control; public final int UP = 1; public final int DOWN = 0; public final int LEFT = 2; public final int RIGHT = 3; public volatile int direction = LEFT; public ArrayList<Integer> directions; public Player(Control control){ this.control = control; } }
83dc8a2b5042e85e380acc7f09348cc9c0c699c8
d8f33e3f86feba283790046dca3aac7fd205233d
/app/src/main/java/com/perawat/yacob/perawat/SessionLogin.java
4ccdaf3cf73d5b62f0f0e811bf6476bf3b092388
[]
no_license
yacob21/Perawat
cdc0ec2751133b9e359eb0b9e1881302f7762e0c
85a418e1dd405fc5223bbc16015f797f60464c1b
refs/heads/master
2020-03-25T04:54:19.813767
2018-08-03T11:30:39
2018-08-03T11:30:39
143,419,434
0
0
null
null
null
null
UTF-8
Java
false
false
3,737
java
package com.perawat.yacob.perawat; /** * Created by yacob on 12/10/2017. */ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import java.util.HashMap; public class SessionLogin { // Shared Preferences SharedPreferences pref; // Editor for Shared preferences SharedPreferences.Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "YacobPref"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String KEY_NIP = "nip"; public static final String KEY_KEPALA = "kepala"; public static final String KEY_SHIFT ="shift"; // Constructor public SessionLogin(Context context) { this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void createLoginSession(String nip,String kepala,String shift){ // Storing login value as TRUE editor.putBoolean(IS_LOGIN, true); // Storing name in pref editor.putString(KEY_NIP, nip); editor.putString(KEY_KEPALA, kepala); editor.putString(KEY_SHIFT, shift); // commit changes editor.commit(); } public void checkLogin() { // Check login status if (!this.isLoggedIn()) { // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public void checkLogin2() { // Check login status if (this.isLoggedIn()) { // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, HomeActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public HashMap<String, String> getUserDetails(){ HashMap<String, String> user = new HashMap<String, String>(); // user name user.put(KEY_NIP, pref.getString(KEY_NIP, null)); user.put(KEY_KEPALA, pref.getString(KEY_KEPALA, null)); user.put(KEY_SHIFT, pref.getString(KEY_SHIFT, null)); // return user return user; } public void logoutUser() { // Clearing all data from Shared Preferences editor.clear(); editor.commit(); // After logout redirect user to Loing Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } public void cleanUser() { // Clearing all data from Shared Preferences editor.clear(); editor.commit(); } public boolean isLoggedIn() { return pref.getBoolean(IS_LOGIN, false); } }
987eb08d623bec38d68e682d8263e00660dd1136
d27cee6ec3aa3f91d1905522b9e901f41daa68bd
/CarShowroom/src/com/practice/shop/client/CarShowroomApp.java
52de5d424d3ef03bdc84ad714e9b2137e5919751
[]
no_license
Chaitra-Reddy/caps
fbaa9495be4a832a84f0294a95bf6e69dfac63f5
fa052c36fab335bb47fd8119f17bab2543bac711
refs/heads/master
2023-04-03T13:35:43.959544
2021-04-05T03:24:47
2021-04-05T03:24:47
353,590,733
0
0
null
null
null
null
UTF-8
Java
false
false
9,246
java
package com.practice.shop.client; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Scanner; import java.util.Set; import com.practice.shop.entity.Car; import com.practice.shop.entity.Showroom; import com.practice.shop.exception.InvalidBrandException; import com.practice.shop.exception.InvalidIdException; public class CarShowroomApp { private static Scanner sc = new Scanner(System.in); private static List<Showroom> showrooms = new ArrayList<Showroom>(); public static void main(String[] args) { int choice = 0; //mock data***************************************** Set<Car> mockCars1 = new HashSet<Car>(); mockCars1.add(new Car(11, "car one", "maruti", 2022, 200000)); mockCars1.add(new Car(12, "car two", "hyundai", 2023, 200000)); mockCars1.add(new Car(13, "car three", "maruti", 2003, 200000)); Showroom s1 = new Showroom(1002, "sai motors", mockCars1); Set<Car> mockCars2 = new HashSet<Car>(); mockCars2.add(new Car(21, "car one", "maruti", 2013, 200000)); mockCars2.add(new Car(22, "car two", "hyundai", 2003, 200000)); mockCars2.add(new Car(23, "car three", "maruti", 2002, 200000)); Showroom s2 = new Showroom(1001, "krishna motors", mockCars2); showrooms.add(s1); showrooms.add(s2); //************************************************** do { System.out.println("\n\n-------------------WELCOME--------------------------"); System.out.println("Choose one from the options below:"); System.out.println("(1) Add showroom and cars."); System.out.println("(2) Search car by showroom name."); System.out.println("(3) Sort showroom by id and cars in it by model year."); System.out.println("(4) Add car to a existing showroom."); System.out.println("(5) Exit."); System.out.println("--------------------------------------------------"); choice = sc.nextInt(); switch(choice) { case 1: try { Showroom s = addShowroom(); displayShowroom(s); } catch(InvalidIdException e) { System.out.println("Duplicate ID is not allowed. Try again."); } catch(InvalidBrandException e) { System.out.println("Brand invalid. Only Maruti and Hyundai allowed. Try again."); } break; case 2: if(!showrooms.isEmpty()) { System.out.println("\nEnter showroom name: "); sc.nextLine(); String showroomName = sc.nextLine(); Set<Car> cars = searchCarByShowroomName(showroomName); if(cars == null) { System.out.println("\nNo cars found!"); } else { displayCar(cars); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 3: if(!showrooms.isEmpty()) { showrooms = sortShowrooms(showrooms); for(Showroom s:showrooms) { displayShowroom(s); System.out.println("\n--------------------------"); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 4: if(!showrooms.isEmpty()) { System.out.println("\nEnter the showroom ID you want to add a car to: "); int showroomId = sc.nextInt(); try { addCar(showroomId); } catch(InvalidIdException e) { System.out.println("Duplicate ID is not allowed. Try again."); } catch(InvalidBrandException e) { System.out.println("Brand invalid. Only Maruti and Hyundai allowed. Try again."); } } else { System.out.println("ERROR: No showrooms registered in the system."); } break; case 5: System.out.println("\nExited."); return; } } while(choice != 5); } //method to add showroom with cars public static Showroom addShowroom() throws InvalidIdException,InvalidBrandException { Set<Car> tempCars = new HashSet<Car>(); Set<Integer> carIds = new HashSet<Integer>(); System.out.println("\nEnter showroom ID:"); int tempShowroomId = sc.nextInt(); if(!showrooms.isEmpty()) { if(findShowroomById(tempShowroomId) != null) { throw new InvalidIdException(); } } System.out.println("\nEnter showroom name:"); sc.nextLine(); String tempShowroomName = sc.nextLine(); System.out.println("\nEnter number of cars you want to add:"); int noOfCars = sc.nextInt(); for(int i=0; i<noOfCars; i++) { System.out.println("\nCar " + (i+1) + " details----"); System.out.println("\nEnter car ID:"); int tempCarId = sc.nextInt(); if(!tempCars.isEmpty() && !carIds.isEmpty()) { if(carIds.contains(tempCarId)) { throw new InvalidIdException(); } } System.out.println("\nEnter car name:"); sc.nextLine(); String tempCarName = sc.nextLine(); System.out.println("\nEnter car brand:"); String tempCarBrand = sc.nextLine(); if(!checkBrand(tempCarBrand)) { throw new InvalidBrandException(); } System.out.println("\nEnter car model year:"); int tempCarYear = sc.nextInt(); System.out.println("\nEnter car price:"); double tempCarPrice = sc.nextDouble(); Car car = new Car(tempCarId,tempCarName,tempCarBrand,tempCarYear,tempCarPrice); carIds.add(tempCarId); tempCars.add(car); } Showroom s = new Showroom(tempShowroomId,tempShowroomName,tempCars); showrooms.add(s); return s; } //method to display a showroom public static void displayShowroom(Showroom s) { System.out.println("\nShowroom ID: " + s.getId()); System.out.println("\nShowroom name: " + s.getName()); Set<Car> cars = s.getCars(); System.out.println("\n==== Car Details ====="); for(Car c: cars) { System.out.println("\nCar ID: " + c.getId()); System.out.println("\nCar name: " + c.getName()); System.out.println("\nCar brand: " + c.getBrand()); System.out.println("\nCar model year: " + c.getModelYear()); System.out.println("\nCar price: $" + c.getPrice()); System.out.println("\n---------"); } } public static void displayCar(Set<Car> cars) { for(Car c: cars) { System.out.println("\nCar ID: " + c.getId()); System.out.println("\nCar name: " + c.getName()); System.out.println("\nCar brand: " + c.getBrand()); System.out.println("\nCar model year: " + c.getModelYear()); System.out.println("\nCar price: $" + c.getPrice()); System.out.println("\n---------"); } } //check if showroom id already exists public static Showroom findShowroomById(int id) { for(Showroom s:showrooms) { if(s.getId() == id) { return s; } } return null; } //check for brand validity public static boolean checkBrand(String brand) { brand = upperCase(brand); if(brand.equals("MARUTI") || brand.equals("HYUNDAI")) { return true; } return false; } //convert string to uppercase public static String upperCase(String s) { String res = ""; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) >= 'a' && s.charAt(i) <= 'z') { res += (char) ((int) s.charAt(i) - 32); } else { res += s.charAt(i); } } return res; } //========================================================================== public static Set<Car> searchCarByShowroomName(String showroomName) { for(Showroom s:showrooms) { if(upperCase(s.getName()).equals(upperCase(showroomName))) { return s.getCars(); } } return null; } //=========================================================================== //method to sort the showrooms based on ID and then the cars in it based on model year public static List<Showroom> sortShowrooms(List<Showroom> showrooms) { Collections.sort(showrooms); return showrooms; } //============================================================================ //add a car to an existing showroom public static void addCar(int showroomId) throws InvalidIdException, InvalidBrandException { if(findShowroomById(showroomId) != null) { Showroom s = findShowroomById(showroomId); int index = showrooms.indexOf(s); Set<Integer> carIds = new HashSet<Integer>(); for(Car c:s.getCars()) { carIds.add(c.getId()); } System.out.println("\nEnter car ID:"); int tempCarId = sc.nextInt(); if(!(s.getCars()).isEmpty() && carIds.contains(tempCarId)) { throw new InvalidIdException(); } System.out.println("\nEnter car name:"); sc.nextLine(); String tempCarName = sc.nextLine(); System.out.println("\nEnter car brand:"); String tempCarBrand = sc.nextLine(); if(!checkBrand(tempCarBrand)) { throw new InvalidBrandException(); } System.out.println("\nEnter car model year:"); int tempCarYear = sc.nextInt(); System.out.println("\nEnter car price:"); double tempCarPrice = sc.nextDouble(); Car car = new Car(tempCarId,tempCarName,tempCarBrand,tempCarYear,tempCarPrice); s.getCars().add(car); showrooms.set(index, s); for(Showroom s1:showrooms) { displayShowroom(s1); System.out.println("\n--------------------------"); } } else { System.out.println("\nSorry! No showroom found having the entered ID."); } } }
89060903d2e2757d0d745c6e5ac253a505bf6bc7
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/24/24_43c91dacd814b55542b120c2de94cab20f676716/StaticCallGraphBuilder/24_43c91dacd814b55542b120c2de94cab20f676716_StaticCallGraphBuilder_s.java
8451088e9c3d25cb395a61860d7d3b1babdff9fe
[]
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
6,044
java
package jkit.jil.stages; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.Stack; import jkit.jil.stages.NonNullInference.Location; import jkit.jil.tree.*; import jkit.util.*; import jkit.util.graph.*; /** * The purpose of this class is to build a static call graph. That is, a graph * whose edges represent potential calls between methods. More specifically, an * edge from method A to method B exists iff there is an invocation of method B * within method A. Observe that, since the construction process is static, the * edge will exist regardless of whether or not the method is ever be called (in * that context). * * @author djp * */ public class StaticCallGraphBuilder { public static class Node extends Triple<Type.Clazz, String, Type.Function> { public Node(Type.Clazz owner, String name, Type.Function type) { super(owner, name, type); } public Type.Clazz owner() { return first(); } public String name() { return second(); } public Type.Function type() { return third(); } public String toString() { return first() + "." + second() + ":" + type(); } } public static class Edge extends Pair<Node,Node> { public Edge(Node from, Node to) { super(from,to); } public Node from() { return first(); } public Node to() { return second(); } public String toString() { return first() + "->" + second(); } } /** * This represents the call graph. Each node in the call graph is identified * by a triple (O,N,T), where O=owner, N=name and T=type. */ private Graph<Node,Edge> callGraph = new DirectedAdjacencyList(); public void apply(JilClass owner) { // First, we identify all the problem cases. for (JilMethod method : owner.methods()) { build(method,owner); } } protected void build(JilMethod method, JilClass owner) { Node myNode = new Node(owner.type(), method.name(), method.type()); List<JilStmt> body = method.body(); // first, initialiser label map for(JilStmt s : body) { if(s instanceof JilExpr.Invoke) { addCallGraphEdges((JilExpr.Invoke)s, myNode); } } } protected void addCallGraphEdges(JilExpr expr, Node myNode) { if(expr instanceof JilExpr.ArrayIndex) { addCallGraphEdges((JilExpr.ArrayIndex) expr, myNode); } else if(expr instanceof JilExpr.BinOp) { addCallGraphEdges((JilExpr.BinOp) expr, myNode); } else if(expr instanceof JilExpr.UnOp) { addCallGraphEdges((JilExpr.UnOp) expr, myNode); } else if(expr instanceof JilExpr.Cast) { addCallGraphEdges((JilExpr.Cast) expr, myNode); } else if(expr instanceof JilExpr.Convert) { addCallGraphEdges((JilExpr.Convert) expr, myNode); } else if(expr instanceof JilExpr.ClassVariable) { addCallGraphEdges((JilExpr.ClassVariable) expr, myNode); } else if(expr instanceof JilExpr.Deref) { addCallGraphEdges((JilExpr.Deref) expr, myNode); } else if(expr instanceof JilExpr.Variable) { addCallGraphEdges((JilExpr.Variable) expr, myNode); } else if(expr instanceof JilExpr.InstanceOf) { addCallGraphEdges((JilExpr.InstanceOf) expr, myNode); } else if(expr instanceof JilExpr.Invoke) { addCallGraphEdges((JilExpr.Invoke) expr, myNode); } else if(expr instanceof JilExpr.New) { addCallGraphEdges((JilExpr.New) expr, myNode); } else if(expr instanceof JilExpr.Value) { addCallGraphEdges((JilExpr.Value) expr, myNode); } } public void addCallGraphEdges(JilExpr.ArrayIndex expr, Node myNode) { addCallGraphEdges(expr.target(), myNode); addCallGraphEdges(expr.index(), myNode); } public void addCallGraphEdges(JilExpr.BinOp expr, Node myNode) { addCallGraphEdges(expr.lhs(), myNode); addCallGraphEdges(expr.rhs(), myNode); } public void addCallGraphEdges(JilExpr.UnOp expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.Cast expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.Convert expr, Node myNode) { addCallGraphEdges(expr.expr(), myNode); } public void addCallGraphEdges(JilExpr.ClassVariable expr, Node myNode) { // do nothing! } public void addCallGraphEdges(JilExpr.Deref expr, Node myNode) { addCallGraphEdges(expr.target(), myNode); } public void addCallGraphEdges(JilExpr.Variable expr, Node myNode) { // do nothing! } public void addCallGraphEdges(JilExpr.InstanceOf expr, Node myNode) { addCallGraphEdges(expr.lhs(), myNode); } public void addCallGraphEdges(JilExpr.Invoke expr, Node myNode) { JilExpr target = expr.target(); addCallGraphEdges(target, myNode); for(JilExpr e : expr.parameters()) { addCallGraphEdges(e, myNode); } // Interesting issue here if target is not a class. Could be an array, // for example. Node targetNode = new Node((Type.Clazz) target.type(), expr.name(), expr.funType()); System.out.println("ADDING EDGE: " + myNode + "--> " + targetNode); // Add the call graph edge! callGraph.add(new Edge(myNode,targetNode)); } public void addCallGraphEdges(JilExpr.New expr, Node myNode) { for(JilExpr e : expr.parameters()) { addCallGraphEdges(e, myNode); } // Interesting issue here if target is not a class. Could be an array, // for example. Type.Clazz type = (Type.Clazz) expr.type(); Node targetNode = new Node(type, type.lastComponent().first(), expr .funType()); // Add the call graph edge! callGraph.add(new Edge(myNode,targetNode)); } public void addCallGraphEdges(JilExpr.Value expr, Node myNode) { if(expr instanceof JilExpr.Array) { JilExpr.Array ae = (JilExpr.Array) expr; for(JilExpr v : ae.values()) { addCallGraphEdges(v, myNode); } } } }
636a05daf5298b6c9daf299e2c74c17bf2d56b5d
2858f7086704d802143c5e1ab702300ee975b166
/src/pilha/Pilha.java
d8da63bd78574a126e065f6efc4ae89828dfc95f
[]
no_license
nandostaroski/pilha
66c98593ad435879989e13029168645b963279cd
16dde41c7f81596e3bbb3d5e2b800f79613d66a8
refs/heads/master
2021-01-21T15:44:31.037451
2017-05-19T23:59:22
2017-05-19T23:59:22
91,853,771
1
0
null
null
null
null
UTF-8
Java
false
false
179
java
package pilha; public interface Pilha { void push(Float v) throws Exception; Float pop() throws Exception; Float top(); boolean vazia(); void libera(); }
f0920586925b2fec5ad81cbcec10260e05ea5373
5b9bf2d5f6a281dd103e524f27048c468f840816
/src/test/java/com/crud/tasks/mapper/TrelloMapperTestSuite.java
4b73edf2d39941db8e7595900e5104c3490f49aa
[]
no_license
kdabrowski8712/kodilla-task-app
de9ebc421411c4331d86946b3c6170850181d2b9
a5abf011d1d4fd4847200ba23dc7cda1aebd72b5
refs/heads/master
2020-04-21T20:37:26.527107
2019-05-31T22:04:12
2019-05-31T22:04:12
169,851,669
0
0
null
null
null
null
UTF-8
Java
false
false
4,613
java
package com.crud.tasks.mapper; import com.crud.tasks.domain.*; import org.hibernate.validator.constraints.br.TituloEleitoral; import org.junit.Assert; import org.junit.Test; import java.util.ArrayList; import java.util.List; public class TrelloMapperTestSuite { @Test public void testMapToBoards() { //Given TrelloListDto list1 = new TrelloListDto("1", "testList1",false); TrelloListDto list2 = new TrelloListDto("2", "testList2",true); List<TrelloListDto> testTrelloList = new ArrayList<>(); testTrelloList.add(list1); testTrelloList.add(list2); TrelloBoardDto boardDto = new TrelloBoardDto("1","myboard1",testTrelloList); List<TrelloBoardDto> boardDtoList = new ArrayList<>(); boardDtoList.add(boardDto); TrelloMapper trelloMapper = new TrelloMapper(); //When List<TrelloBoard> result = trelloMapper.mapToBoards(boardDtoList); //Then Assert.assertEquals("1",result.get(0).getId()); Assert.assertEquals("myboard1",result.get(0).getName()); Assert.assertEquals("testList1",result.get(0).getLists().get(0).getName()); Assert.assertEquals(false,result.get(0).getLists().get(0).isClosed()); } @Test public void testMapToBoardsDto() { //Given List<TrelloList> testTrelloList = new ArrayList<>(); testTrelloList.add(new TrelloList("1", "testList1",false)); testTrelloList.add(new TrelloList("2", "testList2",true)); TrelloBoard board = new TrelloBoard("1","myboard1",testTrelloList); List<TrelloBoard> boardList = new ArrayList<>(); boardList.add(board); TrelloMapper trelloMapper = new TrelloMapper(); //When List<TrelloBoardDto> trelloBoardDtoList = trelloMapper.mapToBoardsDto(boardList); // Then Assert.assertEquals("1",trelloBoardDtoList.get(0).getId()); Assert.assertEquals("myboard1",trelloBoardDtoList.get(0).getName()); Assert.assertEquals("testList1",trelloBoardDtoList.get(0).getLists().get(0).getName()); Assert.assertEquals(false,trelloBoardDtoList.get(0).getLists().get(0).isClosed()); } @Test public void testMapToList() { //given List<TrelloListDto> trelloListDtos = new ArrayList<>(); trelloListDtos.add(new TrelloListDto("1", "testList1",false)); trelloListDtos.add(new TrelloListDto("2", "testList2",true)); TrelloMapper trelloMapper = new TrelloMapper(); //when List<TrelloList> trelloList = trelloMapper.mapToList(trelloListDtos); //then Assert.assertEquals("2",trelloList.get(1).getId()); Assert.assertEquals("testList2",trelloList.get(1).getName()); Assert.assertEquals(true, trelloList.get(1).isClosed()); } @Test public void testMapToListDto() { //given List<TrelloList> trelloList = new ArrayList<>(); trelloList.add(new TrelloList("1", "testList1",false)); trelloList.add(new TrelloList("2", "testList2",true)); TrelloMapper trelloMapper = new TrelloMapper(); //when List<TrelloListDto> trelloListDtos = trelloMapper.mapToListDto(trelloList); //then Assert.assertEquals("2",trelloListDtos.get(1).getId()); Assert.assertEquals("testList2",trelloListDtos.get(1).getName()); Assert.assertEquals(true, trelloListDtos.get(1).isClosed()); } @Test public void testMapToCardDto() { //given TrelloCard trelloCard = new TrelloCard("testCard","testDesc","top","1"); TrelloMapper trelloMapper = new TrelloMapper(); //when TrelloCardDto trelloCardDto = trelloMapper.mapToCardDto(trelloCard); //then Assert.assertEquals("1",trelloCardDto.getListId()); Assert.assertEquals("testCard",trelloCardDto.getName()); Assert.assertEquals("top",trelloCardDto.getPos()); Assert.assertEquals("testDesc",trelloCardDto.getDescription()); } @Test public void testMapToCard() { //given TrelloCardDto trelloCardDto = new TrelloCardDto("testCard","testDesc","top","1"); TrelloMapper trelloMapper = new TrelloMapper(); //when TrelloCard trelloCard = trelloMapper.mapToCard(trelloCardDto); //then Assert.assertEquals("1",trelloCard.getListId()); Assert.assertEquals("testCard",trelloCard.getName()); Assert.assertEquals("top",trelloCard.getPos()); Assert.assertEquals("testDesc",trelloCard.getDescription()); } }
d3b9aa5dc1fc33bcffb77cb1eae98bb3af6b22d5
225feb175edace5c25ab2ceb1323472613bb1de2
/app/src/main/java/com/liemi/seashellmallclient/widget/SpecsTagFlowLayout.java
4eadfe5d75f1ec33c458518a2479ea36a0912b9f
[]
no_license
xueyifei123/SeashellMallClient
33676bbaa7ae6cf19e5bab7ae2fac7821bf46ec6
ded24c6a54a290b591367ee7ec5168ea4977dac1
refs/heads/master
2022-11-18T15:09:58.916809
2020-07-09T05:10:47
2020-07-09T05:10:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,164
java
package com.liemi.seashellmallclient.widget; import android.content.Context; import android.content.res.TypedArray; import android.os.Bundle; import android.os.Parcelable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Log; import android.view.View; import com.liemi.seashellmallclient.ui.good.SpecsTagAdapter; import com.zhy.view.flowlayout.FlowLayout; import com.zhy.view.flowlayout.TagFlowLayout; import com.zhy.view.flowlayout.TagView; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * 类描述: * 创建人:Simple * 创建时间:2018/9/27 18:43 * 修改备注: */ public class SpecsTagFlowLayout extends FlowLayout implements SpecsTagAdapter.OnDataChangedListener { private SpecsTagAdapter mTagAdapter; private int mSelectedMax = -1;//-1为不限制数量 private static final String TAG = "TagFlowLayout"; private Set<Integer> mSelectedView = new HashSet<Integer>(); private TagFlowLayout.OnSelectListener mOnSelectListener; private TagFlowLayout.OnTagClickListener mOnTagClickListener; public interface OnSelectListener { void onSelected(Set<Integer> selectPosSet); } public interface OnTagClickListener { boolean onTagClick(View view, int position, FlowLayout parent); } public SpecsTagFlowLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray ta = context.obtainStyledAttributes(attrs, com.zhy.view.flowlayout.R.styleable.TagFlowLayout); mSelectedMax = ta.getInt(com.zhy.view.flowlayout.R.styleable.TagFlowLayout_max_select, -1); ta.recycle(); } public SpecsTagFlowLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public SpecsTagFlowLayout(Context context) { this(context, null); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int cCount = getChildCount(); for (int i = 0; i < cCount; i++) { TagView tagView = (TagView) getChildAt(i); if (tagView.getVisibility() == View.GONE) { continue; } if (tagView.getTagView().getVisibility() == View.GONE) { tagView.setVisibility(View.GONE); } } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } public void setOnSelectListener(TagFlowLayout.OnSelectListener onSelectListener) { mOnSelectListener = onSelectListener; } public void setOnTagClickListener(TagFlowLayout.OnTagClickListener onTagClickListener) { mOnTagClickListener = onTagClickListener; } public void setAdapter(SpecsTagAdapter adapter) { mTagAdapter = adapter; mTagAdapter.setOnDataChangedListener(this); mSelectedView.clear(); changeAdapter(); } @SuppressWarnings("ResourceType") private void changeAdapter() { removeAllViews(); SpecsTagAdapter adapter = mTagAdapter; TagView tagViewContainer = null; HashSet preCheckedList = mTagAdapter.getPreCheckedList(); for (int i = 0; i < adapter.getCount(); i++) { View tagView = adapter.getView(this, i, adapter.getItem(i)); tagViewContainer = new TagView(getContext()); tagView.setDuplicateParentStateEnabled(true); if (tagView.getLayoutParams() != null) { tagViewContainer.setLayoutParams(tagView.getLayoutParams()); } else { MarginLayoutParams lp = new MarginLayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); lp.setMargins(dip2px(getContext(), 5), dip2px(getContext(), 5), dip2px(getContext(), 5), dip2px(getContext(), 5)); tagViewContainer.setLayoutParams(lp); } LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); tagView.setLayoutParams(lp); tagViewContainer.addView(tagView); addView(tagViewContainer); if (preCheckedList.contains(i)) { setChildChecked(i, tagViewContainer); } if (mTagAdapter.setSelected(i, adapter.getItem(i))) { setChildChecked(i, tagViewContainer); preCheckedList.add(i); mSelectedView.add(i); } tagView.setClickable(false); final TagView finalTagViewContainer = tagViewContainer; final int position = i; tagViewContainer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (mOnTagClickListener != null) { //可以拦截点击,做自己的业务处理 if (!mOnTagClickListener.onTagClick(finalTagViewContainer, position, SpecsTagFlowLayout.this)) { doSelect(finalTagViewContainer, position); } } else { doSelect(finalTagViewContainer, position); } } }); } mSelectedView.addAll(preCheckedList); } public void setMaxSelectCount(int count) { if (mSelectedView.size() > count) { Log.w(TAG, "you has already select more than " + count + " views , so it will be clear ."); mSelectedView.clear(); } mSelectedMax = count; } public Set<Integer> getSelectedList() { return new HashSet<Integer>(mSelectedView); } private void setChildChecked(int position, TagView view) { view.setChecked(true); mTagAdapter.onSelected(position, view.getTagView()); } private void setChildUnChecked(int position, TagView view) { view.setChecked(false); mTagAdapter.unSelected(position, view.getTagView()); } private void doSelect(TagView child, int position) { if (!child.isChecked()) { //处理max_select=1的情况 if (mSelectedMax == 1 && mSelectedView.size() == 1) { Iterator<Integer> iterator = mSelectedView.iterator(); Integer preIndex = iterator.next(); TagView pre = (TagView) getChildAt(preIndex); setChildUnChecked(preIndex, pre); setChildChecked(position, child); mSelectedView.remove(preIndex); mSelectedView.add(position); } else { if (mSelectedMax > 0 && mSelectedView.size() >= mSelectedMax) { return; } setChildChecked(position, child); mSelectedView.add(position); } if (mOnSelectListener != null) { mOnSelectListener.onSelected(mSelectedView); } } //设置无法取消选择 else { setChildUnChecked(position, child); mSelectedView.remove(position); } } public SpecsTagAdapter getAdapter() { return mTagAdapter; } private static final String KEY_CHOOSE_POS = "key_choose_pos"; private static final String KEY_DEFAULT = "key_default"; @Override protected Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable(KEY_DEFAULT, super.onSaveInstanceState()); String selectPos = ""; if (mSelectedView.size() > 0) { for (int key : mSelectedView) { selectPos += key + "|"; } selectPos = selectPos.substring(0, selectPos.length() - 1); } bundle.putString(KEY_CHOOSE_POS, selectPos); return bundle; } @Override protected void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; String mSelectPos = bundle.getString(KEY_CHOOSE_POS); if (!TextUtils.isEmpty(mSelectPos)) { String[] split = mSelectPos.split("\\|"); for (String pos : split) { int index = Integer.parseInt(pos); mSelectedView.add(index); TagView tagView = (TagView) getChildAt(index); if (tagView != null) { setChildChecked(index, tagView); } } } super.onRestoreInstanceState(bundle.getParcelable(KEY_DEFAULT)); return; } super.onRestoreInstanceState(state); } @Override public void onChanged() { mSelectedView.clear(); changeAdapter(); } public static int dip2px(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (dpValue * scale + 0.5f); } }
e4bf647361625432ea7843f1037698114b9f1b0f
d079765b7de19f21f321ec8b87547bb219844ff1
/2p-plugin/tags/REL-2.6.0/alice.tuprologx.eclipse/src/alice/tuprologx/eclipse/properties/EnginesManagement.java
89309296792955d312759b349bb0a23a393ebd27
[]
no_license
wvelandia/tuprolog
40cb91543fc48a18ee0ef85a5dea2a1c16f29a82
d4f15df382412613a8255e78683b13ffb52ccc47
refs/heads/master
2021-01-10T01:53:13.599010
2015-04-17T18:40:45
2015-04-17T18:40:45
47,853,071
0
0
null
null
null
null
UTF-8
Java
false
false
17,842
java
package alice.tuprologx.eclipse.properties; import java.util.Vector; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.List; import org.eclipse.ui.dialogs.PropertyPage; import alice.tuprologx.eclipse.core.PrologEngine; import alice.tuprologx.eclipse.core.PrologEngineFactory; public class EnginesManagement extends PropertyPage { List listEngine = null; Group libraryGroup = null; Group scopeGroup = null; List listLibrary = null; Button[] theoriesButtons = null; String motoreScelto = ""; Button deleteEngine; Button renameEngine; Button loadEngine; Button loadLibrary; Button unloadLibrary; // Costruttore public EnginesManagement() { super(); } // Crea i componenti grafici e ne gestisce la visualizzazione protected Control createContents(final Composite parent) { final String name = ((IResource) getElement()).getName(); final Composite container = new Composite(parent, SWT.NULL); container.setLayout(new RowLayout(SWT.VERTICAL)); final Group engineGroup = new Group(container, SWT.NONE); engineGroup.setText("Engines"); engineGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); listEngine = new List(engineGroup, SWT.BORDER); final RowData rowData_1 = new RowData(); rowData_1.height = 120; rowData_1.width = 240; listEngine.setLayoutData(rowData_1); listEngine.setToolTipText("Loaded engines"); String[] items = new String[PrologEngineFactory.getInstance() .getProjectEngines(name).size()]; for (int j = 0; j < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); j++) { items[j] = PrologEngineFactory.getInstance().getEngine(name, j) .getName(); } listEngine.setItems(items); final Composite compositeEngine = new Composite(engineGroup, SWT.NONE); compositeEngine.setLayout(new GridLayout()); final RowData rowData_2 = new RowData(); rowData_2.width = 80; rowData_2.height = 100; compositeEngine.setLayoutData(rowData_2); listEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String[] selection = listEngine.getSelection(); if (selection.length != 0) { listLibrary.removeAll(); for (int j = 0; j < selection.length; j++) { motoreScelto = selection[j]; libraryGroup.setText("Libraries on: \"" + motoreScelto + "\""); listLibrary.setToolTipText("Loaded libraries on: \"" + motoreScelto + "\""); scopeGroup.setText("Default scope of: \"" + motoreScelto + "\""); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) { Vector<String> lib = PropertyManager .getLibrariesFromProperties( (IProject) getElement(), motoreScelto); String[] librerie = new String[lib.size()]; for (int k = 0; k < librerie.length; k++) { librerie[k] = (String) lib.elementAt(k); } listLibrary.setItems(librerie); } } } for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); Vector<String> theories = new Vector<String>(); try { IResource[] resources = ((IProject) getElement()) .members(); for (int j = 0; j < resources.length; j++) if ((resources[j] instanceof IFile) && (resources[j].getName().endsWith(".pl"))) theories.add(resources[j].getName()); } catch (CoreException e1) { } Vector<?> theoriesFromProperties = PropertyManager .getTheoriesFromProperties((IProject) getElement(), motoreScelto); for (int j = 0; j < theories.size(); j++) { theoriesButtons[j].setText(theories .elementAt(j)); if (PropertyManager.allTheories( (IProject) getElement(), motoreScelto)) theoriesButtons[j].setSelection(true); else for (int k = 0; k < theoriesFromProperties.size(); k++) if (((String) theoriesFromProperties .elementAt(k)).equals(theories .elementAt(j))) { theoriesButtons[j].setSelection(true); } } if (PrologEngineFactory.getInstance() .getProjectEngines(name).size() != 1) { deleteEngine.setEnabled(true); } else deleteEngine.setEnabled(false); loadLibrary.setEnabled(true); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(true); renameEngine.setEnabled(true); } } }); loadEngine = new Button(compositeEngine, SWT.NONE); loadEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String scelta = LoadEngine.show(null, "LoadEngine", (IProject) getElement(), listEngine.getItems()); if (scelta != null) { motoreScelto = ""; listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); listEngine.add(scelta); PrologEngine engine = PrologEngineFactory.getInstance() .addEngine(name, scelta); Vector<String> v = new Vector<String>(); PropertyManager.setLibrariesOnEngine(v, engine); PropertyManager.setLibraryInProperties( (IProject) getElement(), scelta, new String[0]); listEngine.deselectAll(); deleteEngine.setEnabled(false); renameEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); } } }); loadEngine .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); loadEngine.setToolTipText("Click to create new engine"); loadEngine.setText("Create"); deleteEngine = new Button(compositeEngine, SWT.NONE); deleteEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { motoreScelto = ""; String[] selection = listEngine.getSelection(); listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); for (int i = 0; i < selection.length; i++) { listEngine.remove(selection[i]); PrologEngineFactory.getInstance().deleteEngine(name, selection[i]); PropertyManager.deleteEngineInProperties( (IProject) getElement(), selection[i], listEngine.getItems()); } deleteEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); renameEngine.setEnabled(false); } }); deleteEngine.setEnabled(false); deleteEngine.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); deleteEngine.setToolTipText("Click to remove the selected engine"); deleteEngine.setText("Remove"); renameEngine = new Button(compositeEngine, SWT.NONE); renameEngine.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { InputDialog d = new InputDialog(null, "Rename Engine", "Engine name:", "", new EngineValidator(listEngine .getItems())); d.open(); String scelta = d.getValue(); if (scelta != null) { listLibrary.removeAll(); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setSelection(false); libraryGroup.setText("Libraries on: "); listLibrary.setToolTipText("Loaded libraries on: "); scopeGroup.setText("Default scope of: "); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) PrologEngineFactory.getInstance() .getEngine(name, i).rename(scelta); Vector<?> lib = PropertyManager.getLibrariesFromProperties( (IProject) getElement(), motoreScelto); String[] library = new String[lib.size()]; for (int i = 0; i < lib.size(); i++) library[i] = (String) lib.elementAt(i); Vector<?> theor = PropertyManager.getTheoriesFromProperties( (IProject) getElement(), motoreScelto); String[] theories = new String[theor.size()]; boolean all = false; if (PropertyManager.allTheories((IProject) getElement(), motoreScelto)) { all = true; } else { for (int i = 0; i < theor.size(); i++) { theories[i] = (String) theor.elementAt(i); } } listEngine.setItem(listEngine.getSelectionIndex(), scelta); PropertyManager.deleteEngineInProperties( (IProject) getElement(), motoreScelto, listEngine.getItems()); PropertyManager.setLibraryInProperties( (IProject) getElement(), scelta, library); if (all) PropertyManager.setTheoriesInProperty( (IProject) getElement(), scelta, null, true); else PropertyManager.setTheoriesInProperty( (IProject) getElement(), scelta, theories, false); listEngine.deselectAll(); deleteEngine.setEnabled(false); renameEngine.setEnabled(false); loadLibrary.setEnabled(false); unloadLibrary.setEnabled(false); for (int j = 0; j < theoriesButtons.length; j++) theoriesButtons[j].setEnabled(false); } } }); renameEngine.setEnabled(false); renameEngine.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); renameEngine.setToolTipText("Click to rename the selected engine"); renameEngine.setText("Rename"); libraryGroup = new Group(container, SWT.RIGHT); libraryGroup.setText("Libraries on: "); libraryGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); listLibrary = new List(libraryGroup, SWT.BORDER); final RowData rowData_3 = new RowData(); rowData_3.height = 120; rowData_3.width = 240; listLibrary.setLayoutData(rowData_3); listLibrary.setToolTipText("Loaded libraries on: "); listLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { if (listLibrary.getSelection().length != 0) unloadLibrary.setEnabled(true); } }); final Composite compositeLibrary = new Composite(libraryGroup, SWT.NONE); compositeLibrary.setLayout(new GridLayout()); final RowData rowData_4 = new RowData(); rowData_4.width = 80; rowData_4.height = 100; compositeLibrary.setLayoutData(rowData_4); loadLibrary = new Button(compositeLibrary, SWT.NONE); loadLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { InputDialog d = new InputDialog(null, "Load Library on \"" + motoreScelto + "\"", "Library:", "alice.tuprolog.lib.", new LibraryValidator(listLibrary .getItems())); d.open(); String scelta = d.getValue(); if (scelta != null) { Vector<String> r = new Vector<String>(); String[] t = listLibrary.getItems(); for (int i = 0; i < t.length; i++) { r.add(t[i]); } r.add(scelta); for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() .equals(motoreScelto)) { PropertyManager.setLibrariesOnEngine(r, PrologEngineFactory.getInstance() .getEngine(name, i)); listLibrary.add(scelta); PropertyManager.setLibraryInProperties( (IProject) getElement(), motoreScelto, listLibrary.getItems()); } } listLibrary.deselectAll(); } } }); loadLibrary.setEnabled(false); loadLibrary .setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); loadLibrary .setToolTipText("Click to load new library on the selected engine"); loadLibrary.setText("Load"); unloadLibrary = new Button(compositeLibrary, SWT.NONE); unloadLibrary.addMouseListener(new MouseAdapter() { public void mouseUp(final MouseEvent e) { String[] selection = listLibrary.getSelection(); if (selection.length != 0) { for (int i = 0; i < selection.length; i++) { listLibrary.remove(selection[i]); PropertyManager.setLibraryInProperties( (IProject) getElement(), motoreScelto, listLibrary.getItems()); } Vector<String> r = new Vector<String>(); String[] t = listLibrary.getItems(); for (int i = 0; i < t.length; i++) { r.add(t[i]); } for (int i = 0; i < PrologEngineFactory.getInstance() .getProjectEngines(name).size(); i++) { if (PrologEngineFactory.getInstance() .getEngine(name, i).getName() == motoreScelto) { PropertyManager.setLibrariesOnEngine(r, PrologEngineFactory.getInstance() .getEngine(name, i)); } } } } }); unloadLibrary.setEnabled(false); unloadLibrary.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); unloadLibrary .setToolTipText("Click to remove the selected library from the selected engine"); unloadLibrary.setText("Remove"); scopeGroup = new Group(container, SWT.NONE); scopeGroup.setText("Default scope of: "); scopeGroup.setLayout(new RowLayout(SWT.HORIZONTAL)); Vector<String> theories = new Vector<String>(); try { IResource[] resources = ((IProject) getElement()).members(); for (int j = 0; j < resources.length; j++) if ((resources[j] instanceof IFile) && (resources[j].getName().endsWith(".pl"))) theories.add(resources[j].getName()); } catch (CoreException e) { } theoriesButtons = new Button[theories.size()]; for (int j = 0; j < theories.size(); j++) { theoriesButtons[j] = new Button(scopeGroup, SWT.CHECK); theoriesButtons[j].setEnabled(false); theoriesButtons[j].addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { onCheckChanged((Button) e.widget); } private void onCheckChanged(Button button) { int size = 0; for (int i = 0; i < theoriesButtons.length; i++) if (theoriesButtons[i].getSelection()) size++; String[] theories = new String[size]; for (int i = 0; i < size; i++) { boolean match = false; for (int j = i; j < theoriesButtons.length && match == false; j++) { if (theoriesButtons[j].getSelection()) { match = true; theories[i] = theoriesButtons[j].getText(); } } } PropertyManager.setTheoriesInProperty( (IProject) getElement(), motoreScelto, theories, false); } }); theoriesButtons[j].setText(theories.elementAt(j)); } return container; } // Setta i valori di default quando il bottone "Apply default" viene premuto protected void performDefaults() { final String name = ((IResource) getElement()).getName(); for (int i = 0; i < listEngine.getItems().length; i++) { PrologEngineFactory.getInstance().deleteEngine(name, listEngine.getItem(i)); listEngine.remove(listEngine.getItem(i)); PropertyManager.deleteEngineInProperties((IProject) getElement(), listEngine.getItem(i), listEngine.getItems()); } PrologEngine engine = PrologEngineFactory.getInstance().insertEntry( name, "Engine1"); String[] libs = engine.getLibrary(); for (int i = 0; i < libs.length; i++) engine.removeLibrary(libs[i]); String[] libraries = new String[4]; libraries[0] = "alice.tuprolog.lib.BasicLibrary"; libraries[1] = "alice.tuprolog.lib.IOLibrary"; libraries[2] = "alice.tuprolog.lib.ISOLibrary"; libraries[3] = "alice.tuprolog.lib.JavaLibrary"; for (int i = 0; i < libraries.length; i++) engine.addLibrary(libraries[i]); PropertyManager.addEngineInProperty((IProject) getElement(), engine.getName()); PropertyManager.setLibraryInProperties((IProject) getElement(), engine.getName(), libraries); PropertyManager.setTheoriesInProperty((IProject) getElement(), engine.getName(), null, true); listEngine.removeAll(); listEngine.add("Engine1"); listLibrary.removeAll(); } // Metodo invocato quando il bottone "Ok" viene premuto public boolean performOk() { return true; } }
8eec9cc4ca1df947658efcc170b06989d88e8c91
175abdc876b6dc645a40b46f08b3c96f4f7bbabc
/lab4P2_MansourRumman/src/lab4p2_mansourrumman/phev.java
365cca2eaf161885b1c1719cc8d9283e54e9a86f
[]
no_license
MansourRumman/lab4p2_masourrumman
f5b978334474b34edb50b9f8e0aa6c38169f33d6
e0b5c3ea0b52638e934af8b7a8efedf137c253ac
refs/heads/main
2023-07-11T09:10:02.223929
2021-08-13T23:29:29
2021-08-13T23:29:29
395,826,919
0
0
null
null
null
null
UTF-8
Java
false
false
1,620
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 lab4p2_mansourrumman; /** * * @author manso */ public class phev extends carros{ private String tipo; private int cank, cmotores, cremol; public phev() { super(); } public phev(String tipo, int cank, int cmotores, int cremol, String modelo, String caseria, int VIN, int cantp, int capm) { super(modelo, caseria, VIN, cantp, capm); this.tipo = tipo; this.cank = cank; this.cmotores = cmotores; this.cremol = cremol; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public int getCank() { return cank; } public void setCank(int cank) { this.cank = cank; } public int getCmotores() { return cmotores; } public void setCmotores(int cmotores) { this.cmotores = cmotores; } public int getCremol() { return cremol; } public void setCremol(int cremol) { this.cremol = cremol; } @Override public String toString() { return "phev{" + "es de 4x4=" + tipo + ", cank=" + cank + ", cmotores=" + cmotores + ", cremol=" + cremol + '}'; } public int calc()throws excepcion{ int x= 2021-((super.getCantp())*cmotores)+(cank/cremol); if(x>30){ throw new excepcion(" se desgasta muy rapido"); } return x; } }
100b14f897dbdd81b61fdd046c9bc948a532a3ab
8e58b6359623231f513b044d96d724e6a498153b
/src/main/java/rosa/isabelle/inventorycontrol/dto/StockItemDTO.java
220bfc6dd2cc6f2431b4dece14abc11d1f8bcf53
[]
no_license
isabellerosa/controle-estoque-api
a6d388ef7bf8c89dc4f1e2574e5e5f32bf671cb8
dec93bbb175e676a578707b62e45d3b62390fb77
refs/heads/master
2020-09-09T19:31:49.127205
2019-11-16T04:53:50
2019-11-16T04:53:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package rosa.isabelle.inventorycontrol.dto; import lombok.Data; @Data public class StockItemDTO { private ItemDTO item; private StoreDTO store; private int quantity; }
1589012de0f8802b57f928e2d6019416b86bdedf
10d3c5cb42595fe0356cfe9cb76f26fc05855b26
/src/com/sanluan/cms/admin/views/controller/system/SystemUserController.java
4c75ddff48db22a98563503b413a437cac5c7006
[ "BSD-2-Clause" ]
permissive
lcaminy/PublicCMS
ee0d7ccf4ababc6c09ba4cbe4c09115460144437
d8c6789ce8ef1c539b98b9cdc55fe4e81ff15a43
refs/heads/master
2021-01-23T02:15:39.901913
2015-05-14T08:35:21
2015-05-14T08:35:21
35,600,850
0
1
null
2015-05-14T08:41:51
2015-05-14T08:41:51
null
UTF-8
Java
false
false
1,762
java
package com.sanluan.cms.admin.views.controller.system; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.sanluan.cms.common.tools.UserUtils; import com.sanluan.cms.entities.system.SystemUser; import com.sanluan.cms.logic.service.system.SystemUserService; import com.sanluan.common.base.BaseController; /** * @author zhangxd * */ @Controller @RequestMapping("systemuser") public class SystemUserController extends BaseController { @Autowired private SystemUserService service; @RequestMapping(value = { "enable" + DO_SUFFIX }, method = RequestMethod.POST) public String enable(HttpServletRequest request, Integer id, String repassword, ModelMap model) { if (virifyEquals("admin.operate", UserUtils.getAdminFromSession(request), id, model)) { return "common/ajaxError"; } service.updateStatus(id, false); return "common/ajaxDone"; } @RequestMapping(value = { "disable" + DO_SUFFIX }, method = RequestMethod.POST) public String disable(HttpServletRequest request, Integer id, String repassword, ModelMap model) { if (virifyEquals("admin.operate", UserUtils.getAdminFromSession(request), id, model)) { return "common/ajaxError"; } service.updateStatus(id, true); return "common/ajaxDone"; } protected boolean virifyEquals(String field, SystemUser user, Integer value2, ModelMap model) { if (null != user && user.getId().equals(value2)) { model.addAttribute(ERROR, "verify.equals." + field); return true; } return false; } }
7016a4887fc36658234b3361b8baf923f7b20d77
b96a40c236f0f829b341786e9dd03d81f0e05439
/src/MainApp.java
256322bc7cd3fdcb189038ab54648c7db0f5f551
[]
no_license
iwonder001/PlusTwo
cca1ca8bc38275ad2e380d0d882417df7c745e58
0841ce42d80aeb2ba3103cb6048ee852470426c7
refs/heads/master
2021-01-13T14:38:37.505638
2016-09-21T15:28:37
2016-09-21T15:28:37
68,821,059
0
0
null
null
null
null
UTF-8
Java
false
false
797
java
import java.util.Arrays; public class MainApp { public static void main(String[] args) { // make two arrays into one int[] test = { 1, 2 }; int[] test2 = { 3, 4 }; int[] trying = plusTwo(test, test2); System.out.println(Arrays.toString(trying)); }// main method // {1,2} and {3,4} are a fixed length and cannot be expanded or changed. So need to make a new array with length 4. public static int[] plusTwo(int[] a, int[] b) { // get first set of arrays int first1 = a[0]; int first2 = a[1]; // get last set of arrays int last1 = b[0]; int last2 = b[1]; // add together into a 4 array int[] together = { first1, first2, last1, last2 }; // for(int num:together) { // System.out.println(num); // } return together; }// plusTwo method close }// class
86c42242f0a5198350a3881680fc8cc8c3f04d3c
336a92f3c98b0c5f76f9c9c208e1fcbe1a9c9166
/MyLMSSpring/src/main/java/com/gcit/training/lms/dao/Book_copiesDAO.java
5a61260d87fde67c0e77b47d96371a4e857f9883
[]
no_license
MerwanMajid/training
78e5f8bb99179d0520c0fdf793b3775266f6b163
36778a474da76f8550b9999003d0fde46bdf7d08
refs/heads/master
2021-01-10T16:20:24.578034
2015-06-01T18:08:49
2015-06-01T18:08:49
36,037,003
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package com.gcit.training.lms.dao; import java.io.Serializable; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.jdbc.core.ResultSetExtractor; import com.gcit.training.lms.entity.*; public class Book_copiesDAO extends BaseDAO<List<Book_copies>> implements Serializable,ResultSetExtractor<List<Book_copies>>{ /** * */ private static final long serialVersionUID = 1L; public void addBook_copies(Book_copies book_copies) throws Exception { template.update("insert into tbl_book_copies (bookId,branchId,noOfCopies) values (?,?,?)", new Object[] { book_copies.getBook().getBookId(),book_copies.getBranch().getBranchId(),book_copies.getNoOfCopies() }); } public void update(Book_copies book_copies) throws Exception { int bookId = book_copies.getBook().getBookId(); int branchId = book_copies.getBranch().getBranchId(); int noOfCopies = book_copies.getNoOfCopies(); template.update("update tbl_book_copies set noOfCopies = ? where bookId = ? and branchId = ?", new Object[] {noOfCopies,bookId,branchId}); } public void delete(Book_copies book_copies) throws Exception { template.update("delete from tbl_book_copies where bookId = ? and branchId = ?", new Object[] { book_copies.getBook().getBookId(),book_copies.getBranch().getBranchId()}); } public List<Book_copies> readAll() throws Exception { return (List<Book_copies>) template.query("select * from tbl_book_copies", this); } public Book_copies readOne(int bookId,int branchId) throws Exception { List<Book_copies> list = (List<Book_copies>) template.query( "select * from tbl_book_copies where bookId = ? and branchId = ?", new Object[] { bookId, branchId },this); if (list != null && list.size() > 0) { //System.out.println(list.get(0).getBook().getBookId()); return list.get(0); } else { return null; } } @Override public List<Book_copies> extractData(ResultSet rs) throws SQLException { List<Book_copies> list = new ArrayList<Book_copies>(); while (rs.next()) { Book_copies a = new Book_copies(); a.setBook(new Book()); a.setBranch(new Branch()); a.getBook().setBookId(rs.getInt("bookId")); a.getBranch().setBranchId(rs.getInt("branchId")); a.setNoOfCopies(rs.getInt("noOfCopies")); list.add(a); } return list; } }
[ "HappyGuy@HappyGuy-PC" ]
HappyGuy@HappyGuy-PC
f33f563541f2944a4ad56aae17aac7c25357ea97
0cb4d62c207ab9de172a60445b9c23b1b1d4abf1
/src/main/java/com/bookshop01/cscenter/vo/Criteria.java
a64e82e1edb70aa1589cd7fc52b398249a7ad6c1
[]
no_license
fks0513/cinebox
6375566148681350c4c4790520e79d7d59b91d3e
f002a9d98e359179fb56842630f6ab67f7a10329
refs/heads/master
2023-06-27T02:04:37.188019
2021-07-31T02:46:39
2021-07-31T02:46:39
null
0
0
null
null
null
null
UHC
Java
false
false
1,192
java
package com.bookshop01.cscenter.vo; public class Criteria { private int page; //현재 페이지 번호 private int perPageNum; //한 페이지에 출력할 개수 private int rowStart; //시작페이지 번호 private int rowEnd; //끝페이지 번호. 시작페이지번호에서 몇개 보여줄지 결정 public Criteria() { this.page = 1; this.perPageNum = 10; } public void setPage(int page) { if (page <= 0) { this.page = 1; return; } this.page = page; } public void setPerPageNum(int perPageNum) { if (perPageNum <= 0 || perPageNum > 100) { this.perPageNum = 10; return; } this.perPageNum = perPageNum; } public int getPage() { return page; } public int getPageStart() { return (this.page - 1) * perPageNum; } public int getPerPageNum() { return this.perPageNum; } public int getRowStart() { rowStart = ((page - 1) * perPageNum) + 1; return rowStart; } public int getRowEnd() { rowEnd = rowStart + perPageNum - 1; return rowEnd; } @Override public String toString() { return "Criteria [page=" + page + ", perPageNum=" + perPageNum + ", rowStart=" + rowStart + ", rowEnd=" + rowEnd + "]"; } }
f158bfa009df01fdf481d8dfa876d66a51c9a1c7
c4a5ce8d1dfce033ae06468b54c37862ca8b60ec
/NUMAD13-DanKreymer/src/edu/neu/madcourse/dankreymer/multiplayer/DabbleMHighScores.java
79f37d07bef421c0e2ba0ff8912caa84767141a5
[]
no_license
Rubyj/NUMAD-ReubenJacobs
e4464eda0167467e9f234f802521c5cfe995ecc0
423448c5b40fc967f56c38ae2c43213bd130ff3d
refs/heads/master
2021-09-05T19:42:09.014315
2016-07-01T17:45:35
2016-07-01T17:45:35
119,562,505
0
0
null
null
null
null
UTF-8
Java
false
false
1,837
java
package edu.neu.madcourse.dankreymer.multiplayer; import android.app.Activity; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import edu.neu.madcourse.dankreymer.R; import edu.neu.madcourse.dankreymer.keys.Keys; import edu.neu.madcourse.dankreymer.keys.ServerError; import edu.neu.mhealth.api.KeyValueAPI; public class DabbleMHighScores extends Activity implements OnClickListener{ private static String highScores = ""; private static final String NO_SCORES = "No Scores Reported"; private TextView text; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dabble_high_scores); text = (TextView)findViewById(R.id.dabble_high_scores); new HighScoreTask().execute(); View instructionsButon = findViewById(R.id.dabble_back_button); instructionsButon.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.dabble_back_button: finish(); break; } } private String parseScores(String string) { if (string.equals(ServerError.NO_CONNECTION.getText()) || string.equals(ServerError.NO_SUCH_KEY.getText())) { string = NO_SCORES; } else { string = string.replace(";", "\n"); } return string; } private class HighScoreTask extends AsyncTask<String, String, String> { @Override protected void onPostExecute(String result) { highScores = parseScores(result); if (highScores == "") { text.setText(NO_SCORES); } else { text.setText(highScores); } text.invalidate(); } @Override protected String doInBackground(String... parameter) { return Keys.get(Keys.HIGHSCORES); } } }
70acf36618dd3d372ec2f45cf05f8ef675cdb47e
ec246206025220b4552ae9a069863dc66139835c
/src/main/java/psi/domain/user/entity/User.java
70df2f16eecf4e0fd857ae6aaea3673f34f58fef
[]
no_license
JaroslawPokropinski/PSI-TWWO
1cd000f04cb883d56f96475c9d03cfc5f1db9521
13d84e454f2d51e7edb07b8172ba85e65d35147c
refs/heads/main
2023-02-26T07:03:44.021768
2021-01-29T07:59:41
2021-01-29T07:59:41
306,083,151
0
0
null
2021-01-28T12:31:38
2020-10-21T16:25:02
Java
UTF-8
Java
false
false
2,764
java
package psi.domain.user.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.Loader; import org.hibernate.annotations.NaturalIdCache; import org.hibernate.annotations.Where; import org.hibernate.envers.Audited; import psi.domain.auditedobject.entity.AuditedObject; import javax.persistence.Cacheable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.Objects; import static psi.infrastructure.jpa.CacheRegions.USER_ENTITY_CACHE; import static psi.infrastructure.jpa.CacheRegions.USER_NATURAL_ID_CACHE; import static psi.infrastructure.jpa.PersistenceConstants.ID_GENERATOR; @Entity @Table(name = "USER") @AllArgsConstructor @NoArgsConstructor @Getter @SuperBuilder @Cacheable @Audited @Loader(namedQuery = "findUserById") @NamedQuery(name = "findUserById", query = "SELECT u FROM User u WHERE u.id = ?1 AND u.objectState <> psi.domain.auditedobject.entity.ObjectState.REMOVED") @Where(clause = AuditedObject.IS_NOT_REMOVED_OBJECT) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = USER_ENTITY_CACHE) @NaturalIdCache(region = USER_NATURAL_ID_CACHE) public class User extends AuditedObject { @Id @GeneratedValue(generator = ID_GENERATOR) private Long id; @NotBlank @Size(max = 40) private String name; @NotBlank @Size(max = 40) private String surname; @NotBlank @Size(max = 40) private String username; @NotBlank @Size(max = 100) private String password; @Email @NotBlank @Size(max = 40) @Column(unique = true) private String email; @NotBlank private String phoneNumber; @Enumerated(EnumType.STRING) private UserRole role; public void setPassword(String password) { this.password = password; } public void setRole(UserRole role) { this.role = role; } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof User)) { return false; } User otherUser = (User) obj; return Objects.equals(otherUser.id, id); } @Override public int hashCode() { return Objects.hash(id); } }
06651adbc3fab56b81df847977405a82e742da13
464c329607720a410221a237198f8de4b7cc8e53
/src/lecture/controller/LectureUpdateFormServlet.java
4223fc4b294ae688de782fd944c8c382d43ad1fd
[]
no_license
GwakHuisu/eightedu
42595fcb965a20695dc755100902c5b7999b660e
93ac83e25583cc1e72b55964dec21ae0c4061fd4
refs/heads/master
2021-03-02T06:39:23.207142
2020-03-08T18:20:23
2020-03-08T18:20:23
245,843,983
0
0
null
null
null
null
UTF-8
Java
false
false
1,723
java
package lecture.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lecture.model.service.LectureService; import lecture.model.vo.Lecture; /** * Servlet implementation class LectureUpdateFormServlet */ @WebServlet("/updateForm.le") public class LectureUpdateFormServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LectureUpdateFormServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int l_code = Integer.parseInt(request.getParameter("l_code")); Lecture lecture = new LectureService().selectLecture(l_code); String page = ""; if(lecture != null) { request.setAttribute("lecture", lecture); page = "views/lectureAttendPage/lectureUpdateForm.jsp"; }else { request.setAttribute("msg", "강좌등록 조회에 실패하였습니다."); page = "views/common/error.jsp"; } request.getRequestDispatcher(page).forward(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
94216864c118d12f112e1b29b8ec531936b61d9c
575acf52715b95f86a10b4e3c1b354c5cc34248b
/src/test/java/org/demo/data/record/SynopsisRecordTest.java
4339141f11c924e8ae4e96cd68eddbfa2f362d05
[]
no_license
t-soumbou/persistence-with-mongoDB
52a21b507551365f9f88e5adf2b6dd58f9b8ff62
67bfe4425cfe46360606390541b95007952658b0
refs/heads/master
2020-05-21T05:03:53.502360
2017-03-22T16:37:22
2017-03-22T16:37:22
84,574,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,349
java
/* * Created on 2017-03-22 ( Date ISO 2017-03-22 - Time 17:28:47 ) * Generated by Telosys ( http://www.telosys.org/ ) version 3.0.0 */ package org.demo.data.record; import org.junit.Assert; import org.junit.Test; import java.util.logging.*; /** * JUnit test case for bean SynopsisRecord * * @author Telosys Tools Generator * */ public class SynopsisRecordTest { private static final Logger LOGGER = Logger.getLogger(SynopsisRecordTest.class.getName()); @Test public void testSettersAndGetters() { LOGGER.info("Checking class SynopsisRecord getters and setters ..." ); SynopsisRecord synopsisRecord = new SynopsisRecord(); //--- Test setter/getter for attribute "bookId" ( model type : Integer / wrapperType : Integer ) synopsisRecord.setBookId( Integer.valueOf(100) ) ; Assert.assertEquals( Integer.valueOf(100), synopsisRecord.getBookId() ) ; // Not primitive type in model //--- Test setter/getter for attribute "synopsis" ( model type : String / wrapperType : String ) synopsisRecord.setSynopsis( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ) ; Assert.assertEquals( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", synopsisRecord.getSynopsis() ) ; // Not primitive type in model } }
3ec31f2afc75f8fe3ea3f28da4a0d0eccf264689
c1de27c2d97b3587c40ba89eb1539c4bd767598e
/build/project/src/capitals/FXMLAnswerController.java
a54100c3e1a96678531f16d8f05eabd96cae5231
[ "MIT" ]
permissive
n-eq/CapitalsFX
d39a0e961b3ada2df3ca8b8e860c396e66a65b9d
a1aa3d74112117118b19b215c95416eef34d5210
refs/heads/master
2021-06-13T18:04:26.266272
2017-04-22T12:06:32
2017-04-22T12:06:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,622
java
package capitals; import capitals.data.FactReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.geometry.Insets; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.scene.layout.AnchorPane; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.FontSmoothingType; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class FXMLAnswerController implements Initializable { @FXML private Button playAgainButton; @FXML private Button exitButton; @FXML private Text resultStatement; @FXML private VBox factBox; @FXML private ImageView flag; @FXML private AnchorPane pane; private String[] greetings = {"Well done!", "Good job!", "Nice!", "Correct!", "Nice one!", "Awesome!", "Here you go!", "You rock!"}; private String[] consolations = {"What a pity!", "Wrong answer!", "False,", "Try again,", "Nope,"}; @FXML private void exit(ActionEvent e) { Stage stage = (Stage) exitButton.getScene().getWindow(); stage.close(); } @FXML private void restart(ActionEvent event) throws IOException { FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml")); Parent parent = loader.load(); Scene scene = new Scene(parent); FXMLController controller = (FXMLController)loader.getController(); String countryNameChosen = Country.getCountry().getCountryName(); controller.build(countryNameChosen); Stage appStage = (Stage) ((Node) event.getSource()).getScene().getWindow(); appStage.setScene(scene); appStage.show(); } public void build(boolean answerIsCorrect, Country country) throws FileNotFoundException { setAnswerStatement(answerIsCorrect, country); setDisplay(country); setBackgroundImage(); } public void setAnswerStatement(boolean answerIsCorrect, Country country) { if (answerIsCorrect) { resultStatement.setText(greetings[new Random().nextInt(greetings.length)]); resultStatement.setFill(Color.CORAL); } else { resultStatement.setText(consolations[new Random().nextInt(consolations.length)] + " it's " + country.getCapitalName()); resultStatement.setFill(Color.BROWN); } setResultStatementStyle(); } private void setResultStatementStyle() { resultStatement.setFont(Font.font("Century Gothic", FontWeight.EXTRA_BOLD, 28)); } private void setDisplay(Country country) throws FileNotFoundException { if (!setFactBox(country)) setFlagCentered(country); else setFlag(country); } private boolean setFactBox(Country country) throws FileNotFoundException { this.factBox.setPadding(new Insets(10)); List<Text> factListText = new LinkedList<Text>(); String currentFact; List<String> readFacts = FactReader.getFacts(country); if (readFacts.isEmpty()) { return false; } setFactBoxSpacing(readFacts); Iterator<String> factIterator = readFacts.iterator(); while (factIterator.hasNext()) { currentFact = factIterator.next(); Text addedFact = new Text(currentFact); addedFact.setWrappingWidth(378); factListText.add(addedFact); } for (Text factText : factListText) { factText.setFont(Font.font("Trebuchet MS", FontWeight.BOLD, 21)); factText.autosize(); this.factBox.getChildren().add(factText); } return true; } /* this methods calculates the spacings and layout of the factBox * according to the number of facts read and their total size */ private void setFactBoxSpacing(List<String> readFacts) { int totalNumberOfCharacters = 0; for (String fact : readFacts) totalNumberOfCharacters += fact.length(); int numberOfFacts = readFacts.size(); if (totalNumberOfCharacters < 150) { if (numberOfFacts < 5) { this.factBox.setLayoutY(this.flag.getLayoutY()); this.factBox.setSpacing(3); } else { this.factBox.setLayoutY(this.flag.getLayoutY() - 8); this.factBox.setSpacing(5); } } else if (totalNumberOfCharacters < 200) { if (numberOfFacts > 4) { this.factBox.setLayoutY(this.flag.getLayoutY() - 10); this.factBox.setSpacing(3); } else { this.factBox.setLayoutY(this.flag.getLayoutY() - 5); this.factBox.setSpacing(5); } } else if (totalNumberOfCharacters >= 200) { this.factBox.setLayoutY(this.flag.getLayoutY() - 40); } } private void setFlag(Country country) { File flagFile = new File("data\\flags\\" + country.getCountryName().toLowerCase() + ".gif"); this.flag.setImage(new Image(flagFile.toURI().toString())); } private void setFlagCentered(Country country) { setFlag(country); this.flag.setLayoutX((this.pane.getPrefWidth() - 250) / 2); this.flag.setLayoutY((this.pane.getPrefHeight() - 154) / 2); } private void setBackgroundImage() { String bgImagePath = "answer_background.png"; this.pane.setStyle("-fx-background-image: url('" + bgImagePath + "'); " + "-fx-background-position: center; " + "-fx-background-repeat: repeat;"); } @Override public void initialize(URL arg0, ResourceBundle arg1) { } }
d48b6912112d26cfdd22a86a9603088f28d8a882
a3f0e699f265688b4c5d75a26012eb42eb34db7b
/client/src/main/java/ua/nure/petryasya/core/user/package-info.java
313b6cd28c1583cada6a1b5e0f7c35b84d306e13
[]
no_license
happy0wnage/JAX-WS-Petrov-Yasenov
ddaac3c34ac9afbe3ea6b7cab52ceb92e6996d86
6b0b168184a689990388736722ce7f47c3531c11
refs/heads/master
2021-01-09T21:43:22.186703
2016-02-28T23:03:27
2016-02-28T23:03:27
52,731,952
0
0
null
null
null
null
UTF-8
Java
false
false
123
java
@javax.xml.bind.annotation.XmlSchema(namespace = "http://service.petryasya.nure.ua/") package ua.nure.petryasya.core.user;
c63407a516a8d13a48cf06256c8b373ef90ab5cc
316e7708a53558173b40fb1fde39005cb06c749f
/backend/src/main/java/com/devsuperior/dscatalog/dto/ProductDTO.java
0406fc542089f6b941c6dc1f8ef5942027558759
[]
no_license
DaniloPolastri/dscatalog-bootcam-devsuperior
5ff8604ee41293cde2fa349ecd2fd60b341dab1c
900ee58571059d23a22372ad11d0707679b2c169
refs/heads/master
2023-05-02T20:06:08.487080
2021-05-12T22:25:46
2021-05-12T22:25:46
328,265,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,456
java
package com.devsuperior.dscatalog.dto; import com.devsuperior.dscatalog.entities.Category; import com.devsuperior.dscatalog.entities.Product; import java.io.Serializable; import java.time.Instant; import java.util.ArrayList; import java.util.List; import java.util.Set; public class ProductDTO implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String name; private String description; private Double price; private String img_URL; private Instant date; private List<CategoryDTO> categories = new ArrayList<>(); public ProductDTO(){} public ProductDTO(Long id, String name, String description, Double price, String img_URL, Instant date) { this.id = id; this.name = name; this.description = description; this.price = price; this.img_URL = img_URL; this.date = date; } public ProductDTO(Product entity) { this.id = entity.getId(); this.name = entity.getName(); this.description = entity.getDescription(); this.price = entity.getPrice(); this.img_URL = entity.getImg_URL(); this.date = entity.getDate(); } //popular a lista de categoria a categoria DTO public ProductDTO(Product entity, Set<Category> categories){ this(entity); categories.forEach(cat -> this.categories.add(new CategoryDTO(cat))); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String getImg_URL() { return img_URL; } public void setImg_URL(String img_URL) { this.img_URL = img_URL; } public Instant getDate() { return date; } public void setDate(Instant date) { this.date = date; } public List<CategoryDTO> getCategories() { return categories; } public void setCategories(List<CategoryDTO> categories) { this.categories = categories; } }
e832f2b42be50975d0ccc1fac41143e44a3cd81b
99461988a754f76a461775d6e6759cdbe3aafe45
/CardGameSpecs/PlayerTest.java
a5ce9e84745d86595577a0553db9d7ccdbae393b
[]
no_license
graeme81/blackjack-Fun-week-6
9e1295eb8a7a4958700d70b40433b41531f170fc
5b280588fc9019a46d39083d8dd18b1f4ae39d54
refs/heads/master
2021-01-13T14:28:06.486321
2017-01-16T00:33:03
2017-01-16T00:33:03
79,069,200
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
import static org.junit.Assert.*; import org.junit.*; import cardGame.*; public class PlayerTest{ Deck deck; Card card; Player player; @Before public void before(){ deck = new Deck(1); player = new Player("Joe"); card = deck.topCard(); player.takeCard(card); card = deck.topCard(); player.takeCard(card); } @Test public void getPlayerName(){ assertEquals("Joe", player.getName()); } @Test public void cardsDeltFromDeckToHand(){ assertEquals(Suit.DIAMONDS, player.getCard(0).getSuit()); assertEquals(Value.ACE,player.getCard(0).getValue()); assertEquals(Suit.DIAMONDS, player.getSecondCard().getSuit()); assertEquals(Value.TWO,player.getSecondCard().getValue()); } @Test public void clearPlayerHand(){ player.clearHand(); assertEquals(0,player.getHandSize()); } }
4aa9f98625af6fccbc8bec03e96c60eaea28f69e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_e3898da94c8bb7d0ff52fddbc729daf9dbc5ba85/ExportPrivateKey/7_e3898da94c8bb7d0ff52fddbc729daf9dbc5ba85_ExportPrivateKey_t.java
ff4bf02915e864fdc9731ff3206f5227657aeb83
[]
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
2,340
java
package org.cujau.crypto; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.security.Key; import java.security.KeyPair; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; import org.cujau.utils.Base64; public class ExportPrivateKey { private File keystoreFile; private String keyStoreType; private char[] password; private String alias; private File exportedFile; public static KeyPair getPrivateKey( KeyStore keystore, String alias, char[] password ) { try { Key key = keystore.getKey( alias, password ); if ( key instanceof PrivateKey ) { Certificate cert = keystore.getCertificate( alias ); PublicKey publicKey = cert.getPublicKey(); return new KeyPair( publicKey, (PrivateKey) key ); } } catch ( UnrecoverableKeyException e ) { } catch ( NoSuchAlgorithmException e ) { } catch ( KeyStoreException e ) { } return null; } public void export() throws Exception { KeyStore keystore = KeyStore.getInstance( keyStoreType ); keystore.load( new FileInputStream( keystoreFile ), password ); KeyPair keyPair = getPrivateKey( keystore, alias, password ); PrivateKey privateKey = keyPair.getPrivate(); String encoded = Base64.encodeBytes( privateKey.getEncoded() ); FileWriter fw = new FileWriter( exportedFile ); fw.write( "-----BEGIN PRIVATE KEY-----\n" ); fw.write( encoded ); fw.write( "\n" ); fw.write( "-----END PRIVATE KEY-----" ); fw.close(); } public static void main( String args[] ) throws Exception { ExportPrivateKey export = new ExportPrivateKey(); export.keystoreFile = new File( args[0] ); export.keyStoreType = args[1]; export.password = args[2].toCharArray(); export.alias = args[3]; export.exportedFile = new File( args[4] ); export.export(); } }
9956242ffbaee8fd82f2c8326bab5aaa3b583582
ef8c2e1245093d1e086dd1f1fb683ef2c92a3b50
/src/com/javaex/ex02/Goods.java
c94e66d75ae632163719c660bde7459b51c5a062
[]
no_license
seungmi9191/chapter02
f5a25de84ed447f3ea4a6a25c6669972df54befe
c86413125bd03205b05f24ca2ca92ee4733b4014
refs/heads/master
2021-04-06T01:44:06.784665
2018-03-13T15:01:17
2018-03-13T15:01:17
125,017,139
0
0
null
null
null
null
UTF-8
Java
false
false
1,291
java
package com.javaex.ex02; public class Goods { private String name; private int price; public Goods(String n, int p) { name = n; price = p; } //메소드 public void setName(String n) { name = n; } public void setPrice(int p) { price = p; } public String getName() { return name; } public int getPrice() { return price; } //값을 넣고 출력하는것만 만드는 것이 아님 //필요하면 다 만들 수 있음 //한 번에 출력하는 메소드 public void showinfo() { //인스턴트화 된 name,price의 내용값 System.out.print("상품이름: " + "\""+name+"\""+"\t"); System.out.println("가격: " + price); //-------------------------------------------------------------------- /* * public Goods() {}라는 생성자가 숨겨져있음 * */ /*public Goods() {} public Goods(String name, int price) { this.name = name; this.price = price; }*/ //---------------------------------------------------------------------- /* * public Goods(String name) { * this.name = name; * * public Goods(String name, int price) { * this(name); //다른 생성자의 name을 부름 * this.price = price; * */ } }
[ "wooseungmi@DESKTOP-HLAEO9O" ]
wooseungmi@DESKTOP-HLAEO9O
97591bfc33a30dc258216f5ebccfc06c408cca1c
bca2a520e8d9a9f3d49d250bd0c2f7c3838da7f3
/src/main/java/com/boundlessgeo/gsr/model/map/TimeInfo.java
1f14eceb04da7d65637a78e773ae17c434a4fa2d
[]
no_license
geosolutions-it/gsr
1fd64db6b8db0557991b5059c1eb5615f1082b93
e6c442bc31d1d0cd59a677dc52730c6371c1523f
refs/heads/dynamic-table-test
2023-06-01T00:12:41.319200
2020-02-28T15:12:17
2020-02-28T15:12:17
196,354,454
2
6
null
2019-12-20T23:07:16
2019-07-11T08:38:05
Java
UTF-8
Java
false
false
1,362
java
package com.boundlessgeo.gsr.model.map; import org.geoserver.catalog.DimensionInfo; import org.geoserver.catalog.DimensionPresentation; import java.math.BigDecimal; /** * TimeInfo field, used by {@link LayerOrTable} */ public class TimeInfo { public final String startTimeField; public final String endTimeField; public final Object trackIdField = new Object(); public final BigDecimal timeInterval; public final String timeIntervalUnits; public final TimeReference timeReference; public TimeInfo(DimensionInfo time) { startTimeField = time.getAttribute(); if (time.getEndAttribute() != null) { endTimeField = time.getEndAttribute(); } else { endTimeField = time.getAttribute(); } if (time.getPresentation() == DimensionPresentation.DISCRETE_INTERVAL) { BigDecimal resolution = time.getResolution(); timeInterval = resolution; timeIntervalUnits = resolution == null ? null : "ms"; timeReference = new TimeReference(); } else { timeInterval = null; timeIntervalUnits = null; timeReference = null; } } public static class TimeReference { public final String timeZone = "UTC"; public final Boolean respectDaylightSaving = true; } }
981c8736b05e2dcaa3cca428f7d708259f653e7f
a40e8647d702acb405f8da205e7f6e7daa7856c0
/org.jenetics/src/test/java/org/jenetics/internal/math/probabilityTest.java
b805740d2040715628b7222ea60e5d93683ba42c
[ "Apache-2.0" ]
permissive
xiaoqshou/jenetics
ca8965d318f4147d23a98f9d0e908969c43d7799
b0bc2d4762873df8df9295cebc8728a4a87677b6
refs/heads/master
2021-01-21T08:44:31.782899
2015-01-12T17:51:33
2015-01-12T17:51:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,742
java
/* * Java Genetic Algorithm Library (@__identifier__@). * Copyright (c) @__year__@ Franz Wilhelmstötter * * 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. * * Author: * Franz Wilhelmstötter ([email protected]) */ package org.jenetics.internal.math; import java.util.Random; import org.testng.Assert; import org.testng.annotations.Test; import org.jenetics.util.RandomRegistry; /** * @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a> * @version <em>$Date: 2013-09-01 $</em> */ public class probabilityTest { @Test public void toIntToFloat() { final Random random = RandomRegistry.getRandom(); for (int i = 0; i < 100000; ++i) { final float p = random.nextFloat(); final int ip = probability.toInt(p); final float fip = probability.toFloat(ip); Assert.assertEquals(fip, p, 0.000001F); } } @Test public void probabilityToInt() { Assert.assertEquals(probability.toInt(0), Integer.MIN_VALUE); Assert.assertEquals(probability.toInt(1), Integer.MAX_VALUE); Assert.assertEquals(probability.toInt(0.5), 0); Assert.assertEquals(probability.toInt(0.25), Integer.MIN_VALUE/2); Assert.assertEquals(probability.toInt(0.75), Integer.MAX_VALUE/2); } }
10f106ed388dc146b49f8670d22135d9787b24f9
7f4d92acca3827da4778cbea6bfebd07824afd54
/src/main/java/com/example/backbirthday/User/User.java
dc09a4e99120ba8d6ad5c993aa80f0fcd9391966
[]
no_license
leanyanko/back-birthday
831d35f2b6c5965679afd30d85ba0296f2765046
5a3f7738ca1270880f07d884c9977a25e41f71a8
refs/heads/master
2021-09-18T01:32:06.426736
2018-07-08T18:13:16
2018-07-08T18:13:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,387
java
package com.example.backbirthday.User; import com.example.backbirthday.Birthday.Birthday; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.*; import org.springframework.web.bind.annotation.CrossOrigin; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @CrossOrigin @Data @AllArgsConstructor @NoArgsConstructor @Getter @Setter @Entity @Table(name = "USERS") public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany(mappedBy = "creator", cascade=CascadeType.ALL) @JsonIgnore private Set<Birthday> birthdays = new HashSet<> (); @ManyToMany(fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name = "DONATORS", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "birthday_id") }) private Set<Birthday> donators = new HashSet<>(); @Column(name = "USERNAME") private String username; @Column(name = "FIRST_NAME") private String firstName; @Column(name = "LAST_NAME") private String lastName; @Column(name = "EMAIL") private String email; @Column(name = "ABOUT_ME") private String aboutMe; @Column(name = "PASSWORD") private String password; }
2f435dd250e45a1d71cd76250a106a51aded0908
e26fceb0c49ca5865fcf36bd161a168530ae4e69
/OpenAMASE/src/Core/avtas/properties/TestClass.java
e34aeb3071915198ccd1d1766a76a61d0c74ddb2
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-us-govt-public-domain" ]
permissive
sahabi/OpenAMASE
e1ddd2c62848f0046787acbb02b8d31de2f03146
b50f5a71265a1f1644c49cce2161b40b108c65fe
refs/heads/master
2021-06-17T14:15:16.366053
2017-05-07T13:16:35
2017-05-07T13:16:35
90,772,724
3
0
null
null
null
null
UTF-8
Java
false
false
3,682
java
// =============================================================================== // Authors: AFRL/RQQD // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of the Air Force. No copyright is claimed in the United States under // Title 17, U.S. Code. All Other Rights Reserved. // =============================================================================== package avtas.properties; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.JOptionPane; /** * * @author AFRL/RQQD */ public class TestClass { @UserProperty private int intVal = 5; @UserProperty( Description="Color") private Color color = Color.RED; @UserProperty( ) private File file = new File("../test"); @UserProperty( FileType = UserProperty.FileTypes.Directories) private File dir; @UserProperty private Font font = new Font("Arial", Font.PLAIN, 12); @UserProperty private TestEnum anEnum = TestEnum.One; @UserProperty private List list = new ArrayList(); @UserProperty Action push = new AbstractAction("Push") { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "Hello"); } }; private Object ignoreMe; public TestClass() { list.add("one"); list.add("two"); list.add("three"); } /** * @return the intVal */ public int getIntVal() { return intVal; } /** * @param intVal the intVal to set */ //public void setIntVal(int intVal) { // this.intVal = intVal; //} /** * @return the color */ public Color getColor() { return color; } /** * @param color the color to set */ public void setColor(Color color) { this.color = color; } /** * @return the file */ public File getFile() { return file; } /** * @param file the file to set */ public void setFile(File file) { this.file = file; } /** * @return the font */ public Font getFont() { return font; } /** * @param font the font to set */ public void setFont(Font font) { this.font = font; } /** * @return the anEnum */ public TestEnum getAnEnum() { return anEnum; } /** * @param anEnum the anEnum to set */ public void setAnEnum(TestEnum anEnum) { this.anEnum = anEnum; } /** * @return the ignoreMe */ public Object getIgnoreMe() { return ignoreMe; } /** * @param ignoreMe the ignoreMe to set */ public void setIgnoreMe(Object ignoreMe) { this.ignoreMe = ignoreMe; } /** * @return the dir */ public File getDir() { return dir; } /** * @param dir the dir to set */ public void setDir(File dir) { this.dir = dir; } public static enum TestEnum { One, Two, Three } public List getList() { return list; } public void setList(List list) { System.out.println("a new list"); this.list = list; } } /* Distribution A. Approved for public release. * Case: #88ABW-2015-4601. Date: 24 Sep 2015. */
40e44002619336d5e85429efc0b285d68d9fc1a2
31de966495ed5b5700bb3eabd27eca9a7e443f92
/app/src/androidTest/java/com/fitiwizz/mtbfollow/data/TestDb.java
d099cb76efc1ce9a93861859e3ddd7e3e4011631
[]
no_license
Fitiwizz/AndroidDevUdacityTuto
51cc18f6d9409a93ae45f6cb374db3db8d4641e2
46bf2737bd44f313254577730db82925e7249641
refs/heads/master
2021-01-10T17:22:27.629223
2015-10-08T11:11:15
2015-10-08T11:11:15
43,767,770
0
0
null
null
null
null
UTF-8
Java
false
false
8,771
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.fitiwizz.mtbfollow.data; import android.content.ContentValues; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.test.AndroidTestCase; import java.util.HashSet; public class TestDb extends AndroidTestCase { public static final String LOG_TAG = TestDb.class.getSimpleName(); // Since we want each test to start with a clean slate void deleteTheDatabase() { mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME); } /* This function gets called before each test is executed to delete the database. This makes sure that we always have a clean test. */ public void setUp() { deleteTheDatabase(); } /* Students: Uncomment this test once you've written the code to create the Location table. Note that you will have to have chosen the same column names that I did in my solution for this test to compile, so if you haven't yet done that, this is a good time to change your column names to match mine. Note that this only tests that the Location table has the correct columns, since we give you the code for the weather table. This test does not look at the */ public void testCreateDb() throws Throwable { // build a HashSet of all of the table names we wish to look for // Note that there will be another table in the DB that stores the // Android metadata (db version information) final HashSet<String> tableNameHashSet = new HashSet<String>(); tableNameHashSet.add(WeatherContract.LocationEntry.TABLE_NAME); tableNameHashSet.add(WeatherContract.WeatherEntry.TABLE_NAME); mContext.deleteDatabase(WeatherDbHelper.DATABASE_NAME); SQLiteDatabase db = new WeatherDbHelper( this.mContext).getWritableDatabase(); assertEquals(true, db.isOpen()); // have we created the tables we want? Cursor c = db.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null); assertTrue("Error: This means that the database has not been created correctly", c.moveToFirst()); // verify that the tables have been created do { tableNameHashSet.remove(c.getString(0)); } while( c.moveToNext() ); // if this fails, it means that your database doesn't contain both the location entry // and weather entry tables assertTrue("Error: Your database was created without both the location entry and weather entry tables", tableNameHashSet.isEmpty()); // now, do our tables contain the correct columns? c = db.rawQuery("PRAGMA table_info(" + WeatherContract.LocationEntry.TABLE_NAME + ")", null); assertTrue("Error: This means that we were unable to query the database for table information.", c.moveToFirst()); // Build a HashSet of all of the column names we want to look for final HashSet<String> locationColumnHashSet = new HashSet<String>(); locationColumnHashSet.add(WeatherContract.LocationEntry._ID); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_CITY_NAME); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LAT); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_COORD_LONG); locationColumnHashSet.add(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING); int columnNameIndex = c.getColumnIndex("name"); do { String columnName = c.getString(columnNameIndex); locationColumnHashSet.remove(columnName); } while(c.moveToNext()); // if this fails, it means that your database doesn't contain all of the required location // entry columns assertTrue("Error: The database doesn't contain all of the required location entry columns", locationColumnHashSet.isEmpty()); db.close(); } /* Students: Here is where you will build code to test that we can insert and query the location database. We've done a lot of work for you. You'll want to look in TestUtilities where you can uncomment out the "createNorthPoleLocationValues" function. You can also make use of the ValidateCurrentRecord function from within TestUtilities. */ public void testLocationTable() { addToLocationTable(); } public long addToLocationTable() { // First step: Get reference to writable database SQLiteDatabase db = new WeatherDbHelper( this.mContext).getWritableDatabase(); // Create ContentValues of what you want to insert // (you can use the createNorthPoleLocationValues if you wish) ContentValues testValues = TestUtilities.createNorthPoleLocationValues(); // Insert ContentValues into database and get a row ID back Long locationRowId = db.insert(WeatherContract.LocationEntry.TABLE_NAME, null, testValues); assertTrue(locationRowId != -1); // Query the database and receive a Cursor back Cursor dbCursor = db.query( WeatherContract.LocationEntry.TABLE_NAME, null, null, null, null, null, null ); // Move the cursor to a valid database row assertTrue("Error: can't get record", dbCursor.moveToFirst()); // Validate data in resulting Cursor with the original ContentValues // (you can use the validateCurrentRecord function in TestUtilities to validate the // query if you like) TestUtilities.validateCurrentRecord("Location Entry don't match", dbCursor, testValues); assertFalse("More than one record", dbCursor.moveToNext()); // Finally, close the cursor and database dbCursor.close(); db.close(); return locationRowId; } /* Students: Here is where you will build code to test that we can insert and query the database. We've done a lot of work for you. You'll want to look in TestUtilities where you can use the "createWeatherValues" function. You can also make use of the validateCurrentRecord function from within TestUtilities. */ public void testWeatherTable() { String weatherTableName = WeatherContract.WeatherEntry.TABLE_NAME; // First insert the location, and then use the locationRowId to insert // the weather. Make sure to cover as many failure cases as you can. Long locationRowId = addToLocationTable(); // First step: Get reference to writable database SQLiteDatabase db = new WeatherDbHelper(this.mContext).getWritableDatabase(); // Create ContentValues of what you want to insert // (you can use the createWeatherValues TestUtilities function if you wish) ContentValues testValues = TestUtilities.createWeatherValues(locationRowId); // Insert ContentValues into database and get a row ID back Long weatherId = db.insert(weatherTableName, null, testValues); // Query the database and receive a Cursor back Cursor dbCursor = db.query(weatherTableName, null, null, null, null, null, null); // Move the cursor to a valid database row assertTrue("No data ??!", dbCursor.moveToFirst()); // Validate data in resulting Cursor with the original ContentValues // (you can use the validateCurrentRecord function in TestUtilities to validate the // query if you like) TestUtilities.validateCurrentRecord("Weather Entry don't match", dbCursor, testValues); assertFalse("Multiple data ??!", dbCursor.moveToNext()); // Finally, close the cursor and database dbCursor.close(); db.close(); } /* Students: This is a helper method for the testWeatherTable quiz. You can move your code from testLocationTable to here so that you can call this code from both testWeatherTable and testLocationTable. */ public long insertLocation() { return -1L; } }
aa80ea4ef3100dec8842a98d3f9e035735e6c808
ffa02e500888c93d07babd4535049a05991e50ee
/src/main/java/espresso/validation/NamedEntityValidatorContext.java
47ddcb41fed290b19a30ef35c77c7e6dc5acd722
[]
no_license
maximenajim/espresso
634f50894ad5a901d383bc335824e564bf0b95d6
e6580bb35173c0a510a1f6034cb8a7c0e8686ff1
refs/heads/master
2020-04-10T09:22:52.790987
2012-04-19T04:54:57
2012-04-19T04:54:57
4,066,928
0
1
null
null
null
null
UTF-8
Java
false
false
1,611
java
package espresso.validation; import java.util.HashMap; import java.util.List; import java.util.Map; public class NamedEntityValidatorContext<Entity extends NamedEntity> { private List<Entity> existingEntities; private Map<Long,Entity> existingEntitiesIdMap; private Map<String,Entity> existingEntitiesNameMap; private NamedEntityValidatorContext(List<Entity> existingEntitiesList) { existingEntities = existingEntitiesList; existingEntitiesIdMap = new HashMap<Long,Entity>(); existingEntitiesNameMap = new HashMap<String,Entity>(); } public static <Entity extends NamedEntity> NamedEntityValidatorContext load(List<Entity> existingEntities) { NamedEntityValidatorContext<Entity> validatorContext = new NamedEntityValidatorContext<Entity>(existingEntities); for(Entity entity : existingEntities){ validatorContext.existingEntitiesIdMap.put(entity.getId(), entity); validatorContext.existingEntitiesNameMap.put(entity.getName(), entity); } return validatorContext; } public Entity getExistingEntityById(Long id){ Entity entity = null; if(existingEntitiesIdMap != null){ entity = existingEntitiesIdMap.get(id); } return entity; } public Entity getExistingEntityByName(String name){ Entity entity = null; if(existingEntitiesNameMap != null){ entity = existingEntitiesNameMap.get(name); } return entity; } public List<Entity> getExistingEntities() { return existingEntities; } }
75d8d67f0e14f88153f61a13f29d2765bd50e4df
1fb6f17c11aa932e3b63565bcfaa81d9c2645239
/src/Interface/P_1.java
5679187f3a70b509ef3ce538cf347e6132e7e941
[]
no_license
ARN-Test/CommandTest
53bf12c55a588d0c3e08eafe6d581d2f4c626b14
c4a303004f219db7289dcae3770cf7ea680049e6
refs/heads/master
2020-06-24T01:48:43.636033
2017-07-11T16:40:59
2017-07-11T16:40:59
96,915,254
0
0
null
null
null
null
UTF-8
Java
false
false
10,758
java
package Interface; /** * * @author A.R. Nobel */ public class P_1 extends javax.swing.JFrame { /** * Creates new form P_1 */ public P_1() { P.lookandfeel("Metal"); initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { Panel_1 = new javax.swing.JPanel(); Shutdown = new javax.swing.JButton(); Restart = new javax.swing.JButton(); Abort = new javax.swing.JButton(); TimeS = new javax.swing.JSlider(); jLabel1 = new javax.swing.JLabel(); TimerVV = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(0, 0, 0)); Panel_1.setBackground(new java.awt.Color(153, 153, 153)); Shutdown.setBackground(new java.awt.Color(255, 102, 102)); Shutdown.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N Shutdown.setText("Shutdown"); Shutdown.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ShutdownActionPerformed(evt); } }); Restart.setBackground(new java.awt.Color(102, 102, 255)); Restart.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N Restart.setText("Restart"); Restart.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RestartActionPerformed(evt); } }); Abort.setBackground(new java.awt.Color(255, 255, 255)); Abort.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N Abort.setText("Abort"); Abort.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AbortActionPerformed(evt); } }); TimeS.setMajorTickSpacing(1); TimeS.setMaximum(14400); TimeS.setValue(0); TimeS.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); TimeS.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { TimeSStateChanged(evt); } }); jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Set Timer:"); jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); TimerVV.setText("0 Second"); javax.swing.GroupLayout Panel_1Layout = new javax.swing.GroupLayout(Panel_1); Panel_1.setLayout(Panel_1Layout); Panel_1Layout.setHorizontalGroup( Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel_1Layout.createSequentialGroup() .addGap(0, 120, Short.MAX_VALUE) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(Panel_1Layout.createSequentialGroup() .addComponent(Shutdown, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(Restart, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(123, 123, 123)) .addGroup(Panel_1Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(TimerVV) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel_1Layout.createSequentialGroup() .addComponent(Abort, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Panel_1Layout.createSequentialGroup() .addComponent(TimeS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(117, 117, 117))))))) ); Panel_1Layout.setVerticalGroup( Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(Panel_1Layout.createSequentialGroup() .addGap(72, 72, 72) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Restart, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Shutdown, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE) .addGroup(Panel_1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(TimeS, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(TimerVV) .addGap(9, 9, 9) .addComponent(Abort, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Panel_1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Panel_1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void ShutdownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShutdownActionPerformed // TODO add your handling code here: try{ Shutdown ST = new Shutdown(TimeS.getValue()); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_ShutdownActionPerformed private void RestartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RestartActionPerformed // TODO add your handling code here: try{ Restart RT = new Restart(TimeS.getValue()); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_RestartActionPerformed private void AbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AbortActionPerformed // TODO add your handling code here: try{ Abort AT = new Abort(); } catch(Exception e) { e.printStackTrace(); } }//GEN-LAST:event_AbortActionPerformed private void TimeSStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_TimeSStateChanged // TODO add your handling code here: TimerVV.setText(String.valueOf(TimeS.getValue()) + "Seconds"); }//GEN-LAST:event_TimeSStateChanged /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(P_1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new P_1().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton Abort; private javax.swing.JPanel Panel_1; private javax.swing.JButton Restart; private javax.swing.JButton Shutdown; private javax.swing.JSlider TimeS; private javax.swing.JLabel TimerVV; private javax.swing.JLabel jLabel1; // End of variables declaration//GEN-END:variables }
[ "A.R. Nobel@Nobel001" ]
A.R. Nobel@Nobel001
5e270cdd9e10b926adce2a4a34941f3282b870b9
7708ed31f68738e2151d93c52974372ffab0e614
/src/main/java/com/picklerick/schedule/rest/api/controller/FormController.java
b71e38eb42f7657c4e996ec699b859168365c68e
[]
no_license
AhsanManzoor/Pickle-Rick-Schedule
310f06382b0dccf17007989d046d2cfb3dc0f33d
b05f85bc0d9b26f63af260c5b256ebfe71eaeff4
refs/heads/develop
2023-05-06T01:08:01.967075
2021-05-28T20:20:59
2021-05-28T20:20:59
371,402,327
0
0
null
2021-05-27T14:29:39
2021-05-27T14:28:53
Java
UTF-8
Java
false
false
2,245
java
package com.picklerick.schedule.rest.api.controller; import com.picklerick.schedule.rest.api.model.Login; import com.picklerick.schedule.rest.api.model.User; import com.picklerick.schedule.rest.api.repository.RoleRepository; import com.picklerick.schedule.rest.api.repository.UserRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; @Controller public class FormController { private final RoleRepository roleRepository; private final UserRepository userRepository; private static final Logger LOGGER = LoggerFactory.getLogger(FormController.class); public FormController(RoleRepository roleRepository, UserRepository userRepository) { this.roleRepository = roleRepository; this.userRepository = userRepository; } /** * Create Models and load all Roles to select in the Add New User Form * * @author Clelia * */ @Secured("ROLE_ADMIN") @RequestMapping(value = "/user", method = RequestMethod.GET) public String newUser(Model model) { LOGGER.info("Attempt started to create new user"); User user = new User(); user.setLogin(new Login()); Login login = user.getLogin(); model.addAttribute("user", user); model.addAttribute("roles", roleRepository.findAll()); model.addAttribute("login", login); return "addNewUser"; } /** * Create Models and load all Roles to select in the Add New User Form * * @author Clelia * */ @Secured("ROLE_ADMIN") @RequestMapping(value = "/user/{id}", method = RequestMethod.GET) public String editUser(Model model, @PathVariable Long id) { LOGGER.info("Edit user"); User user = userRepository.findById(id).get(); Login login = user.getLogin(); model.addAttribute("user", user); model.addAttribute("roles", roleRepository.findAll()); model.addAttribute("login", login); model.addAttribute("selectedRole", user.getRoles().get(0)); return "editUser"; } }
6968c16a8661b4a7f45a3021ca25822675776a14
b31dde53971b383feeb8b8119ca4655a7b26e490
/src/albums/Album.java
21c8d5c6242e079525029fe1dc7b75c75d49e741
[]
no_license
williamjwang/Album-Manager
b205067f45f2a343183a409499959856aca47350
572c7e769a23440b7cd8b5083f4e30b9f091e668
refs/heads/main
2023-08-21T10:27:21.640314
2021-10-27T04:50:04
2021-10-27T04:50:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,418
java
package albums; /** * This class defines the Album abstract data type with title, artist, genre, releaseDate, and isAvailable. * @author William Wang, Joshua Sze */ public class Album { private String title; private String artist; private Genre genre; //enum class; Classical, Country, Jazz, Pop, Unknown private Date releaseDate; private boolean isAvailable; /** * This method sets/changes the availability of the Album object. * @param isAvailable a boolean representing the availability of Album object being changed to */ public void setIsAvailable(boolean isAvailable) { this.isAvailable = isAvailable; } /** * This method returns the title of the Album object. * @return a String title of the Album object */ public String getTitle() { return title; } /** * This method returns the artist of the Album object. * @return a String artist of the Album object */ public String getArtist() { return artist; } /** * This method returns the genre of the Album object. * @return a Genre genre of the Album object */ public Genre getGenre() { return genre; } /** * This method returns the release date of the Album object. * @return a Date object releaseDate of the Album object */ public Date getDate() { return releaseDate; } /** * This method returns the availability of the Album object. * @return a boolean isAvailable of the Date object */ public boolean getIsAvailable() { return isAvailable; } /** * This method returns an Album object initialized with unknown parameters and today's date. */ public Album() { this("UNKNOWN TITLE", "UNKNOWN ARTIST", Genre.Unknown, new Date(), true); } /** * This method returns an Album object initialized with given parameters title and artist. * @param title A String title of the Album object * @param artist A String artist of the Album object */ public Album(String title, String artist) { this(title, artist, Genre.Unknown, new Date(), true); } /** * This method returns an Album object initialized with given parameters title, artist, genre, releaseDate, and isAvailable. * @param title a String title of the Album object * @param artist a String artist of the Album object * @param genre a Genre genre of the Album object * @param releaseDate a Date object releaseDate of the Album object * @param isAvailable a boolean isAvailable of the ALbum object */ public Album(String title, String artist, Genre genre, Date releaseDate, boolean isAvailable) { this.title = title; this.artist = artist; this.genre = genre; this.releaseDate = releaseDate; this.isAvailable = isAvailable; } /** * This method compares two Album objects and checks if they have the same title and artist. * @param obj an Album object * @return true if the two Album objects have the same title and artist */ @Override public boolean equals(Object obj) { if (obj instanceof Album) { if ((this.title.equals(((Album)obj).getTitle())) && (this.artist.equals(((Album)obj).getArtist()))) { return true; } else return false; } return false; } /** * This method returns a textual representation of an album. * @return a String in the format title::artist::genre::releaseDate::isAvailable */ @Override public String toString() { int albumReleaseMonth = releaseDate.getMonth(); int albumReleaseDay = releaseDate.getDay(); int albumReleaseYear = releaseDate.getYear(); String date = albumReleaseMonth + "/" + albumReleaseDay + "/" + albumReleaseYear; String avail; if (isAvailable) avail = "is available"; else avail = "is not available"; String splitColons = "::"; return title + splitColons + artist + splitColons + genre.toString() + splitColons + date + splitColons + avail; } }
430a39b81daabf3a4ce4880dce885b436a106a15
6f452ab22bb4794692b5b40892270238e4f6d31d
/src/main/java/com/example/mobileapp/LoginActivity.java
043a4e44a6e61aef88f1addce5bbb1cb04073d21
[]
no_license
julian-dsilva-92/mobileapp4360
c811d10bc8012246096dc5ef23f49d72bf369fd1
bec79b9e8047824c4f013e7c099a47d80e3d3ac8
refs/heads/master
2020-04-19T19:56:26.265953
2019-05-01T19:41:35
2019-05-01T19:41:35
168,401,747
5
1
null
null
null
null
UTF-8
Java
false
false
2,112
java
package com.example.mobileapp; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.app.LoaderManager.LoaderCallbacks; import android.content.CursorLoader; import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.ContactsContract; import android.text.TextUtils; import android.view.KeyEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; public class LoginActivity extends AppCompatActivity{ // UI references. private EditText mPassword, mEmail; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); // Set up the login form. mEmail = (EditText) findViewById(R.id.txtEmail); mPassword = (EditText) findViewById(R.id.txtPassword); Button btLogin = (Button) findViewById(R.id.btLogin ); btLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String email = mEmail.getText().toString(); String password = mPassword.getText().toString(); if(email.equals("[email protected]") && password.equals("test")){ Intent mainIntent = new Intent(LoginActivity.this, NewUser.class); startActivity(mainIntent); }else{ Toast.makeText(LoginActivity.this, "Name or Password is incorrect", Toast.LENGTH_LONG).show(); } } }); } public void newUser(View view){ Intent mainIntent = new Intent(this, NewUser.class); startActivity(mainIntent); } }