text stringlengths 10 2.72M |
|---|
package com.example.audiodemo;
import androidx.appcompat.app.AppCompatActivity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
MediaPlayer mplayer;
public void playAudio(View view){
mplayer.start();
}
public void pauseAudio(View view){
mplayer.pause();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mplayer=MediaPlayer.create(MainActivity.this,R.raw.bird);
}
} |
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package edu.tsinghua.lumaqq.ecore.face;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see edu.tsinghua.lumaqq.ecore.face.FacePackage
* @generated
*/
public interface FaceFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
FaceFactory eINSTANCE = edu.tsinghua.lumaqq.ecore.face.impl.FaceFactoryImpl.init();
/**
* Returns a new object of class '<em>Face</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Face</em>'.
* @generated
*/
Face createFace();
/**
* Returns a new object of class '<em>Group</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Group</em>'.
* @generated
*/
FaceGroup createFaceGroup();
/**
* Returns a new object of class '<em>Faces</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Faces</em>'.
* @generated
*/
Faces createFaces();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
FacePackage getFacePackage();
} //FaceFactory
|
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.*;
public class JsonUtilityTest {
public static final String TEST_JSON_TREE_SIMPLE_NO_MATCH = "{\"a\":\"abc\"}";
public static final String TEST_JSON_TREE_SIMPLE_DIRECT_FULL_MATCH = "{\"X\":\"abc\"}";
public static final String TEST_JSON_TREE_COMPLEX_NO_MATCH = "{\"a\" : [ { \"c\":\"\",}, {\"b\":\"abc\"} ,{\"x\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_DIRECT_FULL_MATCH = "{\"X\" : [ { \"c\":\"\",}, {\"b\":\"abc\"} ,{\"x\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_DIRECT_SUBTREE_MATCH = "{\"a\" : [ { \"c\":\"\",}, {\"X\":\"abc\"} ,{\"x\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_SINGLE_MATCH = "{\"X\":\"abc\"}";
public static final String TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH = "{\"a\" : [ { \"c\":\"\",}, {\"X\":\"abc\"} ,{\"X\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH_OCCURENCE_ONE = "{\"X\":\"abc\"}";
public static final String TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH_OCCURENCE_TWO = "{\"X\":\"xyz\"}";
public static final String TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH = "{\"X\" : [ { \"c\":\"\",}, {\"b\":\"abc\"} ,{\"X\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH_OCCURENCE_ONE = "{\"X\" : [ { \"c\":\"\",}, {\"b\":\"abc\"} ,{\"X\":\"xyz\"} ] }";
public static final String TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH_OCCURENCE_TWO = "{\"X\":\"xyz\"}";
public static final String TEST_JSON_SEARCH_MATCH_STRING_ONE = "";
public static final String TEST_JSON_SEARCH_MATCH_STRING_TWO = "abc";
public static final String TEST_JSON_SEARCH_MATCH_STRING_THREE = "xyz";
public static final String TEST_JSON_SEARCH_STRING = "X";
public JSONParser jsonParser = new JSONParser();
public JSONObject getJsonFromString(String stringToParse){
try {
return (JSONObject) jsonParser.parse(stringToParse);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
@Test
public void extractTag_noMatchFoundSimple_shouldReturnEmptyList(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_NO_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertTrue(matchSubtree.isEmpty());
}
@Test
public void extractTag_matchFoundSimple_shouldReturnTheWholeTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_DIRECT_FULL_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> expectedResult = new ArrayList<>();
expectedResult.add(testTree);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertEquals(expectedResult.toString(),matchSubtree.toString());
}
@Test
public void extractTag_noMatchFoundComplex_shouldReturnEmptyList(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_NO_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertTrue(matchSubtree.isEmpty());
}
@Test
public void extractTag_matchFoundComplexFullTree_shouldReturnTheWholeTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_DIRECT_FULL_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> expectedResult = new ArrayList<>();
expectedResult.add(testTree);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertEquals(expectedResult.toString(),matchSubtree.toString());
}
@Test
public void extractTag_matchFoundComplexSubTree_shouldReturnTheMatchedSubtree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_DIRECT_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> expectedResult = new ArrayList<>();
JSONObject matchJsonData = getJsonFromString(TEST_JSON_TREE_COMPLEX_SINGLE_MATCH);
expectedResult.add(matchJsonData);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertEquals(expectedResult.toString(),matchSubtree.toString());
}
@Test
public void extractTag_matchFoundComplexSubTreeNonNested_shouldReturnMultipleMatchedSubtree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> expectedResult = new ArrayList<>();
JSONObject matchJsonData = getJsonFromString(TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH_OCCURENCE_ONE);
expectedResult.add(matchJsonData);
matchJsonData = getJsonFromString(TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH_OCCURENCE_TWO);
expectedResult.add(matchJsonData);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertEquals(expectedResult.toString(),matchSubtree.toString());
}
@Test
public void extractTag_matchFoundComplexSubTreeNested_shouldReturnMultipleMatchedSubtree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<JSONObject> expectedResult = new ArrayList<>();
JSONObject matchJsonData = getJsonFromString(TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH_OCCURENCE_ONE);
expectedResult.add(matchJsonData);
matchJsonData = getJsonFromString(TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH_OCCURENCE_TWO);
expectedResult.add(matchJsonData);
ArrayList<JSONObject> matchSubtree = JsonUtility.extractTag(testTree,tagsToSearch);
assertEquals(expectedResult.toString(),matchSubtree.toString());
}
@Test
public void getTextContent_seenTagNeededNoMatchSubtree_shouldReturnEmptylist(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_NO_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertTrue(textResult.isEmpty());
}
@Test
public void getTextContent_noSeenTagNeededNoMatchSubtree_shouldReturnAllTextInSubtree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_NO_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,true);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContent_seenTagNeededMatchSubtree_shouldReturnAppropiateSubtreeText(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_DIRECT_FULL_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContent_noSeenTagNeededMatchSubtree_shouldReturnAllTextInSubtree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_SIMPLE_DIRECT_FULL_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContext_seenTagNeededComplexTree_shouldReturnExactFullTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_DIRECT_FULL_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_ONE);
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_THREE);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContext_seenTagNeededComplexTree_shouldReturnExactSubTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_DIRECT_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContext_seenTagNeededComplexNonNestedTree_shouldReturnExactSubTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_NON_NESTED_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_THREE);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
@Test
public void getTextContext_seenTagNeededComplexNestedTree_shouldReturnExactSubTree(){
JSONObject testTree = getJsonFromString(TEST_JSON_TREE_COMPLEX_NESTED_SUBTREE_MATCH);
ArrayList<String> tagsToSearch = new ArrayList<>();
tagsToSearch.add(TEST_JSON_SEARCH_STRING);
ArrayList<String> expectedResult = new ArrayList<>();
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_ONE);
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_TWO);
expectedResult.add(TEST_JSON_SEARCH_MATCH_STRING_THREE);
ArrayList<String> textResult = JsonUtility.getTextContent(testTree,tagsToSearch,false);
assertEquals(expectedResult.toString(),textResult.toString());
}
} |
package org.bouncycastle.pqc.jcajce.provider.test;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import junit.framework.TestCase;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.pqc.crypto.lms.LMOtsParameters;
import org.bouncycastle.pqc.crypto.lms.LMSigParameters;
import org.bouncycastle.pqc.jcajce.provider.BouncyCastlePQCProvider;
import org.bouncycastle.pqc.jcajce.spec.LMSHSSParameterSpec;
import org.bouncycastle.pqc.jcajce.spec.LMSParameterSpec;
import org.bouncycastle.util.Strings;
public class LMSTest
extends TestCase
{
public void setUp()
{
if (Security.getProvider(BouncyCastlePQCProvider.PROVIDER_NAME) == null)
{
Security.addProvider(new BouncyCastlePQCProvider());
}
}
public void testKeyPairGenerators()
throws Exception
{
KeyPairGenerator kpGen = KeyPairGenerator.getInstance("LMS", "BCPQC");
KeyPair kp = kpGen.generateKeyPair();
trySigning(kp);
kpGen.initialize(new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1));
kp = kpGen.generateKeyPair();
trySigning(kp);
kpGen.initialize(new LMSHSSParameterSpec(
new LMSParameterSpec[] {
new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1),
new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1)
}), new SecureRandom());
kp = kpGen.generateKeyPair();
trySigning(kp);
}
private void trySigning(KeyPair keyPair)
throws Exception
{
byte[] msg = Strings.toByteArray("Hello, world!");
Signature signer = Signature.getInstance("LMS", "BCPQC");
signer.initSign(keyPair.getPrivate(), new SecureRandom());
signer.update(msg);
byte[] sig = signer.sign();
signer.initVerify(keyPair.getPublic());
signer.update(msg);
assertTrue(signer.verify(sig));
}
public void testKeyFactoryLMSKey()
throws Exception
{
KeyPairGenerator kpGen = KeyPairGenerator.getInstance("LMS", "BCPQC");
kpGen.initialize(new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1));
KeyPair kp = kpGen.generateKeyPair();
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(kp.getPublic().getEncoded());
KeyFactory kFact = KeyFactory.getInstance("LMS", "BCPQC");
PublicKey pub1 = kFact.generatePublic(x509KeySpec);
assertEquals(kp.getPublic(), pub1);
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(kp.getPrivate().getEncoded());
PrivateKey priv1 = kFact.generatePrivate(pkcs8KeySpec);
assertEquals(kp.getPrivate(), priv1);
kFact = KeyFactory.getInstance(PKCSObjectIdentifiers.id_alg_hss_lms_hashsig.getId(), "BCPQC");
pub1 = kFact.generatePublic(x509KeySpec);
assertEquals(kp.getPublic(), pub1);
}
public void testKeyFactoryHSSKey()
throws Exception
{
KeyPairGenerator kpGen = KeyPairGenerator.getInstance("LMS", "BCPQC");
kpGen.initialize(new LMSHSSParameterSpec(
new LMSParameterSpec[] {
new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1),
new LMSParameterSpec(LMSigParameters.lms_sha256_n32_h5, LMOtsParameters.sha256_n32_w1)
}), new SecureRandom());
KeyPair kp = kpGen.generateKeyPair();
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(kp.getPublic().getEncoded());
KeyFactory kFact = KeyFactory.getInstance("LMS", "BCPQC");
PublicKey pub1 = kFact.generatePublic(x509KeySpec);
assertEquals(kp.getPublic(), pub1);
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(kp.getPrivate().getEncoded());
PrivateKey priv1 = kFact.generatePrivate(pkcs8KeySpec);
assertEquals(kp.getPrivate(), priv1);
kFact = KeyFactory.getInstance(PKCSObjectIdentifiers.id_alg_hss_lms_hashsig.getId(), "BCPQC");
pub1 = kFact.generatePublic(x509KeySpec);
assertEquals(kp.getPublic(), pub1);
}
}
|
package com.zking.t251.a;
public class a {
String A = "yangxuan";
}
|
package Chapter4DynamicProgramming.LongestCommonSubsequence;
public class Solution {
public static void main(String[] args) {
System.out.println(solve("counter", "counteract"));
}
public static int solve(String s1, String s2) {
int m = s1.length();
int n = s2.length();
int[][] D = new int[m+1][n+1];
for (int i = 0; i <= m; i++) {
D[i][0] = 0;
}
for (int i = 0; i <= n; i++) {
D[0][i] = 0;
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
D[i][j] = Math.max(D[i-1][j], D[i][j-1]);
if (s1.charAt(i-1) == s2.charAt(j-1)) {
D[i][j] = Math.max(D[i][j], 1 + D[i-1][j-1]);
}
}
}
return D[m][n];
}
}
|
package com.tencent.mm.plugin.aa.ui;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnFocusChangeListener;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.tencent.mm.ab.l;
import com.tencent.mm.bp.a;
import com.tencent.mm.plugin.wxpay.a.f;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.ag;
import com.tencent.mm.vending.app.c;
import com.tencent.mm.vending.c.b;
import com.tencent.mm.wallet_core.ui.WalletBaseUI;
import com.tencent.mm.wallet_core.ui.e;
import com.tenpay.android.wechat.MyKeyboardWindow;
public abstract class BaseAAPresenterActivity extends WalletBaseUI {
private static final int eCE = a.fromDPToPix(ad.getContext(), 300);
private c dtb = new c();
protected View eCD;
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.dtb.A(getIntent(), this);
this.uYS = true;
}
public void onResume() {
super.onResume();
this.dtb.GM(2);
}
public void onPause() {
super.onPause();
this.dtb.GM(3);
}
public void onDestroy() {
super.onDestroy();
this.dtb.onDestroy();
}
public final <T extends b<? extends com.tencent.mm.vending.app.a>> T t(Class<? extends b<? extends com.tencent.mm.vending.app.a>> cls) {
return this.dtb.a(this, cls);
}
public final <T extends com.tencent.mm.vending.app.a> T w(Class<? extends com.tencent.mm.vending.app.a> cls) {
return this.dtb.b(this, cls);
}
public final boolean d(int i, int i2, String str, l lVar) {
return false;
}
protected final void a(View view, int i, boolean z, boolean z2) {
this.mKeyboard = (MyKeyboardWindow) findViewById(f.tenpay_num_keyboard);
this.kMk = findViewById(f.tenpay_keyboard_layout);
View findViewById = findViewById(f.tenpay_push_down);
final EditText editText = (EditText) view.findViewById(f.wallet_content);
if (this.mKeyboard != null && editText != null && this.kMk != null) {
this.kMk.setVisibility(8);
e.setNoSystemInputOnEditText(editText);
final boolean z3 = z;
final boolean z4 = z2;
final View view2 = view;
final int i2 = i;
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
public final void onFocusChange(View view, boolean z) {
if (!view.isFocused() || z3) {
new ag().postDelayed(new 2(this), 200);
return;
}
((InputMethodManager) BaseAAPresenterActivity.this.mController.tml.getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 0);
new ag().postDelayed(new 1(this, view), 300);
}
});
editText.setOnClickListener(new 2(this, z, editText, i));
findViewById.setOnClickListener(new 3(this));
}
}
public final void Wq() {
super.Wq();
if (this.eCD != null) {
this.eCD.scrollTo(0, 0);
}
}
}
|
package fanli.selfcode.kmp;
import java.util.Arrays;
// str1= "BBC ABCDAB ABCDABCDABDE"
// str2="ABCDABD"
public class KMP_Algorithm {
public static void main(String[] args) {
String str1 = "BBC ABCDAB ABCDABCDABDE";
String str2 = "BCDABD";
// int[] D = cal_D(str2);
// System.out.println(Arrays.toString(D));
int index = kmp_Algorithm(str1, str2);
System.out.println("KMP 算法 -- 返回的第一次匹配下标为:" + index);
System.out.println();
System.out.print("String 类 -- 自带的方法:");
System.out.println(str1.indexOf(str2)); // String 自带了寻找匹配串的方法
}
// 计算D数组 D[i] : arr[0] ~ arr[i]index
public static int[] cal_D(String str) {
char[] arr = str.toCharArray();
int len = arr.length;
int[] D = new int[len];
D[0] = 0;
int i = 1;
int j = 0;
while (i < len) {
if (arr[i] == arr[j]) {
D[i++] = ++j;
} else {
if (j > 0) {
j = D[j - 1]; // 注意(这里和两串匹配意义相近)
} else {
i++;
}
}
}
return D;
}
// 匹配
public static int kmp_Algorithm(String str1, String str2) {
int[] d = cal_D(str2);
int len1 = str1.length();
int len2 = str2.length();
int i = 0;
int j = 0;
while (i < len1) {
if (str1.charAt(i) == str2.charAt(j)) {
i++;
j++;
if (j == len2) {
return i - j;
}
} else {
if (j == 0) {
i = i + 1;
} else {
j = d[j - 1];
}
}
}
return -1;
}
}
|
package rent.common.repository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import rent.common.entity.ParameterTypeEntity;
import rent.common.projection.ParameterTypeBasic;
import java.util.List;
@RepositoryRestResource(
collectionResourceRel = "parameter-types",
path = "parameter-type",
itemResourceRel = "parameter-type",
excerptProjection = ParameterTypeBasic.class)
public interface ParameterTypeRepository extends PagingAndSortingRepository<ParameterTypeEntity, String> {
ParameterTypeEntity findByCode(@Param("code") String code);
List<ParameterTypeEntity> findByNameContainingOrderByCode(@Param("name") String name);
}
|
package org.buaa.ly.MyCar.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.buaa.ly.MyCar.entity.Store;
import org.buaa.ly.MyCar.exception.NotFoundError;
import org.buaa.ly.MyCar.http.dto.StoreDTO;
import org.buaa.ly.MyCar.logic.StoreLogic;
import org.buaa.ly.MyCar.service.StoreService;
import org.buaa.ly.MyCar.utils.BeanCopyUtils;
import org.buaa.ly.MyCar.utils.StatusEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Component("storeService")
@Slf4j
@Transactional
public class StoreServiceImpl implements StoreService {
private StoreLogic storeLogic;
@Autowired
public void setStoreLogic(StoreLogic storeLogic) {
this.storeLogic = storeLogic;
}
@Override
public StoreDTO find(int id) {
Store store = storeLogic.find(id);
if ( store == null ) throw new NotFoundError("failure to find the store");
else return StoreDTO.build(store);
}
@Override
public List<StoreDTO> find() {
List<Store> stores = storeLogic.findByStatus(StatusEnum.OK.getStatus());
if ( stores == null ) throw new NotFoundError("failure to find the store");
else return StoreDTO.build(stores);
}
@Override
public StoreDTO insert(StoreDTO storeDTO) {
return StoreDTO.build(storeLogic.insert(storeDTO.build()));
}
@Modifying
@Override
public StoreDTO update(int id, StoreDTO storeDTO) {
Store store = storeLogic.find(id);
if ( store == null ) throw new NotFoundError("failure to find the store");
BeanCopyUtils.copyPropertiesIgnoreNull(storeDTO.build(), store);
return StoreDTO.build(store);
}
@Override
public StoreDTO delete(int id) {
Store store = storeLogic.updateStatus(id,StatusEnum.DELETE.getStatus());
if ( store == null ) throw new NotFoundError("failure to find the store");
else return StoreDTO.build(storeLogic.updateStatus(id,StatusEnum.DELETE.getStatus()));
}
}
|
package 파일시스템;
import java.io.FileWriter;
import java.io.IOException;
import javax.swing.JOptionPane;
public class 파일에쓰기 {
public static void main(String[] args) {
try {
// 1 test2.txt스트링을 file객체로 만들어준다
// 2 test2.txt파일로 java프로그램간에 stream까지 만들어준다
String day = JOptionPane.showInputDialog("날짜 입력");
String title = JOptionPane.showInputDialog("제목 입력");
String content = JOptionPane.showInputDialog("내용 입력");
String we = JOptionPane.showInputDialog("날씨 입력");
FileWriter file = new FileWriter(day + ".txt");
// 3 stream으로 데이터를 보내면 된다
file.write(day + "\n");
file.write(title + "\n");
file.write(content + "\n");
file.write(we + "\n");
file.close();
} catch (IOException e) {
System.out.println("파일 저장하는 동안 에러가 발생");
}
}
}
|
package instructable.server.ccg;
import instructable.server.utils.InstUtils;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Maps;
import com.jayantkrish.jklol.ccg.lexicon.StringContext;
import com.jayantkrish.jklol.preprocessing.FeatureGenerator;
public class StringFeatureGenerator implements FeatureGenerator<StringContext, String>
{
private static final long serialVersionUID = 1L;
private static final int MAX_LENGTH = 3;
private static final int MAX_POS_LENGTH = 1;
@Override
public Map<String, Double> generateFeatures(StringContext context)
{
Map<String, Double> featureValues = Maps.newHashMap();
featureValues.put(histogramFeatureValue("length", getStringLength(context), MAX_LENGTH), 1.0);
featureValues.put(histogramFeatureValue("orgLength", context.getWords().size(), MAX_LENGTH), 1.0);
int[] semiPosCount = semiPosCount(context);
for (PosForFeatures posForFeatures : PosForFeatures.values()) {
String baseFeatureName = "tot" + posForFeatures.toString();
featureValues.put(histogramFeatureValue(baseFeatureName, semiPosCount[posForFeatures.ordinal()], MAX_POS_LENGTH), 1.0);
}
featureValues.put("atStart"+getPosForFeatures(context.getPos().get(context.getSpanStart())).toString(), 1.0);
featureValues.put("atEnd"+getPosForFeatures(context.getPos().get(context.getSpanEnd())).toString(), 1.0);
featureValues.put("endsAtEndOfSentence", (double) endsAtEndOfSentence(context));
featureValues.put("startsAtBegOfSentence", (context.getSpanStart() == 0 ? 1.0 : 0.0));
List<String> tokens = getRelevantTokens(context);
InstUtils.EmailAddressRelation emailAddressRelation = InstUtils.getEmailAddressRelation(tokens);
if (emailAddressRelation == InstUtils.EmailAddressRelation.isOneEmail ||
emailAddressRelation == InstUtils.EmailAddressRelation.listOfEmails)
{
//encouraging a list of emails to be together (as it is also considered as "only emails" and also listOfEmails.
featureValues.put("only emails", 1.0);
featureValues.put("numOfEmailWords",(double)tokens.size()); //the more emails (and good "and"s) the better
}
if (emailAddressRelation != InstUtils.EmailAddressRelation.isOneEmail)
{
featureValues.put(emailAddressRelation.toString(), 1.0);
}
if (getStringLength(context) == 1 || emailAddressRelation == InstUtils.EmailAddressRelation.listOfEmails)
{
featureValues.put("oneUnit", 1.0); //treat length=1 different than all the rest
}
return featureValues;
}
private String histogramFeatureValue(String baseFeatureName, int value, int maxValue) {
String featureName = null;
if (value <= maxValue) {
featureName = baseFeatureName + "=" + value;
} else {
featureName = baseFeatureName + ">" + maxValue;
}
return featureName.intern();
}
private List<String> getRelevantTokens(StringContext context)
{
List<String> tokens = new LinkedList<>();
for (int idx = context.getSpanStart(); idx <= context.getSpanEnd(); idx++)
{
tokens.add(context.getWords().get(idx));
}
return tokens;
}
private int endsAtEndOfSentence(StringContext context)
{
if (context.getWords().size() == context.getSpanEnd() + 1)
return 1;
return 0;
}
enum PosForFeatures
{
baseVerb, //VB base verbs (like "set", "send", "forward", etc.) are more likely to be commands
otherVerbs, //could be: VBD, VBG, VBN, VBP, VBZ
nouns, //NN, NNS
prpNprps,
adverbs, //RB,RBR,RBS
dt,
different
}
private PosForFeatures getPosForFeatures(String pos)
{
if (pos.equals("VB"))
return PosForFeatures.baseVerb;
else if (pos.startsWith("VB"))
return PosForFeatures.otherVerbs;
else if (pos.startsWith("NN"))
return PosForFeatures.nouns;
else if (pos.startsWith("PRP"))
return PosForFeatures.prpNprps;
else if (pos.startsWith("RB"))
return PosForFeatures.adverbs;
return PosForFeatures.different;
}
private int[] semiPosCount(StringContext context)
{
int[] semiPosCounter = new int[PosForFeatures.values().length];
for (int idx = context.getSpanStart(); idx <= context.getSpanEnd(); idx++)
{
String pos = context.getPos().get(idx);
semiPosCounter[getPosForFeatures(pos).ordinal()]++;
}
return semiPosCounter;
}
private int getStringLength(StringContext context)
{
return 1 + (context.getSpanEnd() - context.getSpanStart());
}
//private String getRootConstituency(StringContext context)
//{
// return null;
//}
}
|
package lt.kvk.i11.radiukiene.utils;
/**
* Created by Vita on 4/23/2018.
*/
public class GS {
public String id;
public String name;
public String waste_id;
public String title;
public String wasteCollect_date;
public String wasteCollection_id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
|
package jdbchomework.utils;
import jdbchomework.exceptions.DbConnectionException;
import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.slf4j.LoggerFactory;
public class HibernateUtil {
private static org.slf4j.Logger log = LoggerFactory.getLogger(HibernateUtil.class);
private static SessionFactory sessionFactory;
static {
try {
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (HibernateException e) {
throw new DbConnectionException("Cannot create Session Factory", e);
}
}
private HibernateUtil() {
throw new IllegalAccessError("Utility class");
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void closeSessionFactory() {
try {
sessionFactory.close();
} catch (HibernateException e) {
log.error("Cannot close sessionFactory", e);
throw new DbConnectionException("Cannot close sessionFactory", e);
}
}
} |
package COM.JambPracPortal.BEAN;
import COM.JambPracPortal.DAO.DAO;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean
@SessionScoped
public class viewCert_Application extends DAO {
PreparedStatement ps;
ResultSet rs;
private String fullname;
private String email;
private String phone;
private String program;
private String cclNo;
private String username;
private String dateSigneUp;
private String dateApplied;
private String duration;
public PreparedStatement getPs() {
return this.ps;
}
public void setPs(PreparedStatement ps) {
this.ps = ps;
}
public ResultSet getRs() {
return this.rs;
}
public void setRs(ResultSet rs) {
this.rs = rs;
}
public String getFullname() {
return this.fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getProgram() {
return this.program;
}
public void setProgram(String program) {
this.program = program;
}
public String getCclNo() {
return this.cclNo;
}
public void setCclNo(String cclNo) {
this.cclNo = cclNo;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDateSigneUp() {
return this.dateSigneUp;
}
public void setDateSigneUp(String dateSigneUp) {
this.dateSigneUp = dateSigneUp;
}
public String getDateApplied() {
return this.dateApplied;
}
public void setDateApplied(String dateApplied) {
this.dateApplied = dateApplied;
}
public String getDuration() {
return this.duration;
}
public void setDuration(String duration) {
this.duration = duration;
}
public List<viewCert_Application> getCert_ApplicatonviewInfo() throws Exception {
Connector();
List<viewCert_Application> stockviewInfo = new ArrayList<>();
try {
PreparedStatement ps = getCn().prepareStatement("SELECT fullname,emailid,phone,program,c.username,cclno,SignedupDate,dateapplied,DATEDIFF(dateapplied,SignedupDate) FROM enrollment e inner join cert_application c ON e.username = c.username AND status=''");
this.rs = ps.executeQuery();
while (this.rs.next()) {
viewCert_Application tbl = new viewCert_Application();
tbl.setFullname(this.rs.getString("fullname"));
tbl.setEmail(this.rs.getString("emailID"));
tbl.setPhone(this.rs.getString("phone"));
tbl.setProgram(this.rs.getString("program"));
tbl.setUsername(this.rs.getString("username"));
tbl.setCclNo(this.rs.getString("cclNo"));
tbl.setDateSigneUp(this.rs.getString("SignedupDate"));
tbl.setDateApplied(this.rs.getString("dateApplied"));
tbl.setDuration(this.rs.getString(9));
stockviewInfo.add(tbl);
}
ps.close();
} catch (Exception e) {
throw e;
} finally {
this.Close();}
return stockviewInfo;
}
public List<viewCert_Application> getCert_ApprovalviewInfo() throws Exception {
Connector();
List<viewCert_Application> stockviewInfo = new ArrayList<>();
try {
PreparedStatement ps = getCn().prepareStatement("SELECT fullname,emailid,phone,program,c.username,cclno,SignedupDate,dateapplied,DATEDIFF(dateapplied,SignedupDate) FROM enrollment e inner join cert_application c ON e.username = c.username AND status='approved'");
this.rs = ps.executeQuery();
while (this.rs.next()) {
viewCert_Application tbl = new viewCert_Application();
tbl.setFullname(this.rs.getString("fullname"));
tbl.setEmail(this.rs.getString("emailID"));
tbl.setPhone(this.rs.getString("phone"));
tbl.setProgram(this.rs.getString("program"));
tbl.setUsername(this.rs.getString("username"));
tbl.setCclNo(this.rs.getString("cclNo"));
tbl.setDateSigneUp(this.rs.getString("SignedupDate"));
tbl.setDateApplied(this.rs.getString("dateApplied"));
tbl.setDuration(this.rs.getString(9));
stockviewInfo.add(tbl);
}
ps.close();
Close();
} catch (Exception e) {
throw e;
} finally {
try {
this.rs.close();
this.ps.close();
Close();
} catch (Exception e) {
e.printStackTrace();
System.err.println("Error while viewing cert-application: " + e.getMessage());
}
}
return stockviewInfo;
}
}
|
package unalcol.types.collection.list;
import java.util.NoSuchElementException;
/**
* <p>Title: Queue</p>
* <p>
* <p>Description: A queue </p>
* <p>
* <p>Copyright: Copyright (c) 2009</p>
* <p>
* <p>Company: Kunsamu</p>
*
* @author Jonatan Gomez
* @version 1.0
*/
public class Queue<T> extends List<T> {
public Queue() {
}
public boolean del(T data) {
try {
del();
return true;
} catch (NoSuchElementException e) {
return false;
}
}
public void del() throws NoSuchElementException {
try {
head = head.next;
size--;
if (head == null) {
last = null;
}
} catch (Exception e) {
throw new NoSuchElementException();
}
}
}
|
package com.github.vinja.util;
import java.util.concurrent.atomic.AtomicLong;
public class IdGenerator {
private static AtomicLong id = new AtomicLong(1);
public static String getUniqueId() {
long v = id.getAndIncrement();
return String.valueOf(v);
}
}
|
package demo;
//我们称一个数 X 为好数, 如果它的每位数字逐个地被旋转 180 度后,我们仍可以得到一个有效的,且和 X 不同的数。要求每位数字都要被旋转。
//
// 如果一个数的每位数字被旋转以后仍然还是一个数字, 则这个数是有效的。0, 1, 和 8 被旋转后仍然是它们自己;2 和 5 可以互相旋转成对方;6 和 9 同理,除了这些以外其他的数字旋转以后都不再是有效的数字。
//
// 现在我们有一个正整数 N, 计算从 1 到 N 中有多少个数 X 是好数?
import java.util.Scanner;
// 思路:包含 2 5 6 9 中任意一个且不包含 3 4 7 的就是好数
// str.contains()
// 100 -- 40 复杂运算括号的重要性 !!!
public class X好数 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
for (int i = 1; i <= n; i++) {
String str = String.valueOf(i);
if((str.contains("2") || str.contains("5")|| str.contains("6")|| str.contains("9"))
&& (!str.contains("3") && !str.contains("4")&& !str.contains("7"))){
count++;
}
}
System.out.println(count);
}
}
//public class Main {
// public static void main(String[] args) {
// Scanner scanner = new Scanner(System.in);
// int n = scanner.nextInt();
// int count = 0;
// for (int i = 1; i <= n; i++) {
// String str = String.valueOf(i);
// // 包含2、5、6、9中任意个,且不包含3、4、7的即为好数
// if ((str.contains("2") || str.contains("5") || str.contains("6") || str.contains("9")) && (!str.contains("3") && !str.contains("4") && !str.contains("7"))) {
// count++;
// }
// }
// System.out.println(count);
// }
//}
|
package fr.polytech.al.tfc.account.controller.mock;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import fr.polytech.al.tfc.account.model.Account;
import fr.polytech.al.tfc.account.model.Transaction;
import fr.polytech.al.tfc.account.repository.AccountRepository;
import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Random;
//@EnableScheduling
@Component
public class TransactionMockSender {
private AccountRepository accountRepository;
private String topic;
private Producer<String, String> producer;
public TransactionMockSender(AccountRepository accountRepository, @Value("${kafkabroker}") String broker) {
//todo warning kafka broker here
String customer = "kafka-transaction";
this.topic = String.format("%s", customer);
Properties props = new Properties();
props.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, broker);
props.put("acks", "all");
props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
this.producer = new KafkaProducer<>(props);
this.accountRepository = accountRepository;
}
public void addTransactionIntoAccounts() throws JsonProcessingException {
List<Account> accounts = giveRandomAccount(accountRepository.findAll());
Account account1 = accounts.get(0);
Account account2 = accounts.get(1);
ObjectMapper objectMapper = new ObjectMapper();
Random r = new Random();
Integer randomInteger = r.nextInt();
Transaction transaction = new Transaction(account1.getAccountId(),account2.getAccountId(),randomInteger,LocalDateTime.now());
producer.send(new ProducerRecord<>(topic, transaction.getSource(), objectMapper.writeValueAsString(transaction)));
producer.flush();
}
public List<Account> giveRandomAccount(List<Account> accounts) {
List<Account> accountsRandomChosen = new ArrayList<>();
Account account = new Account();
Random random = new Random();
while (accountsRandomChosen.size() != 2) {
int randomInteger = random.nextInt(accounts.size() - 1);
if (accountsRandomChosen.size() == 1) {
account = accounts.get(randomInteger);
if (accountsRandomChosen.get(0).equals(account)) {
continue;
}
}
accountsRandomChosen.add(account);
}
return accountsRandomChosen;
}
} |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package UI;
import Service.Impl.InstallmentMonthlyManagerImpl;
import java.awt.Frame;
import java.awt.event.KeyEvent;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
/**
*
* @author babman92
*/
public class InstallmentMonthlyFrm extends javax.swing.JFrame {
/**
* Creates new form InstallmentMonthlyFrm
*/
InstallmentMonthlyManagerImpl IstMonthlyImpl;
String CustomerID;
public InstallmentMonthlyFrm() {
initComponents();
setExtendedState(JFrame.MAXIMIZED_BOTH);
IstMonthlyImpl = new InstallmentMonthlyManagerImpl();
Vector source = IstMonthlyImpl.GetListFromTable("Select * From [InstallmentMonthly]");
SetDataIntoTable(source);
}
public InstallmentMonthlyFrm(String CustomerID) {
initComponents();
this.CustomerID = CustomerID;
String sqlSearch = "Select * From [InstallmentMonthly] Where [CustomerID] LIKE '%" + CustomerID + "%'";
Vector sourceSearch = IstMonthlyImpl.GetListFromTable(sqlSearch);
SetDataIntoTable(sourceSearch);
}
private void SetDataIntoTable(Vector source) {
Vector column = new Vector();
column.addElement("ID");
column.addElement("CustomerID");
column.addElement("RateInterestMoney");
column.addElement("MoneyRoot");
column.addElement("Total");
column.addElement("PayDate");
column.addElement("State");
TableModel model = new DefaultTableModel(source, column);
tblInstallment.setModel(model);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tblInstallment = new javax.swing.JTable();
jPanel2 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txfCustomerID = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Data"));
jPanel1.setLayout(new java.awt.BorderLayout());
tblInstallment.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
}
));
jScrollPane1.setViewportView(tblInstallment);
jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Control"));
jLabel1.setText("Search By Customer ID");
txfCustomerID.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
txfCustomerIDKeyPressed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(txfCustomerID, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(595, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(txfCustomerID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(49, Short.MAX_VALUE))
);
getContentPane().add(jPanel2, java.awt.BorderLayout.PAGE_START);
pack();
}// </editor-fold>//GEN-END:initComponents
private void txfCustomerIDKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txfCustomerIDKeyPressed
// TODO add your handling code here:
CustomerID = txfCustomerID.getText();
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
String sqlSearch = "Select * From [InstallmentMonthly] Where [CustomerID] LIKE '%" + CustomerID + "%'";
Vector sourceSearch = IstMonthlyImpl.GetListFromTable(sqlSearch);
SetDataIntoTable(sourceSearch);
}
}//GEN-LAST:event_txfCustomerIDKeyPressed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(InstallmentMonthlyFrm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(InstallmentMonthlyFrm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(InstallmentMonthlyFrm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(InstallmentMonthlyFrm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the form
*/
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new InstallmentMonthlyFrm().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblInstallment;
private javax.swing.JTextField txfCustomerID;
// End of variables declaration//GEN-END:variables
}
|
import java.net.*;
import java.io.*;
import java.util.*;
import p2pBLL.*;
public class P2PServer {
final long chunkSize = 102400;
int _listeningPortNumber = -1;
int _maxClientsLimit = 0;
String _fileToSplit = "";
ServerSocket _listener;
public P2PServer(int portNumber, int maxClientLimit, String fileToSplit) {
_listeningPortNumber = portNumber;
_maxClientsLimit = maxClientLimit;
_fileToSplit = fileToSplit;
}
public static void main(String args[]) {
ConfigManager.init();
int serverPortNumber = Integer.parseInt(ConfigManager.getProperty("ServerPortNumber"));
int maxClients = 5;
String fileName = ConfigManager.getProperty("FileName");
P2PServer server = new P2PServer(serverPortNumber, maxClients, "data/" + fileName);
server.init();
}
private void init() {
try {
_listener = new ServerSocket(_listeningPortNumber, _maxClientsLimit);
System.out.println("The server is running.");
System.out.println("Splitting the file");
FileUtility fu = new FileUtility();
int splitCount = fu.splitFile(_fileToSplit, chunkSize);
System.out.println("File Splited in " + splitCount + " parts");
System.out.println("Waiting for connection");
int clientNum = 1;
try {
while (true) {
new ServerHandler(_listener.accept(), clientNum, getRandomizedSequences(clientNum, splitCount),
splitCount, _fileToSplit).start();
System.out.println("Client " + clientNum + " is connected!");
clientNum++;
}
} catch (IOException ioException) {
ioException.printStackTrace();
} finally {
if (!_listener.isClosed())
_listener.close();
}
} catch (IOException ioException) {
ioException.printStackTrace();
System.err.println("Error setting up socket " + ioException.getMessage());
} finally {
try {
if (!_listener.isClosed())
_listener.close();
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
}
private int[] getRandomizedSequences(int clientNumber, int splitCount) {
int runner = 1;
ArrayList<Integer> al = new ArrayList<Integer>();
for (int i = 1; i <= splitCount; i++) {
if (runner > _maxClientsLimit)
runner = 1;
if (clientNumber == runner) {
al.add(i);
}
runner++;
}
int[] sequences = new int[al.size()];
for (int i = 0; i < al.size(); i++) {
sequences[i] = al.get(i).intValue();
}
return sequences;
}
}
|
package demoudp;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DemoUDP
{
public static int data = 0;
private DatagramSocket socket;
private DatagramPacket packet;
private final int receiveport = 16789;
private final int sendport = receiveport +1;
private final int bufferSize = 1024;
public DemoUDP() {
try {
socket = new DatagramSocket(sendport);
} catch (SocketException e) {
System.out.println("Socket exception occur. " + e.getMessage());
}
}
public void closeUdp() {
socket.close();
}
public void sendUdp() {
String obj = String.valueOf(data);
ObjectOutputStream os = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
os = new ObjectOutputStream(baos);
os.writeObject(obj);
byte[] buffer = baos.toByteArray();
packet = new DatagramPacket(buffer, buffer.length);
packet.setAddress(InetAddress.getByName("localhost"));
packet.setPort(receiveport);
socket.send(packet);
} catch (SocketException e) {
System.out.println("Socket exception occur. " + e.getMessage());
} catch (IOException e) {
System.out.println("IOException occur. " + e.getMessage());
} finally {
if (os != null) try {
os.close();
} catch (IOException ex) {
Logger.getLogger(DemoUDP.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public void receiveUdp() {
ObjectInputStream is = null;
try {
byte[] buffer = new byte[bufferSize];
packet = new DatagramPacket(buffer, buffer.length);
socket.receive(packet);
ByteArrayInputStream bais = new ByteArrayInputStream(packet.getData());
is = new ObjectInputStream(bais);
} catch (SocketException e) {
System.out.println("Socket exception occur. " + e.getMessage());
}
catch (IOException e) {
System.out.println("IOException occur. " + e.getMessage());
}
finally {
if (is != null) try {
is.close();
} catch (IOException ex) {
Logger.getLogger(DemoUDP.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
public static void main(String arg[]) throws Exception {
DemoUDP hendler = new DemoUDP();
MainPanel panel = new MainPanel();
for (int count = 0; count < 10; count = count++ ) {
hendler.sendUdp();
Thread.sleep(1000/5); // 5Hz frequency
DemoUDP.data = MainPanel.sliderData;
System.out.println("data is" + String.valueOf(DemoUDP.data));
}
hendler.closeUdp();
}
} |
package corgi.hub.core.mqtt.bean;
import java.io.Serializable;
import java.util.Date;
/**
* Created by Terry LIANG on 2016/12/24.
*/
public class Subscription implements Serializable {
private int requestedQos;
private String clientId;
private String topic;
private boolean cleanSession;
private boolean active = true;
private Date createTime;
private String nodeBelongTo;
public Subscription() {
}
public Subscription(String clientId, String topic, int requestedQos, boolean cleanSession) {
this.requestedQos = requestedQos;
this.clientId = clientId;
this.topic = topic;
this.cleanSession = cleanSession;
}
public String getClientId() {
return clientId;
}
public int getRequestedQos() {
return requestedQos;
}
public String getTopic() {
return topic;
}
public boolean isCleanSession() {
return this.cleanSession;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public void setRequestedQos(int requestedQos) {
this.requestedQos = requestedQos;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public void setTopic(String topic) {
this.topic = topic;
}
public void setCleanSession(boolean cleanSession) {
this.cleanSession = cleanSession;
}
public String getNodeBelongTo() {
return nodeBelongTo;
}
public void setNodeBelongTo(String nodeBelongTo) {
this.nodeBelongTo = nodeBelongTo;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Subscription other = (Subscription) obj;
if (this.requestedQos != other.requestedQos) {
return false;
}
if ((this.clientId == null) ? (other.clientId != null) : !this.clientId.equals(other.clientId)) {
return false;
}
if ((this.topic == null) ? (other.topic != null) : !this.topic.equals(other.topic)) {
return false;
}
return true;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public int hashCode() {
int hash = 3;
hash = 37 * hash + requestedQos;
hash = 37 * hash + (this.clientId != null ? this.clientId.hashCode() : 0);
hash = 37 * hash + (this.topic != null ? this.topic.hashCode() : 0);
return hash;
}
/**
* Trivial match method
*/
boolean match(String topic) {
return this.topic.equals(topic);
}
@Override
public String toString() {
return String.format("[t:%s, cliID: %s, qos: %s]", this.topic, this.clientId, this.requestedQos);
}
}
|
///*
// * To change this license header, choose License Headers in Project Properties.
// * To change this template file, choose Tools | Templates
// * and open the template in the editor.
// */
package br.com.des.forlogic.controller;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
//
///**
// *
// * @author Stefanie
// */
//
public class ConexaoBD {
public Statement stm;
public ResultSet rs;
private String driver = "org.postgresql.Driver";
private String caminho = "jdbc:postgresql://localhost:5432/locadora";
private String usuario = "postgres";
private String senha = "1234";
public Connection conexao;
public void conexao() {
try{
System.setProperty("jdbc.Drivers", driver);
conexao=DriverManager.getConnection(caminho, usuario, senha);
JOptionPane.showMessageDialog(null, "Conexão feita com sucesso!");
}catch (SQLException ex){
JOptionPane.showMessageDialog(null, "Erro ao conectar com o banco de dados: \n"+ex);
}
}
public void desconecta(){
try{
conexao.close();
JOptionPane.showMessageDialog(null, "BD desconectado com sucesso!");
} catch(SQLException ex){
JOptionPane.showMessageDialog(null, "Erro ao desconectar com o banco de dados: \n"+ex);
}
}
}
|
package extra_Practices;
public class Book {
String title="";
String author="";
String tableOfContents="";
int nextPage=1;
public Book(String title, String author){
this.title=title;
this.author=author;
}
public String gettableOfContents(){
return tableOfContents;
}
public int getPage(int page){
return nextPage=nextPage+page;
}
public void toString1(){
System.out.println( "title "+ title+ "\n author "+ author);
}
public void addChapter(String title, int pages){
getPage(pages);
System.out.println("\n "+ title+" "+ nextPage);
}
}
|
/*
* Copyright 2009 Kjetil Valstadsve
*
* 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 vanadis.concurrent;
import vanadis.common.time.TimeSpan;
import java.io.Closeable;
import java.util.concurrent.Future;
public interface OperationQueuer extends Closeable {
Thread getThread();
TimeSpan getTimeout();
boolean inDispatchThread();
<T> T createAsynch(T instance, Class<T> type, Class<?>... moreClasses);
<T> T createAsynch(T instance, Class<T> type, boolean reentrant, Class<?>... moreClasses);
<T> T createSynch(T instance, Class<T> type, Class<?>... moreClasses);
Future<?> submit(Invocation invocation);
void submitAndForget(Invocation invocation);
boolean synchUp();
void awaitShutdown(TimeSpan timeout);
}
|
package com.xiaoysec.hrm.business.department.entity;
import java.util.Set;
import com.xiaoysec.hrm.business.employee.entity.Employee;
import com.xiaoysec.hrm.common.base.BaseEntity;
public class Department extends BaseEntity<Department> {
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
private String remark;
private Set<Employee> employeeSet;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Set<Employee> getEmployeeSet() {
return employeeSet;
}
public void setEmployeeSet(Set<Employee> employeeSet) {
this.employeeSet = employeeSet;
}
}
|
package edu.sjsu.fly5.services;
public class EmployeeServiceProxy implements edu.sjsu.fly5.services.EmployeeService {
private String _endpoint = null;
private edu.sjsu.fly5.services.EmployeeService employeeService = null;
public EmployeeServiceProxy() {
_initEmployeeServiceProxy();
}
public EmployeeServiceProxy(String endpoint) {
_endpoint = endpoint;
_initEmployeeServiceProxy();
}
private void _initEmployeeServiceProxy() {
try {
employeeService = (new edu.sjsu.fly5.services.EmployeeServiceServiceLocator()).getEmployeeService();
if (employeeService != null) {
if (_endpoint != null)
((javax.xml.rpc.Stub)employeeService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
else
_endpoint = (String)((javax.xml.rpc.Stub)employeeService)._getProperty("javax.xml.rpc.service.endpoint.address");
}
}
catch (javax.xml.rpc.ServiceException serviceException) {}
}
public String getEndpoint() {
return _endpoint;
}
public void setEndpoint(String endpoint) {
_endpoint = endpoint;
if (employeeService != null)
((javax.xml.rpc.Stub)employeeService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
}
public edu.sjsu.fly5.services.EmployeeService getEmployeeService() {
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService;
}
public boolean addEmployee(edu.sjsu.fly5.pojos.Employee employee) throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.addEmployee(employee);
}
public boolean updateEmployee(edu.sjsu.fly5.pojos.Employee employee) throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.updateEmployee(employee);
}
public edu.sjsu.fly5.pojos.Employee viewEmployeeInfo(long employeeID) throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.viewEmployeeInfo(employeeID);
}
public edu.sjsu.fly5.pojos.Employee[] listEmployees() throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.listEmployees();
}
public boolean removeEmployee(long employeeID) throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.removeEmployee(employeeID);
}
public edu.sjsu.fly5.pojos.Employee[] searchEmployeesBasedOnAttributes(edu.sjsu.fly5.pojos.Attribute[] attributes) throws java.rmi.RemoteException, edu.sjsu.fly5.util.Fly5Exception{
if (employeeService == null)
_initEmployeeServiceProxy();
return employeeService.searchEmployeesBasedOnAttributes(attributes);
}
} |
package wallettemplate;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Scanner;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class Voter {
public static void start() throws ParseException {//Vcode+유권자 지갑 주소+후보자 이름을 넘겨 주고 투표권, 후보자 지갑 주소를 받는다
String Cstr = null;
//VoterInfo/////////////////////////////////////
JSONObject voterInfo = new JSONObject();
String str1 = Main.Vcode;
String str2 = Main.bitcoin.wallet().currentReceiveAddress().toString();
String str3 = Main.Cname;
voterInfo.put("vcode", str1);
voterInfo.put("kaddr", str2);
voterInfo.put("cname", str3);
//////////////////////////////////////////
try {
//php사용
URL url = new URL("http://13.124.112.35/KBK_election/server.setting/voter.php");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");//Post방식
conn.setDoOutput(true);
try(OutputStream out = conn.getOutputStream()){
out.write(("k_json="+URLEncoder.encode(voterInfo.toString(),"UTF-8")).getBytes());
}
InputStream is = conn.getInputStream();
Scanner scan = new Scanner(is,"UTF-8");
int line = 1;
while(scan.hasNext()) {
String str4 = scan.nextLine();
if(line == 16) {
System.out.println("str4 :" + str4);//확인용
Cstr = str4;//후보자 지역 주소 들어있는 Json
break;
}
line++;
}
scan.close();
}catch(IOException e) {
System.out.println("Error");
}
//Json Parse 시작 Test 필요
JSONObject candiInfo = new JSONObject();
JSONParser parser = new JSONParser();
candiInfo = (JSONObject)parser.parse(Cstr);
for(int i=0; i<Main.Clist.size(); i++) {
String s = (String)candiInfo.get(Main.Clist.get(i));
System.out.println(s);
Main.CAlist.add(s);
}
}
}
|
package org.idea.plugin.atg;
import com.google.common.collect.ImmutableList;
import com.intellij.facet.FacetTypeId;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.ScalableIcon;
import com.intellij.ui.LayeredIcon;
import com.intellij.util.PlatformIcons;
import org.idea.plugin.atg.module.AtgModuleFacet;
import javax.swing.*;
import java.util.List;
import java.util.regex.Pattern;
@SuppressWarnings({"WeakerAccess", "squid:S1118"})
public class Constants {
public static final String PLUGIN_ID = "atg-toolkit"; //don't change this in future releases
public static final String NOTIFICATION_GROUP_ID = PLUGIN_ID; //don't change this in future releases
public static final String ATG_TOOLKIT_CONFIGURABLE_ID = PLUGIN_ID;
public static final FacetTypeId<AtgModuleFacet> FACET_TYPE_ID = new FacetTypeId<>("config");
public static final String FACET_STRING_ID = "AtgModuleConfiguration"; //don't change this in future releases
public static final String FACET_PRESENTABLE_NAME = "ATG Facet"; //don't change this in future releases
public static final Pattern SUSPECTED_COMPONENT_NAME_REGEX = Pattern.compile("(?<=(^|\\s|=|,))/[^,=\\\\\\s]+");
public static final Pattern SUSPECTED_REFERENCE_NAME_REGEX = Pattern.compile("(?<=(^|\\s|=|,))/[^,=\\\\\\s]+");
public static final String DEFAULT_ITEM_DESCRIPTOR_CLASS = "atg.adapter.gsa.GSAPropertyDescriptor";
public static final List<String> IGNORED_ATTRIBUTES_NAMES_FOR_DESCRIPTOR = ImmutableList.of("uiwritable", "uiqueryable", "resourceBundle", "deployable", "propertySortPriority", "references", "serialize", "useCodeForValue", "stringEnumProvider", "unique");
public static final String WEB_HELP_URL = "https://github.com/chivaler/ATG-Toolkit/wiki/";
public static final String ATG_LIBRARY_SEPARATOR = ":";
public static final String ATG_CONFIG_LIBRARY_PREFIX = "ATGConfig" + ATG_LIBRARY_SEPARATOR;
public static final String ATG_CLASSES_LIBRARY_PREFIX = "ATG" + ATG_LIBRARY_SEPARATOR;
public static final String ATG_HOME = "ATG_HOME";
public static final String DYNAMO_ROOT = "DYNAMO_ROOT";
public static final String DYNAMO_HOME = "DYNAMO_HOME";
public static class Icons {
public static final Icon FACET_ICON = AllIcons.General.GearPlain;
public static final Icon COMPONENT_ICON = AllIcons.General.GearPlain;
public static final LayeredIcon CONFIG_ROOT_ICON;
public static final LayeredIcon CONFIG_LAYER_ROOT_ICON;
public static final LayeredIcon WEB_ROOT_ICON;
private static final float LAYERED_ICON_SCALE_FACTOR = 0.75F;
static {
Icon artifactIconScaled = AllIcons.Nodes.Artifact instanceof ScalableIcon ? ((ScalableIcon) AllIcons.Nodes.Artifact).scale(LAYERED_ICON_SCALE_FACTOR) : AllIcons.Nodes.Artifact;
Icon gearIconScaled = AllIcons.General.GearPlain instanceof ScalableIcon ? ((ScalableIcon) AllIcons.General.GearPlain).scale(0.5f) : AllIcons.General.GearPlain;
Icon webIconScaled = AllIcons.General.Web instanceof ScalableIcon ? ((ScalableIcon) AllIcons.General.Web).scale(LAYERED_ICON_SCALE_FACTOR) : AllIcons.General.Web;
CONFIG_ROOT_ICON = new LayeredIcon(2);
CONFIG_ROOT_ICON.setIcon(PlatformIcons.FOLDER_ICON, 0);
CONFIG_ROOT_ICON.setIcon(artifactIconScaled, 1, SwingConstants.SOUTH_EAST);
CONFIG_LAYER_ROOT_ICON = new LayeredIcon(3);
CONFIG_LAYER_ROOT_ICON.setIcon(PlatformIcons.FOLDER_ICON, 0);
CONFIG_LAYER_ROOT_ICON.setIcon(artifactIconScaled, 1, SwingConstants.SOUTH_EAST);
CONFIG_LAYER_ROOT_ICON.setIcon(gearIconScaled, 2, SwingConstants.NORTH_WEST);
WEB_ROOT_ICON = new LayeredIcon(2);
WEB_ROOT_ICON.setIcon(PlatformIcons.FOLDER_ICON, 0);
WEB_ROOT_ICON.setIcon(webIconScaled, 1, SwingConstants.SOUTH_EAST);
}
}
public static class Keywords {
public static class Manifest {
public static final String ATG_CONFIG_PATH = "ATG-Config-Path";
public static final String ATG_CLASS_PATH = "ATG-Class-Path";
public static final String ATG_REQUIRED = "ATG-Required";
public static final String ATG_VERSION = "ATG-Version";
public static final String ATG_INSTALL_UNIT = "ATG-Install-Unit";
}
public static class Repository {
public static final String ITEM_DESCRIPTOR = "item-descriptor";
public static final String NAME = "name";
public static final String PROPERTY = "property";
public static final String SUPER_TYPE = "super-type";
public static final String ATTRIBUTE = "attribute";
public static final String VALUE = "value";
public static final String BEAN = "bean";
public static final String PROPERTY_TYPE = "property-type";
public static final String COMPONENT_ITEM_TYPE = "component-item-type";
public static final String ITEM_TYPE = "item-type";
public static final String EDITOR_CLASS = "editor-class";
public static final String REPOSITORY = "repository";
}
public static class Properties {
public static final List<String> AVAILABLE_SCOPES = ImmutableList.of(
Scope.GLOBAL, Scope.SESSION, Scope.REQUEST, Scope.WINDOW, Scope.PROTOTYPE);
public static final String BASED_ON_PROPERTY = "$basedOn";
public static final String CLASS_PROPERTY = "$class";
public static final String SCOPE_PROPERTY = "$scope";
}
public static class Java {
public static final List<String> NUCLEUS_REFERENCES = ImmutableList.of("atg.nucleus.GenericReference", "atg.nucleus.ContextualSuffixGenericReference", "atg.nucleus.StaticMethodReference", "atg.nucleus.JNDIReference");
}
public static class Actor {
public static final String NAME = "name";
public static final String ACTOR = "actor";
public static final String COMPONENT = "component";
public static final String DROPLET = "droplet";
public static final String FORM = "form";
}
public static final String INCLUDE_TAG = "include";
public static final String DROPLET_TAG = "droplet";
public static final String IMPORT_BEAN_TAG = "importbean";
public static final String IMG_TAG = "img";
public static final String SCRIPT_TAG = "script";
public static final String PAGE_ATTRIBUTE = "page";
public static final String NAME_ATTRIBUTE = "name";
public static final String BEAN_VALUE_ATTRIBUTE = "beanvalue";
public static final String BEAN_ATTRIBUTE = "bean";
public static final String SRC_ATTRIBUTE = "src";
}
public static class HelpTopics {
public static final String MODULE_FACET_EDITOR = PLUGIN_ID + ".Facet-Settings";
public static final String PLUGIN_CONFIGURABLE_EDITOR = PLUGIN_ID + ".Project-Settings";
}
public static class Scope {
public static final String GLOBAL = "global";
public static final String SESSION = "session";
public static final String WINDOW = "window";
public static final String REQUEST = "request";
public static final String PROTOTYPE = "prototype";
}
}
|
package pl.java.scalatech.test.configurator;
import lombok.extern.slf4j.Slf4j;
import org.fest.assertions.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import pl.java.scalatech.configuration.MyConfig;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {MyConfig.class})
@Slf4j
public class MyConfigTest {
//http://www.intertech.com/Blog/spring-4-conditional-bean-configuration/
@Autowired
private String value;
@Autowired
private Environment env;
@Test
public void shouldFindBean(){
if(env.getProperty("user.country").equals("PL")){
Assertions.assertThat(value).isEqualTo("przodownik");
}else{
Assertions.assertThat(value).isEqualTo("foreign");
}
}
}
|
package com.rails.ecommerce.admin.order.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.rails.ecommerce.admin.webservice.client.ClientImpl;
import com.rails.ecommerce.core.common.domain.PaginationList;
import com.rails.ecommerce.core.common.domain.TrainNumberView;
import com.rails.ecommerce.core.order.domain.OrderInfo;
import com.rails.ecommerce.core.order.service.OrderService;
@RequestMapping(value="/order")
@Controller
public class OrderController {
@Resource(name = "OrderServiceImpl")
private OrderService orderService;
/**
* 页面跳转
* Function:
*
* @author gxl DateTime 2015-1-12 下午2:05:45
* @return
*/
@RequestMapping(value = "/orderinfo")
public ModelAndView orderInfo() {
ModelAndView model = new ModelAndView();
model.setViewName("order/order_info");
return model;
}
/**
* 页面跳转
* Function:
*
* @author gxl DateTime 2015-1-12 下午2:05:45
* @return
*/
@RequestMapping(value = "/addorder")
public ModelAndView addOrderInfo() {
ModelAndView model = new ModelAndView();
model.setViewName("order/add_order");
return model;
}
/**
* 获得初始化列表
* Function:
*
* @author gxl DateTime 2015-1-12 下午2:06:04
* @return
* @throws Exception
* @throws NumberFormatException
*/
@RequestMapping(value = "/orderinfo/list")
@ResponseBody
public PaginationList pageList(HttpServletRequest request, HttpServletResponse response) throws NumberFormatException, Exception {
String pageNo = request.getParameter("pageNum");
String pageSize = request.getParameter("pageSize");
String beginDate = request.getParameter("beginDate");
String endDate = request.getParameter("endDate");
String organization=request.getParameter("organization");
String trainNo= request.getParameter("trainNo");
PaginationList listpage = new PaginationList();
listpage = orderService.findAllPage(organization, trainNo, beginDate, endDate, Integer.valueOf(pageNo), Integer.valueOf(pageSize));
return listpage;
}
/**
* 获得车次列表
* Function:
*
* @author gxl DateTime 2015-1-12 下午2:06:04
* @return
* @throws Exception
* @throws NumberFormatException
*/
@RequestMapping(value = "/getTrainCode")
@ResponseBody
public List<TrainNumberView> getOrganizationForTrainNo(HttpServletRequest request, HttpServletResponse response) {
String carOrgId = request.getParameter("orgId");
List<TrainNumberView> trainList = new ArrayList<TrainNumberView>();
if(carOrgId != null && !"".equals(carOrgId)) {
try {
trainList = ClientImpl.getOrganizationForTrainNo(carOrgId);
} catch (Exception e) {
System.out.println("链接webservice服务器失败:"+e);
}
}
return trainList;
}
/**
* ajax表单提交
* Function:
*
* @author gxl DateTime 2015-1-13 下午7:34:10
* @return
*/
@RequestMapping(value = "/addorder/submit")
@ResponseBody
public String submit(HttpServletRequest request, HttpServletResponse response) {
OrderInfo oi = new OrderInfo();
// gi.setGoodsTitle(request.getParameter("goodsTitle"));
// gi.setPrice(Long.valueOf(request.getParameter("price")));
// gi.setCreateDate(new Date());
// gi.setLastModifyDate(new Date());
//
// gi.setGoodsSummary(request.getParameter("goodsSummary"));
// gi.setState(request.getParameter("state"));
// gi.setGoodsUnit(request.getParameter("goodsUnit"));
// //gi.setGoodsDescript(request.getParameter("goodsDescript"));
// gi.setTitleImgUrl(request.getParameter("titleImgUrl"));
// gi.setSmallImgUrl(request.getParameter("smallImgUrl"));
// gi.setImgUrl1(request.getParameter("imgUrl1"));
// gi.setImgUrl2(request.getParameter("imgUrl2"));
//
// gi.setCreateUser("admin");
// gi.setUnit("测试商家");
try {
orderService.save(oi);
} catch (Exception e) {
e.printStackTrace();
return "error";
}
return "sucess";
}
}
|
package fr.lteconsulting;
public class EmployeTempsPartiel extends Employe
{
public EmployeTempsPartiel( String nom )
{
super( nom );
}
@Override
public double getSalaire( float nbHeuresTravaillees )
{
if( nbHeuresTravaillees < 40 )
{
return super.getSalaire( nbHeuresTravaillees );
}
else
{
return super.getSalaire( nbHeuresTravaillees ) + 0.8 * (nbHeuresTravaillees - 40);
}
}
@Override
public String getCategorie()
{
return "PARTIEL";
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package computersales;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author Sasha
*/
public class NewConnect extends javax.swing.JDialog {
// Connection connection=ConnectionClass.connection;
/**
* Creates new form NewConnect
* @param parent
* @param modal
*/
public NewConnect(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
public Connection getConnection() {
return ConnectionClass.connection;
}
public boolean ready = false;
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
connect = new javax.swing.JButton();
host = new javax.swing.JTextField();
port = new javax.swing.JTextField();
db_name = new javax.swing.JTextField();
login = new javax.swing.JTextField();
password = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("New Connect");
connect.setText("Connect");
connect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
connectActionPerformed(evt);
}
});
host.setText("127.0.0.1");
port.setText("5432");
db_name.setText("ComputerSales");
db_name.setToolTipText("");
login.setText("postgres");
password.setText("1");
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel1.setText("Host");
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel2.setText("Port");
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel3.setText("Database");
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel4.setText("Login");
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabel5.setText("Password");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(password)
.addComponent(login)
.addComponent(db_name)
.addComponent(port)
.addComponent(host, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(connect, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(30, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(db_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(login, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addGap(16, 16, 16)
.addComponent(connect)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void connectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectActionPerformed
String url = "jdbc:postgresql://" + host.getText() + ":" + port.getText() + "/" + db_name.getText();
String connectLogin = this.login.getText();
String connectPassword = this.password.getText();
try {
Class.forName("org.postgresql.Driver");
ConnectionClass.connection = DriverManager.getConnection(url, connectLogin, connectPassword);
JOptionPane.showMessageDialog(new JFrame(), "Connection successful!");
} catch (ClassNotFoundException | SQLException ex) {
JOptionPane.showMessageDialog(new JFrame(), ex.getMessage());
return;
}
ready = true;
dispose();
}//GEN-LAST:event_connectActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton connect;
private javax.swing.JTextField db_name;
private javax.swing.JTextField host;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JTextField login;
private javax.swing.JTextField password;
private javax.swing.JTextField port;
// End of variables declaration//GEN-END:variables
}
|
package com.cg.project.castleglobalproject.home.fragments;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import com.cg.project.castleglobalproject.R;
import com.cg.project.castleglobalproject.base.fragments.BaseFragment;
import com.cg.project.castleglobalproject.base.widgets.circlepageindicator.CirclePageIndicator;
import com.cg.project.castleglobalproject.home.adapters.ImageSlideAdapter;
import com.cg.project.castleglobalproject.search.fragments.SearchResultFragment;
import com.cg.project.castleglobalproject.search.network.pojo.Restaurant;
import com.cg.project.castleglobalproject.search.network.pojo.SearchResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class HomeFragment extends BaseFragment {
private static final long ANIM_VIEWPAGER_DELAY = 2000;
private static final long ANIM_VIEWPAGER_DELAY_USER_VIEW = 10000;
private ViewPager mViewPager;
private CirclePageIndicator mIndicator;
private Handler handler;
private Runnable animateViewPager;
boolean stopSliding = false;
int[] images;
public static Fragment newInstance() {
Fragment fragment = new HomeFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mRootView = inflater.inflate(R.layout.fragment_home, container, false);
images = new int[] {R.drawable.pic_1, R.drawable.pic_2, R.drawable.pic_3};
mViewPager = (ViewPager) mRootView.findViewById(R.id.view_pager);
mIndicator = (CirclePageIndicator) mRootView.findViewById(R.id.indicator);
mIndicator.setOnPageChangeListener(new PageChangeListener());
mViewPager.setOnPageChangeListener(new PageChangeListener());
mViewPager.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction()) {
case MotionEvent.ACTION_CANCEL:
break;
case MotionEvent.ACTION_UP:
// calls when touch release on ViewPager
if (images != null && images.length != 0) {
stopSliding = false;
runnable(images.length);
handler.postDelayed(animateViewPager,
ANIM_VIEWPAGER_DELAY_USER_VIEW);
}
break;
case MotionEvent.ACTION_MOVE:
// calls when ViewPager touch
if (handler != null && stopSliding == false) {
stopSliding = true;
handler.removeCallbacks(animateViewPager);
}
break;
}
return false;
}
});
return mRootView;
}
public void runnable(final int size) {
handler = new Handler();
animateViewPager = new Runnable() {
public void run() {
if (!stopSliding) {
if (mViewPager.getCurrentItem() == size - 1) {
mViewPager.setCurrentItem(0);
} else {
mViewPager.setCurrentItem(
mViewPager.getCurrentItem() + 1, true);
}
handler.postDelayed(animateViewPager, ANIM_VIEWPAGER_DELAY);
}
}
};
}
@Override
public void onResume() {
if (mBaseListener != null) {
mBaseListener.setActionBarTitle("Home");
}
mViewPager.setAdapter(new ImageSlideAdapter(getActivity(), HomeFragment.this));
mIndicator.setViewPager(mViewPager);
// imgNameTxt.setText(""
// + ((Product) products.get(mViewPager.getCurrentItem()))
// .getName());
runnable(images.length);
handler.postDelayed(animateViewPager, ANIM_VIEWPAGER_DELAY);
super.onResume();
}
@Override
public void onPause() {
// if (task != null)
// task.cancel(true);
if (handler != null) {
//Remove callback
handler.removeCallbacks(animateViewPager);
}
super.onPause();
}
private class PageChangeListener implements ViewPager.OnPageChangeListener {
@Override
public void onPageScrollStateChanged(int state) {
if (state == ViewPager.SCROLL_STATE_IDLE) {
if (images != null) {
// imgNameTxt.setText(""
// + ((Product) products.get(mViewPager
// .getCurrentItem())).getName());
}
}
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageSelected(int arg0) {
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
public void processSearchResult(HashMap<String, List<Restaurant>> results) {
// HashMap<String, List<Restaurant>> results = new HashMap<>();
// for (Restaurant result : data.restaurants) {
// String[] cuisines = result.restaurant.cuisines.split(", ");
// for (String cuisine : cuisines) {
// List<Restaurant> restaurants = results.get(cuisine);
// if (restaurants == null) {
// restaurants = new ArrayList<>();
// }
// restaurants.add(result);
// results.put(cuisine, restaurants);
// }
// }
if (mBaseListener != null) {
mBaseListener.mDisplayFragment(SearchResultFragment.newInstance(results),true, true, true);
}
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tableClasses;
/**
*
* @author Mert
*/
public class tableStatusAndPhotos {
private int id;
private String status;
private int picStatusId;
private String url;
private String dateTime;
private int type;
private String nickname;
private String profilePhotoUrl;
private boolean isPhoto;
private boolean isStatus;
private int doubleLikeCount;
private int likeCount;
private int unlikeCount;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getPicStatusId() {
return picStatusId;
}
public void setPicStatusId(int picId) {
this.picStatusId = picId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getProfilePhotoUrl() {
return profilePhotoUrl;
}
public void setProfilePhotoUrl(String profilePhotoUrl) {
this.profilePhotoUrl = profilePhotoUrl;
}
public boolean getIsPhoto() {
return isPhoto;
}
public void setIsPhoto(boolean isPhoto) {
this.isPhoto = isPhoto;
}
public boolean getIsStatus() {
return isStatus;
}
public void setIsStatus(boolean isStatus) {
this.isStatus = isStatus;
}
public int getDoubleLikeCount() {
return doubleLikeCount;
}
public void setDoubleLikeCount(int doubleLikeCount) {
this.doubleLikeCount = doubleLikeCount;
}
public int getLikeCount() {
return likeCount;
}
public void setLikeCount(int likeCount) {
this.likeCount = likeCount;
}
public int getUnlikeCount() {
return unlikeCount;
}
public void setUnlikeCount(int unlikeCount) {
this.unlikeCount = unlikeCount;
}
}
|
package net.senmori.vanillatweaks.tasks;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
public class MinecartSpawnTask extends BukkitRunnable {
private final Location loc;
private final EntityType type;
public MinecartSpawnTask(JavaPlugin plugin, Location location, EntityType type) {
this.loc = location;
this.type = type;
this.runTaskLater(plugin, 1);
}
@Override
public void run() {
loc.getWorld().spawnEntity(loc, type);
this.cancel();
}
}
|
package com.example.ahmed.octopusmart.RecyclerAdapter;
import android.content.Context;
import android.graphics.Paint;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import com.example.ahmed.octopusmart.App.Config;
import com.example.ahmed.octopusmart.Interfaces.HomeAdapterListener;
import com.example.ahmed.octopusmart.Model.ServiceModels.ProductModel;
import com.example.ahmed.octopusmart.R;
import com.example.ahmed.octopusmart.holders.LoadingViewHolder;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class CategoryProductsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public final int item = 0 , loading = 1 ;
public List<ProductModel> data = new ArrayList<>();
LayoutInflater inflater;
Context context;
HomeAdapterListener listener;
public CategoryProductsAdapter(ArrayList<ProductModel> mobileModelList, Context context , HomeAdapterListener listener) {
inflater = LayoutInflater.from(context);
this.data = mobileModelList;
this.context = context;
this.listener = listener;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == item){
View view = inflater.inflate(R.layout.category_product_item, parent, false);
CategryProductViewHolder viewHolder = new CategryProductViewHolder(view);
return viewHolder;
}else {
View view = inflater.inflate(R.layout.item_progress , parent , false);
return new LoadingViewHolder(view) ;
}
}
@Override
public int getItemViewType(int position) {
if (position != 0 && position == getItemCount() - 1 ) return loading ; else return item ;
}
private boolean showLoader = true;
public void showLoading(boolean status) {
showLoader = status;
notifyDataSetChanged();
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, final int position) {
if (getItemViewType(position) == loading){
final LoadingViewHolder loaderViewHolder = (LoadingViewHolder) viewHolder;
if (showLoader) {
loaderViewHolder.mProgressBar.setVisibility(View.VISIBLE);
} else {
loaderViewHolder.mProgressBar.setVisibility(View.GONE);
}
return;
}else {
final CategryProductViewHolder holder = (CategryProductViewHolder) viewHolder ;
final ProductModel current = data.get(position);
Glide.with(context)
.load(Config.Image_URL + current.getImages().get(0))
.apply(new RequestOptions().fitCenter())
.apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
.transition(new DrawableTransitionOptions().crossFade())
.into(holder.mobileImg);
boolean discount = current.getDiscount() != 0L;
if(discount){
holder.priceBefore.setVisibility(View.VISIBLE);
long oldPrice = current.getPrice();
long perc = current.getDiscount();
long newPrice = (oldPrice * perc )/ 100;
newPrice = oldPrice - newPrice ;
holder.priceBefore.setText(oldPrice+" " +context.getString(R.string.le));
holder.priceBefore.setPaintFlags(holder.priceBefore.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
holder.price.setText(newPrice+" "+context.getString(R.string.le));
}else {
holder.price.setText(current.getPrice()+" "+context.getString(R.string.le));
holder.priceBefore.setVisibility(View.GONE);
}
holder.product_rate.setRating((float) current.getUserRates().getRate());
holder.saleText.setText(current.getDiscount()+"%");
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (listener!=null)
listener.onProductClicked(current , holder.mobileImg , position);
}
});
}
}
@Override
public int getItemCount() {
if (data !=null && !data.isEmpty())
return data.size()+1;
else return 0 ;
}
public void update(ArrayList<ProductModel> data) {
if (data !=null)
this.data.addAll(data);
notifyDataSetChanged();
}
public void clear() {
data = new ArrayList<>();
notifyDataSetChanged();
}
class CategryProductViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.mobile_img)
ImageView mobileImg;
@BindView(R.id.sale_text)
TextView saleText;
@BindView(R.id.price_before)
TextView priceBefore;
@BindView(R.id.mobile_name)
TextView mobileName;
@BindView(R.id.price)
TextView price;
@BindView(R.id.product_rate)
RatingBar product_rate;
public CategryProductViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this,itemView);
}
}
}
|
package 并发;
/**
* @Author: Mr.M
* @Date: 2019-04-09 10:47
* @Description:
**/
public class SynchronizedDemo {
public static void main(String[] args) {
}
public synchronized void spi() {
System.out.println(11);
}
}
|
package com.pine.template.mvvm.vm;
import com.pine.tool.architecture.mvvm.vm.ViewModel;
/**
* Created by tanghongfeng on 2019/3/1
*/
public class MvvmHomeVm extends ViewModel {
}
|
package com.graduation.yearbook.Http.HttpProvider;
import com.graduation.yearbook.application.BaseApplication;
import com.squareup.okhttp.Cache;
import com.squareup.okhttp.ConnectionPool;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.apache.OkApacheClient;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.AllowAllHostnameVerifier;
import java.io.File;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
/**
* Created by josephwang on 15/6/25.
*/
public class HttpClientHelper {
private static HttpClient httpClient;
private HttpClientHelper() {
}
public static synchronized HttpClient getHttpClient() {
if (null == httpClient) {
httpClient = createMyHttpClient();
}
return httpClient;
}
public static HttpClient createMyHttpClient() {
OkHttpClient client = getOkHttpClient();
if (client != null) {
return new OkApacheClient(client);
}
return new OkApacheClient();
}
public static OkHttpClient getOkHttpClient() {
try {
OkHttpClient client = new OkHttpClient();
ConnectionPool pool = new ConnectionPool(0, 500);
client.setConnectionPool(pool);
client.setConnectTimeout(5000, TimeUnit.MILLISECONDS);
SSLContext sc = SSLContext.getInstance("TLS");
TrustManager mTrustManager = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
sc.init(null, new TrustManager[]{mTrustManager}, new java.security.SecureRandom());
javax.net.ssl.SSLSocketFactory newFactory = sc.getSocketFactory();
client.setSslSocketFactory(newFactory);
client.setHostnameVerifier(new AllowAllHostnameVerifier());
client.setConnectTimeout(10, TimeUnit.SECONDS);
client.setReadTimeout(30, TimeUnit.SECONDS);
// 需注意Server回傳資料是否會有cache問題
File httpCacheDir = new File(BaseApplication.getContext().getCacheDir(), "http");
long httpCacheSize = 30 * 1024 * 1024; // 30 MiB
try {
client.setCache(new Cache(httpCacheDir, httpCacheSize));
} catch (IOException e) {
e.printStackTrace();
}
return client;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
e.printStackTrace();
}
return null;
}
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package vasylts.blackjack.deck.card;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
/**
*
* @author VasylcTS
*/
public class CardFactory {
private static final Set<ICard> cards;
static {
int maxPossibleCards = EnumCardSuit.values().length * EnumCardValue.values().length;
cards = new HashSet<>(maxPossibleCards);
}
/**
* Return an instance of {@code SimpleCard}
* @param suit Suit of card
* @param value card rank
* @return Instance of {@code SimpleCard}
* @see vasylts.blackjack.deck.card.SimpleCard
*/
static public ICard getCard(EnumCardSuit suit, EnumCardValue value) {
Predicate<ICard> sameCard = (ICard card) -> {
return card.getCardSuit() == suit && card.getCardValue() == value;
};
Optional<ICard> optCard = cards.stream().filter(sameCard).findFirst();
ICard card;
if (optCard.isPresent()) {
card = optCard.get();
} else {
card = new SimpleCard(suit, value);
cards.add(card);
}
return card;
}
}
|
package bootcamp.test.actions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import bootcamp.selenium.basic.LaunchBrowser;
public class RightClick {
public static void main(String[] args) {
WebDriver driver = LaunchBrowser.launch("https://demoqa.com/buttons");
WebElement element = driver.findElement(By.id("rightClickBtn"));
Actions actions = new Actions(driver);
actions.moveToElement(element).contextClick().build().perform();
}
}
|
package it.polimi.se2019.view.player;
import it.polimi.se2019.rmi.UserTimeoutException;
import it.polimi.se2019.rmi.ViewFacadeInterfaceRMIClient;
import it.polimi.se2019.rmi.ViewFacadeInterfaceRMIServer;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TransferQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
public class PlayerViewOnServer implements ViewFacadeInterfaceRMIServer {
/**
* Namespace this class logs to
*/
private static final String LOG_NAMESPACE = "PlayerViewOnServer";
/**
* Disconnection Timeout in seconds
*/
private int timeout;
/**
* Name of the player
*/
private String name;
/**
* Character of the player
*/
private String character;
/**
* Contains the last RMI reference for each getPlayer(), indexed by name
*/
private static final ConcurrentHashMap<String, ViewFacadeInterfaceRMIClient> connections =
new ConcurrentHashMap<>();
/**
* Create a new wrapper for a player on the server.
* The wrapper allows to call syncronous operation on the client with a
* timeout
*
* @param view View of the player (already initialized)
* @param timeout Disconnection Timeout in seconds
*
* @throws RemoteException If an error occurs while utilizing RMI
*/
public PlayerViewOnServer(ViewFacadeInterfaceRMIClient view, int timeout)
throws RemoteException {
this.name = view.getName();
this.character = view.getCharacter();
registerPlayer(view.getName(), view);
this.timeout = timeout;
}
/**
* Register a connection for a client. If a client is already registered, the
* connection is overwritten (only one client can be connected with the same
* nickname)
*
* @param name Name of the client
* @param client Reference to an active RMI connection for the client
*/
public static void registerPlayer(String name, ViewFacadeInterfaceRMIClient client){
connections.put(name, client);
}
/**
* @return the last registered client reference for the user this view is registered
* to.
* Null if there is no user registered for a given name
*/
private ViewFacadeInterfaceRMIClient getPlayer(){
return connections.get(this.name);
}
public String getCharacter() {
return character;
}
public String getName() {
return this.name;
}
/**
*
*/
@Override
public String chooseAction(String state) throws UserTimeoutException {
WaitFor<String, String> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseAction,
state
);
}
/**
* @return index of the power up card to discard
*/
@Override
public int chooseSpawnLocation(List<String> powerUps) throws UserTimeoutException {
WaitFor<List<String>, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseSpawnLocation,
powerUps
);
}
/**
* Choose map type for the match
*/
@Override
public int chooseMap() throws UserTimeoutException {
WaitFor<Void, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForSupp(
this.getPlayer()::chooseMap
);
}
/**
* choose how many players will be in the game
*/
@Override
public int chooseNumberOfPlayers() throws UserTimeoutException {
WaitFor<Void, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForSupp(
this.getPlayer()::chooseNumberOfPlayers
);
}
/**
* @return chosen weapon name
*/
@Override
public String chooseWeapon(List<String> weapons)
throws UserTimeoutException {
WaitFor<List<String>, String> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseWeapon,
weapons
);
}
/**
* @param possibleTargets is a list of the players who can be targeted(their names)
* @return a list of chosen targets(names)
*/
@Override
public String chooseTargets(List<String> possibleTargets)
throws UserTimeoutException {
WaitFor<List<String>, String> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseTargets,
possibleTargets
);
}
/**
* @param weapons that can be reloaded
* @return the name of the weapon to reload
*/
@Override
public String chooseWeaponToReload(List<String> weapons)
throws UserTimeoutException {
WaitFor<List<String>, String> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseWeaponToReload,
weapons
);
}
/**
* @return a list of integers indicating which cards from the player's inventory to use when reloading
*/
@Override
public List<Integer> choosePowerUpCardsForReload(List<String> powerUps)
throws UserTimeoutException {
WaitFor<List<String>, List<Integer>> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::choosePowerUpCardsForReload,
powerUps
);
}
/**
* @return the integer relative to the availableEffects list
*/
@Override
public Integer chooseIndex(List<String> availableEffects)
throws UserTimeoutException {
WaitFor<List<String>, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseIndex,
availableEffects
);
}
/**
* Send a string message to a client
*/
@Override
public void sendGenericMessage(String message) throws RemoteException{
this.getPlayer().sendGenericMessage(message);
}
/**
* @return int indicating which item to pick up from those available
*/
@Override
public int chooseItemToGrab() throws UserTimeoutException {
WaitFor<Void, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForSupp(
this.getPlayer()::chooseItemToGrab
);
}
/**
* choose whether to use a firing mode
*/
@Override
public Boolean chooseFiringMode(String description)
throws UserTimeoutException {
WaitFor<String, Boolean> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseFiringMode,
description
);
}
/**
*
*/
@Override
public Boolean chooseBoolean(String description) throws UserTimeoutException {
WaitFor<String, Boolean> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseBoolean,
description
);
}
/**
* choose a room from those proposed
*/
@Override
public String chooseRoom(List<String> rooms) throws UserTimeoutException {
WaitFor<List<String>, String> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseRoom,
rooms
);
}
/**
* @param targettableSquareCoordinates the coordinates of all targettable squares
* @return the coordinates of one chosen square
*/
@Override
public List<Integer> chooseTargetSquare(List<List<Integer>> targettableSquareCoordinates)
throws UserTimeoutException {
WaitFor<List<List<Integer>>, List<Integer>> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseTargetSquare,
targettableSquareCoordinates
);
}
/**
* @return 0 for north, 1 for east, 2 for south or 3 for west
*/
@Override
public Integer chooseDirection(List<Integer> possibleDirections)
throws UserTimeoutException {
WaitFor<List<Integer>, Integer> wf = new WaitFor<>(this.timeout);
return wf.waitForFunc(
this.getPlayer()::chooseDirection,
possibleDirections
);
}
@Override
public void sendMapInfo(List<ArrayList<ArrayList<String>>> mapInfo)
throws UserTimeoutException, RemoteException {
WaitFor<List<ArrayList<ArrayList<String>>>, Object> wf = new WaitFor<>(this.timeout);
wf.waitForFunc(
(List<ArrayList<ArrayList<String>>> i) -> {
this.getPlayer().sendMapInfo(i);
return new Object();
},
mapInfo
);
}
@Override
public void sendPlayerInfo(List<ArrayList<String>> playerInfo)
throws UserTimeoutException, RemoteException {
WaitFor<List<ArrayList<String>>, Object> wf = new WaitFor<>(this.timeout);
wf.waitForFunc(
(List<ArrayList<String>> i) -> {
this.getPlayer().sendPlayerInfo(i);
return new Object();
},
playerInfo
);
}
@Override
public void sendKillScoreBoardInfo(List<ArrayList<String>> killScoreBoardInfo)
throws UserTimeoutException, RemoteException {
WaitFor<List<ArrayList<String>>, Object> wf = new WaitFor<>(this.timeout);
wf.waitForFunc(
(List<ArrayList<String>> i) -> {
this.getPlayer().sendKillScoreBoardInfo(i);
return new Object();
},
killScoreBoardInfo
);
}
@Override
public void sendCharacterInfo(List<String> characterInfo)
throws UserTimeoutException, RemoteException {
WaitFor<List<String>, Object> wf = new WaitFor<>(this.timeout);
wf.waitForFunc(
(List<String> i) -> {
this.getPlayer().sendCharacterInfo(i);
return new Object();
},
characterInfo
);
}
/**
* Wait for a call on the remote end, throwing an exception if the user is
* disconnected, or a response can not be obtained in time
*
* @param <I> Param Type
* @param <R> Return Type
*/
private final class WaitFor<I extends Object, R extends Object> {
/**
* Timeout (in second) before UserTimeoutException is raised
*/
private int timeout;
/**
* TransferQueue for the object
*/
private TransferQueue<R> tq = new LinkedTransferQueue<>();
/**
* Create a new WaitFor
*
* @param timeout Timeout in seconds to wait for a response
*/
WaitFor(int timeout){
this.timeout = timeout;
}
/**
* Wait for the item generated by supp to become available
*
* @param func Supplier Function to wait for. The supplier function accept
* a parameter of type I (like a java.util.function.Function)
* @param i Input param for the supplier
*
* @return The generated item on success
*
* @throws UserTimeoutException If an item can not be obtained before
* TIMEOUT expiration
*/
R waitForFunc(RMIFunction<I, R> func, I i)
throws UserTimeoutException {
return this.handler(
func,
i
);
}
/**
* Wait for the item generated by supp to become available
*
* @param supp Supplier Function to wait for.
*
* @return The generated item on success
*
* @throws UserTimeoutException If an item can not be obtained before
* TIMEOUT expiration
*/
R waitForSupp(RMISupplier<R> supp)
throws UserTimeoutException {
return this.handler(
(I i) -> supp.get(),
null
);
}
/**
* Handler for the call. Makes the call on the other end, blocks till a
* response is received, but unlock if the timeout is reached
*
* @param call Function to call
* @param i Input param of the function
*
* @return The result of the call
* @throws UserTimeoutException If timeout is reached
*/
private R handler(RMIFunction<I, R> call, I i) throws UserTimeoutException {
new Thread(
() -> {
try {
if (!this.tq.offer(call.apply(i))){
Logger.getLogger(LOG_NAMESPACE).log(
Level.SEVERE,
"Unable to pass response to the TQ"
);
}
}
catch (RemoteException e){
// Ignore exception, triggers timeout
}
}
).start();
try {
R toReturn = this.tq.poll(
this.timeout,
TimeUnit.SECONDS
);
if (toReturn == null){
throw new UserTimeoutException();
}
else {
return toReturn;
}
}
catch (InterruptedException e){
Thread.currentThread().interrupt();
throw new UserTimeoutException(e);
}
}
}
@FunctionalInterface
public interface RMIFunction<I extends Object, R extends Object> {
R apply(I i) throws RemoteException;
}
@FunctionalInterface
public interface RMISupplier<R extends Object> {
R get() throws RemoteException;
}
}
|
package commandlineparser.handlers;
import commandlineparser.parser.*;
import java.util.List;
public class ExitCommandHandler implements CommandHandler {
private boolean exitRequested;
public boolean isExitRequested() {
return exitRequested;
}
public void setExitRequested(boolean exitRequested) {
this.exitRequested = exitRequested;
}
@Override
public String getKey() {
return "exit";
}
@Override
public String getDescription() {
return "Exit program";
}
@Override
public String getDetailedDescription() {
return null;
}
@Override
public List<CommandArgument> getArguments() {
return null;
}
@Override
public CommandResult ExecuteCommand(ArgumentList args) {
setExitRequested(true);
return null;
}
}
|
package com.mrcsoft.game.core;
import java.awt.*;
import java.awt.image.BufferedImage;
/**
* Created with IntelliJ IDEA.
* User: Marek
* Date: 24.02.13
* Time: 18:06
* To change this template use File | Settings | File Templates.
*/
public class Surface {
private BufferedImage image;
private Graphics destGraphics;
private Graphics2D sourceGraphics;
// private Paint clearPaint;
public Surface(int width,int height, Graphics graphics)
{
this.destGraphics =graphics;
image = new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
this.sourceGraphics = image.createGraphics();
}
public BufferedImage getImage()
{
return image;
}
public void render()
{
this.destGraphics.drawImage(image,0,0, image.getWidth(),image.getHeight(),null);
}
public void clear(Color color)
{
this.sourceGraphics.setPaint(color);
this.sourceGraphics.fillRect(0, 0, image.getWidth(), image.getHeight());
}
public void drawImage(int x, int y, Image image)
{
this.sourceGraphics.drawImage(image, x, y, Color.white, null);
}
public void drawImage(int x, int y,int width, int height, Image image)
{
this.sourceGraphics.drawImage(image,x,y,width,height,null);
}
}
|
/**
*
*/
package com.goodhealth.algorithm.NKExercise;
/**
* @author 24663
* @date 2018年8月24日
* @Description 描述 给定 n 个不同的正整数,整数 k(k <= n)以及一个目标数字 target。 在这 n 个数里面找出 k个数,
* 使得这 k 个数的和等于目标数字,求问有多少种方案? 样例 给出 [1,2,3,4],k=2, target=5,[1,4] 和
* [2,3] 是 2 个符合要求的方案,返回 2。
*/
public class K_sum {
public static void main(String[] args) {
K_sum k_sum = new K_sum();
int[] an = { 1,2,3,4 };
int k = 2;
int target = 5;
System.out.println(k_sum.getSumm(an, k, target));
}
public int getSum(int[] an, int k, int target) {
// result[i][j][k] 表示从数组前i个数中选出j个数组成和为k的组合数
int[][][] result = new int[an.length + 1][k + 1][target+1];
for (int i = 0; i < an.length + 1; i++) {
result[i][0][0] = 1;
}
for (int i = 1; i < an.length + 1; i++) {
for (int j = 1; j <= i&&j<=k; j++) {
for (int p = 1; p <= target; p++) {
result[i][j][p]=0;
if (an[i - 1] <= p) {
result[i][j][p] = result[i - 1][j - 1][p - an[i - 1]];
}
result[i][j][p]+=result[i-1][j][p];
}
}
}
return result[an.length][k][target];
}
public int getSumm(int[] an, int k, int target) {
int[][] result = new int[k + 1][target + 1];
result[0][0] = 1;
for (int a : an) {
for (int i = k; i >= 1; i--) {
for (int j = target; j >= a; j--) {
result[i][j] += result[i - 1][j - a];
}
}
}
return result[k][target];
}
}
|
package com.example.demo;
import java.lang.reflect.Array;
import java.util.Arrays;
public class Recusrion {
int[] arr = new int[100];
public static void main (String[] args){
Recusrion test = new Recusrion();
test.recursive1To10(1, 0);
System.out.println(test.count7(710265477));
System.out.println(test.starString("bruh"));
System.out.println(test.pairStar("ecce hommo"));
System.out.println(test.pairStar("hello"));
System.out.println(test.pairStar("xxyy"));
System.out.println(test.pairStar("aaaa"));
}
public void recursive1To10(int number, int index){
//This code prints the sequence from the given number to 10 without using loops
//if (n > 10) break;
arr[index] = number;
//recursive calls itself until it reaches 10
if (number < 100){
recursive1To10(number+1, index+1);
}
else System.out.println(Arrays.toString(arr));
}
public int count7(int n){
/*
if (n == 0) return 0;
if (n%10 == 7) return 1+count7(n/10);
return count7(n/10);
*/
return (n==0) ? 0:((n%10 ==7) ? 1+count7(n/10) : count7(n/10));
}
public String starString(String str){
if(str.length() <= 1) return str;
return str.charAt(0) + "*" + (starString(str.substring(1)));
}
public String pairStar(String str){
if(str.length() <= 1) return str;
return (str.charAt(0)==str.charAt(1)? (str.substring(0,1) + "*" + pairStar(str.substring(1, str.length()))) : (str.substring(0,1) + pairStar(str.substring(1, str.length()))));
}
}
|
package com.Barclay.AsynTasks;
import org.json.JSONObject;
import com.Barclay.global.GlobalApplication;
import com.Barclay.global.HttpRequest;
import com.Barclay.hackatron.LandingActivity;
import com.Barclay.hackatron.R;
import android.app.ActionBar.LayoutParams;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class AsynTransferBalance extends AsyncTask<String, Void, String> {
String mServerResponse = "";
Context mContext;
String mUserName, mUserMobileNo, mAmt;
int mDialogueBoxHeight, mDialogueBoxWidth;
private ProgressDialog mProgress;
public AsynTransferBalance(String UserName, String UserMobileNo, String Amt,Context con) {
mUserName = UserName;
mUserMobileNo = UserMobileNo;
mAmt = Amt;
mContext=con;
DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
mDialogueBoxWidth = metrics.widthPixels;
mDialogueBoxHeight = metrics.heightPixels;
}
@Override
protected void onPreExecute() {
Log.d("in", "preExecute");
mProgress = new ProgressDialog(mContext);
mProgress.setTitle(GlobalApplication.STRING_PLEASE_WAIT);
mProgress.setCancelable(false);
mProgress.setCanceledOnTouchOutside(false);
mProgress.show();
}
@Override
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
try {
mServerResponse = HttpRequest
.get(GlobalApplication.TransferBalance(),true,"Sender",mUserName,"Receiver",mUserMobileNo,"Amount",mAmt)
.body();
Log.d("responce Status::", "::" + mServerResponse.toString());
} catch (Exception e) {
e.printStackTrace();
}
return mServerResponse;
}
@Override
protected void onPostExecute(String result) {
mProgress.dismiss();
try {
Log.e("result", "::" + result);
JSONObject jobj=new JSONObject(result);
String status=jobj.getString("status");
String balance=jobj.getString("balance");
String Username=jobj.getString("name");
Log.e("status", "::"+status) ;
CustomDialog(mContext,status,balance,Username);
} catch (Exception e) {
e.printStackTrace();
}
}
private void CustomDialog(final Context con, String error,final String balance,final String Username) {
final Dialog mCustomDialog = new Dialog(con);
mCustomDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mCustomDialog.setContentView(R.layout.alert);
mCustomDialog.setCanceledOnTouchOutside(false);
Button dialogOk = (Button) mCustomDialog.findViewById(R.id.bt_Ok);
TextView message = (TextView) mCustomDialog.findViewById(R.id.txt_serverMessage);
message.setText(error);
ImageView closeDialogue = (ImageView) mCustomDialog.findViewById(R.id.img_Close);
mCustomDialog.show();
mCustomDialog.getWindow().setLayout((int) (mDialogueBoxWidth /
1.5), LayoutParams.WRAP_CONTENT);
closeDialogue.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent in=new Intent(con,LandingActivity.class);
in.putExtra("Balance", balance);
in.putExtra("UserName", Username);
con.startActivity(in);
mCustomDialog.dismiss();
}
});
dialogOk.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent in=new Intent(con,LandingActivity.class);
in.putExtra("Balance", balance);
in.putExtra("UserName", Username);
con.startActivity(in);
mCustomDialog.dismiss();
}
});
}
}
|
package com.home.web.model;
public class Alumno {
private String _id;
private long id;
private String licencia;
private String nombre;
private String apellido1;
private String apodo;
public Alumno() {
super();
// TODO Auto-generated constructor stub
}
public Alumno(String licencia, String nombre, String apellido1, String apodo) {
super();
this.licencia = licencia;
this.nombre = nombre;
this.apellido1 = apellido1;
this.apodo = apodo;
}
@Override
public String toString() {
return "Alumno [_id=" + _id + ", licencia=" + licencia + ", nombre=" + nombre + ", apellido1=" + apellido1
+ ", apodo=" + apodo + "]";
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public String getLicencia() {
return licencia;
}
public void setLicencia(String licencia) {
this.licencia = licencia;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido1() {
return apellido1;
}
public void setApellido1(String apellido1) {
this.apellido1 = apellido1;
}
public String getApodo() {
return apodo;
}
public void setApodo(String apodo) {
this.apodo = apodo;
}
}
|
/*
* (C) Copyright 2016 Richard Ballard.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.richardballard.packplanner.executionparams;
import com.github.richardballard.arbeeutils.stream.MoreCollectors;
import com.github.richardballard.packplanner.item.Item;
import com.github.richardballard.packplanner.item.ItemQuantity;
import com.github.richardballard.packplanner.item.order.SortOrder;
import com.github.richardballard.packplanner.pack.Pack;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import net.jcip.annotations.Immutable;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
@Immutable
public class ExecutionParams {
@NotNull
private final SortOrder sortOrder;
private final int maxPiecesPerPack;
@NotNull
private final BigDecimal maxWeightPerPackKg;
@NotNull
private final ImmutableList<ItemQuantity> itemQuantities;
public ExecutionParams(@NotNull final SortOrder sortOrder,
final int maxPiecesPerPack,
@NotNull final BigDecimal maxWeightPerPackKg,
@NotNull final ImmutableList<ItemQuantity> itemQuantities) {
assert sortOrder != null;
assert maxWeightPerPackKg != null;
assert itemQuantities != null;
Preconditions.checkArgument(maxPiecesPerPack > 0,
"max pieces per pack (%s) must be > 0",
maxPiecesPerPack);
// check that all of the individual items are within the max weight
final ImmutableList<BigDecimal> overweightItemWeightsKg
= itemQuantities.stream()
.map(ItemQuantity::getItem)
.map(Item::getWeightKg)
.filter(itemWeightKg -> itemWeightKg.compareTo(maxWeightPerPackKg) > 0)
.collect(MoreCollectors.toImmutableList());
Preconditions.checkArgument(overweightItemWeightsKg.isEmpty(),
"The following item weights are greater then the specified max weight (%s) -> %s",
maxWeightPerPackKg,
overweightItemWeightsKg);
this.sortOrder = sortOrder;
this.maxPiecesPerPack = maxPiecesPerPack;
this.maxWeightPerPackKg = maxWeightPerPackKg;
//noinspection AssignmentToCollectionOrArrayFieldFromParameter
this.itemQuantities = itemQuantities;
}
@NotNull
public SortOrder getSortOrder() {
return sortOrder;
}
/**
*
* @return a number > 0
*/
public int getMaxPiecesPerPack() {
return maxPiecesPerPack;
}
/**
*
* All of the item quantities returned by {@link #getItemQuantities()} will be within this value.
*/
@NotNull
public BigDecimal getMaxWeightPerPackKg() {
return maxWeightPerPackKg;
}
@NotNull
public ImmutableList<ItemQuantity> getItemQuantities() {
return itemQuantities;
}
@Override
public boolean equals(final Object o) {
if(this == o) {
return true;
}
if(o == null || getClass() != o.getClass()) {
return false;
}
final ExecutionParams that = (ExecutionParams) o;
if(maxPiecesPerPack != that.maxPiecesPerPack) {
return false;
}
if(sortOrder != that.sortOrder) {
return false;
}
if(!maxWeightPerPackKg.equals(that.maxWeightPerPackKg)) {
return false;
}
return itemQuantities.equals(that.itemQuantities);
}
@Override
public int hashCode() {
int result = sortOrder.hashCode();
result = 31 * result + maxPiecesPerPack;
result = 31 * result + maxWeightPerPackKg.hashCode();
result = 31 * result + itemQuantities.hashCode();
return result;
}
@Override
public String toString() {
return "ExecutionParams{" +
"sortOrder=" + sortOrder +
", maxPiecesPerPack=" + maxPiecesPerPack +
", maxWeightPerPackKg=" + maxWeightPerPackKg +
", itemQuantities=" + itemQuantities +
'}';
}
}
|
package me.eccentric_nz.tardissonicblaster;
import java.util.UUID;
import me.eccentric_nz.TARDIS.enumeration.COMPASS;
import me.eccentric_nz.TARDIS.utility.TARDISStaticUtils;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
public class TARDISSonicBlasterListener implements Listener {
private final TARDISSonicBlaster plugin;
public TARDISSonicBlasterListener(TARDISSonicBlaster plugin) {
this.plugin = plugin;
}
@EventHandler(priority = EventPriority.NORMAL)
public void onInteract(PlayerInteractEvent event) {
final Player player = event.getPlayer();
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (TARDISSonicBlasterUtils.checkBlasterInHand(player)) {
UUID uuid = player.getUniqueId();
if (!plugin.getIsBlasting().contains(uuid)) {
// get distance
Location target = event.getClickedBlock().getLocation();
double distance = TARDISSonicBlasterUtils.getDistanceToTargetBlock(target, player);
double angle = TARDISSonicBlasterUtils.getLineOfSightAngle(player);
COMPASS direction = COMPASS.valueOf(TARDISStaticUtils.getPlayersDirection(player, false));
new TARDISSonicBlasterAction(plugin).blast(target, direction, angle, distance, 100, uuid);
}
}
}
}
}
|
package com.pawi.writer;
import com.pawi.data.Block;
import com.pawi.data.CFClass;
import com.pawi.data.ExtractedContent;
import com.pawi.data.Result;
import com.pawi.data.TestCase;
/**
* The {@link SingleTestFormatter} formats a TestCase into a string so that it is easy to print all relevant values of one test case into a text document.
**/
public class SingleTestFormatter {
public String formatTestCase(TestCase testCase) {
StringBuilder sb = new StringBuilder();
sb.append("Test name: " + testCase.getTestName());
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append("General results:");
sb.append(System.getProperty("line.separator"));
for (Result result : testCase.getResultList()) {
sb.append(result.getKey() + " = " + result.getValue());
sb.append(System.getProperty("line.separator"));
}
for (ExtractedContent ec : testCase.getExtractionResultList()) {
sb.append(System.getProperty("line.separator"));
sb.append("Results " + ec.getExtractorName() + ":");
sb.append(System.getProperty("line.separator"));
for (Result result : ec.getSpecificResults()) {
sb.append(result.getKey() + " = " + result.getValue());
sb.append(System.getProperty("line.separator"));
}
}
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append("Content file:");
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append(testCase.getContentFile().getContent());
for (ExtractedContent ec : testCase.getExtractionResultList()) {
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append("Extractor: " + ec.getExtractorName());
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append(ec.getExtractedText());
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append("Extractor: " + ec.getExtractorName() + " Results as blocks");
sb.append(System.getProperty("line.separator"));
sb.append("---------------------------------------------------------------");
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
for (Block block : ec.getExtractedBlocks()) {
sb.append("[" + //
"link_density: " + formatFloatNo(block.getLinkDensity()) + "; " + //
"classification: " + block.getClassification() + "; " + //
"word_count: " + formatIntegerNo(block.getWordCount()) + "; " + //
"stop_Word_Count: " + formatIntegerNo(block.getStopWordCount()) + "; " + //
"text_Density: " + formatFloatNo(block.getTextDensity()) + "; " + //
"context_Free_classification: " + formatCFClassification(block.getCfClass()) + "; " + //
"]" + //
System.getProperty("line.separator") + //
block.getText() + //
System.getProperty("line.separator") + //
System.getProperty("line.separator"));
}
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
sb.append(System.getProperty("line.separator"));
}
return sb.toString();
}
private String formatCFClassification(CFClass cfClass) {
if (cfClass == null) {
return "NOT_DEFINED";
}
return cfClass.toString();
}
private String formatFloatNo(Float no) {
if (no == null) {
return "NOT_DEFINED";
}
return Float.toString(no);
}
private String formatIntegerNo(Integer no) {
if (no == null) {
return "NOT_DEFINED";
}
return Integer.toString(no);
}
}
|
package com.yida.design.model.impl;
import com.yida.design.model.HummerModel;
/**
*********************
* @author yangke
* @version 1.0
* @created 2018年4月20日 下午5:39:45
***********************
*/
public class HummerH2Model extends HummerModel {
@Override
public void start() {
System.out.println("悍马H2发动...");
}
@Override
public void stop() {
System.out.println("悍马H2停车...");
}
@Override
public void alarm() {
System.out.println("悍马H2鸣笛...");
}
@Override
public void engineBoom() {
System.out.println("悍马H2引擎声音是这样在...");
}
}
|
package cn.zhz.auntaunt.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.List;
import auntanut.zhz.cn.auntaunt.R;
import cn.zhz.auntaunt.javebean.Users;
public class Aboutme_Fragment extends Fragment {
private static final String ARG_PARAM1 = "param1";
private String mParam1;
private View view;
private String[] title={"头像","姓名","电话","我的地址","我的地址","我的擅长","我的资质"};
private String[] main={"","name","","","","",""};
private ListView lv_aboutme;
private List<Users> list;
public Aboutme_Fragment() {
}
public static Aboutme_Fragment newInstance(String param1) {
Aboutme_Fragment fragment = new Aboutme_Fragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view=inflater.inflate(R.layout.fragment_aboutme, container, false);
lv_aboutme=(ListView)view.findViewById(R.id.lv_aboutme);
MyAdapter adapter=new MyAdapter();
lv_aboutme.setAdapter(adapter);
return view;
}
class MyAdapter extends BaseAdapter{
@Override
public int getCount() {
return title.length;
}
@Override
public Object getItem(int i) {
return i;
}
@Override
public long getItemId(int i) {
return i;
}
class Wrapper{
private TextView title,main;
private View row;
public Wrapper(View row){
super();
this.row=row;
}
public TextView getTitle() {
if(title==null){
title=(TextView)row.findViewById(R.id.tv_aboutme_item_title);
}
return title;
}
public TextView getMain() {
if(main==null){
main=(TextView)row.findViewById(R.id.tv_aboutme_item_main);
}
return main;
}
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
Wrapper wrapper;
View row=view;
if(row==null){
LayoutInflater inflater=LayoutInflater.from(getActivity());
row=inflater.inflate(R.layout.fragment_aboutme_item, viewGroup,false);
wrapper=new Wrapper(row);
row.setTag(wrapper);
}else{
wrapper=(Wrapper)row.getTag();
}
TextView title1=wrapper.getTitle();
TextView main1=wrapper.getMain();
title1.setText(title[i]);
main1.setText(main[i]);
return row;
}
}
}
|
package PresentationLayer;
import DBAccess.OrderMapper;
import FunctionLayer.LoginSampleException;
import FunctionLayer.Order;
import FunctionLayer.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;
public class OrderOutJ extends Command {
@Override
String execute(HttpServletRequest request, HttpServletResponse response) throws LoginSampleException {
HttpSession session = request.getSession();
List <Order> tempOrder = new ArrayList<>();
tempOrder = OrderMapper.loadOrder();
List <Order> customerOrder = new ArrayList<>();
User user = (User) session.getAttribute("user");
for (int i = 0; i <tempOrder.size() ; i++) {
if (tempOrder.get(i).getuserID()==user.getId()){
customerOrder.add((Order) tempOrder.get(i));
}
}
session.setAttribute("orderList",customerOrder);
for (int i = 0; i <customerOrder.size() ; i++) {
System.out.println(customerOrder.get(i).toString());
}
return "showorder" + "page";
}
}
|
package com.tencent.mm.pluginsdk.ui.tools;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.provider.MediaStore.Images.Media;
import android.provider.MediaStore.Images.Thumbnails;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.platformtools.h;
import com.tencent.mm.sdk.platformtools.bi;
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class NewFileExplorerUI$a extends BaseAdapter {
private File qSg;
File[] qSh = new File[0];
final /* synthetic */ NewFileExplorerUI qTk;
private File qTl;
private boolean qTm = false;
private ArrayList<File> qTn = new ArrayList();
private class a {
File file;
String qTp;
long time;
private a() {
}
/* synthetic */ a(NewFileExplorerUI$a newFileExplorerUI$a, byte b) {
this();
}
}
public NewFileExplorerUI$a(NewFileExplorerUI newFileExplorerUI) {
this.qTk = newFileExplorerUI;
}
public final /* bridge */ /* synthetic */ Object getItem(int i) {
return this.qSh[i];
}
public final void c(File file, boolean z) {
this.qTl = file;
this.qTm = z;
}
public final void a(File file, List<String> list) {
byte b = (byte) 0;
this.qSg = file;
if (this.qSg != null && this.qSg.canRead() && this.qSg.isDirectory()) {
this.qSh = this.qSg.listFiles(new FileFilter() {
public final boolean accept(File file) {
if (file.isHidden()) {
return false;
}
if (NewFileExplorerUI$a.this.qTm && file.isDirectory()) {
return false;
}
return true;
}
});
if (this.qSh == null) {
this.qSh = new File[0];
}
if (this.qSh.length > 0) {
File[] fileArr = this.qSh;
if (fileArr != null && fileArr.length != 0) {
int i;
List arrayList = new ArrayList();
List<a> arrayList2 = new ArrayList();
for (File file2 : fileArr) {
a aVar = new a(this, (byte) 0);
aVar.file = file2;
aVar.time = file2.lastModified();
if (file2.isDirectory()) {
aVar.qTp = h.oI(file2.getName()).toUpperCase();
arrayList.add(aVar);
} else {
arrayList2.add(aVar);
}
}
Collections.sort(arrayList, new 2(this));
Collections.sort(arrayList2, new 3(this));
Iterator it = arrayList.iterator();
while (true) {
i = b;
if (!it.hasNext()) {
break;
}
fileArr[i] = ((a) it.next()).file;
b = i + 1;
}
for (a aVar2 : arrayList2) {
fileArr[i] = aVar2.file;
i++;
}
}
}
} else if (list != null) {
this.qSh = new File[list.size()];
while (true) {
byte b2 = b;
if (b2 < list.size()) {
this.qSh[b2] = new File((String) list.get(b2));
this.qTn.add(this.qSh[b2]);
b = b2 + 1;
} else {
return;
}
}
}
}
public final int boX() {
int i = 0;
Iterator it = this.qTn.iterator();
while (true) {
int i2 = i;
if (!it.hasNext()) {
return i2;
}
i = (int) (((File) it.next()).length() + ((long) i2));
}
}
public final ArrayList<String> cfs() {
ArrayList<String> arrayList = new ArrayList();
Iterator it = this.qTn.iterator();
while (it.hasNext()) {
File file = (File) it.next();
if (!(TZ(file.getName()) || au(file.getName()))) {
arrayList.add(file.getPath());
}
}
return arrayList;
}
public final ArrayList<String> cft() {
ArrayList<String> arrayList = new ArrayList();
Iterator it = this.qTn.iterator();
while (it.hasNext()) {
File file = (File) it.next();
if (TZ(file.getName())) {
arrayList.add(file.getPath());
}
}
return arrayList;
}
public final ArrayList<String> cfu() {
ArrayList<String> arrayList = new ArrayList();
Iterator it = this.qTn.iterator();
while (it.hasNext()) {
File file = (File) it.next();
if (au(file.getName())) {
arrayList.add(file.getPath());
}
}
return arrayList;
}
public final File cfv() {
if (this.qSg.hashCode() == this.qTl.hashCode()) {
return null;
}
return this.qSg.getParentFile();
}
public final int getCount() {
return this.qSh.length;
}
public final long getItemId(int i) {
return 0;
}
public final View getView(int i, View view, ViewGroup viewGroup) {
Bitmap bitmap = null;
if (view == null) {
view = View.inflate(viewGroup.getContext(), R.i.fm_file_item, null);
b bVar = new b(this, (byte) 0);
bVar.qTq = (FrameLayout) view.findViewById(R.h.item_selector_wrapper);
bVar.qTr = (CheckBox) bVar.qTq.findViewById(R.h.item_selector);
bVar.gmn = (ImageView) view.findViewById(R.h.item_icon);
bVar.eCm = (TextView) view.findViewById(R.h.item_title);
bVar.mfT = (TextView) view.findViewById(R.h.item_size);
bVar.hrs = (TextView) view.findViewById(R.h.item_time);
bVar.qTq.setOnClickListener(new 4(this));
view.setTag(bVar);
}
b bVar2 = (b) view.getTag();
File file = this.qSh[i];
bVar2.eCm.setText(file.getName());
if (file.isDirectory()) {
bVar2.gmn.setImageResource(R.k.app_attach_file_icon_folders);
bVar2.qTq.setVisibility(4);
bVar2.mfT.setVisibility(0);
bVar2.hrs.setVisibility(8);
String[] list = file.list(new FilenameFilter() {
public final boolean accept(File file, String str) {
if (str.startsWith(".")) {
return false;
}
return true;
}
});
int length = list != null ? list.length : 0;
bVar2.mfT.setText(this.qTk.getString(R.l.file_explorer_dir_subfile_size, new Object[]{Integer.valueOf(length)}));
} else {
bVar2.qTq.setVisibility(0);
bVar2.mfT.setVisibility(0);
bVar2.hrs.setVisibility(0);
bVar2.mfT.setText(bi.bF(file.length()));
bVar2.hrs.setText(com.tencent.mm.pluginsdk.f.h.c(this.qTk, file.lastModified(), true));
if (TZ(file.getName())) {
String path = file.getPath();
Cursor query = this.qTk.getContentResolver().query(Media.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "_data=?", new String[]{path}, null);
if (query != null) {
if (query.moveToFirst()) {
int i2 = query.getInt(query.getColumnIndex("_id"));
query.close();
bitmap = Thumbnails.getThumbnail(this.qTk.getContentResolver(), (long) i2, 3, null);
} else {
query.close();
}
}
if (bitmap != null) {
bVar2.gmn.setImageBitmap(bitmap);
} else {
bVar2.gmn.setImageResource(TY(file.getName()));
}
} else {
bVar2.gmn.setImageResource(TY(file.getName()));
}
}
bVar2.qTr.setChecked(this.qTn.contains(file));
bVar2.qTq.setTag(Integer.valueOf(i));
return view;
}
private static int TY(String str) {
Object obj = null;
String toLowerCase = str.toLowerCase();
String toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
Object obj2 = (toLowerCase2.endsWith(".doc") || toLowerCase2.endsWith(".docx") || toLowerCase2.endsWith("wps")) ? 1 : null;
if (obj2 != null) {
return R.k.app_attach_file_icon_word;
}
if (TZ(toLowerCase)) {
return R.g.app_attach_file_icon_pic;
}
toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
if (toLowerCase2.endsWith(".rar") || toLowerCase2.endsWith(".zip") || toLowerCase2.endsWith(".7z") || toLowerCase2.endsWith("tar") || toLowerCase2.endsWith(".iso")) {
obj2 = 1;
} else {
obj2 = null;
}
if (obj2 != null) {
return R.k.app_attach_file_icon_rar;
}
toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
if (toLowerCase2.endsWith(".txt") || toLowerCase2.endsWith(".rtf")) {
obj2 = 1;
} else {
obj2 = null;
}
if (obj2 != null) {
return R.k.app_attach_file_icon_txt;
}
if (bi.oV(toLowerCase).toLowerCase().endsWith(".pdf")) {
return R.k.app_attach_file_icon_pdf;
}
toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
if (toLowerCase2.endsWith(".ppt") || toLowerCase2.endsWith(".pptx")) {
obj2 = 1;
} else {
obj2 = null;
}
if (obj2 != null) {
return R.k.app_attach_file_icon_ppt;
}
toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
if (toLowerCase2.endsWith(".xls") || toLowerCase2.endsWith(".xlsx")) {
obj2 = 1;
} else {
obj2 = null;
}
if (obj2 != null) {
return R.k.app_attach_file_icon_excel;
}
toLowerCase2 = bi.oV(toLowerCase).toLowerCase();
if (toLowerCase2.endsWith(".mp3") || toLowerCase2.endsWith(".wma")) {
obj = 1;
}
if (obj != null) {
return R.k.app_attach_file_icon_music;
}
if (au(toLowerCase)) {
return R.k.app_attach_file_icon_video;
}
if (bi.oV(toLowerCase).toLowerCase().endsWith(".html")) {
return R.k.app_attach_file_icon_webpage;
}
if (bi.oV(toLowerCase).toLowerCase().endsWith(".key")) {
return R.k.app_attach_file_icon_keynote;
}
if (bi.oV(toLowerCase).toLowerCase().endsWith(".number")) {
return R.k.app_attach_file_icon_number;
}
if (bi.oV(toLowerCase).toLowerCase().endsWith(".pages")) {
return R.k.app_attach_file_icon_page;
}
return R.k.app_attach_file_icon_unknow;
}
private static boolean TZ(String str) {
String toLowerCase = bi.oV(str).toLowerCase();
return toLowerCase.endsWith(".bmp") || toLowerCase.endsWith(".png") || toLowerCase.endsWith(".jpg") || toLowerCase.endsWith(".jpeg") || toLowerCase.endsWith(".gif");
}
static boolean au(String str) {
String toLowerCase = bi.oV(str).toLowerCase();
return toLowerCase.endsWith(".mp4") || toLowerCase.endsWith(".rm");
}
}
|
package com.codemine.talk2me;
public class ChattingInfo {
protected int otherLinearLayout;
protected int ownLinearLayout;
protected int otherHeadPortraitId;
protected int ownHeadPortraitId;
protected String otherDialogMsg;
protected String ownDialogMsg;
protected MsgType msgType;
protected String time;
public ChattingInfo(int ownHeadPortraitId, String ownDialogMsg, MsgType msgType, String time) {
this.otherLinearLayout = R.id.other_layout;
this.ownLinearLayout = R.id.own_layout;
this.ownHeadPortraitId = ownHeadPortraitId;
this.ownDialogMsg = ownDialogMsg;
this.msgType = msgType;
this.time = time;
}
public ChattingInfo(int otherLinearLayout, int ownLinearLayout, int otherHeadPortraitId,
int ownHeadPortraitId, String otherDialogMsg, String ownDialogMsg, MsgType msgType, String time) {
this.otherLinearLayout = otherLinearLayout;
this.ownLinearLayout = ownLinearLayout;
this.otherHeadPortraitId = otherHeadPortraitId;
this.ownHeadPortraitId = ownHeadPortraitId;
this.otherDialogMsg = otherDialogMsg;
this.ownDialogMsg = ownDialogMsg;
this.msgType = msgType;
this.time = time;
}
}
enum MsgType {
OTHER,
OWN
} |
package com.nbu.projects.dentistappointmentsys.controllers.models;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.sql.Timestamp;
import java.util.Date;
public class EventInfoModel {
private Long id;
private String title;
private String firstName;
private String lastName;
private String city;
private String info;
@Temporal(TemporalType.TIMESTAMP)
private Timestamp startTime;
@Temporal(TemporalType.TIMESTAMP)
private Timestamp endTime;
public EventInfoModel() { }
public EventInfoModel(Long id, String title, String firstName, String lastName, String city, String info, Date startTime, Date endTime) {
this.id = id;
this.title = title;
this.firstName = firstName;
this.lastName = lastName;
this.city = city;
this.info = info;
this.startTime = new Timestamp(startTime.getTime());
this.endTime = new Timestamp(endTime.getTime());
}
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 String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public Timestamp getStartTime() {
return startTime;
}
public void setStartTime(Timestamp startTime) {
this.startTime = new Timestamp(startTime.getTime());
}
public Timestamp getEndTime() {
return endTime;
}
public void setEndTime(Timestamp endTime) { this.endTime = new Timestamp(endTime.getTime()); }
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE All rights reserved.
*
* This software is the confidential and proprietary information of SAP Hybris ("Confidential Information"). You shall
* not disclose such Confidential Information and shall use it only in accordance with the terms of the license
* agreement you entered into with SAP Hybris.
*
* package com.cnk.travelogix.supplier.settlementterms.core.interceptors;
*
* import de.hybris.platform.servicelayer.interceptor.InterceptorContext; import
* de.hybris.platform.servicelayer.interceptor.InterceptorException; import
* de.hybris.platform.servicelayer.interceptor.PrepareInterceptor;
*
* import com.cnk.travelogix.supplier.settlementterms.core.services.impl.SettlementTermIdService; import
* com.cnk.travelogix.supplier.settlementterms.model.AbstractSupplierSettlementModel;
*
*
*/
package com.cnk.travelogix.supplier.settlementterms.core.interceptors;
import de.hybris.platform.servicelayer.interceptor.InterceptorContext;
import de.hybris.platform.servicelayer.interceptor.InterceptorException;
import de.hybris.platform.servicelayer.interceptor.PrepareInterceptor;
import de.hybris.platform.servicelayer.keygenerator.KeyGenerator;
import com.cnk.travelogix.supplier.settlementterms.model.SupplierSettlementModel;
public class SupplierSettlementPrepareInterceptor implements PrepareInterceptor
{
private KeyGenerator keyGenerator;
// this method will generate unique settlement term id
@Override
public void onPrepare(final Object model, final InterceptorContext ctx) throws InterceptorException
{
if (ctx.isNew(model))
{
final SupplierSettlementModel supplierSettlementModel = (SupplierSettlementModel) model;
supplierSettlementModel.setCode(keyGenerator.generate().toString());
}
else if (null != ctx.getDirtyAttributes(model).get("code"))
{
ctx.getDirtyAttributes(model).get("code").clear();
}
}
public KeyGenerator getKeyGenerator()
{
return keyGenerator;
}
public void setKeyGenerator(final KeyGenerator keyGenerator)
{
this.keyGenerator = keyGenerator;
}
}
|
package com.acme.orderserver.queue.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FinalizeOrderCommand extends Command {
@JsonProperty("paymentId")
private Long paymentId;
@JsonProperty("orderId")
private Long orderId;
}
|
package com.example.demo.controller;
import com.example.demo.model.pojo.ProductImage;
import com.example.demo.model.repository.ProductImageRepository;
import com.example.demo.utility.exceptions.TechnoMarketException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
@RestController
public class ImageController extends BaseController{
@Autowired
private ProductImageRepository productImageRepository;
public String getPath(){
String path = "/Users/theddy/Desktop/"; //"C:" + File.separator + "Users" + File.separator +
// "Prod" + File.separator + "Desktop" + File.separator + "images" + File.separator;
///Users/theddy/Desktop
return path;
}
//Beta version - User avatar(image)
// @PostMapping("/user/images")
// public void uploadUserImage(@RequestParam MultipartFile img, HttpSession ses) throws IOException, TechnoMarketException {
//
// validateLogin(ses);
// User user = (User) ses.getAttribute("userLogged");
// System.out.println(user);
// byte[] bytes = img.getBytes();
// String name = getPath() + user.getUserId() + System.currentTimeMillis()+".png";
// File newImage = new File(name);
// FileOutputStream fos = new FileOutputStream(newImage);
// fos.write(bytes);
// fos.close();
// user.setImageUrl(name);
// userRepository.saveAndFlush(user);
// }
//Adds an image to DB and creates image to absolute path, returns image ID
@RequestMapping(value = "/products/images", method = RequestMethod.POST)
public void uploadProductImage(@RequestParam MultipartFile img, HttpServletResponse response, HttpSession ses) throws IOException, TechnoMarketException {
validateAdminLogin(ses);
byte[] bytes = img.getBytes();
ProductImage p = new ProductImage();
String name = getPath() + System.currentTimeMillis()+ ".png";
p.setImageName(name);
File newImage = new File(name);
FileOutputStream fos = new FileOutputStream(newImage);
fos.write(bytes);
fos.close();
productImageRepository.save(p);
response.getWriter().append("The uploaded image has Id: " + p.getProductImageId());
}
//Shows image
@GetMapping(value="/images/{name}", produces = "image/png")
public byte[] downloadImage(@PathVariable("name") String imageName) throws IOException {
File newImage = new File(getPath() + imageName);
byte[] bytesArray = new byte[(int) newImage.length()];
FileInputStream fis = new FileInputStream(newImage);
fis.read(bytesArray); //read file into bytes[]
fis.close();
return bytesArray;
}
//Shows image by productId
@GetMapping(value = "/product/{productId}/image", produces = "image/png")
public byte[] showImageByProductId(@PathVariable("productId") long productId) throws Exception {
String productImageName = productImageRepository.getImageNameByProductId(productId);
File newImage = new File(productImageName);
byte[] bytesArray = new byte[(int) newImage.length()];
FileInputStream fis = new FileInputStream(newImage);
fis.read(bytesArray); //read file into bytes[]
fis.close();
return bytesArray;
}
}
|
package com.qimou.sb.web.entity;
import java.io.Serializable;
public class Role implements Serializable{
private static final long serialVersionUID = 1L;
private int roleID = 0 ;//角色ID
private String roleName = null ;//角色名称
private String bak = null ;//备注说明
public int getRoleID() {
return roleID;
}
public void setRoleID(int roleID) {
this.roleID = roleID;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getBak() {
return bak;
}
public void setBak(String bak) {
this.bak = bak;
}
}
|
package 并发.多线程求和;
/**
* @Author: Mr.M
* @Date: 2019-05-14 09:44
* @Description:
**/
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class ThreadAddFuture {
public static List<Future> futureList = new ArrayList<Future>();
public static void main(String[] args) throws InterruptedException, ExecutionException {
int sum = 0;
ThreadAddFuture add = new ThreadAddFuture();
ExecutorService pool = Executors.newFixedThreadPool(4);
for (int i = 1; i <= 76; ) {
ThreadTest thread = add.new ThreadTest(i, i + 24);
Future<Integer> future = pool.submit(thread);
futureList.add(future);
i += 25;
}
if (futureList != null && futureList.size() > 0) {
for (Future<Integer> future : futureList) {
sum += (Integer) future.get();
}
}
System.out.println("total result: " + sum);
pool.shutdown();
}
class ThreadTest implements Callable<Integer> {
private int begin;
private int end;
public int sum = 0;
public ThreadTest(int begin, int end) {
this.begin = begin;
this.end = end;
}
@Override
public Integer call() throws Exception {
for (int i = begin; i <= end; i++) {
sum += i;
}
System.out.println("from " + Thread.currentThread().getName() + " sum=" + sum);
return sum;
}
}
}
|
package figures.quadrilaterals;
public class Quadrilateral{}
class ConvexQuadrilateral extends Quadrilateral{}
class Trapezoid extends ConvexQuadrilateral{}
class Parallelogram extends Trapezoid{}
class Rectangle extends Parallelogram{}
class Rhombus extends Parallelogram{}
class Square extends Rhombus{} |
package app.integro.sjbhs;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import java.util.ArrayList;
import app.integro.sjbhs.adapters.PhotosAdapter3;
import app.integro.sjbhs.apis.ApiClients;
import app.integro.sjbhs.apis.ApiServices;
import app.integro.sjbhs.models.Sjbhs_Photos2;
import app.integro.sjbhs.models.Sjbhs_Photos2List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class PhotosActivity3 extends AppCompatActivity {
private ArrayList<Sjbhs_Photos2> photos2ArrayList;
private PhotosAdapter3 adapter;
private ViewPager vpGallery;
private String photos_id;
private int position;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photos3);
Sjbhs_Photos2 sjbhs_photos2 = (Sjbhs_Photos2) getIntent().getSerializableExtra("data");
position = (int) getIntent().getSerializableExtra("position");
photos_id = sjbhs_photos2.getP_id();
photos2ArrayList = new ArrayList<>();
vpGallery = findViewById(R.id.vpGallery);
getFullImage();
}
public void getFullImage() {
String date = photos_id;
Call<Sjbhs_Photos2List> photos2ListCall = ApiClients.getClient().create(ApiServices.class).getSjbhs_photos1List(date);
photos2ListCall.enqueue(new Callback<Sjbhs_Photos2List>() {
@Override
public void onResponse(Call<Sjbhs_Photos2List> call, Response<Sjbhs_Photos2List> response) {
if (response.isSuccessful()) {
if (response.body().getSjbhsPhotos1ArrayList() != null) {
int size = response.body().getSjbhsPhotos1ArrayList().size();
Log.d("RESPONSE", "Gallery Size " + size);
for (int i = 0; i < size; i++) {
photos2ArrayList.add(response.body().getSjbhsPhotos1ArrayList().get(i));
adapter = new PhotosAdapter3(getApplicationContext(), photos2ArrayList);
vpGallery.setAdapter(adapter);
vpGallery.setCurrentItem(Integer.parseInt(String.valueOf(position)));
}
} else {
Toast.makeText(getApplicationContext(), "Response Null", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getApplicationContext(), "Response Fail", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onFailure(Call<Sjbhs_Photos2List> call, Throwable t) {
Toast.makeText(getApplicationContext(), "" + t.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
} |
package ru.mindbroker.lesson01;
import ru.mindbroker.common.Tester;
public class Main {
public static void main(String[] args) {
System.out.println("String length test start.");
Tester tester = new Tester(new StringLengthTask(), "Lesson01/0.String/");
tester.runTest();
System.out.println("String length test ends.");
System.out.println("Lucky tickets test start.");
tester = new Tester(new LuckyTicketTask(), "Lesson01/1.Tickets/");
tester.runTest();
System.out.println("Lucky tickets test ends.");
}
}
|
package Automation_QA_New.pageobjectsfactory;
import Automation_QA_New.paramcontainers.GeneralProperties;
import Automation_QA_New.webdriver.driverexts.WebDriverExt;
import org.apache.log4j.Logger;
/**
* Created by aneutov on 2/3/2017.
*/
public class PageObjectTemplate
{
protected WebDriverExt driver;
protected static Logger log = GeneralProperties.getInstance().log;
}
|
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.*;
public class Restaurant {
final Lock lockvwto = new ReentrantLock(true);
final Lock lockotc = new ReentrantLock(true);
final Lock lockotb = new ReentrantLock(true);
final Lock lockod = new ReentrantLock(true);
final Condition visitorsWantToOrder = lockvwto.newCondition();
final Condition ordersToCook = lockotc.newCondition();
final Condition ordersToBring = lockotb.newCondition();
final Condition ordersDelivered = lockod.newCondition();
// переменные для работы с Condition
int numberOfVisitorsWantToOrder;
int numberOfOrdersToCook;
int numberOfOrdersToBring;
int numberOfOrdersDelivered;
// переменные для подсчета посетителей по ролям
int totalNumberOfOrdersAccepted;
int totalNumberOfOrdersDelivered;
int totalNumberOfOrdersToBring;
AtomicInteger totalNumberOfVisitors = new AtomicInteger(0);
final int VISITORSTIMETOCHOOSE = 5000;
final int COOKSTIMETODO = 7000;
final int VISITORSTIMETOEAT = 3000;
final int LIMIT = 5;
public void waiterToDo() {
System.out.printf("%s на работе\n", Thread.currentThread().getName());
while (totalNumberOfOrdersDelivered < LIMIT) {
try {
lockvwto.lock();
if (totalNumberOfOrdersAccepted >= LIMIT) {
System.out.printf("%s закончил работать\n", Thread.currentThread().getName());
return;
}
while (numberOfVisitorsWantToOrder == 0) {
System.out.println(Thread.currentThread().getName() + " totalNumberOfVisitorsWantToOrder " + totalNumberOfOrdersAccepted);
System.out.println(Thread.currentThread().getName() + " totalNumberOfOrdersDelivered " + totalNumberOfOrdersDelivered);
System.out.println(Thread.currentThread().getName() + " ждет заказов посетителей");
visitorsWantToOrder.await();
}
System.out.printf("%s принял заказ\n", Thread.currentThread().getName());
numberOfVisitorsWantToOrder -= 1;
totalNumberOfOrdersAccepted += 1;
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lockvwto.unlock();
}
try {
lockotc.lock();
numberOfOrdersToCook += 1;
ordersToCook.signal();
} finally {
lockotc.unlock();
}
try {
lockotb.lock();
while (numberOfOrdersToBring == 0) {
ordersToBring.await();
}
System.out.printf("%s принес заказ\n", Thread.currentThread().getName());
numberOfOrdersToBring -= 1;
} catch (
InterruptedException e) {
e.printStackTrace();
} finally {
lockotb.unlock();
}
try {
lockod.lock();
numberOfOrdersDelivered += 1;
totalNumberOfOrdersDelivered += 1;
ordersDelivered.signal();
} finally {
lockod.unlock();
}
}
System.out.printf("%s закончил работать\n", Thread.currentThread().getName());
}
public void cookToDo() {
System.out.printf("%s на работе\n", Thread.currentThread().getName());
while (totalNumberOfOrdersToBring < 5) {
try {
lockotc.lock();
while (numberOfOrdersToCook == 0) {
ordersToCook.await();
}
System.out.printf("%s готовит заказ\n", Thread.currentThread().getName());
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lockotc.unlock();
}
try {
Thread.sleep(COOKSTIMETODO);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
lockotc.lock();
System.out.printf("%s приготовил заказ\n", Thread.currentThread().getName());
numberOfOrdersToCook -= 1;
} finally {
lockotc.unlock();
}
try {
lockotb.lock();
numberOfOrdersToBring += 1;
totalNumberOfOrdersToBring += 1;
ordersToBring.signal();
} finally {
lockotb.unlock();
}
}
System.out.printf("%s закончил работать\n", Thread.currentThread().getName());
}
public void visitorToDo() {
totalNumberOfVisitors.getAndIncrement();
if (totalNumberOfVisitors.get() > LIMIT) {
System.out.printf("%s, ресторан закрыт\n", Thread.currentThread().getName());
return;
} else {
System.out.printf("%s зашел в ресторан\n", Thread.currentThread().getName());
}
try {
Thread.sleep(VISITORSTIMETOCHOOSE);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
lockvwto.lock();
numberOfVisitorsWantToOrder += 1;
System.out.printf("%s хочет сделать заказ\n", Thread.currentThread().getName());
visitorsWantToOrder.signal();
} finally {
lockvwto.unlock();
}
try {
lockod.lock();
while (numberOfOrdersDelivered == 0) {
ordersDelivered.await();
}
numberOfOrdersDelivered -= 1;
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lockod.unlock();
}
System.out.printf("%s приступил к еде\n", Thread.currentThread().getName());
try {
Thread.sleep(VISITORSTIMETOEAT);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.printf("%s вышел из ресторана\n", Thread.currentThread().getName());
}
}
|
package net.Ganesh.shoppingbackend.dao;
import java.util.List;
import net.Ganesh.shoppingbackend.dto.Product;
public interface IProductDAO {
//Basic crud operations
Product get(int id);
List<Product> list();
boolean add(Product product);
boolean update(Product product);
boolean delete(Product product);
//List of active Products
List<Product> listActiveProduct();
//List of active product based on category
List<Product> listActiveProductBasedOnCategory(int categoryID);
//Latest Few active products
List<Product> listLatestActiveProduct(int count);
}
|
package com.example.dao;
import com.example.model.Book;
import java.util.List;
public interface BookDaoImpl {
List<Book> getAllBook();
Book findBookById(int id);
void addNewBook(Book book);
void updateBookById(Book book);
void updateQuantityBookById(int quantity, int idBook);
void deleteBookById(int id);
List searchNameBook(String name);
List searchAuthorBook(String name);
}
|
package it.usi.xframe.xas.bfimpl.sms.providers.vodafonepop;
public class PopAccount {
private String user = null;
private String password = null;
private String protocol = null;
public String getUser() {
return user;
}
public void setUser(String val) {
user = val;
}
public String getPassword() {
return password;
}
public void setPassword(String val) {
password = val;
}
public String getProtocl() {
return protocol;
}
public void setProtocol(String val) {
protocol = val;
}
}
|
package it.unica.pr2.autostrada;
import java.util.*;
public class Berlina extends Mezzo implements Auto{
String colore;
String targa;
public Berlina(String colore, String targa){
super(colore, targa);
this.colore = colore;
this.targa = targa;
}
public String targa(){
return this.targa;
}
}
|
package com.module.auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
@Configuration
@EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true)
public class SecurityConfiguration extends GlobalMethodSecurityConfiguration {
@Autowired
private AuthenticationProvider authenticationProvider;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider);
}
}
|
package com.fillikenesucn.petcare.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.fillikenesucn.petcare.R;
import com.fillikenesucn.petcare.activities.EventListFragmentActivity;
import com.fillikenesucn.petcare.adapters.DataHelper;
import com.fillikenesucn.petcare.models.Acontecimiento;
import java.util.ArrayList;
/**
* Esta clase define objetos adapters que seran utilizados para los recyclerview del llistado de los acontecimientos de una mascota
* Permitiendo gestionar un adapter para el controlar las funcionalidades del los items pertenecientes al listado
* Tales como su eliminación del listado de mascotas
* @author: Marcelo Lazo Chavez
* @version: 03/04/2020
*/
public class AcontecimientoListAdapter extends RecyclerView.Adapter<AcontecimientoListAdapter.AcontecimientoHolder>{
//VARIABLES
private Context mContext;
private ArrayList<Acontecimiento> mAcontecimientoList = new ArrayList<>();
/**
* Constructor para el adaptador del listado de acontecimientos de una mascota asociadas al recyclerview
* @param mContext contexto asociado a la vista que llama al constructor
* @param mAcontecimientoList listado de acontecimientos de una mascota (tipo objeto ACONTECIMIENTO)
*/
public AcontecimientoListAdapter(Context mContext, ArrayList<Acontecimiento> mAcontecimientoList) {
this.mContext = mContext;
this.mAcontecimientoList = mAcontecimientoList;
}
/**
* Método que se ejecuta para crear los holders del adaptador
* Creará las instancias del layout asociadas a los items xml que tendra los componentes de los eventos de una mascota
* @param viewGroup Es el componente al cual se le asociara los items del adapter
* @param i Indice asociado a la posición del acontecimiento en el listado
* @return Retorna un objeto AcontecimientoHolder que tiene asociado los ocmponentes del item de la lista de acontecimientos
*/
@NonNull
@Override
public AcontecimientoHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_eventlistitem, viewGroup, false);
AcontecimientoHolder acontecimientoHolder = new AcontecimientoHolder(view);
return acontecimientoHolder;
}
/**
* Método que setea a un item del listado sus valores correspondientes/asociados a un acontecimiento que se encuentra
* en el listado de acontecimientos. Además se vincula con el dialog que pedira confirmación para eliminar un acontecimiento
* @param acontecimientoHolder Objeto que tiene asociado los componentes del item del listado del adapter
* @param i indice asociado al acontecimiento del listado de acontecimiento
*/
@Override
public void onBindViewHolder(@NonNull AcontecimientoHolder acontecimientoHolder, final int i) {
final Acontecimiento acontecimiento = mAcontecimientoList.get(i);
acontecimientoHolder.txtTitulo.setText(acontecimiento.getTitulo());
acontecimientoHolder.txtDescripcion.setText(acontecimiento.getDescripcion());
acontecimientoHolder.txtFecha.setText(acontecimiento.getFecha());
acontecimientoHolder.imgColor.setBackground(DataHelper.GetRandomColor());
acontecimientoHolder.btnDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ConfirmDialog(i);
}
});
}
/**
* Método que se encarga de desplegar un dialog de confirmación para la eliminación de un acontecimiento especifico
* @param i indice asociado al acontecimiento que se desea eliminar
*/
private void ConfirmDialog(final int i){
AlertDialog.Builder builder = DataHelper.CreateAlertDialog(mContext,"Confirmación","¿Está seguro que desea eliminar este acontecimiento?");
builder.setPositiveButton("Confirmar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
((EventListFragmentActivity)mContext).DeleteAcontecimiento(i);
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do nothing
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
/**
* Método que retona el tamaño de asconteciminetos asociados al listado del adapter
* @return retorna la cantidad de acontecimientos
*/
@Override
public int getItemCount() {
return mAcontecimientoList.size();
}
/**
* Clase que retornar un objeto que tendra asociado los elementos pertenecientes a los item del listado de acontecimientos
* del layout al cual estará asociado el adapter del recyclerview
*/
public class AcontecimientoHolder extends RecyclerView.ViewHolder{
// VARIABLES
TextView txtTitulo;
TextView txtFecha;
TextView txtDescripcion;
ImageView imgColor;
Button btnDelete;
/**
* Constructor para el holder del item del listado de acontecimientos del layout
* @param itemView Es el layout perteneciente al item del listado de Acontecimientos, tendra los componentes que se
* desean asociar a la vista del listado de acontecimientos de una mascota
*/
public AcontecimientoHolder(@NonNull View itemView) {
super(itemView);
imgColor = (ImageView) itemView.findViewById(R.id.imgCOLOR);
txtTitulo = (TextView) itemView.findViewById(R.id.txtTitulo);
txtFecha = (TextView) itemView.findViewById(R.id.txtFecha);
txtDescripcion = (TextView) itemView.findViewById(R.id.txtDescripcion);
btnDelete = (Button) itemView.findViewById(R.id.btnDelete);
}
}
}
|
package com.top.demo.configuration;
import com.top.demo.component.LoginHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* web应用基本配置
* * @description:
* * @author: Tonghuan
* * @create: 2019/3/19
**/
@Configuration
public class WebConfig implements WebMvcConfigurer{
@Autowired
private LoginHandlerInterceptor loginHandlerInterceptor;
/**
* 静态资源配置
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("").addResourceLocations("");
}
/**
* 跨域处理
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
.allowedHeaders("*")
.allowedOrigins("http://localhost:9000")
.allowedMethods("GET", "POST", "PUT", "DELETE, PATCH");
}
/**
* 拦截器配置
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(loginHandlerInterceptor).
addPathPatterns("/**").
excludePathPatterns("/static/**");
}
}
|
public interface TextFormat {
public String getContent();
}
|
package ec.edu.uce.vista;
import android.content.Intent;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.basic.DateConverter;
import com.thoughtworks.xstream.io.xml.DomDriver;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.GregorianCalendar;
import java.util.List;
import ec.edu.uce.modelo.Usuario;
import ec.edu.uce.modelo.Vehiculo;
public class Login extends AppCompatActivity {
private EditText usuario;
private EditText clave;
public static List<Usuario> usuarios;
public static List<Vehiculo> vehiculos;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
//Button btnRegistrarLogin = (Button) findViewById(R.id.registrarLoginButton);
//btnRegistrarLogin.setOnClickListener(new View.OnClickListener() {
//public void onClick(View v) {
//Intent regitsrarLogin = new Intent(Login.this, RegistrarUsuario.class);
//startActivity(regitsrarLogin);
//}
//});
//////@Override
//public void onClick(View v) {
// Intent iniciarSesion = new Intent(Login.this, ListaVehiculos.class);
// startActivity(iniciarSesion);
// }
//});
usuarios = new ArrayList();
vehiculos = new ArrayList();
usuario = (EditText) findViewById(R.id.usuarioLoginText);
clave = (EditText) findViewById(R.id.claveLoginText);
}
public void ingresar(View view) {
for (Object o : leerArchivoUsuario("/archivos/", "miarchivo")) {
Usuario u = (Usuario) o;
usuarios.add(u);
}
for (Object o : leerArchivoVehiculo("/archivos/", "miarchivo1")) {
Vehiculo v = (Vehiculo) o;
vehiculos.add(v);
}
if (vehiculos.isEmpty()) {
cargar();
}
String usuario = this.usuario.getText().toString();
String clave = this.clave.getText().toString();
Intent siguiente;
for (Usuario u : usuarios) {
if (usuario.trim().equalsIgnoreCase(u.getUsuario()) && clave.trim().equalsIgnoreCase(u.getClave())) {
siguiente = new Intent(this, ListaVehiculos.class);
startActivity(siguiente);
finish();
//Toast.makeText(this, "Usuario correcto", Toast.LENGTH_SHORT).show();
}
}
//Toast.makeText(this, "Datos incorrectos o usuario invalido debe REGISTRASE", Toast.LENGTH_SHORT).show();
}
public void registro(View view) {
Intent siguiente;
siguiente = new Intent(this, RegistrarUsuario.class);
startActivity(siguiente);
finish();
}
public List<Object> leerArchivoVehiculo(String carpeta, String nombre) {
XStream xs = new XStream(new DomDriver());
final String[] PATRONES = new String[]{"dd-MMM-yyyy",
"dd-MMM-yy",
"yyyy-MMM-dd",
"yyyy-MM-dd",
"yyyy-dd-MM",
"yyyy/MM/dd",
"yyyy.MM.dd",
"MM-dd-yy",
"dd-MM-yyyy"};
DateConverter dateConverter = new DateConverter("dd/MM/yyyy", PATRONES);//pone todas las fecha que encuentre en un solo formato
xs.registerConverter(dateConverter);
xs.alias("vehiculos", List.class);//pone autos enbes de list en el xml
xs.alias("vehiculo", Vehiculo.class);//pone sola auto enbes de pones todo el paquete
List<Object> objects = new ArrayList();
Object object;
File localFile = new File((Environment.getExternalStorageDirectory() + carpeta));
if (!localFile.exists()) {
localFile.mkdir();
}
File file = new File(localFile, nombre + ".txt");
StringBuilder sb = new StringBuilder();
try {
String texto = "";
BufferedReader br = new BufferedReader(new FileReader(file));
while ((texto = br.readLine()) != null) {
sb.append(texto);
}
objects.addAll((List<Vehiculo>) xs.fromXML(sb.toString()));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
return objects;
}
public List<Object> leerArchivoUsuario(String carpeta, String nombre) {
List<Object> objects = new ArrayList();
Object object;
File localFile = new File((Environment.getExternalStorageDirectory() + carpeta));
if (!localFile.exists()) {
localFile.mkdir();
}
File file = new File(localFile, nombre + ".bin");
try {
FileInputStream fis;
fis = new FileInputStream(file);
ObjectInputStream ois = new ObjectInputStream(fis);
while (fis.available() > 0) {
object = ois.readObject();
objects.add(object);
}
ois.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return objects;
}
public static void cargar() {
Vehiculo vehiculo = new Vehiculo();
vehiculo.setMarca("Audi");
vehiculo.setPlaca("XTR-9784");
vehiculo.setColor("Negro");
vehiculo.setCosto(79990.0);
vehiculo.setMatriculado(true);
vehiculo.setFechaFabricacion(new GregorianCalendar(2015, 11, 13).getTime());
vehiculos.add(vehiculo);
vehiculo = new Vehiculo();
vehiculo.setMarca("Honda");
vehiculo.setPlaca("CCD-0789");
vehiculo.setColor("Blanco");
vehiculo.setCosto(15340.0);
vehiculo.setMatriculado(false);
vehiculo.setFechaFabricacion(new GregorianCalendar(1998, 03, 05).getTime());
vehiculos.add(vehiculo);
}
public static void persistir() throws IOException {
File file;
File localFile = new File(Environment.getExternalStorageDirectory() + "/archivos/");
file = new File(localFile, "miarchivo1.txt");
file.delete();
XStream xs = new XStream(new DomDriver());
final String[] PATRONES = new String[]{"dd-MMM-yyyy",
"dd-MMM-yy",
"yyyy-MMM-dd",
"yyyy-MM-dd",
"yyyy-dd-MM",
"yyyy/MM/dd",
"yyyy.MM.dd",
"MM-dd-yy",
"dd-MM-yyyy"};
DateConverter dateConverter = new DateConverter("dd/MM/yyyy", PATRONES);//pone todas las fecha que encuentre en un solo formato
xs.registerConverter(dateConverter);
xs.alias("vehiculos", List.class);//pone autos enbes de list en el xml
xs.alias("vehiculo", Vehiculo.class);//pone sola auto enbes de pones todo el paquete
String xml = xs.toXML(vehiculos);
FileWriter escribir = new FileWriter(file, true);
escribir.write("");
escribir.write(xml);
escribir.close();
}
public static List<Vehiculo> getVehiculos() {
return vehiculos;
}
public static void setVehiculos(List<Vehiculo> vehiculos) {
Login.vehiculos = vehiculos;
}
}
|
package com.fhbean.springboot.mongodb.reposistory;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.fhbean.springboot.mongodb.entity.ResourceComment;
public interface ResourceCommentRepository extends MongoRepository<ResourceComment, String> {
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nlp_1;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author msankith
*/
public class Viterbi implements Runnable{
StringBuilder bigOut = new StringBuilder();
int perThread = 1;
boolean suffix=true, rule=true, goodTuring=false;
public static void main(String[] args) throws IOException, ClassNotFoundException {
training t = new training("dummycorpus");
BufferedWriter out = new BufferedWriter(new FileWriter("/home/sanjeevmk/NetBeansProjects/PosTagger/src/nlp_1/output/output2_stemmed.txt"));
FileInputStream fin = new FileInputStream("/home/sanjeevmk/NetBeansProjects/PosTagger/src/nlp_1/input/training.ser");
ObjectInputStream ois = new ObjectInputStream(fin);
System.out.println("Reading training objects");
t = (training) ois.readObject();
System.out.println("Read all objects");
ois.close();
Viterbi algo= new Viterbi("/home/sanjeevmk/NetBeansProjects/PosTagger/src/nlp_1/input/test2.txt", t,out);
System.out.println("calling parse file");
algo.parseFile();
}
@Override
public void run() {
int index;
try {
for(index=0; index<threadSet.size(); index++){
String[] words = threadSet.get(index).split(" ");
Viterbi_Algorithm2(words);
}
pos_output.put(id, bigOut.toString());
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} catch (IOException ex) {
Logger.getLogger(Viterbi.class.getName()).log(Level.SEVERE, null, ex);
}
}
class tree {
String tag;
ArrayList<tree> children;
tree parent;
double probability;
public tree(String tag,tree parent,double prob)
{
this.tag=new String(tag);
this.parent=parent;
children= new ArrayList<tree>();
probability=prob;
}
public tree(String tag,tree parent)
{
this.tag=new String(tag);
this.parent=parent;
children= new ArrayList<tree>();
probability=0.0;
}
}
String fileName;
static HashMap<String,Integer> TagSet,WordSet,wordCount;
static HashMap<String,Double> TransistionMatrix,EmissionMatrix, s1m,s2m,s3m,s4m;
BufferedWriter output;
static HashMap<Integer,String> pos_output= new HashMap<Integer,String>();
int id;
ArrayList<String> threadSet = new ArrayList<String>();
ArrayList<ArrayList<String>> setOfSets = new ArrayList<ArrayList<String>>();
public Viterbi(String File,training t,BufferedWriter out)
{
fileName=File;
TagSet = t.TagSet;
WordSet=t.wordSet;
wordCount = t.wordCount;
TransistionMatrix = t.TransistionProbabilty;
EmissionMatrix= t.wordProbability;
s1m = t.s1t;
s2m = t.s2t;
s3m = t.s3t;
s4m = t.s4t;
output = out;
}
public Viterbi(int ID,ArrayList<String> lines) {
this.id=ID;
this.threadSet = lines;
}
public double getEmissionProb(String w, String pt, boolean known){
double initProb = 1;
if(!known){
if(rule){
String letter = w.substring(0,1);
boolean isUpperCase = !letter.equals(letter.toLowerCase());
if(isUpperCase){
if(pt.equalsIgnoreCase("NP") || pt.equalsIgnoreCase("NP$") || pt.equalsIgnoreCase("NPS") || pt.equalsIgnoreCase("NPS$") )
initProb *= 0.25;
}
}
if(suffix){
String suff1=null, suff2=null, suff3=null, suff4=null;
if(w.length()>=1){
suff1 = w.substring(w.length()-1);
}
if(w.length()>=2){
suff2 = w.substring(w.length()-2);
}
if(w.length()>=3){
suff3 = w.substring(w.length()-3);
}
if(w.length()>=4){
suff4 = w.substring(w.length()-4);
}
Iterator tagIt = TagSet.entrySet().iterator();
String tag = null, maxtag=null;
double max = 0,p;
while(tagIt.hasNext()){
Map.Entry pair = (Map.Entry)tagIt.next();
tag = (String)pair.getKey();
p = s4m.containsKey(suff4+"_"+tag)?(double)s4m.get(suff4+"_"+tag):0.0;
if(p>max){
max = p;
maxtag = tag;
}
}
if(max>0){
if(maxtag.equalsIgnoreCase(pt))
return 1.0*initProb;
else
return 0.0;
}else{
tagIt = TagSet.entrySet().iterator();
tag = null; maxtag=null;
max = 0; p=0;
while(tagIt.hasNext()){
Map.Entry pair = (Map.Entry)tagIt.next();
tag = (String)pair.getKey();
p = s3m.containsKey(suff3+"_"+tag)?(double)s3m.get(suff3+"_"+tag):0.0;
if(p>max){
max = p;
maxtag = tag;
}
}
if(max>0){
if(maxtag.equalsIgnoreCase(pt))
return 1.0*initProb;
else
return 0.0;
}else{
tagIt = TagSet.entrySet().iterator();
tag = null; maxtag=null;
max = 0; p=0;
while(tagIt.hasNext()){
Map.Entry pair = (Map.Entry)tagIt.next();
tag = (String)pair.getKey();
p = s2m.containsKey(suff2+"_"+tag)?(double)s2m.get(suff2+"_"+tag):0.0;
if(p>max){
max = p;
maxtag = tag;
}
}
if(max>0){
if(maxtag.equalsIgnoreCase(pt))
return 1.0*initProb;
else
return 0.0;
}else{
tagIt = TagSet.entrySet().iterator();
tag = null; maxtag=null;
max = 0; p=0;
while(tagIt.hasNext()){
Map.Entry pair = (Map.Entry)tagIt.next();
tag = (String)pair.getKey();
p = s2m.containsKey(suff2+"_"+tag)?(double)s2m.get(suff2+"_"+tag):0.0;
if(p>max){
max = p;
maxtag = tag;
}
}
if(max>0){
if(maxtag.equalsIgnoreCase(pt))
return 1.0*initProb;
else
return 0.0;
}else{
return 1.0*initProb;
}
}
}
}
}else{
return (double) 0.00000001;
}
}
String key = w+"_"+pt;
if(EmissionMatrix.containsKey(key)){
return (double) EmissionMatrix.get(key);
}
return (double) 0.00000001;
}
public double getTransitionProb(String parentTag, String tagName){
String key = parentTag+"_"+tagName;
if(TransistionMatrix.containsKey(key)){
return (double)TransistionMatrix.get(key);
}
return 0.00000001;
}
void parseFile() throws IOException
{
try {
List<String> lines = new ArrayList<String>();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));
String line=null;
System.out.println("Reading test lines");
while((line=br.readLine())!=null)
{
lines.add(line);
//String Words[]= line.split(" ");
//Viterbi_Algorithm2(Words);
}
System.out.println("Read all lines");
} catch (FileNotFoundException ex) {
Logger.getLogger(Viterbi.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Viterbi.class.getName()).log(Level.SEVERE, null, ex);
}
int i=0;
int setC = 0;
System.out.println("total sentences in file "+ lines.size());
ExecutorService threadPool = Executors.newFixedThreadPool(lines.size()/perThread);
for(String l : lines){
if(threadSet.size() < perThread){
threadSet.add(l);
}else{
ArrayList<String> tmpCopy = new ArrayList<String>();
tmpCopy.addAll(threadSet);
threadPool.execute(new Thread(new Viterbi(i,tmpCopy)));
i++;
//System.out.println(threadSet);
//setOfSets.add(tmpCopy);
threadSet.clear();
threadSet.add(l);
}
}
ArrayList<String> tmpCopy = new ArrayList<String>();
tmpCopy.addAll(threadSet);
threadPool.execute(new Thread(new Viterbi(i,tmpCopy)));
threadPool.shutdown();
// then wait for it to complete
threadPool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
System.out.println("completed");
//System.out.println(setOfSets);
System.out.println(i+" "+pos_output.size());
Map<Integer,String> allOutputs = new TreeMap<Integer,String>(pos_output);
Iterator outIterate = allOutputs.entrySet().iterator();
while(outIterate.hasNext())
{
Map.Entry me = (Map.Entry)outIterate.next();
//System.out.println(me.getValue());
output.write((String)me.getValue());
}
output.close();
} catch (InterruptedException ex) {
Logger.getLogger(Viterbi.class.getName()).log(Level.SEVERE, null, ex);
}
}
void Viterbi_Algorithm2(String[] Words) throws IOException
{
tree root=new tree(".",null,1.0);
tree present=root;
String prev= ".";
HashMap<String,Double> tagProb = new HashMap<String,Double>();
HashMap<String,tree> levelTree = new HashMap<String,tree>();
Iterator it = TagSet.entrySet().iterator();
double prevProb=1;
// System.out.println("word "+".");
while(it.hasNext())
{
Map.Entry tagPair = (Map.Entry)it.next();
String tagName = (String)tagPair.getKey();
double currentProb=getTransitionProb(prev,tagName);
double tempProb=tagProb.containsKey(tagName)?(double)tagProb.get(tagName):(double)0;
if(currentProb>tempProb)
{
tree tempTree=new tree(tagName,present,currentProb);
present.children.add(tempTree);
levelTree.put(tagName, tempTree);
tagProb.put(tagName, currentProb);
// System.out.print(" "+tagName+" -> "+currentProb);
}
}
HashMap<String,tree> level2Tree= levelTree;
for(int i=0;i<Words.length;i++){
levelTree=level2Tree;
//level2Tree.clear();
level2Tree= new HashMap<String,tree>();
tagProb = new HashMap<String,Double>();
String word = Words[i];
Iterator levelIterator= levelTree.entrySet().iterator();
boolean knownWord = WordSet.containsKey(Words[i]);
// System.out.println("");
// System.out.println("Word "+word);
if(knownWord==false)
{
//System.out.println(Words[i]+ " Unknown Word ");
}
while(levelIterator.hasNext())
{
Map.Entry parentTree = (Map.Entry) levelIterator.next();
String parentTag= (String)parentTree.getKey();
tree parentNode = (tree) parentTree.getValue();
double parentProb = parentNode.probability;
double emissionProb = getEmissionProb(word,parentTag,knownWord);
Iterator tagIterator = TagSet.entrySet().iterator();
//tagProb.clear();//to clear prev prob
while(tagIterator.hasNext())
{
Map.Entry tagPair = (Map.Entry) tagIterator.next();
String tagName = (String) tagPair.getKey();
double presentProb = tagProb.containsKey(tagName)?tagProb.get(tagName):(double)0;
double transmissionProb = getTransitionProb(parentTag,tagName);
double probability = parentProb * emissionProb * transmissionProb * 1000;
// System.out.println(word+" --- "+parentTag+"_"+tagName+" -> "+emissionProb+" "+transmissionProb);
if(probability>presentProb)
{
level2Tree.put(tagName,new tree(tagName,parentNode,probability));
tagProb.put(tagName,probability);
// System.out.print(" "+tagName+" "+probability);
}
}
}
}
Iterator tagItr = tagProb.entrySet().iterator();
String maxTag = null;
double maxProb= 0.0;
while(tagItr.hasNext())
{
Map.Entry tagPair = (Map.Entry)tagItr.next();
double curProb = (double)tagPair.getValue();
// System.out.print(" "+(String)tagPair.getKey()+" ->"+curProb);
if(curProb>maxProb)
{
maxProb=(double)tagPair.getValue();
maxTag = (String)tagPair.getKey();
}
}
tree node = level2Tree.get(maxTag);
Stack<String> tags = new Stack<String>();
//ArrayList<String> tags = new ArrayList<String>();
while(node!=null)
{
// System.out.println("tag --- "+ node.tag);
//tags.add(node.tag);
tags.push(node.tag);
node=node.parent;
}
// System.out.println("--------------------");
if(tags.isEmpty()==true)
{
System.out.println("Something went wrong while POS tagging . Probability is tending to 0");
for(int i=0;i<Words.length;i++)
{
System.out.print(Words[i]+" ");
output.write(Words[i]+" ");
}
System.out.println("");
}else {
tags.pop();
StringBuilder out= new StringBuilder() ;
for(int i=0;i<Words.length;i++)
{
//out.append(Words[i]+"_"+tags.pop()+" ");
bigOut.append(Words[i]+"_"+tags.pop()+" ");
// String out=Words[i]+"_"+tags.pop()+" ";
// System.out.print(out);
//output.write(out);
}
// System.out.println(id);
//pos_output.put(this.id,out.toString());
}
}
void printTrans()
{
System.out.println("printing transisiton ");
Iterator it = TransistionMatrix.entrySet().iterator();
while(it.hasNext())
{
Map.Entry rowPair = (Map.Entry)it.next();
String tagName=(String)rowPair.getKey();
// System.out.println(tagName+" "+rowPair.getValue());
}
}
double foffW(double n, String tag){
double fof = 0;
if(!goodTuring){
return 0;
}
Iterator wordIterator = WordSet.entrySet().iterator();
while(wordIterator.hasNext()){
Map.Entry pair = (Map.Entry) wordIterator.next();
String word = (String)pair.getKey();
if(wordCount.get(word+"_"+tag) == n){
fof++;
}
}
return fof;
}
} |
package com.yeahbunny.stranger.server.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.HeaderHttpSessionStrategy;
import org.springframework.session.web.http.SessionRepositoryFilter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class AuthConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.requestMatcher(new AntPathRequestMatcher("/**"))
.authorizeRequests()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.antMatchers("/v2/api-docs").permitAll()
.antMatchers("/swagger**").permitAll()
.antMatchers("/webjars/**").permitAll()
.antMatchers("/swagger-resources/configuration/ui").permitAll()
.antMatchers("/user/session/**").permitAll()
.antMatchers("/register").permitAll()
.antMatchers("/user/myEvents").hasAuthority(AppRoles.USER)
.antMatchers("/photo/*").permitAll()
.anyRequest().hasAuthority(AppRoles.USER)
.and()
.exceptionHandling()
.authenticationEntryPoint(getNotAuthorizedEntryPoint())
.and()
.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication();
}
/**
* Create Spring-session filter that replaces HttpSession with Spring implementation. Entry point for spring session
* @return
*/
@Bean
SessionRepositoryFilter filter() {
SessionRepositoryFilter filter = new SessionRepositoryFilter(sessionRepo());
filter.setHttpSessionStrategy(sessionStrategy());
return filter;
}
@Bean
SessionRepository sessionRepo() {
return new MapSessionRepository();
}
@Bean
public HeaderHttpSessionStrategy sessionStrategy() {
return new HeaderHttpSessionStrategy();
}
private static AuthenticationEntryPoint getNotAuthorizedEntryPoint() {
return new CustomHttp403ForbiddenEntryPoint();
}
}
|
package com.wzy.service;
import org.springframework.beans.factory.FactoryBean;
/**
* @ClassName ExampleFactoryBean
* @Desc TODO
* @Author Administrator
* @Date 2019/6/28 14:12
**/
public class ExampleFactoryBean implements FactoryBean<Example3> {
public ExampleFactoryBean() {
System.out.println("ExampleFactoryBean init");
}
@Override
public Example3 getObject() throws Exception {
return new Example3();
}
@Override
public Class<?> getObjectType() {
return null;
}
@Override
public boolean isSingleton() {
return true;
}
}
|
package it.usi.xframe.xas.bfintf;
/**
* Local interface for Enterprise Bean: XasSecurity
*/
public interface XasSecurityLocal
extends
it.usi.xframe.xas.bfintf.IXasSecurityServiceFacade,
javax.ejb.EJBLocalObject {
}
|
/**
* Copyright (c) 2016, 指端科技.
*/
package com.rofour.baseball.dao.manager.mapper;
import java.util.List;
import java.util.Map;
import javax.inject.Named;
import com.rofour.baseball.controller.model.manager.SysNoticeInfo;
import com.rofour.baseball.dao.manager.bean.SysNoticeBean;
/**
* @ClassName: SysNoticeMapper
* @Description: 系统通知操作接口
* @author xzy
* @date 2016年3月27日 上午11:58:20
*
*/
@Named("sysNoticeMapper")
public interface SysNoticeMapper {
/**
*
* @Description:批量删除
* @param id
* @return 删除的数量
*/
int deleteBatch(SysNoticeInfo sysNotice);
/**
*
* @Description: 增加
* @param record
* @return int
*/
int insert(SysNoticeBean record);
/**
*
* @Description: 批量增加
* @param list
* @return
*/
int insertBatch(List<SysNoticeBean> list);
/**
*
* @Description: 根据主键查找
* @param sysNoticeId
* @return SysNoticeBean
*/
SysNoticeBean selectByPrimaryKey(Long sysNoticeId);
/**
*
* @Description: 根据主键更新
* @param record
* @return 更新的数量
*/
int updateByPrimaryKeyWithBLOBs(SysNoticeBean record);
/**
*
* @Description:根据主键更新
* @param record
* @return 更新的数量
*/
int updateByPrimaryKey(SysNoticeInfo record);
/**
*
* @Description: 查询所有
* @return List<SysNoticeBean>
*/
List<SysNoticeInfo> selectAll(SysNoticeInfo sysNoticeInfo);
/**
*
* @Description: 查询条数
* @return List<SysNoticeBean>
*/
Integer getSysNoticeTotal(SysNoticeInfo record);
/**
*
* @Description: 审核
* @param map
*/
void auditUpdate(Map<String, Object> map);
} |
package test_funzionali;
import static org.junit.Assert.*;
import java.util.Calendar;
import org.junit.Before;
import org.junit.Test;
import sistema.*;
public class SS4AggiungereUnCinemaPerUnGestoreCinema {
ApplicazioneAmministratoreSistema adminApp;
Calendar adminBirthday;
Calendar managerBirthday;
@Before
public void setUp() throws Exception {
adminBirthday = Calendar.getInstance();
adminBirthday.set(1975, 2, 5);
managerBirthday = Calendar.getInstance();
managerBirthday.set(1980, 0, 1);
adminApp = new ApplicazioneAmministratoreSistema("Anna",
"Bianchi", "BNCNNA75C45D969Q", adminBirthday, "AnnaBianchi", "0000",
"anna.bianchi@gmail.com");
adminApp.login("AnnaBianchi", "0000");
adminApp.resetApplication();
// Registrazione di un nuovo gestore
adminApp.registraNuovoGestoreCinema("Luca", "Rossi", "RSSLCU80A01D969P",
managerBirthday, "luca.rossi@gmail.com");
// Questo Scenario Secondario viene chiamato in seguito all'esecuzione
// dello use case UC13
// Scenario alternativo 6a di UC13:
// 2. L'Applicazione Amministratore Sistema chiede all'Amministratore Sistema
// lo username del Gestore Cinema
// 3. L'Amministratore Sistema inserisce i dati richiesti
// 4. L'Applicazione Amministratore Sistema valida i dati inseriti
assertNotNull(ApplicazioneAmministratoreSistema.getRegisteredGestoreCinema("RSSLCU80A01D969P"));
// 6a: L'Amministratore Sistema comunica di voler aggiungere un cinema alla
// lista del Gestore Cinema
}
// Scenario Secondario: Aggiungere un cinema per un Gestore Cinema
@Test
public void SS4test1() {
// 1. L'Applicazione Amministratore Sistema chiede di inserire il
// nome e l’indirizzo del cinema
// 2. L'Amministratore Sistema inserisce i dati richiesti
// 3. L’Applicazione Amministratore Sistema valida i dati inseriti
// (Non implementato; ad esempio verificare che l'indirizzo esista.
// Questa validazione è lasciata ad una futura implementazione)
// 5. L’Amministratore Sistema conferma di voler procedere con l’inserimento
// 6. L'Applicazione Amministratore Sistema inserisce il nuovo cinema
Cinema cinema = new Cinema("Odeon", "Corso Buenos Aires, 83, 16129 Genova");
assertTrue(adminApp.addNewCinema("RSSLCU80A01D969P", cinema));
}
// Scenario alternativo 2a: L'Amministratore Sistema decide di annullare l'operazione
@Test
public void SS4test2() {
// 1. L'Applicazione Amministratore Sistema chiede di inserire il
// nome e l’indirizzo del cinema
// 2a. Il Gestore Cinema decide di annullare l'operazione
return;
}
// Scenario alternativo 3a: L'Applicazione Amministratore Sistema non valida
// i dati inseriti
@Test
public void SS4test3() {
// 1. L'Applicazione Amministratore Sistema chiede di inserire il
// nome e l’indirizzo del cinema
// 2. L'Amministratore Sistema inserisce i dati richiesti
// 3a. L'Applicazione Amministratore Sistema non valida i dati inseriti
// (valore non valido per l'indirizzo. Questa validazione è lasciata ad una futura
// implementazione)
// Andare al passo 1 dello scenario secondario
}
// Scenario alternativo 5a: L'Amministratore Sistema non conferma l'operazione
@Test
public void SS4test4() {
// 1. L'Applicazione Amministratore Sistema chiede di inserire il
// nome e l’indirizzo del cinema
// 2. L'Amministratore Sistema inserisce i dati richiesti
// 3. L’Applicazione Amministratore Sistema valida i dati inseriti
// (Non implementato; ad esempio verificare che l'indirizzo esista.
// Questa validazione è lasciata ad una futura implementazione)
// 5a. L'Amministratore Sistema non conferma l'operazione
return;
}
// Scenario alternativo 6a: L’Applicazione Amministratore Sistema non riesce ad inserire
// il nuovo cinema perché esiste già un cinema con lo stesso nome e indirizzo
@Test
public void SS4test5() {
// Add a cinema in order to execute this test correctly
Cinema cinema = new Cinema("Odeon", "Corso Buenos Aires, 83, 16129 Genova");
adminApp.addNewCinema("RSSLCU80A01D969P", cinema);
// 1. L'Applicazione Amministratore Sistema chiede di inserire il
// nome e l’indirizzo del cinema
// 2. L'Amministratore Sistema inserisce i dati richiesti
// 3. L’Applicazione Amministratore Sistema valida i dati inseriti
// (Non implementato; ad esempio verificare che l'indirizzo esista.
// Questa validazione è lasciata ad una futura implementazione)
// 5. L’Amministratore Sistema conferma di voler procedere con l’inserimento
// 6. L'Applicazione Amministratore Sistema non inserisce il nuovo cinema
assertFalse(adminApp.addNewCinema("RSSLCU80A01D969P", cinema));
// Andare al passo 1 dello scenario secondario
}
}
|
package Game;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;
import static Game.Model.*;
public class ReadScore
{
static public void readScores()
{
Scores.clear();
Scanner s = null;
try
{
s = new Scanner(new File("src/Game/scores.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try
{
while(s.hasNext())
{
String line = s.nextLine();
String[] scores = line.split(",");
Scores.addAll(Arrays.asList(scores));
}
Scores.sort((a, b) ->
{
if(a.length() > b.length())
{
return -1;
}
else if(a.length() == b.length())
{
return b.compareTo(a);
}
else
{
return 1;
}
});
} catch (Exception e)
{
System.out.println(e + "error during reading scores");
}
}
}
|
package Lists;
import java.util.ArrayList;
import java.util.List;
public class MyArrayList {
public static void main(String[] args) {
List<String> fruits = new ArrayList<>();
fruits.add("apple");
fruits.add("mango");
System.out.println(fruits);
ArrayList<Integer> marks = new ArrayList<>();
marks.add(45);
//this is called the generics .....generics is used to give miltiple type support to and pair and
//used to specifies the type of a list
Pair<String, Integer> p1 = new Pair<>("saransh", 50);
Pair<Boolean,String> p2 = new Pair<>(true,"hello");
p1.getDescription();
p2.getDescription();
}
}
|
package angel.v.devil;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.lang.Runnable;
import java.lang.Thread;
import java.net.ServerSocket;
import java.net.Socket;
public class CustomServerSocket {
public ServerSocket server;
private int port = 7777;
public String data;
Thread t;
public void printdata(String s) {
String news = data + s;
data = news;
}
public void shutdown() {
t.stop();
}
public CustomServerSocket(Talker myTalker) {
data = new String("");
try {
server = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
ConnectionHandler handler = new ConnectionHandler(this,myTalker);
t = new Thread(handler);
t.start();
}
}
class ConnectionHandler implements Runnable {
private Socket socket;
private CustomServerSocket parent;
Talker talker;
public void handleConnection() {
}
public ConnectionHandler(CustomServerSocket parent,Talker talk) {
this.parent = parent;
talker=talk;
talker.ois=null;
talker.oos=null;
}
public void run() {
parent.printdata("Waiting for client message...\n");
while (true) {
try {
socket = parent.server.accept();
talker.connected=true;
talker.ois = new ObjectInputStream(socket.getInputStream());
talker.oos = new ObjectOutputStream(socket.getOutputStream());
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
|
package com.example;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class DataLoaderStub implements DataLoader {
public List<Group> loadGroups() {
List<Group> groups = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
groups.add(new Group(1, "Group A", "", sdf.parse("2000-01-01"), 0, 0));
groups.add(new Group(15, "Group B", "", sdf.parse("1996-01-01"), 0, 0));
groups.add(new Group(20, "Group C", "", sdf.parse("2003-01-01"), 0, 0));
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
return groups;
}
public List<Function> loadFunctions(Group group) {
String groupName = group.getName();
List<Function> functions = new ArrayList<>();
if (groupName.endsWith("A")) {
functions.add(new Function(1, "cos(a)", "", new Date(), null));
functions.add(new Function(2, "sin(a)", "", new Date(), null));
} else if (groupName.endsWith("B")) {
functions.add(new Function(3, "pow(x, y) = x^y", "", new Date(), null));
functions.add(new Function(4, "f(x, y) = x/y", "", new Date(), null));
} else {
}
return functions;
}
public List<Parameter> loadParameters(Function function) {
int functionId = function.getId();
List<Parameter> parameters = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
if (functionId == 1) {
parameters.add(new Parameter(1, "a", "", sdf.parse("2000-01-01")));
} else if (functionId == 2) {
parameters.add(new Parameter(4, "a", "", sdf.parse("1996-01-01")));
} else if (functionId == 3) {
parameters.add(new Parameter(9, "x", "", sdf.parse("2003-01-01")));
parameters.add(new Parameter(10, "y", "", sdf.parse("2003-01-02")));
}
} catch (ParseException ex) {
throw new RuntimeException(ex);
}
return parameters;
}
}
|
// Sun Certified Java Programmer
// Chapter 2, P129
// Object Orientation
public interface Chewable extends Sweetable {
}
|
package org.caps.spring.bean.factory.support;
import org.caps.spring.bean.BeanDefinition;
import org.caps.spring.bean.factory.BeanCreationException;
import org.caps.spring.bean.factory.BeanDefinitionStoreException;
import org.caps.spring.bean.factory.BeanFactory;
/**
* @author Caps.Xia
*/
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.springframework.util.ClassUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class DefaultBeanFactory implements BeanFactory {
public static final String ID_ATTRIBUTE="id";
public static final String CLASS_ATTRIBUTE="class";
private final Map<String, BeanDefinition> beanDefinitionMap = new ConcurrentHashMap<String, BeanDefinition>();
public DefaultBeanFactory(String confileFile) {
loadBeanDefinition(confileFile);
}
private void loadBeanDefinition(String confileFile) {
InputStream is=null;
try {
ClassLoader loader = ClassUtils.getDefaultClassLoader();
is = loader.getResourceAsStream(confileFile);
SAXReader reader=new SAXReader();
Document document = reader.read(is);
Element rootElement = document.getRootElement();
Iterator<Element> iterator = rootElement.elementIterator();
while (iterator.hasNext()){
Element element = iterator.next();
String id = element.attributeValue(ID_ATTRIBUTE);
String beanClassName= element.attributeValue(CLASS_ATTRIBUTE);
GenericBeanDefinition beanDefinition = new GenericBeanDefinition(id, beanClassName);
this.beanDefinitionMap.put(id,beanDefinition);
}
} catch (DocumentException e) {
throw new BeanDefinitionStoreException("create bean for",null);
}finally {
if(is!=null){
try{
is.close();
}catch (IOException e){
e.printStackTrace();
}
}
}
}
@Override
public BeanDefinition getBeanDefinition(String beanID) {
return this.beanDefinitionMap.get(beanID);
}
@Override
public Object getBean(String beanID) {
BeanDefinition bd=this.getBeanDefinition(beanID);
if(bd==null){
throw new BeanCreationException("Bean Definition does not exist");
}
ClassLoader c1 = ClassUtils.getDefaultClassLoader();
String beanClassName = bd.getBeanClassName();
try{
Class<?> aClass = c1.loadClass(beanClassName);
return aClass.newInstance();
} catch (Exception e) {
throw new BeanCreationException("create bean for"+beanClassName+"");
}
}
} |
package com.test;
import java.util.List;
public class ListEx {
private List<String> list;
public ListEx() { }
public void printList() {
for(String p : list) {
System.out.println("게임명 : " + p);
}
}
public List<String> getList() {
return list;
}
public void setList(List<String> list) {
this.list = list;
}
}
|
package com.sparknetworks.loveos.integration;
import com.sparknetworks.loveos.application.filtermatches.UserMatchedDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.util.List;
import java.util.Objects;
import static org.assertj.core.api.Assertions.assertThat;
/**
* In the current stage the application is reading the matches from a JSON file, in that moment
* it was not necessary to introduce a database, the data used on that test is read from files
* located into test/java/resources/integration-test/[matches and profiles]
*/
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
class FilterMatchesIntegrationTest {
@LocalServerPort
private int localPort;
@Autowired
private TestRestTemplate restTemplate;
private String host;
@BeforeEach
void initialise() {
this.host = "http://localhost:" + localPort;
}
@Test
void should_list_all_matches_from_repository_when_no_filter() {
ResponseEntity<List<UserMatchedDTO>> response = restCall(HttpMethod.GET, "/api/v1/matches/tonyxpto23");
assertThat(response.getBody()).hasSize(25);
}
@Test
void should_return_just_the_match_with_compatibility_score_0_99_when_filtering_by_it_and_should_bring_all_its_values_filled_in_result() {
URI url = UriComponentsBuilder
.fromHttpUrl(host + "/api/v1/matches/tonyxpto23")
.queryParam("compatibilityScoreRangeFrom", 0.99)
.queryParam("compatibilityScoreRangeTo", 0.99)
.build().toUri();
ResponseEntity<List<UserMatchedDTO>> response = restCall(HttpMethod.GET, url.toString());
assertThat(response.getBody()).hasSize(1);
UserMatchedDTO katherine = getOnlyUserMatched(response);
assertThat(katherine.getDisplayName()).isEqualTo("Katherine");
assertThat(katherine.getAge()).isEqualTo(39);
assertThat(katherine.getJobTitle()).isEqualTo("Lawyer");
assertThat(katherine.getHeightInCm()).isEqualTo(177);
assertThat(katherine.getCity().getName()).isEqualTo("London");
assertThat(katherine.getCity().getLat()).isEqualTo(51.509865);
assertThat(katherine.getCity().getLon()).isEqualTo(-0.118092);
assertThat(katherine.getMainPhoto()).isEqualTo("http://thecatapi.com/api/images/get?format=src&type=gif");
assertThat(katherine.getCompatibilityScore()).isEqualTo(0.99);
assertThat(katherine.getContactsExchanged()).isEqualTo(50);
assertThat(katherine.isFavourite()).isEqualTo(true);
assertThat(katherine.getReligion()).isEqualTo("Atheist");
}
private UserMatchedDTO getOnlyUserMatched(ResponseEntity<List<UserMatchedDTO>> response) {
return response.getBody().get(0);
}
private ResponseEntity<List<UserMatchedDTO>> restCall(HttpMethod httpMethod, String url) {
return restTemplate.exchange(url, httpMethod, null, new ParameterizedTypeReference<List<UserMatchedDTO>>() {});
}
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package calc;
import java.awt.Component;
import java.awt.GridLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JRadioButtonMenuItem;
import manag.*;
import math.Expression;
/**
* Creates a standard GUI calculator
* @author fabio
*/
public abstract class AbstractStdCalc extends CalcFrame {
protected final JButton[] numbers;
protected final JButton[] operators;
protected final JButton[] deletingOp;
protected final JMenuBar menuBar;
protected JMenu menuFile;
protected JMenuItem[] menuFileItems;
/**
* Constructs graphically a standard calculator
* @param name
*/
public AbstractStdCalc(String name) {
super(name);
/* Creazione della barra dei menu, dei vari menu e degli elementi di ogni menu */
menuBar = new JMenuBar();
this.setJMenuBar(menuBar);
menuFile = new JMenu("File");
menuBar.add(menuFile);
menuFileItems = new JMenuItem[]{
new JRadioButtonMenuItem("Decimal Calculator"), new JRadioButtonMenuItem("Binary Calculator"),
new JRadioButtonMenuItem("Hexadecimal Calculator"), new JRadioButtonMenuItem("Conversions Calculator"),
new JMenuItem("Exit..")
};
ButtonGroup group = new ButtonGroup();
for(JMenuItem item : menuFileItems){
group.add(item);
item.addActionListener(new MenuManagement(this));
menuFile.add(item);
}
//layout per le calcolatrici standard semplici
center.setLayout(new GridLayout(5,5));
/*Creazione dei pulsanti numerici e aggiunta delle gestioni evento */
numbers = new JButton[] {
new JButton("0"), new JButton("1"), new JButton("2"),
new JButton("3"), new JButton("4"), new JButton("5"),
new JButton("6"), new JButton("7"), new JButton("8"),
new JButton("9"), new JButton(".")
};
for(JButton digit : numbers){
digit.addActionListener(new NumericManagement(this));
}
/* Creazione dei pulsanti di operazione e aggiunta delle gestioni evento
* \u221A : SQRT
* \u00F7 : diviso
*/
operators = new JButton[] {
new JButton("="), new JButton("\u221A"), new JButton("^"),
new JButton("+"), new JButton("-"),new JButton("x"), new JButton("\u00F7"),
new JButton("("), new JButton(")"), new JButton("%"), new JButton("\u03C0")
};
for(int i=1;i<operators.length;i++){
operators[i].addActionListener(new OperatorsManagement(this));
}
operators[0].addActionListener(new CalcManagement(this)); //per l'uguale c'è un management apposito
/* Creazione dei pulsanti di cancellazione e aggiunta delle gestioni evento
* \u21E6 : backspace
*/
deletingOp = new JButton[] {
new JButton("\u21E6"), new JButton("CE"), new JButton("C")
};
for(JButton del : deletingOp){
del.addActionListener(new DeletingManagement(this));
}
/* Aggiunta dei componenti al pannello centrale */
center.add(operators[7]);
center.add(operators[8]);
center.add(operators[9]);
center.add(deletingOp[1]);
center.add(deletingOp[0]);
center.add(numbers[7]);
center.add(numbers[8]);
center.add(numbers[9]);
center.add(operators[1]);
center.add(operators[2]);
center.add(numbers[4]);
center.add(numbers[5]);
center.add(numbers[6]);
center.add(operators[5]);
center.add(operators[6]);
center.add(numbers[1]);
center.add(numbers[2]);
center.add(numbers[3]);
center.add(operators[3]);
center.add(operators[4]);
center.add(numbers[0]);
center.add(numbers[10]);
center.add(operators[10]);
center.add(deletingOp[2]);
center.add(operators[0]);
}
public AbstractStdCalc(String name, Expression expression){
this(name);
this.expression = expression;
}
/**
* Sets a new File menu
* @param menu
*/
public void setJMenuFile(JMenu menu){
this.menuFile = menu;
}
/**
* Sets a new item at the specified index on the menu File
* @param item
* @param i
*/
public void setJMenuFileItem(JMenuItem item, int i){
Component[] comps = menuFile.getComponents();
comps[i] = item;
menuFile.removeAll();
for(Component comp : comps){
menuFile.add(comp);
}
}
/**
* Sets a specified element of the central panel with a new one
* @param c
* @param i
*/
public void setCenterPanelElem(JComponent c, int i){
Component[] comps = center.getComponents();
comps[i] = c;
center.removeAll();
for(Component comp : comps){
center.add(comp);
}
}
}
|
package ru.itis.javalab.servlets;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.Writer;
/**
* created: 21-10-2020 - 21:02
* project: 05.WEB-APP
*
* @author dinar
* @version v0.1
*/
@WebServlet("/profile")
public class ProfileServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getServletContext().getRequestDispatcher("/profile.jsp")
.forward(request, response);
}
}
|
package cn.droidlover.xdroid.demo.model;
import android.widget.Button;
import java.util.List;
/**
* Created by Administrator on 2017/2/12 0012.
*/
public class MovieInfo extends BaseModel {
private List<Item> movies;
public List<Item> getResults() {
return movies;
}
public void setResults(List<Item> results) {
this.movies = results;
}
public static class Item{
private String id;
private String movie_id;
private String title;
private String duration;
private String value;
private String media_url;
private String media_pos;
private String media_size;
private String media_key;
private String thumb_key;
private String thumb_url;
private String thumb_pos;
private String thumb_size;
private String type;
private String set_name;
private String isPlay = "0";
private String score;
private String pic_score;
private String sub_type1;
private String isPraise = "0";
private String grade;
private String praise;
private String isEnshrine = "0";
private String enshrineTime = "0";
private String playTime = "0";
public String getMovie_id(){
return movie_id;
}
public void setMovie_id(String movie_id){
this.movie_id = movie_id;
}
public String getTitle(){
return title;
}
public void setTitle(String title){
this.title = title;
}
public String getDuration(){
return duration;
}
public String getFormatDuration(){
int time = Integer.parseInt(duration);
int minus = time / 60;
time %= 60;
return String.format("%02d:%02d", minus, time);
}
public void setDuration(String duration){
this.duration = duration;
}
public String getThumb_key() {
return thumb_key;
}
public void setThumb_key(String thumb_key) {
this.thumb_key = thumb_key;
}
public String getThumb_url() {
return thumb_url;
}
public void setThumb_url(String thumb_url) {
this.thumb_url = thumb_url;
}
public String getThumb_pos() {
return thumb_pos;
}
public void setThumb_pos(String thumb_pos) {
this.thumb_pos = thumb_pos;
}
public String getThumb_size() {
return thumb_size;
}
public void setThumb_size(String thumb_size) {
this.thumb_size = thumb_size;
}
public String getMedia_pos() {
return media_pos;
}
public void setMedia_pos(String media_pos) {
this.media_pos = media_pos;
}
public String getMedia_size() {
return media_size;
}
public void setMedia_size(String media_size) {
this.media_size = media_size;
}
public String getMedia_key() {
return media_key;
}
public void setMedia_key(String media_key) {
this.media_key = media_key;
}
public String getMedia_url() {
return media_url;
}
public void setMedia_url(String media_url) {
this.media_url = media_url;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getIsPlay() {
return isPlay;
}
public void setIsPlay(String isPlay) {
this.isPlay = isPlay;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getSet_name() {
return set_name;
}
public void setSet_name(String set_name) {
this.set_name = set_name;
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score;
}
public String getPic_score() {
return pic_score;
}
public void setPic_score(String pic_score) {
this.pic_score = pic_score;
}
public String getSub_type1() {
return sub_type1;
}
public void setSub_type1(String sub_type1) {
this.sub_type1 = sub_type1;
}
public String getIsPraise() {
return isPraise;
}
public void setIsPraise(String praise) {
isPraise = praise;
}
public String getPraise() {
return praise;
}
public void setPraise(String praise) {
this.praise = praise;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
public String getIsEnshrine() {
return isEnshrine;
}
public void setIsEnshrine(String isEnshrine) {
this.isEnshrine = isEnshrine;
}
public String getEnshrineTime() {
return enshrineTime;
}
public void setEnshrineTime(String enshrineTime) {
this.enshrineTime = enshrineTime;
}
public String getPlayTime() {
return playTime;
}
public void setPlayTime(String playTime) {
this.playTime = playTime;
}
}
}
|
package com.dbs.hack2hire.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name ="fid")
public class FIDEntity {
@Id
@GeneratedValue
@Column(name = "id")
private int id;
@Column(name= "TRADEID")
private String tradeId;
@Column(name= "StockName")
private String stockName;
@Column(name= "ISIN")
private String ISIN;
@Column(name= "Quantity")
private int quantity;
@Column(name= "Buy_Sell_Indicator")
private String bulSellIndicator;
@Column(name= "price")
private String price;
@Column(name= "Exchange_Name")
private String exchangeName;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTradeId() {
return tradeId;
}
public void setTradeId(String tradeId) {
this.tradeId = tradeId;
}
public String getStockName() {
return stockName;
}
public void setStockName(String stockName) {
this.stockName = stockName;
}
public String getISIN() {
return ISIN;
}
public void setISIN(String iSIN) {
ISIN = iSIN;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public String getBulSellIndicator() {
return bulSellIndicator;
}
public void setBulSellIndicator(String bulSellIndicator) {
this.bulSellIndicator = bulSellIndicator;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getExchangeName() {
return exchangeName;
}
public void setExchangeName(String exchangeName) {
this.exchangeName = exchangeName;
}
}
|
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package BPMN.util;
import BPMN.*;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* The <b>Adapter Factory</b> for the model.
* It provides an adapter <code>createXXX</code> method for each class of the model.
* <!-- end-user-doc -->
* @see BPMN.BPMNPackage
* @generated
*/
public class BPMNAdapterFactory extends AdapterFactoryImpl {
/**
* The cached model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static BPMNPackage modelPackage;
/**
* Creates an instance of the adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BPMNAdapterFactory() {
if (modelPackage == null) {
modelPackage = BPMNPackage.eINSTANCE;
}
}
/**
* Returns whether this factory is applicable for the type of the object.
* <!-- begin-user-doc -->
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
* <!-- end-user-doc -->
* @return whether this factory is applicable for the type of the object.
* @generated
*/
public boolean isFactoryForType(Object object) {
if (object == modelPackage) {
return true;
}
if (object instanceof EObject) {
return ((EObject)object).eClass().getEPackage() == modelPackage;
}
return false;
}
/**
* The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BPMNSwitch modelSwitch =
new BPMNSwitch() {
public Object caseBPMNModelElement(BPMNModelElement object) {
return createBPMNModelElementAdapter();
}
public Object caseBPMNEventStartDefault(BPMNEventStartDefault object) {
return createBPMNEventStartDefaultAdapter();
}
public Object caseBPMNEventEndDefault(BPMNEventEndDefault object) {
return createBPMNEventEndDefaultAdapter();
}
public Object caseBPMNEventEndUsed(BPMNEventEndUsed object) {
return createBPMNEventEndUsedAdapter();
}
public Object caseBPMNEventMail(BPMNEventMail object) {
return createBPMNEventMailAdapter();
}
public Object caseBPMNEventMailDash(BPMNEventMailDash object) {
return createBPMNEventMailDashAdapter();
}
public Object caseBPMNEventMailDouble(BPMNEventMailDouble object) {
return createBPMNEventMailDoubleAdapter();
}
public Object caseBPMNEventMailDoubleDash(BPMNEventMailDoubleDash object) {
return createBPMNEventMailDoubleDashAdapter();
}
public Object caseBPMNEventMailInvertDouble(BPMNEventMailInvertDouble object) {
return createBPMNEventMailInvertDoubleAdapter();
}
public Object caseBPMNEventMailInvertBold(BPMNEventMailInvertBold object) {
return createBPMNEventMailInvertBoldAdapter();
}
public Object caseBPMNEventTimerDefault(BPMNEventTimerDefault object) {
return createBPMNEventTimerDefaultAdapter();
}
public Object caseBPMNEventTimerDash(BPMNEventTimerDash object) {
return createBPMNEventTimerDashAdapter();
}
public Object caseBPMNEventTimerDouble(BPMNEventTimerDouble object) {
return createBPMNEventTimerDoubleAdapter();
}
public Object caseBPMNEventTimerDoubleDash(BPMNEventTimerDoubleDash object) {
return createBPMNEventTimerDoubleDashAdapter();
}
public Object caseBPMNEventEskalationStart(BPMNEventEskalationStart object) {
return createBPMNEventEskalationStartAdapter();
}
public Object caseBPMNEventEskalationDash(BPMNEventEskalationDash object) {
return createBPMNEventEskalationDashAdapter();
}
public Object caseBPMNEventEskalationDouble(BPMNEventEskalationDouble object) {
return createBPMNEventEskalationDoubleAdapter();
}
public Object caseBPMNEventEskalationDoubelDash(BPMNEventEskalationDoubelDash object) {
return createBPMNEventEskalationDoubelDashAdapter();
}
public Object caseBPMNEventEskalationDoubelInvert(BPMNEventEskalationDoubelInvert object) {
return createBPMNEventEskalationDoubelInvertAdapter();
}
public Object caseBPMNEventEskalationBoldInvert(BPMNEventEskalationBoldInvert object) {
return createBPMNEventEskalationBoldInvertAdapter();
}
public Object caseBPMNEventIfDefault(BPMNEventIfDefault object) {
return createBPMNEventIfDefaultAdapter();
}
public Object caseBPMNEventIfDash(BPMNEventIfDash object) {
return createBPMNEventIfDashAdapter();
}
public Object caseBPMNEventIfDouble(BPMNEventIfDouble object) {
return createBPMNEventIfDoubleAdapter();
}
public Object caseBPMNEventIfDoubleDash(BPMNEventIfDoubleDash object) {
return createBPMNEventIfDoubleDashAdapter();
}
public Object caseBPMNEventLinkEntered(BPMNEventLinkEntered object) {
return createBPMNEventLinkEnteredAdapter();
}
public Object caseBPMNEventLinkTriggerd(BPMNEventLinkTriggerd object) {
return createBPMNEventLinkTriggerdAdapter();
}
public Object caseBPMNEventErrorDefault(BPMNEventErrorDefault object) {
return createBPMNEventErrorDefaultAdapter();
}
public Object caseBPMNEventErrorDouble(BPMNEventErrorDouble object) {
return createBPMNEventErrorDoubleAdapter();
}
public Object caseBPMNEventErrorBoldInvert(BPMNEventErrorBoldInvert object) {
return createBPMNEventErrorBoldInvertAdapter();
}
public Object caseBPMNEventCancelDouble(BPMNEventCancelDouble object) {
return createBPMNEventCancelDoubleAdapter();
}
public Object caseBPMNEventCancelBoldInvert(BPMNEventCancelBoldInvert object) {
return createBPMNEventCancelBoldInvertAdapter();
}
public Object caseBPMNEventCompensationDefault(BPMNEventCompensationDefault object) {
return createBPMNEventCompensationDefaultAdapter();
}
public Object caseBPMNEventCompensationDouble(BPMNEventCompensationDouble object) {
return createBPMNEventCompensationDoubleAdapter();
}
public Object caseBPMNEventCompensationDoubleInvert(BPMNEventCompensationDoubleInvert object) {
return createBPMNEventCompensationDoubleInvertAdapter();
}
public Object caseBPMNEventCompensationBoldInvert(BPMNEventCompensationBoldInvert object) {
return createBPMNEventCompensationBoldInvertAdapter();
}
public Object caseBPMNEventSignalDefault(BPMNEventSignalDefault object) {
return createBPMNEventSignalDefaultAdapter();
}
public Object caseBPMNEventSignalDash(BPMNEventSignalDash object) {
return createBPMNEventSignalDashAdapter();
}
public Object caseBPMNEventSignalDouble(BPMNEventSignalDouble object) {
return createBPMNEventSignalDoubleAdapter();
}
public Object caseBPMNEventSignalDoubleDash(BPMNEventSignalDoubleDash object) {
return createBPMNEventSignalDoubleDashAdapter();
}
public Object caseBPMNEventSignalDoubleInvert(BPMNEventSignalDoubleInvert object) {
return createBPMNEventSignalDoubleInvertAdapter();
}
public Object caseBPMNEventSignalBoldInvert(BPMNEventSignalBoldInvert object) {
return createBPMNEventSignalBoldInvertAdapter();
}
public Object caseBPMNEventMultiDefault(BPMNEventMultiDefault object) {
return createBPMNEventMultiDefaultAdapter();
}
public Object caseBPMNEventMultiDash(BPMNEventMultiDash object) {
return createBPMNEventMultiDashAdapter();
}
public Object caseBPMNEventMultiDouble(BPMNEventMultiDouble object) {
return createBPMNEventMultiDoubleAdapter();
}
public Object caseBPMNEventMultiDoubleDash(BPMNEventMultiDoubleDash object) {
return createBPMNEventMultiDoubleDashAdapter();
}
public Object caseBPMNEventMultiDoubleInvert(BPMNEventMultiDoubleInvert object) {
return createBPMNEventMultiDoubleInvertAdapter();
}
public Object caseBPMNEventMultiBoldInvert(BPMNEventMultiBoldInvert object) {
return createBPMNEventMultiBoldInvertAdapter();
}
public Object caseBPMNEventParallelDefault(BPMNEventParallelDefault object) {
return createBPMNEventParallelDefaultAdapter();
}
public Object caseBPMNEventParallelDash(BPMNEventParallelDash object) {
return createBPMNEventParallelDashAdapter();
}
public Object caseBPMNEventParallelDouble(BPMNEventParallelDouble object) {
return createBPMNEventParallelDoubleAdapter();
}
public Object caseBPMNEventParallelDoubleDash(BPMNEventParallelDoubleDash object) {
return createBPMNEventParallelDoubleDashAdapter();
}
public Object caseBPMNEventTermination(BPMNEventTermination object) {
return createBPMNEventTerminationAdapter();
}
public Object caseBPMNActivityTask(BPMNActivityTask object) {
return createBPMNActivityTaskAdapter();
}
public Object caseBPMNActivityTransaction(BPMNActivityTransaction object) {
return createBPMNActivityTransactionAdapter();
}
public Object caseBPMNActivityEventSubProcess(BPMNActivityEventSubProcess object) {
return createBPMNActivityEventSubProcessAdapter();
}
public Object caseBPMNActivityCallActivity(BPMNActivityCallActivity object) {
return createBPMNActivityCallActivityAdapter();
}
public Object caseBPMNGatewayXOR1(BPMNGatewayXOR1 object) {
return createBPMNGatewayXOR1Adapter();
}
public Object caseBPMNGatewayXOR2(BPMNGatewayXOR2 object) {
return createBPMNGatewayXOR2Adapter();
}
public Object caseBPMNGatewayEvent(BPMNGatewayEvent object) {
return createBPMNGatewayEventAdapter();
}
public Object caseBPMNGatewayAnd(BPMNGatewayAnd object) {
return createBPMNGatewayAndAdapter();
}
public Object caseBPMNGatewayOR(BPMNGatewayOR object) {
return createBPMNGatewayORAdapter();
}
public Object caseBPMNGatewayComplex(BPMNGatewayComplex object) {
return createBPMNGatewayComplexAdapter();
}
public Object caseBPMNGatewayXEvent(BPMNGatewayXEvent object) {
return createBPMNGatewayXEventAdapter();
}
public Object caseBPMNGatewayAndEvent(BPMNGatewayAndEvent object) {
return createBPMNGatewayAndEventAdapter();
}
public Object caseBPMNConversationDefault(BPMNConversationDefault object) {
return createBPMNConversationDefaultAdapter();
}
public Object caseBPMNConversationBold(BPMNConversationBold object) {
return createBPMNConversationBoldAdapter();
}
public Object caseBPMNOneData(BPMNOneData object) {
return createBPMNOneDataAdapter();
}
public Object caseBPMNListData(BPMNListData object) {
return createBPMNListDataAdapter();
}
public Object caseBPMNDataStorage(BPMNDataStorage object) {
return createBPMNDataStorageAdapter();
}
public Object caseBPMNSequenceFlow(BPMNSequenceFlow object) {
return createBPMNSequenceFlowAdapter();
}
public Object caseBPMNDefaultFlow(BPMNDefaultFlow object) {
return createBPMNDefaultFlowAdapter();
}
public Object caseBPMNConditionalFlow(BPMNConditionalFlow object) {
return createBPMNConditionalFlowAdapter();
}
public Object caseBPMNDataAssoziation(BPMNDataAssoziation object) {
return createBPMNDataAssoziationAdapter();
}
public Object defaultCase(EObject object) {
return createEObjectAdapter();
}
};
/**
* Creates an adapter for the <code>target</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param target the object to adapt.
* @return the adapter for the <code>target</code>.
* @generated
*/
public Adapter createAdapter(Notifier target) {
return (Adapter)modelSwitch.doSwitch((EObject)target);
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNModelElement <em>Model Element</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNModelElement
* @generated
*/
public Adapter createBPMNModelElementAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventStartDefault <em>Event Start Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventStartDefault
* @generated
*/
public Adapter createBPMNEventStartDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEndDefault <em>Event End Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEndDefault
* @generated
*/
public Adapter createBPMNEventEndDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEndUsed <em>Event End Used</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEndUsed
* @generated
*/
public Adapter createBPMNEventEndUsedAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMail <em>Event Mail</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMail
* @generated
*/
public Adapter createBPMNEventMailAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMailDash <em>Event Mail Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMailDash
* @generated
*/
public Adapter createBPMNEventMailDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMailDouble <em>Event Mail Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMailDouble
* @generated
*/
public Adapter createBPMNEventMailDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMailDoubleDash <em>Event Mail Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMailDoubleDash
* @generated
*/
public Adapter createBPMNEventMailDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMailInvertDouble <em>Event Mail Invert Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMailInvertDouble
* @generated
*/
public Adapter createBPMNEventMailInvertDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMailInvertBold <em>Event Mail Invert Bold</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMailInvertBold
* @generated
*/
public Adapter createBPMNEventMailInvertBoldAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventTimerDefault <em>Event Timer Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventTimerDefault
* @generated
*/
public Adapter createBPMNEventTimerDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventTimerDash <em>Event Timer Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventTimerDash
* @generated
*/
public Adapter createBPMNEventTimerDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventTimerDouble <em>Event Timer Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventTimerDouble
* @generated
*/
public Adapter createBPMNEventTimerDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventTimerDoubleDash <em>Event Timer Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventTimerDoubleDash
* @generated
*/
public Adapter createBPMNEventTimerDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationStart <em>Event Eskalation Start</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationStart
* @generated
*/
public Adapter createBPMNEventEskalationStartAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationDash <em>Event Eskalation Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationDash
* @generated
*/
public Adapter createBPMNEventEskalationDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationDouble <em>Event Eskalation Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationDouble
* @generated
*/
public Adapter createBPMNEventEskalationDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationDoubelDash <em>Event Eskalation Doubel Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationDoubelDash
* @generated
*/
public Adapter createBPMNEventEskalationDoubelDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationDoubelInvert <em>Event Eskalation Doubel Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationDoubelInvert
* @generated
*/
public Adapter createBPMNEventEskalationDoubelInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventEskalationBoldInvert <em>Event Eskalation Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventEskalationBoldInvert
* @generated
*/
public Adapter createBPMNEventEskalationBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventIfDefault <em>Event If Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventIfDefault
* @generated
*/
public Adapter createBPMNEventIfDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventIfDash <em>Event If Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventIfDash
* @generated
*/
public Adapter createBPMNEventIfDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventIfDouble <em>Event If Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventIfDouble
* @generated
*/
public Adapter createBPMNEventIfDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventIfDoubleDash <em>Event If Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventIfDoubleDash
* @generated
*/
public Adapter createBPMNEventIfDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventLinkEntered <em>Event Link Entered</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventLinkEntered
* @generated
*/
public Adapter createBPMNEventLinkEnteredAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventLinkTriggerd <em>Event Link Triggerd</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventLinkTriggerd
* @generated
*/
public Adapter createBPMNEventLinkTriggerdAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventErrorDefault <em>Event Error Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventErrorDefault
* @generated
*/
public Adapter createBPMNEventErrorDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventErrorDouble <em>Event Error Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventErrorDouble
* @generated
*/
public Adapter createBPMNEventErrorDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventErrorBoldInvert <em>Event Error Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventErrorBoldInvert
* @generated
*/
public Adapter createBPMNEventErrorBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCancelDouble <em>Event Cancel Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCancelDouble
* @generated
*/
public Adapter createBPMNEventCancelDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCancelBoldInvert <em>Event Cancel Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCancelBoldInvert
* @generated
*/
public Adapter createBPMNEventCancelBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCompensationDefault <em>Event Compensation Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCompensationDefault
* @generated
*/
public Adapter createBPMNEventCompensationDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCompensationDouble <em>Event Compensation Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCompensationDouble
* @generated
*/
public Adapter createBPMNEventCompensationDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCompensationDoubleInvert <em>Event Compensation Double Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCompensationDoubleInvert
* @generated
*/
public Adapter createBPMNEventCompensationDoubleInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventCompensationBoldInvert <em>Event Compensation Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventCompensationBoldInvert
* @generated
*/
public Adapter createBPMNEventCompensationBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalDefault <em>Event Signal Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalDefault
* @generated
*/
public Adapter createBPMNEventSignalDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalDash <em>Event Signal Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalDash
* @generated
*/
public Adapter createBPMNEventSignalDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalDouble <em>Event Signal Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalDouble
* @generated
*/
public Adapter createBPMNEventSignalDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalDoubleDash <em>Event Signal Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalDoubleDash
* @generated
*/
public Adapter createBPMNEventSignalDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalDoubleInvert <em>Event Signal Double Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalDoubleInvert
* @generated
*/
public Adapter createBPMNEventSignalDoubleInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventSignalBoldInvert <em>Event Signal Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventSignalBoldInvert
* @generated
*/
public Adapter createBPMNEventSignalBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiDefault <em>Event Multi Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiDefault
* @generated
*/
public Adapter createBPMNEventMultiDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiDash <em>Event Multi Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiDash
* @generated
*/
public Adapter createBPMNEventMultiDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiDouble <em>Event Multi Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiDouble
* @generated
*/
public Adapter createBPMNEventMultiDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiDoubleDash <em>Event Multi Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiDoubleDash
* @generated
*/
public Adapter createBPMNEventMultiDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiDoubleInvert <em>Event Multi Double Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiDoubleInvert
* @generated
*/
public Adapter createBPMNEventMultiDoubleInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventMultiBoldInvert <em>Event Multi Bold Invert</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventMultiBoldInvert
* @generated
*/
public Adapter createBPMNEventMultiBoldInvertAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventParallelDefault <em>Event Parallel Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventParallelDefault
* @generated
*/
public Adapter createBPMNEventParallelDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventParallelDash <em>Event Parallel Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventParallelDash
* @generated
*/
public Adapter createBPMNEventParallelDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventParallelDouble <em>Event Parallel Double</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventParallelDouble
* @generated
*/
public Adapter createBPMNEventParallelDoubleAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventParallelDoubleDash <em>Event Parallel Double Dash</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventParallelDoubleDash
* @generated
*/
public Adapter createBPMNEventParallelDoubleDashAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNEventTermination <em>Event Termination</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNEventTermination
* @generated
*/
public Adapter createBPMNEventTerminationAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNActivityTask <em>Activity Task</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNActivityTask
* @generated
*/
public Adapter createBPMNActivityTaskAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNActivityTransaction <em>Activity Transaction</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNActivityTransaction
* @generated
*/
public Adapter createBPMNActivityTransactionAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNActivityEventSubProcess <em>Activity Event Sub Process</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNActivityEventSubProcess
* @generated
*/
public Adapter createBPMNActivityEventSubProcessAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNActivityCallActivity <em>Activity Call Activity</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNActivityCallActivity
* @generated
*/
public Adapter createBPMNActivityCallActivityAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayXOR1 <em>Gateway XOR1</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayXOR1
* @generated
*/
public Adapter createBPMNGatewayXOR1Adapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayXOR2 <em>Gateway XOR2</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayXOR2
* @generated
*/
public Adapter createBPMNGatewayXOR2Adapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayEvent <em>Gateway Event</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayEvent
* @generated
*/
public Adapter createBPMNGatewayEventAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayAnd <em>Gateway And</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayAnd
* @generated
*/
public Adapter createBPMNGatewayAndAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayOR <em>Gateway OR</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayOR
* @generated
*/
public Adapter createBPMNGatewayORAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayComplex <em>Gateway Complex</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayComplex
* @generated
*/
public Adapter createBPMNGatewayComplexAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayXEvent <em>Gateway XEvent</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayXEvent
* @generated
*/
public Adapter createBPMNGatewayXEventAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNGatewayAndEvent <em>Gateway And Event</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNGatewayAndEvent
* @generated
*/
public Adapter createBPMNGatewayAndEventAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNConversationDefault <em>Conversation Default</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNConversationDefault
* @generated
*/
public Adapter createBPMNConversationDefaultAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNConversationBold <em>Conversation Bold</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNConversationBold
* @generated
*/
public Adapter createBPMNConversationBoldAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNOneData <em>One Data</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNOneData
* @generated
*/
public Adapter createBPMNOneDataAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNListData <em>List Data</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNListData
* @generated
*/
public Adapter createBPMNListDataAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNDataStorage <em>Data Storage</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNDataStorage
* @generated
*/
public Adapter createBPMNDataStorageAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNSequenceFlow <em>Sequence Flow</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNSequenceFlow
* @generated
*/
public Adapter createBPMNSequenceFlowAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNDefaultFlow <em>Default Flow</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNDefaultFlow
* @generated
*/
public Adapter createBPMNDefaultFlowAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNConditionalFlow <em>Conditional Flow</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNConditionalFlow
* @generated
*/
public Adapter createBPMNConditionalFlowAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link BPMN.BPMNDataAssoziation <em>Data Assoziation</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see BPMN.BPMNDataAssoziation
* @generated
*/
public Adapter createBPMNDataAssoziationAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
* <!-- end-user-doc -->
* @return the new adapter.
* @generated
*/
public Adapter createEObjectAdapter() {
return null;
}
} //BPMNAdapterFactory
|
package tom.graphic.ThreeD;
import java.awt.Color;
import java.awt.Event;
import java.awt.Graphics;
import java.io.PrintStream;
// Referenced classes of package tom.graphic.ThreeD:
// Comparator, Object3D
public class Elem3D
implements Comparator {
public static final int ELEM_NOT_VISIBLE = -1000;
protected float posZ;
protected Object3D parent;
public Color col;
Elem3D() {
col = Color.black;
}
public int compare(Object obj, Object obj1) {
byte byte0 = 0;
if (((Elem3D)obj).posZ > ((Elem3D)obj1).posZ)
byte0 = 1;
else
if (((Elem3D)obj).posZ < ((Elem3D)obj1).posZ)
byte0 = -1;
return byte0;
}
public boolean equals(Object obj) {
return this == obj;
}
public String getLastEvtAsString() {
return "";
}
public boolean handleEvent(Event event) {
return false;
}
public Elem3D isInside(int i, int j) {
return null;
}
public void paint(Graphics g) {
System.out.println("Paint Elem 3D");
}
public float setZ() {
return posZ;
}
}
|
package com.tefper.daas.parque.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
@Entity
@Table(name = "customer")
@Data
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private String id;
@Column(name = "name")
private String name;
@Column(name = "tipodocumento")
private String tipodocumento;
@Column(name = "numerodocumento")
private String numerodocumento;
@Column(name = "ciclodefacturacion")
private String ciclodefacturacion;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.