blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7a55dce14b9185ea2d511badc09a4b9aaff94205 | cf81656232ac3bf3c17de0170a36272df8e0d21b | /ftpGate/apache-sshd-2.2.0/sshd-mina/src/main/java/org/apache/sshd/common/io/mina/MinaService.java | 92090a93e90a9ff1354ede4948b2affb4e429130 | [
"Apache-2.0"
] | permissive | delphiasp/sftpGate | 35fe1b02f88ce2b0aeee87bacb7ebfbaaaafc2cd | a558127cff468d2b9cc939b2da1582d5b84a93fe | refs/heads/master | 2022-08-06T11:27:30.630957 | 2019-12-28T13:51:38 | 2019-12-28T13:51:38 | 221,374,661 | 1 | 0 | null | 2022-05-25T06:46:23 | 2019-11-13T04:47:26 | Java | UTF-8 | Java | false | false | 8,612 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sshd.common.io.mina;
import java.net.SocketAddress;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.apache.mina.core.RuntimeIoException;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.service.IoProcessor;
import org.apache.mina.core.service.IoService;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.session.IoSessionConfig;
import org.apache.mina.transport.socket.SocketSessionConfig;
import org.apache.mina.transport.socket.nio.NioSession;
import org.apache.sshd.common.Closeable;
import org.apache.sshd.common.FactoryManager;
import org.apache.sshd.common.io.IoServiceEventListener;
import org.apache.sshd.common.util.GenericUtils;
import org.apache.sshd.common.util.Readable;
import org.apache.sshd.common.util.closeable.AbstractCloseable;
/**
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
public abstract class MinaService extends AbstractCloseable implements org.apache.sshd.common.io.IoService, IoHandler, Closeable {
protected final FactoryManager manager;
protected final org.apache.sshd.common.io.IoHandler handler;
protected final IoProcessor<NioSession> ioProcessor;
protected IoSessionConfig sessionConfig;
private IoServiceEventListener eventListener;
protected MinaService(FactoryManager manager, org.apache.sshd.common.io.IoHandler handler, IoProcessor<NioSession> ioProcessor) {
this.manager = Objects.requireNonNull(manager, "No factory manager provided");
this.handler = Objects.requireNonNull(handler, "No IoHandler provided");
this.ioProcessor = Objects.requireNonNull(ioProcessor, "No IoProcessor provided");
}
@Override
public IoServiceEventListener getIoServiceEventListener() {
return eventListener;
}
@Override
public void setIoServiceEventListener(IoServiceEventListener listener) {
eventListener = listener;
}
protected abstract IoService getIoService();
public void dispose() {
IoService ioService = getIoService();
ioService.dispose();
}
@Override
protected void doCloseImmediately() {
try {
dispose();
} finally {
super.doCloseImmediately();
}
}
@Override
public Map<Long, org.apache.sshd.common.io.IoSession> getManagedSessions() {
IoService ioService = getIoService();
Map<Long, IoSession> managedMap = ioService.getManagedSessions();
Map<Long, IoSession> mina = new HashMap<>(managedMap);
Map<Long, org.apache.sshd.common.io.IoSession> sessions = new HashMap<>(mina.size());
for (Long id : mina.keySet()) {
// Avoid possible NPE if the MinaSession hasn't been created yet
IoSession minaSession = mina.get(id);
org.apache.sshd.common.io.IoSession session = getSession(minaSession);
if (session != null) {
sessions.put(id, session);
}
}
return sessions;
}
@Override
public void sessionOpened(IoSession session) throws Exception {
// Empty handler
}
@Override
public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
// Empty handler
}
@Override
public void messageSent(IoSession session, Object message) throws Exception {
// Empty handler
}
@Override
public void inputClosed(IoSession session) throws Exception {
session.closeNow();
}
protected void sessionCreated(IoSession session, SocketAddress acceptanceAddress) throws Exception {
org.apache.sshd.common.io.IoSession ioSession = new MinaSession(this, session, acceptanceAddress);
try {
session.setAttribute(org.apache.sshd.common.io.IoSession.class, ioSession);
handler.sessionCreated(ioSession);
} catch (Exception e) {
log.warn("sessionCreated({}) failed {} to handle creation event: {}",
session, e.getClass().getSimpleName(), e.getMessage());
ioSession.close(true);
throw e;
}
}
@Override
public void sessionClosed(IoSession ioSession) throws Exception {
org.apache.sshd.common.io.IoSession session = getSession(ioSession);
handler.sessionClosed(session);
}
@Override
public void exceptionCaught(IoSession ioSession, Throwable cause) throws Exception {
org.apache.sshd.common.io.IoSession session = getSession(ioSession);
handler.exceptionCaught(session, cause);
}
@Override
public void messageReceived(IoSession ioSession, Object message) throws Exception {
org.apache.sshd.common.io.IoSession session = getSession(ioSession);
Readable ioBuffer = MinaSupport.asReadable((IoBuffer) message);
handler.messageReceived(session, ioBuffer);
}
protected org.apache.sshd.common.io.IoSession getSession(IoSession session) {
return (org.apache.sshd.common.io.IoSession)
session.getAttribute(org.apache.sshd.common.io.IoSession.class);
}
protected void configure(SocketSessionConfig config) {
Boolean boolVal = getBoolean(FactoryManager.SOCKET_KEEPALIVE);
if (boolVal != null) {
try {
config.setKeepAlive(boolVal);
} catch (RuntimeIoException t) {
handleConfigurationError(config, FactoryManager.SOCKET_KEEPALIVE, boolVal, t);
}
}
Integer intVal = getInteger(FactoryManager.SOCKET_SNDBUF);
if (intVal != null) {
try {
config.setSendBufferSize(intVal);
} catch (RuntimeIoException t) {
handleConfigurationError(config, FactoryManager.SOCKET_SNDBUF, intVal, t);
}
}
intVal = getInteger(FactoryManager.SOCKET_RCVBUF);
if (intVal != null) {
try {
config.setReceiveBufferSize(intVal);
} catch (RuntimeIoException t) {
handleConfigurationError(config, FactoryManager.SOCKET_RCVBUF, intVal, t);
}
}
intVal = getInteger(FactoryManager.SOCKET_LINGER);
if (intVal != null) {
try {
config.setSoLinger(intVal);
} catch (RuntimeIoException t) {
handleConfigurationError(config, FactoryManager.SOCKET_LINGER, intVal, t);
}
}
boolVal = getBoolean(FactoryManager.TCP_NODELAY);
if (boolVal != null) {
try {
config.setTcpNoDelay(boolVal);
} catch (RuntimeIoException t) {
handleConfigurationError(config, FactoryManager.TCP_NODELAY, boolVal, t);
}
}
if (sessionConfig != null) {
config.setAll(sessionConfig);
}
}
protected void handleConfigurationError(
SocketSessionConfig config, String propName, Object propValue, RuntimeIoException t) {
Throwable e = GenericUtils.resolveExceptionCause(t);
log.warn("handleConfigurationError({}={}) failed ({}) to configure: {}",
propName, propValue, e.getClass().getSimpleName(), e.getMessage());
}
protected Integer getInteger(String property) {
return manager.getInteger(property);
}
protected Boolean getBoolean(String property) {
return manager.getBoolean(property);
}
}
| [
"[email protected]"
] | |
b7442c54dcab9e9e3e9906fb0a6bc3fe38bef4f9 | 0653d65225d55286d2fc2d162df77a863fcc7cd6 | /TotalLiabilityComparator.java | 19a1fa8f3eb56d0db7e743ff5d4634efdc046c30 | [] | no_license | ahmedIreland/PDP-JAVA-Code | 4c32ad87a934bffe5473b051c17f96e6a265ad4d | b618a895eb31489e996ef46818f62c23bff5a102 | refs/heads/main | 2023-03-12T07:07:29.608659 | 2021-02-22T15:18:04 | 2021-02-22T15:18:04 | 341,239,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | import java.util.Comparator;
public class TotalLiabilityComparator implements Comparator<ReportData> {
@Override
public int compare(ReportData reportData1, ReportData reportData2) {
return Double.compare(reportData2.getTotalLiability(), reportData1.getTotalLiability());
}
}
| [
"[email protected]"
] | |
c4827baac9ba22b553286df887852ed627825ba8 | 9bf14b4d2eac89c403109c15a5d48127a81ef8a9 | /src/minecraft/net/minecraft/client/renderer/IImageBuffer.java | 4f62307fdab806179c0596161f1959e0adf48fe3 | [
"MIT"
] | permissive | mchimsak/VodkaSrc | e6d7e968b645566b3eeb1c0995c8d65afc983d1e | 8f0cf23bac81c6bdf784228616f54afa84d03757 | refs/heads/master | 2020-05-01T08:48:11.781283 | 2018-11-20T05:46:18 | 2018-11-20T05:46:18 | 177,386,099 | 1 | 0 | MIT | 2019-03-24T07:59:07 | 2019-03-24T07:59:06 | null | UTF-8 | Java | false | false | 193 | java | package net.minecraft.client.renderer;
import java.awt.image.BufferedImage;
public interface IImageBuffer
{
BufferedImage parseUserSkin(BufferedImage image);
void skinAvailable();
}
| [
"wyy-666"
] | wyy-666 |
15b6331825bbbeda137bad29d77cf447e052c6e2 | 5d3b625aabf173f81d97e08a5a5753236627ab7f | /252_Meeting Rooms.java | bf660afa6352438a92f663dfff30ddbd3ab0b2be | [] | no_license | ssydyc/Leetcode_java | 53cf7e3594de06baf63444ac2f7b9b56defb2128 | 29ecf8d3af598cf39db3eb308936709aa30c03bd | refs/heads/master | 2016-09-06T14:32:48.739340 | 2016-02-11T08:48:14 | 2016-02-11T08:48:14 | 14,976,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | /**
* Definition for an interval.
* public class Interval {
* int start;
* int end;
* Interval() { start = 0; end = 0; }
* Interval(int s, int e) { start = s; end = e; }
* }
*/
class compareEnd implements Comparator<Interval>{
public int compare(Interval interval1, Interval interval2){
return interval1.end-interval2.end;
}
}
public class Solution {
public boolean canAttendMeetings(Interval[] intervals) {
Arrays.sort(intervals, new compareEnd());
for(int i=1; i<intervals.length;i++){
if(intervals[i].start<intervals[i-1].end) return false;
}
return true;
}
}
| [
"[email protected]"
] | |
8afd94ccf895ea6a74780f793fd5479d4f1295e8 | e168d73dc0a0ac81146d563146f75f57d1de8424 | /src/main/java/cn/zhanw/mapper/DetailSqlProvider.java | 3ca265d60190057ed23a018ab3abeca93c3bc57d | [] | no_license | zhanw99/guguanjia01 | 3484002cf7ee28a49c8a5618a711c22d3e3b34d7 | 6aed70287fe5dd83e137504962958167631baa1b | refs/heads/master | 2022-12-22T21:19:22.682169 | 2019-12-10T02:46:02 | 2019-12-10T02:46:02 | 224,758,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,836 | java | package cn.zhanw.mapper;
import cn.zhanw.entity.Detail;
import org.apache.ibatis.jdbc.SQL;
public class DetailSqlProvider {
public String insertSelective(Detail record) {
SQL sql = new SQL();
sql.INSERT_INTO("detail");
if (record.getId() != null) {
sql.VALUES("id", "#{id,jdbcType=BIGINT}");
}
if (record.getWorkOrderId() != null) {
sql.VALUES("work_order_id", "#{workOrderId,jdbcType=BIGINT}");
}
if (record.getWasteTypeId() != null) {
sql.VALUES("waste_type_id", "#{wasteTypeId,jdbcType=BIGINT}");
}
if (record.getWasteId() != null) {
sql.VALUES("waste_id", "#{wasteId,jdbcType=BIGINT}");
}
if (record.getComponent() != null) {
sql.VALUES("component", "#{component,jdbcType=VARCHAR}");
}
if (record.getWeight() != null) {
sql.VALUES("weight", "#{weight,jdbcType=REAL}");
}
if (record.getMorphological() != null) {
sql.VALUES("morphological", "#{morphological,jdbcType=VARCHAR}");
}
if (record.getPackaging() != null) {
sql.VALUES("packaging", "#{packaging,jdbcType=VARCHAR}");
}
if (record.getPlateNumber() != null) {
sql.VALUES("plate_number", "#{plateNumber,jdbcType=VARCHAR}");
}
if (record.getCreateDate() != null) {
sql.VALUES("create_date", "#{createDate,jdbcType=TIMESTAMP}");
}
if (record.getUpdateDate() != null) {
sql.VALUES("update_date", "#{updateDate,jdbcType=TIMESTAMP}");
}
if (record.getDelFlag() != null) {
sql.VALUES("del_flag", "#{delFlag,jdbcType=VARCHAR}");
}
if (record.getCreateBy() != null) {
sql.VALUES("create_by", "#{createBy,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String updateByPrimaryKeySelective(Detail record) {
SQL sql = new SQL();
sql.UPDATE("detail");
if (record.getWorkOrderId() != null) {
sql.SET("work_order_id = #{workOrderId,jdbcType=BIGINT}");
}
if (record.getWasteTypeId() != null) {
sql.SET("waste_type_id = #{wasteTypeId,jdbcType=BIGINT}");
}
if (record.getWasteId() != null) {
sql.SET("waste_id = #{wasteId,jdbcType=BIGINT}");
}
if (record.getComponent() != null) {
sql.SET("component = #{component,jdbcType=VARCHAR}");
}
if (record.getWeight() != null) {
sql.SET("weight = #{weight,jdbcType=REAL}");
}
if (record.getMorphological() != null) {
sql.SET("morphological = #{morphological,jdbcType=VARCHAR}");
}
if (record.getPackaging() != null) {
sql.SET("packaging = #{packaging,jdbcType=VARCHAR}");
}
if (record.getPlateNumber() != null) {
sql.SET("plate_number = #{plateNumber,jdbcType=VARCHAR}");
}
if (record.getCreateDate() != null) {
sql.SET("create_date = #{createDate,jdbcType=TIMESTAMP}");
}
if (record.getUpdateDate() != null) {
sql.SET("update_date = #{updateDate,jdbcType=TIMESTAMP}");
}
if (record.getDelFlag() != null) {
sql.SET("del_flag = #{delFlag,jdbcType=VARCHAR}");
}
if (record.getCreateBy() != null) {
sql.SET("create_by = #{createBy,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
} | [
"[email protected]"
] | |
62595c76da321b0c83968b28242e884ad75d7a7d | 596ac973156641919db80c86d9e08b34b3753861 | /app/src/main/java/vidal/sergi/getfit/LoginActivity.java | 819a61e453e451546b253dff5c9a26fd8143c306 | [] | no_license | JordiSegura/GetFitFinal | 45d4d729dbeca85c159333d3c6765cd4ea0cf182 | b66408d619997bbfe2739067df44e2392f4a7146 | refs/heads/master | 2020-03-20T21:25:55.877643 | 2018-06-18T10:50:40 | 2018-06-18T10:50:40 | 137,740,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,284 | java | package vidal.sergi.getfit;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
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.ValueEventListener;
import vidal.sergi.getfit.Objetos.FirebaseReferences;
import vidal.sergi.getfit.Objetos.Usuario;
/**
* Created by Sergi on 01/03/2018.
*/
public class LoginActivity extends AppCompatActivity {
EditText email, password;
TextView btnRegistrar, btnLogin;
String emailRegistro, passwordRegistro;
public String user;
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_login);
email = findViewById(R.id.email);
password = findViewById(R.id.password);
btnLogin = findViewById(R.id.login);
btnRegistrar = findViewById(R.id.registrar);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
emailRegistro = email.getText().toString();
passwordRegistro = password.getText().toString();
iniciarSesion(emailRegistro, passwordRegistro);
}
});
btnRegistrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(LoginActivity.this, RegistroActivity.class);
startActivity(intent);
}
});
}
private void iniciarSesion(final String email, String pass){
FirebaseAuth.getInstance().signInWithEmailAndPassword(email, pass).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()) {
Bundle extras2 = getIntent().getExtras();
if (extras2!=null) {
String username = extras2.getString("nombreUsuario");
Toast.makeText(LoginActivity.this, "Usuario logueado correctamente.", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
intent.putExtra("nombreUsuario", username);
startActivity(intent);}
else {
String username = emailRegistro.split("@")[0];
Toast.makeText(LoginActivity.this, "Usuario logueado correctamente.", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(LoginActivity.this, HomeActivity.class);
intent.putExtra("nombreUsuario", username);
Log.d("", "onCreate: LOGINUSU "+getUser());
startActivity(intent);
}
Log.d("svm", "Usuario creado correctamente");
}else {
Toast.makeText(LoginActivity.this, "Usuario/Password incorrectos.", Toast.LENGTH_SHORT).show();
Log.d("svm", task.getException().getMessage()+"");
}
}
});
}
}
| [
"[email protected]"
] | |
c083a3e0a6e15df60aa985e4492a50696b7b4cea | b1555df1a1231833f5d8fc7e1f9755bef99f48e5 | /AdminEmployeePortalWithSpringData/src/main/java/com/metacube/training/AdminEmployeePortalWithSpringData/model/Project.java | 38f629e7b8c0ff2898c7f65dcc6b546c7915ffc5 | [] | no_license | meta-bhavika-mathur/GET2018 | 2a2ea43f63317875277ea566fee7253b16997771 | 95a2b4b68c02afcf14cef66a29b326f1b67803ae | refs/heads/master | 2022-12-22T05:07:23.329371 | 2018-11-22T12:27:51 | 2018-11-22T12:27:51 | 140,807,795 | 0 | 0 | null | 2022-12-16T00:02:55 | 2018-07-13T06:41:17 | Java | UTF-8 | Java | false | false | 1,782 | java | package com.metacube.training.AdminEmployeePortalWithSpringData.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name="projectmaster")
public class Project
{
@Id
@Column(name="project_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(name="project_logo")
private String logo;
@Column(name="description")
private String description;
@Column(name="start_date")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Temporal(TemporalType.DATE)
private Date startDate;
@Column(name="end_date")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Temporal(TemporalType.DATE)
private Date endDate;
public int getId()
{
return id;
}
public void setId(int id)
{
this.id = id;
}
public String getLogo()
{
return logo;
}
public void setLogo(String logo)
{
this.logo = logo;
}
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
public Date getStartDate()
{
return startDate;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getEndDate()
{
return endDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
} | [
"[email protected]"
] | |
46934381c24f82d51bff7968c249e80cad3d5bb3 | 4fb802d21b0ae96af0e76ea5b1cd1ede4cd4a335 | /app/src/main/java/com/example/administrator/androidtest/MainActivity.java | 2bc83987db47e2546b10ffd47e2d77b3ce04488c | [] | no_license | cralyquan/test1 | 52a869636e01c68409872df5d3efa5f3771cea7e | f20917869a3b5875619e207728c428ea68f64152 | refs/heads/master | 2016-09-13T21:12:48.156991 | 2016-04-26T14:21:34 | 2016-04-26T14:21:34 | 57,040,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.example.administrator.androidtest;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
public int getmIndex() {
return mIndex;
}
public void setmIndex(int mIndex) {
this.mIndex = mIndex;
}
private int mIndex;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
add();
}
private void add() {
}
}
| [
"[email protected]"
] | |
50cbcc1559626e4fa263842aae8b85d7cd11a383 | 1834686621f8809389413e3745cb4b2f053e65fc | /ResourceGuide/src/com/myle/resource/CircleView.java | 09e5357d5ef68ebf0bd7cdbee8fdac4cf5a6fecd | [] | no_license | shendawei/DemoProject | 8022759d7b6f0d69a941f69ddb9a0b9a4420d7fc | 8fb6f1abe68901bb7b5fe89536fe3db5209b576c | refs/heads/master | 2021-05-26T14:30:08.908131 | 2013-03-19T03:25:07 | 2013-03-19T03:25:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,878 | java | package com.myle.resource;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class CircleView extends View
{
public enum drawType
{
SAVED,
UNSAVED
}
Paint mViewPaint;
Paint mTextPaint;
Path mPath;
// enum 类型就是它的定义。
drawType m_type = drawType.SAVED;
public CircleView(Context context)
{
this(context, null);
}
public CircleView(Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}
public CircleView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init(context);
}
public void setSaved(drawType save)
{
this.m_type = save;
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawColor(Color.BLUE);
// draw circle
/*绘制三个circle*/
// canvas.drawCircle(20, 100, 10, mViewPaint);
// canvas.drawCircle(50, 100, 10, mViewPaint);
// canvas.drawCircle(80, 100, 10, mViewPaint);
// draw drawable
Drawable drawable = createDrawable();
// canvas.save();
// for (int i = 0; i < 5; i++)
// {
// canvas.translate(40, 30);
// drawable.draw(canvas);
// }
// canvas.restore();
// drawable.draw(canvas);
// Save & Restore
int px = getMeasuredWidth();
int py = getMeasuredHeight();
// draw background
canvas.drawRect(10, 10, px-10, py-10, mViewPaint);
// draw right arrow
/*canvas.drawLine(4*px/5, 20, px-20, py/2, mTextPaint);
canvas.drawLine(0+20, py/2, px-20, py/2, mTextPaint);
canvas.drawLine(4*px/5, py-20, px-20, py/2, mTextPaint);*/
// draw up arrow
switch (m_type)
{
case SAVED:
canvas.save();
canvas.rotate(90, px/2, py/2);
canvas.drawLine(1*px/3, py/2, px/2, 0+20, mTextPaint);
canvas.drawLine(px/2, py-20, px/2, 0+20, mTextPaint);
canvas.drawLine(2*px/3, py/2, px/2, 0+20, mTextPaint);
canvas.restore();
canvas.drawCircle(2*px/3, py-20, 10, mTextPaint);
mTextPaint.setTextSize(20);
canvas.drawText("Saved", px-100, py-20, mTextPaint);
break;
case UNSAVED:
canvas.rotate(90, px/2, py/2);
canvas.drawLine(1*px/3, py/2, px/2, 0+20, mTextPaint);
canvas.drawLine(px/2, py-20, px/2, 0+20, mTextPaint);
canvas.drawLine(2*px/3, py/2, px/2, 0+20, mTextPaint);
canvas.drawCircle(2*px/3, py-20, 10, mTextPaint);
mTextPaint.setTextSize(20);
canvas.drawText("UnSaved", px/2, py-50, mTextPaint);
break;
}
}
private Drawable createDrawable()
{
OvalShape oval = new OvalShape();
oval.resize(25, 25);
ShapeDrawable shape = new ShapeDrawable(oval);
Paint paint = shape.getPaint();
paint.setColor(Color.WHITE);
return shape;
}
private void init(Context context)
{
mViewPaint = new Paint();
mTextPaint = new Paint();
mViewPaint.setColor(Color.GREEN);
mTextPaint.setColor(Color.RED);
}
}
| [
"[email protected]"
] | |
26605e3fa67c40d55de573d8cc7981f0bb965e8f | 4894db60c4d4fd7dc9abb17685de49e41883cc2c | /src/main/java/com/example/friojspring/Security/JwtUser.java | 19d0eb10a9050dd2b4e6880f3808e4cfd2c5e775 | [] | no_license | Matheuss012345/FRIOJBackend | 716ae52f5e9952a7f219bd8b5114373032eec369 | 2139cf3edba45bd9d494740e559fd8f07c7f4519 | refs/heads/master | 2020-04-15T12:31:12.123016 | 2019-03-23T14:02:17 | 2019-03-23T14:02:17 | 164,677,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,479 | java | package com.example.friojspring.Security;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.example.friojspring.Model.User;
import com.fasterxml.jackson.annotation.JsonIgnore;
public class JwtUser implements UserDetails{
private final Long id;
private final String username;
private final String password;
private final User user;
public JwtUser(Long id, String username, String password, User user,
Collection<? extends GrantedAuthority> authorities, boolean enabled) {
super();
this.id = id;
this.username = username;
this.password = password;
this.user = user;
this.authorities = authorities;
this.enabled = true;
}
private final Collection<? extends GrantedAuthority> authorities;
private final boolean enabled;
@JsonIgnore
public Long getId() {
return id;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public User getUser() {
return user;
}
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}
public boolean isEnabled() {
return enabled;
}
@JsonIgnore
@Override
public boolean isAccountNonExpired() {
return true;
}
@JsonIgnore
@Override
public boolean isAccountNonLocked() {
return true;
}
@JsonIgnore
@Override
public boolean isCredentialsNonExpired() {
return true;
}
}
| [
"[email protected]"
] | |
769710d83b931ddc996fa8bd1b5ce2f769675d06 | 377f25764316e12a27fcd366183f751f33f20a4f | /src/main/java/org/hyperagents/yggdrasil/http/HttpInterfaceConfig.java | 470cd424d18102b04373ce6acef20ed3f2ecc0fc | [
"MIT"
] | permissive | samubura/yggdrasil | 30e949dcc526f7e50ae615cc93c7efceb0a91e1b | 52653ca0ff8885b2eb82eeac181c6b62292ded64 | refs/heads/master | 2023-08-31T08:05:51.014086 | 2021-09-23T08:54:19 | 2021-09-23T08:54:19 | 408,382,116 | 0 | 0 | MIT | 2021-09-20T10:16:21 | 2021-09-20T09:26:38 | null | UTF-8 | Java | false | false | 798 | java | package org.hyperagents.yggdrasil.http;
import io.vertx.core.json.JsonObject;
import java.util.Optional;
public class HttpInterfaceConfig {
private String host = "0.0.0.0";
private int port = 8080;
private String webSubHubIRI;
public HttpInterfaceConfig(JsonObject config) {
JsonObject httpConfig = config.getJsonObject("http-config");
if (httpConfig != null) {
host = httpConfig.getString("host", "0.0.0.0");
port = httpConfig.getInteger("port", 8080);
webSubHubIRI = httpConfig.getString("websub-hub");
}
}
public String getHost() {
return this.host;
}
public int getPort() {
return this.port;
}
public Optional<String> getWebSubHubIRI() {
return (webSubHubIRI == null) ? Optional.empty() : Optional.of(webSubHubIRI);
}
}
| [
"[email protected]"
] | |
4cde038c48dc307937960e7f1ed3985bf4663ddf | 6cf72b4c7a2d6bab79b96979e52687d73f7bb557 | /app/src/main/java/com/conflux/finflux/offline/databaseoperation/DownloadOperations.java | d792c17d7169c760b86d691611f091621ae1cd8a | [] | no_license | maduhu/ulidavaruKandante | 87a183da2d7854d5716d4cbf378377e67779663e | 142c408c5f205cf96e672144c219e5d45815ea47 | refs/heads/master | 2021-01-12T12:13:18.620616 | 2016-09-14T10:29:33 | 2016-09-14T10:29:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,876 | java | package com.conflux.finflux.offline.databaseoperation;
import android.content.Context;
import com.conflux.finflux.R;
import com.conflux.finflux.collectionSheet.data.CollectionSheetData;
import com.conflux.finflux.collectionSheet.data.ExtendedProductionCollectiondata;
import com.conflux.finflux.collectionSheet.data.ProductiveCollectionData;
import com.conflux.finflux.db.collectionsheet.TableCollectionDataJson;
import com.conflux.finflux.db.collectionsheet.TableCollectionMeetingCalendar;
import com.conflux.finflux.db.collectionsheet.TableInteger;
import com.conflux.finflux.db.collectionsheet.TableMeetingFallCenter;
import com.conflux.finflux.db.collectionsheet.TableProductiveCollectionData;
import com.conflux.finflux.db.collectionsheet.TableStatus;
import com.conflux.finflux.offline.data.CenterListHelper;
import com.conflux.finflux.offline.data.TypesEnum;
import com.conflux.finflux.util.RealmAutoIncrement;
import com.google.gson.Gson;
import java.util.ArrayList;
import io.realm.Realm;
import io.realm.RealmList;
/**
* Created by Praveen J U on 7/27/2016.
*/
public class DownloadOperations {
private CollectionSheetData collectionSheetData;
private Context context;
private CenterListHelper centerListHelper;
private ArrayList<ExtendedProductionCollectiondata> extendedProductionCollectiondata;
private Realm realm;
public DownloadOperations(Context context, CollectionSheetData collectionSheetData, CenterListHelper centerListHelper, ArrayList<ExtendedProductionCollectiondata> extendedProductionCollectiondata, Realm realm) {
this.context = context;
this.collectionSheetData = collectionSheetData;
this.centerListHelper = centerListHelper;
this.extendedProductionCollectiondata = extendedProductionCollectiondata;
this.realm = realm;
}
public void save() {
final String Date = centerListHelper.getDate();
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
try {
TableProductiveCollectionData data;
data = checkifMeetingdateExit(realm);
if (data == null) {
data = realm.createObject(TableProductiveCollectionData.class);
data.setId(RealmAutoIncrement.getInstance(realm).getNextId(TableProductiveCollectionData.class));
data.setMeetingDate(centerListHelper.getDate());
data.setStaffId(centerListHelper.getMeetingFallCenter().getStaffId());
data.setStaffName(centerListHelper.getMeetingFallCenter().getStaffName());
}
TableMeetingFallCenter tableMeetingFallCenter = realm.createObject(TableMeetingFallCenter.class);
tableMeetingFallCenter.setFkProductiveCollectionSheetDataId(data.getId());
tableMeetingFallCenter.setId(centerListHelper.getMeetingFallCenter().getId());
tableMeetingFallCenter.setName(centerListHelper.getMeetingFallCenter().getName());
tableMeetingFallCenter.setAccountNo(centerListHelper.getMeetingFallCenter().getAccountNo());
tableMeetingFallCenter.setOfficeId(centerListHelper.getMeetingFallCenter().getOfficeId());
tableMeetingFallCenter.setStaffId(centerListHelper.getMeetingFallCenter().getStaffId());
tableMeetingFallCenter.setStaffName(centerListHelper.getMeetingFallCenter().getStaffName());
tableMeetingFallCenter.setHierarchy(centerListHelper.getMeetingFallCenter().getHierarchy());
tableMeetingFallCenter.setActive(centerListHelper.getMeetingFallCenter().getActive());
tableMeetingFallCenter.setTotaldue(centerListHelper.getMeetingFallCenter().getTotaldue());
tableMeetingFallCenter.setTotalOverdue(centerListHelper.getMeetingFallCenter().getTotalOverdue());
tableMeetingFallCenter.setTotalCollected(centerListHelper.getMeetingFallCenter().getTotalCollected());
TableStatus status = realm.createObject(TableStatus.class);
status.setFkCenterId(tableMeetingFallCenter.getId());
status.setId(centerListHelper.getMeetingFallCenter().getStatus().getId());
status.setCode(centerListHelper.getMeetingFallCenter().getStatus().getCode());
status.setValue(centerListHelper.getMeetingFallCenter().getStatus().getValue());
status.setType(new TypesEnum(TypesEnum.Entity.Status).entityDetails());
tableMeetingFallCenter.setStatus(status);
String activationDate = null;
for (Integer date : centerListHelper.getMeetingFallCenter().getActivationDate()) {
if (activationDate == null) {
activationDate = String.valueOf(date);
} else {
activationDate = activationDate + "/" + String.valueOf(date);
}
}
tableMeetingFallCenter.setActivationDate(activationDate);
TableCollectionMeetingCalendar collectionMeetingCalendar = realm.createObject(TableCollectionMeetingCalendar.class);
collectionMeetingCalendar.setId(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getId());
collectionMeetingCalendar.setCalendarInstanceId(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getCalendarInstanceId());
collectionMeetingCalendar.setEntityId(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getEntityId());
TableStatus entityType = realm.createObject(TableStatus.class);
entityType.setFkCenterId(tableMeetingFallCenter.getId());
entityType.setId(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getEntityType().getId());
entityType.setCode(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getEntityType().getCode());
entityType.setValue(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getEntityType().getValue());
entityType.setType(new TypesEnum(TypesEnum.Entity.Center).entityDetails());
collectionMeetingCalendar.setEntityType(entityType);
collectionMeetingCalendar.setTitle(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getTitle());
if (centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getLocation() != null)
collectionMeetingCalendar.setLocation(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getLocation());
collectionMeetingCalendar.setRepeating(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().isRepeating());
collectionMeetingCalendar.setRecurrence(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getRecurrence());
String startDate = null;
for (Integer date : centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getStartDate()) {
if (startDate == null) {
startDate = String.valueOf(date);
} else {
startDate = startDate + "/" + String.valueOf(date);
}
}
collectionMeetingCalendar.setStartDate(startDate);
if (centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getMeetingTime().getiLocalMillis() != null)
collectionMeetingCalendar.setiLocalMillis(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getMeetingTime().getiLocalMillis());
if (centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getMeetingTime().getiChronology() != null) {
if (centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getMeetingTime().getiChronology().getiBase() != null) {
collectionMeetingCalendar.setiMinDaysInFirstWeek(centerListHelper.getMeetingFallCenter().getCollectionMeetingCalendar().getMeetingTime().getiChronology().getiBase().getiMinDaysInFirstWeek());
}
}
tableMeetingFallCenter.setCollectionMeetingCalendar(collectionMeetingCalendar);
TableCollectionDataJson collectionDataJson = realm.createObject(TableCollectionDataJson.class);
Gson gson = new Gson();
String dataAsJson = gson.toJson(collectionSheetData).toString();
collectionDataJson.setFkCenterId(tableMeetingFallCenter.getId());
collectionDataJson.setCollectionDataJson(dataAsJson);
centerListHelper.setCanDownload(false);
centerListHelper.setReason(context.getString(R.string.center_download_status_downloaded_successfully));
}catch (Exception e){
centerListHelper.setReason(context.getString(R.string.center_download_status_downloaded_successfully));
}
}
private TableProductiveCollectionData checkifMeetingdateExit(Realm realm) {
TableProductiveCollectionData data = realm.where(TableProductiveCollectionData.class).contains("meetingDate", Date).findFirst();
return data;
}
});
}
}
| [
"[email protected]"
] | |
1cd12f6d191a3d22b5c76cf8c17fa63adea73e6d | 3488c13a5a7b0099237a9f2c733a1f485abd4a83 | /src/naturalnumbers/WeightedSet.java | adbdb68227a8719867c481f58d2cb7e5ae55fc5d | [] | no_license | kmsoileau/Saffron | 6a087143356b290c4b27149f360c15ed445f1e48 | 557c6ddae2ac572e7254eeac61d4dea90ab940ec | refs/heads/master | 2021-06-09T14:09:49.578488 | 2020-12-12T12:25:13 | 2020-12-12T12:25:13 | 80,858,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | package naturalnumbers;
import sets.Set;
import bits.BooleanVariable;
import exceptions.sets.WeightedSetException;
public class WeightedSet
{
private static int objectIndex = 0;
private Set backingSet;
private String name;
public WeightedSet() throws Exception
{
this("WeightedSet" + objectIndex++, new Integer[0]);
}
public WeightedSet(Integer[] data) throws Exception
{
this("WS" + objectIndex++, data);
}
public WeightedSet(String name) throws Exception
{
this(name, new Integer[0]);
}
public WeightedSet(String name, Integer[] data) throws Exception
{
this.name = name;
this.backingSet = new Set();
for (int i = 0; i < data.length; i++)
{
WeightedObject curr = new WeightedObject(name + "_" + i);
curr.setWeightValue(data[i]);
this.addSupport(curr);
}
}
public void addSupport(Object key) throws Exception
{
if (key instanceof WeightedObject)
backingSet.add(key, BooleanVariable.getBooleanVariable());
else
throw new WeightedSetException(
"Attempted to add an Object not of WeightedObject type.");
}
public Set getBackingSet()
{
return backingSet;
}
public String getName()
{
return name;
}
public java.util.Set<Object> getSupport()
{
return this.backingSet.getSupport();
}
public void setBackingSet(Set backingSet)
{
this.backingSet = backingSet;
}
public void setName(String name)
{
this.name = name;
}
public String toString()
{
return backingSet.toString();
}
}
| [
"[email protected]"
] | |
fa5436b355132ec837ff68db3d1306e96b5cb353 | 36cc038eb139d1c8b7ed2385db836524a69620d1 | /src/test/java/com/panda/study/design/patterns/creational/singleton/DemoSingletonTest.java | 2365dbfd39c71a6d08f0bdd6e4f99e88d89677ff | [] | no_license | zhangwei921003/design-patterns | 03a13348aef1cad4b637bd6b7142723ab7b3a803 | 14214050796867717c627aeb8cc3e535284a0b84 | refs/heads/master | 2020-08-23T11:47:40.948539 | 2019-10-22T07:46:18 | 2019-10-22T07:46:18 | 216,608,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | package com.panda.study.design.patterns.creational.singleton;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class DemoSingletonTest {
@Test
public void 修改单例() throws Exception {
DemoSingleton instance = DemoSingleton.getInstance();
// Serialize to a file
ObjectOutput out = new ObjectOutputStream(new FileOutputStream(
"filename.ser"));
out.writeObject(instance);
out.close();
instance.setValue(20);
// Serialize to a file
ObjectInput in = new ObjectInputStream(new FileInputStream(
"filename.ser"));
DemoSingleton instanceTwo = (DemoSingleton) in.readObject();
in.close();
System.out.println(instance.getValue());
System.out.println(instanceTwo.getValue());
}
}
| [
"[email protected]"
] | |
6b6eea5f4a06d301668cd3d1294e4c48716ba358 | a17d4d64fd1e7e5a726cf6a52a7a6386f48a7c79 | /src/test/java/org/edu/algo/AppTest.java | 66fab2bc58f0fdad8ae44c6a435f75801decaab0 | [] | no_license | jsebasct/problem_algorithm | d7f4bf7f9510190b708e9d6bf4785640dbee84f9 | af153a9648f3afc9750004b90ba4617e971522c2 | refs/heads/master | 2021-04-11T08:51:29.124564 | 2020-03-21T17:47:02 | 2020-03-21T17:47:02 | 249,006,543 | 0 | 0 | null | 2020-10-13T20:32:23 | 2020-03-21T15:39:34 | Java | UTF-8 | Java | false | false | 1,356 | java | package org.edu.algo;
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()
{
UnionFind unionFind = new UnionFind(10);
unionFind.union(4, 3);
// unionFind.showComponent();
unionFind.union(3, 8);
// unionFind.showComponent();
unionFind.union(6, 5);
// unionFind.showComponent();
unionFind.union(9, 4);
// unionFind.showComponent();
unionFind.union(2, 1);
// unionFind.showComponent();
assertFalse(unionFind.connected(0, 7));
assertTrue( unionFind.connected(8, 9) );
// assertFalse(unionFind.connected(5, 0));
unionFind.union(5, 0);
// unionFind.showComponent();
unionFind.union(7, 2);
unionFind.showComponent();
unionFind.union(6, 1);
unionFind.showComponent();
}
}
| [
"[email protected]"
] | |
b89d2779acc1fbc8b70cd9c2c6aa34700d4305d8 | 1c010920c8f1df5e4f84768bbcfe6598ec9ff71c | /app/src/main/java/io/mrarm/mcversion/VersionDownloader.java | f2b61c0a81731f5ae02c8ee1d3053ee284e4a01d | [] | no_license | MCMrARM/mc-android-version-switcher | 4a36f61d6abb8baca1a3c782a43724b3e236a0fb | 71ef27304830bd051e78aae454d79dc570178cf1 | refs/heads/master | 2022-05-28T04:14:29.169994 | 2020-05-02T17:57:24 | 2020-05-02T17:57:24 | 260,744,247 | 30 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,198 | java | package io.mrarm.mcversion;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
public class VersionDownloader {
private File storageDir;
public VersionDownloader(File storageDir) {
this.storageDir = storageDir;
}
public File getVersionDir(UiVersion version) {
return new File(storageDir, String.valueOf(version.getVersionCode()));
}
public void updateDownloadedStatus(UiVersion version) {
version.isDownloaded().set(getVersionDir(version).exists());
}
public void download(Context context, UiVersion version) {
if (!PlayHelper.getInstance(context).isAuthedToApi()) {
Toast.makeText(context, R.string.error_api_not_authenticated, Toast.LENGTH_LONG).show();
return;
}
if (version.isDownloading().get())
return;
version.getDownloadComplete().set(0);
version.getDownloadTotal().set(0);
version.isDownloading().set(true);
PlayHelper.getInstance(context).getApi().requestDelivery("com.mojang.minecraftpe", version.getVersionCode(), new PlayApi.DeliveryCallback() {
@Override
public void onSuccess(PlayApi.DownloadInfo[] download) {
for (PlayApi.DownloadInfo i : download)
Log.d("VersionDownloader", "Download: " + i.getName() + " " + i.getGzippedUrl());
UiThreadHelper.runOnUiThread(() -> {
DownloadTracker tracker = new DownloadTracker(context, version, download, getVersionDir(version));
tracker.downloadNextFile();
});
}
@Override
public void onError(String str) {
UiThreadHelper.runOnUiThread(() -> {
Toast.makeText(context, str, Toast.LENGTH_LONG).show();
version.isDownloading().set(false);
});
}
});
}
public void delete(UiVersion version) {
IOUtil.deleteDirectory(getVersionDir(version));
version.isDownloaded().set(false);
}
private static class DownloadTracker {
private final Context context;
private final UiVersion version;
private final PlayApi.DownloadInfo[] downloads;
private final File downloadDir;
private long totalSize, totalDownloaded;
private int nextFileIndex = 0;
public DownloadTracker(Context context, UiVersion version, PlayApi.DownloadInfo[] downloads, File downloadDir) {
this.context = context;
this.version = version;
this.downloads = downloads;
this.downloadDir = downloadDir;
for (PlayApi.DownloadInfo i : downloads)
totalSize += i.getSize();
version.getDownloadTotal().set(totalSize);
}
public void downloadNextFile() {
if (nextFileIndex == downloads.length) {
version.isDownloading().set(false);
version.isDownloaded().set(true);
return;
}
downloadDir.mkdirs();
PlayApi.DownloadInfo dlInfo = downloads[nextFileIndex++];
FileDownloader downloader = new FileDownloader();
downloader.setProgressCallback((c, t) -> UiThreadHelper.runOnUiThread(() -> {
version.getDownloadComplete().set(totalDownloaded + c);
}));
downloader.setCompletionCallback(() -> UiThreadHelper.runOnUiThread(() -> {
totalDownloaded += dlInfo.getSize();
version.getDownloadComplete().set(totalDownloaded);
downloadNextFile();
}));
downloader.setErrorCallback(e -> UiThreadHelper.runOnUiThread(() -> {
Toast.makeText(context, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
e.printStackTrace();
version.isDownloading().set(false);
}));
AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> downloader.execute(dlInfo.getUrl(), new File(downloadDir, dlInfo.getName() + ".apk")));
}
}
}
| [
"[email protected]"
] | |
96e438c143ae770de8db4dd192ec1348d4583f8c | 13ed6336a68e62a139a4d4ffe0df736f93d6a3b9 | /src/main/java/typed/impl/section/AbstractSectionTree.java | 279560cd90a908c9fc53703d3931c34f14aa5c9d | [] | no_license | Topolev/search-simple-parser | fc1c6d684ab419e7c6bca78c7462158385d029c5 | f01e1f75ae6de88f76a99a317f2124de887ae628 | refs/heads/master | 2021-01-25T11:02:19.689934 | 2017-06-28T08:48:26 | 2017-06-28T08:50:03 | 93,903,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,219 | java | package typed.impl.section;
import typed.api.PropertyTree;
import typed.api.literal.ObjectLiteralTree;
import typed.api.literal.StringLiteralTree;
import typed.api.literal.ValueTree;
import typed.impl.PropertyTreeImpl;
import typed.impl.lexical.InternalSyntaxToken;
import java.util.List;
public class AbstractSectionTree extends PropertyTreeImpl {
public AbstractSectionTree(InternalSyntaxToken keyToken, List<StringLiteralTree> nestedObjects, InternalSyntaxToken colonToken, ValueTree value) {
super(keyToken, nestedObjects, colonToken, value);
}
protected List<PropertyTree> getMetaParameters() {
return ((ObjectLiteralTree) value()).properties();
}
protected PropertyTree getMetaParameter(String key) {
return ((ObjectLiteralTree) value()).getProperty(key);
}
protected ValueTree getValueFromMetaParameter(String key) {
PropertyTree property = getMetaParameter(key);
return property != null ? property.value() : null;
}
protected String getStringFromMetaParameter(String key) {
PropertyTree property = getMetaParameter(key);
return property != null ? ((StringLiteralTree) property.value()).value() : null;
}
}
| [
"[email protected]"
] | |
2e06961597fab6ded3ec5840ca2788bdf5c528d3 | de1c01a80062ed7b38878cec852825abddd06463 | /src/com/mugalliRufaida/BonAppétit.java | b2c017038f8e3ccc674b7f27cedf58d45b7be351 | [] | no_license | Rufaidamugalli/HackerRank | df6a35db2cd57d92f5cc73952df1d1233c31fb50 | 934560449aecfd8133f32135b06c6a040615dd10 | refs/heads/master | 2020-04-29T20:08:38.669779 | 2020-01-02T08:40:43 | 2020-01-02T08:40:43 | 176,376,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.mugalliRufaida;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BonAppétit {
static void bonAppetit(List<Integer> bill, int k, int b) {
bill.remove(k);
int sum = 0;
int result = 0;
int diff = 0;
for (int bill2 : bill) {
sum += bill2;
}
result = sum / 2;
diff = b - result;
if (diff != 0) {
System.out.println(diff);
} else {
System.out.println("Bon Appetit");
}
}
public static void main(String[] args) {
List<Integer> bill = new ArrayList<>();
bill.add(3);
bill.add(10);
bill.add(2);
bill.add(9);
bonAppetit(bill, 1, 7);
}
}
| [
"[email protected]"
] | |
d11813dfb59264bea0cfb4c181b60890a7f4c2ce | 3414cb4c58483ab92e0b7b756a1e3732599e93f8 | /GCICodeTest/src/main/java/com/gci/api/controller/ContractController.java | aef76c2f1bfd1ea0ef8ca3bd8616e3f3808a5511 | [] | no_license | bsterner/gci | 6a5b22863ff9bdb67453bac04a0e7a519c63c700 | efbfb0c48e1b4182679d0904bc7d03770b5c8619 | refs/heads/master | 2020-12-31T00:29:22.944491 | 2016-05-01T22:52:50 | 2016-05-01T22:52:50 | 57,854,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,485 | java | package com.gci.api.controller;
import static com.gci.api.Constants.GET_CONTRACTS_URI;
import static com.gci.api.Constants.GET_CONTRACT_URI;
import static com.gci.api.Constants.GET_INVOICES_URI;
import static com.gci.api.Constants.GET_INVOICE_URI;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
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 com.gci.api.model.contract.Contract;
import com.gci.api.model.contract.ContractType;
import com.gci.api.model.invoice.Invoice;
import com.gci.api.service.ContractService;
/**
* Handles RESTful service requests for Contracts API. Uses {@link}
* ContractsService to perform business operations.
*/
@Controller
public class ContractController {
private static final Logger logger = LoggerFactory.getLogger(ContractController.class);
@Autowired
private ContractService contractService;
@RequestMapping(value = GET_CONTRACT_URI, method = RequestMethod.GET)
public @ResponseBody Contract getContract(@RequestParam(required = true) final int clientId,
@RequestParam(required = true) final ContractType type) {
logger.info("Retrieving contract type [{}] for client ID [{}]", type, clientId);
Contract contract = contractService.getContract(clientId, type);
return contract;
}
@RequestMapping(value = GET_CONTRACTS_URI, method = RequestMethod.GET)
public @ResponseBody List<Contract> getAllContracts(@RequestParam(required = true) final int clientId) {
logger.info("Retrieving contracts for client ID [{}]", clientId);
return contractService.getAllContracts(clientId);
}
@RequestMapping(value = GET_INVOICE_URI, method = RequestMethod.GET)
public @ResponseBody Invoice getInvoice(@RequestParam(required = true) final int invoiceId) {
logger.info("Retrieving invoice with ID [{}]", invoiceId);
return contractService.getInvoice(invoiceId);
}
@RequestMapping(value = GET_INVOICES_URI, method = RequestMethod.GET)
public @ResponseBody List<Invoice> getAllInvoices(@RequestParam(required = true) final int contractId) {
logger.info("Retrieving all invoices for contract ID [{}]", contractId);
return contractService.getAllInvoices(contractId);
}
}
| [
"[email protected]"
] | |
8aaaf2649e3b59e5a94766fcb78556fa49ef332d | 080d88cbd6e4fad5d741ec9776af9eef4caba6b1 | /src/main/java/com/istt/security/jwt/JWTFilter.java | 45b246593d12d873ee366b952aac328f667a6e3c | [] | no_license | istt/smpp-simulator | b0e27fe2250a3d6a79011d1262412b7789284dec | 3f53fc197d14e0ed7fe52782a27389908baf31c6 | refs/heads/master | 2020-03-27T00:56:53.972160 | 2018-10-08T08:27:02 | 2018-10-08T08:27:02 | 145,669,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package com.istt.security.jwt;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.util.StringUtils;
import org.springframework.web.filter.GenericFilterBean;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is
* found.
*/
public class JWTFilter extends GenericFilterBean {
private TokenProvider tokenProvider;
public JWTFilter(TokenProvider tokenProvider) {
this.tokenProvider = tokenProvider;
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
String jwt = resolveToken(httpServletRequest);
if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) {
Authentication authentication = this.tokenProvider.getAuthentication(jwt);
SecurityContextHolder.getContext().setAuthentication(authentication);
}
filterChain.doFilter(servletRequest, servletResponse);
}
private String resolveToken(HttpServletRequest request){
String bearerToken = request.getHeader(JWTConfigurer.AUTHORIZATION_HEADER);
if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) {
return bearerToken.substring(7, bearerToken.length());
}
String jwt = request.getParameter(JWTConfigurer.AUTHORIZATION_TOKEN);
if (StringUtils.hasText(jwt)) {
return jwt;
}
return null;
}
}
| [
"[email protected]"
] | |
d956e014ee9666b132983f0243afa5cfee2dc1d1 | 04286a4dd3ebecf8f692945bdb8917af5613ffd3 | /lab10/lab10/src/main/java/com/agh/lab10/Controller/NotFoundException.java | 5cacd07fea9e79cd3aab161c92744d8672cd0f8a | [] | no_license | karolmorawski-AGH/AGH_java | 55a345d6885bb6ae4afdb848f94e88a74bd62642 | cc82c6109e5a41bfedb34c57f009112223a1a6d6 | refs/heads/master | 2022-01-19T07:05:18.885256 | 2019-05-30T11:52:21 | 2019-05-30T11:52:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package com.agh.lab10.Controller;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(code = HttpStatus.NOT_FOUND, reason = "Image not found")
public class NotFoundException {
}
| [
"[email protected]"
] | |
ca9b86b74773ee2b5e9c8e609b2e0ce08670d55c | fb80d88d8cdc81d0f4975af5b1bfb39d194e0d97 | /Character_Library/src/net/sf/anathema/character/library/overview/LabelledAdditionalAlotmentView.java | 9dfba9b8cbb63dcc3d4aebff6ca3b6838c1950bc | [] | no_license | mindnsoul2003/Raksha | b2f61d96b59a14e9dfb4ae279fc483b624713b2e | 2533cdbb448ee25ff355f826bc1f97cabedfdafe | refs/heads/master | 2021-01-17T16:43:35.551343 | 2014-02-19T19:28:43 | 2014-02-19T19:28:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package net.sf.anathema.character.library.overview;
import net.sf.anathema.lib.workflow.labelledvalue.view.LabelledAlotmentView;
public class LabelledAdditionalAlotmentView extends LabelledAlotmentView implements IAdditionalAlotmentView {
public LabelledAdditionalAlotmentView(String labelText, int maxValueLength) {
super(labelText, 0, 0, maxValueLength);
}
@Override
public void setAlotment(int alotment, int additionalAlotment) {
maxPointLabel.setText(String.valueOf(alotment) + "+" + String.valueOf(additionalAlotment)); //$NON-NLS-1$
}
@Override
public void setValue(int value, int additionalValue) {
valueLabel.setText(String.valueOf(value) + "+" + String.valueOf(additionalValue)); //$NON-NLS-1$
}
} | [
"[email protected]"
] | |
23a3bbb65509584e5bf0c2be798574869203aece | 108e98956997060e8fbeff7c16a592756b8f5a06 | /src/main/java/com/my/controller/sys/project/historicType/model/HistoricTypeModel.java | 93b1d4da80e19fc82fdc44d88f0290b62721aff3 | [] | no_license | lizhongxiang12138/fastDevelop | 78b932a6d0871910d58777bb0eb28495dbec87e1 | 5ff7a32181f6d8a054637fac868f3b52de34f4eb | refs/heads/master | 2021-04-29T08:59:41.138674 | 2017-11-04T01:24:24 | 2017-11-04T01:24:24 | 77,668,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.my.controller.sys.project.historicType.model;
public class HistoricTypeModel {
/**
* 角色
*/
private com.my.project.entity.HistoricType historicType;
public com.my.project.entity.HistoricType getHistoricType() {
return historicType;
}
public void setHistoricType(com.my.project.entity.HistoricType historicType) {
this.historicType = historicType;
}
}
| [
"[email protected]"
] | |
cacde75da1aedffd5c5e810b70c91877af5f8915 | fb21f30736556002fe7cc7a06bac732f2b9e0e0f | /src/ite2017/SmartComputerPlayer.java | 2d3c39247c321d299db8a36c41bbcb1ce9aab3d3 | [] | no_license | mohamadkarttomeh/Battle-Ship-Game | ec82622e10441119cf699072a3ececaa184756a3 | f9146503013944f2ea0d6ce9c74bc9ccbfd31a8d | refs/heads/master | 2020-03-23T17:56:02.897518 | 2018-07-22T09:18:29 | 2018-07-22T09:18:29 | 141,881,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package ite2017;
public class SmartComputerPlayer extends ComputerPlayer {
public SmartComputerPlayer() {
super();
this.currentStrategy = new SmartComputerStrategy();
}
}
| [
"[email protected]"
] | |
afa68b3d89c0001040655ffe638432f3f7978580 | cf5978cfd1cf9d36fc14cdfe927314ac509214e1 | /src/main/java/com/hellozjf/test/u8eai/domain/jaxb/invposcontrapose/NewDataSet.java | 69e619fa789a18c529fcc8a41084fd9747a35c43 | [] | no_license | hellozjf/u8eai | 6c39502e96938ff4ddcea1863bc4e1cbcb081d57 | e38134795dfc704afb930ce9c1f6a2e07ae60fb8 | refs/heads/master | 2022-02-28T23:34:53.939698 | 2022-02-16T02:59:38 | 2022-02-16T02:59:38 | 105,213,525 | 11 | 6 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | //
// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的
// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// 在重新编译源模式时, 对此文件的所有修改都将丢失。
// 生成时间: 2017.09.30 时间 06:27:05 PM CST
//
package com.hellozjf.test.u8eai.domain.jaxb.invposcontrapose;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice maxOccurs="unbounded" minOccurs="0">
* <element ref="{}ufinterface"/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"ufinterface"
})
@XmlRootElement(name = "NewDataSet")
public class NewDataSet {
protected List<Ufinterface> ufinterface;
/**
* Gets the value of the ufinterface property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the ufinterface property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getUfinterface().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Ufinterface }
*
*
*/
public List<Ufinterface> getUfinterface() {
if (ufinterface == null) {
ufinterface = new ArrayList<Ufinterface>();
}
return this.ufinterface;
}
}
| [
"[email protected]"
] | |
6f35e52f51a0a0f721a8af607ab834fc018a11c2 | 0e59aac0a2a396b83be349df7c6488da5e409e43 | /paw2018b/models/src/main/java/ar/edu/itba/paw/models/UploadFile.java | 969a595c57da574eaadd45488434752ef01118c9 | [] | no_license | asantoflaminio/MeinHaus_PAW | 511327c00ed82fafb8e99ae71b4a8936f7248f2f | c7bbc477e76541fd0e9034121904f8719ff215c1 | refs/heads/master | 2020-03-27T02:11:54.445432 | 2018-10-03T22:50:18 | 2018-10-03T22:50:18 | 145,772,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package ar.edu.itba.paw.models;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "images")
public class UploadFile {
private Integer id;
private String publicationId;
private byte[] data;
public UploadFile() {
}
public UploadFile(Integer id, String pid, byte[] data) {
this.id = id;
this.publicationId = pid;
this.data = data;
}
@Id
//@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "upload_id")
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Column(name = "publicationid")
public String getPublicationId() {
return publicationId;
}
public void setPublicationId(String pub) {
this.publicationId = pub;
}
@Column(name = "file_data")
public byte[] getData() {
return data;
}
public void setData(byte[] data) {
this.data = data;
}
} | [
"[email protected]"
] | |
4f314143cd93c6e25951492bb9b27ce2952d8494 | e8995cea99b4890694463d76a77e2c8074a52377 | /pegasus/src/main/java/jp/co/internous/pegasus/model/form/DestinationForm.java | 050495c4d9c9bfcdfa2917fb5fa9a388205279d7 | [] | no_license | uedaiori/ecsite | da014c88ef549167e2d98cff8bb0a4629140e3f1 | e30691231e45c2a911de5d9f28f7a5549969490e | refs/heads/master | 2022-08-23T19:33:01.475384 | 2020-05-29T09:46:25 | 2020-05-29T09:46:25 | 267,473,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package jp.co.internous.pegasus.model.form;
import java.io.Serializable;
public class DestinationForm implements Serializable {
private static final long serialVersionUID = 1L;
private int userId;
private String familyName;
private String firstName;
private String telNumber;
private String address;
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getTelNumber() {
return telNumber;
}
public void setTelNumber(String telNumber) {
this.telNumber = telNumber;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
| [
"[email protected]"
] | |
51e493eb1b16ef94f85b525eee7944134ab23b64 | 1f153162f289386194a5f778fc96507495898546 | /app/src/main/java/allunitconverter/fachati/com/weather/models/City.java | 9b150bce09cd97e939c1a8604b9335c0df95d099 | [] | no_license | fachati/Weather-openWeatherMap- | 987724a5361458289a0ca4c9cfaa2e9ea524ad17 | f3c0ac066c1c3bf53c01efcfd8f19c19abce81c8 | refs/heads/master | 2021-01-23T02:06:37.474997 | 2017-03-27T08:15:12 | 2017-03-27T08:15:12 | 85,967,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,570 | java | package allunitconverter.fachati.com.weather.models;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by fachati on 23/03/17.
*/
public class City implements Parcelable{
private String name;
private String country;
private int population;
protected City(Parcel in) {
name = in.readString();
country = in.readString();
population = in.readInt();
}
public static final Creator<City> CREATOR = new Creator<City>() {
@Override
public City createFromParcel(Parcel in) {
return new City(in);
}
@Override
public City[] newArray(int size) {
return new City[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(name);
parcel.writeString(country);
parcel.writeInt(population);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof City)) return false;
City City = (City) o;
if (population != City.population) return false;
if (!name.equals(City.name)) return false;
return country.equals(City.country);
}
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + country.hashCode();
result = 31 * result + population;
return result;
}
public String getName() {
return name;
}
}
| [
"[email protected]"
] | |
dad09f30dc0306958175b2a77cfe4f2ead422a0d | 84eae8f21a09b20ea9ebeff93392aee55b0caa0c | /Integrated project file/maven_Project/src/main/java/com/ILoveLAMP/dao/Base_DataDAO.java | 454dce37fc52f96be40ca2c486df0de0467d40b5 | [] | no_license | FCP-ZhaoYang/MscProject | 3856f2ab827edba43e9afbc35d4767d5e8640660 | b3ef611f29d80a3e1e8ac06aa7bbff103cff52a4 | refs/heads/master | 2021-01-18T07:23:58.788232 | 2016-02-26T10:14:17 | 2016-02-26T10:14:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,021 | java | package com.ILoveLAMP.dao;
import java.util.Collection;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import com.ILoveLAMP.entities.Base_Data;
import com.ILoveLAMP.entities.Error_Data;
import com.ILoveLAMP.entities.Event_Cause;
import com.ILoveLAMP.entities.Failure;
import com.ILoveLAMP.entities.Operator;
import com.ILoveLAMP.entities.User_Equipment;
@Local
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public interface Base_DataDAO {
void addBasicData(Base_Data data);
Base_Data getBaseDataById(int id);
Collection<Base_Data> getAllBaseDatas();
// Collection<Base_Data> getAllBaseDatasbyID(int id);
void addUser_Equipment(Collection<User_Equipment> eq);
void addOperator(Collection<Operator> op);
void addFailure(Collection<Failure> failures);
void addEventCause(Collection<Event_Cause> events);
void addBaseData(Collection<Base_Data> data);
void addErrorData(Collection<Error_Data> data);
}
| [
"[email protected]"
] | |
8d27688460a2425d634466d1d7f3520ee7316b26 | 0be360693a7dafb39de5b54b1de4a967747706c8 | /CameraMapsApplication/app/build/generated/source/r/debug/android/support/constraint/R.java | cac48ec43b9028351dc05afdbd85612f02523bbc | [] | no_license | srividyavn/GoogleMapsActivity | 00f0e55449033aa7be5a2a8af0300688fd3be04c | 460758d70488ecae9a4f3f68f5ad58f32a030fb7 | refs/heads/master | 2022-02-23T08:04:59.230178 | 2019-07-22T03:34:23 | 2019-07-22T03:34:23 | 198,138,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,252 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.constraint;
public final class R {
public static final class attr {
public static final int constraintSet = 0x7f010001;
public static final int layout_constraintBaseline_creator = 0x7f010005;
public static final int layout_constraintBaseline_toBaselineOf = 0x7f010006;
public static final int layout_constraintBottom_creator = 0x7f010007;
public static final int layout_constraintBottom_toBottomOf = 0x7f010008;
public static final int layout_constraintBottom_toTopOf = 0x7f010009;
public static final int layout_constraintDimensionRatio = 0x7f01000a;
public static final int layout_constraintEnd_toEndOf = 0x7f01000b;
public static final int layout_constraintEnd_toStartOf = 0x7f01000c;
public static final int layout_constraintGuide_begin = 0x7f01000d;
public static final int layout_constraintGuide_end = 0x7f01000e;
public static final int layout_constraintGuide_percent = 0x7f01000f;
public static final int layout_constraintHeight_default = 0x7f010010;
public static final int layout_constraintHeight_max = 0x7f010011;
public static final int layout_constraintHeight_min = 0x7f010012;
public static final int layout_constraintHorizontal_bias = 0x7f010013;
public static final int layout_constraintHorizontal_chainStyle = 0x7f010014;
public static final int layout_constraintHorizontal_weight = 0x7f010015;
public static final int layout_constraintLeft_creator = 0x7f010016;
public static final int layout_constraintLeft_toLeftOf = 0x7f010017;
public static final int layout_constraintLeft_toRightOf = 0x7f010018;
public static final int layout_constraintRight_creator = 0x7f010019;
public static final int layout_constraintRight_toLeftOf = 0x7f01001a;
public static final int layout_constraintRight_toRightOf = 0x7f01001b;
public static final int layout_constraintStart_toEndOf = 0x7f01001c;
public static final int layout_constraintStart_toStartOf = 0x7f01001d;
public static final int layout_constraintTop_creator = 0x7f01001e;
public static final int layout_constraintTop_toBottomOf = 0x7f01001f;
public static final int layout_constraintTop_toTopOf = 0x7f010020;
public static final int layout_constraintVertical_bias = 0x7f010021;
public static final int layout_constraintVertical_chainStyle = 0x7f010022;
public static final int layout_constraintVertical_weight = 0x7f010023;
public static final int layout_constraintWidth_default = 0x7f010024;
public static final int layout_constraintWidth_max = 0x7f010025;
public static final int layout_constraintWidth_min = 0x7f010026;
public static final int layout_editor_absoluteX = 0x7f010027;
public static final int layout_editor_absoluteY = 0x7f010028;
public static final int layout_goneMarginBottom = 0x7f010029;
public static final int layout_goneMarginEnd = 0x7f01002a;
public static final int layout_goneMarginLeft = 0x7f01002b;
public static final int layout_goneMarginRight = 0x7f01002c;
public static final int layout_goneMarginStart = 0x7f01002d;
public static final int layout_goneMarginTop = 0x7f01002e;
public static final int layout_optimizationLevel = 0x7f01002f;
}
public static final class id {
public static final int all = 0x7f0d0021;
public static final int basic = 0x7f0d0022;
public static final int chains = 0x7f0d0023;
public static final int none = 0x7f0d0024;
public static final int packed = 0x7f0d001f;
public static final int parent = 0x7f0d001c;
public static final int spread = 0x7f0d001d;
public static final int spread_inside = 0x7f0d0020;
public static final int wrap = 0x7f0d001e;
}
public static final class styleable {
public static final int[] ConstraintLayout_Layout = { 0x010100c4, 0x0101011f, 0x01010120, 0x0101013f, 0x01010140, 0x7f010001, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f };
public static final int ConstraintLayout_Layout_android_maxHeight = 2;
public static final int ConstraintLayout_Layout_android_maxWidth = 1;
public static final int ConstraintLayout_Layout_android_minHeight = 4;
public static final int ConstraintLayout_Layout_android_minWidth = 3;
public static final int ConstraintLayout_Layout_android_orientation = 0;
public static final int ConstraintLayout_Layout_constraintSet = 5;
public static final int ConstraintLayout_Layout_layout_constraintBaseline_creator = 6;
public static final int ConstraintLayout_Layout_layout_constraintBaseline_toBaselineOf = 7;
public static final int ConstraintLayout_Layout_layout_constraintBottom_creator = 8;
public static final int ConstraintLayout_Layout_layout_constraintBottom_toBottomOf = 9;
public static final int ConstraintLayout_Layout_layout_constraintBottom_toTopOf = 10;
public static final int ConstraintLayout_Layout_layout_constraintDimensionRatio = 11;
public static final int ConstraintLayout_Layout_layout_constraintEnd_toEndOf = 12;
public static final int ConstraintLayout_Layout_layout_constraintEnd_toStartOf = 13;
public static final int ConstraintLayout_Layout_layout_constraintGuide_begin = 14;
public static final int ConstraintLayout_Layout_layout_constraintGuide_end = 15;
public static final int ConstraintLayout_Layout_layout_constraintGuide_percent = 16;
public static final int ConstraintLayout_Layout_layout_constraintHeight_default = 17;
public static final int ConstraintLayout_Layout_layout_constraintHeight_max = 18;
public static final int ConstraintLayout_Layout_layout_constraintHeight_min = 19;
public static final int ConstraintLayout_Layout_layout_constraintHorizontal_bias = 20;
public static final int ConstraintLayout_Layout_layout_constraintHorizontal_chainStyle = 21;
public static final int ConstraintLayout_Layout_layout_constraintHorizontal_weight = 22;
public static final int ConstraintLayout_Layout_layout_constraintLeft_creator = 23;
public static final int ConstraintLayout_Layout_layout_constraintLeft_toLeftOf = 24;
public static final int ConstraintLayout_Layout_layout_constraintLeft_toRightOf = 25;
public static final int ConstraintLayout_Layout_layout_constraintRight_creator = 26;
public static final int ConstraintLayout_Layout_layout_constraintRight_toLeftOf = 27;
public static final int ConstraintLayout_Layout_layout_constraintRight_toRightOf = 28;
public static final int ConstraintLayout_Layout_layout_constraintStart_toEndOf = 29;
public static final int ConstraintLayout_Layout_layout_constraintStart_toStartOf = 30;
public static final int ConstraintLayout_Layout_layout_constraintTop_creator = 31;
public static final int ConstraintLayout_Layout_layout_constraintTop_toBottomOf = 32;
public static final int ConstraintLayout_Layout_layout_constraintTop_toTopOf = 33;
public static final int ConstraintLayout_Layout_layout_constraintVertical_bias = 34;
public static final int ConstraintLayout_Layout_layout_constraintVertical_chainStyle = 35;
public static final int ConstraintLayout_Layout_layout_constraintVertical_weight = 36;
public static final int ConstraintLayout_Layout_layout_constraintWidth_default = 37;
public static final int ConstraintLayout_Layout_layout_constraintWidth_max = 38;
public static final int ConstraintLayout_Layout_layout_constraintWidth_min = 39;
public static final int ConstraintLayout_Layout_layout_editor_absoluteX = 40;
public static final int ConstraintLayout_Layout_layout_editor_absoluteY = 41;
public static final int ConstraintLayout_Layout_layout_goneMarginBottom = 42;
public static final int ConstraintLayout_Layout_layout_goneMarginEnd = 43;
public static final int ConstraintLayout_Layout_layout_goneMarginLeft = 44;
public static final int ConstraintLayout_Layout_layout_goneMarginRight = 45;
public static final int ConstraintLayout_Layout_layout_goneMarginStart = 46;
public static final int ConstraintLayout_Layout_layout_goneMarginTop = 47;
public static final int ConstraintLayout_Layout_layout_optimizationLevel = 48;
public static final int[] ConstraintSet = { 0x010100c4, 0x010100d0, 0x010100dc, 0x010100f4, 0x010100f5, 0x010100f7, 0x010100f8, 0x010100f9, 0x010100fa, 0x0101031f, 0x01010320, 0x01010321, 0x01010322, 0x01010323, 0x01010324, 0x01010325, 0x01010327, 0x01010328, 0x010103b5, 0x010103b6, 0x010103fa, 0x01010440, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e };
public static final int ConstraintSet_android_alpha = 9;
public static final int ConstraintSet_android_elevation = 21;
public static final int ConstraintSet_android_id = 1;
public static final int ConstraintSet_android_layout_height = 4;
public static final int ConstraintSet_android_layout_marginBottom = 8;
public static final int ConstraintSet_android_layout_marginEnd = 19;
public static final int ConstraintSet_android_layout_marginLeft = 5;
public static final int ConstraintSet_android_layout_marginRight = 7;
public static final int ConstraintSet_android_layout_marginStart = 18;
public static final int ConstraintSet_android_layout_marginTop = 6;
public static final int ConstraintSet_android_layout_width = 3;
public static final int ConstraintSet_android_orientation = 0;
public static final int ConstraintSet_android_rotationX = 16;
public static final int ConstraintSet_android_rotationY = 17;
public static final int ConstraintSet_android_scaleX = 14;
public static final int ConstraintSet_android_scaleY = 15;
public static final int ConstraintSet_android_transformPivotX = 10;
public static final int ConstraintSet_android_transformPivotY = 11;
public static final int ConstraintSet_android_translationX = 12;
public static final int ConstraintSet_android_translationY = 13;
public static final int ConstraintSet_android_translationZ = 20;
public static final int ConstraintSet_android_visibility = 2;
public static final int ConstraintSet_layout_constraintBaseline_creator = 22;
public static final int ConstraintSet_layout_constraintBaseline_toBaselineOf = 23;
public static final int ConstraintSet_layout_constraintBottom_creator = 24;
public static final int ConstraintSet_layout_constraintBottom_toBottomOf = 25;
public static final int ConstraintSet_layout_constraintBottom_toTopOf = 26;
public static final int ConstraintSet_layout_constraintDimensionRatio = 27;
public static final int ConstraintSet_layout_constraintEnd_toEndOf = 28;
public static final int ConstraintSet_layout_constraintEnd_toStartOf = 29;
public static final int ConstraintSet_layout_constraintGuide_begin = 30;
public static final int ConstraintSet_layout_constraintGuide_end = 31;
public static final int ConstraintSet_layout_constraintGuide_percent = 32;
public static final int ConstraintSet_layout_constraintHeight_default = 33;
public static final int ConstraintSet_layout_constraintHeight_max = 34;
public static final int ConstraintSet_layout_constraintHeight_min = 35;
public static final int ConstraintSet_layout_constraintHorizontal_bias = 36;
public static final int ConstraintSet_layout_constraintHorizontal_chainStyle = 37;
public static final int ConstraintSet_layout_constraintHorizontal_weight = 38;
public static final int ConstraintSet_layout_constraintLeft_creator = 39;
public static final int ConstraintSet_layout_constraintLeft_toLeftOf = 40;
public static final int ConstraintSet_layout_constraintLeft_toRightOf = 41;
public static final int ConstraintSet_layout_constraintRight_creator = 42;
public static final int ConstraintSet_layout_constraintRight_toLeftOf = 43;
public static final int ConstraintSet_layout_constraintRight_toRightOf = 44;
public static final int ConstraintSet_layout_constraintStart_toEndOf = 45;
public static final int ConstraintSet_layout_constraintStart_toStartOf = 46;
public static final int ConstraintSet_layout_constraintTop_creator = 47;
public static final int ConstraintSet_layout_constraintTop_toBottomOf = 48;
public static final int ConstraintSet_layout_constraintTop_toTopOf = 49;
public static final int ConstraintSet_layout_constraintVertical_bias = 50;
public static final int ConstraintSet_layout_constraintVertical_chainStyle = 51;
public static final int ConstraintSet_layout_constraintVertical_weight = 52;
public static final int ConstraintSet_layout_constraintWidth_default = 53;
public static final int ConstraintSet_layout_constraintWidth_max = 54;
public static final int ConstraintSet_layout_constraintWidth_min = 55;
public static final int ConstraintSet_layout_editor_absoluteX = 56;
public static final int ConstraintSet_layout_editor_absoluteY = 57;
public static final int ConstraintSet_layout_goneMarginBottom = 58;
public static final int ConstraintSet_layout_goneMarginEnd = 59;
public static final int ConstraintSet_layout_goneMarginLeft = 60;
public static final int ConstraintSet_layout_goneMarginRight = 61;
public static final int ConstraintSet_layout_goneMarginStart = 62;
public static final int ConstraintSet_layout_goneMarginTop = 63;
public static final int[] LinearConstraintLayout = { 0x010100c4 };
public static final int LinearConstraintLayout_android_orientation = 0;
}
}
| [
"[email protected]"
] | |
6b9d1463f859c88db56be17eed55c2da9e451ed8 | 89d1dcfc803f4eedd1ebe659d98486f9c8cd778a | /src/main/java/com/mobiquity/utils/InputPackerParser.java | 92f4fff919d67b978e4b8ee9ac8eaab7e3a9d93e | [] | no_license | HudaSoliman/Package-Challenge | 679ab69051bbbc617f53bf7ede7980abcfd4324d | 7fdd6ccd1cb31fb41c24c2fe3dbe69c5c11507b5 | refs/heads/master | 2023-04-22T07:46:11.646985 | 2021-05-14T18:29:49 | 2021-05-14T18:29:49 | 366,697,174 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 2,536 | java |
package com.mobiquity.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.mobiquity.domain.InputPackage;
import com.mobiquity.domain.Item;
import com.mobiquity.exception.APIException;
import com.mobiquity.exception.APIExceptionType;
public class InputPackerParser {
private static final PackageProcessor PROCESSOR = new PackageProcessor();
private InputPackerParser() {
}
public static String processLine(String line) throws APIException {
var inputPackage = parseLine(line);
var resultItems = PROCESSOR.process(inputPackage.getWeightLimit(), inputPackage.getItems());
if (resultItems == null || resultItems.isEmpty()) {
return "-";
}
return resultItems.stream().map(i -> Integer.toString(i.getIndex())).collect(Collectors.joining(","));
}
private static InputPackage parseLine(String line) throws APIException {
String[] configurationParts = line.split(" : ");
try {
if (configurationParts.length != 2) {
throw new APIException(APIExceptionType.INVALID_INPUT);
}
var weightLimit = Integer.parseInt(configurationParts[0]);
if (weightLimit > PackerConstants.MAX_PACKAGE_WEIGHT) {
throw new APIException(APIExceptionType.MAX_PACKAGE_WEIGHT);
}
String[] itemsParts = configurationParts[1].split("\\s+");
if (itemsParts.length == 0 || itemsParts.length > PackerConstants.MAX_ITEMS_NUMBER) {
throw new APIException(APIExceptionType.INVALID_ITEMS_NUMBER);
}
List<Item> itemsList = new ArrayList<>();
for (String itemString : itemsParts) {
var item = parseItemString(itemString);
itemsList.add(item);
}
return new InputPackage(weightLimit, itemsList);
} catch (NumberFormatException e) {
throw new APIException(APIExceptionType.INVALID_INPUT);
}
}
private static Item parseItemString(String itemString) throws APIException {
String[] itemParts = itemString.replace("(", "").replace(")", "").split(",");
if (itemParts.length != 3) {
throw new APIException("Invalid Input!");
}
var index = Integer.parseInt(itemParts[0]);
var weight = Float.parseFloat(itemParts[1]);
if (weight > PackerConstants.MAX_ITEM_WEIGHT) {
throw new APIException(APIExceptionType.MAX_ITEM_WEIGHT);
}
var cost = Float.parseFloat(itemParts[2].replace("€", ""));
if (cost > PackerConstants.MAX_ITEM_COST) {
throw new APIException(APIExceptionType.MAX_ITEM_COST);
}
return new Item(index, weight, cost);
}
} | [
"[email protected]"
] | |
7d32d4b149e394c9eb4d240d8b8087636c4c8208 | f8f48ecfadc799175f39e0b7ee7135fab728f9a0 | /src/main/java/com/yct/settle/service/impl/ConsumeDataProcessImpl.java | 5942fa5daa2000511ca1afabeff1702aaa4c0dc5 | [] | no_license | mlsama/settle_process | bd6b6c7aaa266ca026c68dbbada9f837696eb903 | c4f145124cd1744834ce18000e1e2b152e013e4f | refs/heads/master | 2021-09-07T06:34:41.363896 | 2019-07-17T10:13:07 | 2019-07-17T10:13:07 | 197,357,950 | 0 | 2 | null | 2021-08-02T17:17:57 | 2019-07-17T09:25:14 | Java | UTF-8 | Java | false | false | 30,862 | java | package com.yct.settle.service.impl;
import com.yct.settle.mapper.*;
import com.yct.settle.pojo.*;
import com.yct.settle.service.ConsumeDataProcess;
import com.yct.settle.service.CustomerServiceDataProcess;
import com.yct.settle.service.ProcessResultService;
import com.yct.settle.thread.ThreadTaskHandle;
import com.yct.settle.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
/**
* DESC:
* AUTHOR:mlsama
* 2019/7/2 11:41
*/
@Service
public class ConsumeDataProcessImpl implements ConsumeDataProcess {
private final Logger log = LoggerFactory.getLogger(ConsumeDataProcessImpl.class);
@Resource
private ProcessResultService processResultService;
@Resource
private CpuConsumeMapper cpuConsumeMapper;
@Resource
private CpuConsumeNoBusMapper cpuConsumeNoBusMapper;
@Resource
private CpuConsumeReviseMapper cpuConsumeReviseMapper;
@Resource
private MCardConsumeMapper mCardConsumeMapper;
@Resource
private MCardConsumeNoBusMapper mCardConsumeNoBusMapper;
@Resource
private MCardConsumeReviseMapper mCardConsumeReviseMapper;
@Resource
private CustomerServiceDataProcess customerServiceDataProcess;
@Resource
private CpuCustomerServiceMapper cpuCustomerServiceMapper;
@Resource
private MCardCustomerServiceMapper mCardCustomerServiceMapper;
@Resource
private ThreadTaskHandle threadTaskHandle;
/**
* 处理消费,客服文件
* @param inputDataFolder
* @param outputDataFolder
* @param date
* @param dmcj
* @param dmcx
* @param dmmj
* @param dmmx
* @param dbUser
* @param dbPassword
* @param odbName
* @param sqlldrDir
* @param resultMap
* @return
*/
@Override
public boolean processConsumeFiles(String inputDataFolder, String outputDataFolder, String date,
File dmcj, File dmcx, File dmmj, File dmmx, String dbUser,
String dbPassword, String odbName, File sqlldrDir, Map<String, String> resultMap) {
String inZipFileName = null;
File unZipDir = null;
try {
//处理消费文件
File inputDateDir = new File(inputDataFolder + File.separator + date);
log.info("开始处理文件夹{}下的消费文件",inputDateDir.getName());
if (inputDateDir.exists()) {
Boolean isBusFile = null;
//找到对应output日期文件夹
File cOutputDateDir = new File(outputDataFolder + File.separator + date);
File[] inZipFiles = inputDateDir.listFiles();
for (File inZipFile : inZipFiles) {
//其他线程检查
if (threadTaskHandle.getIsError()) {
log.info("有线程发生了异常,处理充值文件的线程无需再执行!");
return false;
}
inZipFileName = inZipFile.getName();
//处理inputDate下的一个压缩文件
if (inZipFileName.startsWith("CX") || inZipFileName.startsWith("XF") ||
inZipFileName.startsWith("CK") || inZipFileName.startsWith("KF")) {
String zipFileType,cardType;
//落库文件处理表
FileProcessResult result = new FileProcessResult();
result.setSettleDate(date);
if (inZipFileName.startsWith("CX")){
//cpu卡,消费
cardType = "01";
zipFileType = "02";
}else if (inZipFileName.startsWith("XF")){
//m1卡,消费
cardType = "02";
zipFileType = "02";
}else if (inZipFileName.startsWith("CK")){
//cpu卡,客服
cardType = "01";
zipFileType = "03";
}else {
//m1卡,客服
cardType = "02";
zipFileType = "03";
}
result.setZipFileType(zipFileType);
result.setZipFileName(inZipFileName);
result.setCardType(cardType);
processResultService.delAndInsert(result);
Boolean lean = FileUtil.unZip(inZipFile);
if (lean) {
//进入解压后的文件夹
String unZipDirName = inZipFile.getName().substring(0, inZipFile.getName().indexOf("."));
unZipDir = new File(inputDateDir, unZipDirName);
File[] unZipFiles = unZipDir.listFiles();
boolean b;
for (File unZipFile : unZipFiles) {
if ("02".equals(zipFileType) && unZipFile.getName().startsWith("JY")) { //消费
isBusFile = FileUtil.isBusFile(unZipDirName, unZipFile);
//落库
b = batchInsert(cOutputDateDir, unZipDirName, unZipFile, isBusFile, sqlldrDir,
dbUser,dbPassword,odbName);
}else if ("03".equals(zipFileType) && unZipFile.getName().startsWith("JY")) { //客服
b = customerServiceDataProcess.batchInsert(unZipDirName, unZipFile, sqlldrDir,
dbUser,dbPassword,odbName);
}else {
continue;
}
if (!b){
processResultService.update(new FileProcessResult(inZipFileName, unZipFile.getAbsolutePath(),new Date(),"6555","落库失败"));
//删除解压的文件夹
FileUtil.deleteFile(unZipDir);
return false;
}
break; //只需要处理JY文件
}
//从数据库取出数据写入dm
writerConsumeOrCustomerToDm(dmmj,dmmx,dmcj,dmcx,date,inZipFileName,isBusFile,zipFileType);
// 把这个消费文件的统计数据存到数据库表
countConsumeOrCustomerDataToDb(inZipFileName,isBusFile);
//删除解压的文件夹
FileUtil.deleteFile(unZipDir);
} else {
threadTaskHandle.setIsError(true);
log.error("处理消费文件{}发生异常,修改标志,通知其他线程", inZipFile);
//删除解压的文件夹
FileUtil.deleteFile(unZipDir);
//修改
processResultService.update(new FileProcessResult(inZipFileName,inZipFile.getAbsolutePath(),new Date(),"6555","解压失败"));
return false;
}
}
}
}
}catch (Exception e){
threadTaskHandle.setIsError(true);
log.error("处理消费文件{}发生异常:{},修改标志,通知其他线程", inZipFileName, e);
//删除解压的文件夹
FileUtil.deleteFile(unZipDir);
//修改
processResultService.update(new FileProcessResult(inZipFileName,null,new Date(),
"6555","处理消费或者客服文件发生异常"));
return false;
}
resultMap.put("consumeResultCode","0000");
return true;
}
private void countConsumeOrCustomerDataToDb(String inZipFileName,boolean isBusFile) {
int investNotes = 0;
BigDecimal investAmount = null;
int consumeNotes = 0;
BigDecimal consumeAmount = null;
int reviseNotes = 0;
BigDecimal reviseAmount = null;
if (inZipFileName.startsWith("CX")){ //cpu消费文件
if (isBusFile){ //公交
log.info("cpu卡公交消费文件统计数据并落库");
CountData cpuConsumeCountData = cpuConsumeMapper.countAmountAndNum();
consumeNotes = cpuConsumeCountData.getNotesSum();
consumeAmount = cpuConsumeCountData.getAmountSum();
CountData cpuConsumeReviseCountData = cpuConsumeReviseMapper.countAmountAndNum();
reviseNotes = cpuConsumeReviseCountData.getNotesSum();
reviseAmount = cpuConsumeReviseCountData.getAmountSum();
}else {
log.info("cpu卡非公交消费文件统计数据并落库");
CountData cpuConsumeCountData = cpuConsumeNoBusMapper.countAmountAndNum();
consumeNotes = cpuConsumeCountData.getNotesSum();
consumeAmount = cpuConsumeCountData.getAmountSum();
}
}else if (inZipFileName.startsWith("XF")){ //m1卡
log.info("m1卡公交消费文件统计数据并落库");
if (isBusFile){
CountData mCardConsume = mCardConsumeMapper.countAmountAndNum();
consumeNotes = mCardConsume.getNotesSum();
consumeAmount = mCardConsume.getAmountSum();
CountData cpuConsumeRevise = mCardConsumeReviseMapper.countAmountAndNum();
reviseNotes = cpuConsumeRevise.getNotesSum();
reviseAmount = cpuConsumeRevise.getAmountSum();
}else {
log.info("m1卡非公交消费文件统计数据并落库");
CountData mCardConsume = mCardConsumeNoBusMapper.countAmountAndNum();
consumeNotes = mCardConsume.getNotesSum();
consumeAmount = mCardConsume.getAmountSum();
}
}else if (inZipFileName.startsWith("Ck")){ //cpu卡客服
log.info("cpu卡客服文件统计数据并落库");
//cpu客服充值
CountData cpuInvest = cpuCustomerServiceMapper.countInvestAmountAndNum();
CountData cpuConsume = cpuCustomerServiceMapper.countConsumeAmountAndNum();
investNotes = cpuInvest.getNotesSum();
investAmount = cpuInvest.getAmountSum();
consumeNotes = cpuConsume.getNotesSum() ;
consumeAmount = cpuConsume.getAmountSum();
}else if (inZipFileName.startsWith("KF")){ //m1卡客服
log.info("m1卡客服文件统计数据并落库");
//m1客服充值
CountData mCardInvest = mCardCustomerServiceMapper.countInvestAmountAndNum();
CountData mCardConsume = mCardCustomerServiceMapper.countConsumeAmountAndNum();
investNotes = mCardInvest.getNotesSum();
investAmount =mCardInvest.getAmountSum();
consumeNotes = mCardConsume.getNotesSum();
consumeAmount = mCardConsume.getAmountSum();
}
processResultService.update(
new FileProcessResult(inZipFileName,new Date(),"0000","处理成功", investNotes,investAmount,
consumeNotes,consumeAmount,reviseNotes,reviseAmount));
}
private void writerConsumeOrCustomerToDm(File dmmj, File dmmx, File dmcj, File dmcx, String date,
String inZipFileName, Boolean isBusFile,String zipFileType) {
if ("02".equals(zipFileType)){ //消费
//从数据库取出写入dm
writerTODM(dmmj,dmmx,dmcj,dmcx,date,inZipFileName,isBusFile);
}else if ("03".equals(zipFileType)){ //客服
//从数据库取出写入dm
customerServiceDataProcess.writerTODM(dmmj, dmcj, date, inZipFileName);
}
}
/**
* 把CX或者XF压缩文件中的JY文件和对应的output文件夹的相关的文件(CW,XZ)落库
* @param cOutputDateDir input对应的output的文件夹
* @param unZipDirName input压缩文件解压后的文件夹名字
* @param unZipFile 解压后文件
* @param dbUser
* @param dbPassword
* @param odbName
* @return 全部落库是否成功
*/
@Override
public boolean batchInsert(File cOutputDateDir, String unZipDirName, File unZipFile, Boolean isBusFile,
File sqlldrDir, String dbUser, String dbPassword, String odbName) {
ArrayList<Map<String,Object>> info = new ArrayList<>();
//表名
String tableName = null;
//表字段
String fieldNames = null;
//控制文件
File contlFile = null;
File[] cOutputUnzipFiles = null;
boolean oFileExists = false;
File cOutputUnzipDir = null;
//解压output对应的压缩文件
Boolean bool = false;
File temFile = null;
File[] zipFiles = cOutputDateDir.listFiles();
for (File zipFile : zipFiles){
if (zipFile.getName().startsWith(unZipDirName)){
oFileExists = true;
temFile = zipFile;
}
}
if (oFileExists){
//解压
bool = FileUtil.unZip(temFile);
if (bool){
//output对应的文件
cOutputUnzipDir = new File(cOutputDateDir,unZipDirName);
}else {
log.error("{}解压失败或者文件名{}不是以{}开头",temFile.getAbsolutePath(),temFile.getName(),unZipDirName);
FileUtil.deleteFile(cOutputUnzipDir);
return false;
}
cOutputUnzipFiles = cOutputUnzipDir.listFiles();
}
if (unZipDirName.startsWith("CX")){ //CPU卡
if (isBusFile){ //公交
tableName = "T_CPU_CONSUME";
fieldNames = "(PID,PSN,TIM,LCN,FCN,TF,FEE,BAL,TT,ATT,CRN,XRN,DMON,BDCT,MDCT,UDCT,EPID,ETIM,LPID,LTIM,AREA,ACT,SAREA,TAC,MEM)";
//控制文件
contlFile = new File(sqlldrDir,"cpuConsume.ctl");
if (oFileExists){
for (File cOutputUnzipFile : cOutputUnzipFiles){
if (cOutputUnzipFile.getName().startsWith("CW")){ //错误
String otable = "T_CPU_CONSUME_ERROR";
String ofields = "(PID, PSN, TIM, LCN, FCN, TF, FEE, BAL, TT, ATT, CRN, XRN, DMON, BDCT, MDCT, UDCT, EPID, ETIM, LPID, LTIM, AREA, ACT, SAREA, TAC, STATUS)";
File ocfile = new File(sqlldrDir,"cpuConsumeError.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
}
if (cOutputUnzipFile.getName().startsWith("XZ")){ //修正
String otable = "T_CPU_CONSUME_REVISE";
String ofields = "(FNAME, PID, PSN, TIM, LCN, FCN, TF, FEE, BAL, TT, ATT, CRN, XRN, DMON, BDCT, MDCT, UDCT, EPID, ETIM, LPID, LTIM, AREA, ACT, SAREA, TAC, FLAG, CODE)";
File ocfile = new File(sqlldrDir,"cpuConsumeRevise.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
}
}
}
}else { //非公交
tableName = "T_CPU_CONSUME_NOBUS";
fieldNames = "(PID, PSN, TIM, LCN, FCN, TF, FEE, BAL, TT, ATT, CRN, XRN, DMON, EPID, ETIM, LPID, LTIM, TAC)";
//控制文件
contlFile = new File(sqlldrDir,"cpuConsumeNoBus.ctl");
if (oFileExists){
for (File cOutputUnzipFile : cOutputUnzipFiles){
if (cOutputUnzipFile.getName().startsWith("CW")){ //错误
String otable = "T_CPU_CONSUME_ERROR_NOBUS";
String ofields = "(PID, PSN, TAC, STATUS)";
File ocfile = new File(sqlldrDir,"cpuConsumeErrorNoBus.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
break;
}
}
}
}
}else if (unZipDirName.startsWith("XF")){ //M1卡
if (isBusFile){ //公交
tableName = "T_MCARD_CONSUME";
fieldNames = "(PSN, LCN, FCN, LPID, LTIM, PID, TIM, TF, BAL, FEE, TT, RN, DMON, BDCT, MDCT, UDCT, EPID, ETIM, AI, VC, TAC)";
//控制文件
contlFile = new File(sqlldrDir,"mCardConsume.ctl");
if (oFileExists){
for (File cOutputUnzipFile : cOutputUnzipFiles){
if (cOutputUnzipFile.getName().startsWith("CW")){ //错误
String otable = "T_MCARD_CONSUME_ERROR";
String ofields = "(PID, PSN, STATUS)";
File ocfile = new File(sqlldrDir,"mCardConsumeError.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
}
if (cOutputUnzipFile.getName().startsWith("XZ")){ //修正
String otable = "T_MCARD_CONSUME_REVISE";
String ofields = "(FNAME, PSN, LCN, FCN, LPID, LTIM, PID, TIM, TF, BAL, FEE, TT, RN, DMON, BDCT, MDCT, UDCT, EPID, ETIM, AI, VC, TAC, FLAG, CODE)";
File ocfile = new File(sqlldrDir,"mCardConsumeRevise.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
}
}
}
}else { //非公交
tableName = "T_MCARD_CONSUME_NOBUS";
fieldNames = "(PSN, LCN, FCN, LPID, LTIM, PID, TIM, TF, BAL, TT, RN, EPID, ETIM, AI, VC, TAC, MEM)";
//控制文件
contlFile = new File(sqlldrDir,"mCardConsumeNoBus.ctl");
if (oFileExists){
for (File cOutputUnzipFile : cOutputUnzipFiles){
if (cOutputUnzipFile.getName().startsWith("CW")){ //错误
String otable = "T_MCARD_CONSUME_ERROR_NOBUS";
String ofields = "(PSN, PID, STATUS)";
File ocfile = new File(sqlldrDir,"mCardConsumeErrorNoBus.ctl");
toMap(info,otable,ofields,ocfile,cOutputUnzipFile);
break;
}
}
}
}
}
toMap(info,tableName,fieldNames,contlFile,unZipFile);
//落库
for (Map<String,Object> map : info){
boolean f = SqlLdrUtil.insertBySqlLdr(dbUser,dbPassword,odbName,(String)map.get("tableName"),(String)map.get("fieldNames"),
(File) map.get("contlFile"),(File) map.get("dataFile"));
if (!f){
log.error("落库失败,文件是{}",((File) map.get("dataFile")).getAbsolutePath());
FileUtil.deleteFile(cOutputUnzipDir);
return false;
}
}
FileUtil.deleteFile(cOutputUnzipDir);
return true;
}
private void toMap(List<Map<String, Object>> info, String otable, String ofields, File ocfile,File cOutputUnzipFile){
Map<String,Object> map = new HashMap<>();
map.put("tableName",otable);
map.put("fieldNames",ofields);
map.put("contlFile",ocfile);
map.put("dataFile",cOutputUnzipFile);
info.add(map);
}
/**
* 从数据库取数据写到dm
* @param dmmj
* @param dmmx
* @param dmcj
* @param dmcx
* @param settleDate 结算日期
* @param zipFileName 压缩文件名称
* @param isBusFile 是否是公交文件
*/
@Override
public void writerTODM(File dmmj, File dmmx, File dmcj, File dmcx,
String settleDate, String zipFileName, Boolean isBusFile) {
log.info("从数据库取消费数据写到对应的dm文件");
if (zipFileName.startsWith("CX")){ //cpu卡
ArrayList<CpuTrade> cpuTradeList = new ArrayList<>();
if (isBusFile){ //公交
//获取总笔数
long allNotes = cpuConsumeMapper.findAllNotes();
if (allNotes > 0L) {
long pageSize = 100000L, startNum = 0L, endNum, count = 1L;
while (allNotes > 0L) {
if (allNotes <= pageSize) {
pageSize = allNotes;
}
endNum = startNum + pageSize;
log.info("第{}次循环,allNotes={},pageSize={},startNum={},endNum={}", count, allNotes, pageSize, startNum, endNum);
List<CpuConsume> cpuConsumeList = cpuConsumeMapper.findByWhere(startNum,endNum);
for (CpuConsume cpuConsume : cpuConsumeList){
CpuTrade cpuTrade = new CpuTrade();
convertToCpuTrade(cpuConsume,cpuTrade,settleDate,zipFileName);
cpuTradeList.add(cpuTrade);
}
FileUtil.writeToFile(dmcj,cpuTradeList);
cpuTradeList.clear();
allNotes -= pageSize;
startNum += pageSize;
count++;
}
}
//修正
List<CpuConsumeRevise> list = cpuConsumeReviseMapper.findList();
if (list.size() > 0){
ArrayList<CpuTradeRevise> cpuTradeReviseList = new ArrayList<>();
for (CpuConsumeRevise cpuConsumeRevise : list){
CpuTradeRevise cpuTradeRevise = new CpuTradeRevise();
convertToCpuTradeRevise(cpuConsumeRevise,cpuTradeRevise,settleDate,zipFileName);
cpuTradeReviseList.add(cpuTradeRevise);
}
FileUtil.writeToFile(dmcx,cpuTradeReviseList);
}
}else {
//获取总笔数
long allNotes = cpuConsumeNoBusMapper.findAllNotes();
if (allNotes > 0L) {
long pageSize = 100000L, startNum = 0L, endNum, count = 1L;
while (allNotes > 0L) {
if (allNotes <= pageSize) {
pageSize = allNotes;
}
endNum = startNum + pageSize;
log.info("第{}次循环,allNotes={},pageSize={},startNum={},endNum={}", count, allNotes, pageSize, startNum, endNum);
List<CpuConsumeNoBus> cpuConsumeNoBusList = cpuConsumeNoBusMapper.findByWhere(startNum,endNum);
for (CpuConsumeNoBus cpuConsumeNoBus : cpuConsumeNoBusList){
CpuTrade cpuTrade = new CpuTrade();
convertToCpuTrade(cpuConsumeNoBus,cpuTrade,settleDate,zipFileName);
cpuTradeList.add(cpuTrade);
}
FileUtil.writeToFile(dmcj,cpuTradeList);
cpuTradeList.clear();
allNotes -= pageSize;
startNum += pageSize;
count++;
}
}
}
}else { //M1卡
ArrayList<MCardTrade> mCardTradeList = new ArrayList<>();
if (isBusFile){ //公交
//获取总笔数
long allNotes = mCardConsumeMapper.findAllNotes();
if (allNotes > 0L){
long pageSize = 100000L,startNum = 0L,endNum,count = 1L;
while (allNotes > 0L){
if (allNotes <= pageSize){
pageSize = allNotes;
}
endNum = startNum + pageSize;
log.info("第{}次循环,allNotes={},pageSize={},startNum={},endNum={}",count,allNotes,pageSize,startNum,endNum);
List<MCardConsume> mCardConsumeList = mCardConsumeMapper.findByWhere(startNum,endNum);
for (MCardConsume mCardConsume : mCardConsumeList){
MCardTrade mCardTrade = new MCardTrade();
convertToMCardTrade(mCardConsume,mCardTrade,settleDate,zipFileName);
mCardTradeList.add(mCardTrade);
}
FileUtil.writeToFile(dmmj,mCardTradeList);
mCardTradeList.clear();
allNotes -= pageSize;
startNum += pageSize;
count++;
}
}
//修正
List<MCardConsumeRevise> reviseList = mCardConsumeReviseMapper.findList();
if (reviseList.size() > 0){
ArrayList<MCardTradeRevise> mCardTradeReviseList = new ArrayList<>();
for (MCardConsumeRevise mCardConsumeRevise : reviseList){
MCardTradeRevise mCardTradeRevise = new MCardTradeRevise();
convertToMCardTradeRevise(mCardConsumeRevise,mCardTradeRevise,settleDate,zipFileName);
mCardTradeReviseList.add(mCardTradeRevise);
}
FileUtil.writeToFile(dmmx,mCardTradeReviseList);
}
}else { //非公交
//获取总笔数
long allNotes = mCardConsumeNoBusMapper.findAllNotes();
if (allNotes > 0L) {
long pageSize = 100000L, startNum = 0L, endNum, count = 1L;
while (allNotes > 0L) {
if (allNotes <= pageSize) {
pageSize = allNotes;
}
endNum = startNum + pageSize;
log.info("第{}次循环,allNotes={},pageSize={},startNum={},endNum={}", count, allNotes, pageSize, startNum, endNum);
List<MCardConsumeNoBus> list = mCardConsumeNoBusMapper.findByWhere(startNum,endNum);
for (MCardConsumeNoBus mCardConsumeNoBus : list){
MCardTrade mCardTrade = new MCardTrade();
convertToMCardTrade(mCardConsumeNoBus,mCardTrade,settleDate,zipFileName);
mCardTradeList.add(mCardTrade);
}
FileUtil.writeToFile(dmmj,mCardTradeList);
mCardTradeList.clear();
allNotes -= pageSize;
startNum += pageSize;
count++;
}
}
}
}
}
private void convertToMCardTradeRevise(MCardConsumeRevise mCardConsumeRevise, MCardTradeRevise mCardTradeRevise, String settleDate, String zipFileName) {
BeanUtils.copyProperties(mCardConsumeRevise,mCardTradeRevise);
mCardTradeRevise.setQDATE(settleDate);
mCardTradeRevise.setQNAME(zipFileName);
mCardTradeRevise.setLTIME(DateUtil.getTomorrow(mCardConsumeRevise.getTIM()));
mCardTradeRevise.setDT("02");
mCardTradeRevise.setTT(mCardConsumeRevise.getTT());
mCardTradeRevise.setXT(mCardConsumeRevise.getFLAG());
mCardTradeRevise.setDSN(mCardConsumeRevise.getPSN());
mCardTradeRevise.setICN(mCardConsumeRevise.getLCN());
mCardTradeRevise.setBINF("00000000000000000000");//备用信息
}
private void convertToMCardTrade(Object object, MCardTrade mCardTrade, String settleDate, String zipFileName) {
if (object instanceof MCardConsume){
MCardConsume mCardConsume = (MCardConsume) object;
BeanUtils.copyProperties(mCardConsume,mCardTrade);
mCardTrade.setDSN(mCardConsume.getPSN());
mCardTrade.setICN(mCardConsume.getLCN());
}else if (object instanceof MCardConsumeNoBus){
MCardConsumeNoBus mCardConsumeNoBus = (MCardConsumeNoBus) object;
BeanUtils.copyProperties(mCardConsumeNoBus,mCardTrade);
mCardTrade.setDSN(mCardConsumeNoBus.getPSN());
mCardTrade.setICN(mCardConsumeNoBus.getLCN());
mCardTrade.setDMON("0000");
mCardTrade.setBDCT("000");
mCardTrade.setMDCT("000");
mCardTrade.setUDCT("000");
}
mCardTrade.setQDATE(settleDate);
mCardTrade.setDT("02");//消费
mCardTrade.setBINF("00000000000000000000");//备用信息
mCardTrade.setQNAME(zipFileName);
}
private void convertToCpuTradeRevise(CpuConsumeRevise cpuConsumeRevise, CpuTradeRevise cpuTradeRevise, String settleDate, String zipFileName) {
BeanUtils.copyProperties(cpuConsumeRevise,cpuTradeRevise);
cpuTradeRevise.setQDATE(settleDate);
cpuTradeRevise.setLTIME(DateUtil.getTomorrow(cpuConsumeRevise.getTIM()));
cpuTradeRevise.setDT("02");//消费
cpuTradeRevise.setDMON("0000000000000");//扩展信息
cpuTradeRevise.setBINF("00000000000000000000");//备用信息
cpuTradeRevise.setQNAME(zipFileName);
cpuTradeRevise.setXT(cpuConsumeRevise.getFLAG());
}
private void convertToCpuTrade(Object object, CpuTrade cpuTrade,String settleDate, String zipFileName) {
if (object instanceof CpuConsume){
CpuConsume cpuConsume = (CpuConsume) object;
BeanUtils.copyProperties(cpuConsume,cpuTrade);
}else if (object instanceof CpuConsumeNoBus){
CpuConsumeNoBus cpuConsumeNoBus = (CpuConsumeNoBus) object;
BeanUtils.copyProperties(cpuConsumeNoBus,cpuTrade);
}
cpuTrade.setQDATE(settleDate);
cpuTrade.setDT("02");//消费
cpuTrade.setTT("06");//消费
cpuTrade.setDMON("0000000000000");//扩展信息
cpuTrade.setQNAME(zipFileName);
}
}
| [
"[email protected]"
] | |
ba5db7134d6b97e0064fe636c8dfc54bee61b6a8 | 7a55f122cd46d62918ed5a17b8bd7812deeef31c | /bernabe_davila/Codigo/src/main/java/Cube.java | 997fa0ad24efdc60af265742c2500b6238f38588 | [] | no_license | jzaldumbide/fundamentos2020B | 71411eb0f50d6bccc7d6dc66b781fc3801eb507a | 8887392ec1550efdae491cfbc9c6acd73f2bba01 | refs/heads/main | 2023-01-19T12:15:15.047308 | 2020-11-30T14:23:05 | 2020-11-30T14:23:05 | 317,222,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java |
public class Cube {
private int edgeLength;
public Cube(int edgeLength) {
this.edgeLength = edgeLength;
}
public int volume() {
int volumen = this.edgeLength * this.edgeLength * this.edgeLength;
return volumen;
}
public String toString() {
return "The length of the edge is " + this.edgeLength + " and the volume " + volume();
}
}
| [
"[email protected]"
] | |
34b07d97fa284ba3af37403b5175e23163e7611f | a6e6cb77b1bf94212dd9acb42289ba9a60128426 | /src/main/java/desingPattrens/Behavioural/Visitor/saglikBakanligi/EnumHastaDurumu.java | 49c0c23b4624e00c85554215cdec1e5eaf6f5bbc | [] | no_license | onyor/JavaDesingPatterns | 582f3889d50dc63ae6abd86e2df619d79bc35e7c | 1d5216ed05281bcc28e772706ad2eecc061cbe14 | refs/heads/master | 2023-02-09T18:24:43.460078 | 2021-01-08T10:04:26 | 2021-01-08T10:04:26 | 275,643,725 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package main.java.desingPattrens.Behavioural.Visitor.saglikBakanligi;
public enum EnumHastaDurumu {
EVDE_KARANTINA,
ZATURRE,
AGIR_HASTA,
OLUM,
IYILESTI
;
}
| [
"[email protected]"
] | |
49d94ac8c67a9952d3f73bb3accdd6fb9f9df045 | 490d0b07be411e1d69dd27ea183165ecba6fa02e | /src/RoomCalc.java | a95c9c91d8f13a9ab0bed80ff501f9a3bc07ebd1 | [] | no_license | wdonaldson2/Lab1RoomCalc | e65d89af34a12ce85eda1a53293d7a498ddc9d13 | 354c207481ea38cdae6bd2914b231b567fe4b37f | refs/heads/master | 2020-12-31T00:52:53.148136 | 2017-01-31T22:20:24 | 2017-01-31T22:20:24 | 80,556,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | import java.util.Scanner;
/**
* Created by williamdonaldson on 1/30/17.
*/
public class RoomCalc {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int choose = 1;
while (choose == 1) {
System.out.println(" Enter length ");
double length = scan.nextDouble();
System.out.println(" Enter Width ");
double width = scan.nextDouble();
double area = (length * width);
System.out.println("Area: " + length * width);
System.out.println("Perimeter: " + (length * 2 + width * 2));
System.out.println("Continue? enter 1 for yes or 2 for no");
choose = scan.nextInt();
}
}
}
| [
"[email protected]"
] | |
11de4d3f85272a66b669552fdb3d1368bbd49204 | 2afabc45655ef55a88fed473837220214e0ed88a | /src/main/java/com/interfacetest/Demo1.java | a0c9bd44d02d6c93e4904db2f944676b12da3639 | [] | no_license | ahuazhu/learn | 117c1095aed5d4871b346b9fdeea3c7d0e06e9ee | 83d596c6adaabad2f7968b60cac808ea81d0beeb | refs/heads/master | 2021-07-13T05:00:36.823737 | 2019-11-15T13:48:34 | 2019-11-15T13:48:34 | 213,590,039 | 0 | 0 | null | 2020-10-13T17:04:02 | 2019-10-08T08:34:53 | Java | UTF-8 | Java | false | false | 192 | java | package com.interfacetest;
public abstract class Demo1 {
abstract void doit();
public static void main(String[] args) {
/*Demo1 d=new Demo1() ;*///不可以实例化
}
}
| [
"[email protected]"
] | |
827151916ed0b21613cbec004df9f222cfb901ee | dbd41aeff22f385c8b2663ebec05605111ba6044 | /src/test/java/com/capgemini/olx/olx/loginService/loginServiceTest.java | 3281705e9d0265f3edf0c3720429431e71b87b1f | [] | no_license | rakesh983545/olxmongodb | 0f89940fa47c438c22e5db20de5e299374f2bce5 | 0a63c78fdcb35986c5982aefdeecfb4e450dde67 | refs/heads/master | 2020-03-30T08:50:03.343771 | 2018-10-01T06:05:23 | 2018-10-01T06:05:23 | 151,043,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,225 | java | package com.capgemini.olx.olx.loginService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import static org.junit.Assert.assertEquals;
import org.junit.Assert;
import com.capgemini.olx.olx.LoginRepository.LoginRepository;
import com.capgemini.olx.olx.LoginService.LoginService;
import com.capgemini.olx.olx.loginpojo.LoginPojo;
//import junit.framework.Assert;
@RunWith(MockitoJUnitRunner.class)
public class loginServiceTest {
@Mock
LoginRepository loginrepository;
@InjectMocks
LoginService loginservice;
@Test
public void ByEmail1()
{
LoginPojo loginpojo=new LoginPojo();
loginpojo.setEmailId("[email protected]");
Mockito.when(loginrepository.findByEmailId("[email protected]")).thenReturn(loginpojo);
assertEquals(loginservice.findByEmailId("[email protected]").getEmailId(),"[email protected]");
}
public void ByPhone1()
{
LoginPojo loginpojo2=new LoginPojo();
loginpojo2.setPhoneNo("9845");
Mockito.when(loginrepository.findByPhoneNo("9845")).thenReturn(loginpojo2);
assertEquals(loginservice.findByPhoneNo("9845").getPhoneNo(),"9845");
}
}
| [
"[email protected]"
] | |
d00141a60ab62eaf6e784a912fd99794b82cc9c1 | e669c1de91c433267b5b30c5adadd75c7022c4c5 | /src/main/java/com/eproject/util/corosFilter.java | 87c61ecf66959dc725814d0449354a893931ddfa | [] | no_license | NoAfraid/eproject | fd6248b3ce4ad06033b6a03fc632d1aef7207d7c | bd942e56b512691df716c619f7e346c822413b4e | refs/heads/master | 2023-03-07T06:54:04.226896 | 2020-05-30T07:59:49 | 2020-05-30T07:59:49 | 248,021,064 | 0 | 0 | null | 2023-02-22T08:28:23 | 2020-03-17T16:37:13 | JavaScript | UTF-8 | Java | false | false | 57 | java | package com.eproject.util;
public class corosFilter {
}
| [
"[email protected]"
] | |
b11001c1bc37d72689a6021c0ef7621e78a6739c | 7f785360d78bb5bb91c50e788c0ad6f3081741f2 | /results/Nopol+UnsatGuided/EvoSuite Tests/Math/Math105/seed83/generatedTests/org/apache/commons/math/stat/regression/SimpleRegression_ESTest.java | 3e72c8bb9d8be3410a26fcfd135663b254e54692 | [] | no_license | Spirals-Team/test4repair-experiments | 390a65cca4e2c0d3099423becfdc47bae582c406 | 5bf4dabf0ccf941d4c4053b6a0909f106efa24b5 | refs/heads/master | 2021-01-13T09:47:18.746481 | 2020-01-27T03:26:15 | 2020-01-27T03:26:15 | 69,664,991 | 5 | 6 | null | 2020-10-13T05:57:11 | 2016-09-30T12:28:13 | Java | UTF-8 | Java | false | false | 19,151 | java | /*
* This file was automatically generated by EvoSuite
* Tue Jan 24 16:46:04 GMT 2017
*/
package org.apache.commons.math.stat.regression;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math.stat.regression.SimpleRegression;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class SimpleRegression_ESTest extends SimpleRegression_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData((double) 0L, 220884.1911311759);
simpleRegression0.addData(3.399464998481189E-5, (double) 0L);
double double0 = simpleRegression0.getRegressionSumSquares();
assertEquals(2.4394912945836926E10, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(2.4394912945836926E10, double0, 0.01);
}
@Test(timeout = 4000)
public void test01() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.getSlopeConfidenceInterval((-268.21115));
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test02() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.getSlopeConfidenceInterval(1.0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test03() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
double[] doubleArray1 = new double[4];
doubleArray1[0] = 2531.4396875;
doubleArray0[0] = doubleArray1;
simpleRegression0.addData(doubleArray0);
// Undeclared exception!
try {
simpleRegression0.getSlopeConfidenceInterval();
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// degrees of freedom must be positive.
//
verifyException("org.apache.commons.math.distribution.TDistributionImpl", e);
}
}
@Test(timeout = 4000)
public void test04() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(78.30207, 78.30207);
simpleRegression0.addData(Double.NaN, 0.0);
double double0 = simpleRegression0.getRSquare();
assertEquals(2L, simpleRegression0.getN());
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test05() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(2892.439135399, 0.0);
simpleRegression0.addData(0.0, 0.0);
double double0 = simpleRegression0.predict(0.0);
assertEquals(0.0, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(1345.2417413968503, (-0.5207483570379722));
simpleRegression0.addData(0.0, 1.0);
double double0 = simpleRegression0.predict(1345.2417413968503);
assertEquals(2L, simpleRegression0.getN());
assertEquals((-0.5207483570379721), double0, 0.01);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[8][8];
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getSlopeConfidenceInterval(Double.NaN);
assertEquals(0.0, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
double[] doubleArray1 = new double[4];
doubleArray1[0] = 2531.4396875;
simpleRegression0.addData(doubleArray0);
doubleArray0[0] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getSlopeConfidenceInterval();
assertEquals(0.0, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test09() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(2892.439135399, 2892.439135399);
simpleRegression0.addData(2892.439135399, 0.0);
simpleRegression0.addData(2892.439135399, 0.0);
double double0 = simpleRegression0.getSlopeConfidenceInterval();
assertEquals(5577469.434658476, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test10() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
double[] doubleArray1 = new double[4];
doubleArray1[0] = 2531.4396875;
doubleArray1[1] = (-1903.4809226034467);
doubleArray0[0] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getSlope();
assertEquals(2L, simpleRegression0.getN());
assertEquals((-0.7519361144579696), double0, 0.01);
}
@Test(timeout = 4000)
public void test11() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(1345.2417413968503, (-0.5207483570379722));
simpleRegression0.addData(0.0, 1.0);
simpleRegression0.addData(1345.2417413968503, (-0.5207483570379722));
double double0 = simpleRegression0.getSignificance();
assertEquals(3L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test12() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(0.0, 3398.991202186862);
long long0 = simpleRegression0.getN();
assertEquals(1L, long0);
}
@Test(timeout = 4000)
public void test13() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
double[] doubleArray1 = new double[4];
doubleArray1[0] = 2531.4396875;
simpleRegression0.addData(doubleArray0);
doubleArray0[0] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getInterceptStdErr();
assertEquals(4L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test14() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(1346.0, 0.0);
simpleRegression0.addData(0.0, 0.0);
double double0 = simpleRegression0.getIntercept();
assertEquals(2L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test15() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(1346.0, (-10.737265803283371));
simpleRegression0.addData(0.0, (-17.73333872138714));
double double0 = simpleRegression0.getIntercept();
assertEquals(2L, simpleRegression0.getN());
assertEquals((-17.73333872138714), double0, 0.01);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.addData((double[][]) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test17() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[6][0];
// Undeclared exception!
try {
simpleRegression0.addData(doubleArray0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 0
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test18() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData(2892.439135399, 0.0);
simpleRegression0.addData(2892.439135399, 0.0);
simpleRegression0.addData(0.0, 0.0);
double double0 = simpleRegression0.getMeanSquareError();
assertEquals(0.0, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test19() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double double0 = simpleRegression0.getMeanSquareError();
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(Double.NaN, double0, 0.01);
assertEquals(0L, simpleRegression0.getN());
}
@Test(timeout = 4000)
public void test20() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double double0 = simpleRegression0.getTotalSumSquares();
assertEquals(Double.NaN, double0, 0.01);
assertEquals(0L, simpleRegression0.getN());
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
}
@Test(timeout = 4000)
public void test21() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[5][1];
double[] doubleArray1 = new double[7];
doubleArray0[0] = doubleArray1;
doubleArray0[1] = doubleArray1;
doubleArray0[2] = doubleArray0[1];
doubleArray0[3] = doubleArray0[0];
doubleArray0[4] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getTotalSumSquares();
assertEquals(5L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test22() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
double[] doubleArray1 = new double[4];
doubleArray1[0] = 2531.4396875;
doubleArray0[0] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getSlope();
assertEquals(2L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test23() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[2][3];
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getSlope();
assertEquals(2L, simpleRegression0.getN());
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test24() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double double0 = simpleRegression0.getSlope();
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(Double.NaN, double0, 0.01);
assertEquals(0L, simpleRegression0.getN());
}
@Test(timeout = 4000)
public void test25() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.addData((-614.19), (-614.19));
simpleRegression0.addData(1.0070914731776513E7, 1.0070914731776513E7);
double double0 = simpleRegression0.getSumSquaredErrors();
assertEquals(2L, simpleRegression0.getN());
assertEquals(0.0, double0, 0.01);
}
@Test(timeout = 4000)
public void test26() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double double0 = simpleRegression0.getSlopeStdErr();
assertEquals(Double.NaN, simpleRegression0.getMeanSquareError(), 0.01);
assertEquals(0L, simpleRegression0.getN());
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test27() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double double0 = simpleRegression0.getSumSquaredErrors();
assertEquals(Double.NaN, double0, 0.01);
assertEquals(0L, simpleRegression0.getN());
}
@Test(timeout = 4000)
public void test28() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.getSlopeConfidenceInterval(0.0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test29() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.getSlopeConfidenceInterval(947.4);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.math.stat.regression.SimpleRegression", e);
}
}
@Test(timeout = 4000)
public void test30() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[4][4];
double[] doubleArray1 = new double[5];
doubleArray1[1] = 1867.7897354858055;
doubleArray0[1] = doubleArray1;
double[] doubleArray2 = new double[9];
doubleArray2[0] = 2731.041767;
doubleArray0[3] = doubleArray2;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getR();
assertEquals(4L, simpleRegression0.getN());
assertEquals((-0.33333333333333337), double0, 0.01);
}
@Test(timeout = 4000)
public void test31() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[4][4];
double[] doubleArray1 = new double[9];
doubleArray1[0] = 2731.041767;
doubleArray0[3] = doubleArray1;
simpleRegression0.addData(doubleArray0);
double double0 = simpleRegression0.getR();
assertEquals(4L, simpleRegression0.getN());
assertEquals(Double.NaN, double0, 0.01);
}
@Test(timeout = 4000)
public void test32() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
double[][] doubleArray0 = new double[4][4];
simpleRegression0.addData(doubleArray0);
simpleRegression0.getSignificance();
assertEquals(0.0, simpleRegression0.getTotalSumSquares(), 0.01);
}
@Test(timeout = 4000)
public void test33() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.getInterceptStdErr();
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(0L, simpleRegression0.getN());
assertEquals(Double.NaN, simpleRegression0.getMeanSquareError(), 0.01);
}
@Test(timeout = 4000)
public void test34() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
long long0 = simpleRegression0.getN();
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(0L, long0);
}
@Test(timeout = 4000)
public void test35() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.clear();
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(0L, simpleRegression0.getN());
}
@Test(timeout = 4000)
public void test36() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.predict(1346.0);
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(0L, simpleRegression0.getN());
assertEquals(Double.NaN, simpleRegression0.getSlope(), 0.01);
}
@Test(timeout = 4000)
public void test37() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.getR();
assertEquals(Double.NaN, simpleRegression0.getRegressionSumSquares(), 0.01);
assertEquals(Double.NaN, simpleRegression0.getTotalSumSquares(), 0.01);
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
assertEquals(0L, simpleRegression0.getN());
}
@Test(timeout = 4000)
public void test38() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
// Undeclared exception!
try {
simpleRegression0.getSignificance();
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// degrees of freedom must be positive.
//
verifyException("org.apache.commons.math.distribution.TDistributionImpl", e);
}
}
@Test(timeout = 4000)
public void test39() throws Throwable {
SimpleRegression simpleRegression0 = new SimpleRegression();
simpleRegression0.getIntercept();
assertEquals(0L, simpleRegression0.getN());
assertEquals(Double.NaN, simpleRegression0.getSlope(), 0.01);
assertEquals(Double.NaN, simpleRegression0.getSumSquaredErrors(), 0.01);
}
}
| [
"[email protected]"
] | |
483553a5d31a3478beeccc87fd51106bec78a337 | 1e99cd862b37119e550a245c0f374b8b82b7cb36 | /data/src/main/java/com/example/data/note/repository/source/preference/PreferenceNoteEntityData.java | e21256fd53f602fff9e7fd8185d884bead0b5215 | [] | no_license | dendy-senapartha/MVPCleanApp | 40529c3dbf2bbb3a19702c5bbe121d773c5c22f7 | 3246f948ac47b2037d645692f1fef6766ac91251 | refs/heads/master | 2020-04-09T07:12:19.918306 | 2019-04-02T07:24:19 | 2019-04-02T07:24:19 | 160,145,333 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,805 | java | package com.example.data.note.repository.source.preference;
import android.text.TextUtils;
import com.example.data.base.UnInitializedSecuredPreferencesException;
import com.example.data.note.repository.source.NoteEntityData;
import com.example.data.note.repository.source.preference.response.NoteResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import io.reactivex.Observable;
import io.reactivex.functions.Function;
public class PreferenceNoteEntityData implements NoteEntityData{
private final NotePreferences notePreferences;
public PreferenceNoteEntityData(NotePreferences notePreferences) {
this.notePreferences = notePreferences;
}
@Override
public Observable<Boolean> init(String key) {
return initObservable(() -> {
notePreferences.init(key);
return true;
});
}
@Override
public Observable<String> refreshNotes() {
return null;
}
@Override
public Observable<List<NoteResponse>> getNotes() {
return initObservable(() -> {
return notePreferences.getNotes();
});
}
@Override
public Observable<NoteResponse> saveNote(String mid, String mTitle,String mDescription) {
return initObservable(()->{
//save the note and reselect it as confirmation of success
notePreferences.saveNote(mid, mTitle,mDescription);
return notePreferences.getNote(mid);
});
}
@Override
public Observable<NoteResponse> getNote(String taskId) {
return initObservable(() -> {
return notePreferences.getNote(taskId);
});
}
@Override
public Observable<ArrayList<String>> deleteNote(ArrayList<String> mid) {
return initObservable(()->{
return notePreferences.deleteNote(mid);
});
}
private <T> Observable<T> initObservable(Callable<T> callable) {
return initializedRequest(Observable.fromCallable(callable));
}
private <T> Observable<T> initializedRequest(Observable<T> observable) {
return observable.onErrorResumeNext(initAndRetry(observable));
}
private <T> Function<Throwable, ? extends Observable<? extends T>>
initAndRetry(final Observable<T> resumedObservable) {
return (Function<Throwable, Observable<? extends T>>) throwable -> {
if (throwable instanceof UnInitializedSecuredPreferencesException) {
String userId = "MyNote";//CommonUtil.getUserId(securityGuardFacade, null);
if (!TextUtils.isEmpty(userId)) {
return init(userId).concatMap(aBoolean -> resumedObservable);
}
}
return Observable.error(throwable);
};
}
}
| [
"wb-ikadekden434525"
] | wb-ikadekden434525 |
430ad831fd1103f145239f267411b85584da69cf | 78cc0db2b28aa7aa108791b8ca9b25315b606eea | /20200929_DateValidator/src/de/telran/Main.java | be7838a9521f0a451a0bfc44e1e45c5d3678a9f2 | [] | no_license | LeSitar/TelRan_13M | 3466dca7b909d246b0939755909576534a6a52ff | 196cc4186ed66b59d93531bc384afbce900485d1 | refs/heads/master | 2023-01-04T04:59:04.087720 | 2020-10-30T13:51:16 | 2020-10-30T13:51:16 | 293,464,331 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package de.telran;
public class Main {
public static void main(String[] args) {
System.out.println(DataValidator.dateValidator(2019, 7 , 28));
System.out.println(DataValidator.dateValidator(2020, 2 , 29));
}
}
| [
"[email protected]"
] | |
21ea771957e1e92ec239d887df64779f61a4f243 | 0a57b2210091f65cc99eda61b936af0421ad1666 | /Servlet&HTTP&Request/src/servlet/ServletDemo6.java | 66222be0a6dd97ff1b7c96b04b1bb3c974bba356 | [] | no_license | lxf-00/JavaWeb | 592885765f0c43cfc77be97a2c57c46a45896025 | 802a57e6076296c288a34d5a032fc2629f72945f | refs/heads/master | 2022-07-11T21:26:13.809965 | 2020-05-26T06:56:44 | 2020-05-26T06:56:44 | 243,445,122 | 0 | 0 | null | 2022-06-21T03:08:14 | 2020-02-27T06:12:55 | Java | UTF-8 | Java | false | false | 1,172 | java | package servlet;
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;
import java.io.IOException;
/**
* Request 设置编码流
* 转发资源
* 存储资源
*/
@WebServlet("/requestDemo6")
public class ServletDemo6 extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 设置编码
req.setCharacterEncoding("utf-8");
// 转发资源访问
System.out.println("requestDemo6 被访问.....");
/*RequestDispatcher requestDispatcher = req.getRequestDispatcher("/requestDemo5");
requestDispatcher.forward(req, resp);*/
// 存储数据到request 域中
req.setAttribute("msg", "hello");
req.getRequestDispatcher("/requestDemo5").forward(req, resp);
}
}
| [
"[email protected]"
] | |
535d1d7fcff8f981e3189bcc5482cf2af1fe1bfd | 20ab305409120f5b5441023f754435b4d1938748 | /src/main/java/org/blockartistry/mod/ThermalRecycling/data/ScrapHandler.java | f59b361bf7ecd3d1afecf4c59088a7f043b89961 | [
"MIT"
] | permissive | WeCodingNow/ThermalRecycling | 360b7f152324856856bde414500686e7eb2f206c | c0b2cbe652e580aa4d563540350b96ba6e27d5dc | refs/heads/master | 2021-05-28T15:24:28.814563 | 2015-05-15T22:46:48 | 2015-05-15T22:46:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,799 | java | /*
* This file is part of ThermalRecycling, licensed under the MIT License (MIT).
*
* Copyright (c) OreCruncher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.blockartistry.mod.ThermalRecycling.data;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;
import org.blockartistry.mod.ThermalRecycling.data.handlers.GenericHandler;
import org.blockartistry.mod.ThermalRecycling.machines.ProcessingCorePolicy;
import org.blockartistry.mod.ThermalRecycling.util.ItemStackHelper;
import org.blockartistry.mod.ThermalRecycling.util.ItemStackWeightTable;
import org.blockartistry.mod.ThermalRecycling.util.MyComparators;
import org.blockartistry.mod.ThermalRecycling.util.ItemStackWeightTable.ItemStackItem;
import com.google.common.base.Preconditions;
import net.minecraft.item.ItemStack;
/**
* Base class from which all scrap handlers are created. Handlers are used by
* the scrapping system to better fine tune how a mod wants to scrap their
* items. Handlers are registered during plugin startup and will be used once
* the mod is up and running.
*
*/
public abstract class ScrapHandler {
public class PreviewResult {
public final ItemStack inputRequired;
public final List<ItemStack> outputGenerated;
protected PreviewResult(ItemStack input, List<ItemStack> output) {
this.inputRequired = input;
this.outputGenerated = output;
}
}
static final TreeMap<ItemStack, ScrapHandler> handlers = new TreeMap<ItemStack, ScrapHandler>(
MyComparators.itemStackAscending);
public static final ScrapHandler generic = new GenericHandler();
public static void registerHandler(ItemStack stack, ScrapHandler handler) {
Preconditions.checkNotNull(stack);
Preconditions.checkNotNull(handler);
handlers.put(stack.copy(), handler);
}
public static ScrapHandler getHandler(ItemStack stack) {
ScrapHandler handler = handlers.get(stack);
if (handler == null)
handler = handlers.get(ItemStackHelper.asGeneric(stack));
return handler == null ? generic : handler;
}
/**
* Scraps the incoming item based on the implementation of the scrap
* handler.
*
* @param core
* Processing core that is being applied, if any
* @param stack
* The ItemStack that is being scrapped
* @param preview
* The call is to generate a preview of what is to happen
* @return A list of parts that are created by scrapping
*/
public abstract List<ItemStack> scrapItems(ItemStack core, ItemStack stack);
protected List<ItemStack> getRecipeOutput(ItemStack stack) {
return RecipeData.getRecipe(stack);
}
protected int getRecipeInputQuantity(ItemStack stack) {
return RecipeData.getMinimumQuantityToRecycle(stack);
}
public PreviewResult preview(ItemStack core, ItemStack stack) {
ItemStack item = stack.copy();
item.stackSize = getRecipeInputQuantity(stack);
List<ItemStack> result = null;
if (ProcessingCorePolicy.isDecompositionCore(core)) {
result = getRecipeOutput(stack);
// If its a decomp core and the item has no recipe, treat as if it
// were being scrapped directly w/o a core it's the best way
// to get scrap yield.
if (result == null)
core = null;
}
if (result == null) {
result = new ArrayList<ItemStack>();
ItemStackWeightTable t = ScrappingTables.getTable(core, stack);
for (ItemStackItem w : t.getEntries()) {
ItemStack temp = w.getStack();
if (temp != null
&& !(ScrappingTables.keepIt(temp) || ScrappingTables
.dustIt(temp))) {
double percent = w.itemWeight * 100F / t.getTotalWeight();
ItemStackHelper.setItemLore(temp,
String.format("%-1.2f%% chance", percent));
result.add(temp);
}
}
}
return new PreviewResult(item, result);
}
}
| [
"[email protected]"
] | |
b458c2fb1a0fd90946494e3243b07fa34df43a68 | 6a977059591a909501236947c8d748ac48ce43ed | /src/main/java/core/Safari.java | f767a38d6ca851e76faf38ac083c67316b15e2a7 | [] | no_license | konstvasiled/FBvalid_HW38 | 1a24beac132bc78a11df7d716824c44a738b314a | 855e920a5417888c7f97efef3ad5ca066b3c556b | refs/heads/master | 2021-05-16T04:01:04.320822 | 2017-10-04T04:26:01 | 2017-10-04T04:26:01 | 105,731,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,582 | java | package core;
import org.openqa.selenium.*;
import org.openqa.selenium.safari.*;
import org.openqa.selenium.support.ui.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.*;
public class Safari {
static WebDriver driver;
public static void main(String[] args) throws InterruptedException {
Logger.getLogger("").setLevel(Level.OFF);
String url = "https://www.facebook.com/login/";
String email_add = "[email protected]";
String password = "";
if (!System.getProperty("os.name").toUpperCase().contains("MAC")) {
throw new IllegalArgumentException("Safari is only available on Mac");
}
driver = new SafariDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebDriverWait delay = new WebDriverWait(driver, 15);
driver.get(url);
String title = driver.getTitle();
String copyright = delay.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='pageFooter']/div[3]/div/span"))).getText();
delay.until(ExpectedConditions.presenceOfElementLocated(By.id("email"))).clear();
delay.until(ExpectedConditions.presenceOfElementLocated(By.id("email"))).sendKeys(email_add);
delay.until(ExpectedConditions.presenceOfElementLocated(By.id("pass"))).clear();
delay.until(ExpectedConditions.presenceOfElementLocated(By.id("pass"))).sendKeys(password);
delay.until(ExpectedConditions.presenceOfElementLocated(By.id("loginbutton"))).click();
delay.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id='u_0_b']/div[1]/div[1]/div/a/span/span"))).click();
String friendcount = driver.findElement(By.xpath("//li[3]/a/span[1]")).getText();
while (friendcount == null) {
friendcount = delay.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[2]/ul/li[3]/a/span[1]"))).getText(); }
WebElement settings = driver.findElement(By.id("userNavigationLabel"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", settings);
WebElement logout = driver.findElement(By.xpath("//li[14]/a/span/span"));
((JavascriptExecutor) driver).executeScript("arguments[0].click();", logout);
driver.quit();
System.out.println("Your browser is Safari");
System.out.println("Page title is: " + title);
System.out.println("Copyright:" + copyright);
System.out.println("You have " + friendcount + " friends.");
}
}
| [
"[email protected]"
] | |
674137e7223161b80897ee9406f00c627503549d | 4be2623b3cc95e039f214f2ad8d9fc14fa404ee9 | /src/thread/synchronizedBlock/SyncBlockDemo.java | 6326e044665eba54db9df036da61ebfb0015c544 | [] | no_license | maainul/Java | df6364f57e5c4cdca3ff83894b633f19197b541e | 81681c9f48946b07c4f839f1db6d9953fe47a9df | refs/heads/master | 2023-04-26T22:13:27.395026 | 2021-04-29T20:47:41 | 2021-04-29T20:47:41 | 229,538,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 796 | java | package thread.synchronizedBlock;
class Display{
public void wish(String name) {
// 1 lack of code
synchronized (this) {
for (int i = 0; i < 10; i++) {
System.out.println("Good Morning..."+ name);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
System.out.println(name);
}
}
}
// 1 lack of code
}
}
class MyThread extends Thread{
Display d;
String name;
public MyThread(Display d, String name) {
this.d = d;
this.name = name;
}
@Override public void run() {
d.wish(name);
}
}
public class SyncBlockDemo {
public static void main(String[] args) {
MyThread thread1 = new MyThread(new Display(), "Dhoni");
thread1.start();
MyThread thread2 = new MyThread(new Display(), "Yuvraj");
thread2.start();
}
}
| [
"[email protected]"
] | |
0fa89d0bb75b5dacc49838c6f3aeea973f4ee051 | 8d9e7596f8680dfbe3272389058b6e85ef8e0bf7 | /src/test/java/com/ragul/springbootmongodemo/SpringBootMongoDemoApplicationTests.java | cb3050a5d3035ec76c33d402804efe14315220ff | [] | no_license | ragulan28/spring-boot-mongo-hotel-demo | f81d7219e43218d9331ae0adaefe5526dba32598 | 440787f349dedd4e9e7b9676094e2d0781b6466e | refs/heads/master | 2020-03-27T17:42:24.465602 | 2018-08-31T09:02:54 | 2018-08-31T09:02:54 | 146,853,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.ragul.springbootmongodemo;
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 SpringBootMongoDemoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
9115c7f684c199bf658bb91830ecc4cfe6c3a2b2 | 9ab5bdb918b886f1f2d09d81efb63ff83a86bfb0 | /frontend/src/main/java/com/jdt/fedlearn/frontend/controller/ForwardController.java | dd157b112177ef669f73036f268d467032bb6645 | [
"Apache-2.0"
] | permissive | BestJex/fedlearn | 75a795ec51c4a37af34886c551874df419da3a9c | 15395f77ac3ddd983ae3affb1c1a9367287cc125 | refs/heads/master | 2023-06-17T01:27:36.143351 | 2021-07-19T10:43:09 | 2021-07-19T10:43:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,419 | java | /* Copyright 2020 The FedLearn Authors. 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.jdt.fedlearn.frontend.controller;
import com.jdt.fedlearn.common.util.FileUtil;
import com.jdt.fedlearn.common.util.HttpClientUtil;
import com.jdt.fedlearn.common.util.JsonUtil;
import com.jdt.fedlearn.frontend.exception.NotAcceptableException;
import com.jdt.fedlearn.frontend.jdchain.config.JdChainFalseCondition;
import com.jdt.fedlearn.frontend.mapper.entity.Account;
import com.jdt.fedlearn.frontend.mapper.entity.Merchant;
import com.jdt.fedlearn.frontend.service.AccountService;
import com.jdt.fedlearn.frontend.service.MerchantService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Conditional;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* Controller类
*/
@Conditional(JdChainFalseCondition.class)
@RestController
@RequestMapping("api")
public class ForwardController {
@Value("${baseUrl}")
private String baseUrl;
@Resource
AccountService accountService;
@Resource
MerchantService merchantService;
/**
* 任务列表,根据参数返回多种任务列表
*
* @param request 请求
* @return ResponseEntity<Map>
*/
private static final String USERNAME = "username";
private static final String LIST_PATH = "list";
@RequestMapping(value = "task/{subPath}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> taskProcess(@PathVariable String subPath, @Validated @RequestBody ModelMap request) {
String username = (String) request.get(USERNAME);
Account account = accountService.queryAccount(username);
if(account != null){
request.put("merCode",account.getMerCode());
}
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "task/" + subPath, request);
ModelMap res = JsonUtil.parseJson(modelMap);
/* merCode 转换 name*/
if(LIST_PATH.equals(subPath)){
codeConvertName(res);
}
return ResponseEntity.status(HttpStatus.OK).body(res);
}
private static final String QUERY_PARAMETER = "prepare/parameter/system";
/**
* 用于系统超参数,比如支持哪些模型,加密算法选项等
*
* @return ResponseEntity<Map>
*/
@RequestMapping(value = QUERY_PARAMETER, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> fetchSuperParameter() {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + QUERY_PARAMETER, null);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
private static final String ALGORITHM_PARAMETER = "prepare/parameter/algorithm";
/**
* 获取算法参数
*
* @param request 请求
* @return ResponseEntity<Map>
*/
@RequestMapping(value = "prepare/parameter/algorithm", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> algorithmParameter(@Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + ALGORITHM_PARAMETER, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
private static final String COMMON_PARAMETER = "prepare/parameter/common";
/**
* 获取通用参数
*
* @return ResponseEntity<Map>
*/
@RequestMapping(value = COMMON_PARAMETER, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> commonParameter() {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + COMMON_PARAMETER, null);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* id对齐接口
*
* @return ResponseEntity<Map>
*/
@RequestMapping(value = "prepare/match/{subPath}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> idMatch(@PathVariable String subPath, @Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "prepare/match/" + subPath, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* 训练相关
*
* @param request 请求
* @return ResponseEntity<Map>
*/
@RequestMapping(value = "train/{subPath}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> startTask(@PathVariable String subPath, @Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "train/" + subPath, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* 运行中任务查询
*
* @param request 请求
* @return ResponseEntity<Map>
*/
private static final String TRAIN_PROGRESS = "train/progress/new";
@RequestMapping(value = TRAIN_PROGRESS, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> runningTask(@Validated @RequestBody ModelMap request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + TRAIN_PROGRESS, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* @param request
* @className ForwardController
* @description:
* @return: org.springframework.http.ResponseEntity<org.springframework.ui.ModelMap>
* @author: geyan29
* @date: 2020/12/2 19:04
*/
@RequestMapping(value = "train/list/new", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> queryTrainList(@Validated @RequestBody ModelMap request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "train/list/new", request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* 预测
*
* @param request 请求
* @return ResponseEntity<Map>
*/
private static final String INFERENCE_BATCH = "inference/batch";
@RequestMapping(value = INFERENCE_BATCH, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> predict(@Validated @RequestBody ModelMap request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + INFERENCE_BATCH, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
private static final String INFERENCE_PROGRESS = "inference/progress";
/**
* 预测进度查询
*
* @param request 请求
* @return ResponseEntity<Map>
* @throws IllegalStateException 1
*/
@RequestMapping(value = INFERENCE_PROGRESS, method = RequestMethod.POST)
public ResponseEntity<ModelMap> predictQuery(@Validated @RequestBody Map<String, Object> request) throws IllegalStateException {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + INFERENCE_PROGRESS, null);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
private static final String INFERENCE_REMOTE = "inference/remote";
/**
* 批量远端推测
*
* @param request 请求
* @return ResponseEntity<Map>
*/
@RequestMapping(value = INFERENCE_REMOTE, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> predictRemote(@Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + INFERENCE_REMOTE, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* 预测文件上传和结果下载
*
* @param file 文件
* @param model 模型
*/
@RequestMapping(value = "inference/download", method = RequestMethod.POST)
public void predictUpload(@RequestParam("file") MultipartFile file, String model, String username, HttpServletResponse response)
throws IllegalStateException, IOException {
// 读取文件
List<String> content = FileUtil.getBodyData(file.getInputStream());
List<String> uidList = FileUtil.readFirstColumn(content);
// 调用预测接口
Map<String, Object> request = new HashMap<>();
request.put("uid", uidList);
request.put("model", model);
request.put("username", username);
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "inference/batch", request);
ModelMap predictMap = JsonUtil.parseJson(modelMap);
final Integer code = (Integer) predictMap.get("code");
if (code != 0) {
throw new NotAcceptableException("调用接口失败");
}
final Map<String, List<Map<String, Object>>> data = (Map<String, List<Map<String, Object>>>) predictMap.get("data");
final List<Map<String, Object>> resultData = data.get("predict");
String lines = FileUtil.list2Lines(resultData);
// 文件下载
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition", "attachment; filename=predict.txt");
OutputStream outputStream = response.getOutputStream();
final byte[] bytes = lines.getBytes(StandardCharsets.UTF_8);
outputStream.write(bytes, 0, bytes.length);
outputStream.flush();
}
//日志查询
private static final String INFERENCE_LOG = "inference/query/log";
@RequestMapping(value = INFERENCE_LOG, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> queryInferenceLog(@Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + INFERENCE_LOG, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
//日志查询
@RequestMapping(value = "system/query/dataset", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> queryDataset(@Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + "system/query/dataset", request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/**
* 已训练完成的模型查询
*
* @param request 请求
* @return ResponseEntity<Map>
*/
private static final String QUERY_MODEL = "inference/query/model";
@RequestMapping(value = QUERY_MODEL, method = RequestMethod.POST, produces = "application/json; charset=utf-8")
@ResponseBody
public ResponseEntity<ModelMap> fetchModel(@Validated @RequestBody Map<String, Object> request) {
String modelMap = HttpClientUtil.doHttpPost(baseUrl + QUERY_MODEL, request);
ModelMap res = JsonUtil.parseJson(modelMap);
return ResponseEntity.status(HttpStatus.OK).body(res);
}
/***
* @description: 将企业编码转换为企业名称用于页面展示
* @param res
* @return: void
* @author: geyan29
* @date: 2021/3/17 2:36 下午
*/
private static final String DATA = "data";
private static final String TASK_LIST = "taskList";
private static final String COMMA = ",";
private static final String VISIBLE_MER_CODE = "visibleMerCode";
private static final String VISIBLE_MER_NAME = "visibleMerName";
private void codeConvertName(ModelMap res) {
Map date = (Map) res.get(DATA);
List<Map> taskList = (List) date.get(TASK_LIST);
if(taskList != null && taskList.size() >0){
for(int i=0 ; i<taskList.size() ;i++){
String codes = (String) taskList.get(i).get(VISIBLE_MER_CODE);
if(!StringUtils.isEmpty(codes)){
String[] codeArr = codes.split(COMMA);
StringBuffer stringBuffer = new StringBuffer();
for(int j =0;j<codeArr.length;j++){
Merchant merchant = merchantService.queryMerchantByCode(codeArr[j]);
String merchantName = merchant.getName();
if(j == codeArr.length -1){
stringBuffer.append(merchantName);
}else {
stringBuffer.append(merchantName).append(COMMA);
}
}
taskList.get(i).put(VISIBLE_MER_NAME,stringBuffer.toString());
}
}
}
}
}
| [
"[email protected]"
] | |
e9763027e55aa839895733e11f1a2d7b6a5dc09f | bd52e9e48e8f42ff6c6921cfa45a800bae98a728 | /src/main/java/viewModels/MenuListViewModel.java | a2255c77fa9c0685679d43ce26f0eae529ea502e | [] | no_license | ryanleecode/ui_a2 | f1545dc957824d961b9444fc3ae57323f2c039a8 | e74c50acbf9ff098908a99826c80b72067e04a41 | refs/heads/master | 2021-08-23T06:13:54.943553 | 2017-12-03T20:50:29 | 2017-12-03T20:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package viewModels;
import models.Model;
public class MenuListViewModel implements IViewModel {
private MenuItemViewModel menuItemViewModel;
private Model model;
public MenuListViewModel(Model model) {
this.model = model;
menuItemViewModel = new MenuItemViewModel(model);
}
public MenuItemViewModel getMenuItemViewModel() {
return menuItemViewModel;
}
}
| [
"[email protected]"
] | |
030c72fb3426423da94db6aa660f5d48efce7993 | d71e879b3517cf4fccde29f7bf82cff69856cfcd | /ExtractedJars/Health_com.huawei.health/javafiles/com/google/android/gms/maps/StreetViewPanorama.java | 3421483e01f914d6aa178d94873af1911b0ae208 | [
"MIT"
] | permissive | Andreas237/AndroidPolicyAutomation | b8e949e072d08cf6c6166c3f15c9c63379b8f6ce | c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a | refs/heads/master | 2020-04-10T02:14:08.789751 | 2019-05-16T19:29:11 | 2019-05-16T19:29:11 | 160,739,088 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 29,094 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.google.android.gms.maps;
import android.graphics.Point;
import android.os.RemoteException;
import com.google.android.gms.common.internal.zzac;
import com.google.android.gms.dynamic.zzd;
import com.google.android.gms.maps.internal.IStreetViewPanoramaDelegate;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.RuntimeRemoteException;
import com.google.android.gms.maps.model.StreetViewPanoramaCamera;
import com.google.android.gms.maps.model.StreetViewPanoramaLocation;
import com.google.android.gms.maps.model.StreetViewPanoramaOrientation;
public class StreetViewPanorama
{
public static interface OnStreetViewPanoramaCameraChangeListener
{
public abstract void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetviewpanoramacamera);
}
public static interface OnStreetViewPanoramaChangeListener
{
public abstract void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetviewpanoramalocation);
}
public static interface OnStreetViewPanoramaClickListener
{
public abstract void onStreetViewPanoramaClick(StreetViewPanoramaOrientation streetviewpanoramaorientation);
}
public static interface OnStreetViewPanoramaLongClickListener
{
public abstract void onStreetViewPanoramaLongClick(StreetViewPanoramaOrientation streetviewpanoramaorientation);
}
protected StreetViewPanorama(IStreetViewPanoramaDelegate istreetviewpanoramadelegate)
{
// 0 0:aload_0
// 1 1:invokespecial #31 <Method void Object()>
zzboA = (IStreetViewPanoramaDelegate)zzac.zzw(((Object) (istreetviewpanoramadelegate)));
// 2 4:aload_0
// 3 5:aload_1
// 4 6:invokestatic #37 <Method Object zzac.zzw(Object)>
// 5 9:checkcast #39 <Class IStreetViewPanoramaDelegate>
// 6 12:putfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 7 15:return
}
public void animateTo(StreetViewPanoramaCamera streetviewpanoramacamera, long l)
{
try
{
zzboA.animateTo(streetviewpanoramacamera, l);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:lload_2
// 4 6:invokeinterface #48 <Method void IStreetViewPanoramaDelegate.animateTo(StreetViewPanoramaCamera, long)>
return;
// 5 11:return
}
// Misplaced declaration of an exception variable
catch(StreetViewPanoramaCamera streetviewpanoramacamera)
//* 6 12:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (streetviewpanoramacamera)));
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_1
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
}
public StreetViewPanoramaLocation getLocation()
{
StreetViewPanoramaLocation streetviewpanoramalocation;
try
{
streetviewpanoramalocation = zzboA.getStreetViewPanoramaLocation();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #58 <Method StreetViewPanoramaLocation IStreetViewPanoramaDelegate.getStreetViewPanoramaLocation()>
// 3 9:astore_1
}
//* 4 10:aload_1
//* 5 11:areturn
catch(RemoteException remoteexception)
//* 6 12:astore_1
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_1
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return streetviewpanoramalocation;
}
public StreetViewPanoramaCamera getPanoramaCamera()
{
StreetViewPanoramaCamera streetviewpanoramacamera;
try
{
streetviewpanoramacamera = zzboA.getPanoramaCamera();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #62 <Method StreetViewPanoramaCamera IStreetViewPanoramaDelegate.getPanoramaCamera()>
// 3 9:astore_1
}
//* 4 10:aload_1
//* 5 11:areturn
catch(RemoteException remoteexception)
//* 6 12:astore_1
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_1
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return streetviewpanoramacamera;
}
public boolean isPanningGesturesEnabled()
{
boolean flag;
try
{
flag = zzboA.isPanningGesturesEnabled();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #66 <Method boolean IStreetViewPanoramaDelegate.isPanningGesturesEnabled()>
// 3 9:istore_1
}
//* 4 10:iload_1
//* 5 11:ireturn
catch(RemoteException remoteexception)
//* 6 12:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_2
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return flag;
}
public boolean isStreetNamesEnabled()
{
boolean flag;
try
{
flag = zzboA.isStreetNamesEnabled();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #69 <Method boolean IStreetViewPanoramaDelegate.isStreetNamesEnabled()>
// 3 9:istore_1
}
//* 4 10:iload_1
//* 5 11:ireturn
catch(RemoteException remoteexception)
//* 6 12:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_2
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return flag;
}
public boolean isUserNavigationEnabled()
{
boolean flag;
try
{
flag = zzboA.isUserNavigationEnabled();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #72 <Method boolean IStreetViewPanoramaDelegate.isUserNavigationEnabled()>
// 3 9:istore_1
}
//* 4 10:iload_1
//* 5 11:ireturn
catch(RemoteException remoteexception)
//* 6 12:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_2
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return flag;
}
public boolean isZoomGesturesEnabled()
{
boolean flag;
try
{
flag = zzboA.isZoomGesturesEnabled();
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:invokeinterface #75 <Method boolean IStreetViewPanoramaDelegate.isZoomGesturesEnabled()>
// 3 9:istore_1
}
//* 4 10:iload_1
//* 5 11:ireturn
catch(RemoteException remoteexception)
//* 6 12:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_2
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
return flag;
}
public Point orientationToPoint(StreetViewPanoramaOrientation streetviewpanoramaorientation)
{
try
{
streetviewpanoramaorientation = ((StreetViewPanoramaOrientation) (zzboA.orientationToPoint(streetviewpanoramaorientation)));
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:invokeinterface #80 <Method com.google.android.gms.dynamic.IObjectWrapper IStreetViewPanoramaDelegate.orientationToPoint(StreetViewPanoramaOrientation)>
// 4 10:astore_1
}
//* 5 11:aload_1
//* 6 12:ifnonnull 17
//* 7 15:aconst_null
//* 8 16:areturn
//* 9 17:aload_1
//* 10 18:invokestatic #86 <Method Object zzd.zzF(com.google.android.gms.dynamic.IObjectWrapper)>
//* 11 21:checkcast #88 <Class Point>
//* 12 24:astore_1
//* 13 25:aload_1
//* 14 26:areturn
// Misplaced declaration of an exception variable
catch(StreetViewPanoramaOrientation streetviewpanoramaorientation)
//* 15 27:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (streetviewpanoramaorientation)));
// 16 28:new #50 <Class RuntimeRemoteException>
// 17 31:dup
// 18 32:aload_1
// 19 33:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 20 36:athrow
}
if(streetviewpanoramaorientation == null)
return null;
streetviewpanoramaorientation = ((StreetViewPanoramaOrientation) ((Point)zzd.zzF(((com.google.android.gms.dynamic.IObjectWrapper) (streetviewpanoramaorientation)))));
return ((Point) (streetviewpanoramaorientation));
}
public StreetViewPanoramaOrientation pointToOrientation(Point point)
{
try
{
point = ((Point) (zzboA.pointToOrientation(zzd.zzA(((Object) (point))))));
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:invokestatic #94 <Method com.google.android.gms.dynamic.IObjectWrapper zzd.zzA(Object)>
// 4 8:invokeinterface #97 <Method StreetViewPanoramaOrientation IStreetViewPanoramaDelegate.pointToOrientation(com.google.android.gms.dynamic.IObjectWrapper)>
// 5 13:astore_1
}
//* 6 14:aload_1
//* 7 15:areturn
// Misplaced declaration of an exception variable
catch(Point point)
//* 8 16:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (point)));
// 9 17:new #50 <Class RuntimeRemoteException>
// 10 20:dup
// 11 21:aload_1
// 12 22:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 13 25:athrow
}
return ((StreetViewPanoramaOrientation) (point));
}
public final void setOnStreetViewPanoramaCameraChangeListener(OnStreetViewPanoramaCameraChangeListener onstreetviewpanoramacamerachangelistener)
{
if(onstreetviewpanoramacamerachangelistener == null)
//* 0 0:aload_1
//* 1 1:ifnonnull 17
{
try
{
zzboA.setOnStreetViewPanoramaCameraChangeListener(((com.google.android.gms.maps.internal.zzab) (null)));
// 2 4:aload_0
// 3 5:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 4 8:aconst_null
// 5 9:invokeinterface #102 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaCameraChangeListener(com.google.android.gms.maps.internal.zzab)>
}
//* 6 14:goto 35
//* 7 17:aload_0
//* 8 18:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
//* 9 21:new #8 <Class StreetViewPanorama$2>
//* 10 24:dup
//* 11 25:aload_0
//* 12 26:aload_1
//* 13 27:invokespecial #105 <Method void StreetViewPanorama$2(StreetViewPanorama, StreetViewPanorama$OnStreetViewPanoramaCameraChangeListener)>
//* 14 30:invokeinterface #102 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaCameraChangeListener(com.google.android.gms.maps.internal.zzab)>
//* 15 35:return
// Misplaced declaration of an exception variable
catch(OnStreetViewPanoramaCameraChangeListener onstreetviewpanoramacamerachangelistener)
//* 16 36:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (onstreetviewpanoramacamerachangelistener)));
// 17 37:new #50 <Class RuntimeRemoteException>
// 18 40:dup
// 19 41:aload_1
// 20 42:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 21 45:athrow
}
break MISSING_BLOCK_LABEL_35;
}
zzboA.setOnStreetViewPanoramaCameraChangeListener(((com.google.android.gms.maps.internal.zzab) (new com.google.android.gms.maps.internal.zzab.zza(onstreetviewpanoramacamerachangelistener) {
public void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetviewpanoramacamera)
{
zzboC.onStreetViewPanoramaCameraChange(streetviewpanoramacamera);
// 0 0:aload_0
// 1 1:getfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaCameraChangeListener zzboC>
// 2 4:aload_1
// 3 5:invokeinterface #25 <Method void StreetViewPanorama$OnStreetViewPanoramaCameraChangeListener.onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera)>
// 4 10:return
}
final OnStreetViewPanoramaCameraChangeListener zzboC;
{
zzboC = onstreetviewpanoramacamerachangelistener;
// 0 0:aload_0
// 1 1:aload_2
// 2 2:putfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaCameraChangeListener zzboC>
super();
// 3 5:aload_0
// 4 6:invokespecial #18 <Method void com.google.android.gms.maps.internal.zzab$zza()>
// 5 9:return
}
}
)));
}
public final void setOnStreetViewPanoramaChangeListener(OnStreetViewPanoramaChangeListener onstreetviewpanoramachangelistener)
{
if(onstreetviewpanoramachangelistener == null)
//* 0 0:aload_1
//* 1 1:ifnonnull 17
{
try
{
zzboA.setOnStreetViewPanoramaChangeListener(((com.google.android.gms.maps.internal.zzac) (null)));
// 2 4:aload_0
// 3 5:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 4 8:aconst_null
// 5 9:invokeinterface #110 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaChangeListener(com.google.android.gms.maps.internal.zzac)>
}
//* 6 14:goto 35
//* 7 17:aload_0
//* 8 18:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
//* 9 21:new #6 <Class StreetViewPanorama$1>
//* 10 24:dup
//* 11 25:aload_0
//* 12 26:aload_1
//* 13 27:invokespecial #113 <Method void StreetViewPanorama$1(StreetViewPanorama, StreetViewPanorama$OnStreetViewPanoramaChangeListener)>
//* 14 30:invokeinterface #110 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaChangeListener(com.google.android.gms.maps.internal.zzac)>
//* 15 35:return
// Misplaced declaration of an exception variable
catch(OnStreetViewPanoramaChangeListener onstreetviewpanoramachangelistener)
//* 16 36:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (onstreetviewpanoramachangelistener)));
// 17 37:new #50 <Class RuntimeRemoteException>
// 18 40:dup
// 19 41:aload_1
// 20 42:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 21 45:athrow
}
break MISSING_BLOCK_LABEL_35;
}
zzboA.setOnStreetViewPanoramaChangeListener(((com.google.android.gms.maps.internal.zzac) (new com.google.android.gms.maps.internal.zzac.zza(onstreetviewpanoramachangelistener) {
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetviewpanoramalocation)
{
zzboB.onStreetViewPanoramaChange(streetviewpanoramalocation);
// 0 0:aload_0
// 1 1:getfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaChangeListener zzboB>
// 2 4:aload_1
// 3 5:invokeinterface #25 <Method void StreetViewPanorama$OnStreetViewPanoramaChangeListener.onStreetViewPanoramaChange(StreetViewPanoramaLocation)>
// 4 10:return
}
final OnStreetViewPanoramaChangeListener zzboB;
{
zzboB = onstreetviewpanoramachangelistener;
// 0 0:aload_0
// 1 1:aload_2
// 2 2:putfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaChangeListener zzboB>
super();
// 3 5:aload_0
// 4 6:invokespecial #18 <Method void com.google.android.gms.maps.internal.zzac$zza()>
// 5 9:return
}
}
)));
}
public final void setOnStreetViewPanoramaClickListener(OnStreetViewPanoramaClickListener onstreetviewpanoramaclicklistener)
{
if(onstreetviewpanoramaclicklistener == null)
//* 0 0:aload_1
//* 1 1:ifnonnull 17
{
try
{
zzboA.setOnStreetViewPanoramaClickListener(((com.google.android.gms.maps.internal.zzad) (null)));
// 2 4:aload_0
// 3 5:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 4 8:aconst_null
// 5 9:invokeinterface #118 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaClickListener(com.google.android.gms.maps.internal.zzad)>
}
//* 6 14:goto 35
//* 7 17:aload_0
//* 8 18:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
//* 9 21:new #10 <Class StreetViewPanorama$3>
//* 10 24:dup
//* 11 25:aload_0
//* 12 26:aload_1
//* 13 27:invokespecial #121 <Method void StreetViewPanorama$3(StreetViewPanorama, StreetViewPanorama$OnStreetViewPanoramaClickListener)>
//* 14 30:invokeinterface #118 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaClickListener(com.google.android.gms.maps.internal.zzad)>
//* 15 35:return
// Misplaced declaration of an exception variable
catch(OnStreetViewPanoramaClickListener onstreetviewpanoramaclicklistener)
//* 16 36:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (onstreetviewpanoramaclicklistener)));
// 17 37:new #50 <Class RuntimeRemoteException>
// 18 40:dup
// 19 41:aload_1
// 20 42:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 21 45:athrow
}
break MISSING_BLOCK_LABEL_35;
}
zzboA.setOnStreetViewPanoramaClickListener(((com.google.android.gms.maps.internal.zzad) (new com.google.android.gms.maps.internal.zzad.zza(onstreetviewpanoramaclicklistener) {
public void onStreetViewPanoramaClick(StreetViewPanoramaOrientation streetviewpanoramaorientation)
{
zzboD.onStreetViewPanoramaClick(streetviewpanoramaorientation);
// 0 0:aload_0
// 1 1:getfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaClickListener zzboD>
// 2 4:aload_1
// 3 5:invokeinterface #25 <Method void StreetViewPanorama$OnStreetViewPanoramaClickListener.onStreetViewPanoramaClick(StreetViewPanoramaOrientation)>
// 4 10:return
}
final OnStreetViewPanoramaClickListener zzboD;
{
zzboD = onstreetviewpanoramaclicklistener;
// 0 0:aload_0
// 1 1:aload_2
// 2 2:putfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaClickListener zzboD>
super();
// 3 5:aload_0
// 4 6:invokespecial #18 <Method void com.google.android.gms.maps.internal.zzad$zza()>
// 5 9:return
}
}
)));
}
public final void setOnStreetViewPanoramaLongClickListener(OnStreetViewPanoramaLongClickListener onstreetviewpanoramalongclicklistener)
{
if(onstreetviewpanoramalongclicklistener == null)
//* 0 0:aload_1
//* 1 1:ifnonnull 17
{
try
{
zzboA.setOnStreetViewPanoramaLongClickListener(((com.google.android.gms.maps.internal.zzae) (null)));
// 2 4:aload_0
// 3 5:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 4 8:aconst_null
// 5 9:invokeinterface #126 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaLongClickListener(com.google.android.gms.maps.internal.zzae)>
}
//* 6 14:goto 35
//* 7 17:aload_0
//* 8 18:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
//* 9 21:new #12 <Class StreetViewPanorama$4>
//* 10 24:dup
//* 11 25:aload_0
//* 12 26:aload_1
//* 13 27:invokespecial #129 <Method void StreetViewPanorama$4(StreetViewPanorama, StreetViewPanorama$OnStreetViewPanoramaLongClickListener)>
//* 14 30:invokeinterface #126 <Method void IStreetViewPanoramaDelegate.setOnStreetViewPanoramaLongClickListener(com.google.android.gms.maps.internal.zzae)>
//* 15 35:return
// Misplaced declaration of an exception variable
catch(OnStreetViewPanoramaLongClickListener onstreetviewpanoramalongclicklistener)
//* 16 36:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (onstreetviewpanoramalongclicklistener)));
// 17 37:new #50 <Class RuntimeRemoteException>
// 18 40:dup
// 19 41:aload_1
// 20 42:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 21 45:athrow
}
break MISSING_BLOCK_LABEL_35;
}
zzboA.setOnStreetViewPanoramaLongClickListener(((com.google.android.gms.maps.internal.zzae) (new com.google.android.gms.maps.internal.zzae.zza(onstreetviewpanoramalongclicklistener) {
public void onStreetViewPanoramaLongClick(StreetViewPanoramaOrientation streetviewpanoramaorientation)
{
zzboE.onStreetViewPanoramaLongClick(streetviewpanoramaorientation);
// 0 0:aload_0
// 1 1:getfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaLongClickListener zzboE>
// 2 4:aload_1
// 3 5:invokeinterface #25 <Method void StreetViewPanorama$OnStreetViewPanoramaLongClickListener.onStreetViewPanoramaLongClick(StreetViewPanoramaOrientation)>
// 4 10:return
}
final OnStreetViewPanoramaLongClickListener zzboE;
{
zzboE = onstreetviewpanoramalongclicklistener;
// 0 0:aload_0
// 1 1:aload_2
// 2 2:putfield #15 <Field StreetViewPanorama$OnStreetViewPanoramaLongClickListener zzboE>
super();
// 3 5:aload_0
// 4 6:invokespecial #18 <Method void com.google.android.gms.maps.internal.zzae$zza()>
// 5 9:return
}
}
)));
}
public void setPanningGesturesEnabled(boolean flag)
{
try
{
zzboA.enablePanning(flag);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:iload_1
// 3 5:invokeinterface #134 <Method void IStreetViewPanoramaDelegate.enablePanning(boolean)>
return;
// 4 10:return
}
catch(RemoteException remoteexception)
//* 5 11:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_2
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
public void setPosition(LatLng latlng)
{
try
{
zzboA.setPosition(latlng);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:invokeinterface #138 <Method void IStreetViewPanoramaDelegate.setPosition(LatLng)>
return;
// 4 10:return
}
// Misplaced declaration of an exception variable
catch(LatLng latlng)
//* 5 11:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (latlng)));
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_1
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
public void setPosition(LatLng latlng, int i)
{
try
{
zzboA.setPositionWithRadius(latlng, i);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:iload_2
// 4 6:invokeinterface #142 <Method void IStreetViewPanoramaDelegate.setPositionWithRadius(LatLng, int)>
return;
// 5 11:return
}
// Misplaced declaration of an exception variable
catch(LatLng latlng)
//* 6 12:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (latlng)));
// 7 13:new #50 <Class RuntimeRemoteException>
// 8 16:dup
// 9 17:aload_1
// 10 18:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 11 21:athrow
}
}
public void setPosition(String s)
{
try
{
zzboA.setPositionWithID(s);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:aload_1
// 3 5:invokeinterface #146 <Method void IStreetViewPanoramaDelegate.setPositionWithID(String)>
return;
// 4 10:return
}
// Misplaced declaration of an exception variable
catch(String s)
//* 5 11:astore_1
{
throw new RuntimeRemoteException(((RemoteException) (s)));
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_1
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
public void setStreetNamesEnabled(boolean flag)
{
try
{
zzboA.enableStreetNames(flag);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:iload_1
// 3 5:invokeinterface #150 <Method void IStreetViewPanoramaDelegate.enableStreetNames(boolean)>
return;
// 4 10:return
}
catch(RemoteException remoteexception)
//* 5 11:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_2
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
public void setUserNavigationEnabled(boolean flag)
{
try
{
zzboA.enableUserNavigation(flag);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:iload_1
// 3 5:invokeinterface #154 <Method void IStreetViewPanoramaDelegate.enableUserNavigation(boolean)>
return;
// 4 10:return
}
catch(RemoteException remoteexception)
//* 5 11:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_2
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
public void setZoomGesturesEnabled(boolean flag)
{
try
{
zzboA.enableZoom(flag);
// 0 0:aload_0
// 1 1:getfield #41 <Field IStreetViewPanoramaDelegate zzboA>
// 2 4:iload_1
// 3 5:invokeinterface #158 <Method void IStreetViewPanoramaDelegate.enableZoom(boolean)>
return;
// 4 10:return
}
catch(RemoteException remoteexception)
//* 5 11:astore_2
{
throw new RuntimeRemoteException(remoteexception);
// 6 12:new #50 <Class RuntimeRemoteException>
// 7 15:dup
// 8 16:aload_2
// 9 17:invokespecial #53 <Method void RuntimeRemoteException(RemoteException)>
// 10 20:athrow
}
}
private final IStreetViewPanoramaDelegate zzboA;
}
| [
"[email protected]"
] | |
67a445532279c3b95e72a95a3242500b0b92c40d | 63ad262a156848521e6aafc4a21710091b93e326 | /submissions/Encode and Decode TinyURL_455869146.java | 1e7dc98f7964b494a8fadff0270a06028ae063b4 | [] | no_license | bansalanurag/LeetCode | e0a0c9865f65204eb373eda923eb9334f9574bf5 | 1e7a778b49560b52f14faca1445df5e900ca4861 | refs/heads/master | 2023-07-06T09:29:30.104518 | 2021-08-15T14:47:56 | 2021-08-15T14:47:56 | 369,997,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | import java.util.UUID;
public class Codec {
private HashMap<String, String> m = new HashMap<String, String>();
public String encode(String longUrl) {
UUID randomId = UUID.randomUUID();
m.put(randomId.toString(), longUrl);
return randomId.toString();
}
public String decode(String shortUrl) {
if (m.containsKey(shortUrl)) {
return m.get(shortUrl);
}
return "";
}
}
// Your Codec object will be instantiated and called as such:
// Codec codec = new Codec();
// codec.decode(codec.encode(url));
| [
"[email protected]"
] | |
a0096d7df11cdd7bac532938c5e61604d5af07d7 | f83cb6d03855bbc57844157f2e1f3a96fc0d122e | /gen/com/rockerz/storageexample/BuildConfig.java | af044a94be9470ffa2e3285172702a22b1358d47 | [] | no_license | thejavangumalli/StorageExample | 6089beb9d2fb6526f6963eb879b0231ffe201100 | f08be7f68938b803717a1b0af7d4b9aa51d7ab27 | refs/heads/master | 2020-06-06T04:57:33.924228 | 2014-02-14T01:00:05 | 2014-02-14T01:00:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 168 | java | /** Automatically generated file. DO NOT MODIFY */
package com.rockerz.storageexample;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"[email protected]"
] | |
c4468f5bb1fa01917d10d55eb2e05b73a85041b4 | 1264e4d85f7119c4eee2f3f350df84791ffddb6d | /Leetcode/src/Q311_Sparse_Matrix_Multiplication.java | 49f0876b5b972bc5d3c45ad3ae1ca4a53b6cde95 | [] | no_license | bumblebee618/mylc | 37eaa59d19d820aa54f00989c50732f27d84e86f | 70e2821b4eb4c5ddbd492a818e3c445a6fcbb72c | refs/heads/master | 2022-06-24T11:49:03.987571 | 2022-05-29T22:59:58 | 2022-06-01T00:15:56 | 223,346,232 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,514 | java | /******
*
Given two sparse matrices A and B, return the result of AB.
You may assume that A's column number is equal to B's row number.
Example:
A = [
[ 1, 0, 0],
[-1, 0, 3]
]
B = [
[ 7, 0, 0 ],
[ 0, 0, 0 ],
[ 0, 0, 1 ]
]
| 1 0 0 | | 7 0 0 | | 7 0 0 |
AB = | -1 0 3 | row | 0 0 0 | = | -7 0 3 |
| 0 0 1 |
*
* */
public class Q311_Sparse_Matrix_Multiplication {
public int[][] multiply(int[][] A, int[][] B) {
if (A == null || A.length == 0 || A[0].length == 0)
{
return new int[0][0];
}
else if (B == null || B.length == 0 || B[0].length == 0)
{
return new int[0][0];
}
else if (A[0].length != B.length)
{
return new int[0][0];
}
int row1 = A.length, col1 = A[0].length;
int col2 = B[0].length;
int[][] result = new int[row1][col2];
for (int i = 0; i < row1; i++)
{
for (int j = 0; j < col1; j++)
{
if (A[i][j] == 0)
{
continue;
}
for (int k = 0; k < col2; k++)
{
if (B[j][k] == 0)
{
continue;
}
result[i][k] += A[i][j] * B[j][k];
}
}
}
return result;
}
}
| [
"[email protected]"
] | |
4c0006c1ee7bbfca945d036d324a79640286faf2 | 01c585ef4f9d0b334bd73bc72146599a71939100 | /src/main/java/com/tfojuth/shop/searchanddiscover/domain/model/search/Redirect.java | 736e19d2a9a8554a28a3048ebb4c43b145a56d38 | [] | no_license | FinalGuy/DDD_Shop | 61e182fa72d278a065cd26c345cd80cf1bc01e7f | d3330bed44cf92bb8f39378bbce0d7d4a6ec54d9 | refs/heads/master | 2020-12-24T15:41:05.273278 | 2014-09-18T13:01:25 | 2014-09-18T13:01:25 | 23,762,932 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.tfojuth.shop.searchanddiscover.domain.model.search;
public class Redirect {
public String toPlainText() {
throw new UnsupportedOperationException("Not yet implemented");
}
}
| [
"[email protected]"
] | |
36af9900718bbaa93a80d6f0516877698822c900 | 64f0a73f1f35078d94b1bc229c1ce6e6de565a5f | /dataset/Top APKs Java Files/com.Hastamev.AmoledWallsFree-com-onesignal-OneSignal.java | d1af99f8bd4cd6188b87121ab98b78956225c5be | [
"MIT"
] | permissive | S2-group/mobilesoft-2020-iam-replication-package | 40d466184b995d7d0a9ae6e238f35ecfb249ccf0 | 600d790aaea7f1ca663d9c187df3c8760c63eacd | refs/heads/master | 2021-02-15T21:04:20.350121 | 2020-10-05T12:48:52 | 2020-10-05T12:48:52 | 244,930,541 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 69,693 | java | package com.onesignal;
import android.app.Activity;
import android.app.Application;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import android.util.Base64;
import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicLong;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class OneSignal
{
static final long MIN_ON_FOCUS_TIME = 60L;
private static final long MIN_ON_SESSION_TIME = 30L;
public static final String VERSION = "030803";
private static int androidParamsReties = 0;
static Context appContext;
static String appId;
private static JSONObject awl;
private static boolean awlFired = false;
private static OSEmailSubscriptionState currentEmailSubscriptionState;
private static OSPermissionState currentPermissionState;
private static OSSubscriptionState currentSubscriptionState;
private static int deviceType = 0;
private static String emailId;
private static OneSignal.EmailUpdateHandler emailLogoutHandler;
private static OSObservable emailSubscriptionStateChangesObserver;
private static OneSignal.EmailUpdateHandler emailUpdateHandler;
private static boolean foreground = false;
private static boolean getTagsCall = false;
private static OneSignal.IAPUpdateJob iapUpdateJob;
private static OneSignal.IdsAvailableHandler idsAvailableHandler;
static boolean initDone = false;
static OSEmailSubscriptionState lastEmailSubscriptionState;
private static LocationGMS.LocationPoint lastLocationPoint;
static OSPermissionState lastPermissionState;
private static String lastRegistrationId;
static OSSubscriptionState lastSubscriptionState;
static AtomicLong lastTaskId;
private static long lastTrackedFocusTime = 1L;
private static boolean locationFired = false;
private static OneSignal.LOG_LEVEL logCatLevel;
static boolean mEnterp = false;
private static String mGoogleProjectNumber;
private static boolean mGoogleProjectNumberIsRemote = false;
static OneSignal.Builder mInitBuilder;
private static AdvertisingIdentifierProvider mainAdIdProvider;
private static OSUtils osUtils;
private static OneSignal.GetTagsHandler pendingGetTagsHandler;
static ExecutorService pendingTaskExecutor;
private static OSObservable permissionStateChangesObserver;
private static HashSet postedOpenedNotifIds = new HashSet();
private static boolean promptedLocation = false;
private static boolean registerForPushFired = false;
public static String sdkType = "native";
private static boolean sendAsSession = false;
static boolean shareLocation = true;
private static int subscribableStatus = 0;
private static OSObservable subscriptionStateChangesObserver;
public static ConcurrentLinkedQueue taskQueueWaitingForInit;
private static TrackAmazonPurchase trackAmazonPurchase;
private static TrackFirebaseAnalytics trackFirebaseAnalytics;
private static TrackGooglePurchase trackGooglePurchase;
private static long unSentActiveTime = -1L;
private static Collection unprocessedOpenedNotifis;
private static boolean useEmailAuth;
private static String userId;
private static OneSignal.LOG_LEVEL visualLogLevel = OneSignal.LOG_LEVEL.NONE;
private static boolean waitingToPostStateSync;
static
{
logCatLevel = OneSignal.LOG_LEVEL.WARN;
taskQueueWaitingForInit = new ConcurrentLinkedQueue();
lastTaskId = new AtomicLong();
mainAdIdProvider = new AdvertisingIdProviderGPS();
unprocessedOpenedNotifis = new ArrayList();
}
public OneSignal() {}
static long GetUnsentActiveTime()
{
if ((unSentActiveTime == -1L) && (appContext != null)) {
unSentActiveTime = OneSignalPrefs.getLong(OneSignalPrefs.PREFS_ONESIGNAL, "GT_UNSENT_ACTIVE_TIME", 0L);
}
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.INFO;
StringBuilder localStringBuilder = new StringBuilder("GetUnsentActiveTime: ");
localStringBuilder.append(unSentActiveTime);
Log(localLOG_LEVEL, localStringBuilder.toString());
return unSentActiveTime;
}
static void Log(OneSignal.LOG_LEVEL paramLOG_LEVEL, String paramString)
{
Log(paramLOG_LEVEL, paramString, null);
}
static void Log(OneSignal.LOG_LEVEL paramLOG_LEVEL, String paramString, Throwable paramThrowable)
{
if (paramLOG_LEVEL.compareTo(logCatLevel) <= 0) {
if (paramLOG_LEVEL == OneSignal.LOG_LEVEL.VERBOSE) {
Log.v("OneSignal", paramString, paramThrowable);
} else if (paramLOG_LEVEL == OneSignal.LOG_LEVEL.DEBUG) {
Log.d("OneSignal", paramString, paramThrowable);
} else if (paramLOG_LEVEL == OneSignal.LOG_LEVEL.INFO) {
Log.i("OneSignal", paramString, paramThrowable);
} else if (paramLOG_LEVEL == OneSignal.LOG_LEVEL.WARN) {
Log.w("OneSignal", paramString, paramThrowable);
} else if ((paramLOG_LEVEL == OneSignal.LOG_LEVEL.ERROR) || (paramLOG_LEVEL == OneSignal.LOG_LEVEL.FATAL)) {
Log.e("OneSignal", paramString, paramThrowable);
}
}
if ((paramLOG_LEVEL.compareTo(visualLogLevel) <= 0) && (ActivityLifecycleHandler.curActivity != null)) {
try
{
Object localObject = new StringBuilder();
((StringBuilder)localObject).append(paramString);
((StringBuilder)localObject).append("\n");
localObject = ((StringBuilder)localObject).toString();
paramString = (String)localObject;
if (paramThrowable != null)
{
paramString = new StringBuilder();
paramString.append((String)localObject);
paramString.append(paramThrowable.getMessage());
paramString = paramString.toString();
localObject = new StringWriter();
paramThrowable.printStackTrace(new PrintWriter((Writer)localObject));
paramThrowable = new StringBuilder();
paramThrowable.append(paramString);
paramThrowable.append(((StringWriter)localObject).toString());
paramString = paramThrowable.toString();
}
OSUtils.runOnMainUIThread(new OneSignal.5(paramLOG_LEVEL, paramString));
return;
}
catch (Throwable paramLOG_LEVEL)
{
Log.e("OneSignal", "Error showing logging message.", paramLOG_LEVEL);
}
}
}
private static void SaveAppId(String paramString)
{
if (appContext == null) {
return;
}
OneSignalPrefs.saveString(OneSignalPrefs.PREFS_ONESIGNAL, "GT_APP_ID", paramString);
}
private static void SaveUnsentActiveTime(long paramLong)
{
unSentActiveTime = paramLong;
if (appContext == null) {
return;
}
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.INFO;
StringBuilder localStringBuilder = new StringBuilder("SaveUnsentActiveTime: ");
localStringBuilder.append(unSentActiveTime);
Log(localLOG_LEVEL, localStringBuilder.toString());
OneSignalPrefs.saveLong(OneSignalPrefs.PREFS_ONESIGNAL, "GT_UNSENT_ACTIVE_TIME", paramLong);
}
public static void addEmailSubscriptionObserver(@NonNull OSEmailSubscriptionObserver paramOSEmailSubscriptionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not add email subscription observer");
return;
}
getEmailSubscriptionStateChangesObserver().addObserver(paramOSEmailSubscriptionObserver);
if (getCurrentEmailSubscriptionState(appContext).compare(getLastEmailSubscriptionState(appContext))) {
OSEmailSubscriptionChangedInternalObserver.fireChangesToPublicObserver(getCurrentEmailSubscriptionState(appContext));
}
}
private static void addNetType(JSONObject paramJSONObject)
{
try
{
paramJSONObject.put("net_type", osUtils.getNetType());
return;
}
catch (Throwable paramJSONObject) {}
}
public static void addPermissionObserver(OSPermissionObserver paramOSPermissionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not add permission observer");
return;
}
getPermissionStateChangesObserver().addObserver(paramOSPermissionObserver);
if (getCurrentPermissionState(appContext).compare(getLastPermissionState(appContext))) {
OSPermissionChangedInternalObserver.fireChangesToPublicObserver(getCurrentPermissionState(appContext));
}
}
public static void addSubscriptionObserver(OSSubscriptionObserver paramOSSubscriptionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not add subscription observer");
return;
}
getSubscriptionStateChangesObserver().addObserver(paramOSSubscriptionObserver);
if (getCurrentSubscriptionState(appContext).compare(getLastSubscriptionState(appContext))) {
OSSubscriptionChangedInternalObserver.fireChangesToPublicObserver(getCurrentSubscriptionState(appContext));
}
}
private static void addTaskToQueue(OneSignal.PendingTaskRunnable paramPendingTaskRunnable)
{
OneSignal.PendingTaskRunnable.access$402(paramPendingTaskRunnable, lastTaskId.incrementAndGet());
OneSignal.LOG_LEVEL localLOG_LEVEL;
StringBuilder localStringBuilder;
if (pendingTaskExecutor == null)
{
localLOG_LEVEL = OneSignal.LOG_LEVEL.INFO;
localStringBuilder = new StringBuilder("Adding a task to the pending queue with ID: ");
localStringBuilder.append(OneSignal.PendingTaskRunnable.access$400(paramPendingTaskRunnable));
Log(localLOG_LEVEL, localStringBuilder.toString());
taskQueueWaitingForInit.add(paramPendingTaskRunnable);
return;
}
if (!pendingTaskExecutor.isShutdown())
{
localLOG_LEVEL = OneSignal.LOG_LEVEL.INFO;
localStringBuilder = new StringBuilder("Executor is still running, add to the executor with ID: ");
localStringBuilder.append(OneSignal.PendingTaskRunnable.access$400(paramPendingTaskRunnable));
Log(localLOG_LEVEL, localStringBuilder.toString());
pendingTaskExecutor.submit(paramPendingTaskRunnable);
}
}
static boolean areNotificationsEnabledForSubscribedState()
{
if (mInitBuilder.mUnsubscribeWhenNotificationsAreDisabled) {
return OSUtils.areNotificationsEnabled(appContext);
}
return true;
}
private static boolean atLogLevel(OneSignal.LOG_LEVEL paramLOG_LEVEL)
{
return (paramLOG_LEVEL.compareTo(visualLogLevel) <= 0) || (paramLOG_LEVEL.compareTo(logCatLevel) <= 0);
}
public static void cancelGroupedNotifications(String paramString)
{
OneSignal.23 local23 = new OneSignal.23(paramString);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
local23.run();
return;
}
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.ERROR;
StringBuilder localStringBuilder = new StringBuilder("OneSignal.init has not been called. Could not clear notifications part of group ");
localStringBuilder.append(paramString);
localStringBuilder.append(" - movingthis operation to a waiting task queue.");
Log(localLOG_LEVEL, localStringBuilder.toString());
addTaskToQueue(new OneSignal.PendingTaskRunnable(local23));
}
public static void cancelNotification(int paramInt)
{
OneSignal.22 local22 = new OneSignal.22(paramInt);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
local22.run();
((NotificationManager)appContext.getSystemService("notification")).cancel(paramInt);
return;
}
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.ERROR;
StringBuilder localStringBuilder = new StringBuilder("OneSignal.init has not been called. Could not clear notification id: ");
localStringBuilder.append(paramInt);
localStringBuilder.append(" at this time - movingthis operation to a waiting task queue. The notification will still be canceledfrom NotificationManager at this time.");
Log(localLOG_LEVEL, localStringBuilder.toString());
taskQueueWaitingForInit.add(local22);
}
public static void clearOneSignalNotifications()
{
OneSignal.21 local21 = new OneSignal.21();
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
local21.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not clear notifications at this time - moving this operation toa waiting task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(local21));
}
public static void deleteTag(String paramString)
{
ArrayList localArrayList = new ArrayList(1);
localArrayList.add(paramString);
deleteTags(localArrayList);
}
public static void deleteTags(String paramString)
{
try
{
JSONObject localJSONObject = new JSONObject();
paramString = new JSONArray(paramString);
int i = 0;
while (i < paramString.length())
{
localJSONObject.put(paramString.getString(i), "");
i += 1;
}
sendTags(localJSONObject);
return;
}
catch (Throwable paramString)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Failed to generate JSON for deleteTags.", paramString);
}
}
public static void deleteTags(Collection paramCollection)
{
try
{
JSONObject localJSONObject = new JSONObject();
paramCollection = paramCollection.iterator();
while (paramCollection.hasNext()) {
localJSONObject.put((String)paramCollection.next(), "");
}
sendTags(localJSONObject);
return;
}
catch (Throwable paramCollection)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Failed to generate JSON for deleteTags.", paramCollection);
}
}
public static void enableSound(boolean paramBoolean)
{
if (appContext == null) {
return;
}
OneSignalPrefs.saveBool(OneSignalPrefs.PREFS_ONESIGNAL, "GT_SOUND_ENABLED", paramBoolean);
}
public static void enableVibrate(boolean paramBoolean)
{
if (appContext == null) {
return;
}
OneSignalPrefs.saveBool(OneSignalPrefs.PREFS_ONESIGNAL, "GT_VIBRATE_ENABLED", paramBoolean);
}
private static void fireCallbackForOpenedNotifications()
{
Iterator localIterator = unprocessedOpenedNotifis.iterator();
while (localIterator.hasNext()) {
runNotificationOpenedCallback((JSONArray)localIterator.next(), true, false);
}
unprocessedOpenedNotifis.clear();
}
static void fireEmailUpdateFailure()
{
if (emailUpdateHandler != null)
{
emailUpdateHandler.onFailure(new OneSignal.EmailUpdateError(OneSignal.EmailErrorType.NETWORK, "Failed due to network failure. Will retry on next sync."));
emailUpdateHandler = null;
}
}
static void fireEmailUpdateSuccess()
{
if (emailUpdateHandler != null)
{
emailUpdateHandler.onSuccess();
emailUpdateHandler = null;
}
}
private static void fireIdsAvailableCallback()
{
if (idsAvailableHandler != null) {
OSUtils.runOnMainUIThread(new OneSignal.16());
}
}
private static void fireIntentFromNotificationOpen(Context paramContext)
{
Intent localIntent = paramContext.getPackageManager().getLaunchIntentForPackage(paramContext.getPackageName());
if (localIntent != null)
{
localIntent.setFlags(268566528);
paramContext.startActivity(localIntent);
}
}
private static void fireNotificationOpenedHandler(OSNotificationOpenResult paramOSNotificationOpenResult)
{
OSUtils.runOnMainUIThread(new OneSignal.17(paramOSNotificationOpenResult));
}
@NonNull
private static OSNotificationOpenResult generateOsNotificationOpenResult(JSONArray paramJSONArray, boolean paramBoolean1, boolean paramBoolean2)
{
int k = paramJSONArray.length();
OSNotificationOpenResult localOSNotificationOpenResult = new OSNotificationOpenResult();
OSNotification localOSNotification = new OSNotification();
localOSNotification.isAppInFocus = isAppActive();
localOSNotification.shown = paramBoolean1;
localOSNotification.androidNotificationId = paramJSONArray.optJSONObject(0).optInt("notificationId");
Object localObject1 = null;
int j = 1;
int i = 0;
Object localObject4;
Object localObject3;
if (i < k)
{
localObject4 = localObject1;
try
{
localObject5 = paramJSONArray.getJSONObject(i);
localObject4 = localObject1;
localOSNotification.payload = NotificationBundleProcessor.OSNotificationPayloadFrom((JSONObject)localObject5);
localObject3 = localObject1;
if (localObject1 != null) {
break label365;
}
localObject4 = localObject1;
localObject3 = localObject1;
if (!((JSONObject)localObject5).has("actionSelected")) {
break label365;
}
localObject4 = localObject1;
localObject3 = ((JSONObject)localObject5).optString("actionSelected", null);
}
catch (Throwable localThrowable)
{
label139:
localObject3 = OneSignal.LOG_LEVEL.ERROR;
Object localObject5 = new StringBuilder("Error parsing JSON item ");
((StringBuilder)localObject5).append(i);
((StringBuilder)localObject5).append("/");
((StringBuilder)localObject5).append(k);
((StringBuilder)localObject5).append(" for callback.");
Log((OneSignal.LOG_LEVEL)localObject3, ((StringBuilder)localObject5).toString(), localThrowable);
localObject2 = localObject4;
}
localObject4 = localObject3;
if (localOSNotification.groupedNotifications == null)
{
localObject4 = localObject3;
localOSNotification.groupedNotifications = new ArrayList();
}
localObject4 = localObject3;
localOSNotification.groupedNotifications.add(localOSNotification.payload);
localObject1 = localObject3;
}
for (;;)
{
i += 1;
break;
localOSNotificationOpenResult.notification = localOSNotification;
localOSNotificationOpenResult.action = new OSNotificationAction();
localOSNotificationOpenResult.action.actionID = ((String)localObject2);
localObject3 = localOSNotificationOpenResult.action;
if (localObject2 != null) {
paramJSONArray = OSNotificationAction.ActionType.ActionTaken;
} else {
paramJSONArray = OSNotificationAction.ActionType.Opened;
}
((OSNotificationAction)localObject3).type = paramJSONArray;
if (paramBoolean2) {
paramJSONArray = localOSNotificationOpenResult.notification;
}
for (Object localObject2 = OSNotification.DisplayType.InAppAlert;; localObject2 = OSNotification.DisplayType.Notification)
{
paramJSONArray.displayType = ((OSNotification.DisplayType)localObject2);
return localOSNotificationOpenResult;
paramJSONArray = localOSNotificationOpenResult.notification;
}
label365:
if (j == 0) {
break label139;
}
j = 0;
localObject2 = localObject3;
}
}
private static OSEmailSubscriptionState getCurrentEmailSubscriptionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (currentEmailSubscriptionState == null)
{
paramContext = new OSEmailSubscriptionState(false);
currentEmailSubscriptionState = paramContext;
paramContext.observable.addObserverStrong(new OSEmailSubscriptionChangedInternalObserver());
}
return currentEmailSubscriptionState;
}
public static OneSignal.Builder getCurrentOrNewInitBuilder()
{
if (mInitBuilder == null) {
mInitBuilder = new OneSignal.Builder(null);
}
return mInitBuilder;
}
private static OSPermissionState getCurrentPermissionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (currentPermissionState == null)
{
paramContext = new OSPermissionState(false);
currentPermissionState = paramContext;
paramContext.observable.addObserverStrong(new OSPermissionChangedInternalObserver());
}
return currentPermissionState;
}
private static OSSubscriptionState getCurrentSubscriptionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (currentSubscriptionState == null)
{
currentSubscriptionState = new OSSubscriptionState(false, getCurrentPermissionState(paramContext).getEnabled());
getCurrentPermissionState(paramContext).observable.addObserver(currentSubscriptionState);
currentSubscriptionState.observable.addObserverStrong(new OSSubscriptionChangedInternalObserver());
}
return currentSubscriptionState;
}
static String getEmailId()
{
if ("".equals(emailId)) {
return null;
}
if ((emailId == null) && (appContext != null)) {
emailId = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, "OS_EMAIL_ID", null);
}
return emailId;
}
static OSObservable getEmailSubscriptionStateChangesObserver()
{
if (emailSubscriptionStateChangesObserver == null) {
emailSubscriptionStateChangesObserver = new OSObservable("onOSEmailSubscriptionChanged", true);
}
return emailSubscriptionStateChangesObserver;
}
static boolean getFilterOtherGCMReceivers(Context paramContext)
{
return OneSignalPrefs.getBool(OneSignalPrefs.PREFS_ONESIGNAL, "OS_FILTER_OTHER_GCM_RECEIVERS", false);
}
static boolean getFirebaseAnalyticsEnabled(Context paramContext)
{
return OneSignalPrefs.getBool(OneSignalPrefs.PREFS_ONESIGNAL, "GT_FIREBASE_TRACKING_ENABLED", false);
}
static boolean getInAppAlertNotificationEnabled()
{
if (mInitBuilder == null) {
return false;
}
return mInitBuilder.mDisplayOption == OneSignal.OSInFocusDisplayOption.InAppAlert;
}
private static OneSignal.OSInFocusDisplayOption getInFocusDisplaying(int paramInt)
{
switch (paramInt)
{
default:
if (paramInt < 0) {
return OneSignal.OSInFocusDisplayOption.None;
}
break;
case 2:
return OneSignal.OSInFocusDisplayOption.Notification;
case 1:
return OneSignal.OSInFocusDisplayOption.InAppAlert;
case 0:
return OneSignal.OSInFocusDisplayOption.None;
}
return OneSignal.OSInFocusDisplayOption.Notification;
}
private static OSEmailSubscriptionState getLastEmailSubscriptionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (lastEmailSubscriptionState == null) {
lastEmailSubscriptionState = new OSEmailSubscriptionState(true);
}
return lastEmailSubscriptionState;
}
private static OSPermissionState getLastPermissionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (lastPermissionState == null) {
lastPermissionState = new OSPermissionState(true);
}
return lastPermissionState;
}
private static long getLastSessionTime(Context paramContext)
{
return OneSignalPrefs.getLong(OneSignalPrefs.PREFS_ONESIGNAL, "OS_LAST_SESSION_TIME", -31000L);
}
private static OSSubscriptionState getLastSubscriptionState(Context paramContext)
{
if (paramContext == null) {
return null;
}
if (lastSubscriptionState == null) {
lastSubscriptionState = new OSSubscriptionState(true, false);
}
return lastSubscriptionState;
}
private static OneSignal.LOG_LEVEL getLogLevel(int paramInt)
{
switch (paramInt)
{
default:
if (paramInt < 0) {
return OneSignal.LOG_LEVEL.NONE;
}
break;
case 6:
return OneSignal.LOG_LEVEL.VERBOSE;
case 5:
return OneSignal.LOG_LEVEL.DEBUG;
case 4:
return OneSignal.LOG_LEVEL.INFO;
case 3:
return OneSignal.LOG_LEVEL.WARN;
case 2:
return OneSignal.LOG_LEVEL.ERROR;
case 1:
return OneSignal.LOG_LEVEL.FATAL;
case 0:
return OneSignal.LOG_LEVEL.NONE;
}
return OneSignal.LOG_LEVEL.VERBOSE;
}
static String getNotificationIdFromGCMBundle(Bundle paramBundle)
{
if (paramBundle.isEmpty()) {
return null;
}
try
{
OneSignal.LOG_LEVEL localLOG_LEVEL;
if (paramBundle.containsKey("custom"))
{
paramBundle = new JSONObject(paramBundle.getString("custom"));
if (paramBundle.has("i")) {
return paramBundle.optString("i", null);
}
localLOG_LEVEL = OneSignal.LOG_LEVEL.DEBUG;
}
for (paramBundle = "Not a OneSignal formatted GCM message. No 'i' field in custom.";; paramBundle = "Not a OneSignal formatted GCM message. No 'custom' field in the bundle.")
{
Log(localLOG_LEVEL, paramBundle);
return null;
localLOG_LEVEL = OneSignal.LOG_LEVEL.DEBUG;
}
return null;
}
catch (Throwable paramBundle)
{
Log(OneSignal.LOG_LEVEL.DEBUG, "Could not parse bundle, probably not a OneSignal notification.", paramBundle);
}
}
private static String getNotificationIdFromGCMJsonPayload(JSONObject paramJSONObject)
{
try
{
paramJSONObject = new JSONObject(paramJSONObject.optString("custom")).optString("i", null);
return paramJSONObject;
}
catch (Throwable paramJSONObject) {}
return null;
}
static boolean getNotificationsWhenActiveEnabled()
{
if (mInitBuilder == null) {
return true;
}
return mInitBuilder.mDisplayOption == OneSignal.OSInFocusDisplayOption.Notification;
}
static OSObservable getPermissionStateChangesObserver()
{
if (permissionStateChangesObserver == null) {
permissionStateChangesObserver = new OSObservable("onOSPermissionChanged", true);
}
return permissionStateChangesObserver;
}
public static OSPermissionSubscriptionState getPermissionSubscriptionState()
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not get OSPermissionSubscriptionState");
return null;
}
OSPermissionSubscriptionState localOSPermissionSubscriptionState = new OSPermissionSubscriptionState();
localOSPermissionSubscriptionState.subscriptionStatus = getCurrentSubscriptionState(appContext);
localOSPermissionSubscriptionState.permissionStatus = getCurrentPermissionState(appContext);
localOSPermissionSubscriptionState.emailSubscriptionStatus = getCurrentEmailSubscriptionState(appContext);
return localOSPermissionSubscriptionState;
}
static String getSavedAppId()
{
return getSavedAppId(appContext);
}
private static String getSavedAppId(Context paramContext)
{
if (paramContext == null) {
return "";
}
return OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, "GT_APP_ID", null);
}
private static String getSavedUserId(Context paramContext)
{
if (paramContext == null) {
return "";
}
return OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, "GT_PLAYER_ID", null);
}
static boolean getSoundEnabled(Context paramContext)
{
return OneSignalPrefs.getBool(OneSignalPrefs.PREFS_ONESIGNAL, "GT_SOUND_ENABLED", true);
}
static OSObservable getSubscriptionStateChangesObserver()
{
if (subscriptionStateChangesObserver == null) {
subscriptionStateChangesObserver = new OSObservable("onOSSubscriptionChanged", true);
}
return subscriptionStateChangesObserver;
}
public static void getTags(OneSignal.GetTagsHandler paramGetTagsHandler)
{
pendingGetTagsHandler = paramGetTagsHandler;
paramGetTagsHandler = new OneSignal.13(paramGetTagsHandler);
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue.");
taskQueueWaitingForInit.add(paramGetTagsHandler);
return;
}
paramGetTagsHandler.run();
}
private static int getTimeZoneOffset()
{
TimeZone localTimeZone = Calendar.getInstance().getTimeZone();
int j = localTimeZone.getRawOffset();
int i = j;
if (localTimeZone.inDaylightTime(new Date())) {
i = j + localTimeZone.getDSTSavings();
}
return i / 1000;
}
static String getUserId()
{
if ((userId == null) && (appContext != null)) {
userId = OneSignalPrefs.getString(OneSignalPrefs.PREFS_ONESIGNAL, "GT_PLAYER_ID", null);
}
return userId;
}
static boolean getVibrate(Context paramContext)
{
return OneSignalPrefs.getBool(OneSignalPrefs.PREFS_ONESIGNAL, "GT_VIBRATE_ENABLED", true);
}
static void handleFailedEmailLogout()
{
if (emailLogoutHandler != null)
{
emailLogoutHandler.onFailure(new OneSignal.EmailUpdateError(OneSignal.EmailErrorType.NETWORK, "Failed due to network failure. Will retry on next sync."));
emailLogoutHandler = null;
}
}
public static void handleNotificationOpen(Context paramContext, JSONArray paramJSONArray, boolean paramBoolean)
{
notificationOpenedRESTCall(paramContext, paramJSONArray);
if ((trackFirebaseAnalytics != null) && (getFirebaseAnalyticsEnabled(appContext))) {
trackFirebaseAnalytics.trackOpenedEvent(generateOsNotificationOpenResult(paramJSONArray, true, paramBoolean));
}
boolean bool1 = false;
boolean bool2 = "DISABLE".equals(OSUtils.getManifestMeta(paramContext, "com.onesignal.NotificationOpened.DEFAULT"));
if (!bool2) {
bool1 = openURLFromNotification(paramContext, paramJSONArray);
}
runNotificationOpenedCallback(paramJSONArray, true, paramBoolean);
if ((!paramBoolean) && (!bool1) && (!bool2)) {
fireIntentFromNotificationOpen(paramContext);
}
}
static void handleNotificationReceived(JSONArray paramJSONArray, boolean paramBoolean1, boolean paramBoolean2)
{
paramJSONArray = generateOsNotificationOpenResult(paramJSONArray, paramBoolean1, paramBoolean2);
if ((trackFirebaseAnalytics != null) && (getFirebaseAnalyticsEnabled(appContext))) {
trackFirebaseAnalytics.trackReceivedEvent(paramJSONArray);
}
if (mInitBuilder != null)
{
if (mInitBuilder.mNotificationReceivedHandler == null) {
return;
}
mInitBuilder.mNotificationReceivedHandler.notificationReceived(paramJSONArray.notification);
}
}
static void handleSuccessfulEmailLogout()
{
if (emailLogoutHandler != null)
{
emailLogoutHandler.onSuccess();
emailLogoutHandler = null;
}
}
public static void idsAvailable(OneSignal.IdsAvailableHandler paramIdsAvailableHandler)
{
idsAvailableHandler = paramIdsAvailableHandler;
paramIdsAvailableHandler = new OneSignal.15();
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
paramIdsAvailableHandler.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(paramIdsAvailableHandler));
}
public static void init(Context paramContext, String paramString1, String paramString2)
{
init(paramContext, paramString1, paramString2, null, null);
}
public static void init(Context paramContext, String paramString1, String paramString2, OneSignal.NotificationOpenedHandler paramNotificationOpenedHandler)
{
init(paramContext, paramString1, paramString2, paramNotificationOpenedHandler, null);
}
public static void init(Context paramContext, String paramString1, String paramString2, OneSignal.NotificationOpenedHandler paramNotificationOpenedHandler, OneSignal.NotificationReceivedHandler paramNotificationReceivedHandler)
{
OneSignal.Builder localBuilder = getCurrentOrNewInitBuilder();
mInitBuilder = localBuilder;
localBuilder.mDisplayOptionCarryOver = false;
mInitBuilder.mNotificationOpenedHandler = paramNotificationOpenedHandler;
mInitBuilder.mNotificationReceivedHandler = paramNotificationReceivedHandler;
if (!mGoogleProjectNumberIsRemote) {
mGoogleProjectNumber = paramString1;
}
paramString1 = new OSUtils();
osUtils = paramString1;
deviceType = paramString1.getDeviceType();
int i = osUtils.initializationChecker(paramContext, deviceType, paramString2);
subscribableStatus = i;
if (i == 64537) {
return;
}
if (initDone)
{
if (paramContext != null) {
appContext = paramContext.getApplicationContext();
}
if (mInitBuilder.mNotificationOpenedHandler != null) {
fireCallbackForOpenedNotifications();
}
return;
}
boolean bool = paramContext instanceof Activity;
foreground = bool;
appId = paramString2;
appContext = paramContext.getApplicationContext();
saveFilterOtherGCMReceivers(mInitBuilder.mFilterOtherGCMReceivers);
if (bool)
{
ActivityLifecycleHandler.curActivity = (Activity)paramContext;
NotificationRestorer.asyncRestore(appContext);
}
else
{
ActivityLifecycleHandler.nextResumeIsFirstActivity = true;
}
lastTrackedFocusTime = SystemClock.elapsedRealtime();
OneSignalStateSynchronizer.initUserState();
((Application)appContext).registerActivityLifecycleCallbacks(new ActivityLifecycleListener());
try
{
Class.forName("com.amazon.device.iap.PurchasingListener");
trackAmazonPurchase = new TrackAmazonPurchase(appContext);
paramContext = getSavedAppId();
if (paramContext != null)
{
if (!paramContext.equals(appId))
{
Log(OneSignal.LOG_LEVEL.DEBUG, "APP ID changed, clearing user id as it is no longer valid.");
SaveAppId(appId);
OneSignalStateSynchronizer.resetCurrentState();
}
}
else
{
BadgeCountUpdater.updateCount(0, appContext);
SaveAppId(appId);
}
OSPermissionChangedInternalObserver.handleInternalChanges(getCurrentPermissionState(appContext));
if ((foreground) || (getUserId() == null))
{
sendAsSession = isPastOnSessionTime();
setLastSessionTime(System.currentTimeMillis());
startRegistrationOrOnSession();
}
if (mInitBuilder.mNotificationOpenedHandler != null) {
fireCallbackForOpenedNotifications();
}
if (TrackGooglePurchase.CanTrack(appContext)) {
trackGooglePurchase = new TrackGooglePurchase(appContext);
}
if (TrackFirebaseAnalytics.CanTrack()) {
trackFirebaseAnalytics = new TrackFirebaseAnalytics(appContext);
}
initDone = true;
startPendingTasks();
return;
}
catch (ClassNotFoundException paramContext)
{
for (;;) {}
}
}
private static void init(OneSignal.Builder paramBuilder)
{
if (getCurrentOrNewInitBuilder().mDisplayOptionCarryOver) {
paramBuilder.mDisplayOption = getCurrentOrNewInitBuilder().mDisplayOption;
}
mInitBuilder = paramBuilder;
Context localContext = paramBuilder.mContext;
mInitBuilder.mContext = null;
try
{
Bundle localBundle = localContext.getPackageManager().getApplicationInfo(localContext.getPackageName(), 128).metaData;
String str = localBundle.getString("onesignal_google_project_number");
paramBuilder = str;
if (str != null)
{
paramBuilder = str;
if (str.length() > 4) {
paramBuilder = str.substring(4);
}
}
init(localContext, paramBuilder, localBundle.getString("onesignal_app_id"), mInitBuilder.mNotificationOpenedHandler, mInitBuilder.mNotificationReceivedHandler);
return;
}
catch (Throwable paramBuilder)
{
paramBuilder.printStackTrace();
}
}
private static void internalFireGetTagsCallback(OneSignal.GetTagsHandler paramGetTagsHandler)
{
if (paramGetTagsHandler == null) {
return;
}
new Thread(new OneSignal.14(paramGetTagsHandler), "OS_GETTAGS_CALLBACK").start();
}
private static void internalFireIdsAvailableCallback()
{
try
{
Object localObject1 = idsAvailableHandler;
if (localObject1 == null) {
return;
}
localObject1 = OneSignalStateSynchronizer.getRegistrationId();
if (!OneSignalStateSynchronizer.getSubscribed()) {
localObject1 = null;
}
String str = getUserId();
if (str == null) {
return;
}
idsAvailableHandler.idsAvailable(str, (String)localObject1);
if (localObject1 != null) {
idsAvailableHandler = null;
}
return;
}
finally {}
}
static boolean isAppActive()
{
return (initDone) && (isForeground());
}
/* Error */
private static boolean isDuplicateNotification(String paramString, Context paramContext)
{
// Byte code:
// 0: aload_0
// 1: ifnull +192 -> 193
// 4: ldc_w 601
// 7: aload_0
// 8: invokevirtual 845 java/lang/String:equals (Ljava/lang/Object;)Z
// 11: ifeq +5 -> 16
// 14: iconst_0
// 15: ireturn
// 16: aload_1
// 17: invokestatic 1241 com/onesignal/OneSignalDbHelper:getInstance (Landroid/content/Context;)Lcom/onesignal/OneSignalDbHelper;
// 20: astore 4
// 22: aconst_null
// 23: astore 6
// 25: aconst_null
// 26: astore_1
// 27: aload 4
// 29: invokevirtual 1245 com/onesignal/OneSignalDbHelper:getReadableDbWithRetries ()Landroid/database/sqlite/SQLiteDatabase;
// 32: ldc_w 555
// 35: iconst_1
// 36: anewarray 621 java/lang/String
// 39: dup
// 40: iconst_0
// 41: ldc_w 1247
// 44: aastore
// 45: ldc_w 1249
// 48: iconst_1
// 49: anewarray 621 java/lang/String
// 52: dup
// 53: iconst_0
// 54: aload_0
// 55: aastore
// 56: aconst_null
// 57: aconst_null
// 58: aconst_null
// 59: invokevirtual 1255 android/database/sqlite/SQLiteDatabase:query (Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
// 62: astore 4
// 64: aload 4
// 66: invokeinterface 1260 1 0
// 71: istore_3
// 72: iload_3
// 73: istore_2
// 74: aload 4
// 76: ifnull +65 -> 141
// 79: aload 4
// 81: invokeinterface 1263 1 0
// 86: iload_3
// 87: istore_2
// 88: goto +53 -> 141
// 91: astore_0
// 92: aload 4
// 94: astore_1
// 95: goto +86 -> 181
// 98: astore 5
// 100: goto +13 -> 113
// 103: astore_0
// 104: goto +77 -> 181
// 107: astore 5
// 109: aload 6
// 111: astore 4
// 113: aload 4
// 115: astore_1
// 116: getstatic 219 com/onesignal/OneSignal$LOG_LEVEL:ERROR Lcom/onesignal/OneSignal$LOG_LEVEL;
// 119: ldc_w 1265
// 122: aload 5
// 124: invokestatic 187 com/onesignal/OneSignal:Log (Lcom/onesignal/OneSignal$LOG_LEVEL;Ljava/lang/String;Ljava/lang/Throwable;)V
// 127: aload 4
// 129: ifnull +10 -> 139
// 132: aload 4
// 134: invokeinterface 1263 1 0
// 139: iconst_0
// 140: istore_2
// 141: iload_2
// 142: ifeq +37 -> 179
// 145: getstatic 207 com/onesignal/OneSignal$LOG_LEVEL:DEBUG Lcom/onesignal/OneSignal$LOG_LEVEL;
// 148: astore_1
// 149: new 167 java/lang/StringBuilder
// 152: dup
// 153: ldc_w 1267
// 156: invokespecial 172 java/lang/StringBuilder:<init> (Ljava/lang/String;)V
// 159: astore 4
// 161: aload 4
// 163: aload_0
// 164: invokevirtual 235 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder;
// 167: pop
// 168: aload_1
// 169: aload 4
// 171: invokevirtual 180 java/lang/StringBuilder:toString ()Ljava/lang/String;
// 174: invokestatic 184 com/onesignal/OneSignal:Log (Lcom/onesignal/OneSignal$LOG_LEVEL;Ljava/lang/String;)V
// 177: iconst_1
// 178: ireturn
// 179: iconst_0
// 180: ireturn
// 181: aload_1
// 182: ifnull +9 -> 191
// 185: aload_1
// 186: invokeinterface 1263 1 0
// 191: aload_0
// 192: athrow
// 193: iconst_0
// 194: ireturn
// Local variable table:
// start length slot name signature
// 0 195 0 paramString String
// 0 195 1 paramContext Context
// 73 69 2 bool1 boolean
// 71 16 3 bool2 boolean
// 20 150 4 localObject1 Object
// 98 1 5 localThrowable1 Throwable
// 107 16 5 localThrowable2 Throwable
// 23 87 6 localObject2 Object
// Exception table:
// from to target type
// 64 72 91 finally
// 64 72 98 java/lang/Throwable
// 27 64 103 finally
// 116 127 103 finally
// 27 64 107 java/lang/Throwable
}
static boolean isForeground()
{
return foreground;
}
private static boolean isPastOnSessionTime()
{
if (sendAsSession) {
return true;
}
return (System.currentTimeMillis() - getLastSessionTime(appContext)) / 1000L >= 30L;
}
private static void logHttpError(String paramString1, int paramInt, Throwable paramThrowable, String paramString2)
{
Object localObject2 = "";
Object localObject1 = localObject2;
if (paramString2 != null)
{
localObject1 = localObject2;
if (atLogLevel(OneSignal.LOG_LEVEL.INFO))
{
localObject1 = new StringBuilder("\n");
((StringBuilder)localObject1).append(paramString2);
((StringBuilder)localObject1).append("\n");
localObject1 = ((StringBuilder)localObject1).toString();
}
}
paramString2 = OneSignal.LOG_LEVEL.WARN;
localObject2 = new StringBuilder("HTTP code: ");
((StringBuilder)localObject2).append(paramInt);
((StringBuilder)localObject2).append(" ");
((StringBuilder)localObject2).append(paramString1);
((StringBuilder)localObject2).append((String)localObject1);
Log(paramString2, ((StringBuilder)localObject2).toString(), paramThrowable);
}
public static void logoutEmail()
{
logoutEmail(null);
}
public static void logoutEmail(@Nullable OneSignal.EmailUpdateHandler paramEmailUpdateHandler)
{
if (getEmailId() == null)
{
if (paramEmailUpdateHandler != null) {
paramEmailUpdateHandler.onFailure(new OneSignal.EmailUpdateError(OneSignal.EmailErrorType.INVALID_OPERATION, "logoutEmail not valid as email was not set or already logged out!"));
}
Log(OneSignal.LOG_LEVEL.ERROR, "logoutEmail not valid as email was not set or already logged out!");
return;
}
emailLogoutHandler = paramEmailUpdateHandler;
paramEmailUpdateHandler = new OneSignal.10();
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
paramEmailUpdateHandler.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "You should initialize OneSignal before calling logoutEmail! Moving this operation to a pending task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(paramEmailUpdateHandler));
}
private static void makeAndroidParamsRequest()
{
if (awlFired)
{
registerForPushToken();
return;
}
OneSignal.4 local4 = new OneSignal.4();
Object localObject = new StringBuilder("apps/");
((StringBuilder)localObject).append(appId);
((StringBuilder)localObject).append("/android_params.js");
String str1 = ((StringBuilder)localObject).toString();
String str2 = getUserId();
localObject = str1;
if (str2 != null)
{
localObject = new StringBuilder();
((StringBuilder)localObject).append(str1);
((StringBuilder)localObject).append("?player_id=");
((StringBuilder)localObject).append(str2);
localObject = ((StringBuilder)localObject).toString();
}
Log(OneSignal.LOG_LEVEL.DEBUG, "Starting request to get Android parameters.");
OneSignalRestClient.get((String)localObject, local4);
}
static boolean notValidOrDuplicated(Context paramContext, JSONObject paramJSONObject)
{
paramJSONObject = getNotificationIdFromGCMJsonPayload(paramJSONObject);
return (paramJSONObject == null) || (isDuplicateNotification(paramJSONObject, paramContext));
}
private static void notificationOpenedRESTCall(Context paramContext, JSONArray paramJSONArray)
{
int i = 0;
while (i < paramJSONArray.length())
{
try
{
String str = new JSONObject(paramJSONArray.getJSONObject(i).optString("custom", null)).optString("i", null);
if (!postedOpenedNotifIds.contains(str))
{
postedOpenedNotifIds.add(str);
JSONObject localJSONObject = new JSONObject();
localJSONObject.put("app_id", getSavedAppId(paramContext));
localJSONObject.put("player_id", getSavedUserId(paramContext));
localJSONObject.put("opened", true);
StringBuilder localStringBuilder = new StringBuilder("notifications/");
localStringBuilder.append(str);
OneSignalRestClient.put(localStringBuilder.toString(), localJSONObject, new OneSignal.18());
}
}
catch (Throwable localThrowable)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Failed to generate JSON to send notification opened.", localThrowable);
}
i += 1;
}
}
static void onAppFocus()
{
foreground = true;
lastTrackedFocusTime = SystemClock.elapsedRealtime();
sendAsSession = isPastOnSessionTime();
setLastSessionTime(System.currentTimeMillis());
startRegistrationOrOnSession();
if (trackGooglePurchase != null) {
trackGooglePurchase.trackIAP();
}
NotificationRestorer.asyncRestore(appContext);
getCurrentPermissionState(appContext).refreshAsTo();
if ((trackFirebaseAnalytics != null) && (getFirebaseAnalyticsEnabled(appContext))) {
trackFirebaseAnalytics.trackInfluenceOpenEvent();
}
OneSignalSyncServiceUtils.cancelSyncTask(appContext);
}
@WorkerThread
static boolean onAppLostFocus()
{
boolean bool2 = false;
foreground = false;
if (!initDone) {
return false;
}
if (trackAmazonPurchase != null) {
trackAmazonPurchase.checkListener();
}
if (lastTrackedFocusTime == -1L) {
return false;
}
long l = ((SystemClock.elapsedRealtime() - lastTrackedFocusTime) / 1000.0D + 0.5D);
lastTrackedFocusTime = SystemClock.elapsedRealtime();
boolean bool1 = bool2;
if (l >= 0L)
{
if (l > 86400L) {
return false;
}
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Android Context not found, please call OneSignal.init when your app starts.");
return false;
}
bool1 = scheduleSyncService();
setLastSessionTime(System.currentTimeMillis());
l = GetUnsentActiveTime() + l;
SaveUnsentActiveTime(l);
if ((l >= 60L) && (getUserId() != null))
{
if (!bool1) {
OneSignalSyncServiceUtils.scheduleSyncTask(appContext);
}
OneSignalSyncServiceUtils.syncOnFocusTime();
return false;
}
bool1 = bool2;
if (l >= 60L) {
bool1 = true;
}
}
return bool1;
}
private static void onTaskRan(long paramLong)
{
if (lastTaskId.get() == paramLong)
{
Log(OneSignal.LOG_LEVEL.INFO, "Last Pending Task has ran, shutting down");
pendingTaskExecutor.shutdown();
}
}
private static boolean openURLFromNotification(Context paramContext, JSONArray paramJSONArray)
{
int j = paramJSONArray.length();
int i = 0;
boolean bool2;
for (boolean bool1 = false; i < j; bool1 = bool2)
{
try
{
Object localObject1 = paramJSONArray.getJSONObject(i);
if (!((JSONObject)localObject1).has("custom"))
{
bool2 = bool1;
}
else
{
localObject1 = new JSONObject(((JSONObject)localObject1).optString("custom"));
bool2 = bool1;
if (((JSONObject)localObject1).has("u"))
{
localObject2 = ((JSONObject)localObject1).optString("u", null);
localObject1 = localObject2;
if (!((String)localObject2).contains("://"))
{
localObject1 = new StringBuilder("http://");
((StringBuilder)localObject1).append((String)localObject2);
localObject1 = ((StringBuilder)localObject1).toString();
}
localObject1 = new Intent("android.intent.action.VIEW", Uri.parse(((String)localObject1).trim()));
((Intent)localObject1).addFlags(1476919296);
paramContext.startActivity((Intent)localObject1);
bool2 = true;
}
}
}
catch (Throwable localThrowable)
{
Object localObject2 = OneSignal.LOG_LEVEL.ERROR;
StringBuilder localStringBuilder = new StringBuilder("Error parsing JSON item ");
localStringBuilder.append(i);
localStringBuilder.append("/");
localStringBuilder.append(j);
localStringBuilder.append(" for launching a web URL.");
Log((OneSignal.LOG_LEVEL)localObject2, localStringBuilder.toString(), localThrowable);
bool2 = bool1;
}
i += 1;
}
return bool1;
}
public static void postNotification(String paramString, OneSignal.PostNotificationResponseHandler paramPostNotificationResponseHandler)
{
try
{
postNotification(new JSONObject(paramString), paramPostNotificationResponseHandler);
return;
}
catch (JSONException paramPostNotificationResponseHandler)
{
StringBuilder localStringBuilder;
for (;;) {}
}
paramPostNotificationResponseHandler = OneSignal.LOG_LEVEL.ERROR;
localStringBuilder = new StringBuilder("Invalid postNotification JSON format: ");
localStringBuilder.append(paramString);
Log(paramPostNotificationResponseHandler, localStringBuilder.toString());
}
public static void postNotification(JSONObject paramJSONObject, OneSignal.PostNotificationResponseHandler paramPostNotificationResponseHandler)
{
try
{
if (!paramJSONObject.has("app_id")) {
paramJSONObject.put("app_id", getSavedAppId());
}
OneSignalRestClient.post("notifications/", paramJSONObject, new OneSignal.12(paramPostNotificationResponseHandler));
return;
}
catch (JSONException paramJSONObject)
{
Log(OneSignal.LOG_LEVEL.ERROR, "HTTP create notification json exception!", paramJSONObject);
if (paramPostNotificationResponseHandler != null) {
try
{
paramPostNotificationResponseHandler.onFailure(new JSONObject("{'error': 'HTTP create notification json exception!'}"));
return;
}
catch (JSONException paramJSONObject)
{
paramJSONObject.printStackTrace();
}
}
}
}
public static void promptLocation()
{
OneSignal.20 local20 = new OneSignal.20();
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
local20.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not prompt for location at this time - moving this operation to awaiting queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(local20));
}
private static void registerForPushToken()
{
Object localObject;
if (deviceType == 2) {
localObject = new PushRegistratorADM();
} else {
localObject = new PushRegistratorGPS();
}
((PushRegistrator)localObject).registerForPush(appContext, mGoogleProjectNumber, new OneSignal.3());
}
private static void registerUser()
{
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.DEBUG;
StringBuilder localStringBuilder = new StringBuilder("registerUser: registerForPushFired:");
localStringBuilder.append(registerForPushFired);
localStringBuilder.append(", locationFired: ");
localStringBuilder.append(locationFired);
localStringBuilder.append(", awlFired: ");
localStringBuilder.append(awlFired);
Log(localLOG_LEVEL, localStringBuilder.toString());
if ((registerForPushFired) && (locationFired))
{
if (!awlFired) {
return;
}
new Thread(new OneSignal.7(), "OS_REG_USER").start();
}
}
private static void registerUserTask()
{
Object localObject2 = appContext.getPackageName();
Object localObject1 = appContext.getPackageManager();
JSONObject localJSONObject = new JSONObject();
localJSONObject.put("app_id", appId);
Object localObject3 = mainAdIdProvider.getIdentifier(appContext);
if (localObject3 != null) {
localJSONObject.put("ad_id", localObject3);
}
localJSONObject.put("device_os", Build.VERSION.RELEASE);
localJSONObject.put("timezone", getTimeZoneOffset());
localJSONObject.put("language", OSUtils.getCorrectedLanguage());
localJSONObject.put("sdk", "030803");
localJSONObject.put("sdk_type", sdkType);
localJSONObject.put("android_package", localObject2);
localJSONObject.put("device_model", Build.MODEL);
try
{
localJSONObject.put("game_version", ((PackageManager)localObject1).getPackageInfo((String)localObject2, 0).versionCode);
try
{
localObject1 = ((PackageManager)localObject1).getInstalledPackages(0);
localObject2 = new JSONArray();
localObject3 = MessageDigest.getInstance("SHA-256");
i = 0;
}
catch (Throwable localThrowable)
{
for (;;)
{
int i;
String str;
continue;
i += 1;
}
}
if (i < ((List)localObject1).size())
{
((MessageDigest)localObject3).update(((PackageInfo)((List)localObject1).get(i)).packageName.getBytes());
str = Base64.encodeToString(((MessageDigest)localObject3).digest(), 2);
if (awl.has(str)) {
((JSONArray)localObject2).put(str);
}
}
else
{
localJSONObject.put("pkgs", localObject2);
localJSONObject.put("net_type", osUtils.getNetType());
localJSONObject.put("carrier", osUtils.getCarrierName());
localJSONObject.put("rooted", RootToolsInternalMethods.isRooted());
OneSignalStateSynchronizer.updateDeviceInfo(localJSONObject);
localJSONObject = new JSONObject();
localJSONObject.put("identifier", lastRegistrationId);
localJSONObject.put("subscribableStatus", subscribableStatus);
localJSONObject.put("androidPermission", areNotificationsEnabledForSubscribedState());
localJSONObject.put("device_type", deviceType);
OneSignalStateSynchronizer.updatePushState(localJSONObject);
if ((shareLocation) && (lastLocationPoint != null)) {
OneSignalStateSynchronizer.updateLocation(lastLocationPoint);
}
if (sendAsSession) {
OneSignalStateSynchronizer.setSyncAsNewSession();
}
waitingToPostStateSync = false;
return;
}
}
catch (PackageManager.NameNotFoundException localNameNotFoundException)
{
for (;;) {}
}
}
public static void removeEmailSubscriptionObserver(@NonNull OSEmailSubscriptionObserver paramOSEmailSubscriptionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not modify email subscription observer");
return;
}
getEmailSubscriptionStateChangesObserver().removeObserver(paramOSEmailSubscriptionObserver);
}
public static void removeNotificationOpenedHandler()
{
getCurrentOrNewInitBuilder().mNotificationOpenedHandler = null;
}
public static void removeNotificationReceivedHandler()
{
getCurrentOrNewInitBuilder().mNotificationReceivedHandler = null;
}
public static void removePermissionObserver(OSPermissionObserver paramOSPermissionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not modify permission observer");
return;
}
getPermissionStateChangesObserver().removeObserver(paramOSPermissionObserver);
}
public static void removeSubscriptionObserver(OSSubscriptionObserver paramOSSubscriptionObserver)
{
if (appContext == null)
{
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Could not modify subscription observer");
return;
}
getSubscriptionStateChangesObserver().removeObserver(paramOSSubscriptionObserver);
}
private static void runNotificationOpenedCallback(JSONArray paramJSONArray, boolean paramBoolean1, boolean paramBoolean2)
{
if ((mInitBuilder != null) && (mInitBuilder.mNotificationOpenedHandler != null))
{
fireNotificationOpenedHandler(generateOsNotificationOpenResult(paramJSONArray, paramBoolean1, paramBoolean2));
return;
}
unprocessedOpenedNotifis.add(paramJSONArray);
}
static void saveEmailId(String paramString)
{
emailId = paramString;
if (appContext == null) {
return;
}
String str = OneSignalPrefs.PREFS_ONESIGNAL;
if ("".equals(emailId)) {
paramString = null;
} else {
paramString = emailId;
}
OneSignalPrefs.saveString(str, "OS_EMAIL_ID", paramString);
}
static void saveFilterOtherGCMReceivers(boolean paramBoolean)
{
if (appContext == null) {
return;
}
OneSignalPrefs.saveBool(OneSignalPrefs.PREFS_ONESIGNAL, "OS_FILTER_OTHER_GCM_RECEIVERS", paramBoolean);
}
static void saveUserId(String paramString)
{
userId = paramString;
if (appContext == null) {
return;
}
OneSignalPrefs.saveString(OneSignalPrefs.PREFS_ONESIGNAL, "GT_PLAYER_ID", userId);
}
static boolean scheduleSyncService()
{
boolean bool = OneSignalStateSynchronizer.persist();
if (bool) {
OneSignalSyncServiceUtils.scheduleSyncTask(appContext);
}
return (LocationGMS.scheduleUpdate(appContext)) || (bool);
}
static void sendOnFocus(long paramLong, boolean paramBoolean)
{
try
{
JSONObject localJSONObject = new JSONObject().put("app_id", appId).put("type", 1).put("state", "ping").put("active_time", paramLong);
addNetType(localJSONObject);
sendOnFocusToPlayer(getUserId(), localJSONObject, paramBoolean);
String str = getEmailId();
if (str != null) {
sendOnFocusToPlayer(str, localJSONObject, paramBoolean);
}
return;
}
catch (Throwable localThrowable)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Generating on_focus:JSON Failed.", localThrowable);
}
}
private static void sendOnFocusToPlayer(String paramString, JSONObject paramJSONObject, boolean paramBoolean)
{
Object localObject = new StringBuilder("players/");
((StringBuilder)localObject).append(paramString);
((StringBuilder)localObject).append("/on_focus");
paramString = ((StringBuilder)localObject).toString();
localObject = new OneSignal.6();
if (paramBoolean)
{
OneSignalRestClient.postSync(paramString, paramJSONObject, (OneSignalRestClient.ResponseHandler)localObject);
return;
}
OneSignalRestClient.post(paramString, paramJSONObject, (OneSignalRestClient.ResponseHandler)localObject);
}
static void sendPurchases(JSONArray paramJSONArray, boolean paramBoolean, OneSignalRestClient.ResponseHandler paramResponseHandler)
{
if (getUserId() == null)
{
paramJSONArray = new OneSignal.IAPUpdateJob(paramJSONArray);
iapUpdateJob = paramJSONArray;
paramJSONArray.newAsExisting = paramBoolean;
iapUpdateJob.restResponseHandler = paramResponseHandler;
return;
}
try
{
JSONObject localJSONObject = new JSONObject();
localJSONObject.put("app_id", appId);
if (paramBoolean) {
localJSONObject.put("existing", true);
}
localJSONObject.put("purchases", paramJSONArray);
paramJSONArray = new StringBuilder("players/");
paramJSONArray.append(getUserId());
paramJSONArray.append("/on_purchase");
OneSignalRestClient.post(paramJSONArray.toString(), localJSONObject, paramResponseHandler);
if (getEmailId() != null)
{
paramJSONArray = new StringBuilder("players/");
paramJSONArray.append(getEmailId());
paramJSONArray.append("/on_purchase");
OneSignalRestClient.post(paramJSONArray.toString(), localJSONObject, null);
}
return;
}
catch (Throwable paramJSONArray)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Failed to generate JSON for sendPurchases.", paramJSONArray);
}
}
public static void sendTag(String paramString1, String paramString2)
{
try
{
sendTags(new JSONObject().put(paramString1, paramString2));
return;
}
catch (JSONException paramString1)
{
paramString1.printStackTrace();
}
}
public static void sendTags(String paramString)
{
try
{
sendTags(new JSONObject(paramString));
return;
}
catch (JSONException paramString)
{
Log(OneSignal.LOG_LEVEL.ERROR, "Generating JSONObject for sendTags failed!", paramString);
}
}
public static void sendTags(JSONObject paramJSONObject)
{
paramJSONObject = new OneSignal.11(paramJSONObject);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
paramJSONObject.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "You must initialize OneSignal before modifying tags!Moving this operation to a pending task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(paramJSONObject));
}
public static void setEmail(@NonNull String paramString)
{
setEmail(paramString, null, null);
}
public static void setEmail(@NonNull String paramString, OneSignal.EmailUpdateHandler paramEmailUpdateHandler)
{
setEmail(paramString, null, paramEmailUpdateHandler);
}
public static void setEmail(@NonNull String paramString1, @Nullable String paramString2)
{
setEmail(paramString1, paramString2, null);
}
public static void setEmail(@NonNull String paramString1, @Nullable String paramString2, @Nullable OneSignal.EmailUpdateHandler paramEmailUpdateHandler)
{
if (!OSUtils.isValidEmail(paramString1))
{
if (paramEmailUpdateHandler != null) {
paramEmailUpdateHandler.onFailure(new OneSignal.EmailUpdateError(OneSignal.EmailErrorType.VALIDATION, "Email is invalid"));
}
Log(OneSignal.LOG_LEVEL.ERROR, "Email is invalid");
return;
}
if ((useEmailAuth) && (paramString2 == null))
{
if (paramEmailUpdateHandler != null) {
paramEmailUpdateHandler.onFailure(new OneSignal.EmailUpdateError(OneSignal.EmailErrorType.REQUIRES_EMAIL_AUTH, "Email authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard."));
}
Log(OneSignal.LOG_LEVEL.ERROR, "Email authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard.");
return;
}
emailUpdateHandler = paramEmailUpdateHandler;
paramString1 = new OneSignal.9(paramString1, paramString2);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
paramString1.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "You should initialize OneSignal before calling setEmail! Moving this operation to a pending task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(paramString1));
}
public static void setInFocusDisplaying(int paramInt)
{
setInFocusDisplaying(getInFocusDisplaying(paramInt));
}
public static void setInFocusDisplaying(OneSignal.OSInFocusDisplayOption paramOSInFocusDisplayOption)
{
getCurrentOrNewInitBuilder().mDisplayOptionCarryOver = true;
getCurrentOrNewInitBuilder().mDisplayOption = paramOSInFocusDisplayOption;
}
static void setLastSessionTime(long paramLong)
{
OneSignalPrefs.saveLong(OneSignalPrefs.PREFS_ONESIGNAL, "OS_LAST_SESSION_TIME", paramLong);
}
public static void setLocationShared(boolean paramBoolean)
{
shareLocation = paramBoolean;
if (!paramBoolean) {
OneSignalStateSynchronizer.clearLocation();
}
OneSignal.LOG_LEVEL localLOG_LEVEL = OneSignal.LOG_LEVEL.DEBUG;
StringBuilder localStringBuilder = new StringBuilder("shareLocation:");
localStringBuilder.append(shareLocation);
Log(localLOG_LEVEL, localStringBuilder.toString());
}
public static void setLogLevel(int paramInt1, int paramInt2)
{
setLogLevel(getLogLevel(paramInt1), getLogLevel(paramInt2));
}
public static void setLogLevel(OneSignal.LOG_LEVEL paramLOG_LEVEL1, OneSignal.LOG_LEVEL paramLOG_LEVEL2)
{
logCatLevel = paramLOG_LEVEL1;
visualLogLevel = paramLOG_LEVEL2;
}
public static void setSubscription(boolean paramBoolean)
{
OneSignal.19 local19 = new OneSignal.19(paramBoolean);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
local19.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "OneSignal.init has not been called. Moving subscription action to a waiting task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(local19));
}
private static boolean shouldRunTaskThroughQueue()
{
if ((initDone) && (pendingTaskExecutor == null)) {
return false;
}
if ((!initDone) && (pendingTaskExecutor == null)) {
return true;
}
return (pendingTaskExecutor != null) && (!pendingTaskExecutor.isShutdown());
}
public static OneSignal.Builder startInit(Context paramContext)
{
return new OneSignal.Builder(paramContext, null);
}
private static void startLocationUpdate()
{
OneSignal.2 local2 = new OneSignal.2();
boolean bool;
if ((mInitBuilder.mPromptLocation) && (!promptedLocation)) {
bool = true;
} else {
bool = false;
}
LocationGMS.getLocation(appContext, bool, local2);
}
private static void startPendingTasks()
{
if (!taskQueueWaitingForInit.isEmpty())
{
pendingTaskExecutor = Executors.newSingleThreadExecutor(new OneSignal.1());
while (!taskQueueWaitingForInit.isEmpty()) {
pendingTaskExecutor.submit((Runnable)taskQueueWaitingForInit.poll());
}
}
}
private static void startRegistrationOrOnSession()
{
if (waitingToPostStateSync) {
return;
}
boolean bool2 = true;
waitingToPostStateSync = true;
registerForPushFired = false;
if (sendAsSession) {
locationFired = false;
}
startLocationUpdate();
makeAndroidParamsRequest();
boolean bool1 = bool2;
if (!promptedLocation) {
if (mInitBuilder.mPromptLocation) {
bool1 = bool2;
} else {
bool1 = false;
}
}
promptedLocation = bool1;
}
@Deprecated
public static void syncHashedEmail(String paramString)
{
if (!OSUtils.isValidEmail(paramString)) {
return;
}
paramString = new OneSignal.8(paramString);
if ((appContext != null) && (!shouldRunTaskThroughQueue()))
{
paramString.run();
return;
}
Log(OneSignal.LOG_LEVEL.ERROR, "You should initialize OneSignal before calling syncHashedEmail! Moving this operation to a pending task queue.");
addTaskToQueue(new OneSignal.PendingTaskRunnable(paramString));
}
static void updateEmailIdDependents(String paramString)
{
saveEmailId(paramString);
getCurrentEmailSubscriptionState(appContext).setEmailUserId(paramString);
try
{
OneSignalStateSynchronizer.updatePushState(new JSONObject().put("parent_player_id", paramString));
return;
}
catch (JSONException paramString)
{
paramString.printStackTrace();
}
}
static void updateOnSessionDependents()
{
sendAsSession = false;
setLastSessionTime(System.currentTimeMillis());
}
static void updateUserIdDependents(String paramString)
{
saveUserId(paramString);
fireIdsAvailableCallback();
internalFireGetTagsCallback(pendingGetTagsHandler);
getCurrentSubscriptionState(appContext).setUserId(paramString);
if (iapUpdateJob != null)
{
sendPurchases(iapUpdateJob.toReport, iapUpdateJob.newAsExisting, iapUpdateJob.restResponseHandler);
iapUpdateJob = null;
}
OneSignalStateSynchronizer.refreshEmailState();
OneSignalChromeTab.setup(appContext, appId, paramString, AdvertisingIdProviderGPS.getLastValue());
}
}
| [
"[email protected]"
] | |
1a5122952d5244e80429ebe489831d71e142acde | dae43d96df2ed3dee9484c3b71e9c80ffb402057 | /simulation/JavaGazebo/src/main/java/gazebo/msgs/GzJoystick.java | 9f1d1a6ea610400eafb127c729e07b12c22f9d68 | [
"BSD-3-Clause"
] | permissive | PeterMitrano/allwpilib | 00b1894d942cce1368ec8f2fd9ea9e1c4e10ea68 | 29d2d2a846137851d0f694832053a0165749a9f7 | refs/heads/master | 2020-04-06T06:57:39.946992 | 2016-08-29T15:10:29 | 2016-08-29T15:10:29 | 58,664,801 | 1 | 0 | NOASSERTION | 2019-07-02T20:53:07 | 2016-05-12T18:02:20 | C++ | UTF-8 | Java | false | true | 22,734 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: frc_gazebo_plugin/msgs/joystick.proto
package gazebo.msgs;
public final class GzJoystick {
private GzJoystick() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
public interface JoystickOrBuilder
extends com.google.protobuf.MessageOrBuilder {
// repeated double axes = 1;
/**
* <code>repeated double axes = 1;</code>
*/
java.util.List<java.lang.Double> getAxesList();
/**
* <code>repeated double axes = 1;</code>
*/
int getAxesCount();
/**
* <code>repeated double axes = 1;</code>
*/
double getAxes(int index);
// repeated bool buttons = 2;
/**
* <code>repeated bool buttons = 2;</code>
*/
java.util.List<java.lang.Boolean> getButtonsList();
/**
* <code>repeated bool buttons = 2;</code>
*/
int getButtonsCount();
/**
* <code>repeated bool buttons = 2;</code>
*/
boolean getButtons(int index);
}
/**
* Protobuf type {@code gazebo.msgs.Joystick}
*/
public static final class Joystick extends
com.google.protobuf.GeneratedMessage
implements JoystickOrBuilder {
// Use Joystick.newBuilder() to construct.
private Joystick(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
super(builder);
this.unknownFields = builder.getUnknownFields();
}
private Joystick(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }
private static final Joystick defaultInstance;
public static Joystick getDefaultInstance() {
return defaultInstance;
}
public Joystick getDefaultInstanceForType() {
return defaultInstance;
}
private final com.google.protobuf.UnknownFieldSet unknownFields;
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Joystick(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
initFields();
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
default: {
if (!parseUnknownField(input, unknownFields,
extensionRegistry, tag)) {
done = true;
}
break;
}
case 9: {
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = new java.util.ArrayList<java.lang.Double>();
mutable_bitField0_ |= 0x00000001;
}
axes_.add(input.readDouble());
break;
}
case 10: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) == 0x00000001) && input.getBytesUntilLimit() > 0) {
axes_ = new java.util.ArrayList<java.lang.Double>();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
axes_.add(input.readDouble());
}
input.popLimit(limit);
break;
}
case 16: {
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>();
mutable_bitField0_ |= 0x00000002;
}
buttons_.add(input.readBool());
break;
}
case 18: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>();
mutable_bitField0_ |= 0x00000002;
}
while (input.getBytesUntilLimit() > 0) {
buttons_.add(input.readBool());
}
input.popLimit(limit);
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e.getMessage()).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = java.util.Collections.unmodifiableList(axes_);
}
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = java.util.Collections.unmodifiableList(buttons_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzJoystick.Joystick.class, gazebo.msgs.GzJoystick.Joystick.Builder.class);
}
public static com.google.protobuf.Parser<Joystick> PARSER =
new com.google.protobuf.AbstractParser<Joystick>() {
public Joystick parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Joystick(input, extensionRegistry);
}
};
@java.lang.Override
public com.google.protobuf.Parser<Joystick> getParserForType() {
return PARSER;
}
// repeated double axes = 1;
public static final int AXES_FIELD_NUMBER = 1;
private java.util.List<java.lang.Double> axes_;
/**
* <code>repeated double axes = 1;</code>
*/
public java.util.List<java.lang.Double>
getAxesList() {
return axes_;
}
/**
* <code>repeated double axes = 1;</code>
*/
public int getAxesCount() {
return axes_.size();
}
/**
* <code>repeated double axes = 1;</code>
*/
public double getAxes(int index) {
return axes_.get(index);
}
// repeated bool buttons = 2;
public static final int BUTTONS_FIELD_NUMBER = 2;
private java.util.List<java.lang.Boolean> buttons_;
/**
* <code>repeated bool buttons = 2;</code>
*/
public java.util.List<java.lang.Boolean>
getButtonsList() {
return buttons_;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public int getButtonsCount() {
return buttons_.size();
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public boolean getButtons(int index) {
return buttons_.get(index);
}
private void initFields() {
axes_ = java.util.Collections.emptyList();
buttons_ = java.util.Collections.emptyList();
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1;
memoizedIsInitialized = 1;
return true;
}
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
getSerializedSize();
for (int i = 0; i < axes_.size(); i++) {
output.writeDouble(1, axes_.get(i));
}
for (int i = 0; i < buttons_.size(); i++) {
output.writeBool(2, buttons_.get(i));
}
getUnknownFields().writeTo(output);
}
private int memoizedSerializedSize = -1;
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
{
int dataSize = 0;
dataSize = 8 * getAxesList().size();
size += dataSize;
size += 1 * getAxesList().size();
}
{
int dataSize = 0;
dataSize = 1 * getButtonsList().size();
size += dataSize;
size += 1 * getButtonsList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
}
private static final long serialVersionUID = 0L;
@java.lang.Override
protected java.lang.Object writeReplace()
throws java.io.ObjectStreamException {
return super.writeReplace();
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseDelimitedFrom(input, extensionRegistry);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return PARSER.parseFrom(input);
}
public static gazebo.msgs.GzJoystick.Joystick parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return PARSER.parseFrom(input, extensionRegistry);
}
public static Builder newBuilder() { return Builder.create(); }
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder(gazebo.msgs.GzJoystick.Joystick prototype) {
return newBuilder().mergeFrom(prototype);
}
public Builder toBuilder() { return newBuilder(this); }
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code gazebo.msgs.Joystick}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder<Builder>
implements gazebo.msgs.GzJoystick.JoystickOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
internalGetFieldAccessorTable() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_fieldAccessorTable
.ensureFieldAccessorsInitialized(
gazebo.msgs.GzJoystick.Joystick.class, gazebo.msgs.GzJoystick.Joystick.Builder.class);
}
// Construct using gazebo.msgs.GzJoystick.Joystick.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessage.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
}
}
private static Builder create() {
return new Builder();
}
public Builder clear() {
super.clear();
axes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
buttons_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
return this;
}
public Builder clone() {
return create().mergeFrom(buildPartial());
}
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return gazebo.msgs.GzJoystick.internal_static_gazebo_msgs_Joystick_descriptor;
}
public gazebo.msgs.GzJoystick.Joystick getDefaultInstanceForType() {
return gazebo.msgs.GzJoystick.Joystick.getDefaultInstance();
}
public gazebo.msgs.GzJoystick.Joystick build() {
gazebo.msgs.GzJoystick.Joystick result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
public gazebo.msgs.GzJoystick.Joystick buildPartial() {
gazebo.msgs.GzJoystick.Joystick result = new gazebo.msgs.GzJoystick.Joystick(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = java.util.Collections.unmodifiableList(axes_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.axes_ = axes_;
if (((bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = java.util.Collections.unmodifiableList(buttons_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.buttons_ = buttons_;
onBuilt();
return result;
}
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof gazebo.msgs.GzJoystick.Joystick) {
return mergeFrom((gazebo.msgs.GzJoystick.Joystick)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(gazebo.msgs.GzJoystick.Joystick other) {
if (other == gazebo.msgs.GzJoystick.Joystick.getDefaultInstance()) return this;
if (!other.axes_.isEmpty()) {
if (axes_.isEmpty()) {
axes_ = other.axes_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAxesIsMutable();
axes_.addAll(other.axes_);
}
onChanged();
}
if (!other.buttons_.isEmpty()) {
if (buttons_.isEmpty()) {
buttons_ = other.buttons_;
bitField0_ = (bitField0_ & ~0x00000002);
} else {
ensureButtonsIsMutable();
buttons_.addAll(other.buttons_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
public final boolean isInitialized() {
return true;
}
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
gazebo.msgs.GzJoystick.Joystick parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (gazebo.msgs.GzJoystick.Joystick) e.getUnfinishedMessage();
throw e;
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
// repeated double axes = 1;
private java.util.List<java.lang.Double> axes_ = java.util.Collections.emptyList();
private void ensureAxesIsMutable() {
if (!((bitField0_ & 0x00000001) == 0x00000001)) {
axes_ = new java.util.ArrayList<java.lang.Double>(axes_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated double axes = 1;</code>
*/
public java.util.List<java.lang.Double>
getAxesList() {
return java.util.Collections.unmodifiableList(axes_);
}
/**
* <code>repeated double axes = 1;</code>
*/
public int getAxesCount() {
return axes_.size();
}
/**
* <code>repeated double axes = 1;</code>
*/
public double getAxes(int index) {
return axes_.get(index);
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder setAxes(
int index, double value) {
ensureAxesIsMutable();
axes_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder addAxes(double value) {
ensureAxesIsMutable();
axes_.add(value);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder addAllAxes(
java.lang.Iterable<? extends java.lang.Double> values) {
ensureAxesIsMutable();
super.addAll(values, axes_);
onChanged();
return this;
}
/**
* <code>repeated double axes = 1;</code>
*/
public Builder clearAxes() {
axes_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
// repeated bool buttons = 2;
private java.util.List<java.lang.Boolean> buttons_ = java.util.Collections.emptyList();
private void ensureButtonsIsMutable() {
if (!((bitField0_ & 0x00000002) == 0x00000002)) {
buttons_ = new java.util.ArrayList<java.lang.Boolean>(buttons_);
bitField0_ |= 0x00000002;
}
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public java.util.List<java.lang.Boolean>
getButtonsList() {
return java.util.Collections.unmodifiableList(buttons_);
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public int getButtonsCount() {
return buttons_.size();
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public boolean getButtons(int index) {
return buttons_.get(index);
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder setButtons(
int index, boolean value) {
ensureButtonsIsMutable();
buttons_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder addButtons(boolean value) {
ensureButtonsIsMutable();
buttons_.add(value);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder addAllButtons(
java.lang.Iterable<? extends java.lang.Boolean> values) {
ensureButtonsIsMutable();
super.addAll(values, buttons_);
onChanged();
return this;
}
/**
* <code>repeated bool buttons = 2;</code>
*/
public Builder clearButtons() {
buttons_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000002);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:gazebo.msgs.Joystick)
}
static {
defaultInstance = new Joystick(true);
defaultInstance.initFields();
}
// @@protoc_insertion_point(class_scope:gazebo.msgs.Joystick)
}
private static com.google.protobuf.Descriptors.Descriptor
internal_static_gazebo_msgs_Joystick_descriptor;
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_gazebo_msgs_Joystick_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n%frc_gazebo_plugin/msgs/joystick.proto\022" +
"\013gazebo.msgs\")\n\010Joystick\022\014\n\004axes\030\001 \003(\001\022\017" +
"\n\007buttons\030\002 \003(\010B\014B\nGzJoystick"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
internal_static_gazebo_msgs_Joystick_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_gazebo_msgs_Joystick_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_gazebo_msgs_Joystick_descriptor,
new java.lang.String[] { "Axes", "Buttons", });
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
}, assigner);
}
// @@protoc_insertion_point(outer_class_scope)
}
| [
"[email protected]"
] | |
efc1527fa114ddcb21d3014b9809ef4888435288 | c3a0e4239c802eb3e1adf13d28f8cdf0c11b42e7 | /taptalklive/src/main/java/io/taptalk/taptalklive/Manager/TTLDataManager.java | f4dca98f39c96c6cc16370b6a3ee591a45cd47cf | [] | no_license | jefrylorentono/taptalk-omnichannel-dev | 068251d06c092917eac460673685e736fe5ff0fa | 01f6d2062c09ae7a2265e5a8b7645044c2540341 | refs/heads/master | 2021-05-19T09:52:32.895324 | 2020-04-01T10:29:46 | 2020-04-01T10:29:46 | 251,639,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,982 | java | package io.taptalk.taptalklive.Manager;
import android.util.Log;
import com.orhanobut.hawk.Hawk;
import io.taptalk.TapTalk.Helper.TAPUtils;
import io.taptalk.taptalklive.API.Api.TTLApiManager;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLCommonResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLCreateCaseResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLCreateUserResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLGetCaseListResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLGetProjectConfigsRespone;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLGetTopicListResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLGetUserProfileResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLRequestAccessTokenResponse;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLRequestTicketResponse;
import io.taptalk.taptalklive.API.Model.TTLUserModel;
import io.taptalk.taptalklive.API.Subscriber.TTLDefaultSubscriber;
import io.taptalk.taptalklive.API.View.TTLDefaultDataView;
import io.taptalk.taptalklive.TapTalkLive;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.ACCESS_TOKEN;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.ACCESS_TOKEN_EXPIRY;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.ACTIVE_USER;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.APP_KEY_SECRET;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.AUTH_TICKET;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.CASE_EXISTS;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.REFRESH_TOKEN;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.REFRESH_TOKEN_EXPIRY;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.TAPTALK_API_URL;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.TAPTALK_APP_KEY_ID;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.TAPTALK_APP_KEY_SECRET;
import static io.taptalk.taptalklive.Const.TTLConstant.PreferenceKey.TAPTALK_AUTH_TICKET;
public class TTLDataManager {
private static final String TAG = TTLDataManager.class.getSimpleName();
private static TTLDataManager instance;
public static TTLDataManager getInstance() {
return instance == null ? (instance = new TTLDataManager()) : instance;
}
/**
* =========================================================================================== *
* GENERIC METHODS FOR PREFERENCE
* =========================================================================================== *
*/
private void saveBooleanPreference(String key, boolean bool) {
Hawk.put(key, bool);
}
private void saveStringPreference(String key, String string) {
Hawk.put(key, string);
}
private void saveFloatPreference(String key, Float flt) {
Hawk.put(key, flt);
}
private void saveLongTimestampPreference(String key, Long timestamp) {
Hawk.put(key, timestamp);
}
private Boolean getBooleanPreference(String key) {
return Hawk.get(key, false);
}
private String getStringPreference(String key) {
return Hawk.get(key, "");
}
private Float getFloatPreference(String key) {
return Hawk.get(key, null);
}
private Long getLongTimestampPreference(String key) {
return Hawk.get(key, 0L);
}
private Boolean checkPreferenceKeyAvailable(String key) {
return Hawk.contains(key);
}
private void removePreference(String key) {
Hawk.delete(key);
}
/**
* =========================================================================================== *
* PUBLIC METHODS FOR PREFERENCE (CALLS GENERIC METHODS ABOVE)
* PUBLIC METHODS MAY NOT HAVE KEY AS PARAMETER
* =========================================================================================== *
*/
public void deleteAllPreference() {
removeAppKeySecret();
removeAuthTicket();
removeAccessToken();
removeRefreshToken();
removeActiveUser();
removeTapTalkApiUrl();
removeTapTalkAppKeyID();
removeTapTalkAppKeySecret();
removeTapTalkAuthTicket();
removeActiveUserHasExistingCase();
}
/**
* APP KEY SECRET
*/
public String getAppKeySecret() {
return !TapTalkLive.getAppKeySecret().isEmpty() ?
TapTalkLive.getAppKeySecret() :
getStringPreference(APP_KEY_SECRET);
}
public void saveAppKeySecret(String appKeySecret) {
saveStringPreference(APP_KEY_SECRET, appKeySecret);
}
public void removeAppKeySecret() {
removePreference(APP_KEY_SECRET);
}
/**
* AUTH TICKET
*/
public Boolean checkAuthTicketAvailable() {
return checkPreferenceKeyAvailable(AUTH_TICKET);
}
public String getAuthTicket() {
return getStringPreference(AUTH_TICKET);
}
public void saveAuthTicket(String authTicket) {
saveStringPreference(AUTH_TICKET, authTicket);
}
public void removeAuthTicket() {
removePreference(AUTH_TICKET);
}
/**
* ACCESS TOKEN
*/
public Boolean checkAccessTokenAvailable() {
return checkPreferenceKeyAvailable(ACCESS_TOKEN);
}
public String getAccessToken() {
return getStringPreference(ACCESS_TOKEN);
}
public void saveAccessToken(String accessToken) {
saveStringPreference(ACCESS_TOKEN, accessToken);
}
public void saveAccessTokenExpiry(Long accessTokenExpiry) {
saveLongTimestampPreference(ACCESS_TOKEN_EXPIRY, accessTokenExpiry);
}
public long getAccessTokenExpiry() {
return getLongTimestampPreference(ACCESS_TOKEN_EXPIRY);
}
public void removeAccessToken() {
removePreference(ACCESS_TOKEN);
}
/**
* REFRESH TOKEN
*/
public Boolean checkRefreshTokenAvailable() {
return checkPreferenceKeyAvailable(REFRESH_TOKEN);
}
public String getRefreshToken() {
return getStringPreference(REFRESH_TOKEN);
}
public void saveRefreshToken(String refreshToken) {
saveStringPreference(REFRESH_TOKEN, refreshToken);
}
public void saveRefreshTokenExpiry(Long refreshTokenExpiry) {
saveLongTimestampPreference(REFRESH_TOKEN_EXPIRY, refreshTokenExpiry);
}
public void removeRefreshToken() {
removePreference(REFRESH_TOKEN);
}
/**
* ACTIVE USER
*/
public boolean checkActiveUserExists() {
return checkPreferenceKeyAvailable(ACTIVE_USER) && null != getActiveUser();
}
public TTLUserModel getActiveUser() {
return Hawk.get(ACTIVE_USER, null);
}
public void saveActiveUser(TTLUserModel user) {
Hawk.put(ACTIVE_USER, user);
}
public void removeActiveUser() {
removePreference(ACTIVE_USER);
}
/**
* TAPTALK API URL
*/
public Boolean checkTapTalkApiUrlAvailable() {
return checkPreferenceKeyAvailable(TAPTALK_API_URL);
}
public String getTapTalkApiUrl() {
return getStringPreference(TAPTALK_API_URL);
}
public void saveTapTalkApiUrl(String tapTalkApiUrl) {
saveStringPreference(TAPTALK_API_URL, tapTalkApiUrl);
}
public void removeTapTalkApiUrl() {
removePreference(TAPTALK_API_URL);
}
/**
* TAPTALK APP KEY ID
*/
public Boolean checkTapTalkAppKeyIDAvailable() {
return checkPreferenceKeyAvailable(TAPTALK_APP_KEY_ID);
}
public String getTapTalkAppKeyID() {
return getStringPreference(TAPTALK_APP_KEY_ID);
}
public void saveTapTalkAppKeyID(String tapTalkAppKeyID) {
saveStringPreference(TAPTALK_APP_KEY_ID, tapTalkAppKeyID);
}
public void removeTapTalkAppKeyID() {
removePreference(TAPTALK_APP_KEY_ID);
}
/**
* TAPTALK APP KEY SECRET
*/
public Boolean checkTapTalkAppKeySecretAvailable() {
return checkPreferenceKeyAvailable(TAPTALK_APP_KEY_SECRET);
}
public String getTapTalkAppKeySecret() {
return getStringPreference(TAPTALK_APP_KEY_SECRET);
}
public void saveTapTalkAppKeySecret(String tapTalkAppKeySecret) {
saveStringPreference(TAPTALK_APP_KEY_SECRET, tapTalkAppKeySecret);
}
public void removeTapTalkAppKeySecret() {
removePreference(TAPTALK_APP_KEY_SECRET);
}
/**
* TAPTALK AUTH TICKET
*/
public String getTapTalkAuthTicket() {
return getStringPreference(TAPTALK_AUTH_TICKET);
}
public void saveTapTalkAuthTicket(String tapTalkAuthTicket) {
saveStringPreference(TAPTALK_AUTH_TICKET, tapTalkAuthTicket);
}
public void removeTapTalkAuthTicket() {
removePreference(TAPTALK_AUTH_TICKET);
}
/**
* USER HAS EXISTING CASE
*/
public boolean activeUserHasExistingCase() {
Boolean caseExists = getBooleanPreference(CASE_EXISTS);
return null != caseExists ? caseExists : false;
}
public void saveActiveUserHasExistingCase(boolean hasExistingCase) {
saveBooleanPreference(CASE_EXISTS, hasExistingCase);
}
public void removeActiveUserHasExistingCase() {
removePreference(CASE_EXISTS);
}
/**
* =========================================================================================== *
* API CALLS
* =========================================================================================== *
*/
public void requestAccessToken(TTLDefaultDataView<TTLRequestAccessTokenResponse> view) {
TTLApiManager.getInstance().requestAccessToken(new TTLDefaultSubscriber<>(view));
}
public void getProjectConfigs(TTLDefaultDataView<TTLGetProjectConfigsRespone> view) {
TTLApiManager.getInstance().getProjectConfigs(new TTLDefaultSubscriber<>(view));
}
public void requestTapTalkAuthTicket(TTLDefaultDataView<TTLRequestTicketResponse> view) {
TTLApiManager.getInstance().requestTapTalkAuthTicket(new TTLDefaultSubscriber<>(view));
}
public void getTopicList(TTLDefaultDataView<TTLGetTopicListResponse> view) {
TTLApiManager.getInstance().getTopicList(new TTLDefaultSubscriber<>(view));
}
public void createUser(String fullName, String email, TTLDefaultDataView<TTLCreateUserResponse> view) {
TTLApiManager.getInstance().createUser(fullName, email, new TTLDefaultSubscriber<>(view));
}
public void getUserProfile(TTLDefaultDataView<TTLGetUserProfileResponse> view) {
TTLApiManager.getInstance().getUserProfile(new TTLDefaultSubscriber<>(view));
}
public void createCase(Integer topicID, String message, TTLDefaultDataView<TTLCreateCaseResponse> view) {
TTLApiManager.getInstance().createCase(topicID, message, new TTLDefaultSubscriber<>(view));
}
public void getCaseList(TTLDefaultDataView<TTLGetCaseListResponse> view) {
TTLApiManager.getInstance().getCaseList(new TTLDefaultSubscriber<>(view));
}
public void getCaseDetailsByID(Integer caseID, TTLDefaultDataView<TTLCreateCaseResponse> view) {
TTLApiManager.getInstance().getCaseDetailsByID(caseID, new TTLDefaultSubscriber<>(view));
}
public void closeCase(Integer caseID, TTLDefaultDataView<TTLCommonResponse> view) {
TTLApiManager.getInstance().closeCase(caseID, new TTLDefaultSubscriber<>(view));
}
public void rateConversation(Integer caseID, Integer rating, String note, TTLDefaultDataView<TTLCommonResponse> view) {
TTLApiManager.getInstance().rateConversation(caseID, rating, note, new TTLDefaultSubscriber<>(view));
}
public void logout(TTLDefaultDataView<TTLCommonResponse> view) {
TTLApiManager.getInstance().logout(new TTLDefaultSubscriber<>(view));
}
}
| [
"[email protected]"
] | |
a81b5df1c9ccaf95399ebbbc119754b7fee9f9cd | e70020ef264a83ce2787d0999aeba7185b815e08 | /sample/src/main/java/sample/server.java | 727f1edc18edc7c010b76fe75fa29da89055a9c4 | [] | no_license | M-Aqeel-Afzal/sample | 703d9cd2c4bb684604361fc9adf944f42ef18bfc | 697b19ce3728978b20d076d4b0d8a82a1d8f4679 | refs/heads/master | 2023-08-16T22:49:47.826770 | 2021-09-17T09:02:10 | 2021-09-17T09:02:10 | 407,453,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 129 | java | package sample;
public class server {
public static void main(String[] args){
System.out.println("hello word ");
}
}
| [
"[email protected]"
] | |
271a75e5470a2a4351e0c0641a2183ee50b1a409 | ba0895475e2425a357814b20dfd5db2f1384effb | /app/src/main/java/com/nayana/bhoj/apps/currencyconverter/DemoTabWithNotificationMarkActivity.java | 74397aa1070b62dfa4c9a8c44ea3b3a7954b95db | [] | no_license | NayanaRBhoj/CurrencyConverter | e2a9db0046c4d59b1097b2e6a34768394201f47b | 5e55b0f304e33d41575a49c8ff98d9f217e5b7cf | refs/heads/master | 2020-09-04T06:16:00.999944 | 2019-11-05T06:59:23 | 2019-11-05T06:59:23 | 219,674,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,201 | java | package com.nayana.bhoj.apps.currencyconverter;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItem;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;
import java.util.Random;
public class DemoTabWithNotificationMarkActivity extends AppCompatActivity implements
SmartTabLayout.TabProvider {
private static final String KEY_DEMO = "demo";
public static void startActivity(Context context, Demo demo) {
Intent intent = new Intent(context, DemoTabWithNotificationMarkActivity.class);
intent.putExtra(KEY_DEMO, demo.name());
context.startActivity(intent);
}
private Random random = new Random(System.currentTimeMillis());
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo_tab_with_notification_mark);
final Demo demo = getDemo();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle(demo.titleResId);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ViewGroup tab = (ViewGroup) findViewById(R.id.tab);
tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false));
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
final SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
viewPagerTab.setCustomTabView(this);
FragmentPagerItems pages = new FragmentPagerItems(this);
for (int titleResId : demo.tabs()) {
pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class));
}
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter(
getSupportFragmentManager(), pages);
viewPager.setAdapter(adapter);
viewPagerTab.setViewPager(viewPager);
viewPagerTab.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
View tab = viewPagerTab.getTabAt(position);
View mark = tab.findViewById(R.id.custom_tab_notification_mark);
mark.setVisibility(View.GONE);
}
});
findViewById(R.id.test).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position = Math.abs(random.nextInt()) % demo.tabs().length;
View tab = viewPagerTab.getTabAt(position);
View mark = tab.findViewById(R.id.custom_tab_notification_mark);
mark.setVisibility(View.VISIBLE);
}
});
}
@Override
public View createTabView(ViewGroup container, int position, PagerAdapter adapter) {
LayoutInflater inflater = LayoutInflater.from(container.getContext());
Resources res = container.getContext().getResources();
View tab = inflater.inflate(R.layout.custom_tab_icon_and_notification_mark, container, false);
View mark = tab.findViewById(R.id.custom_tab_notification_mark);
mark.setVisibility(View.GONE);
ImageView icon = (ImageView) tab.findViewById(R.id.custom_tab_icon);
switch (position) {
case 0:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_home_white_24dp));
break;
case 1:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_search_white_24dp));
break;
case 2:
icon.setImageDrawable(res.getDrawable(R.drawable.ic_person_white_24dp));
break;
default:
throw new IllegalStateException("Invalid position: " + position);
}
return tab;
}
private Demo getDemo() {
return Demo.valueOf(getIntent().getStringExtra(KEY_DEMO));
}
}
| [
"[email protected]"
] | |
2d4bded55fb8b881889c34253083ddc073ce4e2f | 4d443ec30c27a3d2d2717c3d25f8fb6c5b7721eb | /src/main/java/com/example/demo/ManagementServiceApplication.java | 3800b7e26929477a57a0fe0fa03432b504a36196 | [] | no_license | guyshakk/SongManagementService | f0f1cace0c6746cef49ae2713c5a1375932f4c52 | 5269f57b84e82c1c270123156bcfdb6d8820e539 | refs/heads/master | 2021-05-17T01:30:30.787257 | 2020-04-19T19:21:01 | 2020-04-19T19:21:01 | 250,557,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,912 | java | package com.example.demo;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
@Service
public class ManagementServiceApplication implements ManagementService {
private RestTemplate restTemplate;
private String url;
public ManagementServiceApplication() {
this.restTemplate = new RestTemplate();
}
@Value("${storage.service.url}")
public void setUrl(String url) {
this.url = url;
}
/**Validate song element;
* Check if song already exists;
* Save song and return it if it doesn't already exist and syntactically correct**/
@Override
public Song create(Song song) {
if (!validate(song))
throw new IncorrectInputException("Wrong input supplied - not a valid Song object");
Song s = null;
String id = song.getSongId();
try {
s = getSongById(id);
} catch (EntityNotInDBException e) {
}
if (s != null)
throw new TakenSongIdException("SongId " + id + " already exists");
Song newSong = this.restTemplate
.postForObject(this.url + "/{id}",
song,
Song.class,
id);
return newSong;
}
@Override
public Song getSongById(String id) {
try {
return this.restTemplate
.getForObject(this.url + "/{id}",
Song.class,
id);
} catch (HttpClientErrorException e) {
if (e.getStatusCode().equals(HttpStatus.NOT_FOUND))
throw new EntityNotInDBException();
else throw e;
}
}
@Override
public void updateSong(String id, Song update) {
Song currentSong = getSongById(id);
if (update.getAuthors() != null)
currentSong.setAuthors(update.getAuthors());
if (update.getGenres() != null)
currentSong.setGenres(update.getGenres());
if (update.getLyrics() != null)
currentSong.setLyrics(update.getLyrics());
if (update.getName() != null)
currentSong.setName(update.getName());
if (update.getPerformer() != null)
currentSong.setPerformer(update.getPerformer());
if (update.getProducer() != null)
currentSong.setProducer(update.getProducer());
if (update.getPublishedYear() > 0 && update.getPublishedYear() <= Calendar.getInstance().get(Calendar.YEAR))
currentSong.setPublishedYear(update.getPublishedYear());
this.restTemplate.
put(this.url + "/{id}",
currentSong,
id);
}
@Override
public void deleteAllSongs() {
this.restTemplate.delete(this.url);
}
/**Get the correct page of Songs with criteriaValue in criteriaType field sorted**/
@Override
public List<Song> readSongsBy(String criteriaType, String criteriaValue, int size, int page,
String sortBy, String sortOrder) {
validatePagination(page, size);
validateSortAttributes(sortBy, sortOrder);
try {
return Arrays
.asList
(this.restTemplate
.getForObject
(this.url+"/"+criteriaType+"/{criteriaValue}/{sortBy}/{sortOrder}/{page}/{size}",
Song[].class,
criteriaValue,
sortBy,
sortOrder,
page,
size));
} catch (HttpClientErrorException e) {
if (e.getStatusCode().equals(HttpStatus.NOT_ACCEPTABLE)) {
throw new MissingFieldException("Not all songs in storage have attribute " + criteriaType + "; unable to complete action");
}
else
throw e;
}
}
private void validatePagination(int page, int size) {
if (page < 0 || size < 1 || page > Integer.MAX_VALUE || size > 100) {
throw new InvalidPaginationDataException("Invalid pagination data. Please supply page bigger than 0 and size between 0 and 100");
}
}
private void validateSortAttributes(String sortBy, String sortOrder) {
//Check whether sortBy value is one of the song Attributes
if (!Arrays.asList
(SongAttributes.values())
.stream()
.map(obj -> obj.toString().toLowerCase())
.collect(Collectors.toList())
.contains
(sortBy.toLowerCase())) {
throw new UnsupportedSortByException(sortBy);
}
//Check whether sortOrder value is asc or desc
if (!Arrays.asList
(SortOrder.values())
.stream()
.map(obj -> obj.toString().toLowerCase())
.collect(Collectors.toList())
.contains
(sortOrder.toLowerCase())) {
throw new UnsupportedSortOrderException(sortOrder);
}
}
/**Get all songs with pagination**/
@Override
public List<Song> readAllSongs(String sortBy, String sortOrder, int size, int page) {
validatePagination(page, size);
validateSortAttributes(sortBy, sortOrder);
return Arrays.asList(this.restTemplate
.getForObject(this.url+"/all/{sortBy}/{sortOrder}/{page}/{size}",
Song[].class,
sortBy,
sortOrder,
page,
size));
}
/**Validate the value of the song to be saved before saving it**/
private boolean validate(Song song) {
return song.getSongId() != null &&
!song.getSongId().trim().isEmpty() &&
song.getAuthors() != null &&
!song.getAuthors().isEmpty() && //song with no author is not possible
song.getGenres() != null &&
!song.getGenres().isEmpty() && //song with no genre is not possible
song.getLyrics() != null &&
!song.getLyrics().trim().isEmpty() && //song must have lyrics
song.getName() != null &&
!song.getName().trim().isEmpty() && //song must have name
song.getPerformer() != null &&
!song.getPerformer().trim().isEmpty() && //song must have performer
song.getProducer() != null &&
!song.getProducer().trim().isEmpty() && //song must have producer
song.getPublishedYear() > 0 &&
song.getPublishedYear() <= Calendar.getInstance().get(Calendar.YEAR); //song must be in 0<song's year<=current year
}
}
| [
"[email protected]"
] | |
1651b92e05245cfacbebb3ebefa9e66795637153 | d55c19cb1cc69f545b3f281be0f182eb993af607 | /AcousticFeaturesExtraction/src/ubicomp/research/mingming/soundfeatures/MFCCCalculator.java | c74ea4b0d909b240923769c4985edf56e1517dee | [] | no_license | ErikLoo/Detecting-Open-or-Closed-Space-with-Acoustic-Sensing | 1db4392b90c6a88ce3455c635be784d825bc1a28 | 0eb44bf6765aa90dc34b4f60ac56a2e574b688ba | refs/heads/master | 2023-03-07T06:14:55.426442 | 2021-02-21T04:15:00 | 2021-02-21T04:15:00 | 288,324,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,023 | java | /**
* author: Mingming Fan
contact at: [email protected]
Part of the file is adapted from OC Volume package. The copyright of OC Volume is listed below
/*
OC Volume - Java Speech Recognition Engine
Copyright (c) 2002-2004, OrangeCow organization
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the
above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce the
above copyright notice, this list of conditions
and the following disclaimer in the documentation
and/or other materials provided with the
distribution.
* Neither the name of the OrangeCow organization
nor the names of its contributors may be used to
endorse or promote products derived from this
software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Contact information:
Please visit http://ocvolume.sourceforge.net.
*/
package ubicomp.research.mingming.soundfeatures;
public class MFCCCalculator {
/**
* Number of MFCCs per frame
* Modifed 4/5/06 to be non final variable - Daniel McEnnnis
*/
protected int numCepstra = 13;
/**
* lower limit of filter (or 64 Hz?)
*/
protected double lowerFilterFreq = 0; //1000 //5321;//133.3334; //15000;// protected final
/**
* upper limit of filter (or half of sampling freq.?)
*/
protected double upperFilterFreq = 22050; // 8000 //9321; //6855.4976; // protected final
/**
* number of mel filters (SPHINX-III uses 40)
*/
protected int numMelFilters = 23;
protected int frameLength = 512;
protected double samplingRate = 44100;
public MFCCCalculator(double _samplingRate)
{
samplingRate = _samplingRate;
upperFilterFreq = samplingRate/2;
}
public MFCCCalculator(double _samplingRate, double _lowerFilterFreq, double _upperFilterFreq)
{
samplingRate = _samplingRate;
upperFilterFreq = samplingRate/2;
lowerFilterFreq = _lowerFilterFreq;
upperFilterFreq = Math.min(upperFilterFreq,_upperFilterFreq);
}
/**
* takes a speech signal and returns the Mel-Frequency Cepstral Coefficient (MFCC)<br>
*/
public double[][] process(double[][] FFTMags){
double[][] MFCC = null;
if(FFTMags != null)
{
// Initializes the MFCC array
MFCC = new double[FFTMags.length][numCepstra];
//
// Below computations are all based on individual frames with Hamming Window already applied to them
//
for (int k = 0; k < FFTMags.length; k++){
// Magnitude Spectrum from frame k
double bin[] = FFTMags[k];
//System.out.println("bin size: " + bin.length);
// Mel Filtering
int cbin[] = fftBinIndices(samplingRate,frameLength);
//System.out.println("cbin size: " + cbin.length);
// get Mel Filterbank
double fbank[] = melFilter(bin, cbin);
// Non-linear transformation
double f[] = nonLinearTransformation(fbank);
// Cepstral coefficients
double cepc[] = cepCoefficients(f);
// Add resulting MFCC to array
for (int i = 0; i < numCepstra; i++){
MFCC[k][i] = cepc[i];
}
}
}
return MFCC;
}
/**
* calculates the FFT bin indices<br>
* calls: none<br>
* called by: featureExtraction
*
* 5-3-05 Daniel MCEnnis paramaterize sampling rate and frameSize
*
* @return array of FFT bin indices
*/
public int[] fftBinIndices(double samplingRate,int frameSize){
int cbin[] = new int[numMelFilters + 2];
cbin[0] = (int)Math.round(lowerFilterFreq / samplingRate * frameSize);
cbin[cbin.length - 1] = (int)(frameSize / 2);
for (int i = 1; i <= numMelFilters; i++){
double fc = centerFreq(i,samplingRate);
cbin[i] = (int)Math.round(fc / samplingRate * frameSize);
}
return cbin;
}
/**
* Calculate the output of the mel filter<br>
* calls: none
* called by: featureExtraction
*/
public double[] melFilter(double bin[], int cbin[]){
double temp[] = new double[numMelFilters + 2];
for (int k = 1; k <= numMelFilters; k++){
double num1 = 0, num2 = 0;
for (int i = cbin[k - 1]; i <= cbin[k]; i++){
num1 += ((i - cbin[k - 1] + 1) / (cbin[k] - cbin[k-1] + 1)) * bin[i];
}
for (int i = cbin[k] + 1; i <= cbin[k + 1]; i++){
num2 += (1 - ((i - cbin[k]) / (cbin[k + 1] - cbin[k] + 1))) * bin[i];
}
temp[k] = num1 + num2;
}
double fbank[] = new double[numMelFilters];
for (int i = 0; i < numMelFilters; i++){
fbank[i] = temp[i + 1];
}
return fbank;
}
/**
* Cepstral coefficients are calculated from the output of the Non-linear Transformation method<br>
* calls: none<br>
* called by: featureExtraction
* @param f Output of the Non-linear Transformation method
* @return Cepstral Coefficients
*/
public double[] cepCoefficients(double f[]){
double cepc[] = new double[numCepstra];
for (int i = 0; i < cepc.length; i++){
for (int j = 1; j <= numMelFilters; j++){
cepc[i] += f[j - 1] * Math.cos(Math.PI * i / numMelFilters * (j - 0.5));
}
}
return cepc;
}
/**
* the output of mel filtering is subjected to a logarithm function (natural logarithm)<br>
* calls: none<br>
* called by: featureExtraction
* @param fbank Output of mel filtering
* @return Natural log of the output of mel filtering
*/
public double[] nonLinearTransformation(double fbank[]){
double f[] = new double[fbank.length];
final double FLOOR = -50;
for (int i = 0; i < fbank.length; i++){
f[i] = Math.log(fbank[i]);
// check if ln() returns a value less than the floor
if (f[i] < FLOOR) f[i] = FLOOR;
}
return f;
}
/**
* calculates logarithm with base 10<br>
* calls: none<br>
* called by: featureExtraction
* @param value Number to take the log of
* @return base 10 logarithm of the input values
*/
protected static double log10(double value){
return Math.log(value) / Math.log(10);
}
/**
* calculates center frequency<br>
* calls: none<br>
* called by: featureExtraction
* @param i Index of mel filters
* @return Center Frequency
*/
private double centerFreq(int i,double samplingRate){
double mel[] = new double[2];
mel[0] = freqToMel(lowerFilterFreq);
mel[1] = freqToMel(upperFilterFreq); //way up to the highest point that sampling rate can get: samplingRate / 2
// take inverse mel of:
double temp = mel[0] + ((mel[1] - mel[0]) / (numMelFilters + 1)) * i;
return inverseMel(temp);
}
/**
* calculates the inverse of Mel Frequency<br>
* calls: none<br>
* called by: featureExtraction
*/
private static double inverseMel(double x){
double temp = Math.pow(10, x / 2595) - 1;
return 700 * (temp);
}
/**
* convert frequency to mel-frequency<br>
* calls: none<br>
* called by: featureExtraction
* @param freq Frequency
* @return Mel-Frequency
*/
protected static double freqToMel(double freq){
return 2595 * log10(1 + freq / 700);
}
}
| [
"[email protected]"
] | |
96accd436fb4a2da9a90ad203dda4122c406ddf3 | e8d9edfecc62290bc1238174e0fd297a3e610085 | /android/app/src/main/java/com/memo_game/MainApplication.java | 1390536e2c1b700cb28798175578dadce593a2b1 | [] | no_license | kyoyadmoon/memo-game | ac1fdbc332d06985746c9a8037e0a699d8ff55bf | 210841788789965001d6cf328debb5661d936fde | refs/heads/master | 2021-03-19T18:55:17.525410 | 2018-10-17T16:28:01 | 2018-10-17T16:28:01 | 118,461,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,134 | java | package com.memo_game;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"[email protected]"
] | |
b3b9221afe7f7e4e5a50ec3307f9a9cd64553bd9 | 83dc8f29e67289e143a603143dd29a85603aa9db | /src/main/java/com/example/kotlinserver/service/CartGoodsService.java | 3281dbeecca7c967ef0197b58ddd971ed165c8bb | [] | no_license | pcaddicted/kotlinserver | 6e9aa4a0a189c26e036dad960d48c0c3c376214f | ba21ae5ea8f8faf86818576192ce74b495945f13 | refs/heads/master | 2020-04-09T23:16:02.439338 | 2018-12-13T08:38:37 | 2018-12-13T08:38:37 | 160,651,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.example.kotlinserver.service;
import com.example.kotlinserver.model.CartGoods;
import java.util.List;
public interface CartGoodsService {
int addCartGoods(CartGoods paramCartGoods);
List<CartGoods> getCartGoodsList(Integer paramInteger);
void deleteCartGoods(List<Integer> paramList);
}
| [
"[email protected]"
] | |
34608e9f5b4949662f6382c4a93b57535cb690ac | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XRENDERING-418-9-15-SPEA2-WeightedSum:TestLen:CallDiversity/org/xwiki/rendering/listener/chaining/AbstractChainingListener_ESTest.java | d596a28c04cb1b6e8bf528dcfcf991a4c0db34b7 | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | /*
* This file was automatically generated by EvoSuite
* Mon Apr 06 10:25:04 UTC 2020
*/
package org.xwiki.rendering.listener.chaining;
import org.junit.Test;
import static org.junit.Assert.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class AbstractChainingListener_ESTest extends AbstractChainingListener_ESTest_scaffolding {
@Test
public void notGeneratedAnyTest() {
// EvoSuite did not generate any tests
}
}
| [
"[email protected]"
] | |
bbb18dfbf3dd106e895ba7feeeca464cbb5fe01d | 71542536507c48a0626d280672c07de9c26d1824 | /SmartDeviceLinkProxyAndroid/src/com/smartdevicelink/proxy/rpc/EncodedSyncPData.java | ee3ffa8f2ca47c809ebf660f8a02966f4e96a324 | [] | no_license | babynewton/smartdevicelink_android | 7e363e416e67188087d54998bf1fdc06c1764b09 | 57e3abd5d2fa5efdad9a778457fbad74ee18abdf | refs/heads/master | 2016-09-05T08:59:47.303677 | 2014-05-22T09:18:56 | 2014-05-22T09:18:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package com.smartdevicelink.proxy.rpc;
import java.util.Hashtable;
import java.util.Vector;
import com.smartdevicelink.proxy.RPCRequest;
import com.smartdevicelink.proxy.constants.Names;
public class EncodedSyncPData extends RPCRequest {
public EncodedSyncPData() {
super("EncodedSyncPData");
}
public EncodedSyncPData(Hashtable hash) {
super(hash);
}
public Vector<String> getData() {
if (parameters.get(Names.data) instanceof Vector<?>) {
Vector<?> list = (Vector<?>)parameters.get(Names.data);
if (list != null && list.size()>0) {
Object obj = list.get(0);
if (obj instanceof String) {
return (Vector<String>) list;
}
}
}
return null;
}
public void setData( Vector<String> data ) {
if ( data!= null) {
parameters.put(Names.data, data );
}
}
}
| [
"[email protected]"
] | |
d916ae06a0e9ba810aed19fd3142870cbd29795b | e0f2e1ebd55579384161892b4cbe1d372b27cea7 | /src/main/java/com/wg/proxy/ConnectToRemoteHandler.java | 5ea5b468c9c4f848140c52eae0484b57cb770716 | [] | no_license | XiaoShenOL/proxy-wg | f1a50c7fac80f1f81f495ba5b566f645466fe6b1 | 0abcd75536cf5abf96b7f741cad83423537745df | refs/heads/master | 2022-04-09T19:41:31.594045 | 2020-01-28T14:31:09 | 2020-01-28T14:31:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,462 | java | package com.wg.proxy;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.*;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.util.CharsetUtil;
import lombok.extern.slf4j.Slf4j;
/**
* @description:
* @projectName:proxy-wg
* @see:com.wg.proxy
* @author:wanggang
* @createTime:2020/1/25 21:36
* @version:1.0
*/
@Slf4j
@ChannelHandler.Sharable
public class ConnectToRemoteHandler extends ChannelInboundHandlerAdapter {
private Channel channel;
private String requestId;
private final ByteBuf HEARTBEAT_SEQUENCE = Unpooled.unreleasableBuffer(Unpooled.copiedBuffer("HEARTBEAT", CharsetUtil.UTF_8));
public ConnectToRemoteHandler(Channel channel, String requestId) {
this.channel = channel;
this.requestId = requestId;
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
channel.flush();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
log.error("{}-connectToremoteHandler exception-{}", requestId, cause.getMessage());
// if (cause.getMessage().contains("远程主机强迫关闭了一个现有的连接")) {
log.info("{}-connectToremoteHandler 关闭ctx", requestId);
ctx.close();
channel.close();
// }else {
// cause.printStackTrace();
// ctx.close();
// channel.close();
// }
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
channel.write(msg);
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
if (evt instanceof IdleStateEvent) {
log.info("{}-与remote服务器进行心跳检测",requestId);
ChannelFuture remoteCf = ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate())
.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
log.info("{}-发送心跳成功", requestId);
} else {
log.info("{}-发送心跳失败,关闭channel", requestId);
future.channel().close();
channel.close();
}
}
});
log.info("{}-与client服务器进行心跳检测",requestId);
channel.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate())
.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
log.info("{}-发送心跳成功",requestId);
} else{
log.info("{}-发送心跳失败,关闭channel",requestId);
future.channel().close();
remoteCf.channel().close();
}
}
});
} else {
super.userEventTriggered(ctx, evt);
}
}
}
| [
"[email protected]"
] | |
02bc0e3103d2e98fc95c591ed5dce49385a9c05e | c15b9c65d25cfa69a08d9bd528d8ae759ebef7f7 | /Neirinck_Matthias_Raes_Matthias_VIVESbook/test/database/AccountDBTest.java | 15fc1cceaf1d6cbc060d9b13e7f4e51bf6169abc | [] | no_license | r4eze/VivesBook | e66b6b78c4409bb0bca2a6bbe19058c3afc33172 | c469b29767dc0c3ee86eba52a996519429075f76 | refs/heads/master | 2021-01-13T14:59:12.558729 | 2017-03-26T18:27:58 | 2017-03-26T18:27:58 | 76,647,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,644 | java | package database;
import bags.Account;
import datatype.Geslacht;
import exception.DBException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
public class AccountDBTest {
private Account account;
private AccountDB accountDB;
public AccountDBTest() {
accountDB = new AccountDB();
}
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() {
account = new Account();
account.setNaam("Defoort");
account.setVoornaam("Mieke");
account.setLogin("miekedefoort");
account.setPaswoord("wachtwoord123");
account.setEmailadres("[email protected]");
account.setGeslacht(Geslacht.V);
}
@After
public void tearDown() {
try{
accountDB.verwijderenAccount(account);
}catch(DBException ex){
System.out.println("-tearDown- " + ex);
}
}
// Positieve test: account toe te voegen
// Positieve test: account zoeken op login
@Test
public void testToevoegenAccount(){
try{
accountDB.toevoegenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin(account.getLogin());
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("-testToevoegenAccount- " + ex);
}
}
// Negatieve test: 2 accounts toevoegen met dezelfde login
@Test
public void testToevoegenAccountZelfdeLogin() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
Account account2 = new Account();
account2.setNaam("Petersen");
account2.setVoornaam("Peter");
account2.setLogin("miekedefoort");
account2.setPaswoord("wachtwoord12345");
account2.setEmailadres("[email protected]");
account2.setGeslacht(Geslacht.M);
accountDB.toevoegenAccount(account2);
}
// Negatieve test: 2 accounts toevoegen met dezelfde email
@Test
public void testToevoegenAccountZelfdeEmail() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
Account account2 = new Account();
account2.setNaam("Petersen");
account2.setVoornaam("Peter");
account2.setLogin("peterpetersen");
account2.setPaswoord("wachtwoord12345");
account2.setEmailadres("[email protected]");
account2.setGeslacht(Geslacht.M);
accountDB.toevoegenAccount(account2);
}
// Negatieve test: account toevoegen zonder naam
@Test
public void testToevoegenAccountNaamNull() throws DBException{
thrown.expect(DBException.class);
account.setNaam(null);
accountDB.toevoegenAccount(account);
}
// Negatieve test: account toevoegen zonder voornaam
@Test
public void testToevoegenAccountVoornaamNull() throws DBException{
thrown.expect(DBException.class);
account.setVoornaam(null);
accountDB.toevoegenAccount(account);
}
// Negatieve test: account toevoegen zonder login
@Test
public void testToevoegenAccountLoginNull() throws DBException{
thrown.expect(DBException.class);
account.setLogin(null);
accountDB.toevoegenAccount(account);
}
// Negatieve test: account toevoegen zonder passwoord
@Test
public void testToevoegenAccountPaswoordNull() throws DBException{
thrown.expect(DBException.class);
account.setPaswoord(null);
accountDB.toevoegenAccount(account);
}
// Negatieve test: account toevoegen zonder emailadres
@Test
public void testToevoegenAccountEmailadresNull() throws DBException{
thrown.expect(DBException.class);
account.setEmailadres(null);
accountDB.toevoegenAccount(account);
}
// Negatieve test: account toevoegen zonder geslacht
@Test
public void testToevoegenAccountGeslachtNull() throws DBException{
thrown.expect(DBException.class);
account.setGeslacht(null);
accountDB.toevoegenAccount(account);
}
// Positiveve test: account zoeken op email
@Test
public void testZoekAccountOpEmail(){
try{
accountDB.toevoegenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpEmail(account.getEmailadres());
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("-testToevoegenAccount-" + ex);
}
}
/*
// Negatieve test: account zoeken op email zonder email
@Test
public void testZoekAccountOpEmailNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpEmail(null);
}*/
// Positieve test: naam van account wijzigen
@Test
public void testWijzigenAccountNaam(){
try{
accountDB.toevoegenAccount(account);
account.setNaam("Ford");
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Ford", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountNaam - " + ex);
}
}
// Positieve test: voornaam van account wijzigen
@Test
public void testWijzigenAccountVoornaam(){
try{
accountDB.toevoegenAccount(account);
account.setVoornaam("Katrien");
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Katrien", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountVoornaam - " + ex);
}
}
// Er werd geen test voor login te wijzigen toegevoegd want de wijzigenAccount() methode kan het login niet wijzigen
// Positieve test: passwoord van account wijzgen
@Test
public void testWijzigenAccountPasswoord(){
try{
accountDB.toevoegenAccount(account);
account.setPaswoord("paswoord123");
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("paswoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountPasswoord - " + ex);
}
}
// Positieve test: emailadres van account wijzigen
@Test
public void testWijzigenAccountEmailadres(){
try{
accountDB.toevoegenAccount(account);
account.setEmailadres("[email protected]");
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountEmailadres - " + ex);
}
}
// Positieve test: geslacht van account wijzigen naar M
@Test
public void testWijzigenAccountGeslachtM(){
try{
accountDB.toevoegenAccount(account);
account.setGeslacht(Geslacht.M);
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.M, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountGeslachtM - " + ex);
}
}
// Positieve test: geslacht van account wijzigen naar V
@Test
public void testWijzigenAccountGeslachtV(){
try{
account.setGeslacht(Geslacht.M);
accountDB.toevoegenAccount(account);
account.setGeslacht(Geslacht.V);
accountDB.wijzigenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin("miekedefoort");
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
}catch(DBException ex){
System.out.println("testWijzigenAccountGeslachtV - " + ex);
}
}
// Negatieve test: account wijzigen zonder naam
@Test
public void testWijzigenAccountNaamNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
account.setNaam(null);
accountDB.wijzigenAccount(account);
}
// Negatieve test: account wijzigen zonder voornaam
@Test
public void testWijzigenAccountVoornaamNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
account.setVoornaam(null);
accountDB.wijzigenAccount(account);
}
// Negatieve test: account wijzigen zonder paswoord
@Test
public void testWijzigenAccountPaswoordNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
account.setPaswoord(null);
accountDB.wijzigenAccount(account);
}
// Negatieve test: account wijzigen zonder emailadres
@Test
public void testWijzigenAccountEmailadresNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
account.setEmailadres(null);
accountDB.wijzigenAccount(account);
}
// Negatieve test: account wijzigen zonder geslacht
@Test
public void testWijzigenAccountGeslachtNull() throws DBException{
thrown.expect(DBException.class);
accountDB.toevoegenAccount(account);
account.setGeslacht(null);
accountDB.wijzigenAccount(account);
}
// Positieve test: account verwijderen
@Test
public void testVerwijderenAccount(){
try{
accountDB.toevoegenAccount(account);
Account ophaalAcc = accountDB.zoekAccountOpLogin(account.getLogin());
assertEquals("Defoort", ophaalAcc.getNaam());
assertEquals("Mieke", ophaalAcc.getVoornaam());
assertEquals("miekedefoort", ophaalAcc.getLogin());
assertEquals("wachtwoord123", ophaalAcc.getPaswoord());
assertEquals("[email protected]", ophaalAcc.getEmailadres());
assertEquals(Geslacht.V, ophaalAcc.getGeslacht());
accountDB.verwijderenAccount(account);
ophaalAcc = accountDB.zoekAccountOpLogin(account.getLogin());
assertNull(ophaalAcc);
}catch(DBException ex){
System.out.println("testVerwijderenAccount - " + ex);
}
}
// Geen negatieve test om account te verwijderen want een account proberen verwijderen dat niet bestaat geeft geen errors?
} | [
"[email protected]"
] | |
2f66760b43c0fe0d382c37c3c4633ee5d415ac6d | d0275970601952d8527f98d36eb324e9a500b1f0 | /src/models/Cliente.java | b8fe80bf574a07d1f9904dd58483009b8fa925a6 | [] | no_license | ManoelRibeiro2018/Petshop | 51b361b500da77f38d81236745fc0b3fed0f03a8 | 68c421254ebe510b4625fd15c4e506560370a05d | refs/heads/master | 2023-06-06T09:20:18.743581 | 2021-06-19T02:20:25 | 2021-06-19T02:20:25 | 374,853,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | 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 Models;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
* @author manoel.ribeiro.neto
*/
public class Cliente extends Pessoa {
private List<Pet> pets = new ArrayList<>();
public Cliente() {}
@Override
public String getNome() {
return this.nome;
}
@Override
public void setNome(String nome) {
this.nome = nome;
}
@Override
public String getCpf() {
// TODO Auto-generated method stub
return this.cpf;
}
@Override
public void setCpf(String cpf) {
this.cpf = cpf;
}
@Override
public String getEmail() {
return this.email;
}
@Override
public void setEmail(String email) {
this.email = email;
}
@Override
public String getTelefone() {
return this.telefone;
}
@Override
public void setTelefone(String telefone) {
this.telefone = telefone;
}
@Override
public Date getDataDeNascimento() {
return this.dataNascimento;
}
@Override
public void setDataDeNascimento(Date dateDeNascimento) {
this.dataNascimento = dateDeNascimento;
}
public List<Pet> getPets() {
return pets;
}
public void adicionarPet(Pet pet) {
this.pets.add(pet);
}
@Override
public Integer getID() {
return this.ID;
}
@Override
public void setID(int id) {
this.ID = id;
}
}
| [
"[email protected]"
] | |
4518cbadd8b54867164d50bcc87a56280e4f417c | 78911f06d1b93046192f87592b148abc82433043 | /group16/2816977791/firstExercise/src/com/coding/basic/ArrayList.java | 7ac196b7009c17f06eb1e462c67a7b33af3acfb8 | [] | no_license | Ni2014/coding2017 | 0730bab13b83aad82b41bb28552a6235e406c534 | 2732d351bd24084b00878c434e73a8f7f967801e | refs/heads/master | 2021-01-17T14:20:20.163788 | 2017-03-20T03:21:12 | 2017-03-20T03:21:12 | 84,085,757 | 5 | 18 | null | 2017-05-04T15:06:23 | 2017-03-06T14:55:49 | Java | UTF-8 | Java | false | false | 2,679 | java | package com.coding.basic;
public class ArrayList implements List {
private int size = 0;
private Object[] elementData = new Object[10];
public void add(Object o) {
ensureCapacity(size + 1);
elementData[size++] = o;
}
public void add(int index, Object o) {
checkForLength(index);
ensureCapacity(size + 1);
System.arraycopy(elementData, index, elementData, index + 1, size - index);
elementData[index] = o;
size++;
}
public Object get(int index) {
checkForLength(index);
return elementData[index];
}
public Object remove(int index) {
checkForLength(index);
Object oldValue = elementData[index];
System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
size--;
return oldValue;
}
public int size() {
return size;
}
public Iterator iterator() {
return null;
}
private void checkForLength(int index) {
if (index < 0 || index >= size) {
throw new RuntimeException("out of memory");
}
}
private void ensureCapacity(int minCapacity) {
if (minCapacity - elementData.length > 0) {
grow(minCapacity);
}
}
private void grow(int minCapacity) {
int oldCapacity = elementData.length;
int newCapacity = oldCapacity + (oldCapacity >> 1);//增大容量
if (newCapacity - minCapacity < 0) {
newCapacity = minCapacity;
}
elementData = copyOf(elementData, newCapacity);
}
private Object[] copyOf(Object[] src, int newCapacity) {
Object[] target = new Object[newCapacity];
System.arraycopy(src, 0, target, 0, src.length);
return target;
}
public static void main(String[] args) {
ArrayList list = new ArrayList();
String num = "num";
for (int i = 0; i < 100; i++) {
list.add(num + String.valueOf(i));
System.out.println(String.valueOf(i) + ":size:" + list.size());
System.out.println(String.valueOf(i) + ":length:" + list.elementData.length);
}
System.out.println(list.size());
for (int i = 0; i < 100; i++) {
list.add(i, num + String.valueOf(i));
System.out.println(String.valueOf(i) + ":size:" + list.size());
System.out.println(String.valueOf(i) + ":length:" + list.elementData.length);
}
System.out.println(list.size());
for (int i = 0; i < 200; i++) {
System.out.println(list.remove(0));
}
System.out.println(list.size());
}
}
| [
"[email protected]"
] | |
e33232867dded5d9d40e3ce900d25bd078276bb3 | 86b0c3de0a8de16b250246910dc824897c837581 | /src/main/java/ethiotechinfo/web/rest/AccountResource.java | 53a5d7b738a563e849964597045338e0c02e07ca | [] | no_license | BulkSecurityGeneratorProject/demo-in-action | 3376753c3a74ac99c8ec5bff87a22584303265e1 | ab92b01642b2940f64c08b47ab7634acecd8d4f5 | refs/heads/master | 2022-12-14T23:21:02.030918 | 2019-08-30T00:32:17 | 2019-08-30T00:32:17 | 296,567,747 | 0 | 0 | null | 2020-09-18T08:54:52 | 2020-09-18T08:54:51 | null | UTF-8 | Java | false | false | 7,434 | java | package ethiotechinfo.web.rest;
import ethiotechinfo.domain.User;
import ethiotechinfo.repository.UserRepository;
import ethiotechinfo.security.SecurityUtils;
import ethiotechinfo.service.MailService;
import ethiotechinfo.service.UserService;
import ethiotechinfo.service.dto.PasswordChangeDTO;
import ethiotechinfo.service.dto.UserDTO;
import ethiotechinfo.web.rest.errors.*;
import ethiotechinfo.web.rest.vm.KeyAndPasswordVM;
import ethiotechinfo.web.rest.vm.ManagedUserVM;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/api")
public class AccountResource {
private static class AccountResourceException extends RuntimeException {
private AccountResourceException(String message) {
super(message);
}
}
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
private final UserRepository userRepository;
private final UserService userService;
private final MailService mailService;
public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) {
this.userRepository = userRepository;
this.userService = userService;
this.mailService = mailService;
}
/**
* {@code POST /register} : register the user.
*
* @param managedUserVM the managed user View Model.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect.
* @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used.
* @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already used.
*/
@PostMapping("/register")
@ResponseStatus(HttpStatus.CREATED)
public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {
if (!checkPasswordLength(managedUserVM.getPassword())) {
throw new InvalidPasswordException();
}
User user = userService.registerUser(managedUserVM, managedUserVM.getPassword());
mailService.sendActivationEmail(user);
}
/**
* {@code GET /activate} : activate the registered user.
*
* @param key the activation key.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be activated.
*/
@GetMapping("/activate")
public void activateAccount(@RequestParam(value = "key") String key) {
Optional<User> user = userService.activateRegistration(key);
if (!user.isPresent()) {
throw new AccountResourceException("No user was found for this activation key");
}
}
/**
* {@code GET /authenticate} : check if the user is authenticated, and return its login.
*
* @param request the HTTP request.
* @return the login if the user is authenticated.
*/
@GetMapping("/authenticate")
public String isAuthenticated(HttpServletRequest request) {
log.debug("REST request to check if the current user is authenticated");
return request.getRemoteUser();
}
/**
* {@code GET /account} : get the current user.
*
* @return the current user.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be returned.
*/
@GetMapping("/account")
public UserDTO getAccount() {
return userService.getUserWithAuthorities()
.map(UserDTO::new)
.orElseThrow(() -> new AccountResourceException("User could not be found"));
}
/**
* {@code POST /account} : update the current user information.
*
* @param userDTO the current user information.
* @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user login wasn't found.
*/
@PostMapping("/account")
public void saveAccount(@Valid @RequestBody UserDTO userDTO) {
String userLogin = SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new AccountResourceException("Current user login not found"));
Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) {
throw new EmailAlreadyUsedException();
}
Optional<User> user = userRepository.findOneByLogin(userLogin);
if (!user.isPresent()) {
throw new AccountResourceException("User could not be found");
}
userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
userDTO.getLangKey(), userDTO.getImageUrl());
}
/**
* {@code POST /account/change-password} : changes the current user's password.
*
* @param passwordChangeDto current and new password.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the new password is incorrect.
*/
@PostMapping(path = "/account/change-password")
public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) {
if (!checkPasswordLength(passwordChangeDto.getNewPassword())) {
throw new InvalidPasswordException();
}
userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword());
}
/**
* {@code POST /account/reset-password/init} : Send an email to reset the password of the user.
*
* @param mail the mail of the user.
* @throws EmailNotFoundException {@code 400 (Bad Request)} if the email address is not registered.
*/
@PostMapping(path = "/account/reset-password/init")
public void requestPasswordReset(@RequestBody String mail) {
mailService.sendPasswordResetMail(
userService.requestPasswordReset(mail)
.orElseThrow(EmailNotFoundException::new)
);
}
/**
* {@code POST /account/reset-password/finish} : Finish to reset the password of the user.
*
* @param keyAndPassword the generated key and the new password.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the password could not be reset.
*/
@PostMapping(path = "/account/reset-password/finish")
public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) {
if (!checkPasswordLength(keyAndPassword.getNewPassword())) {
throw new InvalidPasswordException();
}
Optional<User> user =
userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey());
if (!user.isPresent()) {
throw new AccountResourceException("No user was found for this reset key");
}
}
private static boolean checkPasswordLength(String password) {
return !StringUtils.isEmpty(password) &&
password.length() >= ManagedUserVM.PASSWORD_MIN_LENGTH &&
password.length() <= ManagedUserVM.PASSWORD_MAX_LENGTH;
}
}
| [
"[email protected]"
] | |
d5ac0873531f99038a0f81a4601f92b27c8e1ad4 | 7475ac6b7bcdfd0a86648ba1bd2f34f1d3d7ff09 | /esshop/src/main/java/com/shopping/view/web/action/SpareGoodsViewAction.java | 7e5cbff82e8ade550715833215d1bf0a6980def3 | [] | no_license | K-Darker/esshop | 736073adfdf828bfe069257ffaddac8cec0b1b7f | 9cc1a11e13d265e6b78ec836232f726a41c21b7d | refs/heads/master | 2021-09-08T05:04:41.067994 | 2018-03-07T09:47:16 | 2018-03-07T09:47:40 | 123,759,831 | 6 | 6 | null | null | null | null | UTF-8 | Java | false | false | 12,600 | java | package com.shopping.view.web.action;
import com.shopping.core.domain.virtual.SysMap;
import com.shopping.core.mv.JModelAndView;
import com.shopping.core.query.support.IPageList;
import com.shopping.core.security.support.SecurityUserHolder;
import com.shopping.core.tools.CommUtil;
import com.shopping.foundation.domain.Area;
import com.shopping.foundation.domain.SpareGoods;
import com.shopping.foundation.domain.SpareGoodsClass;
import com.shopping.foundation.domain.User;
import com.shopping.foundation.domain.query.SpareGoodsQueryObject;
import com.shopping.foundation.service.IAreaService;
import com.shopping.foundation.service.INavigationService;
import com.shopping.foundation.service.ISpareGoodsClassService;
import com.shopping.foundation.service.ISpareGoodsFloorService;
import com.shopping.foundation.service.ISpareGoodsService;
import com.shopping.foundation.service.ISysConfigService;
import com.shopping.foundation.service.IUserConfigService;
import com.shopping.view.web.tools.SpareGoodsViewTools;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class SpareGoodsViewAction
{
@Autowired
private ISysConfigService configService;
@Autowired
private IUserConfigService userConfigService;
@Autowired
private ISpareGoodsClassService sparegoodsclassService;
@Autowired
private ISpareGoodsFloorService sparegoodsfloorService;
@Autowired
private ISpareGoodsService sparegoodsService;
@Autowired
private IAreaService areaService;
@Autowired
private SpareGoodsViewTools SpareGoodsTools;
@Autowired
private INavigationService navService;
@RequestMapping({"/sparegoods_head.htm"})
public ModelAndView sparegoods_head(HttpServletRequest request, HttpServletResponse response)
{
ModelAndView mv = new JModelAndView("sparegoods_head.html",
this.configService.getSysConfig(), this.userConfigService
.getUserConfig(), 1, request, response);
return mv;
}
@RequestMapping({"/sparegoods_nav.htm"})
public ModelAndView sparegoods_nav(HttpServletRequest request, HttpServletResponse response, String currentPage)
{
ModelAndView mv = new JModelAndView("sparegoods_nav.html",
this.configService.getSysConfig(), this.userConfigService
.getUserConfig(), 1, request, response);
List sgcs = this.sparegoodsclassService
.query(
"select obj from SpareGoodsClass obj where obj.parent.id is null order by sequence asc",
null, -1, -1);
mv.addObject("sgcs", sgcs);
if ((SecurityUserHolder.getCurrentUser() != null) &&
(!SecurityUserHolder.getCurrentUser().equals("")))
{
Map params = new HashMap();
params.put("status", Integer.valueOf(0));
params.put("down", Integer.valueOf(0));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List sps = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.status=:status and obj.down=:down and obj.user.id=:uid",
params, -1, -1);
params.clear();
params.put("status", Integer.valueOf(-1));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List drops = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.status=:status and obj.user.id=:uid",
params, -1, -1);
params.clear();
params.put("down", Integer.valueOf(-1));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List down = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.down=:down and obj.user.id=:uid",
params, -1, -1);
mv.addObject("selling", Integer.valueOf(sps.size()));
mv.addObject("drops", Integer.valueOf(drops.size()));
mv.addObject("down", Integer.valueOf(down.size()));
}
Map map = new HashMap();
map.put("type", "sparegoods");
map.put("display", Boolean.valueOf(true));
List navs = this.navService
.query(
"select obj from Navigation obj where obj.type=:type and obj.display=:display order by sequence asc",
map, -1, -1);
mv.addObject("navs", navs);
return mv;
}
@RequestMapping({"/sparegoods_nav2.htm"})
public ModelAndView sparegoods_nav2(HttpServletRequest request, HttpServletResponse response, String currentPage)
{
ModelAndView mv = new JModelAndView("sparegoods_nav2.html",
this.configService.getSysConfig(), this.userConfigService
.getUserConfig(), 1, request, response);
List sgcs = this.sparegoodsclassService
.query(
"select obj from SpareGoodsClass obj where obj.parent.id is null order by sequence asc",
null, -1, -1);
mv.addObject("sgcs", sgcs);
if ((SecurityUserHolder.getCurrentUser() != null) &&
(!SecurityUserHolder.getCurrentUser().equals("")))
{
Map params = new HashMap();
params.put("status", Integer.valueOf(0));
params.put("down", Integer.valueOf(0));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List sps = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.status=:status and obj.down=:down and obj.user.id=:uid",
params, -1, -1);
params.clear();
params.put("status", Integer.valueOf(-1));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List drops = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.status=:status and obj.user.id=:uid",
params, -1, -1);
params.clear();
params.put("down", Integer.valueOf(-1));
params.put("uid", SecurityUserHolder.getCurrentUser().getId());
List down = this.sparegoodsService
.query(
"select obj from SpareGoods obj where obj.down=:down and obj.user.id=:uid",
params, -1, -1);
mv.addObject("selling", Integer.valueOf(sps.size()));
mv.addObject("drops", Integer.valueOf(drops.size()));
mv.addObject("down", Integer.valueOf(down.size()));
}
Map map = new HashMap();
map.put("type", "sparegoods");
map.put("display", Boolean.valueOf(true));
List navs = this.navService
.query(
"select obj from Navigation obj where obj.type=:type and obj.display=:display order by sequence asc",
map, -1, -1);
mv.addObject("navs", navs);
return mv;
}
@RequestMapping({"/sparegoods.htm"})
public ModelAndView sparegoods(HttpServletRequest request, HttpServletResponse response, String currentPage) {
ModelAndView mv = new JModelAndView("sparegoods.html", this.configService
.getSysConfig(), this.userConfigService.getUserConfig(), 1,
request, response);
Map map = new HashMap();
map.put("display", Boolean.valueOf(true));
List floors = this.sparegoodsfloorService
.query(
"select obj from SpareGoodsFloor obj where obj.display=:display order By sequence asc",
map, -1, -1);
List sgcs = this.sparegoodsclassService
.query(
"select obj from SpareGoodsClass obj where obj.parent.id is null order by sequence asc",
null, -1, -1);
mv.addObject("sgcs", sgcs);
mv.addObject("floors", floors);
mv.addObject("SpareGoodsTools", this.SpareGoodsTools);
return mv;
}
@RequestMapping({"/sparegoods_detail.htm"})
public ModelAndView sparegoods_detail(HttpServletRequest request, HttpServletResponse response, String id) {
ModelAndView mv = new JModelAndView("sparegoods_detail.html",
this.configService.getSysConfig(), this.userConfigService
.getUserConfig(), 1, request, response);
SpareGoods obj = this.sparegoodsService.getObjById(
CommUtil.null2Long(id));
if (obj.getStatus() == 0) {
mv.addObject("obj", obj);
}
if (obj.getStatus() == -1) {
mv = new JModelAndView("error.html", this.configService.getSysConfig(),
this.userConfigService.getUserConfig(), 1, request,
response);
mv.addObject("url", CommUtil.getURL(request) + "/sparegoods.htm");
mv.addObject("op_title", "该商品已下架!");
}
if (obj.getDown() == -1) {
mv = new JModelAndView("error.html", this.configService.getSysConfig(),
this.userConfigService.getUserConfig(), 1, request,
response);
mv.addObject("url", CommUtil.getURL(request) + "/sparegoods.htm");
mv.addObject("op_title", "该商品因违规已下架!");
}
return mv;
}
@RequestMapping({"/sparegoods_search.htm"})
public ModelAndView sparegoods_search(HttpServletRequest request, HttpServletResponse response, String cid, String orderBy, String orderType, String currentPage, String price_begin, String price_end, String keyword, String area_id)
{
ModelAndView mv = new JModelAndView("sparegoods_search.html",
this.configService.getSysConfig(), this.userConfigService
.getUserConfig(), 1, request, response);
if ((orderType != null) && (!orderType.equals(""))) {
if (orderType.equals("asc"))
orderType = "desc";
else
orderType = "asc";
}
else {
orderType = "desc";
}
if ((orderBy != null) && (!orderBy.equals(""))) {
if (orderBy.equals("addTime"))
orderType = "desc";
}
else {
orderBy = "addTime";
}
SpareGoodsQueryObject qo = new SpareGoodsQueryObject(currentPage, mv,
orderBy, orderType);
qo.addQuery("obj.status", new SysMap("status", Integer.valueOf(0)), "=");
qo.addQuery("obj.down", new SysMap("down", Integer.valueOf(0)), "=");
if ((cid != null) && (!cid.equals(""))) {
SpareGoodsClass sgc = this.sparegoodsclassService
.getObjById(CommUtil.null2Long(cid));
Set ids = genericIds(sgc);
Map map = new HashMap();
map.put("ids", ids);
qo.addQuery("obj.spareGoodsClass.id in (:ids)", map);
mv.addObject("cid", cid);
mv.addObject("sgc", sgc);
}
if ((orderBy != null) && (!orderBy.equals(""))) {
if (orderBy.equals("recommend")) {
qo.addQuery("obj.recommend", new SysMap("obj_recommend", Boolean.valueOf(true)),
"=");
}
if ((price_begin != null) && (!price_begin.equals(""))) {
qo.addQuery("obj.goods_price",
new SysMap("goods_price",
Integer.valueOf(CommUtil.null2Int(price_begin))), ">=");
}
if ((price_end != null) && (!price_end.equals(""))) {
qo.addQuery("obj.goods_price",
new SysMap("goods_end",
Integer.valueOf(CommUtil.null2Int(price_end))), "<=");
}
}
if ((keyword != null) && (!keyword.equals(""))) {
qo.addQuery("obj.title",
new SysMap("obj_title", "%" +
keyword.trim() + "%"), "like");
}
if ((area_id != null) && (!area_id.equals(""))) {
qo.addQuery("obj.area.parent.id",
new SysMap("obj_area_id",
CommUtil.null2Long(area_id)), "=");
Area area = this.areaService
.getObjById(CommUtil.null2Long(area_id));
mv.addObject("area", area);
}
IPageList pList = this.sparegoodsService.list(qo);
CommUtil.saveIPageList2ModelAndView("", "", "", pList, mv);
List citys = this.areaService.query(
"select obj from Area obj where obj.parent.id is null", null,
-1, -1);
mv.addObject("citys", citys);
mv.addObject("area_id", area_id);
mv.addObject("keyword", keyword);
mv.addObject("price_begin", price_begin);
mv.addObject("price_end", price_end);
mv.addObject("allCount", Integer.valueOf(pList.getRowCount()));
mv.addObject("SpareGoodsTools", this.SpareGoodsTools);
return mv;
}
private Set<Long> genericIds(SpareGoodsClass gc) {
Set ids = new HashSet();
ids.add(gc.getId());
for (SpareGoodsClass child : gc.getChilds()) {
Set<Long> cids = genericIds(child);
for (Long cid : cids) {
ids.add(cid);
}
ids.add(child.getId());
}
return ids;
}
}
| [
"[email protected]"
] | |
881e3423fe316a6bd6ebb5be856050c1024cd825 | 0d6a7dc07d20be232647159020bfa7a1d5381d4b | /main/java/com/actsof3000/Test/proxy/IProxy.java | 5e97515780495bd668aeb261a2bfbfe9d0fcc18b | [
"MIT"
] | permissive | actsof3000/More-Cells | d01b22d18145377f2a13b28e6777be4e68561ac3 | 0abca91c24dea0be421151237c7cae56b9e2851b | refs/heads/master | 2021-03-13T00:08:08.077002 | 2014-10-18T19:18:33 | 2014-10-18T19:18:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package com.actsof3000.Test.proxy;
public interface IProxy
{
public abstract ClientProxy getClientProxy();
public abstract void registerEventHandlers();
}
| [
"[email protected]"
] | |
9506680dd39bbd67b06e8d9c2a38ce23beeabf9f | edeb76ba44692dff2f180119703c239f4585d066 | /libJCRS/src/org/gvsig/crs/CrsGT.java | 03a555be488afaee5a4240ec8a3b2d2c242ca777 | [] | no_license | CafeGIS/gvSIG2_0 | f3e52bdbb98090fd44549bd8d6c75b645d36f624 | 81376f304645d040ee34e98d57b4f745e0293d05 | refs/heads/master | 2020-04-04T19:33:47.082008 | 2012-09-13T03:55:33 | 2012-09-13T03:55:33 | 5,685,448 | 2 | 1 | null | null | null | null | ISO-8859-1 | Java | false | false | 10,623 | java | /* gvSIG. Sistema de Información Geográfica de la Generalitat Valenciana
*
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
*
* For more information, contact:
*
* Generalitat Valenciana
* Conselleria d'Infraestructures i Transport
* Av. Blasco Ibáñez, 50
* 46010 VALENCIA
* SPAIN
*
* +34 963862235
* [email protected]
* www.gvsig.gva.es
*
* or
*
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
* Campus Universitario s/n
* 02071 Alabacete
* Spain
*
* +34 967 599 200
*/
package org.gvsig.crs;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import org.cresques.cts.ICoordTrans;
import org.cresques.cts.IDatum;
import org.cresques.cts.IProjection;
import org.cresques.geo.ViewPortData;
import org.geotools.referencing.crs.AbstractDerivedCRS;
import org.geotools.referencing.crs.AbstractSingleCRS;
import org.geotools.referencing.datum.DefaultGeodeticDatum;
import org.gvsig.crs.proj.CrsProj;
import org.gvsig.crs.proj.CrsProjException;
import org.gvsig.crs.proj.JNIBaseCrs;
import org.gvsig.crs.proj.OperationCrsException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
/**
* Clase que representa un CRS basado en GeoTools/GeoApi.
*
* @author Diego Guerrero Sevilla ([email protected])
*
*/
public class CrsGT implements ICrs {
private static final Color basicGridColor = new Color(64, 64, 64, 128);
/**
* CRS GeoApi. Nucleo de la clare CrsGT.
*/
private CoordinateReferenceSystem crsGT = null;
/**
*Cadena proj4
*/
private String proj4String = null;
private Color gridColor = basicGridColor;
/**
* Parámetros de transformación para el CRS fuente en formato proj4.
*/
private String sourceTrParams = null;
/**
* Parámetros de transformación para el CRS destino en formato proj4.
*/
private String targetTrParams = null;
/**
* CRS operable con proj4.
*/
private CrsProj crsProj = null;
/**
* CRS Base operable con proj4.
*/
private CrsProj crsProjBase = null;
/**
* Provisional, hasta que se elimine getCrsWkt de ICrs.
*/
private CrsWkt crsWkt = null;
/**
* Conversor de CRSs a cadenas proj4.
*/
private Proj4 proj4 = null;
/**
* Constructor a partir de un CoordinateReferenceSystem
*
* @param crsGT
* @throws CrsProjException
*/
public CrsGT(CoordinateReferenceSystem crsGT){
this.crsGT = crsGT;
}
public int getCode() {
return Integer.valueOf(getAbrev().split(":")[1]).intValue();
}
public CrsWkt getCrsWkt() {
if (crsWkt==null)
crsWkt = new CrsWkt(crsGT);
return crsWkt;
}
public String getWKT() {
return crsGT.toWKT();
}
public void setTransformationParams(String SourceParams, String TargetParams) {
this.sourceTrParams = SourceParams;
this.targetTrParams = TargetParams;
}
/**
* Devuelve los parametros de la transformacion del crs fuente
* @return
*/
public String getSourceTransformationParams() {
return this.sourceTrParams;
}
/**
* Devuelve los parametros de la transformacion del crs destino
* @return
*/
public String getTargetTransformationParams() {
return this.targetTrParams;
}
public Point2D createPoint(double x, double y) {
return new Point2D.Double(x,y);
}
public void drawGrid(Graphics2D g, ViewPortData vp) {
// TODO Auto-generated method stub
}
public Point2D fromGeo(Point2D gPt, Point2D mPt) {
// TODO Auto-generated method stub
return null;
}
public String getAbrev() {
return ((AbstractSingleCRS)crsGT).getIdentifiers().iterator().next().toString();
}
public ICoordTrans getCT(IProjection dest) {
try {
if (dest == this)
return null;
COperation operation = null;
if(((ICrs)dest).getSourceTransformationParams() != null || ((ICrs)dest).getTargetTransformationParams() != null)
operation = new COperation(this, (ICrs)dest,((ICrs)dest).getTargetTransformationParams(),((ICrs)dest).getSourceTransformationParams());
else
operation = new COperation(this, (ICrs)dest,sourceTrParams,targetTrParams);
return operation;
}catch (CrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
/*
try {
operation = new COperation(this, (ICrs)dest);
} catch (CrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (!getTransformationParams().equals("")){
if (isParamsInTarget())
operation.setParamsCrsProj(new CrsProj(crsDest.getProj4String()+getTransformationParams()), true);
else
operation.setParamsCrsProj(new CrsProj(getProj4String()+getTransformationParams()), false);
return operation;
}
return operation; */
}
public IDatum getDatum() {
DefaultGeodeticDatum datumGT = (DefaultGeodeticDatum)((AbstractSingleCRS)crsGT).getDatum();
CRSDatum datum = new CRSDatum(datumGT.getEllipsoid().getSemiMajorAxis(),datumGT.getEllipsoid().getInverseFlattening());
return datum;
}
public Color getGridColor() {
return gridColor;
}
public double getScale(double minX, double maxX, double width, double dpi) {
double scale = 0D;
if (!isProjected()) { // Es geográfico; calcula la escala.
scale = ((maxX - minX) * // grados
// 1852.0 metros x minuto de meridiano
(dpi / 2.54 * 100.0 * 1852.0 * 60.0)) / // px / metro
width; // pixels
}
else{
scale = ((maxX - minX) * // metros
(dpi / 2.54 * 100.0)) / // px / metro
width; // pixels
}
return scale;
}
public double getScale(double minX, double maxX, double minY, double maxY, double width, double dpi) {
double scale = 0D;
double incX = (maxX-minX);
if (!isProjected()) {
double a = getDatum().getESemiMajorAxis();
double invF = getDatum().getEIFlattening();
double meanY = (minY+maxY)/2.0;
double radius = 0.0;
if (invF == Double.POSITIVE_INFINITY){
radius = a;
}
else{
double e2 = 2.0/invF-Math.pow(1.0/invF,2.0);
radius = a/Math.sqrt(1.0-e2*Math.pow(Math.sin(meanY*Math.PI/180.0),2.0))*Math.cos(meanY*Math.PI/180.0);
}
incX *= Math.PI/180.0*radius;
}
scale = (incX * // metros
(dpi / 2.54 * 100.0)) / // px / metro
width; // pixels
return scale;
}
public boolean isProjected() {
if (crsGT instanceof AbstractDerivedCRS){
return true;
}else
return false;
}
public void setGridColor(Color c) {
gridColor = c;
}
public Point2D toGeo(Point2D pt) {
if (isProjected()){
double x[] = {pt.getX()};
double y[] = {pt.getY()};
double z[] = {0D};
try {
JNIBaseCrs.operate( x , y, z,
getCrsProj(),getCrsProjBase());
} catch (OperationCrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new Point2D.Double(x[0],y[0]);
}
else
return pt;
}
/**
* @param targetParam
*/
/*public void setParamsInTarget(boolean targetParam) {
this.paramsInTarget = targetParam;
}*/
/**
*
* @return Cadena proj4 Correspondiente al CRS.
* @throws CrsException
*/
public String getProj4String() throws CrsException {
if (proj4String == null)
proj4String = getProj4().exportToProj4(crsGT);
return proj4String;
}
public CoordinateReferenceSystem getCrsGT() {
return crsGT;
}
public CrsProj getCrsProj() {
if (crsProj == null)
try {
crsProj = new CrsProj(getProj4String());
} catch (CrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return crsProj;
}
private CrsProj getCrsProjBase() {
if (crsProjBase == null){
AbstractDerivedCRS derivedCRS = (AbstractDerivedCRS)crsGT;
try {
crsProjBase = new CrsProj(getProj4().exportToProj4(derivedCRS.getBaseCRS()));
} catch (CrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return crsProjBase;
}
private Proj4 getProj4() {
if (proj4 == null)
try {
proj4 = new Proj4();
} catch (CrsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return proj4;
}
/**
* @return Authority:code:proj@Sourceparam@TargerParam@
*/
public String getFullCode() {
if (this.sourceTrParams == null && this.targetTrParams == null)
return getAbrev();
String sourceParams = "";
String targetParams = "";
if (sourceTrParams != null)
sourceParams = sourceTrParams;
if (targetTrParams != null)
targetParams = targetTrParams;
return getAbrev()+":proj@"+sourceParams+"@"+targetParams;
}
public Rectangle2D getExtent(Rectangle2D extent,double scale,double wImage,double hImage,double mapUnits,double distanceUnits,double dpi) {
double w =0;
double h =0;
double wExtent =0;
double hExtent =0;
if (isProjected()) {
w = ((wImage / dpi) * 2.54);
h = ((hImage / dpi) * 2.54);
wExtent =w * scale*distanceUnits/ mapUnits;
hExtent =h * scale*distanceUnits/ mapUnits;
}else {
w = ((wImage / dpi) * 2.54);
h = ((hImage / dpi) * 2.54);
wExtent =(w*scale*distanceUnits)/ (mapUnits*1852.0*60.0);
hExtent =(h*scale*distanceUnits)/ (mapUnits*1852.0*60.0);
}
double xExtent = extent.getCenterX() - wExtent/2;
double yExtent = extent.getCenterY() - hExtent/2;
Rectangle2D rec=new Rectangle2D.Double(xExtent,yExtent,wExtent,hExtent);
return rec;
}
}
| [
"[email protected]"
] | |
c90f6701d6cc8f9483ce8d96e2151b4d47081cc0 | a120fb9c81848811aff283ec6a0fa42b4d58ee32 | /02-java-oop/04-zoo-keeper-pt2/BigBat.java | 6d33ae91ad09e431d5b764fa9261cb0999e0f50a | [] | no_license | java-september-2021/ChrisM-Assignments | bcf29b1fd3c3f0f417d2d94ca7359ffd7e9c29a7 | f203f1c44b7e2449ed6f618c2e22de1d40727d4a | refs/heads/master | 2023-08-15T04:32:05.650136 | 2021-10-17T16:24:19 | 2021-10-17T16:24:19 | 400,835,558 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | public class BigBat extends Mammal {
public BigBat() {
setEnergyLevel(300);
}
public void fly() {
int energy = -50;
System.out.println("Swoosh! The bat takes off and soars into the air. Expend " + " energy.");
changeEnergyLevel(energy);
}
public void eatHumans() {
int energy = 25;
System.out.println("Crunch, crunch, Humans are juicy! Gain " + energy + " energy.");
changeEnergyLevel(energy);
}
public void attackTown() {
int energy = 100;
System.out.println("CRASH, BANG, CRACKLE AND BURN! This roof is on fire!!! Expend " + energy + " energy.");
changeEnergyLevel(energy);
}
}
| [
"[email protected]"
] | |
9bfb39eb3851f39e322624a233e01bd9ea488fee | 70103ef5ed97bad60ee86c566c0bdd14b0050778 | /src/test/java/com/credex/fs/digital/IntegrationTest.java | f8c41b346fad03b0881f60fb638a3213a2a0d663 | [] | no_license | alexjilavu/Smarthack-2021 | 7a127166cef52bfc9ee08ef1840c0fde2d2b79aa | 564abdc14df4981cdcad984a661f105327758559 | refs/heads/master | 2023-08-29T18:34:44.280519 | 2021-11-07T10:42:00 | 2021-11-07T10:42:00 | 423,957,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 504 | java | package com.credex.fs.digital;
import com.credex.fs.digital.SmarthackApp;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.boot.test.context.SpringBootTest;
/**
* Base composite annotation for integration tests.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@SpringBootTest(classes = SmarthackApp.class)
public @interface IntegrationTest {
}
| [
"[email protected]"
] | |
a512e0e02b93831164f8010a2fc9caaed8b6789d | e75224a640ea729691b606aabd3a220829960d9b | /android/app/build/generated/not_namespaced_r_class_sources/debug/r/com/facebook/fresco/memorytypes/ashmem/R.java | 58ef8bff52b42134ba05222f80020c0e8afedc17 | [] | no_license | rakshahegde10/workingApp | 6ed912488c73e0a5d22ce08bf56bbbdd14bc19e8 | 22e015c9aad733e86b0af64d4d91aa2814e41656 | refs/heads/main | 2023-02-27T18:54:45.101348 | 2021-02-05T02:27:29 | 2021-02-05T02:27:29 | 336,136,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,469 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.facebook.fresco.memorytypes.ashmem;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f02002a;
public static final int font = 0x7f020085;
public static final int fontProviderAuthority = 0x7f020087;
public static final int fontProviderCerts = 0x7f020088;
public static final int fontProviderFetchStrategy = 0x7f020089;
public static final int fontProviderFetchTimeout = 0x7f02008a;
public static final int fontProviderPackage = 0x7f02008b;
public static final int fontProviderQuery = 0x7f02008c;
public static final int fontStyle = 0x7f02008d;
public static final int fontVariationSettings = 0x7f02008e;
public static final int fontWeight = 0x7f02008f;
public static final int ttcIndex = 0x7f02012d;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04004b;
public static final int notification_icon_bg_color = 0x7f04004c;
public static final int ripple_material_light = 0x7f040056;
public static final int secondary_text_default_material_light = 0x7f040058;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004e;
public static final int compat_button_inset_vertical_material = 0x7f05004f;
public static final int compat_button_padding_horizontal_material = 0x7f050050;
public static final int compat_button_padding_vertical_material = 0x7f050051;
public static final int compat_control_corner_material = 0x7f050052;
public static final int compat_notification_large_icon_max_height = 0x7f050053;
public static final int compat_notification_large_icon_max_width = 0x7f050054;
public static final int notification_action_icon_size = 0x7f05005e;
public static final int notification_action_text_size = 0x7f05005f;
public static final int notification_big_circle_margin = 0x7f050060;
public static final int notification_content_margin_start = 0x7f050061;
public static final int notification_large_icon_height = 0x7f050062;
public static final int notification_large_icon_width = 0x7f050063;
public static final int notification_main_column_padding_top = 0x7f050064;
public static final int notification_media_narrow_margin = 0x7f050065;
public static final int notification_right_icon_size = 0x7f050066;
public static final int notification_right_side_padding_top = 0x7f050067;
public static final int notification_small_icon_background_padding = 0x7f050068;
public static final int notification_small_icon_size_as_large = 0x7f050069;
public static final int notification_subtext_size = 0x7f05006a;
public static final int notification_top_pad = 0x7f05006b;
public static final int notification_top_pad_large_text = 0x7f05006c;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060073;
public static final int notification_bg = 0x7f060074;
public static final int notification_bg_low = 0x7f060075;
public static final int notification_bg_low_normal = 0x7f060076;
public static final int notification_bg_low_pressed = 0x7f060077;
public static final int notification_bg_normal = 0x7f060078;
public static final int notification_bg_normal_pressed = 0x7f060079;
public static final int notification_icon_background = 0x7f06007a;
public static final int notification_template_icon_bg = 0x7f06007b;
public static final int notification_template_icon_low_bg = 0x7f06007c;
public static final int notification_tile_bg = 0x7f06007d;
public static final int notify_panel_notification_icon_bg = 0x7f06007e;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f070034;
public static final int action_divider = 0x7f070036;
public static final int action_image = 0x7f070037;
public static final int action_text = 0x7f07003d;
public static final int actions = 0x7f07003e;
public static final int async = 0x7f070045;
public static final int blocking = 0x7f070048;
public static final int chronometer = 0x7f070052;
public static final int forever = 0x7f070069;
public static final int icon = 0x7f07006e;
public static final int icon_group = 0x7f07006f;
public static final int info = 0x7f070073;
public static final int italic = 0x7f070074;
public static final int line1 = 0x7f070076;
public static final int line3 = 0x7f070077;
public static final int normal = 0x7f07007f;
public static final int notification_background = 0x7f070080;
public static final int notification_main_column = 0x7f070081;
public static final int notification_main_column_container = 0x7f070082;
public static final int right_icon = 0x7f07008a;
public static final int right_side = 0x7f07008b;
public static final int tag_transition_group = 0x7f0700ba;
public static final int tag_unhandled_key_event_manager = 0x7f0700bb;
public static final int tag_unhandled_key_listeners = 0x7f0700bc;
public static final int text = 0x7f0700be;
public static final int text2 = 0x7f0700bf;
public static final int time = 0x7f0700c2;
public static final int title = 0x7f0700c3;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080007;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0a001f;
public static final int notification_action_tombstone = 0x7f0a0020;
public static final int notification_template_custom_big = 0x7f0a0021;
public static final int notification_template_icon_group = 0x7f0a0022;
public static final int notification_template_part_chronometer = 0x7f0a0023;
public static final int notification_template_part_time = 0x7f0a0024;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0068;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00f9;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00fa;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00fb;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00fc;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00fd;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0171;
public static final int Widget_Compat_NotificationActionText = 0x7f0d0172;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f02002a };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f020087, 0x7f020088, 0x7f020089, 0x7f02008a, 0x7f02008b, 0x7f02008c };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020085, 0x7f02008d, 0x7f02008e, 0x7f02008f, 0x7f02012d };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
0e19f7f1ea6fbb07c04fb7ce886bdd53281aaecc | d7334632eae4cf605113aed2e0c35d57333e1214 | /src/main/java/com/ecoleprivee/ecoleprivee/EcolepriveeApplication.java | 75bfff74bb85c83446bf9e353fe2243d0e07dc58 | [] | no_license | marouajellal/EcolePrivee-JEE | fa1594f3240c04b500a88e3e4a0f986916c96e55 | 63a5f6ec24b7dc0157d9f91465b0732c40c680e1 | refs/heads/master | 2022-09-06T11:57:52.765809 | 2020-06-02T11:58:46 | 2020-06-02T11:58:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.ecoleprivee.ecoleprivee;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class EcolepriveeApplication {
public static void main(String[] args) {
SpringApplication.run(EcolepriveeApplication.class, args);
}
}
| [
"[email protected]"
] | |
720b9f995ea4d60695f96dd72451a10ca8d491e6 | 4061ea65f5365d42dbfecfdf25d7389a3896b20b | /session/src/main/java/com/lljqiu/session/SessionStore.java | ab0a487fdf7d1120d68f3b1a12b8c66d813c4470 | [] | no_license | xingganfengxing/start-common-sharingSession | e518c47a406281fc134005e6dc12ad997eb63474 | 0f0deb2fa3c34efcff50d78a94d73c9f9dcffb26 | refs/heads/master | 2021-01-12T08:42:44.795383 | 2016-11-24T06:31:12 | 2016-11-24T06:31:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,750 | java | package com.lljqiu.session;
/**
* <p>文件名称: SessionStore.java</p>
*
* <p>文件功能: session存储接口,不同的实现可以将session数据持久化到任意地方</p>
*
* <p>编程者: lljqiu</p>
*
* <p>初作时间: 2015年6月8日 下午9:31:12</p>
*
* <p>版本: version 1.0 </p>
*
* <p>输入说明: </p>
*
* <p>输出说明: </p>
*
* <p>程序流程: </p>
*
* <p>============================================</p>
* <p>修改序号:</p>
* <p>时间: </p>
* <p>修改者: </p>
* <p>修改内容: </p>
* <p>============================================</p>
*/
public interface SessionStore {
/**
* 新建session存储空间
*
* @param sessionId
* @param lifetime 单位:秒
*/
public void newSession(String sessionId, int lifetime);
/**
* 保活
*
* @param sessionId
* @param lifetime 单位:秒
*/
public void keepalive(String sessionId, int lifetime);
/**
* put数据到store中
*
* @param sessionId
* @param key
* @param value
*/
public void put(String sessionId, String key, Object value);
/**
* 从store中根据key获取数据
*
* @param sessionId
* @param key
* @return
*/
public Object get(String sessionId, String key);
/**
* 获取所有的key列表
*
* @param sessionId
* @return
*/
public String[] getAllKeys(String sessionId);
/**
* 删除指定key的内容
*
* @param sessionId
* @param key
*/
public void delete(String sessionId, String key);
/**
* 清理store
*
* @param sessionId
*/
public void clean(String sessionId);
}
| [
"[email protected]"
] | |
b9cee8f4b591eb7d223db3bb9a432883ddfb2b9d | 3c5c40e5f6cef9bf37a55c6d506ba130a0e2114f | /gatlin-soa/gatlin-soa-resource/gatlin-soa-resource-bean/src/main/java/org/gatlin/soa/resource/bean/entity/CfgResource.java | f593b8de54154a614596fe42b9043fdef023c513 | [] | no_license | 723854867/gatlin | c9baf20bead5f0f431ede528b3927a984a9612d2 | f7fdb191524db8ec72ad74998d253fb1010f82e9 | refs/heads/master | 2022-12-22T22:56:23.219346 | 2018-08-29T08:20:52 | 2018-08-29T08:20:52 | 127,830,582 | 0 | 1 | null | 2022-12-16T00:00:28 | 2018-04-03T00:59:12 | Java | UTF-8 | Java | false | false | 1,871 | java | package org.gatlin.soa.resource.bean.entity;
import javax.persistence.Id;
import org.gatlin.util.bean.Identifiable;
import org.gatlin.util.bean.enums.CacheUnit;
public class CfgResource implements Identifiable<Integer> {
private static final long serialVersionUID = 429288989882702100L;
@Id
private int id;
private int type;
private String name;
private int minimum;
private int maximum;
private int cacheSize;
private String directory;
private CacheUnit cacheUnit;
private int created;
private int updated;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getMinimum() {
return minimum;
}
public void setMinimum(int minimum) {
this.minimum = minimum;
}
public int getMaximum() {
return maximum;
}
public void setMaximum(int maximum) {
this.maximum = maximum;
}
public int getCacheSize() {
return cacheSize;
}
public void setCacheSize(int cacheSize) {
this.cacheSize = cacheSize;
}
public String getDirectory() {
return directory;
}
public void setDirectory(String directory) {
this.directory = directory;
}
public CacheUnit getCacheUnit() {
return cacheUnit;
}
public void setCacheUnit(CacheUnit cacheUnit) {
this.cacheUnit = cacheUnit;
}
public int getCreated() {
return created;
}
public void setCreated(int created) {
this.created = created;
}
public int getUpdated() {
return updated;
}
public void setUpdated(int updated) {
this.updated = updated;
}
@Override
public Integer key() {
return this.id;
}
}
| [
"[email protected]"
] | |
abf27f310ae22f29fa235ad7e81fcedceb39132f | e339381d969d53a6a59a63c960088e5bd36b175d | /src/Practica4/PersonalGestio.java | 07bcf9222764d384821e0004f28b551539341b81 | [] | no_license | Pagorn07/EjerciciosServidores | edbc7303a1f3eae0b3a5595022ecbf80a998f859 | eb54c524b60122786d620d938cbc9bdeb8d4c7d5 | refs/heads/master | 2021-01-12T11:56:43.848275 | 2016-10-14T15:21:08 | 2016-10-14T15:21:08 | 68,847,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 99 | java | package Practica4;
/**
* Created by arbos.pablo on 29/09/16.
*/
public class PersonalGestio {
}
| [
"[email protected]"
] | |
13294e1f1cc15f852712a74cadbe90988fee7e41 | 051ad787e7044d8eba694c7275702349c63e26ac | /src/graph/adjacencyList/weighted/directed/Graph.java | e107e72775e0670c43a6aae371de65ad8d0acc06 | [] | no_license | Haotian9850/graph-problems | 156ac1883706b2d36e4361f8e2365307ab44a78e | 71d15fe9e1d964aa820ba328ab64aaeabfcca8d6 | refs/heads/master | 2020-04-07T11:44:20.593336 | 2018-12-16T07:01:49 | 2018-12-16T07:01:49 | 158,338,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,428 | java | package graph.adjacencyList.weighted.directed;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
public class Graph {
/*
* adjacency list implementation of weighted directed graph
* Edge as separate entity
* */
int numNodes;
List<LinkedList<Edge>> list;
public Graph(){
//default constructor
this.numNodes = -1;
}
public Graph(int numNodes){
this.numNodes = numNodes;
this.list = new ArrayList<>();
for(int i = 0; i < this.numNodes; ++ i){
this.list.add(new LinkedList<>());
}
}
public void addEdge(int src, int dest, int weight){
//check input
if(src < 0 || src >= this.numNodes || dest < 0 || dest >= this.numNodes){
throw new IndexOutOfBoundsException("Malformed input!");
}
//newEdge
Edge newEdge = new Edge(src, dest, weight);
this.list.get(src).add(newEdge);
}
public int getOutdegree(int node){
if(node < 0 || node >= this.numNodes){
throw new IndexOutOfBoundsException("Malformed input!");
}
return this.list.get(node).size();
}
public void visualize(){
for(int i = 0; i < this.numNodes; ++ i){
System.out.println("node " + i + ": ");
LinkedList<Edge> edgeList = this.list.get(i);
for(Edge e : edgeList){
System.out.println(" " + "(" + e.src + " -> " + e.dest + ") with weight " + e.weight);
}
System.out.println(); //new line separator
}
}
/*
* @return: a list of integers, each equals to the shortest distance from start node
* to the node of its index
* */
public List<Integer> shortestDistToAllBellmanFord(int start){
List<Integer> result = new ArrayList<>();
List<Edge> allEdges = getAllEdges();
int[] dist = new int[this.numNodes];
Arrays.fill(dist, Integer.MAX_VALUE);
dist[start] = 0; //init
for(int i = 1; i <= this.numNodes - 1; ++ i){
for(Edge e : allEdges){
int src = e.src;
int dest = e.dest;
int weight = e.weight;
if(dist[src] != Integer.MAX_VALUE && dist[src] + weight < dist[dest]){
//update
dist[dest] = dist[src] + weight;
}
}
}
for(Integer i : dist){
result.add(i);
}
for(Integer i : result){
System.out.println(i);
}
return result;
}
/*returns all edges in a directed and weighted graph*/
public List<Edge> getAllEdges(){
List<Edge> result = new ArrayList<>();
for(LinkedList<Edge> neighbors : this.list){
for(Edge e : neighbors){
result.add(e);
}
}
return result;
}
/*
* @return: a list of integers, each equals to the shortest distance from start node
* to the node of its index
* */
public List<Integer> shortestDistToAllFloydWarshall(int start){
List<Integer> result = new ArrayList();
//DP mem structure
int[][] dist = new int[this.numNodes][this.numNodes];
for(int[] row : dist){
Arrays.fill(row, Integer.MAX_VALUE);
}
for(int i = 0; i < this.numNodes; ++ i){
for(int j = 0; j < this.numNodes; ++ j){
dist[i][j] = 0;
}
}
List<Edge> allEdges = getAllEdges();
for(Edge e : allEdges){
int src = e.src;
int dest = e.dest;
int weight = e.weight;
dist[src][dest] = weight;
}
//impl
for(int i = 0; i < this.numNodes; ++ i){
for(int j = 0; j < this.numNodes; ++ j){
for(int k = 0; k < this.numNodes; ++ k){
if(dist[i][k] + dist[k][j] < dist[i][j]){
dist[i][j] = dist[i][k] + dist[k][j];
}
}
}
}
//make result
for(int i = 0; i < this.numNodes; ++ i){
result.add(dist[start][i]);
}
for(Integer i : result){
System.out.println(i);
}
return result;
}
/*TODO: Max-flow problem, Ford-Fulkerson Algorithm*/
}
| [
"[email protected]"
] | |
2b79e34a96736393705ca95f00aeef029b70a300 | 5baae9a71d762126ed1214e7660a676e1e065236 | /app/src/main/java/com/massky/new119eproject/view/RoundProgressBar.java | 68cf878e9dbd249f7846812f6590482bce0edb21 | [] | no_license | 1559727195/Beijing1 | 9166b64a207a3742e6f55655bc0e47c614da98e9 | 28daf00d5d892d05f14f842b167d07c4a0f6c09e | refs/heads/master | 2021-08-31T03:34:43.928158 | 2017-12-20T08:09:25 | 2017-12-20T08:09:25 | 114,860,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,024 | java | package com.massky.new119eproject.view;
/**
* Created by zhu on 2017/10/26.
*/
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import com.massky.new119eproject.R;
/**
* 仿iphone带进度的进度条,线程安全的View,可直接在线程中更新进度
* @author xiaanming
*
*/
public class RoundProgressBar extends View {
/**
* 内圆的半径
*/
private final float roundWidth_inner;
/**
* 画笔对象的引用
*/
private Paint paint;
/**
* 圆环的颜色
*/
private int roundColor;
/**
* 圆环进度的颜色
*/
private int roundProgressColor;
/**
* 中间进度百分比的字符串的颜色
*/
private int textColor;
/**
* 中间进度百分比的字符串的字体
*/
private float textSize;
/**
* 圆环的宽度
*/
private float roundWidth;
/**
* 最大进度
*/
private int max;
/**
* 当前进度
*/
private int progress;
/**
* 是否显示中间的进度
*/
private boolean textIsDisplayable;
/**
* 进度的风格,实心或者空心
*/
private int style;
public static final int STROKE = 0;
public static final int FILL = 1;
public RoundProgressBar(Context context) {
this(context, null);
}
public RoundProgressBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
paint = new Paint();
TypedArray mTypedArray = context.obtainStyledAttributes(attrs,
R.styleable.RoundProgressBar);
//获取自定义属性和默认值
roundColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundColor, Color.RED);
roundProgressColor = mTypedArray.getColor(R.styleable.RoundProgressBar_roundProgressColor, Color.GREEN);
textColor = mTypedArray.getColor(R.styleable.RoundProgressBar_textColor, Color.GREEN);
textSize = mTypedArray.getDimension(R.styleable.RoundProgressBar_textSize, 15);
roundWidth = mTypedArray.getDimension(R.styleable.RoundProgressBar_roundWidth, 3);
roundWidth_inner = mTypedArray.getDimension(R.styleable.RoundProgressBar_roundWidth_inner,1);
max = mTypedArray.getInteger(R.styleable.RoundProgressBar_max, 100);
textIsDisplayable = mTypedArray.getBoolean(R.styleable.RoundProgressBar_textIsDisplayable, true);
style = mTypedArray.getInt(R.styleable.RoundProgressBar_style, 0);
mTypedArray.recycle();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
/**
* 画最外层的大圆环
*/
int centre = getWidth()/2; //获取圆心的x坐标
int radius = (int) (centre - roundWidth/2); //圆环的半径
int radius_innner = (int) (centre - roundWidth_inner/2); //圆环的半径
paint.setColor(roundColor); //设置圆环的颜色
paint.setStyle(Paint.Style.STROKE); //设置空心
paint.setStrokeWidth(roundWidth); //设置圆环的宽度,真正画的话还是靠paint.setStrokeWidth (roundWidth);
paint.setAntiAlias(true); //消除锯齿
canvas.drawCircle(centre, centre, radius, paint); //画出外圆环
//canvas.drawCircle(centre,centre,radius,paint);//radius 是距离centre的半径,然后画
//paint.setStrokeWidth (roundWidth)-》roundWidth宽度的圆弧
canvas.drawCircle(centre, centre, radius_innner, paint); //画出内圆环
Log.e("log", centre + "");
/**
* 画进度百分比
*/
paint.setStrokeWidth(0);
paint.setColor(textColor);
paint.setTextSize(textSize);
paint.setTypeface(Typeface.SERIF); //设置字体
// int percent = (int) (((float) progress / (float) max) * 100); //中间的进度百分比,先转换成float在进行除法运算,不然都为0
// float textWidth = paint.measureText(percent + "%"); //测量字体宽度,我们需要根据字体的宽度设置在圆环中间
float textWidth = paint.measureText(progress + "s"); //测量字体宽度,我们需要根据字体的宽度设置在圆环中间
if (textIsDisplayable && progress != 0 && style == STROKE) {
canvas.drawText(progress + "%", centre - textWidth / 2, centre + textSize / 2, paint); //画出进度百分比
}
/**
* 画圆弧 ,画圆环的进度
*/
//设置进度是实心还是空心
paint.setStrokeWidth(radius - radius_innner); //设置圆环的宽度 = 外圆半径 - 内圆半径(为小矩形的深度 -》高)
paint.setColor(roundProgressColor); //设置进度的颜色
RectF oval = new RectF(centre - radius_innner - (radius - radius_innner) / 2, centre - radius_innner - (radius - radius_innner) / 2, centre
+ radius_innner + (radius - radius_innner) / 2, centre + radius_innner + (radius - radius_innner) / 2); //用于定义的圆弧的形状和大小的界限
//float left, float top, float right, float bottom
//centre,centre为圆的中心x,y坐标
switch (style) {
case STROKE:{
paint.setStyle(Paint.Style.STROKE);
canvas.drawArc(oval, 0, 360 * progress / max, false, paint); //根据进度画圆弧
break;
}
case FILL:{
paint.setStyle(Paint.Style.FILL_AND_STROKE);
if(progress !=0)
// canvas.drawArc(oval, 0, 360 * progress / max, true, paint); //根据进度画圆弧
canvas.drawArc(oval,0,360 * progress / max,true,paint);
break;
}
}
}
public synchronized int getMax() {
return max;
}
/**
* 设置进度的最大值
* @param max
*/
public synchronized void setMax(int max) {
if(max < 0){
throw new IllegalArgumentException("max not less than 0");
}
this.max = max;
}
/**
* 获取进度.需要同步
* @return
*/
public synchronized int getProgress() {
return progress;
}
/**
* 设置进度,此为线程安全控件,由于考虑多线的问题,需要同步
* 刷新界面调用postInvalidate()能在非UI线程刷新
* @param progress
*/
public synchronized void setProgress(int progress) {
if(progress < 0){
throw new IllegalArgumentException("progress not less than 0");
}
if(progress > max){
progress = max;
}
if(progress <= max){
this.progress = progress;
postInvalidate();
}
}
public int getCricleColor() {
return roundColor;
}
public void setCricleColor(int cricleColor) {
this.roundColor = cricleColor;
}
public int getCricleProgressColor() {
return roundProgressColor;
}
public void setCricleProgressColor(int cricleProgressColor) {
this.roundProgressColor = cricleProgressColor;
}
public int getTextColor() {
return textColor;
}
public void setTextColor(int textColor) {
this.textColor = textColor;
}
public float getTextSize() {
return textSize;
}
public void setTextSize(float textSize) {
this.textSize = textSize;
}
public float getRoundWidth() {
return roundWidth;
}
public void setRoundWidth(float roundWidth) {
this.roundWidth = roundWidth;
}
} | [
"[email protected]"
] | |
b64128fd2ff4bfcac8ef9db90f22201915377a86 | dd612cee7b40114f4aa5ec253e1bdafd09a459f4 | /proj1b/Palindrome.java | 684423a74911b8bf20f8bc7665a714f2b59fa5a5 | [] | no_license | scot1l/cs61b-hjw | 2c3598a3edb21b2431c732363a14754ad0efd3e6 | 62fd61f16fc6f8378d81620435b2277567de8fd2 | refs/heads/master | 2022-10-08T19:03:04.837920 | 2020-05-27T15:50:03 | 2020-05-27T15:50:03 | 261,373,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 932 | java | public class Palindrome {
public Deque<Character> wordToDeque(String word){
Deque<Character> result = new LinkedListDeque<>();
for (int i = 0; i <word.length() ; i++) {
result.addLast(word.charAt(i));
}
return result;
}
public boolean isPalindrome(String word) {
Deque<Character> palindrome = wordToDeque(word);
for (int i = 0; i < word.length(); i++) {
if (word.charAt(i) != palindrome.removeLast()){
return false;
}
}
return true;
}
public boolean isPalindrome(String word, CharacterComparator cc){
Deque<Character> offByOne = wordToDeque(word);
for (int i = 0; i < word.length()/2; i++) {
if (!cc.equalChars(word.charAt(i),offByOne.removeLast())){
return false;
}
}
return true;
}
public static void main(String[] args) {
OffByOne ob = new OffByOne();
String word = "flake";
Palindrome p = new Palindrome();
System.out.println(p.isPalindrome(word, ob));
}
}
| [
"[email protected]"
] | |
7e7048748baf370bdf8d51cbb5274da7d616911f | 8ed59a43338dbef423a5d193acded8551e2b0b48 | /src/main/java/com/xjtu/form/CategoryForm.java | bd9d9a1f58e2d83e518dda9235d09d901137d79d | [] | no_license | qiuxiaoming/WeChat-ordering-system | 098d66e0cd21df7e2605c367e444175745af4a0d | 40ff78cf9a845a6b8d11ab89cd0e88f7699d9460 | refs/heads/master | 2022-11-25T01:18:29.469189 | 2020-07-27T08:07:23 | 2020-07-27T08:07:23 | 278,229,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.xjtu.form;
import lombok.Data;
/**
* Created by 10270 on 2020/7/25.
*/
@Data
public class CategoryForm {
private Integer categoryId;
private String categoryName;
private Integer categoryType;
}
| [
"[email protected]"
] | |
8c7ce526d127781afa1826bfd2bcd71785d63259 | ce4a07247ca36ba3bb9ed68fd29f7f17ca943957 | /java/com/example/proyectoventa_autos/AutoActivity.java | 50b046304dfc62293065bd9d66fa5ae5aad3d7c4 | [] | no_license | mafemle/Venta_Autos | a695caae8f0750ad18af4c865f4ae22405fd78bf | 6dd58a28653efa03a94bb5efd3acdc828d09fa78 | refs/heads/master | 2022-11-15T14:04:01.367179 | 2020-07-16T17:27:42 | 2020-07-16T17:27:42 | 280,214,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,698 | java | package com.example.proyectoventa_autos;
import androidx.appcompat.app.AppCompatActivity;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class AutoActivity extends AppCompatActivity {
EditText jetplaca, jetmodelo, jetmarca, jetvalor;
Button jbtnconsultar, jbtnadicionar, jbtnmodificar, jbtneliminar, jbtnregresar, jbtncancelar;
MainSQLiteOpenHelper Admin = new MainSQLiteOpenHelper(this, "empresa.db", null, 1);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auto);
jetplaca =findViewById(R.id.etplaca);
jetmodelo = findViewById(R.id.etmodelo);
jetmarca = findViewById(R.id.etmarca);
jetvalor = findViewById(R.id.etvalor);
jbtnconsultar = findViewById(R.id.btconsultar);
jbtnadicionar = findViewById(R.id.btadicionar);
jbtnmodificar = findViewById(R.id.btmodificar);
jbtneliminar = findViewById(R.id.bteliminar);
jbtnregresar = findViewById(R.id.btregresar);
jbtncancelar = findViewById(R.id.btcancelar);
}
public void limpiar_campos(){
jetplaca.setText("");
jetmodelo.setText("");
jetmarca.setText("");
jetvalor.setText("");
jetplaca.requestFocus();
}
public void adicionar (View v){
SQLiteDatabase db = Admin .getWritableDatabase();
String placa, modelo, marca, valor;
placa = jetplaca.getText().toString();
modelo = jetmodelo.getText().toString();
marca = jetmarca.getText().toString();
valor = jetvalor.getText().toString();
if(placa.isEmpty() || modelo.isEmpty() || marca.isEmpty() || valor.isEmpty()){
Toast.makeText(this, "Todos los datos son requeridos", Toast.LENGTH_LONG).show();
jetplaca.requestFocus();
}
else{
ContentValues dato = new ContentValues();
dato.put("placa", placa);
dato.put("modelo", modelo);
dato.put("marca", marca);
dato.put("valor", valor);
long resp=db.insert("auto", null, dato);
if(resp>0){
Toast.makeText(this, "Registro guardado ", Toast.LENGTH_LONG).show();
limpiar_campos();
}else{
Toast.makeText(this, "Error. No se pudo guardar ", Toast.LENGTH_LONG).show();
}
}
db.close();
}
public void modificar (View v){
SQLiteDatabase db = Admin.getWritableDatabase();
String placa, modelo, marca, valor;
placa = jetplaca.getText().toString();
modelo = jetmodelo.getText().toString();
marca = jetmarca.getText().toString();
valor = jetvalor.getText().toString();
if(placa.isEmpty() || modelo.isEmpty() || marca.isEmpty() || valor.isEmpty()){
Toast.makeText(this, "Todos los datos son requeridos para actualizar el auto", Toast.LENGTH_LONG).show();
jetplaca.requestFocus();
}else {
ContentValues dato = new ContentValues();
dato.put("placa", placa);
dato.put("modelo", modelo);
dato.put("marca", marca);
dato.put("valor", valor);
long resp = db.update("auto", dato, "placa='" + placa + "'", null);
if (resp > 0) {
Toast.makeText(this, "Se actualizaron los datos correctamente ", Toast.LENGTH_LONG).show();
limpiar_campos();
} else {
Toast.makeText(this, "Error. No se pudo guardar ", Toast.LENGTH_LONG).show();
}
}
db.close();
}
public void consultar(View v){
SQLiteDatabase db = Admin .getReadableDatabase();
String placa;
placa = jetplaca.getText().toString();
if(placa.isEmpty()){
Toast.makeText(this, "La placa es requerida para la busqueda", Toast.LENGTH_LONG).show();
jetplaca.requestFocus();
}else{
Cursor fila = db.rawQuery("SELECT * FROM auto WHERE placa='" + placa + "'", null );
if(fila.moveToFirst()){
jetmodelo.setText(fila.getString(1));
jetmarca.setText(fila.getString(2));
jetvalor.setText(fila.getString(3));
}else{
Toast.makeText(this, "La placa esta disponible", Toast.LENGTH_SHORT).show();
}
}
db.close();
}
public void eliminar(View v){
SQLiteDatabase db = Admin .getWritableDatabase();
String placa;
placa = jetplaca.getText().toString();
if(placa.isEmpty()){
Toast.makeText(this, "La placa es requerida para poder eliminar", Toast.LENGTH_LONG).show();
jetplaca.requestFocus();
}
else{
long resp=db.delete("auto", "placa = '" + placa + "'", null );
if(resp>0){
Toast.makeText(this, "Se eliminaron los datos correctamente ", Toast.LENGTH_LONG).show();
limpiar_campos();
}else{
Toast.makeText(this, "Error. No se pudo eliminar ", Toast.LENGTH_LONG).show();
}
}
db.close();
}
public void cancelar(View v){
limpiar_campos();
}
public void regresar (View v){
Intent IntRegresar = new Intent(this,MainActivity.class);
startActivity(IntRegresar);
}
} | [
"[email protected]"
] | |
1f61482e0757dd4aefb2e941e377c451e9981535 | 0cdfb75efb63fdfb1cd1bb2cc1e6d5db7a8f9213 | /AMFICOM/v1/bkp/mapviewclient/src/com/syrus/AMFICOM/Client/Map/Props/NodeLinkVisualManager.java | 234cd4d52a84a00c1e240bf7f0c382052408a04f | [] | no_license | syrus-ru/amficom | b230bd554b8c056c9ca1b3236f4c6ac0dc4bf0b5 | 1d1f0c89f05ad224cb7a111bbb36ed14416ab2fc | refs/heads/master | 2023-04-10T17:21:00.091946 | 2006-07-05T02:23:17 | 2006-07-05T02:23:17 | 361,810,067 | 5 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 1,265 | java | /**
* $Id: NodeLinkVisualManager.java,v 1.3 2005/05/27 15:14:58 krupenn Exp $
*
* Syrus Systems
* Научно-технический центр
* Проект: АМФИКОМ
*/
package com.syrus.AMFICOM.Client.Map.Props;
import com.syrus.AMFICOM.client.UI.StorableObjectEditor;
import com.syrus.AMFICOM.client.UI.VisualManager;
import com.syrus.AMFICOM.general.StorableObjectWrapper;
public class NodeLinkVisualManager implements VisualManager {
private static NodeLinkVisualManager instance;
private static NodeLinkEditor generalPanel;
private static MapElementCharacteristicsEditor charPanel;
public static NodeLinkVisualManager getInstance() {
if (instance == null)
instance = new NodeLinkVisualManager();
return instance;
}
public StorableObjectEditor getGeneralPropertiesPanel() {
if (generalPanel == null)
generalPanel = new NodeLinkEditor();
return generalPanel;
}
public StorableObjectEditor getCharacteristicPropertiesPanel() {
if (charPanel == null)
charPanel = new MapElementCharacteristicsEditor();
return charPanel;
}
public StorableObjectWrapper getController() {
return null;
}
public StorableObjectEditor getAdditionalPropertiesPanel() {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
ea2d4b4a250e080b87178c9f75c879e547020253 | 05a2f4c83017cab8ebc31c8f946573574ae94680 | /mooc-2013-OOProgrammingWithJava-PART2/week10-week10_29.PersonAndTheirHeirs/src/people/Student.java | c761e2ef8c00a8461ed4b41e494318f6f168f99b | [] | no_license | RBonnell/Java-MOOC | c82043e5b0d6efed345e28d20414dbb20c9d7d7e | 6dede5e2525513cf08ee78a47afb8243052a2536 | refs/heads/master | 2020-06-23T15:24:16.340046 | 2019-09-17T14:53:05 | 2019-09-17T14:53:05 | 198,662,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package people;
/**
*
* @author 358721
*/
public class Student extends Person{
private int credits;
public Student(String name, String address) {
super(name, address);
this.credits = 0;
}
public void study(){
this.credits++;
}
public int credits(){
return this.credits;
}
@Override
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append(super.toString()).append("\n credits ").append(this.credits());
return sb.toString();
}
}
| [
"[email protected]"
] | |
10832222f8c1ae405cb74fcb473b1466082323c0 | f8109eaa2c6bbe43e963696446c5f993e251b618 | /src/me/paul/imagemanipulator/Manager.java | 2e08b7b0485b090c22fedfd7c4584ad3022ce8d3 | [
"MIT"
] | permissive | paulwrubel/image-manipulator | bbc1c351eb0056eede2dee8d8e1ff47e6d6bcfbe | 9ab0504b3c81fd26f2abf77713e9e06c2066f385 | refs/heads/master | 2021-09-06T06:25:43.825343 | 2018-02-03T04:01:48 | 2018-02-03T04:01:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,533 | java | package me.paul.imagemanipulator;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.image.Image;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Manager extends Application {
public void start(Stage stage) {
Image image = new Image(getParameters().getRaw().get(0));
// Get pixel data from our Image
ArrayList<Pixel> unsortedPixels = getPixels(image);
ArrayList<Pixel> sortedPixels = new ArrayList<>(unsortedPixels);
// Get our pixel data in a sorted list.
// ...and yeah, sorry about the 2n memory use.
System.out.println("SORTING PIXELS!");
Collections.sort(sortedPixels);
// Create output Image
WritableImage result = new WritableImage((int)image.getWidth(), (int)image.getHeight());
File resultFile = new File("/home/voxaelfox/programming/java/ImageManipulator/src/output/" + getParameters().getRaw().get(1));
System.out.println("WRITING PIXELS TO IMAGE!");
fillImage(result, sortedPixels);
try {
System.out.println("EXPORTING BUFFER TO IMAGE!");
ImageIO.write(SwingFXUtils.fromFXImage(result, null), "png", resultFile);
} catch (IOException e) {
// TODO: handle exception here
}
System.out.println("~ DONE! ~");
Platform.exit();
}
private ArrayList<Pixel> getPixels(Image image) {
ArrayList<Pixel> p = new ArrayList<>();
PixelReader r = image.getPixelReader();
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < image.getHeight(); j++) {
p.add(new Pixel(i, j, r.getColor(i, j)));
}
}
return p;
}
private void fillImage(WritableImage image, ArrayList<Pixel> l) {
PixelWriter writer = image.getPixelWriter();
int i = 0;
for (int y = 0; y < image.getHeight(); y++) {
for (int x = 0; x < image.getWidth(); x++) {
writer.setColor(x, y, l.get(i).getColor());
i++;
}
}
}
public static void main(String args[]) {
launch(args);
}
}
| [
"[email protected]"
] | |
17dec49fcd5799b8caed312e91219c60a7ede69e | 82e6cbbb35ee1f27c52474209a4e1ef5114e6d5e | /src/main/java/dae/fxcreator/node/graph/TechniqueEditorPanel.java | a5c658d34bba3dfdcab7b6e9db36f820b983e705 | [] | no_license | samynk/Connect | 3458f2e0dd03f7eb331dbb97aa17e66e47eded19 | 12c150e61d5487321774965db14403e9fe023941 | refs/heads/master | 2021-09-06T22:18:56.266497 | 2018-02-12T10:58:04 | 2018-02-12T10:58:04 | 116,146,437 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,910 | java | package dae.fxcreator.node.graph;
import dae.fxcreator.gui.model.ProjectTreeModel;
import dae.fxcreator.node.project.FXProject;
import dae.fxcreator.node.project.Pass;
import dae.fxcreator.node.project.ShaderStage;
import dae.fxcreator.node.project.ShaderStructCollection;
import dae.fxcreator.node.project.Technique;
import dae.fxcreator.node.project.TechniqueCollection;
import dae.fxcreator.node.templates.NodeTemplateLibrary;
import dae.fxcreator.node.IONode;
import dae.fxcreator.node.StructField;
import dae.fxcreator.node.NodeInput;
import dae.fxcreator.node.IONode;
import dae.fxcreator.node.IOStruct;
import dae.fxcreator.node.graph.menus.PassMenu;
import dae.fxcreator.node.graph.menus.ShaderFieldMenu;
import dae.fxcreator.node.graph.menus.StructMenu;
import dae.fxcreator.node.graph.menus.TechniqueMenu;
import dae.fxcreator.node.graph.menus.TechniquePanelMenu;
import dae.fxcreator.node.graph.menus.TechniquesMenu;
import dae.fxcreator.node.graph.renderers.ShaderTreeCellRenderer;
import dae.fxcreator.ui.FXCreator;
import java.awt.Frame;
import java.util.ArrayList;
import javax.swing.tree.TreePath;
/**
*
* @author samynk
*/
public class TechniqueEditorPanel extends javax.swing.JPanel implements GraphListener{
private Pass pass;
private FXCreator parent;
private FXProject project;
private NodeTemplateLibrary library;
/**
* A dialog that allows the user to edit struct definitions.
*/
private StructEditor structEditor;
/**
* The popup menu for the techniques.
*/
private TechniquesMenu techniquesMenu;
/**
* The popup menu for a specific technique
*/
private TechniqueMenu techniqueMenu;
/**
* The popup menu for the pass object.
*/
private PassMenu passMenu;
/**
* The menu for the struct functionality.
*/
private StructMenu structMenu;
/**
* The menu for the shader fields.
*/
private ShaderFieldMenu shaderFieldMenu;
/**
* Technique panel menu.
*/
private TechniquePanelMenu graphEditorMenu;
/** Creates new form TechniqueEditorPanel */
public TechniqueEditorPanel() {
initComponents();
graphEditor1.setGraphLayout(GraphEditor.Layout.HORIZONTAL);
this.graphEditor1.addGraphListener(this);
//treeShader.setDragEnabled(true);
techniquesMenu = new TechniquesMenu(treeShader);
techniqueMenu = new TechniqueMenu(treeShader);
passMenu = new PassMenu(treeShader);
structMenu = new StructMenu(treeShader, this);
shaderFieldMenu = new ShaderFieldMenu(treeShader);
graphEditorMenu = new TechniquePanelMenu(this);
graphEditor1.setGeneralPopupMenu(graphEditorMenu);
treeShader.setCellRenderer(new ShaderTreeCellRenderer());
//treeShader.setRowHeight(24);
scrShaderTree.validate();
//treeShader.addTreeExpansionListener(this);
treeShader.setVisibleRowCount(100);
}
@Override
public void addNotify() {
super.addNotify();
structEditor = new StructEditor((Frame) this.getTopLevelAncestor(), true);
}
public void setProject(FXProject project) {
this.project = project;
treeShader.setModel(new ProjectTreeModel(project));
graphEditor1.setProject(project);
graphEditor1.enableDrop();
techniquesMenu.setProject(project);
techniqueMenu.setProject(project);
passMenu.setProject(project);
structMenu.setProject(project);
shaderFieldMenu.setProject(project);
graphEditorMenu.setProject(project);
graphEditorMenu.setLibrary(library);
Technique tech = project.getFirstTechnique();
setPass(tech.getFirstPass());
}
/**
* Clears the panel
*/
public void clear() {
graphEditor1.clearNodes();
}
/**
* Sets the parent of this TechniqueEditor panel.
* @param parent the parent frame.
*/
public void setParent(FXCreator parent) {
this.parent = parent;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
tglbtnGroup = new javax.swing.ButtonGroup();
treePopup = new javax.swing.JPopupMenu();
mnuChangeStruct = new javax.swing.JMenuItem();
splitShaderStage = new javax.swing.JSplitPane();
pnlGraph = new javax.swing.JPanel();
scrGraph = new javax.swing.JScrollPane();
graphEditor1 = new dae.fxcreator.node.graph.GraphEditor();
pnlPass = new javax.swing.JPanel();
scrShaderTree = new javax.swing.JScrollPane();
treeShader = new javax.swing.JTree();
mnuChangeStruct.setText("Edit Struct ...");
mnuChangeStruct.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mnuChangeStructActionPerformed(evt);
}
});
treePopup.add(mnuChangeStruct);
setLayout(new java.awt.BorderLayout(2, 2));
pnlGraph.setLayout(new java.awt.BorderLayout());
graphEditor1.setLayout(new java.awt.FlowLayout());
scrGraph.setViewportView(graphEditor1);
pnlGraph.add(scrGraph, java.awt.BorderLayout.CENTER);
splitShaderStage.setRightComponent(pnlGraph);
pnlPass.setLayout(new java.awt.BorderLayout());
javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Shader");
javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Structs");
javax.swing.tree.DefaultMutableTreeNode treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("color");
treeNode2.add(treeNode3);
treeNode1.add(treeNode2);
treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Techniques");
treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("technique1");
javax.swing.tree.DefaultMutableTreeNode treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("pass1");
treeNode3.add(treeNode4);
treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("pass2");
treeNode3.add(treeNode4);
treeNode2.add(treeNode3);
treeNode3 = new javax.swing.tree.DefaultMutableTreeNode("technique2");
treeNode4 = new javax.swing.tree.DefaultMutableTreeNode("pass1");
treeNode3.add(treeNode4);
treeNode2.add(treeNode3);
treeNode1.add(treeNode2);
treeShader.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
treeShader.setEditable(true);
treeShader.setMaximumSize(new java.awt.Dimension(150, 640));
treeShader.setVisibleRowCount(5);
treeShader.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
treeShaderMouseReleased(evt);
}
});
treeShader.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
treeShaderValueChanged(evt);
}
});
scrShaderTree.setViewportView(treeShader);
pnlPass.add(scrShaderTree, java.awt.BorderLayout.CENTER);
splitShaderStage.setLeftComponent(pnlPass);
add(splitShaderStage, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
private void mnuChangeStructActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuChangeStructActionPerformed
// launch the struct editor window.
Object o = treeShader.getSelectionPath().getLastPathComponent();
if (o instanceof IOStruct) {
IOStruct struct = (IOStruct) o;
structEditor.setModel(struct);
structEditor.setVisible(true);
//project.notifyNodeChanged(treeShader.getSelectionPath());
}
}//GEN-LAST:event_mnuChangeStructActionPerformed
private void treeShaderMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_treeShaderMouseReleased
if (evt.isPopupTrigger()) {
int row = treeShader.getRowForLocation(evt.getX(), evt.getY());
treeShader.setSelectionRow(row);
Object o = treeShader.getSelectionPath().getLastPathComponent();
if (o instanceof IOStruct) {
treePopup.show(treeShader, evt.getX(), evt.getY());
} else if (o instanceof TechniqueCollection) {
techniquesMenu.show(treeShader, evt.getX(), evt.getY());
} else if (o instanceof Technique) {
techniqueMenu.show(treeShader, evt.getX(), evt.getY());
} else if (o instanceof Pass) {
passMenu.show(treeShader, evt.getX(), evt.getY());
} else if (o instanceof ShaderStructCollection) {
structMenu.show(treeShader, evt.getX(), evt.getY());
} else if (o instanceof StructField) {
shaderFieldMenu.show(treeShader, evt.getX(), evt.getY());
}
}
}//GEN-LAST:event_treeShaderMouseReleased
private void treeShaderValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_treeShaderValueChanged
TreePath selection = evt.getNewLeadSelectionPath();
if (selection != null) {
Object o = selection.getLastPathComponent();
if (o != null && o instanceof Pass) {
this.setPass((Pass) o);
}
}
}//GEN-LAST:event_treeShaderValueChanged
public void addGraphListener(GraphListener gl) {
graphEditor1.addGraphListener(gl);
}
public void removeGraphListener(GraphListener gl) {
graphEditor1.removeGraphListener(gl);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private dae.fxcreator.node.graph.GraphEditor graphEditor1;
private javax.swing.JMenuItem mnuChangeStruct;
private javax.swing.JPanel pnlGraph;
private javax.swing.JPanel pnlPass;
private javax.swing.JScrollPane scrGraph;
private javax.swing.JScrollPane scrShaderTree;
private javax.swing.JSplitPane splitShaderStage;
private javax.swing.ButtonGroup tglbtnGroup;
private javax.swing.JPopupMenu treePopup;
private javax.swing.JTree treeShader;
// End of variables declaration//GEN-END:variables
public void nodeSelected(JGraphNode node) {
if (parent != null) {
parent.nodeEntered(node);
}
}
/**
* Called when a node was added to the pass editor.
* @param node the node that was added.
* @param parameters
* @param variableName
*/
public void nodeAdded(JGraphNode node) {
System.out.println("node added : " + node.getUserObject());
}
public void nodeRemoved(JGraphNode node) {
}
/**
* Called when a node was moved.
* @param node the node that was moved.
*/
public void nodeMoved(JGraphNode node) {
IONode ionode = (IONode) node.getUserObject();
ionode.setPosition(node.getX(), node.getY());
}
/*
public void linkSelected(GraphNodeLink link) {
}
public void linkAdded(GraphNodeLink link) {
ConnectorPoint cp = link.getFrom();
GraphNode output = cp.getParent();
GraphNode input = link.getTo().getParent();
IONode inputNode = (IONode) input.getUserObject();
ShaderInput si = inputNode.findInput(link.getTo().getLabel());
si.setConnectionString(output.getId() + "." + cp.getLabel());
}
public void linkRemoved(GraphNodeLink link) {
GraphNode input = link.getTo().getParent();
IONode inputNode = (IONode) input.getUserObject();
ShaderInput si = inputNode.findInput(link.getTo().getLabel());
si.setConnectionString("");
}
*/
/**
* Sets the library with node templates.
* @param library the library that defines templates.
*/
public void setLibrary(NodeTemplateLibrary library) {
this.library = library;
}
/**
* Returns the pass object that is currently edited.
* @return the Pass object.
*/
public Pass getPass() {
return this.pass;
}
/**
* Reloads the current pass.
*/
public void reloadPass() {
clear();
this.removeGraphListener(this);
if (pass.hasRasterizerState()) {
JGraphNode state = new JGraphNode(graphEditor1,pass.getRasterizerState());
graphEditor1.addNode(state);
}
ArrayList<ShaderStage> stages = pass.getStages();
for (ShaderStage stage : stages) {
JGraphNode gn = new JGraphNode(this.graphEditor1, stage);
graphEditor1.addNode(gn);
}
validate();
this.addGraphListener(this);
}
public void setPass(Pass pass) {
this.graphEditorMenu.setCurrentPass(pass);
this.pass = pass;
reloadPass();
graphEditor1.selectFirstNode();
}
/**
* Edit the struct
* @param struct the struct to edit.
*/
public void editStruct(IOStruct struct) {
this.structEditor.setModel(struct);
structEditor.setVisible(true);
}
public void linkAdded(Connector connector) {
}
public void linkRemoved(Connector connector) {
}
public void nodeEntered(JGraphNode node) {
//throw new UnsupportedOperationException("Not supported yet.");
}
public void updateStyles() {
this.graphEditor1.updateStyles();
}
}
| [
"[email protected]"
] | |
92a170702b34b8460a4377eb58d0e5317707d7b5 | db1a440d6e284167cb6dcd5f1e1f42640753fbc6 | /src/chap04/textbook/BreakExample.java | b7468b77c0ac5314ed61694c08c843222bc4c581 | [] | no_license | joojoo19/20200929-JAVA | 8a805e84937c37863343fdd9b19eaadb684eb4c9 | 59d83737a4a4279c9d11882448eee646c0e0f018 | refs/heads/master | 2023-01-03T12:35:46.717216 | 2020-10-30T08:03:04 | 2020-10-30T08:03:04 | 299,485,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package chap04.textbook;
public class BreakExample {
public static void main(String[] args) {
while(true) {
int num = (int)(Math.random()*6) +1;
System.out.println(num);
if(num ==6) {
break;
}
}
System.out.println("프로그램 종료");
}
}
| [
"[email protected]"
] | |
a1a02462d6ebb0ebbd589e62a4e9916963d7a1fe | 194753311646924cfb1dd23a2374be18caeb65b6 | /app/src/test/java/info/ravneetpunia/bmiapp/ExampleUnitTest.java | 75bcc5b2ffc4d9ded4a6833432a6d89bc14d1b31 | [] | no_license | RavneetDTU/BMI-App | b206e23952a1efd43d4725424fba8d45867dc038 | 3034ee2dd212bb823c7ab7fb9dc63263bd145519 | refs/heads/master | 2020-04-02T15:02:31.353215 | 2018-10-25T13:48:43 | 2018-10-25T13:48:43 | 154,549,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package info.ravneetpunia.bmiapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
9c75fd1b70b5cc74a0bfd889ca9b4e3ee564d59c | 72eebb44abf049a6b4b3e46a1f10138a0cf64530 | /Modular_Exponentiation.java | fa369f93162338dcb5ba93f989736bf5d394c5f4 | [] | no_license | sanjanathammayya/lockdown-coding | bdab90fbf92d16adc8b03db27a4be7341022b86b | f831b3891ae5e9a398a4e9d0f066186ecc60705e | refs/heads/master | 2022-11-21T20:40:50.796932 | 2020-07-19T16:20:44 | 2020-07-19T16:20:44 | 264,997,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 855 | java | import java.io.*;
import java.util.Scanner;
public class modexp
{
static int pow(int x, int y, int p)
{
int result = 1;
x = x % p;
if (x == 0) return 0;
while (y > 0)
{
if((y & 1)==1)
result= (result * x) % p;
y = y >> 1;
x = (x * x) % p;
}
return result;
}
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the value of x:");
int x =sc.nextInt();
System.out.println("Enter the value of y:");
int y =sc.nextInt();
System.out.println("Enter the value of p:");
int p =sc.nextInt();
System.out.println("Power is " + pow(x, y, p));
}
}
| [
"[email protected]"
] | |
303b1b332356c35064cee3394d9b3f4ce2a79d48 | b940db97ea92d9bec7d1bbd57070f1f26af5c313 | /server/src/main/java/com/hlz/gourdmall/util/Page2Data.java | 37de5357a197c199511c9dc482466b20286099cb | [] | no_license | JxnuHxh/GourdMall | 5759fdd448827881b09bccad3c0e5f5956e5d76d | 93ebe34afce8542e5d996752e502a19a6557986e | refs/heads/master | 2022-12-24T06:43:41.023576 | 2020-04-09T15:05:19 | 2020-04-09T15:05:19 | 218,174,901 | 10 | 1 | null | 2022-12-11T15:31:23 | 2019-10-29T01:01:48 | Vue | UTF-8 | Java | false | false | 734 | java | package com.hlz.gourdmall.util;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @author: Davion
* @date: 2019/12/4
* @description: 分页数据详情
*/
@Component
public class Page2Data {
public Map<String, Object> page2Data(Page page) {
Map<String, Object> data = new HashMap<>();
data.put("pageNum", page.getPageNum());
data.put("pageSize", page.getPageSize());
data.put("startRow", page.getStartRow());
data.put("endRow", page.getEndRow());
data.put("total", page.getTotal());
data.put("pages", page.getPages());
data.put("data", page);
return data;
}
}
| [
"[email protected]"
] | |
2391569f0787df2553b8e913b6aaf98eac272275 | bcf367a2cb81ccc065db3981c41a3c6264c3fed7 | /zigbee-api/src/main/java/org/bubblecloud/zigbee/network/zcl/protocol/command/rssi/location/DeviceConfigurationResponseCommand.java | 933296881b3bb31c800689e076afa6610d159375 | [
"Apache-2.0"
] | permissive | geog-opensource/zigbee4java | 1507a7ce3f678e88fc85fb7c0e54464b19647126 | 705c411ce2f4a9127f30059bc077237740ec4183 | refs/heads/master | 2022-11-29T21:44:29.008282 | 2022-11-28T21:02:09 | 2022-11-28T21:02:09 | 61,035,898 | 0 | 0 | Apache-2.0 | 2022-11-28T21:02:10 | 2016-06-13T12:50:09 | Java | UTF-8 | Java | false | false | 6,375 | java | package org.bubblecloud.zigbee.network.zcl.protocol.command.rssi.location;
import org.bubblecloud.zigbee.network.zcl.ZclCommandMessage;
import org.bubblecloud.zigbee.network.zcl.ZclCommand;
import org.bubblecloud.zigbee.network.zcl.protocol.ZclCommandType;
import org.bubblecloud.zigbee.network.zcl.protocol.ZclFieldType;
/**
* Code generated Device Configuration Response Command value object class.
*/
public class DeviceConfigurationResponseCommand extends ZclCommand {
/**
* Status command message field.
*/
private Integer status;
/**
* Power command message field.
*/
private Integer power;
/**
* Path Loss Exponent command message field.
*/
private Integer pathLossExponent;
/**
* Calculation Period command message field.
*/
private Integer calculationPeriod;
/**
* Number RSSI Measurements command message field.
*/
private Integer numberRssiMeasurements;
/**
* Reporting Period command message field.
*/
private Integer reportingPeriod;
/**
* Default constructor setting the command type field.
*/
public DeviceConfigurationResponseCommand() {
this.setType(ZclCommandType.DEVICE_CONFIGURATION_RESPONSE_COMMAND);
}
/**
* Constructor copying field values from command message.
* @param message the command message
*/
public DeviceConfigurationResponseCommand(final ZclCommandMessage message) {
super(message);
this.status = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_STATUS);
this.power = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_POWER);
this.pathLossExponent = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_PATH_LOSS_EXPONENT);
this.calculationPeriod = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_CALCULATION_PERIOD);
this.numberRssiMeasurements = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_NUMBER_RSSI_MEASUREMENTS);
this.reportingPeriod = (Integer) message.getFields().get(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_REPORTING_PERIOD);
}
@Override
public ZclCommandMessage toCommandMessage() {
final ZclCommandMessage message = super.toCommandMessage();
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_STATUS,status);
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_POWER,power);
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_PATH_LOSS_EXPONENT,pathLossExponent);
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_CALCULATION_PERIOD,calculationPeriod);
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_NUMBER_RSSI_MEASUREMENTS,numberRssiMeasurements);
message.getFields().put(ZclFieldType.DEVICE_CONFIGURATION_RESPONSE_COMMAND_REPORTING_PERIOD,reportingPeriod);
return message;
}
/**
* Gets Status.
* @return the Status
*/
public Integer getStatus() {
return status;
}
/**
* Sets Status.
* @param status the Status
*/
public void setStatus(final Integer status) {
this.status = status;
}
/**
* Gets Power.
* @return the Power
*/
public Integer getPower() {
return power;
}
/**
* Sets Power.
* @param power the Power
*/
public void setPower(final Integer power) {
this.power = power;
}
/**
* Gets Path Loss Exponent.
* @return the Path Loss Exponent
*/
public Integer getPathLossExponent() {
return pathLossExponent;
}
/**
* Sets Path Loss Exponent.
* @param pathLossExponent the Path Loss Exponent
*/
public void setPathLossExponent(final Integer pathLossExponent) {
this.pathLossExponent = pathLossExponent;
}
/**
* Gets Calculation Period.
* @return the Calculation Period
*/
public Integer getCalculationPeriod() {
return calculationPeriod;
}
/**
* Sets Calculation Period.
* @param calculationPeriod the Calculation Period
*/
public void setCalculationPeriod(final Integer calculationPeriod) {
this.calculationPeriod = calculationPeriod;
}
/**
* Gets Number RSSI Measurements.
* @return the Number RSSI Measurements
*/
public Integer getNumberRssiMeasurements() {
return numberRssiMeasurements;
}
/**
* Sets Number RSSI Measurements.
* @param numberRssiMeasurements the Number RSSI Measurements
*/
public void setNumberRssiMeasurements(final Integer numberRssiMeasurements) {
this.numberRssiMeasurements = numberRssiMeasurements;
}
/**
* Gets Reporting Period.
* @return the Reporting Period
*/
public Integer getReportingPeriod() {
return reportingPeriod;
}
/**
* Sets Reporting Period.
* @param reportingPeriod the Reporting Period
*/
public void setReportingPeriod(final Integer reportingPeriod) {
this.reportingPeriod = reportingPeriod;
}
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append(super.toString());
builder.append(", ");
builder.append("status");
builder.append('=');
builder.append(status);
builder.append(", ");
builder.append("power");
builder.append('=');
builder.append(power);
builder.append(", ");
builder.append("pathLossExponent");
builder.append('=');
builder.append(pathLossExponent);
builder.append(", ");
builder.append("calculationPeriod");
builder.append('=');
builder.append(calculationPeriod);
builder.append(", ");
builder.append("numberRssiMeasurements");
builder.append('=');
builder.append(numberRssiMeasurements);
builder.append(", ");
builder.append("reportingPeriod");
builder.append('=');
builder.append(reportingPeriod);
return builder.toString();
}
}
| [
"[email protected]"
] | |
830ed7534a2dafee42837848e8f2b8ddbfec6a60 | cfb0bcd84579c1fb14f731a584cd919e588543ae | /Luceneworkspace/a-multi-lucene-1/src/main/java/com/ddlab/rnd/sequential/SequentialIndexer1.java | 212748b8d02d1b4019ca424da9f05fa32883290c | [] | no_license | debjava/playground1 | 163e681377c7dd9b420ce5e9d9b4234a029b80a4 | a1ec06bb94fd5450742593909d5d35e1e157f83b | refs/heads/master | 2020-04-09T02:52:31.429953 | 2018-12-01T15:44:44 | 2018-12-01T15:44:44 | 159,958,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,006 | java | package com.ddlab.rnd.sequential;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import java.io.File;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
/**
* Created by PIKU on 2/19/2017.
*/
public class SequentialIndexer1 {
private static File indexDirPath = new File("local/data");
private static AtomicLong idCounter = new AtomicLong();
public static String getID() {
return String.valueOf(idCounter.getAndIncrement());
}
public static void addOrUpdateDocument(IndexWriter indexWriter, String id, String zipCode, String courseCode)
throws Exception {
Document doc = new Document();
doc.add(new StringField("id", id, Field.Store.YES));
doc.add(new StringField("zipCode", zipCode, Field.Store.YES));
doc.add(new StringField("courseCode", courseCode, Field.Store.YES));
// For full text search
String fullSearchableText = id + " " + zipCode + " " + courseCode;
doc.add(new TextField("content", fullSearchableText, Field.Store.NO));
if (indexWriter.getConfig().getOpenMode() == IndexWriterConfig.OpenMode.CREATE) {
indexWriter.addDocument(doc);
} else {
indexWriter.updateDocument(new Term("id", id), doc);
}
}
public static IndexWriter getIndexWriter() throws Exception {
Directory indexDir = FSDirectory.open(indexDirPath.toPath());
Analyzer analyzer = new StandardAnalyzer();
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
IndexWriter writer = new IndexWriter(indexDir, iwc);
return writer;
}
public static void storeDocs(IndexWriter writer) throws Exception {
for (int i = 0; i < 10; i++) {
String zipCode = "ZIP" + String.format("%05d", i);
for (int j = 0; j < 20; j++) {
String courseCode = "COURSE" + String.format("%05d", j);
String id = getID();
System.out.println(id + "-" + zipCode + "<---->" + courseCode);
addOrUpdateDocument(writer, id, zipCode, courseCode);
}
}
}
public static void main(String[] args) throws Exception {
long startTime = System.nanoTime();
IndexWriter writer = getIndexWriter();
storeDocs(writer);
writer.close();
System.out.println("Indexing completed successfully ...");
long endTime = System.nanoTime();
long duration = endTime - startTime;
long minutes = TimeUnit.MINUTES.convert(duration, TimeUnit.NANOSECONDS);
long seconds = TimeUnit.SECONDS.convert(duration, TimeUnit.NANOSECONDS);
System.out.println("Total time taken :::" + minutes + " minutes" + " OR " + seconds + " seconds");
}
}
| [
"[email protected]"
] | |
96495365f49393630564d106091af02741734c55 | 922e32a337f0ad2522d21cdb93fdaf798450fc00 | /ICareApplication/src/com/ftfl/icareapplication/activity/DiseViewHomeActivity.java | cfff7e9f4c6a3e2957bf6e3d7339f0e69ad4b624 | [
"Apache-2.0"
] | permissive | NurEJannat/Android | faef8b1470b0443cef55bfa6177eb992e0179bf5 | bdaa3600a68353aa8a001c225c3aaba71f2fa2f6 | refs/heads/master | 2021-01-19T09:38:14.268443 | 2015-03-12T09:40:28 | 2015-03-12T09:40:28 | 30,000,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,847 | java | package com.ftfl.icareapplication.activity;
import java.util.ArrayList;
import java.util.List;
import android.app.ActionBar;
import android.app.Activity;
import android.view.View.OnClickListener;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.ftfl.icareapplication.R;
import com.ftfl.icareapplication.database.DoctorDataSource;
import com.ftfl.icareapplication.database.ICareDietDataSource;
import com.ftfl.icareapplication.database.MedicalHistoryDataSourc;
import com.ftfl.icareapplication.database.ProfileDataSource;
import com.ftfl.icareapplication.database.VaccinationDataSourc;
import com.ftfl.icareapplication.model.DoctorProfile;
import com.ftfl.icareapplication.model.Profile;
public class DiseViewHomeActivity extends Activity {
ICareDietDataSource mDietDataSource = null;
// ICareActivityDietChart mProfile = null;
ImageView imgDietChaet = null;
ImageView imgDoctor = null;
ImageView imgMediccal = null;
ImageView imgVaccination = null;
TextView tvName = null;
TextView tvAge = null;
TextView tvWeight = null;
TextView tvHeight = null;
TextView tvBloodGroup = null;
TextView tvGender = null;
DoctorDataSource mDoctorDataSource = null;
DoctorProfile mDoctorProfile = null;
ProfileDataSource mHospitalDS = null;
MedicalHistoryDataSourc mMedicalDs=null;
VaccinationDataSourc mVaccineDs=null;
ICareDietDataSource mDietDS=null;
Profile mUpdateHospital = null;
List<String> mIdList = new ArrayList<String>();
String mID = "";
Long mLId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
//Naseer Action bar
ActionBar bar = getActionBar();
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00868B")));
mDoctorDataSource = new DoctorDataSource(this);
mMedicalDs = new MedicalHistoryDataSourc(this);
mVaccineDs = new VaccinationDataSourc(this);
mDietDS= new ICareDietDataSource(this);
tvName = (TextView) findViewById(R.id.viewProfileName);
tvAge = (TextView) findViewById(R.id.viewProfileAge);
tvGender = (TextView) findViewById(R.id.viewProfileGender);
tvBloodGroup = (TextView) findViewById(R.id.viewProfileBirthGroup);
Intent mActivityIntent = getIntent();
mID = mActivityIntent.getStringExtra("id");
if (mID != null) {
mLId = Long.parseLong(mID);
/*
* get the activity which include all data from database according
* hospitalId of the clicked item.
*/
mHospitalDS = new ProfileDataSource(this);
mUpdateHospital = mHospitalDS.singleProfileData(mLId);
String mName = mUpdateHospital.getName();
String mAge = mUpdateHospital.getAge();
String mGender = mUpdateHospital.getGender();
String mBloodGroup = mUpdateHospital.getBloodGroup();
// set the value of database to the text field.
tvName.setText(mName);
tvAge.setText(mAge);
tvGender.setText(mGender);
tvBloodGroup.setText(mBloodGroup);
mDietDataSource = new ICareDietDataSource(this);
imgDietChaet = (ImageView) findViewById(R.id.imageViewDietChart);
imgDietChaet.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (mDietDS.isEmpty()) {
Intent i = new Intent(DiseViewHomeActivity.this,
CreateDietChartActivity.class);
startActivity(i);
}
else {
Intent i = new Intent(DiseViewHomeActivity.this,
DietListActivity.class);
startActivity(i);
}
}
});
imgDoctor = (ImageView) findViewById(R.id.ImageViewDoctor);
imgDoctor.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (mDoctorDataSource.isEmpty()) {
Intent i = new Intent(DiseViewHomeActivity.this,
CreateDoctorActivity.class);
startActivity(i);
}
else {
Intent i = new Intent(DiseViewHomeActivity.this,
DoctorListViewActivity.class);
startActivity(i);
}
}
});
imgMediccal = (ImageView) findViewById(R.id.ImageViewMedical);
imgMediccal.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (mMedicalDs.isEmpty()) {
Intent i = new Intent(DiseViewHomeActivity.this,
CreateMedicalHistory.class);
startActivity(i);
}
else {
Intent i = new Intent(DiseViewHomeActivity.this,
MedicalHistoryListViewActivity.class);
startActivity(i);
}
}
});
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_home);
//
imgVaccination = (ImageView) findViewById(R.id.imageViewVeccination);
imgVaccination.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (mVaccineDs.isEmpty()) {
Intent i = new Intent(DiseViewHomeActivity.this,
CreateVaccinationProfile.class);
startActivity(i);
}
else {
Intent i = new Intent(DiseViewHomeActivity.this,
VaccinationListActivity.class);
startActivity(i);
}
}
});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.create_profile_actionbar, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.addProfilemanu:
startActivity(new Intent(DiseViewHomeActivity.this,
CreateProfileActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| [
"[email protected]"
] | |
fed6c70cab992308efa1435d82a195dfbcc1be8b | 111474e6a042ca1eb7bff4acddbd79ac61376af1 | /TrabalhoThiago-master/src/main/java/org/acme/model/Submission.java | 1bc0afec87a63fc96768f62d75486452ff786365 | [] | no_license | ThiagoDisk/LABII | 8d4bbe115933733d94d90cb153af6ffd57246fda | 0b0c89a80773c3ae4ac85d0812f3f56a4efc9018 | refs/heads/main | 2023-06-05T04:55:30.608978 | 2021-06-26T17:28:57 | 2021-06-26T17:28:57 | 380,559,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,171 | java | package org.acme.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.ArrayList;
import java.util.Date;
import java.util.MissingFormatArgumentException;
@Entity
public class Submission {
public Submission(){
this.createdAt = new Date();
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
public String filename;
public String problem;
public String source_code;
public String autor;
public Date createdAt;
public String status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getProblem() {
return problem;
}
public void setProblem(String problem) {
this.problem = problem;
}
public String getSource_code() {
return source_code;
}
public void setSource_code(String source_code) {
this.source_code = source_code;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public void validate() throws MissingFormatArgumentException{
ArrayList<String> missingFields = new ArrayList<String>();
if (filename == null) missingFields.add("filename");
if (problem == null) missingFields.add("problem");
if (source_code == null) missingFields.add("source_code");
if (autor == null) missingFields.add("autor");
if (!missingFields.isEmpty()){
throw new MissingFormatArgumentException(missingFields.toString());
}
}
}
| [
"[email protected]"
] | |
75613e974ad70e5f66707fd4b72e0744821bae9d | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_156/Testnull_15599.java | 4b07f082634ef4d1e6b6f40bafdcee64e89db7ec | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_156;
import static org.junit.Assert.*;
public class Testnull_15599 {
private final Productionnull_15599 production = new Productionnull_15599("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"[email protected]"
] | |
3fdacc4a91ff817f4b7d1a31e10b5778bc443da5 | b463d5cb328e6ae45ae6f78c937b94e83dad31b9 | /app/src/main/java/com/example/downloadpicture/di/module/ImageDataSourceFactoryModule.java | cb0160cfcb8dc54c82871d9e4244c752c1bce521 | [] | no_license | saharkh99/wallpaper | ffe623a33fc3e8cf656b88764bfe8a278ec0b2e5 | 069502a5a21be6c2d92b2ad070d2e0dd80bcb7ec | refs/heads/master | 2022-12-13T03:51:15.599192 | 2020-09-10T11:51:56 | 2020-09-10T11:51:56 | 294,395,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,818 | java | package com.example.downloadpicture.di.module;
import com.example.downloadpicture.di.PictureScope;
import com.example.downloadpicture.model.ImageDataSource;
import com.example.downloadpicture.service.ImageAPIService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
@Module(includes = OkHttpClientModule.class)
public class ImageDataSourceFactoryModule {
@Provides
public ImageDataSource createDataSource(ImageAPIService imageAPIService){
return new ImageDataSource(imageAPIService);
}
@PictureScope
@Provides
public ImageAPIService getService(Retrofit retrofit){
return retrofit.create(ImageAPIService.class);
}
@PictureScope
@Provides
public Retrofit retrofit(OkHttpClient okHttpClient,
GsonConverterFactory gsonConverterFactory, Gson gson, RxJava2CallAdapterFactory rxJava2CallAdapterFactory){
return new Retrofit.Builder()
.client(okHttpClient)
.baseUrl("https://api.unsplash.com/")
.addConverterFactory(gsonConverterFactory)
.addCallAdapterFactory(rxJava2CallAdapterFactory)
.build();
}
@Provides
public Gson gson(){
GsonBuilder gsonBuilder = new GsonBuilder();
return gsonBuilder.create();
}
@Provides
public GsonConverterFactory gsonConverterFactory(Gson gson){
return GsonConverterFactory.create(gson);
}
@Provides
public RxJava2CallAdapterFactory java2CallAdapterFactory(){
return RxJava2CallAdapterFactory.create();
}
}
| [
"[email protected]"
] | |
2e62ded1c98dfc1c875102ef6ba2666139a2cfe7 | 56e2f6a1b80c0f470771342904312af06221208f | /CampChallenge_java/019.巨大なソース修正/第二段階/src/java/jums/JumsHelper.java | 290766afb6940578b73c3f00853aa9cfec36b5aa | [] | no_license | U-Kazuki/GEEKJOB_Challenge | a20a4714b577ea74b154e8e6d04fdf46a29bdcee | 93f1a6777f3b43d30f0bb80fd9a0444825d4a42b | refs/heads/master | 2020-12-02T22:40:22.956531 | 2017-10-25T14:08:21 | 2017-10-25T14:08:21 | 96,163,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | package jums;
import java.util.ArrayList;
/**
* 画面系の処理や表示を簡略化するためのヘルパークラス。定数なども保存されます
* @author hayashi-s
*/
public class JumsHelper {
//トップへのリンクを定数として設定
private final String homeURL = "index.jsp";
public static JumsHelper getInstance(){
return new JumsHelper();
}
//トップへのリンクを返却
public String home(){
return "<a href=\""+homeURL+"\">トップへ戻る</a>";
}
/**
* 入力されたデータのうち未入力項目がある場合、チェックリストにしたがいどの項目が
* 未入力なのかのhtml文を返却する
* @param chkList UserDataBeansで生成されるリスト。未入力要素の名前が格納されている
* @return 未入力の項目に対応する文字列
*/
// 入力フォームの未記入時のエラー文は此処で生成されているのでしょうか?
// chkinput(chkListにArrayListクラスとして文字列型の値を入れる)chkinputメソッド
public String chkinput(ArrayList<String> chkList){
String output = "";
// 文字列型のval変数をchkListに入った値で回す所(for文の最新型)
for(String val : chkList){// for(String val = 0; val.length; val++);
if(val.equals("name")){
output += "名前";// output = output + "名前"
}
if(val.equals("year")){
output +="年";
}
if(val.equals("month")){
output +="月";
}
if(val.equals("day")){
output +="日";
}
if(val.equals("type")){
output +="種別";
}
if(val.equals("tell")){
output +="電話番号";
}
if(val.equals("comment")){
output +="自己紹介";
}
output +="が未記入です<br>";
}
return output;
}
/**
* 種別は数字で取り扱っているので画面に表示するときは日本語に変換
* @param i
* @return
*/
public String exTypenum(int i){
switch(i){
case 1:
return "営業";
case 2:
return "エンジニア";
case 3:
return "その他";
}
return "";
}
}
| [
"[email protected]"
] | |
f7d1cd986fddfbb3b5bc15088ade0981de057ff0 | 4703e00d2ae449a57b8907b07fb35249129b003e | /Midterm Coding Project/src/main/java/com/cisc181/Exceptions/PersonException.java | 56f8ff81389d4117ff294a53d292e5a66de5c753 | [] | no_license | mtgtrader56/CISC181examcodingproblemElliottJones | e0a383c8c210a27bf93820a3cffaeeeca2b02505 | cfa6c79deb814e303c13a3991fd72b2c18cb6e9e | refs/heads/master | 2021-01-11T04:43:45.247856 | 2016-10-17T06:30:47 | 2016-10-17T06:30:47 | 71,106,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.cisc181.Exceptions;
import com.cisc181.core.Person;
public class PersonException extends Exception {
private Person p;
public PersonException(Person p){
super();
this.p = p;
System.out.println("Your Phone # is not properly formatted");
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.