blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
514e2cf898a4cc0598c48a14ebc384df9d3b09fe
8ae17726b0de5e18aef08a8ab9d624fb306c292e
/src/main/java/com/beecode/rest/RestProductController.java
c82e9afa4fb23b12426d55d7be5383aaa1437f3d
[]
no_license
JoelRCVargas/santiandsophe-services
c3bc41f8d6e4345ce07280bf4d87bc9f5dfec436
5901036cc2e453a7e3affbdca25d6d312eff3d5f
refs/heads/master
2023-01-02T21:15:38.754002
2020-10-21T17:20:00
2020-10-21T17:20:00
306,100,747
0
0
null
null
null
null
UTF-8
Java
false
false
3,845
java
package com.beecode.rest; import java.util.Collection; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.beecode.entity.Product; import com.beecode.interfaces.ProductService; import com.beecode.projection.ProductCardProjection; import com.beecode.projection.ProductProjection; @RestController public class RestProductController { @Autowired private ProductService productService; @GetMapping(value = "/public/product/all", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<List<Product>> getAllProduct(){ return ResponseEntity.ok().body(productService.getAllProduct()); } //Get products -> Home @GetMapping(value = "/public/product/pagination", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Page<ProductCardProjection>> getAllProductPage(Pageable pageable ,@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize, @RequestParam("type") List<String> type){ return ResponseEntity.ok().body(this.productService.getProductPage(pageable, pageNo, pageSize, type)); } //Get products -> Menu @GetMapping(value = "/public/product/by/type", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Collection<ProductProjection>> getProductsByType(){ return ResponseEntity.ok().body(productService.getCustomProducts()); } //Get products -> Search @GetMapping(value = "/public/product/like/name", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Slice<ProductProjection>> getProductsLikeName(@RequestParam("name") String name){ return ResponseEntity.ok().body(productService.getLikeCustomProductsByName(name, PageRequest.of(0, 7))); } //Get products -> Details @GetMapping(value = "/public/product/bysku", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Optional<Product>> getProductBySku(@RequestParam("sku") String sku){ return ResponseEntity.ok().body(productService.getBySku(sku)); } //Get products by category id @GetMapping(value = "/public/product/by/category/id", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Collection<ProductCardProjection>> getProductByCategoryId(@RequestParam("id_category") Long id ){ return ResponseEntity.ok().body(productService.getProductProjectionByCategoryId(id)); } //Create products @PostMapping(value = "/admin/product/create", consumes = {MediaType.APPLICATION_JSON_VALUE}, produces = {MediaType.APPLICATION_JSON_VALUE}) public ResponseEntity<Product> bannerCreate(@RequestBody Product product){ return ResponseEntity.ok().body(productService.createProduct(product)); } @GetMapping(value = "/admin/product/delete", consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE }) public ResponseEntity<String> deleteBannerById(@RequestParam("id_product") Long productId) { return this.productService.deleteProduct(productId); } }
1bb65e666b76b0c7844bcb8a8b8439c61d72db6b
b00c54389a95d81a22e361fa9f8bdf5a2edc93e3
/external/conscrypt/src/main/java/org/conscrypt/ClientSessionContext.java
d2e23c9a219dea7a0c0082756def851e087c5036
[]
no_license
mirek190/x86-android-5.0
9d1756fa7ff2f423887aa22694bd737eb634ef23
eb1029956682072bb7404192a80214189f0dc73b
refs/heads/master
2020-05-27T01:09:51.830208
2015-10-07T22:47:36
2015-10-07T22:47:36
41,942,802
15
20
null
2020-03-09T00:21:03
2015-09-05T00:11:19
null
UTF-8
Java
false
false
4,417
java
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.conscrypt; import java.util.HashMap; import java.util.Map; import javax.net.ssl.SSLSession; /** * Caches client sessions. Indexes by host and port. Users are typically * looking to reuse any session for a given host and port. */ public class ClientSessionContext extends AbstractSessionContext { /** * Sessions indexed by host and port. Protect from concurrent * access by holding a lock on sessionsByHostAndPort. */ final Map<HostAndPort, SSLSession> sessionsByHostAndPort = new HashMap<HostAndPort, SSLSession>(); private SSLClientSessionCache persistentCache; public ClientSessionContext() { super(10, 0); } public int size() { return sessionsByHostAndPort.size(); } public void setPersistentCache(SSLClientSessionCache persistentCache) { this.persistentCache = persistentCache; } @Override protected void sessionRemoved(SSLSession session) { String host = session.getPeerHost(); int port = session.getPeerPort(); if (host == null) { return; } HostAndPort hostAndPortKey = new HostAndPort(host, port); synchronized (sessionsByHostAndPort) { sessionsByHostAndPort.remove(hostAndPortKey); } } /** * Finds a cached session for the given host name and port. * * @param host of server * @param port of server * @return cached session or null if none found */ public SSLSession getSession(String host, int port) { if (host == null) { return null; } SSLSession session; HostAndPort hostAndPortKey = new HostAndPort(host, port); synchronized (sessionsByHostAndPort) { session = sessionsByHostAndPort.get(hostAndPortKey); } if (session != null && session.isValid()) { return session; } // Look in persistent cache. if (persistentCache != null) { byte[] data = persistentCache.getSessionData(host, port); if (data != null) { session = toSession(data, host, port); if (session != null && session.isValid()) { super.putSession(session); synchronized (sessionsByHostAndPort) { sessionsByHostAndPort.put(hostAndPortKey, session); } return session; } } } return null; } @Override public void putSession(SSLSession session) { super.putSession(session); String host = session.getPeerHost(); int port = session.getPeerPort(); if (host == null) { return; } HostAndPort hostAndPortKey = new HostAndPort(host, port); synchronized (sessionsByHostAndPort) { sessionsByHostAndPort.put(hostAndPortKey, session); } // TODO: This in a background thread. if (persistentCache != null) { byte[] data = toBytes(session); if (data != null) { persistentCache.putSessionData(session, data); } } } static class HostAndPort { final String host; final int port; HostAndPort(String host, int port) { this.host = host; this.port = port; } @Override public int hashCode() { return host.hashCode() * 31 + port; } @Override public boolean equals(Object o) { if (!(o instanceof HostAndPort)) { return false; } HostAndPort lhs = (HostAndPort) o; return host.equals(lhs.host) && port == lhs.port; } } }
219105134cf79ca6ed4b8f293a9d3769be1e2182
b2f07f3e27b2162b5ee6896814f96c59c2c17405
/java/security/spec/ECPoint.java
82ed7b317af6d0b02107b325f6b2935c3739f933
[]
no_license
weiju-xi/RT-JAR-CODE
e33d4ccd9306d9e63029ddb0c145e620921d2dbd
d5b2590518ffb83596a3aa3849249cf871ab6d4e
refs/heads/master
2021-09-08T02:36:06.675911
2018-03-06T05:27:49
2018-03-06T05:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,805
java
/* */ package java.security.spec; /* */ /* */ import java.math.BigInteger; /* */ /* */ public class ECPoint /* */ { /* */ private final BigInteger x; /* */ private final BigInteger y; /* 47 */ public static final ECPoint POINT_INFINITY = new ECPoint(); /* */ /* */ private ECPoint() /* */ { /* 51 */ this.x = null; /* 52 */ this.y = null; /* */ } /* */ /* */ public ECPoint(BigInteger paramBigInteger1, BigInteger paramBigInteger2) /* */ { /* 64 */ if ((paramBigInteger1 == null) || (paramBigInteger2 == null)) { /* 65 */ throw new NullPointerException("affine coordinate x or y is null"); /* */ } /* 67 */ this.x = paramBigInteger1; /* 68 */ this.y = paramBigInteger2; /* */ } /* */ /* */ public BigInteger getAffineX() /* */ { /* 77 */ return this.x; /* */ } /* */ /* */ public BigInteger getAffineY() /* */ { /* 86 */ return this.y; /* */ } /* */ /* */ public boolean equals(Object paramObject) /* */ { /* 97 */ if (this == paramObject) return true; /* 98 */ if (this == POINT_INFINITY) return false; /* 99 */ if ((paramObject instanceof ECPoint)) { /* 100 */ return (this.x.equals(((ECPoint)paramObject).x)) && (this.y.equals(((ECPoint)paramObject).y)); /* */ } /* */ /* 103 */ return false; /* */ } /* */ /* */ public int hashCode() /* */ { /* 111 */ if (this == POINT_INFINITY) return 0; /* 112 */ return this.x.hashCode() << 5 + this.y.hashCode(); /* */ } /* */ } /* Location: C:\Program Files\Java\jdk1.7.0_79\jre\lib\rt.jar * Qualified Name: java.security.spec.ECPoint * JD-Core Version: 0.6.2 */
9df59c8e75199718583178cea1f1b21b8bb31285
c3468758f7aff503340e7356fbc60d6774997a22
/app/src/main/src/com/anipr/beaconstores/OfferDetails.java
58df5e36bcea6e2c31c3a82d33a583d461de8488
[]
no_license
tymiles003/Beacons-Stores
96ec4b6e6e2e1b6de2f1b38bc2fc9ba7cf20067f
9da64eeb276518edeb330f6cd058ce445c0efb06
refs/heads/master
2021-04-18T19:43:38.032075
2015-01-22T14:00:24
2015-01-22T14:00:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,258
java
package com.anipr.beaconstores; import android.app.Activity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import com.anipr.beaconstores.dbhandler.DbHelper; public class OfferDetails extends Activity { private TextView welcomeMsg, offerName, offerDetails; private String offerCode; private Cursor offerDetailCursor; private SQLiteDatabase dbWrite; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_offer_details); welcomeMsg = (TextView) findViewById(R.id.welcome_msg); offerName = (TextView) findViewById(R.id.offer_name); offerDetails = (TextView) findViewById(R.id.offer_desc); offerCode = getIntent().getStringExtra(DbHelper.offerCode); dbWrite = DbHelper.getInstance(getApplicationContext()) .getWritableDatabase(); String query = "SELECT * FROM " + DbHelper.OFFERS_TABLE + " WHERE "+DbHelper.offerCode+" = '" + offerCode + "'"; offerDetailCursor = dbWrite.rawQuery(query, null); if (offerDetailCursor.moveToFirst()) { if (offerDetailCursor.getString( offerDetailCursor.getColumnIndex(DbHelper.offerType)) .equals(DbHelper.OFFER_TYPE_ENTRY+"")) { welcomeMsg.setText(getString(R.string.entry_offer_welcome_msg)); }else{ welcomeMsg.setText(getString(R.string.exit_offer_welcome_msg)); } } offerName.setText(offerDetailCursor.getString(offerDetailCursor .getColumnIndex(DbHelper.offerName))); offerDetails.setText(offerDetailCursor.getString(offerDetailCursor .getColumnIndex(DbHelper.offerDesc))); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.offer_details, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public static Bitmap getRoundedRectBitmap(Bitmap bitmap, int pixels) { Bitmap result = null; try { result = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(result); int color = 0xff424242; Paint paint = new Paint(); Rect rect = new Rect(0, 0, 200, 200); paint.setAntiAlias(true); canvas.drawARGB(0, 0, 0, 0); paint.setColor(color); canvas.drawCircle(50, 50, 50, paint); paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN)); canvas.drawBitmap(bitmap, rect, rect, paint); } catch (NullPointerException e) { } catch (OutOfMemoryError o) { } return result; } }
ec946bfd4bacdd1267bec5db599b5a90f93c0ad0
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/fastjson/2016/12/FastJsonProvider.java
f3343e605986d7bd5d9f665af2f11c8ee9303474
[]
no_license
rosoareslv/SED99
d8b2ff5811e7f0ffc59be066a5a0349a92cbb845
a062c118f12b93172e31e8ca115ce3f871b64461
refs/heads/main
2023-02-22T21:59:02.703005
2021-01-28T19:40:51
2021-01-28T19:40:51
306,497,459
1
1
null
2020-11-24T20:56:18
2020-10-23T01:18:07
null
UTF-8
Java
false
false
9,245
java
package com.alibaba.fastjson.support.jaxrs; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializeFilter; import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.util.IOUtils; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Fastjson for JAX-RS Provider. * * @author smallnest * @author VictorZeng * @see MessageBodyReader * @see MessageBodyWriter * @since 1.2.9 */ @Provider @Consumes({MediaType.WILDCARD}) @Produces({MediaType.WILDCARD}) public class FastJsonProvider // implements MessageBodyReader<Object>, MessageBodyWriter<Object> { @Deprecated protected Charset charset = IOUtils.UTF8; @Deprecated protected SerializerFeature[] features = new SerializerFeature[0]; @Deprecated protected SerializeFilter[] filters = new SerializeFilter[0]; @Deprecated protected String dateFormat; /** * with fastJson config */ private FastJsonConfig fastJsonConfig = new FastJsonConfig(); /** * allow serialize/deserialize types in clazzes */ private Class<?>[] clazzes = null; /** * whether set PrettyFormat while exec WriteTo() */ private boolean pretty; /** * @return the fastJsonConfig. * @since 1.2.11 */ public FastJsonConfig getFastJsonConfig() { return fastJsonConfig; } /** * @param fastJsonConfig the fastJsonConfig to set. * @since 1.2.11 */ public void setFastJsonConfig(FastJsonConfig fastJsonConfig) { this.fastJsonConfig = fastJsonConfig; } /** * Can serialize/deserialize all types. */ public FastJsonProvider() { } /** * Only serialize/deserialize all types in clazzes. */ public FastJsonProvider(Class<?>[] clazzes) { this.clazzes = clazzes; } /** * Set pretty format */ public FastJsonProvider setPretty(boolean p) { this.pretty = p; return this; } /** * Set charset. the default charset is UTF-8 */ @Deprecated public FastJsonProvider(String charset) { this.fastJsonConfig.setCharset(Charset.forName(charset)); } @Deprecated public Charset getCharset() { return this.fastJsonConfig.getCharset(); } @Deprecated public void setCharset(Charset charset) { this.fastJsonConfig.setCharset(charset); } @Deprecated public String getDateFormat() { return this.fastJsonConfig.getDateFormat(); } @Deprecated public void setDateFormat(String dateFormat) { this.fastJsonConfig.setDateFormat(dateFormat); } @Deprecated public SerializerFeature[] getFeatures() { return this.fastJsonConfig.getSerializerFeatures(); } @Deprecated public void setFeatures(SerializerFeature... features) { this.fastJsonConfig.setSerializerFeatures(features); } @Deprecated public SerializeFilter[] getFilters() { return this.fastJsonConfig.getSerializeFilters(); } @Deprecated public void setFilters(SerializeFilter... filters) { this.fastJsonConfig.setSerializeFilters(filters); } /** * Check whether a class can be serialized or deserialized. It can check * based on packages, annotations on entities or explicit classes. * * @param type class need to check * @return true if valid */ protected boolean isValidType(Class<?> type, Annotation[] classAnnotations) { if (type == null) return false; if (clazzes != null) { for (Class<?> cls : clazzes) { // must strictly equal. Don't check // inheritance if (cls == type) return true; } return false; } return true; } /** * Check media type like "application/json". * * @param mediaType media type * @return true if the media type is valid */ protected boolean hasMatchingMediaType(MediaType mediaType) { if (mediaType != null) { String subtype = mediaType.getSubtype(); return (("json".equalsIgnoreCase(subtype)) // || (subtype.endsWith("+json")) // || ("javascript".equals(subtype)) // || ("x-javascript".equals(subtype)) // || ("x-json".equals(subtype)) // || ("x-www-form-urlencoded".equalsIgnoreCase(subtype)) // || (subtype.endsWith("x-www-form-urlencoded"))); } return true; } /* * /********************************************************** /* Partial * MessageBodyWriter impl * /********************************************************** */ /** * Method that JAX-RS container calls to try to check whether given value * (of specified type) can be serialized by this provider. */ public boolean isWriteable(Class<?> type, // Type genericType, // Annotation[] annotations, // MediaType mediaType) { if (!hasMatchingMediaType(mediaType)) { return false; } return isValidType(type, annotations); } /** * Method that JAX-RS container calls to try to figure out serialized length * of given value. always return -1 to denote "not known". */ public long getSize(Object t, // Class<?> type, // Type genericType, // Annotation[] annotations, // MediaType mediaType) { return -1; } /** * Method that JAX-RS container calls to serialize given value. */ public void writeTo(Object obj, // Class<?> type, // Type genericType, // Annotation[] annotations, // MediaType mediaType, // MultivaluedMap<String, Object> httpHeaders, // OutputStream entityStream // ) throws IOException, WebApplicationException { SerializerFeature[] serializerFeatures = fastJsonConfig.getSerializerFeatures(); if (pretty) { if (serializerFeatures == null) serializerFeatures = new SerializerFeature[]{SerializerFeature.PrettyFormat}; else { List<SerializerFeature> featureList = new ArrayList<SerializerFeature>(Arrays .asList(serializerFeatures)); featureList.add(SerializerFeature.PrettyFormat); serializerFeatures = featureList.toArray(serializerFeatures); } fastJsonConfig.setSerializerFeatures(serializerFeatures); } int len = JSON.writeJSONString(entityStream, // fastJsonConfig.getCharset(), // obj, // fastJsonConfig.getSerializeConfig(), // fastJsonConfig.getSerializeFilters(), // fastJsonConfig.getDateFormat(), // JSON.DEFAULT_GENERATE_FEATURE, // fastJsonConfig.getSerializerFeatures()); // add Content-Length httpHeaders.add("Content-Length", len); entityStream.flush(); } /* * /********************************************************** /* * MessageBodyReader impl * /********************************************************** */ /** * Method that JAX-RS container calls to try to check whether values of * given type (and media type) can be deserialized by this provider. */ public boolean isReadable(Class<?> type, // Type genericType, // Annotation[] annotations, // MediaType mediaType) { if (!hasMatchingMediaType(mediaType)) { return false; } return isValidType(type, annotations); } /** * Method that JAX-RS container calls to deserialize given value. */ public Object readFrom(Class<Object> type, // Type genericType, // Annotation[] annotations, // MediaType mediaType, // MultivaluedMap<String, String> httpHeaders, // InputStream entityStream) throws IOException, WebApplicationException { return JSON.parseObject(entityStream, fastJsonConfig.getCharset(), genericType, fastJsonConfig.getFeatures()); } }
c0e649626b9696a2bebafd349206cf3c034f1921
ad91719cc0193918abd605b9424ff44e07883540
/le-tbtSps/trunk/le-tbtSps-webservice/src/main/java/com/letv/tbtSps/sdk/api/response/dto/RelationTbrelationMedicineProductResponseDto.java
64fb75848a0e51b1498600f52a6d2780d2452714
[]
no_license
267062491/review
0f25289bad673a5344e246d120a9fd221ba1c8a6
a0b33dd5e58934587f608d6cadf3a32de5b1e31b
refs/heads/master
2021-01-22T22:28:29.812317
2017-11-26T13:21:59
2017-11-26T13:21:59
85,545,399
0
0
null
null
null
null
UTF-8
Java
false
false
2,303
java
package com.letv.tbtSps.sdk.api.response.dto; import com.letv.common.sdk.api.dto.LetvDto; import java.util.Date; /** * RelationTbrelationMedicineProductResponse:tbt信息表-相关农产品关联表返回对象<br/> * 提供rest接口时方法的返回对象 * * @author yuguodong * @version 2017-3-25 22:43:05 * */ public class RelationTbrelationMedicineProductResponseDto extends LetvDto { /** 序列化标识 */ private static final long serialVersionUID = 1L; /** id */ private Long id; /** 相关农产品 */ private String relationMedicineProductCode; /** sps编码 */ private String spsCode; /** 创建时间 */ private Date createTime; /** 修改时间 */ private Date updateTime; /** 创建人 */ private String createUser; /** 修改人 */ private String updateUser; /** yn */ private Integer yn; public Long getId(){ return id; } public void setId(Long id) { this.id = id; } public String getRelationMedicineProductCode(){ return relationMedicineProductCode; } public void setRelationMedicineProductCode(String relationMedicineProductCode) { this.relationMedicineProductCode = relationMedicineProductCode; } public String getSpsCode(){ return spsCode; } public void setSpsCode(String spsCode) { this.spsCode = spsCode; } public Date getCreateTime(){ return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime(){ return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public String getCreateUser(){ return createUser; } public void setCreateUser(String createUser) { this.createUser = createUser; } public String getUpdateUser(){ return updateUser; } public void setUpdateUser(String updateUser) { this.updateUser = updateUser; } public Integer getYn(){ return yn; } public void setYn(Integer yn) { this.yn = yn; } }
302fadff531320ab2c284fb78723792897300cf4
891691776a65c9f55ea13fe13a4cc769f8f23e86
/chapter01_myfirstapp/src/main/java/ru/fedorsirotkin/chapter01_myfirstapp/MainActivity.java
6a9783992e6b48c9b48cbfd182cc9bf787d855b1
[]
no_license
fedorsirotkin/HeadFirstAndroid
7522749cf5c49950194c1b76ac4dcc74e24fa917
a2d501b539d6866fa2ae9381792a7f8bbbaae33a
refs/heads/master
2020-06-29T12:14:18.880936
2019-08-26T16:50:01
2019-08-26T16:50:01
200,531,959
0
0
null
null
null
null
UTF-8
Java
false
false
726
java
// Имя пакета package ru.fedorsirotkin.chapter01_myfirstapp; // Классы Android, используемые в MainActivity import android.app.Activity; import android.os.Bundle; // MainActivity расширяет класс Activity public class MainActivity extends Activity { // Реализация метода onCreate() из класса Activity. // Вызывается при первом создании активности @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Указывает, какой макет должен использоваться setContentView(R.layout.activity_main); } }
c9cf201994268a406aacaf8ce051fefedb57daa6
82919e8b8cb5e6582023e4ca22b4144109cae7b5
/Web/src/main/java/org/voovan/http/server/WebSocketDispatcher.java
8d81756d6feb4b9c56775a4c25985049e6e93e12
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
from000/Voovan
a779e7ed03eb987653333f5d608e79ca184044e3
0358169ee5a057b90504f3beaf501d626ea30498
refs/heads/master
2022-01-29T18:31:37.452262
2019-03-23T12:20:52
2019-03-23T12:20:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,173
java
package org.voovan.http.server; import org.voovan.Global; import org.voovan.http.HttpSessionParam; import org.voovan.http.HttpRequestType; import org.voovan.http.server.context.WebServerConfig; import org.voovan.http.server.exception.RouterNotFound; import org.voovan.http.websocket.WebSocketFrame; import org.voovan.http.websocket.WebSocketRouter; import org.voovan.http.websocket.WebSocketSession; import org.voovan.http.websocket.WebSocketType; import org.voovan.http.websocket.exception.WebSocketFilterException; import org.voovan.network.IoSession; import org.voovan.network.exception.SendMessageException; import org.voovan.tools.TEnv; import org.voovan.tools.TObject; import org.voovan.tools.log.Logger; import org.voovan.tools.reflect.annotation.NotSerialization; import java.nio.ByteBuffer; import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.TreeMap; import java.util.concurrent.ConcurrentHashMap; /** * * 根据 WebSocket 请求分派到处理路由 * * @author helyho * * Voovan Framework. * WebSite: https://github.com/helyho/Voovan * Licence: Apache v2 License */ public class WebSocketDispatcher { private WebServerConfig webConfig; private SessionManager sessionManager; @NotSerialization private Map<IoSession, WebSocketSession> webSocketSessions; /** * [Key] = Route path ,[Value] = WebSocketBizHandler对象 */ private Map<String, WebSocketRouter> routers; public enum WebSocketEvent { OPEN, RECIVED, SENT, CLOSE, PING, PONG } /** * 构造函数 * @param webConfig WEB 配置对象 * @param sessionManager session 管理器 */ public WebSocketDispatcher(WebServerConfig webConfig, SessionManager sessionManager) { this.webConfig = webConfig; this.sessionManager = sessionManager; webSocketSessions = new ConcurrentHashMap<IoSession, WebSocketSession>(); routers = new TreeMap<String, WebSocketRouter>(new Comparator<String>() { @Override public int compare(String o1, String o2) { if(o1.length() > o2.length()){ return -1; } else if(o1.length() < o2.length()){ return 1; } else if(o1.equals(o2)){ return 0; } else{ return 1; } } }); } /** * 获取 WebSocket 的路由配置 * @return 路由配置信息 */ public Map<String, WebSocketRouter> getRouters(){ return routers; } /** * 增加一个路由规则 * * @param routeRegexPath 匹配路径 * @param handler WebSocketRouter 对象 */ public void addRouteHandler(String routeRegexPath, WebSocketRouter handler) { routeRegexPath = HttpDispatcher.fixRoutePath(routeRegexPath); routers.put(routeRegexPath, handler); } /** * 获取路由处理对象和注册路由 * @param request 请求对象 * @return 路由信息对象 [ 匹配到的已注册路由, WebSocketRouter对象 ] */ public List<Object> findRouter(HttpRequest request){ String requestPath = request.protocol().getPath(); for (Map.Entry<String,WebSocketRouter> routeEntry : routers.entrySet()) { String routePath = routeEntry.getKey(); if(HttpDispatcher.matchPath(requestPath, routePath, webConfig.isMatchRouteIgnoreCase())){ //[ 匹配到的已注册路由, HttpRouter对象 ] return TObject.asList(routePath, routeEntry.getValue());} } return null; } /** * 路由处理函数 * * @param event WebSocket 事件 * @param session socket连接会话 * @param request HTTP 请求对象 * @param byteBuffer 对象, 保存 WebSocket 数据 * @return WebSocket 帧对象 */ public WebSocketFrame process(WebSocketEvent event, IoSession session, HttpRequest request, ByteBuffer byteBuffer) { //[ 匹配到的已注册路由, WebSocketRouter对象 ] List<Object> routerInfo = findRouter(request); if (routerInfo != null) { // String routePath = (String)routerInfo.get(0); WebSocketRouter webSocketRouter = (WebSocketRouter)routerInfo.get(1); WebSocketSession webSocketSession = disposeSession(request, webSocketRouter); // 获取路径变量 ByteBuffer responseMessage = null; try { Object result = byteBuffer; //WebSocket 事件处理 if (event == WebSocketEvent.OPEN) { result = webSocketRouter.onOpen(webSocketSession); //封包 responseMessage = (ByteBuffer) webSocketRouter.filterEncoder(webSocketSession, result); } else if (event == WebSocketEvent.RECIVED) { //解包 result = webSocketRouter.filterDecoder(webSocketSession, result); //触发 onRecive 事件 result = webSocketRouter.onRecived(webSocketSession, result); //封包 responseMessage = (ByteBuffer) webSocketRouter.filterEncoder(webSocketSession, result); } //将返回消息包装称WebSocketFrame if (responseMessage != null) { return WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.TEXT, false, responseMessage); } if (event == WebSocketEvent.SENT) { //封包 result = webSocketRouter.filterDecoder(webSocketSession, byteBuffer); webSocketRouter.onSent(webSocketSession, result); } else if (event == WebSocketEvent.CLOSE) { webSocketRouter.onClose(webSocketSession); //清理 webSocketSessions 中的 WebSocketSession webSocketSessions.remove(session); } else if (event == WebSocketEvent.PING) { return WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.PONG, false, byteBuffer); } else if (event == WebSocketEvent.PONG) { final IoSession poneSession = session; if(poneSession.isConnected()) { Global.getThreadPool().execute(new Runnable() { @Override public void run() { TEnv.sleep(poneSession.socketContext().getReadTimeout() / 3); try { poneSession.syncSend(WebSocketFrame.newInstance(true, WebSocketFrame.Opcode.PING, false, null)); } catch (SendMessageException e) { poneSession.close(); Logger.error("Send WebSocket ping error", e); } } }); } } } catch (WebSocketFilterException e) { Logger.error(e); } } // 没有找寻到匹配的路由处理器 else { new RouterNotFound("Not avaliable router!").printStackTrace(); } return null; } /** * 处理 WebSocketSession * @param request Http 请求对象 * @param webSocketRouter websocket 路由处理 * @return WebSocketSession对象 */ public WebSocketSession disposeSession(HttpRequest request, WebSocketRouter webSocketRouter){ request.setSessionManager(sessionManager); HttpSession httpSession = request.getSession(); IoSession socketSession = request.getSocketSession(); //如果 session 不存在,创建新的 session if (!webSocketSessions.containsKey(socketSession)) { // 构建 session WebSocketSession webSocketSession = new WebSocketSession(httpSession.getSocketSession(), webSocketRouter, WebSocketType.SERVER); webSocketSessions.put(socketSession, webSocketSession); return webSocketSession; } else { return webSocketSessions.get(socketSession); } } /** * 触发 WebSocket Open 事件 * @param session socket 会话对象 * @param request http 请求对象 * @return WebSocketFrame WebSocket 帧 */ public WebSocketFrame fireOpenEvent(IoSession session, HttpRequest request){ //触发 onOpen 事件 return process(WebSocketEvent.OPEN, session, request, null); } /** * 触发 WebSocket Received 事件 * @param session socket 会话对象 * @param request http 请求对象 * @param byteBuffer ping的报文数据 * @return WebSocketFrame WebSocket 帧 */ public WebSocketFrame fireReceivedEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){ return process(WebSocketEvent.RECIVED, session, request, byteBuffer); } /** * 触发 WebSocket Sent 事件 * @param session socket 会话对象 * @param request http 请求对象 * @param byteBuffer ByteBuffer 对象 */ public void fireSentEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){ process(WebSocketEvent.SENT, session, request, byteBuffer); } /** * 出发 Close 事件 * @param session HTTP-Session 对象 */ public void fireCloseEvent(IoSession session){ //检查是否是WebSocket if (HttpRequestType.WEBSOCKET.equals(WebServerHandler.getAttribute(session, HttpSessionParam.TYPE))) { // 触发一个 WebSocket Close 事件 process(WebSocketEvent.CLOSE, session, (HttpRequest) WebServerHandler.getAttribute(session, HttpSessionParam.HTTP_REQUEST), null); } } /** * 触发 WebSocket Ping 事件 * @param session socket 会话对象 * @param request http 请求对象 * @param byteBuffer ping的报文数据 * @return WebSocketFrame WebSocket 帧 */ public WebSocketFrame firePingEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){ return process(WebSocketEvent.PING, session, request, byteBuffer); } /** * 触发 WebSocket Pone 事件 * @param session socket 会话对象 * @param request http 请求对象 * @param byteBuffer ByteBuffer 对象 */ public void firePoneEvent(IoSession session, HttpRequest request, ByteBuffer byteBuffer){ process(WebSocketEvent.PONG, session, request, byteBuffer); } }
0428861e76da512b3bd9268829a38e76447699cd
e5d739a063a1cf76ffe62bdefc57b62f75e841a9
/src/main/java/nl/bsoft/data/graphql/model/postgresql/Vehicle.java
0237db4a475f4d889b5a9c3ad65e845ec9c3bf9d
[ "MIT" ]
permissive
bvpelt/graphql
a104d22d01056e1c02866c40a1a15fa2366fb3de
1bf733a0dc1273d9c5cf718a545418b47e18a4e9
refs/heads/master
2021-07-24T21:27:36.105191
2019-12-04T18:22:08
2019-12-04T18:22:08
225,834,303
0
0
MIT
2020-10-13T17:58:26
2019-12-04T09:56:31
Java
UTF-8
Java
false
false
844
java
package nl.bsoft.data.graphql.model.postgresql; import lombok.Data; import lombok.EqualsAndHashCode; import javax.persistence.*; import java.time.LocalDate; @Data @EqualsAndHashCode @Entity @Table(name = "VEHICLE") public class Vehicle { private static final long serialVersionUID = 1L; @Id @Column(name = "ID", nullable = false) @GeneratedValue(strategy = GenerationType.AUTO) private int id; @Column(name = "type", nullable = false) private String type; @Column(name = "model_code", nullable = false) private String modelCode; @Column(name = "brand_name") private String brandName; @Column(name = "launch_date") private LocalDate launchDate; private transient String formattedDate; // Getter and setter public String getFormattedDate() { return getLaunchDate().toString(); } }
c205d3310f5f4f35f493f3bce6eba0a08e353ec9
ef645ea312daf0b583340bca32d01899283189ff
/maze_solver.ui/src/module-info.java
a4335cfa177714bd634fe706454dc627bd4706b3
[]
no_license
huangdarz/Maze-Solver
7af7c9ef18ee623dcdf0f998aec5e10428525ae4
55ec6e9c33283e2d7b0902d76fe7d32935c3c90f
refs/heads/master
2022-04-27T13:24:38.031725
2020-04-29T19:16:52
2020-04-29T19:16:52
259,996,741
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
module maze.solver.ui { requires javafx.graphics; requires javafx.controls; requires java.desktop; requires javafx.swing; requires maze.solver.search; requires maze.solver.path; exports maze_solver.ui; }
34f2888f6e088b2e2629dd0b7e61439b1ef5032c
997efa7602debb5062de4e64b0897ca5182fbf18
/experiment1/src/main/java/no/hvl/dat250/expass6/experiment1/servingwebcontent/ServingWebContentApplication.java
2654cd4f150de707af3f8753a3386ca9efabf77b
[]
no_license
mhhundvin/Expass6
fb710e95c5f8043ce66666103d8e0fc43b58584c
e8ae701b9bdc254ea87a8605a1a8efe1928738fe
refs/heads/main
2023-08-29T07:03:46.746008
2021-10-06T13:28:43
2021-10-06T13:28:43
414,168,528
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package no.hvl.dat250.expass6.experiment1.servingwebcontent; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ServingWebContentApplication { public static void main(String[] args) { SpringApplication.run(ServingWebContentApplication.class, args); } }
2a5279dd23ab03cb8cd9d220da9ab794d95c6c48
23d8cfa2522499ddad37d4cac5bf5e8c88645cf8
/platforms/android/app/src/main/java/com/obdx/meezan/THSCard/util/PaymentExecutor.java
db03d369b68f5259185b2f0ba14e959753d23883
[]
no_license
yahya960/Card-Digitization
58746470be5f88525c991deef2b4303ae166ecad
8fca30a54a82fd629a4fbc633ffff976c6f9e636
refs/heads/main
2023-09-06T03:47:15.727144
2021-10-28T11:30:08
2021-10-28T11:30:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.obdx.meezan.THSCard.util; import android.os.Handler; import android.os.Looper; import androidx.annotation.NonNull; /** * PaymentExecutor thread executor implementation */ public class PaymentExecutor { private final Handler mainThreadHandler = new Handler(Looper.getMainLooper()); public void execute(@NonNull Runnable command) { mainThreadHandler.post(command); } public void execute(@NonNull Runnable command, long delayMs) { mainThreadHandler.postDelayed(command, delayMs); } public void cancel(@NonNull Runnable command) { mainThreadHandler.removeCallbacks(command); } public void cancelAllPendingOps() { mainThreadHandler.removeCallbacksAndMessages(null); } }
a20a0f1746d7142b05bae6bec144e596f5f38c2d
c4a8bf860a78db78834b601f619fc902978b830f
/TDT4250.assignment.program/src/Program/util/ProgramValidator.java
9505a5d153eb3f1f32f1440e9f6ae4bb83b8b2f5
[]
no_license
HenrikLarsen/TDT4250-A3
de3960e6a844ecd794cce1f0e13fe5b6b35bbc06
90e9140a06ea48133b9992e6d8cb674f51f780c0
refs/heads/master
2020-08-14T01:41:28.506460
2019-10-18T11:13:47
2019-10-18T11:13:47
215,074,282
1
0
null
null
null
null
UTF-8
Java
false
false
10,299
java
/** */ package Program.util; import Program.*; import java.util.Map; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EObjectValidator; /** * <!-- begin-user-doc --> * The <b>Validator</b> for the model. * <!-- end-user-doc --> * @see Program.ProgramPackage * @generated */ public class ProgramValidator extends EObjectValidator { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final ProgramValidator INSTANCE = new ProgramValidator(); /** * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see org.eclipse.emf.common.util.Diagnostic#getSource() * @see org.eclipse.emf.common.util.Diagnostic#getCode() * @generated */ public static final String DIAGNOSTIC_SOURCE = "Program"; /** * A constant with a fixed name that can be used as the base value for additional hand written constants. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0; /** * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ProgramValidator() { super(); } /** * Returns the package of this validator switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EPackage getEPackage() { return ProgramPackage.eINSTANCE; } /** * Calls <code>validateXXX</code> for the corresponding classifier of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) { switch (classifierID) { case ProgramPackage.PROGRAM: return validateProgram((Program)value, diagnostics, context); case ProgramPackage.SPECIALIZATION: return validateSpecialization((Specialization)value, diagnostics, context); case ProgramPackage.SEMESTER: return validateSemester((Semester)value, diagnostics, context); case ProgramPackage.SEMESTER_COURSE: return validateSemesterCourse((SemesterCourse)value, diagnostics, context); case ProgramPackage.COURSE: return validateCourse((Course)value, diagnostics, context); case ProgramPackage.DEPARTMENT: return validateDepartment((Department)value, diagnostics, context); case ProgramPackage.SEMESTER_STATUS: return validateSemesterStatus((SemesterStatus)value, diagnostics, context); case ProgramPackage.COURSE_STATUS: return validateCourseStatus((CourseStatus)value, diagnostics, context); default: return true; } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateProgram(Program program, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate_EveryDefaultConstraint(program, diagnostics, context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateSpecialization(Specialization specialization, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate_EveryDefaultConstraint(specialization, diagnostics, context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateCourse(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) { if (!validate_NoCircularContainment(course, diagnostics, context)) return false; boolean result = validate_EveryMultiplicityConforms(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryDataValueConforms(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryProxyResolves(course, diagnostics, context); if (result || diagnostics != null) result &= validate_UniqueID(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryKeyUnique(course, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(course, diagnostics, context); if (result || diagnostics != null) result &= validateCourse_minCredits(course, diagnostics, context); if (result || diagnostics != null) result &= validateCourse_courseCodeFormat(course, diagnostics, context); return result; } /** * The cached validation expression for the minCredits constraint of '<em>Course</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static final String COURSE__MIN_CREDITS__EEXPRESSION = "self.credit->sum() >= 5.0"; /** * Validates the minCredits constraint of '<em>Course</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateCourse_minCredits(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate (ProgramPackage.Literals.COURSE, course, diagnostics, context, "http://www.eclipse.org/acceleo/query/1.0", "minCredits", COURSE__MIN_CREDITS__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0); } /** * Validates the courseCodeFormat constraint of '<em>Course</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */ public boolean validateCourse_courseCodeFormat(Course course, DiagnosticChain diagnostics, Map<Object, Object> context) { String pattern = "[A-Z]{2,3}[1-9]{4}"; if (!course.getCode().matches(pattern)) { if (diagnostics != null) { diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0, "_UI_GenericConstraint_diagnostic", new Object[] { "courseCodeFormat", getObjectLabel(course, context) }, new Object[] { course }, context)); } return false; } return true; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateDepartment(Department department, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate_EveryDefaultConstraint(department, diagnostics, context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateSemesterStatus(SemesterStatus semesterStatus, DiagnosticChain diagnostics, Map<Object, Object> context) { return true; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateSemester(Semester semester, DiagnosticChain diagnostics, Map<Object, Object> context) { if (!validate_NoCircularContainment(semester, diagnostics, context)) return false; boolean result = validate_EveryMultiplicityConforms(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryDataValueConforms(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryBidirectionalReferenceIsPaired(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryProxyResolves(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_UniqueID(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryKeyUnique(semester, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(semester, diagnostics, context); if (result || diagnostics != null) result &= validateSemester_min30Credits(semester, diagnostics, context); return result; } /** * The cached validation expression for the min30Credits constraint of '<em>Semester</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static final String SEMESTER__MIN30_CREDITS__EEXPRESSION = "self.semesterCourses.course.credit -> sum() >= 30.0"; /** * Validates the min30Credits constraint of '<em>Semester</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateSemester_min30Credits(Semester semester, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate (ProgramPackage.Literals.SEMESTER, semester, diagnostics, context, "http://www.eclipse.org/acceleo/query/1.0", "min30Credits", SEMESTER__MIN30_CREDITS__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateSemesterCourse(SemesterCourse semesterCourse, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate_EveryDefaultConstraint(semesterCourse, diagnostics, context); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateCourseStatus(CourseStatus courseStatus, DiagnosticChain diagnostics, Map<Object, Object> context) { return true; } /** * Returns the resource locator that will be used to fetch messages for this validator's diagnostics. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { // TODO // Specialize this to return a resource locator for messages specific to this validator. // Ensure that you remove @generated or mark it @generated NOT return super.getResourceLocator(); } } //ProgramValidator
f9aef4ec7593f06382cc2e5e9aefddd110a90006
9058d5155b67af4a2b9f6baef9ef33e9c1ba7abf
/U5-A5/Diferentes_Versiones/app/src/main/java/francisco/paniagua/diferentes_versiones/MainActivity.java
9fd28ea56b0ed680b9dc09b7bf3547d6dabb1f2b
[]
no_license
FranciscoPaniagua/Programacion-Mobil
e94e6f42e8d7cae0fcbad358fe46ee5d918f6c61
933603b1c4a8c4db0063942a597db026736837a0
refs/heads/master
2021-09-30T23:40:36.474558
2018-11-26T02:04:06
2018-11-26T02:04:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,725
java
package francisco.paniagua.diferentes_versiones; import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); //Copiar este código TextView texto=(TextView) findViewById(R.id.txtTexto); if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) { texto.setText("dispositivo Lollipop"); }else if(Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1){ texto.setText("dispositivo Lollipop target 22"); } return true; } }
70545ee5eefa849829294bd69836538d704d8832
e64c2201c1cf2adf9197c77aab2676670de9bf4c
/src/main/java/com/zxb/Concurrency/Executors/RejectedExecutionHandlerImpl.java
413b0049e7647c4617f35d8d9974ab849b24e416
[]
no_license
zengxianbing/JavaStudy
45016f3910606988403f16bd1b5f0e60d52de7b2
9a4593cf4b6f79ada4677bdd87a045ff04ee721a
refs/heads/master
2020-04-06T04:29:17.203382
2016-07-04T01:11:47
2016-07-04T01:11:47
62,491,476
0
0
null
null
null
null
UTF-8
Java
false
false
565
java
package com.zxb.Concurrency.Executors; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadPoolExecutor; /** * Title: <br> * <p> * Description: <br> * <p> * Created by zengxianbing on 2016/4/19. * * @author <a href=mailto:[email protected]>曾宪兵</a> */ public class RejectedExecutionHandlerImpl implements RejectedExecutionHandler { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { System.out.println(r.toString()+" is rejected"); } }
4d31f9192da70fa4dcc63c18a3f3589ff656d2f1
ff6358a30f8068a5b30af5e119e26d3782cfeb62
/src/main/java/softuni/mobilelele/init/DataInit.java
423e3280d033d75e2f2a974f82367d227c951fbd
[]
no_license
yavor300/Mobilelele
ce919079f33ed456157f53f524b528b795c713d6
4d96813d396c8f3e3b360d2d91b5a976e38a413c
refs/heads/master
2023-03-06T14:06:04.346055
2021-02-13T16:38:07
2021-02-13T16:38:07
332,311,783
0
0
null
null
null
null
UTF-8
Java
false
false
3,257
java
package softuni.mobilelele.init; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; import softuni.mobilelele.domain.entities.Brand; import softuni.mobilelele.domain.entities.Model; import softuni.mobilelele.domain.entities.User; import softuni.mobilelele.domain.entities.enums.CategoryType; import softuni.mobilelele.repository.BrandRepository; import softuni.mobilelele.repository.ModelRepository; import softuni.mobilelele.repository.UserRepository; import java.time.LocalDateTime; @Component public class DataInit implements CommandLineRunner { private final BrandRepository brandRepository; private final ModelRepository modelRepository; private final PasswordEncoder passwordEncoder; private final UserRepository userRepository; @Autowired public DataInit(BrandRepository brandRepository, ModelRepository modelRepository, PasswordEncoder passwordEncoder, UserRepository userRepository) { this.brandRepository = brandRepository; this.modelRepository = modelRepository; this.passwordEncoder = passwordEncoder; this.userRepository = userRepository; } @Override public void run(String... args) throws Exception { if (brandRepository.count() == 0) { Brand tesla = new Brand(); tesla.setName("Tesla"); tesla.setCreated(LocalDateTime.now()); tesla.setModified(LocalDateTime.now()); brandRepository.saveAndFlush(tesla); Brand porsche = new Brand(); porsche.setName("Porsche"); porsche.setCreated(LocalDateTime.now()); porsche.setModified(LocalDateTime.now()); brandRepository.saveAndFlush(porsche); Model taycan = new Model(); taycan.setCategory(CategoryType.CAR); taycan.setCreated(LocalDateTime.now()); taycan.setEndYear(2021); taycan.setImageUrl("https://cdn.motor1.com/images/mgl/kJWEN/s1/2020-porsche-taycan.jpg"); taycan.setStartYear(2020); taycan.setModified(LocalDateTime.now()); taycan.setName("Taycan"); taycan.setBrand(porsche); modelRepository.saveAndFlush(taycan); Model modelX = new Model(); modelX.setCategory(CategoryType.CAR); modelX.setCreated(LocalDateTime.now()); modelX.setEndYear(2021); modelX.setImageUrl("https://www.tesla.com/sites/default/files/modelsx-new/social/model-x-social.jpg"); modelX.setStartYear(2017); modelX.setModified(LocalDateTime.now()); modelX.setName("Model X"); modelX.setBrand(tesla); modelRepository.saveAndFlush(modelX); } // if (userRepository.count() == 1) { // User admin = new User(); // admin.setFirstName("Peter"); // admin.setLastName("Dimitrov"); // admin.setUsername("admin"); // admin.setPassword(passwordEncoder.encode("topsecret")); // userRepository.saveAndFlush(admin); // } } }
6b3eab7383d5fdf7e1c284f17fdfcf0b046f3a30
7a30b457f0c2b7fc278eb3e1e98be08d363c6af7
/defaultSample/src/main/java/jhipster/reactive/web/rest/UserResource.java
77323a800159b5abfe2b744371fdfc86344d00cd
[]
no_license
juliensadaoui/webflux-jhipster
dc3cc76fed7c8a261f9fc984c3ffdb448e278e46
2eba126fe877897837da07775af18c95f9606a30
refs/heads/master
2020-12-03T01:58:01.998434
2017-06-30T07:55:36
2017-06-30T07:55:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,876
java
package jhipster.reactive.web.rest; import jhipster.reactive.config.Constants; import com.codahale.metrics.annotation.Timed; import jhipster.reactive.domain.User; import jhipster.reactive.repository.UserRepository; import jhipster.reactive.security.AuthoritiesConstants; import jhipster.reactive.service.MailService; import jhipster.reactive.service.UserService; import jhipster.reactive.service.dto.UserDTO; import jhipster.reactive.web.rest.vm.ManagedUserVM; import jhipster.reactive.web.rest.util.HeaderUtil; import jhipster.reactive.web.rest.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; import io.swagger.annotations.ApiParam; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.*; /** * REST controller for managing users. * * <p>This class accesses the User entity, and needs to fetch its collection of authorities.</p> * <p> * For a normal use-case, it would be better to have an eager relationship between User and Authority, * and send everything to the client side: there would be no View Model and DTO, a lot less code, and an outer-join * which would be good for performance. * </p> * <p> * We use a View Model and a DTO for 3 reasons: * <ul> * <li>We want to keep a lazy association between the user and the authorities, because people will * quite often do relationships with the user, and we don't want them to get the authorities all * the time for nothing (for performance reasons). This is the #1 goal: we should not impact our users' * application because of this use-case.</li> * <li> Not having an outer join causes n+1 requests to the database. This is not a real issue as * we have by default a second-level cache. This means on the first HTTP call we do the n+1 requests, * but then all authorities come from the cache, so in fact it's much better than doing an outer join * (which will get lots of data from the database, for each HTTP call).</li> * <li> As this manages users, for security reasons, we'd rather have a DTO layer.</li> * </ul> * <p>Another option would be to have a specific JPA entity graph to handle this case.</p> */ @RestController @RequestMapping("/api") public class UserResource { private final Logger log = LoggerFactory.getLogger(UserResource.class); private static final String ENTITY_NAME = "userManagement"; private final UserRepository userRepository; private final MailService mailService; private final UserService userService; public UserResource(UserRepository userRepository, MailService mailService, UserService userService) { this.userRepository = userRepository; this.mailService = mailService; this.userService = userService; } /** * POST /users : Creates a new user. * <p> * Creates a new user if the login and email are not already used, and sends an * mail with an activation link. * The user needs to be activated on creation. * </p> * * @param managedUserVM the user to create * @return the ResponseEntity with status 201 (Created) and with body the new user, or with status 400 (Bad Request) if the login or email is already in use * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/users") @Timed @Secured(AuthoritiesConstants.ADMIN) public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM) throws URISyntaxException { log.debug("REST request to save User : {}", managedUserVM); if (managedUserVM.getId() != null) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "idexists", "A new user cannot already have an ID")) .body(null); // Lowercase the user login before comparing with database } else if (userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase()).isPresent()) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "userexists", "Login already in use")) .body(null); } else if (userRepository.findOneByEmail(managedUserVM.getEmail()).isPresent()) { return ResponseEntity.badRequest() .headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use")) .body(null); } else { User newUser = userService.createUser(managedUserVM); mailService.sendCreationEmail(newUser); return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin())) .headers(HeaderUtil.createAlert( "A user is created with identifier " + newUser.getLogin(), newUser.getLogin())) .body(newUser); } } /** * PUT /users : Updates an existing User. * * @param managedUserVM the user to update * @return the ResponseEntity with status 200 (OK) and with body the updated user, * or with status 400 (Bad Request) if the login or email is already in use, * or with status 500 (Internal Server Error) if the user couldn't be updated */ @PutMapping("/users") @Timed @Secured(AuthoritiesConstants.ADMIN) public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody ManagedUserVM managedUserVM) { log.debug("REST request to update User : {}", managedUserVM); Optional<User> existingUser = userRepository.findOneByEmail(managedUserVM.getEmail()); if (existingUser.isPresent() && (!existingUser.get().getId().equals(managedUserVM.getId()))) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use")).body(null); } existingUser = userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase()); if (existingUser.isPresent() && (!existingUser.get().getId().equals(managedUserVM.getId()))) { return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "userexists", "Login already in use")).body(null); } Optional<UserDTO> updatedUser = userService.updateUser(managedUserVM); return ResponseUtil.wrapOrNotFound(updatedUser, HeaderUtil.createAlert("A user is updated with identifier " + managedUserVM.getLogin(), managedUserVM.getLogin())); } /** * GET /users : get all users. * * @param pageable the pagination information * @return the ResponseEntity with status 200 (OK) and with body all users */ @GetMapping("/users") @Timed public ResponseEntity<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable) { final Page<UserDTO> page = userService.getAllManagedUsers(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * @return a string list of the all of the roles */ @GetMapping("/users/authorities") @Timed @Secured(AuthoritiesConstants.ADMIN) public List<String> getAuthorities() { return userService.getAuthorities(); } /** * GET /users/:login : get the "login" user. * * @param login the login of the user to find * @return the ResponseEntity with status 200 (OK) and with body the "login" user, or with status 404 (Not Found) */ @GetMapping("/users/{login:" + Constants.LOGIN_REGEX + "}") @Timed public ResponseEntity<UserDTO> getUser(@PathVariable String login) { log.debug("REST request to get User : {}", login); return ResponseUtil.wrapOrNotFound( userService.getUserWithAuthoritiesByLogin(login) .map(UserDTO::new)); } /** * DELETE /users/:login : delete the "login" User. * * @param login the login of the user to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/users/{login:" + Constants.LOGIN_REGEX + "}") @Timed @Secured(AuthoritiesConstants.ADMIN) public ResponseEntity<Void> deleteUser(@PathVariable String login) { log.debug("REST request to delete User: {}", login); userService.deleteUser(login); return ResponseEntity.ok().headers(HeaderUtil.createAlert( "A user is deleted with identifier " + login, login)).build(); } }
a8a45aff7ee6c58ecc59250d03861749a63c9a44
78eefc3c6e830a126cd14bf4111476062b8ba631
/src/rars/riscv/instructions/FMULD.java
4781d9e75d9ce79b50cfc235c9c2ad64e83a11c6
[ "MIT" ]
permissive
TheThirdOne/rars
ffb9514465ea7d59cf473ecb7e2395a037866d07
a529a70b5cd1bd699f98f5749d34a9eba8232890
refs/heads/master
2023-09-01T20:12:26.864849
2023-07-04T19:11:36
2023-07-04T19:11:36
92,457,409
983
214
NOASSERTION
2023-09-13T06:20:57
2017-05-26T00:57:20
Java
UTF-8
Java
false
false
415
java
package rars.riscv.instructions; import jsoftfloat.Environment; import jsoftfloat.types.Float64; public class FMULD extends Double { public FMULD() { super("fmul.d", "Floating MULtiply (64 bit): assigns f1 to f2 * f3", "0001001"); } @Override public Float64 compute(Float64 f1, Float64 f2, Environment e) { return jsoftfloat.operations.Arithmetic.multiplication(f1,f2,e); } }
79d4d1c1ee26f72b49a56cd729a77562ef5eedc6
6c78507cefba02131426935aa7e00fce4a5f9eb2
/src/WSDidattica/src/java/nu/mine/egoless/didattica/ws/WSDidatticaException.java
aa83870c00b61836a5a4e4cddd37690c13ce6417
[]
no_license
egoless/pqs
1a1b048bfe194d40ac0d6f9e72b0c33a9675cf50
1733d0b0c6e4b02d19f234dd8c50ad122dcd0fce
refs/heads/master
2021-01-02T09:31:57.205973
2012-06-26T18:35:40
2012-06-26T18:35:40
4,742,809
1
0
null
null
null
null
UTF-8
Java
false
false
777
java
/* * Nome file:WSDidatticaException.java * Data creazione: 08 marzo 2007, 10.54 * Info svn: $Id: WSDidatticaException.java 164 2007-03-10 12:59:59Z eric $ */ package nu.mine.egoless.didattica.ws; import java.lang.Exception; /** * Eccezione creata ad hoc per segnalare all'APP-DIDATTICA quali problemi sono * occorsi a livello del WSDidattica */ public class WSDidatticaException extends Exception { /** * Crea una nuova istanza dell'Eccezione */ public WSDidatticaException() { } /** * Constructs an instance of <code>WSDidatticaException</code> with * the specified detail message. * @param msg the detail message. */ public WSDidatticaException(String msg) { super(msg); } }
940a795112ccbebbb06f3169171c6d4a8576d1cd
e80af7e7c2e3a1585211c66828d7b683fe6527e4
/src/innerClassUse/DotNew.java
093a631a5910c799c8e372b2b365a5f634bbaacb
[]
no_license
kangkang94/JVM
9806a22cdc09eb289db3c198cc8d8d451eb192b2
eb5af2c18dd04dda976298ba09bbb484dacb17ec
refs/heads/master
2021-01-19T00:21:24.818355
2017-09-29T01:51:08
2017-09-29T01:51:08
87,160,835
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
package innerClassUse; /** * Created by kang on 17/4/18. */ public class DotNew { public class Inner{ public Inner(int i){ System.out.println(i); } } //产生内部类 public Inner getInner(){ return new Inner(1); } public static void main(String[] args) { DotNew dotNew = new DotNew(); DotNew.Inner inner = dotNew.new Inner(2); dotNew.getInner(); } }
c248c9b1b065a82fda2378546e9d4a0532a0e7bd
c4343ca206aca18e59249c654566b53700d0c252
/src/com/vikisolutions/www/EnumerationsDocumentType.java
2cccff97d6ea21add33427c55926dc058e47797e
[]
no_license
go2irfankhan/VikiSalesforce
961389a42ede1c430d6301894cc61e2ee2cb67d8
612333d2959a8dbb4daa8287aa943108eacbebd0
refs/heads/master
2021-01-25T10:15:14.157756
2015-08-04T11:49:34
2015-08-04T11:49:34
40,128,140
0
0
null
null
null
null
UTF-8
Java
false
false
21,142
java
/** * EnumerationsDocumentType.java * * This file was auto-generated from WSDL * by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:34:40 IST) */ package com.vikisolutions.www; /** * EnumerationsDocumentType bean class */ @SuppressWarnings({"unchecked","unused"}) public class EnumerationsDocumentType implements org.apache.axis2.databinding.ADBBean{ public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( "http://www.vikisolutions.com/", "EnumerationsDocumentType", "ns1"); /** * field for EnumerationsDocumentType */ protected java.lang.String localEnumerationsDocumentType ; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected EnumerationsDocumentType(java.lang.String value, boolean isRegisterValue) { localEnumerationsDocumentType = value; if (isRegisterValue){ _table_.put(localEnumerationsDocumentType, this); } } public static final java.lang.String _Proof = org.apache.axis2.databinding.utils.ConverterUtil.convertToString("Proof"); public static final java.lang.String _Reference = org.apache.axis2.databinding.utils.ConverterUtil.convertToString("Reference"); public static final EnumerationsDocumentType Proof = new EnumerationsDocumentType(_Proof,true); public static final EnumerationsDocumentType Reference = new EnumerationsDocumentType(_Reference,true); public java.lang.String getValue() { return localEnumerationsDocumentType;} public boolean equals(java.lang.Object obj) {return (obj == this);} public int hashCode() { return toString().hashCode();} public java.lang.String toString() { return localEnumerationsDocumentType.toString(); } /** * * @param parentQName * @param factory * @return org.apache.axiom.om.OMElement */ public org.apache.axiom.om.OMElement getOMElement ( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) throws org.apache.axis2.databinding.ADBException{ org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this,MY_QNAME); return factory.createOMElement(dataSource,MY_QNAME); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ serialize(parentQName,xmlWriter,false); } public void serialize(final javax.xml.namespace.QName parentQName, javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType) throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it java.lang.String namespace = parentQName.getNamespaceURI(); java.lang.String _localName = parentQName.getLocalPart(); writeStartElement(null, namespace, _localName, xmlWriter); // add the type details if this is used in a simple type if (serializeType){ java.lang.String namespacePrefix = registerPrefix(xmlWriter,"http://www.vikisolutions.com/"); if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)){ writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", namespacePrefix+":EnumerationsDocumentType", xmlWriter); } else { writeAttribute("xsi","http://www.w3.org/2001/XMLSchema-instance","type", "EnumerationsDocumentType", xmlWriter); } } if (localEnumerationsDocumentType==null){ throw new org.apache.axis2.databinding.ADBException("EnumerationsDocumentType cannot be null !!"); }else{ xmlWriter.writeCharacters(localEnumerationsDocumentType); } xmlWriter.writeEndElement(); } private static java.lang.String generatePrefix(java.lang.String namespace) { if(namespace.equals("http://www.vikisolutions.com/")){ return "ns1"; } return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } /** * Utility method to write an element start tag. */ private void writeStartElement(java.lang.String prefix, java.lang.String namespace, java.lang.String localPart, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String writerPrefix = xmlWriter.getPrefix(namespace); if (writerPrefix != null) { xmlWriter.writeStartElement(namespace, localPart); } else { if (namespace.length() == 0) { prefix = ""; } else if (prefix == null) { prefix = generatePrefix(namespace); } xmlWriter.writeStartElement(prefix, localPart, namespace); xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } } /** * Util method to write an attribute with the ns prefix */ private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); } /** * Util method to write an attribute without the ns prefix */ private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } } /** * Util method to write an attribute without the ns prefix */ private void writeQNameAttribute(java.lang.String namespace, java.lang.String attName, javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String attributeNamespace = qname.getNamespaceURI(); java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace); if (attributePrefix == null) { attributePrefix = registerPrefix(xmlWriter, attributeNamespace); } java.lang.String attributeValue; if (attributePrefix.trim().length() > 0) { attributeValue = attributePrefix + ":" + qname.getLocalPart(); } else { attributeValue = qname.getLocalPart(); } if (namespace.equals("")) { xmlWriter.writeAttribute(attName, attributeValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace, attName, attributeValue); } } /** * method to handle Qnames */ private void writeQName(javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { java.lang.String namespaceURI = qname.getNamespaceURI(); if (namespaceURI != null) { java.lang.String prefix = xmlWriter.getPrefix(namespaceURI); if (prefix == null) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } else { // i.e this is the default namespace xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } else { xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname)); } } private void writeQNames(javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException { if (qnames != null) { // we have to store this data until last moment since it is not possible to write any // namespace data after writing the charactor data java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); java.lang.String namespaceURI = null; java.lang.String prefix = null; for (int i = 0; i < qnames.length; i++) { if (i > 0) { stringToWrite.append(" "); } namespaceURI = qnames[i].getNamespaceURI(); if (namespaceURI != null) { prefix = xmlWriter.getPrefix(namespaceURI); if ((prefix == null) || (prefix.length() == 0)) { prefix = generatePrefix(namespaceURI); xmlWriter.writeNamespace(prefix, namespaceURI); xmlWriter.setPrefix(prefix,namespaceURI); } if (prefix.trim().length() > 0){ stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } else { stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i])); } } xmlWriter.writeCharacters(stringToWrite.toString()); } } /** * Register a namespace prefix */ private java.lang.String registerPrefix(javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace) throws javax.xml.stream.XMLStreamException { java.lang.String prefix = xmlWriter.getPrefix(namespace); if (prefix == null) { prefix = generatePrefix(namespace); javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext(); while (true) { java.lang.String uri = nsContext.getNamespaceURI(prefix); if (uri == null || uri.length() == 0) { break; } prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); } xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } return prefix; } /** * databinding method to get an XML representation of this object * */ public javax.xml.stream.XMLStreamReader getPullParser(javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException{ //We can safely assume an element has only one type associated with it return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(MY_QNAME, new java.lang.Object[]{ org.apache.axis2.databinding.utils.reader.ADBXMLStreamReader.ELEMENT_TEXT, org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localEnumerationsDocumentType) }, null); } /** * Factory class that keeps the parse method */ public static class Factory{ public static EnumerationsDocumentType fromValue(java.lang.String value) throws java.lang.IllegalArgumentException { EnumerationsDocumentType enumeration = (EnumerationsDocumentType) _table_.get(value); if ((enumeration == null) && !((value == null) || (value.equals("")))) { throw new java.lang.IllegalArgumentException(); } return enumeration; } public static EnumerationsDocumentType fromString(java.lang.String value,java.lang.String namespaceURI) throws java.lang.IllegalArgumentException { try { return fromValue(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(value)); } catch (java.lang.Exception e) { throw new java.lang.IllegalArgumentException(); } } public static EnumerationsDocumentType fromString(javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) { if (content.indexOf(":") > -1){ java.lang.String prefix = content.substring(0,content.indexOf(":")); java.lang.String namespaceUri = xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix); return EnumerationsDocumentType.Factory.fromString(content,namespaceUri); } else { return EnumerationsDocumentType.Factory.fromString(content,""); } } /** * static method to create the object * Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable * If this object is not an element, it is a complex type and the reader is at the event just after the outer start element * Postcondition: If this object is an element, the reader is positioned at its end element * If this object is a complex type, the reader is positioned at the end element of its outer element */ public static EnumerationsDocumentType parse(javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception{ EnumerationsDocumentType object = null; // initialize a hash map to keep values java.util.Map attributeMap = new java.util.HashMap(); java.util.List extraAttributeList = new java.util.ArrayList<org.apache.axiom.om.OMAttribute>(); int event; java.lang.String nillableValue = null; java.lang.String prefix =""; java.lang.String namespaceuri =""; try { while (!reader.isStartElement() && !reader.isEndElement()) reader.next(); // Note all attributes that were handled. Used to differ normal attributes // from anyAttributes. java.util.Vector handledAttributes = new java.util.Vector(); while(!reader.isEndElement()) { if (reader.isStartElement() || reader.hasText()){ nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance","nil"); if ("true".equals(nillableValue) || "1".equals(nillableValue)){ throw new org.apache.axis2.databinding.ADBException("The element: "+"EnumerationsDocumentType" +" cannot be null"); } java.lang.String content = reader.getElementText(); if (content.indexOf(":") > 0) { // this seems to be a Qname so find the namespace and send prefix = content.substring(0, content.indexOf(":")); namespaceuri = reader.getNamespaceURI(prefix); object = EnumerationsDocumentType.Factory.fromString(content,namespaceuri); } else { // this seems to be not a qname send and empty namespace incase of it is // check is done in fromString method object = EnumerationsDocumentType.Factory.fromString(content,""); } } else { reader.next(); } } // end of while loop } catch (javax.xml.stream.XMLStreamException e) { throw new java.lang.Exception(e); } return object; } }//end of factory class }
9d697b351feca861c84938f721c43b4bf0b6fb1d
eae576961cbe7d20fbce29e9853454bc2aeaad26
/src/br/com/linkcom/sgm/beans/RequisitoNorma.java
2039454e33222c3038490d991959dfcd30f19394
[]
no_license
ardolazarini/geplanes
81d8ab79f86c2dc27c8204fca1a45a799188f3c4
c1ea5fc1c848dd03875616a9b6cf078cec429254
refs/heads/master
2020-12-25T22:48:34.361010
2012-02-13T20:07:53
2012-02-13T20:07:53
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,872
java
/* Copyright 2007,2008,2009,2010 da Linkcom Informática Ltda Este arquivo é parte do programa GEPLANES. O GEPLANES é software livre; você pode redistribuí-lo e/ou modificá-lo sob os termos da Licença Pública Geral GNU, conforme publicada pela Free Software Foundation; tanto a versão 2 da Licença como (a seu critério) qualquer versão mais nova. Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais detalhes. Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ package br.com.linkcom.sgm.beans; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Transient; import br.com.linkcom.neo.bean.annotation.DescriptionProperty; import br.com.linkcom.neo.bean.annotation.DisplayName; import br.com.linkcom.neo.validation.annotation.MaxLength; import br.com.linkcom.neo.validation.annotation.Required; @Entity @SequenceGenerator(name = "sq_requisitonorma", sequenceName = "sq_requisitonorma") public class RequisitoNorma implements Comparable<RequisitoNorma> { private Integer id; private Norma norma; private String descricao; private String indice; //=========================Get e Set==================================// @Id @GeneratedValue(strategy=GenerationType.AUTO, generator="sq_requisitonorma") public Integer getId() { return id; } @Required @ManyToOne(fetch=FetchType.LAZY) public Norma getNorma() { return norma; } @MaxLength(500) @DisplayName("Descrição") @Required public String getDescricao() { return descricao; } @MaxLength(20) @DisplayName("Índice") @Required public String getIndice() { return indice; } public void setId(Integer id) { this.id = id; } public void setNorma(Norma norma) { this.norma = norma; } public void setDescricao(String descricao) { this.descricao = descricao; } public void setIndice(String indice) { this.indice = indice; } @Transient @DescriptionProperty public String getDescricaoCompleta() { return indice + " " + (descricao != null && descricao.length() > 80 ? descricao.substring(0, 80) + "..." : descricao); } public int compareTo(RequisitoNorma that) { if (this.getIndice() != null && that.getIndice() != null) { String[] thisFields = this.getIndice().split("\\."); String[] thatFields = that.getIndice().split("\\."); Integer thisField; Integer thatField; int count = thisFields.length < thatFields.length ? thisFields.length : thatFields.length; for (int i = 0; i < count; i++) { try { thisField = Integer.parseInt(thisFields[i]); } catch (NumberFormatException e) { thisField = (int) thisFields[i].charAt(0); } try { thatField = Integer.parseInt(thatFields[i]); } catch (NumberFormatException e) { thatField = (int) thatFields[i].charAt(0); } if (thisField.compareTo(thatField) != 0) { return thisField.compareTo(thatField); } } // Caso os pedaços comparados sejam iguais, o menor número é o que tiver menor quantidade de pedaços. // Ex: 1 < 1.1 return thisFields.length < thatFields.length ? -1 : 1; } return 0; } }
71ed628fdc6ec0f902e2f863420de448f917f9bd
888ea10f52f23717ab7ad1444a5d0e85bfce8bcb
/common/src/test/java/natalia/dymnikova/util/sequence/SequenceTest.java
1bd61beced7c47688a3887197e7fb14254b2e01d
[ "MIT" ]
permissive
NataliaDymnikova/akka.scheduler
56a88afe868673c1e9130b45b7e9f586dc1834b1
c857eadf0ecad2b0e5051d4625abd13f8f8bebee
refs/heads/master
2021-01-10T15:52:44.717006
2016-05-06T16:30:08
2016-05-06T16:30:08
49,160,571
1
1
null
2016-01-06T22:13:55
2016-01-06T20:46:16
Java
UTF-8
Java
false
false
2,059
java
// Copyright (c) 2016 Natalia Dymnikova // Available via the MIT license // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, // and to permit persons to whom the Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE // OR OTHER DEALINGS IN THE SOFTWARE. package natalia.dymnikova.util.sequence; import org.junit.Test; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; public class SequenceTest { @Test public void shouldReturnFirstElement() throws Exception { final Element last = Sequence.sequence(10, 98, 10).findFirst().get(); assertThat( last, is(new Element(10, 20)) ); } @Test public void shouldReturnLastElement() throws Exception { final Element last = Sequence.sequence(10, 98, 10).reduce((a, b) -> b).get(); assertThat( last, is(new Element(90, 98)) ); } @Test public void shouldReturnSingleElement() throws Exception { final Element last = Sequence.sequence(10, 18, 10).reduce((a, b) -> b).get(); assertThat( last, is(new Element(10, 18)) ); } }
b036f8ac7e8cdf46345a4eabe11b038e5093e534
c4e33542d65b2d55e98b4a177876f50c0c3b13b9
/Practice1Project/src/com/anil/practice/StrPgm1.java
4dba130841f0285a30a5741dcdc0f67d077aa897
[]
no_license
anilfelix/GeneralPractice
7dbc20ba4731025b9c47fb4cae5a485cd4c63572
0f85af2776aeb2c882a9418c956d6322901dca19
refs/heads/master
2021-01-01T05:49:37.506969
2015-09-06T08:41:28
2015-09-06T08:41:28
41,995,261
0
0
null
null
null
null
UTF-8
Java
false
false
674
java
package com.anil.practice; /** * Created by This1 on 25/08/2015. */ public class StrPgm1 { public static void main(String[] args) { String s1 = "this is string 1 "; System.out.println(s1); String s2 = new String("this is string 2"); System.out.println(s2); String s3 = "Shirt Size"; String s4 = ": M"; String s5 = s3 + s4 + " of bro " + "1234"; System.out.println(s5); char[] c1 = {'H', 'e', 'l', 'l', 'o'}; String sc1 = new String(c1); System.out.println(sc1); char[] c2 = sc1.toCharArray(); for(char x : c2) System.out.print(x); } }
a9a405f35e7131d34a019cf91bcc39fcbd54efbd
eb225ababb916153c3aa97b03252ad104095b48b
/src/test/java/com/SmartCredit/HomePage_SmartCredit_page.java
a1b40dbde6742e5f44d00be021229f01cb8edac8
[]
no_license
Durga-rao-123/POM-With-BDD-Cucumber-
32a264ce0fde599ce0b3f4338da1231d18ba5ca1
da0ada8a07a02cbfe34d25cf246f0ee98566d542
refs/heads/master
2022-12-29T07:26:38.234176
2020-05-29T10:25:05
2020-05-29T10:25:05
267,766,625
0
0
null
2020-10-13T22:25:01
2020-05-29T04:42:02
Java
UTF-8
Java
false
false
561
java
package com.SmartCredit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; public class HomePage_SmartCredit_page { WebDriver driver; @FindBy(xpath = "//span[contains(text(),'Add a New Client')]") WebElement clickOnAddNewClient; public HomePage_SmartCredit_page(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } public void clickon_AddnewClient() { clickOnAddNewClient.click(); } }
5c7e10dad594b3fcc2465e667b6d3e0fbad80cfb
93959684aee0860b5995eb1fd0ed64a81a8ac11b
/Evaluate_bool.java
c22fd0a8a830da091167d378e35f50bea22e25fd
[]
no_license
NITJal/15103085homew2
1b18c4ebb48e46f18cb847f94c787fcd7e6ffb8a
d5f13882b98303858770628c20adaff15a7d4584
refs/heads/master
2021-07-07T05:25:57.956200
2017-10-02T15:31:14
2017-10-02T15:31:14
105,550,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
package assignment2; import java.util.Scanner; interface boolExpression { int TRUE =1 ; int FALSE=0; char AND= 'A'; char OR='B'; public static boolean EvaluateExpression(StringBuffer s); } public class Evaluate_bool implements boolExpression { static boolean EvaluateExpression(StringBuffer s) { int n=s.length(); for(int i=0;i<n;i+=2) { if(i+1<n && i+2<n) { if(s.charAt(i+1)=='A'){ if(s.charAt(i+2)=='0'||s.charAt(i)=='0') { s.setCharAt(i+2,'0'); } else s.setCharAt(i+2,'1'); } else if((i+1)<n &&s.charAt(i+1)=='B') { if(s.charAt(i+2)=='1'||s.charAt(i)=='1') s.setCharAt(i+2, '1'); else s.setCharAt(i+2, '0'); } } } System.out.println (s.charAt(n-1)-'0'); int c=s.charAt(n-1)-'0'; if(c==1){ System.out.println( "true"); boolean b= true; return b; } else if(c==0) { System.out.println("false"); boolean b= false; return b; } } public static void main(String args[]){ Scanner sc= new Scanner(System.in); String exp=sc.next(); StringBuffer sb= new StringBuffer(exp); boolean d; d=EvaluateExpression(sb); System.out.println(d); sc.close(); } }
c99b0a0fc483c7a70155e53d18efa46d5738849a
6505a589029e750dd94774d55ca71d0886da26bd
/src/ssn/ws/jaxws/GetEventsHistoryByUser.java
7d9c994faee53813bf223d53973c59022663460d
[]
no_license
bergacat1/SSN_WS
3db258661e6f8ee6ca36c4e026efd4cbf0fb7ad1
a03ce15d53ab26855a7016fd594cdbb7a0efeb9a
refs/heads/master
2016-08-11T21:36:22.023560
2016-01-18T19:00:38
2016-01-18T19:00:38
47,343,463
0
0
null
null
null
null
UTF-8
Java
false
false
841
java
package ssn.ws.jaxws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * This class was generated by Apache CXF 2.7.11.redhat-3 * Sat Jan 09 18:29:29 CET 2016 * Generated source version: 2.7.11.redhat-3 */ @XmlRootElement(name = "getEventsHistoryByUser", namespace = "http://ws.ssn/") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getEventsHistoryByUser", namespace = "http://ws.ssn/") public class GetEventsHistoryByUser { @XmlElement(name = "iduser") private int iduser; public int getIduser() { return this.iduser; } public void setIduser(int newIduser) { this.iduser = newIduser; } }
fa8944d5a3cf4aa964e9160af77b89cfaaa69d79
ef5295e64ceea1d2b231501c7b542032a0450b8d
/src/main/java/aula20201112/modeloOOMercadoPersistente/produto/ProdutoRepository.java
9cfc24a8512a77d5a459ce15fb0b27ed51ec0898
[]
no_license
beatrizferraz/esoft4s2020
43422677cab5387658827cad812cf97926a789c1
494a12eff266ce5c539e19d33f00edbd1b7f2d61
refs/heads/master
2023-01-23T06:11:37.886021
2020-12-04T06:53:23
2020-12-04T06:53:23
286,868,982
0
0
null
2020-11-18T00:36:23
2020-08-11T23:26:39
Java
UTF-8
Java
false
false
203
java
package aula20201112.modeloOOMercadoPersistente.produto; import org.springframework.data.jpa.repository.JpaRepository; public interface ProdutoRepository extends JpaRepository<Produto, String>{ }
b406b0ac3fe0d0d5ef545f5cb276b6e4352a93db
3d13fae219904183daa81ec7097a1e348b74859c
/Android-Movie-Catalogue-Submission-3/app/src/main/java/com/premankoding/mcd3/viewmodel/MovieViewModel.java
ccf3302d4e0b5d4987b24c9af6d0dfda50f8bf6b
[]
no_license
shandysiswandi/Learning-Dicoding
906d9edff4f992c4d1623e188a4357009934e9c5
3d86cb0a45402d9d25eda036e369c4e17b82ee20
refs/heads/master
2022-10-22T01:02:47.897355
2020-06-11T07:22:41
2020-06-11T07:22:41
271,473,265
0
0
null
null
null
null
UTF-8
Java
false
false
1,364
java
package com.premankoding.mcd3.viewmodel; import androidx.annotation.NonNull; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import com.premankoding.mcd3.model.MovieModelFrame; import com.premankoding.mcd3.service.APIClient; import com.premankoding.mcd3.service.Config; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; public class MovieViewModel extends ViewModel { private MutableLiveData<MovieModelFrame> movieResult; public void setMovieResult(){ if (movieResult != null){ return; } movieResult = new MutableLiveData<>(); APIClient apiClient = Config.getApiClient(); apiClient.getMovie().enqueue(new Callback<MovieModelFrame>() { @Override public void onResponse(@NonNull Call<MovieModelFrame> call, @NonNull Response<MovieModelFrame> response) { if(response.isSuccessful()){ movieResult.setValue(response.body()); } } @Override public void onFailure(@NonNull Call<MovieModelFrame> call, @NonNull Throwable t) { movieResult.setValue(null); } }); } public LiveData<MovieModelFrame> getMovieResult() { return movieResult; } }
cf84dfde73b9bf85129281168c83d334f161a751
62257eb8aca473ec5d0b2a0bfe22f12e00e5c5a8
/Exam-6-final-jdbc-uml/UML..UML/AbdullahEvedence/Inventory/src/inventory/Main.java
58513f8f1ebd1321aaeca908d47ff807cb3847b5
[]
no_license
springapidev/uml
e29bacdbf67748adfa5eadba2cabbaebca4e369a
6f59f1c34dd35428f032faa006b9733138960c0a
refs/heads/master
2021-10-01T00:09:13.491179
2018-11-26T06:50:51
2018-11-26T06:50:51
112,941,252
0
1
null
null
null
null
UTF-8
Java
false
false
299
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inventory; /** * * @author Administrator */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { } }
f64be5b249c01efc13a7f6fb8e2a0f79c4d0b8c3
7230397ff76798f4e2e5ea4ad2227a1c02fe3a80
/src/main/java/com/sapient/test/validator/ValidationRule.java
3e2329badad860d8d1dfd0a978c8f464fdf60f22
[]
no_license
tddfan/credit-card-system-server
f3b2b6d0df0e6c53d5466112f1d6971dfc4c3004
709297c88a501d8526611ef4fba7665e6517cee6
refs/heads/master
2020-03-28T00:32:00.899849
2018-09-06T20:42:17
2018-09-06T20:42:17
147,426,359
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.sapient.test.validator; import com.sapient.test.entity.ValidationResultItem; public interface ValidationRule<T> { public ValidationResultItem validate(T entity); }
dd629533ecca3af8f6a00cf8a02c7f1c20c892b5
da3789801a0ef838f5a92c3170073b4a793f043a
/src/main/java/com/aerospace/service/ils/AbstractProtocolConnector.java
c792dccf1bee0fe460d34388849f0ca86d91860f
[]
no_license
reachrama/coupon-service
7b99eb14671c3a74d181cac956f6ec25f2cf0fec
39f076379093a6f253adaa033f916d4e4fefabd4
refs/heads/master
2023-01-18T19:27:20.770827
2020-11-16T21:28:22
2020-11-16T21:28:22
266,461,739
0
0
null
null
null
null
UTF-8
Java
false
false
651
java
package com.aerospace.service.ils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Configurable; import com.aerospace.service.sip.ILSConfiguration; public abstract class AbstractProtocolConnector { private final ILSConfiguration ilsConfiguration; @Autowired public AbstractProtocolConnector(ILSConfiguration ilsConfiguration) { this.ilsConfiguration = ilsConfiguration; } public abstract boolean supports(String s); public abstract String lookupItem(String itemIdentifier); public String getHost() { return ilsConfiguration.getUrl().get("nypl"); } }
1c03ed0c2c67dbd7cf95d9aee153fdc6b7af0c4f
d59381d990eec206e7b001979714bac2d3da415e
/app/src/main/java/com/cb/basic/base/api/BaseApi.java
036eaf27ca0df84c7576da6d93051f1becb84276
[]
no_license
thatCbin/Basic
56af101f0a6bf2937385a0b5e8609eeb55b75476
105c35016198dd2ae6eecb666153d5467aa703b1
refs/heads/master
2020-12-02T15:09:15.821595
2020-03-17T10:11:44
2020-03-17T10:11:44
231,044,780
2
0
null
null
null
null
UTF-8
Java
false
false
1,211
java
package com.cb.basic.base.api; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory; /** * create date on 2019/12/31 * * @author Cbin * describe 封装基础的Retrofit */ public abstract class BaseApi { /** * 初始化Retrofit */ public Retrofit initRetrofit(String baseUrl) { Retrofit.Builder builder = new Retrofit.Builder(); //支持返回Call<String> builder.addConverterFactory(ScalarsConverterFactory.create()); //支持直接格式化json返回Bean对象 builder.addConverterFactory(GsonConverterFactory.create()); //支持RxJava builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create()); builder.baseUrl(baseUrl); OkHttpClient client = setClient(); if (client != null) { builder.client(client); } return builder.build(); } /** * 设置OkHttpClient,添加拦截器等 * * @return 可以返回为null */ protected abstract OkHttpClient setClient(); }
86bf6efe945b5f739caac6bd60be286c8cbcee99
3f75a467fe14abb74e3cf687acec0b3f124d5022
/MVC_Musica (3)/MVC_Musica/src/Modelo/CancionDAO.java
576395476a3e8c8fd36301167e1bbc8e8a12ba7c
[]
no_license
Arely-Paulina/Discography-System
5795522881945e605112b1681193b74e663156d1
67c6d605f8dfabeb0e5c54d7c5e46f0653a8ed25
refs/heads/main
2023-07-21T20:52:20.669044
2021-09-07T21:36:24
2021-09-07T21:36:24
374,263,915
1
0
null
null
null
null
UTF-8
Java
false
false
5,569
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Modelo; import Modelo.Cancion; import Modelo.ConexionSQL; import java.awt.HeadlessException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; /** * * @author HP */ public class CancionDAO { private ConexionSQL cc; private Connection cn; public CancionDAO() { cc=new ConexionSQL(); cn= cc.GetConexion(); } public int UltimoRegistro(){ int valor=0; try{ String SQL="SELECT MAX(idCancion) AS idCancion FROM Cancion"; Statement st=cn.createStatement(); ResultSet rs=st.executeQuery(SQL); if(rs!=null){ rs.next(); valor=rs.getInt(1); } }catch(Exception e){ JOptionPane.showMessageDialog(null, "Consulta fallida"+e.getMessage()); } return valor; } public String insertarCancion(int idCancion,String nombre, int idAlbum, String Duracion, String Genero, int idUsuario){ String resul=null; try{ String SQL="insert into Cancion(idCancion,nombre,idAlbum,duracion,genero,idUsuario) values(?,?,?,?,?,?)"; PreparedStatement pst=cn.prepareStatement(SQL); pst.setInt(1, idCancion); pst.setString(2, nombre); pst.setInt(3, idAlbum); pst.setString(4, Duracion); pst.setString(5, Genero); pst.setInt(6, idUsuario); int n=pst.executeUpdate(); if(n>0) JOptionPane.showMessageDialog(null, "Registro exitoso"); }catch(Exception e){ JOptionPane.showMessageDialog(null, "Registro fallido"+e.getMessage()); } return resul; } public ArrayList<Cancion> ListaCancion(){ ArrayList ListaCancion=new ArrayList(); Cancion cancion; try{ String SQL ="Select distinctrow idCancion, Cancion.nombre, Album.nombre, Cancion.duracion, Cancion.genero from Cancion INNER JOIN Album ON Cancion.idAlbum=Album.idAlbum "; PreparedStatement ps= cn.prepareStatement(SQL); ResultSet rs= ps.executeQuery(); while (rs.next()){ cancion=new Cancion(); cancion.setIdCancion(rs.getInt(1)); cancion.setNombre(rs.getString(2)); cancion.setNombreAlbum(rs.getString(3)); cancion.setDuracion(rs.getString(4)); cancion.setGenero(rs.getString(5)); ListaCancion.add(cancion); } }catch(Exception e){ JOptionPane.showMessageDialog(null, "nN se pueden enlistar los registros"+e.getMessage()); } return ListaCancion; } public ArrayList<Cancion> FiltrarCancion(String valor){ ArrayList ListaCancion=new ArrayList(); Cancion cancion; try{ String SQL ="Select distinctrow idCancion, Cancion.nombre, Album.nombre, Cancion.duracion, Cancion.genero from Cancion INNER JOIN Album ON Cancion.idAlbum=Album.idAlbum where Cancion.nombre like '%"+valor+"%'"; PreparedStatement ps= cn.prepareStatement(SQL); ResultSet rs= ps.executeQuery(); while (rs.next()){ cancion=new Cancion(); cancion.setIdCancion(rs.getInt(1)); cancion.setNombre(rs.getString(2)); cancion.setNombreAlbum(rs.getString(3)); cancion.setDuracion(rs.getString(4)); cancion.setGenero(rs.getString(5)); ListaCancion.add(cancion); } }catch(Exception e){ JOptionPane.showMessageDialog(null, "No se pueden enlistar los registros"+e.getMessage()); } return ListaCancion; } public void Modificar(String idCancion, String nombre, int idAlbum, String duracion, String genero){ try{ String SQL="update Cancion set nombre=?, idAlbum=?, duracion=?, genero=? where idCancion=?"; String dAct=idCancion; PreparedStatement pst= cn.prepareStatement(SQL); pst.setString(1, nombre); pst.setInt(2, idAlbum); pst.setString(3, duracion); pst.setString(4, genero); pst.setString(5, dAct); pst.execute(); JOptionPane.showMessageDialog(null, "Registro modificado con éxito"); }catch(HeadlessException | SQLException e){ JOptionPane.showMessageDialog(null, "Error al modificar el registro"+e.getMessage()); } } public void Eliminar(String idCancion){ try{ String SQL= "delete from Cancion where idCancion="+idCancion; Statement st=cn.createStatement(); int n=st.executeUpdate(SQL); if(n>=0){ JOptionPane.showMessageDialog(null, "Registro Eliminado"); } }catch(Exception e){ JOptionPane.showMessageDialog(null, "Error al eliminar registro "+e.getMessage()); } } }
181e66b087a32bfb9d93bbf82334149263135e2c
2e3cd3d66c2c13fd599d40360d0a54a075f381bc
/SpringAnnotations/src/casaortiz/jorge/annotations/UsoAnnotations.java
5589e1f3b4b8bea9f6c2bc1aba7b30e644070c4e
[]
no_license
jorgeortizc06/curso_spring
df0d57595da6eee63fb53ebe49a6487c52315aad
c1a24294e44e6cae79cc1af4b22a501690c0ee75
refs/heads/main
2023-01-09T10:19:51.613244
2020-11-15T02:29:04
2020-11-15T02:29:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,117
java
package casaortiz.jorge.annotations; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class UsoAnnotations { public static void main(String[] args) { // TODO Auto-generated method stub //1. leer el xml de configuracion en sistemas antiguos. Actualmente uso una clase //ClassPathXmlApplicationContext contexto = new ClassPathXmlApplicationContext("applicationContext.xml"); //leer el class de configuracion AnnotationConfigApplicationContext contexto = new AnnotationConfigApplicationContext(EmpleadoConfig.class); //2. Pedir un Bean al contenedor /*Empleados Juan = contexto.getBean("comercialExperimentado", Empleados.class); System.out.println(Juan.getTareas()); System.out.println(Juan.getInformes());*/ //aqui uso la llamada del @Bean Empleados empleado = contexto.getBean("directorFinanciero", Empleados.class); System.out.println(empleado.getTareas()); System.out.println(empleado.getInformes()); //3. Cerrar el contexto contexto.close(); } }
df3e8d9d616ed82d86efae6219359b10498ee262
6ba82508e5a0ab0ed6214a8e76200c6b11c5f227
/src/system/leapmotion/gesture/TwoFingerGesture.java
39f2ac9e6434ddc7c5c046164a3f665501ffecfd
[]
no_license
AndyTsangChun/UoB_LeapVisualizationSystem
3c0aadaf3c12f2a1c07e41a88bc7ac2f28c73704
c5c3db25c3df2532201538812c6a7838984c7c29
refs/heads/master
2020-04-06T04:14:40.229018
2017-02-24T10:15:27
2017-02-24T10:15:27
83,026,020
0
0
null
null
null
null
UTF-8
Java
false
false
1,804
java
package system.leapmotion.gesture; import system.controller.GestureController; import system.leapmotion.gesture.util.CustomGestureType; import system.model.StaticGesture; import system.res.SystemTextureManager; import ui.awt.res.LVSStringInfo; /** ************************************************************ * This is a object class extend from custom gesture. * The two finger gesture requires major hand only where index * and middle finger is extended. * * @author Andy Tsang * @version 1.2 * ***********************************************************/ public class TwoFingerGesture extends StaticGesture { public TwoFingerGesture(GestureController gestureController) { super(CustomGestureType.TWO_FINGER_GESTURE, gestureController, SystemTextureManager.TWO_FINGER_GESTURE_IMAGE, LVSStringInfo.OP_ZOOM); super.setRecogniseThreshold(10); } @Override public boolean checkFinger() { boolean[] extended = super.getGestureController().getSystemController().getLeapMotionFrameController().getStyleHandIsExtended(); boolean check_hand = false; // Check is all fingers is not extended check_hand = !extended[0] && extended[1] && extended[2] && !extended[3] && !extended[4]; return check_hand; } @Override public boolean checkPost() { return true; } @Override public void performAction() { if (super.printTest() && super.isEnable()) { System.out.println(super.getGestureName()); } if (super.checkRecogniseThreshold() && super.isEnable()) { //super.getGestureController().getSystemController().getCursorController().moveMouse(super.getFrame()); //super.getGestureController().getSystemController().getCursorController().scrollMouse(super.getFrame()); super.getGestureController().getSystemController().getVTKCameraController().zoom(); } } }
5fb21a7c3593be952b93c10176169462519adb27
3d643e50e304d3ffd3f697905e441556be377cfc
/android/versioned-abis/expoview-abi35_0_0/src/main/java/abi35_0_0/expo/modules/medialibrary/DeleteAlbums.java
ace96b51a63a1d12903061da18e7f21cd91b1896
[ "BSD-3-Clause", "MIT", "Apache-2.0" ]
permissive
Qdigital/expo
326c5c1c0167295c173f2388f078a2f1e73835c9
8865a523d754b2332ffb512096da4998c18c9822
refs/heads/master
2023-07-07T18:37:39.814195
2020-02-18T23:28:20
2020-02-18T23:28:20
241,549,344
1
0
MIT
2023-07-06T14:55:15
2020-02-19T06:28:39
null
UTF-8
Java
false
false
972
java
package abi35_0_0.expo.modules.medialibrary; import android.content.Context; import android.os.AsyncTask; import android.provider.MediaStore.Images.Media; import java.util.List; import abi35_0_0.org.unimodules.core.Promise; import static abi35_0_0.expo.modules.medialibrary.MediaLibraryUtils.deleteAssets; import static abi35_0_0.expo.modules.medialibrary.MediaLibraryUtils.getInPart; class DeleteAlbums extends AsyncTask<Void, Void, Void>{ Context mContext; String mAlbumIds[]; Promise mPromise; public DeleteAlbums(Context context, List<String> albumIds, Promise promise) { mContext = context; mPromise = promise; mAlbumIds = albumIds.toArray(new String[0]); } @Override protected Void doInBackground(Void... voids) { final String selection = Media.BUCKET_ID + " IN (" + getInPart(mAlbumIds) + " )"; final String selectionArgs[] = mAlbumIds; deleteAssets(mContext, selection, selectionArgs, mPromise); return null; } }
8d447916303135e0f1263e83faf0fba460e1c466
bc527be4081720b0414d779959dee2f8373e0580
/app/src/main/java/com/jingchengsoft/dzjplatform/other/GlideEngine.java
e4d080273545534a04b83cbd1a5a73ba773e913d
[]
no_license
guangpu/dzjplatform
79ba7e55cbc3e9158b7610151538bfd35ba2e91a
3149e8da183ffed385973ac8025c758ab7099e6b
refs/heads/master
2022-04-15T23:53:20.712508
2020-04-03T09:14:36
2020-04-03T09:14:36
245,933,661
1
0
null
null
null
null
UTF-8
Java
false
false
2,874
java
package com.jingchengsoft.dzjplatform.other; import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.widget.ImageView; import androidx.annotation.NonNull; import com.bumptech.glide.Glide; import com.huantansheng.easyphotos.engine.ImageEngine; import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade; /** * @author MaybeSix * @date 2019/9/6 * @desc TODO. */ public class GlideEngine implements ImageEngine { //单例 private static GlideEngine instance = null; //单例模式,私有构造方法 private GlideEngine() { } //获取单例 public static GlideEngine getInstance() { if (null == instance) { synchronized (GlideEngine.class) { if (null == instance) { instance = new GlideEngine(); } } } return instance; } /** * 加载图片到ImageView * * @param context 上下文 * @param uri 图片路径 * @param imageView 加载到的ImageView */ @Override public void loadPhoto(@NonNull Context context, @NonNull Uri uri, @NonNull ImageView imageView) { Glide.with(context).load(uri).transition(withCrossFade()).into(imageView); } /** * 加载gif动图图片到ImageView,gif动图不动 * * @param context 上下文 * @param gifUri gif动图路径 * @param imageView 加载到的ImageView * <p> * 备注:不支持动图显示的情况下可以不写 */ @Override public void loadGifAsBitmap(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) { Glide.with(context).asBitmap().load(gifUri).into(imageView); } /** * 加载gif动图到ImageView,gif动图动 * * @param context 上下文 * @param gifUri gif动图路径 * @param imageView 加载动图的ImageView * <p> * 备注:不支持动图显示的情况下可以不写 */ @Override public void loadGif(@NonNull Context context, @NonNull Uri gifUri, @NonNull ImageView imageView) { Glide.with(context).asGif().load(gifUri).transition(withCrossFade()).into(imageView); } /** * 获取图片加载框架中的缓存Bitmap * * @param context 上下文 * @param uri 图片路径 * @param width 图片宽度 * @param height 图片高度 * @return Bitmap * @throws Exception 异常直接抛出,EasyPhotos内部处理 */ @Override public Bitmap getCacheBitmap(@NonNull Context context, @NonNull Uri uri, int width, int height) throws Exception { return Glide.with(context).asBitmap().load(uri).submit(width, height).get(); } }
7416e612db27deff1b16c4dae249b3794b628059
30064f967c3d9316e5104067ae3d5c00b2a947d4
/designpattern/state/src/main/java/me/personal/progress/state/Context.java
eb1ffd605d33183b685144a27e4e9be2b35f43f7
[]
no_license
zy475459736/progress
3980300ab08f99c07815d8bad6a83b0d4f43b88f
7b502e9c8f4b80552f097d4a4926bc934b83f1e2
refs/heads/master
2020-03-23T01:37:05.465393
2019-01-20T15:33:32
2019-01-20T15:33:32
140,927,273
1
0
null
null
null
null
UTF-8
Java
false
false
897
java
package me.personal.progress.state; import me.personal.progress.state.impl.ConcreteStateA; import me.personal.progress.state.impl.ConcreteStateB; /** * Created by zhongyi on 2018/8/23. */ class Context { private State state; //维持一个对抽象状态对象的引用 private int value; //其他属性值,该属性值的变化可能会导致对象状态发生变化 //设置状态对象 public void setState(State state) { this.state = state; } public void request() { //其他代码 state.handle(); //调用状态对象的业务方法 //其他代码 } public void changeState() { //判断属性值,根据属性值进行状态转换 if (value == 0) { this.state=new ConcreteStateA(); } else if (value == 1) { this.setState(new ConcreteStateB()); } } }
52b7105c5eb37705d5b280a7ca8f9bf2cc596819
ea40a7c459246fc49b11f9a295158f343faf6cfd
/xc-framework-model/src/main/java/com/xuecheng/framework/domain/media/response/CheckChunkResult.java
a54fe6a2e449ada40f9862bfcdb6cdca56da4870
[]
no_license
cdtswdk/xuecheng
f38c97eff54a36272b2854a299398ae4847bf17a
b474d9aeda343c915971d18a9d9c3ee4f91b09a4
refs/heads/master
2023-01-08T09:00:46.395425
2020-11-04T10:21:29
2020-11-04T10:21:29
300,299,407
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package com.xuecheng.framework.domain.media.response; import com.xuecheng.framework.model.response.ResponseResult; import com.xuecheng.framework.model.response.ResultCode; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; /** * Created by admin on 2018/3/5. */ @Data @ToString @NoArgsConstructor public class CheckChunkResult extends ResponseResult { public CheckChunkResult(ResultCode resultCode, boolean fileExist) { super(resultCode); this.fileExist = fileExist; } @ApiModelProperty(value = "文件分块存在标记", example = "true", required = true) boolean fileExist; }
11bd1101a320ad275a3613f4d49988c6c70f07bc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_3b6597eb4e921fc94856206f0ed786702f02fc25/StackingET/5_3b6597eb4e921fc94856206f0ed786702f02fc25_StackingET_s.java
2d1f35222609764df669b47048f78e2ffab2862f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,792
java
package techniques; import java.util.List; import org.encog.ensemble.EnsembleAggregator; import org.encog.ensemble.EnsembleMLMethodFactory; import org.encog.ensemble.EnsembleTrainFactory; import org.encog.ensemble.bagging.Bagging; import org.encog.ensemble.stacking.Stacking; import org.encog.ml.data.MLData; import helpers.DataLoader; import helpers.ChainParams; public class StackingET extends EvaluationTechnique { private int dataSetSize; public StackingET(List<Integer> sizes, int dataSetSize, ChainParams fullLabel, EnsembleMLMethodFactory mlMethod, EnsembleTrainFactory trainFactory, EnsembleAggregator aggregator) { this.sizes = sizes; this.dataSetSize = dataSetSize; this.label = fullLabel; this.mlMethod = mlMethod; this.trainFactory = trainFactory; this.aggregator = aggregator; } @Override public void init(DataLoader dataLoader, int fold) { ensemble = new Stacking(sizes.get(currentSizeIndex),dataSetSize,mlMethod,trainFactory,aggregator); setTrainingSet(dataLoader.getTrainingSet(fold)); setSelectionSet(dataLoader.getTestSet(fold)); ensemble.setTrainingData(trainingSet); } @Override public void trainStep() { ((Bagging) ensemble).trainStep(); } @Override public MLData compute(MLData input) { return ensemble.compute(input); } @Override public void step(boolean verbose) { if (currentSizeIndex < sizes.size() -1) { for (int i = sizes.get(currentSizeIndex++); i < sizes.get(currentSizeIndex); i++) { ensemble.addNewMember(); ensemble.trainMember(i, trainToError, selectionError, selectionSet, verbose); } ensemble.getAggregator().train(); } else { this.hasStepsLeft = false; } } }
527e0f48feedfbb144509fdee973493005aec290
7fbbb883c19586b3894716b384eaadff1b439fd1
/xsbweb/src/com/xsbweb/service/impl/LoginRegisterServiceImpl.java
cfae220e14147f4c73bb3fecdd334159b07d5f48
[]
no_license
cike863/testgit
d782e8042b43fc2c8df953c224393db3f7abf967
c1410f23d975d663823c41b63903c33b5e3b9118
refs/heads/master
2021-01-10T13:43:16.440276
2016-03-29T08:37:54
2016-03-29T08:37:54
54,363,422
0
0
null
null
null
null
UTF-8
Java
false
false
4,575
java
package com.xsbweb.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import com.xsbweb.common.bean.DataBaseConstant; import com.xsbweb.controller.app.AppLoginRegistController; import com.xsbweb.mapper.CustomerMapper; import com.xsbweb.mapper.StaffMapper; import com.xsbweb.service.LoginRegisterService; import com.xsbweb.util.MultipleDataSource; import com.xsbweb.util.XsbBusinessUtil; import com.xsbweb.vo.Customer; import com.xsbweb.vo.Staff; import com.xsbweb.vo.extend.*; public class LoginRegisterServiceImpl implements LoginRegisterService { private Logger log = Logger.getLogger(LoginRegisterServiceImpl.class); @Autowired private CustomerMapper customerMapper; @Autowired private StaffMapper staffMapper; /** * 用来校验登录信息 * @return 用户ID * @throws Exception */ @Override public CustomerVO validateLogin(CustomerVO customerVO) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = new HashMap<String, Object>(); param.put("customerUname", customerVO.getCustomerUname()); param.put("customerPassword", customerVO.getCustomerPassword()); param.put("ip", customerVO.getIp()); param.put("loginMethod", customerVO.getLoginMethod()); param.put("prcFlag", null); //param.put("failedCounts", null); param.put("customerId", null); customerMapper.validateLogin(param); CustomerVO cVO = new CustomerVO(); cVO.setCustomerId((String)param.get("customerId")); cVO.setPrcFlag((Integer)param.get("prcFlag")); return cVO; } /** * 根据用户名ID获取用户信息 * @return * @throws Exception */ @Override public CustomerVO getCustomerById(String customerId) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); List<CustomerVO> customerVOList = customerMapper.getCustomerById(customerId); if(customerVOList == null || customerVOList.isEmpty()){ return null; } return customerVOList.get(0); } /** * 用来校验注册信息 * @return 用户ID * @throws Exception */ @Override public Integer validateRegister(CustomerVO customerVO) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = new HashMap<String, Object>(); param.put("customerPhoneNo", customerVO.getCustomerPhoneNo()); param.put("customerEmail", customerVO.getCustomerEmail()); param.put("prcFlag", null); customerMapper.validateRegister(param); return (Integer)param.get("prcFlag"); } @Override public Integer register(CustomerVO customerVO) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO); customerMapper.addCustomer(param); return (Integer)param.get("prcFlag"); } @Override public Integer updateCustomerInfo(CustomerVO customerVO) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO); customerMapper.addCustomer(param); return (Integer)param.get("prcFlag"); } @Override public Integer updatePassword(CustomerVO customerVO) throws Exception { // TODO Auto-generated method stub MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = XsbBusinessUtil.initCustomerParam(customerVO); customerMapper.addCustomer(param); return (Integer)param.get("prcFlag"); } @Override public String getCustomerIdByPhoneOrMail(String customerLabel) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = new HashMap<String, Object>(); param.put("customerLabel", customerLabel); param.put("customerId", null); customerMapper.getCustomerIdByPhoneOrMail(param); return (String)param.get("customerId"); } @Override public List<String> getRoleEnumByCustomerId(String customerId) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); Map<String, Object> param = new HashMap<String, Object>(); param.put("customerId", customerId); param.put("prcFlag", null); List<String> list = customerMapper.getRoleEnumByCustomerId(param); return list; } @Override public List<CustomerVO> getCustomerListByIds(CustomerVO customerVO) throws Exception { MultipleDataSource.setDataSourceKey(DataBaseConstant.OLTP); return customerMapper.getCustomerListByIds(customerVO); } }
62fef1ed142b1df46855af2f34456a5832b86eb9
8aa8e01308fbc56db78b0e211b28ebac2679a643
/Productive/src/backend/PushRequest.java
9cc61e7262d423de3c6fe55777fc908336f8afb3
[]
no_license
ahouts/ProDuctive-client
253e668a75d05c33d7929c7dc9476dbf3421a569
a07a48134120c872581757c1681672fdf4f5e4e9
refs/heads/master
2021-08-22T08:56:50.282021
2017-11-29T20:39:41
2017-11-29T20:39:41
105,924,135
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package backend; public class PushRequest { public PushRequest() { // TODO Auto-generated constructor stub } }
bd497ff948ccc5bc7317032d6ad2c1c3d0aab735
36713f8041648fcb65a9f123e1845b0db39cb07d
/src/LinkedList/ClipBdLinkedList.java
dad705e29cb0c1b45e79acda8574762b32c44f34
[]
no_license
cowlesd/Java
29d6e1869238f7ac95a167255343ec38cf7ed137
dd8f077921872629ae219581f33a2e07f44fe37a
refs/heads/master
2020-08-23T15:56:44.104135
2019-04-12T00:45:46
2019-04-12T00:45:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package LinkedList; public class ClipBdLinkedList { private NodeCB top; private NodeCB tail; public ClipBdLinkedList() { tail = top = null; } public NodeCB getTop(){return top;} public NodeCB getTail(){return tail;} public void add(NodeCB cbToAdd){ cbToAdd.setNext(top); top = cbToAdd; } // create methods you need. }
98520a451c30ad851579b76d3398581e582ef943
d0a34993629b8a89a062c284d3f7e50d499aafc5
/spring-cloud-blog/blog-main/src/main/java/com/wenxianm/utils/RandomUtil.java
e38718184d929e2be6abb563e307ba8e00a526ad
[]
no_license
caiwenxian/bolg-java
bea90b3bcd1dc6a944ea413e78c0a3731a564654
2263dfff57572ceca79916903ef2a0ee17c24546
refs/heads/master
2022-12-21T04:50:52.496421
2021-04-30T08:30:55
2021-04-30T08:30:55
118,109,762
0
0
null
2022-12-16T10:43:53
2018-01-19T10:10:32
Java
UTF-8
Java
false
false
316
java
package com.wenxianm.utils; import java.util.UUID; /** * 随机码获取工具 * * @Author: [caiwenxian] * @Date: [2018-01-19 09:43] * @Version: [1.0.0] */ public class RandomUtil { static public String getUid() { return System.currentTimeMillis() + "-" + UUID.randomUUID().toString(); } }
0ba36c072be7fb36682f9c8bc8a89c17ded75e76
0f5e788411b74934febdcfe21811e7c0ee4a6307
/src/com/Person.java
09c75859184b5a2bec7823c90abd162eac35ccc4
[]
no_license
qyqianyou/rep2
90357f49b44efd9d1254c755dbb0b8553ed2a626
cbd965dcb38549cd13aceb1ea66931dcb0b4151c
refs/heads/master
2022-12-01T11:04:08.048092
2020-08-16T02:18:23
2020-08-16T02:18:23
287,701,088
0
0
null
null
null
null
UTF-8
Java
false
false
81
java
package com; public class Person { private int age; private String email; }
97c5a26d8470837fee5aa4350f923a49724b1ed1
902679402b7c37a9ec5972fb592f95f1daabcf02
/src/main/java/py/com/econtreras/ecommerceadmin/entity/Devolution.java
6b5ea919c2c7fbdd363c7e7546ecccabe4ce57a2
[]
no_license
e-contreras/ecommerce-admin
d1d534a99addfb8978ca9226ab5d19519c85e0a0
e4e344c2fcb96b6c9b612a1e0bab03d5470d01fe
refs/heads/master
2023-01-10T16:49:43.731414
2019-10-27T15:37:54
2019-10-27T15:37:54
216,665,752
0
0
null
2023-01-04T12:36:42
2019-10-21T21:08:03
JavaScript
UTF-8
Java
false
false
1,483
java
package py.com.econtreras.ecommerceadmin.entity; import java.io.Serializable; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import lombok.Data; @Data @Entity @Table(name = "devoluciones", catalog = "econtreras", schema = "") public class Devolution implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id", nullable = false) private Integer id; @Basic(optional = false) @Column(name = "fec_alta", nullable = false) @Temporal(TemporalType.TIMESTAMP) private Date creationDate; @Basic(optional = false) @Lob @Column(name = "comentarios", nullable = false, length = 65535) private String comment; @Basic(optional = false) @Column(name = "concepto", nullable = false, length = 100) private String concept; @JoinColumn(name = "mercaderia", referencedColumnName = "id", nullable = false) @ManyToOne(optional = false) private Product product; }
e16de99309e40a9a464a3b0c22e9a96062ffc30f
fcb4a658a0369acf4f94cabb56aedfb0a6787476
/week1 if,strings,ints,doubles/FirstThree.java
9fc6562e2945ebefefa20cccd8df7cc7b9bffc8c
[]
no_license
OishinSmith/Java-exercises
bf11e7573a47330f993887cbc6340a5cb6bd012e
2adf90bafe18d3ae7037b9086d578b8096d52779
refs/heads/master
2020-03-27T23:56:37.089059
2018-09-04T16:46:38
2018-09-04T16:46:38
147,361,250
0
0
null
null
null
null
UTF-8
Java
false
false
317
java
import java.util.Scanner; public class FirstThree { public static void main(String[] args) { Scanner t = new Scanner(System.in); System.out.print("Tell me your name: "); String name = t.next().substring(0, 3); System.out.println("Your nickname is " + name + "."); } }
3032d8ae507314784174974c77d010fef9ddce2e
05da80d8560178c935cd27adb010d16de116a4b5
/ProvaC_Telecamere/MySolution/telecamera/TelecameraDiAlarme.java
7de95f0a21ada1a3d59da8d1d2b070b2cc3426ed
[]
no_license
formidablae/unibg_triennale_esame_informatica_II_a
2e0d985eb7b48814c1d0de2c33e408901ed505f0
1733be097fc22e94610f2322a21431b241e86bc2
refs/heads/main
2023-08-25T17:35:59.887428
2021-10-01T09:49:34
2021-10-01T09:49:34
412,410,879
9
0
null
null
null
null
UTF-8
Java
false
false
778
java
package telecamera; public class TelecameraDiAlarme extends Telecamera { // CAMPI int numeroTelefono; private int lunghezzaCampoNumeroTelefono; // COSTRUTTORI public TelecameraDiAlarme() // DONE { super(); numeroTelefono = 0; lunghezzaCampoNumeroTelefono = 0; } public TelecameraDiAlarme(String laDescrizione, double laPosizione) // DONE { super(laDescrizione, laPosizione); numeroTelefono = 0; lunghezzaCampoNumeroTelefono = 0; } public TelecameraDiAlarme(String laDescrizione, double laPosizione, int numeroDiTelefono) // DONE { super(laDescrizione, laPosizione); numeroTelefono = numeroDiTelefono; lunghezzaCampoNumeroTelefono = (String.valueOf(numeroDiTelefono)).length(); } // METODI // METODI STATICI }
c1c0d0d122497ca64f99ff69e5670cdb473bc37f
17cf0d8f4860939c608dfdc3715b8fd8749ed6c0
/oops/Rectangle_Test.java
2c9e41ad47bad6f346f79868e3b004a17bba57c5
[]
no_license
Adarsh-cloud/java-programs
41b517a338a337772b45a5edfb1a86493b71840e
6cecbb6b9ee475e0adaa7bf023e8beac21cb73f8
refs/heads/master
2020-06-25T15:20:06.916941
2019-08-17T12:30:25
2019-08-17T12:30:25
199,350,099
0
0
null
2019-07-29T00:25:52
2019-07-29T00:12:19
Java
UTF-8
Java
false
false
1,609
java
//Author: Shakthivel //Date: 24/07/2019 //Purpose: To access Circle class... package capgemini.oops; class Rectangle { // fields... float length, breadth; // constructor public Rectangle() { length = 0.0f; breadth = 0.0f; System.out.println("Rectangle->Default..."); } // constructor overloading public Rectangle(float plength, float pbreadth) { length = plength; breadth = pbreadth; System.out.println("Rectangle->Parameter..."); } // methods public void draw() { System.out.println("Rectangle is drawn..."); } public float calcArea() { return length * breadth; } // method overriding from parent class @Override public String toString() { return "Length: " + length + ", Breadth: " + breadth; } //r1.equals(null) //r1.equals(r2) @Override public boolean equals(Object obj) { if(obj == null) return false; Rectangle otherrectangle = (Rectangle) obj; if (this.length == otherrectangle.length && this.breadth == otherrectangle.breadth) { return true; } else { return false; } } } public class Rectangle_Test { public static void main(String[] args) { // declaration Rectangle r1, r2; // object instantiation r1 = new Rectangle(2.5f, 3.5f); r2 = new Rectangle(2.5f, 3.5f); // method call r1.draw(); System.out.println("r1 Area: " + r1.calcArea()); r2.draw(); System.out.println("r2 Area: " + r2.calcArea()); System.out.println(r1); System.out.println(r2.toString()); if (r1.equals(r2)) { System.out.println("r1 is equal to r2"); } } }
18e595c339601c91f68d10ec0876e0f721c04fb2
e21d3ae8e47b113a7c27524afd4525cc23130b71
/IWXXM-JAVA/aero/aixm/VORTimeSlicePropertyType.java
ebfcbf67664d2364ac66316e31c2613ead4bc5eb
[]
no_license
blchoy/iwxxm-java
dad020c19a9edb61ab3bc6b04def5579f6cbedca
7c1b6fb1d0b0e9935a10b8e870b159c86a4ef1bb
refs/heads/master
2023-05-25T12:14:10.205518
2023-05-22T08:40:56
2023-05-22T08:40:56
97,662,463
2
1
null
2021-11-17T03:40:50
2017-07-19T02:09:41
Java
UTF-8
Java
false
false
2,629
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0-SNAPSHOT // See <a href="https://jaxb.java.net/">https://jaxb.java.net/</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2023.05.22 at 02:50:00 PM HKT // package aero.aixm; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for VORTimeSlicePropertyType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="VORTimeSlicePropertyType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element ref="{http://www.aixm.aero/schema/5.1.1}VORTimeSlice"/&gt; * &lt;/sequence&gt; * &lt;attGroup ref="{http://www.opengis.net/gml/3.2}OwnershipAttributeGroup"/&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VORTimeSlicePropertyType", propOrder = { "vorTimeSlice" }) public class VORTimeSlicePropertyType { @XmlElement(name = "VORTimeSlice", required = true) protected VORTimeSliceType vorTimeSlice; @XmlAttribute(name = "owns") protected Boolean owns; /** * Gets the value of the vorTimeSlice property. * * @return * possible object is * {@link VORTimeSliceType } * */ public VORTimeSliceType getVORTimeSlice() { return vorTimeSlice; } /** * Sets the value of the vorTimeSlice property. * * @param value * allowed object is * {@link VORTimeSliceType } * */ public void setVORTimeSlice(VORTimeSliceType value) { this.vorTimeSlice = value; } /** * Gets the value of the owns property. * * @return * possible object is * {@link Boolean } * */ public boolean isOwns() { if (owns == null) { return false; } else { return owns; } } /** * Sets the value of the owns property. * * @param value * allowed object is * {@link Boolean } * */ public void setOwns(Boolean value) { this.owns = value; } }
bf1055f426b682c35138a49b5587df35e1cdf36b
0617762d785c80fb9095dbe7032ade446eab31c5
/app/src/main/java/com/swarmy/swarmy/DevicesLoader.java
a3ec50a7b38d100ab0d5f77ab64e3976776bca99
[]
no_license
zalsader/swarmy-android
e80a841d47c2baa45a4ad9422c4cbeac489d8575
a5d7bdcb001c8743193024b80dd9916c030251f0
refs/heads/master
2021-05-04T02:08:32.417099
2016-12-20T09:41:04
2016-12-20T09:41:04
71,285,052
1
0
null
null
null
null
UTF-8
Java
false
false
4,528
java
package com.swarmy.swarmy; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.support.annotation.WorkerThread; import android.support.v4.content.LocalBroadcastManager; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.List; import io.particle.android.sdk.cloud.BroadcastContract; import io.particle.android.sdk.cloud.ParallelDeviceFetcherAccessHack; import io.particle.android.sdk.cloud.ParticleCloud; import io.particle.android.sdk.cloud.ParticleCloud.PartialDeviceListResultException; import io.particle.android.sdk.cloud.ParticleCloudException; import io.particle.android.sdk.cloud.ParticleDevice; import io.particle.android.sdk.utils.BetterAsyncTaskLoader; import static io.particle.android.sdk.utils.Py.list; import static io.particle.android.sdk.utils.Py.truthy; public class DevicesLoader extends BetterAsyncTaskLoader<DevicesLoader.DevicesLoadResult> { public static class DevicesLoadResult { public final List<ParticleDevice> devices; public final boolean isPartialResult; // FIXME: naming. also, two booleans in a constructor, in a row.... no. just no. public final boolean unableToLoadAnyDevices; public DevicesLoadResult(List<ParticleDevice> devices, boolean isPartialResult, boolean unableToLoadAnyDevices) { this.devices = devices; this.isPartialResult = isPartialResult; this.unableToLoadAnyDevices = unableToLoadAnyDevices; } } private final ParticleCloud cloud; private final LocalBroadcastManager broadcastManager; private final DevicesUpdatedReceiver devicesUpdatedReceiver; private volatile DevicesLoadResult latestResult = new DevicesLoadResult( new ArrayList<ParticleDevice>(), false, false); private volatile boolean useLongTimeoutsOnNextLoad = false; public DevicesLoader(Context context) { super(context); cloud = ParticleCloud.get(context); broadcastManager = LocalBroadcastManager.getInstance(context); devicesUpdatedReceiver = new DevicesUpdatedReceiver(); } public void setUseLongTimeoutsOnNextLoad(boolean useLongTimeoutsOnNextLoad) { this.useLongTimeoutsOnNextLoad = useLongTimeoutsOnNextLoad; } @Override protected void onStartLoading() { super.onStartLoading(); broadcastManager.registerReceiver(devicesUpdatedReceiver, devicesUpdatedReceiver.getFilter()); } @Override protected void onStopLoading() { super.onStopLoading(); broadcastManager.unregisterReceiver(devicesUpdatedReceiver); } @Override public boolean hasContent() { return truthy(latestResult.devices); } @Override public DevicesLoadResult getLoadedContent() { return latestResult; } @Override @WorkerThread public DevicesLoadResult loadInBackground() { boolean useLongTimeouts = useLongTimeoutsOnNextLoad; useLongTimeoutsOnNextLoad = false; List<ParticleDevice> devices = list(); boolean isPartialList = false; boolean unableToLoadAnyDevices = false; try { devices = ParallelDeviceFetcherAccessHack.getDevicesParallel(cloud, useLongTimeouts); } catch (ParticleCloudException e) { // FIXME: think more about error handling here // getting a PCE here means we couldn't even get the device list, so just return // whatever we have. unableToLoadAnyDevices = true; devices = latestResult.devices; } catch (PartialDeviceListResultException ex) { ex.printStackTrace(); devices = ParallelDeviceFetcherAccessHack.getDeviceList(ex); isPartialList = true; } DevicesLoadResult resultToReturn = new DevicesLoadResult( ImmutableList.copyOf(devices), isPartialList, unableToLoadAnyDevices); if (!unableToLoadAnyDevices) { latestResult = resultToReturn; } return resultToReturn; } private class DevicesUpdatedReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { forceLoad(); } IntentFilter getFilter() { return new IntentFilter(BroadcastContract.BROADCAST_DEVICES_UPDATED); } } }
d922ce5b2f8afba5f8e92e21657461e93b901ca9
8823c96d433605e7c13679b027a697e6a647cf9c
/src/main/java/com/lzhlyle/leetcode/week/no76/MinimumWindowSubstring_TwoPoints.java
5868ca8075afd8098c817f8a4c375652253d3bfb
[ "MIT" ]
permissive
lzhlyle/leetcode
62278bf6e949f802da335e8de2d420440f578c2f
8f053128ed7917c231fd24cfe82552d9c599dc16
refs/heads/master
2022-07-14T02:28:11.082595
2020-11-16T14:28:20
2020-11-16T14:28:20
215,598,819
2
0
MIT
2022-06-17T02:55:41
2019-10-16T16:52:05
Java
UTF-8
Java
false
false
1,289
java
package com.lzhlyle.leetcode.week.no76; public class MinimumWindowSubstring_TwoPoints { // two points // O(n+m) public String minWindow(String s, String t) { char[] sarr = s.toCharArray(), tarr = t.toCharArray(); int slen = sarr.length, tlen = tarr.length; int[] need = new int[256], hire = new int[256]; for (char c : tarr) need[c] = ++hire[c]; int expected = tlen; int l = 0, r = l, len = 0, minL = l, minLen = slen + 1; // minLen: unreachable value while (l < slen - tlen + 1 && r < slen) { if (len < r - l + 1) { int hiring = sarr[r]; if (need[hiring] > 0 && hire[hiring] > 0) expected--; hire[hiring]--; } else { int leaving = sarr[l - 1]; hire[leaving]++; if (need[leaving] > 0 && hire[leaving] > 0) expected++; } len = r - l + 1; if (expected > 0) r++; else { if (len < minLen) { minLen = len; minL = l; } l++; } } return minLen == slen + 1 ? "" : new String(sarr, minL, minLen); } }
35ee09b326df8461526a5b0f718bfe2bf6ae1e3b
8d7d41b71085ff2e88fa6a7a014f002deade8d7e
/src/test/java/be/vbgn/gradle/buildaspects/project/project/VariantProjectFactoryImplTest.java
8510f716d8334ae4402fcf0dd11c10dc3b04e0dd
[]
no_license
vierbergenlars/build-aspects-gradle-plugin
b821c61c9a9456fe6005e0c2a174b6dd086e5694
c0b8bca05339624c1986d671c12dd23ccaed22f6
refs/heads/master
2022-09-12T14:08:23.452939
2022-08-29T07:21:23
2022-08-29T07:21:23
220,013,625
1
0
null
2022-08-29T07:21:24
2019-11-06T14:18:29
Java
UTF-8
Java
false
false
5,634
java
package be.vbgn.gradle.buildaspects.project.project; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import be.vbgn.gradle.buildaspects.TestUtil; import be.vbgn.gradle.buildaspects.settings.project.VariantProjectDescriptor; import be.vbgn.gradle.buildaspects.variant.Variant; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Optional; import java.util.Set; import org.gradle.api.Project; import org.gradle.api.initialization.ProjectDescriptor; import org.gradle.testfixtures.ProjectBuilder; import org.junit.Test; import org.mockito.Mockito; public class VariantProjectFactoryImplTest { private ProjectDescriptor createProjectDescriptor(String path) { ProjectDescriptor projectDescriptor = Mockito.mock(ProjectDescriptor.class, Mockito.RETURNS_SMART_NULLS); Mockito.when(projectDescriptor.getPath()).thenReturn(path); return projectDescriptor; } private VariantProjectDescriptor createVariantProjectDescriptor(String path, Variant variant) { VariantProjectDescriptor variantProjectDescriptor = Mockito .mock(VariantProjectDescriptor.class, Mockito.RETURNS_SMART_NULLS); ProjectDescriptor projectDescriptor = createProjectDescriptor(path); Mockito.when(variantProjectDescriptor.getProjectDescriptor()).thenReturn(projectDescriptor); ProjectDescriptor parentProjectDescriptor = createProjectDescriptor(path.substring(0, path.lastIndexOf(':'))); Mockito.when(variantProjectDescriptor.getParentProjectDescriptor()) .thenReturn(parentProjectDescriptor); Mockito.when(variantProjectDescriptor.getVariant()).thenReturn(variant); return variantProjectDescriptor; } @Test public void createVariantProject() { Set<VariantProjectDescriptor> variantProjectDescriptors = new HashSet<>(); variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-c", TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0")))); variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-d", TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0")))); VariantProjectFactory variantProjectFactory = new VariantProjectFactoryImpl(variantProjectDescriptors); Project rootProject = ProjectBuilder.builder() .withName(":") .build(); Project projectA = ProjectBuilder.builder() .withName("projectA") .withParent(rootProject) .build(); Project projectAC = ProjectBuilder.builder() .withName("projectA-c") .withParent(projectA) .build(); Optional<VariantProject> variantProject = variantProjectFactory.createVariantProject(projectAC); assertTrue(variantProject.isPresent()); assertEquals(projectAC, variantProject.get().getProject()); assertEquals(TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0")), variantProject.get().getVariant()); Optional<VariantProject> variantProject1 = variantProjectFactory.createVariantProject(projectA); assertFalse(variantProject1.isPresent()); } @Test public void createVariantProjectsForParent() { Set<VariantProjectDescriptor> variantProjectDescriptors = new HashSet<>(); variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-c", TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0")))); variantProjectDescriptors.add(createVariantProjectDescriptor(":projectA:projectA-d", TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0")))); variantProjectDescriptors.add(createVariantProjectDescriptor(":projectB:projectB-c", TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0")))); VariantProjectFactory variantProjectFactory = new VariantProjectFactoryImpl(variantProjectDescriptors); Project rootProject = ProjectBuilder.builder() .withName(":") .build(); Project projectA = ProjectBuilder.builder() .withName("projectA") .withParent(rootProject) .build(); Project projectAC = ProjectBuilder.builder() .withName("projectA-c") .withParent(projectA) .build(); Project projectAD = ProjectBuilder.builder() .withName("projectA-d") .withParent(projectA) .build(); Set<VariantProject> variantProjects = variantProjectFactory.createVariantProjectsForParent(projectA); assertEquals(new HashSet<>(Arrays.asList( new VariantProjectImpl(projectAC, TestUtil.createVariant(Collections.singletonMap("systemVersion", "1.0"))), new VariantProjectImpl(projectAD, TestUtil.createVariant(Collections.singletonMap("systemVersion", "2.0"))) )), variantProjects); Set<VariantProject> variantProjects1 = variantProjectFactory.createVariantProjectsForParent(projectAC); assertTrue(variantProjects1.isEmpty()); Set<VariantProject> variantProjects2 = variantProjectFactory .createVariantProjectsForParent(rootProject); assertTrue(variantProjects2.isEmpty()); } }
798f4ff7358b069573a2ec20e0b1b22225dc38fe
dc049c6c1d7b4e40a20c769c30ef80cc42f947da
/src/test/java/com/mimeo/audit/dao/TestDaoTest.java
06f2b17b0e2cbbd7ed53ca2a697671f83ec69736
[]
no_license
cheesunchen/demo
579420f3aa64015f9bb3b09fb0aebc812548dce9
71a4064a17e47b89d5a97ab7692dbc9be11d0428
refs/heads/master
2021-06-27T11:40:09.422167
2020-12-04T07:51:28
2020-12-04T07:51:28
177,755,853
0
0
null
null
null
null
UTF-8
Java
false
false
632
java
package com.mimeo.audit.dao; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.junit4.SpringRunner; import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest public class TestDaoTest { @Autowired private TestDao testDao; @Test @Rollback public void selectMobile() { String str = testDao.selectMobile(); assertEquals("111", str); } }
24252219de7471942274dd041cc961730bc852ef
9f323e4839c0021e623fd43e8a0d098d9b80c463
/apihelper-system/src/main/java/com/ning/modules/system/domain/Project.java
d0d724879011562624c3784d10f7bcc019eec664
[]
no_license
rookie30/APIHelper-server
eeb8b2b3f9282209c20de4748e6470d2d1e2bab9
1656098b487ba05dd4b6c71acd9082b9b1312319
refs/heads/main
2023-04-10T20:26:19.519396
2021-04-20T06:18:01
2021-04-20T06:18:01
330,133,561
0
0
null
null
null
null
UTF-8
Java
false
false
1,653
java
package com.ning.modules.system.domain; import com.alibaba.fastjson.annotation.JSONField; import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.Getter; import lombok.Setter; import org.hibernate.sql.Update; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.*; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; import java.util.Set; @Data @Entity @Table(name = "sys_project") @EntityListeners(AuditingEntityListener.class) public class Project implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @NotNull(groups = Update.class) @Column(name = "project_id") private Long id; @NotBlank(message = "项目名称不能为空") @ApiModelProperty(value = "项目名称") @Column(name = "name") private String projectName; @ApiModelProperty(value = "项目简介") private String introduce; @Column(name = "create_time") @ApiModelProperty(value = "创建时间") private Date createTime; @Column(name = "update_time") @LastModifiedDate @ApiModelProperty(value = "更新时间") private Date updateTime; @Column(name = "create_by") @ApiModelProperty(value = "创建者") private String createBy; @JSONField(serialize = false) @ManyToMany(mappedBy = "projects") @ApiModelProperty(value = "用户", hidden = true) private Set<User> users; }
4faf1a22fe9e6f621733bbc1ce2a181955353ef7
5effb75ea4d76ac1ea4a91f79931f6fce157c2ba
/mobile-app-ws/src/main/java/com/project/app/ws/ui/model/request/UserLoginRequestModel.java
9826f2157e094c6817f9386d773c5681fef06b3e
[]
no_license
koknikolee/MasterSpring
d8ebffe359b90890a18c9b98e9d6caa940b1af8c
b19c4ef6da5793ae3da5f9d107bda53dfafe4ee3
refs/heads/master
2023-02-20T09:13:21.272621
2020-09-29T12:01:59
2020-09-29T12:01:59
299,389,429
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.project.app.ws.ui.model.request; public class UserLoginRequestModel { private String email; private String password; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
6c2b5e9e22a6fde6ce12f4ee18bcba6ecff7c160
2170936ca30aadf6ed492b98afa0f780331f34dd
/src/leetcode/LeetCoce1487.java
c807b7eeff4753907a56feaf1cc94334fab08ff8
[]
no_license
Staunchjun/JZoffer_
f1da0205abeb97f268bc883ca00051cafecefcb1
b668634b9ba7c5da7270f734b000cc013696158a
refs/heads/master
2021-09-23T18:52:25.718049
2021-09-21T15:25:20
2021-09-21T15:25:20
89,563,052
0
0
null
null
null
null
UTF-8
Java
false
false
2,624
java
package leetcode; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; public class LeetCoce1487 { public static void main(String[] args) { LeetCoce1487 leetCoce148 = new LeetCoce1487(); String[] t1 = {"pes", "fifa", "gta", "pes(2019)"}; String[] t2 = {"gta", "gta(1)", "gta", "avalon"}; String[] t3 = {"onepiece", "onepiece(1)", "onepiece(2)", "onepiece(3)"}; String[] t4 = {"wano", "wano", "wano", "wano"}; String[] t5 = {"kaido", "kaido(1)", "kaido", "kaido(1)"}; // System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t1))); // System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t2))); // System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t3))); // System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t4))); System.out.println(Arrays.deepToString(leetCoce148.getFolderNames(t5))); } private String[] getFolderNames(String[] names) { final String suffix = "(%d)"; HashMap<String, Integer> set = new HashMap<>(); for (int i = 0; i < names.length; i++) { String name = names[i]; if (set.containsKey(name)) { int count = set.get(name); while (set.containsKey(name.concat(String.format(suffix, count)))) { count++; } set.put(name.concat(String.format(suffix, count)), 1); set.put(name, set.get(name) + 1); names[i] = name.concat(String.format(suffix, count)); } else { set.put(name, 1); } } return names; } /** * 超时了 * 想想优化的方法吧 * 这里面的do while其实是可以优化的,能不能不do while * 或者do while的次数少一点 * * @param names * @return */ private String[] getFolderNames1(String[] names) { final String suffix = "(%d)"; HashSet<String> set = new HashSet<>(); for (int i = 0; i < names.length; i++) { String name = names[i]; if (set.contains(name)) { int count = 1; String uniqueName; do { uniqueName = name.concat(String.format(suffix, count)); count++; } while (set.contains(uniqueName)); set.add(uniqueName); names[i] = uniqueName; } else { set.add(name); } } return names; } }
b2fd7f7308845c71fcb96d94c316fedb04d96140
ef35cdbac07079ea280ee1647f9019ca9be413d3
/14301101/TheFuck/src/MVC/ModelAndView.java
1a653f080f3064bc5fd58d550d839a7819d6dfc7
[]
no_license
onlyNeVeRmOrE/MVC
1844fa8ad870c1b3488c0221b77a87654e95c49e
80f6982367d9c0ca9a497679b25b0025492937d7
refs/heads/master
2020-06-13T01:55:13.463483
2016-12-03T10:10:29
2016-12-03T10:10:29
75,466,291
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package MVC; import java.util.HashMap; import java.util.Map; import java.util.Set; import com.sun.xml.internal.ws.config.management.policy.ManagementPrefixMapper; public class ModelAndView { Map<String,Object> map = new HashMap<String,Object>(); String viewName; public void setViewName(String string) { // TODO Auto-generated method stub viewName = string; } public String getViewName(){ return viewName; } public Object getMap(String string) { // TODO Auto-generated method stub return map.get(string); } public void addObject(String string, Object map) { // TODO Auto-generated method stub this.map.put(string, map); } public Set<String> getParameters(){ return map.keySet(); } }
4b71f6a93abe2bd231cab7380bb07c4b6ebf1535
59e1310552bfdaa33a0d3bddf388184890e9c0e8
/deeplearning4j-scaleout/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/learning/impl/elements/SkipGramWithB.java
d34678182f96a619c9ca41ca15c4052aa87e723e
[ "Apache-2.0" ]
permissive
fabiana001/deeplearning4j
f725b36ba384c07731b12b1e3c437bb5c58622f6
34147e0f5299b8084cc3deabb80790d5363be39a
refs/heads/master
2021-01-21T02:27:15.745155
2016-09-18T15:50:39
2016-09-18T15:50:39
63,870,440
0
0
null
2016-07-21T13:11:05
2016-07-21T13:11:04
null
UTF-8
Java
false
false
1,773
java
package org.deeplearning4j.models.embeddings.learning.impl.elements; import lombok.NonNull; import org.deeplearning4j.models.sequencevectors.sequence.Sequence; import org.deeplearning4j.models.sequencevectors.sequence.SequenceElement; import java.util.List; import java.util.concurrent.atomic.AtomicLong; /** * Created by Andrea on 11/05/16. */ public class SkipGramWithB<T extends SequenceElement> extends SkipGram<T> { @Override public String getCodeName() { return "SkipGramWithB"; } @Override public double learnSequence(@NonNull Sequence<T> sequence, @NonNull AtomicLong nextRandom, @NonNull double learningRate) { Sequence<T> tempSequence = sequence; if (sampling > 0) tempSequence = super.applySubsampling(sequence, nextRandom); double score = 0; for(int i = 0; i < tempSequence.getElements().size(); i++) { nextRandom.set(nextRandom.get() * 25214903917L + 11); score = skipGram(i, tempSequence.getElements(), (int) nextRandom.get() % window, nextRandom, learningRate); } return score; } private double skipGram(int i, List<T> sentence, int b, AtomicLong nextRandom, double alpha) { final T word = sentence.get(i); if(word == null || sentence.isEmpty()) return 0; double score = 0; int end = window - b; for(int a = b; a < end; a++) { if(a != window) { int c = a - window + i; if(c >= 0 && c < sentence.size()) { T lastWord = sentence.get(c); score = super.iterateSample(word,lastWord,nextRandom,alpha); } } } return score; } }
504dc5c676918319ea75b340715f0abfe153a27f
487ed51c196b1ac3ecb54622fdf4dc3d228e3859
/app/src/main/java/fullerton/edu/autowaiter/DeliverOrder.java
af0ffaaa82917e4ddc7904016315b6db8ea263a1
[]
no_license
jolivian/AutoWaiter
edae3626a4e69c8c7fb8af6c10ebc95bdf53e1cd
4af6ca3da78a6f7fd4bd847188c7997e0aa7750f
refs/heads/master
2020-03-10T03:27:48.651922
2018-04-11T23:24:59
2018-04-11T23:24:59
129,165,063
0
0
null
null
null
null
UTF-8
Java
false
false
839
java
package fullerton.edu.autowaiter; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class DeliverOrder extends AppCompatActivity { Button returner; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_deliver_order); initialize(); returner.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ Intent myIntent = new Intent(DeliverOrder.this, MainActivity.class); DeliverOrder.this.startActivity(myIntent); } }); } private void initialize() { returner = findViewById(R.id.bReturn); } }
94e131c632e486bc1d49055eb80a2b106f78c5ac
b496085457958a7ea0f33ae561596afa4cfd9048
/src/MergeArray.java
a55aff1bdd6b25d66e3267952b930ef5ff39860b
[]
no_license
shivangichhabra/RandomAlgorithmProblems
4dd7ec7dab1cd7a90a83ba3c49b9713c224e8df2
2097623cdf2f1ec17aaae8564a7b0bf6a407fd06
refs/heads/master
2020-04-05T10:39:43.915204
2018-08-09T00:18:58
2018-08-09T00:18:58
81,522,750
0
0
null
null
null
null
UTF-8
Java
false
false
2,302
java
/** * Created by shivangi on 3/20/17. */ public class MergeArray { /* O(n+m) space o(n) time */ public int[] method1(int[]a, int b[]){ int c[] = new int[a.length+b.length]; int j=0, k=0; for(int i=0; i<c.length; i++){ if(j<a.length && k<b.length){ if(a[j] <= b[k]){ c[i] = a[j]; j++; } else { c[i] = b[k]; k++; } } else if(j<a.length){ c[i] = a[j]; j++; } else{ c[i] = b[k]; k++; } } return c; } /* Returning two array sorted in order can merge them at end of a to start of b */ public void method2(int[] a, int[] b) { for (int i = b.length - 1; i >= 0; i--) { int j, last = a[a.length - 1]; for (j = a.length - 2; j >= 0 && a[j] > b[i]; j--) a[j + 1] = a[j]; if (j != a.length - 2 || last > b[i]) { a[j + 1] = b[i]; b[i] = last; } } } /* Can use this method to merge in the same array provided extra space exist at the end */ public void method3(int[] a, int[] b){ int i = a.length; int j = b.length; while(i>0 && j>0){ if(a[i-1] > b[j-1]) { a[i + j - 1] = a[i - 1]; i--; }else { a[i + j - 1] = b[j - 1]; j--; } } while( j > 0){ a[i+j-1] = b[j-1]; j--; } } public static void main(String args[]){ MergeArray ma = new MergeArray(); int a[] = {1,3,5,7,9,11}; int b[] = {12,14,16,18}; int[] c = ma.method1(a,b); for(int i=0; i<c.length; i++){ System.out.print(c[i] + " "); } System.out.println("\n"); ma.method2(a,b); for(int i=0; i<a.length; i++){ System.out.print(a[i] + " "); } for(int i=0; i<b.length; i++){ System.out.print(b[i] + " "); } } }
cf2dc87e216aaa5ff0e4a7dc206bc3a51a2eac71
8c2150d1fe5ca118bc65b618a421ac53d77e8962
/SWB4/swb/SWBPortlet-shared/src/org/semanticwb/portal/portlet/WBPortletContainer.java
51318161834dc13ed321cf5da8860c5e8bc90fe7
[]
no_license
haxdai/SemanticWebBuilder
b3d7b7d872e014a52bf493f613d145eb1e87b2e6
dad201959b3429adaf46caa2990cc5ca6bd448e7
refs/heads/master
2021-01-20T10:49:55.948762
2017-01-26T18:01:17
2017-01-26T18:01:17
62,407,043
0
0
null
null
null
null
UTF-8
Java
false
false
3,619
java
/* * SemanticWebBuilder es una plataforma para el desarrollo de portales y aplicaciones de integración, * colaboración y conocimiento, que gracias al uso de tecnología semántica puede generar contextos de * información alrededor de algún tema de interés o bien integrar información y aplicaciones de diferentes * fuentes, donde a la información se le asigna un significado, de forma que pueda ser interpretada y * procesada por personas y/o sistemas, es una creación original del Fondo de Información y Documentación * para la Industria INFOTEC, cuyo registro se encuentra actualmente en trámite. * * INFOTEC pone a su disposición la herramienta SemanticWebBuilder a través de su licenciamiento abierto al público (‘open source’), * en virtud del cual, usted podrá usarlo en las mismas condiciones con que INFOTEC lo ha diseñado y puesto a su disposición; * aprender de él; distribuirlo a terceros; acceder a su código fuente y modificarlo, y combinarlo o enlazarlo con otro software, * todo ello de conformidad con los términos y condiciones de la LICENCIA ABIERTA AL PÚBLICO que otorga INFOTEC para la utilización * del SemanticWebBuilder 4.0. * * INFOTEC no otorga garantía sobre SemanticWebBuilder, de ninguna especie y naturaleza, ni implícita ni explícita, * siendo usted completamente responsable de la utilización que le dé y asumiendo la totalidad de los riesgos que puedan derivar * de la misma. * * Si usted tiene cualquier duda o comentario sobre SemanticWebBuilder, INFOTEC pone a su disposición la siguiente * dirección electrónica: * http://www.semanticwebbuilder.org */ package org.semanticwb.portal.portlet; import java.io.IOException; import java.io.PrintWriter; import javax.portlet.Portlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.semanticwb.portal.api.SWBActionResponse; import org.semanticwb.portal.api.SWBParamRequest; /** * * @author Javier Solis Gonzalez */ public interface WBPortletContainer { final static String ATT_PORTLET_DEFINITION = "com.infotec.wb.portlet.PortletDefinition"; final static String ATT_PORTLET = "com.infotec.wb.portlet.Portlet"; final static String ATT_METHOD = "com.infotec.wb.portlet.Method"; final static String ATT_PORTLET_REQUEST = "javax.portlet.request"; final static String ATT_PORTLET_RESPONSE = "javax.portlet.response"; final static String ATT_PORTLET_CONFIG = "javax.portlet.config"; final static Integer VAL_METHOD_RENDER = new Integer(0); final static Integer VAL_METHOD_ACTION = new Integer(1); final static Integer VAL_METHOD_LOAD = new Integer(2); final static Integer VAL_METHOD_INIT = new Integer(3); public Portlet loadPortlet(WBPortletDefinition def, HttpServletRequest request); public WBPortletDefinition getPortletDefinition(String site, String id); public void removePortletDefinition(String site, String id); public void addPortletDefinition(WBPortletDefinition def); public void log(Throwable e); public void log(String msg); public void log(String msg, Throwable e); public void invoke_render(HttpServletRequest request, HttpServletResponse response, SWBParamRequest params, WBPortletDefinition def) throws ServletException, IOException; public void invoke_action(HttpServletRequest request, SWBActionResponse params, WBPortletDefinition def) throws ServletException, IOException; }
fb17ff51a8e7b54ea7242de8b8283f1d45354329
08ab891e5cae800aa0f61b8cd928dacf37969301
/ndkrtspserver/src/main/java/com/peng/jni/AudioConfig.java
de6de72949c745c23a37baa7c19e6f4311ce011f
[]
no_license
ps993390891/PengSheng
88d69ff6756edbd46cceae3d1fd1b82df12c4301
c6968af658db164157fb840d46754660e884f449
refs/heads/master
2020-12-04T19:16:17.443787
2020-03-16T09:31:54
2020-03-16T09:31:54
231,878,733
0
0
null
null
null
null
UTF-8
Java
false
false
1,023
java
package com.peng.jni; public class AudioConfig { /*音频源*/ private final int audioSource; /*采样率*/ private final int sampleRateInHz; /*声道*/ private final int channelConfig; // private final int channelConfigOut; /*编码制式和采样大小*/ private final int audioFormat; public AudioConfig(AudioConfigBuilder builder) { this.audioSource = builder.audioSource; this.sampleRateInHz = builder.sampleRateInHz; this.channelConfig = builder.channelConfig; // this.channelConfigOut = builder.channelConfigOut; this.audioFormat = builder.audioFormat; } public int getAudioSource() { return audioSource; } public int getSampleRateInHz() { return sampleRateInHz; } public int getChannelConfig() { return channelConfig; } // public int getChannelConfigOut() { // return channelConfigOut; // } public int getAudioFormat() { return audioFormat; } }
392d96726efff6cc29b0c42b7375cfa5335f6cb8
bcacc9be9bd8074d84b0dd4f7539aa00156a7305
/core-persistence/src/main/java/org/csr/core/persistence/business/dao/OrganizationParameterDao.java
5dc3b7a358ae5d93166002dac0ee2c4e8ec71bce
[]
no_license
cj0829/core
8b308fd5de65a5469b67e625f1a39510d0061432
d57ca9db284b7b25e9a2f5692efeed8d0734cf20
refs/heads/master
2020-05-09T23:49:53.148415
2019-04-15T15:19:52
2019-04-15T15:19:52
86,766,356
1
0
null
null
null
null
UTF-8
Java
false
false
957
java
package org.csr.core.persistence.business.dao; import java.util.List; import org.csr.core.persistence.BaseDao; import org.csr.core.persistence.business.domain.OrganizationParameter; /** * ClassName:OrganizationParameterDao.java <br/> * System Name: 用户管理系统 <br/> * Date: 2014-2-28上午10:08:55 <br/> * @author caijin <br/> * @version 1.0 <br/> * @since JDK 1.7 * * 功能描述: <br/> * 公用方法描述: <br/> */ public interface OrganizationParameterDao extends BaseDao<OrganizationParameter,Long> { /** * @description:根据机构Id查询机构参数表信息 * @param: root:机构Id * @return: List * @author:wangxiujuan */ public List<OrganizationParameter> findByOrgId(Long orgId); /** * * deleteForRoot: 描述方法的作用 <br/> * @author caijin * @param root * @since JDK 1.7 */ public void deleteForOrgId(Long orgId); }
530dc8ce107801c881ffb8f4a569023d673ee8cd
c3b5b2171098b6e38d950a896afdf59862116f84
/src/main/java/com/webstore/app/service/dto/UserDTO.java
f16b4fa30ad2d234eb2b2be43849bb925dd09573
[]
no_license
nazar9501/Jhipster-angular-webstore
5171d0b6d9f18d1e6bc7af26c14be5196cbc8f3a
dd44f84d2c404412d6d6e3c7e32c0dd16d96416b
refs/heads/master
2020-04-18T16:07:28.258459
2019-01-26T12:22:10
2019-01-26T12:22:10
167,627,624
0
0
null
null
null
null
UTF-8
Java
false
false
4,614
java
package com.webstore.app.service.dto; import com.webstore.app.config.Constants; import com.webstore.app.domain.Authority; import com.webstore.app.domain.User; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.*; import java.time.Instant; import java.util.Set; import java.util.stream.Collectors; /** * A DTO representing a user, with his authorities. */ public class UserDTO { private Long id; @NotBlank @Pattern(regexp = Constants.LOGIN_REGEX) @Size(min = 1, max = 50) private String login; @Size(max = 50) private String firstName; @Size(max = 50) private String lastName; @Email @Size(min = 5, max = 254) private String email; @Size(max = 256) private String imageUrl; private boolean activated = false; @Size(min = 2, max = 6) private String langKey; private String createdBy; private Instant createdDate; private String lastModifiedBy; private Instant lastModifiedDate; private Set<String> authorities; public UserDTO() { // Empty constructor needed for Jackson. } public UserDTO(User user) { this.id = user.getId(); this.login = user.getLogin(); this.firstName = user.getFirstName(); this.lastName = user.getLastName(); this.email = user.getEmail(); this.activated = user.getActivated(); this.imageUrl = user.getImageUrl(); this.langKey = user.getLangKey(); this.createdBy = user.getCreatedBy(); this.createdDate = user.getCreatedDate(); this.lastModifiedBy = user.getLastModifiedBy(); this.lastModifiedDate = user.getLastModifiedDate(); this.authorities = user.getAuthorities().stream() .map(Authority::getName) .collect(Collectors.toSet()); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } 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 getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public boolean isActivated() { return activated; } public void setActivated(boolean activated) { this.activated = activated; } public String getLangKey() { return langKey; } public void setLangKey(String langKey) { this.langKey = langKey; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Instant getCreatedDate() { return createdDate; } public void setCreatedDate(Instant createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public Instant getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public Set<String> getAuthorities() { return authorities; } public void setAuthorities(Set<String> authorities) { this.authorities = authorities; } @Override public String toString() { return "UserDTO{" + "login='" + login + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", imageUrl='" + imageUrl + '\'' + ", activated=" + activated + ", langKey='" + langKey + '\'' + ", createdBy=" + createdBy + ", createdDate=" + createdDate + ", lastModifiedBy='" + lastModifiedBy + '\'' + ", lastModifiedDate=" + lastModifiedDate + ", authorities=" + authorities + "}"; } }
f2fea6c937faa553d627b190e7dd638ff96e1e2b
7361d361ef69c1cc3ee2b747bd427bbb6ba6e9a7
/src/com/javarush/test/level04/lesson13/task03/Solution.java
4227a7044023b4ee0fb96d1f28f8ca4d14612e74
[]
no_license
gegorov/JavaRushHomeWork
cafc8a59b8f0787ae2a80682030d92e696056d72
f3bee11ce7464093ccc535046ad80130b718ed99
refs/heads/master
2021-01-12T02:47:45.535870
2017-01-23T14:22:00
2017-01-23T14:22:00
78,105,787
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.javarush.test.level04.lesson13.task03; import java.io.*; /* Рисуем треугольник Используя цикл for вывести на экран прямоугольный треугольник из восьмёрок со сторонами 10 и 10. Пример: 8 88 888 ... */ public class Solution { public static void main(String[] args) throws Exception { //напишите тут ваш код for(int i = 0; i < 10; i++) { for(int j = 0; j <= i; j++) System.out.print(8); System.out.println(""); } } }
1d526627f9183785ca080923810e1eb502577647
83630e9a3642cd42afd06e0818a7078fd8a2e633
/ed08/src/test/java/com/fatec/ed08/REQ01MantemLivrosTest.java
9bdf154670f5374508cb4e9e046c75faf9ae8d26
[]
no_license
rogrlj/TestesDeSoftware
78e827ce5c3dc609e6094be06f78cbc6a80219b3
a1c068a91b41c4fede692cf70fde511d752601c2
refs/heads/master
2023-08-22T22:04:22.773096
2021-10-16T00:01:15
2021-10-16T00:01:15
417,668,690
0
0
null
null
null
null
UTF-8
Java
false
false
6,716
java
package com.fatec.ed08; import static org.assertj.core.api.Assertions.not; import static org.hamcrest.CoreMatchers.is; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; class REQ01MantemLivrosTest { private WebDriver driver; private Map<String, Object> vars; JavascriptExecutor js; @BeforeEach public void setUp() { System.setProperty("webdriver.chrome.driver", "browserDriver/chromedriver.exe"); driver = new ChromeDriver(); js = (JavascriptExecutor) driver; vars = new HashMap<String, Object>(); } @AfterEach public void tearDown() { driver.quit(); } @Test public void REQ01CT01_cadastrar_livro_com_sucesso() { //dado que o livro não esta cadastrado driver.get("https://ts-scel-web.herokuapp.com/login"); driver.findElement(By.name("username")).click(); driver.findElement(By.name("username")).sendKeys("jose"); driver.findElement(By.name("password")).click(); driver.findElement(By.name("password")).sendKeys("123"); driver.findElement(By.cssSelector("button")).click(); driver.findElement(By.linkText("Livros")).click(); espera(); // quando o usuario cadastrar um livro driver.findElement(By.id("isbn")).click(); driver.findElement(By.id("isbn")).sendKeys("1910"); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue"); driver.findElement(By.id("titulo")).click(); driver.findElement(By.id("titulo")).sendKeys("Vagabond"); driver.findElement(By.cssSelector(".btn:nth-child(1)")).click(); driver.findElement(By.cssSelector("body")).click(); // entao apresenta as informacoes do livro assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros")); driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).click(); assertEquals(driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).getText(), is("Vagabond")); driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click(); } @Test public void REQ01CT02_altera_autor_e_titulo_de_livro_ja_cadastrado() { //dado que o livro não esta cadastrado driver.get("https://ts-scel-web.herokuapp.com/login"); driver.findElement(By.name("username")).click(); driver.findElement(By.name("username")).sendKeys("jose"); driver.findElement(By.name("password")).click(); driver.findElement(By.name("password")).sendKeys("123"); driver.findElement(By.cssSelector("button")).click(); driver.findElement(By.linkText("Livros")).click(); driver.findElement(By.id("isbn")).click(); driver.findElement(By.id("isbn")).sendKeys("1910"); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue"); driver.findElement(By.id("titulo")).click(); driver.findElement(By.id("titulo")).sendKeys("Vagabond"); driver.findElement(By.cssSelector(".btn:nth-child(1)")).click(); driver.findElement(By.cssSelector("body")).click(); // quando o usuario altera o autor e o titulo do livro driver.findElement(By.linkText("Livros")).click(); driver.findElement(By.linkText("Lista de Livros")).click(); driver.findElement(By.cssSelector("tr:nth-child(2) .btn-primary")).click(); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).click(); { WebElement element = driver.findElement(By.id("autor")); Actions builder = new Actions(driver); builder.doubleClick(element).perform(); } driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).sendKeys("Kazuo Koike"); driver.findElement(By.id("titulo")).click(); driver.findElement(By.cssSelector(".row:nth-child(4) > .form-group:nth-child(1)")).click(); driver.findElement(By.id("titulo")).sendKeys("Lobo Solitario"); driver.findElement(By.cssSelector(".btn")).click(); driver.findElement(By.cssSelector("body")).click(); // entao o sistema apresenta as informações do livro com o titulo e autor alterado assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros")); driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).click(); assertEquals(driver.findElement(By.cssSelector("tr:nth-child(2) > td:nth-child(3)")).getText(), is("Lobo Solitario")); driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click(); } @Test public void rEQ01CT03() { //dado que o livro ja esta cadastrado driver.get("https://ts-scel-web.herokuapp.com/login"); driver.findElement(By.name("username")).click(); driver.findElement(By.name("username")).sendKeys("jose"); driver.findElement(By.name("password")).click(); driver.findElement(By.name("password")).sendKeys("123"); driver.findElement(By.cssSelector("button")).click(); driver.findElement(By.linkText("Livros")).click(); driver.findElement(By.id("isbn")).click(); driver.findElement(By.id("isbn")).sendKeys("1910"); driver.findElement(By.id("autor")).click(); driver.findElement(By.id("autor")).sendKeys("Takehiko Inoue"); driver.findElement(By.id("titulo")).click(); driver.findElement(By.id("titulo")).sendKeys("Vagabond"); driver.findElement(By.cssSelector(".btn:nth-child(1)")).click(); driver.findElement(By.cssSelector("body")).click(); // quando o usuario excluir o livro driver.findElement(By.linkText("Livros")).click(); driver.findElement(By.linkText("Lista de Livros")).click(); driver.findElement(By.cssSelector("tr:nth-child(2) .delete")).click(); driver.findElement(By.id("paginaConsulta")).click(); // entao o sistema apresenta as informações do livro sem o livro excluido assertEquals(driver.findElement(By.id("paginaConsulta")).getText(), is("Lista de livros")); driver.findElement(By.cssSelector("html")).click(); assertEquals(driver.findElement(By.cssSelector("html")).getText(), is(not("Lobo Solitario"))); } public void espera() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }
2e9af2558d362c3527264d6e2edc1e1e809c6c3d
2d867531592c7a0ecd1267fc62e5e49ef3118355
/java-study/news/src/com/zl/service/impl/NewsServiceImpl.java
ff26d1cc8dd43ec12500f12a1d2f1a135b75313c
[]
no_license
AMORHLS/java-baseStudy
b06b9eefe80c9c8ece056d56b2196c94973288b4
c224abb8ad1d7d932ef1eeac5210289d0d1b83fa
refs/heads/master
2021-04-06T08:40:50.921309
2018-03-14T03:07:23
2018-03-14T03:07:23
125,147,008
0
1
null
null
null
null
GB18030
Java
false
false
924
java
package com.zl.service.impl; import java.util.List; import com.zl.dao.NewsDao; import com.zl.dao.impl.NewsDaoImpl; import com.zl.pojo.News; import com.zl.service.NewsService; public class NewsServiceImpl implements NewsService { private NewsDao newsDao; public NewsServiceImpl() { newsDao = new NewsDaoImpl(); } public List<News> getNewsList() { return newsDao.queryNews(); } public boolean addNews(News news) { return newsDao.addNews(news); } // 根据ID查询特定新闻信息 public News getNewsById(int id) { return newsDao.getNewsById(id); } //获取新闻总数据 public int getTotalCount(){ return newsDao.getTotalCount(); } //分页获取新闻数据 public List<News> getPageNewsList(int pageNo,int pageSize){ return newsDao.getPageNewsList(pageNo, pageSize); } // 删除新闻标题根据id public boolean deleteNews(News news){ return newsDao.deleteNews(news); } }
d17264419d59bec88a050497d3d7e9a3bc639715
94ce05661c7a79c2986be4f1ffc8696c74ccf7ea
/app/src/main/java/com/xuliwen/dm/responsibilitychain/ConcreteRequest2.java
01df38b01b6108517857408cb3d3473d8fb7e4ba
[]
no_license
guangmomo/DesignModle
468879c087378994fb96666687b205ffbb8702ed
5579bd7a8b90e98592a0e587ba176f669bc13ab5
refs/heads/master
2020-03-28T20:32:08.011066
2017-11-22T06:57:55
2017-11-22T06:57:55
94,613,256
1
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.xuliwen.dm.responsibilitychain; /** * Created by xlw on 2017/5/10. */ public class ConcreteRequest2 extends AbstractRequest{ public ConcreteRequest2(Object object) { super(object); } @Override public int getLevel() { return 2; } }
de1f261f1073f6fa1c4548d54201839231b221d5
41a846e632e3cab3b5264f7b2e06eb6c883320a8
/ShopApp/src/cn/cote/yzm/GeetestConfig.java
55aa0a86bb10a8f7f0d8e611b0b00079ec672c21
[]
no_license
CoTeNull/TrainingDemo
53c063c0af58c1025ee5843a52f8b772c1bc1f32
7a6ddbe63213f4650ab4bac7223eccaa9df82260
refs/heads/master
2020-03-24T16:20:44.951754
2019-01-14T00:54:51
2019-01-14T00:54:51
142,821,281
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
package cn.cote.yzm; import javax.swing.text.StyledEditorKit.BoldAction; /** * GeetestWeb配置文件 * * */ public class GeetestConfig { // 填入自己的captcha_id和private_key private static final String geetest_id = "df4785a3168a694fc82d2a5f3e52caf7"; private static final String geetest_key = "c6cf0fb514cf175ba18d6ffeb844d8ec"; private static final boolean newfailback = true; public static final String getGeetest_id() { return geetest_id; } public static final String getGeetest_key() { return geetest_key; } public static final boolean isnewfailback() { return newfailback; } }
578afbdeddd3fd3eed7c93197e820735c1443aad
9a6673e21635aefe3dc4ba80fbe3869f43bb3010
/app/src/main/java/com/luckyseven/safeph/Listeners/IExposureListener.java
6878c98d4e1be2aa55b62650dd3b34f5487ba329
[]
no_license
jtejido/safeph-android
213358d95ffacfc73b42f2cc760b4e3b28e531c2
103e5b581073490d2b906e1db155205047549f67
refs/heads/master
2022-12-02T19:26:46.141114
2020-08-17T19:59:35
2020-08-17T19:59:35
288,035,305
0
0
null
null
null
null
UTF-8
Java
false
false
421
java
package com.luckyseven.safeph.Listeners; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey; import java.util.List; public interface IExposureListener { void onStarted(); void onStopped(); void onApiException(ApiException apiException, int requestCode); void onExposureKeysRetrieved(List<TemporaryExposureKey> keys); }
e3f61d3e38385b6bb5ae6eb590cfc9bd1d88de5f
548a1b731709a376e079e1f0417cc401cce70aaf
/src/main/java/debug/Company.java
654c38ae611e6645393f099f8debce74e67090d5
[]
no_license
egydGIT/javaBackend
0e96c6b2bab639ccdb4631b481b69a2205d3963c
be22a7148e10fb6da019a74e916dcd353fb53e70
refs/heads/master
2023-06-25T00:41:32.443210
2021-07-11T12:33:10
2021-07-11T12:33:10
309,369,092
0
0
null
null
null
null
UTF-8
Java
false
false
2,315
java
package debug; import java.util.ArrayList; import java.util.List; public class Company { // Employee employee = new Employee(); private List<Employee> employees; // employees nevű lista deklaráció public Company(List<Employee> employees) { // Konstruktor, paraméterben kapott listát this.employees = employees; // értékül adja a fent deklarált listának } public void addEmployee(Employee employee) { // addE metódus, ami a param-ben átadott nevet employees.add(employee); // add met-sal hozzáadja a listához } public Employee findEmployeeByName(String name) { // Metódus, ami adott nevet keres a listában for (Employee employee : employees) { // For-each ciklus, deklarál egy Emloyee tipusú változót, // ami végigiterál a lista minden elemén if (employee.getName().equals(name)) { // For-e c változójára meghívom getName met-t Visszaad: nevet // majd ezt a nevet összehasonlítom az equals met-sal // a findEBN met paraméterében megadott névvel. return employee; // Visszatér a f-e c változója. Visszat.érték: true, false } } return null; // ?? } public List<String> listEmployeeNames() { // Metódus, ami kiírja a listában lévő neveket List<String> names = new ArrayList<>(); // 2. lista deklaráció, amibe elmentem az első lista neveit for (Employee employee : employees) { // for-e ciklus, ami végig lépked az emloyye listán names.add(employee.getName()); // 2. listához add metódussal hozzáadom // employee vált. getName met-sal lekért aktuális értékét } return names; // miután lezajlott a f-e ciklus, téjen vissza a 2. listával } }
a2854ae43b82c8e65333999c2c5a2546a77cba66
5d7f1ae962a2c51ee9fc666545c4b0e701d7902e
/src/chat/model/Chatbot.java
60703a6bfe0d69d1ae8619393b541924f316e64e
[]
no_license
MaTtAtTx/Chatbot
b07d1bb246a25d3ea14f21050513e6cc402c4ca9
79209fbece0188fc8d40784a2b5787743126e61e
refs/heads/master
2021-09-10T12:52:09.223242
2018-03-26T14:51:41
2018-03-26T14:51:41
107,289,396
0
0
null
null
null
null
UTF-8
Java
false
false
7,868
java
package chat.model; import java.util.List; import java.time.LocalTime; import java.util.ArrayList; /** * The Chatbot subclass for the chatbot project. * * @author Matthew Johnsen * @version 11/21/17 1.2 */ public class Chatbot { private List<Movie> movieList; private List<String> shoppingList; private List<String> cuteAnimalMemes; private String [] verbs; private String [] topics; private String [] followUps; private String [] questions; private String username; private String content; private String intro; private LocalTime currentTime; public Chatbot(String username) { this.movieList = new ArrayList<Movie>(); this.shoppingList = new ArrayList<String>(); this.cuteAnimalMemes = new ArrayList<String>(); this.verbs = new String [4]; this.topics = new String [7]; this.followUps = new String [5]; this.questions = new String [10]; this.username = username; this.content = ""; this.intro = ""; this.currentTime = LocalTime.now(); buildMovieList(); buildShoppingList(); buildCuteAnimals(); buildVerbs(); buildTopics(); buildFollowUps(); buildQuestions(); } private void buildMovieList() { movieList.add(new Movie("Angels and Demons")); movieList.add(new Movie("The Hunger Games")); movieList.add(new Movie("Harry Potter")); movieList.add(new Movie("Pirates of the Carribbean")); movieList.add(new Movie("Inception")); movieList.add(new Movie("National Treasure")); } private void buildShoppingList() { shoppingList.add("protein"); shoppingList.add("veggies"); shoppingList.add("snacks"); shoppingList.add("fruits"); shoppingList.add("candy"); shoppingList.add("eggs"); shoppingList.add("hot peppers"); shoppingList.add("onions"); shoppingList.add("bagel"); shoppingList.add("crunchy peanut butter"); shoppingList.add("hot sauce"); shoppingList.add("juice"); } private void buildCuteAnimals() { cuteAnimalMemes.add("pupper"); cuteAnimalMemes.add("otter"); cuteAnimalMemes.add("FLOOFER"); cuteAnimalMemes.add("kittie"); } private void buildVerbs() { verbs[0] = "like"; verbs[1] = "dislike"; verbs[2] = "ambivalent about"; verbs[3] = "am thinking about"; } private void buildTopics() { topics[0] = "programming"; topics[1] = "school"; topics[2] = "sports"; topics[3] = "food"; topics[4] = "TV shows"; topics[5] = "books"; topics[6] = "computers"; } private void buildFollowUps() { followUps[0] = "I really like dogs. Do you?"; followUps[1] = "I really like cats. Do you?"; followUps[2] = "I really like ice cream. What's your favorite flavor of ice cream?"; followUps[3] = "I like going to restaurants. What's your favorite restaurant?"; followUps[4] = "I love boating. Have you ever been boating before?"; } private void buildQuestions() { questions[0] = "What is your name?"; questions[1] = "How are you today?"; questions[2] = "What are you going to do this weekend?"; questions[3] = "What is your favorite thing to do in you free time?"; questions[4] = "What is your favorite subject in school?"; questions[5] = "What is your favorite color?"; questions[6] = "What is your favorite restaurant?"; questions[7] = "Do you have a car?"; questions[8] = "How old are you?"; questions[9] = "What country do you live in?"; } public String processConversation(String input) { String chatbotResponse = ""; chatbotResponse += currentTime.getHour() + ":" + currentTime.getMinute() + " \n"; chatbotResponse += "You said:" + "\n" + input + "\n"; chatbotResponse += buildChatbotResponse(); return chatbotResponse; } private String buildChatbotResponse() { String response = "I "; int random2 = ((int) (Math.random() * 2)) % 2; int random = (int) (Math.random() * verbs.length); response += verbs[random]; random = (int) (Math.random() * topics.length); response += " " + topics[random] + ".\n"; random = (int) (Math.random() * questions.length); if (random2 == 0) { response += questions[random]; } else { response += questions[random] + "\n"; } if (random2 == 0) { random = (int) (Math.random() * movieList.size()); response += "\n" + movieList.get(random).getTitle() + " is a great movie!\n"; } int followup = (int) (Math.random() * 5); switch (followup) { case 0: response += followUps[0] + "\n"; break; case 3: response += followUps[1] + "\n"; case 2: response += followUps[2] + "\n"; break; default: response += followUps[4] + "\n"; response += followUps[3] + "\n"; break; } return response; } public boolean lengthChecker(String input) { boolean validLength = false; if (input != null && input.length() > 2) { validLength = true; } return validLength; } public boolean htmlTagChecker(String input) { boolean containsHTML = false; if (input == null || !input.contains("<")) { return containsHTML; } int firstOpen = input.indexOf("<"); int firstClose = input.indexOf(">",firstOpen); int secondOpen = -9; int secondClose = -9; String tagText = ""; //Check bad tags if(input.contains("<>") || input.indexOf("< >") > -1) { containsHTML = false; } //Check singleton if(input.toUpperCase().contains("<P>") || input.toLowerCase().contains("<br>")) { containsHTML = true; } //Check others else if (firstClose > firstOpen) { //Others tagText = input.substring(firstOpen + 1, firstClose).toLowerCase(); secondOpen = input.toLowerCase().indexOf("</" + tagText, firstClose); } return containsHTML; } public boolean userNameChecker(String input) { boolean userNameCheck = false; if (input != null && input.length() > 0 && input.startsWith("@")) { if (input.indexOf("@") == input.lastIndexOf("@")) { userNameCheck = true; } } return userNameCheck; } public boolean contentChecker(String contentCheck) { boolean checkContent = false; if (contentCheck.contains(content)) { checkContent = true; } return checkContent; } public boolean cuteAnimalMemeChecker(String input) { boolean animalCheck = false; for (int index = 0; index < cuteAnimalMemes.size(); index += 1) { if (input.contains(cuteAnimalMemes.get(index))) { animalCheck = true; } } return animalCheck; } public boolean shoppingListChecker(String shoppingItem) { boolean shoppingListCheck = false; for (int index = 0; index < shoppingList.size(); index += 1) { if (shoppingItem.contains(shoppingList.get(index))) { shoppingListCheck = true; } } return shoppingListCheck; } public boolean movieTitleChecker(String title) { return false; } public boolean movieGenreChecker(String genre) { return false; } public boolean quitChecker(String exitString) { if (exitString != null && exitString.equalsIgnoreCase("quit")) { return true; } return false; } public boolean keyboardMashChecker(String sample) { return false; } public List<Movie> getMovieList() { return movieList; } public List<String> getShoppingList() { return shoppingList; } public List<String> getCuteAnimalMemes() { return cuteAnimalMemes; } public String [] getQuestions() { return questions; } public String[] getVerbs() { return verbs; } public String[] getTopics() { return topics; } public String[] getFollowUps() { return followUps; } public String getUsername() { return username; } public String getContent() { return content; } public String getIntro() { return intro; } public LocalTime getCurrentTime() { return currentTime; } public void setUsername(String username) { this.username = username; } public void setContent(String content) { this.content = content; } }
a48859552182af8b0759ffafbc05b2d29f9ee42f
f028c8dcde5175c0c91a3cb7b53d964eac551e7f
/src/zad2/Test.java
8a5b7a020d5ab9318b0d3038421011209fb31a83
[]
no_license
Nikadoo/GUI-homework
6f73d98e88fe8db7b0238670adf8d8695bbc9738
ef193de1947d463a458e0f9e53d6b0fa1d08d3de
refs/heads/master
2023-01-13T11:30:50.312457
2020-11-17T22:44:08
2020-11-17T22:44:08
313,760,356
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
/** * * @author Ługowska Dominika S17226 * */ package zad2; public class Test { public static void main(String[] args) { Pacjent[] pacjenci = { new ChoryNaGlowe("Janek"), new ChoryNaNoge("Edzio"), new ChoryNaDyspepsje("Marian") }; for (Pacjent p : pacjenci) { System.out.println("Pacjent: " + p.nazwisko() + '\n' + "Chory na: " + p.choroba() + '\n' + "Zastosowano: " + p.leczenie() +"\n\n" ); } } }
7cec8e639fd019f88144a62c7c0319abe0c2f49d
1f3cdd68a7c24460e4b33f59fc6701e2c4599e9b
/app/src/main/java/cn/com/xibeiuniversity/xibeiuniversity/activity/DetailImageActivity.java
b635e4927056535acb126a6f6bb5fc3108a5504a
[]
no_license
sun529417168/XiBeiUniversity
7c3e5336d646c68e3115c2f6ff4bee8e1e904cf2
7e8f21a56fed59b5b018eadc975997a0d4ccfb11
refs/heads/master
2021-01-19T13:08:44.937372
2017-04-21T07:05:36
2017-04-21T07:05:36
83,405,504
0
1
null
null
null
null
UTF-8
Java
false
false
7,641
java
package cn.com.xibeiuniversity.xibeiuniversity.activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import cn.com.xibeiuniversity.xibeiuniversity.R; import cn.com.xibeiuniversity.xibeiuniversity.base.BaseActivity; /** * 文件名:DetailImageActivity * 描 述:查看图片类 * 作 者:stt * 时 间:2017.01.09 * 版 本:V1.0.0 */ public class DetailImageActivity extends BaseActivity implements ViewPager.OnPageChangeListener { /** * ViewPager */ private ViewPager viewPager; /** * 装点点的ImageView数组 */ private ImageView[] tips; /** * 装ImageView数组 */ private ImageView[] mImageViews; private ImageView mImageViewObj; private ArrayList<Bitmap> list = new ArrayList<Bitmap>(); private ArrayList listPath = new ArrayList(); private int imageType = -1; private Handler mHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { // 正在下载 case 1: ImageView imageView = (ImageView) msg.obj; Bitmap bitmap = msg.getData().getParcelable("bitmap"); imageView.setImageBitmap(bitmap); break; default: break; } } ; }; @Override protected void setView() { setContentView(R.layout.activity_detail_image); } @Override protected void setDate(Bundle savedInstanceState) { imageType = getIntent().getIntExtra("type", 0); if (imageType == 1) { listPath = getIntent().getStringArrayListExtra("listPath"); } else { listPath = getIntent().getStringArrayListExtra("listPath"); for (int i = 0; i < listPath.size(); i++) { BitmapFactory.Options option = new BitmapFactory.Options(); option.inSampleSize = 2; Bitmap bitmap = BitmapFactory.decodeFile((String) listPath.get(i), option); list.add(bitmap); } } } public void getBitmap(final String url, ImageView imageView) { Bitmap bm = null; try { URL iconUrl = new URL(url); URLConnection conn = iconUrl.openConnection(); HttpURLConnection http = (HttpURLConnection) conn; int length = http.getContentLength(); conn.connect(); // 获得图像的字符流 InputStream is = conn.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is, length); bm = BitmapFactory.decodeStream(bis); bis.close(); is.close();// 关闭流 Message msg = mHandler.obtainMessage(); msg.what = 1; msg.obj = imageView; Bundle data = new Bundle(); data.putParcelable("bitmap", bm); msg.setData(data); mHandler.sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } } @Override protected void init() { ViewGroup group = (ViewGroup) findViewById(R.id.activity_detailImage_viewGroup); viewPager = (ViewPager) findViewById(R.id.activity_detailImage_viewPager); // 将点点加入到ViewGroup中 tips = new ImageView[listPath.size()]; for (int i = 0; i < tips.length; i++) { ImageView imageView = new ImageView(this); imageView.setLayoutParams(new ViewGroup.LayoutParams(10, 10)); tips[i] = imageView; if (i == 0) { tips[i].setBackgroundResource(R.mipmap.item_yuan_yes); } else { tips[i].setBackgroundResource(R.mipmap.item_yuan_no); } LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( new ViewGroup.LayoutParams(ViewPager.LayoutParams.WRAP_CONTENT, ViewPager.LayoutParams.WRAP_CONTENT)); layoutParams.leftMargin = 5; layoutParams.rightMargin = 5; group.addView(imageView, layoutParams); } if (imageType == 1) { mImageViews = new ImageView[listPath.size()]; for (int i = 0; i < listPath.size(); i++) { final ImageView imageView = new ImageView(this); mImageViews[i] = imageView; final int finalI = i; new Thread(new Runnable() { @Override public void run() { getBitmap((String) listPath.get(finalI), imageView); } }).start(); } } else { // 将图片装载到数组中 mImageViews = new ImageView[list.size()]; for (int i = 0; i < mImageViews.length; i++) { ImageView imageView = new ImageView(this); mImageViews[i] = imageView; imageView.setImageBitmap(list.get(i)); } } // 设置Adapter viewPager.setAdapter(new MyAdapter()); // 设置监听,主要是设置点点的背景 viewPager.addOnPageChangeListener(this); // 设置ViewPager的默认项, 设置为长度的100倍,这样子开始就能往左滑动 // viewPager.setCurrentItem((mImageViews.length) * 100); } /** * 文件名:MyAdapter * 描 述:图片滑动的适配器 * 作 者:stt * 时 间:2016.12.06 * 版 本:V1.0.0 */ public class MyAdapter extends PagerAdapter { @Override public int getCount() { return mImageViews.length; } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(mImageViews[position]); } /** * 载入图片进去,用当前的position 除以 图片数组长度取余数是关键 */ @Override public Object instantiateItem(ViewGroup container, int position) { container.addView(mImageViews[position], 0); return mImageViews[position]; } } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { setImageBackground(position % mImageViews.length); } @Override public void onPageScrollStateChanged(int state) { } /** * 设置选中的tip的背景 * * @param selectItems */ private void setImageBackground(int selectItems) { for (int i = 0; i < tips.length; i++) { if (i == selectItems) { tips[i].setBackgroundResource(R.mipmap.item_yuan_yes); } else { tips[i].setBackgroundResource(R.mipmap.item_yuan_no); } } } }
5d9b55f537ba433ee8ed9cfc1125d670304519eb
36626dd49b4a2be1540d579f5302b92c289fe808
/refactoring.upc.edu.pe/src/test/java/refactoring/upc/edu/pe/test/MainTest.java
96e3ff0050bc69cf3bb3fb05f7a0d8359b746966
[]
no_license
Furtherron/RefactoringVideoStore
028fc64c60d6e3dda099e2a278d32185b4727af7
fce9d42b99b6a8d74a332347fc843356611818c3
refs/heads/master
2020-09-04T01:36:03.051782
2019-11-04T03:54:34
2019-11-04T03:54:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package refactoring.upc.edu.pe.test; import static org.junit.Assert.*; import org.junit.Test; import refactoring.upc.edu.pe.Customer; import refactoring.upc.edu.pe.Movie; import refactoring.upc.edu.pe.Rental; public class MainTest { @Test public void testCustomer() { Customer c = new Customer("Jamie"); assertNotNull(c); } @Test public void testStatement() throws Exception { Movie m1 = new Movie("Interstella", Movie.REGULAR); Movie m2 = new Movie("Arrival", Movie.NEW_RELEASE); Movie m3 = new Movie("Moana", Movie.CHILDRENS); Movie m4 = new Movie("LaLaLand", Movie.NEW_RELEASE); Customer c = new Customer("Jamie"); c.addRental(new Rental(m1, 3)); c.addRental(new Rental(m2, 4)); c.addRental(new Rental(m3, 5)); c.addRental(new Rental(m4, 6)); String statementResult = c.statement(); System.out.println(statementResult); assertEquals("Rental Record for Jamie\n" + "\tInterstella\t3.5\n" + "\tArrival\t12.0\n" + "\tMoana\t4.5\n" + "\tLaLaLand\t18.0\n" + "You owed 38.0\n" + "You earned 6 frequent renter points\n", statementResult); } }
a299deb9570a75b1f8ccd5b92f156af0946f2670
da9f6660eaa26607b36ef0aee1ea5f5aef0ddb9f
/apm-opentracing/src/main/java/co/elastic/apm/opentracing/package-info.java
c5535e0540c813b19febb4238c43c8317b4d3689
[ "BSD-3-Clause", "CC0-1.0", "CDDL-1.0", "MIT", "Apache-2.0", "BSD-2-Clause" ]
permissive
elastic/apm-agent-java
9d29e415cd9b37235ef8762bb8abc707fd8b82b8
b38dfee9a9365c3a5a406aeaa390b9974f843f38
refs/heads/main
2023-09-01T17:56:18.440597
2023-08-31T15:49:51
2023-08-31T15:49:51
121,236,494
566
341
Apache-2.0
2023-09-14T09:44:24
2018-02-12T11:05:32
Java
UTF-8
Java
false
false
835
java
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package co.elastic.apm.opentracing;
637c9e835a9908466f0b1d398d31a8eef1f22f0b
893f4c6ff2b7c585bb86b2134b9d1fb79fc0fdec
/app/src/main/java/com/kangsoo/pharmacy/activity/NavigationDrawerAdapter.java
f4cc83e49b7e867f556e2d46b83ceb62a42b6561
[]
no_license
kangsoo/com-kangsoo-pharmacy
9da8e705c9ed67a1319eabcd31824338b5711849
fab5879aeb80c1cef9ea797537bbc5b891eb0ef4
refs/heads/master
2020-04-29T01:39:26.361304
2015-05-25T13:25:05
2015-05-25T13:25:49
35,393,402
1
0
null
null
null
null
UTF-8
Java
false
false
5,481
java
package com.kangsoo.pharmacy.activity; import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.kangsoo.pharmacy.R; import com.kangsoo.pharmacy.model.User; import java.util.ArrayList; import java.util.List; import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_ITEM_MENU; import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_ITEM_ORG; import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_SEPERATOR; import static com.kangsoo.pharmacy.activity.NavigationDrawerObject.TYPE_SUBHEADER; public class NavigationDrawerAdapter extends BaseAdapter { private final Context context; private final LayoutInflater inflater; private User org = null; private List<NavigationDrawerObject> data; public NavigationDrawerAdapter(Context context, User org) { this.org = org; this.context = context; this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); createData(); } private void createData() { //orgs.remove(0); String[] names = new String[]{ context.getString(R.string.home), context.getString(R.string.order), context.getString(R.string.account), context.getString(R.string.bookmarks) }; String[] icons = context.getResources().getStringArray(R.array.navigation_drawer_icon_list); data = new ArrayList<>(); int amount = names.length + 1 + 2; for (int i = 0; i < amount; i++) { if (i < names.length) data.add(new NavigationDrawerObject(names[i], icons[i], TYPE_ITEM_MENU)); else if (i == names.length) data.add(new NavigationDrawerObject(TYPE_SEPERATOR)); else if (i == names.length + 1) data.add(new NavigationDrawerObject("Organizations", TYPE_SUBHEADER)); else data.add(new NavigationDrawerObject(org.getName(), TYPE_ITEM_ORG, org)); } } public void setOrgs(User org) { this.org = org; notifyDataSetChanged(); } @Override public int getCount() { return data.size(); } @Override public NavigationDrawerObject getItem(int position) { return data.get(position); } @Override public long getItemId(int position) { return data.get(position).getType(); } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; final NavigationDrawerObject obj = data.get(position); if (convertView == null || obj.getType() != ((ViewHolder) convertView.getTag()).type) { viewHolder = new ViewHolder(); switch (obj.getType()) { case TYPE_ITEM_MENU: convertView = inflater.inflate(R.layout.navigation_drawer_list_item_text, parent, false); viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name); viewHolder.iconString = (TextView) convertView.findViewById(R.id.navigation_drawer_item_text_icon); break; case TYPE_ITEM_ORG: convertView = inflater.inflate(R.layout.navigation_drawer_list_item_image, parent, false); viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name); viewHolder.iconDrawable = (ImageView) convertView.findViewById(R.id .navigation_drawer_item_drawable_icon); break; case TYPE_SUBHEADER: convertView = inflater.inflate(R.layout.navigation_drawer_list_subheader, parent, false); viewHolder.name = (TextView) convertView.findViewById(R.id.navigation_drawer_item_name); convertView.setEnabled(false); convertView.setOnClickListener(null); break; default: convertView = inflater.inflate(R.layout.navigation_drawer_list_seperator, parent, false); convertView.setEnabled(false); convertView.setOnClickListener(null); break; } viewHolder.type = obj.getType(); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } switch (obj.getType()) { case TYPE_ITEM_MENU: Typeface font = Typeface.createFromAsset(context.getAssets(), "octicons.ttf"); viewHolder.iconString.setTypeface(font); viewHolder.iconString.setText(obj.getIconString()); viewHolder.name.setText(obj.getTitle()); break; case TYPE_ITEM_ORG: viewHolder.name.setText(obj.getTitle()); break; case TYPE_SUBHEADER: viewHolder.name.setText(obj.getTitle()); break; } return convertView; } private class ViewHolder { int type; TextView name; TextView iconString; ImageView iconDrawable; } }
b50b478f09b17d6a2c0eb5a2cd43ba6bb2a70c68
3e448fda9dae0752e579d68d3b034eeb8b112789
/src/com/aeothod/properties/PropertiesAppUtils.java
29ca7495445ee71dc96b5113e09184046d425b74
[]
no_license
AeoliaQAQ/commonJavafx
bd00b9b30f297c7f801b288c723d28190c51f1b7
b150b80c5b6ba85b521dfa9cb7712d47292d7b43
refs/heads/master
2020-05-20T18:46:02.591901
2019-05-09T03:01:44
2019-05-09T03:01:44
185,712,413
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.aeothod.properties; import com.aeothod.utils.AbstractPropertiesUtils; public class PropertiesAppUtils extends AbstractPropertiesUtils { private static PropertiesAppUtils utils; public static PropertiesAppUtils getInstance() { if (null == utils) { utils = new PropertiesAppUtils(); utils.init(); } return utils; } @Override protected String setPath() { return "config/application.properties"; } }
337cd58ffacdb8fc196b308ef1cdb6ee8a41bb71
fbf2aa1bc8d4413e75a7dec52b70ff78857fd40b
/src/main/java/pl/sda/javastart/day6/Pensioner.java
0f97d6f9df1d367743ed9ff139e799664f337e28
[]
no_license
sylwiaswieczkowska/javastart
d6aada32028a6a9f9586d55c72b2648fa6753eac
06640d4b31d3575ea8138fcedc159ba46aec2602
refs/heads/master
2020-04-19T18:06:18.408798
2019-11-13T12:18:59
2019-11-13T12:18:59
162,012,467
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
package pl.sda.javastart.day6; import java.math.BigDecimal; public class Pensioner extends Person { private BigDecimal pension; public Pensioner(String firstName, String lastName, Integer identity, Integer age, BigDecimal pension) { super(firstName, lastName, identity, age); this.pension = pension; } public void introductionInner(){ super.intoduction(); System.out.println("Ale też emerycik"); } @Override public BigDecimal showIncome() { return pension; } public BigDecimal getPension() { return pension; } public void setPension(BigDecimal pension) { this.pension = pension; } }
a50c09d094b4868fe4fa73fc157adc29fbf6853e
185c7cfdd132aeda18564f44968404f7a6558488
/src/main/java/za/ac/cput/domain/staff/StaffDemography.java
16bdd6ef40c6909e725ec0440b45496ea69ca7df
[]
no_license
examsAccount/domain
f7757db75604e1717533d8cf816ced27812a28c6
7a7ca008a140e2a6e0e87261b6badd82a1d7be32
refs/heads/master
2021-07-15T23:21:59.113542
2019-09-21T07:46:48
2019-09-21T07:46:48
209,937,154
0
0
null
2020-10-13T16:11:30
2019-09-21T06:33:13
Java
UTF-8
Java
false
false
1,576
java
package za.ac.cput.domain.staff; import java.util.Date; import java.util.Objects; public class StaffDemography { private String staffNum,genderId,raceId,staffTitle; private Date dateOfBirth; private StaffDemography(){} public StaffDemography(String staffNum, String genderId, String raceId, String staffTitle, Date dateOfBirth) { this.staffNum = staffNum; this.genderId = genderId; this.raceId = raceId; this.staffTitle = staffTitle; this.dateOfBirth = dateOfBirth; } public String getStaffNum() { return staffNum; } public String getGenderId() { return genderId; } public String getRaceId() { return raceId; } public String getStaffTitle() { return staffTitle; } public Date getDateOfBirth() { return dateOfBirth; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StaffDemography that = (StaffDemography) o; return staffNum.equals(that.staffNum); } @Override public int hashCode() { return Objects.hash(staffNum); } @Override public String toString() { return "StaffDemography{" + "staffNum='" + staffNum + '\'' + ", genderId='" + genderId + '\'' + ", raceId='" + raceId + '\'' + ", staffTitle='" + staffTitle + '\'' + ", dateOfBirth=" + dateOfBirth + '}'; } }
590852f3d4fdb109654e19c2bde7c058b5e97a71
de69630707aee806715e913a2d03ec7e8f2c0a2c
/rabbit-feign-ucenter/src/main/java/com/rabbit/feign/ucenter/server/SysAppServer.java
3f4c1b1b035e466706ab3f3b38b55960aba249d5
[]
no_license
li930615/rabbit-feign-cloud
e1e96dc99f91b413d4259d802d9b11aed38b2202
74a8d633c024e5eb14870c64078f607320c1cc1c
refs/heads/master
2020-04-23T10:20:56.997863
2019-02-28T01:06:45
2019-02-28T01:06:45
168,166,467
0
0
null
null
null
null
UTF-8
Java
false
false
674
java
package com.rabbit.feign.ucenter.server; import com.rabbit.feign.ucenter.model.entity.SysApp; import com.rabbit.feign.ucenter.server.fallback.SysAppServerFallbackImpl; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; /** * 〈一句话功能简述〉 * * @author 我的姓名 * @date 2019/2/17 17:11 **/ @FeignClient(name = "rabbit-ucenter-server", fallback = SysAppServerFallbackImpl.class) public interface SysAppServer { @GetMapping(value = {"/ucenter/app/getByCode"}) SysApp getByCode(@RequestParam("code") String code); }
eb1e91f5544e631a777cbab0494f79a3feaf4bc2
6c64b11697c5420dee1005422c4bfc98d9c4a167
/src/Test.java
0163c624f1e85e5a1667a70352d588bdac6ffde0
[]
no_license
marcFraysse/Shape-Comparison-and-Retrieval
ac6cdf4a54ab4cdc22f7d8d0ec08f79988bf1741
25ab00645fad62241fa51ee92baeecbe26b747e6
refs/heads/master
2020-06-28T18:39:12.674481
2016-12-11T19:24:16
2016-12-11T19:24:16
74,484,212
0
0
null
null
null
null
UTF-8
Java
false
false
51
java
public class Test { //this is a test class }
edf9d8aed6e181c194023473ea163d7ecd067823
4124ab932c4cabd071bd1ab53c9cefaa35a788e4
/src/main/java/com/example/demo/XmlDataApplication.java
92d218cc6020482d12251f1158062cba82bc6c21
[]
no_license
connect2nelson/apacheCXFStubClient
4d162357dfa283bd82e3053bb0860328e92a44ae
9a57de68f01df00c377a08553ad57e22fc2f9751
refs/heads/master
2021-07-13T05:40:28.085309
2017-10-16T22:09:33
2017-10-16T22:09:33
107,187,426
1
1
null
null
null
null
UTF-8
Java
false
false
398
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @ComponentScan public class XmlDataApplication { public static void main(String[] args) { SpringApplication.run(XmlDataApplication.class, args); } }
6ee2234da7e2365d0057f509e50b9cb0bc2014a8
79c9416fdf4fc3926ccf8ea3e3b22d7cc504c0d3
/src/main/java/com/example/mybatis/repository/AutorMyBatisRepository.java
dfc7150ad24f36fd27e93b67766826102ac11adb
[]
no_license
MaxChanGonzales/EC2
fbe72ee4ab1fdff8f130e3a01b2df495e9725fff
7695e1e43034ced93861c884c0565b248c135419
refs/heads/master
2023-08-23T03:26:19.641525
2021-11-04T05:25:38
2021-11-04T05:25:38
424,412,062
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
/* * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template */ package com.example.mybatis.repository; import com.example.mybatis.entity.Autor; import java.util.List; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; /** * * @author Max */ @Mapper public interface AutorMyBatisRepository { @Select("select * from autor") public List<Autor> findAll(); @Select("select * from autor where idautor=#{id}") public Autor readAutor(Integer id); @Delete("DELETE FROM autor WHERE idautor = #{id}") public int deleteById(Integer id); @Insert("INSERT INTO autor(nombres, apellidos) VALUES (#{nombres}, #{apellidos})") public int insert(Autor autor); @Update("Update autor set nombres=#{nombres}, apellidos=#{apellidos} where idautor=#{idautor}") public int update(Autor autor); }
[ "Max@DESKTOP-Q1D9088" ]
Max@DESKTOP-Q1D9088
4a158ebdc70a7118e8d0894954dd018ee1b1012c
71577d1a4a9862124cda867b41fba68eb06515b4
/ServerProject001/src/com/info/model/Project.java
00508b0b6964c1160f74e073756d18ce2326b8e1
[]
no_license
monzilnepali/ProjectManagementTool
ab71990288bb12f144c21e53a19b4eb206dc69a4
da8b0a209f98620cb3a3f3a2045598d9c2bc69f3
refs/heads/master
2020-03-16T10:00:39.901862
2018-08-12T17:09:17
2018-08-12T17:09:17
132,627,551
1
0
null
2018-06-29T08:42:42
2018-05-08T15:18:20
Java
UTF-8
Java
false
false
1,777
java
package com.info.model; import java.io.File; import java.io.Serializable; import java.util.List; @SuppressWarnings("serial") public class Project implements Serializable { private int projectId; private String projectTitle; private String categories; private String projectDesc; private List<String> TeamMember; private String projectCreationDate; private List<File> fileList; private String projectImage; private int roleId; public int getProjectId() { return projectId; } public void setProjectId(int projectId) { this.projectId = projectId; } public String getprojectTitle() { return projectTitle; } public void setprojectTitle(String projectTitle) { this.projectTitle = projectTitle; } public String getProjectDesc() { return projectDesc; } public void setProjectDesc(String projectDesc) { this.projectDesc = projectDesc; } public List<String> getTeamMember() { return TeamMember; } public void setTeamMember(List<String> teamMember) { TeamMember = teamMember; } public String getCategories() { return categories; } public void setCategories(String categories) { this.categories = categories; } public String getProjectCreationDate() { return projectCreationDate; } public void setProjectCreationDate(String projectCreationDate) { this.projectCreationDate = projectCreationDate; } public int getRoleId() { return roleId; } public void setRoleId(int roleId) { this.roleId = roleId; } public List<File> getFileList() { return fileList; } public void setFileList(List<File> fileList) { this.fileList = fileList; } public String getProjectImage() { return projectImage; } public void setProjectImage(String projectImage) { this.projectImage = projectImage; } }
4464f9958d9254ade9ef0941c468ccce50045e27
dda94da853000e2adb0b8f1d09a7786b05a98dd8
/src/Objects/Fruits/WormKiller.java
348805d5b9dafbe3933f13f663afeb8498f01c06
[]
no_license
KeyKia/FruitCollector
f8d175f1be5581d9081ed5eeafa92eb7d9f29953
97647371819e9094aa48cd8f93698a32eb5f94dd
refs/heads/master
2021-01-15T18:00:44.126376
2017-08-26T12:12:03
2017-08-26T12:12:03
99,775,746
1
0
null
null
null
null
UTF-8
Java
false
false
595
java
package Objects.Fruits; import Game.GameScene; import javafx.scene.canvas.Canvas; import javafx.scene.image.Image; /** * Created by jeem on 6/27/2017. */ public class WormKiller extends Fruits { static private final Image img = new Image("file:Resources/images/worms/wormKiller.png"); public WormKiller() { super(((int) (GameScene.UNIT * 30)), ( (100 * GameScene.UNIT / GameScene.SPEED_CONVERTER)), 0, img); } @Override public void move(Canvas fruitCanvas, double width, double start) { fruitCanvas.setLayoutY(fruitCanvas.getLayoutY() + speed); } }
e841ae49c86647dcbcc253212743b0dc918d9aad
85f8f7b86b3c0679f8e92494f3c16968a86e9105
/Data Structures/LinkedLists/Insert_a_node_at_the_head_of_a_LinkedList.java
206eec9c6be0ee5d2d8d20894348b3e422f62ee1
[]
no_license
jerrychlee/HackerRank
cc5d81ae520a9a31d402e4acb675071376423586
6de5d978b0c0bf8dd4e94de4e07c2dee84633696
refs/heads/master
2022-06-06T10:04:18.592315
2022-05-22T12:35:05
2022-05-22T12:35:05
109,255,473
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
/* Insert Node at the beginning of a linked list head pointer input could be NULL as well for empty list Node is defined as class Node { int data; Node next; } */ // This is a "method-only" submission. // You only need to complete this method. Node Insert(Node head,int x) { Node p = new Node(); p.data = x; p.next = head; return p; }
ef0cadc6b306297a8328247c612a009257139372
0308489cc3414dc04ec6d2f1ff731a2bd1a6a7d7
/01-QuestionOne/src/Classes/Animal.java
710645e941990841408b6fd9e32a98e709a9c37f
[]
no_license
MichaelCoey/neueda-test-michaelcoey
bfd4b366e09ead05731731cbd9d6a29a29738f8e
81463053038b5eb9c3a76d9fbef743f80d6a69fc
refs/heads/master
2020-04-10T04:44:57.893698
2018-12-07T15:39:36
2018-12-07T15:39:36
160,807,961
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package Classes; public class Animal { private String name; public Animal() { super(); } public Animal(String name) { super(); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
b5fee387846afab334951ecb484341a2151e37f3
d2b7f664fd190b2f8577228b49e2709eacc3a66d
/shop/src/main/java/de/shop/kundenverwaltung/service/KundeScheduler.java
24ddf82d7b80e031eea1fd18bf68afeaf6929ccd
[]
no_license
homa1013/shop-repo
800191e47c68aaa9487bb3ff71bdb59f5ade3dc1
4dc5e40b99f80d8f2cc1a111f1bd9ce76041b9be
refs/heads/master
2020-06-01T03:32:56.638731
2013-10-25T09:41:46
2013-10-25T09:41:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,420
java
package de.shop.kundenverwaltung.service; import java.lang.invoke.MethodHandles; import java.util.Collection; import java.util.List; import javax.ejb.Schedule; import javax.ejb.Stateless; import javax.inject.Inject; import javax.persistence.EntityManager; import org.jboss.logging.Logger; import de.shop.auth.domain.RolleType; import de.shop.kundenverwaltung.domain.AbstractKunde; import de.shop.util.interceptor.Log; /** * @author <a href="mailto:[email protected]">J&uuml;rgen Zimmermann</a> */ @Stateless @Log public class KundeScheduler { private static final Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass()); @Inject private transient EntityManager em; @Inject private KundeService ks; @Schedule(dayOfMonth = "*", hour = "2", minute = "0", year = "*", persistent = false) public void deleteKundeOhneBestellungen() { final List<AbstractKunde> kunden = em.createNamedQuery(AbstractKunde.FIND_KUNDEN_OHNE_BESTELLUNGEN, AbstractKunde.class) .getResultList(); for (AbstractKunde k : kunden) { final Collection<RolleType> rollen = k.getRollen(); if (rollen != null && rollen.contains(RolleType.ADMIN)) { // Admin nicht loeschen continue; } ks.deleteKunde(k); LOGGER.infof("Kunde #%d wurde geloescht (ohne Bestellungen)", k.getId()); } } }
35b035e309b3c397259a460c9000a2d156d86bbe
bcd77a91efd9179e61fa63dd9aa9882c77db9b9c
/chap08/src/exercise_js/Exercise8_6.java
933dc8dda03b503e157e6ad9aa38c1276360700b
[]
no_license
wowwow19/Java
f6904df0f1c9c49bb0e71e455a75cb101094f3f7
0d99ee952c26d2c2fbae9ff4ef6b563788f08075
refs/heads/main
2023-03-08T13:02:38.366688
2021-02-18T13:27:14
2021-02-18T13:27:14
328,982,054
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package exercise_js; public class Exercise8_6 { public static void main(String[] args) { try { method1(); // 3 4(X) 5 } catch(Exception e) { System.out.println(5); } } static void method1() { try { method2(); System.out.println(1); } catch(ArithmeticException e) { System.out.println(2); } finally { System.out.println(3); } System.out.println(4); } static void method2() { throw new NullPointerException(); } }
84cf0767293f14a8af01c832a28633ec331f07bc
c63cd8f2d343c4a31099b45c09bf61ad4f7e50e1
/343. Integer Break.java
878fce13c1dfca7584308f655b46b964073f6a83
[]
no_license
GarhomLee/LeetCode
b449652b57015cb7cc67ff53566522c304462a40
d69323b73a1bc7cb19ea955964f90ae29e86fdd6
refs/heads/master
2022-05-17T16:58:15.333682
2022-04-08T21:06:30
2022-04-08T21:06:30
181,504,736
14
5
null
null
null
null
UTF-8
Java
false
false
1,126
java
https://leetcode.com/problems/integer-break/ // 根据数学性质可知,只有分成2和3的乘积才会最大。 // 解法一:iteration // 1)n为2和3时需要作为特殊性情况单独讨论 // 2)在循环中,n == 4要和n == 2放在一起讨论,以免把n == 4的情况并入n == 3的情况 class Solution { public int integerBreak(int n) { if (n <= 2) return 1; if (n == 3) return 2; int product = 1; while (n >= 2) { if (n == 2 || n == 4) { product *= 2; n -= 2; } else { product *= 3; n -= 3; } } return product; } } // 解法二:DP,内层只需要循环1,2,3这三个数 class Solution { public int integerBreak(int n) { int[] dp = new int[n + 1]; dp[1] = 1; for (int i = 2; i <= n; i++) { for (int j = 1; j < i && j < 4; j++) { dp[i] = Math.max(dp[i], j * (Math.max(i - j, dp[i - j]))); } } return dp[n]; } }
162d27ab0e6cb4ed2ed1f9b1300e35c182677fc1
fe8f78d10e26fa7db781e76eb6f418853ae00e5d
/smallrye-reactive-messaging-vertx-eventbus/src/test/java/io/smallrye/reactive/messaging/eventbus/EventbusTestBase.java
9757f53a1ac105369c8b5f13ee0224e172f42cde
[ "Apache-2.0" ]
permissive
matzew/smallrye-reactive-messaging
8a4f9d1e64d50e7070986d2504399f0109cfe2da
993e322e5f43e3474b356b20d9397b2710c26277
refs/heads/master
2020-04-11T21:12:59.225985
2018-12-14T11:03:05
2018-12-14T11:03:05
162,098,656
0
0
Apache-2.0
2018-12-17T08:30:18
2018-12-17T08:30:17
null
UTF-8
Java
false
false
412
java
package io.smallrye.reactive.messaging.eventbus; import io.vertx.reactivex.core.Vertx; import org.junit.After; import org.junit.Before; public class EventbusTestBase { Vertx vertx; protected EventBusUsage usage; @Before public void setup() { vertx = Vertx.vertx(); usage = new EventBusUsage(vertx.eventBus().getDelegate()); } @After public void tearDown() { vertx.close(); } }
a6943a2f7ab470abc79093a6470821416edd2c37
d649d88314578244c962cb570071a764891abb3d
/FindMax.java
b94818f5e3f0b2ac03e6d8d0bceeaa751a9dd082
[]
no_license
shashichandra7/JavaContents
a08aebc2fda77e6283cfc88fae2be7b1afc25c71
3f11cb4f7fd31f96391cced2a4edde4695e5262f
refs/heads/main
2023-03-27T02:24:58.869802
2021-03-25T11:36:07
2021-03-25T11:36:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
532
java
public class FindMax { public static void main(String[] args) { // TODO Auto-generated method stub int a = 5, b = 10, c = 2; //Maximum of 2 numbers // if (a > b ) { // System.out.println("Maximum =" + a); // } else { // System.out.println("Maximum =" + b); // } //Maximum of 3 numbers if(a>b && a>c) { System.out.println("Maximum =" + a); } else if(b>a && b>c) { System.out.println("Maximum =" + b); } else { System.out.println("Maximum =" + c); } } }
f0e9373ed5bd90edc8165486e071e1477f5854b6
9b3f15e6b10c92dbd539b8141e4f8ac54e4ac032
/app/src/main/java/com/dexfun/yiku/HomeActivity.java
1ea0a6cbb1e5c2c83e343a90b28a484415aa67f8
[]
no_license
chenkexu/YiKu_New
a7175cbb70e8d1841e21e6e0f330772fee739649
006b17cc7b598a7d2571cf264204984bc236c355
refs/heads/master
2020-04-05T04:29:10.822466
2018-11-08T08:40:24
2018-11-08T08:40:24
156,553,433
0
0
null
null
null
null
UTF-8
Java
false
false
12,407
java
package com.dexfun.yiku; import android.annotation.SuppressLint; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.Toast; import com.dexfun.yiku.activity.DetailActivity; import com.dexfun.yiku.activity.ShoppingCartActivity; import com.dexfun.yiku.base.BaseActivity; import com.dexfun.yiku.entity.GetUserInfoEntity; import com.dexfun.yiku.entity.MainDexEvent; import com.dexfun.yiku.entity.OnDexEvent; import com.dexfun.yiku.entity.VersionEntity; import com.dexfun.yiku.fragment.ChooseMainFragment; import com.dexfun.yiku.fragment.HomeFragment; import com.dexfun.yiku.fragment.PersonalFragment; import com.dexfun.yiku.fragment.WishListFragment; import com.dexfun.yiku.service.impl.HttpServiceImpl; import com.dexfun.yiku.utils.UiUtils; import com.dexfun.yiku.widget.BaseDialog; import com.tencent.stat.MtaSDkException; import com.tencent.stat.StatService; import com.yinglan.alphatabs.AlphaTabsIndicator; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import butterknife.BindView; public class HomeActivity extends BaseActivity { @BindView(R.id.bottomNavigationView) AlphaTabsIndicator mBottomNavigationView; private long exitTime = 0; private Fragment mContentFragment = null; private Fragment mPersonalFragment = null; private Fragment mHomeFragment = null; private Fragment mChooseFragment = null; private ShoppingCartActivity mKnapsackFragment = null; private Fragment mWishListFragment = null; @Override public int getLayoutId() { return R.layout.activity_home; } @Override public void initView(Bundle savedInstanceState) { EventBus.getDefault().register(this); if (Build.VERSION.SDK_INT >= 23) { int phone = ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE); int write = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE); if (phone != PackageManager.PERMISSION_GRANTED || write != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS}, 1013); } else { try { // 第三个参数必须为:com.tencent.stat.common.StatConstants.VERSION StatService.startStatService(this, "AGNQ18V3YH1B", com.tencent.stat.common.StatConstants.VERSION); Log.d("MTA", "MTA初始化成功"); } catch (MtaSDkException e) { // MTA初始化失败 Log.d("MTA", "MTA初始化失败" + e); } } } // if (SharedPreferencesUtil.getInstance().getBoolean(Constant.LocalKey.ZYW, true)) { // startActivity(new Intent(this, ZYWActivity.class)); // SharedPreferencesUtil.getInstance().put(Constant.LocalKey.ZYW, false); // } mContentFragment = new Fragment(); mHomeFragment = new HomeFragment(); mChooseFragment = new ChooseMainFragment(); mKnapsackFragment = new ShoppingCartActivity(); mPersonalFragment = new PersonalFragment(); mWishListFragment = new WishListFragment(); switchContent(mHomeFragment); mBottomNavigationView.setOnTabChangedListner(tabNum -> { switch (tabNum) { case 0: UiUtils.setStatusBarLightMode(this); switchContent(mHomeFragment); break; case 1: UiUtils.setStatusBarLightMode(this); switchContent(mChooseFragment); break; case 2: UiUtils.setStatusBarLightMode(this); switchContent(mWishListFragment); break; case 3: UiUtils.setStatusBarLightMode(this); switchContent(mKnapsackFragment); break; case 4: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); getWindow().setStatusBarColor(Color.parseColor("#1A1A1A")); } switchContent(mPersonalFragment); break; default: } }); } @Override public void getData(Bundle savedInstanceState) { try { String id = getIntent().getStringExtra("id"); if (!TextUtils.isEmpty(id)) { startActivity(new Intent(this, DetailActivity.class).putExtra("id", Integer.parseInt(id))); } } catch (Exception e) { e.printStackTrace(); } // startActivity(new Intent(this, LoginActivity.class)); new HttpServiceImpl().checkTheLatestVersion(new HttpServiceImpl.OnObjectDataListener<VersionEntity>() { @Override public void onData(VersionEntity data) { int anInt = Integer.parseInt(data.getData().getServerNewVersion().replace(".", "")); int parseInt = Integer.parseInt(BuildConfig.VERSION_NAME.replace(".", "")); System.out.println(anInt); System.out.println(parseInt); if (anInt > parseInt) { new BaseDialog(HomeActivity.this, true) .setCancel(false) .setMessage(data.getData().getUpgradeInfo()) .setPositiveButton("更新", (dialogInterface, i) -> { dialogInterface.cancel(); Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(data.getData().getUpdateUrl())); startActivity(it); finish(); }) .setNegativeButton("退出程序", (dialogInterface, i) -> { dialogInterface.cancel(); finish(); }) .show(); } } }); new HttpServiceImpl().getUserInfo(new HttpServiceImpl.OnObjectDataListener<GetUserInfoEntity>() { @Override public void onData(GetUserInfoEntity data) { if (data.getStatus() == 200) { UserClass.getInstance().setUserid(String.valueOf(data.getData().getUserInfo().getUserId())); } } }); } @SuppressLint("MissingSuperCall") @Override protected void onSaveInstanceState(Bundle outState) { // super.onSaveInstanceState(outState); } private void switchContent(Fragment to) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (mContentFragment != to) { if (!to.isAdded()) { transaction.hide(mContentFragment).add(R.id.frame, to).commitAllowingStateLoss(); } else { transaction.hide(mContentFragment).show(to).commitAllowingStateLoss(); } mContentFragment = to; } else { transaction.replace(R.id.frame, to).commitAllowingStateLoss(); } } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { if ((System.currentTimeMillis() - exitTime) > 2000) { Toast.makeText(getApplicationContext(), "再按一次返回桌面", Toast.LENGTH_SHORT).show(); exitTime = System.currentTimeMillis(); } else { MainClass.finishAllActivity(); // Intent intent = new Intent(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_HOME); // startActivity(intent); } // Intent intent = new Intent(Intent.ACTION_MAIN); // intent.addCategory(Intent.CATEGORY_HOME); // startActivity(intent); return true; } return super.onKeyDown(keyCode, event); } @Override protected void onRestart() { EventBus.getDefault().post(new OnDexEvent(0)); super.onRestart(); } //迷之代码 勿动!!! //迷之代码 勿动!!! //迷之代码 勿动!!! @Subscribe public void onEventMainThread(MainDexEvent event) { switch (event.getType()) { case 0: mBottomNavigationView.setTabCurrenItem(0); break; case 1: mBottomNavigationView.setTabCurrenItem(1); // if (mChooseFragment != null) { // new Thread(new Runnable() { // @Override // public void run() { // do { // if (mChooseFragment.getTabPx() != null) { // runOnUiThread(new Runnable() { // @Override // public void run() { // ChooseFragment.ck = true; // mChooseFragment.getGridView().smoothScrollToPositionFromTop(2, 500); // mChooseFragment.getTabPx().setScrollPosition(1, 0, true); // mChooseFragment.getTabPx().getTabAt(1).select(); // } // }); // } // } while (mChooseFragment.getTabPx() == null); // } // }).start(); // } break; case 2: // mBottomNavigationView.setTabCurrenItem(2); mKnapsackFragment.getData(null, null); break; default: } } @Override protected void onDestroy() { EventBus.getDefault().unregister(this); super.onDestroy(); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == 1013) { if (Build.VERSION.SDK_INT >= 23) { int phone = ContextCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE); int write = ContextCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE); if (phone != PackageManager.PERMISSION_GRANTED || write != PackageManager.PERMISSION_GRANTED) { // ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE, android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS}, 1013); } else { try { StatService.startStatService(this, "AGNQ18V3YH1B", com.tencent.stat.common.StatConstants.VERSION); Log.d("MTA", "MTA初始化成功"); } catch (MtaSDkException e) { Log.d("MTA", "MTA初始化失败" + e); } } } } } }
9ae60e9621799f7251120f17d60db10a0ef5b54d
0f8fd31b97a52292c66a8a7497c206b81f75e536
/app/src/main/java/eu/laramartin/medsreminder/meds/MedsAdapter.java
4390b4ea0dbb9ef72b1ba06f9fd95e11e3c22fff
[ "MIT" ]
permissive
laramartin/android_meds_reminder
935e48cdae776f5658b891f9af63da685e49512b
70ecbda399460854e3c2acd2f3354dcd7fade2dd
refs/heads/master
2021-01-02T23:00:32.179392
2017-10-21T12:16:48
2017-10-21T12:16:48
99,438,071
4
0
null
2017-10-03T09:00:38
2017-08-05T17:35:23
Java
UTF-8
Java
false
false
8,419
java
/* * PROJECT LICENSE * * This project was submitted by Lara Martín as part of the Nanodegree At Udacity. * * As part of Udacity Honor code, your submissions must be your own work, hence * submitting this project as yours will cause you to break the Udacity Honor Code * and the suspension of your account. * * Me, the author of the project, allow you to check the code as a reference, but if * you submit it, it's your own responsibility if you get expelled. * * Copyright (c) 2017 Lara Martín * * Besides the above notice, the following license applies and this license notice * must be included in all works derived from this project. * * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ package eu.laramartin.medsreminder.meds; import android.content.Context; import android.graphics.Paint; import android.support.constraint.ConstraintLayout; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.analytics.FirebaseAnalytics; import java.util.ArrayList; import java.util.Date; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import eu.laramartin.medsreminder.R; import eu.laramartin.medsreminder.common.CalendarUtility; import eu.laramartin.medsreminder.common.DialogsUtility; import eu.laramartin.medsreminder.common.MedsUtility; import eu.laramartin.medsreminder.firebase.AnalyticsUtility; import eu.laramartin.medsreminder.model.Med; import eu.laramartin.medsreminder.model.Report; import static eu.laramartin.medsreminder.common.MedsUtility.getReportFromMed; import static eu.laramartin.medsreminder.common.Utils.runVibration; import static eu.laramartin.medsreminder.firebase.FirebaseUtility.writeReportOnDb; public class MedsAdapter extends RecyclerView.Adapter<MedsAdapter.MedViewHolder> { private List<Med> meds = new ArrayList<>(); private FirebaseAnalytics firebaseAnalytics; public MedsAdapter(FirebaseAnalytics firebaseAnalytics) { this.firebaseAnalytics = firebaseAnalytics; } public void add(Med med) { meds.add(med); notifyItemInserted(meds.size() - 1); } @Override public MedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { Context context = parent.getContext(); LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.list_med_item, parent, false); return new MedViewHolder(view); } @Override public void onBindViewHolder(MedViewHolder holder, int position) { holder.bind(meds.get(position)); } @Override public int getItemCount() { if (meds != null) { return meds.size(); } return 0; } public void remove(Med med) { for (int i = 0; i < meds.size(); i++) { if (med.getKey().equals(meds.get(i).getKey())) { meds.remove(i); notifyItemRemoved(i); break; } } } private String nextDate(Med med) { Date date = CalendarUtility.getNextTake(med); return CalendarUtility.getFormattedDate(date); } public class MedViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { @BindView(R.id.med_icon) ImageView medIcon; @BindView(R.id.med_name) TextView medName; @BindView(R.id.med_reminder_icon) ImageView medReminder; @BindView(R.id.med_time) TextView medTime; @BindView(R.id.med_days) TextView medDays; @BindView(R.id.med_notes) TextView medNotes; @BindView(R.id.meds_edit) TextView medEdit; @BindView(R.id.med_date) TextView medDate; @BindView(R.id.med_time_status) TextView medTimeStatus; @BindView(R.id.meds_constraint_layout_details) ConstraintLayout medsLayoutDetails; @BindView(R.id.icon_arrow_down) ImageView arrowDownIcon; @BindView(R.id.meds_take_label) TextView takeMedLabel; private MedsAdapterItem medsAdapterItem; public MedViewHolder(final View itemView) { super(itemView); ButterKnife.bind(this, itemView); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); medEdit.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG); takeMedLabel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Report report = getReportFromMed(medsAdapterItem.getMed()); writeReportOnDb(report); AnalyticsUtility.takeMed(firebaseAnalytics, medsAdapterItem.getMed()); Toast.makeText(itemView.getContext(), medName.getText() + itemView.getContext().getString(R.string.meds_taken_feedback), Toast.LENGTH_SHORT).show(); } }); } @Override public void onClick(View view) { medsAdapterItem.setExpanded(!medsAdapterItem.isExpanded()); setDetailsVisibility(); } private void setDetailsVisibility() { if (medsAdapterItem.isExpanded()) { showDetails(); } else { hideDetails(); } } private void showDetails() { medsLayoutDetails.setVisibility(View.VISIBLE); arrowDownIcon.setVisibility(View.INVISIBLE); } private void hideDetails() { medsLayoutDetails.setVisibility(View.GONE); arrowDownIcon.setVisibility(View.VISIBLE); } public void bind(Med med) { MedsAdapterItem medsAdapterItem = new MedsAdapterItem(); medsAdapterItem.setMed(med); this.medsAdapterItem = medsAdapterItem; medIcon.setImageResource(MedsUtility.getMedIcon(med.getDosage())); medName.setText(med.getName()); if (med.getReminderJobTags() != null && !med.getReminderJobTags().isEmpty()) { medReminder.setVisibility(View.VISIBLE); } else { medReminder.setVisibility(View.INVISIBLE); } medDate.setText(nextDate(med)); medTime.setText(med.getTime()); // TODO: 31.08.17 Lara: handle different time status, hardcoded until feature is implemented medTimeStatus.setText("On time"); medDays.setText(CalendarUtility.getFormattedDaysOfWeek(itemView.getContext(), med.getDays())); if (med.getNotes() != null && !med.getNotes().isEmpty()) { medNotes.setText(med.getNotes()); medNotes.setVisibility(View.VISIBLE); } else { medNotes.setVisibility(View.INVISIBLE); } setDetailsVisibility(); } @Override public boolean onLongClick(View view) { DialogsUtility.showRemoveMedDialog(view.getContext(), medsAdapterItem); runVibration(view); return true; } } }
a96d7984257efc7202cc31b7277d9b92febcb851
b4b5ebed4f62f67c8b705b76db414b216352147f
/src/by/it/yatsevich/jd01_01/TaskC1.java
f2c5c79b161867a7f5cb7665ce0b130423a7fa0f
[]
no_license
emakovski/JD2020-09-07
05d2d1a6881d91380f8382a842c2fa4b2c888c16
c597ba029c51b9bfe5ed45a4fabbc465ee7fb3f4
refs/heads/master
2023-01-05T11:44:25.143256
2020-10-30T14:09:01
2020-10-30T14:09:01
302,882,827
1
0
null
2020-10-10T11:07:42
2020-10-10T11:07:42
null
UTF-8
Java
false
false
728
java
package by.it.yatsevich.jd01_01; import java.util.Scanner; /* Нужно написать программу, которая вводит два числа с клавиатуры и выводит их сумму на экран в виде Ввод (это вы вводите с клавиатуры): 34 26 Вывод (это должна появится в консоли, обратите внимание на пробелы и слово Sum: Sum = 60 */ class TaskC1 { public static void main(String[] args) { Scanner sc1 = new Scanner(System.in); int a = sc1.nextInt(); int b = sc1.nextInt(); int c = a+b; System.out.println("Sum" + " " + "=" + " " + c); } }
011dbeb599dd9a6abee87fd6b0069df38a5273d1
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.mm/classes.jar/com/tencent/mm/plugin/finder/live/plugin/bz$p.java
551d95538ea8c8652130bba949699e1a8b92f71f
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
904
java
package com.tencent.mm.plugin.finder.live.plugin; import com.tencent.mm.protocal.protobuf.bkd; import com.tencent.mm.ui.base.w; import kotlin.Metadata; import kotlin.ah; import kotlin.g.a.q; import kotlin.g.b.ah.f; import kotlin.g.b.u; import kotlinx.coroutines.cb; @Metadata(d1={""}, d2={"<anonymous>", "", "success", "", "errMsg", "", "<anonymous parameter 2>", "Lcom/tencent/mm/protocal/protobuf/FinderLiveModShopShelfResponse;"}, k=3, mv={1, 5, 1}, xi=48) final class bz$p extends u implements q<Boolean, String, bkd, ah> { bz$p(cb paramcb, ah.f<w> paramf, q<? super Boolean, ? super Integer, ? super Integer, ah> paramq, int paramInt1, int paramInt2) { super(3); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes2.jar * Qualified Name: com.tencent.mm.plugin.finder.live.plugin.bz.p * JD-Core Version: 0.7.0.1 */
b6a2e2804e02e880b3ad575fd526d7afb6726857
50063a288925a99ec3181691328540733379e0e7
/src/cn/zhangpeng/TestDemo.java
2b8d28aa3eececa9bbb4fed0399140f1dd52bd7a
[]
no_license
stuzhangpeng/threadpool
e11dc74c04425b3af9a6e55656bc44e8bf08d8f6
97258a9574ad0ac2ca67b46392850bfd5e1fb148
refs/heads/master
2020-05-18T11:06:37.049855
2019-05-01T04:52:46
2019-05-01T04:52:46
184,370,146
0
0
null
null
null
null
GB18030
Java
false
false
1,129
java
package cn.zhangpeng; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; /** * @Auther:zhangpeng * @Date:2019/5/1 * @Description:cn.zhangpeng * @Version:1.0 */ public class TestDemo { public static void main(String[] args) { ThreadPoolExecutor threadPoolExecutor=null; try { //线程任务 ThreadTask task =new ThreadTask(); //测试自定义线程池 threadPoolExecutor = ThreadPoolDemo.getThreadPoolExecutor(); //线程未回收的情况下,执行任务超过maxpoolsize+阻塞队列capacity,触发拒绝策略报java.util.concurrent.RejectedExecutionException异常 //执行任务超过corepoolsize+阻塞队列capacity;线程数进行扩充,最大扩充到maxpoolsize for (int i=0;i<10;i++){ Future submit = threadPoolExecutor.submit(task); } }catch (Exception e){ System.out.println(111); e.printStackTrace(); } finally { //关闭线程池 threadPoolExecutor.shutdown(); } } }