blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
79d5f5bbc3befd398136241ee95f3adbdbfaf52b
6e7e3590efbbc116d32fedb4d77f871989baefac
/de.unistuttgart.ims.reiter.treeanno.tools/src/main/java/de/ustu/ims/reiter/treeanno/tools/ConvertDocuments.java
7d9df8dae9b4ca07b54ffa6e040027a4f0b4da4e
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
nilsreiter/treeanno
e3bc3553c6645c080f2ec1359438ec2d0fc7e495
9a0598408f4c11c846b72c878795846d3c51a73f
refs/heads/master
2021-03-19T11:37:52.792780
2019-04-04T06:57:23
2019-04-04T06:57:23
59,232,902
3
0
null
null
null
null
UTF-8
Java
false
false
1,538
java
package de.ustu.ims.reiter.treeanno.tools; import java.io.File; import java.io.IOException; import org.apache.uima.UIMAException; import org.apache.uima.collection.CollectionReaderDescription; import org.apache.uima.fit.factory.AnalysisEngineFactory; import org.apache.uima.fit.factory.CollectionReaderFactory; import org.apache.uima.fit.pipeline.SimplePipeline; import com.lexicalscope.jewel.cli.CliFactory; import com.lexicalscope.jewel.cli.Option; import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiReader; import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter; import de.ustu.ims.reiter.treeanno.util.MapToTreeAnnoClass; public class ConvertDocuments { public static void main(String[] args) throws UIMAException, IOException { Options options = CliFactory.parseArguments(Options.class, args); CollectionReaderDescription crd = CollectionReaderFactory.createReaderDescription( XmiReader.class, XmiReader.PARAM_SOURCE_LOCATION, options.getInputDirectory() + File.separator + "*.xmi", XmiReader.PARAM_LENIENT, true); SimplePipeline.runPipeline(crd, AnalysisEngineFactory .createEngineDescription(MapToTreeAnnoClass.class, MapToTreeAnnoClass.PARAM_CLASSNAME, options.getSegmentClassName()), AnalysisEngineFactory .createEngineDescription(XmiWriter.class, XmiWriter.PARAM_TARGET_LOCATION, options.getOutputDirectory())); } interface Options { @Option File getInputDirectory(); @Option File getOutputDirectory(); @Option String getSegmentClassName(); } }
038973e30f219c5973f2b10caf2665cad2bf5929
af33a79e804692fdaee6c5b312339271036a8190
/maiornumero/src/main/java/com/example/aritmeticabasica/MainActivity.java
b52481fa11b38342625d187bc7f208c7d27164df
[]
no_license
SamuelTheAlmeida/maiornumero
806fcb52dd133622e9df6ad80dd2ec672c17c142
ee2abc261c100f6cab06568fec7fa53ffdd89243
refs/heads/master
2020-06-03T05:37:55.043479
2019-06-12T02:29:51
2019-06-12T02:29:51
191,463,899
0
0
null
null
null
null
UTF-8
Java
false
false
3,904
java
,,,,,,,,,,,,,,,,,,,package com.example.aritmeticabasica; import android.content.DialogInterface; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Random; public class MainActivity extends AppCompatActivity { public TextView txtDigit1; public TextView txtDigit2; public TextView txtDigit3; public TextView txtAnswer; public EditText inputAnswer; public Button btnAnswer; public List<Integer> digits; public int answer; public int result; public double wins = 0; public double losses = 0; public double runs = 0; public double finalScore = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtDigit1 = findViewById(R.id.txtDigit1); txtDigit2 = findViewById(R.id.txtDigit2); txtDigit3 = findViewById(R.id.txtDigit3); txtAnswer = findViewById(R.id.txtAnswer); inputAnswer = findViewById(R.id.inputAnswer); startGame(); } public void startGame() { // se já foram respondidas 5 rodadas, então mostra a nota final if (runs == 5) { finalScore = (wins/runs)*100; int finalScoreInt = (int)finalScore; final AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); alertDialog.setTitle("Fim de jogo"); alertDialog.setMessage("Sua nota foi " + finalScoreInt + "!"); alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alertDialog.show(); } else { newGame(); } } public void newGame() { runs++; inputAnswer.setText(""); digits = new ArrayList<Integer>(); int drawResult; for (int i = 0; i < 3; i++) { drawResult = draw(0, 9); digits.add(drawResult); } txtDigit1.setText(String.valueOf(digits.get(0))); txtDigit2.setText(String.valueOf(digits.get(1))); txtDigit3.setText(String.valueOf(digits.get(2))); Collections.sort(digits, Collections.reverseOrder()); String resultString = String.valueOf(digits.get(0)) + String.valueOf(digits.get(1)) + String.valueOf(digits.get(2)); result = Integer.valueOf(resultString); txtAnswer.setText(String.valueOf(result)); } public int draw(int min, int max) { Random r = new Random(); int result = r.nextInt(max - min + 1) + min; return result; } public void checkAnswer(View view) { answer = Integer.valueOf(inputAnswer.getText().toString()); final AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); alertDialog.setTitle("Resultado"); if (answer == result) { wins++; alertDialog.setMessage("Resposta certa!"); } else { losses++; alertDialog.setMessage("Resposta errada! A resposta correta era " + result); } alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); startGame(); } }); alertDialog.show(); } }
2feb365f574f70dfb910a5e3294526220ca014c9
ac5a4daf5bbd7d40282af7125da9e981241c5cc0
/embedded-cassandra-parent/embedded-cassandra/src/main/java/com/github/nosan/embedded/cassandra/cql/CqlScripts.java
a1f0c59d2e60ea3a6865636147d198d7d728d480
[ "Apache-2.0" ]
permissive
MoDReD/embedded-cassandra
698f884ec3b840f40ce08be8d3909f2342baa20e
96d67348b0d9efddc4f724fbad62346dbfaf1b4a
refs/heads/master
2020-05-13T17:55:14.563765
2019-04-10T15:14:01
2019-04-10T15:14:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,460
java
/* * Copyright 2018-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.nosan.embedded.cassandra.cql; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Objects; import org.apiguardian.api.API; import com.github.nosan.embedded.cassandra.util.annotation.Nullable; /** * {@link CqlScript} implementation for a given CQL {@code scripts}. * * @author Dmytro Nosan * @see CqlScript * @since 1.0.0 */ @API(since = "1.0.0", status = API.Status.STABLE) public final class CqlScripts implements CqlScript { private final List<CqlScript> scripts; /** * Create a new {@link CqlScripts} based on scripts. * * @param scripts CQL scripts */ public CqlScripts(@Nullable CqlScript... scripts) { this((scripts != null) ? Arrays.asList(scripts) : Collections.emptyList()); } /** * Create a new {@link CqlScripts} based on scripts. * * @param scripts CQL scripts */ public CqlScripts(@Nullable Collection<? extends CqlScript> scripts) { this.scripts = Collections .unmodifiableList(new ArrayList<>((scripts != null) ? scripts : Collections.emptyList())); } @Override public Collection<String> getStatements() { List<String> statements = new ArrayList<>(); for (CqlScript script : this.scripts) { statements.addAll(script.getStatements()); } return Collections.unmodifiableList(statements); } @Override public int hashCode() { return Objects.hash(this.scripts); } @Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (other == null || getClass() != other.getClass()) { return false; } CqlScripts that = (CqlScripts) other; return Objects.equals(this.scripts, that.scripts); } @Override public String toString() { return String.format("CQL Scripts %s", this.scripts); } }
9a7d7f2f389bd5ddfa2d839d00478140c9ac50a9
fe63ba43501a9b284b525a5f2ea7172de8d82f58
/src/main/java/lazar/andric/beerstore/util/http/ApiError.java
0cbc3a61049cb4f5a76314856be0b397e92d1357
[]
no_license
lazar-andric/beer-store
681539ea0b05b87178a287c543a1a3aa9e814ff3
3416139dd2a44f930b5ab8db964484c9cb7c2764
refs/heads/main
2023-01-13T11:01:52.277235
2020-11-09T19:46:20
2020-11-09T22:00:15
311,445,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,781
java
package lazar.andric.beerstore.util.http; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Data; import org.hibernate.validator.internal.engine.path.PathImpl; import org.springframework.http.HttpStatus; import javax.validation.ConstraintViolation; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Set; @Data public class ApiError { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd-MM-yyyy hh:mm:ss") private LocalDateTime timeStamp; private HttpStatus httpStatus; private String message; private List<String> errors; public ApiError() { this.timeStamp = LocalDateTime.now(); } public ApiError(HttpStatus httpStatus, String message, List<String> errors) { this(); this.httpStatus = httpStatus; this.message = message; this.errors = errors; } public ApiError(HttpStatus httpStatus, String message) { this(); this.httpStatus = httpStatus; this.message = message; } public void addValidationErrors(Set<ConstraintViolation<?>> constraintViolation) { constraintViolation.forEach(this::addValidationError); } private void addValidationError(ConstraintViolation<?> constraintViolation) { errors = new ArrayList<>(); errors.add(new ApiValidationError( ((PathImpl)constraintViolation.getPropertyPath()).getLeafNode().asString(), constraintViolation.getMessage()).toString()); } } @AllArgsConstructor class ApiValidationError { private final String field; private final String message; @Override public String toString() { return String.format("%s %s", field, message); } }
ff3b85d887f45c78cd55f8235b923f1c3158ff93
3bb203429e33ac833d603b5abc64c7503b0e8bcd
/ZTP_zadanie2.1/src/CarOptimal.java
c77692b0473b1587b6000cd37c4be45726803d8c
[]
no_license
CrabsterK/ZTP_zadania
042aa83807156bf3cf3e350f2843f4083e63cb7c
0b18789f9567fc16c3f700f196b3af5695d66060
refs/heads/master
2021-03-30T22:42:20.128182
2018-06-10T14:04:19
2018-06-10T14:04:19
124,402,335
0
0
null
null
null
null
UTF-8
Java
false
false
606
java
import java.util.Random; public class CarOptimal { private int mileage; private byte age; private char color; public CarOptimal() { } public CarOptimal(int mileage, byte age, char color) { this.mileage = mileage; this.age = age; this.color = color; } public long getMileage() { return mileage; } public CarOptimal generateRandom(){ Random rn = new Random(); int mil = rn.nextInt(700000); byte age = (byte)rn.nextInt(112); char color = 'n'; return new CarOptimal(mil, age, color); } }
7306b1c4ab3427c471d0a4fe4874e48ac3a79266
4a85057fbc21d2997422aa7a6bfe8892f687fbcc
/CTCI6/src/ch7_ObjectOrientedDesign/CallCenter.java
0038ad85c4787f0f6ac8ace2a99c2dffe66018ae
[]
no_license
Dipesh290193/CTCI6
f9a6c023fe7518c1ae4be30de7d58d493eea2c87
0993a9adc51b4e0f3efedb350898c0ce292a27cf
refs/heads/master
2022-12-26T17:35:53.364283
2019-09-08T17:22:45
2019-09-08T17:22:45
84,251,579
0
0
null
null
null
null
UTF-8
Java
false
false
1,624
java
package ch7_ObjectOrientedDesign; import java.util.ArrayList; import java.util.List; public class CallCenter { } class CallHandler{ private static List<Employee> resonders = new ArrayList<Employee>(); private static List<Employee> managers = new ArrayList<>(); private static List<Employee> directors = new ArrayList<>(); List<List<Call>> queue; public Employee assignEmployee(Call call) { return null; } public void addEmployee(Employee e) { } } enum Position { RESPONDER, MANAGER, DIRECTOR } class Caller{ String name; int ssn; String area; public Caller(String name, int ssn) { this.name = name; this.ssn = ssn; } } class Call{ private Caller caller; private Employee callHandler; public Call(Caller c) { this.caller = c; } public void replay(String message){} public void setCallHandler(Employee e) { this.callHandler = e; } public Employee getCallHandler() { return this.callHandler; } public void disconnect(){ } } abstract class Employee{ private Call currentCall; private String empId; private String name; protected Position position; public boolean isFree() { return currentCall == null; } public void receiveCall(Call call) { this.currentCall = call; } public void finishCall() { this.currentCall = null; } } class Responder extends Employee { public Responder(){ this.position = Position.RESPONDER; } } class Manager extends Employee { public Manager(){ this.position = Position.MANAGER; } } class Director extends Employee { public Director(){ this.position = Position.DIRECTOR; } }
bb133d383631d627467b0d17ddb57cc2565d1c9d
6b273ca9d70b1aa2988a8047acb89920074d7165
/io/AlbumFile.java
1c51cbb3c691463090993a1c0119b2cdb58331f6
[]
no_license
sharansa98/Android
9543c7249fbc86d3183d184eda6714df0fb6b8d5
e31f589194964260b00fd1281fee4a9531d36dc3
refs/heads/master
2021-01-02T16:42:18.810382
2020-02-11T08:10:42
2020-02-11T08:10:42
239,706,647
0
0
null
null
null
null
UTF-8
Java
false
false
2,373
java
/* * Copyright (c) 2018 by k3b. * * This file is part of AndroFotoFinder / #APhotoManager * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License * for more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/> */ package de.k3b.io; import java.io.File; import java.util.ArrayList; import java.util.List; /** * Created by k3b on 17.04.2018. */ public class AlbumFile { public static final String SUFFIX_VALBUM = ".album"; public static final String SUFFIX_QUERY = ".query"; public static boolean isQueryFile(String uri) { if (uri != null) { return uri.endsWith(SUFFIX_VALBUM) || uri.endsWith(SUFFIX_QUERY); } return false; } public static boolean isQueryFile(File uri) { if (uri != null) { return isQueryFile(uri.getName()); } return false; } public static File getExistingQueryFileOrNull(String uri) { if (isQueryFile(uri)) { File result = new File(FileUtils.fixPath(uri)); if ((result != null) && result.isFile() && result.exists()) return result; } return null; } /** return all album files as absolute path */ public static List<String> getFilePaths(List<String> result, File root, int subDirLevels) { if (result == null) result = new ArrayList<String>(); if ((root != null) && !FileUtils.isSymlinkDir(root,false) && root.isDirectory()) { for (File file : root.listFiles()) { if (file.isDirectory() && (subDirLevels > 1)) { getFilePaths(result, file, subDirLevels - 1); } else if (isQueryFile((file))) { String path = FileUtils.tryGetCanonicalPath(file, null); result.add(path); } } } return result; } }
d8de891f6ad6b9b7046a5826f510e453121dfdc5
76138fb2c873dd4ef07ba05ed1fa8bee3cb53f7c
/app/src/main/java/vijayanthanusan/com/coloris/Menu.java
a8f80b27d24d9b8a269e023ce77d1b1db11f88cb
[]
no_license
VijayanThanusan/Coloris
735ff41aa1223da790d351ef9f607a2acfd6f6c9
2c5e8b2f5d7b1fa3d4bcfe9f37a9ed078b598f63
refs/heads/master
2020-07-01T01:29:28.641043
2019-08-12T13:29:30
2019-08-12T13:29:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,846
java
package vijayanthanusan.com.coloris; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.ToggleButton; public class Menu extends AppCompatActivity { private Button mButton, buttonPlay; ToggleButton Toggle1; EditText actualScore; TextView bestScore; TextView actualScore1; int score; int score1; int highscore; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.menu); mButton = (Button) findViewById(R.id.button); buttonPlay = (Button) findViewById(R.id.boutonPlay); mButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Code here executes on main thread after user presses button Intent intent = new Intent(Menu.this, About.class); startActivity(intent); } }); buttonPlay.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Code here executes on main thread after user presses button Intent intent = new Intent(Menu.this, Coloris.class); startActivity(intent); } }); Toggle1 = (ToggleButton) findViewById(R.id.toggleButton); final MediaPlayer mp = MediaPlayer.create(this, R.raw.son); Toggle1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (Toggle1.isChecked()) { mp.start(); } else { mp.pause(); } } }); actualScore = (EditText) findViewById(R.id.actualScore); bestScore = (TextView) findViewById(R.id.bestScore); actualScore1 = (TextView) findViewById(R.id.actualScore1); } public void displayScore (View view) { score1= Integer.parseInt(actualScore1.getText().toString()); highscore=Integer.parseInt(bestScore.getText().toString()); SharedPreferences sharedPref = getSharedPreferences("bestScore", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); editor.putString("actualScore", actualScore.getText().toString()); editor.apply(); String score = sharedPref.getString("actualScore", ""); actualScore1.setText(score); if (score1 > highscore) { bestScore.setText(score); } } }
f6eb1f1040d44dda6ba6c2109824f095dd14582c
83e43cc195c4b7bd7bd303726c265936ef4bfce0
/app/src/androidTest/java/com/tecnologias/uniagustapp/ExampleInstrumentedTest.java
a9fc56bcf0fd3ec662b09237803c1d3ffb01168e
[]
no_license
david-minaya/UniagustApp
1ae40a9db8c4b4e0d3e8897ad919c2e8d4bdefa8
5892bea12ad3caf27a3d2303b7f0e19774fa7f97
refs/heads/master
2021-05-07T19:28:26.028041
2017-10-31T16:50:28
2017-10-31T16:50:28
107,465,997
0
0
null
2017-10-30T23:50:20
2017-10-18T21:38:26
Java
UTF-8
Java
false
false
758
java
package com.tecnologias.uniagustapp; 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.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.tecnologias.uniagustapp", appContext.getPackageName()); } }
cf026ea26b81b8c47b8de14dc05ef6b5693d52e5
cd5c03435999dcfbde6d1ff5dfc796d45eb41777
/cordovaApp/platforms/android/src/com/niit/cordova/MainActivity.java
02b872edae5994f3510a5ffc9699398049234f5a
[]
no_license
erpragatisingh/cordova-codepush
e2b6dbbbd10d4f23ef0a657b8ab3960b19f9b721
ca7010cbbd64ccffad1b5159bd1f600b708c2185
refs/heads/master
2021-07-08T13:21:06.921224
2017-10-05T03:43:23
2017-10-05T03:43:23
105,759,264
0
0
null
null
null
null
UTF-8
Java
false
false
1,449
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 com.niit.cordova; import android.os.Bundle; import org.apache.cordova.*; public class MainActivity extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // enable Cordova apps to be started in the background Bundle extras = getIntent().getExtras(); if (extras != null && extras.getBoolean("cdvStartInBackground", false)) { moveTaskToBack(true); } // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); } }
bfaaa791dd83e78b90a0ddab91483dbd453c81cb
f774e6ef461b9212476ea5309a9144a5de3e9cb4
/src/model/dao/exceptions/DataBaseException.java
49fd56c4b0a305772c744cd8b1112644998862f1
[]
no_license
UnalSoft/siac
56569516a8891a89d68124b8c7986a9832bd2f93
b661f4466711fca54aa19891aee4969b9c9e84ea
refs/heads/master
2016-08-05T04:26:32.999273
2013-07-04T19:04:45
2013-07-04T19:04:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package model.dao.exceptions; /** * * @author Alexander */ public class DataBaseException extends Exception { public DataBaseException(String msg) { super(msg); } public DataBaseException(String message, Throwable cause) { super(message, cause); } }
89162d4210bda2b9ec758eb6078ff425747968cc
96f8d42c474f8dd42ecc6811b6e555363f168d3e
/zuiyou/sources/cn/xiaochuankeji/tieba/background/j/c.java
7b82af3d980b13d11cf6efb617583962d26d7bc4
[]
no_license
aheadlcx/analyzeApk
050b261595cecc85790558a02d79739a789ae3a3
25cecc394dde4ed7d4971baf0e9504dcb7fabaca
refs/heads/master
2020-03-10T10:24:49.773318
2018-04-13T09:44:45
2018-04-13T09:44:45
129,332,351
6
2
null
null
null
null
UTF-8
Java
false
false
220
java
package cn.xiaochuankeji.tieba.background.j; public interface c { public interface a { void a(); } void a(); void a(int i, int i2); void b(); void setViewDownloadState(boolean z); }
5e4df25237fc501c95a03ee6e56e7ee5ccdd700f
4c658b4de1b461af1082516d7e86a50b3ae57ada
/src/EjercicioClaseAbstracta/SeleccionFutbol.java
4963ad1cdd8aeb6ed63f4482717e0c5abc352b0e
[]
no_license
Fiap97/Ensalada
b62f67c9a5893069456d1bdf8337dea7bf2bab3a
b24917875b5074a391c4f5c0b166dbd10e913302
refs/heads/main
2023-07-01T22:13:20.243724
2021-08-09T15:08:05
2021-08-09T15:08:05
394,331,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,267
java
package EjercicioClaseAbstracta; public abstract class SeleccionFutbol { private int id; private String nombre; private String apellidos; private int edad; public SeleccionFutbol() { } public SeleccionFutbol(int id, String nombre, String apellidos, int edad) { this.id = id; this.nombre = nombre; this.apellidos = apellidos; this.edad = edad; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getApellidos() { return apellidos; } public void setApellidos(String apellidos) { this.apellidos = apellidos; } public int getEdad() { return edad; } public void setEdad(int edad) { this.edad = edad; } public void viajar() { System.out.println("Viajando"); } public void concentrarse() { System.out.println("Concentradose"); } public void entrenamiento() { System.out.println("Entrenando"); } public void partidoFutbol() { System.out.println("Jugando el partido"); } @Override public String toString() { return "SeleccionFutbol [id=" + id + ", nombre=" + nombre + ", apellidos=" + apellidos + ", edad=" + edad + "]"; } }
cfad096c707ab681208179e2f5a9bf9cac6ff35f
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE470_Unsafe_Reflection/CWE470_Unsafe_Reflection__connect_tcp_05.java
435372b3fdae46450d61fe08826904395938f34a
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
6,697
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE470_Unsafe_Reflection__connect_tcp_05.java Label Definition File: CWE470_Unsafe_Reflection.label.xml Template File: sources-sink-05.tmpl.java */ /* * @description * CWE: 470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') * BadSource: connect_tcp Read data using an outbound tcp connection * GoodSource: Set data to a hardcoded class name * BadSink: Instantiate class named in data * Flow Variant: 05 Control flow: if(privateTrue) and if(privateFalse) * * */ package testcases.CWE470_Unsafe_Reflection; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.util.logging.Level; public class CWE470_Unsafe_Reflection__connect_tcp_05 extends AbstractTestCase { /* The two variables below are not defined as "final", but are never * assigned any other value, so a tool should be able to identify that * reads of these will always return their initialized values. */ private boolean privateTrue = true; private boolean privateFalse = false; /* uses badsource and badsink */ public void bad() throws Throwable { String data; if (privateTrue) { data = ""; /* Initialize data */ /* Read data using an outbound tcp connection */ { Socket socket = null; BufferedReader readerBuffered = null; InputStreamReader readerInputStream = null; try { /* Read data using an outbound tcp connection */ socket = new Socket("host.example.org", 39544); /* read input from socket */ readerInputStream = new InputStreamReader(socket.getInputStream(), "UTF-8"); readerBuffered = new BufferedReader(readerInputStream); /* POTENTIAL FLAW: Read data using an outbound tcp connection */ data = readerBuffered.readLine(); } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error with stream reading", exceptIO); } finally { /* clean up stream reading objects */ try { if (readerBuffered != null) { readerBuffered.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing BufferedReader", exceptIO); } try { if (readerInputStream != null) { readerInputStream.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing InputStreamReader", exceptIO); } /* clean up socket objects */ try { if (socket != null) { socket.close(); } } catch (IOException exceptIO) { IO.logger.log(Level.WARNING, "Error closing Socket", exceptIO); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */ Class<?> tempClass = Class.forName(data); Object tempClassObject = tempClass.newInstance(); IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */ } /* goodG2B1() - use goodsource and badsink by changing privateTrue to privateFalse */ private void goodG2B1() throws Throwable { String data; if (privateFalse) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } else { /* FIX: Use a hardcoded class name */ data = "Testing.test"; } /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */ Class<?> tempClass = Class.forName(data); Object tempClassObject = tempClass.newInstance(); IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */ } /* goodG2B2() - use goodsource and badsink by reversing statements in if */ private void goodG2B2() throws Throwable { String data; if (privateTrue) { /* FIX: Use a hardcoded class name */ data = "Testing.test"; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = null; } /* POTENTIAL FLAW: Instantiate object of class named in data (which may be from external input) */ Class<?> tempClass = Class.forName(data); Object tempClassObject = tempClass.newInstance(); IO.writeLine(tempClassObject.toString()); /* Use tempClassObject in some way */ } public void good() throws Throwable { goodG2B1(); goodG2B2(); } /* Below is the main(). It is only used when building this testcase on * its own for testing or for building a binary to use in testing binary * analysis tools. It is not used when compiling all the testcases as one * application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
1597e1791cf6b95950366cbf386efe2e4791a86f
eca66c0387c84b606fb9336f65eeb95c5b847372
/android/app/src/main/java/com/eshopmobileclient/MainActivity.java
db5512095396736da63c1916b9ecd91d20aea9e5
[]
no_license
ChrisBapin/eshop-mobile-client
a1e06ee8671ad2f829192dacbfd8133de22f70bb
e22d5cd623da41b8f4d17c2b252631b3d65cb027
refs/heads/master
2023-01-06T02:35:30.950653
2019-07-20T20:48:15
2019-07-20T20:48:15
181,650,367
0
0
null
2023-01-04T04:55:48
2019-04-16T08:44:31
JavaScript
UTF-8
Java
false
false
848
java
package com.eshopmobileclient; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.ReactRootView; import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "eshopMobileClient"; } @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { @Override protected ReactRootView createRootView() { return new RNGestureHandlerEnabledRootView(MainActivity.this); } }; } }
65b42beeb57b81951a26cb4d4830f6fb655d9c66
3274d151ad1db18ee513551864bdc944866d3a18
/CNS_analysis/MyCNSanalysis/src/me/songbx/mains/CnsSubfunctionlizationV2.java
2267f304406d82a2d02d9399d505ac4cdec3a0a3
[ "MIT" ]
permissive
baoxingsong/CNSpublication
4e91f6f6c94583e11cee23f3b2cd1ff4e2fdab6f
00540e13be60631e2ea6f337944101e78c45119c
refs/heads/master
2023-03-20T05:37:14.825450
2021-02-27T20:19:44
2021-02-27T20:19:44
292,394,564
0
0
null
null
null
null
UTF-8
Java
false
false
36,049
java
package me.songbx.mains; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import me.songbx.impl.ChromoSomeReadImpl; import me.songbx.impl.ReadGffForSimpleGene; import me.songbx.model.GeneSimple; import me.songbx.model.Strand; import htsjdk.samtools.SAMRecord; import htsjdk.samtools.SAMRecordIterator; import htsjdk.samtools.SamReader; import htsjdk.samtools.SamReaderFactory; import htsjdk.samtools.ValidationStringency; public class CnsSubfunctionlizationV2 { public static void main(String[] args) { new CnsSubfunctionlizationV2(1500); new CnsSubfunctionlizationV2(1600); new CnsSubfunctionlizationV2(1700); new CnsSubfunctionlizationV2(1800); new CnsSubfunctionlizationV2(1900); new CnsSubfunctionlizationV2(2000); new CnsSubfunctionlizationV2(2100); new CnsSubfunctionlizationV2(2200); new CnsSubfunctionlizationV2(2300); new CnsSubfunctionlizationV2(2400); new CnsSubfunctionlizationV2(2500); } public CnsSubfunctionlizationV2( int maizeIntervalEnd){ int maizeIntervalStart = 1; int sorghumExtendLength = maizeIntervalEnd; int miniscore = 0; int maxscore = 500000; // read gff files begin HashMap<String, GeneSimple> maizeGenes = new ReadGffForSimpleGene("/media/bs674/2t/genomeSequence/maize/Zea_mays.AGPv4.34.gff3").getGenes(); HashMap<String, GeneSimple> sorghumGenes = new ReadGffForSimpleGene("/media/bs674/2t/genomeSequence/sorghum/Sorghum_bicolor.Sorghum_bicolor_NCBIv3.42.gff3").getGenes(); // read gff files end //read genome files begin // HashMap<String, String> sorghum1 = new ChromoSomeReadImpl("/media/bs674/1_8t/AndCns/maskGenomeForGenomeAlignment/masked_sorghum_k20_26.fa").getChromoSomeHashMap(); HashMap<String, String> sorghum2 = new ChromoSomeReadImpl("/media/bs674/1_8t/AndCns/maskGenomeForGenomeAlignment/masked_sorghum_k20_26_gff_cds.fa").getChromoSomeHashMap(); //HashMap<String, String> maize = new ChromoSomeReadImpl("/media/bs674/1_8t/AndCns/maskGenomeForGenomeAlignment/masked_B73_v4_k20_46.fa").getChromoSomeHashMap(); // read genome files end // generated a data set of successfully lifted maize genes begin HashMap<String, HashSet<String>> liftedMaizeToSorghum = new HashMap<String, HashSet<String>>(); //key is the maize gene and value is a hashset of sorghum genes try { SamReader readerSam = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(new File("/media/bs674/1_8t/AndCns/sorghum/sorghum.sam")); SAMRecordIterator itSam = readerSam.iterator(); while (itSam.hasNext()) { final SAMRecord samRecord = itSam.next(); if( samRecord.getFlags()!= 4) { if( ! liftedMaizeToSorghum.containsKey(samRecord.getReadName()) ) { liftedMaizeToSorghum.put(samRecord.getReadName(), new HashSet<String>()); } String sorghumChr = samRecord.getContig(); int start = samRecord.getStart(); int end = samRecord.getEnd(); // System.out.println(samRecord.getFlags() + " \t" + sorghumChr); for( String geneId : sorghumGenes.keySet() ) { if ( sorghumGenes.get(geneId).getChromeSomeName().compareTo(sorghumChr) == 0 ) { if( (sorghumGenes.get(geneId).getStart() <= start && start <= sorghumGenes.get(geneId).getEnd()) || ( sorghumGenes.get(geneId).getStart() <= end && end <= sorghumGenes.get(geneId).getEnd() )) { if( (sorghumGenes.get(geneId).getStrand() == Strand.NEGTIVE && samRecord.getReadNegativeStrandFlag() ) || (sorghumGenes.get(geneId).getStrand() != Strand.NEGTIVE && (!samRecord.getReadNegativeStrandFlag() ) ) ) { liftedMaizeToSorghum.get(samRecord.getReadName()).add(geneId); // System.out.println(samRecord.getReadName() + "\t" + geneId); } } } } } } readerSam.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // generated a data set of successfully lifted maize genes begin // get the syntenic paralogous relationship between maize and sorghum begin HashMap<String, ArrayList<String>> sorghum_gene_to_maize_genes = new HashMap<String, ArrayList<String>>(); try { File file = new File("/media/bs674/pan_and_non_asse/core_Andropogoneae_genes/tabasco2.0/quota-alignment/maize_sorghum/syntenic_genes"); BufferedReader reader = new BufferedReader(new FileReader(file)); String tempString = null; while ((tempString = reader.readLine()) != null) { if(tempString.startsWith("#")){ }else{ String[] arrOfStr = tempString.split("\\s+"); if ( ! sorghum_gene_to_maize_genes.containsKey(arrOfStr[0]) ) { sorghum_gene_to_maize_genes.put(arrOfStr[0], new ArrayList<String>()); } if( liftedMaizeToSorghum.containsKey(arrOfStr[1]) && liftedMaizeToSorghum.get(arrOfStr[1]).contains(arrOfStr[0]) ) { sorghum_gene_to_maize_genes.get(arrOfStr[0]).add(arrOfStr[1]); } } } reader.close(); } catch (IOException e) { e.printStackTrace(); } PrintWriter outPut = null; try { /* HashMap<String, HashSet<Integer>> cnsRecords = new HashMap<String, HashSet<Integer>> (); try { File file = new File( "/media/bs674/1_8t/AndCns/sorghum/and_cns_sorghum_maize_V2_smaller_kmer_frequency/5.wig" ); BufferedReader reader = new BufferedReader(new FileReader(file)); String tempString = null; String chr = ""; Pattern p0 =Pattern.compile("chrom=(\\S+)"); while ((tempString = reader.readLine()) != null) { if( tempString.charAt(0) == 't' ) { }else if( tempString.charAt(0) == 'v' ) { Matcher m = p0.matcher(tempString); if( m.find() ) { chr = m.group(1); } }else { String[] arrOfStr = tempString.split("\\s+"); if( ! cnsRecords.containsKey(chr) ) { cnsRecords.put(chr, new HashSet<Integer>()); } if( Integer.parseInt(arrOfStr[1]) > 0 ) { cnsRecords.get(chr).add(Integer.parseInt(arrOfStr[0])); } } } reader.close(); } catch (IOException e) { e.printStackTrace(); } */ outPut = new PrintWriter("/media/bs674/1_8t/AndCns/subfunctionlization/pancns/subfunctionlization_score"+miniscore+"_"+maxscore+"_"+sorghumExtendLength+"_"+maizeIntervalStart+"_"+maizeIntervalEnd); Pattern p = Pattern.compile("^(\\d+)H"); for ( String sorghumGene : sorghum_gene_to_maize_genes.keySet() ) { if( sorghum_gene_to_maize_genes.get(sorghumGene).size() == 2 ) { { int i=0; if ( ! sorghum_gene_to_maize_genes.containsKey(sorghumGene) ) { System.out.println("line 63:" + sorghumGene); continue; } if ( ! maizeGenes.containsKey(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)) ) { System.out.println("line 67:" + sorghum_gene_to_maize_genes.get(sorghumGene).get(i)); continue; } if ( ! sorghumGenes.containsKey(sorghumGene) ) { System.out.println("line 71:" + sorghum_gene_to_maize_genes.get(sorghumGene).get(i)); continue; } i=1; if ( ! maizeGenes.containsKey(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)) ) { System.out.println("line 82:" + sorghum_gene_to_maize_genes.get(sorghumGene).get(i)); continue; } if ( ! sorghumGenes.containsKey(sorghumGene) ) { System.out.println("line 85:" + sorghum_gene_to_maize_genes.get(sorghumGene).get(i)); continue; } } // this also count number of Ms with cigar string , similar with samtools depth command int all_position=0; int all_position1=0; int all_position2=0; { // up stream, upstream is defined from start codon String sorghumIntervalChr = sorghumGenes.get(sorghumGene).getChromeSomeName(); int sorghumIntervalStart = sorghumGenes.get(sorghumGene).getStart() - sorghumExtendLength; int sorghumIntervalEnd = sorghumGenes.get(sorghumGene).getStart()-1; ArrayList<AlignedSorghumFragment2> alignedSorghumFragments1 = new ArrayList<AlignedSorghumFragment2>(); ArrayList<AlignedSorghumFragment2> alignedSorghumFragments2 = new ArrayList<AlignedSorghumFragment2>(); for (int i=0; i<2; ++i) { // System.out.println("iiiii:" + i); int wantedStrand = 1; if( maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStrand() != sorghumGenes.get(sorghumGene).getStrand() ) { wantedStrand = 0; // negative strand } String maizeChr = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getChromeSomeName(); int maizeStart = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStart() - maizeIntervalEnd; int maizeEnd = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStart()-maizeIntervalStart; if ( 0 == wantedStrand ) { maizeStart = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getEnd()+maizeIntervalStart; maizeEnd = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getEnd()+maizeIntervalEnd; } SamReader reader = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(new File("/media/bs674/1_8t/AndCns/sorghum/and_cns_sorghum_maize_V2_smaller_kmer_frequency/5.bam")); SAMRecordIterator it = reader.queryOverlapping(maizeChr, maizeStart, maizeEnd); while (it.hasNext()) { final SAMRecord samRecord = it.next(); // System.out.println(samRecord.getReadName() + " " + samRecord.getCigarString() + " " + samRecord.getAlignmentStart() + " " + samRecord.getAlignmentEnd() + " " + samRecord.getReadNegativeStrandFlag()); Matcher m=p.matcher(samRecord.getCigarString()); if(m.find() && samRecord.getMappingQuality() >= miniscore && samRecord.getMappingQuality()<=maxscore){ int strand = 1; if ( samRecord.getReadNegativeStrandFlag() ) { strand = 0; } if ( strand == wantedStrand ) { // System.out.println(samRecord.getReadName() + " " + samRecord.getCigarString() + " " + samRecord.getAlignmentStart() + " " + samRecord.getAlignmentEnd() + " " + samRecord.getReadNegativeStrandFlag()); int queryStart = Integer.parseInt(m.group(1)); int queryEnd = queryStart + samRecord.getReadString().length()-1; // System.out.println("" + samRecord.getReadString().length() + "\t" + queryStart + " " + queryEnd); if( samRecord.getReadName().compareTo(sorghumIntervalChr)==0 && sorghumIntervalChr.charAt(0)!='s' && maizeChr.charAt(0)!='B' ) { if( (sorghumIntervalStart<=queryStart && queryStart<= sorghumIntervalEnd) || (sorghumIntervalStart<=queryEnd && queryEnd<= sorghumIntervalEnd) || (queryStart<=sorghumIntervalEnd && sorghumIntervalEnd<= queryEnd) || (queryStart<=sorghumIntervalStart && sorghumIntervalStart<= queryEnd) ) { //System.out.println( maizeChr + "\t" + samRecord.getStart() + "\t" + sorghumIntervalChr + "\t" + queryStart + "\t" + samRecord.getCigarString() ); // ArrayList<String> alignment = cirgarToAlignment( maize.get(maizeChr), samRecord.getStart(), sorghum2.get(sorghumIntervalChr), queryStart, samRecord.getCigarString() ); // System.out.println(alignment.get(0)); // System.out.println(alignment.get(1) + "\n"); AlignedSorghumFragment2 alignedSorghumFragment = new AlignedSorghumFragment2(samRecord.getReadName(), strand); if ( samRecord.getReadNegativeStrandFlag() ) { for ( int position = queryEnd; position >= queryStart; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } --position; } } else if ( cigerLetter=='I' ) { position-=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } }else { for ( int position = queryStart; position<=queryEnd; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } ++position; } } else if ( cigerLetter=='I' ) { position+=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } } if( 0 == i ) { alignedSorghumFragments1.add(alignedSorghumFragment); }else { alignedSorghumFragments2.add(alignedSorghumFragment); } } } } } } try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } HashSet<Integer> allPositions = new HashSet<Integer>(); HashSet<Integer> positions1 = new HashSet<Integer>(); HashSet<Integer> positions2 = new HashSet<Integer>(); for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments1 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions1.add(position); } } } for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments2 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions2.add(position); } } } if ( Strand.POSITIVE == sorghumGenes.get(sorghumGene).getStrand() ) { outPut.print("upstream"); }else { outPut.print("downstream"); } all_position += allPositions.size(); all_position1 += positions1.size(); all_position2 += positions2.size(); outPut.println("\t" + sorghumGene + "\t" + sorghum_gene_to_maize_genes.get(sorghumGene).get(0) + "\t" +sorghum_gene_to_maize_genes.get(sorghumGene).get(1) + "\t" + allPositions.size() + "\t" + positions1.size() + "\t" + positions2.size()); } if( sorghumGenes.get(sorghumGene).getNumberOfCds() > 1 ) { // intron String sorghumIntervalChr = sorghumGenes.get(sorghumGene).getChromeSomeName(); int sorghumIntervalStart = sorghumGenes.get(sorghumGene).getStart(); int sorghumIntervalEnd = sorghumGenes.get(sorghumGene).getEnd(); ArrayList<AlignedSorghumFragment2> alignedSorghumFragments1 = new ArrayList<AlignedSorghumFragment2>(); ArrayList<AlignedSorghumFragment2> alignedSorghumFragments2 = new ArrayList<AlignedSorghumFragment2>(); for (int i=0; i<2; ++i) { if( maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getNumberOfCds() > 1 ) { int wantedStrand = 1; if( maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStrand() != sorghumGenes.get(sorghumGene).getStrand() ) { wantedStrand = 0; } String maizeChr = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getChromeSomeName(); int maizeStart = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStart(); int maizeEnd = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getEnd(); SamReader reader = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(new File("/media/bs674/1_8t/AndCns/sorghum/and_cns_sorghum_maize_V2_smaller_kmer_frequency/5.bam")); SAMRecordIterator it = reader.queryOverlapping(maizeChr, maizeStart, maizeEnd); while (it.hasNext()) { final SAMRecord samRecord = it.next(); Matcher m=p.matcher(samRecord.getCigarString()); if(m.find() && samRecord.getMappingQuality() >= miniscore && samRecord.getMappingQuality()<=maxscore){ int strand = 1; if ( samRecord.getReadNegativeStrandFlag() ) { strand = 0; } if ( strand == wantedStrand ) { //System.out.println(samRecord.getReadName() + " " + samRecord.getCigarString() + " " + samRecord.getAlignmentStart() + " " + samRecord.getAlignmentEnd() + " " + samRecord.getReadNegativeStrandFlag()); int queryStart = Integer.parseInt(m.group(1)); int queryEnd = queryStart + samRecord.getReadString().length()-1; if( samRecord.getReadName().compareTo(sorghumIntervalChr)==0 ) { //System.out.println(samRecord.getReadName() + " " + samRecord.getCigarString() + " " + samRecord.getAlignmentStart() + " " + samRecord.getAlignmentEnd() + " " + samRecord.getReadNegativeStrandFlag()); //System.out.println("" + samRecord.getReadString().length() + "\t" + queryStart + " " + queryEnd); if( (sorghumIntervalStart<=queryStart && queryStart<= sorghumIntervalEnd) || (sorghumIntervalStart<=queryEnd && queryEnd<= sorghumIntervalEnd) || (queryStart<=sorghumIntervalEnd && sorghumIntervalEnd<= queryEnd) || (queryStart<=sorghumIntervalStart && sorghumIntervalStart<= queryEnd) ) { AlignedSorghumFragment2 alignedSorghumFragment = new AlignedSorghumFragment2(samRecord.getReadName(), strand); if ( samRecord.getReadNegativeStrandFlag() ) { for ( int position = queryEnd; position >= queryStart; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } --position; } } else if ( cigerLetter=='I' ) { position-=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } }else { for ( int position = queryStart; position<=queryEnd; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } ++position; } } else if ( cigerLetter=='I' ) { position+=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } } if( 0 == i ) { alignedSorghumFragments1.add(alignedSorghumFragment); }else { alignedSorghumFragments2.add(alignedSorghumFragment); } } } } } } //System.out.println(); //System.out.println(); try { reader.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } HashSet<Integer> allPositions = new HashSet<Integer>(); HashSet<Integer> positions1 = new HashSet<Integer>(); HashSet<Integer> positions2 = new HashSet<Integer>(); for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments1 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions1.add(position); } } } for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments2 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions2.add(position); } } } outPut.println("intron\t" + sorghumGene + "\t" + sorghum_gene_to_maize_genes.get(sorghumGene).get(0) + "\t" +sorghum_gene_to_maize_genes.get(sorghumGene).get(1) + "\t" + allPositions.size() + "\t" + positions1.size() + "\t" + positions2.size()); } { // down stream String sorghumIntervalChr = sorghumGenes.get(sorghumGene).getChromeSomeName(); int sorghumIntervalStart = sorghumGenes.get(sorghumGene).getEnd()+1; int sorghumIntervalEnd = sorghumGenes.get(sorghumGene).getEnd()+sorghumExtendLength; ArrayList<AlignedSorghumFragment2> alignedSorghumFragments1 = new ArrayList<AlignedSorghumFragment2>(); ArrayList<AlignedSorghumFragment2> alignedSorghumFragments2 = new ArrayList<AlignedSorghumFragment2>(); for (int i=0; i<2; ++i) { int wantedStrand = 1; if( maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStrand() != sorghumGenes.get(sorghumGene).getStrand() ) { wantedStrand = 0; } String maizeChr = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getChromeSomeName(); int maizeStart = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getEnd()+maizeIntervalStart; int maizeEnd = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getEnd()+maizeIntervalEnd; if ( 0 == wantedStrand ) { maizeStart = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStart() - maizeIntervalEnd; maizeEnd = maizeGenes.get(sorghum_gene_to_maize_genes.get(sorghumGene).get(i)).getStart()-maizeIntervalStart; } SamReader reader = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT).open(new File("/media/bs674/1_8t/AndCns/sorghum/and_cns_sorghum_maize_V2_smaller_kmer_frequency/5.bam")); SAMRecordIterator it = reader.queryOverlapping(maizeChr, maizeStart, maizeEnd); while (it.hasNext()) { final SAMRecord samRecord = it.next(); Matcher m=p.matcher(samRecord.getCigarString()); if(m.find() && samRecord.getMappingQuality() >= miniscore && samRecord.getMappingQuality()<=maxscore){ int strand = 1; if ( samRecord.getReadNegativeStrandFlag() ) { strand = 0; } if ( strand == wantedStrand ) { int queryStart = Integer.parseInt(m.group(1)); int queryEnd = queryStart + samRecord.getReadString().length()-1; if( samRecord.getReadName().compareTo(sorghumIntervalChr)==0 ) { if( (sorghumIntervalStart<=queryStart && queryStart<= sorghumIntervalEnd) || (sorghumIntervalStart<=queryEnd && queryEnd<= sorghumIntervalEnd) || (queryStart<=sorghumIntervalEnd && sorghumIntervalEnd<= queryEnd) || (queryStart<=sorghumIntervalStart && sorghumIntervalStart<= queryEnd) ) { AlignedSorghumFragment2 alignedSorghumFragment = new AlignedSorghumFragment2(samRecord.getReadName(), strand); if ( samRecord.getReadNegativeStrandFlag() ) { for ( int position = queryEnd; position >= queryStart; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } --position; } } else if ( cigerLetter=='I' ) { position-=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } }else { for ( int position = queryStart; position<=queryEnd; ) { Pattern pCigar = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = pCigar.matcher(samRecord.getCigarString()); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { if( position >= sorghumIntervalStart && position<=sorghumIntervalEnd ) { alignedSorghumFragment.getPositions().add(position); } ++position; } } else if ( cigerLetter=='I' ) { position+=length; } else if ( cigerLetter=='D' || cigerLetter=='N' ) { } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } } } if( 0 == i ) { alignedSorghumFragments1.add(alignedSorghumFragment); }else { alignedSorghumFragments2.add(alignedSorghumFragment); } } } } } } try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } HashSet<Integer> allPositions = new HashSet<Integer>(); HashSet<Integer> positions1 = new HashSet<Integer>(); HashSet<Integer> positions2 = new HashSet<Integer>(); for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments1 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions1.add(position); } } } for( AlignedSorghumFragment2 alignedSorghumFragment : alignedSorghumFragments2 ) { for( int position : alignedSorghumFragment.getPositions() ) { if( sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'n' && sorghum2.get(sorghumIntervalChr).charAt(position-1) != 'N') { allPositions.add(position); positions2.add(position); } } } if ( Strand.POSITIVE == sorghumGenes.get(sorghumGene).getStrand() ) { outPut.print("downstream"); }else { outPut.print("upstream"); } all_position += allPositions.size(); all_position1 += positions1.size(); all_position2 += positions2.size(); outPut.println("\t" + sorghumGene + "\t" + sorghum_gene_to_maize_genes.get(sorghumGene).get(0) + "\t" +sorghum_gene_to_maize_genes.get(sorghumGene).get(1) + "\t" + allPositions.size() + "\t" + positions1.size() + "\t" + positions2.size()); } outPut.println("all\t" + sorghumGene + "\t" + sorghum_gene_to_maize_genes.get(sorghumGene).get(0) + "\t" +sorghum_gene_to_maize_genes.get(sorghumGene).get(1) + "\t" + all_position + "\t" + all_position1 + "\t" + all_position2); } } outPut.close(); }catch (IOException e) { e.printStackTrace(); } } public static ArrayList<String> cirgarToAlignment( String referenceSequence, int referenceBpPos, String querySequence, int queryBpPos, String cigar ){ String queryAlignment=""; String referenceAlignment=""; Pattern p = Pattern.compile("(\\d+)([MIDNSHP=XB])"); Matcher matcher = p.matcher(cigar); while (matcher.find()) { int length = Integer.parseInt( matcher.group(1)); char cigerLetter = matcher.group(2).charAt(0); if( cigerLetter=='M' || cigerLetter=='=' || cigerLetter=='X' ) { for( int il=0; il<length; ++il ) { queryAlignment += querySequence.substring(queryBpPos-1, queryBpPos); referenceAlignment += referenceSequence.substring(referenceBpPos-1, referenceBpPos); ++queryBpPos; ++referenceBpPos; } } else if ( cigerLetter=='I' ) { referenceAlignment += StringUtils.repeat("-", length); for( int il=0; il<length; ++il ) { referenceAlignment += StringUtils.repeat("-", length); queryAlignment += querySequence.substring(queryBpPos-1, queryBpPos); ++queryBpPos; } } else if ( cigerLetter=='D' || cigerLetter=='N' ) { referenceAlignment += referenceSequence.substring(referenceBpPos-1, referenceBpPos+length-1); queryAlignment += StringUtils.repeat("-", length); referenceBpPos+=length; } else if ( cigerLetter=='S' || cigerLetter=='H' ) { }else { System.err.println("here we could not deal with the cigar:" + cigerLetter +" well, please contact the developper for updating"); } } ArrayList<String> alignment = new ArrayList<String>(); alignment.add(referenceAlignment); alignment.add(queryAlignment); return alignment; } } class AlignedSorghumFragment2{ private String chr; private HashSet<Integer> positions; private int strand; //1 positive, 0 negative public String getChr() { return chr; } public void setChr(String chr) { this.chr = chr; } public HashSet<Integer> getPositions() { return positions; } public void setPositions(HashSet<Integer> positions) { this.positions = positions; } public int getStrand() { return strand; } public void setStrand(int strand) { this.strand = strand; } public AlignedSorghumFragment2(String chr, int strand) { super(); this.chr = chr; this.positions = new HashSet<Integer>(); this.strand = strand; } }
[ "yifeiren07" ]
yifeiren07
7459891bbbd6d58fc808f284fd784ac0bc9ebc7c
6dc34d2ab1312154685e47f474bcaf9d85fe315b
/fundamentals8/src/main/java/com/manchesterdigital/SpanishSpeaker.java
e35320771f0edd6356ec708751040452027b7271
[]
no_license
johannalongmuir/bootcamp-2019
64e40f14c238031a307ca096adde8a2b471c97e0
b9ed19b39003cb850077f47edddce8d18459cfea
refs/heads/master
2021-07-11T19:44:08.486157
2019-10-12T20:55:34
2019-10-12T20:55:34
210,178,931
1
0
null
2020-10-13T16:40:21
2019-09-22T16:29:39
Java
UTF-8
Java
false
false
163
java
package com.manchesterdigital; public class SpanishSpeaker extends Speaker { @Override public void greet() { System.out.println("Hola!"); } }
24e624207e21e37f0a482774b26e3aee0c11f26e
c5c2c5ed738781924f6b1fe429b4cd440c13de36
/src/com/catandmouse/CreateGameActivity.java
7420f2c8a710ddc8653b90ceb26a8312075da805
[]
no_license
Brian-E/CatAndMouse
2e016d34ae30279dbf83bef6fd906089dcfce030
5ddbfd5415d52e6d858db12ce3b939c208cce810
refs/heads/main
2023-04-14T10:12:04.188460
2021-04-28T18:43:53
2021-04-28T18:43:53
362,569,928
0
0
null
null
null
null
UTF-8
Java
false
false
31,100
java
package com.catandmouse; import java.math.BigDecimal; import java.util.Calendar; import java.util.GregorianCalendar; import org.apache.http.HttpStatus; import android.app.Activity; import android.app.Dialog; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.DatePicker; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; import android.widget.TimePicker; import android.widget.Toast; import com.paypal.android.MEP.CheckoutButton; import com.paypal.android.MEP.PayPal; import com.paypal.android.MEP.PayPalActivity; import com.paypal.android.MEP.PayPalPayment; public class CreateGameActivity extends CMActivity implements OnClickListener { EditText editGameName, editPassword, editLocation, editLatitude, editLongitude, editRange; Spinner spinType, spinRatio; ArrayAdapter<?> adapterTypes, adapterRatio; TextView tvMiceCats; CheckBox cbPrivate, cbLocation; Button buttonLocation, buttonCreateGame, buttonCancel; LinearLayout layoutLocationValues; DatePicker dpStartDate, dpEndDate; TimePicker tpStartTime, tpEndTime; //CreateGameActivity myself; CheckoutButton launchSimplePayment; DialogInterface.OnClickListener listener; //private static final int server = PayPal.ENV_SANDBOX; // The ID of your application that you received from PayPal //private static final String appID = "APP-80W284485P519543T"; protected static final int INITIALIZE_SUCCESS = 0; protected static final int INITIALIZE_FAILURE = 1; private static final int PAYPAL_TRANACTION_REQUEST_CODE=150; private static final int CREATE_MAP_REQUEST_CODE=100; private boolean bRetryNoPayment = false; Handler hRefresh = new Handler(){ @Override public void handleMessage(Message msg) { switch(msg.what){ case INITIALIZE_SUCCESS: LogUtil.info("PayPal initialized"); //setupButton(); break; case INITIALIZE_FAILURE: LogUtil.error("PayPal failed to initialize"); AlertDialog diag = getGenericAlertDialog("PayPal initialization failed", "PayPal initialization failed, please try again", new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { try { CreateGameActivity.this.finish(); } catch (Throwable e) { e.printStackTrace(); } } }); diag.show(); break; } } }; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.create_game); // is paypal initialized? if (!((CMApplication)getApplicationContext()).bPayPalInitialized) { LogUtil.error("PayPal failed to initialize"); AlertDialog diag = getGenericAlertDialog(getResources().getString(R.string.Paypal_Init_Error_Title), getResources().getString(R.string.Paypal_Init_Error), new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { try { CreateGameActivity.this.finish(); } catch (Throwable e) { e.printStackTrace(); } } }); diag.show(); return; } // init paypal // waitCursor = ProgressDialog.show(this, "Initializing PayPal", "Initializing PayPal, please wait...", true, true); // Thread libraryInitializationThread = new Thread() { // public void run() { // waitCursor.show(); // initLibrary(); // waitCursor.dismiss(); // // // The library is initialized so let's create our CheckoutButton and update the UI. // if (PayPal.getInstance().isLibraryInitialized()) { // hRefresh.sendEmptyMessage(INITIALIZE_SUCCESS); // } // else { // hRefresh.sendEmptyMessage(INITIALIZE_FAILURE); // } //// if (PayPal.getInstance().isLibraryInitialized()) { //// LogUtil.info("PayPal initialized"); //// setupButton(); //// //// //bPayPalInitialzed = true; //// } //// else { //// LogUtil.error("PayPal failed to initialize"); //// handler.post(new Runnable(){ //// //// @Override //// public void run() { //// AlertDialog diag = getGenericAlertDialog("PayPal initialization failed", "PayPal initialization failed, please try again", new DialogInterface.OnClickListener(){ //// //// @Override //// public void onClick(DialogInterface dialog, //// int which) { //// try { //// CreateGameActivity.this.finish(); //// } catch (Throwable e) { //// e.printStackTrace(); //// } //// //// } //// //// }); //// diag.show(); //// } //// //// }); //// //PayPal.getInstance().setLibraryInitialized(true); //// //bPayPalInitialzed = true; //// //initPayPal(true); //// } // } // }; // libraryInitializationThread.start(); listener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }; //myself = this; TextView tvInstructions = (TextView) findViewById(R.id.textView_CreateGame_Instructions); String instructions = getResources().getString(R.string.Create_Game_Info); instructions = String.format(instructions, ((CMApplication)getApplicationContext()).isPro() ? CMConstants.GAME_COST_PRO : CMConstants.GAME_COST_FREE); tvInstructions.setText(instructions); editGameName = (EditText) findViewById(R.id.editText_CreateGame_Name); spinType = (Spinner) findViewById(R.id.spinner_CreateGame_Type); adapterTypes = ArrayAdapter.createFromResource(this, R.array.game_types, android.R.layout.simple_spinner_item); adapterTypes.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item); spinType.setAdapter(adapterTypes); spinType.setSelection(0); spinType.setOnItemSelectedListener(new OnItemSelectedListener(){ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { String value = (String) adapterTypes.getItem(position); if (value.equals(getResources().getString(R.string.Normal))) { tvMiceCats.setText(getResources().getString(R.string.mice_cats)); } else if (value.equals(getResources().getString(R.string.Reverse))) { tvMiceCats.setText(getResources().getString(R.string.cats_mice)); } } public void onNothingSelected(AdapterView<?> arg0) { } }); spinRatio = (Spinner) findViewById(R.id.spinner_CreateGame_Ratio); adapterRatio = ArrayAdapter.createFromResource(this, R.array.ratios, android.R.layout.simple_spinner_item); adapterRatio.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item); spinRatio.setAdapter(adapterRatio); spinRatio.setSelection(8); // Hopefully this is 10... tvMiceCats = (TextView) findViewById(R.id.textView_CreateGame_MiceCatsLabel); cbPrivate = (CheckBox) findViewById(R.id.checkBox_CreateGame_Private); cbPrivate.setChecked(false); cbPrivate.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { editPassword.setEnabled(isChecked); } }); editPassword = (EditText) findViewById(R.id.editText_CreateGame_Password); editPassword.setEnabled(false); editLocation = (EditText) findViewById(R.id.editText_CreateGame_Location); layoutLocationValues = (LinearLayout) findViewById(R.id.linearLayout_CreateGame_Location); layoutLocationValues.setVisibility(View.GONE); editLatitude = (EditText) findViewById(R.id.editText_CreateGame_Latitude); editLongitude = (EditText) findViewById(R.id.editText_CreateGame_Longitude); editRange = (EditText) findViewById(R.id.editText_CreateGame_Range); cbLocation = (CheckBox) findViewById(R.id.checkBox_CreateGame_Location); cbLocation.setChecked(false); cbLocation.setOnCheckedChangeListener(new OnCheckedChangeListener(){ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { buttonLocation.setEnabled(isChecked); layoutLocationValues.setVisibility(isChecked ? View.VISIBLE : View.GONE); if (isChecked) { // set all values to 0 editLatitude.setText("0"); editLongitude.setText("0"); editRange.setText("0"); } } }); buttonLocation = (Button) findViewById(R.id.button_CreateGame_SetLocation); buttonLocation.setEnabled(false); buttonLocation.setOnClickListener(new View.OnClickListener(){ public void onClick(View arg0) { Intent mapIntent = new Intent(CreateGameActivity.this, CircleActivity.class); startActivityForResult(mapIntent, CREATE_MAP_REQUEST_CODE); } }); // Dates GregorianCalendar gc = new GregorianCalendar(); gc.setLenient(true); dpStartDate = (DatePicker) findViewById(R.id.datePicker_CreateGame_StartTime); dpStartDate.init(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH), gc.get(Calendar.DAY_OF_MONTH), null); dpEndDate = (DatePicker) findViewById(R.id.DatePicker_CreateGame_EndTime); gc.add(Calendar.DAY_OF_MONTH, 1); dpEndDate.init(gc.get(Calendar.YEAR), gc.get(Calendar.MONTH), gc.get(Calendar.DAY_OF_MONTH), null); gc.add(Calendar.DAY_OF_MONTH, -1); // Times tpStartTime = (TimePicker) findViewById(R.id.timePicker_CreateGame_StartTime); tpStartTime.setIs24HourView(false); // show AM/PM tpStartTime.setCurrentHour(gc.get(Calendar.HOUR_OF_DAY)); tpStartTime.setCurrentMinute(gc.get(Calendar.MINUTE)); tpEndTime = (TimePicker) findViewById(R.id.TimePicker_CreateGame_EndTime); tpEndTime.setIs24HourView(false); // show AM/PM tpEndTime.setCurrentHour(gc.get(Calendar.HOUR_OF_DAY)); tpEndTime.setCurrentMinute(gc.get(Calendar.MINUTE)); // buttonCreateGame = (Button) findViewById(R.id.button_CreateGame_CreateGame); // buttonCreateGame.setOnClickListener(this);//new OnClickListener(){ // public void onClick(View arg0) { // // field validation, paypal, call create game, shitload! // if (!validData()) // return; // // // Time to charge it to paypal // // First, how long is their game? // GregorianCalendar startDate = new GregorianCalendar(); // startDate.set(dpStartDate.getYear(), dpStartDate.getMonth(), dpStartDate.getDayOfMonth(), // tpStartTime.getCurrentHour(), tpStartTime.getCurrentMinute()); // GregorianCalendar endDate = new GregorianCalendar(); // endDate.set(dpEndDate.getYear(), dpEndDate.getMonth(), dpEndDate.getDayOfMonth(), // tpEndTime.getCurrentHour(), tpEndTime.getCurrentMinute()); // long gameLength = endDate.getTimeInMillis() - startDate.getTimeInMillis(); // long gameDays = gameLength / CMConstants.TIME_MILLISECONDS_DAY + (gameLength % CMConstants.TIME_MILLISECONDS_DAY > 0 ? 1 : 0); // double gameCost = gameDays * (((CMApplication)getApplicationContext()).isPro() ? CMConstants.GAME_COST_PRO : CMConstants.GAME_COST_FREE); // // // } // }); buttonCancel = (Button) findViewById(R.id.button_CreateGame_Cancel); buttonCancel.setOnClickListener(new View.OnClickListener(){ public void onClick(View arg0) { finish(); } }); // Paypal button setupButton(); // if (((CMApplication)getApplicationContext()).bPayPalInitialzed) // setupButton(); // else { // AlertDialog dlg = this.getGenericAlertDialog(getResources().getString(R.string.Paypal_Init_Error_Title), getResources().getString(R.string.Paypal_Init_Error), new DialogInterface.OnClickListener() { // public void onClick(DialogInterface dialog, int which) { // dialog.dismiss(); // CreateGameActivity.this.finish(); // } // }); // dlg.show(); // //((CMApplication)getApplicationContext()).initPayPal(true); // // } } private void setupButton() { LinearLayout layoutButtons = (LinearLayout) findViewById(R.id.linearLayout_CreateGame_BottomButtons); // Add Paypal button LinearLayout layoutSimplePayment = new LinearLayout(this); layoutSimplePayment.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); layoutSimplePayment.setOrientation(LinearLayout.VERTICAL); launchSimplePayment = PayPal.getInstance().getCheckoutButton(this, PayPal.BUTTON_194x37, CheckoutButton.TEXT_PAY); launchSimplePayment.setOnClickListener(this);//new View.OnClickListener(){ layoutSimplePayment.addView(launchSimplePayment); layoutButtons.addView(layoutSimplePayment,0); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { LogUtil.info("CreateGameActivity.onActivityResult called, requestCode="+requestCode+ " resultCode="+resultCode+" intent="+data.toString()); switch (requestCode) { case CREATE_MAP_REQUEST_CODE: switch(resultCode) { case Activity.RESULT_OK: default: // Hopefully data is filled with our coordinate info double latitude = data.getDoubleExtra(CMConstants.PARM_LATITUDE, 0); double longitude = data.getDoubleExtra(CMConstants.PARM_LONGITUDE, 0); long range = data.getLongExtra(CMConstants.PARM_RANGE, 0); editLatitude.setText(Double.toString(latitude)); editLongitude.setText(Double.toString(longitude)); editRange.setText(Long.toString(range)); break; } break; case PAYPAL_TRANACTION_REQUEST_CODE: switch(resultCode) { case Activity.RESULT_OK: // Create our game String password = null; if (cbPrivate.isChecked()) password = editPassword.getText().toString(); String locationName = getResources().getString(R.string.Global); double latitude = 0; double longitude = 0; long range = 0; if (cbLocation.isChecked()) { locationName = editLocation.getText().toString(); latitude = Double.parseDouble(editLatitude.getText().toString()); longitude = Double.parseDouble(editLongitude.getText().toString()); range = Long.parseLong(editRange.getText().toString()); } int ratio = Integer.parseInt((String) spinRatio.getSelectedItem()); GregorianCalendar startDate = new GregorianCalendar(); startDate.set(dpStartDate.getYear(), dpStartDate.getMonth(), dpStartDate.getDayOfMonth(), tpStartTime.getCurrentHour(), tpStartTime.getCurrentMinute()); GregorianCalendar endDate = new GregorianCalendar(); endDate.set(dpEndDate.getYear(), dpEndDate.getMonth(), dpEndDate.getDayOfMonth(), tpEndTime.getCurrentHour(), tpEndTime.getCurrentMinute()); final GameBean gb = new GameBean(0, editGameName.getText().toString(), spinType.getSelectedItemPosition(), cbPrivate.isChecked(), password, locationName, latitude, longitude, range, ratio, startDate.getTimeInMillis(), endDate.getTimeInMillis()); // waitCursor.setMessage(getResources().getString(R.string.Creating_Game)); // waitCursor.setIndeterminate(true); // waitCursor.show(); waitCursor = ProgressDialog.show(this, null, getResources().getString(R.string.Creating_Game), true);//(this); Thread createThread = new Thread() { public void run() { int rc = ServerUtil.createGame(gb); waitCursor.dismiss(); switch(rc) { case HttpStatus.SC_OK: case 0: bRetryNoPayment = false; // Success! Let em know - ask em if they want to share this game info final DialogInterface.OnClickListener noListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); CreateGameActivity.this.finish(); } }; final DialogInterface.OnClickListener yesListener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Intent sendIntent = new Intent(Intent.ACTION_SEND); sendIntent.setType("text/plain"); String imBody = getResources().getString(R.string.Share_Create_Game, gb.getGameName()+(gb.isPrivate() ? ", "+getResources().getString(R.string.Password_)+gb.getPassword()+"." : ".")); // imBody += " "+getResources().getString(R.string.Name_)+gb.getGameName(); // imBody += " "+getResources().getString(R.string.Type_)+(gb.getGameType()==1 ? getResources().getString(R.string.Reverse) : getResources().getString(R.string.Normal))+" "; // if (gb.isPrivate()) // imBody += getResources().getString(R.string.Password_)+gb.getPassword(); sendIntent.putExtra(Intent.EXTRA_TEXT, imBody); startActivity(Intent.createChooser(sendIntent, getResources().getString(R.string.Create_Game))); dialog.cancel(); CreateGameActivity.this.finish(); } }; handler.post(new Runnable(){ public void run() { AlertDialog dlg = (AlertDialog)getGenericYesNoDialog(getResources().getString(R.string.Create_Game_Success_Title), getResources().getString(R.string.Create_Game_Success_Msg), yesListener, noListener); dlg.show(); } }); break; case CMConstants.ERR_BAD_PARMS: // Very bad! We need to set a flag and prompt them to try again without charging! LogUtil.error("Create game failed with bad parms!"); bRetryNoPayment = true; final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }; handler.post(new Runnable(){ public void run() { AlertDialog dlg = getGenericAlertDialog(getResources().getString(R.string.Error), getResources().getString(R.string.Create_Unknown_Error),listener); dlg.show(); } }); break; case CMConstants.ERR_CREATE_GAME_NAME_EXISTS: // This is also very bad, we should've checked for this already. Re-prompt just for game name LogUtil.error("Create game failed with game name exists!"); bRetryNoPayment = true; final DialogInterface.OnClickListener listener1 = new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }; handler.post(new Runnable(){ public void run() { AlertDialog dlg = getGenericAlertDialog(getResources().getString(R.string.Game_Name_Exists), getResources().getString(R.string.Create_Game_Name_Exists_Error),listener1); dlg.show(); } }); break; } } }; createThread.start(); break; case PayPalActivity.RESULT_FAILURE: String resultInfo = data.getStringExtra(PayPalActivity.EXTRA_ERROR_MESSAGE); String resultExtra = "Error ID: " + data.getStringExtra(PayPalActivity.EXTRA_ERROR_ID); LogUtil.error("Payment failed! "+resultInfo+" "+resultExtra); Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Paypal_Error_Title), getResources().getString(R.string.Paypal_Error), listener); dlg.show(); break; default: case Activity.RESULT_CANCELED: LogUtil.error("Payment canceled"); Dialog dlg1 = getGenericAlertDialog(getResources().getString(R.string.PayPal_Canceled_Title), getResources().getString(R.string.PayPal_Canceled), listener); dlg1.show(); break; } break; default: break; } launchSimplePayment.updateButton(); } private boolean validData() { if (CMConstants.isGodMode) return true; // Make sure all our fields are filled in, proper values, etc // Game name has already been checked // type and ratio should be ok. Spin controls; can't fuck up your input // Are we private with no password? String strPassword = editPassword.getText().toString(); if (cbPrivate.isChecked() && (strPassword==null || strPassword.length()==0)) { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Password_Required_Title), getResources().getString(R.string.Password_Required_Message), listener); dlg.show(); editPassword.requestFocus(); return false; } // Location - make sure there are values? if (cbLocation.isChecked()) { String locationName = editLocation.getText().toString(); String strLatitude = editLatitude.getText().toString(); String strLongitude = editLongitude.getText().toString(); String strRange = editRange.getText().toString(); if (locationName==null || locationName.length()==0) { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Location_Name_Title), getResources().getString(R.string.No_Location_Name), listener); dlg.show(); editLocation.requestFocus(); return false; } try { Float.parseFloat(strLatitude); } catch (NumberFormatException e) { LogUtil.error("Bad latitude in CreateGame, value: "+strLatitude); Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Invalid_Latitude_Title), getResources().getString(R.string.Invalid_Latitude), listener); dlg.show(); editLatitude.requestFocus(); return false; } try { Float.parseFloat(strLongitude); } catch (NumberFormatException e) { LogUtil.error("Bad longitude in CreateGame, value: "+strLatitude); Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Invalid_Longitude_Title), getResources().getString(R.string.Invalid_Longitude), listener); dlg.show(); editLongitude.requestFocus(); return false; } try { Integer.parseInt(strRange); } catch (NumberFormatException e) { LogUtil.error("Bad range in CreateGame, value: "+strLatitude); Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Invalid_Range_Title), getResources().getString(R.string.Invalid_Range), listener); dlg.show(); editRange.requestFocus(); return false; } } // start and end date and time long currentTime = System.currentTimeMillis(); GregorianCalendar startDate = new GregorianCalendar(); startDate.set(dpStartDate.getYear(), dpStartDate.getMonth(), dpStartDate.getDayOfMonth(), tpStartTime.getCurrentHour(), tpStartTime.getCurrentMinute()); GregorianCalendar endDate = new GregorianCalendar(); endDate.set(dpEndDate.getYear(), dpEndDate.getMonth(), dpEndDate.getDayOfMonth(), tpEndTime.getCurrentHour(), tpEndTime.getCurrentMinute()); // First, check for stupid things like endDate before startDate, or they're equal if (endDate.getTimeInMillis() - startDate.getTimeInMillis() <= 0) { // assholes Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Bad_Kitty), getResources().getString(R.string.End_Time_Before_Start_Time), listener); dlg.show(); dpEndDate.requestFocus(); return false; } // How long did they set the game for? Limit is 1 YEAR! long oneYear = CMConstants.TIME_MILLISECONDS_DAY*365; if (endDate.getTimeInMillis() - startDate.getTimeInMillis() > oneYear) { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.One_Year_Max_Title), getResources().getString(R.string.One_Year_Max), listener); dlg.show(); dpEndDate.requestFocus(); return false; } // Don't let them create a game more than one month out long oneMonth = CMConstants.TIME_MILLISECONDS_DAY*30; if (startDate.getTimeInMillis() - currentTime > oneMonth) { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Start_Date_Too_Far_Title), getResources().getString(R.string.Start_Date_Too_Far), listener); dlg.show(); dpStartDate.requestFocus(); return false; } return true; } public void onClick(View v) { // Check the game name final String strGameName = editGameName.getText().toString(); if (strGameName==null || strGameName.length()==0) { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Invalid_Game_Name_Title), getResources().getString(R.string.Game_Name_Not_Null), listener); dlg.show(); launchSimplePayment.updateButton(); editGameName.requestFocus(); return; } // Check the game name against the server waitCursor = ProgressDialog.show(this, null, getResources().getString(R.string.Checking_Game_Name), true);//(this); Thread createThread = new Thread() { public void run() { int rc = ServerUtil.checkGameName(strGameName); waitCursor.dismiss(); LogUtil.info("Check game returned "+rc); switch (rc) { case HttpStatus.SC_OK: case 0: // All good, proceed handler.post(new Runnable(){ @Override public void run() { // field validation, paypal, call create game, shitload! if (!validData()) { launchSimplePayment.updateButton(); return; } else { // Check in case of error we don't launch paypal if (bRetryNoPayment || CMConstants.isGodMode) { bRetryNoPayment = false; onActivityResult(PAYPAL_TRANACTION_REQUEST_CODE, Activity.RESULT_OK, new Intent()); return; } // Time to charge it to paypal // First, how long is their game? GregorianCalendar startDate = new GregorianCalendar(); startDate.set(dpStartDate.getYear(), dpStartDate.getMonth(), dpStartDate.getDayOfMonth(), tpStartTime.getCurrentHour(), tpStartTime.getCurrentMinute()); GregorianCalendar endDate = new GregorianCalendar(); endDate.set(dpEndDate.getYear(), dpEndDate.getMonth(), dpEndDate.getDayOfMonth(), tpEndTime.getCurrentHour(), tpEndTime.getCurrentMinute()); long gameLength = endDate.getTimeInMillis() - startDate.getTimeInMillis(); long gameDays = gameLength / CMConstants.TIME_MILLISECONDS_DAY + (gameLength % CMConstants.TIME_MILLISECONDS_DAY > CMConstants.TIME_MILLISECONDS_HOUR ? 1 : 0); double gameCost = gameDays * (((CMApplication)getApplicationContext()).isPro() ? CMConstants.GAME_COST_PRO : CMConstants.GAME_COST_FREE); PayPalPayment payment = new PayPalPayment(); payment.setSubtotal(new BigDecimal(gameCost)); payment.setCurrencyType("USD"); payment.setRecipient(CMConstants.PAYPAL_SELLER_EMAIL); payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS); payment.setMerchantName(getResources().getString(R.string.PayPal_Merchant_Name)); //payment.setDescription("Payment for game named "+editGameName.getText().toString()); //payment.setCustomID(CMConstants.PAYPAL_CUSTOM_ID); payment.setMemo(getResources().getString(R.string.PayPal_Memo)+" "+editGameName.getText().toString()); Intent checkoutIntent = PayPal.getInstance().checkout(payment, CreateGameActivity.this); startActivityForResult(checkoutIntent, PAYPAL_TRANACTION_REQUEST_CODE); // PayPal is being a fuckin cocksucker - bypass for now //onActivityResult(1, Activity.RESULT_OK, new Intent()); } } }); break; case CMConstants.ERR_CREATE_GAME_NAME_EXISTS: default: // Bummer dude, give an error message handler.post(new Runnable(){ @Override public void run() { Dialog dlg = getGenericAlertDialog(getResources().getString(R.string.Game_Name_Exists), getResources().getString(R.string.Game_Name_Exists_Error), listener); dlg.show(); launchSimplePayment.updateButton(); editGameName.requestFocus(); } }); break; } } }; createThread.start(); } // private void initLibrary(boolean bForceInit) { // // Paypal setup // PayPal pp = PayPal.getInstance(); // if (pp==null || bForceInit) { // try { // pp = PayPal.initWithAppID(this, "APP-80W284485P519543T", CMConstants.PAYPAL_ENV); // pp.setLanguage("en_US"); // Sets the language for the library. // } // catch (Exception e) { // LogUtil.error("PayPal failed to initialize; error="+e.toString()); // } // } // } // // private void initLibrary() { // boolean bInitialize = true; // PayPal pp = PayPal.getInstance(); // if (pp!=null){ // if (!pp.isLibraryInitialized()) // pp.deinitialize(); // else // bInitialize = false; // } // // // If the library is already initialized, then we don't need to initialize it again. // if(bInitialize) { // // This is the main initialization call that takes in your Context, the Application ID, and the server you would like to connect to. // pp = PayPal.initWithAppID(this, appID, server); // // // -- These are required settings. // pp.setLanguage("en_US"); // Sets the language for the library. // // -- // // // -- These are a few of the optional settings. // // Sets the fees payer. If there are fees for the transaction, this person will pay for them. Possible values are FEEPAYER_SENDER, // // FEEPAYER_PRIMARYRECEIVER, FEEPAYER_EACHRECEIVER, and FEEPAYER_SECONDARYONLY. // pp.setFeesPayer(PayPal.FEEPAYER_EACHRECEIVER); // // Set to true if the transaction will require shipping. // pp.setShippingEnabled(true); // // Dynamic Amount Calculation allows you to set tax and shipping amounts based on the user's shipping address. Shipping must be // // enabled for Dynamic Amount Calculation. This also requires you to create a class that implements PaymentAdjuster and Serializable. // pp.setDynamicAmountCalculationEnabled(false); // // -- // if (pp.isLibraryInitialized()) // LogUtil.info("PayPal initialized in initLibrary()"); // else // LogUtil.error("PayPal not initialized in initLibrary()"); // } // } }
f7fbe744a50227c3917c77cf2e3105e7c8661998
3793fe1ad45d2c890c55280581568387bf85a0d7
/app/src/main/java/com/jayler/widget/uitls/CharacterParser.java
8f778ae87e761bcf306123acb40d1244e16140f5
[]
no_license
JaylerCD/WidgetDemo
c517d058805c7a298127167d16250606bb2d02cc
e11ec3146e4e589726db73f589dad4d247cb9071
refs/heads/master
2021-01-06T17:28:45.912469
2020-03-01T08:26:26
2020-03-01T08:26:26
241,416,657
0
0
null
null
null
null
UTF-8
Java
false
false
9,162
java
package com.jayler.widget.uitls; /** * Java汉字转换为拼音 */ public class CharacterParser { private static int[] pyvalue = new int[]{-20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032, -20026, -20002, -19990, -19986, -19982, -19976, -19805, -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, -19739, -19728, -19725, -19715, -19540, -19531, -19525, -19515, -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275, -19270, -19263, -19261, -19249, -19243, -19242, -19238, -19235, -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006, -19003, -18996, -18977, -18961, -18952, -18783, -18774, -18773, -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697, -18696, -18526, -18518, -18501, -18490, -18478, -18463, -18448, -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201, -18184, -18183, -18181, -18012, -17997, -17988, -17970, -17964, -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752, -17733, -17730, -17721, -17703, -17701, -17697, -17692, -17683, -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427, -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733, -16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470, -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423, -16419, -16412, -16407, -16403, -16401, -16393, -16220, -16216, -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158, -16155, -15959, -15958, -15944, -15933, -15920, -15915, -15903, -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659, -15652, -15640, -15631, -15625, -15454, -15448, -15436, -15435, -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369, -15363, -15362, -15183, -15180, -15165, -15158, -15153, -15150, -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121, -15119, -15117, -15110, -15109, -14941, -14937, -14933, -14930, -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902, -14894, -14889, -14882, -14873, -14871, -14857, -14678, -14674, -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429, -14407, -14399, -14384, -14379, -14368, -14355, -14353, -14345, -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135, -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094, -14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907, -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847, -13831, -13658, -13611, -13601, -13406, -13404, -13400, -13398, -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343, -13340, -13329, -13326, -13318, -13147, -13138, -13120, -13107, -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888, -12875, -12871, -12860, -12858, -12852, -12849, -12838, -12831, -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556, -12359, -12346, -12320, -12300, -12120, -12099, -12089, -12074, -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798, -11781, -11604, -11589, -11536, -11358, -11340, -11339, -11324, -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041, -11038, -11024, -11020, -11019, -11018, -11014, -10838, -10832, -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, -10519, -10331, -10329, -10328, -10322, -10315, -10309, -10307, -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254}; public static String[] pystr = new String[]{"a", "ai", "an", "ang", "ao", "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi", "bian", "biao", "bie", "bin", "bing", "bo", "bu", "ca", "cai", "can", "cang", "cao", "ce", "ceng", "cha", "chai", "chan", "chang", "chao", "che", "chen", "cheng", "chi", "chong", "chou", "chu", "chuai", "chuan", "chuang", "chui", "chun", "chuo", "ci", "cong", "cou", "cu", "cuan", "cui", "cun", "cuo", "da", "dai", "dan", "dang", "dao", "de", "deng", "di", "dian", "diao", "die", "ding", "diu", "dong", "dou", "du", "duan", "dui", "dun", "duo", "e", "en", "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu", "ga", "gai", "gan", "gang", "gao", "ge", "gei", "gen", "geng", "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun", "guo", "ha", "hai", "han", "hang", "hao", "he", "hei", "hen", "heng", "hong", "hou", "hu", "hua", "huai", "huan", "huang", "hui", "hun", "huo", "ji", "jia", "jian", "jiang", "jiao", "jie", "jin", "jing", "jiong", "jiu", "ju", "juan", "jue", "jun", "ka", "kai", "kan", "kang", "kao", "ke", "ken", "keng", "kong", "kou", "ku", "kua", "kuai", "kuan", "kuang", "kui", "kun", "kuo", "la", "lai", "lan", "lang", "lao", "le", "lei", "leng", "li", "lia", "lian", "liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu", "lv", "luan", "lue", "lun", "luo", "ma", "mai", "man", "mang", "mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie", "min", "ming", "miu", "mo", "mou", "mu", "na", "nai", "nan", "nang", "nao", "ne", "nei", "nen", "neng", "ni", "nian", "niang", "niao", "nie", "nin", "ning", "niu", "nong", "nu", "nv", "nuan", "nue", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei", "pen", "peng", "pi", "pian", "piao", "pie", "pin", "ping", "po", "pu", "qi", "qia", "qian", "qiang", "qiao", "qie", "qin", "qing", "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao", "re", "ren", "reng", "ri", "rong", "rou", "ru", "ruan", "rui", "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sen", "seng", "sha", "shai", "shan", "shang", "shao", "she", "shen", "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang", "shui", "shun", "shuo", "si", "song", "sou", "su", "suan", "sui", "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te", "teng", "ti", "tian", "tiao", "tie", "ting", "tong", "tou", "tu", "tuan", "tui", "tun", "tuo", "wa", "wai", "wan", "wang", "wei", "wen", "weng", "wo", "wu", "xi", "xia", "xian", "xiang", "xiao", "xie", "xin", "xing", "xiong", "xiu", "xu", "xuan", "xue", "xun", "ya", "yan", "yang", "yao", "ye", "yi", "yin", "ying", "yo", "yong", "you", "yu", "yuan", "yue", "yun", "za", "zai", "zan", "zang", "zao", "ze", "zei", "zen", "zeng", "zha", "zhai", "zhan", "zhang", "zhao", "zhe", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu", "zhua", "zhuai", "zhuan", "zhuang", "zhui", "zhun", "zhuo", "zi", "zong", "zou", "zu", "zuan", "zui", "zun", "zuo"}; private StringBuilder buffer; private String resource; private static CharacterParser characterParser = new CharacterParser(); public static CharacterParser getInstance() { return characterParser; } public String getResource() { return resource; } public void setResource(String resource) { this.resource = resource; } /** * 汉字转成ASCII码 * * @param chs * @return */ private int getChsAscii(String chs) { int asc = 0; try { byte[] bytes = chs.getBytes("gb2312"); if (bytes == null || bytes.length > 2 || bytes.length <= 0) { throw new RuntimeException("illegal resource string"); } if (bytes.length == 1) { asc = bytes[0]; } if (bytes.length == 2) { int hightByte = 256 + bytes[0]; int lowByte = 256 + bytes[1]; asc = (256 * hightByte + lowByte) - 256 * 256; } } catch (Exception e) { System.out.println("ERROR:ChineseSpelling.class-getChsAscii(String chs)" + e); } return asc; } /** * 单字解析 * * @param str * @return */ public String convert(String str) { String result = null; int ascii = getChsAscii(str); if (ascii > 0 && ascii < 160) { result = String.valueOf((char) ascii); } else { for (int i = (pyvalue.length - 1); i >= 0; i--) { if (pyvalue[i] <= ascii) { result = pystr[i]; break; } } } return result; } /** * 词组解析 * * @param chs * @return */ public String getSelling(String chs) { String key, value; buffer = new StringBuilder(); for (int i = 0; i < chs.length(); i++) { key = chs.substring(i, i + 1); if (key.getBytes().length >= 2) { value = (String) convert(key); if (value == null) { value = "unknown"; } } else { value = key; } buffer.append(value); } return buffer.toString(); } public String getSpelling() { return this.getSelling(this.getResource()); } }
[ "2991518895.com" ]
2991518895.com
45a35745b3b8d4e1566847e3241719b48627c714
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-f4592.java
97ff149de290d959ee7f2b9bc74d583fe3487c7e
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 9166277026577
818b5c81f4ab92a9c6b9b1e289b0c95cfd931551
7016cec54fb7140fd93ed805514b74201f721ccd
/src/java/com/echothree/control/user/payment/server/command/CreatePaymentMethodTypePartyTypeCommand.java
9cf4163946db7fbe27a185f48e57d3d85ed48b88
[ "MIT", "Apache-1.1", "Apache-2.0" ]
permissive
echothreellc/echothree
62fa6e88ef6449406d3035de7642ed92ffb2831b
bfe6152b1a40075ec65af0880dda135350a50eaf
refs/heads/master
2023-09-01T08:58:01.429249
2023-08-21T11:44:08
2023-08-21T11:44:08
154,900,256
5
1
null
null
null
null
UTF-8
Java
false
false
4,966
java
// -------------------------------------------------------------------------------- // Copyright 2002-2023 Echo Three, LLC // // 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.echothree.control.user.payment.server.command; import com.echothree.control.user.payment.common.form.CreatePaymentMethodTypePartyTypeForm; import com.echothree.control.user.payment.common.result.PaymentResultFactory; import com.echothree.model.control.party.common.PartyTypes; import com.echothree.model.control.payment.server.logic.PaymentMethodTypePartyTypeLogic; import com.echothree.model.control.security.common.SecurityRoleGroups; import com.echothree.model.control.security.common.SecurityRoles; import com.echothree.model.data.user.common.pk.UserVisitPK; import com.echothree.util.common.validation.FieldDefinition; import com.echothree.util.common.validation.FieldType; import com.echothree.util.common.command.BaseResult; import com.echothree.util.server.control.BaseSimpleCommand; import com.echothree.util.server.control.CommandSecurityDefinition; import com.echothree.util.server.control.PartyTypeDefinition; import com.echothree.util.server.control.SecurityRoleDefinition; import java.util.Arrays; import java.util.Collections; import java.util.List; public class CreatePaymentMethodTypePartyTypeCommand extends BaseSimpleCommand<CreatePaymentMethodTypePartyTypeForm> { private final static CommandSecurityDefinition COMMAND_SECURITY_DEFINITION; private final static List<FieldDefinition> FORM_FIELD_DEFINITIONS; static { COMMAND_SECURITY_DEFINITION = new CommandSecurityDefinition(Collections.unmodifiableList(Arrays.asList( new PartyTypeDefinition(PartyTypes.UTILITY.name(), null), new PartyTypeDefinition(PartyTypes.EMPLOYEE.name(), Collections.unmodifiableList(Arrays.asList( new SecurityRoleDefinition(SecurityRoleGroups.PaymentMethodType.name(), SecurityRoles.PaymentMethodTypePartyType.name()) ))) ))); FORM_FIELD_DEFINITIONS = Collections.unmodifiableList(Arrays.asList( new FieldDefinition("PaymentMethodTypeName", FieldType.ENTITY_NAME, true, null, null), new FieldDefinition("PartyTypeName", FieldType.ENTITY_NAME, true, null, null), new FieldDefinition("PartyPaymentMethodWorkflowName", FieldType.ENTITY_NAME, false, null, null), new FieldDefinition("ContactMechanismWorkflowName", FieldType.ENTITY_NAME, false, null, null), new FieldDefinition("IsDefault", FieldType.BOOLEAN, true, null, null), new FieldDefinition("SortOrder", FieldType.SIGNED_INTEGER, true, null, null) )); } /** Creates a new instance of CreatePaymentMethodTypePartyTypeCommand */ public CreatePaymentMethodTypePartyTypeCommand(UserVisitPK userVisitPK, CreatePaymentMethodTypePartyTypeForm form) { super(userVisitPK, form, COMMAND_SECURITY_DEFINITION, FORM_FIELD_DEFINITIONS, false); } @Override protected BaseResult execute() { var result = PaymentResultFactory.getCreatePaymentMethodTypePartyTypeResult(); var paymentMethodTypeName = form.getPaymentMethodTypeName(); var partyTypeName = form.getPartyTypeName(); var partyPaymentMethodWorkflowName = form.getPartyPaymentMethodWorkflowName(); var contactMechanismWorkflowName = form.getContactMechanismWorkflowName(); var isDefault = Boolean.valueOf(form.getIsDefault()); var sortOrder = Integer.valueOf(form.getSortOrder()); var paymentMethodTypePartyType = PaymentMethodTypePartyTypeLogic.getInstance().createPaymentMethodTypePartyType(this, paymentMethodTypeName, partyTypeName, partyPaymentMethodWorkflowName, contactMechanismWorkflowName, isDefault, sortOrder, getPartyPK()); if(paymentMethodTypePartyType != null && !hasExecutionErrors()) { result.setPaymentMethodTypeName(paymentMethodTypePartyType.getLastDetail().getPaymentMethodType().getLastDetail().getPaymentMethodTypeName()); result.setPartyTypeName(paymentMethodTypePartyType.getLastDetail().getPartyType().getPartyTypeName()); result.setEntityRef(paymentMethodTypePartyType.getPrimaryKey().getEntityRef()); } return result; } }
b6a18d2e07f1dc60aff1100fc7ca39ec336df533
c6d2e26b1598238a50c07eeb1f747d727674d88c
/c675.java
2210a1472a9e6fae881cc1c575decb80940d8b13
[]
no_license
ShiFengZeng/ZeroJudge
30102a7cda0965904c500f904eadaf13d53a0eaf
e10627e0f3b6ff7bbb004cdbcf7bca8bd9ce1040
refs/heads/master
2021-06-16T10:39:23.607973
2019-09-22T16:19:08
2019-09-22T16:19:08
130,197,100
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; public class c675 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> F = new ArrayList<>(); F.add(0, 0); for (int i = 1; i <= 15751; ++i) { String iStr = String.valueOf(i); if (iStr.contains("4")) continue; F.add(i); } String line; PrintWriter pw = new PrintWriter(System.out); while ((line = br.readLine()) != null) { String[] temp = line.split("[ ]+"); String k = temp[0]; int n = Integer.valueOf(temp[1]); if (k.equals("T")) { pw.println(F.get(n)); } else { pw.println(F.indexOf(n)); } } pw.flush(); } }
901efb363906e9894776478ba754612a732d3939
ec6dc8427514a52164bb14678adacdff884501fd
/classes/src/com/stat/Main.java
0bab5f0a8c9921d4a7a0a67e968b4f9cfffec965
[]
no_license
stansmoczyk/JavaStuff
eee335298a3c10442c3e113667cb10f2f6e724c1
16f511216fc85d07f3a4121504046c43ac57be82
refs/heads/master
2020-04-04T05:24:23.249289
2018-11-01T16:51:54
2018-11-01T16:51:54
151,424,838
0
0
null
null
null
null
UTF-8
Java
false
false
274
java
package com.stat; public class Main { public static void main(String[] args) { Car porsche = new Car(); Car holden = new Car(); porsche.setModel("Carrera"); //porsche.setModel("911"); System.out.println("Model is " + porsche.getModel()); } }
16137d1bd3c8287a88287efeb879674943e229e5
de1464392e916ad6de12828a8ab2ca37b9e03190
/src/main/java/com/example/secondhandstreet/home/HomeFragment.java
cf4aa00c91a4c97d8a4356feda5ce5588965da51
[]
no_license
huangxueqin/secondhandstreet
98206da586daf20ae3cd3015f81fa9f37cf3bbbf
d9fba71d1e11768ac02d835d195285abe17b2d2f
refs/heads/master
2020-03-31T02:46:24.327542
2015-08-25T06:54:20
2015-08-25T06:54:20
40,532,952
1
0
null
null
null
null
UTF-8
Java
false
false
2,578
java
package com.example.secondhandstreet.home; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.secondhandstreet.R; /** * Created by huangxueqin on 15-4-10. * 首页Tab所指示的页面,包含其内部包含两个新的Fragment, * 一个展示最新商品,一个展示推荐商品 */ public class HomeFragment extends Fragment{ SlidingTabLayout mTabIndicator; ViewPager mPages; FragmentPagerAdapter mAdapter; private static final int DEFAULT_TAB_INDEX = 0; private int mCurrentPage = -1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new HomeFragmentPagerAdapter(getActivity(), getFragmentManager()); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_home, container, false); mTabIndicator = (SlidingTabLayout) rootView.findViewById(R.id.tab_indicator); mPages = (ViewPager) rootView.findViewById(R.id.home_pagers); mPages.setAdapter(mAdapter); mPages.setCurrentItem(mCurrentPage < 0 ? DEFAULT_TAB_INDEX : mCurrentPage); mTabIndicator.setViewPager(mPages); return rootView; } class HomeFragmentPagerAdapter extends FragmentPagerAdapter { private static final int COUNT = 2; String[] mTitles = new String[COUNT]; Fragment[] mFragments = new Fragment[COUNT]; public HomeFragmentPagerAdapter(Context context, FragmentManager fm) { super(fm); Resources res = context.getResources(); mTitles[0] = res.getString(R.string.homeTitleRecommendation); mTitles[1] = res.getString(R.string.homeTitleNewest); mFragments[0] = new RecommendationFragment(); mFragments[1] = new NewestFragment(); } @Override public CharSequence getPageTitle(int position) { return mTitles[position]; } @Override public Fragment getItem(int position) { return mFragments[position]; } @Override public int getCount() { return COUNT; } } }
3cbef55d88d2c8ac6314ad95e685762f8e8cb4ad
eebe7b0d0d8cce1cde2bad5864b3342bcef08de5
/platforms/android/app/build/generated/source/r/debug/com/uniminuto/acel/R.java
f9c2986bf9e195cfddaaa6a9a942414729927252
[]
no_license
ISwMF/LatigoB
c4bef1f71398e12842732102471c3d110aa2be7d
cf2cf01a5b1ec6a83f21fda76f53fb36a900c8e3
refs/heads/master
2020-03-11T03:53:03.198968
2018-04-16T15:04:31
2018-04-16T15:04:31
129,761,764
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.uniminuto.acel; public final class R { public static final class drawable { public static final int screen=0x7f010000; } public static final class mipmap { public static final int icon=0x7f020000; } public static final class string { public static final int activity_name=0x7f030000; public static final int app_name=0x7f030001; public static final int launcher_name=0x7f030002; } public static final class xml { public static final int config=0x7f040000; } }
e6bd101c8ce12b4ab5f1c884b75e6618720312c5
aaedb3f2a3b8666b57df86f8b23166b543df87d3
/factory-method/src/main/java/com/wip/factory/FileLogger.java
e64b0e3d33479e51dcd0c204409a64c68c828b5a
[ "MIT" ]
permissive
caozongpeng/java-design-patterns
93d0b5e24e933f4738f3a0b860c1bbd186771eda
b9b9f391a75f5c0b009e5a9d6fd0b5a103902233
refs/heads/master
2020-04-17T03:45:52.767525
2019-01-23T14:59:04
2019-01-23T14:59:04
166,199,393
6
1
null
null
null
null
UTF-8
Java
false
false
256
java
package com.wip.factory; /** * 文件日志记录器类(具体产品) * @author KyrieCao * @date 2019/1/18 15:37 */ public class FileLogger implements Logger { public void writeLog() { System.out.println("文件日志记录"); } }
e136bf2e08531a34d4d46c4119baa49cd044f6fc
86b7d9368bbd18785393dda68fdeac0ffb503b3a
/app/src/main/java/com/example/ecss/medicalmapper/chattingsystem/model/ChatMessage.java
88d167e791a2f37fae93df1697fb149a7f319d9e
[]
no_license
Ahmad-A-Khalifa/at3aleg-feen
13875ce54f6a5d5b88965105712cf4ab201fe0be
c92a650c3010e5d5f034e8998eac149abc6af044
refs/heads/master
2021-01-19T11:34:43.641398
2017-07-18T22:34:13
2017-07-18T22:34:13
87,977,707
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
package com.example.ecss.medicalmapper.chattingsystem.model; import com.google.firebase.database.Exclude; /** * Created by samuel on 5/8/2017. */ public class ChatMessage { private String message; private String sender; private String recipient; private int mRecipientOrSenderStatus; public ChatMessage() { } public ChatMessage(String message, String sender, String recipient) { this.message = message; this.recipient = recipient; this.sender = sender; } public void setRecipientOrSenderStatus(int recipientOrSenderStatus) { this.mRecipientOrSenderStatus = recipientOrSenderStatus; } public String getMessage() { return message; } public String getRecipient(){ return recipient; } public String getSender(){ return sender; } @Exclude public int getRecipientOrSenderStatus() { return mRecipientOrSenderStatus; } }
6e2fb3d378a0d5563d7240488c5d5b7d99c7ccc4
b8645236dcb6431344d4a86db8629cf50d2eb40e
/videoplayer/src/main/java/com/code4rox/videoplayer/activities/VideoPlayer.java
615c363f046a28e2c0d7de030a916dc00a7a16b2
[]
no_license
waqasyousafy/MusicPlayer
01743f445bef2213a888ff4e56d26599a6ae6d49
f310c50f8cc31ee2d4dad9d8b3117d4b2b5e04b6
refs/heads/master
2023-01-06T11:08:38.670331
2020-10-29T06:16:37
2020-10-29T06:16:37
308,231,137
0
0
null
null
null
null
UTF-8
Java
false
false
116,008
java
package com.code4rox.videoplayer.activities; import android.Manifest; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.annotation.SuppressLint; import android.app.ActivityManager; import android.app.Dialog; import android.app.PictureInPictureParams; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.database.ContentObserver; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.PorterDuff; import android.media.AudioFocusRequest; import android.media.AudioManager; import android.media.MediaPlayer; import android.media.audiofx.Equalizer; import android.media.session.MediaController; import android.media.session.MediaSession; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Environment; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.provider.OpenableColumns; import android.provider.Settings; import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.Rational; import android.view.GestureDetector; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.TextureView; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.EdgeEffect; import android.widget.FrameLayout; import android.widget.HorizontalScrollView; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import com.bullhead.equalizer.EqualizerFragment; import com.code4rox.adsmanager.AdmobUtils; import com.code4rox.adsmanager.InterAdsIdType; import com.code4rox.videoplayer.R; import com.code4rox.videoplayer.adapters.ScrollingWidgetsAdapter; import com.code4rox.videoplayer.database.daos.Dao; import com.code4rox.videoplayer.database.songdatabase; import com.code4rox.videoplayer.database.tables.song_detail_table; import com.code4rox.videoplayer.database.tinydb.TinyDB; import com.code4rox.videoplayer.helperClasses.RecyclerViewDecorationClass; import com.code4rox.videoplayer.permissionHandler.PermissionManager; import com.code4rox.videoplayer.services.BackgroundPlayService; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayerFactory; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.SimpleExoPlayer; import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.analytics.AnalyticsListener; import com.google.android.exoplayer2.audio.AudioAttributes; import com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector; import com.google.android.exoplayer2.source.ConcatenatingMediaSource; import com.google.android.exoplayer2.source.MediaSource; import com.google.android.exoplayer2.source.ProgressiveMediaSource; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.source.dash.DashMediaSource; import com.google.android.exoplayer2.source.hls.HlsMediaSource; import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource; import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection; import com.google.android.exoplayer2.trackselection.DefaultTrackSelector; import com.google.android.exoplayer2.trackselection.TrackSelection; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.trackselection.TrackSelector; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.DefaultTimeBar; import com.google.android.exoplayer2.ui.PlayerControlView; import com.google.android.exoplayer2.ui.PlayerView; import com.google.android.exoplayer2.upstream.BandwidthMeter; import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultHttpDataSource; import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory; import com.google.android.exoplayer2.util.Util; import com.google.android.gms.ads.AdView; import com.nabinbhandari.android.permissions.PermissionHandler; import com.nabinbhandari.android.permissions.Permissions; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Objects; import java.util.concurrent.TimeUnit; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.LinearLayoutCompat; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.app.ShareCompat; import androidx.core.content.ContextCompat; import androidx.core.content.FileProvider; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProvider; import androidx.recyclerview.widget.RecyclerView; import static android.media.AudioManager.STREAM_MUSIC; import static android.os.Environment.DIRECTORY_PICTURES; import static com.code4rox.videoplayer.services.AudioPlayerService.MEDIA_SESSION_TAG; import static com.code4rox.videoplayer.utils.AnimationUtils.Type.SCALE_AND_ALPHA; import static com.code4rox.videoplayer.utils.AnimationUtils.animateView; public class VideoPlayer extends AppCompatActivity implements AdmobUtils.AdmobInterstitialListener { public static final int DEFAULT_CONTROLS_DURATION = 300; private static final int ORIENTATION_LANDSCAPE = 2; //Player Veriables private PlayerView mExoPlayerView; public MediaSource mVideoSource; private ConcatenatingMediaSource concatenatingMediaSource; private PlayerControlView controlView; //Gesture detector private final float MAX_GESTURE_LENGTH = 0.75f; public GestureDetector gestureDetector; //Context public Context context; //TextViews public TextView swapduration, swapupdatevalue, overLayToturialTitle, volumepercentText, brightnesspercentText, overlaydissmisDialog, titleprogress, playbackSpeedText, playasaudioText, mutePlayerText, repeatPlayerText, titleSong; //Image Views private ImageView backarrow, menuIcon, playasaudioImage, mutePlayerImage, repeatPlayerImage, iconAnimations, lockicon, controlAnimationView; //Framelayout Aspect Ratio public FrameLayout aspectratiolayout; //Seekbar private SeekBar seekbar1, seekbar; //Shared Preferences public SharedPreferences preferences; //AudioManager private AudioManager audioManager; //Progress bar Loading Bar private ProgressBar loading; //Image Buttons private ImageButton aspectratiobutton1; private ImageButton repeatcontroll; private ImageButton equalizer; private ImageButton exo_screenlock, exo_next, exo_prev; //Constraint Layout private ConstraintLayout featuresmenu, muteplayerbutton, lockLayout, repeatmenubutton, speed, loading_parent_layout, swaptimerrootview, overLayToturial, screenshortButton, backgroundplaybutton, vbview, popupbutton, exo_equalizer; // Animation private ValueAnimator controlViewAnimator; //General Veriables private String url; private String name; private String songname; public long position; public long totalduration; public long currentserviceposition; public int servicerepeatmode, maxGestureLength, isfull = 0, isempty = 0, count = 0, currentPlayerVolume; public ArrayList<String> playlist = new ArrayList<>(); private boolean muted; private boolean serviceplayerisplaying = false; private boolean servicebackgroundplaystate; private boolean firsttime = true; private boolean mExoPlayerFullscreen; private boolean activityplayerisplaying = false; private boolean ispopupenable; private boolean local; private int urlindex; private boolean playlistmode; private int servicesongindex; private int sessionId; private boolean firstsessionid = true; private ImageButton exo_shuffle, sharevideo; Boolean isstream; private ImageButton nightmode; private boolean isnightmode = false; private float previousBrightness; private ImageButton sleepplayer; private int selectedItems; private TextView timer; private boolean timerSelectDuration; private CountDownTimer timers; private boolean toturialvisiablity; private SimpleExoPlayer player; private String path; private AudioFocusRequest focusRequest; private MediaPlayer mediaPlayer; private MediaController mediaController; private MediaSession.Token mediaSessiontoken; private LockScreenReceiver lockScreenReceiver; private Dao dao; public static final int ACTIVITY_REQUEST_CODE = 1; private int file_size; private List<song_detail_table> data; private song_detail_table songdetail; private ImageButton expander; private HorizontalScrollView horizontalScrollView; DisplayMetrics displayMetrics = new DisplayMetrics(); private LinearLayoutCompat scrollgrouplayout; public RecyclerView scrollingwidgetview; private ArrayList<Integer> widgetslist; private WindowManager.LayoutParams layoutParams; Bundle savedInstanceState; private ScrollingWidgetsAdapter scrollingWidgetsAdapter; private int itemPosition; private int marginright; private int devicewidth; private TinyDB tinyDB; private DefaultTimeBar defaultTimeBar; private SharedPreferences.OnSharedPreferenceChangeListener preferenceslistener; private boolean isServiceReturnedIndex; private boolean playersourceerror; private int indexofwindow; private int previousindex = -1; private AlertDialog.Builder builder; private int songindex; private EqualizerFragment equalizerFragment; private Equalizer mEqualizer; private ArrayList<Integer> activatedicons; private int widgetid; private boolean singleactivitycall; private boolean isInterAdShow = false; private AdmobUtils admobUtils; private FrameLayout addview; private boolean songisindatabase = false; private AdView adView; private Dialog adDialog; private boolean isFirst = false; private boolean playerlocked; public VideoPlayer() { } @RequiresApi(api = Build.VERSION_CODES.N) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_videoplayer); Log.d("lifecycle", "oncreate"); adDialog = new Dialog(VideoPlayer.this); admobUtils = new AdmobUtils(this, this, InterAdsIdType.INTER_AM); initExitDialog(); tinyDB = new TinyDB(this); servicebackgroundplaystate = getIntent().getBooleanExtra("BackgroundPlayService", false); servicerepeatmode = getIntent().getIntExtra("repeatmode", 0); widgetslist = new ArrayList<>(); widgetslist.add(R.drawable.ic_mixer); // widgetslist.add(R.drawable.ic_time_ic); widgetslist.add(R.drawable.ic_share); widgetslist.add(R.drawable.ic_shuffle_ic); widgetslist.add(R.drawable.ic_night_ic); if (servicerepeatmode == 0) { widgetslist.add(R.drawable.ic_repeat_ic); } else { widgetslist.add(R.drawable.ic_repeat_selected); } widgetslist.add(R.drawable.ic_rotate_ic); widgetslist.add(R.drawable.ic_arrow_ic); exo_next = findViewById(R.id.exo_next); exo_prev = findViewById(R.id.exo_prev); // addview = findViewById(R.id.addPlayer); defaultTimeBar = findViewById(R.id.exo_progress); defaultTimeBar.setScrubberColor(getResources().getColor(R.color.colorPrimary)); // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int deviceheight = displayMetrics.heightPixels; devicewidth = displayMetrics.widthPixels; path = getIntent().getStringExtra("path"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Log.d("lifecycle", "create pressed" + VideoPlayer.this.isInPictureInPictureMode()); } //AUDIO MANAGER SERVICE layoutParams = getWindow().getAttributes(); layoutParams.screenBrightness = 1f; getWindow().setAttributes(layoutParams); Log.d("brightnessplayer", "" + previousBrightness); audioManager = (AudioManager) getSystemService(AUDIO_SERVICE); //PLAYER STARTED initializeElements(); //Intent getting String imageurl = getIntent().getStringExtra("thumbnail"); ConstraintLayout controlslayout = findViewById(R.id.controlerbottomlayout); //getting url every time the player started //For now we pass the demo path you could pass through intent preferences = getSharedPreferences("player", MODE_PRIVATE); name = getIntent().getStringExtra("title"); currentserviceposition = getIntent().getLongExtra("currentposition", 0); // servicebackgroundplaystate = getIntent().getBooleanExtra("BackgroundPlayService", false); // servicerepeatmode = getIntent().getIntExtra("repeatmode", 0); isstream = getIntent().getBooleanExtra("isstream", false); toturialvisiablity = getIntent().getBooleanExtra("toturialvisiablity", true); //Over layer tutorial overLayToturialTitle.setText(getResources().getString(R.string.videoplayerTipsText)); overLayToturialTitle.setVisibility(View.VISIBLE); overlaydissmisDialog = findViewById(R.id.dismissToturialDialog); overlaydissmisDialog.setText("Got it,\nDismiss this"); Intent intent = getIntent(); overLayToturial.setVisibility(View.VISIBLE); singleactivitycall = intent.getBooleanExtra("singleplaylistmodecall", false); //Seekbar seekbar.setRotation(-90); seekbar.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orangeColor), PorterDuff.Mode.SRC_ATOP); seekbar1.setRotation(-90); seekbar1.getProgressDrawable().setColorFilter(getResources().getColor(R.color.orangeColor), PorterDuff.Mode.SRC_ATOP); //Getting information for player initialization Uri uri; if (toturialvisiablity) { if (getIntent().getDataString() != null) { url = getIntent().getDataString(); uri = Uri.parse(url); if (Objects.requireNonNull(uri.getScheme()).equals("content")) { @SuppressLint("Recycle") Cursor returnCursor = getContentResolver().query(uri, null, null, null, null); int nameIndex = 0; if (returnCursor != null) { nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); } // int sizeIndex = returnCursor.getColumnIndex(OpenableColumns.SIZE); if (returnCursor != null) { returnCursor.moveToFirst(); } if (returnCursor != null) { songname = returnCursor.getString(nameIndex); } if (songname != null) titleSong.setText(songname); local = true; } else { local = true; songname = getFileNameFromUrl(url); titleSong.setText(songname); } } else if (isstream) { url = getIntent().getStringExtra("url"); songname = getFileNameFromUrl(url); titleSong.setText(songname); } else { urlindex = getIntent().getIntExtra("urlindex", 0); playlist = getIntent().getStringArrayListExtra("playlist"); songname = getFileNameFromUrl(playlist.get(urlindex)); playlistmode = true; titleSong.setText(songname); isFirst = true; } } else { local = getIntent().getBooleanExtra("local", false); if (local) { url = getIntent().getStringExtra("url"); uri = Uri.parse(url); if (Objects.requireNonNull(uri.getScheme()).equals("content")) { @SuppressLint("Recycle") Cursor returnCursor = getContentResolver().query(uri, null, null, null, null); int nameIndex = 0; if (returnCursor != null) { nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); } if (returnCursor != null) { returnCursor.moveToFirst(); } if (returnCursor != null) { songname = returnCursor.getString(nameIndex); } if (songname != null) titleSong.setText(songname); else titleSong.setText("null"); local = true; } else { local = true; songname = getFileNameFromUrl(url); titleSong.setText(songname); } } else if (isstream) { url = getIntent().getStringExtra("url"); if (url != null) { songname = getFileNameFromUrl(url); } titleSong.setText(songname); } else { playlist = getIntent().getStringArrayListExtra("playlist"); urlindex = getIntent().getIntExtra("PlayerCurrentSongIndex", 0); songname = getFileNameFromUrl(playlist.get(urlindex)); playlistmode = true; titleSong.setText(songname); } } //Building the media source both for playlist and local requestvideo(url); //initialize player // initExitDialog(); initExoPlayer(); if (getIntent().getBooleanExtra("shufflemode", false)) { mExoPlayerView.getPlayer().setShuffleModeEnabled(true); } //Rotation screen feature //For pop-up getting the current position if (getIntent().hasExtra("currentposition")) { overLayToturial.setVisibility(View.GONE); mExoPlayerView.getPlayer().seekTo(getIntent().getLongExtra("currentposition", 0)); } //Player Feauters at bottom of player //For Screen lock exo_screenlock.setOnClickListener(v -> { lockLayout.setVisibility(View.VISIBLE); mExoPlayerView.hideController(); mExoPlayerView.setEnabled(false); mExoPlayerView.setUseController(false); controlView.setEnabled(false); playerlocked = true; }); //For unloack screen lockicon.setOnClickListener(v -> { lockLayout.setVisibility(View.GONE); mExoPlayerView.showController(); mExoPlayerView.setEnabled(true); controlView.setEnabled(true); mExoPlayerView.setUseController(true); playerlocked = false; }); //For Aspect Ratio aspectratiobutton1.setOnClickListener(v -> { switch (mExoPlayerView.getResizeMode()) { case AspectRatioFrameLayout.RESIZE_MODE_FIT: mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL); aspectratiobutton1.setBackgroundResource(R.drawable.ic_crop); break; case AspectRatioFrameLayout.RESIZE_MODE_ZOOM: mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT); aspectratiobutton1.setBackgroundResource(R.drawable.ic_zoom_ic); break; case AspectRatioFrameLayout.RESIZE_MODE_FILL: mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_ZOOM); aspectratiobutton1.setBackgroundResource(R.drawable.ic_100); break; default: mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT); break; case AspectRatioFrameLayout.RESIZE_MODE_FIXED_HEIGHT: case AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH: break; } }); //Playback speed speed.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getPlaybackParameters().speed == 1f) { PlaybackParameters param = new PlaybackParameters(2f); mExoPlayerView.getPlayer().setPlaybackParameters(param); showAndAnimateControl(R.drawable.speed2x, true); } else if (mExoPlayerView.getPlayer().getPlaybackParameters().speed == 2f) { PlaybackParameters param = new PlaybackParameters(4f); showAndAnimateControl(R.drawable.ic_4x, true); mExoPlayerView.getPlayer().setPlaybackParameters(param); } else { PlaybackParameters param = new PlaybackParameters(1f); showAndAnimateControl(R.drawable.ic_1x, true); mExoPlayerView.getPlayer().setPlaybackParameters(param); } } }); if (!local && !isstream) { songdetail = songdatabase.getDatabase(getApplicationContext()).songdao().get(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); builder = new AlertDialog.Builder(VideoPlayer.this); builder.setMessage(R.string.dialog_position_getter) .setPositiveButton("RESUME", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // FIRE ZE MISSILES! if (songdetail != null) { mExoPlayerView.getPlayer().seekTo(songdetail.getSong_played_duration()); mExoPlayerView.getPlayer().setPlayWhenReady(true); } else { mExoPlayerView.getPlayer().setPlayWhenReady(true); } isFirst = false; } }) .setNegativeButton("START OVER", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mExoPlayerView.getPlayer().seekTo(0); mExoPlayerView.getPlayer().setPlayWhenReady(true); // User cancelled the dialog isFirst = false; } }); } exo_next.setOnClickListener((v) -> { songcheck(); mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getDuration()); mExoPlayerView.getPlayer().next(); }); exo_prev.setOnClickListener((v) -> { songcheck(); mExoPlayerView.getPlayer().previous(); }); //Player listener if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().addListener(new ExoPlayer.EventListener() { @NonNullApi @Override public void onTimelineChanged(Timeline timeline, int reason) { } @NonNullApi @Override public void onTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { Log.d("timersstatus", "track" + timerSelectDuration); // if (timerSelectDuration) { // Log.d("timersstatus", "off"); // finish(); // } // if (!tinyDB.getBoolean("AutoPlayNextSetting")) { // finish(); // } if (!local && !isstream && !singleactivitycall) { indexofwindow = mExoPlayerView.getPlayer().getCurrentWindowIndex(); if (indexofwindow != previousindex) { songdetail = songdatabase.getDatabase(getApplicationContext()).songdao().get(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); if (songdetail != null) { if (songdetail.getSong_id() > -1) { songisindatabase = true; } } if ((getIntent().getBooleanExtra("ispopup", false)) || (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_ONE) || servicebackgroundplaystate) { } else { if (songisindatabase) { if (tinyDB.getBoolean("ResumeSetting")) { Log.d("playerstatus", "insideondiscontinuity"); if (getIntent().getBooleanExtra("actiivitysongcallintent", false)) { overLayToturial.setVisibility(View.GONE); mExoPlayerView.getPlayer().setPlayWhenReady(false); songdetail = songdatabase.getDatabase(getApplicationContext()).songdao().get(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); builder.show(); isFirst = true; } else { if (!serviceplayerisplaying && songdetail != null) { overLayToturial.setVisibility(View.GONE); mExoPlayerView.getPlayer().setPlayWhenReady(false); songdetail = songdatabase.getDatabase(getApplicationContext()).songdao().get(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); builder.show(); isFirst = true; } } } } } previousindex = indexofwindow; } } } @NonNullApi @Override public void onLoadingChanged(boolean isLoading) { } @NonNullApi @Override public void onPlayerStateChanged(boolean playWhenReady, int playbackState) { mExoPlayerView.setKeepScreenOn(true); try { if (playbackState == PlaybackStateCompat.STATE_SKIPPING_TO_NEXT) { } if (playbackState == mExoPlayerView.getPlayer().STATE_ENDED) { if (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_OFF) { loading_parent_layout.setVisibility(View.GONE); } else { mExoPlayerView.getPlayer().seekTo(0); } finish(); } else if (mExoPlayerView.getPlayer().getPlaybackState() == mExoPlayerView.getPlayer().STATE_READY) { loading_parent_layout.setVisibility(View.GONE); } else if (mExoPlayerView.getPlayer().getPlaybackState() == mExoPlayerView.getPlayer().STATE_BUFFERING) { loading_parent_layout.setVisibility(View.VISIBLE); loading.setVisibility(View.VISIBLE); } if (playWhenReady && playbackState == mExoPlayerView.getPlayer().STATE_READY) { adDialog.dismiss(); if (timerSelectDuration) { long durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); timerstart(durationfortimer); } loading_parent_layout.setVisibility(View.GONE); loading.setVisibility(View.GONE); AudioAttributes audioAttributes = new AudioAttributes.Builder() .setUsage(C.USAGE_MEDIA) .setContentType(C.CONTENT_TYPE_MOVIE) .build(); Objects.requireNonNull(mExoPlayerView.getPlayer().getAudioComponent()).setAudioAttributes(audioAttributes, true); activityplayerisplaying = true; } else if (playWhenReady) { // might be idle (plays after prepare()), // buffering (plays when data available) // or ended (plays when seek away from end) } else { // player paused in any state\ if (!isFirst) { if (isConnected()) { adDialog.show(); } else { } } else { } /* admobUtils = new AdmobUtils(VideoPlayer.this); admobUtils.loadBannerAd(adView);*/ if (timerSelectDuration) { cancelTimer(); long durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); scrollingWidgetsAdapter.changeTimerView(itemPosition, durationfortimer, true); } activityplayerisplaying = false; } } catch (Exception e) { e.printStackTrace(); } } @NonNullApi @Override public void onRepeatModeChanged(int repeatMode) { } @NonNullApi @Override public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) { } @NonNullApi @Override public void onPlayerError(ExoPlaybackException error) { //Handeling the error for none playable video String TAG = "PLAYER_ERROR"; switch (error.type) { case ExoPlaybackException.TYPE_SOURCE: overLayToturial.setVisibility(View.GONE); Toast.makeText(getApplicationContext(), "Cannot Play This Video", Toast.LENGTH_LONG).show(); playersourceerror = true; finish(); break; case ExoPlaybackException.TYPE_RENDERER: break; case ExoPlaybackException.TYPE_UNEXPECTED: break; case ExoPlaybackException.TYPE_OUT_OF_MEMORY: case ExoPlaybackException.TYPE_REMOTE: break; } } @NonNullApi @Override public void onPositionDiscontinuity(int reason) { if (mExoPlayerView.getPlayer() != null) { int latestWindowIndex = mExoPlayerView.getPlayer().getCurrentWindowIndex(); if (latestWindowIndex != urlindex) { // item selected in playlist has changed, handle here urlindex = latestWindowIndex; songname = getFileNameFromUrl(playlist.get(urlindex)); titleSong.setText(songname); } } } @NonNullApi @Override public void onPlaybackParametersChanged(PlaybackParameters playbackParameters) { } @NonNullApi @Override public void onSeekProcessed() { // if (timerSelectDuration) { // if (activityplayerisplaying) { // // } else { // cancelTimer(); // long durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); // int positionoftimer = widgetslist.indexOf(R.drawable.ic_time_ic); // scrollingWidgetsAdapter.changeTimerView(positionoftimer, durationfortimer, true); // // } // // } else { // // } // timer(); // if (timerSelectDuration) { // long durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); //// timerstart(durationfortimer); // if (mExoPlayerView.getPlayer().getPlayWhenReady()) { // timerstart(durationfortimer); // } else { // cancelTimer(); //// timer.setText("" + String.format("%d:%d", //// TimeUnit.MILLISECONDS.toMinutes(durationfortimer), //// TimeUnit.MILLISECONDS.toSeconds(durationfortimer) - //// TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(durationfortimer)))); //// timerstart(durationfortimer); // durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); // scrollingWidgetsAdapter.changeTimerView(4, durationfortimer, true); // } // } // Bitmap bitmap = null; // if (mExoPlayerView.getVideoSurfaceView() != null) { // bitmap = ((TextureView) mExoPlayerView.getVideoSurfaceView()).getBitmap(); // Glide.with(getApplicationContext()).asBitmap().load(bitmap).into(frame); // } // loadPreview(mExoPlayerView.getPlayer().getCurrentPosition(),mExoPlayerView.getPlayer().getDuration()); // loadPreview(mExoPlayerView.getPlayer().getCurrentPosition(),mExoPlayerView.getPlayer().getDuration()); // Log.d("seekbaraction", "" + bitmap); // frame.setImageBitmap(bitmap); // loadPreview(mExoPlayerView.getPlayer().getCurrentPosition(), mExoPlayerView.getPlayer().getDuration()) // Log.d("bitmapcaptured", "" + bitmap); } }); } if (player != null) { player.addAnalyticsListener(new AnalyticsListener() { @Override public void onAudioSessionId(@NotNull EventTime eventTime, int audioSessionId) { try { mEqualizer = new Equalizer(1000, audioSessionId); mEqualizer.setEnabled(true); sessionId = audioSessionId; } catch (Exception e) { } } }); } //Repeat button for side menu repeatmenubutton.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); if (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_ONE) { mExoPlayerView.getPlayer().setRepeatMode(mExoPlayerView.getPlayer().REPEAT_MODE_OFF); repeatPlayerText.setTextColor(getResources().getColor(R.color.white)); repeatPlayerImage.setImageResource(R.drawable.repeat); } else if (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_OFF) { repeatPlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); repeatPlayerImage.setImageResource(R.drawable.ic_repeat_selected); mExoPlayerView.getPlayer().setRepeatMode(mExoPlayerView.getPlayer().REPEAT_MODE_ONE); } }); //Getting the total area of touch screen mExoPlayerView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) { // Use smaller value to be consistent between screen orientations // (and to make usage easier) int width = right - left, height = bottom - top; maxGestureLength = (int) (Math.min(width, height) * MAX_GESTURE_LENGTH); // setInitialGestureValues(); seekbar.setMax(maxGestureLength); seekbar1.setMax(maxGestureLength); isfull = maxGestureLength; float currentVolume = audioManager.getStreamVolume(STREAM_MUSIC), maxVolume = audioManager.getStreamMaxVolume(STREAM_MUSIC), res = currentVolume / maxVolume; int progress = (int) (res * maxGestureLength); seekbar.setProgress(progress); if (tinyDB.getFloat("playerbrightness") > -1 && !isnightmode) { WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.screenBrightness = tinyDB.getFloat("playerbrightness"); getWindow().setAttributes(layoutParams); seekbar1.setMax(maxGestureLength); Log.d("brightnessseekbar", "oncreate-total-" + maxGestureLength); seekbar1.setProgress(tinyDB.getInt("playerBrightnessSeekbarValue")); Log.d("brightnessseekbar", "oncreate--" + tinyDB.getInt("playerBrightnessSeekbarValue")); brightnesspercentText.setText(tinyDB.getString("textofbrightness")); // vbview.setVisibility(View.VISIBLE); // seekbar1.setVisibility(View.VISIBLE); // brightnesspercentText.setVisibility(View.VISIBLE); // titleprogress.setText("Brightness"); } if (tinyDB.getInt("playervolume") > -1 && !muted) { audioManager.setStreamVolume(STREAM_MUSIC, tinyDB.getInt("playervolume"), 0); } } }); //To get the volume changed from the volume key pressed //Setting Content Observer SettingsContentObserver mSettingsContentObserver = new SettingsContentObserver(new Handler()); this. getApplicationContext(). getContentResolver(). registerContentObserver( Settings.System.CONTENT_URI, false, mSettingsContentObserver); final MyGestureListener listener = new MyGestureListener(); gestureDetector = new GestureDetector(this, listener); mExoPlayerView.setOnTouchListener(listener); //screen short button Action screenshortButton.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); Permissions.check(this, Manifest.permission.WRITE_EXTERNAL_STORAGE, null, new PermissionHandler() { @Override public void onGranted() { takeSnapshot(); } }); }); // mScaleGestureDetector = new ScaleGestureDetector(VideoPlayer.this, new ScaleListener()); //Background play Feature backgroundplaybutton.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); if (servicebackgroundplaystate) { playasaudioImage.setImageResource(R.drawable.ic_audio_ic); playasaudioText.setTextColor(getResources().getColor(R.color.white)); servicebackgroundplaystate = false; } else { showAndAnimateControl(R.drawable.ic_audio_ic, true); playasaudioImage.setImageResource(R.drawable.ic_play_as_audio_selected); playasaudioText.setTextColor(getResources().getColor(R.color.orangeColor)); servicebackgroundplaystate = true; } }); // if (servicebackgroundplaystate) { // playasaudioImage.setImageResource(R.drawable.ic_play_as_audio_selected); // playasaudioText.setTextColor(getResources().getColor(R.color.orangeColor)); // overLayToturial.setVisibility(View.GONE); // Log.d("servicerepeatmode", "" + servicerepeatmode); // if (servicerepeatmode == 1) { // mExoPlayerView.getPlayer().setRepeatMode(servicerepeatmode); //// repeatcontroll.setImageResource(R.drawable.ic_repeat_selected); // repeatPlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); // repeatPlayerImage.setImageResource(R.drawable.ic_repeat_selected); // } else { //// repeatcontroll.setImageResource(R.drawable.repeat_off); // repeatPlayerText.setTextColor(getResources().getColor(R.color.white)); // repeatPlayerImage.setImageResource(R.drawable.ic_repeat_ic); // } // } //Current Volume currentPlayerVolume = audioManager.getStreamVolume(STREAM_MUSIC); Log.d("volumeofplayer", "" + currentPlayerVolume); //Mute Feature muteplayerbutton.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); menuIcon.setImageResource(R.drawable.ic_side_bar); if (muted) { audioManager.setStreamVolume(STREAM_MUSIC, tinyDB.getInt("playervolume"), 0); mutePlayerImage.setImageResource(R.drawable.ic_mute_ic); mutePlayerText.setTextColor(getResources().getColor(R.color.white)); muted = false; } else { iconAnimations.setImageResource(R.drawable.ic_mute_ic); showAndAnimateControl(R.drawable.ic_mute_player_popup, true); audioManager.setStreamVolume(STREAM_MUSIC, 0, 0); mutePlayerImage.setImageResource(R.drawable.ic_mute_player_selected); mutePlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); muted = true; } }); preferenceslistener = (prefs, s) -> { // mExoPlayerView.getPlayer().setRepeatMode(prefs.getInt("repeatmode", 0)); // if(servicebackgroundplaystate) { // serviceplayerisplaying = prefs.getBoolean("serviceplayerisplaying", true); // } if (servicerepeatmode == 0) mExoPlayerView.getPlayer().setRepeatMode(prefs.getInt("servicerepeatmodehomebuttonCall", 0)); if (getIntent().getFloatExtra("playerspeed", 1) == 1f) { float speed = prefs.getFloat("serviceplayerspeedhomebuttonCall", 1f); PlaybackParameters param = new PlaybackParameters(speed); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlaybackParameters(param); } } Log.d("servicerepeatmode", "repeatmode"); overLayToturial.setVisibility(View.GONE); local = prefs.getBoolean("local", false); isServiceReturnedIndex = prefs.getBoolean("servicereturnedindex", false); boolean activitycalltosong = prefs.getBoolean("activitycalltosong", false); servicesongindex = prefs.getInt("PlayerCurrentSongIndex", 0); Boolean ispopup = getIntent().getBooleanExtra("ispopup", false); if (servicebackgroundplaystate || ispopup) { if (!local && !isstream) { if (!activitycalltosong) { mExoPlayerView.getPlayer().seekTo(servicesongindex, prefs.getLong("PlayerCurrentPosition", 0)); songname = getFileNameFromUrl(playlist.get(servicesongindex)); } playlistmode = true; titleSong.setText(songname); mExoPlayerView.getPlayer().setPlayWhenReady(true); } else if (isstream) { mExoPlayerView.getPlayer().seekTo(servicesongindex, prefs.getLong("PlayerCurrentPosition", 0)); songname = getFileNameFromUrl(url); isstream = true; titleSong.setText(songname); mExoPlayerView.getPlayer().setPlayWhenReady(true); } } else { mExoPlayerView.getPlayer().setPlayWhenReady(false); } if (!activitycalltosong) { if (prefs.getLong("PlayerCurrentPosition", 0) != mExoPlayerView.getPlayer().getDuration()) { mExoPlayerView.getPlayer().seekTo(prefs.getLong("PlayerCurrentPosition", 0)); } } else { mExoPlayerView.getPlayer().seekTo(0); } if (!local) { mExoPlayerView.getPlayer().seekTo(prefs.getLong("PlayerCurrentPosition", 0)); } }; //overlay visibility on audio service if (toturialvisiablity && !servicebackgroundplaystate) { overLayToturial.setOnClickListener(v -> { overLayToturial.setVisibility(View.GONE); isFirst = false; mExoPlayerView.showController(); }); } if (servicebackgroundplaystate) { overLayToturial.setVisibility(View.GONE); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlayWhenReady(true); } } //Menu settings menuIcon.setOnClickListener(v -> { if (featuresmenu.getVisibility() == View.VISIBLE) { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); } else { featuresmenu.setVisibility(View.VISIBLE); menuIcon.setImageResource(R.drawable.ic_side_bar_selected); } }); controlslayout.setOnClickListener(v -> { mExoPlayerView.setUseController(true); if (mExoPlayerView.isControllerVisible()) { mExoPlayerView.showController(); } }); //Back arrow pressed backarrow.setOnClickListener(v -> { onBackPressed(); }); //Pop-up feature popupbutton.setOnClickListener(v -> { featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); enterpipmode(); }); lockScreenReceiver = new LockScreenReceiver(); IntentFilter lockFilter = new IntentFilter(); lockFilter.addAction(Intent.ACTION_SCREEN_ON); lockFilter.addAction(Intent.ACTION_SCREEN_OFF); lockFilter.addAction(Intent.ACTION_USER_PRESENT); registerReceiver(lockScreenReceiver, lockFilter); // com.code4rox.videoplayer.database.viewmodel.songviewmodel songviewmodel = new // ViewModelProvider(this). // get(com.code4rox.videoplayer.database.viewmodel.songviewmodel.class); // songviewmodel.getallsongs(). // observe(this, new Observer<List<song_detail_table>>() { // @Override // public void onChanged(List<song_detail_table> song_detail_tables) { // data = song_detail_tables; // } // }); scrollingwidgetview.addItemDecoration(new RecyclerViewDecorationClass()); scrollingWidgetsAdapter = new ScrollingWidgetsAdapter(widgetslist); scrollingwidgetview.setAdapter(scrollingWidgetsAdapter); scrollingwidgetview.scrollToPosition(widgetslist.size() - 3); RecyclerView.EdgeEffectFactory edgeEffectFactory = new RecyclerView.EdgeEffectFactory() { @NonNull @Override protected EdgeEffect createEdgeEffect(@NonNull RecyclerView view, int direction) { EdgeEffect edgeEffect = new EdgeEffect(view.getContext()); edgeEffect.setColor(ContextCompat.getColor(view.getContext(), R.color.grey_trans)); return edgeEffect; } }; scrollingwidgetview.setEdgeEffectFactory(edgeEffectFactory); // if (tinyDB.getFloat("playerbrightness") > -1) { // WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); // layoutParams.screenBrightness = tinyDB.getFloat("playerbrightness"); // getWindow().setAttributes(layoutParams); // seekbar1.setProgress(tinyDB.getInt("playerBrightnessSeekbarValue")); // brightnesspercentText.setText(tinyDB.getString("textofbrightness")); // } if (tinyDB.getInt("playervolume") > -1) { audioManager.setStreamVolume(STREAM_MUSIC, tinyDB.getInt("playervolume"), 0); } // admobUtils = new AdmobUtils(VideoPlayer.this); // admobUtils.loadNativeAd (addview , R.layout.ad_unified, NativeAdsIdType.MM_NATIVE_AM); ///////////// Log.d("playerspeed", "" + getIntent().getFloatExtra("playerspeed", 1f)); if (getIntent().getFloatExtra("playerspeed", 1f) > 0) { float speed = getIntent().getFloatExtra("playerspeed", 1f); PlaybackParameters param = new PlaybackParameters(speed); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlaybackParameters(param); } } // if(getIntent().getIntExtra("repeatmode",0)>=0) // { // int repeatmode=getIntent().getIntExtra("repeatmode",0); // if (mExoPlayerView.getPlayer() != null) { // mExoPlayerView.getPlayer().setRepeatMode(repeatmode); // } // } } void changediconorder(int position, int widget) { widgetslist.remove(position); widgetslist.remove(widgetslist.size() - 1); widgetslist.add(widget); widgetslist.add(R.drawable.ic_arrow_ic); scrollingWidgetsAdapter.notifyDataSetChanged(); } void changedfordeactivation(int position, int widget) { if (widget == R.drawable.ic_rotate_ic) { int x = 0; for (int i = 0; i < widgetslist.size(); i++) { if (widgetslist.get(i) == R.drawable.ic_repeat_selected || widgetslist.get(i) == R.drawable.nightactive || widgetslist.get(i) == R.drawable.ic_shuffle_active) { x++; } } if (x == 3) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 2, widget); } } else if (x == 2) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 3, widget); } } else if (x == 1) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 4, widget); } } else { widgetslist.remove(position); int indexofarrow = widgetslist.indexOf(R.drawable.ic_arrow_ic); if (indexofarrow > 0) { widgetslist.add(indexofarrow, widget); } } } else { boolean rotateicon = false; int x = 0; for (int i = 0; i < widgetslist.size(); i++) { if (widgetslist.get(i) == R.drawable.ic_rotat_active) { rotateicon = true; } if (widgetslist.get(i) == R.drawable.ic_repeat_selected || widgetslist.get(i) == R.drawable.nightactive || widgetslist.get(i) == R.drawable.ic_shuffle_active) { x++; } } if (rotateicon) { if (x == 3) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 2, widget); } } else if (x == 2) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 3, widget); } } else if (x == 1) { widgetslist.remove(position); int indexofequalizer = widgetslist.indexOf(R.drawable.ic_mixer); if (indexofequalizer == 0) { widgetslist.add(indexofequalizer + 4, widget); } } else { widgetslist.remove(position); int indexofarrow = widgetslist.indexOf(R.drawable.ic_arrow_ic); if (indexofarrow > 0) { widgetslist.add(indexofarrow, widget); } } } else { widgetslist.remove(position); int indexofrotation = widgetslist.indexOf(R.drawable.ic_rotate_ic); int indexofrotationactive = widgetslist.indexOf(R.drawable.ic_rotat_active); if (indexofrotation > 0) { widgetslist.add(indexofrotation - 1, widget); } } } scrollingWidgetsAdapter.notifyDataSetChanged(); } @Subscribe(threadMode = ThreadMode.MAIN) public void onMessageEvent(ScrollingWidgetsAdapter.MessageEvent event) { widgetid = event.imageReference; itemPosition = event.position; if (widgetid == R.drawable.ic_rotate_ic || widgetid == R.drawable.ic_rotat_active) { if (mExoPlayerFullscreen) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); changedfordeactivation(itemPosition, R.drawable.ic_rotate_ic); mExoPlayerFullscreen = false; hideSystemUI(); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); changediconorder(itemPosition, R.drawable.ic_rotat_active); showSystemUi(); mExoPlayerFullscreen = true; } } else if (widgetid == R.drawable.ic_repeat_ic || widgetid == R.drawable.ic_repeat_selected) { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_ONE) { mExoPlayerView.getPlayer().setRepeatMode(mExoPlayerView.getPlayer().REPEAT_MODE_OFF); repeatPlayerText.setTextColor(getResources().getColor(R.color.white)); repeatPlayerImage.setImageResource(R.drawable.ic_repeat_ic); changedfordeactivation(itemPosition, R.drawable.ic_repeat_ic); } else if (mExoPlayerView.getPlayer().getRepeatMode() == mExoPlayerView.getPlayer().REPEAT_MODE_OFF) { mExoPlayerView.getPlayer().setRepeatMode(mExoPlayerView.getPlayer().REPEAT_MODE_ONE); repeatPlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); repeatPlayerImage.setImageResource(R.drawable.ic_repeat_selected); changediconorder(itemPosition, R.drawable.ic_repeat_selected); } } } else if (widgetid == R.drawable.ic_mixer) { if (mExoPlayerView.getPlayer() != null && mExoPlayerView.getPlayer().getAudioComponent() != null) { equalizerFragment = EqualizerFragment.newBuilder() .setAccentColor(Color.parseColor("#4caf50")) .setAudioSessionId(sessionId) .build(); getSupportFragmentManager().beginTransaction() .replace(R.id.eqFrame, equalizerFragment) .addToBackStack("equalizer") .commit(); } } else if (widgetid == R.drawable.ic_shuffle_ic || widgetid == R.drawable.ic_shuffle_active) { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getShuffleModeEnabled()) { mExoPlayerView.getPlayer().setShuffleModeEnabled(false); changedfordeactivation(itemPosition, R.drawable.ic_shuffle_ic); } else { mExoPlayerView.getPlayer().setShuffleModeEnabled(true); changediconorder(itemPosition, R.drawable.ic_shuffle_active); } } } else if (widgetid == R.drawable.ic_share) { if (local || isstream) { shareVideo(url); } else { if (mExoPlayerView.getPlayer() != null) { shareVideo(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); } } } else if (widgetid == R.drawable.ic_night_ic || widgetid == R.drawable.nightactive) { if (!isnightmode) { layoutParams.screenBrightness = 0.1f; getWindow().setAttributes(layoutParams); isnightmode = true; Toast.makeText(getApplicationContext(), "Night Mode On", Toast.LENGTH_LONG).show(); changediconorder(itemPosition, R.drawable.nightactive); } else { layoutParams.screenBrightness = tinyDB.getFloat("playerbrightness"); getWindow().setAttributes(layoutParams); isnightmode = false; Toast.makeText(getApplicationContext(), "Night Mode Off", Toast.LENGTH_LONG).show(); changedfordeactivation(itemPosition, R.drawable.ic_night_ic); } } else if (widgetid == R.drawable.ic_arrow_ic) { scrollingwidgetview.scrollToPosition(scrollingWidgetsAdapter.getItemCount() - 7); } } public void timerstart(long selectedItem) { cancelTimer(); long timeinmili; if (selectedItems != 5) { timeinmili = selectedItem * 60000; } else { timeinmili = selectedItem; } timers = new CountDownTimer(timeinmili, 1000) { // adjust the milli seconds here public void onTick(long millisUntilFinished) { if (millisUntilFinished != 0) { int positionoftimer = 0; if (widgetid == R.drawable.ic_time_ic) positionoftimer = widgetslist.indexOf(R.drawable.ic_time_ic); scrollingWidgetsAdapter.changeTimerView(positionoftimer, millisUntilFinished, true); Log.d("timerstatus", "insidetimer"); } } public void onFinish() { finish(); } }.start(); } private void cancelTimer() { if (timers != null) { if (widgetid == R.drawable.ic_time_ic) { timers.cancel(); int positionoftimer = widgetslist.indexOf(R.drawable.ic_time_ic); scrollingWidgetsAdapter.changeTimerView(positionoftimer, 0, false); } } } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.d("pipmode", "onnewintent"); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().release(); } Uri uri; if (getIntent().getDataString() != null) { url = getIntent().getDataString(); uri = Uri.parse(url); if (Objects.requireNonNull(uri.getScheme()).equals("content")) { @SuppressLint("Recycle") Cursor returnCursor = getContentResolver().query(uri, null, null, null, null); int nameIndex = 0; if (returnCursor != null) { nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME); } if (returnCursor != null) { returnCursor.moveToFirst(); } if (returnCursor != null) { songname = returnCursor.getString(nameIndex); } titleSong.setText(songname); local = true; } } else if (isstream) { url = intent.getStringExtra("url"); songname = getFileNameFromUrl(url); titleSong.setText(songname); } else { urlindex = intent.getIntExtra("urlindex", 0); Log.d("urlindex", "" + urlindex); playlist = intent.getStringArrayListExtra("playlist"); songname = getFileNameFromUrl(playlist.get(urlindex)); playlistmode = true; titleSong.setText(songname); } requestvideo(url); initExoPlayer(); } public void enterpipmode() { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (servicebackgroundplaystate) { VideoPlayer.this.getMaxNumPictureInPictureActions(); PictureInPictureParams.Builder pictureInPictureParamsbuilder = new PictureInPictureParams.Builder(); Rational aspectratio = new Rational(2, 1); pictureInPictureParamsbuilder.setAspectRatio(aspectratio); VideoPlayer.this.enterPictureInPictureMode(pictureInPictureParamsbuilder.build()); playasaudioImage.setImageResource(R.drawable.ic_audio_ic); playasaudioText.setTextColor(getResources().getColor(R.color.white)); servicebackgroundplaystate = false; ispopupenable = true; } else { PictureInPictureParams.Builder pictureInPictureParamsbuilder = new PictureInPictureParams.Builder(); Rational aspectratio = new Rational(2, 1); pictureInPictureParamsbuilder.setAspectRatio(aspectratio); VideoPlayer.this.enterPictureInPictureMode(pictureInPictureParamsbuilder.build()); ispopupenable = true; } } } else { if (PermissionManager.isPopupEnabled(VideoPlayer.this)) { if (servicebackgroundplaystate) { ispopupenable = true; servicebackgroundplaystate = false; startVideoBackgroundService(); finish(); } else { stopService(new Intent(VideoPlayer.this, BackgroundPlayService.class)); tinyDB.putBoolean("BackgroundPlaySetting", false); ispopupenable = true; startVideoBackgroundService(); finish(); } } else { Toast.makeText(VideoPlayer.this, "Pop Up Permission Required", Toast.LENGTH_SHORT).show(); } } } public Dialog onCreateDialog(Bundle savedInstanceState) { selectedItems = 0; // Where we track the selected items AlertDialog.Builder builder = new AlertDialog.Builder(VideoPlayer.this); // Set the dialog title builder.setTitle("Select Timer") // Specify the list array, the items to be selected by default (null for none), // and the listener through which to receive callbacks when items are selected .setSingleChoiceItems(R.array.toppings, 0, (dialog, which) -> { // If the user checked the item, add it to the selected items selectedItems = which; switch (selectedItems) { case 0: cancelTimer(); timerSelectDuration = false; break; case 1: timerstart(15); timerSelectDuration = false; Log.d("timerlog", "15"); break; case 2: timerstart(30); timerSelectDuration = false; break; case 3: timerstart(45); timerSelectDuration = false; break; case 4: timerstart(60); timerSelectDuration = false; break; case 5: timerSelectDuration = true; long durationfortimer = (mExoPlayerView.getPlayer().getDuration() - mExoPlayerView.getPlayer().getCurrentPosition()); timerstart(durationfortimer); if (activityplayerisplaying) { } else { cancelTimer(); } break; default: } dialog.dismiss(); }); return builder.create(); } @Override public boolean dispatchKeyEvent(KeyEvent event) { // If the event was not handled then see if the player view can handle it. return super.dispatchKeyEvent(event) || mExoPlayerView.dispatchKeyEvent(event); } @Override public void onPictureInPictureModeChanged(boolean isInPictureInPictureMode, Configuration newConfig) { if (isInPictureInPictureMode) { mExoPlayerView.setUseController(false); mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL); newConfig.orientation = ORIENTATION_LANDSCAPE; // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode. } else { // Restore the full-screen UI. mExoPlayerView.setUseController(true); mExoPlayerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT); } } public String getFileNameFromUrl(String path) { String[] pathArray = path.split("/"); return pathArray[pathArray.length - 1]; } private void hideSystemUI() { // Enables regular immersive mode. // For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE. // Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_IMMERSIVE // Set the content to appear under the system bars so that the // content doesn't resize when the system bars hide and show. | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // Hide the nav bar and status bar | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN); } public void startVideoBackgroundService() { tinyDB.putBoolean("BackgroundPlaySetting", true); Intent datasending = new Intent(VideoPlayer.this, BackgroundPlayService.class); datasending.putExtra("name", songname); datasending.putExtra("Activityplyerstate", activityplayerisplaying); if (mExoPlayerView.getPlayer() != null) { datasending.putExtra("currentActvityposition", mExoPlayerView.getPlayer().getCurrentPosition()); datasending.putExtra("sufflemode", mExoPlayerView.getPlayer().getShuffleModeEnabled()); datasending.putExtra("repeatemode", mExoPlayerView.getPlayer().getRepeatMode()); } datasending.putExtra("toturialoverlay", false); datasending.putExtra("playerspeed", mExoPlayerView.getPlayer().getPlaybackParameters().speed); if (local) { datasending.putExtra("localvideo", true); datasending.putExtra("url", url); } else if (isstream) { datasending.putExtra("isstream", true); datasending.putExtra("url", url); } else { datasending.putStringArrayListExtra("playlist", playlist); datasending.putExtra("windowindex", mExoPlayerView.getPlayer().getCurrentWindowIndex()); } if (servicebackgroundplaystate && mExoPlayerView.getPlayer().getPlaybackState() != mExoPlayerView.getPlayer().STATE_ENDED) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(datasending); } else { startService(datasending); } mExoPlayerView.getPlayer().setPlayWhenReady(false); } else if (ispopupenable && mExoPlayerView.getPlayer().getPlaybackState() != mExoPlayerView.getPlayer().STATE_ENDED) { datasending.putExtra("localvideo", local); if (ispopupenable) { datasending.putExtra("ispopenable", true); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(datasending); } else { startService(datasending); } mExoPlayerView.getPlayer().setPlayWhenReady(false); } } @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { overlaydissmisDialog.setText("Got it,\nDismiss this"); mExoPlayerFullscreen = false; scrollingwidgetview.setAdapter(scrollingWidgetsAdapter); scrollingwidgetview.scrollToPosition(widgetslist.size() - 3); showSystemUi(); } else { overlaydissmisDialog.setText(getResources().getString(R.string.dissmiss_Text)); scrollingwidgetview.setAdapter(scrollingWidgetsAdapter); scrollingwidgetview.scrollToPosition(widgetslist.size() - 2); mExoPlayerFullscreen = true; hideSystemUI(); } } void takeSnapshot() { Bitmap bitmap = null; if (mExoPlayerView.getVideoSurfaceView() != null) { bitmap = ((TextureView) mExoPlayerView.getVideoSurfaceView()).getBitmap(); } try { String folder_main = "Media Player"; String folder_absolute_path = Environment.getExternalStoragePublicDirectory(DIRECTORY_PICTURES) + "/" + folder_main; File f2 = new File(folder_absolute_path); boolean isDirectoryCreated = f2.exists(); if (!isDirectoryCreated) { isDirectoryCreated = f2.mkdirs(); } if (isDirectoryCreated) { // do something } @SuppressLint("SimpleDateFormat") SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd_HH-mm-ss"); Date whatismytime = Calendar.getInstance().getTime(); String strDate = sdf.format(whatismytime); File file = new File(folder_absolute_path, strDate + ".jpg"); OutputStream fOut; fOut = new FileOutputStream(file); if (bitmap != null) { bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fOut); } fOut.flush(); fOut.close(); Runnable runnable = () -> Toast.makeText(VideoPlayer.this, "Snapshot saved !!", Toast.LENGTH_SHORT).show(); Handler handler = new Handler(Looper.getMainLooper()); handler.postDelayed(runnable, 150); refreshAndroidGallery(Uri.fromFile(file)); } catch (Exception ex) { Toast.makeText(VideoPlayer.this, ex.getMessage(), Toast.LENGTH_SHORT).show(); } } public void refreshAndroidGallery(Uri fileUri) { Intent mediaScanIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); mediaScanIntent.setData(fileUri); VideoPlayer.this.sendBroadcast(mediaScanIntent); } private void showSystemUi() { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_IMMERSIVE // Set the content to appear under the system bars so that the // content doesn't resize when the system bars hide and show. | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // Hide the nav bar and status bar | View.SYSTEM_UI_FLAG_FULLSCREEN); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getPlaybackState() == mExoPlayerView.getPlayer().STATE_READY) { mExoPlayerView.getPlayer().setPlayWhenReady(false); } else { mExoPlayerView.getPlayer().setPlayWhenReady(true); } } } return super.onKeyDown(keyCode, event); } private void initExoPlayer() { if (PermissionManager.checkReadStoragePermissions(VideoPlayer.this, 0)) { BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory(bandwidthMeter); TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); player = ExoPlayerFactory.newSimpleInstance(this, trackSelector); if (playlistmode) { player.prepare(concatenatingMediaSource); } else { player.prepare(mVideoSource); } mExoPlayerView.setPlayer(player); MediaSessionCompat mediaSession = new MediaSessionCompat(VideoPlayer.this, MEDIA_SESSION_TAG); MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession); if (playlistmode) { player.seekTo(urlindex, C.TIME_UNSET); } mediaSessionConnector.setPlayer(player); mediaSession.setActive(true); mExoPlayerView.hideController(); mExoPlayerView.setControllerHideOnTouch(true); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setShuffleModeEnabled(false); } if (getIntent().getBooleanExtra("shufflemode", false)) { mExoPlayerView.getPlayer().setShuffleModeEnabled(true); } if (servicebackgroundplaystate) { player.setPlayWhenReady(false); } else { if (tinyDB.getBoolean("ResumeSetting") && !singleactivitycall && songisindatabase) { player.setPlayWhenReady(false); } else player.setPlayWhenReady(true); } } else { Toast.makeText(getApplicationContext(), "Storage Permission Required", Toast.LENGTH_SHORT).show(); } if (tinyDB.getBoolean("AspectRatioSetting")) { mExoPlayerView.setResizeMode(tinyDB.getInt("AspectRatioMode")); switch (mExoPlayerView.getResizeMode()) { case AspectRatioFrameLayout.RESIZE_MODE_FIT: aspectratiobutton1.setBackgroundResource(R.drawable.ic_zoom_ic); break; case AspectRatioFrameLayout.RESIZE_MODE_ZOOM: aspectratiobutton1.setBackgroundResource(R.drawable.ic_100); break; case AspectRatioFrameLayout.RESIZE_MODE_FILL: aspectratiobutton1.setBackgroundResource(R.drawable.ic_crop); break; default: break; case AspectRatioFrameLayout.RESIZE_MODE_FIXED_HEIGHT: case AspectRatioFrameLayout.RESIZE_MODE_FIXED_WIDTH: break; } } else { Toast.makeText(getApplicationContext(), "Enable the Aspect Ratio in Setting ", Toast.LENGTH_LONG).show(); } } public void shareVideo(String path) { if (!isstream) { File videoFile = new File(path); Uri videoURI = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? FileProvider.getUriForFile(Objects.requireNonNull(getApplicationContext()), this.getPackageName() + ".provider", videoFile) : Uri.fromFile(videoFile); ShareCompat.IntentBuilder.from(VideoPlayer.this) .setStream(videoURI) .setType("video/mp4") .setChooserTitle("Share video...") .startChooser(); } else { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setType("video/*"); intent.putExtra(Intent.EXTRA_TEXT, url); startActivity(Intent.createChooser(intent, "Share")); } } public void requestvideo(String url) { if (playlistmode) { //For Playlist running concatenatingMediaSource = new ConcatenatingMediaSource(); for (int i = 0; i < playlist.size(); i++) { mVideoSource = buildMediaSource(Uri.parse(playlist.get(i))); concatenatingMediaSource.addMediaSource(mVideoSource); } } else { if (url != null) { Uri daUri = Uri.parse(url); mVideoSource = buildMediaSource(daUri); } } } private void initializeElements() { mExoPlayerView = findViewById(R.id.exoplayer); controlView = mExoPlayerView.findViewById(R.id.exo_controller); loading_parent_layout = findViewById(R.id.loading_parent_layout); brightnesspercentText = findViewById(R.id.brightnesspercentagetext); volumepercentText = findViewById(R.id.volumepercentagetext); seekbar = findViewById(R.id.circularSeekBar1); seekbar1 = findViewById(R.id.circularSeekBar2); loading = findViewById(R.id.loading); vbview = findViewById(R.id.volumeBrightnessContainer); menuIcon = findViewById(R.id.menuIcon); screenshortButton = findViewById(R.id.exo_screenshort); controlAnimationView = findViewById(R.id.controlAnimationView); aspectratiobutton1 = findViewById(R.id.aspectratiobutton1); aspectratiolayout = findViewById(R.id.main_media_frame); swapduration = findViewById(R.id.durationtime); swapupdatevalue = findViewById(R.id.swappoints); speed = findViewById(R.id.speedbutton); swaptimerrootview = findViewById(R.id.timerUpdaterootview); backgroundplaybutton = findViewById(R.id.backgroundplay); overLayToturial = findViewById(R.id.overlayToturial); overLayToturialTitle = findViewById(R.id.titleToturial); titleprogress = findViewById(R.id.titleprogress); //menu icons iconAnimations = findViewById(R.id.iconAnimations); featuresmenu = findViewById(R.id.featuresmenu); featuresmenu.setZ(1); playbackSpeedText = findViewById(R.id.playbackSpeedText); exo_equalizer = findViewById(R.id.exo_equalizer); playasaudioImage = findViewById(R.id.playasaudioImage); playasaudioText = findViewById(R.id.playasaudioText); muteplayerbutton = findViewById(R.id.muteplayerbutton); mutePlayerImage = findViewById(R.id.mutePlayerImage); mutePlayerText = findViewById(R.id.mutePlayerText); repeatPlayerImage = findViewById(R.id.repeatPlayerImage); repeatPlayerText = findViewById(R.id.repeatPlayerText); lockLayout = findViewById(R.id.lockLayout); lockicon = findViewById(R.id.lockicon); exo_screenlock = findViewById(R.id.exo_screenlock); repeatmenubutton = findViewById(R.id.repeatmenubutton); popupbutton = findViewById(R.id.popupbutton); //toolbar backarrow = findViewById(R.id.backarrow); titleSong = findViewById(R.id.titleSong); scrollingwidgetview = findViewById(R.id.floatingviewscontainer); } private MediaSource buildMediaSource(Uri uri) { String userAgent = Util.getUserAgent(this, getApplicationContext().getApplicationInfo().packageName); DefaultHttpDataSourceFactory httpDataSourceFactory = new DefaultHttpDataSourceFactory(userAgent, null, DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS, DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS, true); DefaultDataSourceFactory dataSourceFactory = new DefaultDataSourceFactory(VideoPlayer.this, null, httpDataSourceFactory); TextUtils.isEmpty(null); int type = Util.inferContentType(uri); switch (type) { case C.TYPE_SS: return new SsMediaSource.Factory(dataSourceFactory).createMediaSource(uri); case C.TYPE_DASH: return new DashMediaSource.Factory(dataSourceFactory).createMediaSource(uri); case C.TYPE_HLS: return new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(uri); case C.TYPE_OTHER: return new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(uri); default: { throw new IllegalStateException("Unsupported type: " + type); } } } public void showAndAnimateControl(final int drawableId, final boolean goneOnEnd) { if (controlViewAnimator != null && controlViewAnimator.isRunning()) { controlViewAnimator.end(); } if (drawableId == -1) { if (controlAnimationView.getVisibility() == View.VISIBLE) { controlViewAnimator = ObjectAnimator.ofPropertyValuesHolder(controlAnimationView, PropertyValuesHolder.ofFloat(View.ALPHA, 1f, 0f), PropertyValuesHolder.ofFloat(View.SCALE_X, 1.4f, 1f), PropertyValuesHolder.ofFloat(View.SCALE_Y, 1.4f, 1f) ).setDuration(DEFAULT_CONTROLS_DURATION); controlViewAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { controlAnimationView.setVisibility(View.GONE); } }); controlViewAnimator.start(); } return; } float scaleFrom = goneOnEnd ? 1f : 1f, scaleTo = goneOnEnd ? 1.8f : 1.4f; float alphaFrom = goneOnEnd ? 1f : 0f, alphaTo = goneOnEnd ? 0f : 1f; controlViewAnimator = ObjectAnimator.ofPropertyValuesHolder(controlAnimationView, PropertyValuesHolder.ofFloat(View.ALPHA, alphaFrom, alphaTo), PropertyValuesHolder.ofFloat(View.SCALE_X, scaleFrom, scaleTo), PropertyValuesHolder.ofFloat(View.SCALE_Y, scaleFrom, scaleTo) ); controlViewAnimator.setDuration(goneOnEnd ? 1000 : 500); controlViewAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { if (goneOnEnd) controlAnimationView.setVisibility(View.GONE); else controlAnimationView.setVisibility(View.VISIBLE); } }); controlAnimationView.setVisibility(View.VISIBLE); controlAnimationView.setImageDrawable(ContextCompat.getDrawable(VideoPlayer.this, drawableId)); controlViewAnimator.start(); } @Override protected void onStart() { super.onStart(); EventBus.getDefault().register(this); } @Override protected void onResume() { super.onResume(); preferences.registerOnSharedPreferenceChangeListener(preferenceslistener); servicerepeatmode = getIntent().getIntExtra("repeatmode", 0); Log.d("lifecycle", "Resume pressed"); if (checkServiceRunning(BackgroundPlayService.class)) { stopService(new Intent(VideoPlayer.this, BackgroundPlayService.class)); tinyDB.putBoolean("BackgroundPlaySetting", false); } if (servicebackgroundplaystate) { if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlayWhenReady(true); } } else { if (activityplayerisplaying) mExoPlayerView.getPlayer().setPlayWhenReady(true); } if (servicebackgroundplaystate || getIntent().getBooleanExtra("ispopup", false)) { if (!getIntent().getBooleanExtra("ispopup", false)) { playasaudioImage.setImageResource(R.drawable.ic_play_as_audio_selected); playasaudioText.setTextColor(getResources().getColor(R.color.orangeColor)); } overLayToturial.setVisibility(View.GONE); Log.d("servicerepeatmode", "" + servicerepeatmode); if (servicerepeatmode == 1) { mExoPlayerView.getPlayer().setRepeatMode(servicerepeatmode); // repeatcontroll.setImageResource(R.drawable.ic_repeat_selected); repeatPlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); repeatPlayerImage.setImageResource(R.drawable.ic_repeat_selected); } else { // repeatcontroll.setImageResource(R.drawable.repeat_off); repeatPlayerText.setTextColor(getResources().getColor(R.color.white)); repeatPlayerImage.setImageResource(R.drawable.ic_repeat_ic); } } } @Override protected void onPause() { super.onPause(); Log.d("lifecycle", "pause pressed"); if (!ispopupenable && servicebackgroundplaystate) { if (!checkServiceRunning(BackgroundPlayService.class)) { startVideoBackgroundService(); } } if (mExoPlayerView.getPlayer() != null) { if (!ispopupenable) { if (activityplayerisplaying) { mExoPlayerView.getPlayer().setPlayWhenReady(false); activityplayerisplaying = true; } else { activityplayerisplaying = false; } } } PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); boolean isScreenOn = false; if (powerManager != null) { isScreenOn = powerManager.isInteractive(); } if (!isScreenOn) { mExoPlayerView.getPlayer().setPlayWhenReady(false); // The screen has been locked // do stuff... } if (featuresmenu.getVisibility() == View.VISIBLE) { featuresmenu.setVisibility(View.GONE); } if (tinyDB.getBoolean("AspectRatioSetting")) { tinyDB.putInt("AspectRatioMode", mExoPlayerView.getResizeMode()); } } public boolean checkServiceRunning(Class<?> serviceClass) { ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); if (manager != null) { for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { if (serviceClass.getName().equals(service.service.getClassName())) { return true; } } } return false; } @Override protected void onStop() { super.onStop(); EventBus.getDefault().unregister(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (isInPictureInPictureMode()) { if (activityplayerisplaying) if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlayWhenReady(true); } } else { if (ispopupenable) { if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().setPlayWhenReady(false); } ispopupenable = false; } } } } public int getsizeoffile(String url) { int file_size = Integer.parseInt(String.valueOf(new File(url).length() / 1024)); return file_size; } public void songcheck() { if (playlistmode) { songdetail = new song_detail_table(); if (mExoPlayerView.getPlayer() != null) { songdetail = songdatabase.getDatabase(getApplicationContext()).songdao().get(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); if (songdetail == null) { song_detail_table song_detail = new song_detail_table(); song_detail.setSong_url(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex())); song_detail.setSong_duration(mExoPlayerView.getPlayer().getDuration()); song_detail.setSong_played_duration(mExoPlayerView.getPlayer().getCurrentPosition()); song_detail.setSong_size(getsizeoffile(playlist.get(mExoPlayerView.getPlayer().getCurrentWindowIndex()))); songdatabase.getDatabase(getApplicationContext()).songdao().insert(song_detail); } else { songdatabase.getDatabase(getApplicationContext()).songdao().update(songdetail.getSong_id(), mExoPlayerView.getPlayer().getCurrentPosition()); } } } } @Override protected void onDestroy() { super.onDestroy(); songcheck(); if (mExoPlayerView.getPlayer() != null) { mExoPlayerView.getPlayer().release(); mExoPlayerView.setPlayer(null); } preferences.edit().clear().apply(); preferences.unregisterOnSharedPreferenceChangeListener(preferenceslistener); unregisterReceiver(lockScreenReceiver); tinyDB.putFloat("playerspeed", 1f); cancelTimer(); } @Override public void onCreate() { } @Override public void onInterstitialAdClose() { super.onBackPressed(); } @Override public void onInterstitialAdLoaded() { } @Override public void onInterstitialAdFailed() { } public class MyGestureListener extends GestureDetector.SimpleOnGestureListener implements View.OnTouchListener { private static final int MOVEMENT_THRESHOLD = 40; boolean isMoving = false, ishoriMoving = false; boolean isVolumeGestureEnabled = true; @Override public boolean onDown(MotionEvent event) { if (mExoPlayerView.getPlayer() != null) { position = mExoPlayerView.getPlayer().getCurrentPosition(); if (mExoPlayerFullscreen) { hideSystemUI(); } else { showSystemUi(); } } featuresmenu.setVisibility(View.GONE); menuIcon.setImageResource(R.drawable.ic_side_bar); return super.onDown(event); } @Override public boolean onSingleTapConfirmed(MotionEvent e) { vbview.setVisibility(View.GONE); return true; } @Override public void onLongPress(MotionEvent e) { vbview.setVisibility(View.GONE); } @Override public boolean onDoubleTap(MotionEvent e) { if (tinyDB.getBoolean("DoubleTapSetting")) { if (e.getRawX() > mExoPlayerView.getWidth() / 2) { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getCurrentPosition() < (mExoPlayerView.getPlayer().getDuration() - 10000)) { mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getCurrentPosition() + 10000); onFastForward(); } else { mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getDuration()); } } } else { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getCurrentPosition() > 10000) { mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getCurrentPosition() - 10000); onFastRewind(); } else { mExoPlayerView.getPlayer().seekTo(0); } } } } mExoPlayerView.hideController(); return true; } void onFastRewind() { showAndAnimateControl(R.drawable.ic_rewind, true); } void onFastForward() { showAndAnimateControl(R.drawable.ic_forward, true); } String timeConverter(long duration) { String hms; if (duration > 3599999) { hms = String.format("%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(duration), TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)), TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration))); return hms; } else { hms = String.format("%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(duration), TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)) ); } return hms; } @SuppressLint("SetTextI18n") @Override public boolean onScroll(MotionEvent initialEvent, MotionEvent movingEvent, float distanceX, float distanceY) { Log.d("distanceCalculation:", "distanceX:" + Math.abs(distanceX) + "distanceY" + Math.abs(distanceY) + "" + isMoving); final boolean insideThreshold = Math.abs(movingEvent.getY() - initialEvent.getY()) <= MOVEMENT_THRESHOLD; Log.d("count", "" + count); if (count == 0 && firsttime) { if (Math.abs(distanceX) > Math.abs(distanceY)) { count++; } else { count = 0; } firsttime = false; } if (count > 0) { if (mExoPlayerView.getPlayer() != null) { totalduration = mExoPlayerView.getPlayer().getDuration(); } ishoriMoving = true; if (distanceX > 0) { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getCurrentPosition() < 1000) { if (activityplayerisplaying) { mExoPlayerView.getPlayer().setPlayWhenReady(true); } else { mExoPlayerView.getPlayer().setPlayWhenReady(false); } swapduration.setText(timeConverter(0)); mExoPlayerView.getPlayer().seekTo(0); } else { mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getCurrentPosition() - 400); swapduration.setText(timeConverter(mExoPlayerView.getPlayer().getCurrentPosition())); } } } else { if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getCurrentPosition() >= totalduration) { swapduration.setText(timeConverter(totalduration)); } else { mExoPlayerView.getPlayer().seekTo(mExoPlayerView.getPlayer().getCurrentPosition() + 400); swapduration.setText(timeConverter(mExoPlayerView.getPlayer().getCurrentPosition())); } } } long updatingpoints; if (mExoPlayerView.getPlayer() != null) { if (mExoPlayerView.getPlayer().getCurrentPosition() < position) { updatingpoints = position - mExoPlayerView.getPlayer().getCurrentPosition(); swapupdatevalue.setText("[" + "-" + timeConverter(updatingpoints) + "]"); } else { updatingpoints = mExoPlayerView.getPlayer().getCurrentPosition() - position; swapupdatevalue.setText("[" + "+" + timeConverter(updatingpoints) + "]"); } } if (swaptimerrootview.getVisibility() != View.VISIBLE) { animateView(swaptimerrootview, SCALE_AND_ALPHA, true, 200); } swaptimerrootview.setVisibility(View.VISIBLE); mExoPlayerView.showController(); } else if (insideThreshold) { return false; } else { mExoPlayerView.hideController(); swaptimerrootview.setVisibility(View.INVISIBLE); titleprogress.setText("Volume"); isMoving = true; boolean acceptVolumeArea = initialEvent.getX() > mExoPlayerView.getWidth() / 2; boolean acceptBrightnessArea = !acceptVolumeArea; if (isVolumeGestureEnabled && acceptVolumeArea) { if (distanceY > 0) { if (seekbar.getProgress() >= maxGestureLength) { seekbar.setProgress(isfull); } else { seekbar.setProgress(seekbar.getProgress() + (int) distanceY); } } else { if (seekbar.getProgress() <= 1) { seekbar.setProgress(isempty); } else { seekbar.setProgress(seekbar.getProgress() + (int) distanceY); } } float currentProgressPercent = (float) seekbar.getProgress() / maxGestureLength;//second part is get max gesture length volumepercentText.setText("" + (int) (Math.abs(currentProgressPercent) * audioManager.getStreamMaxVolume(STREAM_MUSIC))); int currentVolume = (int) (audioManager.getStreamMaxVolume(STREAM_MUSIC) * currentProgressPercent); if (currentVolume <= 0) { mutePlayerImage.setImageResource(R.drawable.ic_mute_player_selected); mutePlayerText.setTextColor(getResources().getColor(R.color.orangeColor)); muted = true; } else { mutePlayerImage.setImageResource(R.drawable.ic_mute_player); mutePlayerText.setTextColor(getResources().getColor(R.color.white)); muted = false; } audioManager.setStreamVolume(STREAM_MUSIC, currentVolume, 0); if (vbview.getVisibility() != View.VISIBLE) { animateView(vbview, SCALE_AND_ALPHA, true, 200); } if (seekbar1.getVisibility() == View.VISIBLE) { seekbar1.setVisibility(View.GONE); brightnesspercentText.setVisibility(View.GONE); } seekbar.setVisibility(View.VISIBLE); volumepercentText.setVisibility(View.VISIBLE); tinyDB.putInt("playervolume", currentVolume); } else if (acceptBrightnessArea) { titleprogress.setText("Brightness"); if ((int) distanceY > 0) { if (seekbar1.getProgress() >= maxGestureLength) { seekbar1.setProgress(isfull); } else { seekbar1.setProgress(seekbar1.getProgress() + (int) distanceY); } } else { if (seekbar1.getProgress() <= 1) { seekbar1.setProgress(0); } else { seekbar1.setProgress(seekbar1.getProgress() + (int) distanceY); } } float currentProgressPercent = (float) seekbar1.getProgress() / maxGestureLength;//second part is get max gesture length brightnesspercentText.setText("" + (int) (Math.abs(currentProgressPercent) * 15)); WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); if (currentProgressPercent <= 0.1f) { currentProgressPercent = 0.1f; } layoutParams.screenBrightness = currentProgressPercent; getWindow().setAttributes(layoutParams); tinyDB.putFloat("playerbrightness", currentProgressPercent); tinyDB.putInt("playerBrightnessSeekbarValue", seekbar1.getProgress()); tinyDB.putString("textofbrightness", "" + (int) (Math.abs(currentProgressPercent) * 15)); if (vbview.getVisibility() != View.VISIBLE) { animateView(vbview, SCALE_AND_ALPHA, true, 200); } if (seekbar.getVisibility() == View.VISIBLE) { seekbar.setVisibility(View.GONE); volumepercentText.setVisibility(View.GONE); } seekbar1.setVisibility(View.VISIBLE); brightnesspercentText.setVisibility(View.VISIBLE); } } return true; } void onScrollEnd() { if (vbview.getVisibility() == View.VISIBLE) { animateView(vbview, SCALE_AND_ALPHA, false, 200, 200); } } @Override public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) { return true; } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouch(View v, MotionEvent event) { gestureDetector.onTouchEvent(event); if (event.getAction() == MotionEvent.ACTION_UP && isMoving) { isMoving = false; onScrollEnd(); count = 0; firsttime = true; return true; } else if (event.getAction() == MotionEvent.ACTION_UP && ishoriMoving) { ishoriMoving = false; if (swaptimerrootview.getVisibility() == View.VISIBLE) { animateView(swaptimerrootview, SCALE_AND_ALPHA, false, 200, 200); } count = 0; firsttime = true; return true; } return false; } } public class SettingsContentObserver extends ContentObserver { SettingsContentObserver(Handler handler) { super(handler); } @Override public boolean deliverSelfNotifications() { return super.deliverSelfNotifications(); } @Override public void onChange(boolean selfChange) { super.onChange(selfChange); updateStuff(); } private void updateStuff() { float currentVolume = audioManager.getStreamVolume(STREAM_MUSIC), maxVolume = audioManager.getStreamMaxVolume(STREAM_MUSIC), res = currentVolume / maxVolume; int progress = (int) (res * maxGestureLength); seekbar.setProgress(progress); seekbar.setVisibility(View.VISIBLE); if (vbview.getVisibility() != View.VISIBLE) { animateView(vbview, SCALE_AND_ALPHA, true, 200); } } } public class LockScreenReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent != null && intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { // Screen is on but not unlocked (if any locking mechanism present) } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { mExoPlayerView.getPlayer().setPlayWhenReady(false); // Screen is locked } else if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)) { // Screen is unlocked } } } } // private class backgroundwork extends AsyncTask<Void, Void, List> { // // // @Override // protected List doInBackground(Void... voids) { // // return data; // } // // @Override // protected void onPreExecute() { // super.onPreExecute(); // } // // @Override // protected void onPostExecute(List list) { // super.onPostExecute(list); // for (int i = 0; i < data.size(); i++) // Log.d("database_table_data", "" + data.get(i)); // // } // // @Override // protected void onProgressUpdate(Void... values) { // super.onProgressUpdate(values); // } // // @Override // protected void onCancelled(List list) { // super.onCancelled(list); // } // // @Override // protected void onCancelled() { // super.onCancelled(); // } // } private class OnSwipeTouchListener implements View.OnTouchListener { private final GestureDetector gestureDetector; public OnSwipeTouchListener(Context ctx) { gestureDetector = new GestureDetector(ctx, new GestureListener()); } @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } private final class GestureListener extends GestureDetector.SimpleOnGestureListener { private static final int SWIPE_THRESHOLD = 100; private static final int SWIPE_VELOCITY_THRESHOLD = 100; @Override public boolean onDown(MotionEvent e) { return true; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { boolean result = false; try { float diffY = e2.getY() - e1.getY(); float diffX = e2.getX() - e1.getX(); if (Math.abs(diffX) > Math.abs(diffY)) { if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { if (diffX > 0) { onSwipeRight(); } else { onSwipeLeft(); } result = true; } } else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { if (diffY > 0) { onSwipeBottom(); } else { onSwipeTop(); } result = true; } } catch (Exception exception) { exception.printStackTrace(); } return result; } } public void onSwipeRight() { } public void onSwipeLeft() { } public void onSwipeTop() { } public void onSwipeBottom() { } } @Override public void onBackPressed() { isFirst = true; if (getSupportFragmentManager().getBackStackEntryCount() > 0) { getSupportFragmentManager().popBackStack(); } else { if (playerlocked) { } else if (!admobUtils.showInterstitialAd()) { super.onBackPressed(); } } } private void initExitDialog() { adDialog = new Dialog(this, R.style.customDialog); adDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Objects.requireNonNull(adDialog.getWindow()).setBackgroundDrawableResource(android.R.color.transparent); adDialog.setContentView(R.layout.add_dialog); adDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); adDialog.getWindow().setDimAmount(0.5f); adDialog.setCancelable(true); adDialog.setOnKeyListener((dialog, keyCode, event) -> { if (event.getAction() != KeyEvent.ACTION_DOWN) { //onBackPressed(); return true; } if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } return false; }); //exitDialog.onBackPressed(); ImageView cross = adDialog.findViewById(R.id.cross_image); adView = adDialog.findViewById(R.id.banner_ad_view); cross.setOnClickListener(v -> { adDialog.dismiss(); }); admobUtils.loadBannerAd(adView); } private void showAdDialog() { if (adDialog != null) { if (!adDialog.isShowing()) { if (!VideoPlayer.this.isFinishing()) { try { adDialog.show(); } catch (WindowManager.BadTokenException e) { } } } } } private void hideExitDialog() { if (adDialog != null) { if (adDialog.isShowing()) { adDialog.dismiss(); } } } public boolean isConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } }
df158e750bebd9ae6bf433c44c6c100daf3fd452
67a1b5e8dc998ce3594c1c3bb2ec89c30850dee7
/GooglePlay6.0.5/app/src/main/java/android/support/v4/net/ConnectivityManagerCompat.java
d71b122ffc49c193d2211223f39eb9371a1169e7
[ "Apache-2.0" ]
permissive
matrixxun/FMTech
4a47bd0bdd8294cc59151f1bffc6210567487bac
31898556baad01d66e8d87701f2e49b0de930f30
refs/heads/master
2020-12-29T01:31:53.155377
2016-01-07T04:39:43
2016-01-07T04:39:43
49,217,400
2
0
null
2016-01-07T16:51:44
2016-01-07T16:51:44
null
UTF-8
Java
false
false
3,344
java
package android.support.v4.net; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build.VERSION; public final class ConnectivityManagerCompat { private static final ConnectivityManagerCompatImpl IMPL = new BaseConnectivityManagerCompatImpl(); static { if (Build.VERSION.SDK_INT >= 16) { IMPL = new JellyBeanConnectivityManagerCompatImpl(); return; } if (Build.VERSION.SDK_INT >= 13) { IMPL = new HoneycombMR2ConnectivityManagerCompatImpl(); return; } if (Build.VERSION.SDK_INT >= 8) { IMPL = new GingerbreadConnectivityManagerCompatImpl(); return; } } public static boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager) { return IMPL.isActiveNetworkMetered(paramConnectivityManager); } static final class BaseConnectivityManagerCompatImpl implements ConnectivityManagerCompat.ConnectivityManagerCompatImpl { public final boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager) { NetworkInfo localNetworkInfo = paramConnectivityManager.getActiveNetworkInfo(); if (localNetworkInfo == null) { return true; } switch (localNetworkInfo.getType()) { case 0: default: return true; } return false; } } static abstract interface ConnectivityManagerCompatImpl { public abstract boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager); } static final class GingerbreadConnectivityManagerCompatImpl implements ConnectivityManagerCompat.ConnectivityManagerCompatImpl { public final boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager) { NetworkInfo localNetworkInfo = paramConnectivityManager.getActiveNetworkInfo(); if (localNetworkInfo != null) {} switch (localNetworkInfo.getType()) { case 0: case 2: case 3: case 4: case 5: case 6: default: return true; } return false; } } static final class HoneycombMR2ConnectivityManagerCompatImpl implements ConnectivityManagerCompat.ConnectivityManagerCompatImpl { public final boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager) { NetworkInfo localNetworkInfo = paramConnectivityManager.getActiveNetworkInfo(); if (localNetworkInfo != null) {} switch (localNetworkInfo.getType()) { case 0: case 2: case 3: case 4: case 5: case 6: case 8: default: return true; } return false; } } static final class JellyBeanConnectivityManagerCompatImpl implements ConnectivityManagerCompat.ConnectivityManagerCompatImpl { public final boolean isActiveNetworkMetered(ConnectivityManager paramConnectivityManager) { return paramConnectivityManager.isActiveNetworkMetered(); } } } /* Location: F:\apktool\apktool\Google_Play_Store6.0.5\classes-dex2jar.jar * Qualified Name: android.support.v4.net.ConnectivityManagerCompat * JD-Core Version: 0.7.0.1 */
3e77def9081baf263517a2cd2021d042da8c29c2
04b7e13eb644959c8dff3b7bebebc5ce2846224f
/core/src/main/java/com/appscatter/iab/core/model/event/SetupResponse.java
83fe4a217ab1413c958b4babbdef6ced616ae6a5
[ "Apache-2.0", "MIT" ]
permissive
appScatter/appScatter-android-sdk
e0610926050cb6277cc8156559bfc272f9605d25
a39c6e42cd4e386f7a2a3ffbfa85f1807a1b9881
refs/heads/master
2021-08-08T03:22:58.243610
2017-11-09T12:59:49
2017-11-09T12:59:49
90,013,912
5
1
null
2017-11-09T12:59:00
2017-05-02T09:14:26
Java
UTF-8
Java
false
false
4,457
java
/* * Copyright 2012-2015 One Platform Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.appscatter.iab.core.model.event; import com.appscatter.iab.core.ASIab; import com.appscatter.iab.core.billing.BillingProvider; import com.appscatter.iab.core.model.Configuration; import com.appscatter.iab.core.model.JsonCompatible; import com.appscatter.iab.core.util.ASIabUtils; import com.appscatter.iab.utils.ASLog; import org.json.JSONException; import org.json.JSONObject; import android.app.Application; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import java.util.Arrays; import java.util.Collection; import static com.appscatter.iab.core.model.event.SetupResponse.Status.PROVIDER_CHANGED; import static com.appscatter.iab.core.model.event.SetupResponse.Status.SUCCESS; import static org.json.JSONObject.NULL; /** * Class intended to indicate that setup process has finished. * * @see SetupStartedEvent * @see ASIab#setup() */ public class SetupResponse implements JsonCompatible, ASEvent { private static final String NAME_STATUS = "status"; private static final String NAME_PROVIDER = "provider"; /** * Status of corresponding {@link SetupResponse}. */ public enum Status { /** * {@link BillingProvider} has been successfully picked. */ SUCCESS, /** * Setup resulted in a different {@link BillingProvider} being picked then one that was used * for this application previously. * <p> * Some items might be missing in user's inventory. */ PROVIDER_CHANGED, /** * Library failed to pick suitable {@link BillingProvider}. */ FAILED, } private static final Collection<Status> SUCCESSFUL = Arrays.asList(SUCCESS, PROVIDER_CHANGED); @NonNull private final Configuration configuration; @NonNull private final Status status; @Nullable private final BillingProvider billingProvider; public SetupResponse(@NonNull final Configuration configuration, @NonNull final Status status, @Nullable final BillingProvider billingProvider) { this.configuration = configuration; this.status = status; this.billingProvider = billingProvider; if (billingProvider == null && isSuccessful()) { throw new IllegalArgumentException(); } } /** * Gets configuration object which is used for the setup. * * @return Configuration object. * @see ASIab#init(Application, Configuration) */ @NonNull public Configuration getConfiguration() { return configuration; } /** * Gets status of this setup event. * * @return Status. */ @NonNull public Status getStatus() { return status; } /** * Gets billing provider that was picked during setup. * * @return BillingProvider object if setup was successful, null otherwise. * @see #isSuccessful() */ @Nullable public BillingProvider getBillingProvider() { return billingProvider; } /** * Indicates whether billing provider was successfully picked or not. * * @return True if BillingProvider was picked, false otherwise. */ public final boolean isSuccessful() { return SUCCESSFUL.contains(status); } @NonNull @Override public JSONObject toJson() { final JSONObject jsonObject = new JSONObject(); try { jsonObject.put(NAME_STATUS, status); jsonObject.put(NAME_PROVIDER, billingProvider == null ? NULL : billingProvider); } catch (JSONException exception) { ASLog.e("", exception); } return jsonObject; } @Override public String toString() { return ASIabUtils.toString(this); } }
e8b28aba0eb76a98811ab306486da9d23e9c9ee3
2899a23fc19cf515c0f34e37a549fb0f4cf2fdf9
/Lab1/src/lab1/Lab1.java
017da505a5ac183b3ae48d2514b55f294c40a048
[ "MIT" ]
permissive
kmhasan-class/summer2017java
040c82d4b593a7000721e9996e4367c055149581
f4fc117acc55ef3b1205868cf7adfebb5bf21990
refs/heads/master
2021-01-22T08:09:49.664832
2017-08-28T06:57:53
2017-08-28T06:57:53
92,603,298
2
2
null
null
null
null
UTF-8
Java
false
false
2,527
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 lab1; /** * * @author kmhasan */ public class Lab1 { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("Hello, World!"); System.out.printf("I am %d years old.\n", 38); /* Task 1: Declare two integer variables, x and y. Put the minimum of those two variables in a third variable z. Print the value of z. */ int x = 10; int y = 25; int z; if (x < y) z = x; else z = y; System.out.printf("Minimum: %d\n", z); /* Task 2: Solve the same problem using Math.min method. Math.min(x, y) should return the minimum value. */ z = Math.min(x, y); System.out.printf("Minimum: %d\n", z); /* Task 3: There are many useful methods in the Math class. You can search for "Java Math API" to look at the documentation. https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html Look up the documentation to see how you can compute, a) exponentiation b) square root Calculate and print the value of 2^10 and square root of 450. Also, print the value of x where int x = 2 ^ 10; */ double power = Math.pow(2, 10); double squareRoot = Math.sqrt(450); System.out.printf("Power: %8.0f\n", power); System.out.printf("Square Root: %f\n", squareRoot); x = 2 ^ 10; // 2 = 0010 (in binary) // 10 = 1010 (in binary) // ------------- XOR (exclusive OR) // 8 = 1000 System.out.printf("Power: %d\n", x); /* Task 4: Find the smallest element from an array */ int data[] = {5, 1, 5, 2, 3, 6, 7, 2}; /* min = 10000; i | data[i] | min ------------------ 0 | 5 | 5 1 | 1 | 1 2 | 5 | 1 3 | 2 | 1 ... data.length gives you the number of elements in the array for (int i = 0; i < data.length; i++) ... What should we really use for the initial minimum? */ } }
2c5e3d45b94849bdf268fdcdf4f8e1d850bb1a41
3acee662a0314026469188d203fd84c8170bae12
/springBoard2/src/com/spring/board/controller/BoardController.java
022991d9bee6854ac6f0bbab94fb9c71f6bf173d
[]
no_license
Kishi18/board
3e4819af38ca10ee0186ecaee28d586c27de4f93
9b0b607e3acd14c942d9849604670ef6fedd8b86
refs/heads/master
2023-03-22T12:02:03.693009
2021-03-15T06:26:42
2021-03-15T06:26:42
344,314,322
0
0
null
null
null
null
UHC
Java
false
false
8,502
java
package com.spring.board.controller; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; import javax.websocket.server.PathParam; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import com.spring.board.HomeController; import com.spring.board.service.boardService; import com.spring.board.service.impl.boardServiceImpl; import com.spring.board.vo.BoardVo; import com.spring.board.vo.PageVo; import com.spring.common.CommonUtil; @Controller public class BoardController { @Autowired boardService boardService; private static final Logger logger = LoggerFactory.getLogger(HomeController.class); @RequestMapping(value = "/board/boardList.do", method = RequestMethod.GET) public String boardList(Locale locale, Model model,PageVo pageVo) throws Exception{ List<BoardVo> boardList = new ArrayList<BoardVo>(); int totalCnt = 0; int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } boardList = boardService.SelectBoardList(pageVo); totalCnt = boardService.selectBoardCnt(); model.addAttribute("boardList", boardList); model.addAttribute("totalCnt", totalCnt); model.addAttribute("pageNo", page); return "board/boardList"; } @RequestMapping(value = "/board/{boardType}/{boardNum}/boardView.do", method = RequestMethod.GET) public String boardView(Locale locale, Model model ,@PathVariable("boardType")String boardType ,@PathVariable("boardNum")int boardNum) throws Exception{ BoardVo boardVo = new BoardVo(); PageVo pageVo = new PageVo(); int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } model.addAttribute("pageNo",pageVo); boardVo = boardService.selectBoard(boardType,boardNum); model.addAttribute("boardType", boardType); model.addAttribute("boardNum", boardNum); model.addAttribute("board", boardVo); return "board/boardView"; } @RequestMapping(value = "/board/boardWrite.do", method = RequestMethod.GET) public String boardWrite(Locale locale, Model model, BoardVo boardVo) throws Exception{ PageVo pageVo = new PageVo(); int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } model.addAttribute("pageNo",pageVo); List<BoardVo> selectBoxArray = new ArrayList<BoardVo>(); selectBoxArray = boardService.selectTypeList(boardVo); model.addAttribute("selectBoxArray",selectBoxArray); return "board/boardWrite"; } @RequestMapping(value = "/board/boardWriteAction.do", method = RequestMethod.POST) @ResponseBody public String boardWriteAction(Locale locale,BoardVo boardVo, Model model) throws Exception{ HashMap<String, String> result = new HashMap<String, String>(); CommonUtil commonUtil = new CommonUtil(); int resultCnt = boardService.boardInsert(boardVo); result.put("success", (resultCnt > 0)?"Y":"N"); String callbackMsg = commonUtil.getJsonCallBackString(" ",result); System.out.println("callbackMsg::"+callbackMsg); return callbackMsg; } // @RequestMapping(value = "/board/boardUpdate.do", method = RequestMethod.GET) // public String boardUpdate(Locale locale, Model model) throws Exception{ // // return "board/boardUpdate"; // } @RequestMapping(value="/board/{boardType}/{boardNum}/boardUpdate.do", method = RequestMethod.GET) public String boardUpdate(Locale locale, Model model ,@PathVariable("boardType")String boardType ,@PathVariable("boardNum")int boardNum) throws Exception{ BoardVo boardVo = new BoardVo(); boardVo = boardService.selectBoard(boardType,boardNum); PageVo pageVo = new PageVo(); int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } List<BoardVo> selectBoxArray = new ArrayList<BoardVo>(); selectBoxArray = boardService.selectTypeList(boardVo); model.addAttribute("selectBoxArray",selectBoxArray); model.addAttribute("pageNo",pageVo); model.addAttribute("boardType", boardType); model.addAttribute("boardNum", boardNum); model.addAttribute("board", boardVo); return "board/boardUpdate"; } @RequestMapping(value="/board/boardUpdateAction.do", method = RequestMethod.POST) @ResponseBody public String boardUpdateAction(Locale locale, BoardVo boardVo) throws Exception{ HashMap<String, String> result = new HashMap<String,String>(); CommonUtil commonUtil = new CommonUtil(); //int boardNum = boardVo.getBoardNum() ; int resultCnt = boardService.boardUpdate(boardVo); result.put("success",(resultCnt >0)?"Y":"N"); String callbackMsg = commonUtil.getJsonCallBackString(" ", result); return callbackMsg; } @RequestMapping(value="/board/boardDeleteAction.do", method = RequestMethod.POST) @ResponseBody public String boardDelete(Locale locale, int boardNum) throws Exception{ HashMap<String, String> result = new HashMap<String,String>(); CommonUtil commonUtil = new CommonUtil(); int resultCnt = boardService.boardDelete(boardNum); //삭제하는부분 result.put("success",(resultCnt >0)?"Y":"N"); String callbackMsg = commonUtil.getJsonCallBackString(" ", result); return callbackMsg; /* * @ResponseBody 추가, commonutil이용한 callbackMsg 내용전달로 삭제확인 */ } @RequestMapping(value="/board/boardCheckbox.do", method= RequestMethod.GET) //public String boardCheckbox(Locale locale, @RequestParam(value="checkArray[]") List<String> checkArray, Model model, PageVo pageVo) throws Exception { public String boardCheckbox(Locale locale, Model model, PageVo pageVo, @RequestParam("menu") List<String> checkArray) throws Exception{ List<BoardVo> boardList = new ArrayList<BoardVo>(); //List<String> checkArray = new ArrayList<String>(); System.out.println("checkArray 크기:"+checkArray.size()); int arraySize = checkArray.size(); for(int i = 0; i< arraySize; i++) { System.out.println("checkArray"+i+":"+checkArray.get(i));//checkArray.get(i) 로 각각 나눠서 배열값 뿌릴수있음 checkArray.add(checkArray.get(i)); } int totalCnt = 0; int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } boardList = boardService.selectCheckList(checkArray,pageVo); totalCnt = boardService.selectBoardCnt(); model.addAttribute("boardList", boardList); model.addAttribute("totalCnt", totalCnt); model.addAttribute("pageNo", page); return "board/boardList"; } @RequestMapping(value = "/board/boardJoin.do", method = RequestMethod.GET) public String boardJoin(Locale locale, Model model) throws Exception{ PageVo pageVo = new PageVo(); int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } model.addAttribute("pageNo",pageVo); return "board/boardJoin"; } @RequestMapping(value = "/board/boardLogin.do", method = RequestMethod.GET) public String boardLogin(Locale locale, Model model) throws Exception{ PageVo pageVo = new PageVo(); int page = 1; if(pageVo.getPageNo() == 0){ pageVo.setPageNo(page); } model.addAttribute("pageNo",pageVo); return "board/boardLogin"; } @RequestMapping(value="/board/boardCheckId.do", method= RequestMethod.POST) @ResponseBody public String boardCheckId(Locale locale, Model model) throws Exception{ HashMap<String, String> result = new HashMap<String,String>(); CommonUtil commonUtil = new CommonUtil(); //int resultCnt = boardService.; //아이디 중복 체크하는 부분 //result.put("success",(resultCnt >0)?"Y":"N"); String callbackMsg = commonUtil.getJsonCallBackString(" ", result); return callbackMsg; } }
[ "com@DESKTOP-EVFASN7" ]
com@DESKTOP-EVFASN7
952e3263d0f11d1660d05cc62563378736490c72
7ea7918f7d994aae66ea52a657d98c5a35e3ff67
/src/java/br/edu/unidavi/bsi/lucas/servlets/CadastrarAlterar.java
3226d72916c1f7198fd8759cd264bb4de2306289
[]
no_license
lucaspasqualinivota/ExemplosJSP
dc18c3bdaeb5207786dfd2e7c33342ad15a37929
d04eb3251da88e9bcbafce3d21af3fd48ce45540
refs/heads/master
2021-01-17T23:41:29.300407
2013-06-18T22:15:18
2013-06-18T22:15:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,585
java
package br.edu.unidavi.bsi.lucas.servlets; import br.edu.unidavi.bsi.lucas.exception.UnidaviBsiException; import br.edu.unidavi.bsi.lucas.jdbc.ClienteDAO; import br.edu.unidavi.bsi.lucas.model.Cliente; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "CadastrarAlterar", urlPatterns = {"/CadastrarAlterar"}) public class CadastrarAlterar extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, UnidaviBsiException { int iId = Integer.parseInt(request.getParameter("id")); String sNome = request.getParameter("nome"); String sTelefone = request.getParameter("telefone"); String sEmail = request.getParameter("email"); String sRua = request.getParameter("rua"); String sBairro = request.getParameter("bairro"); String sCidade = request.getParameter("cidade"); String sNumero = request.getParameter("numero"); String sCep = request.getParameter("cep"); String sEstado = request.getParameter("estado"); Cliente oCliente = new Cliente(iId, sNome, sEmail, "", sTelefone, true, sRua, sNumero, sBairro, sCep, sCidade, sEstado); ClienteDAO.getInstance().save(oCliente); RequestDispatcher dispatcher = request.getRequestDispatcher("/BuscaDadosLucas"); dispatcher.forward(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (UnidaviBsiException ex) { Logger.getLogger(AlterarDados.class.getName()).log(Level.SEVERE, null, ex); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (UnidaviBsiException ex) { Logger.getLogger(AlterarDados.class.getName()).log(Level.SEVERE, null, ex); } } }
[ "Administrador@Lucas" ]
Administrador@Lucas
f9f5688ff6335084c2a91dce46a62f8262ecb087
89518d06685730978c301c7c3678a38ff04072e0
/src/main/java/io/github/stekeblad/videouploader/jfxExtension/MyStage.java
b8121e3a5ff04a2275cf183e985ce8dd24a7f5ae
[ "MIT" ]
permissive
journeym/Stekeblads-Video-Uploader
7d194db56419d14153eb76d03c043d3d81d0d297
e2ae259875edea06fbc10de40007136a2c77592a
refs/heads/master
2020-09-27T03:06:59.138950
2019-12-01T16:43:51
2019-12-01T16:43:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,903
java
package io.github.stekeblad.videouploader.jfxExtension; import io.github.stekeblad.videouploader.utils.ConfigManager; import io.github.stekeblad.videouploader.utils.WindowDimensionsRestriction; import io.github.stekeblad.videouploader.utils.WindowFrame; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class MyStage extends Stage { private String myWindowPropertyName; public MyStage(String windowPropertyName) { myWindowPropertyName = windowPropertyName; } public void makeScene(Parent root, WindowDimensionsRestriction dimensions) { ConfigManager configManager = ConfigManager.INSTANCE; WindowFrame points = configManager.getWindowRectangle(myWindowPropertyName); Scene scene = new Scene(root, points.width, points.height); setScene(scene); setX(points.x); setY(points.y); setMinHeight(dimensions.minH); setMinWidth(dimensions.minW); setMaxHeight(dimensions.maxH); setMaxWidth(dimensions.maxW); } /** * calls triggerController(controller) and opens the window * * @param controller a class implementing MyControllerBase */ public void prepareControllerAndShow(Object controller) { triggerController(controller); show(); } /** * calls triggerController(controller), opens the window and wait for it to close * * @param controller a class implementing MyControllerBase */ public void prepareControllerAndShowAndWait(Object controller) { triggerController(controller); showAndWait(); } /** * Connects the onCloseRequest to the controller's onWindowClose method, set up to save window size and location on * close and calls myinit() on the controller. * If the given controller does not implement MyControllerBase then this method returns without doing anything * * @param controller a class implementing MyControllerBase */ private void triggerController(Object controller) { if (controller instanceof IWindowController) { IWindowController cont = (IWindowController) controller; setOnCloseRequest(event -> { if (cont.onWindowClose()) { // true == close && false == doNotClose WindowFrame toSave = new WindowFrame(getX(), getY(), getWidth(), getHeight()); ConfigManager.INSTANCE.setWindowRectangle(myWindowPropertyName, toSave); } else { event.consume(); } // Make sure all settings is saved on exit do not save when not needed if (myWindowPropertyName.equals(ConfigManager.WindowPropertyNames.MAIN)) { ConfigManager.INSTANCE.saveSettings(); } }); cont.myInit(); } } }
bf07623fce09d3c6ae952ec5b4110fb5cf347792
49cd7ca265f91c677523a398b542702011b87e64
/src/main/java/com/cvc/cvcteste/CvcTesteApplication.java
d5511221b284244df98324321316832d2d5acbf7
[]
no_license
varronche/cvc
29436873f78e54f9eba2a654d0e6956bd9a44ebc
11c5113e1ff7fa03873928d8ddc5e95bc59bd2bd
refs/heads/master
2022-12-21T01:20:14.900326
2020-05-07T19:59:04
2020-05-07T19:59:04
262,143,893
0
0
null
2020-10-13T21:49:23
2020-05-07T19:47:00
Java
UTF-8
Java
false
false
398
java
package com.cvc.cvcteste; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @EnableSwagger2 public class CvcTesteApplication { public static void main(String[] args) { SpringApplication.run(CvcTesteApplication.class, args); } }
cdca17c21f8d03dd92c23b31d5a1b41456bb151c
995c3431bb6c8940456ec6f88dee27d53f149790
/src/algorithms/dynamicProgramming/LongestCommonSubstring.java
d35e5b5813939cf5dd4e5304decc0a711b777d8b
[]
no_license
LeoHongyi/Leetcode-solutions
a32536cb00b881fa58db3f58a898fb6f2777d531
580bc888cad9a78af39d66db3b949d6cff8424c8
refs/heads/master
2020-08-04T20:28:53.812538
2019-10-02T04:18:02
2019-10-02T04:18:02
212,268,933
0
1
null
2019-10-02T06:20:52
2019-10-02T06:20:51
null
UTF-8
Java
false
false
988
java
package algorithms.dynamicProgramming; /** * @author Qihao He * @date 09/24/2019 * https://app.laicode.io/app/problem/176 * Assumption: s, t are not null. */ public class LongestCommonSubstring { public String longestCommon(String source, String target) { // Write your solution here int m = source.length(); int n = target.length(); int[][] matrix = new int[m + 1][n + 1]; int start = 0; int max = 0; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) { if (source.charAt(i - 1) == target.charAt(j - 1)) { matrix[i][j] = matrix[i - 1][j - 1] + 1; if (matrix[i][j] > max) { max = matrix[i][j]; start = i - max; } } else { matrix[i][j] = 0; } } } return source.substring(start, start + max); } }
1a5aa19030ff10c98ea4f5e89d82551545cc15fa
2d6eeeb6f0a48ed253f0b2c7768cd874feae8ca3
/my-new-board-master/src/main/java/com/lectopia/board/persistence/BoardMapper.java
9c3c278e11c4594edadef277469ab25b17af85c6
[]
no_license
zleonwa/myBoard
dac13be5b40652b4649f84e795da6bb36db0a7bb
e1b77b57e8243e0d467e2cb178c2d67a56536844
refs/heads/master
2020-03-27T03:12:06.722371
2018-08-23T11:50:05
2018-08-23T11:50:05
145,845,583
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
package com.lectopia.board.persistence; import java.util.List; import com.lectopia.board.domain.BoardVO; import com.lectopia.board.domain.Criteria; public interface BoardMapper { public void create(BoardVO vo) throws Exception; public BoardVO read(Integer bno) throws Exception; public void update(BoardVO vo) throws Exception; public void delete(Integer bno) throws Exception; public List<BoardVO> listAll() throws Exception; public List<BoardVO> listPage(int page) throws Exception; public List<BoardVO> listCriteria(Criteria cri) throws Exception; public int countPaging(Criteria cri) throws Exception; }
8d6a2e44f35a7fe546686a3d08bca38213e9d110
d2c481cd1a857c40405640edf787710e25e14cb5
/exam2/CalorieCounter/src/main/java/com/greenfox/repository/FoodRepo.java
d108f4067f015a55b68ce00fcbae0b00815e0f68
[]
no_license
green-fox-academy/dombo3
39ed9f4dfd3d0264113066b02060e2e2a6178ca3
aa062db1cad5b9d99b69af4e3f98b6d4ce621fbe
refs/heads/master
2021-06-22T00:02:06.826749
2017-07-10T08:09:09
2017-07-10T08:09:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package com.greenfox.repository; import com.greenfox.model.Food; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface FoodRepo extends CrudRepository<Food, Long> { }
50cb3994c8062df9f3e4be8fc602c35410cdf10f
ae788e2af389e1eb81b8e975300d57782f0c375a
/src/Boruvka.java
7d9dcdfdf4a69ef74fc05440e7b4fbcbdff66a06
[]
no_license
spate159/Kruskal_Prim_Boruvka
04c0adcf3f95ff5cbbf851cbbafb4b607249a1e2
538497a770e3b43d8b0988cb33b03eff33ca4a9e
refs/heads/master
2021-07-17T09:27:54.737306
2017-10-24T18:26:20
2017-10-24T18:26:20
108,165,780
0
0
null
null
null
null
UTF-8
Java
false
false
13,263
java
import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Objects; import java.util.Set; public class Boruvka { // private HashMap<Edge, EdgeComponents> edgesMap = new HashMap<>(); // private HashSet<Component> components = new HashSet<>(); // testing DisplayGraph dg; boolean testing = false; private ComponentGraph currentCG = new ComponentGraph(); private int maxCompID = 0; HashSet<Edge> mstEdgeList = new HashSet<Edge>(); private void init(Graph graph) { HashMap<Vertex, Component> vertexMap = new HashMap<>(); for (Vertex v : graph.getGraphVertices()) { Component component = new Component(maxCompID++); component.setExtEdges(new HashSet<>(v.getEdges())); // creating // initial // components // for each vertex vertexMap.put(v, component); currentCG.components.add(component); } for (Vertex v : graph.getGraphVertices()) { for (Edge edge : v.getEdges()) { currentCG.edgesMap.put(edge, new EdgeComponents(vertexMap.get(edge.getVertex1()), vertexMap.get(edge.getVertex2()))); } } } public int findMST(Graph graph, boolean print) { init(graph); while (currentCG.components.size() > 1) { // create an iterator Iterator<Component> iterator = currentCG.components.iterator(); // check values while (iterator.hasNext()) { Component c = iterator.next(); int minWeight = Integer.MAX_VALUE; Edge minEdge = null; for (Edge edge : c.getExtEdges()) { // System.out.println("component = " + c.getID() // + " edge in consideration " + edge); if (edge.getWeight() < minWeight) { // find the minimum edge // incident to the // vertex minWeight = edge.getWeight(); minEdge = edge; c.setMinEdge(minEdge); } } // System.err.println("component = " + c.getID() // + " minimum incident edge " + minEdge); c.addMSTEdge(minEdge); // add the min edge to component currentCG.edgesMap.get(minEdge).getOtherComponent(c) .addMSTEdge(minEdge);// add // min // edge // to // the // opposite // component currentCG.minEdgeList.add(minEdge);// no duplicate min edges // ensured set } // (new ArrayList<Edge>(currentCG.minEdgeList)) // .forEach(System.out::println); ComponentGraph newComponentGraph = findComponents(); currentCG = newComponentGraph; cleanGraph(currentCG); } if (print) { Graph graph2 = new Graph(new ArrayList<>(mstEdgeList), Graph.EDGES); System.out.println("\nBoruvka MST\n"); System.out.println(graph2); System.out.println("Total MST weight =" + totalWeight()); } return totalWeight(); } private ComponentGraph findComponents() { ComponentGraph cg = new ComponentGraph(); Iterator<Component> iterator = currentCG.components.iterator(); while (iterator.hasNext()) { Component component = iterator.next(); if (!component.isVisited()) { component.setVisited(true); // System.out.println(component.getMSTEdges().size()); dfs(component, null, cg, null);// perform dfs on the component // to find other components } } mstEdgeList.addAll(currentCG.minEdgeList);// add to the final mst // System.out.println(currentCG.minEdgeList.size()); // System.out.println("MST size = " + mstEdgeList.size()); // if (testing == true) { // Graph graph2 = new Graph(new ArrayList<>(currentCG.minEdgeList), // Graph.EDGES); // dg = new DisplayGraph(graph2, 640, 640, 1000, 64.0); // DisplayGraph.drawGraph(dg, graph2, false); // } return cg; } private void cleanGraph(ComponentGraph cg) { HashMap<EdgeComponents, Edge> uniquePair = new HashMap<>( cg.edgesMap.size()); List<Edge> removeEdge = new ArrayList<>(); for (Edge edge : cg.edgesMap.keySet()) { EdgeComponents ec = cg.edgesMap.get(edge); if (uniquePair.containsKey(ec)) { if (uniquePair.get(ec).getWeight() >= edge.getWeight()) { // cg.edgesMap.remove(uniquePair.get(ec)); remove at the end removeEdge.add(uniquePair.remove(ec)); uniquePair.put(ec, edge); } } else { uniquePair.put(ec, edge); } } for (Edge edge : removeEdge) { EdgeComponents ec = cg.edgesMap.get(edge); ec.c1.extEdges.remove(edge); ec.c2.extEdges.remove(edge); cg.edgesMap.remove(edge); } } // pass parent Component null... used for detection of cycle private void dfs(Component currentComponent, Component parentComponent, ComponentGraph newComponentGraph, Component newComponent) { for (Edge edge : currentComponent.getMSTEdges()) { Component oppositeComponent = getEdgeComponent(edge) .getOtherComponent(currentComponent); // System.out.println("min edge " + edge + " OtherComponent " // + otherComponent.getID()); if (newComponent == null) { newComponent = new Component(maxCompID++); } if (!oppositeComponent.isVisited) { // System.out.println("comp in consideration to other " + // currentComponent.ID // + " " + oppositeComponent.ID + " \"visiting edge\" " // + edge); oppositeComponent.isVisited = true; dfs(oppositeComponent, currentComponent, newComponentGraph, newComponent); setNewComponents(newComponent, newComponentGraph, currentComponent); } else {// other component is visited and it could be a cycle. if (parentComponent == null) { // first round visited vertex // currentCG.minEdgeList.remove(edge); } else if (!parentComponent.equals(oppositeComponent) ) {// if // its // not // the // same edge // from // the // parent // then a // cycle // edgesMap.remove(edge); // removing just this edge as // all // other are of same weight currentCG.minEdgeList.remove(edge); System.err.println("cycle detected for edge " + edge); } // set the new external edges of the new component setNewComponents(newComponent, newComponentGraph, currentComponent); } } } public void setNewComponents(Component newComponent, ComponentGraph newComponentGraph, Component currentComponent) { // if external edges have not been updated before from this // component if (!newComponent.internalComponents.contains(currentComponent)) { Iterator<Edge> iterator = currentComponent.getExtEdges().iterator();// check // all // the // external // edges // of // this // component // to // put // it // in // the // new // component while (iterator.hasNext()) { Edge extEdge = iterator.next(); if (!currentComponent.getMSTEdges().contains(extEdge)) { // if external edge is not an internal one then EdgeComponents edgeComponent = newComponentGraph.edgesMap .get(extEdge);// if component exist then check that // if the edge is an internal edge // of new component if (edgeComponent == null) { edgeComponent = new EdgeComponents(); } else { /* * System.out.println("c= " + currentComponent.ID + * " edge hit " + extEdge + " connected to " + * edgeComponent.getOneComponent().getID()); */ if (edgeComponent.hasAComponent(newComponent)) {// internal // edge // System.err.println( // "Internal edge not external! " + extEdge); iterator.remove(); newComponentGraph.edgesMap.remove(extEdge); newComponent.getExtEdges().remove(extEdge); continue; } } edgeComponent.setUnsetComponents(newComponent);// set one of // the edge // component // to new // component // System.out.println(" Adding ext edge " + extEdge // + " from source " + currentComponent.getID() // + " new component " // + newComponent.getID()); newComponent.getExtEdges().add(extEdge);// add the external // edge to new // component newComponent.internalComponents.add(currentComponent);// add // this // sub // component // to // new // component newComponentGraph.edgesMap.put(extEdge, edgeComponent);// put // the // edge // in // new // graph // edge // set newComponentGraph.components.add(newComponent);// put the // component // in the // new graph // component } } } } public int totalWeight() { int weight = 0; for (Edge edge : mstEdgeList) { weight = weight + edge.getWeight(); } return weight; } /** * * @param c * component * @return min weight edge */ private Edge findMinEdge(Component c) { Edge minEdge = null; for (Edge edge : c.extEdges) { int minWeight = Integer.MAX_VALUE; if (edge.getWeight() < minWeight) { minWeight = edge.getWeight(); minEdge = edge; } } return minEdge; } private EdgeComponents getEdgeComponent(Edge edge) { return currentCG.edgesMap.get(edge); } private class Component { private int ID; private Edge minEdge; private Set<Edge> extEdges; private boolean isVisited; private Set<Edge> mstEdges; private HashSet<Component> internalComponents; public Set<Edge> getMSTEdges() { return mstEdges; } public void addMSTEdge(Edge edge) { mstEdges.add(edge); } public Set<Edge> getExtEdges() { if (extEdges == null) { extEdges = new HashSet<>(); } return extEdges; } public void setExtEdges(Set<Edge> extEdges) { this.extEdges = extEdges; } public Component(int iD) {// Constructor super(); ID = iD; isVisited = false; mstEdges = new HashSet<>(); internalComponents = new HashSet<>(); } public int getID() { return ID; } public void setID(int iD) { ID = iD; } public Edge getMinEdge() { return minEdge; } public void setMinEdge(Edge minEdge) { this.minEdge = minEdge; } @Override public int hashCode() { return ID; } @Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof Component)) { return false; } Component comp = (Component) obj; return Objects.equals(ID, comp.ID); } public boolean isVisited() { return isVisited; } public void setVisited(boolean isVisited) { this.isVisited = isVisited; } } private class EdgeComponents { private Component c1; private Component c2; public EdgeComponents(Component c1, Component c2) { super(); this.c1 = c1; this.c2 = c2; } public EdgeComponents() { // TODO Auto-generated constructor stub } public void setUnsetComponents(Component c) { if (this.c1 == null) { this.c1 = c; } else if (this.c2 == null) { this.c2 = c; } } public int totalSetComponents() { // testing int total = 0; if (this.c1 == null) { total++; } if (this.c2 == null) { total++; } return total; } public void setGivenComponent(Component oldComponent, Component newComponent) { if (this.c1.equals(oldComponent)) { this.c1 = newComponent; } else if (this.c2.equals(oldComponent)) { this.c2 = newComponent; } } public void setComponents(Component c1, Component c2) { this.c1 = c1; this.c2 = c2; } public Component getOneComponent() { return c1; } public Component getOtherComponent(Component oneComponent) { if (!(oneComponent.equals(c1) || oneComponent.equals(c2))) return null; return (oneComponent.equals(c1)) ? c2 : c1; } public boolean hasAComponent(Component c) { if (c1 != null && c1.equals(c)) { return true; } else if (c2 != null && c2.equals(c)) { return true; } return false; } @Override public int hashCode() { int c1; int c2; if (this.c1.hashCode() < this.c2.hashCode()) { c1 = this.c1.hashCode(); c2 = this.c2.hashCode(); } else { c2 = this.c1.hashCode(); c1 = this.c2.hashCode(); } return (((c1 + c2) * (c1 + c2 + 1)) / 2) + c2; } @Override public boolean equals(Object obj) { if (obj == this) return true; if (!(obj instanceof EdgeComponents)) { return false; } EdgeComponents ec = (EdgeComponents) obj; return (Objects.equals(c1, ec.c1) && Objects.equals(c2, ec.c2)) || (Objects.equals(c1, ec.c2) && Objects.equals(c2, ec.c1)); } } public class ComponentGraph { private HashMap<Edge, EdgeComponents> edgesMap; private HashSet<Component> components; HashSet<Edge> minEdgeList; public ComponentGraph() { edgesMap = new HashMap<>(); components = new HashSet<>(); minEdgeList = new HashSet<Edge>(); } } }
7fa764eaf5ad346be590afed56db0d97990633b5
a719f1cec3dc2b538326ba48f52624b37f43e01d
/bdd/src/main/java/stepdef/MyStepdefs.java
4c1ff2ed5bcb7371901e809316ca3044f247488a
[]
no_license
m-x-k/gradle-cucumber-java-template
63e84e7989f2d8d332e277e497d5d2d325eb65f7
f12fd0936d0bc3c5e25ebce6332674f5419a536a
refs/heads/master
2020-12-28T22:34:26.318701
2016-05-18T14:57:07
2016-05-18T14:57:07
58,959,249
0
2
null
null
null
null
UTF-8
Java
false
false
970
java
package stepdef; import com.google.inject.Inject; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import initiate.State; import org.openqa.selenium.support.PageFactory; import pageobjects.HomePage; import static org.junit.Assert.assertEquals; public class MyStepdefs { private final String START = "http://localhost:8080/start"; private State state; private HomePage homePage; @Inject public MyStepdefs(State state) { this.state = state; this.homePage = new HomePage(state.webDriver); PageFactory.initElements(state.webDriver, homePage); } @Given("^User goes to the home page$") public void openHomePage() throws Throwable { homePage.navigateTo(START); } @Then("^The message (.*) is displayed$") public void theMessageIsDisplayed(String expected) throws Throwable { String actual = homePage.result.getText(); assertEquals(actual, expected); } }
5286f3c0d1459509595c1fef9a067098d6564546
748f26c478fee8ce9d8e3e6c2d397a2093bbe3cb
/openex-player/src/main/java/io/openex/player/PlayerApplication.java
a0f5ee00fbb41fe3243ef8649d4bbac232bb915a
[ "Apache-2.0" ]
permissive
tracid56/openex
4e51befec99c30e764ec65ba03709602cbeccbf2
fa9f35fd3f5ceb4630ffc1d02ea827c9dde43863
refs/heads/master
2023-04-09T05:38:37.883385
2020-11-17T13:57:10
2020-11-17T13:57:10
317,280,084
0
0
Apache-2.0
2021-03-29T09:52:19
2020-11-30T16:20:57
null
UTF-8
Java
false
false
1,059
java
package io.openex.player; import io.openex.player.scheduler.InjectsHandlingJob; import org.quartz.JobBuilder; import org.quartz.JobDetail; import org.quartz.Trigger; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import static org.quartz.CronScheduleBuilder.cronSchedule; import static org.quartz.TriggerBuilder.newTrigger; @SpringBootApplication public class PlayerApplication { public static void main(String[] args) { SpringApplication.run(PlayerApplication.class, args); } @Bean public JobDetail injectsJobDetail() { return JobBuilder.newJob(InjectsHandlingJob.class).storeDurably().withIdentity("injectsJob").build(); } @Bean public Trigger injectsJobTrigger() { return newTrigger() .forJob(injectsJobDetail()) .withIdentity("injectsTrigger") .withSchedule(cronSchedule("0 0/1 * * * ?")) .build(); } }
c59e9fcefdcd8efc95674505ac3a3572ba8cfa5b
344a8a5e2eea38caabf99b443038c8a791fab310
/app/src/androidTest/java/com/ller/team_project/ExampleInstrumentedTest.java
2fbc15db115cd4fc31d08677e9653454a116de7d
[]
no_license
LLerFish/Android-game
ad7f2aa4e017e3aea580d6d86d70abf795177afd
f2ef5a4ae8d3ecc069f33d2be3b7f442f0b10643
refs/heads/master
2020-04-09T13:38:56.277816
2018-12-06T17:13:20
2018-12-06T17:13:20
160,377,255
0
0
null
2018-12-06T17:13:21
2018-12-04T15:18:36
Java
UTF-8
Java
false
false
743
java
package com.ller.team_project; 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.ller.team_project", appContext.getPackageName()); } }
9005f3759c5dc6fe1a781f16f037a0507826eff8
36f2e8e8790f465753365921081db97f0ca7f786
/src/java/co/edu/udea/arqsw/aerolinea/data/dao/ClaseDaoLocal.java
0c440047dc73cf95847920a941967c3e9431480c
[]
no_license
mgochoa/AirUsFaces
525efc7f0f207bd6089f8ba74630c586bbae53d8
25f3aef609e9e6cbacfcc7198e24faa32b1f45a8
refs/heads/master
2021-01-16T21:17:18.643576
2015-05-31T02:00:18
2015-05-31T02:00:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
408
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 co.edu.udea.arqsw.aerolinea.data.dao; import co.edu.udea.arqsw.aerolinea.data.dto.Clase; import javax.ejb.Local; /** * * @author dx */ @Local public interface ClaseDaoLocal { Clase obtener(Integer id); }
1f2a536669a537f3f61b01a7dc69e70d0bfe1ebb
4168b1d8b44ea61cab5144ce2c0968ac7fa08149
/src/main/java/com/qiangdong/reader/config/ElasticSearchConfig.java
4c2b62a3655bf935c9995527e83796481f692859
[ "Apache-2.0" ]
permissive
Vivian-miao/qiangdongserver
2a841f0a964c92cbfe73d4eb98f0c2888e542fff
0c16fec01b369d5491b8239860f291732db38f2e
refs/heads/master
2023-04-25T07:21:57.354176
2021-05-20T04:16:51
2021-05-20T04:16:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,336
java
package com.qiangdong.reader.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; @Configuration @ConfigurationProperties("es") public class ElasticSearchConfig { private boolean indexNovel = false; private boolean indexComic = false; private boolean indexUserActivity = false; private boolean indexUser = false; private boolean indexTopic = false; public boolean isIndexNovel() { return indexNovel; } public void setIndexNovel(boolean indexNovel) { this.indexNovel = indexNovel; } public boolean isIndexComic() { return indexComic; } public void setIndexComic(boolean indexComic) { this.indexComic = indexComic; } public boolean isIndexUserActivity() { return indexUserActivity; } public void setIndexUserActivity(boolean indexUserActivity) { this.indexUserActivity = indexUserActivity; } public boolean isIndexUser() { return indexUser; } public void setIndexUser(boolean indexUser) { this.indexUser = indexUser; } public boolean isIndexTopic() { return indexTopic; } public void setIndexTopic(boolean indexTopic) { this.indexTopic = indexTopic; } }
bb4fe813ec77423ad402b0135818973450ae9ca9
fc91966d570c4b601463dd521fbf277bcca444d8
/build/app/src/main/java/com/example/android/chaoshi/application/MyApplication.java
dfe1c4ae433b73c70038447c03c43e6f21bb7e74
[]
no_license
MrCodeSniper/DrugStore
33b2e29481af140af76422698cbe8602ab405362
c002d9d3e20b90c4adcebf6bad284d954c5b5660
refs/heads/master
2021-01-12T13:28:15.939941
2016-10-05T08:04:21
2016-10-05T08:04:21
69,838,325
1
0
null
null
null
null
UTF-8
Java
false
false
2,210
java
package com.example.android.chaoshi.application; import android.app.Application; import android.content.Context; import android.content.Intent; import com.example.android.chaoshi.bean.user.User_New; import com.example.android.chaoshi.util.UserLocalData; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import cn.bmob.v3.Bmob; /** * Created by Android on 2016/9/7. */ public class MyApplication extends Application { public static final int STATE_LOGOUT = 0; public static final int STATE_LOGIN = 1; public static Context context; public static int curState = STATE_LOGOUT; public static String username; public static String pwd; private Context applicationcontext; private User_New user; private static MyApplication mInstance; public static MyApplication getInstance(){ return mInstance; } @Override public void onCreate() { super.onCreate(); applicationcontext = getApplicationContext(); ImageLoaderConfiguration configuration = ImageLoaderConfiguration .createDefault(this); ImageLoader.getInstance().init(configuration); Bmob.initialize(this, "3a4be38c7456063eb274888149dd7c60"); context = getApplicationContext(); } private void initUser(){ this.user = UserLocalData.getUser(this); } public User_New getUser(){ return user; } public void putUser(User_New user,String token){ this.user = user; UserLocalData.putUser(this,user); UserLocalData.putToken(this,token); } public void clearUser(){ this.user =null; UserLocalData.clearUser(this); UserLocalData.clearToken(this); } public String getToken(){ return UserLocalData.getToken(this); } private Intent intent; public void putIntent(Intent intent){ this.intent = intent; } public Intent getIntent() { return this.intent; } public void jumpToTargetActivity(Context context){ context.startActivity(intent); this.intent =null; } }
544929a4c9aac81e6814fb1a3fed87e6bf12db64
15a12ca1ee566588171250df492e70ee2f2a2020
/src/main/java/com/itwanli/dao/AdminRepository.java
f4bf4a728ae87290b9287bff0fb8ff18ee2bdaf5
[ "Apache-2.0" ]
permissive
1752641153/carport
32c778546f9bd9fb993e87477ecde02d27e01e79
24fb221c403a0163f0ff41efe9257674be965c2c
refs/heads/master
2022-07-17T09:06:37.876867
2020-05-24T09:26:50
2020-05-24T09:26:50
266,499,578
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package com.itwanli.dao; import com.itwanli.entity.Admin; import org.springframework.data.jpa.repository.JpaRepository; public interface AdminRepository extends JpaRepository<Admin,Long> { Admin findByUsernameAndPassword(String username,String password); }
554030c679f9b5332583be1003d1a5713dfbdd59
995f73d30450a6dce6bc7145d89344b4ad6e0622
/P40_HarmonyOS_2.0.0_Developer_Beta1/src/main/java/com/android/internal/util/$$Lambda$JwOUSWW2Jzu15y4Kn4JuPh8tWM.java
383105721e97ea4b15940d5c96a87f78a5d67594
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package com.android.internal.util; import android.content.ComponentName; import java.util.function.Predicate; /* renamed from: com.android.internal.util.-$$Lambda$JwOUSWW2-Jzu15y4Kn4JuPh8tWM reason: invalid class name */ /* compiled from: lambda */ public final /* synthetic */ class $$Lambda$JwOUSWW2Jzu15y4Kn4JuPh8tWM implements Predicate { public static final /* synthetic */ $$Lambda$JwOUSWW2Jzu15y4Kn4JuPh8tWM INSTANCE = new $$Lambda$JwOUSWW2Jzu15y4Kn4JuPh8tWM(); private /* synthetic */ $$Lambda$JwOUSWW2Jzu15y4Kn4JuPh8tWM() { } @Override // java.util.function.Predicate public final boolean test(Object obj) { return DumpUtils.isNonPlatformPackage((ComponentName.WithComponentName) obj); } }
a49731b2303c2ded66f1b296eefefdf641b3d95e
4ad30c810586dbcfb8669f8fa4d03e7fbdcdeadc
/app/src/p_module/p_module_a_common/a_debug/java/com/georgebindragon/pinsprojectdemo/debug/MyDebug.java
d9facf2b54c85ae6ff1743dac4542a7a11c78c08
[]
no_license
GeorgeBin/Demo_PinsProject
340d96fa70a147044f8ba8f62edbcaa997c88ff1
c729cc9d38410b88dd38d65d7c9429ef2f204b07
refs/heads/master
2022-04-27T12:42:21.706586
2020-04-28T03:56:27
2020-04-28T03:56:27
259,524,882
0
0
null
null
null
null
UTF-8
Java
false
false
605
java
package com.georgebindragon.pinsprojectdemo.debug; import android.util.Log; /** * 创建人:George * * 描述: * * 修改人: * 修改时间: * 修改备注: */ public class MyDebug { private static final String TAG = "MyDebug-->"; private static final MyDebug ourInstance = new MyDebug(); public static MyDebug getInstance() { return ourInstance; } private MyDebug() { } public void someDebugCode() { Log.i(TAG, "someDebugCode-->只可以在debug模式下被调用,不会打包到release版本中。" + "如果没有注释掉,会在编译过程报错!"); } }
c40b52e8abfc9904cf36ac2102c9c3e2949c228b
884ec330e31fcb9ff247a10427eb4daf100259fd
/src/main/java/io/pivotal/pal/tracker/JdbcTimeEntryRepository.java
0246f9db90aeec25333517a12501166cfed77410
[]
no_license
alexbasson/pal-tracker
36a9aeb9022dc0e7aeb05b33babde9182618bf85
41075d30d1e503c9c998214491191a1bc85b9238
refs/heads/master
2021-01-07T14:12:49.474572
2020-02-21T19:22:07
2020-02-21T19:22:07
241,720,423
0
0
null
null
null
null
UTF-8
Java
false
false
3,182
java
package io.pivotal.pal.tracker; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import javax.sql.DataSource; import java.sql.Date; import java.sql.PreparedStatement; import java.util.List; import static java.sql.Statement.RETURN_GENERATED_KEYS; public class JdbcTimeEntryRepository implements TimeEntryRepository { private final JdbcTemplate jdbcTemplate; private final RowMapper<TimeEntry> mapper = (rs, rowNum) -> new TimeEntry( rs.getLong("id"), rs.getLong("project_id"), rs.getLong("user_id"), rs.getDate("date").toLocalDate(), rs.getInt("hours") ); private final ResultSetExtractor<TimeEntry> extractor = (rs) -> rs.next() ? mapper.mapRow(rs, 1) : null; private static final String CREATE_TIME_ENTRY_SQL = "INSERT INTO time_entries (project_id, user_id, date, hours) VALUES (?, ?, ?, ?)"; private static final String FIND_TIME_ENTRY_SQL = "SELECT id, project_id, user_id, date, hours FROM time_entries WHERE id = ?"; private static final String LIST_TIME_ENTRIES_SQL = "SELECT id, project_id, user_id, date, hours FROM time_entries"; private static final String UPDATE_TIME_ENTRY_SQL = "UPDATE time_entries SET project_id = ?, user_id = ?, date = ?, hours = ? WHERE id = ?"; private static final String DELETE_TIME_ENTRY_SQL = "DELETE FROM time_entries WHERE id = ?"; public JdbcTimeEntryRepository(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } @Override public TimeEntry create(TimeEntry timeEntry) { KeyHolder generatedKeyHolder = new GeneratedKeyHolder(); jdbcTemplate.update(connection -> { PreparedStatement statement = connection.prepareStatement(CREATE_TIME_ENTRY_SQL, RETURN_GENERATED_KEYS); statement.setLong(1, timeEntry.getProjectId()); statement.setLong(2, timeEntry.getUserId()); statement.setDate(3, Date.valueOf(timeEntry.getDate())); statement.setInt(4, timeEntry.getHours()); return statement; }, generatedKeyHolder); return find(generatedKeyHolder.getKey().longValue()); } @Override public TimeEntry find(long id) { return jdbcTemplate.query( FIND_TIME_ENTRY_SQL, new Object[]{id}, extractor ); } @Override public List<TimeEntry> list() { return jdbcTemplate.query(LIST_TIME_ENTRIES_SQL, mapper); } @Override public TimeEntry update(long id, TimeEntry timeEntry) { jdbcTemplate.update(UPDATE_TIME_ENTRY_SQL, timeEntry.getProjectId(), timeEntry.getUserId(), Date.valueOf(timeEntry.getDate()), timeEntry.getHours(), id ); return find(id); } @Override public void delete(long id) { jdbcTemplate.update(DELETE_TIME_ENTRY_SQL, id); } }
104afed0c8f712be8ba838a4226696a5f0ed2179
3244d8b3fc307fea52895649062f6ddfe524fe2a
/user-test2/src/main/java/pmqin/com/aopFramework/BeanFactory.java
e18b9567a9daf1085bea820888b4038fa9462a76
[]
no_license
pmqin/user-parent
c74471686f1d8e9da533180e5d1c9854004d14d0
65950107678ed61d2b757d71298187586ba665af
refs/heads/master
2020-12-02T09:55:56.817013
2017-07-09T04:52:35
2017-07-09T04:52:35
96,661,776
0
0
null
null
null
null
UTF-8
Java
false
false
2,595
java
/** * */ package pmqin.com.aopFramework; import java.io.*; import java.util.*; /** * @author : pmqin * @date : 2016年4月30日 下午10:10:54 * @version 1.0 * @parameter */ /** * @author pmqin * */ public class BeanFactory { Properties props = new Properties(); // public BeanFactory(String fileName) { // try { // InputStream inputStream = new FileInputStream(fileName); // props.load(inputStream); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } public BeanFactory(String fileName) { try { InputStream ips = BeanFactory.class.getClassLoader().getResourceAsStream(fileName); //InputStream inputStream = new FileInputStream(fileName); props.load(ips); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public BeanFactory(File file) { try { InputStream inputStream = new FileInputStream(file); props.load(inputStream); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public BeanFactory(InputStream ips) { try { props.load(ips); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Object getBean(String name) { Object bean = null; try { String strName=props.getProperty(name); System.out.println("BeanFactory得到了这个Key的完全限定名称:"+strName); Class<?> class1 = Class.forName(strName); bean = class1.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(bean instanceof ProxyBeanFactory){ Object proxy = null; ProxyBeanFactory proxyFactoryBean = (ProxyBeanFactory)bean; try { Advice advice = (Advice)Class.forName(props.getProperty(name + ".advice")).newInstance(); Object target = Class.forName(props.getProperty(name + ".target")).newInstance(); proxyFactoryBean.setAdvice(advice); proxyFactoryBean.setTarget(target); proxy = proxyFactoryBean.getProxy(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return proxy; } return bean; } public <T> T getBean(String name, Class<T> requiredType) { T bean = null; try { Class<?> class1 = Class.forName(props.getProperty(name)); bean =(T) class1.newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return bean; } }
543dbcb3dd5e0886e5855690964496966f7d8501
daee768db223600439d8a60f7ef8f8d3c3d3c351
/app/src/main/java/com/example/jiteshnarula/bakbak/ChatActivity.java
cd6549ba5c57a5e84732cae35d60d7d58f6d9ea8
[]
no_license
jiteshnarula/MessengerAppFinal
aa8ae2bbb73cdcbee57a8e2a83acd3eaabb83f9b
671b8e8532dd1f8ab86211e96aac20d3dd684e15
refs/heads/master
2021-08-26T07:09:20.013831
2017-11-22T05:12:22
2017-11-22T05:12:22
111,326,290
0
0
null
null
null
null
UTF-8
Java
false
false
10,665
java
package com.example.jiteshnarula.bakbak; import android.content.Context; import android.content.Intent; import android.os.Message; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.EditText; import android.widget.Gallery; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.google.firebase.database.ServerValue; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import de.hdodenhof.circleimageview.CircleImageView; public class ChatActivity extends AppCompatActivity { private String mChatUser; private Toolbar chatPageToolbar; private DatabaseReference rootReference; TextView nameTextView; TextView seenTextView; CircleImageView customImage; private FirebaseAuth mAuth; private String mCurrentUserId; private EditText chatEditText; private ImageButton addImageButton; private ImageButton sendImageButton; private RecyclerView mMessagesList; private static final int TOTAL_ITEMS_TO_LOAD =10; private int mCurrentPage=1; private SwipeRefreshLayout mRefreshLayout; private final List<Messages> messagesList = new ArrayList<>(); private LinearLayoutManager mLinearLayout; private MessageAdapter mAdapter; private int itemPosition = 0; private String mLastKey = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); chatPageToolbar = (Toolbar) findViewById(R.id.chatPageToolbar); setSupportActionBar(chatPageToolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowCustomEnabled(true); rootReference = FirebaseDatabase.getInstance().getReference(); mAuth = FirebaseAuth.getInstance(); mCurrentUserId = mAuth.getCurrentUser().getUid(); mChatUser = getIntent().getStringExtra("user_id"); String userName = getIntent().getStringExtra("userName"); getSupportActionBar().setTitle(userName); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.chat_custom_bar_layout,null); actionBar.setCustomView(view); //custom toolbar items nameTextView = (TextView) findViewById(R.id.nameTextView); seenTextView = (TextView) findViewById(R.id.seenTextView); customImage = (CircleImageView) findViewById(R.id.customImage); addImageButton = (ImageButton) findViewById(R.id.addImageButton); sendImageButton = (ImageButton) findViewById(R.id.sendImageButton); chatEditText = (EditText) findViewById(R.id.sendEditText); mAdapter = new MessageAdapter(messagesList); //here is the recycler view mMessagesList = (RecyclerView) findViewById(R.id.messagesList); mRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeLayout); mLinearLayout = new LinearLayoutManager(this); mMessagesList.setHasFixedSize(true); mMessagesList.setLayoutManager(mLinearLayout); mMessagesList.setAdapter(mAdapter); loadMessages(); nameTextView.setText(userName); rootReference.child("Users").child(mChatUser).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String online = dataSnapshot.child("online").getValue().toString(); String image =dataSnapshot.child("image").getValue().toString(); if(online.equals("true")){ seenTextView.setText("Online"); }else{ GetTimeAgo getTimeAgo = new GetTimeAgo(); long lastTime = Long.parseLong(online); String lastSeenTime = getTimeAgo.getTimeAgo(lastTime,getApplicationContext()); seenTextView.setText(lastSeenTime); } } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(ChatActivity.this,"error in retriving time",Toast.LENGTH_LONG); } }) ; rootReference.child("Chat").child(mCurrentUserId).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(!dataSnapshot.hasChild(mChatUser)){ Map chatAddMap = new HashMap(); chatAddMap.put("seen",false); chatAddMap.put("timestamp", ServerValue.TIMESTAMP); Map chatUserMap = new HashMap(); chatUserMap.put("Chat/" + mCurrentUserId+"/" + mChatUser,chatAddMap); chatUserMap.put("Chat/" + mChatUser+"/" + mCurrentUserId,chatAddMap); rootReference.updateChildren(chatUserMap, new DatabaseReference.CompletionListener() { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if(databaseError != null){ Log.d("Chat_log",databaseError.getMessage().toString()); } } }); } } @Override public void onCancelled(DatabaseError databaseError) { } }); sendImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { sendMessage(); } }); mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mCurrentPage++; itemPosition=0; loadMoreMessages(); } }); } private void loadMoreMessages() { DatabaseReference messageRef = rootReference.child("messages").child(mCurrentUserId).child(mChatUser); Query messageQuery = messageRef.orderByKey().endAt(mLastKey).limitToLast(10); messageQuery.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Messages message = dataSnapshot.getValue(Messages.class); messagesList.add(itemPosition++,message); if(itemPosition == 1){ String messageKey = dataSnapshot.getKey(); mLastKey = messageKey; } mAdapter.notifyDataSetChanged(); mRefreshLayout.setRefreshing(false); mLinearLayout.scrollToPositionWithOffset(10,0); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void loadMessages() { DatabaseReference messageRef = rootReference.child("messages").child(mCurrentUserId).child(mChatUser); Query messageQuery = messageRef.limitToLast(mCurrentPage * TOTAL_ITEMS_TO_LOAD); messageQuery.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Messages message = dataSnapshot.getValue(Messages.class); itemPosition++; if(itemPosition == 1){ String messageKey = dataSnapshot.getKey(); mLastKey = messageKey; } messagesList.add(message); mAdapter.notifyDataSetChanged(); mMessagesList.scrollToPosition(messagesList.size() - 1); mRefreshLayout.setRefreshing(false); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); } private void sendMessage() { String message = chatEditText.getText().toString(); if(!TextUtils.isEmpty(message)){ String current_user_ref = "messages/" + mCurrentUserId +"/"+mChatUser; String chat_user_ref = "messages/"+ mChatUser+"/"+mCurrentUserId; DatabaseReference user_message_push = rootReference.child("messages").child(mCurrentUserId).child(mChatUser).push(); String push_id = user_message_push.getKey(); Map messageMap = new HashMap(); messageMap.put("message",message); messageMap.put( "seen",false); messageMap.put( "type","text"); messageMap.put( "time",ServerValue.TIMESTAMP); messageMap.put( "from",mCurrentUserId); Map messageUserMap = new HashMap(); messageUserMap.put(current_user_ref +"/"+push_id,messageMap); messageUserMap.put(chat_user_ref+"/"+push_id,messageMap); chatEditText.setText(""); rootReference.updateChildren(messageUserMap, new DatabaseReference.CompletionListener() { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { if(databaseError != null){ Log.d("Chat_log",databaseError.getMessage().toString()); } } }); } } }
9107be2ecc7aaedc72511582ad07fbb4dfb31532
4cb90fc911a1da79369135f46c4f28efbb40682f
/app/src/main/java/com/hismart/easylink/preview/ui/launch/view/SelfishRecyclerView.java
e2b8006096a44005d537ca54aa63ac089778a401
[]
no_license
wyntonchin/android-work-preview
f046e81f42a7753d80b2de03b410aeca4ef9181b
3c1b3ef68838e8f6d8204d7f297465464ecfec67
refs/heads/master
2020-03-19T05:06:26.824165
2018-06-25T03:04:14
2018-06-25T03:04:14
135,900,687
0
0
null
null
null
null
UTF-8
Java
false
false
907
java
package com.hismart.easylink.preview.ui.launch.view; import android.content.Context; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; /** * @author qinwendong * @date 2018/6/5 * descrption: 自私的SelfishRecyclerView ,将所有的touch时间独自消费掉 */ public class SelfishRecyclerView extends RecyclerView { public SelfishRecyclerView(Context context) { this(context, null); } public SelfishRecyclerView(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public SelfishRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean onTouchEvent(MotionEvent ev){ super.onTouchEvent(ev); return true; } }
1a0f2ce94a4d0a706fc747637531ac7fe9fa0ca0
e38e4133b3afddc86b3f779e5edf628268658c6c
/Algorithms Part II/Week 5 FULL/Week 5 Codes/src/com/Hisham/Regex/Clean.java
96a7ae63faf845d7f530c8ede44a7738cedc2c90
[]
no_license
sandyg05/Algorithms-Princeton-Combined
ae6788b63ef3b9d44f16e21adc54caf078591e61
4880a2419f4aaa4eff94a1383429b9d86a4b377e
refs/heads/master
2023-09-03T06:54:00.737857
2021-10-08T17:50:33
2021-10-08T17:50:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.Hisham.Regex; import edu.princeton.cs.algs4.In; import edu.princeton.cs.algs4.StdIn; public class Clean { public static void main(String[] args) { In in = new In(StdIn.readLine()); while (in.hasNextLine()) { String s = in.readLine(); s = s.replaceAll("\\t", " "); s = s.replaceAll("\\s+$", ""); System.out.println(s); } } }
93f5faf79d2b91c23ccbe75934646434a531d270
5807a496efcae9ebbc2109a2db068cc33f1e7dbb
/app/src/main/java/com/afeka/gethelp_demoapp/SettingsActivity.java
73329ee2b2516929ff4cdda8311e00eebad7d1b5
[]
no_license
gironaptik/GetHelp-DemoApp
fef90d3853f52b6620425b9b5771dbbc6e72377f
102a946578964b796d20ba6a25d8a098e4f713d5
refs/heads/master
2020-12-14T13:50:21.335747
2020-02-01T21:00:28
2020-02-01T21:00:28
234,762,702
0
0
null
null
null
null
UTF-8
Java
false
false
853
java
package com.afeka.gethelp_demoapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class SettingsActivity extends AppCompatActivity { private String Status = "status"; String whereTo = "empty"; ImageView viStatus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); getSupportActionBar().hide(); } public void jump2(View view) { Intent activityChangeIntent = new Intent(this, NewRequestActivity.class); activityChangeIntent.putExtra(Status, whereTo); this.startActivity(activityChangeIntent); } @Override public void onBackPressed() { } }
4cf75b9e33d4634a133ee9f09c44aa069608c6e6
cfb5ea59924528807226c7afd17d8ac2831765ef
/src/main/java/com/huang/datasource/domain/Order.java
b4a559826b36749984de9ff6417d3d8afb2fe470
[]
no_license
xiaohuang915/datasource
3466e426ec2927efd8eb3be43bdab7232879be59
c4473783b7d349c84478d3ac2e09878fed79a17f
refs/heads/master
2023-01-28T13:31:45.021842
2020-12-10T07:28:07
2020-12-10T07:28:07
315,259,570
0
0
null
null
null
null
UTF-8
Java
false
false
242
java
package com.huang.datasource.domain; import lombok.Getter; import lombok.Setter; /** * @Description: * @Author : pc.huang * @Date : 2020/11/23 15:19 */ @Getter @Setter public class Order { private int id; private String name; }
47bc8ac38f4800e4b6b52f696f6a8ffcc4ee4c13
4f76caea3a62898c59e5501cc3e3c3596a3f607f
/app/src/main/java/com/example/latihan/pdeddy78/academy/ui/detail/DetailCourseActivity.java
93987a79ccd11607289a5c4aa6e462640002066a
[]
no_license
pdeddy78/AcademyProject
43e7d2274bf56150befd5b2707a46ff85bb931ab
37096d6420ffcb8488ff0b11446aace330c50079
refs/heads/master
2020-09-16T06:03:20.406561
2019-11-24T03:37:26
2019-11-24T03:37:26
223,677,537
0
0
null
null
null
null
UTF-8
Java
false
false
3,612
java
package com.example.latihan.pdeddy78.academy.ui.detail; import android.content.Intent; import android.os.Bundle; import android.widget.Button; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.bumptech.glide.request.RequestOptions; import com.example.latihan.pdeddy78.academy.R; import com.example.latihan.pdeddy78.academy.data.CourseEntity; import com.example.latihan.pdeddy78.academy.ui.reader.CourseReaderActivity; import com.example.latihan.pdeddy78.academy.utils.DataDummy; import com.example.latihan.pdeddy78.academy.utils.GlideApp; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; public class DetailCourseActivity extends AppCompatActivity { public static final String EXTRA_COURSE = "extra_course"; private Button btnStart; private TextView textTitle; private TextView textDesc; private TextView textDate; private RecyclerView rvModule; private DetailCourseAdapter adapter; private ImageView imagePoster; private ProgressBar progressBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_course); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } adapter = new DetailCourseAdapter(); progressBar = findViewById(R.id.progress_bar); btnStart = findViewById(R.id.btn_start); textTitle = findViewById(R.id.text_title); textDesc = findViewById(R.id.text_description); textDate = findViewById(R.id.text_date); rvModule = findViewById(R.id.rv_module); imagePoster = findViewById(R.id.image_poster); Bundle extras = getIntent().getExtras(); if (extras != null) { String courseId = extras.getString(EXTRA_COURSE); if (courseId != null) { adapter.setModules(DataDummy.generateDummyModules(courseId)); populateCourse(courseId); } } rvModule.setNestedScrollingEnabled(false); rvModule.setLayoutManager(new LinearLayoutManager(this)); rvModule.setHasFixedSize(true); rvModule.setAdapter(adapter); DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(rvModule.getContext(), DividerItemDecoration.VERTICAL); rvModule.addItemDecoration(dividerItemDecoration); } private void populateCourse(String courseId) { CourseEntity courseEntity = DataDummy.getCourse(courseId); textTitle.setText(courseEntity.getTitle()); textDesc.setText(courseEntity.getDescription()); textDate.setText(String.format("Deadline %s", courseEntity.getDeadline())); GlideApp.with(getApplicationContext()) .load(courseEntity.getImagePath()) .apply(RequestOptions.placeholderOf(R.drawable.ic_loading).error(R.drawable.ic_error)) .into(imagePoster); btnStart.setOnClickListener(v -> { Intent intent = new Intent(DetailCourseActivity.this, CourseReaderActivity.class); intent.putExtra(CourseReaderActivity.EXTRA_COURSE_ID, courseId); v.getContext().startActivity(intent); }); } }
28aa12384e27d9700df513b00b3f21aa67caf7eb
f8d3fdf9d8bb4e8d1d0a3c771720e745a6b0fcbc
/src/clientsPackage/MyTextPane.java
eb656c02949d80a55af59257e314dfe9d669ce4e
[]
no_license
wbaszczyk/MOWNiT
3e14a19ed762aa4588e71e36543a813af189d916
7f85ab71da719a8b9cc8c315bbe36ba051fbaabc
refs/heads/master
2021-01-25T07:35:16.660443
2013-07-25T21:06:19
2013-07-25T21:06:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
945
java
package clientsPackage; import java.awt.Color; import javax.swing.JTextPane; import javax.swing.text.MutableAttributeSet; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class MyTextPane extends JTextPane { private static final long serialVersionUID = 1L; MyTextPane(boolean editable) { super(); StyledDocument doc = this.getStyledDocument(); MutableAttributeSet standard = new SimpleAttributeSet(); StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER); StyleConstants.setLeftIndent(standard, 40); StyleConstants.setRightIndent(standard, 40); Color szary = new Color(224, 226, 235); doc.setParagraphAttributes(0, 0, standard, true); this.setBackground(szary); this.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true)); this.setEditable(editable); } }
a0421a9479cd0000c42593ba4afc584fad3d31b9
72ca3ced50c6bb6348f54aa05a84fbbb31cbf544
/crypto-core/src/test/java/com/palantir/crypto2/io/ApacheCtrDecryptingSeekableInputTests.java
e0933f1d4b8e81f4ccfad88603a1e4b65f9e7a20
[ "Apache-2.0" ]
permissive
palantir/hadoop-crypto
e805005c4408dfc9bf6705d1b0173e2124b26c3b
4221c8b6527cda39612b03c3621e401d303255dd
refs/heads/develop
2023-08-28T23:52:33.637386
2023-08-26T04:49:07
2023-08-26T04:49:07
62,156,481
46
36
Apache-2.0
2023-09-14T20:36:59
2016-06-28T16:18:49
Java
UTF-8
Java
false
false
2,543
java
/* * (c) Copyright 2021 Palantir Technologies Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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.palantir.crypto2.io; import static org.assertj.core.api.Assertions.assertThat; import com.palantir.seekio.InMemorySeekableDataInput; import java.io.IOException; import java.nio.ByteBuffer; import java.util.Random; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public final class ApacheCtrDecryptingSeekableInputTests { private static final int NUM_BYTES = 1024 * 1024; private static final Random random = new Random(0); private static byte[] data; @BeforeAll public static void beforeClass() throws IOException { data = new byte[NUM_BYTES]; random.nextBytes(data); } @Test public void testEmptyRead() throws IOException { ByteBuffer dst = ByteBuffer.allocate(1024); byte[] emptyData = new byte[] {}; ApacheCtrDecryptingSeekableInput.InputAdapter adapter = inputAdapter(emptyData); assertThat(adapter.read(dst)).isEqualTo(-1); assertThat(dst.position()).isEqualTo(0); } @Test public void testFullRead() throws IOException { ByteBuffer dst = ByteBuffer.allocate(2 * NUM_BYTES); ApacheCtrDecryptingSeekableInput.InputAdapter adapter = inputAdapter(data); assertThat(adapter.read(dst)).isEqualTo(NUM_BYTES); assertThat(dst.position()).isEqualTo(NUM_BYTES); } @Test public void testPartialRead() throws IOException { int toRead = NUM_BYTES / 2; ByteBuffer dst = ByteBuffer.allocate(toRead); ApacheCtrDecryptingSeekableInput.InputAdapter adapter = inputAdapter(data); assertThat(adapter.read(dst)).isEqualTo(toRead); assertThat(dst.position()).isEqualTo(toRead); } private ApacheCtrDecryptingSeekableInput.InputAdapter inputAdapter(byte[] inputData) { return new ApacheCtrDecryptingSeekableInput.InputAdapter(new InMemorySeekableDataInput(inputData)); } }
d9c3147c96c64e55517c70c1be8dd6b3f7bf8d7a
2f9eb220e9a54422ea1ca85bf28b7a77b931ad49
/app/src/main/java/com/sanfengandroid/common/util/Util.java
58079939c16e52f8ba5150581e93c10c0007a70b
[ "Apache-2.0" ]
permissive
AndroidKnife/FakeXposed
3d5af2a80938eb487b920d79064dad32acfb117e
dc592646d9f1a71b718d5fd8bbf69ee635b26e04
refs/heads/main
2023-04-15T18:05:34.264590
2021-03-31T11:37:10
2021-03-31T11:37:10
353,330,301
0
0
Apache-2.0
2021-03-31T11:19:49
2021-03-31T11:19:49
null
UTF-8
Java
false
false
4,577
java
/* * Copyright (c) 2021 FakeXposed by sanfengAndroid. * * 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.sanfengandroid.common.util; import android.app.ActivityManager; import android.app.ActivityThread; import android.content.Context; import android.os.Process; import android.text.TextUtils; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; /** * @author sanfengAndroid * @date 2020/10/31 */ public class Util { public static void removeFinalModifier(final Field field) { removeFinalModifier(field, true); } /** * Removes the final modifier from a {@link Field}. * * @param field to remove the final modifier * @param forceAccess whether to break scope restrictions using the * {@link java.lang.reflect.AccessibleObject#setAccessible(boolean)} method. {@code false} will only * match {@code public} fields. * @throws IllegalArgumentException if the field is {@code null} * @since 3.3 */ public static void removeFinalModifier(final Field field, final boolean forceAccess) { if (field == null) { return; } String[] names = {"accessFlags", "modifiers"}; for (String name : names) { try { if (Modifier.isFinal(field.getModifiers())) { // Do all JREs implement Field with a private ivar called "modifiers"? final Field modifiersField = Field.class.getDeclaredField(name); final boolean doForceAccess = forceAccess && !modifiersField.isAccessible(); if (doForceAccess) { modifiersField.setAccessible(true); } try { modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL); } finally { if (doForceAccess) { modifiersField.setAccessible(false); } } return; } } catch (final NoSuchFieldException ignored) { // The field class contains always a modifiers field } catch (final IllegalAccessException ignored) { // The modifiers field is made accessible } } } public static String getProcessName(Context context) { String process = ActivityThread.currentProcessName(); if (!TextUtils.isEmpty(process)) { return process; } ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); int pid = Process.myPid(); for (ActivityManager.RunningAppProcessInfo processInfo : am.getRunningAppProcesses()) { if (processInfo.pid == pid) { return processInfo.processName; } } return ""; } public static String getMemberFullName(Member member) { if (member == null) { return ""; } Class<?>[] types; if (member instanceof Method) { types = ((Method) member).getParameterTypes(); } else { types = ((Constructor) member).getParameterTypes(); } return member.getDeclaringClass().getName() + '#' + member.getName() + getParametersString(types); } private static String getParametersString(Class<?>[] clazzes) { StringBuilder sb = new StringBuilder("("); boolean first = true; for (Class<?> clazz : clazzes) { if (first) { first = false; } else { sb.append(","); } if (clazz != null) { sb.append(clazz.getCanonicalName()); } else { sb.append("null"); } } sb.append(")"); return sb.toString(); } }
26d689bf55a0cc3edd1a340ea83ae3049e6c5b3e
ece67723857df58d940e9d00a951be25fa629f9e
/src/graph/sortedListToBST.java
b397d2f16f50eabcbc4579cd0ec2afeb86135ab7
[]
no_license
AnuragSingla911/Algorithms
c8fdaf0ec881ce5977fac4ec9136aefb068bc893
84e138b2f8b45bd0e03fb411b7324cc16768c381
refs/heads/master
2020-06-05T23:52:53.270331
2019-09-11T16:44:56
2019-09-11T16:44:56
192,579,186
0
0
null
null
null
null
UTF-8
Java
false
false
2,274
java
package graph; import java.util.LinkedList; import java.util.Queue; public class sortedListToBST { class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } static class ListNode { public int val; public ListNode next; ListNode(int x) { val = x; next = null; } } public static void main(String[] args) { ListNode node = new ListNode(4); ListNode node1 = new ListNode(5); ListNode node2 = new ListNode(6); node.next = node1; node1.next=node2; new sortedListToBST().sortedListToBST(node); } public TreeNode sortedListToBST(ListNode a) { ListNode slow = middle(a); if(slow.next == null) { TreeNode head = new TreeNode(slow.val); return head; } TreeNode head = new TreeNode(slow.next.val); Queue<ListNode> list = new LinkedList<ListNode>(); Queue<TreeNode> tree = new LinkedList<TreeNode>(); list.add(a); list.add(slow.next.next); slow.next = null; tree.add(head); while(!list.isEmpty()) { ListNode left = list.poll(); TreeNode cur = tree.poll(); if(left != null) { ListNode leftMiddle = middle(left); if(leftMiddle != null) { if(leftMiddle.next == null) { cur.left = new TreeNode(leftMiddle.val); }else { cur.left = new TreeNode(leftMiddle.next.val); list.add(left); list.add(leftMiddle.next.next); leftMiddle.next = null; tree.add(cur.left); } } } ListNode right = list.poll(); if(right != null) { ListNode rightMiddle = middle(right); if(rightMiddle != null) { if(rightMiddle.next == null) { cur.right = new TreeNode(rightMiddle.val); }else { cur.right = new TreeNode(rightMiddle.next.val); list.add(right); list.add(rightMiddle.next.next); rightMiddle.next = null; tree.add(cur.right); } } } } return head; } private ListNode middle(ListNode a) { int size = 0; ListNode c = a; while(c != null) { c= c.next; size++; } ListNode slow = a; ListNode fast = a; ListNode prev = null; while(fast.next != null && fast.next.next != null) { fast = fast.next.next; prev = slow; slow = slow.next; } //prev.next=null; return size < 2 || size % 2 == 0 ? slow : prev; } }
b035dd1e0112c0e46f4a0da6978b779f1a1559a6
894aa6e6232a204985bd948892253ab639fca912
/Kotlin/GSYKotlin/app/build/tmp/kapt3/stubs/debug/com/example/gsykotlin/common/net/PageInfoInterceptor.java
c6ad54263989379ae38301033d8bc49080afaf66
[]
no_license
linxiaoxing/MyTest
4bb6a9a4b9d8e23d45537d04d33d26a6feeb5a61
beec69911e8446f349b7ca65d0c68e3c116e0b31
refs/heads/master
2023-08-31T14:49:30.399608
2023-08-05T06:03:46
2023-08-05T06:03:46
44,009,438
3
1
null
2023-03-21T22:45:39
2015-10-10T12:17:47
Kotlin
UTF-8
Java
false
false
1,240
java
package com.example.gsykotlin.common.net; import java.lang.System; /** * 页面信息提取拦截 */ @kotlin.Metadata(mv = {1, 1, 15}, bv = {1, 0, 3}, k = 1, d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\u0018\u00002\u00020\u0001B\u0005\u00a2\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0012\u0010\u0007\u001a\u00020\b2\b\u0010\t\u001a\u0004\u0018\u00010\nH\u0002\u00a8\u0006\u000b"}, d2 = {"Lcom/example/gsykotlin/common/net/PageInfoInterceptor;", "Lokhttp3/Interceptor;", "()V", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "parseNumber", "", "item", "", "app_debug"}) public final class PageInfoInterceptor implements okhttp3.Interceptor { @org.jetbrains.annotations.NotNull() @java.lang.Override() public okhttp3.Response intercept(@org.jetbrains.annotations.NotNull() okhttp3.Interceptor.Chain chain) { return null; } private final int parseNumber(java.lang.String item) { return 0; } public PageInfoInterceptor() { super(); } }
3e5f3a5de53b546649e8d1bc59638fe229abb002
43d07af1742e01001c17eba4196f30156b08fbcc
/com/sun/tools/javac/comp/Check.java
ee7b42ca180a401b8a8ba2c0c883e3373b2f3945
[]
no_license
kSuroweczka/jdk
b408369b4b87ab09a828aa3dbf9132aaf8bb1b71
7ec3e8e31fcfb616d4a625191bcba0191ca7c2d4
refs/heads/master
2021-12-30T00:58:24.029054
2018-02-01T10:07:14
2018-02-01T10:07:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
167,778
java
/* */ package com.sun.tools.javac.comp; /* */ /* */ import com.sun.tools.javac.code.Attribute; /* */ import com.sun.tools.javac.code.Attribute.Array; /* */ import com.sun.tools.javac.code.Attribute.Class; /* */ import com.sun.tools.javac.code.Attribute.Compound; /* */ import com.sun.tools.javac.code.Attribute.Enum; /* */ import com.sun.tools.javac.code.Attribute.RetentionPolicy; /* */ import com.sun.tools.javac.code.DeferredLintHandler; /* */ import com.sun.tools.javac.code.DeferredLintHandler.LintLogger; /* */ import com.sun.tools.javac.code.Flags; /* */ import com.sun.tools.javac.code.Kinds; /* */ import com.sun.tools.javac.code.Lint; /* */ import com.sun.tools.javac.code.Lint.LintCategory; /* */ import com.sun.tools.javac.code.Scope; /* */ import com.sun.tools.javac.code.Scope.CompoundScope; /* */ import com.sun.tools.javac.code.Scope.Entry; /* */ import com.sun.tools.javac.code.Source; /* */ import com.sun.tools.javac.code.Symbol; /* */ import com.sun.tools.javac.code.Symbol.ClassSymbol; /* */ import com.sun.tools.javac.code.Symbol.CompletionFailure; /* */ import com.sun.tools.javac.code.Symbol.MethodSymbol; /* */ import com.sun.tools.javac.code.Symbol.OperatorSymbol; /* */ import com.sun.tools.javac.code.Symbol.TypeSymbol; /* */ import com.sun.tools.javac.code.Symbol.VarSymbol; /* */ import com.sun.tools.javac.code.Symtab; /* */ import com.sun.tools.javac.code.Type; /* */ import com.sun.tools.javac.code.Type.ArrayType; /* */ import com.sun.tools.javac.code.Type.CapturedType; /* */ import com.sun.tools.javac.code.Type.ClassType; /* */ import com.sun.tools.javac.code.Type.ForAll; /* */ import com.sun.tools.javac.code.Type.TypeVar; /* */ import com.sun.tools.javac.code.Type.WildcardType; /* */ import com.sun.tools.javac.code.TypeTag; /* */ import com.sun.tools.javac.code.Types; /* */ import com.sun.tools.javac.code.Types.FunctionDescriptorLookupError; /* */ import com.sun.tools.javac.code.Types.UnaryVisitor; /* */ import com.sun.tools.javac.jvm.ClassReader.BadClassFile; /* */ import com.sun.tools.javac.jvm.Profile; /* */ import com.sun.tools.javac.jvm.Target; /* */ import com.sun.tools.javac.tree.JCTree; /* */ import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; /* */ import com.sun.tools.javac.tree.JCTree.JCAnnotation; /* */ import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree; /* */ import com.sun.tools.javac.tree.JCTree.JCAssign; /* */ import com.sun.tools.javac.tree.JCTree.JCClassDecl; /* */ import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; /* */ import com.sun.tools.javac.tree.JCTree.JCExpression; /* */ import com.sun.tools.javac.tree.JCTree.JCFieldAccess; /* */ import com.sun.tools.javac.tree.JCTree.JCIdent; /* */ import com.sun.tools.javac.tree.JCTree.JCIf; /* */ import com.sun.tools.javac.tree.JCTree.JCMethodDecl; /* */ import com.sun.tools.javac.tree.JCTree.JCMethodInvocation; /* */ import com.sun.tools.javac.tree.JCTree.JCModifiers; /* */ import com.sun.tools.javac.tree.JCTree.JCNewArray; /* */ import com.sun.tools.javac.tree.JCTree.JCNewClass; /* */ import com.sun.tools.javac.tree.JCTree.JCPolyExpression.PolyKind; /* */ import com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree; /* */ import com.sun.tools.javac.tree.JCTree.JCStatement; /* */ import com.sun.tools.javac.tree.JCTree.JCTypeApply; /* */ import com.sun.tools.javac.tree.JCTree.JCTypeCast; /* */ import com.sun.tools.javac.tree.JCTree.JCTypeParameter; /* */ import com.sun.tools.javac.tree.JCTree.JCVariableDecl; /* */ import com.sun.tools.javac.tree.JCTree.JCWildcard; /* */ import com.sun.tools.javac.tree.JCTree.Tag; /* */ import com.sun.tools.javac.tree.JCTree.Visitor; /* */ import com.sun.tools.javac.tree.TreeInfo; /* */ import com.sun.tools.javac.tree.TreeScanner; /* */ import com.sun.tools.javac.util.Abort; /* */ import com.sun.tools.javac.util.Assert; /* */ import com.sun.tools.javac.util.Context; /* */ import com.sun.tools.javac.util.Context.Key; /* */ import com.sun.tools.javac.util.DiagnosticSource; /* */ import com.sun.tools.javac.util.Filter; /* */ import com.sun.tools.javac.util.JCDiagnostic; /* */ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; /* */ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; /* */ import com.sun.tools.javac.util.JCDiagnostic.Factory; /* */ import com.sun.tools.javac.util.List; /* */ import com.sun.tools.javac.util.ListBuffer; /* */ import com.sun.tools.javac.util.Log; /* */ import com.sun.tools.javac.util.Log.DiscardDiagnosticHandler; /* */ import com.sun.tools.javac.util.MandatoryWarningHandler; /* */ import com.sun.tools.javac.util.Name; /* */ import com.sun.tools.javac.util.Names; /* */ import com.sun.tools.javac.util.Options; /* */ import com.sun.tools.javac.util.Pair; /* */ import com.sun.tools.javac.util.Warner; /* */ import java.util.Collection; /* */ import java.util.Collections; /* */ import java.util.HashMap; /* */ import java.util.HashSet; /* */ import java.util.Iterator; /* */ import java.util.LinkedHashSet; /* */ import java.util.Map; /* */ import java.util.Set; /* */ import javax.tools.JavaFileManager; /* */ /* */ public class Check /* */ { /* 67 */ protected static final Context.Key<Check> checkKey = new Context.Key(); /* */ private final Names names; /* */ private final Log log; /* */ private final Resolve rs; /* */ private final Symtab syms; /* */ private final Enter enter; /* */ private final DeferredAttr deferredAttr; /* */ private final Infer infer; /* */ private final Types types; /* */ private final JCDiagnostic.Factory diags; /* */ private boolean warnOnSyntheticConflicts; /* */ private boolean suppressAbortOnBadClassFile; /* */ private boolean enableSunApiLintControl; /* */ private final TreeInfo treeinfo; /* */ private final JavaFileManager fileManager; /* */ private final Profile profile; /* */ private final boolean warnOnAccessToSensitiveMembers; /* */ private Lint lint; /* */ private Symbol.MethodSymbol method; /* */ boolean allowGenerics; /* */ boolean allowVarargs; /* */ boolean allowAnnotations; /* */ boolean allowCovariantReturns; /* */ boolean allowSimplifiedVarargs; /* */ boolean allowDefaultMethods; /* */ boolean allowStrictMethodClashCheck; /* */ boolean complexInference; /* */ char syntheticNameChar; /* 196 */ public Map<Name, Symbol.ClassSymbol> compiled = new HashMap(); /* */ private MandatoryWarningHandler deprecationHandler; /* */ private MandatoryWarningHandler uncheckedHandler; /* */ private MandatoryWarningHandler sunApiHandler; /* */ private DeferredLintHandler deferredLintHandler; /* 496 */ CheckContext basicHandler = new CheckContext() { /* */ public void report(JCDiagnostic.DiagnosticPosition paramAnonymousDiagnosticPosition, JCDiagnostic paramAnonymousJCDiagnostic) { /* 498 */ Check.this.log.error(paramAnonymousDiagnosticPosition, "prob.found.req", new Object[] { paramAnonymousJCDiagnostic }); /* */ } /* */ public boolean compatible(Type paramAnonymousType1, Type paramAnonymousType2, Warner paramAnonymousWarner) { /* 501 */ return Check.this.types.isAssignable(paramAnonymousType1, paramAnonymousType2, paramAnonymousWarner); /* */ } /* */ /* */ public Warner checkWarner(JCDiagnostic.DiagnosticPosition paramAnonymousDiagnosticPosition, Type paramAnonymousType1, Type paramAnonymousType2) { /* 505 */ return Check.this.convertWarner(paramAnonymousDiagnosticPosition, paramAnonymousType1, paramAnonymousType2); /* */ } /* */ /* */ public Infer.InferenceContext inferenceContext() { /* 509 */ return Check.this.infer.emptyContext; /* */ } /* */ /* */ public DeferredAttr.DeferredAttrContext deferredAttrContext() { /* 513 */ return Check.this.deferredAttr.emptyDeferredAttrContext; /* */ } /* */ /* */ public String toString() /* */ { /* 518 */ return "CheckContext: basicHandler"; /* */ } /* 496 */ }; /* */ private static final boolean ignoreAnnotatedCasts = true; /* 1007 */ Types.UnaryVisitor<Boolean> isTypeArgErroneous = new Types.UnaryVisitor() { /* */ public Boolean visitType(Type paramAnonymousType, Void paramAnonymousVoid) { /* 1009 */ return Boolean.valueOf(paramAnonymousType.isErroneous()); /* */ } /* */ /* */ public Boolean visitTypeVar(Type.TypeVar paramAnonymousTypeVar, Void paramAnonymousVoid) { /* 1013 */ return (Boolean)visit(paramAnonymousTypeVar.getUpperBound()); /* */ } /* */ /* */ public Boolean visitCapturedType(Type.CapturedType paramAnonymousCapturedType, Void paramAnonymousVoid) { /* 1017 */ return Boolean.valueOf((((Boolean)visit(paramAnonymousCapturedType.getUpperBound())).booleanValue()) || /* 1018 */ (((Boolean)visit(paramAnonymousCapturedType /* 1018 */ .getLowerBound())).booleanValue())); /* */ } /* */ /* */ public Boolean visitWildcardType(Type.WildcardType paramAnonymousWildcardType, Void paramAnonymousVoid) { /* 1022 */ return (Boolean)visit(paramAnonymousWildcardType.type); /* */ } /* 1007 */ }; /* */ /* 1751 */ Warner overrideWarner = new Warner(); /* */ /* 1993 */ private Filter<Symbol> equalsHasCodeFilter = new Filter() /* */ { /* */ public boolean accepts(Symbol paramAnonymousSymbol) { /* 1996 */ return (Symbol.MethodSymbol.implementation_filter.accepts(paramAnonymousSymbol)) && /* 1996 */ ((paramAnonymousSymbol /* 1996 */ .flags() & 0x0) == 0L); /* */ } /* 1993 */ }; /* */ private Set<Name> defaultTargets; /* */ private final Name[] dfltTargetMeta; /* */ /* */ public static Check instance(Context paramContext) /* */ { /* 97 */ Check localCheck = (Check)paramContext.get(checkKey); /* 98 */ if (localCheck == null) /* 99 */ localCheck = new Check(paramContext); /* 100 */ return localCheck; /* */ } /* */ /* */ protected Check(Context paramContext) { /* 104 */ paramContext.put(checkKey, this); /* */ /* 106 */ this.names = Names.instance(paramContext); /* 107 */ this.dfltTargetMeta = new Name[] { this.names.PACKAGE, this.names.TYPE, this.names.FIELD, this.names.METHOD, this.names.CONSTRUCTOR, this.names.ANNOTATION_TYPE, this.names.LOCAL_VARIABLE, this.names.PARAMETER }; /* */ /* 110 */ this.log = Log.instance(paramContext); /* 111 */ this.rs = Resolve.instance(paramContext); /* 112 */ this.syms = Symtab.instance(paramContext); /* 113 */ this.enter = Enter.instance(paramContext); /* 114 */ this.deferredAttr = DeferredAttr.instance(paramContext); /* 115 */ this.infer = Infer.instance(paramContext); /* 116 */ this.types = Types.instance(paramContext); /* 117 */ this.diags = JCDiagnostic.Factory.instance(paramContext); /* 118 */ Options localOptions = Options.instance(paramContext); /* 119 */ this.lint = Lint.instance(paramContext); /* 120 */ this.treeinfo = TreeInfo.instance(paramContext); /* 121 */ this.fileManager = ((JavaFileManager)paramContext.get(JavaFileManager.class)); /* */ /* 123 */ Source localSource = Source.instance(paramContext); /* 124 */ this.allowGenerics = localSource.allowGenerics(); /* 125 */ this.allowVarargs = localSource.allowVarargs(); /* 126 */ this.allowAnnotations = localSource.allowAnnotations(); /* 127 */ this.allowCovariantReturns = localSource.allowCovariantReturns(); /* 128 */ this.allowSimplifiedVarargs = localSource.allowSimplifiedVarargs(); /* 129 */ this.allowDefaultMethods = localSource.allowDefaultMethods(); /* 130 */ this.allowStrictMethodClashCheck = localSource.allowStrictMethodClashCheck(); /* 131 */ this.complexInference = localOptions.isSet("complexinference"); /* 132 */ this.warnOnSyntheticConflicts = localOptions.isSet("warnOnSyntheticConflicts"); /* 133 */ this.suppressAbortOnBadClassFile = localOptions.isSet("suppressAbortOnBadClassFile"); /* 134 */ this.enableSunApiLintControl = localOptions.isSet("enableSunApiLintControl"); /* 135 */ this.warnOnAccessToSensitiveMembers = localOptions.isSet("warnOnAccessToSensitiveMembers"); /* */ /* 137 */ Target localTarget = Target.instance(paramContext); /* 138 */ this.syntheticNameChar = localTarget.syntheticNameChar(); /* */ /* 140 */ this.profile = Profile.instance(paramContext); /* */ /* 142 */ boolean bool1 = this.lint.isEnabled(Lint.LintCategory.DEPRECATION); /* 143 */ boolean bool2 = this.lint.isEnabled(Lint.LintCategory.UNCHECKED); /* 144 */ boolean bool3 = this.lint.isEnabled(Lint.LintCategory.SUNAPI); /* 145 */ boolean bool4 = localSource.enforceMandatoryWarnings(); /* */ /* 147 */ this.deprecationHandler = new MandatoryWarningHandler(this.log, bool1, bool4, "deprecated", Lint.LintCategory.DEPRECATION); /* */ /* 149 */ this.uncheckedHandler = new MandatoryWarningHandler(this.log, bool2, bool4, "unchecked", Lint.LintCategory.UNCHECKED); /* */ /* 151 */ this.sunApiHandler = new MandatoryWarningHandler(this.log, bool3, bool4, "sunapi", null); /* */ /* 154 */ this.deferredLintHandler = DeferredLintHandler.instance(paramContext); /* */ } /* */ /* */ Lint setLint(Lint paramLint) /* */ { /* 219 */ Lint localLint = this.lint; /* 220 */ this.lint = paramLint; /* 221 */ return localLint; /* */ } /* */ /* */ Symbol.MethodSymbol setMethod(Symbol.MethodSymbol paramMethodSymbol) { /* 225 */ Symbol.MethodSymbol localMethodSymbol = this.method; /* 226 */ this.method = paramMethodSymbol; /* 227 */ return localMethodSymbol; /* */ } /* */ /* */ void warnDeprecated(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) /* */ { /* 235 */ if (!this.lint.isSuppressed(Lint.LintCategory.DEPRECATION)) /* 236 */ this.deprecationHandler.report(paramDiagnosticPosition, "has.been.deprecated", new Object[] { paramSymbol, paramSymbol.location() }); /* */ } /* */ /* */ public void warnUnchecked(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, String paramString, Object[] paramArrayOfObject) /* */ { /* 244 */ if (!this.lint.isSuppressed(Lint.LintCategory.UNCHECKED)) /* 245 */ this.uncheckedHandler.report(paramDiagnosticPosition, paramString, paramArrayOfObject); /* */ } /* */ /* */ void warnUnsafeVararg(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, String paramString, Object[] paramArrayOfObject) /* */ { /* 252 */ if ((this.lint.isEnabled(Lint.LintCategory.VARARGS)) && (this.allowSimplifiedVarargs)) /* 253 */ this.log.warning(Lint.LintCategory.VARARGS, paramDiagnosticPosition, paramString, paramArrayOfObject); /* */ } /* */ /* */ public void warnSunApi(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, String paramString, Object[] paramArrayOfObject) /* */ { /* 261 */ if (!this.lint.isSuppressed(Lint.LintCategory.SUNAPI)) /* 262 */ this.sunApiHandler.report(paramDiagnosticPosition, paramString, paramArrayOfObject); /* */ } /* */ /* */ public void warnStatic(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, String paramString, Object[] paramArrayOfObject) { /* 266 */ if (this.lint.isEnabled(Lint.LintCategory.STATIC)) /* 267 */ this.log.warning(Lint.LintCategory.STATIC, paramDiagnosticPosition, paramString, paramArrayOfObject); /* */ } /* */ /* */ public void reportDeferredDiagnostics() /* */ { /* 274 */ this.deprecationHandler.reportDeferredDiagnostic(); /* 275 */ this.uncheckedHandler.reportDeferredDiagnostic(); /* 276 */ this.sunApiHandler.reportDeferredDiagnostic(); /* */ } /* */ /* */ public Type completionError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.CompletionFailure paramCompletionFailure) /* */ { /* 285 */ this.log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, paramDiagnosticPosition, "cant.access", new Object[] { paramCompletionFailure.sym, paramCompletionFailure.getDetailValue() }); /* 286 */ if (((paramCompletionFailure instanceof ClassReader.BadClassFile)) && (!this.suppressAbortOnBadClassFile)) /* 287 */ throw new Abort(); /* 288 */ return this.syms.errType; /* */ } /* */ /* */ Type typeTagError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Object paramObject1, Object paramObject2) /* */ { /* 300 */ if (((paramObject2 instanceof Type)) && (((Type)paramObject2).hasTag(TypeTag.VOID))) { /* 301 */ this.log.error(paramDiagnosticPosition, "illegal.start.of.type", new Object[0]); /* 302 */ return this.syms.errType; /* */ } /* 304 */ this.log.error(paramDiagnosticPosition, "type.found.req", new Object[] { paramObject2, paramObject1 }); /* 305 */ return this.types.createErrorType((paramObject2 instanceof Type) ? (Type)paramObject2 : this.syms.errType); /* */ } /* */ /* */ void earlyRefError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) /* */ { /* 314 */ this.log.error(paramDiagnosticPosition, "cant.ref.before.ctor.called", new Object[] { paramSymbol }); /* */ } /* */ /* */ void duplicateError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) /* */ { /* 320 */ if (!paramSymbol.type.isErroneous()) { /* 321 */ Symbol localSymbol = paramSymbol.location(); /* 322 */ if ((localSymbol.kind == 16) && /* 323 */ (((Symbol.MethodSymbol)localSymbol) /* 323 */ .isStaticOrInstanceInit())) /* 324 */ this.log.error(paramDiagnosticPosition, "already.defined.in.clinit", new Object[] { Kinds.kindName(paramSymbol), paramSymbol, /* 325 */ Kinds.kindName(paramSymbol /* 325 */ .location()), Kinds.kindName(paramSymbol.location().enclClass()), paramSymbol /* 326 */ .location().enclClass() }); /* */ else /* 328 */ this.log.error(paramDiagnosticPosition, "already.defined", new Object[] { Kinds.kindName(paramSymbol), paramSymbol, /* 329 */ Kinds.kindName(paramSymbol /* 329 */ .location()), paramSymbol.location() }); /* */ } /* */ } /* */ /* */ void varargsDuplicateError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol1, Symbol paramSymbol2) /* */ { /* 337 */ if ((!paramSymbol1.type.isErroneous()) && (!paramSymbol2.type.isErroneous())) /* 338 */ this.log.error(paramDiagnosticPosition, "array.and.varargs", new Object[] { paramSymbol1, paramSymbol2, paramSymbol2.location() }); /* */ } /* */ /* */ void checkTransparentVar(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.VarSymbol paramVarSymbol, Scope paramScope) /* */ { /* 353 */ if (paramScope.next != null) /* 354 */ for (Scope.Entry localEntry = paramScope.next.lookup(paramVarSymbol.name); /* 355 */ (localEntry.scope != null) && (localEntry.sym.owner == paramVarSymbol.owner); /* 356 */ localEntry = localEntry.next()) /* 357 */ if ((localEntry.sym.kind == 4) && ((localEntry.sym.owner.kind & 0x14) != 0) && (paramVarSymbol.name != this.names.error)) /* */ { /* 360 */ duplicateError(paramDiagnosticPosition, localEntry.sym); /* 361 */ return; /* */ } /* */ } /* */ /* */ void checkTransparentClass(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.ClassSymbol paramClassSymbol, Scope paramScope) /* */ { /* 374 */ if (paramScope.next != null) /* 375 */ for (Scope.Entry localEntry = paramScope.next.lookup(paramClassSymbol.name); /* 376 */ (localEntry.scope != null) && (localEntry.sym.owner == paramClassSymbol.owner); /* 377 */ localEntry = localEntry.next()) /* 378 */ if ((localEntry.sym.kind == 2) && (!localEntry.sym.type.hasTag(TypeTag.TYPEVAR)) && ((localEntry.sym.owner.kind & 0x14) != 0) && (paramClassSymbol.name != this.names.error)) /* */ { /* 381 */ duplicateError(paramDiagnosticPosition, localEntry.sym); /* 382 */ return; /* */ } /* */ } /* */ /* */ boolean checkUniqueClassName(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Name paramName, Scope paramScope) /* */ { /* 396 */ for (Object localObject = paramScope.lookup(paramName); ((Scope.Entry)localObject).scope == paramScope; localObject = ((Scope.Entry)localObject).next()) { /* 397 */ if ((((Scope.Entry)localObject).sym.kind == 2) && (((Scope.Entry)localObject).sym.name != this.names.error)) { /* 398 */ duplicateError(paramDiagnosticPosition, ((Scope.Entry)localObject).sym); /* 399 */ return false; /* */ } /* */ } /* 402 */ for (localObject = paramScope.owner; localObject != null; localObject = ((Symbol)localObject).owner) { /* 403 */ if ((((Symbol)localObject).kind == 2) && (((Symbol)localObject).name == paramName) && (((Symbol)localObject).name != this.names.error)) { /* 404 */ duplicateError(paramDiagnosticPosition, (Symbol)localObject); /* 405 */ return true; /* */ } /* */ } /* 408 */ return true; /* */ } /* */ /* */ Name localClassName(Symbol.ClassSymbol paramClassSymbol) /* */ { /* 422 */ for (int i = 1; ; i++) /* */ { /* 424 */ Name localName = this.names /* 424 */ .fromString("" + paramClassSymbol.owner /* 424 */ .enclClass().flatname + this.syntheticNameChar + i + paramClassSymbol.name); /* */ /* 427 */ if (this.compiled.get(localName) == null) return localName; /* */ } /* */ } /* */ /* */ Type checkType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) /* */ { /* 529 */ return checkType(paramDiagnosticPosition, paramType1, paramType2, this.basicHandler); /* */ } /* */ /* */ Type checkType(final JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, final Type paramType1, final Type paramType2, final CheckContext paramCheckContext) { /* 533 */ Infer.InferenceContext localInferenceContext = paramCheckContext.inferenceContext(); /* 534 */ if ((localInferenceContext.free(paramType2)) || (localInferenceContext.free(paramType1))) { /* 535 */ localInferenceContext.addFreeTypeListener(List.of(paramType2, paramType1), new Infer.FreeTypeListener() /* */ { /* */ public void typesInferred(Infer.InferenceContext paramAnonymousInferenceContext) { /* 538 */ Check.this.checkType(paramDiagnosticPosition, paramAnonymousInferenceContext.asInstType(paramType1), paramAnonymousInferenceContext.asInstType(paramType2), paramCheckContext); /* */ } /* */ }); /* */ } /* 542 */ if (paramType2.hasTag(TypeTag.ERROR)) /* 543 */ return paramType2; /* 544 */ if (paramType2.hasTag(TypeTag.NONE)) /* 545 */ return paramType1; /* 546 */ if (paramCheckContext.compatible(paramType1, paramType2, paramCheckContext.checkWarner(paramDiagnosticPosition, paramType1, paramType2))) { /* 547 */ return paramType1; /* */ } /* 549 */ if ((paramType1.isNumeric()) && (paramType2.isNumeric())) { /* 550 */ paramCheckContext.report(paramDiagnosticPosition, this.diags.fragment("possible.loss.of.precision", new Object[] { paramType1, paramType2 })); /* 551 */ return this.types.createErrorType(paramType1); /* */ } /* 553 */ paramCheckContext.report(paramDiagnosticPosition, this.diags.fragment("inconvertible.types", new Object[] { paramType1, paramType2 })); /* 554 */ return this.types.createErrorType(paramType1); /* */ } /* */ /* */ Type checkCastable(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) /* */ { /* 565 */ return checkCastable(paramDiagnosticPosition, paramType1, paramType2, this.basicHandler); /* */ } /* */ Type checkCastable(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2, CheckContext paramCheckContext) { /* 568 */ if (this.types.isCastable(paramType1, paramType2, castWarner(paramDiagnosticPosition, paramType1, paramType2))) { /* 569 */ return paramType2; /* */ } /* 571 */ paramCheckContext.report(paramDiagnosticPosition, this.diags.fragment("inconvertible.types", new Object[] { paramType1, paramType2 })); /* 572 */ return this.types.createErrorType(paramType1); /* */ } /* */ /* */ public void checkRedundantCast(Env<AttrContext> paramEnv, final JCTree.JCTypeCast paramJCTypeCast) /* */ { /* 580 */ if ((!paramJCTypeCast.type.isErroneous()) && /* 581 */ (this.types /* 581 */ .isSameType(paramJCTypeCast.expr.type, paramJCTypeCast.clazz.type)) && /* 582 */ (!TreeInfo.containsTypeAnnotation(paramJCTypeCast.clazz)) && /* 583 */ (!is292targetTypeCast(paramJCTypeCast))) /* */ { /* 584 */ this.deferredLintHandler.report(new DeferredLintHandler.LintLogger() /* */ { /* */ public void report() { /* 587 */ if (Check.this.lint.isEnabled(Lint.LintCategory.CAST)) /* 588 */ Check.this.log.warning(Lint.LintCategory.CAST, paramJCTypeCast /* 589 */ .pos(), "redundant.cast", new Object[] { paramJCTypeCast.expr.type }); /* */ } /* */ }); /* */ } /* */ } /* */ /* */ private boolean is292targetTypeCast(JCTree.JCTypeCast paramJCTypeCast) { /* 596 */ boolean bool = false; /* 597 */ JCTree.JCExpression localJCExpression = TreeInfo.skipParens(paramJCTypeCast.expr); /* 598 */ if (localJCExpression.hasTag(JCTree.Tag.APPLY)) { /* 599 */ JCTree.JCMethodInvocation localJCMethodInvocation = (JCTree.JCMethodInvocation)localJCExpression; /* 600 */ Symbol localSymbol = TreeInfo.symbol(localJCMethodInvocation.meth); /* 601 */ if ((localSymbol != null) && (localSymbol.kind == 16)); /* 603 */ bool = (localSymbol /* 603 */ .flags() & 0x0) != 0L; /* */ } /* 605 */ return bool; /* */ } /* */ /* */ private boolean checkExtends(Type paramType1, Type paramType2) /* */ { /* 618 */ if (paramType1.isUnbound()) /* 619 */ return true; /* 620 */ if (!paramType1.hasTag(TypeTag.WILDCARD)) { /* 621 */ paramType1 = this.types.cvarUpperBound(paramType1); /* 622 */ return this.types.isSubtype(paramType1, paramType2); /* 623 */ }if (paramType1.isExtendsBound()) /* 624 */ return this.types.isCastable(paramType2, this.types.wildUpperBound(paramType1), this.types.noWarnings); /* 625 */ if (paramType1.isSuperBound()) { /* 626 */ return !this.types.notSoftSubtype(this.types.wildLowerBound(paramType1), paramType2); /* */ } /* 628 */ return true; /* */ } /* */ /* */ Type checkNonVoid(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 636 */ if (paramType.hasTag(TypeTag.VOID)) { /* 637 */ this.log.error(paramDiagnosticPosition, "void.not.allowed.here", new Object[0]); /* 638 */ return this.types.createErrorType(paramType); /* */ } /* 640 */ return paramType; /* */ } /* */ /* */ Type checkClassOrArrayType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 645 */ if ((!paramType.hasTag(TypeTag.CLASS)) && (!paramType.hasTag(TypeTag.ARRAY)) && (!paramType.hasTag(TypeTag.ERROR))) { /* 646 */ return typeTagError(paramDiagnosticPosition, this.diags /* 647 */ .fragment("type.req.class.array", new Object[0]), /* 648 */ asTypeParam(paramType)); /* */ } /* */ /* 650 */ return paramType; /* */ } /* */ /* */ Type checkClassType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 659 */ if ((!paramType.hasTag(TypeTag.CLASS)) && (!paramType.hasTag(TypeTag.ERROR))) { /* 660 */ return typeTagError(paramDiagnosticPosition, this.diags /* 661 */ .fragment("type.req.class", new Object[0]), /* 662 */ asTypeParam(paramType)); /* */ } /* */ /* 664 */ return paramType; /* */ } /* */ /* */ private Object asTypeParam(Type paramType) /* */ { /* 670 */ return paramType.hasTag(TypeTag.TYPEVAR) ? this.diags /* 670 */ .fragment("type.parameter", new Object[] { paramType }) : /* 670 */ paramType; /* */ } /* */ /* */ Type checkConstructorRefType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 677 */ paramType = checkClassOrArrayType(paramDiagnosticPosition, paramType); /* 678 */ if (paramType.hasTag(TypeTag.CLASS)) { /* 679 */ if ((paramType.tsym.flags() & 0x600) != 0L) { /* 680 */ this.log.error(paramDiagnosticPosition, "abstract.cant.be.instantiated", new Object[] { paramType.tsym }); /* 681 */ paramType = this.types.createErrorType(paramType); /* 682 */ } else if ((paramType.tsym.flags() & 0x4000) != 0L) { /* 683 */ this.log.error(paramDiagnosticPosition, "enum.cant.be.instantiated", new Object[0]); /* 684 */ paramType = this.types.createErrorType(paramType); /* */ } else { /* 686 */ paramType = checkClassType(paramDiagnosticPosition, paramType, true); /* */ } /* 688 */ } else if ((paramType.hasTag(TypeTag.ARRAY)) && /* 689 */ (!this.types.isReifiable(((Type.ArrayType)paramType).elemtype))) { /* 690 */ this.log.error(paramDiagnosticPosition, "generic.array.creation", new Object[0]); /* 691 */ paramType = this.types.createErrorType(paramType); /* */ } /* */ /* 694 */ return paramType; /* */ } /* */ /* */ Type checkClassType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, boolean paramBoolean) /* */ { /* 703 */ paramType = checkClassType(paramDiagnosticPosition, paramType); /* 704 */ if ((paramBoolean) && (paramType.isParameterized())) { /* 705 */ List localList = paramType.getTypeArguments(); /* 706 */ while (localList.nonEmpty()) { /* 707 */ if (((Type)localList.head).hasTag(TypeTag.WILDCARD)) { /* 708 */ return typeTagError(paramDiagnosticPosition, this.diags /* 709 */ .fragment("type.req.exact", new Object[0]), /* 709 */ localList.head); /* */ } /* 711 */ localList = localList.tail; /* */ } /* */ } /* 714 */ return paramType; /* */ } /* */ /* */ Type checkRefType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 723 */ if (paramType.isReference()) { /* 724 */ return paramType; /* */ } /* 726 */ return typeTagError(paramDiagnosticPosition, this.diags /* 727 */ .fragment("type.req.ref", new Object[0]), /* 727 */ paramType); /* */ } /* */ /* */ List<Type> checkRefTypes(List<JCTree.JCExpression> paramList, List<Type> paramList1) /* */ { /* 737 */ Object localObject1 = paramList; /* 738 */ for (Object localObject2 = paramList1; ((List)localObject2).nonEmpty(); localObject2 = ((List)localObject2).tail) { /* 739 */ ((List)localObject2).head = checkRefType(((JCTree.JCExpression)((List)localObject1).head).pos(), (Type)((List)localObject2).head); /* 740 */ localObject1 = ((List)localObject1).tail; /* */ } /* 742 */ return paramList1; /* */ } /* */ /* */ Type checkNullOrRefType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 750 */ if ((paramType.isReference()) || (paramType.hasTag(TypeTag.BOT))) { /* 751 */ return paramType; /* */ } /* 753 */ return typeTagError(paramDiagnosticPosition, this.diags /* 754 */ .fragment("type.req.ref", new Object[0]), /* 754 */ paramType); /* */ } /* */ /* */ boolean checkDisjoint(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, long paramLong1, long paramLong2, long paramLong3) /* */ { /* 766 */ if (((paramLong1 & paramLong2) != 0L) && ((paramLong1 & paramLong3) != 0L)) { /* 767 */ this.log.error(paramDiagnosticPosition, "illegal.combination.of.modifiers", new Object[] { /* 769 */ Flags.asFlagSet(TreeInfo.firstFlag(paramLong1 & paramLong2)), /* 770 */ Flags.asFlagSet(TreeInfo.firstFlag(paramLong1 & paramLong3)) }); /* */ /* 771 */ return false; /* */ } /* 773 */ return true; /* */ } /* */ /* */ Type checkDiamond(JCTree.JCNewClass paramJCNewClass, Type paramType) /* */ { /* 780 */ if ((!TreeInfo.isDiamond(paramJCNewClass)) || /* 781 */ (paramType /* 781 */ .isErroneous())) /* 782 */ return checkClassType(paramJCNewClass.clazz.pos(), paramType, true); /* 783 */ if (paramJCNewClass.def != null) { /* 784 */ this.log.error(paramJCNewClass.clazz.pos(), "cant.apply.diamond.1", new Object[] { paramType, this.diags /* 786 */ .fragment("diamond.and.anon.class", new Object[] { paramType }) }); /* */ /* 787 */ return this.types.createErrorType(paramType); /* 788 */ }if (paramType.tsym.type.getTypeArguments().isEmpty()) { /* 789 */ this.log.error(paramJCNewClass.clazz.pos(), "cant.apply.diamond.1", new Object[] { paramType, this.diags /* 791 */ .fragment("diamond.non.generic", new Object[] { paramType }) }); /* */ /* 792 */ return this.types.createErrorType(paramType); /* 793 */ }if ((paramJCNewClass.typeargs != null) && /* 794 */ (paramJCNewClass.typeargs /* 794 */ .nonEmpty())) { /* 795 */ this.log.error(paramJCNewClass.clazz.pos(), "cant.apply.diamond.1", new Object[] { paramType, this.diags /* 797 */ .fragment("diamond.and.explicit.params", new Object[] { paramType }) }); /* */ /* 798 */ return this.types.createErrorType(paramType); /* */ } /* 800 */ return paramType; /* */ } /* */ /* */ void checkVarargsMethodDecl(Env<AttrContext> paramEnv, JCTree.JCMethodDecl paramJCMethodDecl) /* */ { /* 805 */ Symbol.MethodSymbol localMethodSymbol = paramJCMethodDecl.sym; /* 806 */ if (!this.allowSimplifiedVarargs) return; /* 807 */ int i = localMethodSymbol.attribute(this.syms.trustMeType.tsym) != null ? 1 : 0; /* 808 */ Type localType = null; /* 809 */ if (localMethodSymbol.isVarArgs()) { /* 810 */ localType = this.types.elemtype(((JCTree.JCVariableDecl)paramJCMethodDecl.params.last()).type); /* */ } /* 812 */ if ((i != 0) && (!isTrustMeAllowedOnMethod(localMethodSymbol))) { /* 813 */ if (localType != null) { /* 814 */ this.log.error(paramJCMethodDecl, "varargs.invalid.trustme.anno", new Object[] { this.syms.trustMeType.tsym, this.diags /* 817 */ .fragment("varargs.trustme.on.virtual.varargs", new Object[] { localMethodSymbol }) }); /* */ } /* */ else /* */ { /* 819 */ this.log.error(paramJCMethodDecl, "varargs.invalid.trustme.anno", new Object[] { this.syms.trustMeType.tsym, this.diags /* 822 */ .fragment("varargs.trustme.on.non.varargs.meth", new Object[] { localMethodSymbol }) }); /* */ } /* */ /* */ } /* 824 */ else if ((i != 0) && (localType != null) && /* 825 */ (this.types /* 825 */ .isReifiable(localType))) /* */ { /* 826 */ warnUnsafeVararg(paramJCMethodDecl, "varargs.redundant.trustme.anno", new Object[] { this.syms.trustMeType.tsym, this.diags /* 829 */ .fragment("varargs.trustme.on.reifiable.varargs", new Object[] { localType }) }); /* */ } /* 831 */ else if ((i == 0) && (localType != null) && /* 832 */ (!this.types /* 832 */ .isReifiable(localType))) /* */ { /* 833 */ warnUnchecked(((JCTree.JCVariableDecl)paramJCMethodDecl.params.head).pos(), "unchecked.varargs.non.reifiable.type", new Object[] { localType }); /* */ } /* */ } /* */ /* */ private boolean isTrustMeAllowedOnMethod(Symbol paramSymbol) /* */ { /* 840 */ return ((paramSymbol.flags() & 0x0) != 0L) && ( /* 839 */ (paramSymbol /* 839 */ .isConstructor()) || /* 840 */ ((paramSymbol /* 840 */ .flags() & 0x18) != 0L)); /* */ } /* */ /* */ Type checkMethod(final Type paramType, final Symbol paramSymbol, final Env<AttrContext> paramEnv, final List<JCTree.JCExpression> paramList, final List<Type> paramList1, final boolean paramBoolean, Infer.InferenceContext paramInferenceContext) /* */ { /* 853 */ if (paramInferenceContext.free(paramType)) { /* 854 */ paramInferenceContext.addFreeTypeListener(List.of(paramType), new Infer.FreeTypeListener() { /* */ public void typesInferred(Infer.InferenceContext paramAnonymousInferenceContext) { /* 856 */ Check.this.checkMethod(paramAnonymousInferenceContext.asInstType(paramType), paramSymbol, paramEnv, paramList, paramList1, paramBoolean, paramAnonymousInferenceContext); /* */ } /* */ }); /* 859 */ return paramType; /* */ } /* 861 */ Type localType1 = paramType; /* 862 */ List localList1 = localType1.getParameterTypes(); /* 863 */ List localList2 = paramSymbol.type.getParameterTypes(); /* 864 */ if (localList2.length() != localList1.length()) localList2 = localList1; /* 865 */ Type localType2 = paramBoolean ? (Type)localList1.last() : null; /* 866 */ if ((paramSymbol.name == this.names.init) && (paramSymbol.owner == this.syms.enumSym)) { /* 867 */ localList1 = localList1.tail.tail; /* 868 */ localList2 = localList2.tail.tail; /* */ } /* 870 */ Object localObject1 = paramList; /* 871 */ if (localObject1 != null) /* */ { /* */ Object localObject3; /* 873 */ while (localList1.head != localType2) { /* 874 */ localObject2 = (JCTree)((List)localObject1).head; /* 875 */ localObject3 = convertWarner(((JCTree)localObject2).pos(), ((JCTree)localObject2).type, (Type)localList2.head); /* 876 */ assertConvertible((JCTree)localObject2, ((JCTree)localObject2).type, (Type)localList1.head, (Warner)localObject3); /* 877 */ localObject1 = ((List)localObject1).tail; /* 878 */ localList1 = localList1.tail; /* 879 */ localList2 = localList2.tail; /* */ } /* 881 */ if (paramBoolean) { /* 882 */ localObject2 = this.types.elemtype(localType2); /* 883 */ while (((List)localObject1).tail != null) { /* 884 */ localObject3 = (JCTree)((List)localObject1).head; /* 885 */ Warner localWarner = convertWarner(((JCTree)localObject3).pos(), ((JCTree)localObject3).type, (Type)localObject2); /* 886 */ assertConvertible((JCTree)localObject3, ((JCTree)localObject3).type, (Type)localObject2, localWarner); /* 887 */ localObject1 = ((List)localObject1).tail; /* */ } /* 889 */ } else if (((paramSymbol.flags() & 0x0) == 17179869184L) && (this.allowVarargs)) /* */ { /* 892 */ localObject2 = (Type)localType1.getParameterTypes().last(); /* 893 */ localObject3 = (Type)paramList1.last(); /* 894 */ if ((this.types.isSubtypeUnchecked((Type)localObject3, this.types.elemtype((Type)localObject2))) && /* 895 */ (!this.types /* 895 */ .isSameType(this.types /* 895 */ .erasure((Type)localObject2), /* 895 */ this.types.erasure((Type)localObject3)))) /* 896 */ this.log.warning(((JCTree.JCExpression)paramList.last()).pos(), "inexact.non-varargs.call", new Object[] { this.types /* 897 */ .elemtype((Type)localObject2), /* 897 */ localObject2 }); /* */ } /* */ } /* 900 */ if (paramBoolean) { /* 901 */ localObject2 = (Type)localType1.getParameterTypes().last(); /* 902 */ if ((!this.types.isReifiable((Type)localObject2)) && ((!this.allowSimplifiedVarargs) || /* 904 */ (paramSymbol /* 904 */ .attribute(this.syms.trustMeType.tsym) == null) || /* 905 */ (!isTrustMeAllowedOnMethod(paramSymbol)))) /* */ { /* 906 */ warnUnchecked(paramEnv.tree.pos(), "unchecked.generic.array.creation", new Object[] { localObject2 }); /* */ } /* */ /* 910 */ if ((paramSymbol.baseSymbol().flags() & 0x0) == 0L) { /* 911 */ TreeInfo.setVarargsElement(paramEnv.tree, this.types.elemtype((Type)localObject2)); /* */ } /* */ } /* */ /* 915 */ Object localObject2 = (paramSymbol.type.hasTag(TypeTag.FORALL)) && /* 915 */ (paramSymbol.type /* 915 */ .getReturnType().containsAny(((Type.ForAll)paramSymbol.type).tvars)) ? JCTree.JCPolyExpression.PolyKind.POLY : JCTree.JCPolyExpression.PolyKind.STANDALONE; /* */ /* 917 */ TreeInfo.setPolyKind(paramEnv.tree, (JCTree.JCPolyExpression.PolyKind)localObject2); /* 918 */ return localType1; /* */ } /* */ /* */ private void assertConvertible(JCTree paramJCTree, Type paramType1, Type paramType2, Warner paramWarner) { /* 922 */ if (this.types.isConvertible(paramType1, paramType2, paramWarner)) { /* 923 */ return; /* */ } /* 925 */ if ((paramType2.isCompound()) && /* 926 */ (this.types /* 926 */ .isSubtype(paramType1, this.types /* 926 */ .supertype(paramType2))) && /* 927 */ (this.types /* 927 */ .isSubtypeUnchecked(paramType1, this.types /* 927 */ .interfaces(paramType2), /* 927 */ paramWarner))); /* */ } /* */ /* */ public boolean checkValidGenericType(Type paramType) /* */ { /* 939 */ return firstIncompatibleTypeArg(paramType) == null; /* */ } /* */ /* */ private Type firstIncompatibleTypeArg(Type paramType) { /* 943 */ List localList1 = paramType.tsym.type.allparams(); /* 944 */ List localList2 = paramType.allparams(); /* 945 */ List localList3 = paramType.getTypeArguments(); /* 946 */ List localList4 = paramType.tsym.type.getTypeArguments(); /* 947 */ ListBuffer localListBuffer = new ListBuffer(); /* */ /* 951 */ while ((localList3.nonEmpty()) && (localList4.nonEmpty())) /* */ { /* 956 */ localListBuffer.append(this.types.subst(((Type)localList4.head).getUpperBound(), localList1, localList2)); /* 957 */ localList3 = localList3.tail; /* 958 */ localList4 = localList4.tail; /* */ } /* */ /* 961 */ localList3 = paramType.getTypeArguments(); /* 962 */ List localList5 = this.types.substBounds(localList1, localList1, this.types /* 964 */ .capture(paramType) /* 964 */ .allparams()); /* 965 */ while ((localList3.nonEmpty()) && (localList5.nonEmpty())) /* */ { /* 967 */ ((Type)localList3.head).withTypeVar((Type.TypeVar)localList5.head); /* 968 */ localList3 = localList3.tail; /* 969 */ localList5 = localList5.tail; /* */ } /* */ /* 972 */ localList3 = paramType.getTypeArguments(); /* 973 */ List localList6 = localListBuffer.toList(); /* */ /* 975 */ while ((localList3.nonEmpty()) && (localList6.nonEmpty())) { /* 976 */ localObject = (Type)localList3.head; /* 977 */ if ((!isTypeArgErroneous((Type)localObject)) && /* 978 */ (!((Type)localList6.head) /* 978 */ .isErroneous()) && /* 979 */ (!checkExtends((Type)localObject, (Type)localList6.head))) /* */ { /* 980 */ return (Type)localList3.head; /* */ } /* 982 */ localList3 = localList3.tail; /* 983 */ localList6 = localList6.tail; /* */ } /* */ /* 986 */ localList3 = paramType.getTypeArguments(); /* 987 */ localList6 = localListBuffer.toList(); /* */ /* 989 */ for (Object localObject = this.types.capture(paramType).getTypeArguments().iterator(); ((Iterator)localObject).hasNext(); ) { Type localType = (Type)((Iterator)localObject).next(); /* 990 */ if ((localType.hasTag(TypeTag.TYPEVAR)) && /* 991 */ (localType /* 991 */ .getUpperBound().isErroneous()) && /* 992 */ (!((Type)localList6.head) /* 992 */ .isErroneous()) && /* 993 */ (!isTypeArgErroneous((Type)localList3.head))) /* */ { /* 994 */ return (Type)localList3.head; /* */ } /* 996 */ localList6 = localList6.tail; /* 997 */ localList3 = localList3.tail; /* */ } /* */ /* 1000 */ return null; /* */ } /* */ /* */ boolean isTypeArgErroneous(Type paramType) { /* 1004 */ return ((Boolean)this.isTypeArgErroneous.visit(paramType)).booleanValue(); /* */ } /* */ /* */ long checkFlags(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, long paramLong, Symbol paramSymbol, JCTree paramJCTree) /* */ { /* 1037 */ long l2 = 0L; /* */ long l1; /* 1039 */ switch (paramSymbol.kind) { /* */ case 4: /* 1041 */ if (TreeInfo.isReceiverParam(paramJCTree)) /* 1042 */ l1 = 8589934592L; /* 1043 */ else if (paramSymbol.owner.kind != 2) /* 1044 */ l1 = 8589934608L; /* 1045 */ else if ((paramSymbol.owner.flags_field & 0x200) != 0L) /* 1046 */ l1 = l2 = 25L; /* */ else /* 1048 */ l1 = 16607L; /* 1049 */ break; /* */ case 16: /* 1051 */ if (paramSymbol.name == this.names.init) { /* 1052 */ if ((paramSymbol.owner.flags_field & 0x4000) != 0L) /* */ { /* 1056 */ l2 = 2L; /* 1057 */ l1 = 2L; /* */ } else { /* 1059 */ l1 = 7L; /* */ } } else if ((paramSymbol.owner.flags_field & 0x200) != 0L) { /* 1061 */ if ((paramSymbol.owner.flags_field & 0x2000) != 0L) { /* 1062 */ l1 = 1025L; /* 1063 */ l2 = 1025L; /* 1064 */ } else if ((paramLong & 0x8) != 0L) { /* 1065 */ l1 = 8796093025289L; /* 1066 */ l2 = 1L; /* 1067 */ if ((paramLong & 0x0) != 0L) /* 1068 */ l2 |= 1024L; /* */ } /* */ else { /* 1071 */ l1 = l2 = 1025L; /* */ } /* */ } /* 1074 */ else l1 = 3391L; /* */ /* 1077 */ if ((((paramLong | l2) & 0x400) == 0L) || ((paramLong & 0x0) != 0L)) /* */ { /* 1079 */ l2 |= paramSymbol.owner.flags_field & 0x800; } break; /* */ case 2: /* 1082 */ if (paramSymbol.isLocal()) { /* 1083 */ l1 = 23568L; /* 1084 */ if (paramSymbol.name.isEmpty()) /* */ { /* 1087 */ l1 |= 8L; /* */ /* 1089 */ l2 |= 16L; /* */ } /* 1091 */ if (((paramSymbol.owner.flags_field & 0x8) == 0L) && ((paramLong & 0x4000) != 0L)) /* */ { /* 1093 */ this.log.error(paramDiagnosticPosition, "enums.must.be.static", new Object[0]); /* */ } } else if (paramSymbol.owner.kind == 2) { /* 1095 */ l1 = 24087L; /* 1096 */ if ((paramSymbol.owner.owner.kind == 1) || ((paramSymbol.owner.flags_field & 0x8) != 0L)) /* */ { /* 1098 */ l1 |= 8L; /* 1099 */ } else if ((paramLong & 0x4000) != 0L) { /* 1100 */ this.log.error(paramDiagnosticPosition, "enums.must.be.static", new Object[0]); /* */ } /* 1102 */ if ((paramLong & 0x4200) != 0L) l2 = 8L; /* */ } /* 1104 */ else { l1 = 32273L; } /* */ /* */ /* 1107 */ if ((paramLong & 0x200) != 0L) l2 |= 1024L; /* */ /* 1109 */ if ((paramLong & 0x4000) != 0L) /* */ { /* 1111 */ l1 &= -1041L; /* 1112 */ l2 |= implicitEnumFinalFlag(paramJCTree); /* */ } /* */ /* 1115 */ l2 |= paramSymbol.owner.flags_field & 0x800; /* 1116 */ break; /* */ default: /* 1118 */ throw new AssertionError(); /* */ } /* 1120 */ long l3 = paramLong & 0xFFF & (l1 ^ 0xFFFFFFFF); /* 1121 */ if (l3 != 0L) { /* 1122 */ if ((l3 & 0x200) != 0L) { /* 1123 */ this.log.error(paramDiagnosticPosition, "intf.not.allowed.here", new Object[0]); /* 1124 */ l1 |= 512L; /* */ } /* */ else { /* 1127 */ this.log.error(paramDiagnosticPosition, "mod.not.allowed.here", new Object[] { /* 1128 */ Flags.asFlagSet(l3) }); /* */ } /* */ /* */ } /* 1131 */ else if ((paramSymbol.kind == 2) || /* 1134 */ (checkDisjoint(paramDiagnosticPosition, paramLong, 1024L, 8796093022218L))) /* */ { /* 1138 */ if (checkDisjoint(paramDiagnosticPosition, paramLong, 8L, 8796093022208L)) /* */ { /* 1142 */ if (checkDisjoint(paramDiagnosticPosition, paramLong, 1536L, 304L)) /* */ { /* 1146 */ if (checkDisjoint(paramDiagnosticPosition, paramLong, 1L, 6L)) /* */ { /* 1150 */ if (checkDisjoint(paramDiagnosticPosition, paramLong, 2L, 5L)) /* */ { /* 1154 */ if ((checkDisjoint(paramDiagnosticPosition, paramLong, 16L, 64L)) && /* 1154 */ (paramSymbol.kind != 2)) /* */ { /* 1159 */ if (!checkDisjoint(paramDiagnosticPosition, paramLong, 1280L, 2048L)); /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* */ /* 1164 */ return paramLong & (l1 | 0xFFFFF000) | l2; /* */ } /* */ /* */ private long implicitEnumFinalFlag(JCTree paramJCTree) /* */ { /* 1176 */ if (!paramJCTree.hasTag(JCTree.Tag.CLASSDEF)) return 0L; /* */ /* 1197 */ JCTree.Visitor local1SpecialTreeVisitor = new JCTree.Visitor() /* */ { /* */ boolean specialized; /* */ /* */ public void visitTree(JCTree paramAnonymousJCTree) /* */ { /* */ } /* */ /* */ public void visitVarDef(JCTree.JCVariableDecl paramAnonymousJCVariableDecl) /* */ { /* 1188 */ if (((paramAnonymousJCVariableDecl.mods.flags & 0x4000) != 0L) && /* 1189 */ ((paramAnonymousJCVariableDecl.init instanceof JCTree.JCNewClass)) && (((JCTree.JCNewClass)paramAnonymousJCVariableDecl.init).def != null)) /* */ { /* 1191 */ this.specialized = true; /* */ } /* */ } /* */ }; /* 1198 */ JCTree.JCClassDecl localJCClassDecl = (JCTree.JCClassDecl)paramJCTree; /* 1199 */ for (JCTree localJCTree : localJCClassDecl.defs) { /* 1200 */ localJCTree.accept(local1SpecialTreeVisitor); /* 1201 */ if (local1SpecialTreeVisitor.specialized) return 0L; /* */ } /* 1203 */ return 16L; /* */ } /* */ /* */ void validate(JCTree paramJCTree, Env<AttrContext> paramEnv) /* */ { /* 1227 */ validate(paramJCTree, paramEnv, true); /* */ } /* */ void validate(JCTree paramJCTree, Env<AttrContext> paramEnv, boolean paramBoolean) { /* 1230 */ new Validator(paramEnv).validateTree(paramJCTree, paramBoolean, true); /* */ } /* */ /* */ void validate(List<? extends JCTree> paramList, Env<AttrContext> paramEnv) /* */ { /* 1236 */ for (Object localObject = paramList; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1237 */ validate((JCTree)((List)localObject).head, paramEnv); /* */ } /* */ /* */ void checkRaw(JCTree paramJCTree, Env<AttrContext> paramEnv) /* */ { /* 1377 */ if ((this.lint.isEnabled(Lint.LintCategory.RAW)) && /* 1378 */ (paramJCTree.type /* 1378 */ .hasTag(TypeTag.CLASS)) && /* 1379 */ (!TreeInfo.isDiamond(paramJCTree)) && /* 1380 */ (!withinAnonConstr(paramEnv)) && /* 1381 */ (paramJCTree.type /* 1381 */ .isRaw())) /* 1382 */ this.log.warning(Lint.LintCategory.RAW, paramJCTree /* 1383 */ .pos(), "raw.class.use", new Object[] { paramJCTree.type, paramJCTree.type.tsym.type }); /* */ } /* */ /* */ private boolean withinAnonConstr(Env<AttrContext> paramEnv) /* */ { /* 1388 */ return (paramEnv.enclClass.name.isEmpty()) && (paramEnv.enclMethod != null) && (paramEnv.enclMethod.name == this.names.init); /* */ } /* */ /* */ boolean subset(Type paramType, List<Type> paramList) /* */ { /* 1403 */ for (Object localObject = paramList; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1404 */ if (this.types.isSubtype(paramType, (Type)((List)localObject).head)) return true; /* 1405 */ return false; /* */ } /* */ /* */ boolean intersects(Type paramType, List<Type> paramList) /* */ { /* 1412 */ for (Object localObject = paramList; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1413 */ if ((this.types.isSubtype(paramType, (Type)((List)localObject).head)) || (this.types.isSubtype((Type)((List)localObject).head, paramType))) return true; /* 1414 */ return false; /* */ } /* */ /* */ List<Type> incl(Type paramType, List<Type> paramList) /* */ { /* 1421 */ return subset(paramType, paramList) ? paramList : excl(paramType, paramList).prepend(paramType); /* */ } /* */ /* */ List<Type> excl(Type paramType, List<Type> paramList) /* */ { /* 1427 */ if (paramList.isEmpty()) { /* 1428 */ return paramList; /* */ } /* 1430 */ List localList = excl(paramType, paramList.tail); /* 1431 */ if (this.types.isSubtype((Type)paramList.head, paramType)) return localList; /* 1432 */ if (localList == paramList.tail) return paramList; /* 1433 */ return localList.prepend(paramList.head); /* */ } /* */ /* */ List<Type> union(List<Type> paramList1, List<Type> paramList2) /* */ { /* 1440 */ Object localObject1 = paramList1; /* 1441 */ for (Object localObject2 = paramList2; ((List)localObject2).nonEmpty(); localObject2 = ((List)localObject2).tail) /* 1442 */ localObject1 = incl((Type)((List)localObject2).head, (List)localObject1); /* 1443 */ return localObject1; /* */ } /* */ /* */ List<Type> diff(List<Type> paramList1, List<Type> paramList2) /* */ { /* 1449 */ Object localObject1 = paramList1; /* 1450 */ for (Object localObject2 = paramList2; ((List)localObject2).nonEmpty(); localObject2 = ((List)localObject2).tail) /* 1451 */ localObject1 = excl((Type)((List)localObject2).head, (List)localObject1); /* 1452 */ return localObject1; /* */ } /* */ /* */ public List<Type> intersect(List<Type> paramList1, List<Type> paramList2) /* */ { /* 1458 */ List localList = List.nil(); /* 1459 */ for (Object localObject = paramList1; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1460 */ if (subset((Type)((List)localObject).head, paramList2)) localList = incl((Type)((List)localObject).head, localList); /* 1461 */ for (localObject = paramList2; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1462 */ if (subset((Type)((List)localObject).head, paramList1)) localList = incl((Type)((List)localObject).head, localList); /* 1463 */ return localList; /* */ } /* */ /* */ boolean isUnchecked(Symbol.ClassSymbol paramClassSymbol) /* */ { /* 1472 */ return (paramClassSymbol.kind == 63) || /* 1471 */ (paramClassSymbol /* 1471 */ .isSubClass(this.syms.errorType.tsym, this.types)) || /* 1472 */ (paramClassSymbol /* 1472 */ .isSubClass(this.syms.runtimeExceptionType.tsym, this.types)); /* */ } /* */ /* */ boolean isUnchecked(Type paramType) /* */ { /* 1481 */ return paramType /* 1480 */ .hasTag(TypeTag.CLASS) ? /* 1480 */ isUnchecked((Symbol.ClassSymbol)paramType.tsym) : paramType /* 1479 */ .hasTag(TypeTag.TYPEVAR) ? /* 1479 */ isUnchecked(this.types.supertype(paramType)) : /* 1480 */ paramType /* 1481 */ .hasTag(TypeTag.BOT); /* */ } /* */ /* */ boolean isUnchecked(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* */ try /* */ { /* 1488 */ return isUnchecked(paramType); /* */ } catch (Symbol.CompletionFailure localCompletionFailure) { /* 1490 */ completionError(paramDiagnosticPosition, localCompletionFailure); /* 1491 */ }return true; /* */ } /* */ /* */ boolean isHandled(Type paramType, List<Type> paramList) /* */ { /* 1498 */ return (isUnchecked(paramType)) || (subset(paramType, paramList)); /* */ } /* */ /* */ List<Type> unhandled(List<Type> paramList1, List<Type> paramList2) /* */ { /* 1506 */ List localList = List.nil(); /* 1507 */ for (Object localObject = paramList1; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1508 */ if (!isHandled((Type)((List)localObject).head, paramList2)) localList = localList.prepend(((List)localObject).head); /* 1509 */ return localList; /* */ } /* */ /* */ static int protection(long paramLong) /* */ { /* 1520 */ switch ((short)(int)(paramLong & 0x7)) { case 2: /* 1521 */ return 3; /* */ case 4: /* 1522 */ return 1; /* */ case 1: /* */ case 3: /* */ default: /* 1524 */ return 0; /* 1525 */ case 0: } return 2; /* */ } /* */ /* */ Object cannotOverride(Symbol.MethodSymbol paramMethodSymbol1, Symbol.MethodSymbol paramMethodSymbol2) /* */ { /* */ String str; /* 1536 */ if ((paramMethodSymbol2.owner.flags() & 0x200) == 0L) /* 1537 */ str = "cant.override"; /* 1538 */ else if ((paramMethodSymbol1.owner.flags() & 0x200) == 0L) /* 1539 */ str = "cant.implement"; /* */ else /* 1541 */ str = "clashes.with"; /* 1542 */ return this.diags.fragment(str, new Object[] { paramMethodSymbol1, paramMethodSymbol1.location(), paramMethodSymbol2, paramMethodSymbol2.location() }); /* */ } /* */ /* */ Object uncheckedOverrides(Symbol.MethodSymbol paramMethodSymbol1, Symbol.MethodSymbol paramMethodSymbol2) /* */ { /* */ String str; /* 1552 */ if ((paramMethodSymbol2.owner.flags() & 0x200) == 0L) /* 1553 */ str = "unchecked.override"; /* 1554 */ else if ((paramMethodSymbol1.owner.flags() & 0x200) == 0L) /* 1555 */ str = "unchecked.implement"; /* */ else /* 1557 */ str = "unchecked.clash.with"; /* 1558 */ return this.diags.fragment(str, new Object[] { paramMethodSymbol1, paramMethodSymbol1.location(), paramMethodSymbol2, paramMethodSymbol2.location() }); /* */ } /* */ /* */ Object varargsOverrides(Symbol.MethodSymbol paramMethodSymbol1, Symbol.MethodSymbol paramMethodSymbol2) /* */ { /* */ String str; /* 1568 */ if ((paramMethodSymbol2.owner.flags() & 0x200) == 0L) /* 1569 */ str = "varargs.override"; /* 1570 */ else if ((paramMethodSymbol1.owner.flags() & 0x200) == 0L) /* 1571 */ str = "varargs.implement"; /* */ else /* 1573 */ str = "varargs.clash.with"; /* 1574 */ return this.diags.fragment(str, new Object[] { paramMethodSymbol1, paramMethodSymbol1.location(), paramMethodSymbol2, paramMethodSymbol2.location() }); /* */ } /* */ /* */ void checkOverride(JCTree paramJCTree, Symbol.MethodSymbol paramMethodSymbol1, Symbol.MethodSymbol paramMethodSymbol2, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 1603 */ if (((paramMethodSymbol1.flags() & 0x80001000) != 0L) || ((paramMethodSymbol2.flags() & 0x1000) != 0L)) { /* 1604 */ return; /* */ } /* */ /* 1608 */ if (((paramMethodSymbol1.flags() & 0x8) != 0L) && /* 1609 */ ((paramMethodSymbol2 /* 1609 */ .flags() & 0x8) == 0L)) { /* 1610 */ this.log.error(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.static", new Object[] { /* 1611 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2) }); /* */ /* 1612 */ paramMethodSymbol1.flags_field |= 35184372088832L; /* 1613 */ return; /* */ } /* */ /* 1618 */ if (((paramMethodSymbol2.flags() & 0x10) != 0L) || ( /* 1619 */ ((paramMethodSymbol1 /* 1619 */ .flags() & 0x8) == 0L) && /* 1620 */ ((paramMethodSymbol2 /* 1620 */ .flags() & 0x8) != 0L))) { /* 1621 */ this.log.error(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.meth", new Object[] { /* 1622 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2), /* 1623 */ Flags.asFlagSet(paramMethodSymbol2 /* 1623 */ .flags() & 0x18) }); /* 1624 */ paramMethodSymbol1.flags_field |= 35184372088832L; /* 1625 */ return; /* */ } /* */ /* 1628 */ if ((paramMethodSymbol1.owner.flags() & 0x2000) != 0L) /* */ { /* 1630 */ return; /* */ } /* */ /* 1634 */ if (((paramClassSymbol.flags() & 0x200) == 0L) && /* 1635 */ (protection(paramMethodSymbol1 /* 1635 */ .flags()) > protection(paramMethodSymbol2.flags()))) { /* 1636 */ this.log.error(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.weaker.access", new Object[] { /* 1637 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2), /* 1637 */ paramMethodSymbol2 /* 1638 */ .flags() == 0L ? "package" : /* 1640 */ Flags.asFlagSet(paramMethodSymbol2 /* 1640 */ .flags() & 0x7) }); /* 1641 */ paramMethodSymbol1.flags_field |= 35184372088832L; /* 1642 */ return; /* */ } /* */ /* 1645 */ Type localType1 = this.types.memberType(paramClassSymbol.type, paramMethodSymbol1); /* 1646 */ Type localType2 = this.types.memberType(paramClassSymbol.type, paramMethodSymbol2); /* */ /* 1651 */ List localList1 = localType1.getTypeArguments(); /* 1652 */ List localList2 = localType2.getTypeArguments(); /* 1653 */ Type localType3 = localType1.getReturnType(); /* 1654 */ Type localType4 = this.types.subst(localType2.getReturnType(), localList2, localList1); /* */ /* 1656 */ this.overrideWarner.clear(); /* */ /* 1658 */ boolean bool = this.types /* 1658 */ .returnTypeSubstitutable(localType1, localType2, localType4, this.overrideWarner); /* */ /* 1659 */ if (!bool) { /* 1660 */ if ((this.allowCovariantReturns) || (paramMethodSymbol1.owner == paramClassSymbol) || /* 1662 */ (!paramMethodSymbol1.owner /* 1662 */ .isSubClass(paramMethodSymbol2.owner, this.types))) /* */ { /* 1665 */ this.log.error(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.incompatible.ret", new Object[] { /* 1667 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2), /* 1667 */ localType3, localType4 }); /* */ /* 1669 */ paramMethodSymbol1.flags_field |= 35184372088832L; /* */ } /* */ } /* 1672 */ else if (this.overrideWarner.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) { /* 1673 */ warnUnchecked(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.unchecked.ret", new Object[] { /* 1675 */ uncheckedOverrides(paramMethodSymbol1, paramMethodSymbol2), /* 1675 */ localType3, localType4 }); /* */ } /* */ /* 1681 */ List localList3 = this.types.subst(localType2.getThrownTypes(), localList2, localList1); /* 1682 */ List localList4 = unhandled(localType1.getThrownTypes(), this.types.erasure(localList3)); /* 1683 */ List localList5 = unhandled(localType1.getThrownTypes(), localList3); /* 1684 */ if (localList4.nonEmpty()) { /* 1685 */ this.log.error(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.meth.doesnt.throw", new Object[] { /* 1687 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2), /* 1687 */ localList5.head }); /* */ /* 1689 */ paramMethodSymbol1.flags_field |= 35184372088832L; /* 1690 */ return; /* */ } /* 1692 */ if (localList5.nonEmpty()) { /* 1693 */ warnUnchecked(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.unchecked.thrown", new Object[] { /* 1695 */ cannotOverride(paramMethodSymbol1, paramMethodSymbol2), /* 1695 */ localList5.head }); /* */ /* 1697 */ return; /* */ } /* */ /* 1701 */ if ((((paramMethodSymbol1.flags() ^ paramMethodSymbol2.flags()) & 0x0) != 0L) && /* 1702 */ (this.lint /* 1702 */ .isEnabled(Lint.LintCategory.OVERRIDES))) /* */ { /* 1703 */ this.log.warning(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), /* 1704 */ (paramMethodSymbol1 /* 1704 */ .flags() & 0x0) != 0L ? "override.varargs.missing" : "override.varargs.extra", new Object[] { /* 1707 */ varargsOverrides(paramMethodSymbol1, paramMethodSymbol2) }); /* */ } /* */ /* 1711 */ if ((paramMethodSymbol2.flags() & 0x80000000) != 0L) { /* 1712 */ this.log.warning(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), "override.bridge", new Object[] { /* 1713 */ uncheckedOverrides(paramMethodSymbol1, paramMethodSymbol2) }); /* */ } /* */ /* 1717 */ if (!isDeprecatedOverrideIgnorable(paramMethodSymbol2, paramClassSymbol)) { /* 1718 */ Lint localLint = setLint(this.lint.augment(paramMethodSymbol1)); /* */ try { /* 1720 */ checkDeprecated(TreeInfo.diagnosticPositionFor(paramMethodSymbol1, paramJCTree), paramMethodSymbol1, paramMethodSymbol2); /* */ } finally { /* 1722 */ setLint(localLint); /* */ } /* */ } /* */ } /* */ /* */ private boolean isDeprecatedOverrideIgnorable(Symbol.MethodSymbol paramMethodSymbol, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 1735 */ Symbol.ClassSymbol localClassSymbol = paramMethodSymbol.enclClass(); /* 1736 */ Type localType = this.types.supertype(paramClassSymbol.type); /* 1737 */ if (!localType.hasTag(TypeTag.CLASS)) /* 1738 */ return true; /* 1739 */ Symbol.MethodSymbol localMethodSymbol = paramMethodSymbol.implementation((Symbol.ClassSymbol)localType.tsym, this.types, false); /* */ /* 1741 */ if ((localClassSymbol != null) && ((localClassSymbol.flags() & 0x200) != 0L)) { /* 1742 */ List localList = this.types.interfaces(paramClassSymbol.type); /* 1743 */ return !localList.contains(localClassSymbol.type); /* */ } /* */ /* 1746 */ return localMethodSymbol != paramMethodSymbol; /* */ } /* */ /* */ public void checkCompatibleConcretes(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 1759 */ Type localType1 = this.types.supertype(paramType); /* 1760 */ if (!localType1.hasTag(TypeTag.CLASS)) return; /* */ /* 1762 */ for (Type localType2 = localType1; /* 1763 */ (localType2.hasTag(TypeTag.CLASS)) && (localType2.tsym.type.isParameterized()); /* 1764 */ localType2 = this.types.supertype(localType2)) /* 1765 */ for (Scope.Entry localEntry1 = localType2.tsym.members().elems; /* 1766 */ localEntry1 != null; /* 1767 */ localEntry1 = localEntry1.sibling) { /* 1768 */ Symbol localSymbol1 = localEntry1.sym; /* 1769 */ if ((localSymbol1.kind == 16) && /* 1770 */ ((localSymbol1 /* 1770 */ .flags() & 0x80001008) == 0L) && /* 1771 */ (localSymbol1 /* 1771 */ .isInheritedIn(paramType.tsym, this.types)) && /* 1772 */ (((Symbol.MethodSymbol)localSymbol1) /* 1772 */ .implementation(paramType.tsym, this.types, true) == /* 1772 */ localSymbol1)) /* */ { /* 1776 */ Type localType3 = this.types.memberType(localType2, localSymbol1); /* 1777 */ int i = localType3.getParameterTypes().length(); /* 1778 */ if (localType3 != localSymbol1.type) /* */ { /* 1780 */ for (Type localType4 = localType1; /* 1781 */ localType4.hasTag(TypeTag.CLASS); /* 1782 */ localType4 = this.types.supertype(localType4)) /* 1783 */ for (Scope.Entry localEntry2 = localType4.tsym.members().lookup(localSymbol1.name); /* 1784 */ localEntry2.scope != null; /* 1785 */ localEntry2 = localEntry2.next()) { /* 1786 */ Symbol localSymbol2 = localEntry2.sym; /* 1787 */ if ((localSymbol2 != localSymbol1) && (localSymbol2.kind == 16)) /* */ { /* 1789 */ if (((localSymbol2 /* 1789 */ .flags() & 0x80001008) == 0L) && /* 1790 */ (localSymbol2.type /* 1790 */ .getParameterTypes().length() == i) && /* 1791 */ (localSymbol2 /* 1791 */ .isInheritedIn(paramType.tsym, this.types)) && /* 1792 */ (((Symbol.MethodSymbol)localSymbol2) /* 1792 */ .implementation(paramType.tsym, this.types, true) == /* 1792 */ localSymbol2)) /* */ { /* 1796 */ Type localType5 = this.types.memberType(localType4, localSymbol2); /* 1797 */ if (this.types.overrideEquivalent(localType3, localType5)) /* 1798 */ this.log.error(paramDiagnosticPosition, "concrete.inheritance.conflict", new Object[] { localSymbol1, localType2, localSymbol2, localType4, localType1 }); /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* */ } /* */ /* */ public boolean checkCompatibleAbstracts(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) /* */ { /* 1815 */ return checkCompatibleAbstracts(paramDiagnosticPosition, paramType1, paramType2, this.types /* 1816 */ .makeIntersectionType(paramType1, paramType2)); /* */ } /* */ /* */ public boolean checkCompatibleAbstracts(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2, Type paramType3) /* */ { /* 1823 */ if ((paramType3.tsym.flags() & 0x1000000) != 0L) /* */ { /* 1825 */ paramType1 = this.types.capture(paramType1); /* 1826 */ paramType2 = this.types.capture(paramType2); /* */ } /* 1828 */ return firstIncompatibility(paramDiagnosticPosition, paramType1, paramType2, paramType3) == null; /* */ } /* */ /* */ private Symbol firstIncompatibility(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2, Type paramType3) /* */ { /* 1840 */ HashMap localHashMap1 = new HashMap(); /* 1841 */ closure(paramType1, localHashMap1); /* */ HashMap localHashMap2; /* 1843 */ if (paramType1 == paramType2) /* 1844 */ localHashMap2 = localHashMap1; /* */ else { /* 1846 */ closure(paramType2, localHashMap1, localHashMap2 = new HashMap()); /* */ } /* 1848 */ for (Iterator localIterator1 = localHashMap1.values().iterator(); localIterator1.hasNext(); ) { localType1 = (Type)localIterator1.next(); /* 1849 */ for (Type localType2 : localHashMap2.values()) { /* 1850 */ Symbol localSymbol = firstDirectIncompatibility(paramDiagnosticPosition, localType1, localType2, paramType3); /* 1851 */ if (localSymbol != null) return localSymbol; /* */ } /* */ } /* */ Type localType1; /* 1854 */ return null; /* */ } /* */ /* */ private void closure(Type paramType, Map<Symbol.TypeSymbol, Type> paramMap) /* */ { /* 1859 */ if (!paramType.hasTag(TypeTag.CLASS)) return; /* 1860 */ if (paramMap.put(paramType.tsym, paramType) == null) { /* 1861 */ closure(this.types.supertype(paramType), paramMap); /* 1862 */ for (Type localType : this.types.interfaces(paramType)) /* 1863 */ closure(localType, paramMap); /* */ } /* */ } /* */ /* */ private void closure(Type paramType, Map<Symbol.TypeSymbol, Type> paramMap1, Map<Symbol.TypeSymbol, Type> paramMap2) /* */ { /* 1869 */ if (!paramType.hasTag(TypeTag.CLASS)) return; /* 1870 */ if (paramMap1.get(paramType.tsym) != null) return; /* 1871 */ if (paramMap2.put(paramType.tsym, paramType) == null) { /* 1872 */ closure(this.types.supertype(paramType), paramMap1, paramMap2); /* 1873 */ for (Type localType : this.types.interfaces(paramType)) /* 1874 */ closure(localType, paramMap1, paramMap2); /* */ } /* */ } /* */ /* */ private Symbol firstDirectIncompatibility(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2, Type paramType3) /* */ { /* 1880 */ for (Scope.Entry localEntry1 = paramType1.tsym.members().elems; localEntry1 != null; localEntry1 = localEntry1.sibling) { /* 1881 */ Symbol localSymbol1 = localEntry1.sym; /* 1882 */ Type localType1 = null; /* 1883 */ if ((localSymbol1.kind == 16) && (localSymbol1.isInheritedIn(paramType3.tsym, this.types)) && /* 1884 */ ((localSymbol1 /* 1884 */ .flags() & 0x1000) == 0L)) { /* 1885 */ Symbol.MethodSymbol localMethodSymbol = ((Symbol.MethodSymbol)localSymbol1).implementation(paramType3.tsym, this.types, false); /* 1886 */ if ((localMethodSymbol == null) || ((localMethodSymbol.flags() & 0x400) != 0L)) /* 1887 */ for (Scope.Entry localEntry2 = paramType2.tsym.members().lookup(localSymbol1.name); localEntry2.scope != null; localEntry2 = localEntry2.next()) { /* 1888 */ Symbol localSymbol2 = localEntry2.sym; /* 1889 */ if ((localSymbol1 != localSymbol2) && /* 1890 */ (localSymbol2.kind == 16) && (localSymbol2.isInheritedIn(paramType3.tsym, this.types)) && /* 1891 */ ((localSymbol2 /* 1891 */ .flags() & 0x1000) == 0L)) { /* 1892 */ if (localType1 == null) localType1 = this.types.memberType(paramType1, localSymbol1); /* 1893 */ Type localType2 = this.types.memberType(paramType2, localSymbol2); /* 1894 */ if (this.types.overrideEquivalent(localType1, localType2)) { /* 1895 */ List localList1 = localType1.getTypeArguments(); /* 1896 */ List localList2 = localType2.getTypeArguments(); /* 1897 */ Type localType3 = localType1.getReturnType(); /* 1898 */ Type localType4 = this.types.subst(localType2.getReturnType(), localList2, localList1); /* */ /* 1905 */ int i = (this.types /* 1900 */ .isSameType(localType3, localType4)) || /* 1901 */ ((!localType3 /* 1901 */ .isPrimitiveOrVoid()) && /* 1902 */ (!localType4 /* 1902 */ .isPrimitiveOrVoid()) && ( /* 1903 */ (this.types /* 1903 */ .covariantReturnType(localType3, localType4, this.types.noWarnings)) || /* 1904 */ (this.types /* 1904 */ .covariantReturnType(localType4, localType3, this.types.noWarnings)))) || /* 1905 */ (checkCommonOverriderIn(localSymbol1, localSymbol2, paramType3)) ? /* 1905 */ 1 : 0; /* 1906 */ if (i == 0) { /* 1907 */ this.log.error(paramDiagnosticPosition, "types.incompatible.diff.ret", new Object[] { paramType1, paramType2, localSymbol2.name + "(" + this.types /* 1909 */ .memberType(paramType2, localSymbol2) /* 1909 */ .getParameterTypes() + ")" }); /* 1910 */ return localSymbol2; /* */ } /* 1912 */ } else if ((checkNameClash((Symbol.ClassSymbol)paramType3.tsym, localSymbol1, localSymbol2)) && /* 1913 */ (!checkCommonOverriderIn(localSymbol1, localSymbol2, paramType3))) /* */ { /* 1914 */ this.log.error(paramDiagnosticPosition, "name.clash.same.erasure.no.override", new Object[] { localSymbol1, localSymbol1 /* 1916 */ .location(), localSymbol2, localSymbol2 /* 1917 */ .location() }); /* 1918 */ return localSymbol2; /* */ } /* */ } /* */ } /* */ } /* */ } /* 1922 */ return null; /* */ } /* */ /* */ boolean checkCommonOverriderIn(Symbol paramSymbol1, Symbol paramSymbol2, Type paramType) { /* 1926 */ HashMap localHashMap = new HashMap(); /* 1927 */ Type localType1 = this.types.memberType(paramType, paramSymbol1); /* 1928 */ Type localType2 = this.types.memberType(paramType, paramSymbol2); /* 1929 */ closure(paramType, localHashMap); /* 1930 */ for (Type localType3 : localHashMap.values()) /* 1931 */ for (Scope.Entry localEntry = localType3.tsym.members().lookup(paramSymbol1.name); localEntry.scope != null; localEntry = localEntry.next()) { /* 1932 */ Symbol localSymbol = localEntry.sym; /* 1933 */ if ((localSymbol != paramSymbol1) && (localSymbol != paramSymbol2) && (localSymbol.kind == 16) && ((localSymbol.flags() & 0x80001000) == 0L)) { /* 1934 */ Type localType4 = this.types.memberType(paramType, localSymbol); /* 1935 */ if ((this.types.overrideEquivalent(localType4, localType1)) && /* 1936 */ (this.types /* 1936 */ .overrideEquivalent(localType4, localType2)) && /* 1937 */ (this.types /* 1937 */ .returnTypeSubstitutable(localType4, localType1)) && /* 1938 */ (this.types /* 1938 */ .returnTypeSubstitutable(localType4, localType2))) /* */ { /* 1939 */ return true; /* */ } /* */ } /* */ } /* 1943 */ return false; /* */ } /* */ /* */ void checkOverride(JCTree.JCMethodDecl paramJCMethodDecl, Symbol.MethodSymbol paramMethodSymbol) /* */ { /* 1952 */ Symbol.ClassSymbol localClassSymbol = (Symbol.ClassSymbol)paramMethodSymbol.owner; /* 1953 */ if (((localClassSymbol.flags() & 0x4000) != 0L) && (this.names.finalize.equals(paramMethodSymbol.name)) && /* 1954 */ (paramMethodSymbol.overrides(this.syms.enumFinalFinalize, localClassSymbol, this.types, false))) { /* 1955 */ this.log.error(paramJCMethodDecl.pos(), "enum.no.finalize", new Object[0]); /* */ return; /* */ } /* */ Iterator localIterator; /* */ Object localObject2; /* 1958 */ for (Object localObject1 = localClassSymbol.type; ((Type)localObject1).hasTag(TypeTag.CLASS); /* 1959 */ localObject1 = this.types.supertype((Type)localObject1)) { /* 1960 */ if (localObject1 != localClassSymbol.type) { /* 1961 */ checkOverride(paramJCMethodDecl, (Type)localObject1, localClassSymbol, paramMethodSymbol); /* */ } /* 1963 */ for (localIterator = this.types.interfaces((Type)localObject1).iterator(); localIterator.hasNext(); ) { localObject2 = (Type)localIterator.next(); /* 1964 */ checkOverride(paramJCMethodDecl, (Type)localObject2, localClassSymbol, paramMethodSymbol); /* */ } /* */ } /* */ /* 1968 */ if ((paramMethodSymbol.attribute(this.syms.overrideType.tsym) != null) && (!isOverrider(paramMethodSymbol))) { /* 1969 */ localObject1 = paramJCMethodDecl.pos(); /* 1970 */ for (localIterator = paramJCMethodDecl.getModifiers().annotations.iterator(); localIterator.hasNext(); ) { localObject2 = (JCTree.JCAnnotation)localIterator.next(); /* 1971 */ if (((JCTree.JCAnnotation)localObject2).annotationType.type.tsym == this.syms.overrideType.tsym) { /* 1972 */ localObject1 = ((JCTree.JCAnnotation)localObject2).pos(); /* 1973 */ break; /* */ } /* */ } /* 1976 */ this.log.error((JCDiagnostic.DiagnosticPosition)localObject1, "method.does.not.override.superclass", new Object[0]); /* */ } /* */ } /* */ /* */ void checkOverride(JCTree paramJCTree, Type paramType, Symbol.ClassSymbol paramClassSymbol, Symbol.MethodSymbol paramMethodSymbol) { /* 1981 */ Symbol.TypeSymbol localTypeSymbol = paramType.tsym; /* 1982 */ Scope.Entry localEntry = localTypeSymbol.members().lookup(paramMethodSymbol.name); /* 1983 */ while (localEntry.scope != null) { /* 1984 */ if ((paramMethodSymbol.overrides(localEntry.sym, paramClassSymbol, this.types, false)) && /* 1985 */ ((localEntry.sym.flags() & 0x400) == 0L)) { /* 1986 */ checkOverride(paramJCTree, paramMethodSymbol, (Symbol.MethodSymbol)localEntry.sym, paramClassSymbol); /* */ } /* */ /* 1989 */ localEntry = localEntry.next(); /* */ } /* */ } /* */ /* */ public void checkClassOverrideEqualsAndHashIfNeeded(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 2007 */ if ((paramClassSymbol == (Symbol.ClassSymbol)this.syms.objectType.tsym) || /* 2008 */ (paramClassSymbol /* 2008 */ .isInterface()) || (paramClassSymbol.isEnum()) || /* 2009 */ ((paramClassSymbol /* 2009 */ .flags() & 0x2000) != 0L) || /* 2010 */ ((paramClassSymbol /* 2010 */ .flags() & 0x400) != 0L)) return; /* */ /* 2012 */ if (paramClassSymbol.isAnonymous()) { /* 2013 */ List localList = this.types.interfaces(paramClassSymbol.type); /* 2014 */ if ((localList != null) && (!localList.isEmpty()) && (((Type)localList.head).tsym == this.syms.comparatorType.tsym)) /* 2015 */ return; /* */ } /* 2017 */ checkClassOverrideEqualsAndHash(paramDiagnosticPosition, paramClassSymbol); /* */ } /* */ /* */ private void checkClassOverrideEqualsAndHash(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 2022 */ if (this.lint.isEnabled(Lint.LintCategory.OVERRIDES)) /* */ { /* 2024 */ Symbol.MethodSymbol localMethodSymbol1 = (Symbol.MethodSymbol)this.syms.objectType.tsym /* 2024 */ .members().lookup(this.names.equals).sym; /* */ /* 2026 */ Symbol.MethodSymbol localMethodSymbol2 = (Symbol.MethodSymbol)this.syms.objectType.tsym /* 2026 */ .members().lookup(this.names.hashCode).sym; /* 2027 */ int i = this.types.implementation(localMethodSymbol1, paramClassSymbol, false, this.equalsHasCodeFilter).owner == paramClassSymbol ? 1 : 0; /* */ /* 2029 */ int j = this.types.implementation(localMethodSymbol2, paramClassSymbol, false, this.equalsHasCodeFilter) != localMethodSymbol2 ? 1 : 0; /* */ /* 2032 */ if ((i != 0) && (j == 0)) /* 2033 */ this.log.warning(Lint.LintCategory.OVERRIDES, paramDiagnosticPosition, "override.equals.but.not.hashcode", new Object[] { paramClassSymbol }); /* */ } /* */ } /* */ /* */ private boolean checkNameClash(Symbol.ClassSymbol paramClassSymbol, Symbol paramSymbol1, Symbol paramSymbol2) /* */ { /* 2040 */ ClashFilter localClashFilter = new ClashFilter(paramClassSymbol.type); /* */ /* 2043 */ return (localClashFilter.accepts(paramSymbol1)) && /* 2042 */ (localClashFilter /* 2042 */ .accepts(paramSymbol2)) && /* 2043 */ (this.types /* 2043 */ .hasSameArgs(paramSymbol1 /* 2043 */ .erasure(this.types), /* 2043 */ paramSymbol2.erasure(this.types))); /* */ } /* */ /* */ void checkAllDefined(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 2052 */ Symbol.MethodSymbol localMethodSymbol1 = this.types.firstUnimplementedAbstract(paramClassSymbol); /* 2053 */ if (localMethodSymbol1 != null) /* */ { /* 2056 */ Symbol.MethodSymbol localMethodSymbol2 = new Symbol.MethodSymbol(localMethodSymbol1 /* 2055 */ .flags(), localMethodSymbol1.name, this.types /* 2056 */ .memberType(paramClassSymbol.type, localMethodSymbol1), /* 2056 */ localMethodSymbol1.owner); /* 2057 */ this.log.error(paramDiagnosticPosition, "does.not.override.abstract", new Object[] { paramClassSymbol, localMethodSymbol2, localMethodSymbol2 /* 2058 */ .location() }); /* */ } /* */ } /* */ /* */ void checkNonCyclicDecl(JCTree.JCClassDecl paramJCClassDecl) { /* 2063 */ CycleChecker localCycleChecker = new CycleChecker(); /* 2064 */ localCycleChecker.scan(paramJCClassDecl); /* 2065 */ if ((!localCycleChecker.errorFound) && (!localCycleChecker.partialCheck)) /* 2066 */ paramJCClassDecl.sym.flags_field |= 1073741824L; /* */ } /* */ /* */ void checkNonCyclic(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2176 */ checkNonCyclicInternal(paramDiagnosticPosition, paramType); /* */ } /* */ /* */ void checkNonCyclic(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type.TypeVar paramTypeVar) /* */ { /* 2181 */ checkNonCyclic1(paramDiagnosticPosition, paramTypeVar, List.nil()); /* */ } /* */ /* */ private void checkNonCyclic1(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, List<Type.TypeVar> paramList) /* */ { /* 2186 */ if ((paramType.hasTag(TypeTag.TYPEVAR)) && ((paramType.tsym.flags() & 0x10000000) != 0L)) /* */ return; /* */ Type.TypeVar localTypeVar; /* 2188 */ if (paramList.contains(paramType)) { /* 2189 */ localTypeVar = (Type.TypeVar)paramType.unannotatedType(); /* 2190 */ localTypeVar.bound = this.types.createErrorType(paramType); /* 2191 */ this.log.error(paramDiagnosticPosition, "cyclic.inheritance", new Object[] { paramType }); /* 2192 */ } else if (paramType.hasTag(TypeTag.TYPEVAR)) { /* 2193 */ localTypeVar = (Type.TypeVar)paramType.unannotatedType(); /* 2194 */ paramList = paramList.prepend(localTypeVar); /* 2195 */ for (Type localType : this.types.getBounds(localTypeVar)) /* 2196 */ checkNonCyclic1(paramDiagnosticPosition, localType, paramList); /* */ } /* */ } /* */ /* */ private boolean checkNonCyclicInternal(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2208 */ boolean bool = true; /* */ /* 2210 */ Symbol.TypeSymbol localTypeSymbol = paramType.tsym; /* 2211 */ if ((localTypeSymbol.flags_field & 0x40000000) != 0L) return true; /* */ /* 2213 */ if ((localTypeSymbol.flags_field & 0x8000000) != 0L) /* 2214 */ noteCyclic(paramDiagnosticPosition, (Symbol.ClassSymbol)localTypeSymbol); /* 2215 */ else if (!localTypeSymbol.type.isErroneous()) { /* */ try { /* 2217 */ localTypeSymbol.flags_field |= 134217728L; /* 2218 */ if (localTypeSymbol.type.hasTag(TypeTag.CLASS)) { /* 2219 */ Type.ClassType localClassType = (Type.ClassType)localTypeSymbol.type; /* */ Object localObject1; /* 2220 */ if (localClassType.interfaces_field != null) /* 2221 */ for (localObject1 = localClassType.interfaces_field; ((List)localObject1).nonEmpty(); localObject1 = ((List)localObject1).tail) /* 2222 */ bool &= checkNonCyclicInternal(paramDiagnosticPosition, (Type)((List)localObject1).head); /* 2223 */ if (localClassType.supertype_field != null) { /* 2224 */ localObject1 = localClassType.supertype_field; /* 2225 */ if ((localObject1 != null) && (((Type)localObject1).hasTag(TypeTag.CLASS))) /* 2226 */ bool &= checkNonCyclicInternal(paramDiagnosticPosition, (Type)localObject1); /* */ } /* 2228 */ if (localTypeSymbol.owner.kind == 2) /* 2229 */ bool &= checkNonCyclicInternal(paramDiagnosticPosition, localTypeSymbol.owner.type); /* */ } /* */ } finally { /* 2232 */ localTypeSymbol.flags_field &= -134217729L; /* */ } /* */ } /* 2235 */ if (bool) /* 2236 */ bool = ((localTypeSymbol.flags_field & 0x10000000) == 0L) && (localTypeSymbol.completer == null); /* 2237 */ if (bool) localTypeSymbol.flags_field |= 1073741824L; /* 2238 */ return bool; /* */ } /* */ /* */ private void noteCyclic(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 2243 */ this.log.error(paramDiagnosticPosition, "cyclic.inheritance", new Object[] { paramClassSymbol }); /* 2244 */ for (Object localObject = this.types.interfaces(paramClassSymbol.type); ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 2245 */ ((List)localObject).head = this.types.createErrorType((Symbol.ClassSymbol)((Type)((List)localObject).head).tsym, Type.noType); /* 2246 */ localObject = this.types.supertype(paramClassSymbol.type); /* 2247 */ if (((Type)localObject).hasTag(TypeTag.CLASS)) /* 2248 */ ((Type.ClassType)paramClassSymbol.type).supertype_field = this.types.createErrorType((Symbol.ClassSymbol)((Type)localObject).tsym, Type.noType); /* 2249 */ paramClassSymbol.type = this.types.createErrorType(paramClassSymbol, paramClassSymbol.type); /* 2250 */ paramClassSymbol.flags_field |= 1073741824L; /* */ } /* */ /* */ void checkImplementations(JCTree.JCClassDecl paramJCClassDecl) /* */ { /* 2258 */ checkImplementations(paramJCClassDecl, paramJCClassDecl.sym, paramJCClassDecl.sym); /* */ } /* */ /* */ void checkImplementations(JCTree paramJCTree, Symbol.ClassSymbol paramClassSymbol1, Symbol.ClassSymbol paramClassSymbol2) /* */ { /* 2265 */ for (List localList = this.types.closure(paramClassSymbol2.type); localList.nonEmpty(); localList = localList.tail) { /* 2266 */ Symbol.ClassSymbol localClassSymbol = (Symbol.ClassSymbol)((Type)localList.head).tsym; /* 2267 */ if (((this.allowGenerics) || (paramClassSymbol1 != localClassSymbol)) && ((localClassSymbol.flags() & 0x400) != 0L)) /* 2268 */ for (Scope.Entry localEntry = localClassSymbol.members().elems; localEntry != null; localEntry = localEntry.sibling) /* 2269 */ if ((localEntry.sym.kind == 16) && /* 2270 */ ((localEntry.sym /* 2270 */ .flags() & 0x408) == 1024L)) { /* 2271 */ Symbol.MethodSymbol localMethodSymbol1 = (Symbol.MethodSymbol)localEntry.sym; /* 2272 */ Symbol.MethodSymbol localMethodSymbol2 = localMethodSymbol1.implementation(paramClassSymbol1, this.types, false); /* 2273 */ if ((localMethodSymbol2 != null) && (localMethodSymbol2 != localMethodSymbol1)) /* */ { /* 2275 */ if ((localMethodSymbol2.owner /* 2274 */ .flags() & 0x200) == /* 2275 */ (paramClassSymbol1 /* 2275 */ .flags() & 0x200)) /* */ { /* 2282 */ checkOverride(paramJCTree, localMethodSymbol2, localMethodSymbol1, paramClassSymbol1); /* */ } /* */ } /* */ } /* */ } /* */ } /* */ /* */ void checkCompatibleSupertypes(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2296 */ List localList1 = this.types.interfaces(paramType); /* 2297 */ Type localType = this.types.supertype(paramType); /* 2298 */ if ((localType.hasTag(TypeTag.CLASS)) && /* 2299 */ ((localType.tsym /* 2299 */ .flags() & 0x400) != 0L)) /* 2300 */ localList1 = localList1.prepend(localType); /* 2301 */ for (List localList2 = localList1; localList2.nonEmpty(); localList2 = localList2.tail) { /* 2302 */ if ((this.allowGenerics) && (!((Type)localList2.head).getTypeArguments().isEmpty()) && /* 2303 */ (!checkCompatibleAbstracts(paramDiagnosticPosition, (Type)localList2.head, (Type)localList2.head, paramType))) /* */ { /* 2304 */ return; /* 2305 */ }for (List localList3 = localList1; localList3 != localList2; localList3 = localList3.tail) /* 2306 */ if (!checkCompatibleAbstracts(paramDiagnosticPosition, (Type)localList2.head, (Type)localList3.head, paramType)) /* 2307 */ return; /* */ } /* 2309 */ checkCompatibleConcretes(paramDiagnosticPosition, paramType); /* */ } /* */ /* */ void checkConflicts(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Symbol.TypeSymbol paramTypeSymbol) { /* 2313 */ for (Type localType = paramTypeSymbol.type; localType != Type.noType; localType = this.types.supertype(localType)) /* 2314 */ for (Scope.Entry localEntry = localType.tsym.members().lookup(paramSymbol.name); localEntry.scope == localType.tsym.members(); localEntry = localEntry.next()) /* */ { /* 2316 */ if ((paramSymbol.kind == localEntry.sym.kind) && /* 2317 */ (this.types /* 2317 */ .isSameType(this.types /* 2317 */ .erasure(paramSymbol.type), /* 2317 */ this.types.erasure(localEntry.sym.type))) && (paramSymbol != localEntry.sym)) /* */ { /* 2319 */ if (((paramSymbol /* 2319 */ .flags() & 0x1000) != (localEntry.sym.flags() & 0x1000)) && /* 2320 */ ((paramSymbol /* 2320 */ .flags() & 0x200000) == 0L) && ((localEntry.sym.flags() & 0x200000) == 0L) && /* 2321 */ ((paramSymbol /* 2321 */ .flags() & 0x80000000) == 0L) && ((localEntry.sym.flags() & 0x80000000) == 0L)) { /* 2322 */ syntheticError(paramDiagnosticPosition, (localEntry.sym.flags() & 0x1000) == 0L ? localEntry.sym : paramSymbol); /* 2323 */ return; /* */ } /* */ } /* */ } /* */ } /* */ /* */ void checkOverrideClashes(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, Symbol.MethodSymbol paramMethodSymbol) /* */ { /* 2337 */ ClashFilter localClashFilter = new ClashFilter(paramType); /* */ /* 2341 */ List localList = List.nil(); /* 2342 */ int i = 0; /* 2343 */ for (Iterator localIterator1 = this.types.membersClosure(paramType, false).getElementsByName(paramMethodSymbol.name, localClashFilter).iterator(); localIterator1.hasNext(); ) { localObject = (Symbol)localIterator1.next(); /* 2344 */ if (!paramMethodSymbol.overrides((Symbol)localObject, paramType.tsym, this.types, false)) { /* 2345 */ if ((localObject != paramMethodSymbol) && /* 2349 */ (i == 0)) { /* 2350 */ localList = localList.prepend((Symbol.MethodSymbol)localObject); /* */ } /* */ } /* */ else /* */ { /* 2355 */ if (localObject != paramMethodSymbol) { /* 2356 */ i = 1; /* 2357 */ localList = List.nil(); /* */ } /* */ /* 2361 */ for (Symbol localSymbol : this.types.membersClosure(paramType, false).getElementsByName(paramMethodSymbol.name, localClashFilter)) /* 2362 */ if (localSymbol != localObject) /* */ { /* 2365 */ if ((!this.types.isSubSignature(paramMethodSymbol.type, this.types.memberType(paramType, localSymbol), this.allowStrictMethodClashCheck)) && /* 2366 */ (this.types /* 2366 */ .hasSameArgs(localSymbol /* 2366 */ .erasure(this.types), /* 2366 */ ((Symbol)localObject).erasure(this.types)))) { /* 2367 */ paramMethodSymbol.flags_field |= 4398046511104L; /* 2368 */ String str = localObject == paramMethodSymbol ? "name.clash.same.erasure.no.override" : "name.clash.same.erasure.no.override.1"; /* */ /* 2371 */ this.log.error(paramDiagnosticPosition, str, new Object[] { paramMethodSymbol, paramMethodSymbol /* 2373 */ .location(), localSymbol, localSymbol /* 2374 */ .location(), localObject, ((Symbol)localObject) /* 2375 */ .location() }); /* */ return; /* */ } /* */ } /* */ } /* */ } /* */ Object localObject; /* 2381 */ if (i == 0) /* 2382 */ for (localIterator1 = localList.iterator(); localIterator1.hasNext(); ) { localObject = (Symbol.MethodSymbol)localIterator1.next(); /* 2383 */ checkPotentiallyAmbiguousOverloads(paramDiagnosticPosition, paramType, paramMethodSymbol, (Symbol.MethodSymbol)localObject); /* */ } /* */ } /* */ /* */ void checkHideClashes(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, Symbol.MethodSymbol paramMethodSymbol) /* */ { /* 2396 */ ClashFilter localClashFilter = new ClashFilter(paramType); /* */ /* 2398 */ for (Symbol localSymbol : this.types.membersClosure(paramType, true).getElementsByName(paramMethodSymbol.name, localClashFilter)) /* */ { /* 2401 */ if (!this.types.isSubSignature(paramMethodSymbol.type, this.types.memberType(paramType, localSymbol), this.allowStrictMethodClashCheck)) { /* 2402 */ if (this.types.hasSameArgs(localSymbol.erasure(this.types), paramMethodSymbol.erasure(this.types))) { /* 2403 */ this.log.error(paramDiagnosticPosition, "name.clash.same.erasure.no.hide", new Object[] { paramMethodSymbol, paramMethodSymbol /* 2405 */ .location(), localSymbol, localSymbol /* 2406 */ .location() }); /* 2407 */ return; /* */ } /* 2409 */ checkPotentiallyAmbiguousOverloads(paramDiagnosticPosition, paramType, paramMethodSymbol, (Symbol.MethodSymbol)localSymbol); /* */ } /* */ } /* */ } /* */ /* */ void checkDefaultMethodClashes(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2439 */ DefaultMethodClashFilter localDefaultMethodClashFilter = new DefaultMethodClashFilter(paramType); /* 2440 */ for (Iterator localIterator1 = this.types.membersClosure(paramType, false).getElements(localDefaultMethodClashFilter).iterator(); localIterator1.hasNext(); ) { localSymbol1 = (Symbol)localIterator1.next(); /* 2441 */ Assert.check(localSymbol1.kind == 16); /* 2442 */ List localList = this.types.interfaceCandidates(paramType, (Symbol.MethodSymbol)localSymbol1); /* 2443 */ if (localList.size() > 1) { /* 2444 */ localListBuffer1 = new ListBuffer(); /* 2445 */ localListBuffer2 = new ListBuffer(); /* 2446 */ for (Symbol.MethodSymbol localMethodSymbol : localList) { /* 2447 */ if ((localMethodSymbol.flags() & 0x0) != 0L) /* 2448 */ localListBuffer2 = localListBuffer2.append(localMethodSymbol); /* 2449 */ else if ((localMethodSymbol.flags() & 0x400) != 0L) { /* 2450 */ localListBuffer1 = localListBuffer1.append(localMethodSymbol); /* */ } /* 2452 */ if ((localListBuffer2.nonEmpty()) && (localListBuffer2.size() + localListBuffer1.size() >= 2)) /* */ { /* 2457 */ Symbol localSymbol2 = (Symbol)localListBuffer2.first(); /* */ String str; /* */ Symbol localSymbol3; /* 2459 */ if (localListBuffer2.size() > 1) { /* 2460 */ str = "types.incompatible.unrelated.defaults"; /* 2461 */ localSymbol3 = (Symbol)localListBuffer2.toList().tail.head; /* */ } else { /* 2463 */ str = "types.incompatible.abstract.default"; /* 2464 */ localSymbol3 = (Symbol)localListBuffer1.first(); /* */ } /* 2466 */ this.log.error(paramDiagnosticPosition, str, new Object[] { /* 2467 */ Kinds.kindName(paramType.tsym), /* 2467 */ paramType, localSymbol1.name, this.types /* 2468 */ .memberType(paramType, localSymbol1) /* 2468 */ .getParameterTypes(), localSymbol2 /* 2469 */ .location(), localSymbol3.location() }); /* 2470 */ break; /* */ } /* */ } /* */ } /* */ } /* */ Symbol localSymbol1; /* */ ListBuffer localListBuffer1; /* */ ListBuffer localListBuffer2; /* */ } /* */ /* */ void checkPotentiallyAmbiguousOverloads(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, Symbol.MethodSymbol paramMethodSymbol1, Symbol.MethodSymbol paramMethodSymbol2) /* */ { /* 2502 */ if ((paramMethodSymbol1 != paramMethodSymbol2) && (this.allowDefaultMethods)) /* */ { /* 2504 */ if ((this.lint /* 2504 */ .isEnabled(Lint.LintCategory.OVERLOADS)) && /* 2505 */ ((paramMethodSymbol1 /* 2505 */ .flags() & 0x0) == 0L) && /* 2506 */ ((paramMethodSymbol2 /* 2506 */ .flags() & 0x0) == 0L)) { /* 2507 */ Type localType1 = this.types.memberType(paramType, paramMethodSymbol1); /* 2508 */ Type localType2 = this.types.memberType(paramType, paramMethodSymbol2); /* */ /* 2510 */ if ((localType1.hasTag(TypeTag.FORALL)) && (localType2.hasTag(TypeTag.FORALL)) && /* 2511 */ (this.types /* 2511 */ .hasSameBounds((Type.ForAll)localType1, (Type.ForAll)localType2))) /* */ { /* 2512 */ localType2 = this.types.subst(localType2, ((Type.ForAll)localType2).tvars, ((Type.ForAll)localType1).tvars); /* */ } /* */ /* 2515 */ int i = Math.max(localType1.getParameterTypes().length(), localType2.getParameterTypes().length()); /* 2516 */ List localList1 = this.rs.adjustArgs(localType1.getParameterTypes(), paramMethodSymbol1, i, true); /* 2517 */ List localList2 = this.rs.adjustArgs(localType2.getParameterTypes(), paramMethodSymbol2, i, true); /* */ /* 2519 */ if (localList1.length() != localList2.length()) return; /* 2520 */ int j = 0; /* 2521 */ while ((localList1.nonEmpty()) && (localList2.nonEmpty())) { /* 2522 */ Type localType3 = (Type)localList1.head; /* 2523 */ Type localType4 = (Type)localList2.head; /* 2524 */ if ((!this.types.isSubtype(localType4, localType3)) && (!this.types.isSubtype(localType3, localType4))) { /* 2525 */ if ((!this.types.isFunctionalInterface(localType3)) || (!this.types.isFunctionalInterface(localType4)) || /* 2526 */ (this.types /* 2526 */ .findDescriptorType(localType3) /* 2526 */ .getParameterTypes().length() <= 0)) /* */ break; /* 2528 */ if (this.types /* 2527 */ .findDescriptorType(localType3) /* 2527 */ .getParameterTypes().length() != this.types /* 2528 */ .findDescriptorType(localType4) /* 2528 */ .getParameterTypes().length()) break; /* 2529 */ j = 1; /* */ } /* */ /* 2534 */ localList1 = localList1.tail; /* 2535 */ localList2 = localList2.tail; /* */ } /* 2537 */ if (j != 0) /* */ { /* 2540 */ paramMethodSymbol1.flags_field |= 281474976710656L; /* 2541 */ paramMethodSymbol2.flags_field |= 281474976710656L; /* 2542 */ this.log.warning(Lint.LintCategory.OVERLOADS, paramDiagnosticPosition, "potentially.ambiguous.overload", new Object[] { paramMethodSymbol1, paramMethodSymbol1 /* 2543 */ .location(), paramMethodSymbol2, paramMethodSymbol2 /* 2544 */ .location() }); /* 2545 */ return; /* */ } /* */ } /* */ } /* */ } /* */ /* 2551 */ void checkElemAccessFromSerializableLambda(JCTree paramJCTree) { if (this.warnOnAccessToSensitiveMembers) { /* 2552 */ Symbol localSymbol = TreeInfo.symbol(paramJCTree); /* 2553 */ if ((localSymbol.kind & 0x14) == 0) { /* 2554 */ return; /* */ } /* */ /* 2557 */ if ((localSymbol.kind == 4) && ( /* 2558 */ ((localSymbol.flags() & 0x0) != 0L) || /* 2559 */ (localSymbol /* 2559 */ .isLocal()) || (localSymbol.name == this.names._this) || (localSymbol.name == this.names._super))) /* */ { /* 2562 */ return; /* */ } /* */ /* 2566 */ if ((!this.types.isSubtype(localSymbol.owner.type, this.syms.serializableType)) && /* 2567 */ (isEffectivelyNonPublic(localSymbol))) /* */ { /* 2568 */ this.log.warning(paramJCTree.pos(), "access.to.sensitive.member.from.serializable.element", new Object[] { localSymbol }); /* */ } /* */ } /* */ } /* */ /* */ private boolean isEffectivelyNonPublic(Symbol paramSymbol) /* */ { /* 2575 */ if (paramSymbol.packge() == this.syms.rootPackage) { /* 2576 */ return false; /* */ } /* */ /* 2579 */ while (paramSymbol.kind != 1) { /* 2580 */ if ((paramSymbol.flags() & 1L) == 0L) { /* 2581 */ return true; /* */ } /* 2583 */ paramSymbol = paramSymbol.owner; /* */ } /* 2585 */ return false; /* */ } /* */ /* */ private void syntheticError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) /* */ { /* 2591 */ if (!paramSymbol.type.isErroneous()) /* 2592 */ if (this.warnOnSyntheticConflicts) { /* 2593 */ this.log.warning(paramDiagnosticPosition, "synthetic.name.conflict", new Object[] { paramSymbol, paramSymbol.location() }); /* */ } /* */ else /* 2596 */ this.log.error(paramDiagnosticPosition, "synthetic.name.conflict", new Object[] { paramSymbol, paramSymbol.location() }); /* */ } /* */ /* */ void checkClassBounds(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2607 */ checkClassBounds(paramDiagnosticPosition, new HashMap(), paramType); /* */ } /* */ /* */ void checkClassBounds(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Map<Symbol.TypeSymbol, Type> paramMap, Type paramType) /* */ { /* 2617 */ if (paramType.isErroneous()) return; /* 2618 */ for (Object localObject = this.types.interfaces(paramType); ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) { /* 2619 */ Type localType1 = (Type)((List)localObject).head; /* 2620 */ Type localType2 = (Type)paramMap.put(localType1.tsym, localType1); /* 2621 */ if (localType2 != null) { /* 2622 */ List localList1 = localType2.allparams(); /* 2623 */ List localList2 = localType1.allparams(); /* 2624 */ if (!this.types.containsTypeEquivalent(localList1, localList2)) { /* 2625 */ this.log.error(paramDiagnosticPosition, "cant.inherit.diff.arg", new Object[] { localType1.tsym, /* 2626 */ Type.toString(localList1), /* 2627 */ Type.toString(localList2) }); /* */ } /* */ } /* 2629 */ checkClassBounds(paramDiagnosticPosition, paramMap, localType1); /* */ } /* 2631 */ localObject = this.types.supertype(paramType); /* 2632 */ if (localObject != Type.noType) checkClassBounds(paramDiagnosticPosition, paramMap, (Type)localObject); /* */ } /* */ /* */ void checkNotRepeated(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType, Set<Type> paramSet) /* */ { /* 2639 */ if (paramSet.contains(paramType)) /* 2640 */ this.log.error(paramDiagnosticPosition, "repeated.interface", new Object[0]); /* */ else /* 2642 */ paramSet.add(paramType); /* */ } /* */ /* */ void validateAnnotationTree(JCTree paramJCTree) /* */ { /* 2663 */ paramJCTree.accept(new TreeScanner() /* */ { /* */ public void visitAnnotation(JCTree.JCAnnotation paramAnonymousJCAnnotation) /* */ { /* 2657 */ if (!paramAnonymousJCAnnotation.type.isErroneous()) { /* 2658 */ super.visitAnnotation(paramAnonymousJCAnnotation); /* 2659 */ Check.this.validateAnnotation(paramAnonymousJCAnnotation); /* */ } /* */ } /* */ }); /* */ } /* */ /* */ void validateAnnotationType(JCTree paramJCTree) /* */ { /* 2675 */ if (paramJCTree != null) /* 2676 */ validateAnnotationType(paramJCTree.pos(), paramJCTree.type); /* */ } /* */ /* */ void validateAnnotationType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 2681 */ if (paramType.isPrimitive()) return; /* 2682 */ if (this.types.isSameType(paramType, this.syms.stringType)) return; /* 2683 */ if ((paramType.tsym.flags() & 0x4000) != 0L) return; /* 2684 */ if ((paramType.tsym.flags() & 0x2000) != 0L) return; /* 2685 */ if (this.types.cvarLowerBound(paramType).tsym == this.syms.classType.tsym) return; /* 2686 */ if ((this.types.isArray(paramType)) && (!this.types.isArray(this.types.elemtype(paramType)))) { /* 2687 */ validateAnnotationType(paramDiagnosticPosition, this.types.elemtype(paramType)); /* 2688 */ return; /* */ } /* 2690 */ this.log.error(paramDiagnosticPosition, "invalid.annotation.member.type", new Object[0]); /* */ } /* */ /* */ void validateAnnotationMethod(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.MethodSymbol paramMethodSymbol) /* */ { /* 2702 */ for (Type localType = this.syms.annotationType; localType.hasTag(TypeTag.CLASS); localType = this.types.supertype(localType)) { /* 2703 */ Scope localScope = localType.tsym.members(); /* 2704 */ for (Scope.Entry localEntry = localScope.lookup(paramMethodSymbol.name); localEntry.scope != null; localEntry = localEntry.next()) /* 2705 */ if ((localEntry.sym.kind == 16) && /* 2706 */ ((localEntry.sym /* 2706 */ .flags() & 0x5) != 0L) && /* 2707 */ (this.types /* 2707 */ .overrideEquivalent(paramMethodSymbol.type, localEntry.sym.type))) /* */ { /* 2708 */ this.log.error(paramDiagnosticPosition, "intf.annotation.member.clash", new Object[] { localEntry.sym, localType }); /* */ } /* */ } /* */ } /* */ /* */ public void validateAnnotations(List<JCTree.JCAnnotation> paramList, Symbol paramSymbol) /* */ { /* 2716 */ for (JCTree.JCAnnotation localJCAnnotation : paramList) /* 2717 */ validateAnnotation(localJCAnnotation, paramSymbol); /* */ } /* */ /* */ public void validateTypeAnnotations(List<JCTree.JCAnnotation> paramList, boolean paramBoolean) /* */ { /* 2723 */ for (JCTree.JCAnnotation localJCAnnotation : paramList) /* 2724 */ validateTypeAnnotation(localJCAnnotation, paramBoolean); /* */ } /* */ /* */ private void validateAnnotation(JCTree.JCAnnotation paramJCAnnotation, Symbol paramSymbol) /* */ { /* 2730 */ validateAnnotationTree(paramJCAnnotation); /* */ /* 2732 */ if (!annotationApplicable(paramJCAnnotation, paramSymbol)) { /* 2733 */ this.log.error(paramJCAnnotation.pos(), "annotation.type.not.applicable", new Object[0]); /* */ } /* 2735 */ if (paramJCAnnotation.annotationType.type.tsym == this.syms.functionalInterfaceType.tsym) /* 2736 */ if (paramSymbol.kind != 2) /* 2737 */ this.log.error(paramJCAnnotation.pos(), "bad.functional.intf.anno", new Object[0]); /* 2738 */ else if ((!paramSymbol.isInterface()) || ((paramSymbol.flags() & 0x2000) != 0L)) /* 2739 */ this.log.error(paramJCAnnotation.pos(), "bad.functional.intf.anno.1", new Object[] { this.diags.fragment("not.a.functional.intf", new Object[] { paramSymbol }) }); /* */ } /* */ /* */ public void validateTypeAnnotation(JCTree.JCAnnotation paramJCAnnotation, boolean paramBoolean) /* */ { /* 2745 */ Assert.checkNonNull(paramJCAnnotation.type, "annotation tree hasn't been attributed yet: " + paramJCAnnotation); /* 2746 */ validateAnnotationTree(paramJCAnnotation); /* */ /* 2748 */ if ((paramJCAnnotation.hasTag(JCTree.Tag.TYPE_ANNOTATION)) && /* 2749 */ (!paramJCAnnotation.annotationType.type /* 2749 */ .isErroneous()) && /* 2750 */ (!isTypeAnnotation(paramJCAnnotation, paramBoolean))) /* */ { /* 2751 */ this.log.error(paramJCAnnotation.pos(), "annotation.type.not.applicable", new Object[0]); /* */ } /* */ } /* */ /* */ public void validateRepeatable(Symbol.TypeSymbol paramTypeSymbol, Attribute.Compound paramCompound, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) /* */ { /* 2765 */ Assert.check(this.types.isSameType(paramCompound.type, this.syms.repeatableType)); /* */ /* 2767 */ Type localType = null; /* 2768 */ List localList = paramCompound.values; /* 2769 */ if (!localList.isEmpty()) { /* 2770 */ Assert.check(((Symbol.MethodSymbol)((Pair)localList.head).fst).name == this.names.value); /* 2771 */ localType = ((Attribute.Class)((Pair)localList.head).snd).getValue(); /* */ } /* */ /* 2774 */ if (localType == null) /* */ { /* 2776 */ return; /* */ } /* */ /* 2779 */ validateValue(localType.tsym, paramTypeSymbol, paramDiagnosticPosition); /* 2780 */ validateRetention(localType.tsym, paramTypeSymbol, paramDiagnosticPosition); /* 2781 */ validateDocumented(localType.tsym, paramTypeSymbol, paramDiagnosticPosition); /* 2782 */ validateInherited(localType.tsym, paramTypeSymbol, paramDiagnosticPosition); /* 2783 */ validateTarget(localType.tsym, paramTypeSymbol, paramDiagnosticPosition); /* 2784 */ validateDefault(localType.tsym, paramDiagnosticPosition); /* */ } /* */ /* */ private void validateValue(Symbol.TypeSymbol paramTypeSymbol1, Symbol.TypeSymbol paramTypeSymbol2, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) { /* 2788 */ Scope.Entry localEntry = paramTypeSymbol1.members().lookup(this.names.value); /* 2789 */ if ((localEntry.scope != null) && (localEntry.sym.kind == 16)) { /* 2790 */ Symbol.MethodSymbol localMethodSymbol = (Symbol.MethodSymbol)localEntry.sym; /* 2791 */ Type localType = localMethodSymbol.getReturnType(); /* 2792 */ if ((!localType.hasTag(TypeTag.ARRAY)) || (!this.types.isSameType(((Type.ArrayType)localType).elemtype, paramTypeSymbol2.type))) /* 2793 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.value.return", new Object[] { paramTypeSymbol1, localType, this.types /* 2794 */ .makeArrayType(paramTypeSymbol2.type) }); /* */ } /* */ else /* */ { /* 2797 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.no.value", new Object[] { paramTypeSymbol1 }); /* */ } /* */ } /* */ /* */ private void validateRetention(Symbol paramSymbol1, Symbol paramSymbol2, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) { /* 2802 */ Attribute.RetentionPolicy localRetentionPolicy1 = this.types.getRetention(paramSymbol1); /* 2803 */ Attribute.RetentionPolicy localRetentionPolicy2 = this.types.getRetention(paramSymbol2); /* */ /* 2805 */ int i = 0; /* 2806 */ switch (localRetentionPolicy2) { /* */ case RUNTIME: /* 2808 */ if (localRetentionPolicy1 != Attribute.RetentionPolicy.RUNTIME) /* 2809 */ i = 1; break; /* */ case CLASS: /* 2813 */ if (localRetentionPolicy1 == Attribute.RetentionPolicy.SOURCE) /* 2814 */ i = 1; /* */ break; /* */ } /* 2817 */ if (i != 0) /* 2818 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.retention", new Object[] { paramSymbol1, localRetentionPolicy1, paramSymbol2, localRetentionPolicy2 }); /* */ } /* */ /* */ private void validateDocumented(Symbol paramSymbol1, Symbol paramSymbol2, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) /* */ { /* 2825 */ if ((paramSymbol2.attribute(this.syms.documentedType.tsym) != null) && /* 2826 */ (paramSymbol1.attribute(this.syms.documentedType.tsym) == null)) /* 2827 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.not.documented", new Object[] { paramSymbol1, paramSymbol2 }); /* */ } /* */ /* */ private void validateInherited(Symbol paramSymbol1, Symbol paramSymbol2, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) /* */ { /* 2833 */ if ((paramSymbol2.attribute(this.syms.inheritedType.tsym) != null) && /* 2834 */ (paramSymbol1.attribute(this.syms.inheritedType.tsym) == null)) /* 2835 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.not.inherited", new Object[] { paramSymbol1, paramSymbol2 }); /* */ } /* */ /* */ private void validateTarget(Symbol paramSymbol1, Symbol paramSymbol2, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) /* */ { /* 2847 */ Attribute.Array localArray1 = getAttributeTargetAttribute(paramSymbol1); /* */ Object localObject1; /* 2848 */ if (localArray1 == null) { /* 2849 */ localObject1 = getDefaultTargetSet(); /* */ } else { /* 2851 */ localObject1 = new HashSet(); /* 2852 */ for (Object localObject3 : localArray1.values) { /* 2853 */ if ((localObject3 instanceof Attribute.Enum)) /* */ { /* 2856 */ Attribute.Enum localEnum1 = (Attribute.Enum)localObject3; /* 2857 */ ((Set)localObject1).add(localEnum1.value.name); /* */ } /* */ } /* */ } /* */ /* 2862 */ Attribute.Array localArray2 = getAttributeTargetAttribute(paramSymbol2); /* 2863 */ if (localArray2 == null) { /* 2864 */ ??? = getDefaultTargetSet(); /* */ } else { /* 2866 */ ??? = new HashSet(); /* 2867 */ for (Attribute localAttribute : localArray2.values) { /* 2868 */ if ((localAttribute instanceof Attribute.Enum)) /* */ { /* 2871 */ Attribute.Enum localEnum2 = (Attribute.Enum)localAttribute; /* 2872 */ ((Set)???).add(localEnum2.value.name); /* */ } /* */ } /* */ } /* 2876 */ if (!isTargetSubsetOf((Set)localObject1, (Set)???)) /* 2877 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.incompatible.target", new Object[] { paramSymbol1, paramSymbol2 }); /* */ } /* */ /* */ private Set<Name> getDefaultTargetSet() /* */ { /* 2883 */ if (this.defaultTargets == null) { /* 2884 */ HashSet localHashSet = new HashSet(); /* 2885 */ localHashSet.add(this.names.ANNOTATION_TYPE); /* 2886 */ localHashSet.add(this.names.CONSTRUCTOR); /* 2887 */ localHashSet.add(this.names.FIELD); /* 2888 */ localHashSet.add(this.names.LOCAL_VARIABLE); /* 2889 */ localHashSet.add(this.names.METHOD); /* 2890 */ localHashSet.add(this.names.PACKAGE); /* 2891 */ localHashSet.add(this.names.PARAMETER); /* 2892 */ localHashSet.add(this.names.TYPE); /* */ /* 2894 */ this.defaultTargets = Collections.unmodifiableSet(localHashSet); /* */ } /* */ /* 2897 */ return this.defaultTargets; /* */ } /* */ /* */ private boolean isTargetSubsetOf(Set<Name> paramSet1, Set<Name> paramSet2) /* */ { /* 2909 */ for (Name localName1 : paramSet1) { /* 2910 */ int i = 0; /* 2911 */ for (Name localName2 : paramSet2) { /* 2912 */ if (localName2 == localName1) { /* 2913 */ i = 1; /* 2914 */ break; /* 2915 */ }if ((localName2 == this.names.TYPE) && (localName1 == this.names.ANNOTATION_TYPE)) { /* 2916 */ i = 1; /* 2917 */ break; /* 2918 */ }if ((localName2 == this.names.TYPE_USE) && ((localName1 == this.names.TYPE) || (localName1 == this.names.ANNOTATION_TYPE) || (localName1 == this.names.TYPE_PARAMETER))) /* */ { /* 2922 */ i = 1; /* 2923 */ break; /* */ } /* */ } /* 2926 */ if (i == 0) /* 2927 */ return false; /* */ } /* 2929 */ return true; /* */ } /* */ /* */ private void validateDefault(Symbol paramSymbol, JCDiagnostic.DiagnosticPosition paramDiagnosticPosition) /* */ { /* 2934 */ Scope localScope = paramSymbol.members(); /* 2935 */ for (Symbol localSymbol : localScope.getElements()) /* 2936 */ if ((localSymbol.name != this.names.value) && (localSymbol.kind == 16) && (((Symbol.MethodSymbol)localSymbol).defaultValue == null)) /* */ { /* 2939 */ this.log.error(paramDiagnosticPosition, "invalid.repeatable.annotation.elem.nondefault", new Object[] { paramSymbol, localSymbol }); /* */ } /* */ } /* */ /* */ boolean isOverrider(Symbol paramSymbol) /* */ { /* 2949 */ if ((paramSymbol.kind != 16) || (paramSymbol.isStatic())) /* 2950 */ return false; /* 2951 */ Symbol.MethodSymbol localMethodSymbol = (Symbol.MethodSymbol)paramSymbol; /* 2952 */ Symbol.TypeSymbol localTypeSymbol = (Symbol.TypeSymbol)localMethodSymbol.owner; /* 2953 */ for (Type localType : this.types.closure(localTypeSymbol.type)) { /* 2954 */ if (localType != localTypeSymbol.type) /* */ { /* 2956 */ Scope localScope = localType.tsym.members(); /* 2957 */ for (Scope.Entry localEntry = localScope.lookup(localMethodSymbol.name); localEntry.scope != null; localEntry = localEntry.next()) /* 2958 */ if ((!localEntry.sym.isStatic()) && (localMethodSymbol.overrides(localEntry.sym, localTypeSymbol, this.types, true))) /* 2959 */ return true; /* */ } /* */ } /* 2962 */ return false; /* */ } /* */ /* */ protected boolean isTypeAnnotation(JCTree.JCAnnotation paramJCAnnotation, boolean paramBoolean) /* */ { /* 2968 */ Attribute.Compound localCompound = paramJCAnnotation.annotationType.type.tsym /* 2968 */ .attribute(this.syms.annotationTargetType.tsym); /* */ /* 2969 */ if (localCompound == null) /* */ { /* 2971 */ return false; /* */ } /* */ /* 2974 */ Attribute localAttribute1 = localCompound.member(this.names.value); /* 2975 */ if (!(localAttribute1 instanceof Attribute.Array)) { /* 2976 */ return false; /* */ } /* */ /* 2979 */ Attribute.Array localArray = (Attribute.Array)localAttribute1; /* 2980 */ for (Attribute localAttribute2 : localArray.values) { /* 2981 */ if (!(localAttribute2 instanceof Attribute.Enum)) { /* 2982 */ return false; /* */ } /* 2984 */ Attribute.Enum localEnum = (Attribute.Enum)localAttribute2; /* */ /* 2986 */ if (localEnum.value.name == this.names.TYPE_USE) /* 2987 */ return true; /* 2988 */ if ((paramBoolean) && (localEnum.value.name == this.names.TYPE_PARAMETER)) /* 2989 */ return true; /* */ } /* 2991 */ return false; /* */ } /* */ /* */ boolean annotationApplicable(JCTree.JCAnnotation paramJCAnnotation, Symbol paramSymbol) /* */ { /* 2996 */ Attribute.Array localArray = getAttributeTargetAttribute(paramJCAnnotation.annotationType.type.tsym); /* */ Name[] arrayOfName1; /* 2999 */ if (localArray == null) { /* 3000 */ arrayOfName1 = defaultTargetMetaInfo(paramJCAnnotation, paramSymbol); /* */ } /* */ else { /* 3003 */ arrayOfName1 = new Name[localArray.values.length]; /* 3004 */ for (int i = 0; i < localArray.values.length; i++) { /* 3005 */ Attribute localAttribute = localArray.values[i]; /* 3006 */ if (!(localAttribute instanceof Attribute.Enum)) { /* 3007 */ return true; /* */ } /* 3009 */ Attribute.Enum localEnum = (Attribute.Enum)localAttribute; /* 3010 */ arrayOfName1[i] = localEnum.value.name; /* */ } /* */ } /* 3013 */ for (Name localName : arrayOfName1) { /* 3014 */ if (localName == this.names.TYPE) { /* 3015 */ if (paramSymbol.kind == 2) return true; /* */ } /* 3016 */ else if (localName == this.names.FIELD) { /* 3017 */ if ((paramSymbol.kind == 4) && (paramSymbol.owner.kind != 16)) return true; /* */ } /* 3018 */ else if (localName == this.names.METHOD) { /* 3019 */ if ((paramSymbol.kind == 16) && (!paramSymbol.isConstructor())) return true; /* */ } /* 3020 */ else if (localName == this.names.PARAMETER) { /* 3021 */ if ((paramSymbol.kind == 4) && (paramSymbol.owner.kind == 16)) /* */ { /* 3023 */ if ((paramSymbol /* 3023 */ .flags() & 0x0) != 0L) /* 3024 */ return true; /* */ } /* 3026 */ } else if (localName == this.names.CONSTRUCTOR) { /* 3027 */ if ((paramSymbol.kind == 16) && (paramSymbol.isConstructor())) return true; /* */ } /* 3028 */ else if (localName == this.names.LOCAL_VARIABLE) { /* 3029 */ if ((paramSymbol.kind == 4) && (paramSymbol.owner.kind == 16) && /* 3030 */ ((paramSymbol /* 3030 */ .flags() & 0x0) == 0L)) /* 3031 */ return true; /* */ } /* 3033 */ else if (localName == this.names.ANNOTATION_TYPE) { /* 3034 */ if ((paramSymbol.kind == 2) && ((paramSymbol.flags() & 0x2000) != 0L)) /* 3035 */ return true; /* */ } /* 3037 */ else if (localName == this.names.PACKAGE) { /* 3038 */ if (paramSymbol.kind == 1) return true; /* */ } /* 3039 */ else if (localName == this.names.TYPE_USE) { /* 3040 */ if ((paramSymbol.kind == 2) || (paramSymbol.kind == 4) || ((paramSymbol.kind == 16) && /* 3042 */ (!paramSymbol /* 3042 */ .isConstructor()) && /* 3043 */ (!paramSymbol.type /* 3043 */ .getReturnType().hasTag(TypeTag.VOID))) || ( /* 3043 */ (paramSymbol.kind == 16) && /* 3044 */ (paramSymbol /* 3044 */ .isConstructor()))) /* 3045 */ return true; /* */ } /* 3047 */ else if (localName == this.names.TYPE_PARAMETER) { /* 3048 */ if ((paramSymbol.kind == 2) && (paramSymbol.type.hasTag(TypeTag.TYPEVAR))) /* 3049 */ return true; /* */ } /* */ else /* 3052 */ return true; /* */ } /* 3054 */ return false; /* */ } /* */ /* */ Attribute.Array getAttributeTargetAttribute(Symbol paramSymbol) /* */ { /* 3060 */ Attribute.Compound localCompound = paramSymbol /* 3060 */ .attribute(this.syms.annotationTargetType.tsym); /* */ /* 3061 */ if (localCompound == null) return null; /* 3062 */ Attribute localAttribute = localCompound.member(this.names.value); /* 3063 */ if (!(localAttribute instanceof Attribute.Array)) return null; /* 3064 */ return (Attribute.Array)localAttribute; /* */ } /* */ /* */ private Name[] defaultTargetMetaInfo(JCTree.JCAnnotation paramJCAnnotation, Symbol paramSymbol) /* */ { /* 3069 */ return this.dfltTargetMeta; /* */ } /* */ /* */ public boolean validateAnnotationDeferErrors(JCTree.JCAnnotation paramJCAnnotation) /* */ { /* 3078 */ boolean bool = false; /* 3079 */ Log.DiscardDiagnosticHandler localDiscardDiagnosticHandler = new Log.DiscardDiagnosticHandler(this.log); /* */ try { /* 3081 */ bool = validateAnnotation(paramJCAnnotation); /* */ } finally { /* 3083 */ this.log.popDiagnosticHandler(localDiscardDiagnosticHandler); /* */ } /* 3085 */ return bool; /* */ } /* */ /* */ private boolean validateAnnotation(JCTree.JCAnnotation paramJCAnnotation) { /* 3089 */ boolean bool = true; /* */ /* 3091 */ LinkedHashSet localLinkedHashSet = new LinkedHashSet(); /* 3092 */ for (Object localObject1 = paramJCAnnotation.annotationType.type.tsym.members().elems; /* 3093 */ localObject1 != null; /* 3094 */ localObject1 = ((Scope.Entry)localObject1).sibling) { /* 3095 */ if ((((Scope.Entry)localObject1).sym.kind == 16) && (((Scope.Entry)localObject1).sym.name != this.names.clinit) && /* 3096 */ ((((Scope.Entry)localObject1).sym /* 3096 */ .flags() & 0x1000) == 0L)) { /* 3097 */ localLinkedHashSet.add((Symbol.MethodSymbol)((Scope.Entry)localObject1).sym); /* */ } /* */ } /* 3100 */ for (localObject1 = paramJCAnnotation.args.iterator(); ((Iterator)localObject1).hasNext(); ) { localObject2 = (JCTree)((Iterator)localObject1).next(); /* 3101 */ if (((JCTree)localObject2).hasTag(JCTree.Tag.ASSIGN)) { /* 3102 */ localObject3 = (JCTree.JCAssign)localObject2; /* 3103 */ localObject4 = TreeInfo.symbol(((JCTree.JCAssign)localObject3).lhs); /* 3104 */ if ((localObject4 != null) && (!((Symbol)localObject4).type.isErroneous())) { /* 3105 */ if (!localLinkedHashSet.remove(localObject4)) { /* 3106 */ bool = false; /* 3107 */ this.log.error(((JCTree.JCAssign)localObject3).lhs.pos(), "duplicate.annotation.member.value", new Object[] { ((Symbol)localObject4).name, paramJCAnnotation.type }); /* */ } /* */ } /* */ } /* */ } /* */ /* 3113 */ localObject1 = List.nil(); /* 3114 */ for (Object localObject2 = localLinkedHashSet.iterator(); ((Iterator)localObject2).hasNext(); ) { localObject3 = (Symbol.MethodSymbol)((Iterator)localObject2).next(); /* 3115 */ if ((((Symbol.MethodSymbol)localObject3).defaultValue == null) && (!((Symbol.MethodSymbol)localObject3).type.isErroneous())) { /* 3116 */ localObject1 = ((List)localObject1).append(((Symbol.MethodSymbol)localObject3).name); /* */ } /* */ } /* 3119 */ localObject1 = ((List)localObject1).reverse(); /* 3120 */ if (((List)localObject1).nonEmpty()) { /* 3121 */ bool = false; /* 3122 */ localObject2 = ((List)localObject1).size() > 1 ? "annotation.missing.default.value.1" : "annotation.missing.default.value"; /* */ /* 3125 */ this.log.error(paramJCAnnotation.pos(), (String)localObject2, new Object[] { paramJCAnnotation.type, localObject1 }); /* */ } /* */ /* 3130 */ if ((paramJCAnnotation.annotationType.type.tsym != this.syms.annotationTargetType.tsym) || (paramJCAnnotation.args.tail == null)) /* */ { /* 3132 */ return bool; /* */ } /* 3134 */ if (!((JCTree.JCExpression)paramJCAnnotation.args.head).hasTag(JCTree.Tag.ASSIGN)) return false; /* 3135 */ localObject2 = (JCTree.JCAssign)paramJCAnnotation.args.head; /* 3136 */ Object localObject3 = TreeInfo.symbol(((JCTree.JCAssign)localObject2).lhs); /* 3137 */ if (((Symbol)localObject3).name != this.names.value) return false; /* 3138 */ Object localObject4 = ((JCTree.JCAssign)localObject2).rhs; /* 3139 */ if (!((JCTree)localObject4).hasTag(JCTree.Tag.NEWARRAY)) return false; /* 3140 */ JCTree.JCNewArray localJCNewArray = (JCTree.JCNewArray)localObject4; /* 3141 */ HashSet localHashSet = new HashSet(); /* 3142 */ for (JCTree localJCTree : localJCNewArray.elems) { /* 3143 */ if (!localHashSet.add(TreeInfo.symbol(localJCTree))) { /* 3144 */ bool = false; /* 3145 */ this.log.error(localJCTree.pos(), "repeated.annotation.target", new Object[0]); /* */ } /* */ } /* 3148 */ return bool; /* */ } /* */ /* */ void checkDeprecatedAnnotation(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) { /* 3152 */ if ((this.allowAnnotations) && /* 3153 */ (this.lint /* 3153 */ .isEnabled(Lint.LintCategory.DEP_ANN)) && /* 3154 */ ((paramSymbol /* 3154 */ .flags() & 0x20000) != 0L) && /* 3155 */ (!this.syms.deprecatedType /* 3155 */ .isErroneous()) && /* 3156 */ (paramSymbol /* 3156 */ .attribute(this.syms.deprecatedType.tsym) == null)) /* */ { /* 3157 */ this.log.warning(Lint.LintCategory.DEP_ANN, paramDiagnosticPosition, "missing.deprecated.annotation", new Object[0]); /* */ } /* */ } /* */ /* */ void checkDeprecated(final JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol1, final Symbol paramSymbol2) /* */ { /* 3163 */ if (((paramSymbol2.flags() & 0x20000) != 0L) && /* 3164 */ ((paramSymbol1 /* 3164 */ .flags() & 0x20000) == 0L) && /* 3165 */ (paramSymbol2 /* 3165 */ .outermostClass() != paramSymbol1.outermostClass())) /* 3166 */ this.deferredLintHandler.report(new DeferredLintHandler.LintLogger() /* */ { /* */ public void report() { /* 3169 */ Check.this.warnDeprecated(paramDiagnosticPosition, paramSymbol2); /* */ } /* */ }); /* */ } /* */ /* */ void checkSunAPI(final JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, final Symbol paramSymbol) /* */ { /* 3176 */ if ((paramSymbol.flags() & 0x0) != 0L) /* 3177 */ this.deferredLintHandler.report(new DeferredLintHandler.LintLogger() { /* */ public void report() { /* 3179 */ if (Check.this.enableSunApiLintControl) /* 3180 */ Check.this.warnSunApi(paramDiagnosticPosition, "sun.proprietary", new Object[] { paramSymbol }); /* */ else /* 3182 */ Check.this.log.mandatoryWarning(paramDiagnosticPosition, "sun.proprietary", new Object[] { paramSymbol }); /* */ } /* */ }); /* */ } /* */ /* */ void checkProfile(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) /* */ { /* 3189 */ if ((this.profile != Profile.DEFAULT) && ((paramSymbol.flags() & 0x0) != 0L)) /* 3190 */ this.log.error(paramDiagnosticPosition, "not.in.profile", new Object[] { paramSymbol, this.profile }); /* */ } /* */ /* */ void checkNonCyclicElements(JCTree.JCClassDecl paramJCClassDecl) /* */ { /* 3201 */ if ((paramJCClassDecl.sym.flags_field & 0x2000) == 0L) return; /* 3202 */ Assert.check((paramJCClassDecl.sym.flags_field & 0x8000000) == 0L); /* */ try { /* 3204 */ paramJCClassDecl.sym.flags_field |= 134217728L; /* 3205 */ for (JCTree localJCTree : paramJCClassDecl.defs) /* 3206 */ if (localJCTree.hasTag(JCTree.Tag.METHODDEF)) { /* 3207 */ JCTree.JCMethodDecl localJCMethodDecl = (JCTree.JCMethodDecl)localJCTree; /* 3208 */ checkAnnotationResType(localJCMethodDecl.pos(), localJCMethodDecl.restype.type); /* */ } /* */ } finally { /* 3211 */ paramJCClassDecl.sym.flags_field &= -134217729L; /* 3212 */ paramJCClassDecl.sym.flags_field |= 34359738368L; /* */ } /* */ } /* */ /* */ void checkNonCyclicElementsInternal(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.TypeSymbol paramTypeSymbol) { /* 3217 */ if ((paramTypeSymbol.flags_field & 0x0) != 0L) /* 3218 */ return; /* 3219 */ if ((paramTypeSymbol.flags_field & 0x8000000) != 0L) { /* 3220 */ this.log.error(paramDiagnosticPosition, "cyclic.annotation.element", new Object[0]); /* 3221 */ return; /* */ } /* */ try { /* 3224 */ paramTypeSymbol.flags_field |= 134217728L; /* 3225 */ for (Scope.Entry localEntry = paramTypeSymbol.members().elems; localEntry != null; localEntry = localEntry.sibling) { /* 3226 */ Symbol localSymbol = localEntry.sym; /* 3227 */ if (localSymbol.kind == 16) /* */ { /* 3229 */ checkAnnotationResType(paramDiagnosticPosition, ((Symbol.MethodSymbol)localSymbol).type.getReturnType()); /* */ } /* */ } /* */ } finally { paramTypeSymbol.flags_field &= -134217729L; /* 3233 */ paramTypeSymbol.flags_field |= 34359738368L; } /* */ } /* */ /* */ void checkAnnotationResType(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType) /* */ { /* 3238 */ switch (paramType.getTag()) { /* */ case CLASS: /* 3240 */ if ((paramType.tsym.flags() & 0x2000) != 0L) /* 3241 */ checkNonCyclicElementsInternal(paramDiagnosticPosition, paramType.tsym); break; /* */ case ARRAY: /* 3244 */ checkAnnotationResType(paramDiagnosticPosition, this.types.elemtype(paramType)); /* 3245 */ break; /* */ } /* */ } /* */ /* */ void checkCyclicConstructors(JCTree.JCClassDecl paramJCClassDecl) /* */ { /* 3259 */ HashMap localHashMap = new HashMap(); /* */ Object localObject2; /* 3262 */ for (Object localObject1 = paramJCClassDecl.defs; ((List)localObject1).nonEmpty(); localObject1 = ((List)localObject1).tail) { /* 3263 */ localObject2 = TreeInfo.firstConstructorCall((JCTree)((List)localObject1).head); /* 3264 */ if (localObject2 != null) { /* 3265 */ JCTree.JCMethodDecl localJCMethodDecl = (JCTree.JCMethodDecl)((List)localObject1).head; /* 3266 */ if (TreeInfo.name(((JCTree.JCMethodInvocation)localObject2).meth) == this.names._this) /* 3267 */ localHashMap.put(localJCMethodDecl.sym, TreeInfo.symbol(((JCTree.JCMethodInvocation)localObject2).meth)); /* */ else { /* 3269 */ localJCMethodDecl.sym.flags_field |= 1073741824L; /* */ } /* */ } /* */ } /* */ /* 3274 */ localObject1 = new Symbol[0]; /* 3275 */ localObject1 = (Symbol[])localHashMap.keySet().toArray((Object[])localObject1); /* 3276 */ for (Symbol localSymbol : localObject1) /* 3277 */ checkCyclicConstructor(paramJCClassDecl, localSymbol, localHashMap); /* */ } /* */ /* */ private void checkCyclicConstructor(JCTree.JCClassDecl paramJCClassDecl, Symbol paramSymbol, Map<Symbol, Symbol> paramMap) /* */ { /* 3286 */ if ((paramSymbol != null) && ((paramSymbol.flags_field & 0x40000000) == 0L)) { /* 3287 */ if ((paramSymbol.flags_field & 0x8000000) != 0L) { /* 3288 */ this.log.error(TreeInfo.diagnosticPositionFor(paramSymbol, paramJCClassDecl), "recursive.ctor.invocation", new Object[0]); /* */ } /* */ else { /* 3291 */ paramSymbol.flags_field |= 134217728L; /* 3292 */ checkCyclicConstructor(paramJCClassDecl, (Symbol)paramMap.remove(paramSymbol), paramMap); /* 3293 */ paramSymbol.flags_field &= -134217729L; /* */ } /* 3295 */ paramSymbol.flags_field |= 1073741824L; /* */ } /* */ } /* */ /* */ int checkOperator(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol.OperatorSymbol paramOperatorSymbol, JCTree.Tag paramTag, Type paramType1, Type paramType2) /* */ { /* 3317 */ if (paramOperatorSymbol.opcode == 277) { /* 3318 */ this.log.error(paramDiagnosticPosition, "operator.cant.be.applied.1", new Object[] { this.treeinfo /* 3320 */ .operatorName(paramTag), /* 3320 */ paramType1, paramType2 }); /* */ } /* */ /* 3323 */ return paramOperatorSymbol.opcode; /* */ } /* */ /* */ void checkDivZero(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Type paramType) /* */ { /* 3334 */ if ((paramType.constValue() != null) && /* 3335 */ (this.lint /* 3335 */ .isEnabled(Lint.LintCategory.DIVZERO)) && /* 3336 */ (paramType /* 3336 */ .getTag().isSubRangeOf(TypeTag.LONG)) && /* 3337 */ (((Number)paramType /* 3337 */ .constValue()).longValue() == 0L)) { /* 3338 */ int i = ((Symbol.OperatorSymbol)paramSymbol).opcode; /* 3339 */ if ((i == 108) || (i == 112) || (i == 109) || (i == 113)) /* */ { /* 3341 */ this.log.warning(Lint.LintCategory.DIVZERO, paramDiagnosticPosition, "div.zero", new Object[0]); /* */ } /* */ } /* */ } /* */ /* */ void checkEmptyIf(JCTree.JCIf paramJCIf) /* */ { /* 3350 */ if ((paramJCIf.thenpart.hasTag(JCTree.Tag.SKIP)) && (paramJCIf.elsepart == null) && /* 3351 */ (this.lint /* 3351 */ .isEnabled(Lint.LintCategory.EMPTY))) /* */ { /* 3352 */ this.log.warning(Lint.LintCategory.EMPTY, paramJCIf.thenpart.pos(), "empty.if", new Object[0]); /* */ } /* */ } /* */ /* */ boolean checkUnique(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Scope paramScope) /* */ { /* 3361 */ if (paramSymbol.type.isErroneous()) /* 3362 */ return true; /* 3363 */ if (paramSymbol.owner.name == this.names.any) return false; /* 3364 */ for (Scope.Entry localEntry = paramScope.lookup(paramSymbol.name); localEntry.scope == paramScope; localEntry = localEntry.next()) { /* 3365 */ if ((paramSymbol != localEntry.sym) && /* 3366 */ ((localEntry.sym /* 3366 */ .flags() & 0x0) == 0L) && (paramSymbol.kind == localEntry.sym.kind) && (paramSymbol.name != this.names.error) && ( /* 3366 */ (paramSymbol.kind != 16) || /* 3370 */ (this.types /* 3370 */ .hasSameArgs(paramSymbol.type, localEntry.sym.type)) || /* 3371 */ (this.types /* 3371 */ .hasSameArgs(this.types /* 3371 */ .erasure(paramSymbol.type), /* 3371 */ this.types.erasure(localEntry.sym.type))))) { /* 3372 */ if ((paramSymbol.flags() & 0x0) != (localEntry.sym.flags() & 0x0)) { /* 3373 */ varargsDuplicateError(paramDiagnosticPosition, paramSymbol, localEntry.sym); /* 3374 */ return true; /* 3375 */ }if ((paramSymbol.kind == 16) && (!this.types.hasSameArgs(paramSymbol.type, localEntry.sym.type, false))) { /* 3376 */ duplicateErasureError(paramDiagnosticPosition, paramSymbol, localEntry.sym); /* 3377 */ paramSymbol.flags_field |= 4398046511104L; /* 3378 */ return true; /* */ } /* 3380 */ duplicateError(paramDiagnosticPosition, localEntry.sym); /* 3381 */ return false; /* */ } /* */ } /* */ /* 3385 */ return true; /* */ } /* */ /* */ void duplicateErasureError(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol1, Symbol paramSymbol2) /* */ { /* 3391 */ if ((!paramSymbol1.type.isErroneous()) && (!paramSymbol2.type.isErroneous())) /* 3392 */ this.log.error(paramDiagnosticPosition, "name.clash.same.erasure", new Object[] { paramSymbol1, paramSymbol2 }); /* */ } /* */ /* */ boolean checkUniqueImport(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Scope paramScope) /* */ { /* 3403 */ return checkUniqueImport(paramDiagnosticPosition, paramSymbol, paramScope, false); /* */ } /* */ /* */ boolean checkUniqueStaticImport(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Scope paramScope) /* */ { /* 3413 */ return checkUniqueImport(paramDiagnosticPosition, paramSymbol, paramScope, true); /* */ } /* */ /* */ private boolean checkUniqueImport(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, Scope paramScope, boolean paramBoolean) /* */ { /* 3424 */ for (Scope.Entry localEntry = paramScope.lookup(paramSymbol.name); localEntry.scope != null; localEntry = localEntry.next()) /* */ { /* 3426 */ int i = localEntry.scope == paramScope ? 1 : 0; /* 3427 */ if (((i != 0) || (paramSymbol != localEntry.sym)) && (paramSymbol.kind == localEntry.sym.kind) && (paramSymbol.name != this.names.error) && ((!paramBoolean) || /* 3430 */ (!localEntry /* 3430 */ .isStaticallyImported()))) { /* 3431 */ if (!localEntry.sym.type.isErroneous()) { /* 3432 */ if (i == 0) { /* 3433 */ if (paramBoolean) /* 3434 */ this.log.error(paramDiagnosticPosition, "already.defined.static.single.import", new Object[] { localEntry.sym }); /* */ else /* 3436 */ this.log.error(paramDiagnosticPosition, "already.defined.single.import", new Object[] { localEntry.sym }); /* */ } /* 3438 */ else if (paramSymbol != localEntry.sym) /* 3439 */ this.log.error(paramDiagnosticPosition, "already.defined.this.unit", new Object[] { localEntry.sym }); /* */ } /* 3441 */ return false; /* */ } /* */ } /* 3444 */ return true; /* */ } /* */ /* */ public void checkCanonical(JCTree paramJCTree) /* */ { /* 3450 */ if (!isCanonical(paramJCTree)) /* 3451 */ this.log.error(paramJCTree.pos(), "import.requires.canonical", new Object[] { /* 3452 */ TreeInfo.symbol(paramJCTree) }); /* */ } /* */ /* */ private boolean isCanonical(JCTree paramJCTree) /* */ { /* 3456 */ while (paramJCTree.hasTag(JCTree.Tag.SELECT)) { /* 3457 */ JCTree.JCFieldAccess localJCFieldAccess = (JCTree.JCFieldAccess)paramJCTree; /* 3458 */ if (localJCFieldAccess.sym.owner != TreeInfo.symbol(localJCFieldAccess.selected)) /* 3459 */ return false; /* 3460 */ paramJCTree = localJCFieldAccess.selected; /* */ } /* 3462 */ return true; /* */ } /* */ /* */ void checkForBadAuxiliaryClassAccess(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Env<AttrContext> paramEnv, Symbol.ClassSymbol paramClassSymbol) /* */ { /* 3468 */ if ((this.lint.isEnabled(Lint.LintCategory.AUXILIARYCLASS)) && /* 3469 */ ((paramClassSymbol /* 3469 */ .flags() & 0x0) != 0L) && /* 3470 */ (this.rs /* 3470 */ .isAccessible(paramEnv, paramClassSymbol)) && /* 3471 */ (!this.fileManager /* 3471 */ .isSameFile(paramClassSymbol.sourcefile, paramEnv.toplevel.sourcefile))) /* */ { /* 3473 */ this.log.warning(paramDiagnosticPosition, "auxiliary.class.accessed.from.outside.of.its.source.file", new Object[] { paramClassSymbol, paramClassSymbol.sourcefile }); /* */ } /* */ } /* */ /* */ public Warner castWarner(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) /* */ { /* 3513 */ return new ConversionWarner(paramDiagnosticPosition, "unchecked.cast.to.type", paramType1, paramType2); /* */ } /* */ /* */ public Warner convertWarner(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) { /* 3517 */ return new ConversionWarner(paramDiagnosticPosition, "unchecked.assign", paramType1, paramType2); /* */ } /* */ /* */ public void checkFunctionalInterface(JCTree.JCClassDecl paramJCClassDecl, Symbol.ClassSymbol paramClassSymbol) { /* 3521 */ Attribute.Compound localCompound = paramClassSymbol.attribute(this.syms.functionalInterfaceType.tsym); /* */ /* 3523 */ if (localCompound != null) /* */ try { /* 3525 */ this.types.findDescriptorSymbol(paramClassSymbol); /* */ } catch (Types.FunctionDescriptorLookupError localFunctionDescriptorLookupError) { /* 3527 */ JCDiagnostic.DiagnosticPosition localDiagnosticPosition = paramJCClassDecl.pos(); /* 3528 */ for (JCTree.JCAnnotation localJCAnnotation : paramJCClassDecl.getModifiers().annotations) { /* 3529 */ if (localJCAnnotation.annotationType.type.tsym == this.syms.functionalInterfaceType.tsym) { /* 3530 */ localDiagnosticPosition = localJCAnnotation.pos(); /* 3531 */ break; /* */ } /* */ } /* 3534 */ this.log.error(localDiagnosticPosition, "bad.functional.intf.anno.1", new Object[] { localFunctionDescriptorLookupError.getDiagnostic() }); /* */ } /* */ } /* */ /* */ public static abstract interface CheckContext /* */ { /* */ public abstract boolean compatible(Type paramType1, Type paramType2, Warner paramWarner); /* */ /* */ public abstract void report(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, JCDiagnostic paramJCDiagnostic); /* */ /* */ public abstract Warner checkWarner(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2); /* */ /* */ public abstract Infer.InferenceContext inferenceContext(); /* */ /* */ public abstract DeferredAttr.DeferredAttrContext deferredAttrContext(); /* */ } /* */ /* */ private class ClashFilter /* */ implements Filter<Symbol> /* */ { /* */ Type site; /* */ /* */ ClashFilter(Type arg2) /* */ { /* */ Object localObject; /* 2421 */ this.site = localObject; /* */ } /* */ /* */ boolean shouldSkip(Symbol paramSymbol) { /* 2425 */ return ((paramSymbol.flags() & 0x0) != 0L) && (paramSymbol.owner == this.site.tsym); /* */ } /* */ /* */ public boolean accepts(Symbol paramSymbol) /* */ { /* 2434 */ return (paramSymbol.kind == 16) && /* 2431 */ ((paramSymbol /* 2431 */ .flags() & 0x1000) == 0L) && /* 2432 */ (!shouldSkip(paramSymbol)) && /* 2433 */ (paramSymbol /* 2433 */ .isInheritedIn(this.site.tsym, Check.this.types)) && /* 2434 */ (!paramSymbol /* 2434 */ .isConstructor()); /* */ } /* */ } /* */ /* */ private class ConversionWarner extends Warner /* */ { /* */ final String uncheckedKey; /* */ final Type found; /* */ final Type expected; /* */ /* */ public ConversionWarner(JCDiagnostic.DiagnosticPosition paramString, String paramType1, Type paramType2, Type arg5) /* */ { /* 3483 */ super(); /* 3484 */ this.uncheckedKey = paramType1; /* 3485 */ this.found = paramType2; /* */ Object localObject; /* 3486 */ this.expected = localObject; /* */ } /* */ /* */ public void warn(Lint.LintCategory paramLintCategory) /* */ { /* 3491 */ boolean bool = this.warned; /* 3492 */ super.warn(paramLintCategory); /* 3493 */ if (bool) return; /* 3494 */ switch (Check.9.$SwitchMap$com$sun$tools$javac$code$Lint$LintCategory[paramLintCategory.ordinal()]) { /* */ case 1: /* 3496 */ Check.this.warnUnchecked(pos(), "prob.found.req", new Object[] { Check.this.diags.fragment(this.uncheckedKey, new Object[0]), this.found, this.expected }); /* 3497 */ break; /* */ case 2: /* 3499 */ if ((Check.this.method != null) && /* 3500 */ (Check.this.method /* 3500 */ .attribute(Check.this.syms.trustMeType.tsym) != null) && /* 3501 */ (Check.this /* 3501 */ .isTrustMeAllowedOnMethod(Check.this.method)) && /* 3502 */ (!Check.this.types /* 3502 */ .isReifiable((Type)Check.this.method.type.getParameterTypes().last()))) /* 3503 */ Check.this.warnUnsafeVararg(pos(), "varargs.unsafe.use.varargs.param", new Object[] { Check.this.method.params.last() }); break; /* */ default: /* 3507 */ throw new AssertionError("Unexpected lint: " + paramLintCategory); /* */ } /* */ } /* */ } /* */ /* */ class CycleChecker extends TreeScanner /* */ { /* 2072 */ List<Symbol> seenClasses = List.nil(); /* 2073 */ boolean errorFound = false; /* 2074 */ boolean partialCheck = false; /* */ /* */ CycleChecker() { } /* 2077 */ private void checkSymbol(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol) { if ((paramSymbol != null) && (paramSymbol.kind == 2)) { /* 2078 */ Env localEnv = Check.this.enter.getEnv((Symbol.TypeSymbol)paramSymbol); /* 2079 */ if (localEnv != null) { /* 2080 */ DiagnosticSource localDiagnosticSource = Check.this.log.currentSource(); /* */ try { /* 2082 */ Check.this.log.useSource(localEnv.toplevel.sourcefile); /* 2083 */ scan(localEnv.tree); /* */ } /* */ finally { /* 2086 */ Check.this.log.useSource(localDiagnosticSource.getFile()); /* */ } /* 2088 */ } else if (paramSymbol.kind == 2) { /* 2089 */ checkClass(paramDiagnosticPosition, paramSymbol, List.nil()); /* */ } /* */ } /* */ else { /* 2093 */ this.partialCheck = true; /* */ } /* */ } /* */ /* */ public void visitSelect(JCTree.JCFieldAccess paramJCFieldAccess) /* */ { /* 2099 */ super.visitSelect(paramJCFieldAccess); /* 2100 */ checkSymbol(paramJCFieldAccess.pos(), paramJCFieldAccess.sym); /* */ } /* */ /* */ public void visitIdent(JCTree.JCIdent paramJCIdent) /* */ { /* 2105 */ checkSymbol(paramJCIdent.pos(), paramJCIdent.sym); /* */ } /* */ /* */ public void visitTypeApply(JCTree.JCTypeApply paramJCTypeApply) /* */ { /* 2110 */ scan(paramJCTypeApply.clazz); /* */ } /* */ /* */ public void visitTypeArray(JCTree.JCArrayTypeTree paramJCArrayTypeTree) /* */ { /* 2115 */ scan(paramJCArrayTypeTree.elemtype); /* */ } /* */ /* */ public void visitClassDef(JCTree.JCClassDecl paramJCClassDecl) /* */ { /* 2120 */ List localList = List.nil(); /* 2121 */ if (paramJCClassDecl.getExtendsClause() != null) { /* 2122 */ localList = localList.prepend(paramJCClassDecl.getExtendsClause()); /* */ } /* 2124 */ if (paramJCClassDecl.getImplementsClause() != null) { /* 2125 */ for (JCTree localJCTree : paramJCClassDecl.getImplementsClause()) { /* 2126 */ localList = localList.prepend(localJCTree); /* */ } /* */ } /* 2129 */ checkClass(paramJCClassDecl.pos(), paramJCClassDecl.sym, localList); /* */ } /* */ /* */ void checkClass(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Symbol paramSymbol, List<JCTree> paramList) { /* 2133 */ if ((paramSymbol.flags_field & 0x40000000) != 0L) /* 2134 */ return; /* 2135 */ if (this.seenClasses.contains(paramSymbol)) { /* 2136 */ this.errorFound = true; /* 2137 */ Check.this.noteCyclic(paramDiagnosticPosition, (Symbol.ClassSymbol)paramSymbol); /* 2138 */ } else if (!paramSymbol.type.isErroneous()) { /* */ try { /* 2140 */ this.seenClasses = this.seenClasses.prepend(paramSymbol); /* 2141 */ if (paramSymbol.type.hasTag(TypeTag.CLASS)) { /* 2142 */ if (paramList.nonEmpty()) { /* 2143 */ scan(paramList); /* */ } /* */ else { /* 2146 */ Type.ClassType localClassType = (Type.ClassType)paramSymbol.type; /* 2147 */ if ((localClassType.supertype_field == null) || (localClassType.interfaces_field == null)) /* */ { /* 2150 */ this.partialCheck = true; /* 2151 */ return; /* */ } /* 2153 */ checkSymbol(paramDiagnosticPosition, localClassType.supertype_field.tsym); /* 2154 */ for (Type localType : localClassType.interfaces_field) { /* 2155 */ checkSymbol(paramDiagnosticPosition, localType.tsym); /* */ } /* */ } /* 2158 */ if (paramSymbol.owner.kind == 2) /* 2159 */ checkSymbol(paramDiagnosticPosition, paramSymbol.owner); /* */ } /* */ } /* */ finally { /* 2163 */ this.seenClasses = this.seenClasses.tail; /* */ } /* */ } /* */ } /* */ } /* */ /* */ private class DefaultMethodClashFilter /* */ implements Filter<Symbol> /* */ { /* */ Type site; /* */ /* */ DefaultMethodClashFilter(Type arg2) /* */ { /* */ Object localObject; /* 2483 */ this.site = localObject; /* */ } /* */ /* */ public boolean accepts(Symbol paramSymbol) /* */ { /* 2490 */ return (paramSymbol.kind == 16) && /* 2488 */ ((paramSymbol /* 2488 */ .flags() & 0x0) != 0L) && /* 2489 */ (paramSymbol /* 2489 */ .isInheritedIn(this.site.tsym, Check.this.types)) && /* 2490 */ (!paramSymbol /* 2490 */ .isConstructor()); /* */ } /* */ } /* */ /* */ static class NestedCheckContext /* */ implements Check.CheckContext /* */ { /* */ Check.CheckContext enclosingContext; /* */ /* */ NestedCheckContext(Check.CheckContext paramCheckContext) /* */ { /* 469 */ this.enclosingContext = paramCheckContext; /* */ } /* */ /* */ public boolean compatible(Type paramType1, Type paramType2, Warner paramWarner) { /* 473 */ return this.enclosingContext.compatible(paramType1, paramType2, paramWarner); /* */ } /* */ /* */ public void report(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, JCDiagnostic paramJCDiagnostic) { /* 477 */ this.enclosingContext.report(paramDiagnosticPosition, paramJCDiagnostic); /* */ } /* */ /* */ public Warner checkWarner(JCDiagnostic.DiagnosticPosition paramDiagnosticPosition, Type paramType1, Type paramType2) { /* 481 */ return this.enclosingContext.checkWarner(paramDiagnosticPosition, paramType1, paramType2); /* */ } /* */ /* */ public Infer.InferenceContext inferenceContext() { /* 485 */ return this.enclosingContext.inferenceContext(); /* */ } /* */ /* */ public DeferredAttr.DeferredAttrContext deferredAttrContext() { /* 489 */ return this.enclosingContext.deferredAttrContext(); /* */ } /* */ } /* */ /* */ class Validator extends JCTree.Visitor /* */ { /* */ boolean checkRaw; /* */ boolean isOuter; /* */ Env<AttrContext> env; /* */ /* */ Validator() /* */ { /* */ Object localObject; /* 1249 */ this.env = localObject; /* */ } /* */ /* */ public void visitTypeArray(JCTree.JCArrayTypeTree paramJCArrayTypeTree) /* */ { /* 1254 */ validateTree(paramJCArrayTypeTree.elemtype, this.checkRaw, this.isOuter); /* */ } /* */ /* */ public void visitTypeApply(JCTree.JCTypeApply paramJCTypeApply) /* */ { /* 1259 */ if (paramJCTypeApply.type.hasTag(TypeTag.CLASS)) { /* 1260 */ List localList1 = paramJCTypeApply.arguments; /* 1261 */ List localList2 = paramJCTypeApply.type.tsym.type.getTypeArguments(); /* */ /* 1263 */ Type localType = Check.this.firstIncompatibleTypeArg(paramJCTypeApply.type); /* 1264 */ if (localType != null) { /* 1265 */ for (JCTree localJCTree : paramJCTypeApply.arguments) { /* 1266 */ if (localJCTree.type == localType) { /* 1267 */ Check.this.log.error(localJCTree, "not.within.bounds", new Object[] { localType, localList2.head }); /* */ } /* 1269 */ localList2 = localList2.tail; /* */ } /* */ } /* */ /* 1273 */ localList2 = paramJCTypeApply.type.tsym.type.getTypeArguments(); /* */ /* 1275 */ int i = paramJCTypeApply.type.tsym.flatName() == Check.this.names.java_lang_Class ? 1 : 0; /* */ /* 1279 */ while ((localList1.nonEmpty()) && (localList2.nonEmpty())) { /* 1280 */ validateTree((JCTree)localList1.head, (!this.isOuter) || (i == 0), false); /* */ /* 1283 */ localList1 = localList1.tail; /* 1284 */ localList2 = localList2.tail; /* */ } /* */ /* 1289 */ if (paramJCTypeApply.type.getEnclosingType().isRaw()) /* 1290 */ Check.this.log.error(paramJCTypeApply.pos(), "improperly.formed.type.inner.raw.param", new Object[0]); /* 1291 */ if (paramJCTypeApply.clazz.hasTag(JCTree.Tag.SELECT)) /* 1292 */ visitSelectInternal((JCTree.JCFieldAccess)paramJCTypeApply.clazz); /* */ } /* */ } /* */ /* */ public void visitTypeParameter(JCTree.JCTypeParameter paramJCTypeParameter) /* */ { /* 1298 */ validateTrees(paramJCTypeParameter.bounds, true, this.isOuter); /* 1299 */ Check.this.checkClassBounds(paramJCTypeParameter.pos(), paramJCTypeParameter.type); /* */ } /* */ /* */ public void visitWildcard(JCTree.JCWildcard paramJCWildcard) /* */ { /* 1304 */ if (paramJCWildcard.inner != null) /* 1305 */ validateTree(paramJCWildcard.inner, true, this.isOuter); /* */ } /* */ /* */ public void visitSelect(JCTree.JCFieldAccess paramJCFieldAccess) /* */ { /* 1310 */ if (paramJCFieldAccess.type.hasTag(TypeTag.CLASS)) { /* 1311 */ visitSelectInternal(paramJCFieldAccess); /* */ /* 1315 */ if ((paramJCFieldAccess.selected.type.isParameterized()) && (paramJCFieldAccess.type.tsym.type.getTypeArguments().nonEmpty())) /* 1316 */ Check.this.log.error(paramJCFieldAccess.pos(), "improperly.formed.type.param.missing", new Object[0]); /* */ } /* */ } /* */ /* */ public void visitSelectInternal(JCTree.JCFieldAccess paramJCFieldAccess) { /* 1321 */ if ((paramJCFieldAccess.type.tsym.isStatic()) && /* 1322 */ (paramJCFieldAccess.selected.type /* 1322 */ .isParameterized())) /* */ { /* 1326 */ Check.this.log.error(paramJCFieldAccess.pos(), "cant.select.static.class.from.param.type", new Object[0]); /* */ } /* */ else /* 1329 */ paramJCFieldAccess.selected.accept(this); /* */ } /* */ /* */ public void visitAnnotatedType(JCTree.JCAnnotatedType paramJCAnnotatedType) /* */ { /* 1335 */ paramJCAnnotatedType.underlyingType.accept(this); /* */ } /* */ /* */ public void visitTypeIdent(JCTree.JCPrimitiveTypeTree paramJCPrimitiveTypeTree) /* */ { /* 1340 */ if (paramJCPrimitiveTypeTree.type.hasTag(TypeTag.VOID)) { /* 1341 */ Check.this.log.error(paramJCPrimitiveTypeTree.pos(), "void.not.allowed.here", new Object[0]); /* */ } /* 1343 */ super.visitTypeIdent(paramJCPrimitiveTypeTree); /* */ } /* */ /* */ public void visitTree(JCTree paramJCTree) /* */ { /* */ } /* */ /* */ public void validateTree(JCTree paramJCTree, boolean paramBoolean1, boolean paramBoolean2) /* */ { /* 1353 */ if (paramJCTree != null) { /* 1354 */ boolean bool = this.checkRaw; /* 1355 */ this.checkRaw = paramBoolean1; /* 1356 */ this.isOuter = paramBoolean2; /* */ try /* */ { /* 1359 */ paramJCTree.accept(this); /* 1360 */ if (paramBoolean1) /* 1361 */ Check.this.checkRaw(paramJCTree, this.env); /* */ } catch (Symbol.CompletionFailure localCompletionFailure) { /* 1363 */ Check.this.completionError(paramJCTree.pos(), localCompletionFailure); /* */ } finally { /* 1365 */ this.checkRaw = bool; /* */ } /* */ } /* */ } /* */ /* */ public void validateTrees(List<? extends JCTree> paramList, boolean paramBoolean1, boolean paramBoolean2) { /* 1371 */ for (Object localObject = paramList; ((List)localObject).nonEmpty(); localObject = ((List)localObject).tail) /* 1372 */ validateTree((JCTree)((List)localObject).head, paramBoolean1, paramBoolean2); /* */ } /* */ } /* */ } /* Location: D:\dt\jdk\tools.jar * Qualified Name: com.sun.tools.javac.comp.Check * JD-Core Version: 0.6.2 */
f9f07f2137edf42565fbe10754310de70cca5e7e
32fe859d0fb15bfc72d5950fd2b2cccdc00dd37a
/library/src/main/java/com/yongchun/library/utils/LocalMediaLoader.java
e7565d0ce1d73089ef86fd7fb8c8233cb4c3f1ce
[]
no_license
Zeratul96/EasyChat
e50a07c52e44d31874bb4a0f13eeaa5ef1c32452
2b0f088506673ac79f5023041b1527d04ac10480
refs/heads/master
2020-03-22T01:18:26.846902
2019-07-18T12:57:05
2019-07-18T12:57:05
134,116,270
0
0
null
null
null
null
UTF-8
Java
false
false
7,280
java
package com.yongchun.library.utils; import android.database.Cursor; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import com.yongchun.library.model.LocalMedia; import com.yongchun.library.model.LocalMediaFolder; import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; /** * Created by dee on 15/11/19. * */ public class LocalMediaLoader { // load type public static final int TYPE_IMAGE = 1; public static final int TYPE_VIDEO = 2; private final static String[] IMAGE_PROJECTION = { MediaStore.Images.Media.DATA, MediaStore.Images.Media.DISPLAY_NAME, MediaStore.Images.Media.DATE_ADDED, MediaStore.Images.Media._ID}; private final static String[] VIDEO_PROJECTION = { MediaStore.Video.Media.DATA, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.DATE_ADDED, MediaStore.Video.Media._ID, MediaStore.Video.Media.DURATION}; private int type = TYPE_IMAGE; private FragmentActivity activity; public LocalMediaLoader(FragmentActivity activity, int type) { this.activity = activity; this.type = type; } HashSet<String> mDirPaths = new HashSet<String>(); public void loadAllImage(final LocalMediaLoadListener imageLoadListener) { activity.getSupportLoaderManager().initLoader(type, null, new LoaderManager.LoaderCallbacks<Cursor>() { @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { CursorLoader cursorLoader = null; if (id == TYPE_IMAGE) { cursorLoader = new CursorLoader( activity, MediaStore.Images.Media.EXTERNAL_CONTENT_URI, IMAGE_PROJECTION, MediaStore.Images.Media.MIME_TYPE + "=? or " + MediaStore.Images.Media.MIME_TYPE + "=?", new String[]{"image/jpeg", "image/png"}, IMAGE_PROJECTION[2] + " DESC"); } else if (id == TYPE_VIDEO) { cursorLoader = new CursorLoader( activity, MediaStore.Video.Media.EXTERNAL_CONTENT_URI, VIDEO_PROJECTION, null, null, VIDEO_PROJECTION[2] + " DESC"); } return cursorLoader; } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { ArrayList<LocalMediaFolder> imageFolders = new ArrayList<LocalMediaFolder>(); LocalMediaFolder allImageFolder = new LocalMediaFolder(); List<LocalMedia> allImages = new ArrayList<LocalMedia>(); while (data != null && data.moveToNext()) { // 获取图片的路径 String path = data.getString(data .getColumnIndex(MediaStore.Images.Media.DATA)); File file = new File(path); if (!file.exists()) continue; // 获取该图片的目录路径名 File parentFile = file.getParentFile(); if (parentFile == null || !parentFile.exists()) continue; String dirPath = parentFile.getAbsolutePath(); // 利用一个HashSet防止多次扫描同一个文件夹 if (mDirPaths.contains(dirPath)) { continue; } else { mDirPaths.add(dirPath); } if (parentFile.list() == null) continue; LocalMediaFolder localMediaFolder = getImageFolder(path, imageFolders); File[] files = parentFile.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { if (filename.endsWith(".jpg") || filename.endsWith(".png") || filename.endsWith(".jpeg")) return true; return false; } }); ArrayList<LocalMedia> images = new ArrayList<>(); for (int i = 0; i < files.length; i++) { File f = files[i]; LocalMedia localMedia = new LocalMedia(f.getAbsolutePath()); allImages.add(localMedia); images.add(localMedia); } if (images.size() > 0) { localMediaFolder.setImages(images); localMediaFolder.setImageNum(localMediaFolder.getImages().size()); imageFolders.add(localMediaFolder); } } allImageFolder.setImages(allImages); allImageFolder.setImageNum(allImageFolder.getImages().size()); allImageFolder.setFirstImagePath(allImages.get(0).getPath()); allImageFolder.setName(activity.getString(com.yongchun.library.R.string.all_image)); imageFolders.add(allImageFolder); sortFolder(imageFolders); imageLoadListener.loadComplete(imageFolders); if (data != null) data.close(); } @Override public void onLoaderReset(Loader<Cursor> loader) { } }); } private void sortFolder(List<LocalMediaFolder> imageFolders) { // 文件夹按图片数量排序 Collections.sort(imageFolders, new Comparator<LocalMediaFolder>() { @Override public int compare(LocalMediaFolder lhs, LocalMediaFolder rhs) { if (lhs.getImages() == null || rhs.getImages() == null) { return 0; } int lsize = lhs.getImageNum(); int rsize = rhs.getImageNum(); return lsize == rsize ? 0 : (lsize < rsize ? 1 : -1); } }); } private LocalMediaFolder getImageFolder(String path, List<LocalMediaFolder> imageFolders) { File imageFile = new File(path); File folderFile = imageFile.getParentFile(); for (LocalMediaFolder folder : imageFolders) { if (folder.getName().equals(folderFile.getName())) { return folder; } } LocalMediaFolder newFolder = new LocalMediaFolder(); newFolder.setName(folderFile.getName()); newFolder.setPath(folderFile.getAbsolutePath()); newFolder.setFirstImagePath(path); return newFolder; } public interface LocalMediaLoadListener { void loadComplete(List<LocalMediaFolder> folders); } }
2a2399b6f882b2d72d563956a2292e342287fdb2
3b8d912ca2bdc5d00462fa95dc13301d677c9574
/src/operators/Casting.java
246e16a47f4d2411cbb65fec78e90d10e7d73f47
[]
no_license
MykolaBova/tech.java.tij3
160348c3cbdfc4d08b18c357310a12f48e8bfceb
6284a376286e61f0a42fce9a936c00485aa5771d
refs/heads/master
2021-01-23T16:51:22.200956
2017-09-07T14:36:36
2017-09-07T14:36:36
102,747,994
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package operators; //: operators/Casting.java public class Casting { public static void main(String[] args) { int i = 200; long lng = (long)i; lng = i; // "Widening," so cast not really required long lng2 = (long)200; lng2 = 200; // A "narrowing conversion": i = (int)lng2; // Cast required } } ///:~
07a651d7b9b46dfe7ba0d72eb04e723fdc5aa6e3
a897a610a1831a7bd159718b1fb7c9fe6f4bee1f
/MyNote/app/src/main/java/com/krkmz/mynote/InputPasswordActivity.java
40d3c9d66849dac512aed1aa7bb3461b6bc2e733
[]
no_license
muratkorkmazoglu/myNote
daefc6b5596a7f74e7ac0998734893af578d62b3
1d0ffe0c2665d4b8e4c9f3e1a8b936cd7b175009
refs/heads/master
2021-08-22T22:34:25.932710
2017-12-01T13:25:37
2017-12-01T13:25:37
105,279,058
1
0
null
null
null
null
UTF-8
Java
false
false
2,096
java
package com.krkmz.mynote; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.WindowManager; import android.widget.Toast; import com.andrognito.patternlockview.PatternLockView; import com.andrognito.patternlockview.listener.PatternLockViewListener; import com.andrognito.patternlockview.utils.PatternLockUtils; import java.util.List; public class InputPasswordActivity extends AppCompatActivity { PatternLockView mPatternLockView; String password; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.input_password_layout); SharedPreferences preferences = getSharedPreferences("PREFS", 0); password = preferences.getString("password", "0"); mPatternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view); mPatternLockView.addPatternLockListener(new PatternLockViewListener() { @Override public void onStarted() { } @Override public void onProgress(List<PatternLockView.Dot> progressPattern) { } @Override public void onComplete(List<PatternLockView.Dot> pattern) { if (password.equals(PatternLockUtils.patternToString(mPatternLockView, pattern))) { Intent ıntent = new Intent(getApplicationContext(), MainActivity.class); startActivity(ıntent); finish(); } else { mPatternLockView.clearPattern(); Toast.makeText(getApplicationContext(), "Wrong Pattern", Toast.LENGTH_LONG).show(); } } @Override public void onCleared() { } }); } }
10e9e0c6e215f7705ecebcccf6d8c82e79378009
feead28f68548d90f716029fc3681c89f749a6ca
/LeetCode/src/com/google/linkedlist/RemoveNthNode.java
62d56a400aebc04ac4f0b88cbd5c56a28de45b7a
[]
no_license
krishnan1159/olaf
685d083f9ecf258254096d3086db264106a49283
c6a07dcbc3980aa94aa94100823b6b5c73761436
refs/heads/master
2023-08-25T00:12:25.646671
2021-10-15T10:41:52
2021-10-15T10:47:21
287,916,897
0
3
null
null
null
null
UTF-8
Java
false
false
1,794
java
package com.google.linkedlist; import com.google.datastructures.ListNode; import java.io.IOException; import java.util.concurrent.atomic.AtomicLong; /** * https://leetcode.com/problems/remove-nth-node-from-end-of-list/ */ public class RemoveNthNode { private static ListNode removeNthFromEnd(ListNode head, int n) { if (head == null) { return null; } ListNode slowPtr = head, fastPtr = head; int numNodesVisited = 1, totalNodes = 0; // 1 indicates the headNode visited. while(fastPtr.next != null && fastPtr.next.next != null) { slowPtr = slowPtr.next; fastPtr = fastPtr.next.next; numNodesVisited += 1; } if (fastPtr.next == null) { totalNodes = numNodesVisited * 2 - 1; } else { totalNodes = numNodesVisited * 2; } int nodeToDelete = totalNodes - n + 1; ListNode traversor; if ( nodeToDelete > numNodesVisited ) { traversor = slowPtr; // traversor will be in middle } else { traversor = head; numNodesVisited = 1; } if (nodeToDelete == 1) { return traversor.next; } while (nodeToDelete > (numNodesVisited + 1)) { traversor = traversor.next; numNodesVisited += 1; } traversor.next = traversor.next.next; return head; } public static void main(String[] args) throws IOException { final int[] l1Inp = new int[]{1,2,3}; final ListNode l1 = ListNode.generateListFromArray(l1Inp); ListNode res = removeNthFromEnd(l1, 3); while (res != null) { System.out.print(" " + res.val); res = res.next; } } }
2a4989919e1cdcafb7da383610560ca4c88cdba2
4eecbff4501d606af9d69d08c126df700a648bad
/app/src/main/java/com/mooc/ppjoke/model/SofaTab.java
5e259db6d5b668493bc73834b9c7592f5c2c8adc
[ "Apache-2.0" ]
permissive
Petermaodan/ppjoke
52090d17db21e2c9eeaae79f025a2a98172126ab
a6dbabc9a845cb2cf70b8265b13f7fa6351d77ea
refs/heads/master
2023-04-23T02:17:47.557781
2021-05-09T08:51:08
2021-05-09T08:51:08
346,345,722
1
0
null
null
null
null
UTF-8
Java
false
false
930
java
package com.mooc.ppjoke.model; import java.util.List; public class SofaTab { /** * activeSize : 16 * normalSize : 14 * activeColor : #ED7282 * normalColor : #666666 * select : 0 * tabGravity : 0 * tabs : [{"title":"图片","index":0,"tag":"pics","enable":true},{"title":"视频","index":1,"tag":"video","enable":true},{"title":"文本","index":1,"tag":"text","enable":true}] */ public int activeSize; public int normalSize; public String activeColor; public String normalColor; public int select; public int tabGravity; public List<Tabs> tabs; public static class Tabs { /** * title : 图片 * index : 0 * tag : pics * enable : true */ public String title; public int index; public String tag; public boolean enable; } }
dd5623d2e8e9f86e19a71723c7584cc1ab046b82
f8744cb1d7658ec3132a4e889f0df3b1e25f0436
/slideback/src/main/java/com/example/slideback/ui/pulltorefresh/OverscrollHelper.java
ba54944b8d8d39777836c685016e841e1be5392f
[]
no_license
shinelyme/MyGithubDemo
7f63938c4138ca69097e2dbd264268ae75689561
9570f4ed2d9d24a37321fbb5ed9e65d70cb0f9fd
refs/heads/master
2020-07-02T05:59:02.855050
2019-08-26T08:27:05
2019-08-26T08:27:05
201,434,162
0
0
null
null
null
null
UTF-8
Java
false
false
9,364
java
/******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * 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 * distributedF 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.example.slideback.ui.pulltorefresh; import android.annotation.TargetApi; import android.util.Log; import android.view.View; @TargetApi(9) public final class OverscrollHelper { static final String LOG_TAG = "OverscrollHelper"; static final float DEFAULT_OVERSCROLL_SCALE = 1f; /** * Helper method for Overscrolling that encapsulates all of the necessary * function. * <p/> * This should only be used on AdapterView's such as ListView as it just * calls through to overScrollBy() with the scrollRange = 0. AdapterView's * do not have a scroll range (i.e. getScrollY() doesn't work). * * @param view - PullToRefreshView that is calling this. * @param deltaX - Change in X in pixels, passed through from from * overScrollBy call * @param scrollX - Current X scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param deltaY - Change in Y in pixels, passed through from from * overScrollBy call * @param scrollY - Current Y scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param isTouchEvent - true if this scroll operation is the result of a * touch event, passed through from from overScrollBy call */ public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX, final int deltaY, final int scrollY, final boolean isTouchEvent) { overScrollBy(view, deltaX, scrollX, deltaY, scrollY, 0, isTouchEvent); } /** * Helper method for Overscrolling that encapsulates all of the necessary * function. This version of the call is used for Views that need to specify * a Scroll Range but scroll back to it's edge correctly. * * @param view - PullToRefreshView that is calling this. * @param deltaX - Change in X in pixels, passed through from from * overScrollBy call * @param scrollX - Current X scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param deltaY - Change in Y in pixels, passed through from from * overScrollBy call * @param scrollY - Current Y scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param scrollRange - Scroll Range of the View, specifically needed for * ScrollView * @param isTouchEvent - true if this scroll operation is the result of a * touch event, passed through from from overScrollBy call */ public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX, final int deltaY, final int scrollY, final int scrollRange, final boolean isTouchEvent) { overScrollBy(view, deltaX, scrollX, deltaY, scrollY, scrollRange, 0, DEFAULT_OVERSCROLL_SCALE, isTouchEvent); } /** * Helper method for Overscrolling that encapsulates all of the necessary * function. This is the advanced version of the call. * * @param view - PullToRefreshView that is calling this. * @param deltaX - Change in X in pixels, passed through from from * overScrollBy call * @param scrollX - Current X scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param deltaY - Change in Y in pixels, passed through from from * overScrollBy call * @param scrollY - Current Y scroll value in pixels before applying deltaY, * passed through from from overScrollBy call * @param scrollRange - Scroll Range of the View, specifically needed for * ScrollView * @param fuzzyThreshold - Threshold for which the values how fuzzy we * should treat the other values. Needed for WebView as it * doesn't always scroll back to it's edge. 0 = no fuzziness. * @param scaleFactor - Scale Factor for overscroll amount * @param isTouchEvent - true if this scroll operation is the result of a * touch event, passed through from from overScrollBy call */ public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX, final int deltaY, final int scrollY, final int scrollRange, final int fuzzyThreshold, final float scaleFactor, final boolean isTouchEvent) { final int deltaValue, currentScrollValue, scrollValue; switch (view.getPullToRefreshScrollDirection()) { case HORIZONTAL: deltaValue = deltaX; scrollValue = scrollX; currentScrollValue = view.getScrollX(); break; case VERTICAL: default: deltaValue = deltaY; scrollValue = scrollY; currentScrollValue = view.getScrollY(); break; } // Check that OverScroll is enabled and that we're not currently // refreshing. if (view.isPullToRefreshOverScrollEnabled() && !view.isRefreshing()) { final PullToRefreshBase.Mode mode = view.getMode(); // Check that Pull-to-Refresh is enabled, and the event isn't from // touch if (((PullToRefreshBase.Mode) mode).permitsPullToRefresh() && !isTouchEvent && deltaValue != 0) { final int newScrollValue = (deltaValue + scrollValue); if (PullToRefreshBase.DEBUG) { Log.d(LOG_TAG, "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY + ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange + ", CurrentScroll: " + currentScrollValue); } if (newScrollValue < (0 - fuzzyThreshold)) { // Check the mode supports the overscroll direction, and // then move scroll if (mode.showHeaderLoadingLayout()) { // If we're currently at zero, we're about to start // overscrolling, so change the state if (currentScrollValue == 0) { view.setState(PullToRefreshBase.State.OVERSCROLLING); } view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue))); } } else if (newScrollValue > (scrollRange + fuzzyThreshold)) { // Check the mode supports the overscroll direction, and // then move scroll if (mode.showFooterLoadingLayout()) { // If we're currently at zero, we're about to start // overscrolling, so change the state if (currentScrollValue == 0) { view.setState(PullToRefreshBase.State.OVERSCROLLING); } view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue - scrollRange))); } } else if (Math.abs(newScrollValue) <= fuzzyThreshold || Math.abs(newScrollValue - scrollRange) <= fuzzyThreshold) { // Means we've stopped overscrolling, so scroll back to 0 view.setState(PullToRefreshBase.State.RESET); } } else if (isTouchEvent && PullToRefreshBase.State.OVERSCROLLING == view.getState()) { // This condition means that we were overscrolling from a fling, // but the user has touched the View and is now overscrolling // from touch instead. We need to just reset. view.setState(PullToRefreshBase.State.RESET); } } } static boolean isAndroidOverScrollEnabled(View view) { return view.getOverScrollMode() != View.OVER_SCROLL_NEVER; } }
ad86ac1d9c5db70a41de41b4beb596b0b8ba039d
a06c8dce6cc7f9d6ff6aafaa68d26c5c9bc331a0
/app/src/main/java/com/lingavin/flickrviewer/ui/MainActivity.java
e1834fce04e1a66e238c354d37762b60cdd8b69f
[]
no_license
gavinlin/FlickrViewer
a80cae406db3c982f9f1e34ad6bb585e7064ad39
4f3531b9b01d7ecca2f5c4514353b379abd53736
refs/heads/master
2021-01-10T20:04:07.981304
2015-05-14T23:53:47
2015-05-14T23:53:47
35,643,031
0
0
null
null
null
null
UTF-8
Java
false
false
5,440
java
package com.lingavin.flickrviewer.ui; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.lingavin.flickrviewer.FlickrApplication; import com.lingavin.flickrviewer.R; import com.lingavin.flickrviewer.model.Photo; import com.lingavin.flickrviewer.utils.Constants; import com.lingavin.flickrviewer.utils.FlickrJsonParser; import com.lingavin.flickrviewer.utils.MLog; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private static final String TAG_STRING_OBJ = "string_req"; private static final String TAG = MainActivity.class.getSimpleName(); private RecyclerView mPhotoview; private ViewPager mDisplayView; private ArrayList<Photo> photos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initToolbar(); intViews(); fetchPhotos(); } /** * use toolbar to replace default action bar */ private void initToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle(R.string.app_name); } private void intViews() { mPhotoview = (RecyclerView)findViewById(R.id.main_recycler_view); mDisplayView = (ViewPager)findViewById(R.id.main_display_view_pager); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); //set recycler view's orientation to horizontal linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); mPhotoview.setLayoutManager(linearLayoutManager); } /** * fetch json from flickr and parse it */ private void fetchPhotos() { // use volley to get json string from internet StringRequest strReq = new StringRequest(Request.Method.GET, Constants.STR_URL, new Response.Listener<String>() { @Override public void onResponse(String response) { photos = new ArrayList<>(); photos.addAll(FlickrJsonParser.parsePhotos(response)); MLog.i(TAG, photos.toString()); PhotosAdapter adapter = new PhotosAdapter(photos, MainActivity.this); adapter.setOnItemClickListener(new PhotosAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { mDisplayView.setCurrentItem(position); } }); mPhotoview.setAdapter(adapter); mDisplayView.setAdapter(new DisplayAdapter(photos)); // set View Pager's on page change listener // notify recyclerview when view page changed mDisplayView.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { ((PhotosAdapter)mPhotoview.getAdapter()).setSelectedNum(position); mPhotoview.getAdapter().notifyDataSetChanged(); mPhotoview.scrollToPosition(position); } @Override public void onPageScrollStateChanged(int state) { } }); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(MainActivity.this, R.string.fetch_error, Toast.LENGTH_SHORT).show(); } }); strReq.setTag(TAG_STRING_OBJ); //start fetch photo from internet FlickrApplication.getInstance().getRequestQueue().add(strReq); } @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_refresh) { fetchPhotos(); return true; } return super.onOptionsItemSelected(item); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } }
56fec539f1d252de067b57a24daa002fd7f39e67
12139b5ebb761a2fba93bccb851654357f91c6f6
/paascloud-provider/paascloud-provider-uac/src/main/java/com/paascloud/provider/model/dto/email/SendEmailMessage.java
0aaee44a5fd1c49a28ff1bb3f03ecff6431f37d1
[ "Apache-2.0" ]
permissive
akcoat/springcloudTest
f6f17c7abc49ae399816d1c043463f85cdc2557f
90297c03791b7178cc0eadd005a23eb59a9cc00a
refs/heads/master
2022-11-17T21:48:49.660753
2019-06-30T15:17:24
2019-06-30T15:17:24
193,732,561
0
0
Apache-2.0
2022-11-16T08:00:12
2019-06-25T15:14:55
Java
UTF-8
Java
false
false
1,234
java
/* * Copyright (c) 2018. paascloud.net All Rights Reserved. * 项目名称:paascloud快速搭建企业级分布式微服务平台 * 类名称:SendEmailMessage.java * 创建人:刘兆明 * 联系方式:[email protected] * 开源地址: https://github.com/paascloud * 博客地址: http://blog.paascloud.net * 项目官网: http://paascloud.net */ package com.paascloud.provider.model.dto.email; import lombok.Data; import java.io.Serializable; /** * The class Send email message. * * @author [email protected] */ @Data public class SendEmailMessage implements Serializable { private static final long serialVersionUID = -8708881656765856624L; /** * 登录名 */ private String loginName; /** * 手机号码 */ private String email; /** * 验证码 */ private String emailCode; /** * 邮件模板Code */ private String emailTemplateCode; /** * Instantiates a new Send email message. */ public SendEmailMessage() { } /** * Instantiates a new Send email message. * * @param email the email */ public SendEmailMessage(String email) { this.email = email; } }
6c0cda5eb9d369921e62b85a6e94ad9aa0883045
c86bc28214143d28ccea5add021e8b8ecd7518db
/src/main/java/br/com/firstdatacorp/apipagamentos/SwaggerConfig.java
c0b95d32e3a471e12c8f7e44d44f4f6a3fd221c8
[]
no_license
wilsonhh/api-pagamentos
e1be87f9c29b222f5087805be25b11b7f8b497f5
1904503377b54267987969ecdbabc28866e79d62
refs/heads/master
2020-06-22T08:08:02.253661
2019-07-19T01:24:27
2019-07-19T01:24:27
197,678,347
0
0
null
null
null
null
UTF-8
Java
false
false
2,825
java
package br.com.firstdatacorp.apipagamentos; import java.util.List; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.google.common.collect.Lists; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.service.ApiKey; import springfox.documentation.service.AuthorizationScope; import springfox.documentation.service.Contact; import springfox.documentation.service.SecurityReference; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @Configuration public class SwaggerConfig { public static final String AUTHORIZATION_HEADER = "Authorization"; public static final String DEFAULT_INCLUDE_PATTERN = "/resources/.*"; @Bean public Docket detalheApi() { Docket docket = new Docket(DocumentationType.SWAGGER_2); docket.apiInfo(informacoesApi().build()).pathMapping("/").apiInfo(ApiInfo.DEFAULT).forCodeGeneration(true) .securityContexts(Lists.newArrayList(securityContext())).securitySchemes(Lists.newArrayList(apiKey())) .useDefaultResponseMessages(false); docket = docket.select().paths(PathSelectors.regex(DEFAULT_INCLUDE_PATTERN)).build(); return docket; } private ApiInfoBuilder informacoesApi() { ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder(); apiInfoBuilder.title("Api-Validator"); apiInfoBuilder.description("Api para validação cadastral via token"); apiInfoBuilder.version("1.0"); apiInfoBuilder .termsOfServiceUrl("Termo de uso: Serviços de geração e validação do token para permitir cadastros"); apiInfoBuilder.license("Licença - Open Source"); apiInfoBuilder.licenseUrl("https://www.firstdata.com/pt_br/home.html"); apiInfoBuilder.contact(this.contato()); return apiInfoBuilder; } private Contact contato() { return new Contact("First Data", "https://www.firstdata.com/pt_br/home.html", ""); } private ApiKey apiKey() { return new ApiKey("JWT", AUTHORIZATION_HEADER, "header"); } private SecurityContext securityContext() { return SecurityContext.builder().securityReferences(defaultAuth()) .forPaths(PathSelectors.regex(DEFAULT_INCLUDE_PATTERN)).build(); } List<SecurityReference> defaultAuth() { AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; authorizationScopes[0] = authorizationScope; return Lists.newArrayList(new SecurityReference("JWT", authorizationScopes)); } }
f57c7140ce8b773b3190dadf09b6cb0b8c2d469e
cd2207266cf07c306e1c44b4c8c4bc77bd92b8b5
/src/main/java/com/whnm/mediappbackend/restcontroller/EspecialidadRestController.java
2e2d880c52ee7e930f0f111d76a0769c330719ff
[]
no_license
wilsonn/mediapp
0a262ec645fdc4f5b37cb218465e42ba4b91f2b3
f70c6f243e59d48b93bac3336d60ac5d06486dc7
refs/heads/main
2023-08-06T17:07:39.279123
2021-09-21T23:10:19
2021-09-21T23:10:19
403,126,459
0
0
null
null
null
null
UTF-8
Java
false
false
4,920
java
package com.whnm.mediappbackend.restcontroller; import java.net.URI; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import javax.validation.Valid; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import com.whnm.mediappbackend.dto.EspecialidadDTO; import com.whnm.mediappbackend.entity.Especialidad; import com.whnm.mediappbackend.exception.ModeloNoFoundException; import com.whnm.mediappbackend.service.EspecialidadService; @RestController @RequestMapping("/especialidades") public class EspecialidadRestController { @Autowired private EspecialidadService especialidadService; @Autowired private ModelMapper modelMapper; @GetMapping public ResponseEntity<List<EspecialidadDTO>> listar() throws Exception { List<EspecialidadDTO> listaEspecialidadsDTO = especialidadService.listar().stream() .map( especialidad -> modelMapper.map(especialidad, EspecialidadDTO.class) ) .collect(Collectors.toList()); return new ResponseEntity<>(listaEspecialidadsDTO, HttpStatus.OK); } @GetMapping("/{id}") public ResponseEntity<EspecialidadDTO> listarPorId(@PathVariable("id") Long id) throws Exception { Optional<Especialidad> especialidad = especialidadService.listarPorId(id); if (!especialidad.isPresent()) { throw new ModeloNoFoundException("Especialidad con id: " + id + " no encontrado"); } return new ResponseEntity<>( modelMapper.map( especialidad.get(), EspecialidadDTO.class ), HttpStatus.OK ); } @PostMapping public ResponseEntity<Void> registrar(@Valid @RequestBody EspecialidadDTO especialidadDto) throws Exception { Especialidad especialidad = modelMapper.map(especialidadDto, Especialidad.class); Especialidad especialidadRegistro = especialidadService.registrar(especialidad); EspecialidadDTO especialidadDTORegistro = modelMapper.map(especialidadRegistro,EspecialidadDTO.class); URI location = ServletUriComponentsBuilder.fromCurrentRequest() .path("/{id}").buildAndExpand(especialidadDTORegistro.getIdEspecialidad()).toUri(); return ResponseEntity.created(location).build(); } @PutMapping("/{id}") public ResponseEntity<EspecialidadDTO> modificar(@Valid @RequestBody EspecialidadDTO especialidadDTOMod) throws Exception { Optional<Especialidad> especialidad = especialidadService.listarPorId(especialidadDTOMod.getIdEspecialidad()); if (especialidad.isPresent()) { especialidadDTOMod = modelMapper.map( especialidadService.modificar( modelMapper.map(especialidadDTOMod, Especialidad.class) ), EspecialidadDTO.class ); } else { throw new ModeloNoFoundException( "Especialidad con id: " + especialidadDTOMod.getIdEspecialidad() + " no encontrado" ); } return new ResponseEntity<>(especialidadDTOMod, HttpStatus.OK); } @DeleteMapping("/{id}") public ResponseEntity<Void> eliminar(@PathVariable("id") Long id) throws Exception { Optional<Especialidad> especialidad = especialidadService.listarPorId(id); if (especialidad.isPresent()) { especialidadService.eliminar(id); } else { throw new ModeloNoFoundException( "Especialidad con id: " + id + " no encontrado" ); } return new ResponseEntity<>(HttpStatus.NO_CONTENT); } @GetMapping("/hateoas/{id}") public EntityModel<EspecialidadDTO> listarHeteoasPorId(@PathVariable("id") Long id) throws Exception { Optional<Especialidad> especialidad = especialidadService.listarPorId(id); if (!especialidad.isPresent()) { throw new ModeloNoFoundException( "Especialidad con id: " + id + " no encontrado" ); } EspecialidadDTO especialidadDTO = modelMapper.map(especialidad.get(), EspecialidadDTO.class); EntityModel<EspecialidadDTO> recurso = EntityModel.of(especialidadDTO); WebMvcLinkBuilder link1 = linkTo(methodOn(this.getClass()).listarPorId(id)); recurso.add(link1.withRel("especialidadRecurso1")); return recurso; } }
8b89f7cfae090edd46f0aad0373c0b99bdf9ebc9
ffaa178f5c53d6d82f7801281a10e299d01831b9
/src/main/java/com/thebytecloud/springwithangular/jwt/resource/JwtTokenResponse.java
0ea650afa83a3116d6e7e76e6af041a2631fa58b
[]
no_license
nanthakumarg/spring-with-angular
894e1e6bc5e2f9b5e34432330331c9ffee027e75
a76d272f71c132f68287888790cd173ef61f769d
refs/heads/master
2023-01-08T03:57:14.782059
2019-12-30T12:27:22
2019-12-30T12:27:22
230,423,478
0
0
null
2023-01-06T00:56:21
2019-12-27T10:25:03
TypeScript
UTF-8
Java
false
false
364
java
package com.thebytecloud.springwithangular.jwt.resource; import java.io.Serializable; public class JwtTokenResponse implements Serializable { private static final long serialVersionUID = 8317676219297719109L; private final String token; public JwtTokenResponse(String token) { this.token = token; } public String getToken() { return this.token; } }
42ffcf8a18603179fa6944732f28d93e5c8db161
5835e9f2d028f0afaafe6583ba248384d4b10bb6
/src/main/java/org/zerock/persistence/UserDAO.java
bbaa5680423a25a98c40dd6f79d95d9996e98507
[]
no_license
meloning/Spring-Zerock
f3e79a44e82eb2353de9c04364b61dc749439089
88fb38edd23b14692b4957e7bbf266f044695c1c
refs/heads/master
2022-12-22T05:07:21.460561
2019-05-23T16:12:57
2019-05-23T16:12:57
186,214,852
0
0
null
2022-12-16T10:32:12
2019-05-12T05:19:37
HTML
UTF-8
Java
false
false
432
java
package org.zerock.persistence; import java.sql.Date; import org.zerock.domain.LoginDTO; import org.zerock.domain.UserVO; public interface UserDAO { public UserVO login(LoginDTO dto)throws Exception; public void keepLogin(String uid,String sessionId,Date next); public UserVO checkUserWithSessionKey(String value); public void memberRegister(UserVO userVO); public String getUserPass(String uid) throws Exception; }
3ac6d5b356bedff4fc7214296cd8b4870ca9d383
efca855f83be608cc5fcd5f9976b820f09f11243
/consensus/common/src/main/java/org/enterchain/enter/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java
930b760b42625714d4b0157b359d73e244d7a57d
[ "Apache-2.0" ]
permissive
enterpact/enterchain
5438e127c851597cbd7e274526c3328155483e58
d8b272fa6885e5d263066da01fff3be74a6357a0
refs/heads/master
2023-05-28T12:48:02.535365
2021-06-09T20:44:01
2021-06-09T20:44:01
375,483,000
0
0
null
null
null
null
UTF-8
Java
false
false
5,139
java
/* * Copyright ConsenSys AG. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * SPDX-License-Identifier: Apache-2.0 */ package org.enterchain.enter.consensus.common.bft.blockcreation; import org.enterchain.enter.consensus.common.ConsensusHelpers; import org.enterchain.enter.consensus.common.ValidatorVote; import org.enterchain.enter.consensus.common.VoteTally; import org.enterchain.enter.consensus.common.bft.BftContext; import org.enterchain.enter.consensus.common.bft.BftExtraData; import org.enterchain.enter.consensus.common.bft.BftExtraDataCodec; import org.enterchain.enter.consensus.common.bft.Vote; import org.enterchain.enter.ethereum.ProtocolContext; import org.enterchain.enter.ethereum.blockcreation.GasLimitCalculator; import org.enterchain.enter.ethereum.core.Address; import org.enterchain.enter.ethereum.core.BlockHeader; import org.enterchain.enter.ethereum.core.MiningParameters; import org.enterchain.enter.ethereum.core.Wei; import org.enterchain.enter.ethereum.eth.transactions.PendingTransactions; import org.enterchain.enter.ethereum.mainnet.ProtocolSchedule; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; import org.apache.tuweni.bytes.Bytes; public class BftBlockCreatorFactory { private final GasLimitCalculator gasLimitCalculator; private final PendingTransactions pendingTransactions; protected final ProtocolContext protocolContext; protected final ProtocolSchedule protocolSchedule; private final BftExtraDataCodec bftExtraDataCodec; private final Address localAddress; final Address miningBeneficiary; private volatile Bytes vanityData; private volatile Wei minTransactionGasPrice; private volatile Double minBlockOccupancyRatio; public BftBlockCreatorFactory( final GasLimitCalculator gasLimitCalculator, final PendingTransactions pendingTransactions, final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, final MiningParameters miningParams, final Address localAddress, final Address miningBeneficiary, final BftExtraDataCodec bftExtraDataCodec) { this.gasLimitCalculator = gasLimitCalculator; this.pendingTransactions = pendingTransactions; this.protocolContext = protocolContext; this.protocolSchedule = protocolSchedule; this.localAddress = localAddress; this.minTransactionGasPrice = miningParams.getMinTransactionGasPrice(); this.minBlockOccupancyRatio = miningParams.getMinBlockOccupancyRatio(); this.vanityData = miningParams.getExtraData(); this.miningBeneficiary = miningBeneficiary; this.bftExtraDataCodec = bftExtraDataCodec; } public BftBlockCreator create(final BlockHeader parentHeader, final int round) { return new BftBlockCreator( localAddress, ph -> createExtraData(round, ph), pendingTransactions, protocolContext, protocolSchedule, gasLimitCalculator, minTransactionGasPrice, minBlockOccupancyRatio, parentHeader, miningBeneficiary, bftExtraDataCodec); } public void setExtraData(final Bytes extraData) { this.vanityData = extraData.copy(); } public void setMinTransactionGasPrice(final Wei minTransactionGasPrice) { this.minTransactionGasPrice = minTransactionGasPrice; } public Wei getMinTransactionGasPrice() { return minTransactionGasPrice; } public Bytes createExtraData(final int round, final BlockHeader parentHeader) { final BftContext bftContext = protocolContext.getConsensusState(BftContext.class); final VoteTally voteTally = bftContext.getVoteTallyCache().getVoteTallyAfterBlock(parentHeader); final Optional<ValidatorVote> proposal = bftContext.getVoteProposer().getVote(localAddress, voteTally); final List<Address> validators = new ArrayList<>(voteTally.getValidators()); final BftExtraData extraData = new BftExtraData( ConsensusHelpers.zeroLeftPad(vanityData, BftExtraDataCodec.EXTRA_VANITY_LENGTH), Collections.emptyList(), toVote(proposal), round, validators); return bftExtraDataCodec.encode(extraData); } public void changeTargetGasLimit(final Long targetGasLimit) { gasLimitCalculator.changeTargetGasLimit(targetGasLimit); } public Address getLocalAddress() { return localAddress; } private static Optional<Vote> toVote(final Optional<ValidatorVote> input) { return input .map(v -> Optional.of(new Vote(v.getRecipient(), v.getVotePolarity()))) .orElse(Optional.empty()); } }
758a7bc087fd9bd8660a997c451a2be17c5a03f2
e7ee311e20b40c87bf6d23a53a1d7b11fd29d2c3
/src/chosun/ciis/ss/sls/camp/dm/SS_I_CAMP_EXTNDM.java
f26d0b6ae9a76153fc16b1b4264f5e9c079a2ecf
[]
no_license
nosmoon/misdevteam
4e3695ef7bbdcd231bb84d7d8d7df54a23ff0a60
1829d5bd489eb6dd307ca244f0e183a31a1de773
refs/heads/master
2020-04-15T15:57:05.480056
2019-01-10T01:12:01
2019-01-10T01:12:01
164,812,547
1
0
null
null
null
null
UHC
Java
false
false
37,920
java
/*************************************************************************************************** * 파일명 : SP_SS_I_CAMP_EXTN.java * 기능 : 캠페인확장 * 작성일자 : 2005/05/26 * 작성자 : 이혁 **************************************************************************************************/ package chosun.ciis.ss.sls.camp.dm; import java.sql.*; import oracle.jdbc.driver.*; import somo.framework.db.*; import somo.framework.util.*; import chosun.ciis.ss.sls.camp.ds.*; import chosun.ciis.ss.sls.camp.rec.*; /** * 캠페인확장 */ public class SS_I_CAMP_EXTNDM extends somo.framework.db.BaseDM implements java.io.Serializable{ public String jobflag; public String accflag; public String dt; public String no; public String rshpclsfcd; public String aplcpersnm; public String aplcperstel_no1; public String aplcperstel_no2; public String aplcperstel_no3; public String aplcpersemail; public String aplcpersptph_no1; public String aplcpersptph_no2; public String aplcpersptph_no3; public String aplcperszip; public String aplcpersaddr; public String aplcpersdtlsaddr; public String rdr_no; public String rdrnm; public String natncd; public String rdrtel_no1; public String rdrtel_no2; public String rdrtel_no3; public String rdremail; public String rdrptph_no1; public String rdrptph_no2; public String rdrptph_no3; public String dlvzip; public String dlvaddr; public String dlvdtlsaddr; public String movmresiclsf; public String movmresitype; public String movmdt; public String medicd; public String qty; public String dlvhopedt; public String bocd; public String bocd2; public String resiclsfcd; public String resitypecd; public String dscttypecd; public String titl; public String cont; public String clsfcd; public String suspfrdt; public String susptodt; public String vaca_arearegncd; public String vaca_areacd; public String uid; public String nm; public String remk; public String cnscnfmyn; public String cnscnfmcd; public String camptypecd; public String campid; public SS_I_CAMP_EXTNDM(){} public SS_I_CAMP_EXTNDM(String jobflag, String accflag, String dt, String no, String rshpclsfcd, String aplcpersnm, String aplcperstel_no1, String aplcperstel_no2, String aplcperstel_no3, String aplcpersemail, String aplcpersptph_no1, String aplcpersptph_no2, String aplcpersptph_no3, String aplcperszip, String aplcpersaddr, String aplcpersdtlsaddr, String rdr_no, String rdrnm, String natncd, String rdrtel_no1, String rdrtel_no2, String rdrtel_no3, String rdremail, String rdrptph_no1, String rdrptph_no2, String rdrptph_no3, String dlvzip, String dlvaddr, String dlvdtlsaddr, String movmresiclsf, String movmresitype, String movmdt, String medicd, String qty, String dlvhopedt, String bocd, String bocd2, String resiclsfcd, String resitypecd, String dscttypecd, String titl, String cont, String clsfcd, String suspfrdt, String susptodt, String vaca_arearegncd, String vaca_areacd, String uid, String nm, String remk, String cnscnfmyn, String cnscnfmcd, String camptypecd, String campid){ this.jobflag = jobflag; this.accflag = accflag; this.dt = dt; this.no = no; this.rshpclsfcd = rshpclsfcd; this.aplcpersnm = aplcpersnm; this.aplcperstel_no1 = aplcperstel_no1; this.aplcperstel_no2 = aplcperstel_no2; this.aplcperstel_no3 = aplcperstel_no3; this.aplcpersemail = aplcpersemail; this.aplcpersptph_no1 = aplcpersptph_no1; this.aplcpersptph_no2 = aplcpersptph_no2; this.aplcpersptph_no3 = aplcpersptph_no3; this.aplcperszip = aplcperszip; this.aplcpersaddr = aplcpersaddr; this.aplcpersdtlsaddr = aplcpersdtlsaddr; this.rdr_no = rdr_no; this.rdrnm = rdrnm; this.natncd = natncd; this.rdrtel_no1 = rdrtel_no1; this.rdrtel_no2 = rdrtel_no2; this.rdrtel_no3 = rdrtel_no3; this.rdremail = rdremail; this.rdrptph_no1 = rdrptph_no1; this.rdrptph_no2 = rdrptph_no2; this.rdrptph_no3 = rdrptph_no3; this.dlvzip = dlvzip; this.dlvaddr = dlvaddr; this.dlvdtlsaddr = dlvdtlsaddr; this.movmresiclsf = movmresiclsf; this.movmresitype = movmresitype; this.movmdt = movmdt; this.medicd = medicd; this.qty = qty; this.dlvhopedt = dlvhopedt; this.bocd = bocd; this.bocd2 = bocd2; this.resiclsfcd = resiclsfcd; this.resitypecd = resitypecd; this.dscttypecd = dscttypecd; this.titl = titl; this.cont = cont; this.clsfcd = clsfcd; this.suspfrdt = suspfrdt; this.susptodt = susptodt; this.vaca_arearegncd = vaca_arearegncd; this.vaca_areacd = vaca_areacd; this.uid = uid; this.nm = nm; this.remk = remk; this.cnscnfmyn = cnscnfmyn; this.cnscnfmcd = cnscnfmcd; this.camptypecd = camptypecd; this.campid = campid; } public void setJobflag(String jobflag){ this.jobflag = jobflag; } public void setAccflag(String accflag){ this.accflag = accflag; } public void setDt(String dt){ this.dt = dt; } public void setNo(String no){ this.no = no; } public void setRshpclsfcd(String rshpclsfcd){ this.rshpclsfcd = rshpclsfcd; } public void setAplcpersnm(String aplcpersnm){ this.aplcpersnm = aplcpersnm; } public void setAplcperstel_no1(String aplcperstel_no1){ this.aplcperstel_no1 = aplcperstel_no1; } public void setAplcperstel_no2(String aplcperstel_no2){ this.aplcperstel_no2 = aplcperstel_no2; } public void setAplcperstel_no3(String aplcperstel_no3){ this.aplcperstel_no3 = aplcperstel_no3; } public void setAplcpersemail(String aplcpersemail){ this.aplcpersemail = aplcpersemail; } public void setAplcpersptph_no1(String aplcpersptph_no1){ this.aplcpersptph_no1 = aplcpersptph_no1; } public void setAplcpersptph_no2(String aplcpersptph_no2){ this.aplcpersptph_no2 = aplcpersptph_no2; } public void setAplcpersptph_no3(String aplcpersptph_no3){ this.aplcpersptph_no3 = aplcpersptph_no3; } public void setAplcperszip(String aplcperszip){ this.aplcperszip = aplcperszip; } public void setAplcpersaddr(String aplcpersaddr){ this.aplcpersaddr = aplcpersaddr; } public void setAplcpersdtlsaddr(String aplcpersdtlsaddr){ this.aplcpersdtlsaddr = aplcpersdtlsaddr; } public void setRdr_no(String rdr_no){ this.rdr_no = rdr_no; } public void setRdrnm(String rdrnm){ this.rdrnm = rdrnm; } public void setNatncd(String natncd){ this.natncd = natncd; } public void setRdrtel_no1(String rdrtel_no1){ this.rdrtel_no1 = rdrtel_no1; } public void setRdrtel_no2(String rdrtel_no2){ this.rdrtel_no2 = rdrtel_no2; } public void setRdrtel_no3(String rdrtel_no3){ this.rdrtel_no3 = rdrtel_no3; } public void setRdremail(String rdremail){ this.rdremail = rdremail; } public void setRdrptph_no1(String rdrptph_no1){ this.rdrptph_no1 = rdrptph_no1; } public void setRdrptph_no2(String rdrptph_no2){ this.rdrptph_no2 = rdrptph_no2; } public void setRdrptph_no3(String rdrptph_no3){ this.rdrptph_no3 = rdrptph_no3; } public void setDlvzip(String dlvzip){ this.dlvzip = dlvzip; } public void setDlvaddr(String dlvaddr){ this.dlvaddr = dlvaddr; } public void setDlvdtlsaddr(String dlvdtlsaddr){ this.dlvdtlsaddr = dlvdtlsaddr; } public void setMovmresiclsf(String movmresiclsf){ this.movmresiclsf = movmresiclsf; } public void setMovmresitype(String movmresitype){ this.movmresitype = movmresitype; } public void setMovmdt(String movmdt){ this.movmdt = movmdt; } public void setMedicd(String medicd){ this.medicd = medicd; } public void setQty(String qty){ this.qty = qty; } public void setDlvhopedt(String dlvhopedt){ this.dlvhopedt = dlvhopedt; } public void setBocd(String bocd){ this.bocd = bocd; } public void setBocd2(String bocd2){ this.bocd2 = bocd2; } public void setResiclsfcd(String resiclsfcd){ this.resiclsfcd = resiclsfcd; } public void setResitypecd(String resitypecd){ this.resitypecd = resitypecd; } public void setDscttypecd(String dscttypecd){ this.dscttypecd = dscttypecd; } public void setTitl(String titl){ this.titl = titl; } public void setCont(String cont){ this.cont = cont; } public void setClsfcd(String clsfcd){ this.clsfcd = clsfcd; } public void setSuspfrdt(String suspfrdt){ this.suspfrdt = suspfrdt; } public void setSusptodt(String susptodt){ this.susptodt = susptodt; } public void setVaca_arearegncd(String vaca_arearegncd){ this.vaca_arearegncd = vaca_arearegncd; } public void setVaca_areacd(String vaca_areacd){ this.vaca_areacd = vaca_areacd; } public void setUid(String uid){ this.uid = uid; } public void setNm(String nm){ this.nm = nm; } public void setRemk(String remk){ this.remk = remk; } public void setCnscnfmyn(String cnscnfmyn){ this.cnscnfmyn = cnscnfmyn; } public void setCnscnfmcd(String cnscnfmcd){ this.cnscnfmcd = cnscnfmcd; } public void setCamptypecd(String camptypecd){ this.camptypecd = camptypecd; } public void setCampid(String campid){ this.campid = campid; } public String getJobflag(){ return this.jobflag; } public String getAccflag(){ return this.accflag; } public String getDt(){ return this.dt; } public String getNo(){ return this.no; } public String getRshpclsfcd(){ return this.rshpclsfcd; } public String getAplcpersnm(){ return this.aplcpersnm; } public String getAplcperstel_no1(){ return this.aplcperstel_no1; } public String getAplcperstel_no2(){ return this.aplcperstel_no2; } public String getAplcperstel_no3(){ return this.aplcperstel_no3; } public String getAplcpersemail(){ return this.aplcpersemail; } public String getAplcpersptph_no1(){ return this.aplcpersptph_no1; } public String getAplcpersptph_no2(){ return this.aplcpersptph_no2; } public String getAplcpersptph_no3(){ return this.aplcpersptph_no3; } public String getAplcperszip(){ return this.aplcperszip; } public String getAplcpersaddr(){ return this.aplcpersaddr; } public String getAplcpersdtlsaddr(){ return this.aplcpersdtlsaddr; } public String getRdr_no(){ return this.rdr_no; } public String getRdrnm(){ return this.rdrnm; } public String getNatncd(){ return this.natncd; } public String getRdrtel_no1(){ return this.rdrtel_no1; } public String getRdrtel_no2(){ return this.rdrtel_no2; } public String getRdrtel_no3(){ return this.rdrtel_no3; } public String getRdremail(){ return this.rdremail; } public String getRdrptph_no1(){ return this.rdrptph_no1; } public String getRdrptph_no2(){ return this.rdrptph_no2; } public String getRdrptph_no3(){ return this.rdrptph_no3; } public String getDlvzip(){ return this.dlvzip; } public String getDlvaddr(){ return this.dlvaddr; } public String getDlvdtlsaddr(){ return this.dlvdtlsaddr; } public String getMovmresiclsf(){ return this.movmresiclsf; } public String getMovmresitype(){ return this.movmresitype; } public String getMovmdt(){ return this.movmdt; } public String getMedicd(){ return this.medicd; } public String getQty(){ return this.qty; } public String getDlvhopedt(){ return this.dlvhopedt; } public String getBocd(){ return this.bocd; } public String getBocd2(){ return this.bocd2; } public String getResiclsfcd(){ return this.resiclsfcd; } public String getResitypecd(){ return this.resitypecd; } public String getDscttypecd(){ return this.dscttypecd; } public String getTitl(){ return this.titl; } public String getCont(){ return this.cont; } public String getClsfcd(){ return this.clsfcd; } public String getSuspfrdt(){ return this.suspfrdt; } public String getSusptodt(){ return this.susptodt; } public String getVaca_arearegncd(){ return this.vaca_arearegncd; } public String getVaca_areacd(){ return this.vaca_areacd; } public String getUid(){ return this.uid; } public String getNm(){ return this.nm; } public String getRemk(){ return this.remk; } public String getCnscnfmyn(){ return this.cnscnfmyn; } public String getCnscnfmcd(){ return this.cnscnfmcd; } public String getCamptypecd(){ return this.camptypecd; } public String getCampid(){ return this.campid; } public String getSQL(){ return "{ call SP_SS_I_CAMP_EXTN( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) }"; } public void setParams(CallableStatement cstmt, BaseDM bdm) throws SQLException{ SS_I_CAMP_EXTNDM dm = (SS_I_CAMP_EXTNDM)bdm; cstmt.registerOutParameter(1, Types.VARCHAR); cstmt.registerOutParameter(2, Types.VARCHAR); cstmt.setString(3, dm.jobflag); cstmt.setString(4, dm.accflag); cstmt.setString(5, dm.dt); cstmt.setString(6, dm.no); cstmt.setString(7, dm.rshpclsfcd); cstmt.setString(8, dm.aplcpersnm); cstmt.setString(9, dm.aplcperstel_no1); cstmt.setString(10, dm.aplcperstel_no2); cstmt.setString(11, dm.aplcperstel_no3); cstmt.setString(12, dm.aplcpersemail); cstmt.setString(13, dm.aplcpersptph_no1); cstmt.setString(14, dm.aplcpersptph_no2); cstmt.setString(15, dm.aplcpersptph_no3); cstmt.setString(16, dm.aplcperszip); cstmt.setString(17, dm.aplcpersaddr); cstmt.setString(18, dm.aplcpersdtlsaddr); cstmt.setString(19, dm.rdr_no); cstmt.setString(20, dm.rdrnm); cstmt.setString(21, dm.natncd); cstmt.setString(22, dm.rdrtel_no1); cstmt.setString(23, dm.rdrtel_no2); cstmt.setString(24, dm.rdrtel_no3); cstmt.setString(25, dm.rdremail); cstmt.setString(26, dm.rdrptph_no1); cstmt.setString(27, dm.rdrptph_no2); cstmt.setString(28, dm.rdrptph_no3); cstmt.setString(29, dm.dlvzip); cstmt.setString(30, dm.dlvaddr); cstmt.setString(31, dm.dlvdtlsaddr); cstmt.setString(32, dm.movmresiclsf); cstmt.setString(33, dm.movmresitype); cstmt.setString(34, dm.movmdt); cstmt.setString(35, dm.medicd); cstmt.setString(36, dm.qty); cstmt.setString(37, dm.dlvhopedt); cstmt.setString(38, dm.bocd); cstmt.setString(39, dm.bocd2); cstmt.setString(40, dm.resiclsfcd); cstmt.setString(41, dm.resitypecd); cstmt.setString(42, dm.dscttypecd); cstmt.setString(43, dm.titl); cstmt.setString(44, dm.cont); cstmt.setString(45, dm.clsfcd); cstmt.setString(46, dm.suspfrdt); cstmt.setString(47, dm.susptodt); cstmt.setString(48, dm.vaca_arearegncd); cstmt.setString(49, dm.vaca_areacd); cstmt.setString(50, dm.uid); cstmt.setString(51, dm.nm); cstmt.setString(52, dm.remk); cstmt.setString(53, dm.cnscnfmyn); cstmt.setString(54, dm.cnscnfmcd); cstmt.setString(55, dm.camptypecd); cstmt.setString(56, dm.campid); } public BaseDataSet createDataSetObject(){ return new chosun.ciis.ss.sls.camp.ds.SS_I_CAMP_EXTNDataSet(); } } /*---------------------------------------------------------------------------------------------------- Web Tier에서 req.getParameter() 처리 및 결과확인 검사시 사용하십시오. String jobflag = req.getParameter("jobflag"); if( jobflag == null){ System.out.println(this.toString+" : jobflag is null" ); }else{ System.out.println(this.toString+" : jobflag is "+jobflag ); } String accflag = req.getParameter("accflag"); if( accflag == null){ System.out.println(this.toString+" : accflag is null" ); }else{ System.out.println(this.toString+" : accflag is "+accflag ); } String dt = req.getParameter("dt"); if( dt == null){ System.out.println(this.toString+" : dt is null" ); }else{ System.out.println(this.toString+" : dt is "+dt ); } String no = req.getParameter("no"); if( no == null){ System.out.println(this.toString+" : no is null" ); }else{ System.out.println(this.toString+" : no is "+no ); } String rshpclsfcd = req.getParameter("rshpclsfcd"); if( rshpclsfcd == null){ System.out.println(this.toString+" : rshpclsfcd is null" ); }else{ System.out.println(this.toString+" : rshpclsfcd is "+rshpclsfcd ); } String aplcpersnm = req.getParameter("aplcpersnm"); if( aplcpersnm == null){ System.out.println(this.toString+" : aplcpersnm is null" ); }else{ System.out.println(this.toString+" : aplcpersnm is "+aplcpersnm ); } String aplcperstel_no1 = req.getParameter("aplcperstel_no1"); if( aplcperstel_no1 == null){ System.out.println(this.toString+" : aplcperstel_no1 is null" ); }else{ System.out.println(this.toString+" : aplcperstel_no1 is "+aplcperstel_no1 ); } String aplcperstel_no2 = req.getParameter("aplcperstel_no2"); if( aplcperstel_no2 == null){ System.out.println(this.toString+" : aplcperstel_no2 is null" ); }else{ System.out.println(this.toString+" : aplcperstel_no2 is "+aplcperstel_no2 ); } String aplcperstel_no3 = req.getParameter("aplcperstel_no3"); if( aplcperstel_no3 == null){ System.out.println(this.toString+" : aplcperstel_no3 is null" ); }else{ System.out.println(this.toString+" : aplcperstel_no3 is "+aplcperstel_no3 ); } String aplcpersemail = req.getParameter("aplcpersemail"); if( aplcpersemail == null){ System.out.println(this.toString+" : aplcpersemail is null" ); }else{ System.out.println(this.toString+" : aplcpersemail is "+aplcpersemail ); } String aplcpersptph_no1 = req.getParameter("aplcpersptph_no1"); if( aplcpersptph_no1 == null){ System.out.println(this.toString+" : aplcpersptph_no1 is null" ); }else{ System.out.println(this.toString+" : aplcpersptph_no1 is "+aplcpersptph_no1 ); } String aplcpersptph_no2 = req.getParameter("aplcpersptph_no2"); if( aplcpersptph_no2 == null){ System.out.println(this.toString+" : aplcpersptph_no2 is null" ); }else{ System.out.println(this.toString+" : aplcpersptph_no2 is "+aplcpersptph_no2 ); } String aplcpersptph_no3 = req.getParameter("aplcpersptph_no3"); if( aplcpersptph_no3 == null){ System.out.println(this.toString+" : aplcpersptph_no3 is null" ); }else{ System.out.println(this.toString+" : aplcpersptph_no3 is "+aplcpersptph_no3 ); } String aplcperszip = req.getParameter("aplcperszip"); if( aplcperszip == null){ System.out.println(this.toString+" : aplcperszip is null" ); }else{ System.out.println(this.toString+" : aplcperszip is "+aplcperszip ); } String aplcpersaddr = req.getParameter("aplcpersaddr"); if( aplcpersaddr == null){ System.out.println(this.toString+" : aplcpersaddr is null" ); }else{ System.out.println(this.toString+" : aplcpersaddr is "+aplcpersaddr ); } String aplcpersdtlsaddr = req.getParameter("aplcpersdtlsaddr"); if( aplcpersdtlsaddr == null){ System.out.println(this.toString+" : aplcpersdtlsaddr is null" ); }else{ System.out.println(this.toString+" : aplcpersdtlsaddr is "+aplcpersdtlsaddr ); } String rdr_no = req.getParameter("rdr_no"); if( rdr_no == null){ System.out.println(this.toString+" : rdr_no is null" ); }else{ System.out.println(this.toString+" : rdr_no is "+rdr_no ); } String rdrnm = req.getParameter("rdrnm"); if( rdrnm == null){ System.out.println(this.toString+" : rdrnm is null" ); }else{ System.out.println(this.toString+" : rdrnm is "+rdrnm ); } String natncd = req.getParameter("natncd"); if( natncd == null){ System.out.println(this.toString+" : natncd is null" ); }else{ System.out.println(this.toString+" : natncd is "+natncd ); } String rdrtel_no1 = req.getParameter("rdrtel_no1"); if( rdrtel_no1 == null){ System.out.println(this.toString+" : rdrtel_no1 is null" ); }else{ System.out.println(this.toString+" : rdrtel_no1 is "+rdrtel_no1 ); } String rdrtel_no2 = req.getParameter("rdrtel_no2"); if( rdrtel_no2 == null){ System.out.println(this.toString+" : rdrtel_no2 is null" ); }else{ System.out.println(this.toString+" : rdrtel_no2 is "+rdrtel_no2 ); } String rdrtel_no3 = req.getParameter("rdrtel_no3"); if( rdrtel_no3 == null){ System.out.println(this.toString+" : rdrtel_no3 is null" ); }else{ System.out.println(this.toString+" : rdrtel_no3 is "+rdrtel_no3 ); } String rdremail = req.getParameter("rdremail"); if( rdremail == null){ System.out.println(this.toString+" : rdremail is null" ); }else{ System.out.println(this.toString+" : rdremail is "+rdremail ); } String rdrptph_no1 = req.getParameter("rdrptph_no1"); if( rdrptph_no1 == null){ System.out.println(this.toString+" : rdrptph_no1 is null" ); }else{ System.out.println(this.toString+" : rdrptph_no1 is "+rdrptph_no1 ); } String rdrptph_no2 = req.getParameter("rdrptph_no2"); if( rdrptph_no2 == null){ System.out.println(this.toString+" : rdrptph_no2 is null" ); }else{ System.out.println(this.toString+" : rdrptph_no2 is "+rdrptph_no2 ); } String rdrptph_no3 = req.getParameter("rdrptph_no3"); if( rdrptph_no3 == null){ System.out.println(this.toString+" : rdrptph_no3 is null" ); }else{ System.out.println(this.toString+" : rdrptph_no3 is "+rdrptph_no3 ); } String dlvzip = req.getParameter("dlvzip"); if( dlvzip == null){ System.out.println(this.toString+" : dlvzip is null" ); }else{ System.out.println(this.toString+" : dlvzip is "+dlvzip ); } String dlvaddr = req.getParameter("dlvaddr"); if( dlvaddr == null){ System.out.println(this.toString+" : dlvaddr is null" ); }else{ System.out.println(this.toString+" : dlvaddr is "+dlvaddr ); } String dlvdtlsaddr = req.getParameter("dlvdtlsaddr"); if( dlvdtlsaddr == null){ System.out.println(this.toString+" : dlvdtlsaddr is null" ); }else{ System.out.println(this.toString+" : dlvdtlsaddr is "+dlvdtlsaddr ); } String movmresiclsf = req.getParameter("movmresiclsf"); if( movmresiclsf == null){ System.out.println(this.toString+" : movmresiclsf is null" ); }else{ System.out.println(this.toString+" : movmresiclsf is "+movmresiclsf ); } String movmresitype = req.getParameter("movmresitype"); if( movmresitype == null){ System.out.println(this.toString+" : movmresitype is null" ); }else{ System.out.println(this.toString+" : movmresitype is "+movmresitype ); } String movmdt = req.getParameter("movmdt"); if( movmdt == null){ System.out.println(this.toString+" : movmdt is null" ); }else{ System.out.println(this.toString+" : movmdt is "+movmdt ); } String medicd = req.getParameter("medicd"); if( medicd == null){ System.out.println(this.toString+" : medicd is null" ); }else{ System.out.println(this.toString+" : medicd is "+medicd ); } String qty = req.getParameter("qty"); if( qty == null){ System.out.println(this.toString+" : qty is null" ); }else{ System.out.println(this.toString+" : qty is "+qty ); } String dlvhopedt = req.getParameter("dlvhopedt"); if( dlvhopedt == null){ System.out.println(this.toString+" : dlvhopedt is null" ); }else{ System.out.println(this.toString+" : dlvhopedt is "+dlvhopedt ); } String bocd = req.getParameter("bocd"); if( bocd == null){ System.out.println(this.toString+" : bocd is null" ); }else{ System.out.println(this.toString+" : bocd is "+bocd ); } String bocd2 = req.getParameter("bocd2"); if( bocd2 == null){ System.out.println(this.toString+" : bocd2 is null" ); }else{ System.out.println(this.toString+" : bocd2 is "+bocd2 ); } String resiclsfcd = req.getParameter("resiclsfcd"); if( resiclsfcd == null){ System.out.println(this.toString+" : resiclsfcd is null" ); }else{ System.out.println(this.toString+" : resiclsfcd is "+resiclsfcd ); } String resitypecd = req.getParameter("resitypecd"); if( resitypecd == null){ System.out.println(this.toString+" : resitypecd is null" ); }else{ System.out.println(this.toString+" : resitypecd is "+resitypecd ); } String dscttypecd = req.getParameter("dscttypecd"); if( dscttypecd == null){ System.out.println(this.toString+" : dscttypecd is null" ); }else{ System.out.println(this.toString+" : dscttypecd is "+dscttypecd ); } String titl = req.getParameter("titl"); if( titl == null){ System.out.println(this.toString+" : titl is null" ); }else{ System.out.println(this.toString+" : titl is "+titl ); } String cont = req.getParameter("cont"); if( cont == null){ System.out.println(this.toString+" : cont is null" ); }else{ System.out.println(this.toString+" : cont is "+cont ); } String clsfcd = req.getParameter("clsfcd"); if( clsfcd == null){ System.out.println(this.toString+" : clsfcd is null" ); }else{ System.out.println(this.toString+" : clsfcd is "+clsfcd ); } String suspfrdt = req.getParameter("suspfrdt"); if( suspfrdt == null){ System.out.println(this.toString+" : suspfrdt is null" ); }else{ System.out.println(this.toString+" : suspfrdt is "+suspfrdt ); } String susptodt = req.getParameter("susptodt"); if( susptodt == null){ System.out.println(this.toString+" : susptodt is null" ); }else{ System.out.println(this.toString+" : susptodt is "+susptodt ); } String vaca_arearegncd = req.getParameter("vaca_arearegncd"); if( vaca_arearegncd == null){ System.out.println(this.toString+" : vaca_arearegncd is null" ); }else{ System.out.println(this.toString+" : vaca_arearegncd is "+vaca_arearegncd ); } String vaca_areacd = req.getParameter("vaca_areacd"); if( vaca_areacd == null){ System.out.println(this.toString+" : vaca_areacd is null" ); }else{ System.out.println(this.toString+" : vaca_areacd is "+vaca_areacd ); } String uid = req.getParameter("uid"); if( uid == null){ System.out.println(this.toString+" : uid is null" ); }else{ System.out.println(this.toString+" : uid is "+uid ); } String nm = req.getParameter("nm"); if( nm == null){ System.out.println(this.toString+" : nm is null" ); }else{ System.out.println(this.toString+" : nm is "+nm ); } String remk = req.getParameter("remk"); if( remk == null){ System.out.println(this.toString+" : remk is null" ); }else{ System.out.println(this.toString+" : remk is "+remk ); } String cnscnfmyn = req.getParameter("cnscnfmyn"); if( cnscnfmyn == null){ System.out.println(this.toString+" : cnscnfmyn is null" ); }else{ System.out.println(this.toString+" : cnscnfmyn is "+cnscnfmyn ); } String cnscnfmcd = req.getParameter("cnscnfmcd"); if( cnscnfmcd == null){ System.out.println(this.toString+" : cnscnfmcd is null" ); }else{ System.out.println(this.toString+" : cnscnfmcd is "+cnscnfmcd ); } String camptypecd = req.getParameter("camptypecd"); if( camptypecd == null){ System.out.println(this.toString+" : camptypecd is null" ); }else{ System.out.println(this.toString+" : camptypecd is "+camptypecd ); } String campid = req.getParameter("campid"); if( campid == null){ System.out.println(this.toString+" : campid is null" ); }else{ System.out.println(this.toString+" : campid is "+campid ); } ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 req.getParameter() 처리시 사용하십시오. String jobflag = Util.checkString(req.getParameter("jobflag")); String accflag = Util.checkString(req.getParameter("accflag")); String dt = Util.checkString(req.getParameter("dt")); String no = Util.checkString(req.getParameter("no")); String rshpclsfcd = Util.checkString(req.getParameter("rshpclsfcd")); String aplcpersnm = Util.checkString(req.getParameter("aplcpersnm")); String aplcperstel_no1 = Util.checkString(req.getParameter("aplcperstel_no1")); String aplcperstel_no2 = Util.checkString(req.getParameter("aplcperstel_no2")); String aplcperstel_no3 = Util.checkString(req.getParameter("aplcperstel_no3")); String aplcpersemail = Util.checkString(req.getParameter("aplcpersemail")); String aplcpersptph_no1 = Util.checkString(req.getParameter("aplcpersptph_no1")); String aplcpersptph_no2 = Util.checkString(req.getParameter("aplcpersptph_no2")); String aplcpersptph_no3 = Util.checkString(req.getParameter("aplcpersptph_no3")); String aplcperszip = Util.checkString(req.getParameter("aplcperszip")); String aplcpersaddr = Util.checkString(req.getParameter("aplcpersaddr")); String aplcpersdtlsaddr = Util.checkString(req.getParameter("aplcpersdtlsaddr")); String rdr_no = Util.checkString(req.getParameter("rdr_no")); String rdrnm = Util.checkString(req.getParameter("rdrnm")); String natncd = Util.checkString(req.getParameter("natncd")); String rdrtel_no1 = Util.checkString(req.getParameter("rdrtel_no1")); String rdrtel_no2 = Util.checkString(req.getParameter("rdrtel_no2")); String rdrtel_no3 = Util.checkString(req.getParameter("rdrtel_no3")); String rdremail = Util.checkString(req.getParameter("rdremail")); String rdrptph_no1 = Util.checkString(req.getParameter("rdrptph_no1")); String rdrptph_no2 = Util.checkString(req.getParameter("rdrptph_no2")); String rdrptph_no3 = Util.checkString(req.getParameter("rdrptph_no3")); String dlvzip = Util.checkString(req.getParameter("dlvzip")); String dlvaddr = Util.checkString(req.getParameter("dlvaddr")); String dlvdtlsaddr = Util.checkString(req.getParameter("dlvdtlsaddr")); String movmresiclsf = Util.checkString(req.getParameter("movmresiclsf")); String movmresitype = Util.checkString(req.getParameter("movmresitype")); String movmdt = Util.checkString(req.getParameter("movmdt")); String medicd = Util.checkString(req.getParameter("medicd")); String qty = Util.checkString(req.getParameter("qty")); String dlvhopedt = Util.checkString(req.getParameter("dlvhopedt")); String bocd = Util.checkString(req.getParameter("bocd")); String bocd2 = Util.checkString(req.getParameter("bocd2")); String resiclsfcd = Util.checkString(req.getParameter("resiclsfcd")); String resitypecd = Util.checkString(req.getParameter("resitypecd")); String dscttypecd = Util.checkString(req.getParameter("dscttypecd")); String titl = Util.checkString(req.getParameter("titl")); String cont = Util.checkString(req.getParameter("cont")); String clsfcd = Util.checkString(req.getParameter("clsfcd")); String suspfrdt = Util.checkString(req.getParameter("suspfrdt")); String susptodt = Util.checkString(req.getParameter("susptodt")); String vaca_arearegncd = Util.checkString(req.getParameter("vaca_arearegncd")); String vaca_areacd = Util.checkString(req.getParameter("vaca_areacd")); String uid = Util.checkString(req.getParameter("uid")); String nm = Util.checkString(req.getParameter("nm")); String remk = Util.checkString(req.getParameter("remk")); String cnscnfmyn = Util.checkString(req.getParameter("cnscnfmyn")); String cnscnfmcd = Util.checkString(req.getParameter("cnscnfmcd")); String camptypecd = Util.checkString(req.getParameter("camptypecd")); String campid = Util.checkString(req.getParameter("campid")); ----------------------------------------------------------------------------------------------------*//*---------------------------------------------------------------------------------------------------- Web Tier에서 한글처리와 동시에 req.getParameter() 처리시 사용하십시오. String jobflag = Util.Uni2Ksc(Util.checkString(req.getParameter("jobflag"))); String accflag = Util.Uni2Ksc(Util.checkString(req.getParameter("accflag"))); String dt = Util.Uni2Ksc(Util.checkString(req.getParameter("dt"))); String no = Util.Uni2Ksc(Util.checkString(req.getParameter("no"))); String rshpclsfcd = Util.Uni2Ksc(Util.checkString(req.getParameter("rshpclsfcd"))); String aplcpersnm = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersnm"))); String aplcperstel_no1 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcperstel_no1"))); String aplcperstel_no2 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcperstel_no2"))); String aplcperstel_no3 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcperstel_no3"))); String aplcpersemail = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersemail"))); String aplcpersptph_no1 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersptph_no1"))); String aplcpersptph_no2 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersptph_no2"))); String aplcpersptph_no3 = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersptph_no3"))); String aplcperszip = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcperszip"))); String aplcpersaddr = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersaddr"))); String aplcpersdtlsaddr = Util.Uni2Ksc(Util.checkString(req.getParameter("aplcpersdtlsaddr"))); String rdr_no = Util.Uni2Ksc(Util.checkString(req.getParameter("rdr_no"))); String rdrnm = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrnm"))); String natncd = Util.Uni2Ksc(Util.checkString(req.getParameter("natncd"))); String rdrtel_no1 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrtel_no1"))); String rdrtel_no2 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrtel_no2"))); String rdrtel_no3 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrtel_no3"))); String rdremail = Util.Uni2Ksc(Util.checkString(req.getParameter("rdremail"))); String rdrptph_no1 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrptph_no1"))); String rdrptph_no2 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrptph_no2"))); String rdrptph_no3 = Util.Uni2Ksc(Util.checkString(req.getParameter("rdrptph_no3"))); String dlvzip = Util.Uni2Ksc(Util.checkString(req.getParameter("dlvzip"))); String dlvaddr = Util.Uni2Ksc(Util.checkString(req.getParameter("dlvaddr"))); String dlvdtlsaddr = Util.Uni2Ksc(Util.checkString(req.getParameter("dlvdtlsaddr"))); String movmresiclsf = Util.Uni2Ksc(Util.checkString(req.getParameter("movmresiclsf"))); String movmresitype = Util.Uni2Ksc(Util.checkString(req.getParameter("movmresitype"))); String movmdt = Util.Uni2Ksc(Util.checkString(req.getParameter("movmdt"))); String medicd = Util.Uni2Ksc(Util.checkString(req.getParameter("medicd"))); String qty = Util.Uni2Ksc(Util.checkString(req.getParameter("qty"))); String dlvhopedt = Util.Uni2Ksc(Util.checkString(req.getParameter("dlvhopedt"))); String bocd = Util.Uni2Ksc(Util.checkString(req.getParameter("bocd"))); String bocd2 = Util.Uni2Ksc(Util.checkString(req.getParameter("bocd2"))); String resiclsfcd = Util.Uni2Ksc(Util.checkString(req.getParameter("resiclsfcd"))); String resitypecd = Util.Uni2Ksc(Util.checkString(req.getParameter("resitypecd"))); String dscttypecd = Util.Uni2Ksc(Util.checkString(req.getParameter("dscttypecd"))); String titl = Util.Uni2Ksc(Util.checkString(req.getParameter("titl"))); String cont = Util.Uni2Ksc(Util.checkString(req.getParameter("cont"))); String clsfcd = Util.Uni2Ksc(Util.checkString(req.getParameter("clsfcd"))); String suspfrdt = Util.Uni2Ksc(Util.checkString(req.getParameter("suspfrdt"))); String susptodt = Util.Uni2Ksc(Util.checkString(req.getParameter("susptodt"))); String vaca_arearegncd = Util.Uni2Ksc(Util.checkString(req.getParameter("vaca_arearegncd"))); String vaca_areacd = Util.Uni2Ksc(Util.checkString(req.getParameter("vaca_areacd"))); String uid = Util.Uni2Ksc(Util.checkString(req.getParameter("uid"))); String nm = Util.Uni2Ksc(Util.checkString(req.getParameter("nm"))); String remk = Util.Uni2Ksc(Util.checkString(req.getParameter("remk"))); String cnscnfmyn = Util.Uni2Ksc(Util.checkString(req.getParameter("cnscnfmyn"))); String cnscnfmcd = Util.Uni2Ksc(Util.checkString(req.getParameter("cnscnfmcd"))); String camptypecd = Util.Uni2Ksc(Util.checkString(req.getParameter("camptypecd"))); String campid = Util.Uni2Ksc(Util.checkString(req.getParameter("campid"))); ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 DM 파일의 변수를 설정시 사용하십시오. dm.setJobflag(jobflag); dm.setAccflag(accflag); dm.setDt(dt); dm.setNo(no); dm.setRshpclsfcd(rshpclsfcd); dm.setAplcpersnm(aplcpersnm); dm.setAplcperstel_no1(aplcperstel_no1); dm.setAplcperstel_no2(aplcperstel_no2); dm.setAplcperstel_no3(aplcperstel_no3); dm.setAplcpersemail(aplcpersemail); dm.setAplcpersptph_no1(aplcpersptph_no1); dm.setAplcpersptph_no2(aplcpersptph_no2); dm.setAplcpersptph_no3(aplcpersptph_no3); dm.setAplcperszip(aplcperszip); dm.setAplcpersaddr(aplcpersaddr); dm.setAplcpersdtlsaddr(aplcpersdtlsaddr); dm.setRdr_no(rdr_no); dm.setRdrnm(rdrnm); dm.setNatncd(natncd); dm.setRdrtel_no1(rdrtel_no1); dm.setRdrtel_no2(rdrtel_no2); dm.setRdrtel_no3(rdrtel_no3); dm.setRdremail(rdremail); dm.setRdrptph_no1(rdrptph_no1); dm.setRdrptph_no2(rdrptph_no2); dm.setRdrptph_no3(rdrptph_no3); dm.setDlvzip(dlvzip); dm.setDlvaddr(dlvaddr); dm.setDlvdtlsaddr(dlvdtlsaddr); dm.setMovmresiclsf(movmresiclsf); dm.setMovmresitype(movmresitype); dm.setMovmdt(movmdt); dm.setMedicd(medicd); dm.setQty(qty); dm.setDlvhopedt(dlvhopedt); dm.setBocd(bocd); dm.setBocd2(bocd2); dm.setResiclsfcd(resiclsfcd); dm.setResitypecd(resitypecd); dm.setDscttypecd(dscttypecd); dm.setTitl(titl); dm.setCont(cont); dm.setClsfcd(clsfcd); dm.setSuspfrdt(suspfrdt); dm.setSusptodt(susptodt); dm.setVaca_arearegncd(vaca_arearegncd); dm.setVaca_areacd(vaca_areacd); dm.setUid(uid); dm.setNm(nm); dm.setRemk(remk); dm.setCnscnfmyn(cnscnfmyn); dm.setCnscnfmcd(cnscnfmcd); dm.setCamptypecd(camptypecd); dm.setCampid(campid); ----------------------------------------------------------------------------------------------------*/ /* 작성시간 : Fri May 27 15:22:53 KST 2005 */
6d705b82a3bdd53b6cd63956b1a8718cff588389
ae99addb1c8ebb0515547ceb4d7c9977968befda
/microservice/src/test/java/com/prashant/microservice/MicroServiceMainTest.java
cc106b80bb6f6c1efced1d7dc783156604c6556b
[]
no_license
prashantpratik/springboot-mircroservice
c7fa6a63702e0925cdaed001003c76aa09565f47
aa6e8dcd2b4d132940db3df6dce18493239413a5
refs/heads/master
2020-04-07T19:19:34.041132
2018-12-03T03:23:10
2018-12-03T03:23:10
158,644,129
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package com.prashant.microservice; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class MicroServiceMainTest { @Test public void testContextLoading() { // Just by having this test will start the context and ensure it loads } }
0d1ffabf48d8ca5205f55334b2842a487ca9f901
d52ea3fe8cce3985f13d9e76cb6169bfae2cc3c7
/src/com/ceep/dominio/Circulo.java
cc208929981e703bce6b962269983a05306ba369
[]
no_license
Gemamm/geometria
dcc689b101f0006a854d8471bd76c7266af6af7b
7146f352a75d1ecfc605807c53fe589abf333dec
refs/heads/main
2023-08-15T04:39:24.318655
2021-10-14T08:09:28
2021-10-14T08:09:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.ceep.dominio; public class Circulo extends FiguraGeometrica{ public Circulo(String tipoFigura){ super(tipoFigura); } @Override public void dibujar(){ System.out.println("Se imprime por pantalla un: " + this.getClass().getSimpleName()); } }
630344aa5dad0f2783c27c3d922776f4acab6cc2
9c98958ed14d2e92141e07d59f1f4000e1a8b566
/src/main/java/com/example/air_quality_app/model/data/Data.java
29af43fc72769951e95596c09e31699e6c353e02
[]
no_license
adamorzelski/air-quality-app
1be962591729b79fc858bb35c230a93b8bc09aa5
7a476a005f4cc02b4c8b2901b1fd2e95d7b48274
refs/heads/master
2023-03-04T02:03:53.147746
2021-02-19T08:41:07
2021-02-19T08:41:07
339,037,123
0
0
null
null
null
null
UTF-8
Java
false
false
739
java
package com.example.air_quality_app.model.data; import java.util.List; public class Data{ public String key; public List<Value> values; public Data() { } public Data(String key, List<Value> values) { this.key = key; this.values = values; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public List<Value> getValues() { return values; } public void setValues(List<Value> values) { this.values = values; } @Override public String toString() { return "Data{" + "key='" + key + '\'' + ", values=" + values + '}'; } }
72741a44fd48ae328f58c2cac768f7958bc2be01
ff51d136dae863a4b7647edc6a93ba98f11d3eae
/src/OldProjects/CubePanel.java
3c6d1a67c634f7200d53e125cb4a1e5c12106df1
[]
no_license
Spydercrawler/CustomGUIPrograms
7fb2feb701d4ba9189da8f91dd3231853bc8705d
102d191716c4a72ee7a7087b14671cf2f43d9407
refs/heads/master
2021-05-04T22:19:20.599202
2018-02-02T20:36:08
2018-02-02T20:36:08
120,027,646
0
0
null
null
null
null
UTF-8
Java
false
false
3,566
java
package OldProjects; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.image.BufferedImage; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class CubePanel extends JPanel { private float cameraRotX = 0; private float cameraRotY = 0; private final float fovX = (float)Math.PI / 2; private final float fovY = (float)Math.PI / 4; private final float focalLength = 1.0f; private float xDegreeChange; private float yDegreeChange; private static final int defaultWidth = 400; private static final int defaultHeight = 400; private int localWidth; private int localHeight; public CubePanel() { localWidth = defaultWidth; localHeight = defaultHeight; xDegreeChange = fovX / localWidth; yDegreeChange = fovY / localWidth; this.addComponentListener(new ResizeListener()); } Runnable UpdateScript = new Runnable() { @Override public void run() { } }; public Dimension getPreferredSize() { return new Dimension(defaultWidth,defaultHeight); } private static void OpenFrame() { JFrame f = new JFrame(); // f.setUndecorated(true); // f.setBackground(new Color(0, 0, 0, 0)); f.setTitle("Clock"); f.add(new CubePanel()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { OpenFrame(); } }); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if(localHeight == 0 || localWidth == 0) return; BufferedImage bi = new BufferedImage(localWidth, localHeight, BufferedImage.TYPE_INT_RGB); float i = (localWidth)/2.0f *-1; for(int r = 0;r<bi.getHeight();r+=1) { float j = (localHeight)/2.0f *-1; for(int c = 0;c<bi.getWidth();c+=1) { double x = focalLength * Math.cos(i); double y = focalLength * Math.sin(i); double z = focalLength * Math.sin(j); if(Math.abs(x) > Math.abs(y) && Math.abs(x) > Math.abs(z)) { if(x>0) { bi.setRGB(c, r, Color.RED.getRGB()); } else { bi.setRGB(c, r, Color.GREEN.getRGB()); } } else if (Math.abs(y) > Math.abs(x) && Math.abs(y) > Math.abs(z)) { if(y>0) { bi.setRGB(c, r, Color.BLUE.getRGB()); } else { bi.setRGB(c, r, Color.ORANGE.getRGB()); } } else { if(z>0) { bi.setRGB(c, r, Color.MAGENTA.getRGB()); } else { bi.setRGB(c, r, Color.YELLOW.getRGB()); } } j+=yDegreeChange; } i+=xDegreeChange; } g2.drawImage(bi, 1, 1, null); } private class ResizeListener implements ComponentListener { @Override public void componentHidden(ComponentEvent arg0) { // TODO Auto-generated method stub } @Override public void componentMoved(ComponentEvent arg0) { // TODO Auto-generated method stub } @Override public void componentResized(ComponentEvent arg0) { Rectangle Bounds = arg0.getComponent().getBounds(); localWidth = Bounds.width; localHeight = Bounds.height; } @Override public void componentShown(ComponentEvent arg0) { // TODO Auto-generated method stub } } }
ea0deca4e3857f83e1daf5cce1e76c0bbf352144
572ab44a5612fa7c48c1c3b29b5f4375f3b08ed1
/BIMfoBA.src/jsdai/SIfc4/AIfcprojectionelement.java
a27a46b31ebfee9b7f6807e11ab3718327d19b7b
[]
no_license
ren90/BIMforBA
ce9dd9e5c0b8cfd2dbd2b84f3e2bcc72bc8aa18e
4a83d5ecb784b80a217895d93e0e30735dc83afb
refs/heads/master
2021-01-12T20:49:32.561833
2015-03-09T11:00:40
2015-03-09T11:00:40
24,721,790
0
0
null
null
null
null
UTF-8
Java
false
false
543
java
/* Generated by JSDAI Express Compiler, version 4.3.2, build 500, 2011-12-13 */ // Java class implementing aggregate of IfcProjectionElement of level 1 package jsdai.SIfc4; import jsdai.lang.*; public class AIfcprojectionelement extends AEntity { public EIfcprojectionelement getByIndex(int index) throws SdaiException { return (EIfcprojectionelement)getByIndexEntity(index); } public EIfcprojectionelement getCurrentMember(SdaiIterator iter) throws SdaiException { return (EIfcprojectionelement)getCurrentMemberObject(iter); } }
4cc4326027f827bffe2b2f2a2f9b47a0665ba105
12eec69e38c224dba4deaaa4399d22ef33e370b7
/src/main/java/com/lepskaja/timeCalculator/validator/TimeValidator.java
2f2e22d9d78e77ea89c5a0f4656ba44f502fb04b
[]
no_license
malvann/timeCalculator
85553c73ddd128819f8b6c383173d941defa9767
8d0cf7023eb003d4df3a4b03c892aa3bc707e7f5
refs/heads/master
2023-03-27T12:11:26.225594
2021-03-27T16:02:12
2021-03-27T16:02:12
345,930,318
0
0
null
null
null
null
UTF-8
Java
false
false
358
java
package com.lepskaja.timeCalculator.validator; public class TimeValidator { private static final String DIGIT_REG = "^\\d+(.\\d+)?$"; public static boolean isTimeFormatValid(int hour, int min){ return hour>=0 && hour<24 && min>=0 && min<60; } public static boolean isDigit(String str){ return str.matches(DIGIT_REG); } }
799e810ce1f6e90e16be22ca90b34fd0a3087411
fe5bcdae31301dbb418bc5cced266cfc609b0793
/lab5/src/Controller.java
3b1983d9108c83f31dbe1f1004e0d0a24068c28e
[]
no_license
JustynaDreger/Java
147021ae357a42372ef5f6b7fb7660ecdb7713ac
54e02146a5b1fc19cdd9078a144b4f4c77423981
refs/heads/master
2020-05-04T15:23:22.766788
2019-04-03T07:53:50
2019-04-03T07:53:50
179,238,541
0
0
null
null
null
null
UTF-8
Java
false
false
2,081
java
import java.util.Scanner; public class Controller { static View view=new View(); static Model model=new Model(); //(1) Wprowadz macierze wejsciowe private static void enterMatrix(Scanner scanner) { view.diplayRequest("liczbe wierszy macierzy A"); int a=scanner.nextInt(); view.diplayRequest("liczbe kolumn macierzy A"); int b=scanner.nextInt(); view.diplayRequest("liczbe wierszy macierzy B"); int c=scanner.nextInt(); view.diplayRequest("liczbe kolumn macierzy B"); int d=scanner.nextInt(); model.create('A',a, b); model.create('B',c, d); model.fillMatrix('A'); model.fillMatrix('B'); menu(); } //(2) Operacje arytmetyczne private static void aritmeticOperation(Scanner scanner) { view.displayArithmeticOperation(); switch(scanner.nextInt()) { case 1: transposingMatrixs(); break; case 2: multiplyMatrixs(); break; case 3: transposingMatrix(); break; default: view.displayError(); aritmeticOperation(scanner);break; } } //(3) Wyswietl macierze private static void displayMatrixs(Scanner scanner) { view.displayMatrixs(); switch(scanner.nextInt()) { case 1: view.displayMatrix(model.getMatrix('A')); view.displayMatrix(model.getMatrix('B')); break; case 2: view.displayMatrix(model.getMatrix('C')); break; default: view.displayError(); displayMatrixs(scanner);break; } menu(); } private static void transposingMatrixs() { model.transposingMatrix('A'); model.transposingMatrix('B'); menu(); } private static void multiplyMatrixs() { model.multyplyMatrixs(); menu(); } private static void transposingMatrix() { model.transposingMatrix('C'); menu(); } public static void menu() { Scanner scanner=new Scanner(System.in); view.displayMenu(); switch(scanner.nextInt()) { case 1: enterMatrix(scanner); break; case 2: aritmeticOperation(scanner); break; case 3: displayMatrixs(scanner); break; default: view.displayError(); menu(); } scanner.close(); } public static void main(String[] args) { menu(); } }
9c0f84f1f7d143ea596f1e9377b9394554014998
e012957ebc41ee3f6fa30a04e6e06aae280a36f2
/src/cart/Composite.java
1abb3ef75ba3edcc54fe8e6984ebc04b912deaca
[]
no_license
qiyal/console-flip-app
5491a35cbe92ba77b2e9e0ef54f23ad0c4fb4470
ba9d1b68346d9ac91985397d690bf7f1c367e8c8
refs/heads/master
2023-01-29T01:20:44.446148
2020-12-14T03:07:35
2020-12-14T03:07:35
321,133,519
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package cart; import databases.ProductDatabase; import products.Product; import java.util.ArrayList; public class Composite implements Component { ArrayList<Component> box = new ArrayList<>(); ProductDatabase productDatabase = ProductDatabase.getInstance(); @Override public int calculateTotalCost() { int totalCost = 0; for (Component component : box) { totalCost += component.calculateTotalCost(); } return totalCost; } @Override public boolean isComposite() { return true; } @Override public void show() { showItems(); } public void addProduct(Component component) { System.out.println("is add"); box.add(component); } public void removeProduct(int i) { Product product = ((Leaf) box.get(i)).product; box.remove(i); productDatabase.incrementQuantity(product); } public void clear() { box.clear(); } public void showItems() { System.out.println("\n[ Cart Items ]"); for (int i = 0; i < box.size(); i++) { System.out.print("\n" + i + ") "); box.get(i).show(); System.out.println(); } } public int getSize() { return box.size(); } }
d78cf14d507d8c16b842944bb8171f2d94da097a
fa9dec2d731e65a0f07dc9af5449c6356cadcb06
/app/src/main/java/cn/closeli/rtc/utils/signature/StringUtil.java
799b08ca39af103f31ddfd1b4d4b1cae109569f9
[ "Apache-2.0" ]
permissive
huizhongyu/SudiVCAndroidClient
8526ea236322e5a96804aab531f7431d0eb71023
ccf3a8b6788ec6577c42740ba491785c526e373e
refs/heads/master
2021-01-05T01:40:27.675276
2020-02-17T06:10:39
2020-02-17T06:10:39
240,832,731
0
1
null
null
null
null
UTF-8
Java
false
false
3,825
java
//package cn.closeli.rtc.utils.signature; // //import java.util.Random; //import java.util.regex.Pattern; // //public class StringUtil { // private static Random random = new Random(); // private static final String[] chars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }; // // public static void assertStringNotNullOrEmpty(String param, String paramName){ // if (param == null) // throw new NullPointerException("ParameterIsNull:" + paramName); // if (param.length() == 0) // throw new IllegalArgumentException("ParameterStringIsEmpty:" + paramName); // } // // public static boolean isNullOrEmpty(String value) { // return (value == null) || (value.length() == 0); // } // // public static String getNonce(int length) { // StringBuffer sb = new StringBuffer(); // for (int i = 0; i < length; i++) { // sb.append(chars[random.nextInt(31)]); // } // return sb.toString(); // } // // public static boolean isPhoneNumber(String phoneNum) { // if (StringUtil.isNullOrEmpty(phoneNum)) return false; // return Pattern.compile("1\\d{10}").matcher(phoneNum.trim()).matches(); // } // // public static boolean isEmail(String email) { // if (StringUtil.isNullOrEmpty(email)) return false; // return Pattern.compile("^[\\w-.]+@[\\w-]+(\\.{1}[\\w-]+)+$").matcher(email.trim()).matches(); // } // // public static String createValidateCode(int count) { // Random random = new Random(); // StringBuilder authCode = new StringBuilder(); // for (int i = 0; i < count; i++) { // int code = random.nextInt(10); // authCode.append(code); // } // return authCode.toString(); // } // // public static String getAppUniqueStr(int length) { // StringBuffer sb = new StringBuffer(); // for (int i = 0; i < length; i++) { // sb.append(chars[random.nextInt(61)]); // } // return sb.toString(); // } // // public static String generateActiveCode() { // StringBuilder stringBuilder = new StringBuilder(); // for (int i = 0; i < 5; i++) { // stringBuilder.append(getNonce(4)).append("-"); // } // return stringBuilder.deleteCharAt(stringBuilder.length() - 1).toString(); // } // // public static String generateActiveCode(String ak) { // StringBuilder stringBuilder = new StringBuilder(); // String salt = getAppUniqueStr(4); // stringBuilder.append(salt, 0, 1) // .append(AESUtil.encrypt(ak, salt)) // .append(salt, 1, 4); // return stringBuilder.toString(); // } // // public static String getUserAkByActiveCode(String activeCode) { // int len = activeCode.length(); // String salt = activeCode.substring(0, 1) + activeCode.substring(len - 3); // String aesEncStr = activeCode.substring(1, len - 3); // return AESUtil.decrypt(aesEncStr, salt); // } // // public static void main(String[] args) { //// String ak = getAppUniqueStr(16); //// System.out.println("AK:" + ak); //// String activecode = generateActiveCode(ak); //// System.out.println("active code:" + activecode); //// System.out.println("ak:" + getUserAkByActiveCode(activecode)); //// System.out.println(getUserAkByActiveCode("8vDJyWMwddeXMS8IrsLG8Og==7Hh")); // String uri = "/webportal/api/face/v1/detect"; // System.out.println(uri.substring(10)); // } // //}
98817ad7e416f03f66572f911a2a0c2522cb0ffe
19af863cf255426d28fc7ef473a5041d9e9cc3e8
/spark-netty-core/src/main/java/idv/jack/spark/driver/SparkDriverWordCount.java
bcf4f38d58ba564ce8d7a6518ccea382f74f5034
[]
no_license
witnesslq/spark-netty-poc
1275d3127546b485b454ce5c0e58a297cf8a4caf
e9917eb586a0045b4bf6e5a50735e49717125f91
refs/heads/master
2020-12-30T13:46:11.943547
2016-07-12T06:49:43
2016-07-12T06:49:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,696
java
package idv.jack.spark.driver; import idv.jack.netty.client.Client; import java.util.Arrays; import java.util.List; import org.apache.spark.api.java.JavaPairRDD; import org.apache.spark.api.java.JavaRDD; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.api.java.function.FlatMapFunction; import org.apache.spark.api.java.function.Function2; import org.apache.spark.api.java.function.PairFunction; import scala.Tuple2; public class SparkDriverWordCount { public static void main(String args[]) throws Exception{ System.out.println("SOURCE FILE PATH:" + args[0]); JavaSparkContext sc = new JavaSparkContext(); JavaRDD<String> textFile = sc.textFile("hdfs://apache-server-a1:9000/file1.txt"); JavaRDD<String> words = textFile.flatMap(new FlatMapFunction<String, String>() { public Iterable<String> call(String s) { return Arrays.asList(s.split(" ")); } }); JavaPairRDD<String, Integer> pairs = words.mapToPair(new PairFunction<String, String, Integer>() { public Tuple2<String, Integer> call(String s) { return new Tuple2<String, Integer>(s, 1); } }); JavaPairRDD<String, Integer> counts = pairs.reduceByKey(new Function2<Integer, Integer, Integer>() { public Integer call(Integer a, Integer b) { return a + b; } }); List<Tuple2<String, Integer>> list = counts.collect(); String resultValue = ""; for(Tuple2<String, Integer> result : list){ resultValue = resultValue + result._1 + "," + result._2; } //counts.saveAsTextFile("hdfs://apache-server-a1:9000/result"); //result assign to netty server String host = "192.168.1.16"; int port = 1234; new Client(host, port).start(resultValue); } }
aeab02b49bd41699c74078b66b45a5f338493a53
6635387159b685ab34f9c927b878734bd6040e7e
/src/org/apache/commons/io/LineIterator.java
b386b6d0857e01adc9d740dcc4b7d6d33923737c
[]
no_license
RepoForks/com.snapchat.android
987dd3d4a72c2f43bc52f5dea9d55bfb190966e2
6e28a32ad495cf14f87e512dd0be700f5186b4c6
refs/heads/master
2021-05-05T10:36:16.396377
2015-07-16T16:46:26
2015-07-16T16:46:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,084
java
package org.apache.commons.io; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.Iterator; import java.util.NoSuchElementException; public class LineIterator implements Iterator<String> { private final BufferedReader bufferedReader; private String cachedLine; private boolean finished = false; public LineIterator(Reader paramReader) { if (paramReader == null) { throw new IllegalArgumentException("Reader must not be null"); } if ((paramReader instanceof BufferedReader)) { bufferedReader = ((BufferedReader)paramReader); return; } bufferedReader = new BufferedReader(paramReader); } public static void closeQuietly(LineIterator paramLineIterator) { if (paramLineIterator != null) { paramLineIterator.close(); } } public void close() { finished = true; IOUtils.closeQuietly(bufferedReader); cachedLine = null; } public boolean hasNext() { if (cachedLine != null) { return true; } if (finished) { return false; } try { String str; do { str = bufferedReader.readLine(); if (str == null) { finished = true; return false; } } while (!isValidLine(str)); cachedLine = str; return true; } catch (IOException localIOException) { close(); throw new IllegalStateException(localIOException); } } protected boolean isValidLine(String paramString) { return true; } public String next() { return nextLine(); } public String nextLine() { if (!hasNext()) { throw new NoSuchElementException("No more lines"); } String str = cachedLine; cachedLine = null; return str; } public void remove() { throw new UnsupportedOperationException("Remove unsupported on LineIterator"); } } /* Location: * Qualified Name: org.apache.commons.io.LineIterator * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
5aa8d5e14e26b69d231a9202dcaf66377a0154e5
9ea4dccb440a34e000e74b472cf4a2ca9e264ae6
/ng-pw-legacy/src/pw-web/java/com/csc/fsg/life/pw/web/io/descriptor/wma/TW70X1Descriptor.java
98e9a027875844e26017ff19ed012625f27b65f4
[]
no_license
jasmeet167/PW-NextGen
516473e8d7171b49a832304e76170b3c62ab7261
ea8d9e4de3c8a9dde35bc7b90a6bdba2aee74654
refs/heads/master
2021-01-20T16:21:41.676449
2017-05-09T11:45:40
2017-05-09T11:45:40
90,832,529
0
1
null
null
null
null
UTF-8
Java
false
false
5,126
java
package com.csc.fsg.life.pw.web.io.descriptor.wma; import com.csc.fsg.life.pw.web.io.*; public class TW70X1Descriptor extends TableDescriptor { private static final String pagingSql = "SELECT COMPANY_CODE, TABLE_SUBSET, ISSUE_AGE, DURATION, D_SUB_X, LN_V_SUPER_T, ANNUITY_DUE FROM "; public void initialize() { setRowClass(TW70X1Row.class); setTableName("TW70X1"); setTableId("70X"); super.initialize(); } public void initializeColumnDescriptors() { super.initializeColumnDescriptors(); addColumnDescriptor(new ColumnDescriptor(this,"getCompanyCode","setCompanyCode","COMPANY_CODE,1,1,3,0,true|,0,CHAR,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getTableSubset","setTableSubset","TABLE_SUBSET,1,2,16,0,true|,0,CHAR,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getIssueAge","setIssueAge","ISSUE_AGE,3,3,3,0,true|,0,INTEGER,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getDuration","setDuration","DURATION,3,4,3,0,true|,0,INTEGER,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getDSubX","setDSubX","D_SUB_X,3,5,17,8,false|,0,DOUBLE,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getLnVSuperT","setLnVSuperT","LN_V_SUPER_T,3,6,13,11,false|,0,DOUBLE,1,null,null,null,null,null")); addColumnDescriptor(new ColumnDescriptor(this,"getAnnuityDue","setAnnuityDue","ANNUITY_DUE,3,7,9,6,false|,0,DOUBLE,1,null,null,null,null,null")); } public String getPagingSQL(String schemaName,boolean isSubsetMode,boolean isNext, boolean locator) { String pagingWhere = null; String order = null; if (isNext) { if (isSubsetMode) if (locator) pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND (TABLE_SUBSET = :table_subset) AND ((ISSUE_AGE > :issue_age) OR (ISSUE_AGE = :issue_age AND DURATION > :duration) OR (ISSUE_AGE = :issue_age AND DURATION = :duration)) "; else pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND (TABLE_SUBSET = :table_subset) AND ((ISSUE_AGE > :issue_age) OR (ISSUE_AGE = :issue_age AND DURATION > :duration)) "; else if (locator) pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND ((TABLE_SUBSET > :table_subset) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE > :issue_age) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE = :issue_age AND DURATION > :duration) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE = :issue_age AND DURATION = :duration)) "; else pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND ((TABLE_SUBSET > :table_subset) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE > :issue_age) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE = :issue_age AND DURATION > :duration)) "; order = " ORDER BY COMPANY_CODE, TABLE_SUBSET, ISSUE_AGE, DURATION"; } else { if (isSubsetMode) pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND (TABLE_SUBSET = :table_subset) AND ((ISSUE_AGE < :issue_age) OR (ISSUE_AGE = :issue_age AND DURATION < :duration)) "; else pagingWhere = ".TW70X1 WHERE (COMPANY_CODE = :company_code) AND ((TABLE_SUBSET < :table_subset) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE < :issue_age) OR (TABLE_SUBSET = :table_subset AND ISSUE_AGE = :issue_age AND DURATION < :duration)) "; order = " ORDER BY COMPANY_CODE DESC, TABLE_SUBSET DESC, ISSUE_AGE DESC, DURATION DESC"; } return pagingSql + schemaName + pagingWhere + order; } public String prepareInsertStmt(String schemaName) { StringBuffer sb = new StringBuffer(); sb.append("INSERT INTO ").append(schemaName); sb.append(".TW70X1 ( "); sb.append("COMPANY_CODE, TABLE_SUBSET, ISSUE_AGE, DURATION, D_SUB_X, LN_V_SUPER_T, ANNUITY_DUE )"); sb.append(" VALUES (?, ?, ?, ?, ?, ?, ? )"); return sb.toString(); } public String prepareUpdateStmt(String schemaName) { StringBuffer sb = new StringBuffer(); sb.append("UPDATE ").append(schemaName); sb.append(".TW70X1 "); sb.append(" SET COMPANY_CODE = ?, TABLE_SUBSET = ?, ISSUE_AGE = ?, DURATION = ?, D_SUB_X = ?, LN_V_SUPER_T = ?, ANNUITY_DUE = ?"); sb.append(" WHERE COMPANY_CODE = ? AND TABLE_SUBSET = ? AND ISSUE_AGE = ? AND DURATION = ?"); return sb.toString(); } public String prepareDeleteStmt(String schemaName) { StringBuffer sb = new StringBuffer(); sb.append("DELETE FROM ").append(schemaName); sb.append(".TW70X1 "); sb.append(" WHERE COMPANY_CODE = ? AND TABLE_SUBSET = ? AND ISSUE_AGE = ? AND DURATION = ?"); return sb.toString(); } }
8b9f22f87237863137c947feeed93f4a09af0bbf
4e317d7fd874ac0e65ba381db655e2a304b84022
/src/main/java/org/open/market/config/LogConfig.java
ffd5e16f365a31201d500974be02704d4531649d
[]
no_license
escapearth/openmarket
612f4d78e63748bc62e330ea3eb1e2921b9c236e
c34e94481163d1ffa2ed3ca3d7b595d384f4f87e
refs/heads/master
2021-04-16T11:03:45.808528
2020-03-24T15:25:01
2020-03-24T15:25:01
249,351,227
0
0
null
null
null
null
UTF-8
Java
false
false
821
java
package org.open.market.config; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @Aspect @Component public class LogConfig { Logger logger = LoggerFactory.getLogger(LogConfig.class); @Around("execution(* org.open.market.service.*Service.*(..))") public Object logging(ProceedingJoinPoint pjp) throws Throwable { logger.info("start - " + pjp.getSignature().getDeclaringTypeName() + " / " + pjp.getSignature().getName()); Object result = pjp.proceed(); logger.info("finished - " + pjp.getSignature().getDeclaringTypeName() + " / " + pjp.getSignature().getName()); return result; } }
ff3644338ba5a3bacecaef491e378c7c4c483268
994bf9a04abf161236595c786a7ae6825c49b0ae
/Exams/second_2012a2b/IntNode.java
beefeacdecd659d9e657e4f7ecfa6b2444046922
[]
no_license
easpex/java
7cdfbe26594ee3b51112992a67a00211d1ec355d
ed1caa19a59a3ff40962816de59b80c619c9e92e
refs/heads/master
2021-01-13T17:08:20.805254
2016-10-28T18:06:57
2016-10-28T18:06:57
72,230,514
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
public class IntNode { private int _value; private IntNode _next; public IntNode(int val, IntNode n) { _value = val; _next = n; } public int getValue() { return _value; } public IntNode getNext() { return _next; } public void setValue(int v) { _value = v; } public void setNext(IntNode node) { _next = node; } }
f7ea160fcef1f74854767e6722872567e5e7f0b4
9b6e984313c3d2fed9d760a87e685f96e4cd087f
/src/main/java/HelloWorld.java
3b15f58d6231c04293f94ff9a48456b252ae66d1
[]
no_license
siarqua/java8InAction
64d3bf2ea1a7235f9d568cafb2ae943fdf9a7630
c7370efe8e1e62bb11b2da8ea2160282c30e2a55
refs/heads/master
2020-04-05T13:02:54.629813
2017-07-14T14:21:48
2017-07-14T14:21:48
95,036,101
0
0
null
2017-07-03T18:09:49
2017-06-21T18:52:33
Java
UTF-8
Java
false
false
158
java
/** * Created by lukasz on 16.06.17. */ public class HelloWorld { public static void main(String[] args) { System.out.println("test"); } }
b6f0de321d56795b46a162e4eacf8ca00d1891f7
c7da13b3c0b8b53bc627c0d7b1555fedd64c18b8
/mooncore-Security/src/test/java/mooncoreSecurity/mooncore_Security/AppTest.java
eaf016d9e1684702a8e52696e732dd4de69f887f
[]
no_license
mushtaque87/SecurityTesting
7fffe53a98b3a087658721dfdf20b7d146f75e06
85d590ce50795834d8e1f6c74151fb28086f8c85
refs/heads/master
2021-08-18T23:31:02.466166
2017-11-24T06:30:29
2017-11-24T06:30:29
107,225,714
0
0
null
null
null
null
UTF-8
Java
false
false
662
java
package mooncoreSecurity.mooncore_Security; 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 ); } }
f714e6c1192621bfa93d6cbbbcd4284b509cf398
71719fd26191f788e4a5a7e7017821641498e560
/message-bus/src/main/java/cn/felord/messagebus/config/DelegateMessagePostProcessor.java
0360444fd3a329b45e897a3c04fb43a740a32a2c
[]
no_license
NotFound403/dax-cloud
0749db81d7222d74dc3b1868912030bed163266e
a124889a26323d5d6663d0920758a643b0ade422
refs/heads/master
2021-05-14T05:24:32.466673
2018-01-04T09:41:39
2018-01-04T09:41:39
116,220,234
3
2
null
null
null
null
UTF-8
Java
false
false
1,090
java
package cn.felord.messagebus.config; import org.springframework.amqp.AmqpException; import org.springframework.amqp.core.Message; import org.springframework.amqp.core.MessagePostProcessor; import org.springframework.amqp.core.MessageProperties; /** * 代理消息延时处理器 * * @author dax. * @version v1.0 * @since 2017 /12/6 9:39 */ public class DelegateMessagePostProcessor implements MessagePostProcessor { /** * 延时消费毫秒数 */ private long delayTimeMillis; /** * Instantiates a new Delegate message post processor. * * @param delayTimeMillis the delay time millis */ public DelegateMessagePostProcessor(long delayTimeMillis) { this.delayTimeMillis = delayTimeMillis; } @Override public Message postProcessMessage(Message message) throws AmqpException { MessageProperties messageProperties = message.getMessageProperties(); messageProperties.setExpiration(String.valueOf(delayTimeMillis)); messageProperties.setContentEncoding("UTF-8"); return message; } }
79a3039fd3934ffb14b7d85f6c83497affb0eae1
3f3a09546228e4ad4e6e6e8b5422b446ada6600f
/app/src/androidTest/java/org/avvento/apps/telefyna/ExampleInstrumentedTest.java
1fcffd2c59f1cf0ad3c240e28e5ffc6c1bb34bce
[]
no_license
avventoapps/Telefyna-App
1f9507ab3286695fcac34e667dd22c8db6fc0e78
2e6645706678b56ee614ae458d4b2eb0b38589ce
refs/heads/master
2023-06-18T18:21:49.939990
2021-07-21T09:28:35
2021-07-21T09:28:35
387,530,706
2
2
null
null
null
null
UTF-8
Java
false
false
732
java
package org.avvento.apps.telefyna; import android.content.Context; import org.junit.Test; import org.junit.runner.RunWith; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import static org.junit.Assert.assertEquals; /** * 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("org.avvento.apps.telefyna", appContext.getPackageName()); } }
93d87d1fc3b30f348533c1cc6e89c0eec2b06975
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/navasmdc--MaterialDesignLibrary/1c574cfdb6fafe9f2376cc0400ed0782857e8882/before/ProgressBarIndeterminateDeterminate.java
686f80bfc10c6e17bf1bf7dc8f4a5be3d8f879a8
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,927
java
package com.gc.materialdesign.views; import com.nineoldandroids.animation.Animator; import com.nineoldandroids.animation.AnimatorListenerAdapter; import com.nineoldandroids.animation.ObjectAnimator; import com.nineoldandroids.view.ViewHelper; import android.content.Context; import android.util.AttributeSet; public class ProgressBarIndeterminateDeterminate extends ProgressBarDeterminate { boolean firstProgress = true; boolean runAnimation = true; ObjectAnimator animation; public ProgressBarIndeterminateDeterminate(Context context, AttributeSet attrs) { super(context, attrs); post(new Runnable() { @Override public void run() { // Make progress animation setProgress(60); ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2); animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2); animation.setDuration(1200); animation.addListener(new AnimatorListenerAdapter() { int cont = 1; int suma = 1; int duration = 1200; public void onAnimationEnd(Animator arg0) { // Repeat animation if(runAnimation){ ViewHelper.setX(progressView, getWidth() + progressView.getWidth() / 2); cont += suma; animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth() / 2); animation.setDuration(duration / cont); animation.addListener(this); animation.start(); if(cont == 3 || cont == 1) { suma *= -1; } } } }); animation.start(); } }); } @Override public void setProgress(int progress) { if(firstProgress){ firstProgress = false; }else{ stopIndeterminate(); } super.setProgress(progress); } /** * Stop indeterminate animation to convert view in determinate progress bar */ private void stopIndeterminate(){ animation.cancel(); ViewHelper.setX(progressView,0); runAnimation = false; } }
cb344466e3956ca79816675362c0ff1c43c9565e
57555ba88a7ec99349b06276c9f2512606fb3baa
/src/sweeper/Flag.java
21770e67cb385afacf587e6f7416e2ca5359e82e
[]
no_license
Alexsanchoo/MinesweeperJavaGame
1e9ed46cdcb8033d96ed131d578d2f4efaf914de
482447c90938aaab257ba90e29be780201d83432
refs/heads/master
2022-11-21T03:22:10.157721
2020-07-27T19:50:34
2020-07-27T19:50:34
282,687,304
0
0
null
null
null
null
UTF-8
Java
false
false
1,576
java
package sweeper; class Flag { private Matrix flagMap; private int countOfClosedBoxes; void start() { flagMap = new Matrix(Box.CLOSED); countOfClosedBoxes = Ranges.getSize().x * Ranges.getSize().y; } Box get(Coord coord) { return flagMap.get(coord); } public void setOpenedToBox(Coord coord) { flagMap.set(coord, Box.OPENED); countOfClosedBoxes--; } public void setFlagedToBox(Coord coord) { flagMap.set(coord, Box.FLAGED); } private void setClosedBox(Coord coord) { flagMap.set(coord, Box.CLOSED); } public void toggleFlagedToBox(Coord coord) { switch (flagMap.get(coord)) { case FLAGED: setClosedBox(coord); break; case CLOSED: setFlagedToBox(coord); break; } } int getCountOfClosedBoxes() { return countOfClosedBoxes; } public void setBombedToBox(Coord coord) { flagMap.set(coord, Box.BOMBED); } void setOpenedToClosedBombBox(Coord coord) { if(flagMap.get(coord) == Box.CLOSED) { flagMap.set(coord, Box.OPENED); } } void setNoBombToFlagedSafeBox(Coord coord) { if(flagMap.get(coord) == Box.FLAGED) { flagMap.set(coord, Box.NOBOMB); } } int getCountFlagedBoxesAroundNumber(Coord coord) { int count = 0; for(Coord around : Ranges.getCoordAround(coord)) { if(flagMap.get(around) == Box.FLAGED) { count++; } } return count; } }
4ec75e949ebf81b0a10a56325da4b374bcbb08c5
96b10a273de656e534e1b9373080b8c00fd43b7d
/app/src/main/java/com/github/kongpf8848/shuihu/activity/Constants.java
fb05ef4940f7a49b3034324a04e9e0dc0811b9f9
[]
no_license
kongpf8848/shuihu
1976a94260104f54d9ed35cd9d3c0637cb5da55f
ee1bb9be9ce15df24e9e18663091b76b48701594
refs/heads/master
2021-09-28T04:50:06.736307
2021-09-12T14:13:47
2021-09-12T14:13:47
210,838,015
0
0
null
null
null
null
UTF-8
Java
false
false
6,595
java
package com.github.kongpf8848.shuihu.activity; public class Constants { public static final String[] NAME_LIST = { "宋江", "卢俊义", "吴用", "公孙胜", "关胜", "林冲", "秦明", "呼延灼", "花荣", "柴进", "李应", "朱仝", "鲁智深", "武松", "董平", "张清", "杨志", "徐宁", "索超", "戴宗", "刘唐", "李逵", "史进", "穆弘", "雷横", "李俊", "阮小二", "张横", "阮小五", "张顺", "阮小七", "杨雄", "石秀", "解珍", "解宝", "燕青", "朱武", "黄信", "孙立", "宣赞", "郝思文", "韩滔", "彭玘", "单延圭", "魏定国", "萧让", "裴宣", "欧鹏", "邓飞", "燕顺", "杨林", "凌振", "蒋敬", "吕方", "郭盛", "安道全", "皇甫端", "王英", "扈三娘", "鲍旭", "樊瑞", "孔明", "孔亮", "项充", "李衮", "金大坚", "马麟", "童威", "童猛", "孟康", "侯健", "陈达", "杨春", "郑天寿", "陶宗旺", "宋清", "乐和", "龚旺", "丁得孙", "穆春", "曹正", "宋万", "杜迁", "薛永", "施恩", "李忠", "周通", "汤隆", "杜兴", "邹渊", "邹润", "朱贵", "朱富", "蔡福", "蔡庆", "李立", "李云", "焦挺", "石勇", "孙新", "顾大嫂", "张青", "孙二娘", "王定六", "郁保四", "白胜", "时迁", "段景住" }; public static final String[] NICK_LIST = { "呼保义", "玉麒麟", "智多星", "入云龙", "大刀", "豹子头", "霹雳火", "双鞭", "小李广", "小旋风", "扑天雕", "美髯公", "花和尚", "行者", "双枪将", "没羽箭", "青面兽", "金枪手", "急先锋", "神行太保", "赤发鬼", "黑旋风", "九纹龙", "没遮拦", "插翅虎", "混江龙", "立地太岁", "船火儿", "短命二郎", "浪里白条", "活阎罗", "病关索", "拼命三郎", "两头蛇", "双尾蝎", "浪子", "神机军师", "镇三山", "病尉迟", "丑郡马", "井木犴", "百胜将", "天目将", "圣水将", "神火将", "圣手书生", "铁面孔目", "摩云金翅", "火眼狻猊", "锦毛虎", "锦豹子", "轰天雷", "神算子", "小温侯", "赛仁贵", "神医", "紫髯伯", "矮脚虎", "一丈青", "丧门神", "混世魔王", "毛头星", "独火星", "八臂哪吒", "飞天大圣", "玉臂匠", "铁笛仙", "出洞蛟", "翻江蜃", "玉幡竿", "通臂猿", "跳涧虎", "白花蛇", "白面郎君", "九尾龟", "铁扇子", "铁叫子", "花项虎", "中箭虎", "小遮拦", "操刀鬼", "云里金刚", "摸着天", "病大虫", "金眼彪", "打虎将", "小霸王", "金钱豹子", "鬼脸儿", "出林龙", "独角龙", "旱地忽律", "笑面虎", "铁臂膊", "一枝花", "催命判官", "青眼虎", "没面目", "石将军", "小尉迟", "母大虫", "菜园子", "母夜叉", "活闪婆", "险道神", "白日鼠", "鼓上骚", "金毛犬" }; public static final String[] STAR_LIST = { "天魁星", "天罡星", "天机星", "天闲星", "天勇星", "天雄星", "天猛星", "天威星", "天英星", "天贵星", "天富星", "天满星", "天孤星", "天伤星", "天立星", "天捷星", "天暗星", "天佑星", "天空星", "天速星", "天异星", "天杀星", "天微星", "天究星", "天退星", "天寿星", "天剑星", "天平星", "天罪星", "天损星", "天败星", "天牢星", "天慧星", "天暴星", "天哭星", "天巧星", "地魁星", "地煞星", "地勇星", "地杰星", "地雄星", "地威星", "地英星", "地奇星", "地猛星", "地文星", "地正星", "地阔星", "地阖星", "地强星", "地暗星", "地轴星", "地会星", "地佐星", "地佑星", "地灵星", "地兽星", "地微星", "地彗星", "地暴星", "地然星", "地猖星", "地狂星", "地飞星", "地走星", "地巧星", "地明星", "地进星", "地退星", "地满星", "地遂星", "地周星", "地隐星", "地异星", "地理星", "地俊星", "地乐星", "地捷星", "地速星", "地镇星", "地羁星", "地魔星", "地妖星", "地幽星", "地伏星", "地僻星", "地空星", "地孤星", "地全星", "地短星", "地角星", "地囚星", "地藏星", "地平星", "地损星", "地奴星", "地察星", "地恶星", "地丑星", "地数星", "地阴星", "地刑星", "地壮星", "地劣星", "地健星", "地耗星", "地贼星", "地狗星" }; public static final String[] SORT_LIST = { "第一", "第二", "第三", "第四", "第五", "第六", "第七", "第八", "第九", "第十", "第十一", "第十二", "第十三", "第十四", "第十五", "第十六", "第十七", "第十八", "第十九", "第二十", "第二十一", "第二十二", "第二十三", "第二十四", "第二十五", "第二十六", "第二十七", "第二十八", "第二十九", "第三十", "第三十一", "第三十二", "第三十三", "第三十四", "第三十五", "第三十六", "第三十七", "第三十八", "第三十九", "第四十", "第四十一", "第四十二", "第四十三", "第四十四", "第四十五", "第四十六", "第四十七", "第四十八", "第四十九", "第五十", "第五十一", "第五十二", "第五十三", "第五十四", "第五十五", "第五十六", "第五十七", "第五十八", "第五十九", "第六十", "第六十一", "第六十二", "第六十三", "第六十四", "第六十五", "第六十六", "第六十七", "第六十八", "第六十九", "第七十", "第七十一", "第七十二", "第七十三", "第七十四", "第七十五", "第七十六", "第七十七", "第七十八", "第七十九", "第八十", "第八十一", "第八十二", "第八十三", "第八十四", "第八十五", "第八十六", "第八十七", "第八十八", "第八十九", "第九十", "第九十一", "第九十二", "第九十三", "第九十四", "第九十五", "第九十六", "第九十七", "第九十八", "第九十九", "第一百", "第一百零一", "第一百零二", "第一百零三", "第一百零四", "第一百零五", "第一百零六", "第一百零七", "第一百零八" }; }
7fa4a68b2e4e1c66e7095537db2d02602530178e
56f6305a1943bcd63fbd5dead12355d75e865805
/BoundService/app/src/main/java/com/example/amangupta/boundservice/MainActivity.java
6e9e766885376ec2f71c11e18ff2578da3c3002c
[]
no_license
amanag395/android-projects
646f7619609bc6aba4e67a1830e9d7dabe334ae6
d006f79f938af762d27a6dd1af5c42c79031de08
refs/heads/master
2021-01-23T07:49:46.166965
2017-04-08T08:09:09
2017-04-08T08:09:09
86,448,529
0
0
null
null
null
null
UTF-8
Java
false
false
2,781
java
package com.example.amangupta.boundservice; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.IBinder; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements BoundService.Listener, View.OnClickListener { BoundService mService; boolean aBoolean = true; boolean isStart = false; MainActivity mainActivity = this; ServiceConnection connection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { BoundService.MyBinder myBinder = (BoundService.MyBinder) service; mService = myBinder.getService(); mService.setListener(mainActivity); aBoolean = true; mService.startListener(); } @Override public void onServiceDisconnected(ComponentName name) { Log.d("main", "onServiceDisconnected"); aBoolean = false; } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.bt_start).setOnClickListener(this); findViewById(R.id.bt_stop).setOnClickListener(this); } @Override public void makeToast() { Thread thread = new Thread(new Runnable() { @Override public void run() { while (aBoolean) { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "Alarm", Toast.LENGTH_SHORT).show(); } }); } } }); thread.start(); } @Override protected void onPause() { super.onPause(); } @Override protected void onResume() { super.onResume(); } @Override public void onClick(View v) { if (v.getId() == R.id.bt_start && !isStart) { Intent intent = new Intent(this, BoundService.class); bindService(intent, connection, BIND_AUTO_CREATE); isStart = true; } else if (v.getId() == R.id.bt_stop && isStart) { unbindService(connection); aBoolean = false; isStart = false; } } }
127b41cad78c6e32a84ea7675e3fb45da42bb7f3
7e590f0e337051a90cb8e0c591e4a84457915f69
/api-diff-core/src/main/java/ru/uskov/apidiff/graph/Graph.java
25891d3ccf58c671c7ca86f632d1171a5b64f690
[]
no_license
ausatiy/jar-api-diff
fde06bb2f4e88b342ac5d4b07d65b4f6f47699fd
2c31777364038019976636ea5cbeff1e8d3950d4
refs/heads/master
2020-03-27T07:13:41.815036
2018-10-02T16:44:42
2018-10-02T16:44:42
146,172,988
0
0
null
null
null
null
UTF-8
Java
false
false
2,629
java
package ru.uskov.apidiff.graph; import ru.uskov.apidiff.classesmodel.Api; import ru.uskov.apidiff.classesmodel.ClassInstance; import ru.uskov.apidiff.transform.TransformOperation; import java.util.*; /** * Graph of API changes. Each node of graph represents API obtained by some list of changes. * At the moment the Dijkstra’s algorithm is used to find the easiest way to find path in the graph * (to find list of changes in order to obtain required API) */ public class Graph { private final Api initialApi; private final RouteHelper.RenamePolicy renamePolicy; public Graph(Api initialApi, RouteHelper.RenamePolicy renamePolicy) { this.initialApi= initialApi; this.renamePolicy = renamePolicy; } /** * Finds the "lightest" list of changes to get newApi from initialApi * @param newApi the api to be obtained * @return graphNode with list of changes required to get required API */ public GraphNode pathTo(Api newApi) { final Set<GraphNode> openNodes = new HashSet<>(); final Queue<GraphNode> shellNodesQueue = new PriorityQueue<>(); shellNodesQueue.add(new GraphNode(initialApi)); final RouteHelper routeHelper = new RouteHelper(renamePolicy); while (! shellNodesQueue.isEmpty()) { final GraphNode currentNode = shellNodesQueue.poll(); if (currentNode.getApi().equals(newApi)) { return currentNode; } openNodes.add(currentNode); for (TransformOperation transformOperation : routeHelper.getTransformOperations(currentNode, newApi)) { System.out.println(String.format("Checked nodes: %s, nodes to check: %s, current weight: %s.", openNodes.size(), shellNodesQueue.size(), currentNode.getWeight())); GraphNode newNode = currentNode.withTransform(transformOperation); if (! openNodes.contains(newNode)) { for(Iterator<GraphNode> it = shellNodesQueue.iterator(); it.hasNext(); ) { final GraphNode node = it.next(); if ((node.getWeight() > newNode.getWeight()) && node.equals(newNode)) { // Existing node has unoptimal route it.remove(); shellNodesQueue.add(newNode); break; } } shellNodesQueue.add(newNode); } } } throw new RuntimeException("Could not find find full list of class modifications."); } }
7171aa3d3a2590b229e72fe1fd56c1cc48acbe40
b16f2bb70f72fe28f9685814f98b844ef23888f0
/src/test/java/uk/me/paulswilliams/addressbook/cukes/StepDefinitions.java
bb2c5b4d8fd19ac8d1d8a4c052b720a37ff80e47
[]
no_license
paulspencerwilliams/addressbook
f5d9afc308c7ae4498e9601e8f45d926a561bfb5
694593bb22f722ee4101e6426c7872306c3193b9
refs/heads/master
2020-05-20T00:00:16.827162
2014-12-19T13:33:33
2014-12-19T13:33:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,303
java
package uk.me.paulswilliams.addressbook.cukes; import cucumber.api.DataTable; import cucumber.api.PendingException; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class StepDefinitions { private AddressBookRepository addressBookRepository = new AddressBookRepository(); @Given("^no entries exist$") public void no_entries_exist() throws Throwable { addressBookRepository.recreate(); } @When("^I create \"([^\"]*)\" with phone number (\\d+)$") public void I_create_with_phone_number(String name, int phoneNumber) throws Throwable { // Express the Regexp above with the code you wish you had throw new PendingException(); } @When("^I search for \"([^\"]*)\"$") public void I_search_for(String searchString) throws Throwable { // Express the Regexp above with the code you wish you had throw new PendingException(); } @Then("^I should see the following entries$") public void I_should_see_the_following_entries(DataTable expectedSearchResults) throws Throwable { // Express the Regexp above with the code you wish you had // For automatic conversion, change DataTable to List<YourType> throw new PendingException(); } }