blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
32c549d13af40e0cd49dd68bc87f2d865f1b1572
4d0e9eea1f95d28572d64c582447a498bd0db9e3
/src/arrays/arrayListCollection.java
7ccf9cb438895d8c6e38256c0d2851be7c0c4f6a
[]
no_license
akhilchin/JavaPrograms
8a964ddb63f99cd489f5c71c2054f7ae8d726dcc
33f125a5d3b589ab47e7e6ea8a5ae1a8cb0a259c
refs/heads/master
2021-01-19T13:43:43.445971
2017-04-12T23:40:53
2017-04-12T23:40:53
88,105,927
0
0
null
null
null
null
UTF-8
Java
false
false
1,252
java
package arrays; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class arrayListCollection { static List<String> _studentName = new ArrayList<String>(); //import java.util.ArrayList; import java.util.List; static List<Integer> _studentroll = new LinkedList<Integer>(); // cannot add int to list. instead use Integer class (autoboxing) static void addToArray(String stdName, int rollNumber){ _studentName.add(stdName); _studentroll.add(rollNumber); } static void printStdDetails() { for(String i : _studentName) //foreach loop to retrieve values from arraylist { System.out.println("Student Name: " + i); } for(int j: _studentroll) // for each to retrieve values from linked list. { System.out.println("Student RollNumber: "+j); } } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // reads value from the console. import from java.util.Scanner; for(int i =0; i<5; i++){ System.out.println("Please enter student Name: "); String stdName =scanner.nextLine(); addToArray(stdName, i); //calling method to add } printStdDetails(); System.out.println("*********End******"); } }
[ "akhilabhi429@gmail.com" ]
akhilabhi429@gmail.com
19ba05ec454d24742ad53c3f00331ad8aa719bbb
0b099d56d1b048824c1324957365dc855fd44f0a
/src/main/java/com/pri/corejava/oopconcepts/interfaceOriginal.java
62c2afbfa404214a1e40e7182a1c9c787d52a395
[]
no_license
Priyanth2313/cracking-java-code-Vol_1
4bd0ea0c0e7d0934c363e82c2abaf46464afc049
e1fb55faab6d2cfbc202478ed69b0da53d4b574b
refs/heads/master
2022-07-10T18:15:48.727778
2022-06-08T03:08:29
2022-06-08T03:08:29
145,938,515
0
0
null
2022-06-08T03:06:33
2018-08-24T03:36:39
Java
UTF-8
Java
false
false
250
java
package com.pri.corejava.oopconcepts; public interface interfaceOriginal { // interface can only have public methods // by default all the methods in the interface are abstract methods public int number(); public String value(); }
[ "priyanth.1992@gmail.com" ]
priyanth.1992@gmail.com
6f12625226ca6a467755d5778e3a11a1b344388d
2b761f18ea47f18baa2f5b22e689ef919e28f7ff
/src/com/gkpoter/dazuoye/action/UpLoadAction.java
b0b18e4438b4f40177c933fd1947d184d02a4a60
[]
no_license
BoyGK/Dazuoye_two
7b7f70ae44199ff47929a6f9244902e53f72ecb9
b6bae490631d94f9e611a42952efd207e7100983
refs/heads/master
2021-01-22T10:47:48.618416
2017-06-08T12:38:31
2017-06-08T12:38:31
92,656,290
0
0
null
null
null
null
UTF-8
Java
false
false
1,754
java
package com.gkpoter.dazuoye.action; import com.gkpoter.dazuoye.model.BaseModel; import com.gkpoter.dazuoye.serves.UpLoadServes; import com.google.gson.Gson; import com.opensymphony.xwork2.ActionSupport; import org.apache.struts2.ServletActionContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.PrintWriter; /** * Created by 12153 on 2017/6/3. */ public class UpLoadAction extends ActionSupport { private Integer userid; private String title; private String subject; public String upLoadFile(){ try { HttpServletResponse response = ServletActionContext.getResponse(); HttpServletRequest request = ServletActionContext.getRequest(); InputStream videoFile = request.getInputStream(); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); UpLoadServes serves = new UpLoadServes(); BaseModel model = serves.upLoad(userid,videoFile,title,subject); String json = new Gson().toJson(model); out.println(json); }catch (Exception e){ e.printStackTrace(); } return null; } public Integer getUserid() { return userid; } public void setUserid(Integer userid) { this.userid = userid; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSubject() { return subject; } public void setSubject(String subject) { this.subject = subject; } }
[ "1215356195@qq.com" ]
1215356195@qq.com
f50db79e40c78b7a1d7285cf1b73dc58fc3e2a3d
ee1b59255ea1d2d766d5c45671f3ab0f133d31f4
/core/src/main/java/cn/gamemate/app/domain/game/GameMap.java
4771db306b24ba64ba914b193d7b65cc4f3605af
[]
no_license
JamesChang/gm-app2
916d26c40eb4fbaa8843f0855643571afbb43f5b
c2f7e1213b7340e412c463194a79f3fceb129cbe
refs/heads/master
2020-04-06T04:49:13.178272
2011-11-02T07:09:26
2011-11-02T07:10:20
1,221,895
2
0
null
null
null
null
UTF-8
Java
false
false
4,016
java
package cn.gamemate.app.domain.game; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.ILoggerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.spi.LoggerFactoryBinder; import org.springframework.roo.addon.javabean.RooJavaBean; import org.springframework.roo.addon.json.RooJson; import org.springframework.roo.addon.tostring.RooToString; import org.springframework.roo.addon.entity.RooEntity; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.springframework.roo.addon.serializable.RooSerializable; import proto.response.ResGame; import proto.response.ResGame.Map.Builder; @Entity @RooJavaBean @RooToString @RooEntity @Table(name = "gm_map") @RooSerializable public class GameMap { private static final Logger logger = LoggerFactory.getLogger(GameMap.class); @NotNull @Size(max = 40) private String name; @NotNull @Size(max = 32) private String digest; @NotNull @Column(name = "file_size") private Integer fileSize; @Column(name = "file_link") private String fileLink; @Column(name = "attrs_json") private String attrsInJson; @Column(name = "game_id") private Integer physicalGameID; public int getMaxUserCount(){ //TODO not null ObjectMapper m = new ObjectMapper(); JsonNode rootNode; try { rootNode = m.readValue(this.attrsInJson, JsonNode.class); return rootNode.get("max_user_count").getIntValue(); } catch (JsonParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JsonMappingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; } public String getThumbnail() { return fileLink + ".png"; } public void setFile(String filename) throws Exception { BufferedInputStream f = new BufferedInputStream(new FileInputStream( filename)); byte[] data; try { data = new byte[f.available()]; f.read(data); } finally { f.close(); } MessageDigest md; try { md = MessageDigest.getInstance("MD5"); digest = new String(md.digest(data)); fileSize = data.length; } catch (NoSuchAlgorithmException e) { logger.error("", e); throw new Exception("can not reach here"); } } public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Thumbnail: ").append(getThumbnail()).append(", "); sb.append("Id: ").append(getId()).append(", "); sb.append("Version: ").append(getVersion()).append(", "); sb.append("Name: ").append(getName()).append(", "); sb.append("Digest: ").append(getDigest()).append(", "); sb.append("FileSize: ").append(getFileSize()).append(", "); sb.append("FileLink: ").append(getFileLink()).append(", "); sb.append("AttrsInJson: ").append(getAttrsInJson()); return sb.toString(); } //TODO: move this to one another AJ file public ResGame.Map.Builder toProtobuf(){ ResGame.Map.Builder builder = ResGame.Map.newBuilder(); copyTo(builder); return builder; } private void copyTo(ResGame.Map.Builder builder) { builder .setId(this.getId().intValue()) .setName(this.getName()) .setDigest(this.getDigest()) .setFileSize(this.getFileSize()) .setDownloadLink(this.getFileLink()) .setThumbnail(this.getThumbnail()) .setPhysicalGameID(physicalGameID); } }
[ "boqiang.zhang@gmail.com" ]
boqiang.zhang@gmail.com
741aaef1bbbcb7b1e5bee9a30b77644c2f3be81d
b8a6bdccdf814a72dc6a89b2f28cecf84e9411fc
/app/src/test/java/com/hdh/baekalleyproject/ExampleUnitTest.java
091fb526abc1cd41114af14c050588b3cd67e726
[]
no_license
da-hyeon/BaekAlleyProject
0b725ff38c4225727c00187bde9dab5363ac4fc0
39eec3b0ed860b8e842a49aa7ce59508cc01dca2
refs/heads/master
2020-06-26T06:24:47.760930
2019-09-25T02:49:53
2019-09-25T02:49:53
199,558,858
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.hdh.baekalleyproject; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "kjg123kg@gmail.com" ]
kjg123kg@gmail.com
62a607da1558b05df93774b7e31543dc47c41b12
903213aa03ea7ab84976bfb3fb7d87c06161c419
/camel-spring-2/src/main/java/com/cts/camel/CamelSpring2Application.java
491d54bf02bb2d764c2c5d22efd7400698d29559
[]
no_license
jayant839105/Jayant_ApcheCamelAssignment
018a648cc1cc3de0eb8c6a4e138623e12af820c1
5527704bc614c7f3070a051a6a3bd579874c768c
refs/heads/main
2023-01-23T16:21:46.157077
2020-11-26T04:58:53
2020-11-26T04:58:53
316,126,807
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package com.cts.camel; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CamelSpring2Application { public static void main(String[] args) { SpringApplication.run(CamelSpring2Application.class, args); } }
[ "noreply@github.com" ]
noreply@github.com
87a6d9ad42c917dd83994541e429a23de27507db
da37226b787d6d02267b8f05dd1ba35d9c942003
/docs/Caso3/ServerSS/src/server/Seguridad.java
0d1567124327a38e6a979cba19c02a65305e830c
[ "MIT" ]
permissive
dnarvaez27/Infracomp
aad0c307fdd7b893c07323d64ce24cf2e58dcb56
5fa6a6d02aa17a31fceeb7134befce12b02b8796
refs/heads/master
2021-03-19T13:06:13.199605
2018-05-01T18:12:16
2018-05-01T18:12:16
122,061,195
0
0
null
null
null
null
UTF-8
Java
false
false
2,439
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package server; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x509.X509Extension; import org.bouncycastle.cert.X509v3CertificateBuilder; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils; import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import java.math.BigInteger; import java.security.KeyPair; import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; import java.security.cert.X509Certificate; import java.util.Date; public class Seguridad { private static final Date NOT_BEFORE = new Date( System.currentTimeMillis( ) - 31536000000L ); private static final Date NOT_AFTER = new Date( System.currentTimeMillis( ) + 3153600000000L ); public static final String RSA = "RSA"; public static final String HMACMD5 = "HMACMD5"; public static final String HMACSHA1 = "HMACSHA1"; public static final String HMACSHA256 = "HMACSHA256"; public static final String RC4 = "RC4"; public static final String BLOWFISH = "BLOWFISH"; public static final String AES = "AES"; public static final String DES = "DES"; public Seguridad( ) { } public static X509Certificate generateV3Certificate( KeyPair pair ) throws Exception { PublicKey subPub = pair.getPublic( ); PrivateKey issPriv = pair.getPrivate( ); PublicKey issPub = pair.getPublic( ); JcaX509ExtensionUtils extUtils = new JcaX509ExtensionUtils( ); X509v3CertificateBuilder v3CertGen = new JcaX509v3CertificateBuilder( new X500Name( "CN=0.0.0.0, OU=None, O=None, L=None, C=None" ), new BigInteger( 128, new SecureRandom( ) ), new Date( System.currentTimeMillis( ) ), new Date( System.currentTimeMillis( ) + 8640000000L ), new X500Name( "CN=0.0.0.0, OU=None, O=None, L=None, C=None" ), subPub ); v3CertGen.addExtension( X509Extension.subjectKeyIdentifier, false, extUtils.createSubjectKeyIdentifier( subPub ) ); v3CertGen.addExtension( X509Extension.authorityKeyIdentifier, false, extUtils.createAuthorityKeyIdentifier( issPub ) ); return ( new JcaX509CertificateConverter( ) ).setProvider( "BC" ).getCertificate( v3CertGen.build( ( new JcaContentSignerBuilder( "MD5withRSA" ) ).setProvider( "BC" ).build( issPriv ) ) ); } }
[ "dnarvaez27@outlook.com" ]
dnarvaez27@outlook.com
8c6e3a3ea9b1f702d0438f7b32cc5de6ad269ed2
d28611bff340aea43a3ae82d71b4c067d43e266c
/src/com/loopj/android/http/BaseJsonHttpResponseHandler.java
f643bf3f3ba6ff51fe9108231b69a14b691a556d
[]
no_license
vincentsunhao/itingshuo
5afef93412a8a49fb051aa4c33a2a91c034774ed
c81bcfd6c9e2dc054b25b75b7732aadf03e06da4
refs/heads/master
2021-01-23T05:29:50.401168
2016-04-04T03:35:46
2016-04-04T03:35:46
86,313,000
1
0
null
2017-03-27T08:54:58
2017-03-27T08:54:57
null
UTF-8
Java
false
false
6,386
java
/* Android Asynchronous Http Client Copyright (c) 2011 James Smith <james@loopj.com> http://loopj.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.loopj.android.http; import android.util.Log; import org.apache.http.Header; import org.apache.http.HttpStatus; /** * Class meant to be used with custom JSON parser (such as GSON or Jackson JSON) <p>&nbsp;</p> * {@link #parseResponse(String, boolean)} should be overriden and must return type of generic param * class, response will be then handled to implementation of abstract methods {@link #onSuccess(int, * org.apache.http.Header[], String, Object)} or {@link #onFailure(int, org.apache.http.Header[], * Throwable, String, Object)}, depending of response HTTP status line (result http code) * @param <JSON_TYPE> Generic type meant to be returned in callback */ public abstract class BaseJsonHttpResponseHandler<JSON_TYPE> extends TextHttpResponseHandler { private static final String LOG_TAG = "BaseJsonHttpResponseHandler"; /** * Creates a new JsonHttpResponseHandler with default charset "UTF-8" */ public BaseJsonHttpResponseHandler() { this(DEFAULT_CHARSET); } /** * Creates a new JsonHttpResponseHandler with given string encoding * * @param encoding result string encoding, see <a href="http://docs.oracle.com/javase/7/docs/api/java/nio/charset/Charset.html">Charset</a> */ public BaseJsonHttpResponseHandler(String encoding) { super(encoding); } /** * Base abstract method, handling defined generic type * * @param statusCode HTTP status line * @param headers response headers * @param rawJsonResponse string of response, can be null * @param response response returned by {@link #parseResponse(String, boolean)} */ public abstract void onSuccess(int statusCode, Header[] headers, String rawJsonResponse, JSON_TYPE response); /** * Base abstract method, handling defined generic type * * @param statusCode HTTP status line * @param headers response headers * @param throwable error thrown while processing request * @param rawJsonData raw string data returned if any * @param errorResponse response returned by {@link #parseResponse(String, boolean)} */ public abstract void onFailure(int statusCode, Header[] headers, Throwable throwable, String rawJsonData, JSON_TYPE errorResponse); @Override public final void onSuccess(final int statusCode, final Header[] headers, final String responseString) { if (statusCode != HttpStatus.SC_NO_CONTENT) { Runnable parser = new Runnable() { @Override public void run() { try { final JSON_TYPE jsonResponse = parseResponse(responseString, false); postRunnable(new Runnable() { @Override public void run() { onSuccess(statusCode, headers, responseString, jsonResponse); } }); } catch (final Throwable t) { Log.d(LOG_TAG, "parseResponse thrown an problem", t); postRunnable(new Runnable() { @Override public void run() { onFailure(statusCode, headers, t, responseString, null); } }); } } }; if (!getUseSynchronousMode()) new Thread(parser).start(); else // In synchronous mode everything should be run on one thread parser.run(); } else { onSuccess(statusCode, headers, null, null); } } @Override public final void onFailure(final int statusCode, final Header[] headers, final String responseString, final Throwable throwable) { if (responseString != null) { Runnable parser = new Runnable() { @Override public void run() { try { final JSON_TYPE jsonResponse = parseResponse(responseString, true); postRunnable(new Runnable() { @Override public void run() { onFailure(statusCode, headers, throwable, responseString, jsonResponse); } }); } catch (Throwable t) { Log.d(LOG_TAG, "parseResponse thrown an problem", t); postRunnable(new Runnable() { @Override public void run() { onFailure(statusCode, headers, throwable, responseString, null); } }); } } }; if (!getUseSynchronousMode()) new Thread(parser).start(); else // In synchronous mode everything should be run on one thread parser.run(); } else { onFailure(statusCode, headers, throwable, null, null); } } /** * Should return deserialized instance of generic type, may return object for more vague * handling * * @param rawJsonData response string, may be null * @param isFailure indicating if this method is called from onFailure or not * @return object of generic type or possibly null if you choose so * @throws Throwable allows you to throw anything from within deserializing JSON response */ protected abstract JSON_TYPE parseResponse(String rawJsonData, boolean isFailure) throws Throwable; }
[ "2815506514@qq.com" ]
2815506514@qq.com
10d0990f685fc8a3ec2c225662d1d2c94f23b54e
3048f9f03bd109660de36ccbf214a3f71755d858
/app/src/androidTest/java/com/majkl/kitereg/ExampleInstrumentedTest.java
a57e97052500a4925d736e2266cd344dc552d0b4
[]
no_license
majkl109/KiteReg
93f8c28a70f57a187dd7e6db65f4c806d1a23c17
34fb6b794f0ff30301cc542a1c974f453f821c7a
refs/heads/master
2022-04-17T23:04:57.475129
2020-04-13T20:10:06
2020-04-13T20:10:06
254,962,556
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package com.majkl.kitereg; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.majkl.kitereg", appContext.getPackageName()); } }
[ "majkl.andracic@gmail.com" ]
majkl.andracic@gmail.com
f0b04e0f9c19a321334759525318108ec0742376
1ea7cc9b6c577ebb69c8b384c1878ff013debf38
/src/main/java/com/lmg/config/coreDYNAMOlmg.java
96d55c728bf72475a884ebe6c9ed5c0784512e89
[]
no_license
RamiBenMohamed/appliCoreLMG2-master
1dab08d99dea8208f3c8d9400aad439221e3339d
edb30a64459d8d9005508a54cecc7d0bb0858799
refs/heads/master
2021-01-21T12:49:29.179428
2017-05-19T11:51:00
2017-05-19T11:51:00
91,800,883
0
0
null
null
null
null
UTF-8
Java
false
false
2,220
java
package com.lmg.config; import javax.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.DependsOn; import org.springframework.stereotype.Component; import com.amazonaws.ClientConfiguration; import com.amazonaws.Protocol; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient; import com.amazonaws.services.dynamodbv2.document.DynamoDB; import com.lmg.coreConfiguration; @Configuration @DependsOn("coreConfiguration") @Component public class coreDYNAMOlmg { private static final Logger LOGGER = LoggerFactory.getLogger(coreJMSlmg.class); @Autowired coreConfiguration LaConfig; AmazonDynamoDBClient aMDclient; DynamoDB dynamoDB; /* * On recupere un credential temporaire pour l'accès à l'environnement SAND-BOX * */ @PostConstruct public void init() { try { LOGGER.info("Création du client DynamoDB OK ..........................................."); AWSCredentialsProvider AWSP = LaConfig.getCredentialProvider(); ClientConfiguration cC = LaConfig.getClientConfiguration(); cC.setProtocol(Protocol.HTTPS); aMDclient = new AmazonDynamoDBClient(AWSP,cC); aMDclient.setRegion(Region.getRegion(Regions.EU_CENTRAL_1)); dynamoDB = new DynamoDB(aMDclient); LOGGER.info("initialisation du dynamo DB .....OK .............."); } catch ( Exception e) { LOGGER.info("Echec de l'initialisation du Dynamo Db.............."); LOGGER.info("Service Name : " + aMDclient.getServiceName()); LOGGER.info("Excpetion : " + e.getMessage()); } } public DynamoDB getDynamoDb(){ return dynamoDB; } // // On modifie la configuration du client pour repasser en HTTP // }
[ "benmohamedrami91@gmail.com" ]
benmohamedrami91@gmail.com
f0461194bc0a17bc4bfc1e058eb650b33f053890
a5a13c75c45d9d61f8da309c71c3bd2d0a3cee84
/apollo-sample/src/main/java/com/apollographql/apollo/sample/FeedQuery.java
dd843ecc61dfdcf60e9f2cc93d0b09a2d633aa5f
[]
no_license
bill-lin/apollo-android-generated-sample
4ea05f86476cc0df05e1f685fbda2da97e70ccb8
bd2edacde87da54a8ea0119ad9d5e53e56ecffc5
refs/heads/master
2020-08-01T23:43:53.234831
2019-09-26T19:38:06
2019-09-26T19:38:06
211,162,889
0
0
null
null
null
null
UTF-8
Java
false
false
19,987
java
// AUTO-GENERATED FILE. DO NOT MODIFY. // // This class was automatically generated by Apollo GraphQL plugin from the GraphQL queries it found. // It should not be modified by hand. // package com.apollographql.apollo.sample; import com.apollographql.apollo.api.FragmentResponseFieldMapper; import com.apollographql.apollo.api.InputFieldMarshaller; import com.apollographql.apollo.api.InputFieldWriter; import com.apollographql.apollo.api.Operation; import com.apollographql.apollo.api.OperationName; import com.apollographql.apollo.api.Query; import com.apollographql.apollo.api.ResponseField; import com.apollographql.apollo.api.ResponseFieldMapper; import com.apollographql.apollo.api.ResponseFieldMarshaller; import com.apollographql.apollo.api.ResponseReader; import com.apollographql.apollo.api.ResponseWriter; import com.apollographql.apollo.api.internal.UnmodifiableMapBuilder; import com.apollographql.apollo.api.internal.Utils; import com.apollographql.apollo.sample.fragment.RepositoryFragment; import com.apollographql.apollo.sample.type.FeedType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; public final class FeedQuery implements Query<FeedQuery.Data, FeedQuery.Data, FeedQuery.Variables> { public static final String OPERATION_ID = "1c62dde8b28ec8ee428434328d125ca3b9c9e4653929a4d871b702bdfe9cbf33"; public static final String QUERY_DOCUMENT = "query FeedQuery($type: FeedType!, $limit: Int!) {\n" + " feedEntries: feed(type: $type, limit: $limit) {\n" + " __typename\n" + " id\n" + " repository {\n" + " __typename\n" + " ...RepositoryFragment\n" + " }\n" + " postedBy {\n" + " __typename\n" + " login\n" + " }\n" + " }\n" + "}\n" + "fragment RepositoryFragment on Repository {\n" + " __typename\n" + " name\n" + " full_name\n" + " owner {\n" + " __typename\n" + " login\n" + " }\n" + "}"; public static final OperationName OPERATION_NAME = new OperationName() { @Override public String name() { return "FeedQuery"; } }; private final Variables variables; public FeedQuery(@NotNull FeedType type, int limit) { Utils.checkNotNull(type, "type == null"); variables = new Variables(type, limit); } @Override public String operationId() { return OPERATION_ID; } @Override public String queryDocument() { return QUERY_DOCUMENT; } @Override public Data wrapData(Data data) { return data; } @Override public Variables variables() { return variables; } @Override public ResponseFieldMapper<Data> responseFieldMapper() { return new Data.Mapper(); } public static Builder builder() { return new Builder(); } @Override public OperationName name() { return OPERATION_NAME; } public static final class Builder { private @NotNull FeedType type; private int limit; Builder() { } public Builder type(@NotNull FeedType type) { this.type = type; return this; } public Builder limit(int limit) { this.limit = limit; return this; } public FeedQuery build() { Utils.checkNotNull(type, "type == null"); return new FeedQuery(type, limit); } } public static final class Variables extends Operation.Variables { private final @NotNull FeedType type; private final int limit; private final transient Map<String, Object> valueMap = new LinkedHashMap<>(); Variables(@NotNull FeedType type, int limit) { this.type = type; this.limit = limit; this.valueMap.put("type", type); this.valueMap.put("limit", limit); } public @NotNull FeedType type() { return type; } public int limit() { return limit; } @Override public Map<String, Object> valueMap() { return Collections.unmodifiableMap(valueMap); } @Override public InputFieldMarshaller marshaller() { return new InputFieldMarshaller() { @Override public void marshal(InputFieldWriter writer) throws IOException { writer.writeString("type", type.rawValue()); writer.writeInt("limit", limit); } }; } } public static class Data implements Operation.Data { static final ResponseField[] $responseFields = { ResponseField.forList("feedEntries", "feed", new UnmodifiableMapBuilder<String, Object>(2) .put("type", new UnmodifiableMapBuilder<String, Object>(2) .put("kind", "Variable") .put("variableName", "type") .build()) .put("limit", new UnmodifiableMapBuilder<String, Object>(2) .put("kind", "Variable") .put("variableName", "limit") .build()) .build(), true, Collections.<ResponseField.Condition>emptyList()) }; final @Nullable List<FeedEntry> feedEntries; private transient volatile String $toString; private transient volatile int $hashCode; private transient volatile boolean $hashCodeMemoized; public Data(@Nullable List<FeedEntry> feedEntries) { this.feedEntries = feedEntries; } /** * A feed of repository submissions */ public @Nullable List<FeedEntry> feedEntries() { return this.feedEntries; } @SuppressWarnings("unchecked") public ResponseFieldMarshaller marshaller() { return new ResponseFieldMarshaller() { @Override public void marshal(ResponseWriter writer) { writer.writeList($responseFields[0], feedEntries, new ResponseWriter.ListWriter() { @Override public void write(List items, ResponseWriter.ListItemWriter listItemWriter) { for (Object item : items) { listItemWriter.writeObject(((FeedEntry) item).marshaller()); } } }); } }; } @Override public String toString() { if ($toString == null) { $toString = "Data{" + "feedEntries=" + feedEntries + "}"; } return $toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Data) { Data that = (Data) o; return ((this.feedEntries == null) ? (that.feedEntries == null) : this.feedEntries.equals(that.feedEntries)); } return false; } @Override public int hashCode() { if (!$hashCodeMemoized) { int h = 1; h *= 1000003; h ^= (feedEntries == null) ? 0 : feedEntries.hashCode(); $hashCode = h; $hashCodeMemoized = true; } return $hashCode; } public static final class Mapper implements ResponseFieldMapper<Data> { final FeedEntry.Mapper feedEntryFieldMapper = new FeedEntry.Mapper(); @Override public Data map(ResponseReader reader) { final List<FeedEntry> feedEntries = reader.readList($responseFields[0], new ResponseReader.ListReader<FeedEntry>() { @Override public FeedEntry read(ResponseReader.ListItemReader listItemReader) { return listItemReader.readObject(new ResponseReader.ObjectReader<FeedEntry>() { @Override public FeedEntry read(ResponseReader reader) { return feedEntryFieldMapper.map(reader); } }); } }); return new Data(feedEntries); } } } public static class FeedEntry { static final ResponseField[] $responseFields = { ResponseField.forString("__typename", "__typename", null, false, Collections.<ResponseField.Condition>emptyList()), ResponseField.forInt("id", "id", null, false, Collections.<ResponseField.Condition>emptyList()), ResponseField.forObject("repository", "repository", null, true, Collections.<ResponseField.Condition>emptyList()), ResponseField.forObject("postedBy", "postedBy", null, true, Collections.<ResponseField.Condition>emptyList()) }; final @NotNull String __typename; final int id; final @Nullable Repository repository; final @Nullable PostedBy postedBy; private transient volatile String $toString; private transient volatile int $hashCode; private transient volatile boolean $hashCodeMemoized; public FeedEntry(@NotNull String __typename, int id, @Nullable Repository repository, @Nullable PostedBy postedBy) { this.__typename = Utils.checkNotNull(__typename, "__typename == null"); this.id = id; this.repository = repository; this.postedBy = postedBy; } public @NotNull String __typename() { return this.__typename; } /** * The SQL ID of this entry */ public int id() { return this.id; } /** * Information about the repository from GitHub */ public @Nullable Repository repository() { return this.repository; } /** * The GitHub user who submitted this entry */ public @Nullable PostedBy postedBy() { return this.postedBy; } @SuppressWarnings("unchecked") public ResponseFieldMarshaller marshaller() { return new ResponseFieldMarshaller() { @Override public void marshal(ResponseWriter writer) { writer.writeString($responseFields[0], __typename); writer.writeInt($responseFields[1], id); writer.writeObject($responseFields[2], repository != null ? repository.marshaller() : null); writer.writeObject($responseFields[3], postedBy != null ? postedBy.marshaller() : null); } }; } @Override public String toString() { if ($toString == null) { $toString = "FeedEntry{" + "__typename=" + __typename + ", " + "id=" + id + ", " + "repository=" + repository + ", " + "postedBy=" + postedBy + "}"; } return $toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof FeedEntry) { FeedEntry that = (FeedEntry) o; return this.__typename.equals(that.__typename) && this.id == that.id && ((this.repository == null) ? (that.repository == null) : this.repository.equals(that.repository)) && ((this.postedBy == null) ? (that.postedBy == null) : this.postedBy.equals(that.postedBy)); } return false; } @Override public int hashCode() { if (!$hashCodeMemoized) { int h = 1; h *= 1000003; h ^= __typename.hashCode(); h *= 1000003; h ^= id; h *= 1000003; h ^= (repository == null) ? 0 : repository.hashCode(); h *= 1000003; h ^= (postedBy == null) ? 0 : postedBy.hashCode(); $hashCode = h; $hashCodeMemoized = true; } return $hashCode; } public static final class Mapper implements ResponseFieldMapper<FeedEntry> { final Repository.Mapper repositoryFieldMapper = new Repository.Mapper(); final PostedBy.Mapper postedByFieldMapper = new PostedBy.Mapper(); @Override public FeedEntry map(ResponseReader reader) { final String __typename = reader.readString($responseFields[0]); final int id = reader.readInt($responseFields[1]); final Repository repository = reader.readObject($responseFields[2], new ResponseReader.ObjectReader<Repository>() { @Override public Repository read(ResponseReader reader) { return repositoryFieldMapper.map(reader); } }); final PostedBy postedBy = reader.readObject($responseFields[3], new ResponseReader.ObjectReader<PostedBy>() { @Override public PostedBy read(ResponseReader reader) { return postedByFieldMapper.map(reader); } }); return new FeedEntry(__typename, id, repository, postedBy); } } } public static class Repository { static final ResponseField[] $responseFields = { ResponseField.forString("__typename", "__typename", null, false, Collections.<ResponseField.Condition>emptyList()), ResponseField.forFragment("__typename", "__typename", Arrays.asList("Repository")) }; final @NotNull String __typename; private final @NotNull Fragments fragments; private transient volatile String $toString; private transient volatile int $hashCode; private transient volatile boolean $hashCodeMemoized; public Repository(@NotNull String __typename, @NotNull Fragments fragments) { this.__typename = Utils.checkNotNull(__typename, "__typename == null"); this.fragments = Utils.checkNotNull(fragments, "fragments == null"); } public @NotNull String __typename() { return this.__typename; } public @NotNull Fragments fragments() { return this.fragments; } @SuppressWarnings("unchecked") public ResponseFieldMarshaller marshaller() { return new ResponseFieldMarshaller() { @Override public void marshal(ResponseWriter writer) { writer.writeString($responseFields[0], __typename); fragments.marshaller().marshal(writer); } }; } @Override public String toString() { if ($toString == null) { $toString = "Repository{" + "__typename=" + __typename + ", " + "fragments=" + fragments + "}"; } return $toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Repository) { Repository that = (Repository) o; return this.__typename.equals(that.__typename) && this.fragments.equals(that.fragments); } return false; } @Override public int hashCode() { if (!$hashCodeMemoized) { int h = 1; h *= 1000003; h ^= __typename.hashCode(); h *= 1000003; h ^= fragments.hashCode(); $hashCode = h; $hashCodeMemoized = true; } return $hashCode; } public static class Fragments { final @NotNull RepositoryFragment repositoryFragment; private transient volatile String $toString; private transient volatile int $hashCode; private transient volatile boolean $hashCodeMemoized; public Fragments(@NotNull RepositoryFragment repositoryFragment) { this.repositoryFragment = Utils.checkNotNull(repositoryFragment, "repositoryFragment == null"); } public @NotNull RepositoryFragment repositoryFragment() { return this.repositoryFragment; } public ResponseFieldMarshaller marshaller() { return new ResponseFieldMarshaller() { @Override public void marshal(ResponseWriter writer) { final RepositoryFragment $repositoryFragment = repositoryFragment; if ($repositoryFragment != null) { $repositoryFragment.marshaller().marshal(writer); } } }; } @Override public String toString() { if ($toString == null) { $toString = "Fragments{" + "repositoryFragment=" + repositoryFragment + "}"; } return $toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof Fragments) { Fragments that = (Fragments) o; return this.repositoryFragment.equals(that.repositoryFragment); } return false; } @Override public int hashCode() { if (!$hashCodeMemoized) { int h = 1; h *= 1000003; h ^= repositoryFragment.hashCode(); $hashCode = h; $hashCodeMemoized = true; } return $hashCode; } public static final class Mapper implements FragmentResponseFieldMapper<Fragments> { final RepositoryFragment.Mapper repositoryFragmentFieldMapper = new RepositoryFragment.Mapper(); @Override public @NotNull Fragments map(ResponseReader reader, @NotNull String conditionalType) { RepositoryFragment repositoryFragment = repositoryFragmentFieldMapper.map(reader); return new Fragments(Utils.checkNotNull(repositoryFragment, "repositoryFragment == null")); } } } public static final class Mapper implements ResponseFieldMapper<Repository> { final Fragments.Mapper fragmentsFieldMapper = new Fragments.Mapper(); @Override public Repository map(ResponseReader reader) { final String __typename = reader.readString($responseFields[0]); final Fragments fragments = reader.readConditional($responseFields[1], new ResponseReader.ConditionalTypeReader<Fragments>() { @Override public Fragments read(String conditionalType, ResponseReader reader) { return fragmentsFieldMapper.map(reader, conditionalType); } }); return new Repository(__typename, fragments); } } } public static class PostedBy { static final ResponseField[] $responseFields = { ResponseField.forString("__typename", "__typename", null, false, Collections.<ResponseField.Condition>emptyList()), ResponseField.forString("login", "login", null, false, Collections.<ResponseField.Condition>emptyList()) }; final @NotNull String __typename; final @NotNull String login; private transient volatile String $toString; private transient volatile int $hashCode; private transient volatile boolean $hashCodeMemoized; public PostedBy(@NotNull String __typename, @NotNull String login) { this.__typename = Utils.checkNotNull(__typename, "__typename == null"); this.login = Utils.checkNotNull(login, "login == null"); } public @NotNull String __typename() { return this.__typename; } /** * The name of the user, e.g. apollostack */ public @NotNull String login() { return this.login; } @SuppressWarnings("unchecked") public ResponseFieldMarshaller marshaller() { return new ResponseFieldMarshaller() { @Override public void marshal(ResponseWriter writer) { writer.writeString($responseFields[0], __typename); writer.writeString($responseFields[1], login); } }; } @Override public String toString() { if ($toString == null) { $toString = "PostedBy{" + "__typename=" + __typename + ", " + "login=" + login + "}"; } return $toString; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof PostedBy) { PostedBy that = (PostedBy) o; return this.__typename.equals(that.__typename) && this.login.equals(that.login); } return false; } @Override public int hashCode() { if (!$hashCodeMemoized) { int h = 1; h *= 1000003; h ^= __typename.hashCode(); h *= 1000003; h ^= login.hashCode(); $hashCode = h; $hashCodeMemoized = true; } return $hashCode; } public static final class Mapper implements ResponseFieldMapper<PostedBy> { @Override public PostedBy map(ResponseReader reader) { final String __typename = reader.readString($responseFields[0]); final String login = reader.readString($responseFields[1]); return new PostedBy(__typename, login); } } } }
[ "cold.lin@gmail.com" ]
cold.lin@gmail.com
9e346e7d39fdd75c3edf6291ea1b860b0ac0b72b
4b0fdcd17cb45042710dc72742d744175739f0fb
/src/ejerciciotema4/parte2/Plato.java
75676049f4cdaa9de1cc5808479c086932e219b1
[]
no_license
mdiasan28/Ejercicios_Programacion
180b2745c9cb225cb5237e81114d865136f2cc3c
a4cffd96ef7ce40d660eaf1cec92988324a2869a
refs/heads/master
2020-12-22T07:20:32.605562
2020-03-04T07:39:26
2020-03-04T07:39:26
236,708,090
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package ejerciciotema4.parte2; public class Plato { String nombre; float precio; /** * * @param nombre * @param precio */ public Plato(String nombre, float precio) { super(); this.nombre = nombre; this.precio = precio; } public Plato() { // TODO Auto-generated constructor stub } /** * @return the nombre */ public String getNombre() { return nombre; } /** * @param nombre the nombre to set */ public void setNombre(String nombre) { this.nombre = nombre; } /** * @return the precio */ public float getPrecio() { return precio; } /** * @param precio the precio to set */ public void setPrecio(float precio) { this.precio = precio; } @Override public String toString() { return "Plato [nombre=" + nombre + ", precio=" + precio + ", getNombre()=" + getNombre() + "]"; } }
[ "mdiasan28@gmail.com" ]
mdiasan28@gmail.com
5e737b3d59c87b50d93e9505ea426d9b41110690
50de3b3875b0744222374c1e9d18056496dec3da
/REST/DBSample/service/src/main/java/ru/forxy/fraud/db/dao/mongo/CurrencyExchangeDAO.java
af267b78b9f4bc12895f9d055d42ebf954dcf34b
[]
no_license
Askadias/LearningREST
d7b15aa8d459d7896d16c205873e57033714cd22
3a638eff1d4479366100413f2dadb1f90f849405
refs/heads/master
2021-05-28T02:03:06.072547
2014-11-13T16:13:34
2014-11-13T16:13:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,106
java
package ru.forxy.fraud.db.dao.mongo; import org.apache.commons.lang.time.DateUtils; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.beans.factory.InitializingBean; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; import ru.forxy.common.utils.NetworkUtils; import ru.forxy.fraud.db.dao.ICurrencyExchangeDAO; import ru.forxy.fraud.db.dto.Currency; import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; public class CurrencyExchangeDAO implements ICurrencyExchangeDAO, InitializingBean { private static final String YAHOO_ALL_CURRENCIES_XML = "http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote?format=json"; private static final DateFormat UTC_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); private Date lastUpdateDate = null; private MongoTemplate mongoTemplate; private Map<String, Currency> currencyExchangeRatesToUSD = new HashMap<String, Currency>(); @Override public void performScheduledCurrencyUpdate() throws IOException, ParseException { if (new Date().getTime() - lastUpdateDate.getTime() > DateUtils.MILLIS_PER_DAY) { updateCurrencyExchangeRates(); } } private void updateCurrencyExchangeRates() throws IOException, ParseException { String jsonString = NetworkUtils.getURLResource(YAHOO_ALL_CURRENCIES_XML); JSONObject jsonObject = new JSONObject(jsonString); JSONObject listObject = jsonObject.getJSONObject("list"); JSONArray resources = listObject.getJSONArray("resources"); Map<String, Currency> currencies = new HashMap<String, Currency>(resources.length()); Date maxUpdateDate = new Date(0); for (int i = 0; i < resources.length(); i++) { JSONObject resource = resources.getJSONObject(i).getJSONObject("resource"); JSONObject fields = resource.getJSONObject("fields"); String name = fields.getString("name"); String pair[] = name.split("/"); String utcTime = fields.getString("utctime"); Date updateDate = UTC_DATE_FORMAT.parse(utcTime); if (pair.length == 2 && pair[0].equals("USD") && !pair[1].equals("USD")) { Double price = fields.getDouble("price"); Currency currency = new Currency(pair[1], price, updateDate); currencies.put(pair[1], currency); mongoTemplate.save(currency); } if (maxUpdateDate.getTime() < updateDate.getTime()) { maxUpdateDate = updateDate; } } lastUpdateDate = maxUpdateDate; if (currencies.size() > 0) { currencyExchangeRatesToUSD = currencies; } } @Override public Double usdValue(String currencySymbol, Double amount) { Currency currency = currencyExchangeRatesToUSD.get(currencySymbol); return currency != null && amount != null ? amount * currency.getUsdRate() : null; } public void setMongoTemplate(MongoTemplate mongoTemplate) { this.mongoTemplate = mongoTemplate; } @Override public void afterPropertiesSet() throws Exception { List<Currency> currencies = mongoTemplate.find(Query.query(new Criteria()), Currency.class); if (currencies != null && currencies.size() > 0) { Date maxUpdateDate = new Date(0); for (Currency currency : currencies) { currencyExchangeRatesToUSD.put(currency.getSymbol(), currency); if (maxUpdateDate.getTime() < currency.getUpdateDate().getTime()) { maxUpdateDate = currency.getUpdateDate(); } } lastUpdateDate = maxUpdateDate; } else { updateCurrencyExchangeRates(); } } }
[ "askadias@mail.ru" ]
askadias@mail.ru
7e59bb9af5ee35ce15636a52f9b72298121bf4cf
69ab15dd5f2f79961b67882e45b95341133f5aef
/BSX/src/java/myModels/clsDBFunction.java
ec27a1c3d22ddeffcf6c992ad73421a32c27cb33
[]
no_license
tskmliyuth/data
986620cfa722d80b08c444c738bd3110849a2a2a
150c06baec362672df9e3bd69d735207be56ea59
refs/heads/master
2021-05-27T11:25:56.460923
2013-02-07T00:56:47
2013-02-07T00:56:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package myModels; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; /** * * @author NHEP BORA */ public class clsDBFunction { //Method convert to Lower cast public static String LOWER(String pValue){ return "LOWER(" + pValue + ")"; } public static String Format(Object pObject){ SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); String myString = (String) formatter.format(pObject); return myString; } public static String getDateTime() { DateFormat dateFormat = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); Date date = new Date(); return dateFormat.format(date); } public static int Boolean_to_Integer(boolean pValue){ if (pValue==true){ return 1; }else{ return 0; } } public static boolean Integer_to_Boolean(int pValue){ if (pValue==1){ return true; }else{ return false; } } }
[ "sokhomoliyuth.tea@gmail.com" ]
sokhomoliyuth.tea@gmail.com
687b519f5d05930ab8bcb28d7015cd2a0e41cc84
2452a509f33f3f03ea10bd0c52a249054ed488bd
/src/main/java/kpi/manfredi/gui/controllers/ProcessingEnvironmentController.java
1c898b0cff96bd77caf6f5ae85340f9db1293eef
[]
no_license
MrManfredi/RenamingService
d636bfb5e57a5bc9a76eaea40bbe8807b365694b
e0ede498a80460f6e985a97329635dbaa2edc5c0
refs/heads/master
2023-04-21T07:56:10.989192
2020-09-07T22:21:23
2020-09-07T22:21:23
200,072,362
0
0
null
2021-04-26T20:35:04
2019-08-01T15:07:45
Java
UTF-8
Java
false
false
8,451
java
package kpi.manfredi.gui.controllers; import javafx.collections.ListChangeListener; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.MenuItem; import javafx.scene.control.TextArea; import javafx.scene.control.*; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.KeyCode; import javafx.scene.input.KeyCodeCombination; import javafx.scene.input.KeyCombination; import javafx.scene.layout.VBox; import javafx.stage.Stage; import kpi.manfredi.gui.commands.MenuCommands; import kpi.manfredi.tags.TagsAdapter; import kpi.manfredi.tags.TagsCustodian; import kpi.manfredi.tags.tree.TagsTree; import org.controlsfx.control.CheckTreeView; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.xml.bind.JAXBException; import java.awt.*; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import static kpi.manfredi.utils.DialogsUtil.showAlert; import static kpi.manfredi.utils.DialogsUtil.showFileNotFoundAlert; import static kpi.manfredi.utils.FileManipulation.convertToFile; import static kpi.manfredi.utils.MessageUtil.getMessage; public class ProcessingEnvironmentController { private static final Logger logger = LoggerFactory.getLogger(ProcessingEnvironmentController.class); private Stage mainStage; // // Container // @FXML private VBox vBoxContainer; // // Menu // @FXML private MenuItem menuOpen; @FXML private MenuItem menuSelectAll; @FXML private MenuItem menuClearAll; @FXML private MenuItem menuClearSelected; @FXML private MenuItem menuRenameIteratively; @FXML private MenuItem menuDelete; @FXML private MenuItem menuAbout; // // Left Panel // @FXML private CheckTreeView<Object> tagsTree; @FXML private TextArea oldName; @FXML private TextArea newName; @FXML private Button renameButton; /// // Images list // @FXML private ListView<File> imagesListView; // // Preview // @FXML private ImageView previewImage; @FXML private Button openImageButton; // // Main method // public void initialize() { // Menu initMenuListeners(); // Left Panel initTagsTree(); initTagsSelectionListener(); // Images List initImagesListView(); // Image preview initOpenImageButtonListener(); } // // Menu // private void initMenuListeners() { menuOpen.setOnAction(event -> MenuCommands.open(imagesListView.getItems(), getMainStage())); menuOpen.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.CONTROL_DOWN)); menuSelectAll.setOnAction(event -> imagesListView.getSelectionModel().selectAll()); menuClearAll.setOnAction(event -> imagesListView.getItems().clear()); menuClearSelected.setOnAction(event -> MenuCommands.delete( imagesListView.getItems(), imagesListView.getSelectionModel().getSelectedItems(), false)); menuRenameIteratively.setOnAction(event -> MenuCommands.renameIteratively(imagesListView)); menuDelete.setOnAction(event -> MenuCommands.delete( imagesListView.getItems(), imagesListView.getSelectionModel().getSelectedItems(), true)); menuDelete.setAccelerator(new KeyCodeCombination(KeyCode.DELETE)); menuAbout.setOnAction(event -> showAlert( Alert.AlertType.INFORMATION, getMessage("about.title"), getMessage("about.header"), getMessage("about.content") )); } // // Left Panel // private void initTagsTree() { TagsTree tagsTree = null; try { tagsTree = TagsCustodian.getTags(); } catch (FileNotFoundException e) { showAlert( Alert.AlertType.ERROR, getMessage("error.title"), e.getMessage()); } catch (JAXBException jbe) { showAlert( Alert.AlertType.ERROR, getMessage("error.title"), jbe.getMessage(), getMessage("tags.validation.error.content") ); } if (tagsTree == null) { this.tagsTree.setRoot(new CheckBoxTreeItem<>("Error")); this.tagsTree.setShowRoot(true); } else { CheckBoxTreeItem<Object> rootItem = TagsAdapter.getRootItem(tagsTree); this.tagsTree.setRoot(rootItem); } } private void initTagsSelectionListener() { tagsTree.getCheckModel().getCheckedItems().addListener((ListChangeListener<TreeItem<Object>>) c -> newName.setText(tagsTree.getCheckModel().getCheckedItems().toString()) ); } private Stage getMainStage() { if (mainStage == null) mainStage = (Stage) vBoxContainer.getScene().getWindow(); return mainStage; } // // Images List // private void initImagesListView() { imagesListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); initImagesLvKeyListener(); imagesListView.setCellFactory(lv -> { ListCell<File> cell = new ListCell<>() { @Override protected void updateItem(File item, boolean empty) { super.updateItem(item, empty); if (item != null) setText(item.getName()); else setText(""); } }; cell.setOnMouseClicked(e -> { if (!cell.isEmpty()) { logger.debug("You clicked on " + cell.getItem()); setFocusedImagePreview(); } }); return cell; }); } private void initImagesLvKeyListener() { imagesListView.setOnKeyPressed(event -> { switch (event.getCode()) { case UP: case DOWN: setFocusedImagePreview(); break; } }); } // // Image preview // private void setFocusedImagePreview() { File focusedItem = imagesListView.getFocusModel().getFocusedItem(); if (focusedItem == null) { setDefaultPreviewImage(); } else if (focusedItem.exists()) { try { setPreviewImage(focusedItem); } catch (MalformedURLException ex) { logger.error(ex.getMessage()); } } else { logger.warn("File {} does not exist!", focusedItem); imagesListView.getItems().remove(focusedItem); showFileNotFoundAlert(focusedItem); } } private void setPreviewImage(File file) throws MalformedURLException { Image image = new Image(file.toURI().toURL().toString()); previewImage.setImage(image); logger.debug("Set preview image to {}", file); } private void initOpenImageButtonListener() { openImageButton.setOnMouseClicked(event -> { if (previewImage != null) { File file = convertToFile(previewImage.getImage()); if (file != null) { if (file.exists()) { Desktop desktop = Desktop.getDesktop(); try { desktop.open(file); } catch (IOException e) { logger.error(e.getMessage()); } } else { logger.warn("File {} does not exist!", file); imagesListView.getItems().remove(file); showFileNotFoundAlert(file); setDefaultPreviewImage(); } } } }); } private void setDefaultPreviewImage() { Image image = new Image("preview_image.jpg"); previewImage.setImage(image); } }
[ "mrmanfredi228@gmail.com" ]
mrmanfredi228@gmail.com
234fcd1c0f26edabaa77538cded1d3273708c3e9
840e24e04be310f0e916a5f28d2745c75a83041a
/src/main/java/com/xuyang/mapper/TcouponsMapper.java
b7d4d7690856baea84defc1f5c8acc7aa93c4392
[]
no_license
arillYang/multiUserApp
ef822fccf0caefae010a9d5a04f8b68c2335a857
8ef88ba94db3ac64b74af54ec5c980d8291f75f0
refs/heads/master
2020-04-03T18:24:02.602305
2018-12-10T03:09:38
2018-12-10T03:09:38
155,482,458
0
0
null
null
null
null
UTF-8
Java
false
false
2,654
java
package com.xuyang.mapper; import com.xuyang.model.Tcoupons; import com.xuyang.model.TcouponsExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface TcouponsMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ long countByExample(TcouponsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int deleteByExample(TcouponsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int deleteByPrimaryKey(Integer couponId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int insert(Tcoupons record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int insertSelective(Tcoupons record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ List<Tcoupons> selectByExample(TcouponsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ Tcoupons selectByPrimaryKey(Integer couponId); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int updateByExampleSelective(@Param("record") Tcoupons record, @Param("example") TcouponsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int updateByExample(@Param("record") Tcoupons record, @Param("example") TcouponsExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int updateByPrimaryKeySelective(Tcoupons record); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_coupons * * @mbg.generated */ int updateByPrimaryKey(Tcoupons record); }
[ "15823914401@163.com" ]
15823914401@163.com
0a2a9086035b37c3c17c85a553a176b515b8e4a7
1cef0267f8b24cb59b5fed3d0f95030d8da4e59b
/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/segment/impl/insert/ExpectedReturningClause.java
5bc33f2c73a4a27a5dcd7448c696e76d8f0c2b37
[ "Apache-2.0" ]
permissive
apache/shardingsphere
4e69d07ad082ed3d1269e113d66421f67baa1f02
5ad75d38ab4fcf169a1a4704be4e671200d02e4c
refs/heads/master
2023-09-02T15:56:04.469891
2023-09-02T15:20:38
2023-09-02T15:20:38
49,876,476
9,157
3,758
Apache-2.0
2023-09-14T14:45:41
2016-01-18T12:49:26
Java
UTF-8
Java
false
false
1,285
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.insert; import lombok.Getter; import org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.segment.impl.projection.ExpectedProjections; import javax.xml.bind.annotation.XmlElement; /** * Expected returning clause. */ @Getter public class ExpectedReturningClause { @XmlElement private final ExpectedProjections projections = new ExpectedProjections(); }
[ "noreply@github.com" ]
noreply@github.com
2fe8c49a3f4840a9986d5f8e491825cb4272d1c7
2992fd099aa401a601e0dc0bac0aa598058ef951
/Behavioral/Memento/src/main/java/app/web/pavelk/pattern20/shapes/BaseShape.java
af0c2dfa2a84a453395fd76ace20910b4a3c8034
[]
no_license
PavelK6896/9887Pattern1Java
72f4357e5505c174795cb73235e99f9cdb9cac39
1b8a3830f34b555b28381a5af770ad0c6709bc2e
refs/heads/master
2023-03-27T10:31:40.765510
2021-03-31T17:44:26
2021-03-31T17:44:26
341,268,476
0
0
null
null
null
null
UTF-8
Java
false
false
2,022
java
package app.web.pavelk.pattern20.shapes; import java.awt.*; public abstract class BaseShape implements Shape { int x, y; private int dx = 0, dy = 0; private Color color; private boolean selected = false; BaseShape(int x, int y, Color color) { this.x = x; this.y = y; this.color = color; } @Override public int getX() { return x; } @Override public int getY() { return y; } @Override public int getWidth() { return 0; } @Override public int getHeight() { return 0; } @Override public void drag() { dx = x; dy = y; } @Override public void moveTo(int x, int y) { this.x = dx + x; this.y = dy + y; } @Override public void moveBy(int x, int y) { this.x += x; this.y += y; } @Override public void drop() { this.x = dx; this.y = dy; } @Override public boolean isInsideBounds(int x, int y) { return x > getX() && x < (getX() + getWidth()) && y > getY() && y < (getY() + getHeight()); } @Override public Color getColor() { return color; } @Override public void setColor(Color color) { this.color = color; } @Override public void select() { selected = true; } @Override public void unSelect() { selected = false; } @Override public boolean isSelected() { return selected; } void enableSelectionStyle(Graphics graphics) { graphics.setColor(Color.LIGHT_GRAY); Graphics2D g2 = (Graphics2D) graphics; float dash1[] = {2.0f}; g2.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 2.0f, dash1, 0.0f)); } void disableSelectionStyle(Graphics graphics) { graphics.setColor(color); Graphics2D g2 = (Graphics2D) graphics; g2.setStroke(new BasicStroke()); } @Override public void paint(Graphics graphics) { if (isSelected()) { enableSelectionStyle(graphics); } else { disableSelectionStyle(graphics); } // ... } }
[ "79208776896@yandex.ru" ]
79208776896@yandex.ru
484670b6e7270fe6741005961d6965a0ae2239e3
14d1b09d42c0318b61f8bab9c62f9f9a0597fc2f
/src/main/java/com/springworkshop/handson/sessionone/intro/exercisefive/MobileProcessor.java
09430c00f03cf49aaba76678255cb47a99538d2f
[]
no_license
ElsonRenatoDeFranca/SpringCore
d9975459ce9362da6f0150794f10499646398ace
38b1f258309322c1f90a9e9ad1355bf13f1f86f0
refs/heads/master
2023-04-27T18:37:11.249331
2019-07-19T21:12:08
2019-07-19T21:12:08
197,270,542
0
0
null
2023-04-17T19:08:17
2019-07-16T21:30:01
Java
UTF-8
Java
false
false
169
java
package com.springworkshop.handson.sessionone.intro.exercisefive; /** * Created by e068635 on 7/15/2019. */ public interface MobileProcessor { void process(); }
[ "elson.franca@mastercard.com" ]
elson.franca@mastercard.com
949b88ceadb010a85e3c42ffc5306de227b10c21
50073e47b4eab994faa91cb678ec670888b34745
/src/Test3.java
284168c867017a49882ace8335883a6d2cee879a
[]
no_license
AntoMertz/TestProject
11215b2ebcb6268f7d0b4f12d22feb1e4d1a4cf6
98c7d703711d2d8df1f1fd8de5d81851ecb8a28b
refs/heads/master
2023-04-09T07:33:55.038823
2021-04-18T09:25:35
2021-04-18T09:25:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
58
java
public class Test3 { public void method3() { } }
[ "ics20072@uom.edu.gr" ]
ics20072@uom.edu.gr
7c7ed09bce30eb3b544ff7bc2dedda6029fa101a
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_43_buggy/mutated/406/HtmlTreeBuilderState.java
f713af79a09ab8fafc307eda07060776eb5a80f5
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
68,204
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; import java.util.Iterator; import java.util.LinkedList; /** * The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states. */ enum HtmlTreeBuilderState { Initial { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } }, BeforeHtml { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); return false; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { tb.insert(t.asStartTag()); tb.transition(BeforeHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { return anythingElse(t, tb); } else if (t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.insert("html"); tb.transition(BeforeHead); return tb.process(t); } }, BeforeHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return InBody.process(t, tb); // does not transition } else if (t.isStartTag() && t.asStartTag().name().equals("head")) { Element head = tb.insert(t.asStartTag()); tb.setHeadElement(head); tb.transition(InHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { tb.process(new Token.StartTag("head")); return tb.process(t); } else if (t.isEndTag()) { tb.error(this); return false; } else { tb.process(new Token.StartTag("head")); return tb.process(t); } return true; } }, InHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return InBody.process(t, tb); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) { Element el = tb.insertEmpty(start); // jsoup special: update base the frist time it is seen if (name.equals("base") && el.hasAttr("href")) tb.maybeSetBaseUri(el); } else if (name.equals("meta")) { Element meta = tb.insertEmpty(start); // todo: charset switches } else if (name.equals("title")) { handleRcData(start, tb); } else if (StringUtil.in(name, "noframes", "style")) { handleRawtext(start, tb); } else if (name.equals("noscript")) { // else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript) tb.insert(start); tb.transition(InHeadNoscript); } else if (name.equals("script")) { // skips some script rules as won't execute them tb.insert(start); tb.tokeniser.transition(TokeniserState.ScriptData); tb.markInsertionMode(); tb.transition(Text); } else if (name.equals("head")) { tb.error(this); return false; } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("head")) { tb.pop(); tb.transition(AfterHead); } else if (StringUtil.in(name, "body", "html", "br")) { return anythingElse(t, tb); } else { tb.error(this); return false; } break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.EndTag("head")); return tb.process(t); } }, InHeadNoscript { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) { tb.pop(); tb.transition(InHead); } else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "basefont", "bgsound", "link", "meta", "noframes", "style"))) { return tb.process(t, InHead); } else if (t.isEndTag() && t.asEndTag().name().equals("br")) { return anythingElse(t, tb); } else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); tb.process(new Token.EndTag("noscript")); return tb.process(t); } }, AfterHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { return tb.process(t, InBody); } else if (name.equals("body")) { tb.insert(startTag); tb.framesetOk(false); tb.transition(InBody); } else if (name.equals("frameset")) { tb.insert(startTag); tb.transition(InFrameset); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) { tb.error(this); Element head = tb.getHeadElement(); tb.push(head); tb.process(t, InHead); tb.removeFromStack(head); } else if (name.equals("head")) { tb.error(this); return false; } else { anythingElse(t, tb); } } else if (t.isEndTag()) { if (StringUtil.in(t.asEndTag().name(), "body", "html")) { anythingElse(t, tb); } else { tb.error(this); return false; } } else { anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.process(new Token.StartTag("body")); tb.framesetOk(true); return tb.process(t); } }, InBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: { Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { // todo confirm that check tb.error(this); return false; } else if (isWhitespace(c)) { tb.reconstructFormattingElements(); tb.insert(c); } else { tb.reconstructFormattingElements(); tb.insert(c); tb.framesetOk(false); } break; } case Comment: { tb.insert(t.asComment()); break; } case Doctype: { tb.error(this); return false; } case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { tb.error(this); // merge attributes onto real html Element html = tb.getStack().getFirst(); for (Attribute attribute : startTag.getAttributes()) { if (!html.hasAttr(attribute.getKey())) html.attributes().put(attribute); } } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) { return tb.process(t, InHead); } else if (name.equals("body")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else { tb.framesetOk(false); Element body = stack.get(1); for (Attribute attribute : startTag.getAttributes()) { if (!body.hasAttr(attribute.getKey())) body.attributes().put(attribute); } } } else if (name.equals("frameset")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else if (!tb.framesetOk()) { return false; // ignore frameset } else { Element second = stack.get(1); if (second.parent() != null) second.remove(); // pop up to html element while (stack.size() > 1) stack.removeLast(); tb.insert(startTag); tb.transition(InFrameset); } } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) { tb.error(this); tb.pop(); } tb.insert(startTag); } else if (StringUtil.in(name, "pre", "listing")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } else if (name.equals("form")) { if (tb.getFormElement() != null) { tb.error(this); return false; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } Element form = tb.insert(startTag); tb.setFormElement(form); } else if (name.equals("li")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (el.nodeName().equals("li")) { tb.process(new Token.EndTag("li")); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "dd", "dt")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (StringUtil.in(el.nodeName(), "dd", "dt")) { tb.process(new Token.EndTag(el.nodeName())); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (name.equals("plaintext")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out } else if (name.equals("button")) { if (tb.inButtonScope("button")) { // close and reprocess tb.error(this); tb.process(new Token.EndTag("button")); tb.process(startTag); } else { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); } } else if (name.equals("a")) { if (tb.getActiveFormattingElement("a") != null) { tb.error(this); tb.process(new Token.EndTag("a")); // still on stack? Element remainingA = tb.getFromStack("a"); if (remainingA != null) { tb.removeFromActiveFormattingElements(remainingA); tb.removeFromStack(remainingA); } } tb.reconstructFormattingElements(); Element a = tb.insert(startTag); tb.pushActiveFormattingElements(a); } else if (StringUtil.in(name, "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) { tb.reconstructFormattingElements(); Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (name.equals("nobr")) { tb.reconstructFormattingElements(); if (tb.inScope("nobr")) { tb.error(this); tb.process(new Token.EndTag("nobr")); tb.reconstructFormattingElements(); } Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (StringUtil.in(name, "applet", "marquee", "object")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.insertMarkerToFormattingElements(); tb.framesetOk(false); } else if (name.equals("table")) { if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.framesetOk(false); tb.transition(InTable); } else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) { tb.reconstructFormattingElements(); tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("input")) { tb.reconstructFormattingElements(); Element el = tb.insertEmpty(startTag); if (!el.attr("type").equalsIgnoreCase("hidden")) tb.framesetOk(false); } else if (StringUtil.in(name, "param", "source", "track")) { tb.insertEmpty(startTag); } else if (name.equals("hr")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("image")) { // we're not supposed to ask. startTag.name("img"); return tb.process(startTag); } else if (name.equals("isindex")) { // how much do we care about the early 90s? tb.error(this); if (tb.getFormElement() != null) return false; tb.tokeniser.acknowledgeSelfClosingFlag(); tb.process(new Token.StartTag("form")); if (startTag.attributes.hasKey("action")) { Element form = tb.getFormElement(); form.attr("action", startTag.attributes.get("action")); } tb.process(new Token.StartTag("hr")); tb.process(new Token.StartTag("label")); // hope you like english. String prompt = startTag.attributes.hasKey("prompt") ? startTag.attributes.get("prompt") : "This is a searchable index. Enter search keywords: "; tb.process(new Token.Character(prompt)); // input Attributes inputAttribs = new Attributes(); for (Attribute attr : startTag.attributes) { if (!StringUtil.in(attr.getKey(), "name", "action", "prompt")) inputAttribs.put(attr); } inputAttribs.put("name", "isindex"); tb.process(new Token.StartTag("input", inputAttribs)); tb.process(new Token.EndTag("label")); tb.process(new Token.StartTag("hr")); tb.process(new Token.EndTag("form")); } else if (name.equals("textarea")) { tb.insert(startTag); // todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.framesetOk(false); tb.transition(Text); } else if (name.equals("xmp")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.reconstructFormattingElements(); tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("iframe")) { tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("noembed")) { // also handle noscript if script enabled handleRawtext(startTag, tb); } else if (name.equals("select")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); HtmlTreeBuilderState state = tb.state(); if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) tb.transition(InSelectInTable); else tb.transition(InSelect); } else if (StringUtil.in("optgroup", "option")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in("rp", "rt")) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("body")) { if (!tb.inScope("body")) { tb.error(this); return false; } else { // todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html tb.transition(AfterBody); } } else if (name.equals("html")) { boolean notIgnored = tb.process(new Token.EndTag("body")); if (notIgnored) return tb.process(endTag); } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul")) { // todo: refactor these lookups if (!tb.inScope(name)) { // nothing to close tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("form")) { Element currentForm = tb.getFormElement(); tb.setFormElement(null); if (currentForm == null || !tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); // remove currentForm from stack. will shift anything under up. tb.removeFromStack(currentForm); } } else if (name.equals("p")) { if (!tb.inButtonScope(name)) { tb.error(this); tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p> return tb.process(endTag); } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("li")) { if (!tb.inListItemScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "dd", "dt")) { if (!tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6"); } } else if (name.equals("sarcasm")) { // *sigh* return anyOtherEndTag(t, tb); } else if (StringUtil.in(name, "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) { // Adoption Agency Algorithm. OUTER: for (int i = 0; i < 8; i++) { Element formatEl = tb.getActiveFormattingElement(name); if (formatEl == null) return anyOtherEndTag(t, tb); else if (!tb.onStack(formatEl)) { tb.error(this); tb.removeFromActiveFormattingElements(formatEl); return true; } else if (!tb.inScope(formatEl.nodeName())) { tb.error(this); return false; } else if (tb.currentElement() != formatEl) tb.error(this); Element furthestBlock = null; Element commonAncestor = null; boolean seenFormattingElement = false; LinkedList<Element> stack = tb.getStack(); for (int si = 0; si < stack.size(); si++) { Element el = stack.get(si); if (el == formatEl) { commonAncestor = stack.get(si - 1); seenFormattingElement = true; } else if (seenFormattingElement && tb.isSpecial(el)) { furthestBlock = el; break; } } if (furthestBlock == null) { tb.popStackToClose(formatEl.nodeName()); tb.removeFromActiveFormattingElements(formatEl); return true; } // todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list. // does that mean: int pos of format el in list? Element node = furthestBlock; Element lastNode = furthestBlock; INNER: for (int j = 0; j < 3; j++) { if (tb.onStack(node)) node = tb.aboveOnStack(node); if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check tb.removeFromStack(node); continue INNER; } else if (node == formatEl) break INNER; Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); tb.replaceActiveFormattingElement(node, replacement); tb.replaceOnStack(node, replacement); node = replacement; if (lastNode == furthestBlock) { // todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements. // not getting how this bookmark both straddles the element above, but is inbetween here... } if (lastNode.parent() != null) lastNode.remove(); node.appendChild(lastNode); lastNode = node; } if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { if (lastNode.parent() != null) lastNode.remove(); tb.insertInFosterParent(lastNode); } else { if (lastNode.parent() != null) lastNode.remove(); commonAncestor.appendChild(lastNode); } Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]); for (Node childNode : childNodes) { adopter.appendChild(childNode); // append will reparent. thus the clone to avvoid concurrent mod. } furthestBlock.appendChild(adopter); tb.removeFromActiveFormattingElements(formatEl); // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark. tb.removeFromStack(formatEl); tb.insertOnStackAfter(furthestBlock, adopter); } } else if (StringUtil.in(name, "applet", "marquee", "object")) { if (!tb.inScope("name")) { if (!tb.inScope(name)) { tb.error(this); return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); } } else if (name.equals("br")) { tb.error(this); tb.process(new Token.StartTag("br")); return false; } else { return anyOtherEndTag(t, tb); } break; case EOF: // todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html // stop parsing break; } return true; } boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { String name = t.asEndTag().name(); DescendableLinkedList<Element> stack = tb.getStack(); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (node.nodeName().equals(name)) { tb.generateImpliedEndTags(name); if (!name.equals(tb.currentElement().nodeName())) tb.error(this); tb.popStackToClose(name); break; } else { if (tb.isSpecial(node)) { tb.error(this); return false; } } } return true; } }, Text { // in script, style etc. normally treated as data tags boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.insert(t.asCharacter()); } else if (t.isEOF()) { tb.error(this); // if current node is script: already started tb.pop(); tb.transition(tb.originalState()); return tb.process(t); } else if (t.isEndTag()) { // if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts tb.pop(); tb.transition(tb.originalState()); } return true; } }, InTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.newPendingTableCharacters(); tb.markInsertionMode(); tb.transition(InTableText); return tb.process(t); } else if (t.isComment()) { tb.insert(t.asComment()); return true; } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("caption")) { tb.clearStackToTableContext(); tb.insertMarkerToFormattingElements(); tb.insert(startTag); tb.transition(InCaption); } else if (name.equals("colgroup")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InColumnGroup); } else if (name.equals("col")) { tb.process(new Token.StartTag("colgroup")); return tb.process(t); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InTableBody); } else if (StringUtil.in(name, "td", "th", "tr")) { tb.process(new Token.StartTag("tbody")); return tb.process(t); } else if (name.equals("table")) { tb.error(this); boolean processed = tb.process(new Token.EndTag("table")); if (processed) // only ignored if in fragment return tb.process(t); } else if (StringUtil.in(name, "style", "script")) { return tb.process(t, InHead); } else if (name.equals("input")) { if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) { return anythingElse(t, tb); } else { tb.insertEmpty(startTag); } } else if (name.equals("form")) { tb.error(this); if (tb.getFormElement() != null) return false; else { Element form = tb.insertEmpty(startTag); tb.setFormElement(form); } } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("table")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.popStackToClose("table"); } tb.resetInsertionMode(); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else if (t.isEOF()) { if (tb.currentElement().nodeName().equals("html")) tb.error(this); return true; // stops parsing } return anythingElse(t, tb); } boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); boolean processed = true; if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); processed = tb.process(t, InBody); tb.setFosterInserts(false); } else { processed = tb.process(t, InBody); } return processed; } }, InTableText { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.getPendingTableCharacters().add(c); } break; default: if (tb.getPendingTableCharacters().size() > 0) { for (Token.Character character : tb.getPendingTableCharacters()) { if (!isWhitespace(character)) { // InTable anything else section: tb.error(this); if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); tb.process(character, InBody); tb.setFosterInserts(false); } else { tb.process(character, InBody); } } else tb.insert(character); } tb.newPendingTableCharacters(); } tb.transition(tb.originalState()); return tb.process(t); } return true; } }, InCaption { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag() && t.asEndTag().name().equals("caption")) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("caption")) tb.error(this); tb.popStackToClose("caption"); tb.clearFormattingElementsToLastMarker(); tb.transition(InTable); } } else if (( t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") || t.isEndTag() && t.asEndTag().name().equals("table")) ) { tb.error(this); boolean processed = tb.process(new Token.EndTag("caption")); if (processed) return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return tb.process(t, InBody); } return true; } }, InColumnGroup { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); break; case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) return tb.process(t, InBody); else if (name.equals("col")) tb.insertEmpty(startTag); else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("colgroup")) { if (tb.currentElement().nodeName().equals("html")) { // frag case tb.error(this); return false; } else { tb.pop(); tb.transition(InTable); } } else return anythingElse(t, tb); break; case EOF: if (tb.currentElement().nodeName().equals("html")) return true; // stop parsing; frag case else return anythingElse(t, tb); default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("colgroup")); if (processed) // only ignored in frag case return tb.process(t); return true; } }, InTableBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("tr")) { tb.clearStackToTableBodyContext(); tb.insert(startTag); tb.transition(InRow); } else if (StringUtil.in(name, "th", "td")) { tb.error(this); tb.process(new Token.StartTag("tr")); return tb.process(startTag); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) { return exitTableBody(t, tb); } else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.clearStackToTableBodyContext(); tb.pop(); tb.transition(InTable); } } else if (name.equals("table")) { return exitTableBody(t, tb); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) { tb.error(this); return false; } else return anythingElse(t, tb); break; default: return anythingElse(t, tb); } return true; } private boolean exitTableBody(Token t, HtmlTreeBuilder tb) { if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) { // frag case tb.error(this); return false; } tb.clearStackToTableBodyContext(); tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead return tb.process(t); } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } }, InRow { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (StringUtil.in(name, "th", "td")) { tb.clearStackToTableRowContext(); tb.insert(startTag); tb.transition(InCell); tb.insertMarkerToFormattingElements(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return handleMissingTr(t, tb); } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("tr")) { if (!tb.inTableScope(name)) { tb.error(this); // frag return false; } tb.clearStackToTableRowContext(); tb.pop(); // tr tb.transition(InTableBody); } else if (name.equals("table")) { return handleMissingTr(t, tb); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } tb.process(new Token.EndTag("tr")); return tb.process(t); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } private boolean handleMissingTr(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("tr")); if (processed) return tb.process(t); else return false; } }, InCell { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (StringUtil.in(name, "td", "th")) { if (!tb.inTableScope(name)) { tb.error(this); tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); tb.transition(InRow); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) { tb.error(this); return false; } else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } } else if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) { if (!(tb.inTableScope("td") || tb.inTableScope("th"))) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InBody); } private void closeCell(HtmlTreeBuilder tb) { if (tb.inTableScope("td")) tb.process(new Token.EndTag("td")); else tb.process(new Token.EndTag("th")); // only here if th or td in scope } }, InSelect { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.insert(c); } break; case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) return tb.process(start, InBody); else if (name.equals("option")) { tb.process(new Token.EndTag("option")); tb.insert(start); } else if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); else if (tb.currentElement().nodeName().equals("optgroup")) tb.process(new Token.EndTag("optgroup")); tb.insert(start); } else if (name.equals("select")) { tb.error(this); return tb.process(new Token.EndTag("select")); } else if (StringUtil.in(name, "input", "keygen", "textarea")) { tb.error(this); if (!tb.inSelectScope("select")) return false; // frag tb.process(new Token.EndTag("select")); return tb.process(start); } else if (name.equals("script")) { return tb.process(t, InHead); } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup")) tb.process(new Token.EndTag("option")); if (tb.currentElement().nodeName().equals("optgroup")) tb.pop(); else tb.error(this); } else if (name.equals("option")) { if (tb.currentElement().nodeName().equals("option")) tb.pop(); else tb.error(this); } else if (name.equals("select")) { if (!tb.inSelectScope(name)) { tb.error(this); return false; } else { tb.popStackToClose(name); tb.resetInsertionMode(); } } else return anythingElse(t, tb); break; case EOF: if (!tb.currentElement().nodeName().equals("html")) tb.error(this); break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); return false; } }, InSelectInTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); tb.process(new Token.EndTag("select")); return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); if (tb.inTableScope(t.asEndTag().name())) { tb.process(new Token.EndTag("select")); return (tb.process(t)); } else return false; } else { return tb.process(t, InSelect); } } }, AfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return tb.process(t, InBody); } else if (t.isComment()) { tb.insert(t.asComment()); // into html node } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { if (tb.isFragmentParsing()) { tb.error(this); return false; } else { tb.transition(AfterAfterBody); } } else if (t.isEOF()) { // chillax! we're done } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, InFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return tb.process(start, InBody); } else if (name.equals("frameset")) { tb.insert(start); } else if (name.equals("frame")) { tb.insertEmpty(start); } else if (name.equals("noframes")) { return tb.process(start, InHead); } else { tb.error(this); return false; } } else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) { if (tb.currentElement().nodeName().equals("html")) { // frag tb.error(this); return false; } else { tb.pop(); if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) { tb.transition(AfterFrameset); } } } else if (t.isEOF()) { if (!tb.currentElement().nodeName().equals("html")) { tb.error(this); return true; } } else { tb.error(this); return false; } return true; } }, AfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { tb.transition(AfterAfterFrameset); } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else if (t.isEOF()) { // cool your heels, we're complete } else { tb.error(this); return false; } return true; } }, AfterAfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, AfterAfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else { tb.error(this); return false; } return true; } }, ForeignContent { boolean process(Token t, HtmlTreeBuilder tb) { return true; // todo: implement. Also; how do we get here? } }; private static String nullString = String.valueOf('\u0000'); abstract boolean process(Token t, HtmlTreeBuilder tb); private static boolean isWhitespace(Token t) { if (t.isCharacter()) { String data = t.asCharacter().getData(); // todo: this checks more than spec - "\t", "\n", "\f", "\r", " " for (int i = 0; i < "link".length(); i++) { char c = data.charAt(i); if (!StringUtil.isWhitespace(c)) return false; } return true; } return false; } private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } }
[ "justinwm@163.com" ]
justinwm@163.com
dee5d934cbdf2d239bf8d8dbd7115f6657d7cdfb
973f30433b6d091e0131ecd76670bb5dec543475
/src/main/java/com/soft/paradigm/web/rest/package-info.java
8d22b0de6563330ed2db736bcd8a28fc838ecafd
[]
no_license
charfeddine12/TVF
7ecd78bb11646571da4a3babb29536407b977f44
489c5e427c83b833cc714c4485b78b0efbc6393b
refs/heads/master
2021-04-03T07:51:58.482400
2018-03-09T08:56:44
2018-03-09T08:56:44
124,515,323
0
0
null
null
null
null
UTF-8
Java
false
false
76
java
/** * Spring MVC REST controllers. */ package com.soft.paradigm.web.rest;
[ "charfeddinebenmohamed24@gmail.com" ]
charfeddinebenmohamed24@gmail.com
b86235370cfc612f84987c52da4fbf9c0bbd99b6
18ae64ca232b469682d09a7eceb844a941d152b2
/src/main/java/com/swust/demo/rbac/service/impl/UserInfoServiceImpl.java
da423bad889cb6e2431804b0abcf463b709c75b6
[]
no_license
daily11/shiro
07a2d718bd826d36311d12d134eac63489ea32ae
5f5fc71f795e157339d0e3c08083345d459edc71
refs/heads/master
2022-12-24T21:09:34.508743
2019-09-22T05:42:05
2019-09-22T05:42:05
210,094,154
0
0
null
2022-12-10T05:42:49
2019-09-22T05:13:12
TSQL
UTF-8
Java
false
false
2,578
java
package com.swust.demo.rbac.service.impl; import afu.org.checkerframework.checker.oigj.qual.O; import com.swust.demo.rbac.bean.AclInfo; import com.swust.demo.rbac.bean.UserInfo; import com.swust.demo.rbac.biz.UserInfoBiz; import com.swust.demo.rbac.service.UserInfoService; import java.util.List; public class UserInfoServiceImpl implements UserInfoService { UserInfoBiz userInfoBiz = new UserInfoBiz(); @Override public UserInfo login(String username, String password) { UserInfo userInfo = userInfoBiz.selectUserInfoByName(username); if (null != userInfo) { if (password.equals(userInfo.getPassword())) { return userInfo; } else { return null; } } return null; } /** * 保存“用户”记录 * * @param userInfo 用户对象 */ @Override public void save(UserInfo userInfo) { userInfoBiz.save(userInfo); } /** * 查询用户记录 * * @return */ @Override public List<UserInfo> select() { return userInfoBiz.select(); } /** * 查询用户记录 * * @param id 记录id * @return */ @Override public UserInfo selectById(Long id) { return userInfoBiz.selectById(id); } /** * 更新用户记录 * * @param obj 权限对象 */ @Override public void update(Object obj) { userInfoBiz.update(obj); } /** * 删除用户记录 * * @param id 权限对象ID */ @Override public void delete(Long id) { userInfoBiz.delete(id); } /** * 查询当前用户的权限 * * @param userId 用户id * @return List<AclInfo> */ public List<AclInfo> selectUserAcls(Long userId) { return userInfoBiz.selectUserAcls(userId); } /** * 查询系统预定义给用户对应角色的权限 * * @param userId 用户di * @param name 用户名称【同时也是角色名称】 * @return */ public List<AclInfo> selectUserAclsBySystem(int userId, String name) { return userInfoBiz.selectUserAclsBySystem(userId, name); } /** * 查询用户自己的,非系统预定义的权限 * * @param userId 用户di * @param name 用户名称【同时也是角色名称】 * @return */ public List<AclInfo> selectUserAclsBySingle(int userId, String name) { return userInfoBiz.selectUserAclsBySingle(userId, name); } }
[ "1663268062@qq.com" ]
1663268062@qq.com
30f43198f69a385da562b5119b51852a6dcd5de0
ed2fc560f1c9ca2094b471457c97103c56c3ac65
/Asgn14b/Graphics/src/asgn14b/TestJPanelExt.java
9cda78fcc9daae7f66956df2daa81a66790c9950
[]
no_license
JPL4494/DVC-COMSC255
e234fc00e173b1dfd5feabc16b448f066b74d8b4
c225c5061d56a18265ffb5d9b640e74c8c036587
refs/heads/master
2020-03-19T00:33:11.172548
2018-05-30T19:59:43
2018-05-30T19:59:43
135,489,101
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
/* Programmer: Josh Long Assignment: 14B Graphics - Draw Date: 12/5/15 */ package asgn14b; public class TestJPanelExt { public static void main(String[] args) { JPanelExt j = new JPanelExt(); } }
[ "noreply@github.com" ]
noreply@github.com
c7f568a53533d1094dbd4c3f8fbeb0dc42b8d3bc
c49aed5b87459bbb8c305b891aae308db66e0934
/TaxiDriver/app/src/main/java/com/taxidrivr/ActivityLauncher.java
690a889ec6a56e21d2bb525e4e592f04a35feacd
[]
no_license
ramanasha/teliver-taxi-booking-android
a479dafd9b5a8cbc4432d0230ad6c65499daba4b
37c4a480ae9899965cd37b5d182220d22c47e579
refs/heads/master
2020-03-27T10:02:47.594446
2018-08-06T10:52:17
2018-08-06T10:52:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,723
java
package com.taxidrivr; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.ResultCallback; import com.google.android.gms.common.api.Status; import com.google.android.gms.location.LocationRequest; import com.google.android.gms.location.LocationServices; import com.google.android.gms.location.LocationSettingsRequest; import com.google.android.gms.location.LocationSettingsResult; import com.google.android.gms.location.LocationSettingsStatusCodes; import com.teliver.sdk.core.TLog; import com.teliver.sdk.core.Teliver; import com.teliver.sdk.core.TripListener; import com.teliver.sdk.models.PushData; import com.teliver.sdk.models.Trip; import com.teliver.sdk.models.TripBuilder; import com.teliver.sdk.models.UserBuilder; import java.util.Calendar; @SuppressWarnings("ALL") public class ActivityLauncher extends AppCompatActivity { private boolean inCurrentTrip; private String driverName = "driver_xolo"; private GoogleApiClient googleApiClient; private enum type { trip, push } private Application application; private SwitchCompat availabilitySwitch; private String trackingId; private TextView txtSendPush; private EditText edtPushMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_launcher); Teliver.identifyUser(new UserBuilder(driverName).setUserType(UserBuilder.USER_TYPE.OPERATOR).registerPush().build()); TLog.setVisible(true); Calendar calendar = Calendar.getInstance(); int month = (calendar.get(Calendar.MONTH) + 1); int date = calendar.get(Calendar.DATE); trackingId = driverName + date + "/" + month; } @Override protected void onPostCreate(@Nullable Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolBar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); Drawable drawable = toolBar.getNavigationIcon(); drawable.setColorFilter(ContextCompat.getColor(this, R.color.colorWhite), PorterDuff.Mode.SRC_ATOP); toolBar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); application = (Application) getApplication(); txtSendPush = (TextView) findViewById(R.id.txtSendPush); edtPushMessage = (EditText) findViewById(R.id.edtPushMessage); availabilitySwitch = (SwitchCompat) findViewById(R.id.availabilitySwitch); availabilitySwitch.setChecked(application.getBooleanInPef("switch_state")); availabilitySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { PushData pushData = new PushData("selvakumar"); pushData.setMessage("trip started"); pushData.setPayload("1"); TripBuilder tripBuilder = new TripBuilder(trackingId). withUserPushObject(pushData); Teliver.startTrip(tripBuilder.build()); Teliver.setTripListener(new TripListener() { @Override public void onTripStarted(Trip tripDetails) { application.storeBooleanInPref("switch_state", true); Log.d("TELIVER::", "onTripStarted: " + tripDetails.getTrackingId()); txtSendPush.setTextColor(ContextCompat.getColor(ActivityLauncher.this, R.color.colorBlack)); edtPushMessage.setEnabled(true); edtPushMessage.setHintTextColor(ContextCompat.getColor(ActivityLauncher.this, R.color.colorBackGround)); } @Override public void onLocationUpdate(Location location) { Log.d("TELIVER::", "onLocationUpdate: LATLNG VALUES == " + location.getLatitude() + location.getLongitude()); toYourServer(); } @Override public void onTripEnded(String trackingID) { } @Override public void onTripError(String reason) { } }); } else if (!isChecked) { application.storeBooleanInPref("switch_state", false); PushData pushData = new PushData("selvakumar"); pushData.setMessage("trip_stopped"); pushData.setPayload("0"); Teliver.sendEventPush(trackingId, pushData, "trip stopped"); Teliver.stopTrip(trackingId); Teliver.setTripListener(new TripListener() { @Override public void onTripStarted(Trip tripDetails) { } @Override public void onLocationUpdate(Location location) { } @Override public void onTripEnded(String trackingID) { Log.d(Constants.TAG, "onTripEnded: ON TRIP ENDED == " + trackingID); txtSendPush.setTextColor(ContextCompat.getColor(ActivityLauncher.this, R.color.colorHint)); edtPushMessage.setText(""); edtPushMessage.setHintTextColor(ContextCompat.getColor(ActivityLauncher.this, R.color.colorHint)); edtPushMessage.setEnabled(false); } @Override public void onTripError(String reason) { } }); } } }); if (Application.checkPermission(this)) checkGps(); txtSendPush.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PushData pushData = new PushData("selvakumar"); pushData.setMessage(edtPushMessage.getText().toString().trim() + ", " + trackingId); Teliver.sendEventPush(trackingId, pushData, "taxi"); edtPushMessage.setText(""); } }); } private void toYourServer() { //In the setTripListener callback onLocationUpdate will give you the location values of driver // in a certain interval handle it on your wish.. // you can get the customer location and show the nearby taxi to your } private void checkGps() { GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this) .addApi(LocationServices.API) .build(); googleApiClient.connect(); LocationRequest locationRequest = LocationRequest.create(); locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder() .addLocationRequest(locationRequest); builder.setAlwaysShow(true); PendingResult<LocationSettingsResult> result = LocationServices.SettingsApi.checkLocationSettings(googleApiClient, builder.build()); result.setResultCallback(new ResultCallback<LocationSettingsResult>() { @Override public void onResult(@NonNull LocationSettingsResult locationSettingsResult) { Status status = locationSettingsResult.getStatus(); if (status.getStatusCode() == LocationSettingsStatusCodes.RESOLUTION_REQUIRED) { try { status.startResolutionForResult(ActivityLauncher.this, 3); } catch (Exception e) { e.printStackTrace(); } } } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == 3 && resultCode == RESULT_OK) Toast.makeText(ActivityLauncher.this, "Gps is turned on", Toast.LENGTH_SHORT).show(); else if (requestCode == 3 && resultCode == RESULT_CANCELED) finish(); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case 4: if (grantResults[0] != PackageManager.PERMISSION_GRANTED && requestCode == 4) finish(); else checkGps(); break; } } @Override protected void onResume() { if (application.getBooleanInPef("switch_state")) { edtPushMessage.setHintTextColor(ContextCompat.getColor(this, R.color.colorBackGround)); edtPushMessage.setEnabled(true); txtSendPush.setTextColor(ContextCompat.getColor(this, R.color.colorBlack)); } super.onResume(); } private void fromYourServer() { // Based on the location values show the cabs near to the customer, you can do that by handpicking those trackingId's // near to the customer and starting the tracking by multiple trackingId's, so that the user can view and track his nearby cabs...... } }
[ "selvakumar.p@quadkast.co.in" ]
selvakumar.p@quadkast.co.in
5e9815b06a90dbe0405041d7f2131df79e5fddba
fbf799b4bc456324a4680a19e71ef3a2ce07549f
/jdlms/asn1/axdr-compiler/src/main/java/org/bn/compiler/parser/model/AsnObjectIdentifier.java
360bfe7767f0b89201f875d2742b43638c84e285
[]
no_license
rodroy/Jdlms2
ad84f268495e1c5be70983a126d58c0d7be7d3f6
b255148480e5e62baec5de376463ba8814646650
refs/heads/master
2021-01-10T04:23:32.866347
2016-01-12T12:56:58
2016-01-12T12:56:58
49,499,659
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package org.bn.compiler.parser.model; public class AsnObjectIdentifier { public final String BUILTINTYPE = "OBJECT IDENTIFIER"; public String name; // ~--- constructors ------------------------------------------------------- // Default Constructor public AsnObjectIdentifier() { name = ""; } // ~--- methods ------------------------------------------------------------ // toString() definition @Override public String toString() { String ts = ""; ts += name + "\t::=\t" + BUILTINTYPE; return ts; } }
[ "rodrigo.lacerda.taschetto@gmail.com" ]
rodrigo.lacerda.taschetto@gmail.com
e1a22d5c4e41605ced64fa0fc2372c973832b065
d0b5c69ad2e32242364f0b163fe49caf66348547
/SevenAndAHalf/src/objects/Partida.java
723c2f438f8ac4fe62e47632889a1d8aa419e051
[]
no_license
cristoprogramador/PSP
97d3e98b3d36a41a2c128863727a2d4ab10cf55f
e74b49fb5b199fb3bd331d4f9f95a8d7c4442b8f
refs/heads/master
2020-07-25T02:49:20.288104
2019-09-12T20:31:10
2019-09-12T20:31:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,142
java
package objects; import java.io.Serializable; @SuppressWarnings("serial") public class Partida implements Serializable{ private String name; private double bet; private String information; private boolean preguntaPedirCarta; private boolean pedirOtraCarta; public Partida() { } public Partida(String name, double bet) { this.name = name; this.bet = bet; this.pedirOtraCarta = true; this.preguntaPedirCarta = true; } public String getName() { return name; } public double getBet() { return bet; } public void setBet(double bet) { this.bet = bet; } public String getInformation() { return information; } public void setInformation(String information) { this.information = information; } public boolean isPreguntaPedirCarta() { return preguntaPedirCarta; } public void setPreguntaPedirCarta(boolean preguntaPedirCarta) { this.preguntaPedirCarta = preguntaPedirCarta; } public boolean ispedirOtraCarta() { return pedirOtraCarta; } public void setpedirOtraCarta(boolean respuesta) { this.pedirOtraCarta = respuesta; } }
[ "39799281+cristoprogramador@users.noreply.github.com" ]
39799281+cristoprogramador@users.noreply.github.com
d2d73bf4b5b2f67403f4ed301ca6bf246aafa2f0
05b1ae95ba2ffea71b442fa21247cea9811df142
/Demo/src/main/java/com/cbw/security/hanler/MyAuthenctiationFailureHandler.java
abe63a0a0f5002ebcd1134c37b73f01bd90645c6
[ "MIT" ]
permissive
xeroCBW/springBootDemo
a712c1b4c7ea7a1b310d431d228c03ce936c4949
4af26bfe807762f040085596456646509f55e286
refs/heads/master
2020-03-19T20:46:26.444401
2018-06-24T14:39:59
2018-06-24T14:39:59
136,915,981
0
0
null
null
null
null
UTF-8
Java
false
false
1,856
java
/** * */ package com.cbw.security.hanler; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; import org.springframework.stereotype.Component; import com.cbw.security.SimpleResponse; import com.fasterxml.jackson.databind.ObjectMapper; /** * @author zhailiang * */ @Component("myAuthenctiationFailureHandler") public class MyAuthenctiationFailureHandler extends SimpleUrlAuthenticationFailureHandler { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private ObjectMapper objectMapper; /* (non-Javadoc) * @see org.springframework.security.web.authentication.AuthenticationFailureHandler#onAuthenticationFailure(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.security.core.AuthenticationException) */ @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { //要使用失败的exception logger.info("登录失败"); response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); response.setContentType("application/json;charset=UTF-8"); //设置下,不把所有的消息都放出去,留一部分消息 SimpleResponse simpleResponse = new SimpleResponse(exception.getMessage()); response.getWriter().write(objectMapper.writeValueAsString(simpleResponse)); } }
[ "861754186@qq.com" ]
861754186@qq.com
fad560dbfb8d79cd54afbc72f500645034891fce
fa724f01b2c324272f76e9c533654c831c0aa92c
/src/us/jaba/titaniumblocksswingui/BasicVerticalViewer.java
ab8f0c52b05a28a9a4e1af3da0ec3888fbfca0e2
[]
no_license
tonybeckett/TitaniumBlocksSwingUI
dd8bfb93c31a1767289dd91b221947ff429394d7
d988deade2e3010234fc533d4c18795e7cac3e4f
refs/heads/master
2021-01-04T02:41:49.821236
2016-12-10T14:16:55
2016-12-10T14:16:55
76,115,657
0
0
null
null
null
null
UTF-8
Java
false
false
4,535
java
/* * Copyright (c) 2015, Tony Beckett * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * The names of its contributors may not be used to endorse or promote * products derived from this software without specific prior written * permission. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ package us.jaba.titaniumblocksswingui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.image.BufferedImage; import java.util.Iterator; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import javax.swing.border.LineBorder; import us.jaba.titaniumblocks.core.CoreInfoSupport; import us.jaba.titaniumblocks.core.color.ColorPalette; /** * * @author tbeckett */ public class BasicVerticalViewer extends javax.swing.JFrame { protected Color backgroundColor = ColorPalette.BLACK; protected Color foregroundColor = ColorPalette.WHITE; protected JScrollPane jScrollPane1 = new JScrollPane(); protected JPanel list = new JPanel(); protected GridLayout gl = new GridLayout(); protected Dimension imageDim; public BasicVerticalViewer() { imageDim = new Dimension(200, 200); } protected BufferedImage getImageFromInstance(Object next, Dimension iDim) { return null; } protected String getClassNameFromInstance(Object o) { return ""; } protected JPanel buildPanel(Object o) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel jlabel = new JLabel(); try { jlabel.setText(getClassNameFromInstance(o)); jlabel.setVerticalTextPosition(JLabel.BOTTOM); jlabel.setHorizontalTextPosition(JLabel.CENTER); jlabel.setIcon(new ImageIcon(getImageFromInstance(o, imageDim))); jlabel.setForeground(foregroundColor); jlabel.setBackground(ColorPalette.GRAY.brighter()); panel.setBackground(backgroundColor); panel.add(jlabel, BorderLayout.CENTER); panel.setBorder(new LineBorder(Color.BLACK)); } catch (Exception exp) { } return panel; } protected void init(String title, Dimension dim, List instances) { imageDim = dim; setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle(CoreInfoSupport.TITANIUM_BLOCKS + " - " + title); list.setLayout(gl); this.setLayout(new BorderLayout()); jScrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); int len = instances.size(); gl.setRows(len); Iterator i = instances.iterator(); while (i.hasNext()) { Object o = i.next(); list.add(buildPanel(o)); } jScrollPane1.setViewportView(list); add(jScrollPane1, BorderLayout.CENTER); this.setSize( new Dimension(400, 800)); // this.setIconImage(Images.titaniumblocks16); } }
[ "tonybeckett@yahoo.com" ]
tonybeckett@yahoo.com
6c92321a47bc2ea03b7ae526b283aba26664c60e
9793e52935fc9452777e3de336ff5375149b0439
/app/src/main/java/com/net/dominic/hdwallpaper/HomeActivity.java
2b17ae4ab0224ff4b726faf037e3d499aadca146
[]
no_license
huuhuybn/HDWallpaper
3e08baa86b8ec6a6c64e2556ff7d55bd6906aef0
83be6aaf10f439978e6d174c9ba618d30ad8c7c0
refs/heads/master
2021-01-20T10:23:40.140890
2017-08-28T10:43:21
2017-08-28T10:43:21
101,632,956
0
0
null
null
null
null
UTF-8
Java
false
false
3,507
java
package com.net.dominic.hdwallpaper; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); 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(); } }); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); } @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.home, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { // Handle the camera action } else if (id == R.id.nav_gallery) { } else if (id == R.id.nav_slideshow) { } else if (id == R.id.nav_manage) { } else if (id == R.id.nav_share) { } else if (id == R.id.nav_send) { } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
[ "huuhuybn@gmail.com" ]
huuhuybn@gmail.com
a5530ca587b34fd50ee47c7a71c787c549595c47
70a84192c0944f48a5ecd56a10c962d7c22eecd2
/src/main/java/com/myorg/service/UserService.java
4ac0ff0d0bbd9910e41207fd6a13c2faf032f034
[]
no_license
Akshay-Deshpande/ygjwttest
bdfed3e4f17e98ea1e2ba37f3f727e19f0c0e048
d4c3b8379cabc881c9c6d0ddce8f230c79c0936f
refs/heads/master
2020-04-01T07:16:30.654216
2018-09-11T10:40:39
2018-09-11T10:40:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.myorg.service; import java.util.List; import com.myorg.model.User; public interface UserService { User save(User user); List<User> findAll(); void delete(long id); User findOne(String username); User findById(Long id); }
[ "rakesh@yaragos.com" ]
rakesh@yaragos.com
3295aad016021ee0bc7b49d9b501e2c5fc018377
d31aa6abaf5f939fa26d3a4c53ca1b46be4ab899
/src/com/code/leetcode/dp/Rob2_213.java
b5b3513a43e4b2a9aac9f8197a04c9ede4ca83f7
[]
no_license
haojunsheng/AlgorithmNotes
905d9d5df4a710be23626f34c729ecb7c7a3c190
6f44bb6dec4090e41e54b3b1c88906e8d261091b
refs/heads/master
2023-03-11T22:59:46.283715
2023-02-18T09:01:29
2023-02-18T09:01:29
208,792,357
2
0
null
null
null
null
UTF-8
Java
false
false
1,702
java
package com.code.leetcode.dp; /** * 打家劫舍2 * 所有的房屋都围成一圈,这意味着第一个房屋和最后一个房屋是紧挨着的。同时,相邻的房屋装有相互连通的防盗系统,如果两间相邻的房屋在同一晚上被小偷闯入,系统会自动报警。 * <p> * 输入: [2,3,2],输出: 3 * 解释: 你不能先偷窃 1 号房屋(金额 = 2),然后偷窃 3 号房屋(金额 = 2), 因为他们是相邻的。 * <p> * 输入: [1,2,3,1],输出: 4 * 解释: 你可以先偷窃 1 号房屋(金额 = 1),然后偷窃 3 号房屋(金额 = 3)。偷窃到的最高金额 = 1 + 3 = 4 。 * <p> * https://leetcode-cn.com/problems/house-robber-ii/ * * @author 俊语 * @date 2020/9/15 12:01 */ public class Rob2_213 { public static void main(String[] args) { int[] nums = {1, 2, 3, 1}; System.out.println(rob(nums)); } /** * 把环形的拆成2个,一个是不偷第一个房子,一个是不偷最后一个房子,然后取二者的较大值 * * @param nums * @return */ public static int rob(int[] nums) { int length = nums.length; if (length <= 0) { return 0; } if (length == 1) { return nums[0]; } return Math.max(robRange(nums, 0, length - 1), robRange(nums, 1, length)); } public static int robRange(int[] nums, int start, int end) { int dp_i_1 = 0, dp_i_2 = 0; int dp_i = 0; for (int i = start; i < end; ++i) { dp_i = Math.max(dp_i_1, dp_i_2 + nums[i]); dp_i_2 = dp_i_1; dp_i_1 = dp_i; } return dp_i; } }
[ "1324722673@qq.com" ]
1324722673@qq.com
8cdcaf829a7afe2b77ea1def0cceec2261eefbc3
1ec2a301394ee2034977db3a1411dd030b2779aa
/src/main/java/edu/yale/sml/view/EditHistoryShelvingView.java
edfb88cfa83e45ef368ea68368a47e366539dfdd
[]
no_license
yalelibrary/accservices
77c0549fb7366292a0639303f007fb5c35b56462
3ccf499e411a7b12f479ddc70eeaf3f8c7cabf4d
refs/heads/master
2022-09-05T14:18:58.877874
2020-09-15T14:59:54
2020-09-15T14:59:54
17,157,339
2
3
null
2022-07-13T18:27:51
2014-02-25T01:33:53
Java
UTF-8
Java
false
false
1,582
java
package edu.yale.sml.view; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.context.FacesContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import edu.yale.sml.model.Shelving; import edu.yale.sml.persistence.ShelvingDAO; import edu.yale.sml.persistence.ShelvingHibernateDAO; @ManagedBean @ViewScoped public class EditHistoryShelvingView implements java.io.Serializable { private static final Logger logger = LoggerFactory.getLogger(EditHistoryShelvingView.class); private static final long serialVersionUID = 6223995917417414208L; private Shelving historyCatalog; // history object private ShelvingDAO historyDAO = new ShelvingHibernateDAO();; private Integer ID = 0; @PostConstruct public void initialize() { ID = Integer.parseInt(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("id")); historyCatalog = new Shelving(); try { historyCatalog = historyDAO.findById(ID).get(0); } catch (Exception e) { logger.error(e.getMessage()); } } public Integer getID() { return ID; } public Shelving getHistoryCatalog() { return historyCatalog; } public void setHistoryCatalog(Shelving historyCatalog) { this.historyCatalog = historyCatalog; } public void setID(Integer id) { ID = id; } public String save() { historyDAO.update(historyCatalog); return "ok"; } }
[ "osmandin@gmail.com" ]
osmandin@gmail.com
8ca80f407697119b9fd31a1b73491ed6471fcdeb
643d45a49f15946fbc9b901d225d298f0a7496e2
/HelloAndroid/app/src/main/java/com/example/ktr/helloandroid/MainActivity.java
0a0ca56f1394d3db7e751cca35162341cc62b491
[]
no_license
kotori0506/HelloAndroid
7e87a82d5a96a1904a2d5fdb4f9d2fa5b77e03cd
c22ceafc4458816ec1fb37a521f774b07ce0c774
refs/heads/master
2016-09-06T06:24:04.709176
2015-08-17T21:42:23
2015-08-17T21:42:23
40,907,022
0
0
null
null
null
null
UTF-8
Java
false
false
2,820
java
package com.example.ktr.helloandroid; import android.app.Activity; import android.graphics.Color; import android.graphics.PorterDuff; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.test.ActivityUnitTestCase; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.SeekBar; public class MainActivity extends Activity implements SeekBar.OnSeekBarChangeListener { private Button buttonPushMe; private ImageView imageAndroid; private SeekBar seekBarRed; private SeekBar seekBargreen; private SeekBar seekBarblue; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonPushMe = (Button) findViewById(R.id.btn_pushme); buttonPushMe.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { buttonPushMe.setText("Pushed!!"); imageAndroid.setImageResource(R.drawable.androidtst2); } }); imageAndroid=(ImageView) findViewById(R.id.iv_android); seekBarRed=(SeekBar) findViewById(R.id.sb_red); seekBarRed.setOnSeekBarChangeListener(this); seekBargreen=(SeekBar) findViewById(R.id.sb_green); seekBargreen.setOnSeekBarChangeListener(this); seekBarblue=(SeekBar) findViewById(R.id.sb_blue); seekBarblue.setOnSeekBarChangeListener(this); } @Override public void onProgressChanged(SeekBar seekBar,int progress,boolean fromUser){ int red=seekBarRed.getProgress(); int green=seekBargreen.getProgress(); int blue=seekBarblue.getProgress(); imageAndroid.setColorFilter(Color.rgb(red, green, blue), PorterDuff.Mode.LIGHTEN); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "kotori0506studio@yahoo.co.jp" ]
kotori0506studio@yahoo.co.jp
eb0fafaa84b1fc539f4985fcdb7245edfc22b53d
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/28/28_c08b26e1d67e613d0502b96d00c8c34ca17f4ca7/GDTabActivity/28_c08b26e1d67e613d0502b96d00c8c34ca17f4ca7_GDTabActivity_s.java
fecf649ef18d55fe3bf51e06761025e98580c70f
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
7,972
java
/* * Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package greendroid.app; import greendroid.util.Config; import greendroid.widget.ActionBar; import greendroid.widget.ActionBar.OnActionBarListener; import greendroid.widget.ActionBarHost; import greendroid.widget.ActionBarItem; import android.app.TabActivity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.TabHost; import android.widget.TextView; import com.cyrilmottier.android.greendroid.R; /** * An equivalent to a TabActivity that manages fancy tabs and an * {@link ActionBar} * * @author Cyril Mottier */ public class GDTabActivity extends TabActivity implements ActionBarActivity { private static final String LOG_TAG = GDTabActivity.class.getSimpleName(); private ActionBarHost mActionBarHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(createLayout()); } public int createLayout() { return R.layout.gd_tab_content; } public GDApplication getGDApplication() { return (GDApplication) getApplication(); } @Override public void onContentChanged() { super.onContentChanged(); onPreContentChanged(); onPostContentChanged(); } public void onPreContentChanged() { mActionBarHost = (ActionBarHost) findViewById(R.id.gd_action_bar_host); if (mActionBarHost == null) { throw new RuntimeException("Your content must have an ActionBarHost whose id attribute is R.id.gd_action_bar_host"); } mActionBarHost.getActionBar().setOnActionBarListener(mActionBarListener); } public void onPostContentChanged() { boolean titleSet = false; final Intent intent = getIntent(); if (intent != null) { String title = intent.getStringExtra(ActionBarActivity.GD_ACTION_BAR_TITLE); if (title != null) { titleSet = true; setTitle(title); } } if (!titleSet) { // No title has been set via the Intent. Let's look in the // ActivityInfo try { final ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), 0); if (activityInfo.labelRes != 0) { setTitle(activityInfo.labelRes); } } catch (NameNotFoundException e) { // Do nothing } } final int visibility = intent.getIntExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.VISIBLE); getGDActionBar().setVisibility(visibility); } // @Override // protected void onTitleChanged(CharSequence title, int color) { // setTitle(title); // } @Override public void setTitle(CharSequence title) { getActionBar().setTitle(title); } @Override public void setTitle(int titleId) { setTitle(getString(titleId)); } public ActionBar getGDActionBar() { return mActionBarHost.getActionBar(); } public ActionBarItem addActionBarItem(ActionBarItem item) { return getGDActionBar().addItem(item); } public ActionBarItem addActionBarItem(ActionBarItem item, int itemId) { return getGDActionBar().addItem(item, itemId); } public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType) { return getGDActionBar().addItem(actionBarItemType); } public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType, int itemId) { return getGDActionBar().addItem(actionBarItemType, itemId); } public FrameLayout getContentView() { return mActionBarHost.getContentView(); } public boolean onHandleActionBarItemClick(ActionBarItem item, int position) { return false; } private OnActionBarListener mActionBarListener = new OnActionBarListener() { public void onActionBarItemClicked(int position) { if (position == OnActionBarListener.HOME_ITEM) { final Class<?> klass = getGDApplication().getHomeActivityClass(); if (klass != null && !klass.equals(GDTabActivity.this.getClass())) { if (Config.GD_INFO_LOGS_ENABLED) { Log.i(LOG_TAG, "Going back to the home activity"); } Intent homeIntent = new Intent(GDTabActivity.this, klass); homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(homeIntent); } } else { if (!onHandleActionBarItemClick(getGDActionBar().getItem(position), position)) { if (Config.GD_WARNING_LOGS_ENABLED) { Log.w(LOG_TAG, "Click on item at position " + position + " dropped down to the floor"); } } } } }; /* * GDTabActivity methods */ /** * Add a new tab to this GDTabActivity * * @param tag The tag associated this the new tab * @param labelId A resource ID to the label of the new tab * @param intent The Intent used to start the content of the tab */ public void addTab(String tag, int labelId, Intent intent) { addTab(tag, getString(labelId), intent); } /** * Add a new tab to this GDTabActivity * * @param tag The tag associated this the new tab * @param label The label of the new tab * @param intent The Intent used to start the content of the tab */ public void addTab(String tag, CharSequence label, Intent intent) { final TabHost host = getTabHost(); View indicator = createTabIndicator(tag, label, getTabWidget()); if (indicator == null) { final TextView textIndicator = (TextView) getLayoutInflater().inflate(R.layout.gd_tab_indicator, getTabWidget(), false); textIndicator.setText(label); indicator = textIndicator; } host.addTab(host.newTabSpec(tag).setIndicator(indicator).setContent(intent)); } @Deprecated protected View createTabIndicator(CharSequence label) { return createTabIndicator(null, label, getTabWidget()); } /** * Callback allowing client to create their own tabs. * * @param tag The tag of the tab to create * @param label The label that need to be displayed in the tab * @param parent The parent in which the tab will be added.Please note you * shouldn't add the newly created/inflated View to the parent. * GDTabActivity will deal with this automatically. * @return A newly allocated View representing the tab. */ protected View createTabIndicator(String tag, CharSequence label, ViewGroup parent) { return null; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0a94753037dc2de9caae00b8e668a4e984a2721e
719344f95a6dd78655f942ee9c1ea82f8eed829c
/src/assignment5/Deck.java
f1b4d0637f1ba821a4a725b553c9341bae35ea5e
[]
no_license
amijohar/BigTwo
96cea4fc6cbfca6b825180d32ba5c1a0276631e7
8fa67cdea7f0e52c0e7d2d257c25714c5c0e8953
refs/heads/master
2021-07-10T09:33:52.446715
2017-10-09T06:58:05
2017-10-09T06:58:05
106,247,245
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
package assignment5; /** * This class is used to represent a deck of cards in general card games. * * @author Kenneth Wong */ public class Deck extends CardList { private static final long serialVersionUID = -3886066435694112173L; /** * Creates and returns an instance of the Deck class. */ public Deck() { initialize(); } /** * Initialize the deck of cards. */ public void initialize() { removeAllCards(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 13; j++) { Card card = new Card(i, j); addCard(card); } } } /** * Shuffles the deck of cards. */ public void shuffle() { for (int i = 0; i < this.size(); i++) { int j = (int) (Math.random() * this.size()); if (i != j) { Card card = setCard(i, getCard(j)); setCard(j, card); } } } }
[ "amanjohar@Amans-MacBook-Pro.local" ]
amanjohar@Amans-MacBook-Pro.local
91b849f160cff8e995e2d57227cb90b5d642bbef
4c5741ee39b3a9a58bc65860283c42f3b77bdeee
/WSCuentasMedicas/modulos/generales/src/main/java/com/gci/siarp/generales/domain/MaestroNominas.java
a78930102a0683bbf167361a5a2a8b94ab45bac1
[]
no_license
leogci/wscm
2a4b42bee0ae6df56b233e004f81df181e58f1e3
78eb6da71cc27340f9e21e896f99c98f31742304
refs/heads/master
2020-03-20T14:13:15.903705
2018-06-15T11:42:05
2018-06-15T11:42:05
137,478,020
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package com.gci.siarp.generales.domain; import java.util.Date; import lombok.Data; @Data public class MaestroNominas { private Long id_solicitud_it; private Integer id_secuencial_it; private Long id_cuenta; private Integer id_factura; private Long id_solicitud_pe; private Integer consec; private String estado_sap; private String id_tipo_doc; private String id_persona; private Integer nro_nomina; private Date fecha_cierre_nomina; private Double id_siarp; }
[ "lbetancourt@gcicolombia.com" ]
lbetancourt@gcicolombia.com
cf5d256cf4d17e2c6f129b1fe0253b3602f616ce
076ccaad9cd6439be2a321b0f879b55ef2d02348
/Chapter1Part1ToTranMinhNhut/src/Operator/Operator.java
e36db2ac9fcbbba054cf6e88cf6c90f8b0475d32
[]
no_license
ToTranMinhNhut/Advanced-Java-Source
a17b916a9b1c20ad153ba2841d98cc7dff108ead
fb8fabb5936ed6ee50ec0d2d37fc2864b45faa38
refs/heads/master
2020-12-25T15:08:35.810742
2016-09-28T04:26:09
2016-09-28T04:26:09
65,992,406
0
0
null
null
null
null
UTF-8
Java
false
false
2,347
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 chapter1part1totranminhnhut.Operator; /** * * @author hv * @date: 19/8/2016 * @version: 1.0 */ public class Operator { private double firstNumber; private double secondNumber; public Operator() { } public Operator(double firstNumber, double secondNumber) { this.firstNumber = firstNumber; this.secondNumber = secondNumber; } public double getFirstNumber() { return firstNumber; } public void setFirstNumber(double firstNumber) { this.firstNumber = firstNumber; } public double getSecondNumber() { return secondNumber; } public void setSecondNumber(double secondNumber) { this.secondNumber = secondNumber; } /* 1. The plus() function make calculator plus for two number. 2. author hv 3. date: 19/8/2016 4. @version: 1.0 5. Input: not 6. Output is a 'sum' valuable have double type. */ public double plus() { double sum = firstNumber + secondNumber; return sum; } /* 1. The minus() function make calculator subtract for two number. 2. author hv 3. date: 19/8/2016 4. @version: 1.0 5. Input: not 6. Output is a 'sub' valuable have double type. */ public double minus() { double sub = firstNumber - secondNumber; return sub; } /* 1. The product() function make calculator product for two numbers. 2. author hv 3. date: 19/8/2016 4. @version: 1.0 5. Input: not 6. Output is a 'pro' valuable have double type. */ public double product() { double pro = firstNumber * secondNumber; return pro; } /* 1. The devide() function make calculator devide for two numbers. 2. author hv 3. date: 19/8/2016 4. @version: 1.0 5. Input: not 6. Output is a 'dev' valuable have double type. */ public double devide() { if (secondNumber == 0) { throw new ArithmeticException("Second number must has value differ 0"); } double dev = firstNumber / secondNumber; return dev; } }
[ "ttmnhut93@gmail.com" ]
ttmnhut93@gmail.com
02fc2c9690e6d470694ffdb474e07234247e7654
b04d128fed0f7a00d74c90ab3984b99e8fa7593f
/源代码/work-system/work-system/work-api-admin/src/main/java/team/work/doc/TeachScheduleUpdate.java
4bbcb039c4936a0c6f9fbea0491ef1fedb5b97d8
[]
no_license
2368990203/WorkManagementSystem
a11d126a9aaf273d2f574e320d150434d4b98462
8ae92e884eada4be22a8e80d808aead096220163
refs/heads/master
2020-06-08T08:22:38.250204
2019-07-05T02:16:52
2019-07-05T02:16:52
193,195,527
2
1
null
null
null
null
UTF-8
Java
false
false
1,345
java
package team.work.doc; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties({ "handler","hibernateLazyInitializer" }) @ApiModel(value ="教师授课修改") public class TeachScheduleUpdate { @ApiModelProperty(value = "") private String id; @ApiModelProperty(value = "课程号") private String courseNumber; @ApiModelProperty(value = "授课班级id") private String classId; @ApiModelProperty(value = "教师工号") private String teacherNumber; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCourseNumber() { return courseNumber; } public void setCourseNumber(String courseNumber) { this.courseNumber = courseNumber; } public String getClassId() { return classId; } public void setClassId(String classId) { this.classId = classId; } public String getTeacherNumber() { return teacherNumber; } public void setTeacherNumber(String teacherNumber) { this.teacherNumber = teacherNumber; } }
[ "2368990203@qq.com" ]
2368990203@qq.com
cdf5707f8053198ab46c46e0eef96215c3156156
b8ca9f640303d3a4929046e3759fc78272ec6ac0
/src/com/jagex/Class412.java
ef754fd7e55bb8b71a4e4a27f8ef2ef030eb7bfc
[]
no_license
Rune-Status/sotr7-RS876
2e855aa26bc4641e60816315bb4ac5f656e7857f
46fc21ecf2ca4572abb78d59b8dd4819371308e5
refs/heads/master
2020-12-03T19:58:16.523170
2017-04-03T21:38:23
2017-04-03T21:38:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,965
java
package com.jagex; import com.jagex.Class166; import com.jagex.Class174_Sub3_Sub1; import com.jagex.Interface42; import jagdx.Class367; import jagdx.IDirect3DDevice; import jagdx.IDirect3DIndexBuffer; import jagdx.IUnknown; public class Class412 implements Interface42 { int anInt4437; long aLong4435 = 0L; int anInt4434; Class174_Sub3_Sub1 aClass174_Sub3_Sub1_4433; Class166 aClass166_4436; boolean aBool4432; public void finalize() { this.method4907(); } public int method95() { return this.anInt4437; } public Class166 method339() { return this.aClass166_4436; } public void method340(int var1) { this.anInt4437 = this.aClass166_4436.anInt1891 * 1990758583 * var1; if(this.anInt4437 > this.anInt4434) { if(this.aLong4435 != 0L) { IUnknown.Release(this.aLong4435); } int var2 = 8; byte var3; if(this.aBool4432) { var3 = 0; var2 |= 512; } else { var3 = 1; } this.aLong4435 = IDirect3DDevice.CreateIndexBuffer(this.aClass174_Sub3_Sub1_4433.aLong11450, this.anInt4437, var2, this.aClass166_4436 == Class166.aClass166_1888?101:102, var3); this.anInt4434 = this.anInt4437; } } public long method236(int var1, int var2) { return IDirect3DIndexBuffer.Lock(this.aLong4435, var1, var2, this.aBool4432?8192:0); } public void method234() { IDirect3DIndexBuffer.Unlock(this.aLong4435); } public boolean method235(int var1, int var2, long var3) { return Class367.method4652(IDirect3DIndexBuffer.Upload(this.aLong4435, var1, var2, this.aBool4432?8192:0, var3)); } void method4906() { if(this.aLong4435 != 0L) { this.aClass174_Sub3_Sub1_4433.method10508(this.aLong4435); this.aLong4435 = 0L; } this.anInt4434 = 0; this.anInt4437 = 0; } void method4907() { if(this.aLong4435 != 0L) { this.aClass174_Sub3_Sub1_4433.method10508(this.aLong4435); this.aLong4435 = 0L; } this.anInt4434 = 0; this.anInt4437 = 0; } public long method239(int var1, int var2) { return IDirect3DIndexBuffer.Lock(this.aLong4435, var1, var2, this.aBool4432?8192:0); } public void method141() { if(this.aLong4435 != 0L) { IUnknown.Release(this.aLong4435); this.aLong4435 = 0L; } this.anInt4434 = 0; this.anInt4437 = 0; this.aClass174_Sub3_Sub1_4433.method8716(this); } void method4908() { this.method4907(); } public void method342(int var1) { this.anInt4437 = this.aClass166_4436.anInt1891 * 1990758583 * var1; if(this.anInt4437 > this.anInt4434) { if(this.aLong4435 != 0L) { IUnknown.Release(this.aLong4435); } int var2 = 8; byte var3; if(this.aBool4432) { var3 = 0; var2 |= 512; } else { var3 = 1; } this.aLong4435 = IDirect3DDevice.CreateIndexBuffer(this.aClass174_Sub3_Sub1_4433.aLong11450, this.anInt4437, var2, this.aClass166_4436 == Class166.aClass166_1888?101:102, var3); this.anInt4434 = this.anInt4437; } } public long method238(int var1, int var2) { return IDirect3DIndexBuffer.Lock(this.aLong4435, var1, var2, this.aBool4432?8192:0); } public void method140() { if(this.aLong4435 != 0L) { IUnknown.Release(this.aLong4435); this.aLong4435 = 0L; } this.anInt4434 = 0; this.anInt4437 = 0; this.aClass174_Sub3_Sub1_4433.method8716(this); } public void method240() { IDirect3DIndexBuffer.Unlock(this.aLong4435); } void method4909() { this.method4907(); } public boolean method241(int var1, int var2, long var3) { return Class367.method4652(IDirect3DIndexBuffer.Upload(this.aLong4435, var1, var2, this.aBool4432?8192:0, var3)); } public int method242() { return this.anInt4437; } public int method244() { return this.anInt4437; } public int method243() { return this.anInt4437; } public int method237() { return this.anInt4437; } public Class166 method341() { return this.aClass166_4436; } public boolean method245(int var1, int var2, long var3) { return Class367.method4652(IDirect3DIndexBuffer.Upload(this.aLong4435, var1, var2, this.aBool4432?8192:0, var3)); } void method4910() { if(this.aLong4435 != 0L) { this.aClass174_Sub3_Sub1_4433.method10508(this.aLong4435); this.aLong4435 = 0L; } this.anInt4434 = 0; this.anInt4437 = 0; } Class412(Class174_Sub3_Sub1 var1, Class166 var2, boolean var3) { this.aClass174_Sub3_Sub1_4433 = var1; this.aClass166_4436 = var2; this.aBool4432 = var3; this.aClass174_Sub3_Sub1_4433.method8819(this); } }
[ "mablack15@gmail.com" ]
mablack15@gmail.com
a135139e6fc5229659c3e6b9730487f38c0c5ffe
d30d60d2d785ac861e2b614a5ad765d14410a718
/src/main/java/com/lynden/gmapsfx/service/directions/DirectionsRoute.java
f1974b3bf3f2271ce6c6fe3ed7a82d138bc6467c
[ "MIT" ]
permissive
abhaydalmia/clean-water-crowdsourcing
64105a640f7059b9bbcd71b672f4c7b06b275841
ae1f273815e3e64d2717630cbc77992296c5656d
refs/heads/master
2021-01-10T18:33:40.771509
2016-11-24T08:49:20
2016-11-24T08:49:20
74,654,705
0
0
null
null
null
null
UTF-8
Java
false
false
2,897
java
/* * Copyright 2015 Andre. * * 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 main.java.com.lynden.gmapsfx.service.directions; import main.java.com.lynden.gmapsfx.javascript.object.LatLong; import main.java.com.lynden.gmapsfx.javascript.object.LatLongBounds; import main.java.com.lynden.gmapsfx.javascript.JavascriptObject; import main.java.com.lynden.gmapsfx.javascript.object.GMapObjectType; import main.java.com.lynden.gmapsfx.service.geocoding.GeocoderUtils; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import netscape.javascript.JSObject; /** * * @author Andre */ public class DirectionsRoute extends JavascriptObject{ public DirectionsRoute() { super(GMapObjectType.DIRECTIONS_ROUTE); } public DirectionsRoute(JSObject jsObject) { super(GMapObjectType.DIRECTIONS_ROUTE, jsObject); } public List<DirectionsLeg> getLegs(){ final List<DirectionsLeg> result = new ArrayList<>(); List<JSObject> jsLocalities = GeocoderUtils.getJSObjectsFromArray((JSObject) getJSObject().getMember("legs")); for (JSObject jsLocality : jsLocalities) { DirectionsLeg ll = new DirectionsLeg(jsLocality); if (!jsLocality.toString().equals("undefined")) { result.add(ll); } } return result; } public String getWaypointOrder(){ return getJSObject().getMember("waypoint_order").toString(); } public List<LatLong> getOverviewPath(){ final List<LatLong> result = new ArrayList<>(); List<JSObject> jsLocalities = GeocoderUtils.getJSObjectsFromArray((JSObject) getJSObject().getMember("overview_path")); for (JSObject jsLocality : jsLocalities) { LatLong ll = new LatLong(jsLocality); if (!jsLocality.toString().equals("undefined")) { result.add(ll); } } return result; } public LatLongBounds getBounds() { try { JSObject bounds = (JSObject) getJSObject().getMember("bounds"); return new LatLongBounds((JSObject) bounds); } catch (Exception e) { Logger.getLogger(this.getClass().getName()).log(Level.FINE, "", e); } return null; } }
[ "abhaydalmia@ipsec-143-215-26-15.vpn.gatech.edu" ]
abhaydalmia@ipsec-143-215-26-15.vpn.gatech.edu
0a9e10bebb79bf3074526263cf74b262fbb7b139
36744cba4e4bfdf6c122a75176ec30d9fe08699f
/SpringDemo/src/main/java/hello/Greeting.java
65cfbe3b15dd5c185579d88ea38fadcab21929a9
[]
no_license
tompatt/SpringDemo
3b1270984cbe1f69a96af7e263f4a2e4954cbf91
c978ac5018193cdee162ab2672d041b33a59b740
refs/heads/master
2021-01-18T13:42:37.355966
2015-05-18T14:29:37
2015-05-18T14:29:37
35,818,244
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package main.java.hello; public class Greeting { private final long id; private final String content; public Greeting(long id, String content) { this.id = id; this.content = content; } public long getId() { return id; } public String getContent() { return content; } }
[ "tompatt92@gmail.com" ]
tompatt92@gmail.com
e3228c137f515657758d2d38b02158f2fc7d22e9
28da497f44b82b151c157eebccd0210154e27e1c
/demo-voice-search-ttx/src/main/java/com/demo/voice/nlu/analyzer/strategy/NameProcessingStrategy.java
865d12ff5f5dcb55bb34b03c44f23e9acc8038e1
[]
no_license
manhviet17/ttx
18a2f039eb139dd65eb6ca94a8be7f48e7e7baee
fba0087382edc214483376c4d2df88335de50a7a
refs/heads/master
2021-01-01T19:36:49.761039
2017-08-17T10:33:00
2017-08-17T10:33:00
98,625,184
0
0
null
null
null
null
UTF-8
Java
false
false
2,053
java
package com.demo.voice.nlu.analyzer.strategy; import java.util.ArrayList; import java.util.List; import org.apache.commons.collections.CollectionUtils; import com.demo.voice.nlu.analyzer.dataloader.NluDataBean; import com.demo.voice.nlu.analyzer.dto.MentionType; import com.demo.voice.nlu.analyzer.dto.NluIntentDTO; import com.demo.voice.nlu.analyzer.strategy.helper.ProcessingStrategyHelper; import com.demo.voice.nlu.tagger.dto.NLULiteral; import com.demo.voice.nlu.tagger.enums.LabelTags; import com.demo.voice.nlu.util.NLUAnalyzerUtils; public class NameProcessingStrategy extends AbstractProcessingStrategy implements ProcessingStrategy { private static final LabelTags[] tags = { LabelTags.Name }; private static final MentionType mentionType = MentionType.NAME; protected List<String> names = null; public NameProcessingStrategy() { super(); // TODO Auto-generated constructor stub } public NameProcessingStrategy(NluDataBean dataBean, ProcessingStrategyHelper helper) { super(dataBean, helper); // TODO Auto-generated constructor stub } @Override public LabelTags[] getTags() { // TODO Auto-generated method stub return tags; } @Override public MentionType getMentionType() { // TODO Auto-generated method stub return mentionType; } @Override public NluIntentDTO execute(NluIntentDTO intent, NLULiteral nluLiteral, String timeZone) { // TODO Auto-generated method stub //List<String> unnormalized = new ArrayList<String>(); if (CollectionUtils.isNotEmpty(this.names)) { intent.setName(names.get(0)); } return intent; } @Override public void setValue(LabelTags tag, String value) { // TODO Auto-generated method stub if (LabelTags.Name.equals(tag)) { if (names == null) { names = new ArrayList<String>(); } NLUAnalyzerUtils.addNoNullNoDups(names, value); } } @Override public ProcessingStrategy getInstance(NluDataBean dataBean, ProcessingStrategyHelper helper) { // TODO Auto-generated method stub return new NameProcessingStrategy(dataBean, helper); } }
[ "manviet1796@gmail.com" ]
manviet1796@gmail.com
ca94a348575957c2800e6ab68a0aa5405fbbcb25
e368372048de31d083c620b2ff66fb6cb39d57a6
/3/PetlaDoWhile.java
cd38c9892c840ae7173df3405b8527ee47e22479
[]
no_license
KNJPJATK/Kurs-Podstawowy2020-2021
92d8bd5cee5f32614fcb9011d090870b631bb4ff
0210e35a030a3f9aa031c2e7ad72b140e49754da
refs/heads/master
2023-01-21T01:46:49.401167
2020-11-26T16:17:40
2020-11-26T16:17:40
306,222,585
1
0
null
null
null
null
UTF-8
Java
false
false
293
java
public class PetlaDoWhile { public static void main(String[] args) { String[] tablica = {"Hello", "world", "!", "This", "is", "my", "awesome", "program", "!"}; int i = 0; do { System.out.print(tablica[i] + " "); i++; } while (i < tablica.length); System.out.println(); } }
[ "rafal.podkonski@dev-software.pl" ]
rafal.podkonski@dev-software.pl
717062ed5cb1bbee2f950e29a744b9dc06397cda
a637f42782378b5890a3feaa638dd7116376af28
/DollarBarrier.java
75de6d1a535589abfe092d81c1fc297860676246
[]
no_license
eyhhuang/FlappyBernie
8c1356177da4d20c1eaf74a3695360d110a3f372
f1058e7e085607cabcd56b1fafe5a036e0cb0c3c
refs/heads/master
2021-05-10T14:22:30.048183
2018-01-22T21:12:39
2018-01-22T21:12:39
118,515,926
1
0
null
null
null
null
UTF-8
Java
false
false
619
java
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * dollar bill barrier * * @author Emily Huang * @version 19 - 01 - 17 */ public class DollarBarrier extends Actor { public DollarBarrier() { //change size of actor GreenfootImage image = getImage(); image.scale(image.getWidth()*2/3, image.getHeight()*2/3); setImage(image); } int PIPE_SPEED = -3; public void act() { // allows dollar to move to the back of the screen setLocation(getX()+ PIPE_SPEED, getY()); } }
[ "emily.huang1@hotmail.com" ]
emily.huang1@hotmail.com
8634531f5ce12f3381c9fec188abe6733731a40b
4ef872ad8f6af051785a242462ed7f8dd59709dc
/design/ImplementTopologicalSortInDigraph/DepthFirstOrder.java
51777e31cb13a383b1c11aad7f7c54728c38ea5f
[]
no_license
vladovsiychuk/LeetCodeProblems-1
b19b4314cba1acbf9e28bc6e21a6be1885222088
6009798d218fc9a953331b178494889db94d29be
refs/heads/master
2022-10-31T18:54:17.730745
2020-06-17T20:36:54
2020-06-17T20:36:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package LeetCode.design.ImplementTopologicalSortInDigraph; import java.util.LinkedList; import java.util.Stack; /** * Topological sort implementation */ public class DepthFirstOrder { Digraph digraph; private boolean[] marked; private LinkedList<Integer> list; public DepthFirstOrder(Digraph g) { digraph = g; list = new LinkedList<>(); marked = new boolean[g.size()]; for (int i=0; i<g.size(); i++) { if (!marked[i]) { dfs(g, i, list); } } } private void dfs(Digraph g, int curr, LinkedList<Integer> list) { marked[curr] = true; for (Integer i : g.adj(curr)) { if (!marked[i]) { dfs(g, i, list); } } list.add(0, curr); } public Iterable<Integer> getTopologicalOrder() { return list; } }
[ "Semaserg@gmail.com" ]
Semaserg@gmail.com
df999ef6b5f9ba50afb23c132215a6d2221639ed
cb8ac4c39d514d48c051d3c1184747667720bd1f
/framework/src/main/java/com/genonbeta/android/framework/app/RecyclerViewFragment.java
91f047cabebd6a3757ae94bdae19e6a29bddc534
[]
no_license
bailyzheng/framework-android
c77ef56471ecc82927e5fb3d3125fe79c1e09281
4f8b8b0b63669b68a6f6bcec640c8200a266bfb0
refs/heads/master
2020-07-04T17:47:33.412609
2019-03-01T09:55:06
2019-03-01T09:55:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,602
java
package com.genonbeta.android.framework.app; import android.os.Bundle; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.genonbeta.android.framework.R; import com.genonbeta.android.framework.widget.RecyclerViewAdapter; import androidx.annotation.NonNull; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; /** * created by: veli * date: 26.03.2018 11:45 */ abstract public class RecyclerViewFragment<T, V extends RecyclerViewAdapter.ViewHolder, E extends RecyclerViewAdapter<T, V>> extends ListFragment<RecyclerView, T, E> { private RecyclerView mRecyclerView; final private Handler mHandler = new Handler(); final private Runnable mRequestFocus = new Runnable() { @Override public void run() { mRecyclerView.focusableViewAvailable(mRecyclerView); } }; @Override protected void onListRefreshed() { super.onListRefreshed(); boolean isEmpty = getAdapter().getCount() == 0; getEmptyView().setVisibility(isEmpty ? View.VISIBLE : View.GONE); getListView().setVisibility(isEmpty ? View.GONE : View.VISIBLE); } public RecyclerView.LayoutManager onLayoutManager() { return getDefaultLayoutManager(); } @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); mRecyclerView = view.findViewById(R.id.genfw_customListFragment_listView); if (mRecyclerView == null) mRecyclerView = onListView(getContainer(), getListViewContainer()); return view; } @Override protected RecyclerView onListView(View mainContainer, ViewGroup listViewContainer) { RecyclerView recyclerView = new RecyclerView(getContext()); recyclerView.setLayoutManager(onLayoutManager()); recyclerView.setLayoutParams(new GridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); listViewContainer.addView(recyclerView); return recyclerView; } @Override protected void onEnsureList() { mHandler.post(mRequestFocus); } @Override public boolean onSetListAdapter(E adapter) { if (mRecyclerView == null) return false; mRecyclerView.setAdapter(adapter); return true; } public RecyclerView.LayoutManager getDefaultLayoutManager() { return new LinearLayoutManager(getContext()); } @Override public RecyclerView getListView() { return mRecyclerView; } }
[ "veli.tasali@gmail.com" ]
veli.tasali@gmail.com
3401ddd83e41d6a9502f83b5b6589cf6e1e57ced
0ef0c78fbd8e0e19c0cf327fa15cf1ac2c606178
/PrakharTKG/A.java
fc3e5da00b983fde4466c4ae6d318bca8a21b91c
[]
no_license
shweyoe/PrakharTKGRepo
9c6570a079b8cafddd356eb689f9e5485936a13a
1ecc0d7b66850a11248cd43f77719fa76d4d9c9f
refs/heads/master
2020-12-11T06:12:35.169089
2016-01-07T13:00:52
2016-01-07T13:00:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
57
java
class A{ public static void main(String...args){ } }
[ "prakhar.jain@YITRNG17DT.Yash.com" ]
prakhar.jain@YITRNG17DT.Yash.com
f3fc9da96833f26a69cba8ea15339481cca37322
033b1e2cd67c125fdb4f77a1b8755a7bce9adf6b
/telegram_bot/src/main/java/org/gruzdov/springboot/telegram/model/Question.java
61b2b592c48f3bdbcbd197f03a171e73f2613cfb
[]
no_license
VodzurGoNe/Telegram_Bot
f439d3b98dc997ab604b26d7993ae3a3e0645f03
9e47129a2719f6c441fa8a194d1c7fdfac3865d0
refs/heads/main
2023-06-04T05:35:39.873203
2021-06-20T14:15:44
2021-06-20T14:15:44
369,290,769
0
0
null
null
null
null
UTF-8
Java
false
false
841
java
package org.gruzdov.springboot.telegram.model; import lombok.*; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.validation.constraints.NotBlank; @NoArgsConstructor @AllArgsConstructor @Getter @Setter @ToString @Entity @Table(name = "java_quiz") public class Question extends AbstractBaseEntity { @NotBlank @Column(name = "question", nullable = false) private String question; @NotBlank @Column(name = "answer_correct", nullable = false) private String correctAnswer; @NotBlank @Column(name = "option2", nullable = false) private String optionOne; @NotBlank @Column(name = "option1", nullable = false) private String optionTwo; @NotBlank @Column(name = "option3", nullable = false) private String optionThree; }
[ "Gruzdov.V.1991@Hotmail.com" ]
Gruzdov.V.1991@Hotmail.com
9102845d45d2205117860a2cf7d10556ec6b1585
652b39837ed213e42ffdea4ac60a3a7bbc121d2e
/Algorithm/src/com/neu/Graph/MGraphOperation.java
81b6c3262919862865dba813c4f841e4b04f4fe8
[]
no_license
Johnqiu123/Algorithm
3271978d0f5e1879f6ad1383a31887bc6db739f0
bdac9a3ed70dbfe67ca3db71959f88f27e87b332
refs/heads/master
2020-05-21T13:39:38.248766
2017-08-14T22:57:12
2017-08-14T22:57:12
63,992,762
0
0
null
null
null
null
UTF-8
Java
false
false
4,074
java
package com.neu.Graph; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class MGraphOperation { private MGraph g; public MGraphOperation() { // TODO Auto-generated constructor stub g = null; } /** * create a graph by matrix */ @SuppressWarnings("resource") public void createMGraph(){ Scanner cin = new Scanner(System.in); System.out.println("输入顶点数和边数:"); int n = cin.nextInt(); int e = cin.nextInt(); if (n < 0) throw new RuntimeException("Number of vertices must be nonnegative"); if (e < 0) throw new RuntimeException("Number of edges must be nonnegative"); this.g = new MGraph(n,e); // create vertex info System.out.println("输入顶点信息:"); for(int i = 0; i < n ; i++){ Vertex v = new Vertex(); v.setData(cin.nextInt()); g.vex[i] = v; } // create edge info System.out.println("输入有向边(vi,vj)上的顶点序号和权值:"); for(int i = 0; i < e; i++){ String[] value = cin.next().split(","); if (value.length < 3) throw new RuntimeException("input value must has three numbers"); int vi = Integer.parseInt(value[0]); int vj = Integer.parseInt(value[1]); int weight = Integer.parseInt(value[2]); g.edges[vi][vj] = weight; } } /** * create a matrix graph by auto */ public void createMGraphAuto(){ int n = 13; int e = 15; // int[] vexinfo = {0,1,2,3}; // String[] edgesinfo ={ // "0,1,1", // "0,3,4", // "1,3,2", // "1,2,9", // "2,0,3", // "2,1,5", // "2,3,8", // "3,2,6"}; int[] vexinfo = {0,1,2,3,4,5,6,7,8,9,10,11,12}; String[] edgesinfo = { "0,1,1", "0,6,1", "0,5,1", "2,0,1", "2,3,1", "3,5,1", "5,4,1", "6,4,1", "6,9,1", "7,6,1", "8,7,1", "9,10,1", "9,11,1", "9,12,1", "11,12,1"}; this.g = new MGraph(n,e); // create vertex info for(int i = 0; i < n ; i++){ Vertex v = new Vertex(); v.setData(vexinfo[i]); g.vex[i] = v; } // create edge info and indegrees int[] indegrees = new int[n]; for(int i = 0; i < e; i++){ String[] value = edgesinfo[i].split(","); int vi = Integer.parseInt(value[0]); int vj = Integer.parseInt(value[1]); int weight = Integer.parseInt(value[2]); indegrees[vj]++; // count indegree g.edges[vi][vj] = weight; } g.indegrees = indegrees; } /** * print a graph */ public void printGraph(){ if(g == null) throw new RuntimeException("create a graph first"); if(g != null){ int i,j; for (i = 0; i < g.getN(); i++){ for (j = 0; j < g.getN(); j++){ System.out.print(g.edges[i][j] + " "); } System.out.println(""); } } } /** * topolopic for a graph * @return toposort */ public int[] topologic(){ int[] toposort = new int[g.getN()]; Queue<Integer> queue = new LinkedList<Integer>(); int[] indegrees = g.indegrees; int[][] edges = g.edges; for(int i = 0; i < indegrees.length; i++){ if(indegrees[i] == 0){ queue.offer(i); } } int cur; // current node's indegree is 0 int j = 0; while(!queue.isEmpty()){ cur = queue.poll(); toposort[j++] = cur; for(int i =0; i < g.getN(); i++){ if(edges[cur][i] != 0){ indegrees[i]--; if(indegrees[i] == 0){ queue.offer(i); } } } } return toposort; } public static void main(String[] args) { MGraphOperation mgo = new MGraphOperation(); // mgo.createMGraph(); // System.out.println("打印图:"); // mgo.printGraph(); /*****************Test 1********************/ mgo.createMGraphAuto(); System.out.println("打印图:"); mgo.printGraph(); int[] indegree = mgo.g.indegrees; for(int i=0; i < indegree.length; i++){ System.out.print(indegree[i] + " "); } System.out.println(""); /*****************Test 2********************/ System.out.println("拓扑排序:"); int[] toposort = mgo.topologic(); for(int i = 0; i < toposort.length; i++){ System.out.print(toposort[i] + " "); } System.out.println(""); } }
[ "quanshao2014@126.com" ]
quanshao2014@126.com
2aafe0dd6c6e8d8158347cad88b18a565e21319e
242540c1cacfca8b2ef5bd658061909dce48261a
/core/src/main/java/com/onlinestock/core/user/service/UserService.java
570cca95a007edc359f1e404cc349e9f6bdf463e
[]
no_license
NikBelarus/stock
36e2d89b6f635a53f8de7c80648e829e72c13c86
9cd6fab2b82431befbc28cd77054074d427a97f1
refs/heads/master
2022-09-25T01:33:07.390367
2019-11-17T18:37:48
2019-11-17T18:37:48
222,294,675
0
1
null
2022-09-08T01:04:35
2019-11-17T18:40:58
JavaScript
UTF-8
Java
false
false
728
java
package com.onlinestock.core.user.service; import com.onlinestock.core.common.ApiResponse; import com.onlinestock.core.user.dto.FindUserDTO; import com.onlinestock.core.user.dto.SaveUserDTO; import org.springframework.data.crossstore.ChangeSetPersister; import org.springframework.validation.annotation.Validated; import javax.validation.Valid; import javax.validation.constraints.NotNull; @Validated public interface UserService { FindUserDTO findOne(@NotNull Long id) throws ChangeSetPersister.NotFoundException; ApiResponse create(@Valid SaveUserDTO saveDto); void delete(@NotNull Long id); ApiResponse update(@NotNull Long id, @Valid SaveUserDTO saveDto) throws ChangeSetPersister.NotFoundException; }
[ "dashchynskinikita@gmail.com" ]
dashchynskinikita@gmail.com
ad6d6aa3d68359c0ed4330edb592ca766660e158
8e4bd5a6e579826780a6cabcb4d354fe02f5967c
/CoreLibrary/src/main/java/com/didi/virtualapk/internal/ClassLoaderEx.java
c3cfc8dd59cfb440bcb1a2b5f6315057ae041ae8
[ "Apache-2.0" ]
permissive
wyogap/tcg-lib-virtualapk
2909dbfee41897ff4fd352344d0cd9eb04bd8380
1ce9b4fe0fb3754bf1d2a9c1b6f933c5f2c6a3b9
refs/heads/master
2020-07-11T08:44:02.111889
2019-09-13T04:37:44
2019-09-13T04:37:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,502
java
package com.didi.virtualapk.internal; import android.content.Context; import android.support.annotation.NonNull; import android.text.TextUtils; import java.io.File; import java.util.HashMap; import dalvik.system.DexClassLoader; /** * This is just a flag to identify if a class is loaded by PluginManager */ public class ClassLoaderEx extends DexClassLoader { String mPackage; String mFile; ClassLoaderEx[] mDeps; //IKomkitApp appContext; Context mContext; static final HashMap<String, ClassLoaderEx> loaders = new HashMap<String, ClassLoaderEx>(); public ClassLoaderEx(Context context, @NonNull String dexPath, @NonNull String optimizedDirectory, String librarySearchPath, ClassLoader parent, String pkgName, ClassLoaderEx[] deps) { super(dexPath, optimizedDirectory, librarySearchPath, parent); this.mContext = context; this.mFile = dexPath; this.mPackage = pkgName; this.mDeps = deps; } public Context getContext() { return mContext; } public String getPackageName() { return mPackage; } @Override protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class<?> clazz = null; try { clazz = super.loadClass(name, resolve); } catch (Exception ex) { //ignore } if (clazz != null) return clazz; if (mDeps != null) { for (ClassLoaderEx c : mDeps) { try { clazz = c.findClass(name); break; } catch (ClassNotFoundException e) { } } } if (clazz != null) return clazz; return findClass(name); } public static ClassLoaderEx getClassLoader(Context context, String apk, String optimizedDir, String libsDir, ClassLoader parent, String pkgName, String[] deps ) { if (TextUtils.isEmpty(apk)) return null; ClassLoaderEx cl = loaders.get(pkgName); if (cl != null) return cl; File depPath; ClassLoaderEx depLoader; ClassLoaderEx[] cldeps = null; if (deps != null) { cldeps = new ClassLoaderEx[deps.length]; for (int i = 0; i < deps.length; i++) { if (TextUtils.isEmpty(deps[i])) continue; depPath = new File(deps[i]); if (!depPath.isFile()) continue; depLoader = getClassLoader(context, depPath.getAbsolutePath(), optimizedDir, libsDir, parent, null, null); if (depLoader == null) continue; cldeps[i] = depLoader; } } File path = new File(apk); if (!path.isFile()) return null; cl = new ClassLoaderEx( context, path.getAbsolutePath(), optimizedDir, libsDir, parent, pkgName, cldeps); if (cl != null) loaders.put(pkgName, cl); return cl; } }
[ "wyogap@gmail.com" ]
wyogap@gmail.com
e6ca86668fafe586ad8cbf0581659b8994ce8f05
7ac234738caa07ac71f71ad0daac39cf79e01c8b
/cinnamon-core/src/main/java/org/cinnamon/core/config/builder/GroupWrapper.java
360e55fc1f7d7cabe0f129af213d771632035b86
[ "MIT" ]
permissive
adrenalinee/cinnamon
c8309bd2cd69bcee5de368cbb1475f2dbc8e84ac
cc6eb6d6a0c2f52eae71deeddf88ea637ce07a72
refs/heads/master
2021-01-17T00:53:11.415600
2017-02-13T02:46:20
2017-02-13T02:46:20
29,680,497
0
0
null
null
null
null
UTF-8
Java
false
false
988
java
package org.cinnamon.core.config.builder; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import org.cinnamon.core.domain.Group; /** * * * created date: 2015. 9. 15. * @author 신동성 */ public class GroupWrapper { Group group; GroupWrapper parent; List<GroupWrapper> childGroupWrappers = new LinkedList<>(); GroupWrapper(String name, Object groupId) { group = new Group(); group.setName(name); group.setGroupId(groupId.toString()); } public GroupWrapper description(String description) { group.setDescription(description); return this; } public GroupWrapper message(String message) { group.setMessage(message); return this; } public GroupWrapper addChildGroup(GroupWrapper... childWrappers) { Arrays.asList(childWrappers).forEach(childWrapper -> { childWrapper.parent = this; childGroupWrappers.add(childWrapper); }); // childGroupWrappers.addAll(Arrays.asList(childWrappers)); return this; } }
[ "dsshin@daihansci@co.kr" ]
dsshin@daihansci@co.kr
4e0a4850e96e98d56e5fb6bbec0ba1adc1d7370b
2fc51c5135661e997ecf08d0d462b043ada7b6a6
/seava.j4e.business/src/main/java/seava/j4e/business/service/AbstractBusinessBaseService.java
adfc6ae9c2aad9969a3f62a93da072ca4ae88dad
[ "Apache-2.0" ]
permissive
RainerJava/seava.lib.j4e
283f9b23a31a46c541f4c322ec111c60d0c5f3fc
f0df2b835a489319bc889b5eb534cb4107c6673f
refs/heads/master
2021-01-16T19:31:48.813324
2014-05-26T09:29:51
2014-05-26T09:29:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,132
java
/** * DNet eBusiness Suite * Copyright: 2013 Nan21 Electronics SRL. All rights reserved. * Use is subject to license terms. */ package seava.j4e.business.service; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import seava.j4e.api.ISettings; import seava.j4e.api.exceptions.BusinessException; import seava.j4e.api.exceptions.ErrorCode; import seava.j4e.api.model.IModelWithId; import seava.j4e.api.service.IServiceLocatorBusiness; import seava.j4e.api.service.business.IEntityService; import seava.j4e.api.wf.IActivitiProcessEngineHolder; import seava.j4e.business.AbstractApplicationContextAware; import org.activiti.engine.FormService; import org.activiti.engine.HistoryService; import org.activiti.engine.ProcessEngine; import org.activiti.engine.RepositoryService; import org.activiti.engine.RuntimeService; import org.activiti.engine.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.integration.Message; import org.springframework.integration.MessageChannel; import org.springframework.integration.support.MessageBuilder; /** * Root abstract class for business service hierarchy. It provides support for * the sub-classes with the generally needed elements like an * applicationContext, system configuration parameters, workflow services etc. * * * @author amathe * */ public abstract class AbstractBusinessBaseService extends AbstractApplicationContextAware { private ISettings settings; private IServiceLocatorBusiness serviceLocator; private ProcessEngine workflowEngine; @PersistenceContext @Autowired private EntityManager entityManager; /** * Lookup an entity service. * * @param <T> * @param entityClass * @return * @throws BusinessException */ public <T> IEntityService<T> findEntityService(Class<T> entityClass) throws BusinessException { return this.getServiceLocator().findEntityService(entityClass); } /** * Return a new instance of a business delegate by the given class. * * @param <T> * @param clazz * @return * @throws BusinessException */ public <T extends AbstractBusinessDelegate> T getBusinessDelegate( Class<T> clazz) throws BusinessException { T delegate; try { delegate = clazz.newInstance(); } catch (Exception e) { throw new BusinessException(ErrorCode.G_RUNTIME_ERROR, "Cannot create a new instance of " + clazz.getCanonicalName(), e); } delegate.setApplicationContext(this.getApplicationContext()); delegate.setEntityManager(this.getEntityManager()); return delegate; } public ISettings getSettings() { if (this.settings == null) { this.settings = this.getApplicationContext().getBean( ISettings.class); } return settings; } public void setSettings(ISettings settings) { this.settings = settings; } /** * @return the entity manager */ public EntityManager getEntityManager() { return this.entityManager; } /** * @param entityManager * the entity manager to set */ public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } /** * Get business service locator. If it is null attempts to retrieve it * * @return */ public IServiceLocatorBusiness getServiceLocator() { if (this.serviceLocator == null) { this.serviceLocator = this.getApplicationContext().getBean( IServiceLocatorBusiness.class); } return serviceLocator; } /** * Set business service locator. * * @param serviceLocator */ public void setServiceLocator(IServiceLocatorBusiness serviceLocator) { this.serviceLocator = serviceLocator; } public ProcessEngine getWorkflowEngine() throws BusinessException { if (this.workflowEngine == null) { try { this.workflowEngine = (ProcessEngine) this .getApplicationContext() .getBean(IActivitiProcessEngineHolder.class) .getProcessEngine(); } catch (Exception e) { throw new BusinessException(ErrorCode.G_RUNTIME_ERROR, "Cannot get the Activiti workflow engine.", e); } } return this.workflowEngine; } public RuntimeService getWorkflowRuntimeService() throws BusinessException { return this.getWorkflowEngine().getRuntimeService(); } public TaskService getWorkflowTaskService() throws BusinessException { return this.getWorkflowEngine().getTaskService(); } public RepositoryService getWorkflowRepositoryService() throws BusinessException { return this.getWorkflowEngine().getRepositoryService(); } public HistoryService getWorkflowHistoryService() throws BusinessException { return this.getWorkflowEngine().getHistoryService(); } public FormService getWorkflowFormService() throws BusinessException { return this.getWorkflowEngine().getFormService(); } public void doStartWfProcessInstanceByKey(String processDefinitionKey, String businessKey, Map<String, Object> variables) throws BusinessException { this.getWorkflowRuntimeService().startProcessInstanceByKey( processDefinitionKey, businessKey, variables); } public void doStartWfProcessInstanceById(String processDefinitionId, String businessKey, Map<String, Object> variables) throws BusinessException { this.getWorkflowRuntimeService().startProcessInstanceById( processDefinitionId, businessKey, variables); } public void doStartWfProcessInstanceByMessage(String messageName, String businessKey, Map<String, Object> processVariables) throws BusinessException { this.getWorkflowRuntimeService().startProcessInstanceByMessage( messageName, businessKey, processVariables); } protected void sendMessage(String to, Object content) { Message<Object> message = MessageBuilder.withPayload(content).build(); this.getApplicationContext().getBean(to, MessageChannel.class) .send(message); } protected List<Object> collectIds(List<? extends IModelWithId<?>> entities) { List<Object> result = new ArrayList<Object>(); for (IModelWithId<?> e : entities) { result.add(e.getId()); } return result; } }
[ "attila.mathe@dnet-ebusiness-suite.com" ]
attila.mathe@dnet-ebusiness-suite.com
dd41828520aec99841f6dfca2b89df6d89333646
894a03711d315bdf1777573b890c5ef2d54a14ca
/My_Project/V2_chapter1/src/streams/CountLongWords.java
61ca6130f88bb9e910a7df7ced2ce917d0f83a2b
[]
no_license
C-Liueasymoney/Personal-Practise-of-Core-Java
615d273c7f2cf09941638c451b643392faf0bca0
00120f421e240e5b977db9911771ff98fa8ae6a8
refs/heads/master
2023-04-01T20:07:29.388610
2021-04-09T08:24:00
2021-04-09T08:24:00
356,193,114
2
1
null
null
null
null
UTF-8
Java
false
false
1,212
java
package streams; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Stream; /** * @Description: * @Author: chong * @Data: 2021/3/21 11:59 上午 */ public class CountLongWords { public static void main(String[] args) throws IOException { String contents = new String(Files.readAllBytes(Paths.get("./test.txt")), StandardCharsets.UTF_8); List<String> words = Arrays.asList(contents.split("\\PL+")); long count = 0; for (String w : words){ if (w.length() > 12) count++; } System.out.println(count); count = words.stream().filter(w -> w.length() > 12).count(); System.out.println(count); count = words.parallelStream().filter(w -> w.length() > 12).count(); System.out.println(count); } public static Stream<String> letters(String s){ List<String> result = new ArrayList<>(); for (int i =0; i < s.length(); i++){ result.add(s.substring(i, i + 1)); } return result.stream(); } }
[ "chong@chongdeMacBook-Pro.local" ]
chong@chongdeMacBook-Pro.local
7a319dde1c53eae688200627151d1915edf958cd
de514e258a6e368fea5de242ebaadb16b267c332
/concurrentdemo/src/main/java/com/art2cat/dev/concurrency/BusStation.java
a150c993eaa70a688724dd71da07b746a86250f2
[]
no_license
Art2Cat/JavaDemo
09e1e10d4bbc13fb80f6afd92e56d4c4bfed3d51
08a8a45c3301bfba5856b7edeebf37ebd648111b
refs/heads/master
2021-06-21T16:40:04.403603
2019-08-03T06:14:18
2019-08-03T06:14:18
104,846,429
0
1
null
null
null
null
UTF-8
Java
false
false
1,466
java
package com.art2cat.dev.concurrency; import java.time.LocalDateTime; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ThreadLocalRandom; public class BusStation { private static int busCounter = 0; public static synchronized void departBus() { busCounter++; } private static String getTime() { return LocalDateTime.now().toString(); } public static class Passenger implements Runnable { CyclicBarrier barrier; public Passenger(CyclicBarrier barrier) { this.barrier = barrier; } @Override public void run() { try { Thread.sleep(ThreadLocalRandom.current().nextInt(10000)); String arriveTime = getTime(); int index = barrier.await(); System.out.println("第" + (10 - index) + "位乘客于" + arriveTime + "到达"); } catch (BrokenBarrierException | InterruptedException e) { e.printStackTrace(); } } } public static class BusManager implements Runnable { @Override public void run() { departBus(); System.out.println("**********************"); System.out.println("第" + busCounter + "辆大巴于" + getTime() + "发车"); System.out.println("乘客到达时间如下:"); } } }
[ "yiming.whz@gmail.com" ]
yiming.whz@gmail.com
48c21804fd859e10e72e703f5ada5fda75610d14
6773cf1d63a50ec6fe1699dd88462eacf0549fc6
/blog/src/com/cos/test/ReplyTest.java
1a0d1005e80f1687a39aa293ea03b9a1068020dd
[]
no_license
juneyj114/jspblog
567a172d055add30b8d954b046447f144e6cbd52
48dd8a0fcc9ff58296ff65778144368e8c0d5fc2
refs/heads/master
2020-09-09T04:58:37.737461
2019-11-13T06:10:18
2019-11-13T06:10:18
221,354,307
0
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
package com.cos.test; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.cos.model.Comment; import com.google.gson.Gson; @WebServlet("/test/reply") public class ReplyTest extends HttpServlet { private static final long serialVersionUID = 1L; public ReplyTest() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setContentType("text/plain; charset=UTF-8"); //MIME 타입 // 1. JSON 데이터 받기 & sout 출력 BufferedReader in = request.getReader(); String jsonStr = in.readLine(); System.out.println(jsonStr); // 2. JAVA 오브젝트로 변환 & sout 출력 Gson gson = new Gson(); Comment reply = gson.fromJson(jsonStr, Comment.class); System.out.println(reply.getId()); System.out.println(reply.getBoardId()); System.out.println(reply.getUserId()); System.out.println(reply.getContent()); System.out.println(reply.getCreateDate()); PrintWriter out = response.getWriter(); out.print("Hello"); out.flush(); } }
[ "acto2002@naver.com" ]
acto2002@naver.com
e1125685f7cbee03062e947342f8fc765c2ce3bd
398ef9e2f6d5e5a9fd727af8c08c68bac66900dd
/app/src/main/java/com/mooc/ppjoke/ui/state/PreviewViewModel.java
d9657384e101f6bca3d1fe4234441e4f0668b21a
[]
no_license
riomarksafk/Jetpack-MVVM-PPJoke
165b83ab910d4b9bd0a623885e79ea7686deb941
36e2f2fd622e6953399270433cc45a13f40145de
refs/heads/master
2023-05-21T15:03:22.648828
2021-06-08T07:39:43
2021-06-08T07:39:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
574
java
package com.mooc.ppjoke.ui.state; import androidx.databinding.ObservableField; import androidx.lifecycle.ViewModel; import com.google.android.exoplayer2.SimpleExoPlayer; public class PreviewViewModel extends ViewModel { public final ObservableField<String> btnText = new ObservableField<>(); public final ObservableField<Boolean> isVideo = new ObservableField<>(); //如果是图片文件 public final ObservableField<String> previewUrl = new ObservableField<>(); //视频播放器 public final ObservableField<SimpleExoPlayer> player = new ObservableField<>(); }
[ "1025618933@qq,com" ]
1025618933@qq,com
e54aa04eab204169908b4a9b199e5bbf444bdfc5
870ece25e2ac94330cbbc3502bb2020174513f42
/src/main/java/devfun/bookstore/rest/config/RestAppConfig.java
31be6e8b5377b1a49f28bc2c67fc31bae4a39fe2
[]
no_license
devkook/book-restapp
62c7f85939ce49e28f98dff370c085333aaaa60e
07239bc73db7cdf4a7d99eea7d0fdd8b4d3aa260
refs/heads/master
2016-09-03T01:05:10.767165
2014-04-28T13:36:22
2014-04-28T13:36:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
146
java
package devfun.bookstore.rest.config; import org.springframework.context.annotation.Configuration; @Configuration public class RestAppConfig { }
[ "devinkook@gmail.com" ]
devinkook@gmail.com
4912fe05783c4b29f460ff139d573540cf131c15
ff973a21288ac88df6a083d297f379d7c67d9519
/app/src/androidTest/java/com/blumonplay/cesarcruz/pruebatecnica/ExampleInstrumentedTest.java
4c345025b0aacdae8bd49bc0863586c9afc219d0
[]
no_license
neurosistemas/PruebaTecnica
83590750bf7193a8d267567f4bc797c574789dd2
2780ee746cf972d507a02d762ad07c3a0a662fdb
refs/heads/master
2020-03-19T07:11:08.886901
2018-06-04T21:41:33
2018-06-04T21:41:33
136,094,233
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.blumonplay.cesarcruz.pruebatecnica; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.blumonplay.cesarcruz.pruebatecnica", appContext.getPackageName()); } }
[ "neurosistemas21@gmail.com" ]
neurosistemas21@gmail.com
db0daec3fd753cba6401831a80242168b220a04d
681d83fde3a2a2f7eb91978aa092edf99e5d2e92
/leetcode/src/zzz_niuke/wangyi/_2018_School/_1_Solution.java
f772c84f2293f257d7956d289b6f8ce76e805365
[]
no_license
tjlcast/MyLeetCodePro
981d5d68c6cef6d9e1a57c17dda81cfde7657044
c0711348939408d71315c523e17e37c040d29142
refs/heads/master
2022-12-25T20:40:40.103349
2020-04-05T18:31:43
2020-04-05T18:31:43
134,796,463
0
0
null
2022-12-16T03:14:24
2018-05-25T03:06:22
Java
UTF-8
Java
false
false
3,183
java
package zzz_niuke.wangyi._2018_School; import java.io.* ; import java.util.* ; /** * Created by tangjialiang on 2017/10/2. */ public class _1_Solution { /** * 小易准备去魔法王国采购魔法神器,购买魔法神器需要使用魔法币,但是小易现在一枚魔法币都没有,但是小易有两台魔法机器可以通过投入x(x可以为0)个魔法币产生更多的魔法币。 魔法机器1:如果投入x个魔法币,魔法机器会将其变为2x+1个魔法币 魔法机器2:如果投入x个魔法币,魔法机器会将其变为2x+2个魔法币 小易采购魔法神器总共需要n个魔法币,所以小易只能通过两台魔法机器产生恰好n个魔法币,小易需要你帮他设计一个投入方案使他最后恰好拥有n个魔法币。 输入描述: 输入包括一行,包括一个正整数n(1 ≤ n ≤ 10^9),表示小易需要的魔法币数量。 输出描述: 输出一个字符串,每个字符表示该次小易选取投入的魔法机器。其中只包含字符'1'和'2'。 输入例子1: +10 输出例子1: 122 */ public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ; String i0 = null ; i0 = br.readLine() ; int n = Integer.parseInt(i0) ; _1_Solution sol = new _1_Solution() ; String res = sol.work(0, n) ; System.out.println(res) ; } String ans = null ; private LinkedList<Integer> nums = new LinkedList<>() ; public String work(int x, int n) { generateStr(n); return (ans==null)?(""):(ans) ; } private void generateStr(int n) { int count = n ; while(count > 0) { if (count % 2 != 0) { // current num is odd, add 1 nums.add(1) ; count = (count - 1) / 2 ; } else { // current num id even, add 2 nums.add(2) ; count = (count - 2) / 2 ; } } // list 2 string StringBuilder sb = new StringBuilder() ; for(Integer i : nums) { sb.append(i) ; } sb.reverse() ; this.ans = sb.toString() ; } private void generateStr(int count, int n) { // machine 1 can add exp 1 coins // machine 2 can add exp 2 coins if (count == n) { StringBuilder sb = new StringBuilder() ; for(Integer i : nums) { sb.append(i) ; } sb.reverse() ; this.ans = sb.toString() ; } if (count < n) { int diff = n - count ; if (diff >= (count + 2)) { nums.addFirst(2); generateStr(count + (count + 2), n); nums.removeFirst() ; } // if ans has been found if (ans != null) return ; if (diff >= (count + 1)) { nums.addFirst(1) ; generateStr(count + (count + 1), n); nums.removeFirst() ; } } } }
[ "phx108@sina.com" ]
phx108@sina.com
b47d3b0f7a5f8e6a5f513c488e418e76c8a57508
d0cba53c150247f7c109f4a3899f66b1563fdbf3
/src/net/fai/daems/DaemsActivity.java
6c9d6990b6672c5a3b1d85944685f4cb4d6d4012
[ "MIT" ]
permissive
daemsproject/daemsAndroid
1d4b208f48ec7be59b4ef0dc3eb80306e46572c8
08bb53a9ac6f732d12f29123dcf0c1e8b8ad98a7
refs/heads/master
2020-06-14T07:15:34.078250
2017-03-11T12:21:11
2017-03-11T12:21:11
75,217,318
0
0
null
null
null
null
UTF-8
Java
false
false
3,331
java
package net.fai.daems; import java.lang.reflect.Field; import org.greenrobot.eventbus.EventBus; import net.fai.daems.constant.Daems; import net.fai.daems.constant.ViewId; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import com.readystatesoftware.systembartint.SystemBarTintManager; /** * Base Activity * @author Administrator * */ public abstract class DaemsActivity extends Activity { @Override final protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (subscribeMessage()) { EventBus.getDefault().register(this); } beforeSetContentView(); int viewId = getContentView(); if (viewId != Daems.View.NONE_VIEW) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); ViewGroup layout = (ViewGroup) inflater.inflate(viewId, null); if (isTintSystgemBar()) { layout.setFitsSystemWindows(true); initSystemBar(this); } setContentView(layout); } try { initComponentViews(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } onCreateActivity(savedInstanceState); } @Override final protected void onDestroy() { super.onDestroy(); if (subscribeMessage()) { EventBus.getDefault().unregister(this); } onDestroyActivity(); } public void beforeSetContentView() {} public abstract int getContentView(); /** * 是否需要沉浸式系统状态栏 * @return */ public boolean isTintSystgemBar() { return true; } public abstract void onCreateActivity(Bundle savedInstanceState); public boolean subscribeMessage() { return false; } public void onDestroyActivity() {}; /** * 初始化Activity上的组件 * @throws IllegalArgumentException * @throws IllegalAccessException */ private void initComponentViews() throws IllegalAccessException, IllegalArgumentException { Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { if (field.isAnnotationPresent(ViewId.class)) { int componentViewId = field.getAnnotation(ViewId.class).value(); View view = findViewById(componentViewId); field.setAccessible(true); field.set(this, view); } } } /** * 沉浸式系统状态栏 * @param activity */ public static void initSystemBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(activity, true); } SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); // 使用颜色资源 tintManager.setStatusBarTintResource(R.color.background); } @TargetApi(19) private static void setTranslucentStatus(Activity activity, boolean on) { Window win = activity.getWindow(); WindowManager.LayoutParams winParams = win.getAttributes(); final int bits = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; if (on) { winParams.flags |= bits; } else { winParams.flags &= ~bits; } win.setAttributes(winParams); } }
[ "mr-ooops@gmx.com" ]
mr-ooops@gmx.com
8611a61703dc2d540e689f6f993eea9681172055
3016374f9ee1929276a412eb9359c0420d165d77
/InstrumentAPK/sootOutput/com.waze_source_from_JADX/com/google/android/gms/auth/firstparty/shared/FACLDataCreator.java
3af652cdbe6f144deb3e1b3bff191628eeeddd6c
[]
no_license
DulingLai/Soot_Instrumenter
190cd31e066a57c0ddeaf2736a8d82aec49dadbf
9b13097cb426b27df7ba925276a7e944b469dffb
refs/heads/master
2021-01-02T08:37:50.086354
2018-04-16T09:21:31
2018-04-16T09:21:31
99,032,882
4
3
null
null
null
null
UTF-8
Java
false
false
1,984
java
package com.google.android.gms.auth.firstparty.shared; import android.os.Parcel; import android.os.Parcelable.Creator; import com.google.android.gms.common.internal.safeparcel.zza; import com.google.android.gms.common.internal.safeparcel.zzb; /* compiled from: dalvik_source_com.waze.apk */ public class FACLDataCreator implements Creator<FACLData> { public static final int CONTENT_DESCRIPTION = 0; static void zza(FACLData $r0, Parcel $r1, int $i0) throws { int $i1 = zzb.zzea($r1); zzb.zzc($r1, 1, $r0.version); zzb.zza($r1, 2, $r0.iC, $i0, false); zzb.zza($r1, 3, $r0.iD, false); zzb.zza($r1, 4, $r0.iE); zzb.zza($r1, 5, $r0.iF, false); zzb.zzaj($r1, $i1); } public FACLData createFromParcel(Parcel $r1) throws { boolean $z0 = false; String $r2 = null; int $i0 = zza.zzdz($r1); String $r3 = null; FACLConfig $r4 = null; int $i1 = 0; while ($r1.dataPosition() < $i0) { int $i2 = zza.zzdy($r1); switch (zza.zziv($i2)) { case 1: $i1 = zza.zzg($r1, $i2); break; case 2: $r4 = (FACLConfig) zza.zza($r1, $i2, FACLConfig.CREATOR); break; case 3: $r3 = zza.zzq($r1, $i2); break; case 4: $z0 = zza.zzc($r1, $i2); break; case 5: $r2 = zza.zzq($r1, $i2); break; default: zza.zzb($r1, $i2); break; } } if ($r1.dataPosition() == $i0) { return new FACLData($i1, $r4, $r3, $z0, $r2); } throw new zza.zza("Overread allowed size end=" + $i0, $r1); } public FACLData[] newArray(int $i0) throws { return new FACLData[$i0]; } }
[ "laiduling@alumni.ubc.ca" ]
laiduling@alumni.ubc.ca
7162043cbb2a6c027eff618cc3fe4a9b2ff005bc
e7c4836bcd64be467a0397a9792246ab0a97dcad
/src/com/java/rishabh/PowerfulDigitSum.java
dc2c7df72c01696ae779a0fe66bb0d0c4198c043
[]
no_license
rish8089/projectEuler
0961ca043694c8bba4c60336e79b7cad7ced9855
a78b83f3bca2b07e74cb3e5984c500f5f1ecafa4
refs/heads/master
2020-04-22T05:19:18.561015
2019-05-01T08:52:52
2019-05-01T08:52:52
170,155,487
0
0
null
null
null
null
UTF-8
Java
false
false
2,623
java
package com.java.rishabh; import java.util.Arrays; public class PowerfulDigitSum { int lim=100; public int getPowerfulDigitSum() { int ans=0; int arr[]; int A[]=new int[2*lim+1]; int B[]=new int[2*lim+1]; for(int i=2;i<lim;i++) { int noOfDigitsInA=populateArrayWithDigits(A,1); int noOfDigitsInB=populateArrayWithDigits(B,i); for(int j=1;j<lim;j++) { A=multiplyTwoArrays(A,B,noOfDigitsInA,noOfDigitsInB); noOfDigitsInA=getNoOfDigitsInArray(A); int sumOfDigits=getSumOfDigitsInArray(A); if(ans<sumOfDigits) { ans = sumOfDigits; } } Arrays.fill(A,0); Arrays.fill(B,0); } return ans; } private int populateArrayWithDigits(int arr[],int num) { int idx=arr.length-1; while(num>0) { arr[idx]=num%10; num=num/10; idx--; } return arr.length-1-idx; } int[] multiplyTwoArrays(int[] A, int[] B, int noOfDigitsInA, int noOfDigitsInB) { int tmp[] = new int[2*lim+1]; for (int j = 2*lim; j > 2*lim-noOfDigitsInB; j--) { int carry = 0; int idx = j; for (int k = 2*lim; k > (2*lim-noOfDigitsInA) && idx >= 0; k--, idx--) { int prod = carry + B[j] * A[k]; addNumToArrayAtIdx(tmp, prod % 10, idx); carry = prod / 10; } if (idx >= 0 && carry > 0) { addNumToArrayAtIdx(tmp, carry, idx); } } return tmp; } private int getNoOfDigitsInArray(int arr[]) { int idx = 0; while (idx < arr.length && arr[idx] == 0) { idx++; } return arr.length - idx; } private int getSumOfDigitsInArray(int arr[]) { int idx=0; while (idx < arr.length && arr[idx] == 0) { idx++; } int sum=0; while(idx<arr.length) { sum=sum+arr[idx]; idx++; } return sum; } private void addNumToArrayAtIdx(int tmp[], int num, int idx) { int addition = tmp[idx] + num; tmp[idx] = addition % 10; int carry = addition / 10; idx--; while (idx >= 0 && carry > 0) { addition = carry + tmp[idx]; tmp[idx] = addition % 10; carry = addition / 10; idx--; } } }
[ "shinghal.rishab@gaiansolutions.com" ]
shinghal.rishab@gaiansolutions.com
c027b0dd4b29add8e4b6fa1370c70144cfa73e3c
fb8bd4f35d6327224f319f212429456646477463
/src/main/java/com/joe/alain/myapp/config/Constant.java
ec25f66ba69aa1e1c44a8aea7834224bc020c778
[]
no_license
JoAlain/MyStock
0bc6cf8df0c46b40e3088ff1d9a9d1b2693a47b6
0c20ab1e9e3ea161108a83b2bca8d026a4d9e033
refs/heads/master
2022-12-14T08:19:13.672415
2020-09-25T10:41:18
2020-09-25T10:41:18
298,359,661
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
package com.joe.alain.myapp.config; public class Constant { public static final String noRecordFound = "No record found for given id"; }
[ "jtiarilala.olona@gmail.com" ]
jtiarilala.olona@gmail.com
f7f2c41c98d43e37847328eed41bd31aaa7a3420
dbbef2ea773000e633eeda04793607ae94faec6f
/src/main/java/rxjava/operators/combine/ConcatEx.java
4a9ba04596e3cff0317e77e3f21cdc5a477ae476
[]
no_license
eve0625/RxJava
a2b939709a53b910651a280ecd0450c87fa22795
5893a3a8a1df32a04bf67e0fbd9f307c74b4adb9
refs/heads/master
2021-05-05T16:06:30.705430
2017-10-08T09:41:03
2017-10-08T09:41:03
103,201,402
0
0
null
null
null
null
UTF-8
Java
false
false
1,320
java
package rxjava.operators.combine; import java.util.concurrent.TimeUnit; import common.CommonUtils; import common.Log; import io.reactivex.Observable; import io.reactivex.functions.Action; public class ConcatEx { /* * concat : 2개 이상의 Obsevable을 이어 붙여주는 함수 * 첫번째 Observable에서 onComplete 이벤트가 발생해야, 다음 Observable을 구독함 * 첫번째 Observable이 완료되지 않으면 두번째 Observable은 영원히 대기하므로 잠재적인 메모리 누수가 있을 수 있다. */ public void test() { //OnComplete 이벤트 발생을 확인하기 위한 Action Action onCompleteAction = () -> Log.d("onComplete()"); String[] data1 = {"1", "3", "5"}; String[] data2 = {"2", "4", "6"}; Observable<String> source1 = Observable.fromArray(data1) .doOnComplete(onCompleteAction); Observable<String> source2 = Observable.interval(100L, TimeUnit.MILLISECONDS) .map(Long::intValue) .map(idx -> data2[idx]) .take(data2.length) .doOnComplete(onCompleteAction); Observable<String> source = Observable.concat(source1, source2) .doOnComplete(onCompleteAction); source.subscribe(Log::i); CommonUtils.sleep(1000); } public static void main(String[] args) { ConcatEx ex = new ConcatEx(); ex.test(); } }
[ "eve0625@naver.com" ]
eve0625@naver.com
5de295299441a729fb87a783b2b561ea1477d10c
3709823d4c510bc08ce6e6e27e718c106062619c
/eCommerce/src/eCommerce/business/concretes/UserValidationManager.java
c1482bf3d1361dc03bca713a716d136b1bc9328b
[]
no_license
koseirem1/eCommerce
97226656cb7fa85cd23e16b8710b5543d2ad2c81
fda7b4e780cd9a59da0f71acc381df440f3acc0e
refs/heads/master
2023-04-28T07:46:39.686253
2021-05-18T12:15:09
2021-05-18T12:15:09
368,517,006
1
0
null
null
null
null
ISO-8859-9
Java
false
false
1,490
java
package eCommerce.business.concretes; import java.util.regex.Matcher; import java.util.regex.Pattern; import eCommerce.business.abstracts.UserValidationService; public class UserValidationManager implements UserValidationService { @Override public boolean passwordValidation(String password) { if(password != null && password != "") { if(password.length() < 6) { System.out.println("Şifre 6 karakterden küçük olamaz!"); return false; } else { return true; } } else { return false; } } @Override public boolean mailValidation(String mail) { String regex = "^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@"+"[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$"; Pattern p = Pattern.compile(regex); if (mail == null) { return false; } Matcher m = p.matcher(mail); return m.matches(); } @Override public boolean nameValidation(String name) { if(name != null) { if(name.length() < 2) { System.out.println("Geçersiz isim"); return false; } else { return true; } } else { return false; } } @Override public boolean surnameValidation(String surname) { if(surname != null) { if(surname.length() < 2) { System.out.println("Geçersiz soyisim"); return false; } else { return true; } } else { return false; } } @Override public boolean isClickedValidation(boolean isClicked) { return isClicked; } }
[ "koseirem1@gmail.com" ]
koseirem1@gmail.com
139053c064e558e15d42fd8ae85e2d9a0646312d
b6d1e392dda206e44aee1b1668c3d6afbf2c980c
/processing-app/src/main/java/turingpatterns/TuringPatternApplet.java
3b5518f6d5ada17a61da2d1dd36efb340abd6883
[]
no_license
eli-jordan/generative-art
fa1af12695db14e67f40c3c144e1ace882ae848a
b06596f9472a3a4caa2706541aa278708cd3874a
refs/heads/master
2023-05-09T10:50:58.778688
2021-03-17T22:44:23
2021-03-17T22:44:23
322,738,379
1
0
null
2021-04-05T21:11:50
2020-12-19T00:57:23
Java
UTF-8
Java
false
false
3,118
java
package turingpatterns; import processing.core.PApplet; import turingpatterns.config.ConfigPersistence; import turingpatterns.config.RunConfig; import turingpatterns.config.ScaleConfig; import java.io.File; import java.util.ArrayList; import java.util.List; /** * Base class that interprets the {{@link RunConfig}} renders the frames and saves both the configuration * and the frames to disk. * <p> * To define the runConfig, extend this class and in the constructor set the `runConfig` attribute. * This can be either loaded from disk using {{@link ConfigPersistence#load(File)}} or dynamically generated * in any other way. */ public abstract class TuringPatternApplet extends PApplet { /* The configuration for this run. Should be set in the constructor of a subclass*/ protected RunConfig runConfig; /* Used to render the grid to the screen */ private Renderer renderer; /* Persistence helper used to load and store the RunConfig */ private ConfigPersistence persistence; private long startTs; @Override public final void settings() { this.startTs = System.currentTimeMillis(); // Save the configuration this.persistence = new ConfigPersistence(this.getClass().getSimpleName()); this.persistence.save(this.runConfig); println("Run configuration and render frames will be saved in: " + this.persistence.saveDir()); size(runConfig.width, runConfig.height); // Set the random and noise seeds, so we can recreate the randomness of a goods run randomSeed(runConfig.randomSeed); noiseSeed(runConfig.noiseSeed); // Initialise the grid and renderer Grid grid = createGrid(); if (runConfig.renderer == RunConfig.RenderType.Colour) { this.renderer = new ColourRenderer(grid, new Colours(this)); } else if (runConfig.renderer == RunConfig.RenderType.Grayscale) { this.renderer = new GrayscaleRenderer(grid); } else { throw new IllegalStateException("Unrecognised RenderType: " + runConfig.renderer); } } private Grid createGrid() { Grid.Builder builder = Grid.newBuilder(this); if (runConfig.coupling == RunConfig.ScaleCoupling.MultiScale) { builder.scaleCoupling(Grid::multiScaleDelta); } else if (runConfig.coupling == RunConfig.ScaleCoupling.Compound) { builder.scaleCoupling(Grid::compoundScaleDelta); } else { throw new IllegalStateException("Unrecognised ScaleCoupling: " + runConfig.coupling); } List<Scale> scales = new ArrayList<>(); for (ScaleConfig c : runConfig.scales) { scales.add(new Scale(c)); } builder.scales(scales); return builder.build(); } @Override public void draw() { this.renderer.draw(this); if (frameCount % 10 == 0) { long runTime = System.currentTimeMillis() - this.startTs; println("Frame Rate: " + frameRate + ", Frame Count: " + frameCount + ", Running Time: " + runTime + " ms"); } saveFrame(this.persistence.saveDir().getAbsolutePath() + "/frame-#####.png"); } }
[ "elias.jordan@tapad.com" ]
elias.jordan@tapad.com
3478e65255a0205ab964251ea372eb8eecd57a30
6ba54d3ee34f7bb20a0ad6164b7de098bfb77a5c
/src/Transaction/InterBranchTransfer.java
a9d91766330a1bbb6b323e4d5d8def347abd08ec
[]
no_license
keepYourHairOn/BankSystem
e467b6d05ee6332f70e94f9ecbaa5fcbf3437b60
bde512f7ebc8c0028e0159ff8681247bd1e2c4b7
refs/heads/master
2020-05-31T14:47:40.643417
2015-07-27T13:19:30
2015-07-27T13:19:30
39,700,226
0
0
null
null
null
null
UTF-8
Java
false
false
1,758
java
package Transaction; import Accounts.Account; import java.util.Date; /** * Created by Admin on 26.07.2015. */ public class InterBranchTransfer extends Transaction { private Double transfer; private Double balance1; private Double balance2; private String transaction; private Transaction_types type = Transaction_types.Transfer; /** * constructor with parameters * * @param transfer is transfer to add to the balance2 from the balance1 */ public InterBranchTransfer(double transfer, Account type1, Account type2) { this.transfer = transfer; this.firstAccount = type1; this.secondAccount = type2; this.balance1 = firstAccount.getBalance(); this.balance2 = secondAccount.getBalance(); this.firstAccountBranch = firstAccount.getBranch(); this.secondAccountBranch = secondAccount.getBranch(); this.date = new Date(); } @Override public void description() { System.out.println("Transferring of the money between two accounts of different branches."); } @Override public void makeTransaction() { if (transfer <= balance1 && transfer > 0) { balance1 -= transfer; balance2 += transfer; isValid = true; transaction = "Transfer: " + transfer + " rubles. From: " + firstAccount.getId() + " To: " + secondAccount.getId(); this.firstAccount.addTransaction(this); this.secondAccount.addTransaction(this); System.out.println("Transfer operation between two branches complete successfully!"); } else { this.isValid = false; System.out.println("Transferring operation failure!"); } } }
[ "sofia-ne@ukr.net" ]
sofia-ne@ukr.net
4c769496e57caec393f62e904223f225a3a1b801
85a2d89c2c2a2908b67312c47b73b16fe58c5b58
/src/main/java/com/cheatbreaker/nethandler/server/CBPacketServerRule.java
d2daa1cc91090f2968c85aa84a19c3614469cd06
[]
no_license
CoOwner/CheatBreakerAPINetHandler
60f92479f34d65eba06c4c30459f5f0ce78f0ade
0f2222f8ada77da1a6d4d1ec431e1335b62ec570
refs/heads/master
2022-09-13T21:40:56.815361
2020-05-23T19:21:08
2020-05-23T19:21:08
266,401,321
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
package com.cheatbreaker.nethandler.server; import com.cheatbreaker.nethandler.obj.*; import java.io.*; import com.cheatbreaker.nethandler.*; import com.cheatbreaker.nethandler.client.*; public class CBPacketServerRule extends CBPacket { private ServerRule rule; private int intValue; private float floatValue; private boolean booleanValue; private String stringValue; public CBPacketServerRule() { this.stringValue = ""; } public CBPacketServerRule(ServerRule rule, float value) { this(rule); this.floatValue = value; } public CBPacketServerRule(ServerRule rule, boolean value) { this(rule); this.booleanValue = value; } public CBPacketServerRule(ServerRule rule, int value) { this(rule); this.intValue = value; } public CBPacketServerRule(ServerRule rule, String value) { this(rule); this.stringValue = value; } private CBPacketServerRule(ServerRule rule) { this.stringValue = ""; this.rule = rule; } @Override public void write(ByteBufWrapper b) throws IOException { b.writeString(this.rule.getRule()); b.buf().writeBoolean(this.booleanValue); b.buf().writeInt(this.intValue); b.buf().writeFloat(this.floatValue); b.writeString(this.stringValue); } @Override protected byte[] readBlob(ByteBufWrapper b) { return super.readBlob(b); } @Override public void read(ByteBufWrapper b) throws IOException { this.rule = ServerRule.getRule(b.readString()); this.booleanValue = b.buf().readBoolean(); this.intValue = b.buf().readInt(); this.floatValue = b.buf().readFloat(); this.stringValue = b.readString(); } @Override public void process(ICBNetHandler handler) { ((ICBNetHandlerClient)handler).handleServerRule(this); } public ServerRule getRule() { return this.rule; } public int getIntValue() { return this.intValue; } public float getFloatValue() { return this.floatValue; } public boolean isBooleanValue() { return this.booleanValue; } public String getStringValue() { return this.stringValue; } }
[ "david@orbit.games" ]
david@orbit.games
7ba6bb86ca6ab9613ce35884d51b5aaec475214c
0df0c0b3de1c817529a7147cb731301070fe30fc
/Dynamic Programming/PartitionSetIntoKSubsets.java
0ebb65d60b5826fe369614e3b68ae818827268ed
[]
no_license
utkarsh2827/Practice
255572c774d5b7ea5efffef110fe974ede62dae0
dddf1c69763efcb34716fa9c5b384ab8669b68fa
refs/heads/master
2022-11-24T16:57:53.318031
2020-08-03T18:22:11
2020-08-03T18:22:11
272,504,874
3
0
null
null
null
null
UTF-8
Java
false
false
918
java
import java.util.*; public class PartitionSetIntoKSubsets { public static void print(String msg){ System.out.print(msg); } public static int partitionRecursive(int n, int k){ if(k==1||n==k){ return 1; } return k*partitionRecursive(n-1,k) + partitionRecursive(n-1,k-1); } public static int partitionDP(int n, int k){ int dp[][] = new int[n+1][k+1]; for(int i = 1;i<=n;i++){ for(int j =1;j<=k;j++){ if(j==1||j==i){ dp[i][j] = 1; } else{ dp[i][j] = j*dp[i-1][j] + dp[i-1][j-1]; } } } return dp[n][k]; } public static void main(String args[]) { Scanner sc = new Scanner(System.in); print("Enter n and k:\n"); int n = sc.nextInt(); int k = sc.nextInt(); print("Recursive Approach Answer:\n" + partitionRecursive(n,k)+"\n"); print("Dynamic Programming Approach Answer:\n" + partitionDP(n,k)+"\n"); } }
[ "prateek.nigam.581@gmail.com" ]
prateek.nigam.581@gmail.com
671bf69db242ea5bf794e484a894e6de8f634dc6
c387a1ee41763a0409e8dc89c93be29675253ad1
/app/services/utils/swagger/parser/processors/OperationProcessor.java
e2db5c32d7169a0adca3474edb46054a66af9c72
[ "Apache-2.0" ]
permissive
RainYang0925/ApiIntelligenceRobot
e0cbe2018c732d2800d83783d1446ecc39cb0c7a
ed366f421c9bb46b6af08aab60573033533cc457
refs/heads/master
2020-04-05T23:38:00.492043
2016-06-14T01:32:13
2016-06-14T01:32:13
61,084,352
1
0
null
2016-06-14T02:12:20
2016-06-14T02:12:20
null
UTF-8
Java
false
false
1,918
java
package services.utils.swagger.parser.processors; import models.apis.swagger.Operation; import models.apis.swagger.RefResponse; import models.apis.swagger.Response; import models.apis.swagger.Swagger; import models.apis.swagger.parameters.Parameter; import services.utils.swagger.parser.ResolverCache; import java.util.List; import java.util.Map; public class OperationProcessor { private final ParameterProcessor parameterProcessor; private final ResponseProcessor responseProcessor; private final ResolverCache cache; public OperationProcessor(ResolverCache cache, Swagger swagger) { this.cache = cache; parameterProcessor = new ParameterProcessor(cache, swagger); responseProcessor = new ResponseProcessor(cache, swagger); } public void processOperation(Operation operation) { final List<Parameter> processedOperationParameters = parameterProcessor.processParameters(operation.getParameters()); operation.setParameters(processedOperationParameters); final Map<String, Response> responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { Response response = responses.get(responseCode); if(response != null) { if (response instanceof RefResponse) { RefResponse refResponse = (RefResponse) response; Response resolvedResponse = cache.loadRef(refResponse.get$ref(), refResponse.getRefFormat(), Response.class); if (resolvedResponse != null) { response = resolvedResponse; responses.put(responseCode, resolvedResponse); } } responseProcessor.processResponse(response); } } } } }
[ "806833417@qq.com" ]
806833417@qq.com
96a7bda4d4a0ae933f61cee54d9ba457a113b09e
26f0641351364e75ac57c58cf46a3d74506448d2
/src/main/java/com/cinchapi/common/base/Verify.java
36dcce66fb2b83136f800d803143ba3ee4b4b8bf
[ "Apache-2.0" ]
permissive
cinchapi/accent4j
d8344276b6aefb30da2cf865cfae3da8a40488de
5c46676bab6283f7b19f185687b54bdf62b25516
refs/heads/develop
2022-10-04T04:17:35.506694
2022-10-01T20:20:48
2022-10-01T20:22:46
47,751,504
9
4
Apache-2.0
2021-08-30T19:35:30
2015-12-10T09:28:48
Java
UTF-8
Java
false
false
5,825
java
/* * Copyright (c) 2015 Cinchapi Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cinchapi.common.base; /** * A collection of functions to either successfully verify a condition or throw * an exception. * * @author Jeff Nelson */ public final class Verify { /** * Verify that {@code object} is {@link Class#isAssignableFrom(Class) an * instance of} {@code type} or throw a {@link ClassCastException}. * <p> * <h2>Example</h2> * * <pre> * Verify.isType(new ArrayList&lt;Object&gt;(), List.class); // does nothing * Verify.isType(new ArrayList&lt;Object&gt;(), Set.class); // throws ClassCastException * </pre> * * </p> * * @param object the object to check * @param type the expected {@link Class type} or super type for * {@code object} */ public static void isType(Object object, Class<?> type) { isType(object, type, null); } /** * Verify that {@code object} is {@link Class#isAssignableFrom(Class) an * instance of} {@code type} or throw a {@link ClassCastException}. * <p> * <h2>Example</h2> * * <pre> * Verify.isType(new ArrayList&lt;Object&gt;(), List.class); // does nothing * Verify.isType(new ArrayList&lt;Object&gt;(), Set.class); // throws ClassCastException * </pre> * * </p> * * @param object the object to check * @param type the expected {@link Class type} or super type for * {@code object} * @param errorMsgTemplate the template for the error message; see * {@link AnyStrings#format(String, Object...)} for more * information * @param errorMsgArgs the values to inject in the {@code errorMsgTemplate} * placeholders; see {@link AnyStrings#format(String, Object...)} * for more information */ public static void isType(Object object, Class<?> type, String errorMsgTemplate, Object... errorMsgArgs) { if(!type.isAssignableFrom(object.getClass())) { throw new ClassCastException(AnyStrings.format(errorMsgTemplate, errorMsgArgs)); } } /** * Verify the truth of {@code condition} or throw an * {@link IllegalStateException}. * <p> * <h2>Example</h2> * * <pre> * Verify.that(1 < 2); //does nothing * Verify.that(1 > 2); throws IllegalStateException * </pre> * * </p> * * @param condition the condition that should be {@code true} * @throws IllegalStateException if {@code condition} is false */ public static void that(boolean condition) { that(condition, null); } /** * Verify the truth of the {@code condition} or throw an * {@link IllegalStateException}. * <p> * <h2>Example</h2> * * <pre> * Verify.that(1 < 2); //does nothing * Verify.that(1 > 2); throws IllegalStateException * Verify.that(1 > 2, &quot;{} is not greater than {}&quot;, 1, 2); //throws IllegalStateException * </pre> * * </p> * * @param condition the condition that should be {@code true} * @param errorMsgTemplate the template for the error message; see * {@link AnyStrings#format(String, Object...)} for more * information * @param errorMsgArgs the values to inject in the {@code errorMsgTemplate} * placeholders; see {@link AnyStrings#format(String, Object...)} * for more information * @throws IllegalStateException if {@code condition} is false */ public static void that(boolean condition, String errorMsgTemplate, Object... errorMsgArgs) { if(!condition) { throw new IllegalStateException(AnyStrings.format(errorMsgTemplate, errorMsgArgs)); } } /** * Verify the truth of the {@code condition} about a method argument or * throw an {@link IllegalArgumentException}. * * @param condition the condition that should be {@code true} * @throws IllegalArgumentException if {@code condition} is false */ public static void thatArgument(boolean condition) { thatArgument(condition, null); } /** * Verify the truth of the {@code condition} about a method argument or * throw an {@link IllegalArgumentException}. * * @param condition the condition that should be {@code true} * @param errorMsgTemplate the template for the error message; see * {@link AnyStrings#format(String, Object...)} for more * information * @param errorMsgArgs the values to inject in the {@code errorMsgTemplate} * placeholders; see {@link AnyStrings#format(String, Object...)} * for more information * @throws IllegalArgumentException if {@code condition} is false */ public static void thatArgument(boolean condition, String errorMsgTemplate, Object... errorMsgArgs) { if(!condition) { throw new IllegalArgumentException(AnyStrings.format( errorMsgTemplate, errorMsgArgs)); } } private Verify() {/* noinit */} }
[ "jeff@cinchapi.com" ]
jeff@cinchapi.com
331838aca0844e07e8119ac74e1dc7334b39d43a
18255c44223aad737d3634a015ac7af7b69ef636
/Jar and database/Computer.java
99faa3e2d5fa88cfd356316ab707e138ac3c830b
[]
no_license
emontag/Software_Engineering_Group
1c050642b276d2d9856408deacec2fa45aefc19c
96b384424497aef48154646c3e31450124fced30
refs/heads/master
2020-12-31T07:43:58.155098
2016-04-19T20:13:40
2016-04-19T20:13:40
56,628,513
1
0
null
null
null
null
UTF-8
Java
false
false
148
java
public class Computer extends Player{ public int getScore(){ return scores; } public void setScore(int s){ scores+=s; } }
[ "ephraim443@gmil.com" ]
ephraim443@gmil.com
75dc00b882aa16d5747667cb593fdaa5b633f5f6
7df9f85fd021ab4c4b634b1ccd493f17fe3ab78e
/app/src/main/java/com/rachad/alarmmangerservice/MyReceiverAlarmManger.java
8cf67cc336361d8ab24e54f749e2c8aceb923aab
[]
no_license
rachadaccoumeh/alarm-manger-service
861ae6e8236e199e906c31139a47409599089aff
648449006bd4fec768d22bc5cc117775c39d1d97
refs/heads/master
2023-06-09T14:50:50.914584
2021-06-27T13:10:12
2021-06-27T13:10:12
361,427,250
0
0
null
null
null
null
UTF-8
Java
false
false
2,443
java
package com.rachad.alarmmangerservice; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import android.os.Build; import androidx.core.app.NotificationCompat; public class MyReceiverAlarmManger extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { createNotificationChaneel(context); Intent intent1 = new Intent(context, MyService.class); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { context.startForegroundService(intent1); } else { context.startService(intent1); } /*Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(2 * 1000);*/ } private void notify(Context context) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0); Notification notification = new NotificationCompat.Builder(context,"ChannelId2") .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(context.getString(R.string.app_name)) .setStyle(new NotificationCompat.BigTextStyle().bigText("work")) .setContentText("work") .setAutoCancel(true) .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) .setContentIntent(contentIntent).build(); notificationManager.notify(147, notification); } private void createNotificationChaneel(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationChannel notificationChannel = new NotificationChannel("ChannelId2", "Foreground Notification", NotificationManager.IMPORTANCE_DEFAULT); NotificationManager manager = context.getSystemService(NotificationManager.class); manager.createNotificationChannel(notificationChannel); } notify(context); } }
[ "rachadaccoumeh@gmail.com" ]
rachadaccoumeh@gmail.com
dace6c9e54f7db658888e95114cd6a9807930e81
80539b3a04bae27c5a67a37a2decdda1abe8a496
/src/Gameplay.java
8cb8c9c14a9aa7d2e208f4bfc20dc79d114907fe
[]
no_license
mayank241995/2Dsnakes
16693c5e5e49f56950faefeffad537638a13110c
a889aefc6c51c43dacd8bf303dcb9ccb59b6306e
refs/heads/master
2020-03-07T07:14:15.880781
2019-01-25T08:06:17
2019-01-25T08:06:17
127,343,921
0
0
null
null
null
null
UTF-8
Java
false
false
6,834
java
import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.swing.Timer; public class Gameplay extends JPanel implements KeyListener,ActionListener{ private int[] snakexlength = new int [750]; private int[] snakeylength = new int [750]; private boolean left=false; private boolean right=false; private boolean up=false; private boolean down=false; private ImageIcon rightmouth; private ImageIcon upmouth; private ImageIcon downmouth; private ImageIcon leftmouth; private int lengthofsnake = 3; private Timer timer; private int delay=100; private ImageIcon snakeimage; private int [] enemyxpos={25,50,75,100,125,150,175,200,225,250,300,325,350,375, 400,425,450,475,500,525,550,575,600,625,650,675,700,725, 750,775,800,825,850}; private int [] enemyypos={75,100,125,150,175,200,225,250,275,300,325,350, 375,400,425,450,475,500,525,575,600,625}; private ImageIcon enemyimage; private Random random = new Random(); private int xpos = random.nextInt(34); private int ypos = random.nextInt(23); private int score=0; private int moves = 0; private ImageIcon titleImage; public Gameplay() { addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); timer = new Timer (delay,this); timer.start(); } public void paint (Graphics g) { if(moves ==0) { snakexlength[2]=50; snakexlength[1]=75; snakexlength[0]=100; snakeylength[2]=100; snakeylength[1]=100; snakeylength[0]=100; } //draw the image border g.setColor(Color.white); g.drawRect(24, 10, 851, 55); //DRAW THE TITLE IMAGE titleImage =new ImageIcon("snaketitle.jpg"); titleImage.paintIcon(this, g, 25, 11); //draw the border for gameplay g.setColor(Color.white); g.drawRect(24, 74, 851, 577); //draw the background for the gameplay g.setColor(Color.black); g.fillRect(24, 74, 850, 575); //draw the score g.setColor(Color.white); g.setFont(new Font("arial", Font.PLAIN, 14)); g.drawString("Scores: "+score, 780,30); //draw length g.setColor(Color.white); g.setFont(new Font("arial", Font.PLAIN, 14)); g.drawString("Length: "+lengthofsnake, 780,50); rightmouth = new ImageIcon("rightmouth.png"); rightmouth.paintIcon(this, g,snakexlength[0] ,snakeylength[0]); for (int a=0 ;a< lengthofsnake;a++ ) { if (a==0&& right) { rightmouth = new ImageIcon("rightmouth.png"); rightmouth.paintIcon(this, g,snakexlength[a] ,snakeylength[a]); } if (a==0&& left) { leftmouth = new ImageIcon("leftmouth.png"); leftmouth.paintIcon(this, g,snakexlength[a] ,snakeylength[a]); } if (a==0&& down) { downmouth = new ImageIcon("downmouth.png"); downmouth.paintIcon(this, g,snakexlength[a] ,snakeylength[a]); } if (a==0&& up) { upmouth = new ImageIcon("upmouth.png"); upmouth.paintIcon(this, g,snakexlength[a] ,snakeylength[a]); } if(a!=0) { snakeimage = new ImageIcon("snakeimage.png"); snakeimage.paintIcon(this, g,snakexlength[a] ,snakeylength[a]); } } enemyimage = new ImageIcon("enemy.png"); if((enemyxpos[xpos]==snakexlength[0]&& enemyypos[ypos]==snakeylength[0])) { score++; lengthofsnake++; xpos = random .nextInt(34); ypos = random.nextInt(23); } enemyimage.paintIcon(this, g, enemyxpos[xpos], enemyypos[ypos]); for(int b=1;b<lengthofsnake;b++) { if(snakexlength[b] == snakexlength[0]&&snakeylength[b] == snakeylength[0]) { right=false; left=false; up=false; down=false; g.setColor(Color.white); g.setFont(new Font("arial",Font.BOLD ,50)); g.drawString("Game over", 300, 300); g.setFont(new Font("arial",Font.BOLD ,20)); g.drawString("Restart Game", 350, 340); } } g.dispose(); } @Override public void actionPerformed(ActionEvent e) { timer.start(); if(right) { for(int r = lengthofsnake-1; r>=0;r--) { snakeylength[r+1] = snakeylength[r]; } for(int r = lengthofsnake; r>=0;r--) //logic { if(r==0) { snakexlength[r] = snakexlength[r]+25; } else { snakexlength[r]=snakexlength[r-1]; } if(snakexlength[r]>850) { snakexlength[r]=25; } } repaint(); } if(left) { for(int r = lengthofsnake-1; r>=0;r--) { snakeylength[r+1] = snakeylength[r]; } for(int r = lengthofsnake; r>=0;r--) { if(r==0) { snakexlength[r] = snakexlength[r]-25; } else { snakexlength[r]=snakexlength[r-1]; } if(snakexlength[r]<25) { snakexlength[r]=850; } } repaint(); } if(up) { for(int r = lengthofsnake-1; r>=0;r--) { snakexlength[r+1] = snakexlength[r]; } for(int r = lengthofsnake; r>=0;r--) { if(r==0) { snakeylength[r] = snakeylength[r]-25; } else { snakeylength[r]=snakeylength[r-1]; } if(snakeylength[r]<75) { snakeylength[r]=625; } } repaint(); } if(down) { for(int r = lengthofsnake-1; r>=0;r--) { snakexlength[r+1] = snakexlength[r]; } for(int r = lengthofsnake; r>=0;r--) { if(r==0) { snakeylength[r] = snakeylength[r]+25; } else { snakeylength[r]=snakeylength[r-1]; } if(snakeylength[r]>625) { snakeylength[r]=75; } } repaint(); } } @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_SPACE) { moves=0; score=0; lengthofsnake=3; repaint(); } if(e.getKeyCode()==KeyEvent.VK_RIGHT) { moves++; right =true; if(!left) { right=true; } else { right=false; left=true; } up =false; down =false; } if(e.getKeyCode()==KeyEvent.VK_LEFT) { moves++; left =true; if(!right) { left=true; } else { left=false; right=true; } up =false; down =false; } if(e.getKeyCode()==KeyEvent.VK_UP) { moves++; up =true; if(!down) { up=true; } else { up=false; down=true; } left =false; right=false; } if(e.getKeyCode()==KeyEvent.VK_DOWN) { moves++; down =true; if(!up) { down=true; } else { up=true; down=false; } right=false; left =false; } } @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } @Override public void keyTyped(KeyEvent e) { // TODO Auto-generated method stub } }
[ "noreply@github.com" ]
noreply@github.com
70d74a5b86a641fbb573027d2c8da0cfef2bb80b
facd5c2f30543d137275a81f6f27fe8348cc5125
/team7/src/web/PhotoViewServlet.java
d5e08bdb6112eed0b039d51fc67960d11ed6a12b
[]
no_license
soviet2/team7
4d1f468d7950c49e12b96848de10c46e759420d3
856e8e86ea1ae206f27c0a7ed45504c246ed2359
refs/heads/master
2021-01-15T17:14:26.163134
2016-06-12T03:48:15
2016-06-12T03:48:15
null
0
0
null
null
null
null
UHC
Java
false
false
1,723
java
package web; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.sql.*; public class PhotoViewServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); String id = request.getParameter("ID"); String photoname = photoview(id); String photo = "photo/" + photoname; RequestDispatcher dispatcher = request.getRequestDispatcher("PhotoViewer.jsp"); request.setAttribute("PHOTO", photo); dispatcher.forward(request, response); } private String photoview(String id) throws ServletException { Connection conn = null; Statement stmt = null; try { Class.forName("org.apache.commons.dbcp.PoolingDriver"); Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:/wdbpool"); if (conn == null) throw new Exception("데이터베이스에 연결할 수 없습니다."); stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select photo from memberinfo where id='" + id + "';"); if (!rs.next()) return null; String photoname = rs.getString("photo"); return photoname; } catch (Exception e) { throw new ServletException(e); } finally { try { stmt.close(); } catch (Exception ignored) { } try { conn.close(); } catch (Exception ignored) { } } } }
[ "yisukimc@gmail.com" ]
yisukimc@gmail.com
a6622a379ad4d06e95832798ea7ad4a7e6d2db45
b44d294591310b661f092e30ae6b785bfc9a2389
/src/main/java/com/looseboxes/cometd/chatservice/initializers/ChatServerInitializer.java
76f924424f52fa23cf9e7b368f6883d4a1804fe0
[]
no_license
poshjosh/cometdchatservice
a159b67992b0218cbd5d34e9148fa60be652c908
0a1b012bdc74b64bdc6d35a46dd09ecc0d1d3857
refs/heads/master
2020-12-20T11:49:20.535625
2020-04-04T01:01:24
2020-04-04T01:01:24
236,065,252
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
/* * Copyright 2020 looseBoxes.com * * Licensed under the looseBoxes Software License (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.looseboxes.com/legal/licenses/software.html * * 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.looseboxes.cometd.chatservice.initializers; import org.cometd.bayeux.server.BayeuxServer; /** * @author USER */ public interface ChatServerInitializer{ void init(BayeuxServer bayeux); }
[ "posh.bc@gmail.com" ]
posh.bc@gmail.com
8e68ea095c5f7b3b8c97c3870ed653f72e86ca69
ca18124b162b134c392376dccf1656bdb1b11efa
/src/main/java/online/starlex/hospital/entity/DrugInfo.java
5232267a044f0171f1ab1c28f2d86492c153e34e
[]
no_license
StarlexAtlas/hospital_bk
0525cec93249d76cd2787ebcbe73aaee6fb245f8
eb851f1106450b9a65c69ab7873ebee71d6ced1b
refs/heads/master
2023-02-06T11:09:04.736388
2020-12-28T14:40:20
2020-12-28T14:40:20
325,035,314
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package online.starlex.hospital.entity; import javax.persistence.*; @Table @Entity(name = "drug_info") public class DrugInfo { @Id @Column(name = "drug_code", columnDefinition = "bigint") private long drugCode; @Column(name = "drug_name", columnDefinition = "varchar(255)") private String drugName; @Column(name = "specification", columnDefinition = "varchar(255)") private String specification; @Column(name = "company", columnDefinition = "varchar(255)") private String company; @Column(name = "form", columnDefinition = "varchar(255)") private String form; public long getDrugCode() { return drugCode; } public void setDrugCode(long drugCode) { this.drugCode = drugCode; } public String getDrugName() { return drugName; } public void setDrugName(String drugName) { this.drugName = drugName; } public String getSpecification() { return specification; } public void setSpecification(String specification) { this.specification = specification; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public String getForm() { return form; } public void setForm(String form) { this.form = form; } }
[ "201800301032@mail.sdu.edu.cn" ]
201800301032@mail.sdu.edu.cn
ab0bc399427c723994e5ad88ded67c9d45390910
210c05a189d46754f615c0f2bf1031bab83bd04e
/Web/src/com/tao/location/model/LocationDAO_interface.java
af76c052381d90531623cc924d97e1fc370e5f7a
[]
no_license
hand79/iii_TAO_Puzzle
7750287c7f08be8fa56665800527f8bb32e9cf60
ce9e91538b413bd347104ab4a70313ba2947d415
refs/heads/master
2021-01-21T07:54:20.159097
2016-09-18T16:36:37
2016-09-18T16:36:37
68,525,975
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.tao.location.model; import java.util.List; public interface LocationDAO_interface { public LocationVO findByPrimaryKey(Integer locno); public List<LocationVO> getAll(); public List<String[]> getUniqCounty(); public List<String[]> getMatchedTowns(String countyRange); }
[ "maxdjkl@gmail.com" ]
maxdjkl@gmail.com
63d0b61e6eecb946e293b9f5e07b029db6208f2c
023dbba0118c2fbc12169fba5002a7beb638bb8a
/app/src/main/java/com/example/ankush/hackathon/Class10streams.java
e04b004c74b9737271ecb55b13c67cba894a7352
[ "MIT" ]
permissive
Rawkush/Career_Counselling_app
67538033e3a9c27d602b768514f78f4ab7906eab
09d88d1990030e12171f563ba2a6393fbb8e5213
refs/heads/master
2021-04-06T14:23:09.969877
2020-12-14T09:46:34
2020-12-14T09:46:34
124,768,869
5
6
MIT
2018-10-05T06:55:59
2018-03-11T15:12:38
Java
UTF-8
Java
false
false
1,433
java
package com.example.ankush.hackathon; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; public class Class10streams extends AppCompatActivity { private TextView btn1,btn2,btn3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.class10streams); btn1 = (TextView) findViewById(R.id.text1); btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Class10streams.this,coursexplation.class); startActivity(i); } }); btn2 = (TextView) findViewById(R.id.text2); btn2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Class10streams.this,coursexplation.class); startActivity(i); } }); btn3 = (TextView) findViewById(R.id.text8); btn3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(Class10streams.this,coursexplation.class); startActivity(i); } }); } }
[ "ankushrawat950@gmail.com" ]
ankushrawat950@gmail.com
c27e776631b23f2e6a728c30e8df691872443dd4
c81bacaf8e63c7a04be90beb85b3dd35b5dbaa5a
/src/main/java/com/workhardkj/repositories/TodoRepository.java
a31261fce9b37c3bf03f0bc7caca36301d3cdfaa
[]
no_license
kyle-judd/todo-list
9840a1c9abbb442019b69b0e3f83fd8ef9f783c5
4ec4842db0454aa8a48d85139ed79bee3db53ccc
refs/heads/master
2021-05-21T22:37:37.070883
2020-04-21T01:23:27
2020-04-21T01:23:27
252,835,662
0
0
null
null
null
null
UTF-8
Java
false
false
230
java
package com.workhardkj.repositories; import org.springframework.data.jpa.repository.JpaRepository; import com.workhardkj.entity.Todo; public interface TodoRepository extends JpaRepository<Todo, Long>, TodoRepositoryCustom { }
[ "juddkyle1408@gmail.com" ]
juddkyle1408@gmail.com
2c4c2e45625c4837ba9e4c56cc2dbf920eac262c
e2cd2d66a27dd8661810ef80785e683bdc7817f6
/nzsproject/src/main/java/com/needmall/admin/user/controller/UserController.java
56b0854c8304a0ace8b05544a16a90d690ab6dc5
[]
no_license
needmall/data
3d2aed5ea45303bcc824b17c13857198cadb2f39
f646aec46e927ddbaa666e4f280dbe654f1f2196
refs/heads/master
2020-03-26T07:42:40.778859
2018-09-17T04:35:11
2018-09-17T04:35:11
144,667,138
1
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package com.needmall.admin.user.controller; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import com.needmall.admin.user.service.UserService; import com.needmall.common.vo.CustomerVO; import com.needmall.common.vo.SellerVO; @Controller @RequestMapping(value="/admin/user") public class UserController { Logger logger = Logger.getLogger(UserController.class); @Autowired private UserService userService; /** * customerList : 고객 리스트 * @param cvo * @param model * @return */ @RequestMapping(value="/customerList.do",method=RequestMethod.GET) public String customerList(Model model) { logger.info("customerList 호출 성공"); List<CustomerVO> list = userService.customerList(); model.addAttribute("customerList", list); return "admin/user/customerList"; } /** * userList : 셀러 리스트 * @param prvo * @param model * @return */ @RequestMapping(value="/sellerList.do",method=RequestMethod.GET) public String sellerList( Model model) { logger.info("sellerList 호출 성공"); List<SellerVO> list = userService.sellerList(); model.addAttribute("sellerList", list); return "admin/user/sellerList"; } }
[ "trustray7@gmail.com" ]
trustray7@gmail.com
b48a3ec5c64089be1dcd2149c34a16e7d4ec4e63
a48b1b3841c1048cea86d6e34211ccadbf8978ad
/src/main/java/multithreading/concurrencyTools/locks/reentrantLockCondition/example/Consumer.java
d96b20cfd8bd979c7bf87561b752d1bbc36280fb
[]
no_license
BaranovAndrey99/multithreading
e2b9822d3a5aa8fa03080f42bf139c91d2e6ed21
13d43cf21d157d28d681a315c1b2d875a711a6b9
refs/heads/master
2020-08-10T20:32:00.296335
2019-10-11T11:09:54
2019-10-11T11:09:54
214,415,161
0
1
null
null
null
null
UTF-8
Java
false
false
457
java
package multithreading.concurrencyTools.locks.reentrantLockCondition.example; public class Consumer implements Runnable { private Store store; public Consumer(Store store) { this.store = store; } @Override public void run() { for(int i = 0; i < 5; i++) { try { store.get(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
[ "pishipismodrug@gmail.com" ]
pishipismodrug@gmail.com
ffebba376bbd8306bddd694dfb3c7f0d027b33f3
bc05504a99acc49e7cf6b62b6c87be4d4394c7e7
/src/emitter/EmitterMesh.java
a45ca3ece501429eb1d25efb85caf7a0a6b2651e
[]
no_license
dingyf0523/tonegodemitter
dd591e6dbba5d5cae3c3465e627d060387ac1830
c0b1ddf0369659fd894b071be7beb72aebc638c9
refs/heads/master
2021-01-10T12:04:57.176426
2014-02-17T00:41:47
2014-02-17T00:41:47
45,771,194
0
0
null
null
null
null
UTF-8
Java
false
false
6,111
java
package emitter; import com.jme3.math.FastMath; import com.jme3.math.Quaternion; import com.jme3.math.Triangle; import com.jme3.math.Vector3f; import com.jme3.scene.Mesh; import com.jme3.scene.Node; /** * * @author t0neg0d */ public class EmitterMesh { public static enum DirectionType { Normal, NormalNegate, Random, RandomTangent, RandomNormalAligned, RandomNormalNegate } private Mesh mesh; private int triangleIndex; private Triangle triStore = new Triangle(); Vector3f p1 = new Vector3f(); Vector3f p2 = new Vector3f(); Vector3f p3 = new Vector3f(); Vector3f a = new Vector3f(); Vector3f b = new Vector3f(); Vector3f result = new Vector3f(); Node p = new Node(), n1 = new Node(), n2 = new Node(), n3 = new Node(); private int triCount; private int currentTri = 0; Emitter emitter; // Geometry geom = new Geometry(); Quaternion q = new Quaternion(), q2 = new Quaternion(); Vector3f tempDir = new Vector3f(); Vector3f up = new Vector3f(); Vector3f left = new Vector3f(); // DirectionType directionType = DirectionType.Normal; /** * Sets the mesh to use as the emitter shape * @param mesh The mesh to use as the emitter shape */ public void setShape(Emitter emitter, Mesh mesh) { this.emitter = emitter; this.mesh = mesh; // geom.setMesh(mesh); triCount = mesh.getTriangleCount(); p.attachChild(n1); p.attachChild(n2); p.attachChild(n3); } /** * Returns the mesh used as the particle emitter shape * @return The particle emitter shape mesh */ public Mesh getMesh() { return this.mesh; } /* public void setDirectionType(DirectionType directionType) { this.directionType = directionType; } public DirectionType getDirectionType() { return this.directionType; } */ /** * Selects a random face as the next particle emission point */ public void setNext() { if (emitter.getUseSequentialEmissionFace()) { if (emitter.getUseSequentialSkipPattern()) currentTri += 2; else currentTri++; if (currentTri >= triCount) currentTri = 0; triangleIndex = currentTri; } else { triangleIndex = FastMath.rand.nextInt(triCount); } mesh.getTriangle(triangleIndex, triStore); calcTransform(); triStore.calculateCenter(); triStore.calculateNormal(); } /** * Set the current particle emission face to the specified faces index * @param triangleIndex The index of the face to set as the particle emission point */ public void setNext(int triangleIndex) { mesh.getTriangle(triangleIndex, triStore); calcTransform(); triStore.calculateCenter(); triStore.calculateNormal(); } private void calcTransform() { n1.setLocalTranslation(triStore.get1()); n2.setLocalTranslation(triStore.get2()); n3.setLocalTranslation(triStore.get3()); p.setLocalRotation(emitter.getEmitterNode().getLocalRotation()); p.setLocalScale(emitter.getLocalScale()); triStore.set1(n1.getWorldTranslation()); triStore.set2(n2.getWorldTranslation()); triStore.set3(n3.getWorldTranslation()); } /** * Returns the index of the current face being used as the particle emission point * @return */ public int getTriangleIndex() { return triangleIndex; } public Vector3f getNormal() { return triStore.getNormal(); } /** * Returns the local position of the center of the selected face * @return A Vector3f representing the local translation of the selected emission point */ public Vector3f getNextTranslation(){ return triStore.getCenter(); } public Vector3f getRandomTranslation() { int start = FastMath.nextRandomInt(1, 3); switch(start) { case 1: p1.set(triStore.get1().subtract(triStore.getCenter())); p2.set(triStore.get2().subtract(triStore.getCenter())); p3.set(triStore.get3().subtract(triStore.getCenter())); break; case 2: p1.set(triStore.get2().subtract(triStore.getCenter())); p2.set(triStore.get1().subtract(triStore.getCenter())); p3.set(triStore.get3().subtract(triStore.getCenter())); break; case 3: p1.set(triStore.get3().subtract(triStore.getCenter())); p2.set(triStore.get2().subtract(triStore.getCenter())); p3.set(triStore.get1().subtract(triStore.getCenter())); break; } a.interpolate(p1, p2, 1f-FastMath.rand.nextFloat()); b.interpolate(p1, p3, 1f-FastMath.rand.nextFloat()); result.interpolate(a,b,FastMath.rand.nextFloat()); return result; } /** * Returns the normal of the selected emission point * @return A Vector3f containing the normal of the selected emission point */ public Vector3f getNextDirection(){ switch (emitter.getDirectionType()) { case Normal: tempDir.set(getDirectionNormal()); break; case NormalNegate: tempDir.set(getDirectionNormal().negate()); break; case Random: tempDir.set(getDirectionRandom()); break; case RandomTangent: tempDir.set(getDirectionRandomTangent()); break; case RandomNormalAligned: tempDir.set(getDirectionRandom()); if (tempDir.dot(getDirectionNormal()) < 0) tempDir.negateLocal(); break; case RandomNormalNegate: tempDir.set(getDirectionRandom()); if (tempDir.dot(getDirectionNormal()) > 0) tempDir.negateLocal(); break; } return tempDir; } private Vector3f getDirectionNormal() { return triStore.getNormal(); } private Vector3f getDirectionRandom() { q.fromAngles( FastMath.nextRandomFloat()*FastMath.TWO_PI, FastMath.nextRandomFloat()*FastMath.TWO_PI, FastMath.nextRandomFloat()*FastMath.TWO_PI ).normalizeLocal(); tempDir.set(q.mult(Vector3f.UNIT_Y)); return tempDir; } private Vector3f getDirectionRandomTangent() { tempDir.set(Vector3f.UNIT_Y); q2.lookAt(getNormal(), Vector3f.UNIT_Y); tempDir.set(q2.mult(tempDir)); q.fromAngleAxis(FastMath.nextRandomFloat()*360*FastMath.DEG_TO_RAD, getNormal()); tempDir.set(q.mult(tempDir)); return tempDir; } }
[ "cristofflanders@gmail.com" ]
cristofflanders@gmail.com
97575021dc95a9b503d58935f3ad7294df01116b
8392d8af9bc0e86ba4eb42e172ac47321ebb876a
/src/main/java/fm/fish/pojo/youtube/playlistitems/Snippet.java
caffc3550d9e03bf6217ead49933c204d23b6e20
[]
no_license
alexamber/fishfm
6e2e4079474d84ff4c23c6d6d50bf09a707c6450
a744581438383ad43f6035b1e33b8bea0805920d
refs/heads/master
2020-03-23T18:44:48.561998
2018-08-06T20:43:20
2018-08-06T20:43:20
141,929,564
0
1
null
2018-08-06T20:43:21
2018-07-22T20:48:46
Java
UTF-8
Java
false
false
1,421
java
package fm.fish.pojo.youtube.playlistitems; import com.google.gson.annotations.SerializedName; import javax.annotation.Generated; @Generated("com.robohorse.robopojogenerator") public class Snippet { @SerializedName("playlistId") private String playlistId; @SerializedName("resourceId") private ResourceId resourceId; @SerializedName("publishedAt") private String publishedAt; @SerializedName("description") private String description; @SerializedName("position") private int position; @SerializedName("title") private String title; @SerializedName("thumbnails") private Thumbnails thumbnails; @SerializedName("channelId") private String channelId; @SerializedName("channelTitle") private String channelTitle; public String getPlaylistId() { return playlistId; } public ResourceId getResourceId() { return resourceId; } public String getPublishedAt() { return publishedAt; } public String getDescription() { return description; } public int getPosition() { return position; } public String getTitle() { return title; } public Thumbnails getThumbnails() { return thumbnails; } public String getChannelId() { return channelId; } public String getChannelTitle() { return channelTitle; } }
[ "alexamber91@gmail.com" ]
alexamber91@gmail.com
b42223486cc05d463abe8504d6e5380f1f2f7e1f
f788d7fee3203f2bcfc40b2da1b0ae13c01eceef
/src/Controller/Controller.java
67994036c3d85e0c732e36ea1422db7e9f08e37a
[]
no_license
ColdCipri/MAP-InterpreterGUI
774531ed28112f061019fe8d5162f90287f43b51
78aab15dc65441aec2dae67be2a60781ebdba7a3
refs/heads/master
2020-05-03T22:49:09.013253
2019-04-01T11:41:11
2019-04-01T11:41:11
178,850,712
1
0
null
null
null
null
UTF-8
Java
false
false
5,427
java
package Controller; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.stream.Collectors; import Domain.IPrgState; import Domain.PrgState; import Domain.PrintCallBack; import Exception.DuplicateFileException; import Exception.InvalidAddressException; import Exception.InvalidBarrierException; import Exception.InvalidFileException; import Exception.InvalidSemaphoreException; import Exception.InvalidSignException; import Exception.InvalidStateException; import Exception.InvalidSymbolException; import Exception.NullAddressException; import Exception.OperandException; import Exception.ZeroDivisionException; import Repository.IRepo; import Repository.Repo; public class Controller implements IController{ IRepo repo; public PrintCallBack callback; private ExecutorService executor = Executors.newFixedThreadPool(2); public Controller(IRepo r ) { repo = r; } @Override public void nextStep() throws InvalidStateException, ZeroDivisionException, OperandException, IOException, DuplicateFileException, InvalidFileException, InvalidSymbolException, NullAddressException, InvalidAddressException, InvalidSignException { } public void oneStepForAllPrgStates(List<PrgState> prgList) throws InterruptedException { List<Callable<PrgState>> callList = prgList.stream() .map((PrgState p) -> (Callable<PrgState>) (() -> p.oneStep())).collect(Collectors.toList()); List<PrgState> newPrgList = ((ExecutorService) executor).invokeAll(callList).stream().map(future -> { try { return future.get(); } catch (Exception ex) { ex.printStackTrace(); //String msg = ex.getMessage(); } return null; }).filter(p -> p != null).collect(Collectors.toList()); prgList.addAll(newPrgList); prgList.forEach(prg ->{ try { repo.logPrgState(prg); } catch (IOException e) { callback.printCallBack(e.getMessage()); } }); repo.setPrgState(new ArrayList<>(prgList)); } @Override public void allSteps(){ List<PrgState> prgList = removeCompletedPrgStates(repo.getPrgState()); prgList.forEach(prg -> { try { repo.logPrgState(prg); } catch (IOException e) { callback.printCallBack(e.getMessage()); } }); while (prgList.size() > 0) { try { oneStepForAllPrgStates(prgList); } catch (InterruptedException e) { callback.printCallBack("execution interupted"); } prgList = removeCompletedPrgStates(repo.getPrgState()); } ((ExecutorService) executor).shutdownNow(); /*} catch (IOException | InvalidStateException | InvalidSymbolException | NullAddressException | InvalidAddressException |DuplicateFileException | InvalidFileException | InvalidSignException ex) { callback.printCallBack(ex.getLocalizedMessage()); } finally { for (int fd : s.getSymTable().getContent().values()) { if (s.getFileTbl().contains(fd)) { try { s.addStatement(new CloseReadFileStmt(new ConstExp(fd)));//auto close file try { s.executeNextStep(); } catch (OperandException e) { //callback.printCallBack(e.getLocalizedMessage()); e.printStackTrace(); } catch (ZeroDivisionException e1) { e1.printStackTrace(); } callback.printCallBack("Closed file with file descriptor: " + fd); } catch (InvalidStateException | DuplicateFileException | InvalidFileException | IOException | InvalidSymbolException | NullAddressException | InvalidAddressException | InvalidSignException e) { callback.printCallBack(e.getLocalizedMessage()); } } } callback.printCallBack(s.getFileTbl().toString()); }*/ repo.setPrgState(prgList); } @Override public void oneStepRedirect() throws InterruptedException { List<PrgState> prgList = removeCompletedPrgStates(repo.getPrgState()); oneStepForAllPrgStates(prgList); } @Override public IPrgState getNextState(IPrgState s) throws InvalidStateException, ZeroDivisionException, OperandException, FileNotFoundException, DuplicateFileException, InvalidFileException, IOException, InvalidSymbolException, NullAddressException, InvalidAddressException, InvalidSignException, InvalidBarrierException, InvalidSemaphoreException { PrgState st = (PrgState) s; st.executeNextStep(); return st; } @Override public void conservativeGarbageCollector(List<IPrgState> prgstates) { HashSet<Integer> symbtblvalues = new HashSet<>(); HashMap<Integer, Integer> heap = new HashMap<>(); for (IPrgState s : prgstates) symbtblvalues.addAll(s.getSymTable().getContent().values()); for (IPrgState s : prgstates) for (Integer val : s.getHeap().getContent().values()) if (!symbtblvalues.contains(val)) heap.remove(val); if (prgstates.size() > 0) { prgstates.get(0).getHeap().setContent(heap); } } @Override public List<PrgState> removeCompletedPrgStates(List<PrgState> prgstates){ return prgstates.stream().filter(i -> i.isNotDone()).collect(Collectors.toList()); } @Override public Repo getRepo() { return (Repo) this.repo; } }
[ "colder.ciprian@gmail.com" ]
colder.ciprian@gmail.com
e6f2d9505edc84fa92bd863e522875843d94bc24
576d76f81bc4de8bea09d206fb35b06786cfd692
/SpringAwsHloWrldApp/src/main/java/com/tcs/aws/app/controller/Employee.java
38859b594362ea70075707eee518f5c399f35c5e
[]
no_license
kishore191018/springbootawsapp
66f184628a82c9dc661cb9960dec1345d5061d07
444ed1991d38baefbecb877aabc0fe720ab19bb4
refs/heads/master
2023-06-29T16:42:57.925696
2021-07-25T11:13:24
2021-07-25T11:13:24
387,126,246
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package com.tcs.aws.app.controller; public class Employee { private Integer id; private String name; private Integer sal; public Integer getSal() { return sal; } public void setSal(Integer sal) { this.sal = sal; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Employee [id=" + id + ", name=" + name + "]"; } }
[ "Lokeswara.danamreddi@gamil.com" ]
Lokeswara.danamreddi@gamil.com
123bdfc893a247682432c3c81d443831c189f005
28c762bf0433245e7deb13056c712440650abb01
/src/main/java/com/intelli5/back/repository/search/TicketSearchRepository.java
b90a9f9f348b5088f9ffbc14fa1ecca2d72a9337
[]
no_license
porkmanic/foodbackend
4ad37442a353ec316ce2a0772d4731a36615b451
b4f7ceeae4811ba5b47e83d50ba7f8d2663459c2
refs/heads/master
2021-07-14T05:49:00.551890
2016-12-04T00:12:36
2016-12-04T00:12:36
73,762,824
0
1
null
2020-09-18T13:31:56
2016-11-15T01:19:04
Java
UTF-8
Java
false
false
330
java
package com.intelli5.back.repository.search; import com.intelli5.back.domain.Ticket; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; /** * Spring Data ElasticSearch repository for the Ticket entity. */ public interface TicketSearchRepository extends ElasticsearchRepository<Ticket, Long> { }
[ "nbliuhaobo@gmail.com" ]
nbliuhaobo@gmail.com
4f5aa9df92ef13534fdb4a9092968ff540fc9eff
18b97acf3a31f8c360ae20989bf64c648a4a8f7f
/src/inheritance/Shape.java
85ec384c3db77664057f837d1f5afce6fd4bbf96
[]
no_license
maulong305/OopPractice
7adc61688fc3fd7f10508f89e27706ff9687ba90
a50c9071a9fc6705f77fe71043d3f1d8f9ac5c7c
refs/heads/master
2023-02-03T16:34:21.764823
2020-12-21T08:41:13
2020-12-21T08:41:13
323,277,759
1
0
null
null
null
null
UTF-8
Java
false
false
71
java
package inheritance; public class Shape { String color = "red"; }
[ "maulong305@gmail.com" ]
maulong305@gmail.com
8d820c08fa944039bd5222fef7ec3fbee6c5f5ad
9296fbf00af501cf6df877a47da0380cb41c31d9
/app/src/main/java/com/george/euzin/hilfe/EuZinJobService.java
00d5acccfb5eaaa537ffb09db1f383119699ebcb
[]
no_license
farmaker47/EuZin
902e322565e65c751b469711b045e451b9c7ae67
16613eda8b69df73692a41f469c7bc93414183f6
refs/heads/master
2021-09-01T15:02:19.475594
2017-12-27T15:31:54
2017-12-27T15:31:54
114,528,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,364
java
package com.george.euzin.hilfe; import android.content.Context; import android.os.AsyncTask; import com.firebase.jobdispatcher.JobParameters; import com.firebase.jobdispatcher.JobService; /** * Created by farmaker1 on 20/12/2017. */ public class EuZinJobService extends JobService { private EuZinDownloadFunction mEuZinDownload=new EuZinDownloadFunction(); private AsyncTask<Void,Void,Void> mDownloadFromInternet; @Override public boolean onStartJob(final JobParameters jobParameters) { mDownloadFromInternet = new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... voids) { Context context = getApplicationContext(); //Execute this method to download picture mEuZinDownload.sendIntentToDownloadPicture(context); jobFinished(jobParameters, false); return null; } @Override protected void onPostExecute(Void aVoid) { jobFinished(jobParameters, false); } }; mDownloadFromInternet.execute(); return true; } @Override public boolean onStopJob(JobParameters job) { if (mDownloadFromInternet != null) { mDownloadFromInternet.cancel(true); } return true; } }
[ "farmaker47@yahoo.cm" ]
farmaker47@yahoo.cm
be8e1cdfef8f5552c81dd7cc875496ca88bcd68f
4bb49ae9826cd3414f43e9d521132deebf71f7b7
/src/main/java/com/andersen/controllers/FindAllProductsServlet.java
77f23bbe96dee648ab86462347a5a2c7f366f634
[]
no_license
Martynovich/store-spring
d6e52fcd25996fb09a0ab905148efb2e3907fe5e
bf8c984990b603a24c0d2716333d5b8f3b38a52f
refs/heads/master
2021-01-11T17:37:22.658871
2017-02-01T12:45:19
2017-02-01T12:45:19
79,806,170
0
0
null
null
null
null
UTF-8
Java
false
false
1,686
java
package com.andersen.controllers; import com.andersen.domain.Product; import com.andersen.service.ProductService; import org.apache.log4j.Logger; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; public class FindAllProductsServlet extends HttpServlet { private static final Logger logger = Logger.getLogger(FindAllProductsServlet.class); @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { logger.info("Start FindAllProductsServlet doPost."); ApplicationContext context = new ClassPathXmlApplicationContext("store-spring.xml"); ProductService service = (ProductService) context.getBean("productService"); PrintWriter out = resp.getWriter(); resp.setContentType("text/html"); String tables = TextHolder.TABLE_SELECTION + "</br>\n</br>\n" + TextHolder.END_OF_PAGE; out.println(tables); List<Product> products = service.findAll(); if (products == null) { out.println("No products."); return; } for(Product product : products) { out.println("Product id - " + product.getId() + ", product login - " + product.getProductName() + ", product price - " + product.getProdutPrice()); out.println("</br>"); } } }
[ "Ihor.Martynovich@gmail.com" ]
Ihor.Martynovich@gmail.com
d8410bcf764511fdfcc1f6f6dacf5e76ef82b557
746a2aa0723eaa91affc0523c62aac8165280353
/Galaxzee/src/test/java/com/Galaxzee/AppTest.java
a9dad5da173fe739fcf4bce40cbbce78decd9423
[]
no_license
mansi08/E-commerce-Project-with-Spring-Spring-Security
1248e5a94544289efe5020c88e2e8e0ee9b7a3ed
878f9b827cdf12f31dffe4de57c6baec9c2469b6
refs/heads/master
2020-04-09T04:28:26.827317
2018-12-02T07:43:01
2018-12-02T07:43:01
160,024,625
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package com.Galaxzee; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "39582953+mansi08@users.noreply.github.com" ]
39582953+mansi08@users.noreply.github.com
8d52824dce1de7bfeddc869591a8596621ff6c9f
c13b0025dd707c3033f61ee1bec8bdbdf3c214fb
/src/alarm/controller/UpdateReadServlet.java
87481ad2d8e5677c69cd432375cd888f1fda9435
[]
no_license
Jinseon038/study_with_us
aa15eb22aec168e510d0344480b5f1fa1af1451b
d8911c636ab4a9c86414be1f845c6d9a2124371a
refs/heads/master
2023-05-02T06:47:57.386961
2021-05-08T06:01:13
2021-05-08T06:01:13
334,324,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package alarm.controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import alarm.model.service.AlarmService; /** * Servlet implementation class UpdateReadServlet */ @WebServlet(name = "UpdateRead", urlPatterns = { "/updateRead" }) public class UpdateReadServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UpdateReadServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("utf-8"); int alN = Integer.parseInt(request.getParameter("alarmNum")); int result = new AlarmService().updateReadStatus(alN); PrintWriter out = response.getWriter(); if(result>0) { out.print(true); } else { out.print(false); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "jinseon038@gmail.com" ]
jinseon038@gmail.com
e47d1cfa6aaadf0368812e9aeca252793e185d64
58be70938560c4ccd01e108487f66f33dc26b3c3
/src/main/java/com/wojo/Vault/Controller/PaymentsController.java
725909c1ad1d2e6d434560e86a58aedf48f46f3d
[ "MIT" ]
permissive
FoioK/Vault
93c4dff2d9c04c20d4e2f3e707c37e17692ea234
5a9631475b9e85f3e1c37550ac67afd6b9331076
refs/heads/master
2022-09-19T13:14:39.130670
2020-05-01T21:53:27
2020-05-01T21:53:27
113,100,141
3
0
MIT
2022-02-16T01:08:36
2017-12-04T22:02:18
Java
UTF-8
Java
false
false
4,132
java
package com.wojo.Vault.Controller; import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXTextField; import com.wojo.Vault.Filters.TextFieldFilter; import com.wojo.Vault.Service.PaymentService; import com.wojo.Vault.Service.impl.PaymentServiceImpl; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Label; import java.math.BigDecimal; public class PaymentsController { @FXML private JFXButton backToDesktopPane; @FXML private JFXTextField recipientName; @FXML private Label badRecipientNameMessage; @FXML private JFXTextField recipientAccountNumber; @FXML private Label badRecipientNumberMessage; @FXML private JFXTextField paymentValue; @FXML private Label badPaymentValueMessage; @FXML private JFXTextField title; @FXML private Label badTitleMessage; @FXML private JFXButton sendTransfer; @FXML private Label badSendTransferMessage; @FXML void initialize() { initTextLimiters(); setErrorMessage(); addEventHandlers(); } private RootController rootController; private PaymentService paymentService = new PaymentServiceImpl(); private void initTextLimiters() { TextFieldFilter.lengthLimiter(recipientName, 75); //TODO split entered text TextFieldFilter.lengthLimiter(recipientAccountNumber, 26); TextFieldFilter.typeInteger(recipientAccountNumber); //TODO entered value with ',' TextFieldFilter.lengthLimiter(paymentValue, 15); TextFieldFilter.lengthLimiter(title, 75); } private void setErrorMessage() { badRecipientNameMessage.setVisible(false); badRecipientNumberMessage.setVisible(false); badPaymentValueMessage.setVisible(false); badTitleMessage.setVisible(false); badSendTransferMessage.setVisible(false); } private void addEventHandlers() { sendTransfer.addEventHandler(ActionEvent.ACTION, e -> { if (sendTransferProcess()) { loadDesktopPane(); } else { badSendTransferMessage.setVisible(true); } }); backToDesktopPane.addEventHandler(ActionEvent.ACTION, e -> loadDesktopPane()); } private boolean sendTransferProcess() { setErrorMessage(); return checkData() && sendTransfer(); } private boolean checkData() { boolean isCorrect = true; if (recipientName.getText().equals("")) { badRecipientNameMessage.setVisible(true); isCorrect = false; } if (recipientAccountNumber.getText().equals("") || recipientAccountNumber.getText().length() != 26) { badRecipientNumberMessage.setVisible(true); isCorrect = false; } if (paymentValue.getText().equals("")) { badPaymentValueMessage.setVisible(true); isCorrect = false; } else { try { if (new BigDecimal(paymentValue.getText()) .compareTo(new BigDecimal("0")) <= 0) { badPaymentValueMessage.setVisible(true); isCorrect = false; } } catch (NumberFormatException e) { badPaymentValueMessage.setVisible(true); isCorrect = false; } } if (title.getText().equals("")) { badTitleMessage.setVisible(true); isCorrect = false; } return isCorrect; } private boolean sendTransfer() { return paymentService.sendTransfer( CurrentPerson.getActiveAccount(), recipientName.getText(), recipientAccountNumber.getText(), title.getText(), new BigDecimal(paymentValue.getText())); } private void loadDesktopPane() { rootController.loadDesktopPane(); } public void setRootController(RootController rootController) { this.rootController = rootController; } }
[ "7wojok7@gmail.com" ]
7wojok7@gmail.com
9e188cfc0448aa617215bd39e5d4cdefae94b24f
8bf261911d029ed2d2d6de53b1c7f596e8fc1df3
/core/domain/src/main/java/org/mobicents/gmlc/GmlcPropertiesManagement.java
5bae402f98d8fbd506db0ce3b325005a19db8f64
[]
no_license
satyaparmar/gmlc
533fd242ae5c4ac0692a46c040eb5b61db5a2f87
c98089e6815df3e7e2af342567482f193c08cf37
refs/heads/master
2021-01-01T08:56:36.403669
2012-10-31T09:28:03
2012-10-31T09:28:03
40,012,561
0
0
null
null
null
null
UTF-8
Java
false
false
6,053
java
/** * TeleStax, Open Source Cloud Communications Copyright 2012. * and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.mobicents.gmlc; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import javolution.text.TextBuilder; import javolution.xml.XMLBinding; import javolution.xml.XMLObjectReader; import javolution.xml.XMLObjectWriter; import javolution.xml.stream.XMLStreamException; import org.apache.log4j.Logger; /** * @author amit bhayani * */ public class GmlcPropertiesManagement implements GmlcPropertiesManagementMBean { private static final Logger logger = Logger.getLogger(GmlcPropertiesManagement.class); protected static final String GMLC_GT = "gmlcgt"; protected static final String GMLC_SSN = "gmlcssn"; protected static final String HLR_SSN = "hlrssn"; protected static final String MSC_SSN = "mscssn"; protected static final String MAX_MAP_VERSION = "maxmapv"; private static final String TAB_INDENT = "\t"; private static final String CLASS_ATTRIBUTE = "type"; private static final XMLBinding binding = new XMLBinding(); private static final String PERSIST_FILE_NAME = "gmlcproperties.xml"; private static GmlcPropertiesManagement instance; private final String name; private String persistDir = null; private final TextBuilder persistFile = TextBuilder.newInstance(); private String gmlcGt = null; private int gmlcSsn = -1; private int hlrSsn = -1; private int mscSsn = -1; private int maxMapVersion = 3; private GmlcPropertiesManagement(String name) { this.name = name; binding.setClassAttribute(CLASS_ATTRIBUTE); } protected static GmlcPropertiesManagement getInstance(String name) { if (instance == null) { instance = new GmlcPropertiesManagement(name); } return instance; } public static GmlcPropertiesManagement getInstance() { return instance; } public String getName() { return name; } public String getPersistDir() { return persistDir; } public void setPersistDir(String persistDir) { this.persistDir = persistDir; } @Override public String getGmlcGt() { return gmlcGt; } @Override public void setGmlcGt(String gmlcGt) { this.gmlcGt = gmlcGt; } @Override public int getGmlcSsn() { return gmlcSsn; } @Override public void setGmlcSsn(int gmlcSsn) { this.gmlcSsn = gmlcSsn; } @Override public int getHlrSsn() { return hlrSsn; } @Override public void setHlrSsn(int hlrSsn) { this.hlrSsn = hlrSsn; } @Override public int getMscSsn() { return mscSsn; } @Override public void setMscSsn(int mscSsn) { this.mscSsn = mscSsn; } @Override public int getMaxMapVersion() { return maxMapVersion; } @Override public void setMaxMapVersion(int maxMapVersion) { this.maxMapVersion = maxMapVersion; } public void start() throws Exception { this.persistFile.clear(); if (persistDir != null) { this.persistFile.append(persistDir).append(File.separator).append(this.name).append("_") .append(PERSIST_FILE_NAME); } else { persistFile .append(System.getProperty(GmlcManagement.USSD_PERSIST_DIR_KEY, System.getProperty(GmlcManagement.USER_DIR_KEY))).append(File.separator).append(this.name) .append("_").append(PERSIST_FILE_NAME); } logger.info(String.format("Loading USSD Properties from %s", persistFile.toString())); try { this.load(); } catch (FileNotFoundException e) { logger.warn(String.format("Failed to load the USSD configuration file. \n%s", e.getMessage())); } } public void stop() throws Exception { this.store(); } /** * Persist */ public void store() { // TODO : Should we keep reference to Objects rather than recreating // everytime? try { XMLObjectWriter writer = XMLObjectWriter.newInstance(new FileOutputStream(persistFile.toString())); writer.setBinding(binding); // Enables cross-references. // writer.setReferenceResolver(new XMLReferenceResolver()); writer.setIndentation(TAB_INDENT); writer.write(this.gmlcGt, GMLC_GT, String.class); writer.write(this.gmlcSsn, GMLC_SSN, Integer.class); writer.write(this.hlrSsn, HLR_SSN, Integer.class); writer.write(this.mscSsn, MSC_SSN, Integer.class); writer.write(this.maxMapVersion, MAX_MAP_VERSION, Integer.class); writer.close(); } catch (Exception e) { logger.error("Error while persisting the Rule state in file", e); } } /** * Load and create LinkSets and Link from persisted file * * @throws Exception */ public void load() throws FileNotFoundException { XMLObjectReader reader = null; try { reader = XMLObjectReader.newInstance(new FileInputStream(persistFile.toString())); reader.setBinding(binding); this.gmlcGt = reader.read(GMLC_GT, String.class); this.gmlcSsn = reader.read(GMLC_SSN, Integer.class); this.hlrSsn = reader.read(HLR_SSN, Integer.class); this.mscSsn = reader.read(MSC_SSN, Integer.class); this.maxMapVersion = reader.read(MAX_MAP_VERSION, Integer.class); reader.close(); } catch (XMLStreamException ex) { // this.logger.info( // "Error while re-creating Linksets from persisted file", ex); } } }
[ "amit.bhayani@gmail.com" ]
amit.bhayani@gmail.com
6df3326d4f24bd67beffccb0ae967d2e8f47e2a0
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_7fddc94c88635b58b21fe0210763f4d25c0046b5/CVSProviderTest/9_7fddc94c88635b58b21fe0210763f4d25c0046b5_CVSProviderTest_s.java
d97fe05d998a0eaaf44d86a5ce8382413231712a
[]
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
35,292
java
/******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.team.tests.ccvs.core.provider; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.HashMap; import java.util.Map; import junit.framework.Test; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.team.core.IFileTypeInfo; import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.core.Team; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.ccvs.core.CVSException; import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; import org.eclipse.team.internal.ccvs.core.CVSStatus; import org.eclipse.team.internal.ccvs.core.CVSTag; import org.eclipse.team.internal.ccvs.core.CVSTeamProvider; import org.eclipse.team.internal.ccvs.core.ICVSFile; import org.eclipse.team.internal.ccvs.core.ICVSFolder; import org.eclipse.team.internal.ccvs.core.client.Command; import org.eclipse.team.internal.ccvs.core.client.Session; import org.eclipse.team.internal.ccvs.core.client.Update; import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption; import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; import org.eclipse.team.internal.ccvs.core.util.Util; import org.eclipse.team.tests.ccvs.core.EclipseTest; /* * This class tests both the CVSProvider and the CVSTeamProvider */ public class CVSProviderTest extends EclipseTest { /** * Constructor for CVSProviderTest */ public CVSProviderTest() { super(); } /** * Constructor for CVSProviderTest */ public CVSProviderTest(String name) { super(name); } public static Test suite() { return suite(CVSProviderTest.class); } public void testAdd() throws TeamException, CoreException { // Test add with cvsignores /* IProject project = createProject("testAdd", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); IFile file = project.getFile(".cvsignore"); file.create(new ByteArrayInputStream("ignored.txt".getBytes()), false, null); file = project.getFile("ignored.txt"); file.create(new ByteArrayInputStream("some text".getBytes()), false, null); file = project.getFile("notignored.txt"); file.create(new ByteArrayInputStream("some more text".getBytes()), false, null); file = project.getFile("folder1/.cvsignore"); file.create(new ByteArrayInputStream("ignored.txt".getBytes()), false, null); file = project.getFile("folder1/ignored.txt"); file.create(new ByteArrayInputStream("some text".getBytes()), false, null); file = project.getFile("folder1/notignored.txt"); file.create(new ByteArrayInputStream("some more text".getBytes()), false, null); getProvider(project).add(new IResource[] {project}, IResource.DEPTH_INFINITE, DEFAULT_MONITOR); assertTrue( ! CVSWorkspaceRoot.getCVSResourceFor(project.getFile("ignored.txt")).isManaged()); assertTrue( ! CVSWorkspaceRoot.getCVSResourceFor(project.getFile("folder1/ignored.txt")).isManaged()); assertTrue(CVSWorkspaceRoot.getCVSResourceFor(project.getFile("notignored.txt")).isManaged()); assertTrue(CVSWorkspaceRoot.getCVSResourceFor(project.getFile("folder1/notignored.txt")).isManaged()); assertTrue(CVSWorkspaceRoot.getCVSResourceFor(project.getFile(".cvsignore")).isManaged()); assertTrue(CVSWorkspaceRoot.getCVSResourceFor(project.getFile("folder1/.cvsignore")).isManaged()); */ } public void testDeleteHandling() throws TeamException, CoreException { IProject project = createProject("testDeleteHandling", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Delete a file and ensure that it is an outgoing deletion project.getFile("deleted.txt").delete(false, false, null); ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(project.getFile("deleted.txt")); assertTrue("File is not outgoing deletion", file.getSyncInfo().isDeleted()); // Delete a folder and ensure that the file is managed but doesn't exist // (Special behavior is provider by the CVS move/delete hook but this is not part of CVS core) project.getFolder("folder1").delete(false, false, null); ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project.getFolder("folder1")); assertTrue("Deleted folder not in proper state", ! folder.exists() && folder.isManaged()); } public void testCheckin() throws TeamException, CoreException, IOException { IProject project = createProject("testCheckin", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Perform some operations on the project IResource[] newResources = buildResources(project, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false); setContentsAndEnsureModified(project.getFile("changed.txt")); addResources(newResources); deleteResources(new IResource[] {project.getFile("deleted.txt")}); assertIsModified("testDeepCheckin: ", newResources); assertIsModified("testDeepCheckin: ", new IResource[] {project.getFile("deleted.txt"), project.getFile("changed.txt")}); commitResources(new IResource[] {project}, IResource.DEPTH_INFINITE); assertLocalStateEqualsRemote(project); } public void testMoveHandling() throws TeamException, CoreException { IProject project = createProject("testMoveHandling", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Move a file and ensure that it is an outgoing deletion at the source and unmanaged at the destination project.getFile("deleted.txt").move(new Path("moved.txt"), false, false, null); ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(project.getFile("deleted.txt")); assertTrue("Source is not outgoing deletion", file.getSyncInfo().isDeleted()); file = CVSWorkspaceRoot.getCVSFileFor(project.getFile("moved.txt")); assertTrue("Destination not in proper state", ! file.isManaged()); // Move a folder and ensure the source is deleted project.getFolder("folder1").move(new Path("moved"), false, false, null); ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project.getFolder("folder1")); assertTrue("Deleted folder not in proper state", ! folder.exists() && folder.isManaged()); folder = CVSWorkspaceRoot.getCVSFolderFor(project.getFolder("moved")); assertTrue("Moved folder should not be managed", ! folder.isManaged()); assertTrue("Moved folder should not be a CVS folder", ! folder.isCVSFolder()); } public void testUpdate() throws TeamException, CoreException, IOException { // Create a test project, import it into cvs and check it out IProject project = createProject("testUpdate", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Check the project out under a different name IProject copy = checkoutCopy(project, "-copy"); // Perform some operations on the copy addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false); setContentsAndEnsureModified(copy.getFile("changed.txt")); deleteResources(new IResource[] {copy.getFile("deleted.txt")}); // Commit the copy and update the project commitResources(new IResource[] {copy}, IResource.DEPTH_INFINITE); updateProject(project, null, false); assertEquals(project, copy); } public void testUpdate123280() throws CoreException { IProject project = createProject(new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Make a remote change IProject copy = checkoutCopy(project, "-copy"); setContentsAndEnsureModified(copy.getFile("folder1/a.txt")); commitProject(copy); // Delete locally and then update project.getFile("deleted.txt").delete(false, null); updateProject(project, null, false); // Ensure that the file is still an outgoing deletion ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(project.getFile("deleted.txt")); assertTrue(!file.exists() && file.isManaged()); } public void testVersionTag() throws TeamException, CoreException, IOException { // Create a test project, import it into cvs and check it out IProject project = createProject("testVersionTag", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Perform some operations on the copy and commit IProject copy = checkoutCopy(project, "-copy"); addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false); changeResources(copy, new String[] {"changed.txt"}, false); deleteResources(copy, new String[] {"deleted.txt"}, false); commitResources(copy, true); // Tag the original, checkout the tag and compare with original CVSTag v1Tag = new CVSTag("v1", CVSTag.VERSION); tagProject(project, v1Tag, false); IProject v1 = checkoutCopy(project, v1Tag); assertEquals(project, v1); // Update original to HEAD and compare with copy including tags updateProject(project, null, false); assertEquals(project, copy, false, true); // Update copy to v1 and compare with the copy (including tag) updateProject(copy, v1Tag, false); assertEquals(copy, v1, false, true); // Update copy back to HEAD and compare with project (including tag) updateProject(copy, CVSTag.DEFAULT, false); assertEquals(project, copy, false, true); } public void testMakeBranch() throws TeamException, CoreException, IOException { // Create a test project IProject project = createProject("testMakeBranch", new String[] { "file1.txt", "file2.txt", "file3.txt", "folder1/", "folder1/a.txt", "folder1/b.txt"}); // Make some local modifications including "cvs adds" and "cvs removes" addResources(project, new String[] {"folder1/c.txt"}, false); deleteResources(project, new String[] {"folder1/b.txt"}, false); changeResources(project, new String[] {"file2.txt"}, false); // Make the branch including a pre-version CVSTag version = new CVSTag("v1", CVSTag.BRANCH); CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH); makeBranch(new IResource[] {project}, version, branch, true); // Checkout a copy from the branch and version and compare IProject branchCopy = checkoutCopy(project, branch); IProject versionCopy = checkoutCopy(project, version); assertEquals(branchCopy, versionCopy, true, false); // Commit the project, update the branch and compare commitProject(project); updateProject(branchCopy, null, false); assertEquals(branchCopy, project, false, true); } public void testDuplicatedBranch() throws TeamException, CoreException { // Create a test project IProject project = createProject("testDuplicatedBranch", new String[] { "file1.txt", "file2.txt", "file3.txt", "folder1/", "folder1/a.txt", "folder1/b.txt" }); // Create a branch CVSTag version = new CVSTag("v1", CVSTag.BRANCH); CVSTag branch = new CVSTag("branch1", CVSTag.BRANCH); makeBranch(new IResource[] { project }, version, branch, false); // Create the second branch using the same names try { makeBranch(new IResource[] { project }, version, branch, false); fail(); } catch (CVSException e) { } } public void testPruning() throws TeamException, CoreException, IOException { // Create a project with empty folders CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(false); IProject project = createProject("testPruning", new String[] { "file.txt", "folder1/", "folder2/folder3/" }); // Disable pruning, checkout a copy and ensure original and copy are the same IProject copy = checkoutCopy(project, "-copy"); assertEquals(project, copy); // Enable pruning, update copy and ensure emtpy folders are gone CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(true); updateProject(copy, null, false); assertDoesNotExistInFileSystem(new IResource[] {copy.getFolder("folder1"), copy.getFolder("folder2"), copy.getFolder("folder2/folder3")}); // Checkout another copy and ensure that the two copies are the same (with pruning enabled) IProject copy2 = checkoutCopy(project, "-copy2"); assertEquals(copy, copy2); // Disable pruning, update copy and ensure directories come back // TODO: disabled until bug 125037 can be resolved // CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(false); // updateProject(copy, null, false); // assertEquals(project, copy); // Enable pruning again since it's the default CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(true); } public void testGet() throws TeamException, CoreException, IOException { // Create a project IProject project = createProject("testGet", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Checkout a copy and modify locally IProject copy = checkoutCopy(project, "-copy"); //addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, false); deleteResources(copy, new String[] {"deleted.txt"}, false); setContentsAndEnsureModified(copy.getFile("changed.txt")); // get the remote conetns replace(new IResource[] {copy}, null, true); assertEquals(project, copy); } public void testReadOnly() throws TeamException, CoreException, IOException { // IProject project = createProject("testReadOnly", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt" }); // Need to check the project out as read-only } public void testCleanLineDelimiters() throws TeamException, CoreException, IOException { // Create a project IProject project = getUniqueTestProject("testCleanLineDelimiters"); IFile file = project.getFile("testfile"); IProgressMonitor monitor = new NullProgressMonitor(); // empty file setFileContents(file, ""); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, ""); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, ""); // one byte setFileContents(file, "a"); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, "a"); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, "a"); // single orphan carriage return (should be preserved) setFileContents(file, "\r"); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, "\r"); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, "\r"); // single line feed setFileContents(file, "\n"); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, "\n"); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, "\r\n"); // single carriage return line feed setFileContents(file, "\r\n"); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, "\r\n"); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, "\n"); // mixed text with orphaned CR's setFileContents(file, "The \r\n quick brown \n fox \r\r\r\n jumped \n\n over \r\n the \n lazy dog.\r\n"); CVSTeamProvider.cleanLineDelimiters(file, false, monitor); assertEqualsFileContents(file, "The \n quick brown \n fox \r\r\n jumped \n\n over \n the \n lazy dog.\n"); setFileContents(file, "The \r\n quick brown \n fox \r\r\r\n jumped \n\n over \r\n the \n lazy dog.\r\n"); CVSTeamProvider.cleanLineDelimiters(file, true, monitor); assertEqualsFileContents(file, "The \r\n quick brown \r\n fox \r\r\r\n jumped \r\n\r\n over \r\n the \r\n lazy dog.\r\n"); } public void testKeywordSubstitution() throws TeamException, CoreException, IOException { testKeywordSubstitution(Command.KSUBST_BINARY); // -kb testKeywordSubstitution(Command.KSUBST_TEXT); // -ko testKeywordSubstitution(Command.KSUBST_TEXT_EXPAND); // -kkv } private void testKeywordSubstitution(KSubstOption ksubst) throws TeamException, CoreException, IOException { // setup some known file types Team.setAllTypes( new String[] {"xbin", "xtxt"}, new int[] {Team.BINARY, Team.TEXT}); // create a test project IProject project = createProject("testKeywordSubstitution", new String[] { "dummy" }); addResources(project, new String[] { "binary.xbin", "text.xtxt", "folder1/", "folder1/a.xtxt" }, true); addResources(project, new String[] { "added.xbin", "added.xtxt" }, false); assertHasKSubstOption(project, "binary.xbin", Command.KSUBST_BINARY); assertHasKSubstOption(project, "added.xbin", Command.KSUBST_BINARY); assertHasKSubstOption(project, "text.xtxt", CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION); assertHasKSubstOption(project, "folder1/a.xtxt", CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION); assertHasKSubstOption(project, "added.xtxt", CVSProviderPlugin.DEFAULT_TEXT_KSUBST_OPTION); // change keyword substitution Map map = new HashMap(); map.put(project.getFile("binary.xbin"), ksubst); map.put(project.getFile("added.xbin"), ksubst); map.put(project.getFile("text.xtxt"), ksubst); map.put(project.getFile("folder1/a.xtxt"), ksubst); map.put(project.getFile("added.xtxt"), ksubst); waitMsec(1500); IStatus status = getProvider(project).setKeywordSubstitution(map, null, null); assertTrue("Status should be ok, was: " + status.toString(), status.isOK()); assertHasKSubstOption(project, "binary.xbin", ksubst); assertHasKSubstOption(project, "text.xtxt", ksubst); assertHasKSubstOption(project, "folder1/a.xtxt", ksubst); assertHasKSubstOption(project, "added.xtxt", ksubst); assertHasKSubstOption(project, "added.xbin", ksubst); // verify that substitution mode changed remotely and "added.xtxt", "added.xbin" don't exist IProject copy = checkoutCopy(project, "-copy"); assertHasKSubstOption(copy, "binary.xbin", ksubst); assertHasKSubstOption(copy, "text.xtxt", ksubst); assertHasKSubstOption(copy, "folder1/a.xtxt", ksubst); assertDoesNotExistInWorkspace(copy.getFile("added.xtxt")); assertDoesNotExistInWorkspace(copy.getFile("added.xbin")); // commit added files then checkout the copy again commitResources(project, new String[] { "added.xbin", "added.xtxt" }); IProject copy2 = checkoutCopy(project, "-copy2"); assertHasKSubstOption(copy2, "added.xtxt", ksubst); assertHasKSubstOption(copy2, "added.xbin", ksubst); IFileTypeInfo[] infos = Team.getDefaultTypes(); String[] extensions = new String[infos.length]; int[] types = new int[infos.length]; for (int i = 0; i < infos.length; i++) { IFileTypeInfo info = infos[i]; extensions[i] = info.getExtension(); types[i] = info.getType(); } Team.setAllTypes(extensions, types); } public void testKeywordSubsBinToText() throws TeamException, CoreException, IOException { //create a test project KSubstOption ksubst = Command.KSUBST_TEXT; IProject project = createProject("testKeywordSubsBinToText", new String[] { "dummy" }); assertHasKSubstOption(project, "dummy", Command.KSUBST_BINARY); // change keyword substitution Map map = new HashMap(); map.put(project.getFile("dummy"), ksubst); // change from binary to text should commit a new file with waitMsec(1500); IStatus status = getProvider(project).setKeywordSubstitution(map, null, null); assertTrue("Status should be ok, was: " + status.toString(), status.isOK()); assertHasKSubstOption(project, "dummy", ksubst); IProject copy = checkoutCopy(project, "-copy"); assertHasKSubstOption(copy, "dummy", ksubst); assertEquals(project, copy); } public static void setFileContents(IFile file, String string) throws CoreException { InputStream is = new ByteArrayInputStream(string.getBytes()); if (file.exists()) { file.setContents(is, false /*force*/, true /*keepHistory*/, null); } else { file.create(is, false /*force*/, null); } } public static void assertEqualsFileContents(IFile file, String string) throws CoreException, IOException { String other = getFileContents(file); assertEquals(string, other); } public static void assertHasKSubstOption(IContainer container, String filename, KSubstOption ksubst) throws TeamException { IFile file = container.getFile(new Path(filename)); ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file); ResourceSyncInfo info = cvsFile.getSyncInfo(); assertEquals(ksubst, info.getKeywordMode()); } public void testUnmap() throws CoreException, TeamException { // Create a project IProject project = createProject("testUnmap", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt", "folder1/", "folder1/folder2/deep.txt", "folder2/b.txt" }); // delete a file and folder to create phantoms project.getFile("deleted.txt").delete(false, false, null); assertTrue(project.getFile("deleted.txt").isPhantom()); project.getFolder("folder2").delete(false, false, null); assertTrue(project.getFolder("folder2").isPhantom()); // unmap RepositoryProvider.unmap(project); // ensure that phantoms for the resoucrs no longer exist assertFalse(project.getFile("deleted.txt").isPhantom()); assertFalse(project.getFolder("folder2").isPhantom()); // Create a project project = createProject("testUnmap2", new String[] { "changed.txt", "deleted.txt", "folder1/", "folder1/a.txt", "folder1/", "folder1/folder2/deep.txt", "folder2/b.txt" }); // delete a deep folder to create phantoms project.getFolder("folder1/folder2").delete(false, false, null); assertTrue(project.getFolder("folder1/folder2").isPhantom()); // unmap RepositoryProvider.unmap(project); // ensure that phantoms for the resources no longer exist assertFalse(project.getFolder("folder1/folder2").isPhantom()); } public void testForBinaryLinefeedCorruption() throws CoreException, TeamException, IOException { String EOL = "\n"; IProject project = createProject("testForBinaryLinefeedCorruption", new String[] { "binaryFile" }); ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(project.getFile("binaryFile")); assertTrue(ResourceSyncInfo.isBinary(cvsFile.getSyncBytes())); setContentsAndEnsureModified(project.getFile("binaryFile"), "line 1" + EOL + "line 2"); commitProject(project); // Checkout a copy and ensure the file was not corrupted IProject copy = checkoutCopy(project, "-copy"); assertEquals(project, copy); } public void test33984CannotCommitAfterConflictsMergedLocally() throws CoreException, TeamException, IOException { String EOL = System.getProperty("line.separator"); IProject project = createProject("test33984", new String[] { "a.txt", "b.txt" }); setContentsAndEnsureModified(project.getFile("a.txt"), "line 1"); setContentsAndEnsureModified(project.getFile("b.txt"), ("line 1" + EOL + "line 2" + EOL + "line3")); Map kMode = new HashMap(); kMode.put(project.getFile("a.txt"), Command.KSUBST_TEXT); kMode.put(project.getFile("b.txt"), Command.KSUBST_TEXT); getProvider(project).setKeywordSubstitution(kMode, "", null); commitProject(project); // Checkout a copy and ensure the file was not corrupted IProject copy = checkoutCopy(project, "-copy"); assertEquals(project, copy); // TEST 1: simulate modifying same file by different users // b.txt has non-conflicting changes setContentsAndEnsureModified(copy.getFile("b.txt"), ("line 1a" + EOL + "line 2" + EOL + "line3")); commitProject(copy); // user updates which would cause a merge with conflict, a commit should not be allowed setContentsAndEnsureModified(project.getFile("b.txt"), ("line 1" + EOL + "line 2" + EOL + "line3a")); updateProject(project, CVSTag.DEFAULT, false /* don't ignore local changes */); commitProject(project); // TEST 2: a.txt has conflicting changes setContentsAndEnsureModified(copy.getFile("a.txt"), "line 1dfgdfne3"); commitProject(copy); // user updates which would cause a merge with conflict, a commit should not be allowed setContentsAndEnsureModified(project.getFile("a.txt"), "some other text"); updateProject(project, CVSTag.DEFAULT, false /* don't ignore local changes */); try { commitProject(project); fail("should not be allowed to commit a resource with merged conflicts"); } catch(TeamException e) { } } public void testTagExistsFailure() throws TeamException, CoreException, IOException { IProject project = createProject(new String[] { "a.txt", "b.txt" }); CVSTag tag = new CVSTag("v1", CVSTag.VERSION); tagProject(project, tag, false); setContentsAndEnsureModified(project.getFile("a.txt")); commitProject(project); try { tagProject(project, tag, false/* don't force */); fail("The tag should have failed since the tag already exists."); } catch (TeamException e) { // This is what we expected assertTrue("This exception should be an error", e.getStatus().getSeverity() == IStatus.ERROR); } tagProject(project, tag, true /* force */); IProject copy = checkoutCopy(project, tag); assertEquals(project, copy); } public void testUpdateWithOverwrite() throws TeamException, CoreException { // Create a project and ad an unmanaged resource IProject project = createProject(new String[] { "a.txt", "b.txt" }); buildResources(project, new String[] { "new.txt" }, false); // Checkout a copy and commit the same resource IProject copy = checkoutCopy(project, "-copy"); addResources(copy, new String[] { "new.txt" }, true); // Use the regular update and ensure that it fails IStatus status = executeCommand(project, Command.UPDATE, Command.NO_LOCAL_OPTIONS); assertStatusContainsCode(status, CVSStatus.INVALID_LOCAL_RESOURCE_PATH); // Use the update and overwrite and ensure that it works status = executeCommand(project, Command.REPLACE, Command.NO_LOCAL_OPTIONS); assertTrue(status.isOK()); } private IStatus executeCommand(IProject project, Update update, LocalOption[] options) throws CVSException { Session session = new Session(getRepository(), CVSWorkspaceRoot.getCVSFolderFor(project)); session.open(DEFAULT_MONITOR); try { return update.execute( session, Command.NO_GLOBAL_OPTIONS, options, new String[] { "." }, null, DEFAULT_MONITOR); } finally { session.close(); } } public void testUpdateWithNoChange() throws TeamException, CoreException { IProject project = createProject(new String[] { "a.txt"}); setContentsAndEnsureModified(project.getFile("a.txt"), "contents"); commitProject(project); // set the contents to the same value but ensure the local timestamp is different setContentsAndEnsureModified(project.getFile("a.txt"), "contents"); // Update and ensure file timestamp is what is was before out edit updateProject(project, null, false); Date modDate = CVSWorkspaceRoot.getCVSFileFor(project.getFile("a.txt")).getSyncInfo().getTimeStamp(); assertEquals("Timestamp was not properly reset", modDate, CVSWorkspaceRoot.getCVSFileFor(project.getFile("a.txt")).getTimeStamp()); } public void testBinaryAddition() throws CoreException { // See bug 132255 KSubstOption option = CVSProviderPlugin.getPlugin().getDefaultTextKSubstOption(); try { CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(Command.KSUBST_TEXT_KEYWORDS_ONLY); IProject project = createProject(new String[] { "a.txt"}); IProject copy = checkoutCopy(project, "-copy"); create(copy.getFile("binaryFile"), true); setContentsAndEnsureModified(copy.getFile("binaryFile"), "/n/n\n\n"); addResources(new IResource[] { copy.getFile("binaryFile") }); commitProject(copy); updateProject(project, null, false); assertContentsEqual(copy.getFile("binaryFile"), project.getFile("binaryFile")); } finally { CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(option); } } public void testDeletedPhantom139250() throws CoreException { IProject project = createProject(new String[] { "a.txt"}); // Create a phantom folder that is mapped to a remote folder // but for which no remote exists ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project.getFolder("phantom")); ICVSFolder projectFolder = CVSWorkspaceRoot.getCVSFolderFor(project); FolderSyncInfo projectInfo = projectFolder.getFolderSyncInfo(); String repo = Util.appendPath(projectInfo.getRepository(), "phantom"); FolderSyncInfo info = new FolderSyncInfo(repo, projectInfo.getRoot(), projectInfo.getTag(), false); folder.setFolderSyncInfo(info); updateProject(project, null, false); } public void testUpdateOfDeletedFile140007() throws CoreException { IProject project = createProject(new String[] { "a.txt"}); IProject copy = checkoutCopy(project, "-copy"); deleteResources(copy, new String[] { "a.txt"}, true); updateResources(project, new String[] { "a.txt"}, false); } public void testUpdateOfRemotelyRemovedFile() throws CoreException, IOException { IProject project = createProject(new String[] { "a.txt"}); IProject copy = checkoutCopy(project, "-copy"); //Create a file and add it to version control (but don't commit) addResources(copy, new String[] { "b.txt"}, false); // Change the revision of the file so it appears to exist remotely ICVSFile file = CVSWorkspaceRoot.getCVSFileFor(copy.getFile("b.txt")); byte[] syncBytes = file.getSyncBytes(); syncBytes = ResourceSyncInfo.setRevision(syncBytes, "1.1"); file.setSyncBytes(syncBytes, ICVSFile.UNKNOWN); file.checkedIn(null, true); // Update the project and verify that the file gets removed updateProject(copy, null, false); assertEquals(project, copy); } public void testMergeWithTrailingLineFeeds() throws CoreException, IOException { IProject project = createProject("testFileConflict", new String[] { "file1.txt"}); // Set the contents of file1.txt to ensure proper merging // Ensure there is a trailing LF setContentsAndEnsureModified(project.getFile("file1.txt"), "line1" + eol + "line2" + eol + "line3" + eol); commitProject(project); // Checkout and modify a copy IProject copy = checkoutCopy(project, "-copy"); appendText(copy.getFile("file1.txt"), "line0" + eol, true); commitProject(copy); // Modify the original in a non-conflicting way setContentsAndEnsureModified(project.getFile("file1.txt"), "line1" + eol + "line2" + eol + "line2.5" + eol + "line3" + eol); // Update and ensure the contents are what we expect updateProject(project, null, false); assertTrue("File contents are not correct after merge", compareContent( new ByteArrayInputStream(("line0" + eol + "line1" + eol + "line2" + eol + "line2.5" + eol + "line3" + eol).getBytes()), project.getFile("file1.txt").getContents())); } public void testRevertToBaseHeadTag() throws CoreException, IOException{ IProject project = createProject("testRevertToBase", new String[] {"file1.txt"}); setContentsAndEnsureModified(project.getFile("file1.txt"), "line1" + eol + "line2" + eol + "line3" + eol); commitProject(project); IProject copy = checkoutCopy(project, "-copy"); appendText(project.getFile("file1.txt"), "line0" + eol, true); updateProject(project, CVSTag.BASE, true); assertTrue("File has changed after revert to base", compareContent(new ByteArrayInputStream(("line1" + eol + "line2" + eol + "line3" + eol).getBytes()), project.getFile("file1.txt").getContents())); assertEquals(getRepositoryProvider(project), getRepositoryProvider(copy), false, true); } private CVSTeamProvider getRepositoryProvider(IProject project) { return (CVSTeamProvider)RepositoryProvider.getProvider(project); } public void testRevertToBaseNonHeadTag() throws CoreException, IOException{ IProject project = createProject("testRevertToBaseNonHead", new String[] {"file1.txt"}); setContentsAndEnsureModified(project.getFile("file1.txt"), "line1" + eol + "line2" + eol); commitProject(project); tagProject(project, new CVSTag("testtag", CVSTag.BRANCH), true); appendText(project.getFile("file1.txt"), "line3" + eol, true); commitProject(project); IProject copy = checkoutCopy(project, "-copy"); appendText(copy.getFile("file1.txt"), "line0" + eol, true); updateProject(copy, CVSTag.BASE, true); assertTrue("File has changed after revert to base", compareContent(new ByteArrayInputStream(("line3" + eol + "line1" + eol + "line2" + eol).getBytes()), copy.getFile("file1.txt").getContents())); assertEquals(getRepositoryProvider(project), getRepositoryProvider(copy), false, true); } public void testSwitchTagForModifiedFile()throws CoreException, IOException { // it's a similar scenario as in https://bugs.eclipse.org/bugs/show_bug.cgi?id=192392 // create a project IProject project = createProject("testSwitchTagForModifiedFile", new String[] {"file"}); commitProject(project); // tag it CVSTag tag = new CVSTag("A", CVSTag.BRANCH); tagProject(project, tag, true); // modify a file appendText(project.getFile("file"), "changed in head" + eol, false); // switch to the tag updateProject(project, tag, false); ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(project.getFile("file")); // we expect the file to have the same tag used when switching assertEquals(tag, cvsFile.getSyncInfo().getTag()); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
0a6b24d1a8aff3394dd5b7bedd4f103f2e7d4b2c
3c8c874ce92454868fb0c1f762293681fad25ee4
/src/fantasyuser/Season.java
e2c42696c18431df3894462aa5988478c206c41c
[ "MIT" ]
permissive
arocca1/fantasy-sports-backend
950f1a2ca24b6fac2a8e5ecadc1b1323d4655167
a6c8ce62a50f9056804c4aff8baefe0e9efdf1b5
refs/heads/master
2022-11-24T22:06:18.604166
2020-04-18T17:16:26
2020-04-18T17:16:26
230,545,975
1
0
MIT
2022-11-15T23:53:35
2019-12-28T02:12:21
Java
UTF-8
Java
false
false
2,237
java
package fantasyuser; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Convert; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import database.ScoreBreakdownToStringConverter; @Entity @Table( name = "SEASONS" ) public class Season { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; private int year; private int numWeeks; private int maxTeamSize; @Convert(converter = ScoreBreakdownToStringConverter.class) // This is better served as a separate column, but JSON is better currently to handle all sports private ScoreBreakdown scoringBreakdown; private Date createdAt = Calendar.getInstance().getTime(); @ManyToOne @JoinColumn(name="leagueId", nullable=false) private League league; @OneToMany( cascade = CascadeType.ALL, orphanRemoval = true ) private List<SeasonLineupPositionRequirement> lineupRequirements; public Season() { } public Season(int year, int numWeeks, int maxTeamSize, ScoreBreakdown scoringBreakdown, League league) { this.year = year; this.numWeeks = numWeeks; this.maxTeamSize = maxTeamSize; this.scoringBreakdown = scoringBreakdown; this.league = league; } public int getNumWeeks() { return numWeeks; } public void setNumWeeks(int numWeeks) { this.numWeeks = numWeeks; } public ScoreBreakdown getScoringBreakdown() { return scoringBreakdown; } public void setScoringBreakdown(ScoreBreakdown scoringBreakdown) { this.scoringBreakdown = scoringBreakdown; } public long getId() { return id; } public int getYear() { return year; } public Date getCreatedAt() { return createdAt; } public League getLeague() { return league; } public int getMaxTeamSize() { return maxTeamSize; } public void setMaxTeamSize(int maxTeamSize) { this.maxTeamSize = maxTeamSize; } public List<SeasonLineupPositionRequirement> getLineupRequirements() { return lineupRequirements; } }
[ "rocca1.antonio@gmail.com" ]
rocca1.antonio@gmail.com
df1ce27914ffcf133a7ca7a71d21b3694ecd5c11
a8bb4a420223644c12a3ab2363bc7d07d24dc6d0
/Stepik/src/main/java/ru/alternation/stepik/basic/section4/stage2/step7/RobotConnectionException.java
4b80962300f2aae0d2ad22bea2b7d8f9e2925b0d
[ "MIT" ]
permissive
Fandorinxxx/homework
245dd1b3101b1f9ad8a4e4dc7e7acc00c8904167
a5d370e327c34efbbddf0fab540cab5940fa24b3
refs/heads/master
2020-06-18T08:02:56.113891
2019-02-04T17:22:32
2019-02-04T17:22:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package ru.alternation.stepik.basic.section4.stage2.step7; public class RobotConnectionException extends RuntimeException { public RobotConnectionException(String message) { super(message); } public RobotConnectionException(String message, Throwable cause) { super(message, cause); } }
[ "16310547+AlternatiOne@users.noreply.github.com" ]
16310547+AlternatiOne@users.noreply.github.com
578680b03f52542101080ecc90eaf72c646769c8
c663b981af3566743a774fae261548255947bfdc
/snomed-osgi/uk.nhs.cfh.dsp.snomed.expression.model/src/main/java/uk/nhs/cfh/dsp/snomed/expression/model/IntersectionExpression.java
e3e9c3893835cb1ba03e9b51ed136ffe556f48f4
[]
no_license
termlex/snofyre
c653295ecb1b2a28a44d111ff7603a3cc639e7eb
2622c524377ed7cc77a9aae9f1ec522b00da2b7c
refs/heads/master
2022-05-22T18:37:18.579877
2022-03-25T15:23:41
2022-03-25T15:23:41
34,781,765
0
0
null
null
null
null
UTF-8
Java
false
false
1,732
java
/** * Crown Copyright (C) 2008 - 2011 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.nhs.cfh.dsp.snomed.expression.model; import java.util.Collection; // TODO: Auto-generated Javadoc /** * An object representation that represents an intersection of two. * * {@link uk.nhs.cfh.dsp.snomed.expression.model.Expression} objects. * * <br>Version : @#VersionNumber#@ * <br>Written by @author Jay Kola * <br>Created on Dec 16, 2009 at 3:31:43 PM */ public interface IntersectionExpression extends Expression{ /** * Gets the contained expressions. * * @return the contained expressions */ Collection<Expression> getContainedExpressions(); /** * Sets the contained expressions. * * @param containedExpressions the new contained expressions */ void setContainedExpressions(Collection<Expression> containedExpressions); /** * Adds the contained expression. * * @param expression the expression */ void addContainedExpression(Expression expression); /** * Removes the contained expression. * * @param expression the expression */ void removeContainedExpression(Expression expression); }
[ "jay.kola@29ca23ef-472f-bbfa-ca66-17e9de3a230d" ]
jay.kola@29ca23ef-472f-bbfa-ca66-17e9de3a230d