blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
701ee91a130ca0a9790220a091deb5a9e9913103
|
a9100de27adc3f1f384530a6461a982c6ef1249d
|
/app/src/main/java/project/ys/glasssystem_r1/mvp/model/UserDetailModel.java
|
cc8dac3dbe2c21b09ddd55d6b350800edb52456e
|
[] |
no_license
|
358Tcyf/GlassSystemClientR1
|
25055c7ed6fde1f6a62b2e68080a1b0918db6054
|
ca10146a78ce9653f6b98aae24cb980f15d7b03d
|
refs/heads/master
| 2020-04-25T07:58:14.755116
| 2019-05-24T18:27:58
| 2019-05-24T18:27:58
| 172,630,407
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,009
|
java
|
package project.ys.glasssystem_r1.mvp.model;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import project.ys.glasssystem_r1.http.HttpContract;
import project.ys.glasssystem_r1.http.HttpFeedBackUtil;
import project.ys.glasssystem_r1.http.OnHttpCallBack;
import project.ys.glasssystem_r1.http.RetResult;
import project.ys.glasssystem_r1.http.RetrofitUtils;
import project.ys.glasssystem_r1.mvp.contract.UserDetailContract;
import static project.ys.glasssystem_r1.common.constant.HttpConstant.HTTP;
import static project.ys.glasssystem_r1.common.constant.HttpConstant.PORT;
import static project.ys.glasssystem_r1.common.constant.HttpConstant.getURL;
public class UserDetailModel implements UserDetailContract.Model {
@Override
public void getDetail(String no, OnHttpCallBack<RetResult> callBack) {
RetrofitUtils.newInstance(HTTP + getURL() + PORT + "/")
.create(HttpContract.class)
.userInfo(no)
.subscribeOn(Schedulers.newThread())
.observeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<RetResult>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(RetResult retResult) {
HttpFeedBackUtil.handleRetResult(retResult, callBack);
if (retResult.getCode() == RetResult.RetCode.SUCCESS.code) {
}
}
@Override
public void onError(Throwable e) {
HttpFeedBackUtil.handleException(e, callBack);
}
@Override
public void onComplete() {
}
});
}
}
|
[
"2371183243@qq.com"
] |
2371183243@qq.com
|
d0c962d764a62bbdcbb7e0cb84f886a24b9d3d53
|
bb2bac913a6ea5a292f3f01ba6e9aa700217eb77
|
/LakaZambia_API/api/src/main/java/com/lakazambia/api/controller/CategoryFieldController.java
|
591a5b9075c813fcb1ebf9f4c0555f4000e21d96
|
[] |
no_license
|
minesh1409/laka
|
8ed5d6ce071853c53a803321a90dcab66f372035
|
07ad12b83491033850ba467666b7c69c652198c1
|
refs/heads/master
| 2020-04-14T21:09:59.630293
| 2019-01-04T15:03:55
| 2019-01-04T15:03:55
| 164,119,486
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,281
|
java
|
package com.lakazambia.api.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.UriComponentsBuilder;
import com.lakazambia.api.model.CategoryField;
import com.lakazambia.api.service.ICategoryFieldService;
@RestController
public class CategoryFieldController {
@Autowired
private ICategoryFieldService categoryFieldService;
@GetMapping("/categoryFields")
// @RequestMapping("hello")
public ResponseEntity<List<CategoryField>> getAllCategoryFields(HttpServletRequest request) {
List<CategoryField> list = categoryFieldService.getAllCategoryFields();
return new ResponseEntity<List<CategoryField>>(list, HttpStatus.OK);
}
@PostMapping("/categoryfield")
public ResponseEntity<?> addCategoryField(@RequestBody CategoryField cf, UriComponentsBuilder builder) {
boolean flag = categoryFieldService.createCategoryField(cf);
if (flag == false) {
return new ResponseEntity<String>(HttpStatus.CONFLICT);
}
HttpHeaders headers = new HttpHeaders();
headers.setLocation(builder.path("/categoryField/{id}").buildAndExpand(cf.getField_id()).toUri());
return new ResponseEntity<String>("Success", HttpStatus.CREATED);
}
@GetMapping("categoryField/{id}")
public ResponseEntity<CategoryField> getCategoryFieldById(@PathVariable("id") int id) {
CategoryField cf=categoryFieldService.getCategoryFieldById(id);
return new ResponseEntity<CategoryField>(cf, HttpStatus.OK);
}
@PutMapping("updateCategoryField")
public ResponseEntity<CategoryField> updateCategoryField(@RequestBody CategoryField cf) {
categoryFieldService.updateCategoryField(cf);
return new ResponseEntity<CategoryField>(cf, HttpStatus.OK);
}
}
|
[
"m.prajapati@simhagroup.in"
] |
m.prajapati@simhagroup.in
|
6d35775731ccefc911e8d4a05d61371faa5357f1
|
e0f9acce3a4f1d36aa3780f9ea78e2b6fabd0008
|
/chartprediction/src/tunemapschartcrawler/Metro.java
|
9c049c9fa4188917662c975d4e7b7df56bb58b8e
|
[
"MIT"
] |
permissive
|
erwinvaneyk/TuneMaps
|
11ebc00e3cd67b80cf3437b6ef3565bda44a2b19
|
154e7c3c0bcc74bc70a42baf16ea42b71cfca826
|
refs/heads/master
| 2021-01-15T11:14:19.106519
| 2013-01-13T21:56:28
| 2013-01-13T21:56:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,245
|
java
|
package tunemapschartcrawler;
/**
* A metro
*
* @author Rolf Jagerman <rolf.jagerman@contended.nl>
*/
public class Metro {
/**
* The index
*/
private int index;
/**
* The country
*/
private String country;
/**
* The name
*/
private String name;
/**
* Creates a metro object
* @param country the country
* @param name the name
*/
public Metro(String country, String name) {
this.country = country;
this.name = name;
}
/**
* @return the country
*/
public String getCountry() {
return country;
}
/**
* @param country the country to set
*/
public void setCountry(String country) {
this.country = country;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the index
*/
public int getIndex() {
return index;
}
/**
* @param index the index to set
*/
public void setIndex(int index) {
this.index = index;
}
}
|
[
"rjagerman@gmail.com"
] |
rjagerman@gmail.com
|
e0459590615958949ea2d21ee05435f479a3ba81
|
1c2f521ceff55fa0eac00bc71a749898ece56cc9
|
/quotes-hooks/android/app/src/main/java/com/test_rn/MainActivity.java
|
545b09bff385ee1c8d102758e09f91e8c909bfdd
|
[] |
no_license
|
PavelPoroskov/test_rn
|
4fe5d28b68468d8cadf6053cc93fa615a5c21872
|
119fb001f472c2f2605a4f7886f46a94152572f5
|
refs/heads/master
| 2023-01-11T00:50:44.120120
| 2019-08-07T01:00:03
| 2019-08-07T01:00:03
| 183,464,961
| 0
| 1
| null | 2023-01-04T06:28:37
| 2019-04-25T15:47:53
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 819
|
java
|
package com.test_rn;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "test_rn";
}
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
|
[
"pavl1853@gmail.com"
] |
pavl1853@gmail.com
|
4f158e5310d7c9007f79c3b93579d749d8a5c139
|
48872cb48e3493cbdee115899f57fc636595e9eb
|
/camel-spring-2/src/main/java/com/camelspring2/CamelSpring2Application.java
|
01527a2d984ec80f154cda7fc1e9f61df4b6f250
|
[] |
no_license
|
lipsa-prusty/camel-projects
|
1749d44c0fc376d2f7e3b477706a4f39e3e8eebc
|
8e6faa89ab5c7f5fa5cbde047b671892705711bf
|
refs/heads/main
| 2023-01-14T07:19:46.528042
| 2020-11-25T18:25:10
| 2020-11-25T18:25:10
| 314,201,873
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 321
|
java
|
package com.camelspring2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class CamelSpring2Application {
public static void main(String[] args) {
SpringApplication.run(CamelSpring2Application.class, args);
}
}
|
[
"noreply@github.com"
] |
lipsa-prusty.noreply@github.com
|
a3382f53ce16d15ab970dca9e7650afed4ffbc68
|
94922182195b56ae309287d101d34a4ebc47b165
|
/app/src/main/java/correios/natal/adoteumacarta/DoadorAdapter.java
|
67d658b9dacca998662f3be4427920a0fd40906b
|
[] |
no_license
|
gildoneto/AdoteUmaCarta
|
5d68622539ce887f1c6f8dd0f306f6f20e911256
|
d99411f0ef5c28180e669079276d53930f835f20
|
refs/heads/master
| 2020-05-16T18:33:12.892694
| 2019-05-22T23:35:51
| 2019-05-22T23:35:51
| 183,230,218
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,431
|
java
|
package correios.natal.adoteumacarta;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.ArrayList;
public class DoadorAdapter extends ArrayAdapter<Doador> {
private ArrayList<Doador> doadores;
public DoadorAdapter(@NonNull Context context, @NonNull ArrayList<Doador> doadores) {
super(context, 0,doadores);
this.doadores = doadores;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
Doador doador = doadores.get(position);
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_doador,null);
TextView textViewNome = convertView.findViewById(R.id.txvNomeDoador);
TextView textViewCell = convertView.findViewById(R.id.txvCellDoador);
TextView textViewGift = convertView.findViewById(R.id.txvGiftDoador);
TextView textViewStatus = convertView.findViewById(R.id.txvStatusDoador);
textViewNome.setText(doador.getNome());
textViewCell.setText(doador.getCell());
textViewGift.setText(doador.getGift());
textViewStatus.setText(doador.getStatus());
return convertView;
}
}
|
[
"gildorama@gmail.com"
] |
gildorama@gmail.com
|
134b6fd2316f17d1f1848ffdd4fc104cea3ee421
|
4f178425dd0fa6f21e367784415ba59d7dc80c33
|
/src/Action/UserAction.java
|
175d6d9c3b60b371a056108dc1f20a85cabf45c0
|
[] |
no_license
|
zidieq/st
|
928f9dbb9d623ca908c553916808cd945755f4e1
|
ff1079a2f80463c10fb533954f10bef777693aea
|
refs/heads/master
| 2021-05-16T01:50:06.178287
| 2016-12-07T15:55:35
| 2016-12-07T15:55:35
| 75,851,615
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 49
|
java
|
package Action;
public class UserAction {
}
|
[
"zidieq@qq.com"
] |
zidieq@qq.com
|
29c9159eff0411109f8387df3ead546a89dac9ed
|
d81f6a896dace4eb31b326743776d55982333c12
|
/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/jms/jndi/ObjectFactoryTest.java
|
9ceebfdf14fe96df4c6fc0984cdb1d849bec5b8c
|
[
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] |
permissive
|
michaelandrepearce/activemq-artemis
|
a19fda7c97a232b320551d6b2bd46ad34a693b6e
|
fafbd7e2e5953e03573088577be620828cd77bc5
|
refs/heads/master
| 2021-10-08T09:52:26.277367
| 2019-03-12T19:53:07
| 2019-03-12T19:53:07
| 90,807,775
| 1
| 1
|
Apache-2.0
| 2018-05-23T17:42:35
| 2017-05-10T01:29:30
|
Java
|
UTF-8
|
Java
| false
| false
| 6,980
|
java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.tests.unit.jms.jndi;
import static org.junit.Assert.assertEquals;
import javax.naming.Reference;
import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
import org.apache.activemq.artemis.jndi.JNDIReferenceFactory;
import org.apache.activemq.artemis.utils.RandomUtil;
import org.junit.Assert;
import org.junit.Test;
public class ObjectFactoryTest {
@Test(timeout = 1000)
public void testConnectionFactory() throws Exception {
// Create sample connection factory
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://0");
String clientID = RandomUtil.randomString();
String user = RandomUtil.randomString();
String password = RandomUtil.randomString();
long clientFailureCheckPeriod = RandomUtil.randomPositiveLong();
long connectionTTL = RandomUtil.randomPositiveLong();
long callTimeout = RandomUtil.randomPositiveLong();
int minLargeMessageSize = RandomUtil.randomPositiveInt();
int consumerWindowSize = RandomUtil.randomPositiveInt();
int consumerMaxRate = RandomUtil.randomPositiveInt();
int confirmationWindowSize = RandomUtil.randomPositiveInt();
int producerMaxRate = RandomUtil.randomPositiveInt();
boolean blockOnAcknowledge = RandomUtil.randomBoolean();
boolean blockOnDurableSend = RandomUtil.randomBoolean();
boolean blockOnNonDurableSend = RandomUtil.randomBoolean();
boolean autoGroup = RandomUtil.randomBoolean();
boolean preAcknowledge = RandomUtil.randomBoolean();
String loadBalancingPolicyClassName = RandomUtil.randomString();
boolean useGlobalPools = RandomUtil.randomBoolean();
int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
int threadPoolMaxSize = RandomUtil.randomPositiveInt();
long retryInterval = RandomUtil.randomPositiveLong();
double retryIntervalMultiplier = RandomUtil.randomDouble();
int reconnectAttempts = RandomUtil.randomPositiveInt();
factory.setClientID(clientID);
factory.setUser(user);
factory.setPassword(password);
factory.setClientFailureCheckPeriod(clientFailureCheckPeriod);
factory.setConnectionTTL(connectionTTL);
factory.setCallTimeout(callTimeout);
factory.setMinLargeMessageSize(minLargeMessageSize);
factory.setConsumerWindowSize(consumerWindowSize);
factory.setConsumerMaxRate(consumerMaxRate);
factory.setConfirmationWindowSize(confirmationWindowSize);
factory.setProducerMaxRate(producerMaxRate);
factory.setBlockOnAcknowledge(blockOnAcknowledge);
factory.setBlockOnDurableSend(blockOnDurableSend);
factory.setBlockOnNonDurableSend(blockOnNonDurableSend);
factory.setAutoGroup(autoGroup);
factory.setPreAcknowledge(preAcknowledge);
factory.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
factory.setUseGlobalPools(useGlobalPools);
factory.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
factory.setThreadPoolMaxSize(threadPoolMaxSize);
factory.setRetryInterval(retryInterval);
factory.setRetryIntervalMultiplier(retryIntervalMultiplier);
factory.setReconnectAttempts(reconnectAttempts);
// Create reference
Reference ref = JNDIReferenceFactory.createReference(factory.getClass().getName(), factory);
// Get object created based on reference
ActiveMQConnectionFactory temp;
JNDIReferenceFactory refFactory = new JNDIReferenceFactory();
temp = (ActiveMQConnectionFactory)refFactory.getObjectInstance(ref, null, null, null);
// Check settings
Assert.assertEquals(clientID, temp.getClientID());
Assert.assertEquals(user, temp.getUser());
Assert.assertEquals(password, temp.getPassword());
Assert.assertEquals(clientFailureCheckPeriod, temp.getClientFailureCheckPeriod());
Assert.assertEquals(connectionTTL, temp.getConnectionTTL());
Assert.assertEquals(callTimeout, temp.getCallTimeout());
Assert.assertEquals(minLargeMessageSize, temp.getMinLargeMessageSize());
Assert.assertEquals(consumerWindowSize, temp.getConsumerWindowSize());
Assert.assertEquals(consumerMaxRate, temp.getConsumerMaxRate());
Assert.assertEquals(confirmationWindowSize, temp.getConfirmationWindowSize());
Assert.assertEquals(producerMaxRate, temp.getProducerMaxRate());
Assert.assertEquals(blockOnAcknowledge, temp.isBlockOnAcknowledge());
Assert.assertEquals(blockOnDurableSend, temp.isBlockOnDurableSend());
Assert.assertEquals(blockOnNonDurableSend, temp.isBlockOnNonDurableSend());
Assert.assertEquals(autoGroup, temp.isAutoGroup());
Assert.assertEquals(preAcknowledge, temp.isPreAcknowledge());
Assert.assertEquals(loadBalancingPolicyClassName, temp.getConnectionLoadBalancingPolicyClassName());
Assert.assertEquals(useGlobalPools, temp.isUseGlobalPools());
Assert.assertEquals(scheduledThreadPoolMaxSize, temp.getScheduledThreadPoolMaxSize());
Assert.assertEquals(threadPoolMaxSize, temp.getThreadPoolMaxSize());
Assert.assertEquals(retryInterval, temp.getRetryInterval());
Assert.assertEquals(retryIntervalMultiplier, temp.getRetryIntervalMultiplier(), 0.0001);
Assert.assertEquals(reconnectAttempts, temp.getReconnectAttempts());
}
@Test(timeout = 1000)
public void testDestination() throws Exception {
// Create sample destination
ActiveMQDestination dest = (ActiveMQDestination) ActiveMQJMSClient.createQueue(RandomUtil.randomString());
// Create reference
Reference ref = JNDIReferenceFactory.createReference(dest.getClass().getName(), dest);
// Get object created based on reference
ActiveMQDestination temp;
JNDIReferenceFactory refFactory = new JNDIReferenceFactory();
temp = (ActiveMQDestination)refFactory.getObjectInstance(ref, null, null, null);
// Check settings
assertEquals(dest.getAddress(), temp.getAddress());
}
}
|
[
"clebertsuconic@apache.org"
] |
clebertsuconic@apache.org
|
3b9d08646296693855e338d91df5b647352e0b50
|
0d8614f0710189abc7203de655fa947e9776e981
|
/app/src/main/java/com/example/lfy/basicframes/utill/status/BarConfig.java
|
f27b226319c98107fbeb97721cea5a6fc0cadfdd
|
[] |
no_license
|
lifuyuan123/BasicFrames
|
82a86dc3406dcaf6078fddca73a9d43568ef658e
|
8608f34214ff80f56c94d24e4f37a876201433ea
|
refs/heads/master
| 2021-05-06T03:06:02.126445
| 2018-02-01T09:03:42
| 2018-02-01T09:03:42
| 114,740,133
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,124
|
java
|
package com.example.lfy.basicframes.utill.status;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.ViewConfiguration;
import java.lang.reflect.Method;
/**
* Created by LiaoDuanHong on 2017/7/10.
*/
class BarConfig {
private static final String STATUS_BAR_HEIGHT_RES_NAME = "status_bar_height";
private static final String NAV_BAR_HEIGHT_RES_NAME = "navigation_bar_height";
private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape";
private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width";
private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar";
private static String sNavBarOverride;
private final int mStatusBarHeight;
private final int mActionBarHeight;
private final boolean mHasNavigationBar;
private final int mNavigationBarHeight;
private final int mNavigationBarWidth;
private final boolean mInPortrait;
private final float mSmallestWidthDp;
static {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
try {
Class c = Class.forName("android.os.SystemProperties");
Method m = c.getDeclaredMethod("get", String.class);
m.setAccessible(true);
sNavBarOverride = (String) m.invoke(null, "qemu.hw.mainkeys");
} catch (Throwable e) {
sNavBarOverride = null;
}
}
}
public BarConfig(Activity activity) {
Resources res = activity.getResources();
mInPortrait = (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT);
mSmallestWidthDp = getSmallestWidthDp(activity);
mStatusBarHeight = getInternalDimensionSize(res, STATUS_BAR_HEIGHT_RES_NAME);
mActionBarHeight = getActionBarHeight(activity);
mNavigationBarHeight = getNavigationBarHeight(activity);
mNavigationBarWidth = getNavigationBarWidth(activity);
mHasNavigationBar = (mNavigationBarHeight > 0);
}
@TargetApi(14)
private int getActionBarHeight(Context context) {
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
TypedValue tv = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true);
result = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
}
return result;
}
@TargetApi(14)
private int getNavigationBarHeight(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
String key;
if (mInPortrait) {
key = NAV_BAR_HEIGHT_RES_NAME;
} else {
key = NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME;
}
return getInternalDimensionSize(res, key);
}
}
return result;
}
@TargetApi(14)
private int getNavigationBarWidth(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (hasNavBar(context)) {
return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
}
}
return result;
}
@TargetApi(14)
private boolean hasNavBar(Context context) {
Resources res = context.getResources();
int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
if (resourceId != 0) {
boolean hasNav = res.getBoolean(resourceId);
// check override flag (see static block)
if ("1".equals(sNavBarOverride)) {
hasNav = false;
} else if ("0".equals(sNavBarOverride)) {
hasNav = true;
}
return hasNav;
} else { // fallback
return !ViewConfiguration.get(context).hasPermanentMenuKey();
}
}
private int getInternalDimensionSize(Resources res, String key) {
int result = 0;
int resourceId = res.getIdentifier(key, "dimen", "android");
if (resourceId > 0) {
result = res.getDimensionPixelSize(resourceId);
}
return result;
}
@SuppressLint("NewApi")
private float getSmallestWidthDp(Activity activity) {
DisplayMetrics metrics = new DisplayMetrics();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
activity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
} else {
// TODO this is not correct, but we don't really care pre-kitkat
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
}
float widthDp = metrics.widthPixels / metrics.density;
float heightDp = metrics.heightPixels / metrics.density;
return Math.min(widthDp, heightDp);
}
/**
* Should a navigation bar appear at the bottom of the screen in the current
* device configuration? A navigation bar may appear on the right side of
* the screen in certain configurations.
*
* @return True if navigation should appear at the bottom of the screen, False otherwise.
*/
public boolean isNavigationAtBottom() {
return (mSmallestWidthDp >= 600 || mInPortrait);
}
/**
* Get the height of the system status bar.
*
* @return The height of the status bar (in pixels).
*/
public int getStatusBarHeight() {
return mStatusBarHeight;
}
/**
* Get the height of the action bar.
*
* @return The height of the action bar (in pixels).
*/
public int getActionBarHeight() {
return mActionBarHeight;
}
/**
* Does this device have a system navigation bar?
*
* @return True if this device uses soft key navigation, False otherwise.
*/
public boolean hasNavigtionBar() {
return mHasNavigationBar;
}
/**
* Get the height of the system navigation bar.
*
* @return The height of the navigation bar (in pixels). If the device does not have
* soft navigation keys, this will always return 0.
*/
public int getNavigationBarHeight() {
return mNavigationBarHeight;
}
/**
* Get the width of the system navigation bar when it is placed vertically on the screen.
*
* @return The width of the navigation bar (in pixels). If the device does not have
* soft navigation keys, this will always return 0.
*/
public int getNavigationBarWidth() {
return mNavigationBarWidth;
}
}
|
[
"lifuyuan123"
] |
lifuyuan123
|
f9e58493a4bdc45b470e7021bd9f39dc0c11ef03
|
0af8b92686a58eb0b64e319b22411432aca7a8f3
|
/large-multiproject/project21/src/test/java/org/gradle/test/performance21_1/Test21_93.java
|
89470f08dd7820407ee3ce5f4a69e2388dfdd2cc
|
[] |
no_license
|
gradle/performance-comparisons
|
b0d38db37c326e0ce271abebdb3c91769b860799
|
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
|
refs/heads/master
| 2023-08-14T19:24:39.164276
| 2022-11-24T05:18:33
| 2022-11-24T05:18:33
| 80,121,268
| 17
| 15
| null | 2022-09-30T08:04:35
| 2017-01-26T14:25:33
| null |
UTF-8
|
Java
| false
| false
| 289
|
java
|
package org.gradle.test.performance21_1;
import static org.junit.Assert.*;
public class Test21_93 {
private final Production21_93 production = new Production21_93("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
}
|
[
"cedric.champeau@gmail.com"
] |
cedric.champeau@gmail.com
|
62e31aff0a1ff07f59d42cba0a0a69ae3a094644
|
389d9671f65236138b5a51c2c1404f173bd22916
|
/UIautomation/src/main/java/com/gl/automation/utilities/BrowserFactory.java
|
387d41667a10fc0b29995f0b788f7a01696aabd8
|
[] |
no_license
|
mohitb01/UIautomation
|
d64e295032d27d296034561d9e1a80dd7a1d91d7
|
7de591f684612153790a8a8ecc3a960dbb9e22b2
|
refs/heads/master
| 2022-07-26T08:33:05.495420
| 2020-03-15T14:25:29
| 2020-03-15T14:25:29
| 244,977,419
| 0
| 0
| null | 2022-06-29T17:59:59
| 2020-03-04T18:43:43
|
Java
|
UTF-8
|
Java
| false
| false
| 1,901
|
java
|
package com.gl.automation.utilities;
/*
* author : Mohit Bhatt
* Date :
*/
import java.util.HashMap;
import java.util.Map;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import com.gl.automation.resources.Constants;
public class BrowserFactory {
private static Map<String, WebDriver> drivers = new HashMap<String, WebDriver>();
/*
* Factory method for getting browsers
*/
public static WebDriver getBrowser(String browserName) {
WebDriver driver = null;
switch (browserName) {
case "Firefox":
driver = drivers.get("Firefox");
if (driver == null) {
System.setProperty("webdriver.gecko.driver",
Constants.Path_GECKO);
driver = new FirefoxDriver();
drivers.put("Firefox", driver);
}
break;
case "IE":
driver = drivers.get("IE");
if (driver == null) {
System.setProperty("webdriver.ie.driver",
Constants.Path_IEDRIVER);
driver = new InternetExplorerDriver();
drivers.put("IE", driver);
}
break;
case "Chrome":
driver = drivers.get("Chrome");
if (driver == null) {
System.setProperty("webdriver.chrome.driver",
Constants.Path_CHROMEDRIVER);
driver = new ChromeDriver();
drivers.put("Chrome", driver);
}
break;
}
return driver;
}
public static void closeAllDriver() {
for (String key : drivers.keySet()) {
drivers.get(key).close();
drivers.get(key).quit();
}
}
}
|
[
"mohit.bhatt@pearson.com"
] |
mohit.bhatt@pearson.com
|
374e721ae78e5119adfbd8b1e92cc1fd1ebc17e8
|
efd813d0096a4f8b66e6ce1d4defd2fde74585c6
|
/src/main/java/br/edu/ulbra/election/election/api/v1/ElectionApi.java
|
096db5327df0da1b9297dd6676f972c4adceba7a
|
[] |
no_license
|
BDOMORAESULBRA/Election
|
cd769fc44c508794fd86c90f3ea8c9cd64a8a75f
|
3af514f015d4b6768eb77bff8c295f59e8c558a6
|
refs/heads/master
| 2020-04-04T08:05:15.154728
| 2018-11-30T19:15:12
| 2018-11-30T19:15:12
| 155,770,689
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,865
|
java
|
package br.edu.ulbra.election.election.api.v1;
import br.edu.ulbra.election.election.service.ElectionService;
import br.edu.ulbra.election.election.input.v1.ElectionInput;
import br.edu.ulbra.election.election.output.v1.ElectionOutput;
import br.edu.ulbra.election.election.output.v1.GenericOutput;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/v1/election")
public class ElectionApi {
private final ElectionService electionService;
@Autowired
public ElectionApi(ElectionService electionService) {
this.electionService = electionService;
}
@GetMapping("/")
@ApiOperation(value = "Get election List")
public List<ElectionOutput> getAll() {
return electionService.getAll();
}
@GetMapping("/year/{year}")
@ApiOperation(value = "Get election List by year")
public List<ElectionOutput> getByYear(@PathVariable Integer year) {
return electionService.getByYear(year);
}
@GetMapping("/{electionId}")
@ApiOperation(value = "Get election by Id")
public ElectionOutput getById(@PathVariable Long electionId) {
return electionService.getById(electionId);
}
@PostMapping("/")
@ApiOperation(value = "Create new election")
public ElectionOutput create(@RequestBody ElectionInput electionInput) {
return electionService.create(electionInput);
}
@PutMapping("/{electionId}")
@ApiOperation(value = "Update election")
public ElectionOutput update(@PathVariable Long electionId, @RequestBody ElectionInput electionInput) {
return electionService.update(electionId, electionInput);
}
@DeleteMapping("/{electionId}")
@ApiOperation(value = "Delete election")
public GenericOutput delete(@PathVariable Long electionId) {
return electionService.delete(electionId);
}
}
|
[
"bruno.delcio@ulbra.inf.br"
] |
bruno.delcio@ulbra.inf.br
|
b0cd4ddf0ae77efd73d3f76386a7b660550eace0
|
25de7b89ca23f156bb2247fa4823c957dec308ac
|
/jk_export/src/cn/itcast/export/webservice/EpService.java
|
be27504c53e45e791cb890600ede19d14aae7348
|
[] |
no_license
|
eastboom/mytest
|
512f8eb77d126573e158eec9b893ae0f46e79dcc
|
24725ba03bc16b9ad9e20b50ff56b948cf54c04b
|
refs/heads/master
| 2020-03-16T06:04:59.429738
| 2018-05-08T02:40:44
| 2018-05-08T02:40:44
| 132,546,838
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,227
|
java
|
package cn.itcast.export.webservice;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.springframework.beans.BeanUtils;
import com.alibaba.fastjson.JSON;
import cn.itcast.export.domain.Export;
import cn.itcast.export.domain.ExportProduct;
import cn.itcast.export.service.ExportProductService;
import cn.itcast.export.service.ExportService;
import cn.itcast.export.vo.ExportProductResult;
import cn.itcast.export.vo.ExportResult;
import cn.itcast.export.vo.ExportVo;
public class EpService implements IEpService {
private ExportService exportService;
private ExportProductService exportProductService;
public void setExportService(ExportService exportService) {
this.exportService = exportService;
}
public void setExportProductService(ExportProductService exportProductService) {
this.exportProductService = exportProductService;
}
//实现报运单的数据保存
public void exportE(ExportVo exportVo) throws Exception {
Export export = new Export();
org.springframework.beans.BeanUtils.copyProperties(exportVo, export);
System.out.println(JSON.toJSONString(export));
Set<ExportProduct> epSet = export.getProducts();
exportService.saveOrUpdate(export);
for (ExportProduct ep : epSet) {
ExportProduct epObj = new ExportProduct();
BeanUtils.copyProperties(ep, epObj);
exportProductService.saveOrUpdate(epObj);
}
}
//实现报运单信息的查询,并响应给Webservice客户端
public ExportResult getResult(String id) throws Exception {
Export result = exportService.get(Export.class, id);
ExportResult exportR = new ExportResult();
exportR.setExportId(result.getExportId());
exportR.setState(2);
exportR.setRemark("报运成功");
Set<ExportProductResult> epResult = new HashSet<ExportProductResult>();
double i = 1;
List<ExportProduct> epList = exportProductService.find("from ExportProduct where exportId=?",
ExportProduct.class,new String[] { id });
for (ExportProduct ep : epList) {
ExportProductResult eprObj = new ExportProductResult();
eprObj.setExportProductId(ep.getExportProductId());
eprObj.setTax(10 + (i++) * 0.4);
epResult.add(eprObj);
}
exportR.setProducts(epResult);
return exportR;
}
}
|
[
"3306283447@qq.com"
] |
3306283447@qq.com
|
3c65700bf36757bb2ed61b21a373080ff859e63b
|
2252763a7be3152dbcaf4aff12c4cb2bf2cd577b
|
/src/java/com/nomis/ovc/legacydatamanagement/business/LegacyOvcWithdrawal.java
|
4f9f0dfcc3cce8e0ccc30217c85beaed9c1d3e3e
|
[] |
no_license
|
ccharlex/nomis3
|
c9a3ed101bed3b4352343b6b513b711dd0104c85
|
dfa73b2f63d25c54fe6fd18921f751985829d4ae
|
refs/heads/master
| 2023-03-21T14:22:51.827506
| 2020-12-13T23:28:22
| 2020-12-13T23:28:22
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,449
|
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.nomis.ovc.legacydatamanagement.business;
import java.io.Serializable;
/**
*
* @author HP USER
*/
public class LegacyOvcWithdrawal implements Serializable {
public LegacyOvcWithdrawal()
{
}
private String ovcId;
private String dateOfWithdrawal;
private String reasonWithdrawal;
private String type;
private int surveyNumber;
private int markedForDelete;
public String getOvcId() {
return ovcId;
}
public void setOvcId(String ovcId) {
this.ovcId = ovcId;
}
public String getDateOfWithdrawal() {
return dateOfWithdrawal;
}
public void setDateOfWithdrawal(String dateOfWithdrawal) {
this.dateOfWithdrawal = dateOfWithdrawal;
}
public String getReasonWithdrawal() {
return reasonWithdrawal;
}
public void setReasonWithdrawal(String reasonWithdrawal) {
this.reasonWithdrawal = reasonWithdrawal;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getSurveyNumber() {
return surveyNumber;
}
public void setSurveyNumber(int surveyNumber) {
this.surveyNumber = surveyNumber;
}
public int getMarkedForDelete() {
return markedForDelete;
}
public void setMarkedForDelete(int markedForDelete) {
this.markedForDelete = markedForDelete;
}
}
|
[
"smomoh@ahnigeria.org"
] |
smomoh@ahnigeria.org
|
abb35c7771ac6820f6743913167daf6f412f3b68
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/13/13_240d35a9a89492542c54fabc8d0f5af80b4bd41d/UserDAOImpl/13_240d35a9a89492542c54fabc8d0f5af80b4bd41d_UserDAOImpl_s.java
|
08de518a23eba859b7a52e91e1f1fd6a3df9c658
|
[] |
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
| 21,511
|
java
|
package com.nearme;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import javax.sql.DataSource;
import org.apache.log4j.Logger;
public class UserDAOImpl implements UserDAO {
private static Logger logger = Logger.getLogger(UserDAOImpl.class);
/* In the real world I'd be using an ORM here, but that feels like one too many things
* to shove at the team during this project.
*
* Actually I'd probably write the thing in Groovy or Perl, but that'd be even crueller.
*
* TODO: wrap these big sets of queries in transactions.
* And check the database is set up to use them...
*/
private static final String READ_ID_SQL = "SELECT user.*, idHash.hash FROM user,idHash WHERE user.id = ? AND idHash.id = user.hashId";
private static final String READ_HASH_SQL = "SELECT user.*, idHash.hash FROM user,idHash WHERE idHash.hash = ? AND idHash.id = user.hashId";
private static final String READ_DEVICE_SQL = "SELECT user.*, idHash.hash FROM user,idHash WHERE user.deviceId = ? AND idHash.id = user.hashId";
private static final String READ_AB_SQL = "SELECT ab.id, ab.name, ab.permission, ih.id, ih.hash FROM addressBook ab, addressBookHashMatcher abhm, idHash ih WHERE ab.ownerId = ? AND abhm.addressBookId = ab.id AND abhm.hashId = ih.id ORDER BY ab.name";
private static final String NEAREST_SQL = "SELECT u.id, ab.name, u.latitude, u.longitude, ( 6371 * acos( cos( radians(?) ) * cos( radians( u.latitude ) ) * cos( radians( u.longitude ) - radians(?) ) + sin( radians(?) ) * sin( radians( u.latitude ) ) ) ) AS distance, abhm.* FROM user u, addressBook ab, addressBookHashMatcher abhm WHERE ab.ownerId = ? AND abhm.addressBookId = ab.id AND abhm.hashId = u.hashId AND u.id IN (/* All those who have user with the supplied hash in their address book with permission > 0 */ SELECT distinct ab.ownerId FROM addressBook ab, addressBookHashMatcher abhm, idHash ih WHERE ih.hash = ? AND abhm.hashId = ih.id AND abhm.addressBookId = ab.id AND ab.permission > 0 ) HAVING distance < ? ORDER BY distance";
private static final String USER_INSERT_SQL = "INSERT INTO user (deviceId, hashId, latitude, longitude, lastReport) VALUES (?,?,?,?,?)";
private static final String USER_UPDATE_POSITION_SQL = "UPDATE user SET latitude = ?, longitude = ?, lastReport = ? WHERE id = ?";
private static final String USER_UPDATE_IDHASH_SQL = "UPDATE user SET hashId = ? WHERE id = ?";
private static final String IDHASH_FIND_SQL = "SELECT id FROM idHash WHERE hash = ?";
private static final String IDHASH_INSERT_SQL = "INSERT INTO idHash (hash) VALUES (?)";
private static final String BOOK_DELETE_SQL = "DELETE FROM addressBook WHERE ownerId = ?";
private static final String HASHMATCH_DELETE_SQL = "DELETE ah.* from addressBookHashMatcher ah, addressBook ab WHERE ab.ownerId = ? AND ah.addressBookId = ab.id";
private static final String BOOK_INSERT_SQL = "INSERT INTO addressBook (ownerId, name, permission) VALUES (?,?,?)";
private static final String MATCH_INSERT_SQL = "INSERT INTO addressBookHashMatcher (hashId, addressBookId) VALUES (?,?)";
private static final String IDHASH_LIST_SQL = "SELECT ih.id, ih.hash from addressBook ab, addressBookHashMatcher hm, idHash ih WHERE ih.id = hm.hashId AND hm.addressBookId = ab.id and ab.ownerId = ? AND ab.permission = ?";
private static final String PERMS_RESET_SQL = "UPDATE addressBook SET permission = ? WHERE ownerId = ?";
private static final String PERMS_UPDATE_SQL = "UPDATE addressBook ab SET permission = ? WHERE ownerID = ? AND id IN (SELECT abhm.addressBookId FROM addressBookHashMatcher abhm, idHash h WHERE abhm.hashId = h.id AND h.hash IN (?,?,?,?,?,?,?,?,?,?))";
private static final String USER_DELETE_SQL = "DELETE FROM user WHERE id = ?";
/* See the comment for setPermissions() to understand what this is, and why it needs to match the
* number of question-marks in the subquery of PERMS_UPDATE_SQL
*/
private static final int PERM_UPDATE_COUNT = 10;
private DataSource dataSource = null;
public UserDAOImpl(DataSource d) {
this.dataSource = d;
}
/**
* Read a User from the database, identified by their unique ID
*/
@Override
public User read(int i) throws SQLException {
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
pst = c.prepareStatement(READ_ID_SQL);
pst.setInt(1, i);
rs = pst.executeQuery();
if (rs.next()) return userFrom(rs);
else return null;
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
/**
* Helper method, takes a ResultSet and returns the first User from it
*
* @param rs
* @return
* @throws SQLException
*/
private User userFrom(ResultSet rs) throws SQLException {
User u = new User(rs.getInt("user.id"),
rs.getString("user.deviceId"),
rs.getString("idHash.hash"));
if (rs.getTimestamp("user.lastReport")!=null)
u.setLastPosition(new Position(rs.getDouble("user.latitude"), rs.getDouble("user.longitude"), new java.util.Date(rs.getTimestamp("user.lastReport").getTime())));
return u;
}
/**
* Read a User from the database, identified by the Hash of their MSISDN
*/
public User readByHash(String string) throws SQLException {
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
pst = c.prepareStatement(READ_HASH_SQL);
pst.setString(1, string);
rs = pst.executeQuery();
if (rs.next()) return userFrom(rs);
else return null;
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
/**
* Read a User from the database, identified by their unique device ID
*/
@Override
public User readByDeviceId(String string) throws SQLException {
Connection c = null;
PreparedStatement pst = null;
try {
c = dataSource.getConnection();
pst = c.prepareStatement(READ_DEVICE_SQL);
pst.setString(1, string);
ResultSet rs = pst.executeQuery();
if (rs.next()) return userFrom(rs);
else return null;
} finally {
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
/**
* Read the address book for a user from the database, identified by their unique ID
*/
@Override
public List<AddressBookEntry> getAddressBook(int i) throws SQLException {
User u = read(i);
if (u==null) return null;
Connection c = null;
PreparedStatement pst = null;
ArrayList<AddressBookEntry> ret = new ArrayList<AddressBookEntry>();
try {
c = dataSource.getConnection();
pst = c.prepareStatement(READ_AB_SQL);
pst.setInt(1, i);
ResultSet rs = pst.executeQuery();
int lastId = -1;
AddressBookEntry abe = null;
ArrayList<IdentityHash> hashes = null;
while (rs.next()) {
// rows of ab.id, ab.name, ab.permission, ih.id, ih.hash
IdentityHash ih = new IdentityHash(rs.getInt("ih.id"), rs.getString("ih.hash"));
if (rs.getInt("ab.id")!=lastId) {
hashes = new ArrayList<IdentityHash>();
abe = new AddressBookEntry(rs.getInt("ab.id"), u, rs.getString("ab.name"), rs.getInt("ab.permission"), hashes);
ret.add(abe);
}
hashes.add(ih);
lastId = rs.getInt("ab.id");
}
} finally {
if (pst!=null) pst.close();
if (c!=null) c.close();
}
return ret;
}
@Override
public List<Poi> getNearestUsers(User u, int radius) throws SQLException {
List<Poi> ret = new ArrayList<Poi>();
if (u==null) {
logger.debug("getNearestUsers() u=null,radius="+radius);
return ret; /* By definition we have no nearby friends for users we don't know! */
}
if (u.getLastPosition()==null) {
logger.debug("getNearestUsers() u="+u.getId()+",lastPosition=null,radius="+radius);
return ret; /* By definition we have no nearby friends for users we don't know a last position for */
}
logger.debug("getNearestUsers() lat="+u.getLastPosition().getLatitude()+",long="+u.getLastPosition().getLongitude()+",id="+u.getId()+",radius="+radius);
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
pst = c.prepareStatement(NEAREST_SQL);
pst.setDouble(1, u.getLastPosition().getLatitude());
pst.setDouble(2, u.getLastPosition().getLongitude());
pst.setDouble(3, u.getLastPosition().getLatitude());
pst.setInt(4, u.getId());
pst.setString(5,u.getMsisdnHash());
pst.setDouble(6, ((float) radius/ (float) 1000));
rs = pst.executeQuery();
while (rs.next()) {
/**
* OK, this makes me feel dirty. For each result here we're going to look up the smudge factor they have given us, and apply it
* to the location before sending out said location.
*
* This is bad because it's inefficient: a nested query. In practice, for a project of this scale it'll be unnoticeable,
* so in the interests of avoiding premature optimisation, I've done it.
*
* Possible improvements:
* 1. assume that most users won't have a smudge factor of >1, and do two queries: one to find the majority with permissions=1, and another to get the others
* 2. do it all in SQL, somehow, which will mean passing a value from that subquery out to the outer query... brrr.
*/
// int smudgeFactor = lookupSmudgeFactorBetween(rs.getInt("ab.id"));
Poi p = new Poi(rs.getString("ab.name"), rs.getDouble("u.latitude"), rs.getDouble("u.longitude"), PoiType.FRIEND, 0);
ret.add(p);
}
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
return ret;
}
/**
* Look up by how much we should smudge the location of the user in the address book of user userId
* with the addressBookId of abId
*
* @param userId
* @param abId
* @return
*/
// private int getSmudgeFactorBetween(int abId) {
// return 0;
// }
/**
* Writes the given User into the database, either inserting or updating, depending on whether a
* record for them already exists.
*/
@Override
public User write(User u) throws SQLException {
User exists = readByDeviceId(u.getDeviceId());
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
/* If the User exists, we must:
* 1. If there's a lat and long in the User passed in, update the lat, long and time of their last position report, otherwise do nothing.
* 2. If their MSISDN IdentityHash has changed,
* 2a. Either look to see if it's changed to something in our database, and get the ID of that something, or
* 2b. If it's completely new, add it and get its ID, then
* 2c. Update the hashId of their user record to point to this new IdentityHash
*
* It's meaningless to update their deviceId, as it's the way we found them.
*/
if (exists!=null) {
logger.debug("write() user already exists");
if ((u.getLastPosition()!=null) && (!u.getLastPosition().equals(exists.getLastPosition()))) {
logger.debug("write() updating last known position");
pst = c.prepareStatement(USER_UPDATE_POSITION_SQL);
pst.setDouble(1, u.getLastPosition().getLatitude());
pst.setDouble(2, u.getLastPosition().getLongitude());
pst.setTimestamp(3, new Timestamp(u.getLastPosition().getWhen().getTime()));
pst.setInt(4, exists.getId());
pst.executeUpdate();
pst.close();
} else
logger.debug("write() no position updated; null or unchanged, old="+exists.getLastPosition()+",current="+u.getLastPosition());
if (!u.getMsisdnHash().equals(exists.getMsisdnHash())) {
/* update the ID hash to this new value */
int idHash = findOrCreateIdHash(c, u.getMsisdnHash());
pst = c.prepareStatement(USER_UPDATE_IDHASH_SQL);
pst.setInt(1, idHash);
pst.setInt(2, exists.getId());
pst.executeUpdate();
pst.close();
}
u.setId(exists.getId());
} else {
/* Otherwise, this is a new user, so
*
* 1. Add their idHash if necessary, getting its ID
* 2. Add a User record for them
* 3. Get the ID of this User record, and update the User passed in with it
*/
int idHash = findOrCreateIdHash(c, u.getMsisdnHash());
pst = c.prepareStatement(USER_INSERT_SQL, Statement.RETURN_GENERATED_KEYS);
pst.setString(1, u.getDeviceId());
pst.setInt(2, idHash);
if (u.getLastPosition()!=null) {
pst.setDouble(3, u.getLastPosition().getLatitude());
pst.setDouble(4, u.getLastPosition().getLongitude());
pst.setTimestamp(5, new Timestamp(u.getLastPosition().getWhen().getTime()));
} else {
pst.setNull(3, Types.DOUBLE);
pst.setNull(4, Types.DOUBLE);
pst.setNull(5, Types.TIMESTAMP);
}
pst.executeUpdate();
/* If they've just been added to the database for the first time, it will
* have allocated them an ID number automatically. Fetch this and set
* the ID class variable to it
*/
rs = pst.getGeneratedKeys();
if (rs.next()) u.setId(rs.getInt(1));
}
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
return u;
}
/**
* Give an idHash and a Connection, finds the hash in the database and returns its ID,
* or if it isn't there, adds it and returns its ID.
*
* @param c
* @param hash
* @return
* @throws SQLException
*/
private int findOrCreateIdHash(Connection c, String hash) throws SQLException {
PreparedStatement pst = null;
ResultSet rs = null;
try {
pst = c.prepareStatement(IDHASH_FIND_SQL);
pst.setString(1, hash);
rs = pst.executeQuery();
if (rs.next()) return rs.getInt(1);
rs.close();
pst.close();
pst = c.prepareStatement(IDHASH_INSERT_SQL, Statement.RETURN_GENERATED_KEYS);
pst.setString(1, hash);
pst.executeUpdate();
rs = pst.getGeneratedKeys();
if (rs.next()) return rs.getInt(1);
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
}
// It should be impossible to reach this point
throw new RuntimeException("couldn't add an IdentityHash");
}
private void deleteAddressBook(Connection c, int userId) throws SQLException {
PreparedStatement pst = null;
try {
/* Delete all entries for this addressBook from the addressBookHashMatcher table */
pst = c.prepareStatement(HASHMATCH_DELETE_SQL);
pst.setInt(1, userId);
pst.executeUpdate();
/* Delete all entries for this user from the addressBook table */
pst = c.prepareStatement(BOOK_DELETE_SQL);
pst.setInt(1, userId);
pst.executeUpdate();
} finally {
if (pst!=null) pst.close();
}
}
@Override
public boolean setAddressBook(int id, List<AddressBookEntry> book) throws SQLException {
/* No such user? Not a valid request, so return false */
User u = read(id);
if (u==null) return false;
PreparedStatement pst = null;
ResultSet rs = null;
Connection c = null;
/* If they exist, delete their old address book and any orphaned hashes;
* If this were a real-world app I'd consider this kind of approach kludgy;
* a proper syncing mechanism would be quicker for migrating small changes
* from client to server, and would minimise load on the database. But I
* think that would be overcomplicating the app, in this case.
*
* This will be a *very* expensive operation - oodles of queries generated.
* The good news is that it should be done only infrequently, but even so
* I would definitely look to optimise this heavily "in the wild".
*/
try {
c = dataSource.getConnection();
deleteAddressBook(c, u.getId());
/* For each new AddressBookEntry to be added
* - create an entry in the AddressBook table
* - for each hash for this entry
* -- create it in the idHash table if necessary
* -- create an entry linking it to the addressBook row in the addressBookHashMatcher table
*/
for (AddressBookEntry entry: book) {
/* Add an entry into the AddressBook table */
pst = c.prepareStatement(BOOK_INSERT_SQL, Statement.RETURN_GENERATED_KEYS);
pst.setInt(1, u.getId());
pst.setString(2, entry.getName());
pst.setInt(3, entry.getPermission());
pst.executeUpdate();
/* Look up the unique ID for the entry we just added - we need this */
rs = pst.getGeneratedKeys();
int addressBookId = -1;
if (rs.next()) addressBookId = rs.getInt(1);
else throw new RuntimeException("Never received insert_id when adding book");
rs.close();
pst.close();
for (IdentityHash hash: entry.getHashes()) {
if (hash.getHash()==null) {
logger.warn("Received null hash");
} else {
int hashId = findOrCreateIdHash(c, hash.getHash());
pst = c.prepareStatement(MATCH_INSERT_SQL, Statement.RETURN_GENERATED_KEYS);
pst.setInt(1, hashId);
pst.setInt(2, addressBookId);
pst.executeUpdate();
pst.close();
}
}
}
/* Finally, there may be hashes which used to be used, but no longer are
* (if, for instance, the user has deleted a contact from their address
* book). Remove these from the database.
*/
//TODO Add this bit in. It's a tidy-up rather than essential, mind
/*
*
*
pst = c.prepareStatement(IDHASH_DELETE_ORPHAN_SQL);
pst.setInt(1, u.getId());
pst.executeUpdate();
pst.close();
*/
return true;
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
@Override
public List<IdentityHash> getPermissions(User u) throws SQLException {
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
pst = c.prepareStatement(IDHASH_LIST_SQL);
pst.setInt(1, u.getId());
pst.setInt(2, AddressBookEntry.PERM_SHOWN);
rs = pst.executeQuery();
List<IdentityHash> ret = new ArrayList<IdentityHash>();
while (rs.next()) {
ret.add(new IdentityHash(rs.getInt(1), rs.getString(2)));
}
return ret;
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
public boolean setPermissions(User u, String[] perms) throws SQLException {
Connection c = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
c = dataSource.getConnection();
/* We wrap this whole operation in a transaction. This means that we can roll back the "resetting of permissions"
* if it turns out that we're not making any changes further down the line
*/
c.setAutoCommit(false);
/* First, set all permissions for this user to HIDDEN */
pst = c.prepareStatement(PERMS_RESET_SQL);
pst.setInt(1, AddressBookEntry.PERM_HIDDEN);
pst.setInt(2, u.getId());
int rows = pst.executeUpdate();
pst.close();
logger.debug("setPermissions reset " + rows);
/* Then, mark the ones we're interested in. This is more involved than it ought to be,
* because the MySQL JDBC drivers don't let use use the setArray() method on a PreparedStatement
* to pass in an array of stuff.
*
* Instead, we have to have a query with an IN(?,?,?,?,?) clause and set each one of those
* substitutions to be null, or one of our values from our array... and then loop around
* because, of course, we may have more friends to share with than are allowed for in that clause.
* I kid you not.
* */
pst = c.prepareStatement(PERMS_UPDATE_SQL);
pst.setInt(1, AddressBookEntry.PERM_SHOWN);
pst.setInt(2, u.getId());
rows = 0;
for (int i=0; i<perms.length; i+= PERM_UPDATE_COUNT) {
for (int j=0; j<PERM_UPDATE_COUNT; j++) {
if (i+j<perms.length) {
logger.debug("set parameter " + (j+3) + " to hash " + (i+j));
pst.setString(j+3, perms[i+j]);
} else {
logger.debug("set parameter " + (j+3) + " to null");
pst.setString(j+3, null);
}
}
rows += pst.executeUpdate();
logger.debug("setPermissions updated " + rows);
}
if ((perms.length>0) && (rows==0)) return false; // the IdentityHash we were given wasn't linked to this user
c.commit();
c.setAutoCommit(true); // reset this to its usual setting
return true;
} finally {
if (rs!=null) rs.close();
if (pst!=null) pst.close();
if (c!=null) c.close();
}
}
@Override
public void deleteUser(User u) throws SQLException {
Connection c = dataSource.getConnection();
PreparedStatement pst = null;
try {
deleteAddressBook(c, u.getId());
pst = c.prepareStatement(USER_DELETE_SQL);
pst.setInt(1, u.getId());
pst.executeUpdate();
} finally {
if (pst!=null) pst.close();
}
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
cbc171bc36abd2b42a5eb6eab35b073c6cf925ef
|
de7b67d4f8aa124f09fc133be5295a0c18d80171
|
/workspace_jvms7/jvms7/src/main/java/three/twelve/Test.java
|
fa868696163a3914d780e835936b22f385b7294a
|
[] |
no_license
|
lin-lee/eclipse_workspace_test
|
adce936e4ae8df97f7f28965a6728540d63224c7
|
37507f78bc942afb11490c49942cdfc6ef3dfef8
|
refs/heads/master
| 2021-05-09T10:02:55.854906
| 2018-01-31T07:19:02
| 2018-01-31T07:19:02
| 119,460,523
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 702
|
java
|
package three.twelve;
public class Test {
void cantBeZero(int i) throws Exception {
if (i == 0) {
throw new Exception();
}
}
void tryItOut() throws Exception{
}
void handleExc(Exception e){
}
void catchOne() {
try {
tryItOut();
} catch (Exception e) {
handleExc(e);
}
}
void catchTwo() {
try {
tryItOut();
} catch (NullPointerException e) {
handleExc(e);
} catch (IndexOutOfBoundsException e) {
handleExc(e);
} catch (Exception e) {
e.printStackTrace();
}
}
void nestedCatch() {
try {
try {
tryItOut();
} catch (NullPointerException e) {
handleExc(e);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
[
"lilin@lvmama.com"
] |
lilin@lvmama.com
|
76f6f1e1f207f3a1c8bf42b6a8635638aec5dff8
|
e43150a6125c4b11a9ee2e184c74cbd1834dfea7
|
/src/main/java/me/strongwhisky/app/day32/runner/AppRunner.java
|
d518cbe2632c15952ff40c9184652fbcce65f3aa
|
[] |
no_license
|
dlxotn216/JPA
|
f501249aa3cb45342567be2085e0f877fc291d5a
|
8c2b01617b15ee305337b1855d696131cf9f04be
|
refs/heads/master
| 2020-03-11T03:12:05.310226
| 2018-06-15T14:30:59
| 2018-06-15T14:30:59
| 129,740,159
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,203
|
java
|
package me.strongwhisky.app.day32.runner;
import me.strongwhisky.app.day32.document.domain.model.Document;
import me.strongwhisky.app.day32.document.service.DocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
* Created by taesu on 2018-06-14.
*/
@Component
public class AppRunner implements ApplicationRunner {
@Autowired
private DocumentService documentService;
/*
2018-06-15 23:22:10.659 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onBeforeCommit
2018-06-15 23:22:10.659 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onBeforeCommit
2018-06-15 23:22:10.677 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : insert into document (description, name, document_key) values (?, ?, ?)
2018-06-15 23:22:10.682 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : insert into document_task (auto_start, completed_at, description, document_key, due_at, name, sequence, started_at, task_status, document_task_key) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2018-06-15 23:22:10.685 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : insert into document_task (auto_start, completed_at, description, document_key, due_at, name, sequence, started_at, task_status, document_task_key) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2018-06-15 23:22:10.688 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCompletion
2018-06-15 23:22:10.690 INFO 9988 --- [ restartedMain] .s.a.AnnotationAsyncExecutionInterceptor : No task executor bean found for async processing: no bean of type TaskExecutor and no bean named 'taskExecutor' either
2018-06-15 23:22:10.691 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCommit
2018-06-15 23:22:10.691 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCompletion
2018-06-15 23:22:10.691 INFO 9988 --- [ restartedMain] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCommit
2018-06-15 23:22:10.693 INFO 9988 --- [cTaskExecutor-1] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCommitByAsync
2018-06-15 23:22:10.694 INFO 9988 --- [cTaskExecutor-2] .d.d.d.e.DocumentTransactionEventHandler : DocumentTaskCreateEvent -> onAfterCommitByAsync
2018-06-15 23:22:10.707 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : select document0_.document_key as document1_0_1_, document0_.description as descript2_0_1_, document0_.name as name3_0_1_, documentta1_.document_key as documen10_1_3_, documentta1_.document_task_key as document1_1_3_, documentta1_.document_task_key as document1_1_0_, documentta1_.auto_start as auto_sta2_1_0_, documentta1_.completed_at as complete3_1_0_, documentta1_.description as descript4_1_0_, documentta1_.document_key as documen10_1_0_, documentta1_.due_at as due_at5_1_0_, documentta1_.name as name6_1_0_, documentta1_.sequence as sequence7_1_0_, documentta1_.started_at as started_8_1_0_, documentta1_.task_status as task_sta9_1_0_ from document document0_ left outer join document_task documentta1_ on document0_.document_key=documentta1_.document_key where document0_.document_key=?
2018-06-15 23:22:10.729 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : select documentve0_.document_key as document4_2_0_, documentve0_.document_version_key as document1_2_0_, documentve0_.document_version_key as document1_2_1_, documentve0_.document_key as document4_2_1_, documentve0_.sequence as sequence2_2_1_, documentve0_.version as version3_2_1_ from document_version documentve0_ where documentve0_.document_key=? order by documentve0_.version desc, documentve0_.sequence desc
2018-06-15 23:22:10.736 DEBUG 9988 --- [ restartedMain] org.hibernate.SQL : update document_task set auto_start=?, completed_at=?, description=?, document_key=?, due_at=?, name=?, sequence=?, started_at=?, task_status=? where document_task_key=?
*/
@Override
public void run(ApplicationArguments args) throws Exception {
System.out.println("======================================run==============================");
//Given
Document document = new Document("문서1", "설명1");
document.createDocumentTask("작성태스크1", "작성", 1, false, null);
document.createDocumentTask("작성태스크2", "작성", 2, true, null);
document = documentService.saveDocument(document);
//When start
document.startNextTask();
document = documentService.saveDocument(document);
//When complete
documentService.completeCurrentTask(document.getDocumentKey());
documentService.anotherTest(document.getDocumentKey());
}
}
|
[
"taesu@crscube.co.kr"
] |
taesu@crscube.co.kr
|
d7b6c72edfb31cafeb770b1ddf3db95c3c3b3ae2
|
2b0219b19b9951b9cb1ea4929392f434c84f81db
|
/src/main/java/shg/examsys/dao/impl/DepartmentImpl.java
|
cc6405f5d86ac8f37de4196446d3900250106047
|
[] |
no_license
|
jackylovechina/SHGNewExamSys
|
c5c5f14637435d44a9cd7e7d34b510721a7401bd
|
28d7b7d35759b1505d48592e8f071e8fd1049501
|
refs/heads/master
| 2020-03-12T14:20:43.581542
| 2018-05-29T07:37:13
| 2018-05-29T07:37:13
| 130,665,034
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 404
|
java
|
package shg.examsys.dao.impl;
import org.springframework.stereotype.Repository;
import shg.examsys.dao.DepartmentDao;
import shg.examsys.entity.Department;
@Repository
public class DepartmentImpl extends BaseDaoImpl<Department> implements DepartmentDao{
public DepartmentImpl() {
// TODO Auto-generated constructor stub
super.setNs("shg.examsys.mapper.DepartmentMapper");
}
}
|
[
"jackylovechina@gmail.com"
] |
jackylovechina@gmail.com
|
ea56c1725146c263fd327d4f01f702daa7c8d7b2
|
184780fd10c7635453875456187456fc9f9840bb
|
/src/itcast1113/StringBufferDemo.java
|
3d95b5c9c71fcb67450a956ea19c7c1dc3768d45
|
[] |
no_license
|
rirrr/chapter8
|
9a0dcd9b00c33dad64be5c87ec152387263f5689
|
a40cfe7ae6df4ac1575bd633c8107532ef0483d1
|
refs/heads/master
| 2020-04-07T07:26:30.908500
| 2018-11-19T06:52:42
| 2018-11-19T06:52:42
| 158,176,750
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 975
|
java
|
package itcast1113;
//1.String、StringBuffer、StringBuilder的区别
//A:String是内容不可变的,StringBuffer、StringBuilder是内容可变的
//B:StringBuffer是同步的,数据安全,效率低;StringBuilder是不同步,数据不安全的效率高。
//
//2.StringBuffer和数组的区别?
//二者都可以看作是一个容器装其他的数据,StringBuffer的数据最终是一个字符串数据,而数组可以是多种同类数据
//
//3.作为形式参数问题
//String作为参数传递
//StringBuffer作为参数传递
//形式参数:
// 基本类型:形式参数的改变不影响实际参数
// 引用类型:形式参数的改变直接影响实际参数
public class StringBufferDemo {
public static void main(String[] args) {
String s1 = "hello";
String s2 = "world";
System.out.println(s1 + "---" + s2);
change(s1,s2);
}
public static void change(String s1, String s2) {
}
}
|
[
"1048641670@qq.com"
] |
1048641670@qq.com
|
1f32d9dbd07496ca25f4641f46425453f40876cb
|
00c5ba0131f2dccb1ccbf3534ee5d6f1de8a0ab8
|
/src/lab5/StringOperations.java
|
e0cdb1d6d7a48708319446ee5682e91bbb2b8dea
|
[] |
no_license
|
11611109/DataStructureAndAlgorithmAnalysis
|
475c1312ec19ecb2606b7ed1137a5b1c7e22603a
|
457fee4210aee22b66ac5ffc15adfc17cbd14406
|
refs/heads/master
| 2020-06-06T12:34:48.172159
| 2019-06-19T13:53:54
| 2019-06-19T13:53:54
| 192,740,957
| 0
| 0
| null | null | null | null |
ISO-8859-1
|
Java
| false
| false
| 2,494
|
java
|
package lab5;
import java.util.LinkedList;
import java.util.Scanner;
public class StringOperations {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int testcases=input.nextInt();
String a,order;
int length,operations;
if(0<=testcases&&testcases<=10){
for(int i=0;i<testcases;i++){
LinkedList<String> string=new LinkedList<String>();
a=input.next();
length=a.length();
char [] b=a.toCharArray();
operations=input.nextInt();
for(int j=0;j<length;j++){
string.add(String.valueOf(b[j]));
}//×Ö·û´®´¢´æ½ølinklist
int pos=0,pos2=0;
for(int k=0;k<operations;k++){
order=input.next();
switch(order){
case "Add":
String value=input.next();
pos=input.nextInt();
string.add(pos, value);
//System.out.println(string);
printlist(string);
break;
case "Delete":
pos=input.nextInt();
string.remove(pos);
//System.out.println(string);
printlist(string);
break;
case "Sstr":
StringBuffer x=new StringBuffer(string.get(0));
for(int n=1;n<string.size();n++){
x.append(string.get(n));
}
pos=input.nextInt();
pos2=input.nextInt();
String y=x.substring(pos, pos2+1);
System.out.println(y);
break;
case "Reverse":
pos=input.nextInt();
pos2=input.nextInt();
String listToString=tostring(string);
String part1=listToString.substring(0, pos);
String part2=listToString.substring(pos,pos2+1);
String part3=listToString.substring(pos2+1,listToString.length());
StringBuffer reverse=new StringBuffer();
reverse.append(part2);
reverse.reverse();
String newString=part1+reverse.toString()+part3;
int lengthAll=newString.length();
char [] result=newString.toCharArray();
string.clear();
for(int q=0;q<lengthAll;q++){
string.add(String.valueOf(result[q]));
}
printlist(string);
break;
}
}
}
}
}
public static void printlist(LinkedList<String> a){
int length=a.size();
for(int r=0;r<length;r++){
System.out.print(a.get(r));
}
System.out.println( );
}
public static String tostring(LinkedList<String> a){
StringBuffer x=new StringBuffer(a.get(0));
for(int n=1;n<a.size();n++){
x.append(a.get(n));
}
String y=x.toString();
return y;
}
}
|
[
"jing_hong_yan@163.com"
] |
jing_hong_yan@163.com
|
f7251c84e5823c50913a4ed6758a226d2336936d
|
01d68739ba24ebbe3ab20a4a2679b7b000c60ccc
|
/degreePlanner/src/degreePlanner/Controller/Controller.java
|
544ac500a3e4556c41a43b1b952154e6aabca3b5
|
[] |
no_license
|
se-project-sm4/Degree-Planner
|
9fc0bf3a4c35973a32bdfece6b83b6584bb99e46
|
654b783a6bc022edcd0a3e46738a04c4d7ae2735
|
refs/heads/master
| 2020-06-22T05:52:21.005423
| 2019-08-16T14:35:32
| 2019-08-16T14:35:32
| 197,650,052
| 0
| 0
| null | 2019-07-27T21:17:34
| 2019-07-18T20:07:33
|
Java
|
UTF-8
|
Java
| false
| false
| 224
|
java
|
package degreePlanner.Controller;
import degreePlanner.Model.Model;
import degreePlanner.View.View;
public interface Controller {
void setModel(Model model);
Model getModel();
View getView();
void setView(View view);
}
|
[
"45404939+jordan-matthews-98@users.noreply.github.com"
] |
45404939+jordan-matthews-98@users.noreply.github.com
|
389d64db1a4709f3441efeabaa81f6cf15886338
|
c0fe21b86f141256c85ab82c6ff3acc56b73d3db
|
/vqd/src/main/java/com/jdcloud/sdk/service/vqd/model/QueryCallbackRequest.java
|
075bb6b816e630b2373d79412400a60fe98a3e95
|
[
"Apache-2.0"
] |
permissive
|
jdcloud-api/jdcloud-sdk-java
|
3fec9cf552693520f07b43a1e445954de60e34a0
|
bcebe28306c4ccc5b2b793e1a5848b0aac21b910
|
refs/heads/master
| 2023-07-25T07:03:36.682248
| 2023-07-25T06:54:39
| 2023-07-25T06:54:39
| 126,275,669
| 47
| 61
|
Apache-2.0
| 2023-09-07T08:41:24
| 2018-03-22T03:41:41
|
Java
|
UTF-8
|
Java
| false
| false
| 1,033
|
java
|
/*
* Copyright 2018 JDCLOUD.COM
*
* 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.
*
* Callback
* 回调配置相关接口
*
* OpenAPI spec version: v1
* Contact:
*
* NOTE: This class is auto generated by the jdcloud code generator program.
*/
package com.jdcloud.sdk.service.vqd.model;
import com.jdcloud.sdk.service.JdcloudRequest;
/**
* 查询回调配置
*/
public class QueryCallbackRequest extends JdcloudRequest implements java.io.Serializable {
private static final long serialVersionUID = 1L;
}
|
[
"tancong@jd.com"
] |
tancong@jd.com
|
ffd406887baaf2369d78f1d135a7fad684016ef4
|
5371e008aac841a2121d85b0982ab696c76aca22
|
/board_game/code/.svn/pristine/ff/ffd406887baaf2369d78f1d135a7fad684016ef4.svn-base
|
1218d029714d50c68bc0741230e41cf6098dbf05
|
[] |
no_license
|
jbodah/grad_work
|
7234cc55005144474283d614428ca416e8d3869c
|
291bcacdbbc0f6b0d78f96d9b81a77a5a5904696
|
refs/heads/master
| 2016-09-16T02:54:51.440448
| 2014-08-23T00:07:22
| 2014-08-23T00:11:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,188
|
package wordstealclient.controllers.xml_handlers;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import ks.client.UserContext;
import ks.client.controllers.ConnectController;
import ks.client.controllers.DisconnectController;
import ks.client.lobby.LobbyFrame;
import ks.framework.common.Configure;
import ks.framework.common.Message;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import arch.WSClientArchitecture;
import test.TestData;
import test.Utilities;
import wordstealclient.controllers.correlated_requests.JoinRequestController;
import wordstealclient.entities.Room;
public class JoinTableResponseHandlerTest {
Message mOne ;
Message mTwo ;
Message mThree ;
Message mFour ;
Message rTwo ;
Message rThree ;
Message rFour ;
@Before
public void setUp() {
// Create a message to test parsing
// 1000 is just a random id number
mOne = Utilities.makeTestMessage(TestData.samplePlayerResponse("1000"));
mTwo = Utilities.makeTestMessage(TestData.sampleTableResponseSuccesfulJoin("2000"));
mThree = Utilities.makeTestMessage(TestData.sampleTableEmptyResponse("3000"));
mFour = Utilities.makeTestMessage(TestData.sampleRejectResponse("4000"));
// Create test requests
rTwo = Utilities.makeTestMessage("<request version='1.0' id='2000'>" + "<join table='" + 1 + "'/></request>" );
rThree = Utilities.makeTestMessage("<request version='1.0' id='3000'>" + "<join table='" + 1 + "'/></request>" );
rFour = Utilities.makeTestMessage("<request version='1.0' id='4000'>" + "<join table='" + 1 + "'/></request>" );
}
@After
public void tearDown() {
mOne = null ;
mTwo = null ;
mThree = null ;
mFour = null ;
rTwo = null ;
rThree = null ;
rFour = null ;
}
@Test
public void test() {
context.getClient().process(mOne);
JoinRequestController jrc = new JoinRequestController(lobby);
// Attempt to join table
lobby.getContext().getClient().sendToServer(lobby, rTwo, jrc) ;
// Receive OK response
jrc.process(lobby, rTwo, mTwo);
// Assert that table was joined
assertEquals(Room.getInstance().getTable(1).getPlayer(1213).getAlias(), "George Heineman") ;
// Remove from table
Room.getInstance().getTable(1).removePlayer(1213) ;
assertEquals(Room.getInstance().getTable(1).getNumberOfPlayers(), 0) ;
// Attempt to join table
lobby.getContext().getClient().sendToServer(lobby, rThree, jrc) ;
// Receive denial response
jrc.process(lobby, rThree, mThree);
// Assert that table wasn't joined
assertTrue(Room.getInstance().getTable(1).getPlayer(1213) == null) ;
// Assert nobody is at the table
assertEquals(Room.getInstance().getTable(1).getNumberOfPlayers(), 0) ;
// Attempt to join table
lobby.getContext().getClient().sendToServer(lobby, rThree, jrc) ;
// Receive denial response
jrc.process(lobby, rFour, mFour);
// Assert that table wasn't joined
assertTrue(Room.getInstance().getTable(1).getPlayer(1213) == null) ;
// Assert nobody is at the table
assertEquals(Room.getInstance().getTable(1).getNumberOfPlayers(), 0) ;
}
/********************* BOILERPLATE CODE *********************/
// host
public static final String localhost = "localhost";
// sample credentials (really meaningless in the testing case)
public static final String user = "11323";
public static final String password = "password";
/** Constructed objects for this test case. */
UserContext context;
LobbyFrame lobby;
// random port 8000-10000 to avoid arbitrary conflicts
int port;
/**
* setUp() method is executed by the JUnit framework prior to each
* test case.
*/
@Before
public void setUpTwo() {
// Determine the XML schema we are going to use
try {
Message.unconfigure();
assertTrue (Configure.configure());
} catch (Exception e) {
fail ("Unable to setup Message tests.");
}
WSClientArchitecture.setupControllerChain();
// create client to connect
context = new UserContext(); // by default, localhost
lobby = new LobbyFrame (context);
lobby.setVisible(true);
context.setPort(port);
context.setUser(user);
context.setPassword(password);
context.setSelfRegister(false);
// connect client to server
assertTrue (new ConnectController(lobby).process(context));
// wait for things to settle down. As your test cases become more
// complex, we may find it necessary to include additional waiting
// times.
waitASecond();
}
/**
* tearDown() is executed by JUnit at the conclusion of each individual
* test case.
*/
@After
public void tearDownTwo() {
// the other way to leave is to manually invoke controller.
assertTrue (new DisconnectController (lobby).process(context));
lobby.setVisible(false);
lobby.dispose();
}
// helper function to sleep for a second.
private void waitASecond() {
// literally wait a second.
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
}
|
[
"jb3689@yahoo.com"
] |
jb3689@yahoo.com
|
|
16eec40ef0c99fa16517c64a9732796bcbe00722
|
df76e92a853883154ff87e5bde8d9bb0dee47c66
|
/app/src/main/java/com/satur/kosherpitagrill/ui/share/ShareViewModel.java
|
99a91b754f1dcd2c76fd7815b8e470d720c9124c
|
[] |
no_license
|
SaTuR/Restaurante
|
c5e7985e44816140b974abe2d48089086e0b1267
|
b1c4de9b9a1bd22b728df243c358e89ca60b2ef8
|
refs/heads/master
| 2020-12-29T10:27:56.929862
| 2020-02-06T00:14:16
| 2020-02-06T00:14:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 452
|
java
|
package com.satur.kosherpitagrill.ui.share;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class ShareViewModel extends ViewModel {
private MutableLiveData<String> mText;
public ShareViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is share fragment");
}
public LiveData<String> getText() {
return mText;
}
}
|
[
"satur_cordova@hotmail.com"
] |
satur_cordova@hotmail.com
|
747a772426857fefca1812586d97eeb2d5451c53
|
ee3ef9b4fdba9c02dc867919952eed801dda6715
|
/Webdriver/src/pkg1/Dropdown_30dec.java
|
03b0c1566f84e01c0e39140f5cbf1ef577316965
|
[] |
no_license
|
Aakashkhatter1/Webdriver
|
85d0c0439b3a3b11b5914f678c65d8ae2605e7c5
|
e9308aee287e0fad2fdf210b2c4eb3aa35c9f001
|
refs/heads/master
| 2020-04-15T18:12:39.205617
| 2019-01-09T17:31:36
| 2019-01-09T17:31:36
| 164,905,359
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,303
|
java
|
package pkg1;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Dropdown_30dec {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Owner\\Desktop\\chromedriver.exe");
ChromeDriver driver = new ChromeDriver(); //object of chrome driver
driver.get("https://www.facebook.com");
driver.manage().window().maximize();
//Drop down:-
//If drop down is in Select tag -- then select class will be used.
// If drop down is in other tag --- then keyword arrow-down key is used.
//Three methods for select class
//Selectbyindex(), selectbyValue() and selectbyvisibletext()
WebElement drop= driver.findElement(By.cssSelector("select[name='birthday_day']")); //using css -- tag with attribute -
Select s = new Select(drop);
s.selectByIndex(5);
WebElement drop2= driver.findElement(By.cssSelector("select#month")); //using css -- tag with id.
Select s2=new Select(drop2);
s2.selectByVisibleText("Aug");
WebElement drop3= driver.findElement(By.cssSelector("select[title='Year']"));
Select s3=new Select(drop3);
s3.selectByValue("2018");
}
}
|
[
"Owner@192.168.1.36"
] |
Owner@192.168.1.36
|
4e4ac3984d88895c951181cb87b2373cc97d8172
|
5e0f71b709fefd209186d8270782252347bf56fe
|
/src/main/java/com/harden/backend_study/cache/MemoryCustomCacheManager.java
|
6529c8606311c6fee3356f9d4e2e460c768c05f4
|
[] |
no_license
|
electricline/backend_study
|
696e06c59e1f88ab65206e845772aaaf8a01e084
|
5fc5bfd7ee77e7c8b3b0a3eca181bf73143f8553
|
refs/heads/master
| 2023-03-01T10:16:39.513950
| 2021-02-11T11:54:10
| 2021-02-11T11:54:10
| 329,929,331
| 0
| 0
| null | 2021-01-31T04:58:40
| 2021-01-15T14:07:59
|
Java
|
UTF-8
|
Java
| false
| false
| 1,246
|
java
|
package com.harden.backend_study.cache;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
@Component("memoryCustomCacheCacheManager")
public class MemoryCustomCacheManager implements CustomCacheManager {
private final ConcurrentMap<String, CurrentMapCustomCache> cacheMap
= new ConcurrentHashMap<>(16);
public CurrentMapCustomCache getCache(String name) {
CurrentMapCustomCache cache = this.cacheMap.get(name);
if (cache == null) {
synchronized (this.cacheMap) {
cache = this.cacheMap.get(name);
if (cache == null) {
cache = createConcurrentMapCustomCache(name);
this.cacheMap.put(name, cache);
}
}
}
return cache;
}
protected CurrentMapCustomCache createConcurrentMapCustomCache(String name) {
return new CurrentMapCustomCache(name, new ConcurrentHashMap<>(256));
}
@Deprecated
@Override
public Collections getCacheStorageNames() {
return (Collections) Collections.unmodifiableSet(this.cacheMap.keySet());
}
}
|
[
"jktmobile6637@gmail.com"
] |
jktmobile6637@gmail.com
|
ece596f3120842601efa169ce357157c7772bfc4
|
c9fd916fbe50f4c684573381b0305e4076fac866
|
/casa-do-codigo/src/main/java/br/com/zup/casadocodigo/controller/ClienteController.java
|
22b9a77625ab4506393c28f103e78b3f1759a2dc
|
[
"Apache-2.0"
] |
permissive
|
rafaelrezende-zup/orange-talents-07-template-casa-do-codigo
|
e052e72712a268d1ccaba110e1728e87df65b96c
|
099b4627a51206130f321efa50ea16b91168c7c6
|
refs/heads/master
| 2023-07-07T18:42:47.479990
| 2021-07-29T13:18:56
| 2021-07-29T13:18:56
| 389,629,418
| 0
| 0
|
Apache-2.0
| 2021-07-26T20:34:47
| 2021-07-26T12:45:51
|
Java
|
UTF-8
|
Java
| false
| false
| 1,993
|
java
|
package br.com.zup.casadocodigo.controller;
import br.com.zup.casadocodigo.model.Cliente;
import br.com.zup.casadocodigo.model.Estado;
import br.com.zup.casadocodigo.model.Pais;
import br.com.zup.casadocodigo.model.dto.NovoClienteDTO;
import br.com.zup.casadocodigo.repository.ClienteRepository;
import br.com.zup.casadocodigo.repository.EstadoRepository;
import br.com.zup.casadocodigo.repository.PaisRepository;
import br.com.zup.casadocodigo.validator.PaisPossuiEstadoValidator;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.transaction.Transactional;
import javax.validation.Valid;
@RestController
@RequestMapping("/cliente")
public class ClienteController {
private final PaisRepository paisRepository;
private final EstadoRepository estadoRepository;
private final PaisPossuiEstadoValidator paisPossuiEstadoValidator;
private final ClienteRepository repository;
@InitBinder
public void init(WebDataBinder binder) {
binder.addValidators(paisPossuiEstadoValidator);
}
public ClienteController(PaisRepository paisRepository,
EstadoRepository estadoRepository,
PaisPossuiEstadoValidator paisPossuiEstadoValidator,
ClienteRepository repository) {
this.repository = repository;
this.paisRepository = paisRepository;
this.estadoRepository = estadoRepository;
this.paisPossuiEstadoValidator = paisPossuiEstadoValidator;
}
@PostMapping
@Transactional
public ResponseEntity<?> cria(@RequestBody @Valid NovoClienteDTO dto) {
Pais pais = paisRepository.getById(dto.getIdPais());
Estado estado = estadoRepository.getById(dto.getIdEstado());
Cliente cliente = new Cliente(dto, pais, estado);
repository.save(cliente);
return ResponseEntity.ok().build();
}
}
|
[
"rafael.rezende@zup.com.br"
] |
rafael.rezende@zup.com.br
|
730f4a50736675f806a5aadd980fda07bdaac3d5
|
faf59c4f8202b791c97d559e695109a7584503bf
|
/src/main/java/org/openstreetmap/josm/plugins/ods/geotools/SetIdFeatureEnhancer.java
|
124c7657f0f2c8cecde546fa7e2f98f55bdb4772
|
[] |
no_license
|
gidema/josm-openservices
|
57a4d681ddddbc6fce34d0553fb3f9c306c8e8e6
|
d462b857c2a7a093ff9bbfeb01fb8fb2fe8715b0
|
refs/heads/master
| 2023-08-05T11:43:07.194185
| 2020-04-13T11:36:57
| 2020-04-13T11:36:57
| 7,605,281
| 2
| 4
| null | 2022-01-19T21:43:14
| 2013-01-14T14:03:58
|
Java
|
UTF-8
|
Java
| false
| false
| 1,862
|
java
|
package org.openstreetmap.josm.plugins.ods.geotools;
import java.util.HashMap;
import java.util.Map;
import org.geotools.feature.simple.SimpleFeatureImpl;
import org.geotools.filter.identity.FeatureIdImpl;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.AttributeDescriptor;
import org.opengis.filter.identity.FeatureId;
public class SetIdFeatureEnhancer implements FeatureEnhancer {
private int idAttributeIndex;
private Map<String, Integer> index;
public SetIdFeatureEnhancer(SimpleFeatureType featureType, String idAttribute) {
this(featureType, featureType.indexOf(idAttribute));
}
public SetIdFeatureEnhancer(SimpleFeatureType featureType, int idAttribute) {
super();
this.idAttributeIndex = idAttribute;
this.index = getIndex(featureType);
}
@Override
public SimpleFeature enhance(SimpleFeature feature) {
Object fid = feature.getAttribute(idAttributeIndex);
if (fid == null) return feature;
Object[] values = new Object[feature.getAttributeCount()];
for (int i=0; i<feature.getAttributeCount(); i++) {
values[i] = feature.getAttribute(i);
}
FeatureId featureId = new FeatureIdImpl(fid.toString());
return new SimpleFeatureImpl(values, feature.getFeatureType(), featureId,
false, index);
}
private static Map<String, Integer> getIndex(SimpleFeatureType featureType) {
Map<String, Integer> indexKey = new HashMap<>();
for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) {
String name = descriptor.getLocalName();
Integer idx = featureType.indexOf(name);
indexKey.put(name, idx);
}
return indexKey;
}
}
|
[
"mail@gertjanidema.nl"
] |
mail@gertjanidema.nl
|
4246c745516b5d7bcf3605b988bc6f507ce86000
|
ff168460725b5dd18b8c2330a24e1fe5abcec27c
|
/src/com/company/streamExercise/Car.java
|
bcce9c7c8b13feabe9edb8747d243e39f4339278
|
[] |
no_license
|
deividasbarzdenis/Java-Exercises
|
89693724332a38acd09012327aa887dc55aeddb0
|
459472b99c9f3a07252c710e4179fd2be23e27c4
|
refs/heads/master
| 2023-08-16T02:47:48.897525
| 2021-09-29T20:36:31
| 2021-09-29T20:36:31
| 348,461,614
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 515
|
java
|
package com.company.streamExercise;
public class Car {
public final String make;
public final String color;
public final Float price;
public Car(String make, String color, Float price) {
this.make = make;
this.color = color;
this.price = price;
}
@Override
public String toString() {
return "Car{" +
"make='" + make + '\'' +
", color='" + color + '\'' +
", price=" + price +
'}';
}
}
|
[
"deividasbarzdenis@yahoo.com"
] |
deividasbarzdenis@yahoo.com
|
8e63ff996df7d20727470536a405c43246714aa9
|
59ed765c34e24a2a5cbbb81535ec9031f28104aa
|
/test/src/test/java/org/apache/rocketmq/test/client/consumer/tag/TagMessageWithMulConsumerIT.java
|
995bf416d8cae8458ffb71b0fd11b00d6757246c
|
[
"Apache-2.0",
"EPL-1.0",
"MIT",
"LGPL-2.1-or-later",
"MPL-1.1",
"LGPL-2.1-only"
] |
permissive
|
songyuan1994/incubator-rocketmq
|
fe722b96bbcb093f4e8c7a27b6085eccc6f83877
|
ac90a6c571f4e4d04c4f175018feb82283fb8b04
|
refs/heads/master
| 2023-04-18T23:52:04.944028
| 2021-05-10T02:27:57
| 2021-05-10T02:27:57
| 275,774,859
| 0
| 0
|
Apache-2.0
| 2020-06-29T08:30:09
| 2020-06-29T08:30:08
| null |
UTF-8
|
Java
| false
| false
| 9,074
|
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.rocketmq.test.client.consumer.tag;
import java.util.Collection;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.rocketmq.test.base.BaseConf;
import org.apache.rocketmq.test.client.rmq.RMQNormalConsumer;
import org.apache.rocketmq.test.client.rmq.RMQNormalProducer;
import org.apache.rocketmq.test.factory.MQMessageFactory;
import org.apache.rocketmq.test.factory.TagMessage;
import org.apache.rocketmq.test.listener.rmq.concurrent.RMQNormalListner;
import org.apache.rocketmq.test.util.VerifyUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import static com.google.common.truth.Truth.assertThat;
public class TagMessageWithMulConsumerIT extends BaseConf {
private static Logger logger = Logger.getLogger(TagMessageWith1ConsumerIT.class);
private RMQNormalProducer producer = null;
private String topic = null;
@Before
public void setUp() {
topic = initTopic();
String consumerId = initConsumerGroup();
logger.info(String.format("use topic: %s; consumerId: %s !", topic, consumerId));
producer = getProducer(nsAddr, topic);
}
@After
public void tearDown() {
super.shutDown();
}
@Test
public void testSendTwoTag() {
String tag1 = "jueyin1";
String tag2 = "jueyin2";
int msgSize = 10;
RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, tag1,
new RMQNormalListner());
RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, tag2,
new RMQNormalListner());
List<Object> tag1Msgs = MQMessageFactory.getRMQMessage(tag1, topic, msgSize);
producer.send(tag1Msgs);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
List<Object> tag2Msgs = MQMessageFactory.getRMQMessage(tag2, topic, msgSize);
producer.send(tag2Msgs);
Assert.assertEquals("Not all are sent", msgSize * 2, producer.getAllUndupMsgBody().size());
consumerTag1.getListner().waitForMessageConsume(MQMessageFactory.getMessageBody(tag1Msgs),
consumeTime);
consumerTag2.getListner().waitForMessageConsume(MQMessageFactory.getMessageBody(tag2Msgs),
consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag1.getListner().getAllMsgBody()))
.containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag1Msgs));
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag2.getListner().getAllMsgBody()))
.containsExactlyElementsIn(MQMessageFactory.getMessageBody(tag2Msgs));
}
@Test
public void testSendMessagesWithTwoTag() {
String tags[] = {"jueyin1", "jueyin2"};
int msgSize = 10;
TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, tags[0],
new RMQNormalListner());
RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, tags[1],
new RMQNormalListner());
List<Object> tagMsgs = tagMessage.getMixedTagMessages();
producer.send(tagMsgs);
Assert.assertEquals("Not all are sent", msgSize * tags.length,
producer.getAllUndupMsgBody().size());
consumerTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
consumeTime);
consumerTag2.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[1]),
consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag1.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag2.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[1]));
}
@Test
public void testTwoConsumerOneMatchOneOtherMatchAll() {
String tags[] = {"jueyin1", "jueyin2"};
String sub1 = String.format("%s||%s", tags[0], tags[1]);
String sub2 = String.format("%s|| noExist", tags[0]);
int msgSize = 10;
TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
RMQNormalConsumer consumerTag1 = getConsumer(nsAddr, topic, sub1,
new RMQNormalListner());
RMQNormalConsumer consumerTag2 = getConsumer(nsAddr, topic, sub2,
new RMQNormalListner());
List<Object> tagMsgs = tagMessage.getMixedTagMessages();
producer.send(tagMsgs);
Assert.assertEquals("Not all are sent", msgSize * tags.length,
producer.getAllUndupMsgBody().size());
consumerTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags),
consumeTime);
consumerTag2.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag1.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerTag2.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
}
@Test
public void testSubKindsOf() {
String tags[] = {"jueyin1", "jueyin2"};
String sub1 = String.format("%s||%s", tags[0], tags[1]);
String sub2 = String.format("%s|| noExist", tags[0]);
String sub3 = tags[0];
String sub4 = "*";
int msgSize = 10;
RMQNormalConsumer consumerSubTwoMatchAll = getConsumer(nsAddr, topic, sub1,
new RMQNormalListner());
RMQNormalConsumer consumerSubTwoMachieOne = getConsumer(nsAddr, topic, sub2,
new RMQNormalListner());
RMQNormalConsumer consumerSubTag1 = getConsumer(nsAddr, topic, sub3,
new RMQNormalListner());
RMQNormalConsumer consumerSubAll = getConsumer(nsAddr, topic, sub4,
new RMQNormalListner());
producer.send(msgSize);
Assert.assertEquals("Not all are sent", msgSize, producer.getAllUndupMsgBody().size());
Collection<Object> msgsWithNoTag = producer.getMsgBodysCopy();
TagMessage tagMessage = new TagMessage(tags, topic, msgSize);
List<Object> tagMsgs = tagMessage.getMixedTagMessages();
producer.send(tagMsgs);
Assert.assertEquals("Not all are sent", msgSize * 3, producer.getAllUndupMsgBody().size());
consumerSubTwoMatchAll.getListner()
.waitForMessageConsume(tagMessage.getMessageBodyByTag(tags), consumeTime);
consumerSubTwoMachieOne.getListner()
.waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]), consumeTime);
consumerSubTag1.getListner().waitForMessageConsume(tagMessage.getMessageBodyByTag(tags[0]),
consumeTime);
consumerSubAll.getListner().waitForMessageConsume(
MQMessageFactory.getMessage(msgsWithNoTag, tagMessage.getAllTagMessageBody()),
consumeTime);
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerSubTwoMatchAll.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getAllTagMessageBody());
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerSubTwoMachieOne.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerSubTag1.getListner().getAllMsgBody()))
.containsExactlyElementsIn(tagMessage.getMessageBodyByTag(tags[0]));
assertThat(VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
consumerSubAll.getListner().getAllMsgBody()))
.containsExactlyElementsIn(MQMessageFactory.getMessage(msgsWithNoTag,
tagMessage.getAllTagMessageBody()));
}
}
|
[
"yukon@apache.org"
] |
yukon@apache.org
|
e7fbe479c731f756d6c96e298041f0171b761e41
|
dc40cbb84b915c52408cede3c9c7587301d2f05e
|
/WordInPicture/core/src/com/dana/team/wordinpicture/screens/GameScreen.java
|
972340c34c78a5e668a52ae9f8daa65bd38e4062
|
[] |
no_license
|
haunguyencts/danateam
|
da4b0808638326229259d2e27f3aea8139527bc2
|
e5c89b8f5f49defebdda13484d1a39cbbe20c0fd
|
refs/heads/master
| 2021-01-21T12:03:30.386566
| 2015-07-23T15:48:53
| 2015-07-23T15:48:53
| 39,363,454
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,358
|
java
|
package com.dana.team.wordinpicture.screens;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector3;
import com.dana.team.wordinpicture.WordInPicture;
import com.dana.team.wordinpicture.World;
import com.dana.team.wordinpicture.World.WorldListener;
import com.dana.team.wordinpicture.WorldRenderer;
import com.dana.team.wordinpicture.utils.Assets;
public class GameScreen extends ScreenAdapter {
static final int GAME_READY = 0;
static final int GAME_RUNNING = 1;
static final int GAME_PAUSED = 2;
static final int GAME_LEVEL_END = 3;
static final int GAME_OVER = 4;
WordInPicture game;
int state;
OrthographicCamera guiCam;
Vector3 touchPoint;
World world;
WorldListener worldListener;
WorldRenderer renderer;
Rectangle pauseBounds;
Rectangle resumeBounds;
Rectangle quitBounds;
int lastScore;
String scoreString;
GlyphLayout glyphLayout = new GlyphLayout();
public GameScreen (WordInPicture game) {
this.game = game;
state = GAME_READY;
guiCam = new OrthographicCamera(320, 480);
guiCam.position.set(320 / 2, 480 / 2, 0);
touchPoint = new Vector3();
worldListener = new WorldListener() {
@Override
public void jump () {
Assets.playSound(Assets.jumpSound);
}
@Override
public void highJump () {
Assets.playSound(Assets.highJumpSound);
}
@Override
public void hit () {
Assets.playSound(Assets.hitSound);
}
@Override
public void coin () {
Assets.playSound(Assets.coinSound);
}
};
world = new World(worldListener);
renderer = new WorldRenderer(game.batcher, world);
pauseBounds = new Rectangle(320 - 64, 480 - 64, 64, 64);
resumeBounds = new Rectangle(160 - 96, 240, 192, 36);
quitBounds = new Rectangle(160 - 96, 240 - 36, 192, 36);
lastScore = 0;
scoreString = "SCORE: 0";
}
public void update (float deltaTime) {
if (deltaTime > 0.1f) deltaTime = 0.1f;
switch (state) {
case GAME_READY:
updateReady();
break;
case GAME_RUNNING:
updateRunning(deltaTime);
break;
case GAME_PAUSED:
updatePaused();
break;
case GAME_LEVEL_END:
updateLevelEnd();
break;
case GAME_OVER:
updateGameOver();
break;
}
}
private void updateReady () {
if (Gdx.input.justTouched()) {
state = GAME_RUNNING;
}
}
private void updateRunning (float deltaTime) {
if (Gdx.input.justTouched()) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (pauseBounds.contains(touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
state = GAME_PAUSED;
return;
}
}
ApplicationType appType = Gdx.app.getType();
// should work also with Gdx.input.isPeripheralAvailable(Peripheral.Accelerometer)
if (appType == ApplicationType.Android || appType == ApplicationType.iOS) {
world.update(deltaTime, Gdx.input.getAccelerometerX());
} else {
float accel = 0;
if (Gdx.input.isKeyPressed(Keys.DPAD_LEFT)) accel = 5f;
if (Gdx.input.isKeyPressed(Keys.DPAD_RIGHT)) accel = -5f;
world.update(deltaTime, accel);
}
if (world.score != lastScore) {
lastScore = world.score;
scoreString = "SCORE: " + lastScore;
}
if (world.state == World.WORLD_STATE_NEXT_LEVEL) {
// game.setScreen(new WinScreen(game));
}
if (world.state == World.WORLD_STATE_GAME_OVER) {
state = GAME_OVER;
//if (lastScore >= Settings.highscores[4])
// scoreString = "NEW HIGHSCORE: " + lastScore;
//else
// scoreString = "SCORE: " + lastScore;
//Settings.addScore(lastScore);
//Settings.save();
}
}
private void updatePaused () {
if (Gdx.input.justTouched()) {
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if (resumeBounds.contains(touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
state = GAME_RUNNING;
return;
}
if (quitBounds.contains(touchPoint.x, touchPoint.y)) {
Assets.playSound(Assets.clickSound);
game.setScreen(new MainMenuScreen(game));
return;
}
}
}
private void updateLevelEnd () {
if (Gdx.input.justTouched()) {
world = new World(worldListener);
renderer = new WorldRenderer(game.batcher, world);
world.score = lastScore;
state = GAME_READY;
}
}
private void updateGameOver () {
if (Gdx.input.justTouched()) {
game.setScreen(new MainMenuScreen(game));
}
}
public void draw () {
GL20 gl = Gdx.gl;
gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
renderer.render();
guiCam.update();
game.batcher.setProjectionMatrix(guiCam.combined);
game.batcher.enableBlending();
game.batcher.begin();
switch (state) {
case GAME_READY:
presentReady();
break;
case GAME_RUNNING:
presentRunning();
break;
case GAME_PAUSED:
presentPaused();
break;
case GAME_LEVEL_END:
presentLevelEnd();
break;
case GAME_OVER:
presentGameOver();
break;
}
game.batcher.end();
}
private void presentReady () {
game.batcher.draw(Assets.ready, 160 - 192 / 2, 240 - 32 / 2, 192, 32);
}
private void presentRunning () {
game.batcher.draw(Assets.pause, 320 - 64, 480 - 64, 64, 64);
Assets.font.draw(game.batcher, scoreString, 16, 480 - 20);
}
private void presentPaused () {
game.batcher.draw(Assets.pauseMenu, 160 - 192 / 2, 240 - 96 / 2, 192, 96);
Assets.font.draw(game.batcher, scoreString, 16, 480 - 20);
}
private void presentLevelEnd () {
glyphLayout.setText(Assets.font, "the princess is ...");
Assets.font.draw(game.batcher, glyphLayout, 160 - glyphLayout.width / 2, 480 - 40);
glyphLayout.setText(Assets.font, "in another castle!");
Assets.font.draw(game.batcher, glyphLayout, 160 - glyphLayout.width / 2, 40);
}
private void presentGameOver () {
game.batcher.draw(Assets.gameOver, 160 - 160 / 2, 240 - 96 / 2, 160, 96);
glyphLayout.setText(Assets.font, scoreString);
Assets.font.draw(game.batcher, scoreString, 160 - glyphLayout.width / 2, 480 - 20);
}
@Override
public void render (float delta) {
update(delta);
draw();
}
@Override
public void pause () {
if (state == GAME_RUNNING) state = GAME_PAUSED;
}
}
|
[
"haunguyen.cts@gmail.com"
] |
haunguyen.cts@gmail.com
|
8d28dc510cc9b27660941983525595d5e8f5162c
|
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
|
/sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/models/NameValuePair.java
|
06eee3d6a79ebcb2e73cb414fb810bc16b85982a
|
[
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
Azure/azure-sdk-for-java
|
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
|
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
|
refs/heads/main
| 2023-09-04T09:36:35.821969
| 2023-09-02T01:53:56
| 2023-09-02T01:53:56
| 2,928,948
| 2,027
| 2,084
|
MIT
| 2023-09-14T21:37:15
| 2011-12-06T23:33:56
|
Java
|
UTF-8
|
Java
| false
| false
| 1,659
|
java
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.appservice.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
/** Name value pair. */
@Fluent
public final class NameValuePair {
/*
* Pair name.
*/
@JsonProperty(value = "name")
private String name;
/*
* Pair value.
*/
@JsonProperty(value = "value")
private String value;
/** Creates an instance of NameValuePair class. */
public NameValuePair() {
}
/**
* Get the name property: Pair name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Pair name.
*
* @param name the name value to set.
* @return the NameValuePair object itself.
*/
public NameValuePair withName(String name) {
this.name = name;
return this;
}
/**
* Get the value property: Pair value.
*
* @return the value value.
*/
public String value() {
return this.value;
}
/**
* Set the value property: Pair value.
*
* @param value the value value to set.
* @return the NameValuePair object itself.
*/
public NameValuePair withValue(String value) {
this.value = value;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
}
|
[
"noreply@github.com"
] |
Azure.noreply@github.com
|
76cb7d242d4c5af934b926bfd0cd958de30dfe79
|
adca09f6b819d7f8f5ff7ab22c14ed863d5e05e7
|
/cm_common/src/main/java/jlu/nan/common/vo/ExceptionResult.java
|
17741a084571401ced889289b70834bcf6fb21a8
|
[] |
no_license
|
227Rb/mall_manager_demo
|
02be5dc40bc9a18ac523e4098e43def840f73929
|
e416da8f81d3be57417f63accfc06ea13a41cfb8
|
refs/heads/master
| 2022-12-04T09:34:58.721369
| 2020-08-27T13:29:40
| 2020-08-27T13:29:40
| 290,778,946
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 781
|
java
|
package jlu.nan.common.vo;
import jlu.nan.common.enums.ExectionEnum;
import jlu.nan.common.exception.CmException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName: ExceptionResult
* @Description:
* @author: Nan
* @date: 2020/3/16 17:37
* @version: V1.0
*/
@Data
public class ExceptionResult {
private Integer status;
private String errMsg;
private Boolean isResult;
private Long timestamp;
public ExceptionResult(){}
public ExceptionResult(ExectionEnum exectionEnum) {
this.status = exectionEnum.getCode();
this.errMsg = exectionEnum.getMsg();
timestamp=System.currentTimeMillis();
}
public ExceptionResult(CmException ce){
this(ce.getEe());
}
}
|
[
"1109066402@qq.com"
] |
1109066402@qq.com
|
3523596e4989c7f7c2093263be6ddd2dfbb45a18
|
dbc413f22b6c88a6bdb565cd35fb42349817b33d
|
/src/main/java/com/newStart/Q9.java
|
f5fe022051cc9fe847df2ac8a24b5a7437bbd31c
|
[] |
no_license
|
SlientP/leetcode
|
10efdae461fb312911b13301db0b67610137f4e1
|
deb102dadfedea52f7ffd2cb948d72f76f7d082d
|
refs/heads/master
| 2022-07-02T23:19:45.998073
| 2022-06-07T08:23:17
| 2022-06-07T08:23:17
| 247,408,886
| 0
| 0
| null | 2022-06-17T03:35:48
| 2020-03-15T05:42:01
|
Java
|
UTF-8
|
Java
| false
| false
| 1,049
|
java
|
package com.newStart;
//Palindrome Number(Easy)
//Cases:正负数 0
// 大于最大整数 小于最小负数
//如果采用倒置的方式 可能会超过边界值
//如果一个数是回文 k为x的长度
//逐步划分 x/10==x之余的 或者 x==x之余
//这种情况无序考虑超过边界的问题
public class Q9 {
public static void main(String[] args) {
Q9 test=new Q9();
System.out.println(test.isPalindrome(10));
}
public boolean isPalindrome(int x) {
int temp=0;
if(x==0) return true;
while(x>temp){
temp=temp*10+x%10;
if(temp==0) return false;
if(x==temp||x/10==temp) return true;
x=x/10;
}
return false;
}
public boolean V2isPalindrome(int x) {
//负数肯定不行;
//个位为0的肯定不行
if(x<0||(x%10==0&&x!=0)) return false;
int res=0;
while (x>res){
res=res*10+x%10;
x=x/10;
}
return x==res/10||x==res;
}
}
|
[
"691937717@qq.com"
] |
691937717@qq.com
|
9d3b1b3ab43b37c8d821080650a5ef240ea9f793
|
a1cc570d2f6ddd8883b4435952db2e3a0b97b9cd
|
/PetCare-InventoryManagement-EJBClient/ejbModule/edu/osu/cse5234/business/view/InventoryService.java
|
5d1ef6153d4f2f310bfd0b70c232da8fb7115d8a
|
[] |
no_license
|
mcoqzeug/PetCare
|
747b3d136d310714e0ef35be3f6fef03c6fe8324
|
b598a2d72cd48c5577c058acbefa76e5efb58941
|
refs/heads/master
| 2020-03-29T17:48:25.631429
| 2018-12-16T23:46:25
| 2018-12-16T23:46:25
| 150,180,823
| 0
| 2
| null | 2018-11-15T03:52:15
| 2018-09-24T23:26:42
|
Java
|
UTF-8
|
Java
| false
| false
| 290
|
java
|
package edu.osu.cse5234.business.view;
import java.util.List;
//import edu.osu.cse5234.model.LineItem;
public interface InventoryService {
public Inventory getAvailableInventory();
public boolean validateQuantity(List<Item> Items);
public boolean updateInventory(List<Item> Items);
}
|
[
"kevin_lee3@outlook.com"
] |
kevin_lee3@outlook.com
|
beab49b6aadacc165da7ff8bda77750222143c75
|
7fbf24eec3a0124082b1a6dea1e8d54ebee7212e
|
/internal/EqinConv.java
|
e1602c98ad26c3c479ebc17b102fbca8807bd14c
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
open-dis/srm
|
6c48d56df8f626463af891913edbaf1e9102d7f7
|
bc94d9d1d6e610c5b04d15b27fde27c1cef60d50
|
refs/heads/master
| 2021-01-19T04:18:43.717397
| 2016-06-20T00:47:27
| 2016-06-20T00:47:27
| 55,258,601
| 2
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,080
|
java
|
// SRM SDK Release 4.4.0 - January 21, 2010
// - SRM spec. 4.4
/*
* NOTICE
*
* This software is provided openly and freely for use in representing and
* interchanging environmental data & databases.
*
* This software was developed for use by the United States Government with
* unlimited rights. The software was developed under contract
* DASG60-02-D-0006 TO-193 by Science Applications International Corporation.
* The software is unclassified and is deemed as Distribution A, approved
* for Public Release.
*
* Use by others is permitted only upon the ACCEPTANCE OF THE TERMS AND
* CONDITIONS, AS STIPULATED UNDER THE FOLLOWING PROVISIONS:
*
* 1. Recipient may make unlimited copies of this software and give
* copies to other persons or entities as long as the copies contain
* this NOTICE, and as long as the same copyright notices that
* appear on, or in, this software remain.
*
* 2. Trademarks. All trademarks belong to their respective trademark
* holders. Third-Party applications/software/information are
* copyrighted by their respective owners.
*
* 3. Recipient agrees to forfeit all intellectual property and
* ownership rights for any version created from the modification
* or adaptation of this software, including versions created from
* the translation and/or reverse engineering of the software design.
*
* 4. Transfer. Recipient may not sell, rent, lease, or sublicense
* this software. Recipient may, however enable another person
* or entity the rights to use this software, provided that this
* AGREEMENT and NOTICE is furnished along with the software and
* /or software system utilizing this software.
*
* All revisions, modifications, created by the Recipient, to this
* software and/or related technical data shall be forwarded by the
* Recipient to the Government at the following address:
*
* SMDC
* Attention SEDRIS (TO193) TPOC
* P.O. Box 1500
* Huntsville, AL 35807-3801
*
* or via electronic mail to: se-mgmt@sedris.org
*
* 5. No Warranty. This software is being delivered to you AS IS
* and there is no warranty, EXPRESS or IMPLIED, as to its use
* or performance.
*
* The RECIPIENT ASSUMES ALL RISKS, KNOWN AND UNKNOWN, OF USING
* THIS SOFTWARE. The DEVELOPER EXPRESSLY DISCLAIMS, and the
* RECIPIENT WAIVES, ANY and ALL PERFORMANCE OR RESULTS YOU MAY
* OBTAIN BY USING THIS SOFTWARE OR DOCUMENTATION. THERE IS
* NO WARRANTY, EXPRESS OR, IMPLIED, AS TO NON-INFRINGEMENT OF
* THIRD PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY
* PARTICULAR PURPOSE. IN NO EVENT WILL THE DEVELOPER, THE
* UNITED STATES GOVERNMENT OR ANYONE ELSE ASSOCIATED WITH THE
* DEVELOPMENT OF THIS SOFTWARE BE HELD LIABLE FOR ANY CONSEQUENTIAL,
* INCIDENTAL OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS
* OR LOST SAVINGS WHATSOEVER.
*/
/*
* COPYRIGHT 2010, SCIENCE APPLICATIONS INTERNATIONAL CORPORATION.
* ALL RIGHTS RESERVED.
*
*/
// SRM_OTHERS_GOES_HERE
/**
@author David Shen
*/
package SRM;
class EqinConv extends SphereConv
{
protected EqinConv()
{
// setting the source and destinations of this conversion object
super (SRM_SRFT_Code.SRFTCOD_EQUATORIAL_INERTIAL,
new SRM_SRFT_Code[] {SRM_SRFT_Code.SRFTCOD_CELESTIOCENTRIC,
SRM_SRFT_Code.SRFTCOD_UNSPECIFIED });
}
protected Conversions makeClone() {
return (Conversions) new EqinConv();
}
/*
*----------------------------------------------------------------------------
*
* Conversion dispatcher
*
*----------------------------------------------------------------------------
*/
protected SRM_Coordinate_Valid_Region_Code convert(SRM_SRFT_Code destSrfType,
BaseSRF srcSrf,
BaseSRF destSrf,
double[] src,
double[] dest,
SRM_ORM_Trans_Params hst) throws SrmException
{
SRM_Coordinate_Valid_Region_Code retValid =
SRM_Coordinate_Valid_Region_Code.COORDVALRGN_VALID;
if (destSrfType == SRM_SRFT_Code.SRFTCOD_CELESTIOCENTRIC)
{
// perform pre validation
retValid = CoordCheck.forSpherical( src );
toCcen(srcSrf, destSrf, src, dest);
}
else if (destSrfType == SRM_SRFT_Code.SRFTCOD_UNSPECIFIED)
{
// just pass the coordinate through. This is the last conversion of chain
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
}
return retValid;
}
}
|
[
"leifer@gmail.com"
] |
leifer@gmail.com
|
a1f79b3f21412064f3ba12e7b0d3d97f4ffcd049
|
8444e8636f2003fb2c0048b0a930bff234353e53
|
/CMP338_HW2_Bubble_and_Insertion_Sort/src/RuntimeInterface.java
|
e21e888f208ad76d58f1e95275a131852fd2c084
|
[] |
no_license
|
seerocode/cmp338-ds-and-algos
|
73bc1ad9e9a4ff1d8fe689f57847391d4f2e0a27
|
49cc0dc040e60ea49b382c26d54f1efed631f7f8
|
refs/heads/master
| 2021-01-22T15:59:40.087371
| 2017-12-11T04:52:31
| 2017-12-11T04:52:31
| 102,385,655
| 1
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,944
|
java
|
/**
*
* This interface will be used to organize and manage runtimes that are measured for specific operations.
*
* The user will utilze <code>System.nanoTime()</code> to measure the runtime of an operation.
*
* <p>Before the operation is started, you can obtain the start time:
* <br>
* <code>startTime = System.nanoTime()</code>.</p>
*
* <p>After the operation is completed, you can obtain the end time:
* <br>
* <code>endTime = System.nanoTime()</code>.</p>
*
* <p>Run Time is then:
* <br>
* <code>runTime = endTime - startTime</code>. </p>
*
* @author Sameh A. Fakhouri
*
*/
public interface RuntimeInterface {
/**
*
* This method is used to retrieve the last runtime. If no runtime
* has been added, the method will return a zero.
*
* @return The last runtime, in nanoseconds, or zero.
*
*/
public long getLastRunTime();
/**
*
* This method returns an array of <b>long</b> values representing the last 10 runtimes.
* If less than 10 runtimes are available, the remaining
* runtimes should be zero. If more than 10 runtimes have been added, the array
* should contain the last 10 runtimes.
*
* @return An array of <b>long</b> values representing the last 10 runtimes.
*
*/
public long[] getRunTimes();
/**
*
* This method is used to reset all 10 linear search times to zero.
*
*/
public void resetRunTimes();
/**
*
* This method is used to add a runtime.
*
* @param runTime a <b>long</b> value representing the runtime in nanoseconds.
*
*/
public void addRuntime(long runTime);
/**
*
* This method is used to obtain the average runtime. The method should average all
* the non-zero runtimes that are available. If no runtimes are available, the method
* returns a zero.
*
* @return A <b>double</b> value representing the average of all the non-zero runtimes, or zero.
*
*/
public double getAverageRunTime();
}
|
[
"ro@DESKTOP-GIDKRUJ.localdomain"
] |
ro@DESKTOP-GIDKRUJ.localdomain
|
b91cfb90940135e36ace8ce687961ef48dea6db8
|
29bbaf8e1c370c922a9d4ff6226b74627a7449c5
|
/src/test/java/com/himanshu/cluster/TestClusterSetup.java
|
d29f22c7ba84e8c331be51b69453f13e08d6abe1
|
[] |
no_license
|
him-bhar/cluster-poc
|
3823d0b341edee13c77b8d5c718254e205898637
|
210df85ac037ecce861fef869e68d41034527cdd
|
refs/heads/master
| 2020-04-01T19:58:32.263432
| 2012-05-24T11:53:29
| 2012-05-24T11:53:29
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,048
|
java
|
package com.himanshu.cluster;
import java.util.Collection;
import java.util.List;
import org.jgroups.Address;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import com.himanshu.cluster.Cluster;
import com.himanshu.cluster.NodeJob;
import com.himanshu.cluster.impl.DummyJobImpl;
import com.himanshu.cluster.impl.DummyJobResultImpl;
import com.himanshu.cluster.impl.JGroupsClusterImpl;
public class TestClusterSetup {
static Logger LOG = LoggerFactory.getLogger(TestClusterSetup.class);
private XmlBeanFactory ctx = null;
private String CLUSTER_BEAN_NAME = "cluster";
private String JOB_BOMBARDER_BEAN_NAME = "jobBombarder";
private String CLUSTER_MXBEAN_BEAN_NAME = "clusterMBean";
private JGroupsClusterImpl cluster = null;
@Before
public void initMethod() {
System.setProperty("com.iperia.vx.mg.cluster.name", "himanshu");
org.springframework.core.io.Resource xmlRes = new ClassPathResource("/mg-cluster.xml");
ctx = new XmlBeanFactory(xmlRes);
PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
cfg.setProperties(System.getProperties());
cfg.postProcessBeanFactory(ctx);
}
@Test
public void test() throws Exception {
//JGroupsClusterImpl clusterInstance = (JGroupsClusterImpl)ctx.getBean(BEAN_NAME);
Cluster cluster = (JGroupsClusterImpl)ctx.getBean(CLUSTER_BEAN_NAME);
ctx.getBean(CLUSTER_MXBEAN_BEAN_NAME);
LOG.info("Current node address is :"+cluster.getCurrentNodeIpAddress());
cluster.registerListener(new Cluster.Listener() {
@Override
public void onMasterReelection(String masterAddress, String currentNodeAddress) {
LOG.debug("Master Re-election done");
}
@Override
public NodeJob onJobReceive(NodeJob job) {
//job = null;
job.getJobId();
LOG.debug("New job received:"+job);
DummyJobResultImpl result = new DummyJobResultImpl();
result.setResult("GOLA");
((DummyJobImpl)job).setNodeJobResult(result);
return job;
}
@Override
public void onResponseReceive(Collection<NodeJob> result) {
LOG.debug("Response received is:"+result);
//return result;
}
@Override
public void onNewNodesAdded(Collection<String> nodesLogicalNames) {
LOG.debug("New nodes added are: "+nodesLogicalNames);
}
@Override
public void onNodesRemoved(Collection<String> nodesLogicalNames) {
LOG.debug("Nodes removed are :"+nodesLogicalNames);
}
});
LOG.debug("Cluster started");
System.out.println(cluster.getCurrentNodeIpAddress());
//System.out.println(cluster.getCurrentNodeIpAddress());
try {
Thread.currentThread().sleep(24*60*60*1000); //24 hours sleep
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@After
public void cleanup() {
}
}
|
[
"him_bhar@hotmail.com"
] |
him_bhar@hotmail.com
|
c905b5ac4160764877b4d19b73411f2fbc529759
|
e8f0b47754487c485bbef3906dde7879297c6fbc
|
/src/test/java/com/dfire/qa/meal/vo/boss/Style.java
|
9a629c816a437dfa69b54d1af7a8351e8c98f0d6
|
[] |
no_license
|
wuyajun2016/interfacetest
|
b5ae4fb3c831615b4b2b686027f4e0493b7cf726
|
94e54bc578a66b2aa8854e5b65f2a2356ae06929
|
refs/heads/master
| 2021-07-01T15:20:09.922558
| 2017-09-21T10:13:13
| 2017-09-21T10:13:13
| 103,607,465
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 595
|
java
|
package com.dfire.qa.meal.vo.boss;
public class Style {
private String bag;
private String tone;
private String icon;
private String entityId;
public String getBag() {
return bag;
}
public void setBag(String bag) {
this.bag = bag;
}
public String getTone() {
return tone;
}
public void setTone(String tone) {
this.tone = tone;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getEntityId() {
return entityId;
}
public void setEntityId(String entityId) {
this.entityId = entityId;
}
}
|
[
"xianmao@2dfire.com"
] |
xianmao@2dfire.com
|
3d98ca5eb4f8c3870d3333355e3a3a838dd96676
|
60af2942b936f6e060f48313eb319c66dd9a2f5e
|
/InheritanceLesson/src/com/company/Animal.java
|
54cd2d35b96f526c75c22cdfe2997ed814a10a72
|
[] |
no_license
|
MattMal/checker
|
b7c534ff69d8f373a905bdeca77dd72b7fad0eb9
|
754109f77a1614d596291957ead6ddec1a3815a8
|
refs/heads/master
| 2020-06-24T05:28:41.433373
| 2017-07-11T17:41:17
| 2017-07-11T17:41:17
| 96,920,286
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 740
|
java
|
package com.company;
/**
* Created by owner on 2017-07-02.
*/
public class Animal implements Contract{
public Animal() {
System.out.println("Animal Constructor");
}
public void walk(){
System.out.println("The animal is walking");
}
public void speak(){
System.out.println("The animal is speaking");
}
public void eat(){
System.out.println("The animal is eating");
}
public void breath(){
System.out.println("The animal is breathing");
}
@Override
public void see() {
System.out.println("The animal must have eyes");
}
@Override
public void excrete() {
System.out.println("The animal must take shits");
}
}
|
[
"tmalumi@gmail.com"
] |
tmalumi@gmail.com
|
3363d0d39ef690dc969c37f077c3cda56c4034b0
|
ec173fb31aec430888de0ebe10e9762226499cb6
|
/emarket-master/cloud-seller-service/src/main/java/com/emarket/emarket/service/SellerService.java
|
d5d35e066bdc7ceeb975333be0a6d3f0b5618f82
|
[] |
no_license
|
cblttlm/emarket-milestone4
|
033b8d922c8b4cfbdc2b0454a890cb60628650e0
|
3f972743bcdbbd0a04895d63964bd1e6c9cfbe7e
|
refs/heads/master
| 2022-09-04T07:22:04.045162
| 2020-05-27T22:08:48
| 2020-05-27T22:08:48
| 267,345,925
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,402
|
java
|
package com.emarket.emarket.service;
import java.util.List;
import com.emarket.emarket.entity.SellerEntity;
public interface SellerService {
/**
* @Title: findAllUsers
* <p>Description: get all seller information from userid
* </p>
* @param
* @return seller information list
* @author: chenbl
* @version 1.0
*/
public List<SellerEntity> findAllUsers();
/**
* @Title: findUserById
* <p>Description: get seller information from userid
* </p>
* @param id userid
* @return seller information
* @author: chenbl
* @version 1.0
*/
public SellerEntity findUserById(Integer id);
/**
* @Title: createUser
* <p>Description: create seller information
* </p>
* @param user
* @return seller information
* @author: chenbl
* @version 1.0
*/
public SellerEntity createUser(SellerEntity user);
/**
* @Title: updateUser
* <p>Description: update seller information
* </p>
* @param user
* @return seller information
* @author: chenbl
* @version 1.0
*/
public SellerEntity updateUser(SellerEntity user);
/**
* @Title: delete
* <p>Description: delete seller information by id
* </p>
* @param id
* @return delete success information
* @author: chenbl
* @version 1.0
*/
public void delete(Integer id);
}
|
[
"60694075+cblttlm@users.noreply.github.com"
] |
60694075+cblttlm@users.noreply.github.com
|
bc25e15367c2efa0b0cd3878d083625f3299794f
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/33/33_8a3dd4480ee6eb8b0c89b26ad696cbee528da401/Soap/33_8a3dd4480ee6eb8b0c89b26ad696cbee528da401_Soap_t.java
|
3e2cc629e4a394ef7666f490b242aad387ff328d
|
[] |
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
| 20,922
|
java
|
/*
* This code is subject to the HIEOS License, Version 1.0
*
* Copyright(c) 2008-2009 Vangent, Inc. All rights reserved.
*
* 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.vangent.hieos.xutil.soap;
import com.vangent.hieos.xutil.exception.XdsException;
import com.vangent.hieos.xutil.exception.XdsFormatException;
import com.vangent.hieos.xutil.exception.XdsInternalException;
import com.vangent.hieos.xutil.metadata.structure.MetadataSupport;
import com.vangent.hieos.xutil.xml.Util;
import java.util.HashMap;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.OperationContext;
import com.vangent.hieos.xutil.xconfig.XConfig;
import java.util.List;
import org.apache.axis2.engine.Phase;
import com.vangent.hieos.xutil.xua.handlers.XUAOutPhaseHandler;
import com.vangent.hieos.xutil.xua.utils.XUAConstants;
import com.vangent.hieos.xutil.xua.utils.XUAObject;
import java.util.Iterator;
import javax.xml.namespace.QName;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.log4j.Logger;
/**
* Main point of making SOAP requests via AXIS2.
*
* @author Bernie Thuman (adapted from original NIST code).
*/
public class Soap {
private final static Logger logger = Logger.getLogger(Soap.class);
// Default values (if XConfig is not available).
private static final long DEFAULT_ASYNC_TIMEOUT_MSEC = 120000; // 120 secs.
private static final long DEFAULT_SYNC_TIMEOUT_MSEC = 45000; // 45 secs.
private static final String DEFAULT_ASYNC_RESPONSE_PORT = "8080";
// XConfig propertie names.
private static final String XCONFIG_PARAM_ASYNC_TIMEOUT_MSEC = "SOAPAsyncTimeOutInMilliseconds";
private static final String XCONFIG_PARAM_SYNC_TIMEOUT_MSEC = "SOAPtimeOutInMilliseconds";
private static final String XCONFIG_PARAM_ASYNC_RESPONSE_PORT = "SOAPAsyncResponseHTTPPort";
// Axis2 property names.
private static final String AXIS2_PARAM_RUNNING_PORT = "RUNNING_PORT";
private static final String XUA_OUT_PHASE_NAME = "XUAOutPhase";
// Private variables:
private XUAObject xuaObject = null; // Only used if XUA is enabled (null if not used).
private ServiceClient serviceClient = null; // Cached Axis2 ServiceClient.
private OMElement result = null; // Holds the SOAP result.
private boolean async = false; // Boolean value (determines "async" mode).
/**
* Set boolean value to determine if this request should be an asynchronous
* SOAP request.
*
* @param async Set to true if asynchronous. Otherwise, set to false.
*/
public void setAsync(boolean async) {
this.async = async;
}
/**
* Sets the XUA object used to properly generate SAML during Axis2 outbound
* message handling.
*
* @param xuaObj The XUAObject.
*/
public void setXUAObject(XUAObject xuaObj) {
this.xuaObject = xuaObj;
}
/**
* Issues a SOAP call to the target endpoint.
*
* @param body The SOAP body to send.
* @param endpoint The target endpoint of the request.
* @param mtom Set to true if MTOM should be enabled. Otherwise, false.
* @param addressing Set to true if SOAP addressing should be enabled. Otherwise, false.
* @param soap12 Set to true if SOAP 1.2 should be enabled. Otherwise, false.
* @param action The SOAP action associated with the request.
* @param expectedReturnAction The expected SOAP return action.
* @return The SOAP body of the result.
* @throws XdsException
*/
public OMElement soapCall(OMElement body, String endpoint, boolean mtom,
boolean addressing, boolean soap12, String action, String expectedReturnAction)
throws XdsException {
try {
// Get the AXIS2 ServiceClient.
if (this.serviceClient == null) {
this.serviceClient = new ServiceClient();
}
// Setup ServiceClient options.
Options options = this.serviceClient.getOptions();
this.setTargetEndpoint(options, endpoint);
this.setMTOMOption(options, mtom);
this.setTimeOutFromConfig(options);
this.setSOAPAction(options, action);
this.setAddressing(this.serviceClient, addressing);
this.setSOAPVersion(options, soap12);
// Configure for "async" mode (if required).
if (this.async) {
if (!options.isUseSeparateListener()) {
options.setUseSeparateListener(this.async);
}
// Now, check to see if the request is simply "http".
if (endpoint.startsWith("http://")) {
this.setAsyncResponsePort();
// NOTE: HTTPS is handled via "axis2.xml" configuration.
}
}
// Setup for XUA (if required).
this.setupXUA(serviceClient);
HttpConnectionManager connMgr =
new XUtilSimpleHttpConnectionManager(true);
HttpClient httpClient = new HttpClient(connMgr);
// set the above created objects to re use.
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
Constants.VALUE_TRUE);
options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,
httpClient);
/*
* This cleanup option will call response.getEnvelope().build()
* However, envelope.build() does not build everything
* and any subsequent access to the atttachement(s) will
* throw a closed stream exception,
* an explicit clean up is below
*
* options.setCallTransportCleanup(true);
*/
// Make the SOAP request (and save the result).
this.result = serviceClient.sendReceive(body);
// explicitly build the whole response and clean up
if (this.result != null) {
MessageContext mc = this.serviceClient.
getLastOperationContext().
getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (mtom) {
mc.getEnvelope().buildWithAttachments();
} else {
mc.getEnvelope().build();
}
this.serviceClient.cleanupTransport();
}
// Cleanup after "async" (if required).
// if (this.async) {
// serviceClient.cleanupTransport();
// }
// Make sure response is what is expected.
this.validateSOAPResponse(this.serviceClient, mtom);
// Validate proper return action is received.
if (this.async) {
verifySOAPReturnAction(expectedReturnAction, "urn:mediateResponse");
} else if (addressing) { // Only validate in this case.
verifySOAPReturnAction(expectedReturnAction, null);
}
// Return the SOAP result.
return this.result;
} catch (AxisFault e) {
// If an AxisFault ... turn into an XdsException and get out.
throw new XdsException(e.getMessage(), e);
}
}
/**
* Returns the result of the SOAP request.
*
* @return The SOAP body response.
*/
public OMElement getResult() {
return result;
}
/*
* Returns a deep copy of the SOAP "in" header.
*
* @return A deep copy of the SOAP "in" header.
* @throws XdsInternalException
*/
public OMElement getInHeader() throws XdsInternalException {
OperationContext oc = serviceClient.getLastOperationContext();
HashMap<String, MessageContext> ocs = oc.getMessageContexts();
MessageContext in = ocs.get("In");
if (in == null) {
return null;
}
if (in.getEnvelope() == null) {
return null;
}
if (in.getEnvelope().getHeader() == null) {
return null;
}
return Util.deep_copy(in.getEnvelope().getHeader());
}
/**
* Returns a deep copy of the SOAP "out" header.
*
* @return A deep copy of the SOAP "out" header.
* @throws XdsInternalException
*/
public OMElement getOutHeader() throws XdsInternalException {
OperationContext oc = serviceClient.getLastOperationContext();
HashMap<String, MessageContext> ocs = oc.getMessageContexts();
MessageContext out = ocs.get("Out");
if (out == null) {
return null;
}
return Util.deep_copy(out.getEnvelope().getHeader());
}
/**
* Set the target endpoint.
*
* @param options Axis2 ServiceClient options.
* @param endpoint The target http/https endpoint.
*/
private void setTargetEndpoint(Options options, String endpoint) {
options.setTo(new EndpointReference(endpoint));
}
/**
* Set the MTOM option (true or false).
*
* @param options Axis2 ServiceClient options.
* @param mtom true if MTOM should be enabled. Otherwise, false.
*/
private void setMTOMOption(Options options, boolean mtom) {
options.setProperty(Constants.Configuration.ENABLE_MTOM,
((mtom) ? Constants.VALUE_TRUE : Constants.VALUE_FALSE));
}
/**
* Set the "time out" for the request. Pulled from XConfig if available; otherwise,
* sets to default values.
*
* @param options Axis2 ServiceClient options.
*/
private void setTimeOutFromConfig(Options options) {
// Set defaults first in case configuration is not available.
long timeOut;
if (this.async) {
timeOut = Soap.DEFAULT_ASYNC_TIMEOUT_MSEC;
} else {
timeOut = Soap.DEFAULT_SYNC_TIMEOUT_MSEC;
}
try {
XConfig cfg = XConfig.getInstance();
if (this.async) {
timeOut = cfg.getHomeCommunityConfigPropertyAsLong(Soap.XCONFIG_PARAM_ASYNC_TIMEOUT_MSEC);
} else {
timeOut = cfg.getHomeCommunityConfigPropertyAsLong(Soap.XCONFIG_PARAM_SYNC_TIMEOUT_MSEC);
}
} catch (Exception e) {
logger.warn("Unable to get SOAP timeout from XConfig -- using default");
}
options.setTimeOutInMilliSeconds(timeOut);
}
/**
* Set the SOAP action to use in the request.
*
* @param options Axis2 ServiceClient options.
* @param action The SOAP action.
*/
private void setSOAPAction(Options options, String action) {
options.setAction(action);
}
/**
* Engage (or desengage) Axis2 SOAP "addressing".
*
* @param sc The Axis2 ServiceClient.
* @param addressing true if SOAP addressing should be used. Otherwise, false.
* @throws AxisFault
*/
private void setAddressing(ServiceClient sc, boolean addressing) throws AxisFault {
if (addressing) {
sc.engageModule("addressing");
} else {
sc.disengageModule("addressing"); // this does not work in Axis2 yet
}
}
/**
* Set the SOAP version to use.
*
* @param options Axis2 ServiceClient options.
* @param soap12 true if SOAP1.2 should be used. false if SOAP1.1.
*/
private void setSOAPVersion(Options options, boolean soap12) {
options.setSoapVersionURI(
((soap12) ? SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI : SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
}
/**
* Configure Axis2 port to use for asynchronous SOAP responses. Should set in
* XConfig (a default port will be used if not found) to match the HTTP listener
* port being used by the application server.
*/
private void setAsyncResponsePort() {
// Get default in case configuration is not set.
String responsePort = Soap.DEFAULT_ASYNC_RESPONSE_PORT;
// Now, set the proper listening port.
ConfigurationContext ctx = this.serviceClient.getServiceContext().getConfigurationContext();
if (ctx.getProperty(Soap.AXIS2_PARAM_RUNNING_PORT) == null) {
try {
XConfig cfg = XConfig.getInstance();
responsePort = cfg.getHomeCommunityConfigProperty(Soap.XCONFIG_PARAM_ASYNC_RESPONSE_PORT);
} catch (Exception e) {
logger.warn("Unable to get " + Soap.XCONFIG_PARAM_ASYNC_RESPONSE_PORT + " from XConfig -- using default");
}
ctx.setProperty(Soap.AXIS2_PARAM_RUNNING_PORT, responsePort);
}
}
/**
* Validate that if the inbound request was MTOM, the result is also.
*
* @param sc The ServiceClient used to support SOAP request.
* @param mtomExpected Set to true if MTOM is expected.
* @throws XdsFormatException
*/
private void validateSOAPResponse(ServiceClient sc, boolean mtomExpected) throws XdsFormatException, XdsInternalException {
Object in = sc.getServiceContext().getLastOperationContext().getMessageContexts().get("In");
if (!(in instanceof MessageContext)) {
throw new XdsInternalException("Soap: In MessageContext of type " + in.getClass().getName() + " instead of MessageContext");
}
MessageContext messageContext = (MessageContext) in;
boolean responseMtom = messageContext.isDoingMTOM();
if (mtomExpected != responseMtom) {
if (mtomExpected) {
throw new XdsFormatException("Request was MTOM format but response was SIMPLE SOAP");
} else {
throw new XdsFormatException("Request was SIMPLE SOAP but response was MTOM");
}
}
}
/**
* Verify that the the SOAP response includes the extected return SOAP action.
*
* @param expectedReturnAction Expected SOAP return action.
* @param alternateReturnAction Alternative expected SOAP return action.
* @throws XdsException
*/
private void verifySOAPReturnAction(String expectedReturnAction, String alternateReturnAction) throws XdsException {
if (expectedReturnAction == null) {
return; // None expected.
}
// First see if a SOAP header exists.
OMElement soapHeader = this.getInHeader();
if (soapHeader == null) {
throw new XdsInternalException(
"No SOAPHeader returned: expected header with action = " + expectedReturnAction);
}
// Now see if the SOAP action exists.
OMElement action = MetadataSupport.firstChildWithLocalName(soapHeader, "Action");
if (action == null) {
throw new XdsInternalException(
"No action returned in SOAPHeader: expected action = " + expectedReturnAction);
}
// Now get the SOAP action value and compare against expected results.
String soapActionValue = action.getText();
if (alternateReturnAction == null) {
if (soapActionValue == null || !soapActionValue.equals(expectedReturnAction)) {
throw new XdsInternalException(
"Wrong action returned in SOAPHeader: expected action = " + expectedReturnAction
+ " returned action = " + soapActionValue);
}
} else {
if (soapActionValue == null
|| ((!soapActionValue.equals(expectedReturnAction)) && (!soapActionValue.equals(alternateReturnAction)))) {
throw new XdsInternalException(
"Wrong action returned in SOAPHeader: expected action = " + expectedReturnAction
+ " returned action = " + soapActionValue);
}
}
}
/**
* Sets the XUA "Out Phase Handler" (if XUA is enabled).
*/
private void setupXUA(ServiceClient serviceClient) {
OMElement currentSecurityHeader = this.getCurrentSecurityHeader();
if (currentSecurityHeader != null) {
// Must be on server-side -- propogate Security header on out-bound requests.
serviceClient.addHeader(currentSecurityHeader);
} else if ((this.xuaObject != null) && (this.xuaObject.isXUAEnabled())) {
List outFlowPhases = serviceClient.getAxisConfiguration().getOutFlowPhases();
// Check to see if the out phase handler already exists
for (Iterator it = outFlowPhases.iterator(); it.hasNext();) {
Phase phase = (Phase) it.next();
if (phase.getName().equals(XUA_OUT_PHASE_NAME)) {
// Already exists.
return; // EARLY EXIT!
}
}
logger.info("Adding XUA out phase handler!!!");
Phase xuaOutPhase = this.getXUAOutPhaseHandler();
outFlowPhases.add(xuaOutPhase);
}
}
/**
* Sets the XUA "Out Phase Handler".
*
* @return Axis2 Phase (XUAOutPhaseHandler).
*/
private Phase getXUAOutPhaseHandler() {
Phase phase = null;
try {
phase = new Phase(XUA_OUT_PHASE_NAME);
XUAOutPhaseHandler xuaOutPhaseHandler = new XUAOutPhaseHandler();
xuaOutPhaseHandler.setXUAObject(this.xuaObject);
phase.addHandler(xuaOutPhaseHandler);
} catch (Throwable t) {
logger.error("Exception while initializing the XUA out phase handler", t);
t.printStackTrace();
}
return phase;
}
/**
*
* @return
*/
private OMElement getCurrentSecurityHeader() {
OMElement securityHeader = null;
MessageContext currentMessageContext = MessageContext.getCurrentMessageContext();
if (currentMessageContext != null) {
//System.out.println("+++ XUA - Current SOAP Action: "
// + MessageContext.getCurrentMessageContext().getSoapAction());
// Get the SOAP envelope from the current message context
SOAPEnvelope env = currentMessageContext.getEnvelope();
// Check to see if the envelope contains a Security header ... if so, propagate
SOAPHeader header = env.getHeader();
if (header != null) {
OMElement securityHeaderFromRequest = header.getFirstChildWithName(
new QName(XUAConstants.WS_SECURITY_NS_URL, "Security"));
//if (securityHeader != null) {
// System.out.println("+++++ FOUND +++++");
//}
securityHeader = Util.deep_copy(securityHeaderFromRequest);
}
}
return securityHeader;
// Attach assertion to wrapper and
//wsseSecurityHeader.addChild(samlTokenEle);
// Attach wrapper to SOAP message
//requestEnvelope.getHeader().addChild(wsseSecurityHeader);
}
}
|
[
"yuzhongxing88@gmail.com"
] |
yuzhongxing88@gmail.com
|
4a9ba12908038918e97d46c255f1648129f591d9
|
a69fd4e23de3c3b1ddda4907184caefc018157a5
|
/src/cn/lcy/ontology/query/sem/model/SemanticGraph.java
|
fb27354d2c83bd02da96ec0b2e7d12f6c4ce1ce3
|
[] |
no_license
|
BestJex/answer-ontology-query
|
3202c8fc76689315994a96b88297d33d49fd8baa
|
c4fbe7c93e0bec21a0166d6c71c84977f9d2ff8d
|
refs/heads/master
| 2021-09-11T13:53:53.961505
| 2020-02-27T14:39:05
| 2020-02-27T14:39:05
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,500
|
java
|
package cn.lcy.ontology.query.sem.model;
import edu.stanford.nlp.graph.DirectedMultiGraph;
public class SemanticGraph extends DirectedMultiGraph<SemanticGraphVertex, SemanticGraphEdge> {
/**
* default serial version ID
*/
private static final long serialVersionUID = 1L;
public boolean printGraph() {
StringBuilder s = new StringBuilder();
s.append("{\n");
s.append("Graph:\n");
for (SemanticGraphVertex sourceVertex : this.getAllVertices()) {
for (SemanticGraphEdge edge : this.getOutgoingEdges(sourceVertex)) {
SemanticGraphVertex destVertex = new SemanticGraphVertex();
for (SemanticGraphVertex v : this.getAllVertices()) {
for (SemanticGraphEdge e : this.getIncomingEdges(v)) {
if (e.equals(edge)) {
destVertex = v;
}
}
}
s.append(sourceVertex.getWord().getName() + "(" + sourceVertex.getWord().getPostag() + ")");
s.append("-----" + edge.getWord().getName() + "(" + edge.getWord().getPostag() + ")" + "---->");
s.append(destVertex.getWord().getName() + "(" + destVertex.getWord().getPostag() + ")");
s.append("\n");
}
}
s.append('}');
System.out.println("语义图结构如下:" + s.toString());
return true;
}
}
|
[
"li_chuan_yue@foxmail.com"
] |
li_chuan_yue@foxmail.com
|
f72551cac2309e0172e42b6b2c54a79cc79be801
|
6236535103506d30173b10f42779900dda151765
|
/app/src/main/java/com/exercise/here/util/di/component/AppComponent.java
|
07069da2b220a59a70929951a4365c1ff069f27b
|
[] |
no_license
|
Adi-Matzliah/GetTaxi
|
8966ee0baf1721d27f0dc36378f04f4853790d63
|
e2e70ca91fef41c179efca772b85d365c068d152
|
refs/heads/master
| 2022-11-23T15:35:29.407052
| 2020-07-28T00:37:49
| 2020-07-28T00:37:49
| 171,181,143
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 749
|
java
|
package com.exercise.here.util.di.component;
import com.exercise.here.application.App;
import com.exercise.here.ui.main.MainActivity;
import com.exercise.here.ui.service.EtaUpdaterService;
import com.exercise.here.util.di.module.AppModule;
import com.exercise.here.util.di.module.ImageLoaderModule;
import com.exercise.here.util.di.module.NetworkModule;
import com.exercise.here.util.di.module.StorageModule;
import com.exercise.here.util.di.scope.AppScope;
import dagger.Component;
@AppScope
@Component(modules = {AppModule.class, NetworkModule.class, ImageLoaderModule.class, StorageModule.class})
public interface AppComponent {
void inject(App app);
void inject(MainActivity activity);
void inject(EtaUpdaterService service);
}
|
[
"Adi-Matzliah"
] |
Adi-Matzliah
|
f42655bdf5bcdba703d4edcf49d24faf6b8d0c01
|
d0c7cfa5872db5bb15ea2aa0eb6037e2f48d4be1
|
/BattleShip/src/player/Player.java
|
fa2460065ab5fb66c6ed1de90781de8dd102b5f2
|
[] |
no_license
|
SmileJun/1_2_PL_in_Java
|
92145b2c5b0dcc0ba2bfd156b50e526cc1421184
|
d77bb97a6a89738c80935dcb79885cb70cab82a5
|
refs/heads/master
| 2021-01-21T19:35:08.783356
| 2014-10-13T07:07:10
| 2014-10-13T07:07:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,162
|
java
|
package player;
import java.util.ArrayList;
import java.util.Iterator;
import enums.*;
import map.*;
import map.MapCell.CellState;
import ship.*;
public class Player {
ArrayList<Ship> shipList;
Map myMap;
Map enemyMap;
public Player() {
shipList = new ArrayList<Ship>(Ship.SHIP_NUM);
for (int i = 0; i < Ship.AIRCRAFT_NUM; i++) {
shipList.add(new Aircraft());
}
for (int i = 0; i < Ship.BATTLESHIP_NUM; i++) {
shipList.add(new BattleShip());
}
for (int i = 0; i < Ship.CRUISER_NUM; i++) {
shipList.add(new Cruiser());
}
for (int i = 0; i < Ship.DESTROYER_NUM; i++) {
shipList.add(new Destroyer());
}
myMap = new Map();
enemyMap = new Map();
init();
}
public void init() {
for (Iterator<Ship> iterator = shipList.iterator(); iterator.hasNext();) {
Ship ship = iterator.next();
ship.init();
}
myMap.init();
enemyMap.init();
}
public void placeShips() {
Position randomPos;
Direction randomDir;
int[] dx = { 0 };
int[] dy = { 0 };
for (Iterator<Ship> iterator = shipList.iterator(); iterator.hasNext();) {
Ship ship = iterator.next();
do {
randomPos = makeRandomPos();
randomDir = makeRandomDir();
} while (!myMap.isValidPlacePosition(randomPos.getX(), randomPos.getY(), randomDir, ship.getShipLength()));
randomDir.makeDxDyValueWithDir(dx, dy);
for (int i = 0; i < ship.getShipLength(); i++) {
MapCell currentCell = myMap.getCell(randomPos);
currentCell.setState(CellState.SHIP_STATE);
ship.addShipPart(randomPos.getX(), randomPos.getY());
randomPos.setX((char)(randomPos.getX() + dx[0]));
randomPos.setY((char)(randomPos.getY() + dy[0]));
}
}
}
public Position makeRandomPos() {
Position randomPos = new Position();
char randX = (char) (Map.START_COL + (char)((int)(Math.random()*Map.COL_SIZE)));
char randY = (char) (Map.START_ROW + (char)((int)(Math.random()*Map.ROW_SIZE)));
randomPos.setX(randX);
randomPos.setY(randY);
return randomPos;
}
public Direction makeRandomDir() {
Direction randomDir = new Direction();
randomDir.setDir((int)(Math.random()*Direction.DIRECTION_NUM));
return randomDir;
}
public Position makeAttackPosition() {
Position attackPos;
do {
attackPos = makeRandomPos();
} while(!enemyMap.isValidAttackPos(attackPos));
return attackPos;
}
/**
* 공격자가 적을 대상으로 공격을 한다
* @param pos 공격 위치
* @return 피격자가 보내온 공격결과 데이터
*/
public HitResult attack(Position pos) {
HitResult result;
for (Iterator<Ship> iterator = shipList.iterator(); iterator.hasNext();) {
Ship ship = iterator.next();
result = ship.hitCheck(pos);
if (result != HitResult.MISS) {
return result;
}
}
return HitResult.MISS;
}
/**
* 공격자가 공격을 한 뒤 피격자로부터 온 결과를 이용해 공격에 대한 처리를 수행
* @param pos : 공격했던 위치
* @param res : 피격자가 공격을 받은 후 보내온 결과
*/
public void attackHandler(Position pos, HitResult res) {
if (pos == null) {
return;
}
if (res == HitResult.HIT) {
MapCell targetCell = enemyMap.getCell(pos);
targetCell.setState(CellState.HIT_STATE);
}
if (res == HitResult.MISS) {
MapCell targetCell = enemyMap.getCell(pos);
targetCell.setState(CellState.MISS_STATE);
}
if (res == HitResult.DESTROY) {
MapCell targetCell = enemyMap.getCell(pos);
targetCell.setState(CellState.DESTROY_STATE);
}
}
public boolean isAllShipsDestroyed() {
int shipsTotalHP = 0;
for (Iterator<Ship> iterator = shipList.iterator(); iterator.hasNext();) {
Ship ship = iterator.next();
shipsTotalHP += ship.getShipHP();
}
if (shipsTotalHP > 0)
return false;
return true;
}
public void showShipListData() {
for (Iterator<Ship> iterator = shipList.iterator(); iterator.hasNext();) {
Ship ship = iterator.next();
ship.showShipData();
}
}
public ArrayList<Ship> getShipList() {
return shipList;
}
public Map getMyMap() {
return myMap;
}
public Map getEnemyMap() {
return enemyMap;
}
}
|
[
"Dreamwe@nhnnext.org"
] |
Dreamwe@nhnnext.org
|
f69c8d1fb1cf0daba7df037a6ba983de62fe3a64
|
0ae8985287221fabcd169b3e1ca86c34ee31597e
|
/RxJavaJason/src/main/java/com/itvillage/chapter05/chapter0503/ObservableSwitchMapExample02.java
|
c2a9e6e681170b5bb14f53d661e42b99dc54b055
|
[
"Apache-2.0"
] |
permissive
|
yunjaena/android_study
|
2c79a18151078e359a1d8acf0afe8348eff8c8b0
|
a80a9e5a55c58976c6ba2aec5e3365d0687231c4
|
refs/heads/master
| 2023-03-10T19:46:22.629847
| 2021-02-13T03:32:05
| 2021-02-13T03:32:05
| 278,050,486
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,721
|
java
|
package com.itvillage.chapter05.chapter0503;
import com.itvillage.utils.LogType;
import com.itvillage.utils.Logger;
import com.itvillage.utils.TimeUtil;
import io.reactivex.Observable;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* switchMap 대신 concatMap을 쓸 경우 비효율적인 검색 예제
*/
public class ObservableSwitchMapExample02 {
public static void main(String[] args) {
TimeUtil.start();
Searcher searcher = new Searcher();
// 사용자가 입력하는 검색어라고 가정한다.
final List<String> keywords = Arrays.asList("M", "Ma", "Mal", "Malay");
Observable.interval(100L, TimeUnit.MILLISECONDS)
.take(4)
.concatMap(data -> { /** concatMap을 사용했기때문에 매번 모든 키워드 검색 결과를 다 가져온다. */
String keyword = keywords.get(data.intValue()); // 데이터베이스에서 조회한다고 가정한다.
return Observable.just(searcher.search(keyword))
.doOnNext(notUse -> System.out.println("===================================================================="))
.delay(1000L, TimeUnit.MILLISECONDS);
})
.flatMap(resultList -> Observable.fromIterable(resultList))
.subscribe(
data -> Logger.log(LogType.ON_NEXT, data),
error -> {},
() ->{
TimeUtil.end();
TimeUtil.takeTime();;
}
);
TimeUtil.sleep(6000L);
}
}
|
[
"yunjaena@gmail.com"
] |
yunjaena@gmail.com
|
2f1d7032c2cbeeb800b8eb79c8878fe0379f5713
|
1d9f46f641f2b56c3b196169485c74ffb479dae4
|
/p/src/main/java/easyFrame/dao/RoleDao.java
|
dcaa0d4ef25a81fa1b3cfec9812ecde1c4e7c19f
|
[] |
no_license
|
olddaog/myp
|
90b1513625d3340061504bf0b429321b51478aeb
|
c68b9fcb67e9d3771ca76f38d91883870ed3468f
|
refs/heads/master
| 2021-01-12T08:56:03.224215
| 2017-02-22T08:59:33
| 2017-02-22T08:59:33
| 76,726,374
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 153
|
java
|
package easyFrame.dao;
import easyFrame.model.Menu;
import easyFrame.model.Role;
public interface RoleDao extends GenericDao<Role, Long> {
}
|
[
"1477736949@qq.com"
] |
1477736949@qq.com
|
2d0783f0b89719fd1fb205be7cfe3b07197f091b
|
baaeacfbaef1eda14257fe43d59d23b952739b29
|
/hello-spring/src/main/java/hello/hellospring/controller/MemberController.java
|
72a5f442873203e437ef735f4f3eaaab762cedc5
|
[] |
no_license
|
glotsomething/burning2021intheweb
|
1263f553563cd7daf64b1e798bb07a6deeb9f3bf
|
e252054fece123f1e859960e13c8d1f84b8aa190
|
refs/heads/main
| 2023-06-08T16:18:16.104825
| 2021-06-23T11:11:59
| 2021-06-23T11:11:59
| 372,319,407
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,212
|
java
|
package hello.hellospring.controller;
import hello.hellospring.domain.Member;
import hello.hellospring.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@Controller
public class MemberController {
private final MemberService memberService;
@Autowired
public MemberController(MemberService memberService) {
this.memberService = memberService;
}
@GetMapping("/members/new")
public String createForm(){
return "members/createMemberForm";
}
@PostMapping("/members/new")
public String create(MemberForm memberForm){
Member member = new Member();
member.setName(memberForm.getName());
memberService.join(member);
return "redirect:/";
}
@GetMapping("/members")
public String list(Model model){
List<Member> members = memberService.findMembers();
model.addAttribute("members", members);
return "members/memberList";
}
}
|
[
"govlwhdl@gmail.coom"
] |
govlwhdl@gmail.coom
|
e12f89ab46f5507169823571ad515c93325f4790
|
1380bfc931c2fbaef6fb6950edf3954f9066e061
|
/src/main/java/algorithm/list/SwapNodesInPairs.java
|
d787cac0410aebda715a1418f710db55e0b1b210
|
[] |
no_license
|
xiaobaoqiu/leetcode
|
506e89aed84ed8c3cf797ac12447133496193b99
|
beb804dd731651c0f2f8e08d882c0302ec3ea92a
|
refs/heads/master
| 2020-04-18T19:49:36.423349
| 2018-03-15T03:03:20
| 2018-03-15T03:03:20
| 66,132,596
| 2
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,784
|
java
|
package algorithm.list;
/**
* https://leetcode.com/problems/swap-nodes-in-pairs/
*
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space.
You may not modify the values in the list, only nodes itself can be changed.
* @author xiaobaoqiu Date: 16-5-28 Time: 上午12:05
*/
public class SwapNodesInPairs {
public static void main(String[] args) {
ListNode node1 = new ListNode(1);
ListNode node2 = new ListNode(2);
ListNode node3 = new ListNode(3);
ListNode node4 = new ListNode(4);
ListNode node5 = new ListNode(5);
node1.next = node2;
node2.next = node3;
node3.next = node4;
node4.next = node5;
printList(node1);
ListNode head = swapPairs(node1);
System.out.println();
printList(head);
}
/**
* 0 ms
* Your runtime beats 13.35% of java submissions
*/
public static ListNode swapPairs(ListNode head) {
if (head == null || head.next == null) return head;
ListNode node = head, next = node.next, pre;
head = head.next;
while(node != null && next != null) {
pre = node;
node.next = next.next;
next.next = node;
node = node.next;
if (node == null || node.next == null) break;
next = node.next;
pre.next = next;
}
return head;
}
private static void printList(ListNode head) {
ListNode node = head;
while(node != null) {
System.out.print(node.val + "-->");
node = node.next;
}
System.out.println();
}
}
|
[
"baoqiu.xiao@qunar.com"
] |
baoqiu.xiao@qunar.com
|
799479c0b093a7f9abe9e1563fd455b75d7fb01b
|
16eac8de4897bf360806c929ce5d6ac8d173bd53
|
/src/main/java/org/jprolog/library/AtomsAndStrings.java
|
510ba57b4db5d8dcff95654e66d7fa4ab85a52f1
|
[
"MIT"
] |
permissive
|
JamieHunter/prolog
|
1d1e241c8931b77410554f42f308f880e00fd008
|
fe97a9eb433037bd470003b070096b330d73f92f
|
refs/heads/master
| 2020-04-21T22:58:51.963172
| 2019-09-30T00:38:50
| 2019-09-30T00:38:50
| 169,930,853
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 31,103
|
java
|
// Author: Jamie Hunter, 2019
// Refer to LICENSE.TXT for copyright and license information
//
package org.jprolog.library;
import org.jprolog.bootstrap.Predicate;
import org.jprolog.constants.PrologAtom;
import org.jprolog.constants.PrologAtomLike;
import org.jprolog.constants.PrologInteger;
import org.jprolog.constants.PrologString;
import org.jprolog.exceptions.PrologDomainError;
import org.jprolog.exceptions.PrologInstantiationError;
import org.jprolog.exceptions.PrologTypeError;
import org.jprolog.execution.DecisionPointImpl;
import org.jprolog.execution.Environment;
import org.jprolog.expressions.Strings;
import org.jprolog.expressions.Term;
import org.jprolog.expressions.TermList;
import org.jprolog.flags.ReadOptions;
import org.jprolog.flags.WriteOptions;
import org.jprolog.io.StringOutputStream;
import org.jprolog.io.StructureWriter;
import org.jprolog.io.WriteContext;
import org.jprolog.parser.StringParser;
import org.jprolog.unification.Unifier;
import java.io.IOException;
import java.math.BigInteger;
import java.util.List;
import java.util.Locale;
import java.util.function.Function;
/**
* File is referenced by {@link Library} to parse all annotations.
* Atom manipulation predicates.
*/
public final class AtomsAndStrings {
private AtomsAndStrings() {
// Static methods/fields only
}
/**
* True if atom is of given length.
*
* @param environment Execution environment
* @param atomTerm Atom to obtain length
* @param lengthTerm Length of atom
*/
@Predicate("atom_length")
public static void atomLength(Environment environment, Term atomTerm, Term lengthTerm) {
commonLength(environment, atomTerm, lengthTerm, t -> PrologAtomLike.from(t).name());
}
/**
* True if string is of given length.
*
* @param environment Execution environment
* @param stringTerm String to obtain length
* @param lengthTerm Length of string
*/
@Predicate("string_length")
public static void stringLength(Environment environment, Term stringTerm, Term lengthTerm) {
commonLength(environment, stringTerm, lengthTerm, Strings::stringFromAnyString);
}
public static void commonLength(Environment environment, Term sourceTerm, Term lengthTerm, Function<Term, String> extract) {
if (!sourceTerm.isInstantiated()) {
throw PrologInstantiationError.error(environment, sourceTerm);
}
String text = extract.apply(sourceTerm);
Unifier.unifyInteger(environment, lengthTerm, text.length());
}
/**
* Utility to parse an string as a term or convert a term to a string
*
* @param environment Execution environment
* @param term Source/target term
* @param stringTerm String to convert to/from
* @param optionsTerm Parsing options
*/
@Predicate("term_string")
public static void termString(Environment environment, Term term, Term stringTerm, Term optionsTerm) {
if (stringTerm.isInstantiated()) {
stringToTerm(environment, stringTerm, term, new ReadOptions(environment, ro -> {
ro.fullStop = ReadOptions.FullStop.ATOM_optional;
}, optionsTerm));
} else {
if (!term.isInstantiated()) {
throw PrologInstantiationError.error(environment, term);
}
termToString(environment, term, stringTerm, new WriteOptions(environment, wo -> {
wo.quoted = true;
}, optionsTerm));
}
}
/**
* Utility to parse an string as a term or convert a term to a string
*
* @param environment Execution environment
* @param term Source/target term
* @param stringTerm String to convert to/from
*/
@Predicate("term_string")
public static void termString(Environment environment, Term term, Term stringTerm) {
termString(environment, term, stringTerm, null);
}
public static void stringToTerm(Environment environment, Term stringTerm, Term outTerm, ReadOptions options) {
String text = Strings.stringFromAtomOrAnyString(stringTerm);
Term out = StringParser.parse(environment, text, options);
Unifier.unifyTerm(environment, outTerm, out);
}
public static void termToString(Environment environment, Term inTerm, Term stringTerm, WriteOptions options) {
String text = StructureWriter.toString(environment, inTerm, options);
Unifier.unifyString(environment, stringTerm, text, Strings::stringFromAtomOrAnyString, PrologString::new);
}
/**
* Utility to parse an atom as a term
*
* @param environment Execution environment
* @param atomTerm Source atom
* @param outTerm Extracted term after parsing
* @param optionsTerm Parsing options
*/
@Predicate("read_term_from_atom")
public static void readTermFromAtom(Environment environment, Term atomTerm, Term outTerm, Term optionsTerm) {
if (!atomTerm.isInstantiated()) {
throw PrologInstantiationError.error(environment, atomTerm);
}
String text = PrologAtomLike.from(atomTerm).name();
ReadOptions readOptions = new ReadOptions(environment, ro -> {
ro.fullStop = ReadOptions.FullStop.ATOM_optional;
}, optionsTerm);
Term out = StringParser.parse(environment, text, readOptions);
Unifier.unifyTerm(environment, outTerm, out);
}
/**
* Either (a) concatenate left/right, (b) test left/right, (c) split into possible left/right
*
* @param environment Execution environment
* @param leftTerm Left atom term
* @param rightTerm Right atom term
* @param concatTerm Concatinated form
*/
@Predicate("atom_concat")
public static void atomConcat(Environment environment, Term leftTerm, Term rightTerm, Term concatTerm) {
concatCommon(environment, leftTerm, rightTerm, concatTerm, t -> PrologAtomLike.from(t).name(), PrologAtom::new);
}
/**
* Either (a) concatenate left/right, (b) test left/right, (c) split into possible left/right
*
* @param environment Execution environment
* @param leftTerm Left string term
* @param rightTerm Right string term
* @param concatTerm Concatinated form
*/
@Predicate("string_concat")
public static void stringConcat(Environment environment, Term leftTerm, Term rightTerm, Term concatTerm) {
concatCommon(environment, leftTerm, rightTerm, concatTerm, Strings::stringFromAnyString, PrologString::new);
}
/**
* Generic form of concat
*
* @param environment Execution environment
* @param leftTerm Left term
* @param rightTerm Right term
* @param concatTerm Concatinated form
* @param extract Extract term to a string
* @param create Create term from a string
*/
private static void concatCommon(Environment environment, Term leftTerm, Term rightTerm, Term concatTerm,
Function<Term, String> extract, Function<String, Term> create) {
String leftString = null;
String rightString = null;
String concatString = null;
if (leftTerm.isInstantiated()) {
leftString = extract.apply(leftTerm);
}
if (rightTerm.isInstantiated()) {
rightString = extract.apply(rightTerm);
}
if (concatTerm.isInstantiated()) {
concatString = extract.apply(concatTerm);
}
if (leftString != null && rightString != null) {
Unifier.unifyString(environment, concatTerm, leftString + rightString, extract, create);
return;
}
if (leftString != null && concatString != null) {
// rightTerm is uninstantiated
if (leftString.length() <= concatString.length() &&
concatString.substring(0, leftString.length()).equals(leftString)) {
Unifier.unifyString(environment, rightTerm, concatString.substring(leftString.length()), extract, create);
} else {
environment.backtrack();
}
return;
}
if (rightString != null && concatString != null) {
// leftTerm is uninstantiated
int off = concatString.length() - rightString.length();
if (rightString.length() <= concatString.length() &&
concatString.substring(off).equals(rightString)) {
Unifier.unifyString(environment, leftTerm, concatString.substring(0, off), extract, create);
} else {
environment.backtrack();
}
return;
}
if (concatString != null) {
// Final case enumerates all possible permutations
new Concat(environment, concatString, leftTerm, rightTerm, extract, create).redo();
return;
}
throw PrologInstantiationError.error(environment, concatTerm);
}
/**
* Given sub_atom(+Atom, ?Before, ?Length, ?After, ?SubAtom), identify all possible SubAtom's, and/or all possible
* Before/Length/After.
*
* @param environment Execution environment
* @param atomTerm Source atom, required
* @param beforeTerm Variable, or integer >= 0, number of characters before sub-atom
* @param lengthTerm Variable, or integer >=0, length of sub-atom
* @param afterTerm Variable, or integer >=0, number of characters after sub-atom
* @param subAtomTerm Variable, or defined sub-atom
*/
@Predicate("sub_atom")
public static void subAtom(Environment environment, Term atomTerm, Term beforeTerm, Term lengthTerm, Term afterTerm, Term subAtomTerm) {
String atomString;
if (atomTerm.isInstantiated()) {
atomString = PrologAtomLike.from(atomTerm).name();
} else {
throw PrologInstantiationError.error(environment, atomTerm);
}
new Sub(environment, atomString, beforeTerm, lengthTerm, afterTerm, subAtomTerm,
t -> PrologAtomLike.from(t).name(), PrologAtom::new).redo();
}
/**
* Given sub_string(+String, ?Before, ?Length, ?After, ?SubString), identify all possible SubString's, and/or all possible
* Before/Length/After.
*
* @param environment Execution environment
* @param stringTerm Source atom, required
* @param beforeTerm Variable, or integer >= 0, number of characters before sub-atom
* @param lengthTerm Variable, or integer >=0, length of sub-atom
* @param afterTerm Variable, or integer >=0, number of characters after sub-atom
* @param subStringTerm Variable, or defined sub-atom
*/
@Predicate("sub_string")
public static void subSting(Environment environment, Term stringTerm, Term beforeTerm, Term lengthTerm, Term afterTerm, Term subStringTerm) {
String sourceString;
if (stringTerm.isInstantiated()) {
sourceString = Strings.stringFromAnyString(stringTerm);
} else {
throw PrologInstantiationError.error(environment, stringTerm);
}
new Sub(environment, sourceString, beforeTerm, lengthTerm, afterTerm, subStringTerm,
Strings::stringFromAnyString, PrologString::new).redo();
}
/**
* Retrieve code at given 1-based index of string
*
* @param environment Execution environment
* @param indexTerm Index to retrieve from, must be instantiated, and is validated
* @param stringTerm String (or string-like) term
* @param codeTerm Unified with code (integer) at index
*/
@Predicate("get_string_code")
public static void getStringCode(Environment environment, Term indexTerm, Term stringTerm, Term codeTerm) {
// 1-index of code, range checked
String sourceText = Strings.stringFromAtomOrAnyString(stringTerm);
int index = PrologInteger.from(indexTerm).toInteger();
if (index < 1 || index > sourceText.length()) {
throw PrologDomainError.range(environment, 1, sourceText.length(), indexTerm);
}
if (codeTerm.isInstantiated()) {
PrologInteger.from(codeTerm).toChar(); // validate as a character code
}
int code = sourceText.charAt(index - 1);
Unifier.unifyInteger(environment, codeTerm, BigInteger.valueOf(code));
}
/**
* Retrieve code at given 1-based index of string. Or index where code appears, or iterate index and codes.
*
* @param environment Execution environment
* @param indexTerm Index or variable.
* @param stringTerm String (or string-like) term
* @param codeTerm Unified with code (integer) at index.
*/
@Predicate("string_code")
public static void stringCode(Environment environment, Term indexTerm, Term stringTerm, Term codeTerm) {
// 1-index of code, with backtracking
String sourceString = Strings.stringFromAtomOrAnyString(stringTerm);
new StringCodeIndex(environment, sourceString, indexTerm, codeTerm).redo();
}
/**
* Concatenate list of atomic values with separator.
*
* @param environment Execution environment
* @param listTerm List of values
* @param sepTerm Separator. Null indicates ""
* @param outTerm Term unified with concatenated value.
*/
@Predicate("atomics_to_string")
public static void atomicsToString(Environment environment, Term listTerm, Term sepTerm, Term outTerm) {
List<Term> list = TermList.extractList(listTerm);
String sepString;
if (sepTerm == null) {
sepString = "";
} else {
sepString = Strings.stringFromAtomOrAnyString(sepTerm);
}
WriteOptions opts = new WriteOptions(environment, null);
try (StringOutputStream output = new StringOutputStream()) {
WriteContext context = new WriteContext(
environment,
opts,
output);
StructureWriter structWriter = new StructureWriter(context);
boolean writeSep = false;
for (Term t : list) {
if (t.isAtomic()) {
if (writeSep) {
output.write(sepString);
}
structWriter.reset();
structWriter.write(t);
writeSep = true;
} else if (!t.isInstantiated()) {
throw PrologInstantiationError.error(environment, t);
} else {
throw PrologTypeError.atomicExpected(environment, t);
}
}
Unifier.unifyString(environment, outTerm, output.toString(),
Strings::stringFromAtomOrAnyString,
PrologString::new);
} catch (IOException e) {
throw new InternalError(e.getMessage(), e);
}
}
/**
* Concatenate list of atomic values with no separator.
*
* @param environment Execution environment
* @param listTerm List of values
* @param outTerm Term unified with concatenated value.
*/
@Predicate("atomics_to_string")
public static void atomicsToString(Environment environment, Term listTerm, Term outTerm) {
atomicsToString(environment, listTerm, null, outTerm);
}
@Predicate("string_upper")
public static void stringUpper(Environment environment, Term textTerm, Term upperTerm) {
String text = Strings.stringFromAtomOrAnyString(textTerm);
text = text.toUpperCase(Locale.ENGLISH); // TODO: Support locale?
Unifier.unifyString(environment, upperTerm, text,
Strings::stringFromAtomOrAnyString, PrologString::new);
}
@Predicate("string_lower")
public static void stringLower(Environment environment, Term textTerm, Term lowerTerm) {
String text = Strings.stringFromAtomOrAnyString(textTerm);
text = text.toLowerCase(Locale.ENGLISH); // TODO: Support locale?
Unifier.unifyString(environment, lowerTerm, text,
Strings::stringFromAtomOrAnyString, PrologString::new);
}
private static class Concat extends DecisionPointImpl {
private final String concat;
private final Term leftTerm;
private final Term rightTerm;
private final Function<Term, String> extract;
private final Function<String, Term> create;
private int split = 0;
protected Concat(Environment environment, String concat, Term leftTerm, Term rightTerm,
Function<Term, String> extract, Function<String, Term> create) {
super(environment);
this.concat = concat;
this.leftTerm = leftTerm;
this.rightTerm = rightTerm;
this.extract = extract;
this.create = create;
}
@Override
public void redo() {
if (split > concat.length()) {
environment.backtrack();
return;
}
environment.forward();
if (split < concat.length()) {
environment.pushDecisionPoint(this);
}
Unifier.unifyString(environment, leftTerm, concat.substring(0, split), extract, create);
Unifier.unifyString(environment, rightTerm, concat.substring(split), extract, create);
split++;
}
}
private static class Sub extends DecisionPointImpl {
private final String sourceString;
private final Term beforeTerm;
private final Term lengthTerm;
private final Term afterTerm;
private final Term subTerm;
private Integer beforeConstraint;
private Integer lengthConstraint;
private Integer afterConstraint;
private String subConstraint;
private int offset;
private int length;
private int limit;
private Runnable algorithm = this::backtrack;
private final Function<String, Term> create;
/**
* Create a new decision point associated with the environment. At time decision point is created, the local context,
* the catch point, the cut depth and the call stack are all snapshot and reused on each iteration of the decision
* point.
*
* @param environment Execution environment
*/
protected Sub(Environment environment, String sourceString, Term beforeTerm, Term lengthTerm, Term afterTerm, Term subTerm,
Function<Term, String> extract,
Function<String, Term> create) {
super(environment);
this.sourceString = sourceString;
this.beforeTerm = beforeTerm;
this.lengthTerm = lengthTerm;
this.afterTerm = afterTerm;
this.subTerm = subTerm;
this.create = create;
int sourceLength = sourceString.length();
offset = -1; // to help identify errors in below logic
length = -1;
limit = -1;
if (beforeTerm.isInstantiated()) {
beforeConstraint = PrologInteger.from(beforeTerm).notLessThanZero().toInteger();
if (beforeConstraint > sourceLength) {
return; // not solvable
}
}
if (lengthTerm.isInstantiated()) {
lengthConstraint = PrologInteger.from(lengthTerm).notLessThanZero().toInteger();
if (lengthConstraint > sourceLength) {
return; // not solvable
}
}
if (afterTerm.isInstantiated()) {
afterConstraint = PrologInteger.from(afterTerm).notLessThanZero().toInteger();
if (afterConstraint > sourceLength) {
return; // not solvable
}
}
if (subTerm.isInstantiated()) {
subConstraint = extract.apply(subTerm);
if (lengthConstraint != null) {
if (lengthConstraint != subConstraint.length()) {
return; // not solvable
}
} else {
// implied length constraint
lengthConstraint = subConstraint.length();
}
}
// infer additional constraints
if (beforeConstraint != null && lengthConstraint != null && afterConstraint == null) {
afterConstraint = sourceLength - (beforeConstraint + lengthConstraint);
if (afterConstraint < 0 || afterConstraint > sourceLength) {
return; // not solvable
}
}
if (beforeConstraint != null && lengthConstraint == null && afterConstraint != null) {
lengthConstraint = sourceLength - (beforeConstraint + afterConstraint);
if (lengthConstraint < 0 || lengthConstraint > sourceLength) {
return; // not solvable
}
}
if (beforeConstraint == null && lengthConstraint != null && afterConstraint != null) {
beforeConstraint = sourceLength - (afterConstraint + lengthConstraint);
if (beforeConstraint < 0 || beforeConstraint > sourceLength) {
return; // not solvable
}
}
// Given the constraints (provided or inferred), determine the algorithm and starting condition
if (beforeConstraint != null && lengthConstraint != null) {
assert afterConstraint != null;
int checkLen = beforeConstraint + lengthConstraint + afterConstraint;
if (checkLen != sourceLength) {
return; // not solvable
}
offset = limit = beforeConstraint;
length = lengthConstraint;
algorithm = this::fullyConstrained;
return;
}
if (beforeConstraint == null && afterConstraint != null) {
assert lengthConstraint == null;
algorithm = this::enumerateFixedRight;
offset = 0;
length = sourceLength - afterConstraint; // starting length
limit = length;
return;
}
if (beforeConstraint != null) {
assert afterConstraint == null;
assert lengthConstraint == null;
algorithm = this::enumerateFixedLeft;
offset = beforeConstraint;
length = 0;
limit = sourceLength;
return;
}
assert beforeConstraint == null;
assert afterConstraint == null;
offset = 0;
if (lengthConstraint == null) {
limit = sourceLength;
length = 0;
algorithm = this::enumerateAll;
} else if (lengthConstraint == 0) {
limit = sourceLength;
length = 0;
algorithm = this::scanEmpty;
} else if (subConstraint != null) {
length = lengthConstraint;
limit = sourceLength - lengthConstraint;
algorithm = this::scanString;
} else {
length = lengthConstraint;
limit = sourceLength - lengthConstraint;
algorithm = this::enumerateFixedLength;
}
}
/**
* All constraints applied, this only runs once
*/
protected void fullyConstrained() {
String sub = sourceString.substring(offset, offset + length);
unify(offset, sub);
}
/**
* Before is fixed, length and after are variable
*/
protected void enumerateFixedLeft() {
int end = offset + length;
String sub = sourceString.substring(offset, end);
if (end != limit) {
notLast();
}
unify(offset, sub);
length++;
}
/**
* After is fixed, length and before are variable
*/
protected void enumerateFixedRight() {
int end = offset + length;
String sub = sourceString.substring(offset, end);
if (offset != limit) {
notLast();
}
unify(offset, sub);
offset++;
length--;
}
/**
* Length is fixed, before and after are variable
*/
protected void enumerateFixedLength() {
int end = offset + length;
String sub = sourceString.substring(offset, end);
if (offset != limit) {
notLast();
}
unify(offset, sub);
offset++;
}
/**
* Completely unconstrained
*/
protected void enumerateAll() {
int end = offset + length;
String sub = sourceString.substring(offset, end);
if (offset != limit) {
notLast();
}
unify(offset, sub);
if (end == limit) {
offset++;
length = 0;
} else {
length++;
}
}
/**
* Algorithm: start/end constraints are empty,
* String is empty string
*/
protected void scanEmpty() {
if (offset == limit + 1) {
forceBacktrack();
return;
}
if (offset != limit) {
notLast();
}
unify(offset, "");
offset++;
}
/**
* Algorithm: start/end constraints are empty,
* String is a provided string.
*/
protected void scanString() {
for (; ; ) {
if (!scan()) {
forceBacktrack();
return;
}
if (sourceString.substring(offset, offset + length).equals(subConstraint)) {
break;
}
offset++;
}
if (offset < limit) {
notLast();
}
unify(offset, subConstraint);
offset++;
}
/**
* Helper for the scanString algorithm, find first character
*
* @return true if first character found
*/
protected boolean scan() {
char c = subConstraint.charAt(0);
while (offset <= limit) {
if (sourceString.charAt(offset) == c) {
return true;
}
offset++;
}
return false;
}
/**
* {@inheritDoc}
*/
@Override
public void redo() {
environment.forward();
algorithm.run();
}
/**
* Algorithm: Determined we've already failed
*/
protected void forceBacktrack() {
environment.backtrack();
}
/**
* Called to push decision point
*/
protected void notLast() {
environment.pushDecisionPoint(this);
}
protected void unify(int before, String sub) {
int length = sub.length();
int after = sourceString.length() - (length + before);
if (!beforeTerm.isInstantiated()) {
if (!beforeTerm.instantiate(PrologInteger.from(before))) {
forceBacktrack();
return;
}
}
if (!lengthTerm.isInstantiated()) {
if (!lengthTerm.instantiate(PrologInteger.from(length))) {
forceBacktrack();
return;
}
}
if (!afterTerm.isInstantiated()) {
if (!afterTerm.instantiate(PrologInteger.from(after))) {
forceBacktrack();
return;
}
}
if (!subTerm.isInstantiated()) {
if (!subTerm.instantiate(create.apply(sub))) {
forceBacktrack();
return;
}
}
}
}
private static class StringCodeIndex extends DecisionPointImpl {
private final String sourceString;
private final Term indexTerm;
private final Term codeTerm;
private final int codeConstraint;
private int index;
private final int limit;
/**
* Backtrackable algorithm to enumerate all indexes matching code, or all code/index combinations
*
* @param environment Execution environment
*/
protected StringCodeIndex(Environment environment, String sourceString, Term indexTerm, Term codeTerm) {
super(environment);
this.sourceString = sourceString;
this.indexTerm = indexTerm;
this.codeTerm = codeTerm;
if (indexTerm.isInstantiated()) {
index = PrologInteger.from(indexTerm).toInteger(); // 1-based
if (index < 1 || index > sourceString.length()) {
// force immediate failure
index = -1;
limit = 0;
} else {
limit = index; // inclusive
}
} else {
index = 1;
limit = sourceString.length();
}
if (codeTerm.isInstantiated()) {
codeConstraint = PrologInteger.from(codeTerm).toChar();
} else {
codeConstraint = -1;
}
}
/**
* {@inheritDoc}
*/
@Override
public void redo() {
if (codeConstraint >= 0) {
// find next index
while (index <= limit && index > 0) {
if (sourceString.charAt(index - 1) == codeConstraint) {
break;
}
index++;
}
}
if (index > limit || index <= 0) {
environment.backtrack();
return;
}
environment.forward();
if (index < limit) {
// this may backtrack to another solution
environment.pushDecisionPoint(this);
}
int code = sourceString.charAt(index - 1); // if codeConstraint >= 0, assume constraint checked
if (codeConstraint < 0) Unifier.unifyInteger(environment, codeTerm, BigInteger.valueOf(code));
if (!indexTerm.isInstantiated()) Unifier.unifyInteger(environment, indexTerm, BigInteger.valueOf(index));
index++;
}
}
}
|
[
"jamie+git@thehunters.org"
] |
jamie+git@thehunters.org
|
bc19526aa9902a35685f0e44750589ac083da1e1
|
c498baaa1c36984c8e0a2ac6ab908a52e0a217c7
|
/app/src/main/java/com/ecommerce/model/Merchant.java
|
f7b3fa052c5a77d125362e67b7196e3cf4510f6b
|
[] |
no_license
|
RakeshJv/Ecommerce
|
a30ec5f3b21c444d207a4f6325ec2f7ba3fb7230
|
26a00a61a6fd16c47c090677225333f216329845
|
refs/heads/master
| 2020-03-18T17:57:48.670390
| 2018-06-12T11:02:02
| 2018-06-12T11:02:02
| 135,063,003
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 847
|
java
|
package com.ecommerce.model;
/**
* Created by Rvaishya on 5/1/2018.
*/
public class Merchant extends Person{
int merchantId;
String nearLandmark;
public Contact getContact()
{
return contact;
}
public void setContact(Contact contact) {
this.contact = contact;
}
Contact contact;
public int getMerchantId() {
return merchantId;
}
public void setMerchantId(int merchantId) {
this.merchantId = merchantId;
}
public String getMerchantName() {
return this.name;
}
public void setMerchantName(String merchantName) {
this.name = merchantName;
}
public String getNearLandmark() {
return nearLandmark;
}
public void setNearLandmark(String nearLandmark) {
this.nearLandmark = nearLandmark;
}
}
|
[
"rakesh.vaishya@gmail.com"
] |
rakesh.vaishya@gmail.com
|
44d1bec36e0cb5ea98c7cd1f283ac9709f03f517
|
0eaa15aac3e6ced4c6d304fe7b793af2585ba56a
|
/quiz/src/quiz/Quiz29.java
|
7f3fbc89ca3efb9d190081042adbfe612b83253d
|
[] |
no_license
|
JaeHyun-Ban/GB_java
|
c9505e9ffdb58cc30081b8467af7441b68e8e739
|
6601f01c2419a2543a2ba74841d87ac2e1ae6359
|
refs/heads/master
| 2023-01-01T10:04:56.160762
| 2020-10-26T03:38:52
| 2020-10-26T03:38:52
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 954
|
java
|
package quiz;
import java.util.Scanner;
public class Quiz29 {
//숙제(?) - 08/26
//Quiz14
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("정수를 입력하세요: ");
int num = sc.nextInt();
int sum = 0;
int count = 0; //소수 체크
//소수들의 합
start:for(int i = 2; i <= num; i++) {
count = 0; //초기화
for(int j = 2; j <= i; j++) {
if(i%j == 0) {
count++;
}
//중간에 미리 쳐내서 반복문으로 돌아가게하면 더 빠르게(효율적)으로 작동한다
if(count > 1) { //실행 해보면 이게 더 빠름
continue start;
}
}
//값이 커질수록 조건식이 계산하는데 느려진다 ex) 1000000을 입력
if(count == 1) {
sum += i;
}
}
System.out.printf("%d까지 소수의 합은: %d\n", num, sum);
// 2 2
// 3 2
// 3
}//main
}
|
[
"wogus0008@gmail.com"
] |
wogus0008@gmail.com
|
e729993d76472f1d61c8e4abd9a788a465ea9a7b
|
5f8880a76d0ff000ec12c67066911217582e8344
|
/ConstraintLayout/app/src/androidTest/java/com/ufc/ec/constraintlayout/ExampleInstrumentedTest.java
|
7f9072d39afde37a561de96c352ef7a9f483782b
|
[] |
no_license
|
podesermp/android
|
700a1a9fe08a5a750361c8186614f216ce4a4c87
|
a3f3f9fc52432ae8df81ae49e8f722f7880a2075
|
refs/heads/main
| 2022-12-29T16:43:08.512630
| 2020-10-16T15:53:04
| 2020-10-16T15:53:04
| 304,672,619
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 770
|
java
|
package com.ufc.ec.constraintlayout;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.ufc.ec.constraintlayout", appContext.getPackageName());
}
}
|
[
"marcospaulorocharodrigues12@gmail.com"
] |
marcospaulorocharodrigues12@gmail.com
|
e21da29eb35e7c5b042f45d50a311b830a012ac4
|
06c5c867f6d2003fa195e213c5e8306f8b3e005c
|
/src/main/java/cn/novisfff/javafx/FxContainerPane.java
|
df87bf1c33d6e2bba9a1fd14dd3c029740283012
|
[] |
no_license
|
novisfff/javafxAnnotation
|
6defeb2b1a83250435dc4ada24f88c6a79d6e0a2
|
7bce6dfb2b66e86b5ce13f5c35137ad3e3aa063a
|
refs/heads/master
| 2023-01-19T20:13:33.612658
| 2020-11-30T13:01:34
| 2020-11-30T13:01:34
| 314,490,417
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,495
|
java
|
package cn.novisfff.javafx;
import javafx.scene.layout.Pane;
import java.util.*;
/**
* @author :novisfff
* @date :Created in 2020/11/27
* @description:
* @modified By:
* @version: $
*/
public class FxContainerPane {
private static final int INIT_CAP = 16;
private int size = 0;
private Map<String, FxContainerNode<?>> nodeMap;
private FxContainerNode<?>[] fxContainerNodes = new FxContainerNode[INIT_CAP];
private String name;
private FxContainerPane parent;
private List<FxContainerPane> children;
private Pane pane;
FxContainerPane(String name, Pane pane,FxContainerPane parent) {
this.name = name;
this.pane = pane;
this.parent = parent;
this.children = new ArrayList<>();
nodeMap = new HashMap<>();
}
void sort() {
Arrays.sort(fxContainerNodes, 0, size);
}
void addNode(FxContainerNode<?> node) {
nodeMap.put(node.getName(), node);
if(size >= fxContainerNodes.length - 1) {
resize();
}
fxContainerNodes[size] = node;
size++;
}
private void resize() {
int oldSize = fxContainerNodes.length;
int newSize = oldSize << 1;
FxContainerNode<?>[] newNodes = new FxContainerNode<?>[newSize];
System.arraycopy(fxContainerNodes, 0, newNodes, 0, oldSize);
fxContainerNodes = newNodes;
}
public Map<String, FxContainerNode<?>> getNodeMap() {
return nodeMap;
}
public void setNodeMap(Map<String, FxContainerNode<?>> nodeMap) {
this.nodeMap = nodeMap;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public FxContainerPane getParent() {
return parent;
}
public void setParent(FxContainerPane parent) {
this.parent = parent;
}
public List<FxContainerPane> getChildren() {
return children;
}
public void setChildren(List<FxContainerPane> children) {
this.children = children;
}
public Pane getPane() {
return pane;
}
public void setPane(Pane pane) {
this.pane = pane;
}
public FxContainerNode<?>[] getFxContainerNodes() {
return fxContainerNodes;
}
public void setFxContainerNodes(FxContainerNode<?>[] fxContainerNodes) {
this.fxContainerNodes = fxContainerNodes;
}
public int size() {
return size;
}
}
|
[
"156125813@qq.com"
] |
156125813@qq.com
|
8ba3d9669470ba4f6b3dcedd45960e3383180e63
|
c75179313bde1d87eef2ec8e5a688f44581d1e25
|
/src/main/java/com/example/java_design/ch3/Robot.java
|
6d569ef6dc7aab0bc32ae8d15c3e2f80134c2bad
|
[] |
no_license
|
jinioh88/JAVA_-_-
|
48c47fba18bfa88a0773006fd44088c3211ce8c8
|
6e794ccd1aec9361f56e0f64305d9e25b67cb9b0
|
refs/heads/master
| 2022-11-07T02:16:17.655260
| 2020-06-19T14:14:01
| 2020-06-19T14:14:01
| 269,274,588
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 148
|
java
|
package com.example.java_design.ch3;
public class Robot extends Toy {
@Override
public String toString() {
return "Robot";
}
}
|
[
"jinioh88@gmail.com"
] |
jinioh88@gmail.com
|
4864160e5299e0ff8bd38ea65dffccba0743e872
|
d3fb3544bca714fbaecec554055ee261c1558689
|
/hwkj/src/main/java/hwkj/hwkj/dao/Engineering/MachineDataDao.java
|
cd7d66d462d66ede4d5b306f4c865b3df3be72b0
|
[] |
no_license
|
haiweikeji/test
|
31c8d75e8f462a4748bd7294fff08ccae1ec0146
|
794e21d4ba8fe6f3ceb25002ca5879203f19b37d
|
refs/heads/master
| 2022-07-01T11:52:37.615240
| 2019-09-16T06:34:13
| 2019-09-16T06:34:13
| 206,438,210
| 0
| 0
| null | 2022-06-21T01:48:56
| 2019-09-05T00:15:36
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 1,902
|
java
|
package hwkj.hwkj.dao.Engineering;
import hwkj.hwkj.entity.Engineering.MachineData;
import hwkj.hwkj.entity.pagingquery.PageModel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface MachineDataDao {
/**
* 新增数据
* @param machineData
* @return
*/
public int insertMachineData(MachineData machineData);
/**
* 删除数据
* @param Id
* @return
*/
public int deleteMachineData(@Param("Id") Integer Id);
/**
* 更新数据
* @param machineData
* @return
*/
public int updateMachineData(MachineData machineData);
/**
* 分页集合List
* @param machineDataPageModel
* @param machineData
* @return
*/
public List<MachineData> queryMachineDataList(@Param("machineDataPageModel") PageModel<MachineData> machineDataPageModel, @Param("machineData") MachineData machineData);
/**
* 分页总数count
* @param machineDataPageModel
* @param machineData
* @return
*/
public int queryMachineDataCount(@Param("machineDataPageModel") PageModel<MachineData> machineDataPageModel, @Param("machineData") MachineData machineData);
/**
* by Id 查询
* @param Id
* @return
*/
public MachineData queryMachineDataById(@Param("Id") Integer Id);
/**
* for download all
* @param machineData
* @return
*/
public List<MachineData> queryMachineDataForDownLoadAll(@Param("machineData") MachineData machineData);
/**
* for download
* @param Id
* @return
*/
public MachineData queryMachineDataForDownLoad(@Param("Id") Integer Id);
/**
* check 新增数据是否已存在
* @param machineData
* @return
*/
public int queryMachineDataForExist(MachineData machineData);
}
|
[
"425378487@qq.com"
] |
425378487@qq.com
|
fcd6f2a81005c94322b2c63e8859b518d05307e9
|
74f1d9c4cecd58262888ffed02101c1b6bedfe13
|
/src/main/java/com/chinaxiaopu/xiaopuMobi/interceptor/CrossConfiguration.java
|
6e1e296b5eab11bf97c0b2bb78713e77d2a5eb99
|
[] |
no_license
|
wwm0104/xiaopu
|
341da3f711c0682d3bc650ac62179935330c27b2
|
ddb1b57c84cc6e6fdfdd82c2e998eea341749c87
|
refs/heads/master
| 2021-01-01T04:38:42.376033
| 2017-07-13T15:44:19
| 2017-07-13T15:44:19
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 743
|
java
|
package com.chinaxiaopu.xiaopuMobi.interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* Created by Steven@chinaxiaopu.com on 10/2/16.
*/
@Configuration
public class CrossConfiguration {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**");
}
};
}
}
|
[
"ellien"
] |
ellien
|
9912d9101bee13d392bd12b53742670a9fce4f5e
|
d59a535d7816585975193648ebf35df84df4519b
|
/rpc-core/src/main/java/ncl/chen/rpc/registry/NacosServiceRegistry.java
|
c6a87f2089e1fa65b8e55050ef6564e013ab0730
|
[
"MIT"
] |
permissive
|
chencqy/rpcFramework
|
2b514a405687999196c7360801b4003c253be9dc
|
080b729604973d2b777233d9832095e770da1b8c
|
refs/heads/main
| 2023-04-09T05:54:07.908635
| 2021-04-16T19:31:20
| 2021-04-16T19:31:20
| 351,182,319
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 874
|
java
|
package ncl.chen.rpc.registry;
import com.alibaba.nacos.api.exception.NacosException;
import ncl.chen.rpc.enumeration.RpcError;
import ncl.chen.rpc.exception.RpcException;
import ncl.chen.rpc.util.NacosUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.InetSocketAddress;
/**
* @author: Qiuyu
*/
public class NacosServiceRegistry implements ServiceRegistry{
private static final Logger logger = LoggerFactory.getLogger(NacosServiceRegistry.class);
@Override
public void register(String serviceName, InetSocketAddress inetSocketAddress) {
try {
NacosUtil.registerService(serviceName, inetSocketAddress);
} catch (NacosException e) {
logger.error("An error occurred when registering a service:", e);
throw new RpcException(RpcError.REGISTER_SERVICE_FAILED);
}
}
}
|
[
"chen.qy1996@hotmail.com"
] |
chen.qy1996@hotmail.com
|
9ee96042d51ed363a21f29ed6c0b6eea35118bd9
|
282fc8e2c97d1d903d683606b4428f42eb34ee86
|
/src/main/java/com/pydio/sdk/core/api/cells/model/RestSettingsSection.java
|
47cfd808833ea7c56aa0b174d24f088636f6afd6
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
Bhanditz/pydio-sdk-java-v2
|
15d28ef6fb00377cda97d77451265333810728c0
|
75f60490d2292b897f3915703633e8271bb8318a
|
refs/heads/master
| 2023-04-08T01:37:14.672533
| 2019-02-26T12:52:00
| 2019-02-26T12:52:00
| 174,153,451
| 0
| 0
|
Apache-2.0
| 2019-03-06T13:46:26
| 2019-03-06T13:46:26
| null |
UTF-8
|
Java
| false
| false
| 3,974
|
java
|
/*
* Pydio Cells Rest API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 1.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.pydio.sdk.core.api.cells.model;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import io.swagger.annotations.ApiModelProperty;
/**
* RestSettingsSection
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2018-11-30T14:51:15.861Z")
public class RestSettingsSection {
@SerializedName("Key")
private String key = null;
@SerializedName("Label")
private String label = null;
@SerializedName("Description")
private String description = null;
@SerializedName("Children")
private List<RestSettingsEntry> children = null;
public RestSettingsSection key(String key) {
this.key = key;
return this;
}
/**
* Get key
* @return key
**/
@ApiModelProperty(value = "")
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public RestSettingsSection label(String label) {
this.label = label;
return this;
}
/**
* Get label
* @return label
**/
@ApiModelProperty(value = "")
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public RestSettingsSection description(String description) {
this.description = description;
return this;
}
/**
* Get description
* @return description
**/
@ApiModelProperty(value = "")
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public RestSettingsSection children(List<RestSettingsEntry> children) {
this.children = children;
return this;
}
public RestSettingsSection addChildrenItem(RestSettingsEntry childrenItem) {
if (this.children == null) {
this.children = new ArrayList<RestSettingsEntry>();
}
this.children.add(childrenItem);
return this;
}
/**
* Get children
* @return children
**/
@ApiModelProperty(value = "")
public List<RestSettingsEntry> getChildren() {
return children;
}
public void setChildren(List<RestSettingsEntry> children) {
this.children = children;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RestSettingsSection restSettingsSection = (RestSettingsSection) o;
return Objects.equals(this.key, restSettingsSection.key) &&
Objects.equals(this.label, restSettingsSection.label) &&
Objects.equals(this.description, restSettingsSection.description) &&
Objects.equals(this.children, restSettingsSection.children);
}
@Override
public int hashCode() {
return Objects.hash(key, label, description, children);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RestSettingsSection {\n");
sb.append(" key: ").append(toIndentedString(key)).append("\n");
sb.append(" label: ").append(toIndentedString(label)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" children: ").append(toIndentedString(children)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
[
"pydio@PYDIO-ASUS"
] |
pydio@PYDIO-ASUS
|
63378b8e219742f71d4e2637cce5304ece1aa0c0
|
1040990529b75980b77f8a1b84149ed0400c71fd
|
/homeworks/Корзина/10/Test/Program.java
|
13138a7f04bf210d072457362475c20b36bccc0f
|
[] |
no_license
|
GIgorV/GARIN_JAVA_120
|
640d8bff5081acd789b763cb88407c45e77bfbf3
|
3e570d4acbdd9abedac2c4b7e8ade2af34998ffa
|
refs/heads/master
| 2021-08-07T13:15:26.479053
| 2020-05-29T06:28:34
| 2020-05-29T06:28:34
| 182,122,871
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 574
|
java
|
public class Program {
public static void main(String[] args) {
char c = 'M';
int codeOfC = c;
codeOfC++;
String a;
a = "Moris";
// если символ с троке есть - даст 0, нет -1:
// int I = a.indexOf(c);
// дает длину строки:
int I = a.length();
char b = a.charAt(3);
char another = (char)codeOfC;
System.out.println(codeOfC);
System.out.println(another);
System.out.println(I);
System.out.println(b);
}
}
|
[
"gigor907@gmail.com"
] |
gigor907@gmail.com
|
fa1254057f478b7a6f6641343543d21ff900302f
|
4f9daefa2c5a90014095933bf6259fb03737e543
|
/src/demo1/sumof100num.java
|
0af65fb664c9bd6dd78a5ee9b372ac95c2e70536
|
[] |
no_license
|
ssbrain1994/testproject
|
79260cb5fa43e26c1543d2b28657cf192a6d6e14
|
2ed034d175c084cc023adb087c72c912448dc7ca
|
refs/heads/master
| 2021-07-11T11:38:58.133987
| 2017-10-08T21:47:08
| 2017-10-08T21:47:08
| 106,156,456
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 277
|
java
|
package demo1;
public class sumof100num {
public static void main(String[] args) {
int sum = 0;
for (int i = 1; i <= 100; i++) sum +=i;
System.out.println("The sum is " + sum);
/*\int sum=0;
* for(int i=0;i<=100;i++){
* sum +=i;
* Syso(sum);*/
}
}
|
[
"bedreshubham@gmail.com"
] |
bedreshubham@gmail.com
|
2ed0bc542412e79bc2906ba3e28b4f99415868f5
|
b8ab8c96dd7776aaaf522b04173a9646e5e28ab4
|
/src/crs-core/src/main/java/pl/nask/crs/commons/email/search/HistoricalEmailTemplateSearchCriteria.java
|
2c12b27ebd912957d2c7106f41b04c1f7bc5e8d6
|
[] |
no_license
|
srirammails/iedr
|
f7638717a62b5b12add24fb70515e982a0a687c6
|
848c2560e9e0c73d93b40e31ce0d0ce2453969d1
|
refs/heads/master
| 2023-02-18T21:51:23.701880
| 2017-08-22T08:17:24
| 2017-08-22T08:17:24
| 101,394,020
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 912
|
java
|
package pl.nask.crs.commons.email.search;
import pl.nask.crs.commons.email.EmailTemplate;
import pl.nask.crs.commons.search.SearchCriteria;
import pl.nask.crs.history.HistoricalObject;
import java.util.Date;
public class HistoricalEmailTemplateSearchCriteria implements SearchCriteria<HistoricalObject<EmailTemplate>> {
protected Integer id;
protected String histChangedBy;
protected Date histChangeDate;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getHistChangedBy() {
return histChangedBy;
}
public void setHistChangedBy(String histChangedBy) {
this.histChangedBy = histChangedBy;
}
public Date getHistChangeDate() {
return histChangeDate;
}
public void setHistChangeDate(Date histChangeDate) {
this.histChangeDate = histChangeDate;
}
}
|
[
"admin@work-vm.localdomain"
] |
admin@work-vm.localdomain
|
08b6a66a4cb0aed264d265135b9017fa986c66a1
|
7eebac23731da004f036b17018b77348bcfb059d
|
/app/src/main/java/com/solutions/friendy/Adapters/AdapterInterestUser.java
|
b619cb3aa8a0b2aaaf46ae2de9daa568be942a2d
|
[] |
no_license
|
amitchd45/Friendy
|
fb46d9e0c4ce15515462ffd86d65e0f678d72f54
|
2f99886c1c3d2ef509fd3f0270ddd77f3d26012d
|
refs/heads/master
| 2022-11-11T10:54:06.992169
| 2020-07-03T17:10:32
| 2020-07-03T17:10:32
| 274,216,473
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,478
|
java
|
package com.solutions.friendy.Adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.solutions.friendy.Models.GetProfileDataModel;
import com.solutions.friendy.R;
import java.util.ArrayList;
import java.util.List;
public class AdapterInterestUser extends RecyclerView.Adapter<AdapterInterestUser.ViewHolder> {
Context context;
List<GetProfileDataModel.Details.InterestTitle> list;
private AdapterSubListInterestUser adapterSubListInterestUser;
List<GetProfileDataModel.Details.InterestTitle.InterestType> subList=new ArrayList<>();
public AdapterInterestUser(Context context, List<GetProfileDataModel.Details.InterestTitle> list) {
this.context = context;
this.list = list;
}
public interface Select{
void Choose(int position);
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_interest_layout, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
holder.mainTitle.setText(list.get(position).getTitle());
if(list.get(position).getInterestType().size()>0||list.get(position).getInterestType()!=null)
{
subList=list.get(position).getInterestType();
adapterSubListInterestUser=new AdapterSubListInterestUser(context,subList);
holder.recyclerView.setAdapter(adapterSubListInterestUser);
}
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView mainTitle;
RecyclerView recyclerView;
public ViewHolder(@NonNull View itemView) {
super(itemView);
mainTitle=itemView.findViewById(R.id.tv_mainInterest);
recyclerView=itemView.findViewById(R.id.rv_sublistInterest);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// select.Choose(getLayoutPosition());
}
});
}
}
}
|
[
"amit.suscet15@gmail.com"
] |
amit.suscet15@gmail.com
|
bdc3c716a6ff17769bed467c747c021bcb4ce1e8
|
f405015899c77fc7ffcc1fac262fbf0b6d396842
|
/sec2-basis/sec2-card/src/test/java/org/sec2/token/testSuites/TSHardwareToken.java
|
3375cc45f32b43d24e50e9df86531c3d5b470f5c
|
[] |
no_license
|
OniXinO/Sec2
|
a10ac99dd3fbd563288b8d21806afd949aea4f76
|
d0a4ed1ac97673239a8615a7ddac1d0fc0a1e988
|
refs/heads/master
| 2022-05-01T18:43:42.532093
| 2016-01-18T19:28:20
| 2016-01-18T19:28:20
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,605
|
java
|
/*
* Copyright 2011 Sec2 Consortium
*
* This source code is part of the "Sec2" project and as this remains property
* of the project partners. Content and concepts have to be treated as
* CONFIDENTIAL. Publication or partly disclosure without explicit written
* permission is prohibited.
* For details on "Sec2" and its contributors visit
*
* http://www.sec2.org
*/
package org.sec2.token.testSuites;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
import org.sec2.token.*;
/**
* Testsuite for HardwareToken.
*
* @author benedikt
*/
public class TSHardwareToken extends TestCase {
public TSHardwareToken(String testName) {
super(testName);
}
public static Test suite() {
System.out.println("\n==== Starting HardwareToken Tests ====");
TestSuite suite = new TestSuite();
suite.addTestSuite(GroupKeyTest.class);
suite.addTestSuite(DocumentKeyTest.class);
suite.addTestSuite(PinPukTest.class);
suite.addTestSuite(ServerKeyTest.class);
suite.addTestSuite(UserKeyTest.class);
suite.addTestSuite(ConcurrentAccessTest.class);
return suite;
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public static void main (String[] args) {
int c = 0;
while (true) {
TestRunner.run(suite());
System.out.println(c++);
}
}
}
|
[
"developer@developer-VirtualBox"
] |
developer@developer-VirtualBox
|
c29edc647426ff39e1e717111dd44441602a8210
|
141aa14f02074de8fbe790a594cf7ce163a7b769
|
/src/main/java/com/app/restaurantgit/controllers/SecurityController.java
|
1430216a78b8246be576e858cfd6e4c639604cc8
|
[] |
no_license
|
danielbelter/Restaurant
|
c37678a19b5a54813b18997759d1f9e2f10250fa
|
9d6f2d256120ae0f7950dedd714896a2d5027b88
|
refs/heads/master
| 2020-04-04T10:49:35.945926
| 2019-04-03T20:20:41
| 2019-04-03T20:20:41
| 162,745,675
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 874
|
java
|
package com.app.restaurantgit.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/login")
public class SecurityController {
@GetMapping("/login")
public String loginForm(Model model) {
model.addAttribute("error", "");
return "security/loginForm";
}
@GetMapping("/login/error")
public String loginError(Model model) {
model.addAttribute("error", "Nieprawidłowe dane logowania");
return "security/loginForm";
}
@GetMapping("/accessDenied")
public String accessDenied(Model model) {
model.addAttribute("error", "Nie masz uprawnien do tej strony");
return "security/accessDeniedPage";
}
}
|
[
"danielbelter96@gmail.com"
] |
danielbelter96@gmail.com
|
1db6a049e498c3518acc6f146483cbb859b1b81d
|
9054992882b8e94163376614d92ca3edc47a9e67
|
/app/src/main/java/com/shinplest/airbnbclone/src/main/fragment_travel/PastReservedHouseAdapter.java
|
009b0ef11dbea490ed5f57d8032945a02d13d60e
|
[] |
no_license
|
softsquared-summer/airbnb-mock-android-leo
|
9e94b28713b0347f1a965fc500304855a10ca205
|
0c170d62bd53d7034300a054191f904fbd6cc98e
|
refs/heads/master
| 2021-01-03T20:50:53.461080
| 2020-04-22T00:48:54
| 2020-04-22T00:48:54
| 240,230,735
| 1
| 1
| null | 2020-04-22T00:48:58
| 2020-02-13T10:12:26
|
Java
|
UTF-8
|
Java
| false
| false
| 2,412
|
java
|
package com.shinplest.airbnbclone.src.main.fragment_travel;
import android.content.Context;
import android.net.Uri;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.shinplest.airbnbclone.R;
import com.shinplest.airbnbclone.src.main.fragment_travel.models.ReservedResponse;
import java.util.ArrayList;
public class PastReservedHouseAdapter extends RecyclerView.Adapter<PastReservedHouseAdapter.MyViewHolder> {
private ArrayList<ReservedResponse.PastReservationList> mPastReservationLists;
private Context context;
public PastReservedHouseAdapter(ArrayList<ReservedResponse.PastReservationList> mPastReservationLists, Context context) {
this.mPastReservationLists = mPastReservationLists;
this.context = context;
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
public SimpleDraweeView mSvReservedHousePhoto;
public TextView mTvReservedDate, mTvReservedHouseName;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
this.mSvReservedHousePhoto = itemView.findViewById(R.id.sv_holder_reserved_house_img);
this.mTvReservedHouseName = itemView.findViewById(R.id.tv_holder_reserved_house_name);
this.mTvReservedDate = itemView.findViewById(R.id.tv_holder_reserved_date);
}
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View holderView = LayoutInflater.from(parent.getContext()).inflate(R.layout.holder_reserved_house, parent, false);
MyViewHolder myViewHolder = new MyViewHolder(holderView);
return myViewHolder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
final ReservedResponse.PastReservationList reservation = mPastReservationLists.get(position);
holder.mSvReservedHousePhoto.setImageURI(Uri.parse(reservation.getImageUrl()));
holder.mTvReservedHouseName.setText(reservation.getName());
holder.mTvReservedDate.setText(reservation.getDate());
}
@Override
public int getItemCount() {
return mPastReservationLists.size();
}
}
|
[
"shinplest@gmail.com"
] |
shinplest@gmail.com
|
20d847f79d3c76d89f4cf3d7d73a58cfd959ea52
|
1254b708b846592bb9b25defdb223cf9ba2c38ba
|
/Java Programming Build a Recommendation System/Semana4/Recommender.java
|
557231bdbc24a4aaf4e406972f68e4c7c73416c3
|
[] |
no_license
|
Daniber11/Especializacion
|
b512cfc7d277095d41077165cdb4ab814a6b93f8
|
b9d403799451ea89688b58fd4b53b3f15d4e47d5
|
refs/heads/main
| 2023-06-10T01:34:28.798791
| 2021-05-03T02:58:54
| 2021-05-03T02:58:54
| 380,587,262
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 163
|
java
|
import java.util.*;
public interface Recommender {
public ArrayList<String> getItemsToRate ();
public void printRecommendationsFor (String webRaterID);
}
|
[
"77933980+Daniber11@users.noreply.github.com"
] |
77933980+Daniber11@users.noreply.github.com
|
f680376934b1f0931a990c2da8c9bd4809282486
|
acdcbd5efe554791742c5226334b3b87a8ef54ca
|
/java-code/expense-business/src/main/java/bht/expense/business/enterprise/position/controller/PositionController.java
|
ed968b00cb2dac49cf8e6946cca353000b2bb6a8
|
[] |
no_license
|
helilangyan/expense
|
9484515d5bbbab9ea9c8328b2e1db2a086597952
|
9cc5e0edf76b7c7e8dc943f984ea5a8cd58d6269
|
refs/heads/main
| 2023-06-27T12:57:59.738879
| 2021-07-22T17:58:52
| 2021-07-22T17:58:52
| 388,550,452
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,052
|
java
|
package bht.expense.business.enterprise.position.controller;
import bht.expense.business.common.ResultDto;
import bht.expense.business.enterprise.position.dto.PositionEntityDto;
import bht.expense.business.enterprise.position.service.PositionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author 姚轶文
* @date 2021/4/16 14:58
*/
@Api(tags = "职位设置")
@RestController
@RequestMapping("enterprise/position")
public class PositionController {
@Autowired
PositionService positionService;
@ApiOperation("列表,本企业设置的职位")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true),
@ApiImplicitParam(name = "limit", value = "每页多少条记录", required = true),
@ApiImplicitParam(name = "enterpriseId", value = "企业ID", required = true)
})
@PostMapping("/findByEnterpriseId")
public ResultDto findByEnterpriseId(int page, int limit , Long enterpriseId)
{
return positionService.findByEnterpriseId(page, limit, enterpriseId);
}
@ApiOperation("新增、修改")
@PostMapping("/insert")
public ResultDto insert(@RequestBody PositionEntityDto positionEntityDto)
{
return positionService.insert(positionEntityDto);
}
@ApiOperation("根据ID删除")
@ApiImplicitParam(name = "id", value = "ID", required = true)
@DeleteMapping("/delete/{id}")
public ResultDto delete(@PathVariable Long id)
{
return positionService.delete(id);
}
@ApiOperation("根据ID批量删除")
@ApiImplicitParam(name = "id", value = "ID", required = true)
@DeleteMapping("/deletes/{id}")
public ResultDto deletes(@PathVariable Long[] id)
{
return positionService.deletes(id);
}
}
|
[
"helilangyan@outlook.com"
] |
helilangyan@outlook.com
|
0e0b1b005bf0f78666454db014ae0f9700434afc
|
b9a2aa01a5756a591e423371bb0b6fa5c680b435
|
/bundles/org.connectorio.addons.binding.wmbus/src/main/java/org/connectorio/addons/binding/wmbus/internal/config/ChannelConfig.java
|
49927d4537bce585b5abaa853f94035bae226206
|
[
"GPL-3.0-only",
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"GPL-1.0-or-later"
] |
permissive
|
ConnectorIO/connectorio-addons
|
49dbae8ab38537e3ec18f7860070431612d375c1
|
7757376a6b4535bedabf5fdcb76e4193aa2bbc76
|
refs/heads/master
| 2023-08-31T20:33:38.295013
| 2023-07-14T23:47:45
| 2023-07-14T23:47:45
| 243,823,699
| 22
| 8
|
Apache-2.0
| 2023-07-16T22:28:43
| 2020-02-28T17:58:51
|
Java
|
UTF-8
|
Java
| false
| false
| 881
|
java
|
/*
* Copyright (C) 2023-2023 ConnectorIO Sp. z o.o.
*
* 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.connectorio.addons.binding.wmbus.internal.config;
import org.connectorio.addons.binding.config.Configuration;
public class ChannelConfig implements Configuration {
public String dib;
public String vib;
}
|
[
"luke@code-house.org"
] |
luke@code-house.org
|
30d05ec0747bacb1af926f20059c8d2a13bb6a4b
|
2af67ddf0ab23d41ed693685e17c9022601f930d
|
/NinjaSchool/src/com/kienvu/View/AnimationNinja/RunLeftNinjaDrawer.java
|
80b3ddca69859ed7121bf4cdc8b711c02b131256
|
[] |
no_license
|
hoangdoan267/NinjaKidFull
|
5ef6d3c3e5621a553a7bc1e32f70a9b58df9af59
|
1f71a02d31d2577c7402c7f6f52248c66dde6860
|
refs/heads/master
| 2020-12-24T20:43:13.333198
| 2016-05-21T11:53:00
| 2016-05-21T11:53:00
| 59,357,043
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 433
|
java
|
package com.kienvu.View.AnimationNinja;
import com.kienvu.View.AnimationGameDrawer;
import java.awt.image.BufferedImage;
import java.util.Vector;
/**
* Created by vukien on 19/05/2016.
*/
public class RunLeftNinjaDrawer extends AnimationGameDrawer {
private static int DELAY_DEFAULT = 50;
public RunLeftNinjaDrawer(Vector<BufferedImage> imageVect) {
super(imageVect);
this.delay = DELAY_DEFAULT;
}
}
|
[
"hoang.doan@outlook.com"
] |
hoang.doan@outlook.com
|
3a45e5caaa2f28b0a94e68e4fff5ca577124b3ce
|
0691840d983bc8aa983415ac9ecac28a4d7a6449
|
/src/test/java/pages/WikiHomePage.java
|
3dc294c70b2a1671eac25872347e5d62eb19f105
|
[] |
no_license
|
mehmetsenyuce/PracticeWithEmre
|
d5a21e9af860eff74e75c3573db4aefedb6a1492
|
59689b8bb89f258eec35e27cf1f0e4a114d2dfcd
|
refs/heads/master
| 2022-11-17T16:56:23.064631
| 2019-08-19T01:47:18
| 2019-08-19T01:47:18
| 203,073,916
| 0
| 0
| null | 2022-11-16T11:54:10
| 2019-08-19T01:01:45
|
Java
|
UTF-8
|
Java
| false
| false
| 594
|
java
|
package pages;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import utilities.Driver;
public class WikiHomePage {
public WikiHomePage(){
PageFactory.initElements(Driver.getDriver(), this);
}
@FindBy(xpath = "//input[@type='search']")
public WebElement searchBox;
@FindBy(xpath = "//button[@type='submit']")
public WebElement searchButton;
@FindBy(id = "firstHeading")
public WebElement mainHeader;
@FindBy(className = "fn")
public WebElement imageHeader;
}
|
[
"meetyuce@gmail.com"
] |
meetyuce@gmail.com
|
d701fb33ee87300278b9166a4f5632bc01f51ff1
|
398981e861350dfd80d9fa326c947d9521c74020
|
/javaBasics/src/jdbcDao/DaoException.java
|
f8707fbab8892653969b153bb56698f0169c31fb
|
[] |
no_license
|
asherplotnik/javaBasics
|
b17ab5d51abc8a270350213edfef8f2bd59ec590
|
1977fc6d521530bd57056ee22e4cbbbf9b7016ef
|
refs/heads/master
| 2023-03-06T03:36:15.231620
| 2021-02-24T05:05:35
| 2021-02-24T05:05:35
| 313,263,155
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 541
|
java
|
package jdbcDao;
public class DaoException extends Exception {
private static final long serialVersionUID = 1L;
public DaoException() {
super();
}
public DaoException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
public DaoException(String message, Throwable cause) {
super(message, cause);
}
public DaoException(String message) {
super(message);
}
public DaoException(Throwable cause) {
super(cause);
}
}
|
[
"'asherplotnik@gmail.com'"
] |
'asherplotnik@gmail.com'
|
fb1c5cf2dd880701a16d96d58a44dfdc3a46ea9f
|
d35a3d093d47fdaf67853e693c208c2960220a86
|
/Presenter/App/src/uit/aep06/phuctung/ara/Presenter/ARYoutubeProcessor.java
|
8a6a334ca74f9dcf85c57a7e5d7d24844fffdcd5
|
[] |
no_license
|
FaTaToo/ara
|
f389ecdfcae98fa9cce354e55d3689171136a909
|
f0910c0500f6074a83ebdecb06fe56a46ab48eb9
|
refs/heads/master
| 2021-01-21T15:13:15.605293
| 2016-04-17T01:41:03
| 2016-04-17T01:41:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,590
|
java
|
package uit.aep06.phuctung.ara.Presenter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.google.android.youtube.player.YouTubeInitializationResult;
import com.google.android.youtube.player.YouTubePlayer;
import com.google.android.youtube.player.YouTubePlayerView;
import com.google.android.youtube.player.YouTubePlayer.OnInitializedListener;
import com.google.android.youtube.player.YouTubePlayer.Provider;
import android.R;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import uit.aep06.phuctung.ara.ARResource.ARSM_Youtube;
public class ARYoutubeProcessor extends ARPresenterProcessor implements OnInitializedListener {
public ARYoutubeProcessor(Context context) {
super(context);
}
public ARSM_Youtube data = new ARSM_Youtube();
public YouTubePlayerView playerview;
public ARSM_Youtube getData() {
return data;
}
public void setData(ARSM_Youtube data) {
this.data = data;
}
public YouTubePlayerView getPlayerview() {
return playerview;
}
public void setPlayerview(YouTubePlayerView playerview) {
this.playerview = playerview;
}
@Override
public Button createButton() {
Button btn = new Button(getContext());
btn.setBackgroundResource(uit.aep06.phuctung.ara.R.drawable.icon_youtube);
btn.setLayoutParams(new LinearLayout.LayoutParams(50, 50));
return btn;
}
@Override
public View onPlay() {
playerview = new YouTubePlayerView(getContext());
playerview.initialize("AIzaSyAmvY-XRQTEo_-0bgDL7LzCH94YHTs5SjM", this);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT);
layoutParams.setMargins(50, 50, 50, 50);
playerview.setLayoutParams(layoutParams);
playerview.setBackgroundColor(Color.BLACK);
return playerview;
}
@Override
public void onInitializationFailure(Provider arg0, YouTubeInitializationResult arg1) {
// TODO Auto-generated method stub
}
@Override
public void onInitializationSuccess(Provider arg0, YouTubePlayer player, boolean wasRestored) {
String idVideo = getIDYoutube(data.getUrl());
if (!wasRestored && idVideo != null) {
player.cueVideo(idVideo);
}
}
private String getIDYoutube(String url) {
String pattern = "(?<=watch\\?v=|/videos/|embed\\/)[^#\\&\\?]*";
Pattern compiledPattern = Pattern.compile(pattern);
Matcher matcher = compiledPattern.matcher(url);
if (matcher.find()) {
return matcher.group();
}
return null;
}
}
|
[
"phamtangtung@gmail.com"
] |
phamtangtung@gmail.com
|
86cc45a6219e277c63f65b1b6b75e0ed3db7d600
|
779a95682af54ce37c6ee60b01b7fa2bf4bc4513
|
/src/main/java/edu/whu/iss/whufleamarket/mapper/Product2Mapper.java
|
332fe6d5cccd586e64329b27fd96a70c06824667
|
[] |
no_license
|
mrjiao2018/whuFleaMarket
|
240b777efdaadff38908cfe6fba071c6b205708a
|
8174f1ca811ea65eeae272be3a5d010ebb1a55e0
|
refs/heads/master
| 2020-05-07T14:29:50.123421
| 2019-05-14T02:17:30
| 2019-05-14T02:17:30
| 180,597,019
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 584
|
java
|
package edu.whu.iss.whufleamarket.mapper;
import edu.whu.iss.whufleamarket.vo.Product;
import edu.whu.iss.whufleamarket.vo.ShareProduct;
import org.apache.ibatis.annotations.*;
import java.util.List;
public interface Product2Mapper
{
@Results({@Result(property = "id",column = "product_id"),@Result(property = "images",column = "product_id",many = @Many(select = "edu.whu.iss.whufleamarket.mapper.ProductImgMapper.queryImgAddrByProductId"))})
@Select({"Select * from tb_product where owner_id = #{userId} "})
List<Product> queryByOwnerId(@Param("userId")int userId);
}
|
[
"41311213+Bluchris@users.noreply.github.com"
] |
41311213+Bluchris@users.noreply.github.com
|
34292333d41279691da19dc8b5ddfd434e582b98
|
bfdfadb9e1227433ce57e5c2d8be7ab653ea6630
|
/src/main/java/com/capgemini/helloworldwebapp/controllers/HelloWorldController.java
|
fa66bf9dadcb1b8e7d4b27d5ff3895f8d4203c20
|
[
"Apache-2.0"
] |
permissive
|
IT-Capgemini-Java/spring-mvc-example-helloworld
|
904faf997b1d8015a4c8f888f4387eb311082803
|
be909053fe3112f505b81bb7f74a97727c464ba1
|
refs/heads/master
| 2021-01-23T05:25:49.163193
| 2017-05-31T18:17:29
| 2017-05-31T18:17:29
| 92,972,241
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,214
|
java
|
package com.capgemini.helloworldwebapp.controllers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.capgemini.helloworldwebapp.constants.Constants;
/**
* Welcome's controller
*
* @author clusardi
* @version 1.0
*
*/
@Controller
public class HelloWorldController {
/*
* Logger
*/
private static final Logger log = LoggerFactory.getLogger(HelloWorldController.class);
/**
* Mapping of welcome page request (GET method is implicit)
*
* @return {@link ModelAndView}
*/
@RequestMapping(Constants.WELCOME_PAGE)
public ModelAndView helloWorld() {
log.debug("start helloWorld");
String message = "<br>"
+ "<div style='text-align:center;'>"
+ "<h3>Hello World, Spring MVC</h3>"
+ "This message is coming from com.capgemini.helloworldwebapp.controllers.HelloWorldController.java"
+ "</div>"
+ "<br>"
+ "<br>";
log.info("creato messaggi di benvenuto");
log.debug("end helloWorld");
return new ModelAndView("welcome", "message", message);
}
}
|
[
"christian.lusardi@capgemini.com"
] |
christian.lusardi@capgemini.com
|
8d20cbbfad2b91121504f920939860e94ffdb805
|
60751ccc314b9de15d62a4283cb35ecc75c58050
|
/src/com/airline/models/Airplane.java
|
4a8cea5cae101fefa4c1dfe5a009844a3cf02f0a
|
[] |
no_license
|
fozeu-jm/airline_Management
|
bd074b7fdfc8abc19df148959a3331e85670d68c
|
7af6cde88a86332205fd45ff1ac7f1b3c990c0b1
|
refs/heads/master
| 2021-01-04T06:18:04.720698
| 2020-02-14T05:43:17
| 2020-02-14T05:43:17
| 240,426,057
| 0
| 0
| null | 2020-02-14T04:55:40
| 2020-02-14T04:13:46
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 2,097
|
java
|
package com.airline.models;
import java.io.Serializable;
import java.util.List;
import javax.json.bind.annotation.JsonbTransient;
import javax.persistence.*;
/**
* Entity implementation class for Entity: Airplane
*
*/
@NamedQuery(name = "findPlaneById", query = "SELECT p FROM Airplane p WHERE p.id = :id")
@NamedQuery(name = "findAllPlanes", query = "SELECT p FROM Airplane p")
@NamedQuery(name = "findOperationalPlanes", query = "SELECT p FROM Airplane p WHERE p.status = :stat")
@Entity
public class Airplane implements Serializable {
@Transient
private static final long serialVersionUID = 1L;
public Airplane() {
super();
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String planeMake;
private String modelName;
private Integer seatingCapacity;
@Enumerated(EnumType.STRING)
private PlaneStatus status;
@OneToMany(mappedBy = "airplane")
@JsonbTransient
private List<Flight> flights;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPlaneMake() {
return planeMake;
}
public void setPlaneMake(String planeMake) {
this.planeMake = planeMake;
}
public String getModelName() {
return modelName;
}
public void setModelName(String modelName) {
this.modelName = modelName;
}
public Integer getSeatingCapacity() {
return seatingCapacity;
}
public void setSeatingCapacity(Integer seatingCapacity) {
this.seatingCapacity = seatingCapacity;
}
public List<Flight> getFlights() {
return flights;
}
public void setFlights(List<Flight> flights) {
this.flights = flights;
}
public PlaneStatus getStatus() {
return status;
}
public void setStatus(PlaneStatus status) {
this.status = status;
}
@Override
public String toString() {
return "Airplane [id=" + id + ", planeMake=" + planeMake + ", modelName=" + modelName + ", seatingCapacity="
+ seatingCapacity + ", status=" + status + ", flights=" + flights + "]";
}
}
|
[
"Fatih@DESKTOP-KQBFODS"
] |
Fatih@DESKTOP-KQBFODS
|
15372237ea74e1bb20c53d702f3cf6db5d943d03
|
502d7f40c533a6c721573a11fdcd51de8d195dc7
|
/src/main/java/com/tutoriel/ddd/infrastructure/mapper/reunion/MeetingWaitlistMemberMappeur.java
|
bc9e903effe5dc5acaaad447be04625e80d082ce
|
[] |
no_license
|
astro-repository/ddd
|
12bf6bee7662198fee01fa1998fe8ac07d055414
|
9847a9bd3f84480a41429c41b581bf1580a65869
|
refs/heads/master
| 2022-12-24T13:37:58.768053
| 2020-06-15T09:11:30
| 2020-06-15T09:11:30
| 272,389,304
| 0
| 0
| null | 2022-12-10T06:03:31
| 2020-06-15T08:56:07
|
Java
|
UTF-8
|
Java
| false
| false
| 1,388
|
java
|
package com.tutoriel.ddd.infrastructure.mapper.reunion;
import com.tutoriel.ddd.core.reunion.domaine.entite.MeetingWaitlistMember;
import com.tutoriel.ddd.infrastructure.entite.reunion.MeetingWaitlistMemberTable;
import com.tutoriel.ddd.infrastructure.entite.reunion.MembreTable;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.Set;
@Service
public class MeetingWaitlistMemberMappeur {
private final MeetingMappeur meetingMappeur;
// private final MembreMappeur membreMappeur;
public MeetingWaitlistMemberMappeur(MeetingMappeur meetingMappeur/*, MembreMappeur membreMappeur*/) {
this.meetingMappeur = meetingMappeur;
// this.membreMappeur = membreMappeur;
}
public MeetingWaitlistMemberTable waitlistMappeurVersTable(MeetingWaitlistMember meetingWaitlistMember) {
MeetingWaitlistMemberTable meetingWaitlistMemberTable = new MeetingWaitlistMemberTable();
meetingWaitlistMemberTable.setMeeting(meetingMappeur.meetingVersTable(meetingWaitlistMember.getMeeting()));
// Set<MembreTable> membreTables = new HashSet<>();
// meetingWaitlistMember.getMembres().forEach(membre -> {
// membreTables.add(membreMappeur.membreVersTable(membre));
// });
// meetingWaitlistMemberTable.setMembers(membreTables);
return meetingWaitlistMemberTable;
}
}
|
[
"christianastro36@gmail.com"
] |
christianastro36@gmail.com
|
9b89cd23704a4dc698b6c6b1434704e8c018a30f
|
244b83d1b462f958ffc4dae607030935d46d2a26
|
/lordsDomain/robovm/src/main/java/com/github/ovagi/lordsDomain/robovm/LordsDomainRoboVM.java
|
49f6f59112b19491fe88253b817d4aeff28627ca
|
[] |
permissive
|
ovagi/TheLordsDomain
|
852e95a40dd6ad825d5a2d5209861ecf42d3398d
|
2f20ea838d6ec474d56fdd6c33b2fbfb16ace395
|
refs/heads/master
| 2020-04-25T05:04:38.791126
| 2019-05-07T18:41:41
| 2019-05-07T18:41:41
| 172,530,963
| 0
| 0
|
MIT
| 2019-05-07T18:41:43
| 2019-02-25T15:22:10
| null |
UTF-8
|
Java
| false
| false
| 1,468
|
java
|
package com.github.ovagi.lordsDomain.robovm;
import org.robovm.apple.coregraphics.CGRect;
import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.uikit.UIApplicationDelegateAdapter;
import org.robovm.apple.uikit.UIApplicationLaunchOptions;
import org.robovm.apple.uikit.UIInterfaceOrientationMask;
import org.robovm.apple.uikit.UIScreen;
import org.robovm.apple.uikit.UIWindow;
import playn.robovm.RoboPlatform;
import com.github.ovagi.lordsDomain.core.LordsDomain;
public class LordsDomainRoboVM extends UIApplicationDelegateAdapter {
@Override
public boolean didFinishLaunching (UIApplication app, UIApplicationLaunchOptions launchOpts) {
// create a full-screen window
CGRect bounds = UIScreen.getMainScreen().getBounds();
UIWindow window = new UIWindow(bounds);
// configure and create the PlayN platform
RoboPlatform.Config config = new RoboPlatform.Config();
config.orients = UIInterfaceOrientationMask.All;
RoboPlatform plat = RoboPlatform.create(window, config);
// create and initialize our game
new LordsDomain(plat);
// make our main window visible (this starts the platform)
window.makeKeyAndVisible();
addStrongRef(window);
return true;
}
public static void main (String[] args) {
NSAutoreleasePool pool = new NSAutoreleasePool();
UIApplication.main(args, null, LordsDomainRoboVM.class);
pool.close();
}
}
|
[
"tim.clark@genesys.com"
] |
tim.clark@genesys.com
|
2d4f620b9b9566f7bbaadb99a03af61bf2adf973
|
f08256664e46e5ac1466f5c67dadce9e19b4e173
|
/sources/kotlin/reflect/jvm/internal/KParameterImpl.java
|
67a766400e2c628014a921b07c56087cf9354e39
|
[] |
no_license
|
IOIIIO/DisneyPlusSource
|
5f981420df36bfbc3313756ffc7872d84246488d
|
658947960bd71c0582324f045a400ae6c3147cc3
|
refs/heads/master
| 2020-09-30T22:33:43.011489
| 2019-12-11T22:27:58
| 2019-12-11T22:27:58
| 227,382,471
| 6
| 3
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 7,807
|
java
|
package kotlin.reflect.jvm.internal;
import java.lang.annotation.Annotation;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.C12890t;
import kotlin.jvm.internal.C12891u;
import kotlin.jvm.internal.C12895y;
import kotlin.reflect.KParameter;
import kotlin.reflect.KParameter.Kind;
import kotlin.reflect.KProperty;
import kotlin.reflect.KType;
import kotlin.reflect.jvm.internal.ReflectProperties.LazySoftVal;
import kotlin.reflect.jvm.internal.impl.descriptors.ParameterDescriptor;
import kotlin.reflect.jvm.internal.impl.descriptors.ValueParameterDescriptor;
import kotlin.reflect.jvm.internal.impl.name.Name;
import kotlin.reflect.jvm.internal.impl.resolve.descriptorUtil.DescriptorUtilsKt;
import kotlin.reflect.jvm.internal.impl.types.KotlinType;
@Metadata(mo31005bv = {1, 0, 3}, mo31006d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0010\u001b\n\u0002\b\r\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0000\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B/\u0012\n\u0010\u0002\u001a\u0006\u0012\u0002\b\u00030\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\f\u0010\b\u001a\b\u0012\u0004\u0012\u00020\n0\t¢\u0006\u0002\u0010\u000bJ\u0013\u0010)\u001a\u00020\u001c2\b\u0010*\u001a\u0004\u0018\u00010+H\u0002J\b\u0010,\u001a\u00020\u0005H\u0016J\b\u0010-\u001a\u00020\"H\u0016R!\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\r8VX\u0002¢\u0006\f\n\u0004\b\u0011\u0010\u0012\u001a\u0004\b\u000f\u0010\u0010R\u0015\u0010\u0002\u001a\u0006\u0012\u0002\b\u00030\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014R\u001b\u0010\u0015\u001a\u00020\n8BX\u0002¢\u0006\f\n\u0004\b\u0018\u0010\u0012\u001a\u0004\b\u0016\u0010\u0017R\u0014\u0010\u0004\u001a\u00020\u0005X\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u001aR\u0014\u0010\u001b\u001a\u00020\u001c8VX\u0004¢\u0006\u0006\u001a\u0004\b\u001b\u0010\u001dR\u0014\u0010\u001e\u001a\u00020\u001c8VX\u0004¢\u0006\u0006\u001a\u0004\b\u001e\u0010\u001dR\u0014\u0010\u0006\u001a\u00020\u0007X\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001f\u0010 R\u0016\u0010!\u001a\u0004\u0018\u00010\"8VX\u0004¢\u0006\u0006\u001a\u0004\b#\u0010$R\u0014\u0010%\u001a\u00020&8VX\u0004¢\u0006\u0006\u001a\u0004\b'\u0010(¨\u0006."}, mo31007d2 = {"Lkotlin/reflect/jvm/internal/KParameterImpl;", "Lkotlin/reflect/KParameter;", "callable", "Lkotlin/reflect/jvm/internal/KCallableImpl;", "index", "", "kind", "Lkotlin/reflect/KParameter$Kind;", "computeDescriptor", "Lkotlin/Function0;", "Lkotlin/reflect/jvm/internal/impl/descriptors/ParameterDescriptor;", "(Lkotlin/reflect/jvm/internal/KCallableImpl;ILkotlin/reflect/KParameter$Kind;Lkotlin/jvm/functions/Function0;)V", "annotations", "", "", "getAnnotations", "()Ljava/util/List;", "annotations$delegate", "Lkotlin/reflect/jvm/internal/ReflectProperties$LazySoftVal;", "getCallable", "()Lkotlin/reflect/jvm/internal/KCallableImpl;", "descriptor", "getDescriptor", "()Lorg/jetbrains/kotlin/descriptors/ParameterDescriptor;", "descriptor$delegate", "getIndex", "()I", "isOptional", "", "()Z", "isVararg", "getKind", "()Lkotlin/reflect/KParameter$Kind;", "name", "", "getName", "()Ljava/lang/String;", "type", "Lkotlin/reflect/KType;", "getType", "()Lkotlin/reflect/KType;", "equals", "other", "", "hashCode", "toString", "kotlin-reflection"}, mo31008k = 1, mo31009mv = {1, 1, 15})
/* compiled from: KParameterImpl.kt */
public final class KParameterImpl implements KParameter {
static final /* synthetic */ KProperty[] $$delegatedProperties;
private final LazySoftVal annotations$delegate = ReflectProperties.lazySoft(new KParameterImpl$annotations$2(this));
private final KCallableImpl<?> callable;
private final LazySoftVal descriptor$delegate;
private final int index;
private final Kind kind;
static {
Class<KParameterImpl> cls = KParameterImpl.class;
$$delegatedProperties = new KProperty[]{C12895y.m40235a((C12890t) new C12891u(C12895y.m40230a((Class) cls), "descriptor", "getDescriptor()Lorg/jetbrains/kotlin/descriptors/ParameterDescriptor;")), C12895y.m40235a((C12890t) new C12891u(C12895y.m40230a((Class) cls), "annotations", "getAnnotations()Ljava/util/List;"))};
}
public KParameterImpl(KCallableImpl<?> kCallableImpl, int i, Kind kind2, Function0<? extends ParameterDescriptor> function0) {
this.callable = kCallableImpl;
this.index = i;
this.kind = kind2;
this.descriptor$delegate = ReflectProperties.lazySoft(function0);
}
/* access modifiers changed from: private */
public final ParameterDescriptor getDescriptor() {
return (ParameterDescriptor) this.descriptor$delegate.getValue(this, $$delegatedProperties[0]);
}
public boolean equals(Object obj) {
if (obj instanceof KParameterImpl) {
KParameterImpl kParameterImpl = (KParameterImpl) obj;
if (Intrinsics.areEqual((Object) this.callable, (Object) kParameterImpl.callable) && Intrinsics.areEqual((Object) getDescriptor(), (Object) kParameterImpl.getDescriptor())) {
return true;
}
}
return false;
}
public List<Annotation> getAnnotations() {
return (List) this.annotations$delegate.getValue(this, $$delegatedProperties[1]);
}
public final KCallableImpl<?> getCallable() {
return this.callable;
}
public int getIndex() {
return this.index;
}
public Kind getKind() {
return this.kind;
}
public String getName() {
ParameterDescriptor descriptor = getDescriptor();
String str = null;
if (!(descriptor instanceof ValueParameterDescriptor)) {
descriptor = null;
}
ValueParameterDescriptor valueParameterDescriptor = (ValueParameterDescriptor) descriptor;
if (valueParameterDescriptor != null) {
if (valueParameterDescriptor.getContainingDeclaration().hasSynthesizedParameterNames()) {
return null;
}
Name name = valueParameterDescriptor.getName();
Intrinsics.checkReturnedValueIsNotNull((Object) name, "valueParameter.name");
if (!name.isSpecial()) {
str = name.asString();
}
}
return str;
}
public KType getType() {
KotlinType type = getDescriptor().getType();
Intrinsics.checkReturnedValueIsNotNull((Object) type, "descriptor.type");
return new KTypeImpl(type, new KParameterImpl$type$1(this));
}
public int hashCode() {
return (this.callable.hashCode() * 31) + getDescriptor().hashCode();
}
public boolean isOptional() {
ParameterDescriptor descriptor = getDescriptor();
if (!(descriptor instanceof ValueParameterDescriptor)) {
descriptor = null;
}
ValueParameterDescriptor valueParameterDescriptor = (ValueParameterDescriptor) descriptor;
if (valueParameterDescriptor != null) {
return DescriptorUtilsKt.declaresOrInheritsDefaultValue(valueParameterDescriptor);
}
return false;
}
public boolean isVararg() {
ParameterDescriptor descriptor = getDescriptor();
return (descriptor instanceof ValueParameterDescriptor) && ((ValueParameterDescriptor) descriptor).getVarargElementType() != null;
}
public String toString() {
return ReflectionObjectRenderer.INSTANCE.renderParameter(this);
}
}
|
[
"101110@vivaldi.net"
] |
101110@vivaldi.net
|
01a04ab38d1df9e839484e09e7c86f9505693b91
|
2366bab343abeae9a479ee6de5a868b0604bb8aa
|
/app/src/test/java/dropandcrack/android/dac/ExampleUnitTest.java
|
58faefb96adf78b14b46e563274a0a729c968dfd
|
[] |
no_license
|
scubedoo187/dropandcrack
|
a4c6a7ad16859e729e3b4fa314ee9fa10a4f1194
|
fc7532fc4ea4eec0a858c16a2e3d27892c0a1428
|
refs/heads/master
| 2021-05-29T16:13:14.877308
| 2015-10-31T16:34:55
| 2015-10-31T16:34:55
| 44,907,059
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 331
|
java
|
package dropandcrack.android.dac;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
[
"yg.jung@tridge.com"
] |
yg.jung@tridge.com
|
4ffd45e350abe108166f4c1f5e1090e90601fc31
|
2094e5459eb0cc1347f57aa8a331d13984319b7c
|
/app/src/androidTest/java/com/rim/asus/firebasea/ExampleInstrumentedTest.java
|
60674ffe2a109fda1146d0b0961700b9c6fc9004
|
[] |
no_license
|
RimMehdbi/FireBaseA
|
6dcee6eeecc2c2b68cf64c5f0dcdd897139fc4c7
|
7b50da34c9a890e59975fc3f98539ad56605d1c1
|
refs/heads/master
| 2020-04-11T04:44:41.989228
| 2018-12-12T17:45:56
| 2018-12-12T17:45:56
| 161,524,204
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 728
|
java
|
package com.rim.asus.firebasea;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.rim.asus.firebasea", appContext.getPackageName());
}
}
|
[
"mahedhbirim@gmail.com"
] |
mahedhbirim@gmail.com
|
3c5158ece91e0b18c05622f58ba79f11ae5a9d78
|
68acc6d9e773f3e30dc894b4e6ed686b44f19e10
|
/StatusType.java
|
b17ec5cfce5658e97ce238706f6a508a36236dc3
|
[] |
no_license
|
excleupload/excelupload
|
bedbfd24846300d354ea3924af86f767139bc782
|
4aff4460accdd9d80a7b7ba05997fe5950aa2f24
|
refs/heads/master
| 2020-06-20T20:27:00.003115
| 2019-10-01T17:05:15
| 2019-10-01T17:05:15
| 197,237,851
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 392
|
java
|
package com.example.tapp.common.utils;
public class StatusType {
public static final Integer show = 1;
public static final Integer hide = 2;
public static final int active = 1;
public static final int deActive = 2;
public static final int softDelete = 3;
public static final int tableBlock = 1;
public static final int tableFree = 2;
}
|
[
"noreply@github.com"
] |
excleupload.noreply@github.com
|
3ab075e604638f40e565c96f1a25ec09ccda73d6
|
82da52af1c0514780718977cf1907c837cf6d425
|
/app/src/main/java/jaygoo/peachplayerdemo/CustomMediaPlayerController.java
|
c89c242b9125b822ec5dcfa10941e1c258692acd
|
[
"Apache-2.0"
] |
permissive
|
litakeji/0001
|
1576f89c997f0331264f1c395f574d13330e0d50
|
cdca0f5c8d0814cd72dc63fdbf15ef7e63badd5b
|
refs/heads/master
| 2020-03-25T16:53:53.427170
| 2018-08-15T15:46:14
| 2018-08-15T15:46:14
| 143,952,860
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,580
|
java
|
package jaygoo.peachplayerdemo;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;
import jaygoo.peachplayer.media.AndroidMediaController;
/**
* ================================================
* 作 者:JayGoo
* 版 本:
* 创建日期:2017/9/6
* 描 述: 自定义视频控制面板,支持自定义UI
* ================================================
*/
public class CustomMediaPlayerController extends AndroidMediaController {
public CustomMediaPlayerController(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomMediaPlayerController(Context context) {
super(context);
}
@Override
protected float onGestureLeftSlideUp(float distance, float percent) {
super.onGestureLeftSlideUp(distance, percent);
return 0;
}
@Override
protected float onGestureLeftSlideDown(float distance, float percent) {
super.onGestureLeftSlideDown(distance, percent);
return 0;
}
@Override
protected void onClickOptionPause(MediaPlayerControl mPlayer) {
if (mPauseButton == null || mPlayer == null)
return;
if (mPauseButton instanceof ImageView){
ImageView pauseButton = (ImageView) mPauseButton;
if (mPlayer.isPlaying()) {
pauseButton.setImageResource(R.drawable.ic_video_pause);
} else {
pauseButton.setImageResource(R.drawable.ic_video_play);
}
}
}
}
|
[
"wo52199jun"
] |
wo52199jun
|
4f801bd00e13dad3698c6c8844b4021edf3f80d1
|
79c3ee9e66ab201c2b6ae1edc2ecf1fc1e7c6149
|
/app/src/androidTest/java/org/mgenterprises/friendfinder/ApplicationTest.java
|
9981de1314ec1ac897853c19be481749907aac94
|
[] |
no_license
|
twa16/FriendFinder-App
|
f60ba60bca1af17f81fc876abd65883759a026a9
|
57b363541f362aa1093b0375743a3e080d09e28b
|
refs/heads/master
| 2021-01-23T21:34:09.371924
| 2014-10-08T22:41:48
| 2014-10-08T22:41:48
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 361
|
java
|
package org.mgenterprises.friendfinder;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
|
[
"nander13@gmu.edu"
] |
nander13@gmu.edu
|
e1c54a5e6ecdb3f9cef69ff1f50362fe5ecabc88
|
0981ac8dba21353ad1ad535052e9371488807835
|
/app/src/main/java/romine/colorwheel/Board/Board.java
|
4f01febd7d4b3aa918a96a0ae2c15f4df1e52004
|
[] |
no_license
|
karomine/puzzlewheel-android
|
eb79b02257bc97b3fbf75b8a56b9506e89a8e395
|
dce48e00a9fa5fa23b311e74e7b8d1314a3e694d
|
refs/heads/master
| 2021-01-12T02:58:59.014390
| 2017-01-05T20:07:45
| 2017-01-05T20:07:45
| 78,144,370
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,714
|
java
|
package romine.colorwheel.Board;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.Log;
import java.util.ArrayList;
import romine.colorwheel.Pieces.BasePiece;
import romine.colorwheel.Pieces.GamePiece;
import romine.colorwheel.Shapes.Lines;
/**
* Created by karom on 10/21/2016.
*/
public abstract class Board {
private Canvas backgroundCanvas;
float xOffset;
float yOffset;
float scale;
int boardDimension;
ArrayList<BasePiece> piecesOnBoard;
Board board;
Board(float xOffset, float yOffset, float scale, Canvas backgroundCanvas) {
this.xOffset = xOffset;
this.yOffset = yOffset;
this.scale = scale;
this.backgroundCanvas = backgroundCanvas;
}
abstract int getBoardDimension();
abstract ArrayList<BasePiece> getPiecesOnBoard();
public abstract GridTile[][] getBoardGrid();
abstract Board getBoard();
public boolean onBoard(float x, float y) {
return x >= getXOffset() && x <= getXOffset() + getScale() * getBoardDimension()
&& y >= getYOffset() && y <= getYOffset() + getScale() * getBoardDimension();
}
public void addPiece(BasePiece piece, int x, int y) {
getPiecesOnBoard().add(piece);
piece.addPiece(getBoardGrid(), x, y);
getBoard().updateBoard(piece, x, y);
}
public void removePiece(BasePiece piece, int x, int y) {
getPiecesOnBoard().remove(piece);
piece.removePiece(getBoardGrid());
getBoard().updateBoard(piece, x, y);
}
public void updateBoard(GamePiece parentPiece, int x , int y) {
for (GamePiece piece: parentPiece.getPieces()) {
piece.updateBoard(this, x + piece.getXOffset(), y + piece.getYOffset());
}
}
public void display() {
GridTile[][] board = getBoardGrid();
for (int i = 0; i < getBoardDimension(); i++) {
for (int j = 0; j < getBoardDimension(); j++) {
board[i][j].display();
}
}
this.drawBorder();
}
public void drawBorder() {
Lines.drawLine(getXOffset(),
getYOffset(),
getXOffset(),
getYOffset() + getBoardDimension() * getScale(),
3, PaintColors.BLACK_PAINT, backgroundCanvas);
Lines.drawLine(getXOffset(),
getYOffset() + getBoardDimension() * getScale(),
getXOffset() + getBoardDimension() * getScale(),
getYOffset() + getBoardDimension() * getScale(),
3, PaintColors.BLACK_PAINT, backgroundCanvas);
Lines.drawLine(getXOffset() + getBoardDimension() * getScale(),
getYOffset() + getBoardDimension() * getScale(),
getXOffset() + getBoardDimension() * getScale(),
getYOffset(),
3, PaintColors.BLACK_PAINT, backgroundCanvas);
Lines.drawLine(getXOffset() + getBoardDimension() * getScale(),
getYOffset(),
getXOffset(),
getYOffset(),
3, PaintColors.BLACK_PAINT, backgroundCanvas);
}
public boolean pieceInRange(BasePiece piece, int x, int y) {
return (x + piece.getXDimension() < boardDimension && y + piece.getYDimension() < boardDimension);
}
public BasePiece topPiece(int x, int y, float xOff, float yOff) {
return getBoardGrid()[x][y].topPiece(xOff, yOff);
}
public float getXOffset() {
return getBoard().getXOffset();
}
public float getYOffset() {
return getBoard().getYOffset();
}
public float getScale() {
return getBoard().getScale();
}
}
|
[
"karomine@gmail.com"
] |
karomine@gmail.com
|
8f0f4fdc63d7c680fd309381b7d4c3457f2465d6
|
f026eddc8f9b33165432a2e9486ea3adc0329364
|
/src/main/java/com/institution/service/IInstitutionReportService.java
|
3e6ab650390db684a694ebf97c5034c9dbec68b1
|
[] |
no_license
|
GrayooKey/hl_pro_v2
|
27f62f70b29a26d87bb663f5d040fb2f91693b0f
|
14a56db444fcedd0e1a5f3e4052a4bb6367f289d
|
refs/heads/master
| 2023-01-04T16:35:00.369202
| 2019-06-02T13:10:32
| 2019-06-02T13:10:32
| 177,954,375
| 0
| 0
| null | 2022-12-16T05:55:25
| 2019-03-27T08:49:46
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 828
|
java
|
package com.institution.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.common.base.service.IBaseService;
import com.institution.module.Institution;
import com.urms.orgFrame.module.OrgFrame;
import com.urms.orgFrame.vo.OrgFrameVo;
import com.urms.user.module.User;
/**
*
* @Description 制度统计service接口
* @author xm
* @date 2016-10-12
*
*/
public interface IInstitutionReportService extends IBaseService{
/**
*
* @ClassName:IinstitutionReportService.java
* @Description:制度阅读统计
* @param institutionId
* @return
* @author xm
* @date 2016-10-12
*/
public String getInstitutionReport(String institutionId);
public void saveOrUpdate(Institution institution, User user);
List<OrgFrame> getNodes(OrgFrameVo orgFrameVo);
}
|
[
"983034353@qq.com"
] |
983034353@qq.com
|
5f82be6449288aa33835d2715622122428321b4c
|
b13a9f62e9d1b73b83688dcafe3de92cf288f325
|
/app/src/main/java/com/example/nodo/MainActivity.java
|
43442e7e3fee0fbd248bd8d94a944abd92e8e659
|
[] |
no_license
|
KnightsOfAvalon/No-Do-App
|
207d32c90d4bad98f6b05115ad98c975fea3ea31
|
8c57fd61a84bda7b13a2d67062537a9ff80046e8
|
refs/heads/master
| 2023-02-09T14:22:11.497458
| 2021-01-07T00:24:52
| 2021-01-07T00:24:52
| 327,461,216
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 4,426
|
java
|
// Designates what package this activity is a part of
package com.example.nodo;
// Importing all dependencies that this activity will use
import android.content.Intent;
import android.os.Bundle;
import com.example.nodo.model.NoDo;
import com.example.nodo.model.NoDoViewModel;
import com.example.nodo.ui.NoDoListAdapter;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
import java.util.List;
import java.util.Objects;
public class MainActivity extends AppCompatActivity {
private static final int NEW_NODO_REQUEST_CODE = 1; // Creates a variable that holds the request code
private NoDoListAdapter noDoListAdapter; // Creates a variable that will hold the recycler view adapter
private NoDoViewModel noDoViewModel; // Creates a variable that will hold the view model
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar); // Initializes the toolbar view
setSupportActionBar(toolbar);
// Initializes the view model
noDoViewModel = ViewModelProviders.of(this)
.get(NoDoViewModel.class);
RecyclerView recyclerView = findViewById(R.id.recyclerView); // Initializes the recycler view
noDoListAdapter = new NoDoListAdapter(this); // Initializes the recycler view adapter
recyclerView.setAdapter(noDoListAdapter); // Sets the recycler view adapter on the recycler view
recyclerView.setLayoutManager(new LinearLayoutManager(this)); // Sets a layout manager on the recycler view
FloatingActionButton fab = findViewById(R.id.fab); // Initializes the floating action button
// Sets an onClick listener on the floating action button
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Creates a new intent
Intent intent = new Intent(MainActivity.this, NewNoDoActivity.class);
// Starts a new activity -- moves from the current activity (main activity) to
// the NewNoDoActivity. Also, the request code is passed to the new activity.
startActivityForResult(intent, NEW_NODO_REQUEST_CODE);
}
});
noDoViewModel.getAllNoDos().observe(this, new Observer<List<NoDo>>() {
@Override
public void onChanged(List<NoDo> noDos) {
// Update the saved copy of no-dos in the adapter
noDoListAdapter.setNoDos(noDos);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == NEW_NODO_REQUEST_CODE && resultCode == RESULT_OK) {
assert data != null;
NoDo noDo = new NoDo(Objects.requireNonNull(data.getStringExtra(NewNoDoActivity.EXTRA_REPLY)));
noDoViewModel.insert(noDo);
} else {
Toast.makeText(this, R.string.empty_not_saved, Toast.LENGTH_LONG).show();
}
}
}
|
[
"washington_ava@yahoo.com"
] |
washington_ava@yahoo.com
|
fab7148c411b0290011d9381ad155e1944c11000
|
fc11646ada720b5e44a38cddec815c630f059410
|
/src/main/java/com/demandforce/bluebox/admin/dto/Vendor.java
|
7e778c9b7ad8a2313a1c4e3e347f68abd9942679
|
[] |
no_license
|
hsanchez67/new_ef_admin
|
51b2c2636bd41cfa3f0b87917a1fbad00bac2ea9
|
a82d730f15408c3aa3be6aaef396e45bad52bb5a
|
refs/heads/master
| 2020-05-18T17:24:38.961059
| 2015-04-01T15:36:46
| 2015-04-01T15:36:46
| 33,256,094
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 798
|
java
|
package com.demandforce.bluebox.admin.dto;
public class Vendor {
private int vendorId;
private String name;
private String contact;
public Vendor() {
}
public Vendor(int vendorId, String name, String contact) {
this.vendorId = vendorId;
this.name = name;
this.contact = contact;
}
public int getVendorId() {
return vendorId;
}
public void setVendorId(int vendorId) {
this.vendorId = vendorId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
@Override
public String toString() {
return "Vendor [vendorId=" + vendorId + ", name=" + name + ", contact="
+ contact + "]";
}
}
|
[
"hsanchez@customerlink.com"
] |
hsanchez@customerlink.com
|
e0e4545752f8f9d5bdbf7f05e88c722d479375ca
|
f6ece58dad55e9bdb3c4988c6c50bccf3d04a432
|
/reporter-config-snoop/src/main/java/com/snoopconsulting/idi/metrics/config/AbstractReporterConfig.java
|
01239067622298d1e6d1a703053c0974a8c0894b
|
[
"Apache-2.0"
] |
permissive
|
snoopconsulting/metrics-alarms
|
658feff9a8f241acb755a4c2e698c51ede2b749d
|
7762830f9a241475c4a9d38a8be35ea892e35db8
|
refs/heads/master
| 2016-09-10T03:40:40.993451
| 2014-07-15T15:19:07
| 2014-07-15T15:19:07
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,329
|
java
|
/*
* 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.snoopconsulting.idi.metrics.config;
import com.yammer.metrics.core.MetricPredicate;
import java.util.concurrent.TimeUnit;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
public abstract class AbstractReporterConfig
{
@NotNull
@Min(1)
private long period;
@NotNull
@Pattern(
regexp = "^(DAYS|HOURS|MICROSECONDS|MILLISECONDS|MINUTES|NANOSECONDS|SECONDS)$",
message = "must be a valid java.util.concurrent.TimeUnit"
)
private String timeunit;
@Valid
private PredicateConfig predicate;
public long getPeriod()
{
return period;
}
public void setPeriod(long period)
{
this.period = period;
}
public String getTimeunit()
{
return timeunit;
}
public void setTimeunit(String timeunit)
{
this.timeunit = timeunit;
}
public TimeUnit getRealTimeunit()
{
return TimeUnit.valueOf(timeunit);
}
public PredicateConfig getPredicate()
{
return predicate;
}
public void setPredicate(PredicateConfig predicate)
{
this.predicate = predicate;
}
protected boolean isClassAvailable(String className)
{
try
{
Class.forName(className);
return true;
}
catch (ClassNotFoundException e)
{
return false;
}
}
public MetricPredicate getMetricPredicate()
{
if (predicate == null)
{
return MetricPredicate.ALL;
}
else
{
return predicate;
}
}
public abstract boolean enable();
}
|
[
"nicolas.just@snoopconsulting.com"
] |
nicolas.just@snoopconsulting.com
|
e006e6c28d684841bf1a500ed9e17fe1aa852491
|
2b6e430aab71afa8ec9d864dbba2f6fb40dad993
|
/CrackingTheCodingInterview/src/Person.java
|
ecf600d9a55f8851047253594f8d13d4796163eb
|
[] |
no_license
|
VasiliAnoshin/PracticeBeforeInterview
|
972cece176402a0db41fa062c151dc406942c952
|
5d171ce8bcc22224ec3968a3c3476d90d17e09b6
|
refs/heads/master
| 2020-06-15T18:17:53.272505
| 2017-06-16T20:01:08
| 2017-06-16T20:01:08
| 75,272,785
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 96
|
java
|
public class Person {
String Name;
public Person(String name){
this.Name = name;
}
}
|
[
"anoshin45@gmail.com"
] |
anoshin45@gmail.com
|
d8b89eb8c485cf0a03b10767e9675293b5a64de8
|
80369371e9f9da1111fb8c8fc6f4c41158494fce
|
/src/main/java/com/github/kristofa/test/http/HttpResponseFileWriterImpl.java
|
aa891a0ac092d23d1507680964dd94059e360f8c
|
[
"Apache-2.0"
] |
permissive
|
mediavrog/mock-http-server
|
a915b0e92ec05a3de31598bae508698de90738c5
|
8a9363b03c4a83ca550562f69ee9e982ff2355e3
|
refs/heads/master
| 2020-12-01T11:41:19.979991
| 2013-07-14T10:04:11
| 2013-07-14T10:04:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,665
|
java
|
package com.github.kristofa.test.http;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import org.apache.commons.io.FileUtils;
class HttpResponseFileWriterImpl implements HttpResponseFileWriter {
/**
* {@inheritDoc}
*/
@Override
public void write(final HttpResponse response, final File httpResponseFile, final File httpResponseEntityFile) {
try {
writeResponse(response, httpResponseFile);
writeResponseEntity(response, httpResponseEntityFile);
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}
private void writeResponse(final HttpResponse httpResponse, final File httpResponseFile) throws IOException {
final BufferedWriter writer =
new BufferedWriter(new OutputStreamWriter(new FileOutputStream(httpResponseFile), "UTF-8"));
try {
writer.write("[HttpCode]");
writer.newLine();
writer.write(String.valueOf(httpResponse.getHttpCode()));
writer.newLine();
writer.write("[ContentType]");
writer.newLine();
writer.write(httpResponse.getContentType());
writer.newLine();
} finally {
writer.close();
}
}
private void writeResponseEntity(final HttpResponse httpResponse, final File httpResponseEntityFile) throws IOException {
if (httpResponse.getContent() != null) {
FileUtils.writeByteArrayToFile(httpResponseEntityFile, httpResponse.getContent());
}
}
}
|
[
"kr_adr@yahoo.co.uk"
] |
kr_adr@yahoo.co.uk
|
9ca674a2cee9e604a67a56f565730a434a8cf277
|
5cfc2bc189504dbf69c0df83555f5012c033fb72
|
/src/main/java/com/muditasoft/hibernateorm/_02onetomany/bidirectional/Course.java
|
2c91568f70fb80903d294771012d1a52e88750c5
|
[] |
no_license
|
tutkuince/hibernateorm
|
65edc8a02bf3c93cad313cf88dd49839e3e6a4ec
|
041565c3ae044a4aca877ebe9fd34030eb350629
|
refs/heads/master
| 2020-04-02T23:37:06.778567
| 2018-10-30T13:28:28
| 2018-10-30T13:28:28
| 154,873,241
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,390
|
java
|
package com.muditasoft.hibernateorm._02onetomany.bidirectional;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* @author tutku ince
*
* Oct 29, 2018
*/
@Entity
@Table(name = "course")
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "title", length = 128)
private String title;
@ManyToOne(cascade = { CascadeType.DETACH, CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH })
@JoinColumn(name = "instructor_id")
private Instructor instructor;
public Course() {
// TODO Auto-generated constructor stub
}
public Course(String title) {
this.title = title;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Instructor getInstructor() {
return instructor;
}
public void setInstructor(Instructor instructor) {
this.instructor = instructor;
}
@Override
public String toString() {
return "Course [id=" + id + ", title=" + title + "]";
}
}
|
[
"tutku.ince@outlook.com"
] |
tutku.ince@outlook.com
|
9224cd8857953652b09b7df8dc946c3fe7694d49
|
86d55252ca2ee808fcfeec04f7c6b7f8aeba86d0
|
/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/TestBehavior.java
|
ecd6ac9077f04183e840e4fa0e73751a62ac29c2
|
[
"Apache-2.0"
] |
permissive
|
Kuvaldis/citrus
|
26b65d2cd7fd59b0fcaddf1c4a910c6eef52b884
|
ef59ac3bec5a2a0b8b93d55a40fcf2c3f7deaeb3
|
refs/heads/master
| 2020-04-06T06:51:46.423068
| 2015-07-13T08:07:54
| 2015-07-13T08:07:54
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,003
|
java
|
/*
* Copyright 2006-2015 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.consol.citrus.dsl;
/**
* Test apply interface applies to test builder classes adding all builder
* methods to a test builder instance.
*
* @author Christoph Deppisch
* @since 1.3.1
* @deprecated since 2.2.1 in favor of using {@link com.consol.citrus.dsl.design.TestBehavior}
*/
public interface TestBehavior extends com.consol.citrus.dsl.design.TestBehavior {
}
|
[
"deppisch@consol.de"
] |
deppisch@consol.de
|
43bb8855850dfef216e7e2fa157a9d87f8ef116a
|
43e039c22a501bae27f86acf430427078effa908
|
/Miller_PA2/src/Miller_p1/Application.java
|
71c286372f84730454e4ae1063042d55949ed77d
|
[] |
no_license
|
Matteo431/Miller_pa01
|
aa14a2f93346551e75ed6930e847d6ef24518570
|
92dc72471f881e2d2e37b250d2414be9925b31cf
|
refs/heads/master
| 2020-12-13T16:48:22.755841
| 2020-02-14T07:15:44
| 2020-02-14T07:15:44
| 234,476,004
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,175
|
java
|
package Miller_p1;
import java.util.Scanner;
import Miller_p2.BMICalculator;
public class Application {
public static void main(String[] args) {
//prompt the user to enter the four-digit integer
System.out.println("Please enter a four-digit integer: ");
Scanner in = new Scanner(System.in);
String num = in.nextLine();
//safe programming in case the length isn't there
if(num.length() != 4)
System.out.println("Please enter a four-digit integer: ");
//run through the encrypter program to encrypt the value
Encrypter run_encryption = new Encrypter();
String encrypt_result = run_encryption.encrypt(num);
System.out.printf("Encrypted value: %s\n", encrypt_result);
//run through the decrypter program to attain the original prompted value
Decrypter run_decryption = new Decrypter();
String decrypt_result = run_decryption.decrypt(encrypt_result);
System.out.printf("Decrypted value: %s\n", decrypt_result);
//calculate the BMI through specific function calls to determine the user's BMI
BMICalculator test_calc = new BMICalculator();
test_calc.readUserData();
test_calc.calculateBMI();
test_calc.displayBMI();
}
}
|
[
"bballmatt431@knights.ucf.edu"
] |
bballmatt431@knights.ucf.edu
|
5ed798155f8d6d350a02d6a9c03c6295edf140ff
|
d6edc4d640892eb3f53735a6c9c6b3413026145e
|
/Java/w2/d3/src/RainbowBoxFunction.java
|
1a646e40da008c7abe8af93461efdf82a4646d34
|
[] |
no_license
|
green-fox-academy/martinsvatek
|
b981086cf092a265b556256ec1754fb53eb652ac
|
a04e6b18c5cd8f2fbf4447a3d4f0b82ad85d570e
|
refs/heads/master
| 2020-05-04T17:09:22.651024
| 2019-06-20T15:19:44
| 2019-06-20T15:19:44
| 179,300,453
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,553
|
java
|
import javax.swing.*;
import java.awt.*;
import static javax.swing.JFrame.EXIT_ON_CLOSE;
public class RainbowBoxFunction {
public static void mainDraw(Graphics graphics) {
for (int i = 0; i < 320; i++) {
CenteredSquare(320 - i , new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)), graphics);
}
}
private static void CenteredSquare(int size, Color color, Graphics graphics) {
graphics.setColor(color);
graphics.fillRect(WIDTH / 2 - size / 2, HEIGHT / 2 - size / 2, size, size);
}
// Create a square drawing function that takes 3 parameters:
// The square size, the fill color, graphics
// and draws a square of that size and color to the center of the canvas.
// Create a loop that fills the canvas with rainbow colored squares.
// Don't touch the code below
static int WIDTH = 320;
static int HEIGHT = 320;
public static void main(String[] args) {
JFrame jFrame = new JFrame("Drawing");
jFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
ImagePanel panel = new ImagePanel();
panel.setPreferredSize(new Dimension(WIDTH, HEIGHT));
jFrame.add(panel);
jFrame.setLocationRelativeTo(null);
jFrame.setVisible(true);
jFrame.pack();
}
static class ImagePanel extends JPanel {
@Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
mainDraw(graphics);
}
}
}
|
[
"svatek.ma@gmail.com"
] |
svatek.ma@gmail.com
|
51724fde748c6dbcfc8228737d74da8d552a4742
|
e3e62a681004739bd57a90ba111e8a67fc1342ec
|
/app/src/main/java/smktelkom_mlg/sch/id/crudroompersistance_lyra/AppDatabase.java
|
194ea1a4f659413d7052cce075c74dac36c2c4ca
|
[] |
no_license
|
lyrahrtn/CRUDRoomPersistance_Lyra
|
3350646fffec22ce84d625d5ca3f50a0474e5491
|
de0e46f78836b46d438327852e2a2f53b3efd72d
|
refs/heads/master
| 2020-05-04T20:00:36.012128
| 2019-04-04T03:57:01
| 2019-04-04T03:57:01
| 179,417,495
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 308
|
java
|
package smktelkom_mlg.sch.id.crudroompersistance_lyra;
import android.arch.persistence.room.Database;
import android.arch.persistence.room.RoomDatabase;
@Database(entities = {SiswaModel.class}, version = 1)
public abstract class AppDatabase extends RoomDatabase {
public abstract SiswaDao userDao();
}
|
[
"lyra_hertin_26rpl@student.smktelkom-mlg.sch.id"
] |
lyra_hertin_26rpl@student.smktelkom-mlg.sch.id
|
79cfca49ee64d81b135659ec6ddbf91dc30c9765
|
36d4c9a57b53f5e14acb512759b49fe44d9990d8
|
/geekbrains_java_0/test1/src/Main6MultTable.java
|
8ba63bc4dd9927537ba2e665e82e46f8b787fd22
|
[] |
no_license
|
yosef8234/test
|
4a280fa2b27563c055b54f2ed3dfbc7743dd9289
|
8bb58d12b2837c9f8c7b1877206a365ab9004758
|
refs/heads/master
| 2021-05-07T22:46:06.598921
| 2017-10-16T18:11:26
| 2017-10-16T18:11:26
| 107,286,907
| 4
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 629
|
java
|
/**
* Created by igor on 17.05.15.
*/
public class Main6MultTable {
public static void main(String[] args) {
for (int i = 1; i < 10; i++) {
for (int j = 1; j < 10; j++) {
// System.out.println(i + " * " + j + " == " + i * j);
//sout
// System.out.print(j + " * " + i + " == " + i * j + "\t\t");
//souf
System.out.printf("%d * %d == %d\t\t", j, i, i * j);
}
System.out.println();
}
System.out.printf("число %d, строка %s, дробное %.1f", 10, "java", 22.1234);
}
}
|
[
"ekoz@protonmail.com"
] |
ekoz@protonmail.com
|
667f42d7091b7226ba4f85e0986caa5db50d7b0b
|
c9a630a689399580ecaa6b00200764742e7d5b89
|
/src/main/java/com/sample/trader/rules/UnmatchedRule.java
|
de9d697c18551cd720d2f4886f58f50f97a03510
|
[] |
no_license
|
victordov/trading-sample
|
4a075e1aa91cd48745c1369349f81a002da455f9
|
8c3348f9bc61676f05bc6ad30ac47706c6670f97
|
refs/heads/master
| 2020-12-25T21:56:28.495818
| 2014-07-18T01:09:42
| 2014-07-18T01:09:42
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 337
|
java
|
package com.sample.trader.rules;
/**
* Default Rule that gets applied when no other rule matches.
*/
public class UnmatchedRule implements Rule<Object>
{
@Override
public boolean apply(Object event)
{
return true;
}
@Override
public Class<Object> getType()
{
return Object.class;
}
}
|
[
"mailtomohitarora@gmail.com"
] |
mailtomohitarora@gmail.com
|
fffa326b0894e50f5bc4a9fcb3c083241b686d06
|
78f230d521fd8e4337e912b5af3ea37486bb96ef
|
/myth-common/src/main/java/org/dromara/myth/common/utils/DateUtils.java
|
a086b5906064b4267b7681ca0dcbc2d23da167f0
|
[
"Apache-2.0"
] |
permissive
|
dromara/myth
|
a7ed95907914a6da8eed2b1d39df4a5039f34936
|
02b1b86abba1fed4a0a536a8a955d6e1be02b74c
|
refs/heads/master
| 2023-03-08T09:32:04.732726
| 2022-08-19T02:23:20
| 2022-08-19T02:23:20
| 112,703,947
| 123
| 43
|
Apache-2.0
| 2023-03-01T11:28:50
| 2017-12-01T06:33:28
|
Java
|
UTF-8
|
Java
| false
| false
| 2,841
|
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dromara.myth.common.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
/**
* DateUtils.
*
* @author xiaoyu
*/
public class DateUtils {
/**
* The constant LOGGER.
*/
public static final Logger LOGGER = LoggerFactory.getLogger(DateUtils.class);
private static final String DATE_FORMAT_DATETIME = "yyyy-MM-dd HH:mm:ss";
/**
* parseLocalDateTime.
* out put format:yyyy-MM-dd HH:mm:ss
*
* @param str date String
* @return yyyy-MM-dd HH:mm:ss
* @see LocalDateTime
*/
private static LocalDateTime parseLocalDateTime(final String str) {
return LocalDateTime.parse(str, DateTimeFormatter.ofPattern(DATE_FORMAT_DATETIME));
}
/**
* Gets date yyyy.
*
* @return the date yyyy
*/
public static Date getDateYYYY() {
LocalDateTime localDateTime = parseLocalDateTime(getCurrentDateTime());
ZoneId zone = ZoneId.systemDefault();
Instant instant = localDateTime.atZone(zone).toInstant();
return Date.from(instant);
}
/**
* Parse date string.
*
* @param date the date
* @return the string
*/
public static String parseDate(Date date) {
Instant instant = date.toInstant();
ZoneId zone = ZoneId.systemDefault();
LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, zone);
return formatLocalDateTime(localDateTime);
}
private static String formatLocalDateTime(final LocalDateTime dateTime) {
return dateTime.format(DateTimeFormatter.ofPattern(DATE_FORMAT_DATETIME));
}
/**
* Gets current date time.
*
* @return the current date time
*/
public static String getCurrentDateTime() {
return LocalDateTime.now().format(DateTimeFormatter.ofPattern(DATE_FORMAT_DATETIME));
}
}
|
[
"549477611@qq.com"
] |
549477611@qq.com
|
27c1bf39d172b54cd6fc498d46893a755196aacd
|
5855fece091c22c09fe35448d0cf25bd21fccd4b
|
/app/Bootstrap.java
|
a0d49aeabf54ec95e220ce3946804d83ad697f6a
|
[] |
no_license
|
acrovetto/yabe
|
f9e7c0ee28e023f112c332c0fa48bbab8816ce4a
|
42457a6b47e6415b6c2e0d6050c795bf109148e3
|
refs/heads/master
| 2020-05-27T13:25:31.684932
| 2011-03-17T12:18:52
| 2011-03-17T12:18:52
| 1,488,063
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 316
|
java
|
import play.*;
import play.jobs.*;
import play.test.*;
import models.*;
@OnApplicationStart
public class Bootstrap extends Job {
public void doJob() {
// Check if the database is empty
if (User.count() == 0) {
Fixtures.load("initial-data.yml");
}
}
}
|
[
"acrovetto@PC080505.axones.fr"
] |
acrovetto@PC080505.axones.fr
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.