blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1166fc63538dd64f582b682608628d6fe1c4289c | 2d8000a25632d7f382fe0455d3c2365212d4409c | /app/src/main/java/com/jacksen/wanandroid/presenter/todo/fragment/todo/TodoFragPresenter.java | 36c481578591c628382c4d21ecbd6bdef2a334e0 | [] | no_license | JacksenLaw/Jacksenlaw-WanAndroid | 4925071174de34cba32e9d0c0b2aa767bbe7626a | dbc4d8f386daeb7b90e0fc2f4dae004805b39be6 | refs/heads/master | 2020-07-03T20:31:30.218571 | 2019-10-22T08:33:59 | 2019-10-22T08:33:59 | 202,040,701 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,194 | java | package com.jacksen.wanandroid.presenter.todo.fragment.todo;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jacksen.aspectj.annotation.Login;
import com.jacksen.wanandroid.R;
import com.jacksen.wanandroid.app.Constants;
import com.jacksen.wanandroid.base.presenter.BasePresenter;
import com.jacksen.wanandroid.model.DataManager;
import com.jacksen.wanandroid.model.bean.todo.TodoBean;
import com.jacksen.wanandroid.model.bus.BusConstant;
import com.jacksen.wanandroid.model.bus.LiveDataBus;
import com.jacksen.wanandroid.model.http.RxUtils;
import com.jacksen.wanandroid.model.http.base.BaseObserver;
import com.jacksen.wanandroid.util.KLog;
import com.jacksen.wanandroid.util.MaterialDialogUtils;
import com.jacksen.wanandroid.view.bean.todo.FilterResult;
import com.jacksen.wanandroid.view.bean.todo.ViewTodoData;
import com.jacksen.wanandroid.view.ui.todo.activity.TodoCreateActivity;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import okhttp3.ResponseBody;
/**
* 作者: LuoM
* 时间: 2019/5/1 0001
* 描述:
* 版本: v1.0.0
* 更新: 本次修改内容
*/
public class TodoFragPresenter extends BasePresenter<TodoFragContract.View> implements TodoFragContract.Presenter {
private int pageNo = 1;
private boolean isFilter;
private Map<String, String> params = new HashMap<>();
@Inject
public TodoFragPresenter(DataManager dataManager) {
super(dataManager);
}
@Override
public void injectEvent() {
super.injectEvent();
LiveDataBus.get()
.with(BusConstant.TODO_CREATED, Object.class)
.observe(this, o -> {
getTodoData(1);
isFilter = true;
});
}
@Override
public void getTodoData(int pageNo) {
params.put("status", "0");
addSubscribe(dataManager.getTodoData(pageNo, params)
.compose(RxUtils.rxSchedulerHelper())
.compose(RxUtils.handleResult())
.subscribeWith(new BaseObserver<TodoBean>(getView()) {
@Override
public void onNext(TodoBean todoBean) {
KLog.i(todoBean.toString());
ArrayList<ViewTodoData.ViewTodoItem> items = new ArrayList<>();
for (TodoBean.DatasBean data : todoBean.getDatas()) {
items.add(new ViewTodoData.ViewTodoItem(data.getId(), data.getTitle(), data.getContent(),
data.getDateStr(), data.getCompleteDateStr(), data.getType(), data.getStatus(), data.getPriority()));
}
ViewTodoData viewTodoData = new ViewTodoData(items);
getView().showTodoData(viewTodoData, isFilter);
getView().showNormal();
}
}));
}
@Override
public void onRefresh() {
pageNo = 1;
getTodoData(pageNo);
}
@Override
public void onLoadMore() {
isFilter = false;
pageNo++;
getTodoData(pageNo);
}
@Override
public void filterData(List<FilterResult> results) {
isFilter = true;
if (results != null) {
params.clear();
for (FilterResult result : results) {
if (!TextUtils.isEmpty(result.getKey())) {
if (!getFragment().getString(R.string.filter_all).equals(result.getKey())) {
params.put(result.getKey(), result.getValue());
}
}
KLog.i(result.toString());
}
}
getTodoData(1);
}
@Override
public void doUpdateTodoClick(BaseQuickAdapter adapter, View view, int position) {
Intent intent = new Intent(getFragment().getActivity(), TodoCreateActivity.class);
Bundle bundle = new Bundle();
bundle.putBoolean(Constants.ARG_PARAM1, false);
bundle.putSerializable(Constants.ARG_PARAM2, (ViewTodoData.ViewTodoItem) adapter.getData().get(position));
intent.putExtras(bundle);
getFragment().startActivity(intent);
}
@Override
@Login
public void doDoneTodoClick(BaseQuickAdapter adapter, View view, int position) {
MaterialDialogUtils.showBasicDialog(getFragment().getActivity(), getFragment().getString(R.string.todo_update_status_done))
.onNegative((dialog, which) -> dialog.dismiss())
.onPositive((dialog, which) ->
addSubscribe(dataManager.updateOnlyStatusTodo(((ViewTodoData.ViewTodoItem) adapter.getData().get(position)).getId(), "1")
.compose(RxUtils.rxSchedulerHelper())
.compose(RxUtils.handleResult())
.subscribeWith(new BaseObserver<TodoBean>(getView()) {
@Override
public void onNext(TodoBean responseBody) {
getTodoData(pageNo);
isFilter = true;
LiveDataBus.get().with(BusConstant.TODO_STATUS_DONE).postValue(null);
}
})))
.show();
}
@Override
public void doDeleteSwipe(int id) {
addSubscribe(dataManager.deleteTodo(id)
.compose(RxUtils.rxSchedulerHelper())
.subscribeWith(new BaseObserver<ResponseBody>(getView()) {
@Override
public void onNext(ResponseBody responseBody) {
try {
KLog.i(responseBody.string());
} catch (IOException e) {
e.printStackTrace();
}
}
}));
}
}
| [
"luomeng@cyclecentury.com"
] | luomeng@cyclecentury.com |
44069d537bc758ac2ac13d9cb467e0f3de79f261 | b84596efa9d8a7eb50b34a4a0478cd0c929acd5b | /SOLID/src/main/java/ISP/problema/Penguim.java | c0709cd67a64fb1ab4b75cc2cc6d5e9a31cf76f9 | [] | no_license | lanasreis/JAVA-DIO | a2628b286733675c7a0d14adba5e5212d4a6e433 | 471d19f117ccbdf554a129c4a8d2712cd99a9f26 | refs/heads/master | 2023-01-11T02:27:41.437579 | 2020-11-16T18:24:42 | 2020-11-16T18:24:42 | 309,234,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package ISP.problema;
public class Penguim implements Ave {
@Override
public void bicar() {
//consegue bicar
}
@Override
public void chpcarOvos() {
//consegue chocar Ovos
}
@Override
public void voar() {
//NÃO CONSEGUE VOAR
}
}
| [
"lanareissdd@gmail.com"
] | lanareissdd@gmail.com |
ed7f087e755b539f0e507bae0bbe1cb9254d3c4e | 6b5930fb4e9c5b6829684a903eca8dea3db8b738 | /app/src/main/java/com/hotel/mangrovehotel/TramsAncConditions.java | 82797098aa7c42d9b0259c1a129396fa3c624842 | [] | no_license | RxSajib/HotelAppFinial | 9aca5668b6a742c378c42ed8073143b05f0e6f89 | 8a411842006518a4611f9fc83988f825dc285def | refs/heads/master | 2020-11-26T02:26:37.452255 | 2020-02-22T15:41:30 | 2020-02-22T15:41:30 | 228,936,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package com.hotel.mangrovehotel;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.os.Bundle;
import android.view.MenuItem;
public class TramsAncConditions extends AppCompatActivity {
private Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trams_anc_conditions);
toolbar = findViewById(R.id.TramConditionIDToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.back_icon);
getSupportActionBar().setTitle("Why Mangrove");
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
| [
"sajibroy206@gmail.com"
] | sajibroy206@gmail.com |
dc738416b7bd7bc36a7c3ba4b7cef69c9185a8c7 | 0f7cb184136862657bb1c3a69cbea2e967003bbf | /core/src/test/java/org/neuronbit/xpi/common/extension/adaptive/HasAdaptiveExt.java | 9c8df5842e06d1f604aa634d9fde0707780dfdc9 | [
"Apache-2.0"
] | permissive | ziscloud/xpi | 1a21d1d8eb039455609ebe50bf96672681736e9e | 7bb89918b5b8fb46036b89e93cd97a17e96fb0f4 | refs/heads/master | 2023-07-10T05:06:03.852718 | 2021-08-08T00:24:41 | 2021-08-08T00:24:41 | 388,655,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | 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.neuronbit.xpi.common.extension.adaptive;
import org.neuronbit.xpi.common.extension.Adaptive;
import org.neuronbit.xpi.common.extension.SPI;
@SPI
public interface HasAdaptiveExt {
@Adaptive
String echo(HasAdaptiveExtParam url, String s);
}
| [
"ziscloud@gmail.com"
] | ziscloud@gmail.com |
d5e019bca4c7b183e865dbe4134196e6c36e219f | e7199b55d70540cc219d14d0bd9392865af95e4c | /server/src/main/java/pl/kluczify/server/controllers/PermissionController.java | d4d384b9e4afcc20e06c857b1acd9b7eae2847a1 | [] | no_license | jedrek18/Kluczify | 3ea9dfb1325dd8ee4a4bbedf0cbbf98aeee10a74 | 2ae289bd1a0c12cd26babc6cff2ece0f814b7f53 | refs/heads/master | 2021-05-06T11:32:56.602276 | 2018-01-23T23:43:51 | 2018-01-23T23:43:51 | 114,296,416 | 0 | 0 | null | 2018-01-23T21:34:50 | 2017-12-14T21:09:16 | Java | UTF-8 | Java | false | false | 4,718 | java | package pl.kluczify.server.controllers;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import pl.kluczify.server.models.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List;
@Controller
public class PermissionController {
@Autowired
private PermissionDao permissionDao;
@Autowired
private UserDao userDao;
@Autowired
private RoomDao roomDao;
//Public methods
@RequestMapping("/create-permission")
@ResponseBody
public String create(Long userId, String creationDate, String expiryDate, Long roomId) {
Permission permission = null;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
User user = userDao.findOne(userId);
Room room = roomDao.findOne(roomId);
LocalDateTime creationDateTime = LocalDateTime.parse(creationDate, formatter);
LocalDateTime expiryDateTime = LocalDateTime.parse(expiryDate, formatter);
try {
permission = new Permission(user, creationDateTime, expiryDateTime, room);
permissionDao.save(permission);
}
catch (Exception ex) {
return "Error creating permission: " + ex.toString();
}
return "Permission succesfully created! (id = " + permission.getId() + ")";
}
@RequestMapping("/delete-permission")
@ResponseBody
public String delete(long id) {
try {
Permission permission = new Permission(id);
permissionDao.delete(permission);
}
catch (Exception ex) {
return "Error deleting permission: " + ex.toString();
}
return "Permission succesfully deleted!";
}
@RequestMapping("/get-permission-by-id")
@ResponseBody
public String getById(long id) {
LocalDateTime permissionCreationDate;
LocalDateTime permissionExpiryDate;
List<Room> permissionRooms;
User permissionUser;
try {
Permission permission = permissionDao.findById(id);
permissionCreationDate = permission.getCreationDate();
permissionExpiryDate = permission.getExpiryDate();
permissionRooms = permission.getRooms();
permissionUser = permission.getUser();
}
catch (Exception ex) {
return "Permission not found";
}
return "Data for permission id=" + id + ": user: " + permissionUser.getUserName() + " (id=" + permissionUser.getId() + "), creation_date: " + permissionCreationDate + ", expiry_date: " + permissionExpiryDate + ", rooms: " + Arrays.toString(permissionRooms.toArray());
}
@RequestMapping("/update-permission-date")
@ResponseBody
public String updatePermission(long id,
@RequestParam(value = "creationDate", required = false) String creationDate,
@RequestParam (value = "expiryDate", required = false ) String expiryDate) {
try {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
Permission permission = permissionDao.findOne(id);
if(creationDate != null ){
LocalDateTime creationDateTime = LocalDateTime.parse(creationDate, formatter);
permission.setCreationDate(creationDateTime);
}
if(expiryDate != null ){
LocalDateTime expiryDateTime = LocalDateTime.parse(expiryDate, formatter);
permission.setExpiryDate(expiryDateTime);
}
permissionDao.save(permission);
}
catch (Exception ex) {
return "Error updating permission: " + ex.toString();
}
return "Permission succesfully updated!";
}
@RequestMapping("/add-room-to-permission")
@ResponseBody
public String addRoom(long permissionId, long roomId){
List<Room> allRooms;
try {
Permission permission = permissionDao.findOne(permissionId);
Room room = roomDao.findOne(roomId);
allRooms = permission.addRoom(room);
permissionDao.save(permission);
}
catch (Exception ex) {
return "Error updating permission: " + ex.toString();
}
return "Room succesfully added for permission id=" + permissionId + "! Permission rooms: " + Arrays.toString(allRooms.toArray());
}
}
| [
"stilo001@gmail.com"
] | stilo001@gmail.com |
def8d468df2df14dc19164493907ab4304a6b424 | 7128dd2f13d19e5c720470ec60387431dffdef65 | /src/java/controller/VehiculosJpaController.java | 92f961052cee483fe9916c54266e52264371bce7 | [] | no_license | Dakkar05/Prueba-Bimestral | 5a389c34fef2d2aaa137819d3a54f2a8c6dc9623 | 5e926d5109c7d350668d5684d0935bb739071230 | refs/heads/master | 2022-12-02T11:31:39.644405 | 2020-08-21T21:17:22 | 2020-08-21T21:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,553 | 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 controller;
import controller.exceptions.NonexistentEntityException;
import controller.exceptions.PreexistingEntityException;
import controller.exceptions.RollbackFailureException;
import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;
import javax.persistence.EntityNotFoundException;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import javax.transaction.UserTransaction;
import modelo.Vehiculos;
/**
*
* @author santiago
*/
public class VehiculosJpaController implements Serializable {
public VehiculosJpaController(UserTransaction utx, EntityManagerFactory emf) {
this.utx = utx;
this.emf = emf;
}
private UserTransaction utx = null;
private EntityManagerFactory emf = null;
public EntityManager getEntityManager() {
return emf.createEntityManager();
}
public void create(Vehiculos vehiculos) throws PreexistingEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
em.persist(vehiculos);
utx.commit();
} catch (Exception ex) {
try {
utx.rollback();
} catch (Exception re) {
throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re);
}
if (findVehiculos(vehiculos.getIdvehiculos()) != null) {
throw new PreexistingEntityException("Vehiculos " + vehiculos + " already exists.", ex);
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void edit(Vehiculos vehiculos) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
vehiculos = em.merge(vehiculos);
utx.commit();
} catch (Exception ex) {
try {
utx.rollback();
} catch (Exception re) {
throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re);
}
String msg = ex.getLocalizedMessage();
if (msg == null || msg.length() == 0) {
Integer id = vehiculos.getIdvehiculos();
if (findVehiculos(id) == null) {
throw new NonexistentEntityException("The vehiculos with id " + id + " no longer exists.");
}
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public void destroy(Integer id) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
Vehiculos vehiculos;
try {
vehiculos = em.getReference(Vehiculos.class, id);
vehiculos.getIdvehiculos();
} catch (EntityNotFoundException enfe) {
throw new NonexistentEntityException("The vehiculos with id " + id + " no longer exists.", enfe);
}
em.remove(vehiculos);
utx.commit();
} catch (Exception ex) {
try {
utx.rollback();
} catch (Exception re) {
throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re);
}
throw ex;
} finally {
if (em != null) {
em.close();
}
}
}
public List<Vehiculos> findVehiculosEntities() {
return findVehiculosEntities(true, -1, -1);
}
public List<Vehiculos> findVehiculosEntities(int maxResults, int firstResult) {
return findVehiculosEntities(false, maxResults, firstResult);
}
private List<Vehiculos> findVehiculosEntities(boolean all, int maxResults, int firstResult) {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
cq.select(cq.from(Vehiculos.class));
Query q = em.createQuery(cq);
if (!all) {
q.setMaxResults(maxResults);
q.setFirstResult(firstResult);
}
return q.getResultList();
} finally {
em.close();
}
}
public Vehiculos findVehiculos(Integer id) {
EntityManager em = getEntityManager();
try {
return em.find(Vehiculos.class, id);
} finally {
em.close();
}
}
public int getVehiculosCount() {
EntityManager em = getEntityManager();
try {
CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
Root<Vehiculos> rt = cq.from(Vehiculos.class);
cq.select(em.getCriteriaBuilder().count(rt));
Query q = em.createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
} finally {
em.close();
}
}
}
| [
"santiago@santiago-Inspiron-3583"
] | santiago@santiago-Inspiron-3583 |
9539fbbc209da8dfb82617250664a82c4ebeff8f | 16a86330792bcbb78ccce5dbf043824faf94074d | /app/src/main/java/com/example/thatsmepratik/moviebuddies/ui/ForgotPassActivity.java | 72366d2448715421a5f3124cba158c994b68821a | [] | no_license | pratikgarala/MovieBuddies | 699afe23a4415600076e354ede15a8297a7eef13 | bb05594f087e0f0bc2629de841831709fef57f58 | refs/heads/master | 2020-12-25T14:23:17.260350 | 2016-09-12T01:52:33 | 2016-09-12T01:52:33 | 67,963,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,973 | java | package com.example.thatsmepratik.moviebuddies.ui;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.thatsmepratik.moviebuddies.R;
import com.example.thatsmepratik.moviebuddies.models.Constants;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
public class ForgotPassActivity extends AppCompatActivity {
private EditText etEmailId;
private Button btnSend;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot_pass);
etEmailId = (EditText) this.findViewById(R.id.etEmailId);
btnSend = (Button) this.findViewById(R.id.btnSend);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Firebase ref = new Firebase(Constants.FIREBASE_URL);
ref.resetPassword(etEmailId.getText().toString(), new Firebase.ResultHandler() {
@Override
public void onSuccess() {
// password reset email sent
String successMsg = getString(R.string.PassResetLinkSent);
Toast toast = Toast.makeText(ForgotPassActivity.this, successMsg, Toast.LENGTH_LONG);
toast.show();
}
@Override
public void onError(FirebaseError firebaseError) {
// error encountered
String errorMsg = "Error in sending mail..!!";
Toast toast = Toast.makeText(ForgotPassActivity.this, errorMsg, Toast.LENGTH_LONG);
toast.show();
}
});
}
});
}
}
| [
"pratikgarala@Pratiks-MacBook-Pro.local"
] | pratikgarala@Pratiks-MacBook-Pro.local |
647cbbbf0f30c538820d2fc61b3609716d4b56a1 | f0dc080aefc14756f9d54d3315d2e0f3df8d02e5 | /src/main/java/com/mutest/dao/base/InterfaceCaseDao.java | 30567cc5683b6dfe15dcb51d3d7aa5c9c7bd93b4 | [] | no_license | kakawaa/mutest-platForm | 5dc01f7643f56d7fddc47f3aed6b112679e4cf5f | 9a608ff3406d82b02df0371c6308fb7f8c21b2c3 | refs/heads/master | 2022-09-30T14:59:55.640735 | 2020-06-08T02:25:11 | 2020-06-08T02:25:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,095 | java | package com.mutest.dao.base;
import com.alibaba.fastjson.JSONObject;
import com.mutest.model.interfaces.CaseInfo;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface InterfaceCaseDao {
/**
* 获取接口用例列表
*
* @return
*/
List<CaseInfo> getCaseList(@Param("projectId") Long projectId, @Param("interfaceId") Long interfaceId);
/**
* @param id 用例id
* @return
*/
CaseInfo getCaseInfoById(@Param("id") Long id);
CaseInfo getCaseMainById(@Param("id") Long id);
/**
* 修改测试用例首页内容
*
* @param interfaceId 用例id
* @param caseType 用例类型
* @param delay 前置延迟
* @param description 用例描述
* @param id 用例id
* @return
*/
@Update("UPDATE mutest.interface_case SET interface_id=#{interfaceId},case_type=#{caseType},delay=#{delay},description=#{description} WHERE id=#{id}")
int updateCaseMain(@Param("interfaceId") Long interfaceId, @Param("caseType") String caseType, @Param("delay") int delay, @Param("description") String description, @Param("id") Long id);
/**
* 修改用例详情
*
* @param request:headerData,bodyData,resultDemo,caseType,correlation,assertion,id
* @return
*/
int updateCaseInfo(JSONObject request);
/**
* 新增测试用例
*/
void addCase(CaseInfo caseInfo);
/**
* 搜索用例
*
* @param request 前端搜索条件
* @return
*/
List<CaseInfo> searchCase(JSONObject request);
/**
* 查询特定接口标准用例的数量
*
* @param interfaceId 接口id
* @return
*/
@Select("SELECT COUNT(*) FROM mutest.interface_case WHERE interface_id=#{interfaceId} AND case_type='标准用例'")
int getCaseCount(@Param("interfaceId") Long interfaceId);
/**
* 获取特定接口的标准用例部分信息
*
* @param interfaceId 接口id
* @return
*/
CaseInfo getStandardCaseByInterfaceId(@Param("interfaceId") Long interfaceId);
/**
* 根据接口信息查询创建者
*
* @param interfaceName 接口
* @return 去重的创建者
*/
@Select("SELECT DISTINCT(a.creator) FROM mutest.interface_case a JOIN mutest.interface_list b ON a.interface_id=b.id JOIN mutest.interface_module c ON b.module_id=c.id JOIN mutest.interface_project d ON c.project_id = d.id WHERE project_name = #{projectName} AND module_name= #{moduleName} AND interface_name= #{interfaceName}")
List<String> getCreators(@Param("projectName") String projectName, @Param("moduleName") String moduleName, @Param("interfaceName") String interfaceName);
/**
* 根据接口信息和创建者信息获取用例特征
*
* @param request 查询信息:projectName moduleName interfaceName
* @return
*/
List<CaseInfo> getCaseFeature(JSONObject request);
@Delete("DELETE FROM mutest.interface_case WHERE id=#{caseId}")
int deleteCaseById(@Param("caseId") int caseId);
} | [
"602322734@qq.com"
] | 602322734@qq.com |
817d147d3041ff62649ec162b21c2dc8c2b17286 | 6dbae30c806f661bcdcbc5f5f6a366ad702b1eea | /Corpus/eclipse.pde.ui/3927.java | 363ed7712f3c9a4746bb697149124cd6c712a3a0 | [
"MIT"
] | permissive | SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018 | d3fd21745dfddb2979e8ac262588cfdfe471899f | 0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0 | refs/heads/master | 2020-03-31T15:52:01.005505 | 2018-10-01T23:38:50 | 2018-10-01T23:38:50 | 152,354,327 | 1 | 0 | MIT | 2018-10-10T02:57:02 | 2018-10-10T02:57:02 | null | UTF-8 | Java | false | false | 1,577 | java | /*******************************************************************************
* Copyright (c) 2016 Google Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Stefan Xenos (Google) - initial API and implementation
*
*******************************************************************************/
package org.eclipse.pde.internal.runtime.spy.dialogs;
import org.eclipse.jface.util.Geometry;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
public class GeometryUtil {
public static Rectangle getDisplayBounds(Control boundsControl) {
Control parent = boundsControl.getParent();
if (parent == null || boundsControl instanceof Shell) {
return boundsControl.getBounds();
}
return Geometry.toDisplay(parent, boundsControl.getBounds());
}
public static Rectangle extrudeEdge(Rectangle innerBoundsWrtOverlay, int distanceToTop, int side) {
if (distanceToTop <= 0) {
return new Rectangle(0, 0, 0, 0);
}
return Geometry.getExtrudedEdge(innerBoundsWrtOverlay, distanceToTop, side);
}
public static int getBottom(Rectangle rect) {
return rect.y + rect.height;
}
public static int getRight(Rectangle rect) {
return rect.x + rect.width;
}
}
| [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
aa5a078fabc3c780f5b754bfac020fbb23271b5c | db3464cb586249f3713225f665d17ccf0ef6f09c | /app/src/main/java/com/chad/demo/random/render/impl/RandomRender.java | ef6ec13ea5a93852c7769ac9b7c554afb61e5b95 | [] | no_license | holyace/RandomGame | e31bc26de252d7a253e5e3e8508fd4388c2dcb71 | 42de2e79ac5571b3f8eac33406c681cda3a41999 | refs/heads/master | 2022-10-24T13:02:51.156909 | 2022-10-08T07:17:40 | 2022-10-08T07:17:40 | 196,388,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | package com.chad.demo.random.render.impl;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;
import com.chad.demo.random.mgr.MovePolicy;
import com.chad.demo.random.model.IRobot;
import com.chad.demo.random.model.MoveModel;
import com.chad.demo.random.model.Robot;
import com.chad.demo.random.render.IRender;
import com.chad.demo.random.constant.Direction;
/**
* No comment for you. yeah, come on, bite me~
* <p>
* Created by chad on 2019-06-28.
*/
public class RandomRender implements IRender {
private static final String TAG = RandomRender.class.getSimpleName();
private Paint mPaint;
private Paint mBgPaint;
private float mR;
private float mSpeed = 3;
private int mWidth;
private int mHeigth;
private IRobot mRobot;
private MovePolicy mPolicy;
private MoveModel mMoveModel;
public RandomRender(Robot robo) {
mRobot = robo;
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setColor(Color.parseColor("#ff0000"));
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(10);
mBgPaint = new Paint();
mBgPaint.setAntiAlias(true);
mBgPaint.setColor(Color.parseColor("#000000"));
mBgPaint.setStyle(Paint.Style.STROKE);
mBgPaint.setStrokeWidth(1);
mR = 5;
mPolicy = new MovePolicy();
mMoveModel = new MoveModel();
mMoveModel.setSpeed(mSpeed);
}
@Override
public void setRobot(IRobot model) {
mRobot = model;
}
@Override
public void setCanvasSize(int width, int height) {
mWidth = width;
mHeigth = height;
mMoveModel.setRange(width, height);
mMoveModel.setPosition(width / 2f, height / 2f, Direction.RIGHT);
}
@Override
public void render(Canvas canvas, long time) {
mPolicy.move(mWidth, mHeigth, mMoveModel, time);
drawMove(canvas, mMoveModel);
}
private void drawMove(Canvas canvas, MoveModel moveModel) {
canvas.drawPath(moveModel.getPath(), mBgPaint);
PointF point = moveModel.getNow().getPosition();
canvas.drawCircle(point.x, point.y, mR, mPaint);
}
}
| [
"xianbo.wxb@alibaba-inc.com"
] | xianbo.wxb@alibaba-inc.com |
37390205b4a38e14c9d83f697661d48bc9e489d8 | 82eba08b9a7ee1bd1a5f83c3176bf3c0826a3a32 | /ZmailSoap/src/java/org/zmail/soap/mail/type/ExcludeRecurrenceInfo.java | 702002dc0846e7a7d6ba0654ed5952a335186a46 | [
"MIT"
] | permissive | keramist/zmailserver | d01187fb6086bf3784fe180bea2e1c0854c83f3f | 762642b77c8f559a57e93c9f89b1473d6858c159 | refs/heads/master | 2021-01-21T05:56:25.642425 | 2013-10-21T11:27:05 | 2013-10-22T12:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2011, 2012 VMware, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package org.zmail.soap.mail.type;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import org.zmail.soap.base.ExcludeRecurrenceInfoInterface;
@XmlAccessorType(XmlAccessType.NONE)
public class ExcludeRecurrenceInfo
extends RecurrenceInfo
implements RecurRuleBase, ExcludeRecurrenceInfoInterface {
}
| [
"bourgerie.quentin@gmail.com"
] | bourgerie.quentin@gmail.com |
21c5050679177e0e37b095c5151688f0c4dd1201 | 2bbb4a7a7a652768f02e41416fb209333a341a38 | /app/src/main/java/com/creative/myspinner/CustomAdapter.java | 0c0d32aaf0f4ac3923c0b4ae06bbd58cdafd8b78 | [] | no_license | kelth78/MySpinner | 237e35c3a2e9794515271809bb07462e94042365 | b7dc683ed99c000c1a9a9e156aae127b052b8bf3 | refs/heads/master | 2021-09-10T05:13:22.596159 | 2018-03-21T03:21:33 | 2018-03-21T03:21:33 | 126,117,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | java | package com.creative.myspinner;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by kelvin_lim on 21/3/18.
*/
public class CustomAdapter extends BaseAdapter{
Context context;
int[] categoryIcons;
String[] categoryNames;
LayoutInflater inflater;
public CustomAdapter(Context context, int[] categoryIcons, String[] categoryNames) {
this.context = context;
this.categoryIcons = categoryIcons;
this.categoryNames = categoryNames;
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return categoryIcons.length;
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@Override
public View getView(int pos, View view, ViewGroup viewGroup) {
view = inflater.inflate(R.layout.custom_spinner_items, null);
ImageView icon = view.findViewById(R.id.imageView);
TextView name = view.findViewById(R.id.textView);
icon.setImageResource(categoryIcons[pos]);
name.setText(categoryNames[pos]);
return view;
}
}
| [
"kelvin_lim@ctl.creative.com"
] | kelvin_lim@ctl.creative.com |
509c93dea7a1c932e81972c30ade00a41ca5c9cb | 85baab0361626f0803c84e6932a87e14739046ea | /app/src/main/java/com/example/ders09_03/MyAdapter.java | ad305479eefe8841eb0ebfdf0ecb126dfd937fce | [] | no_license | donmezburak/medipolAndroid | 63e5a8cd5e6339ce5b3da029477f18aeb984ef46 | 595f82fef544417a7beebec3088601583766480c | refs/heads/master | 2021-04-17T18:13:02.347816 | 2020-04-07T19:07:07 | 2020-04-07T19:07:07 | 249,464,912 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,309 | java | package com.example.ders09_03;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class MyAdapter extends RecyclerView.Adapter<MyViewHolder> {
public CountryModel[] arr;
public MyAdapter(CountryModel[] arr) {
this.arr = arr;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View view = inflater.inflate(R.layout.recycler_item, parent, false);
MyViewHolder holder = new MyViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
holder.tvName.setText(arr[position].name);
holder.tvCapital.setText(arr[position].capital);
holder.tvPopulation.setText(arr[position].population + "");
holder.tvTranslation.setText(arr[position].translations.de + " " + arr[position].translations.fr + " " +
arr[position].translations.es);
}
@Override
public int getItemCount() {
return arr.length;
}
}
| [
"burak.donmez@robotic.mobi"
] | burak.donmez@robotic.mobi |
a7a9dd943b1eca5be601eab9e217ee05b274b087 | 1680dc953679e5fff4befeb00135697d1897ece3 | /Character.java | 199a66ff8b40b860587dc2877d271c2972bf2b65 | [] | no_license | AidanHancock/Game | 8da85b9b3b20301ada20268abbfe41427dce603c | 468c6c4510f0c23e2bf2c3b83bf0c4d49adb93e1 | refs/heads/master | 2022-05-28T10:45:18.467745 | 2020-05-04T11:50:11 | 2020-05-04T11:50:11 | 261,142,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19 | java | DEV 3character map
| [
"19489054@lab218-a03.staff.ad.curtin.edu.au"
] | 19489054@lab218-a03.staff.ad.curtin.edu.au |
8c460993f5eb56603eb8e4f7fa402b5a66483d8c | 9059693c20cd700adaae45e823819b0a0fa0ce8a | /chapter9/Woman.java | 5b569f4c2cdee0a4b799b0820a5d1508f9c44671 | [] | no_license | milanoid/java-programming | c7e43383c4715b917abda73af44849def39cd481 | d30ee675aa606fc396b44d07f50656072b122d17 | refs/heads/master | 2023-02-12T16:39:35.712055 | 2023-02-03T13:32:20 | 2023-02-03T13:32:20 | 194,499,244 | 0 | 0 | null | 2019-06-30T09:40:52 | 2019-06-30T09:40:51 | null | UTF-8 | Java | false | false | 113 | java | package chapter9;
public class Woman extends Person {
public Woman(){
setGender("female");
}
}
| [
"jones.angie@gmail.com"
] | jones.angie@gmail.com |
cdcf7b0e5ae71a1a23c94a6b02047f0b36985c63 | d8f111d62444116151af0037eb040ca7e49908d2 | /src/br/aeso/aula24/CalculoImpostoQuinzeOuDez.java | 92bc76dedb8e955757a690bf855ee54c2d139374 | [] | no_license | mauriciomanoel/AESODESENV32015.2 | 6bb2ebf05105456897ce95b9cb3bcddf71b35c7e | dbb84c4211b18854cb0b3ab54fc7d7ed6bb862f6 | refs/heads/master | 2021-07-09T01:42:37.295234 | 2016-09-13T00:38:26 | 2016-09-13T00:38:26 | 41,856,661 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package br.aeso.aula24;
public class CalculoImpostoQuinzeOuDez implements CalculaImposto {
@Override
public double calculaSalarioComImposto(Funcionario funcionario) {
if (funcionario.getSalarioBase() > 2000) {
return funcionario.getSalarioBase() * 0.85;
}
return funcionario.getSalarioBase() * 0.9;
}
}
| [
"mauriciomanoel@gmail.com"
] | mauriciomanoel@gmail.com |
ea6d49d1aab5f23d3fb7346a2ceb2ac1e2e01907 | 272ef810dbbd418eaa5e6b21766bd623a498333f | /src/main/java/com/test/sz/exception/ResourceNotFoundException.java | 45f8fccff6c58f8a89062f0e5a4154b9ad8ab771 | [] | no_license | mpren/ShaiZi | 35a54c1a364ea77350a41f043e561ce9cf88ecd0 | 27125bf7648d1b4bd19276c17cec1bb9792810cd | refs/heads/master | 2023-05-28T08:44:42.880524 | 2020-06-18T07:44:31 | 2020-06-18T07:44:31 | 124,331,079 | 1 | 2 | null | 2023-05-23T20:10:29 | 2018-03-08T03:26:54 | Java | UTF-8 | Java | false | false | 92 | java | package com.test.sz.exception;
public class ResourceNotFoundException extends Exception {
} | [
"mpren@qq.com"
] | mpren@qq.com |
d74ac4ed069f1fcb9be1a339a391ce742dbf494d | 639303c3700c94df84196c948c2d6ca09cac407e | /RealSpringConsole/src/main/java/part04/QnaBoardWrite.java | 14df2cb645953b2a6b023308198233310431e9f3 | [] | no_license | androimaster/RealSpringConsole | 2a366b5fb61bfddb5ffabc4c5d4484d5228561a4 | 3567fba66df3f14983794ed7c128ae22ab86a966 | refs/heads/master | 2022-11-06T22:52:37.904708 | 2020-07-04T04:35:00 | 2020-07-04T04:35:00 | 277,038,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package part04;
public class QnaBoardWrite implements Write {
private String boardName;
public QnaBoardWrite() {
this.init();
}
public void init() {
this.setBoardName("Q&A Board");
}
public void doWrite() {
System.out.println(this.getBoardName() + " Write down!!");
}
public String getBoardName() {
return boardName;
}
public void setBoardName(String boardName) {
this.boardName = boardName;
}
}
| [
"androimaster@gmail.com"
] | androimaster@gmail.com |
e49a8da774d8c833a3e8a92f59bff53f7bd6a9c8 | 9bb7e2c46a2ec05c6984e3dc4cf3289994b9cc88 | /app/src/main/java/com/spacemonster/book/mentors/Adapter/BannerAdapter.java | 9580171d3b706019a5aa73eb3adea7e05aec2936 | [] | no_license | jbh9022/Mentors | c0d565e422301213bc6b6bed77f68ab58502540d | c79a2d67260da0b3f0094d8a8b60722587de1fdd | refs/heads/master | 2020-04-08T15:09:31.959993 | 2018-12-11T09:10:07 | 2018-12-11T09:10:07 | 159,467,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,324 | java | package com.spacemonster.book.mentors.Adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.spacemonster.book.mentors.R;
import java.util.ArrayList;
public class BannerAdapter extends PagerAdapter {
private Context context;
private LayoutInflater layoutInflater;
private int pos;
private ArrayList<Object> arrayList;
public BannerAdapter(Context context, ArrayList<Object> arrayList) {
this.context = context;
this.arrayList = arrayList;
}
@Override
public int getCount() {
return arrayList.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return view == o;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = layoutInflater.inflate(R.layout.custom_banner, null);
ImageView banner = (ImageView) view.findViewById(R.id.banner_img);
RequestOptions options = new RequestOptions().fitCenter();
Glide.with(context).load(arrayList.get(position)).apply(options).into(banner);
banner.setScaleType(ImageView.ScaleType.FIT_XY);
ViewPager vp = (ViewPager) container;
vp.addView(view,0);
//배너 클릭시-웹뷰랑 연결 예정
banner.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(context, "배너 페이지", Toast.LENGTH_SHORT).show();
}
});
return view;
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
// super.destroyItem(container, position, object);
ViewPager vp = (ViewPager) container;
View view = (View) object;
vp.removeView(view);
}
}
| [
"jbh9022@naver.com"
] | jbh9022@naver.com |
5f116640c6ee5e2ec594b2ae430f41eb5dabbd76 | 28aafdc3c193c33d1214b2d6722e8087aba25b08 | /src/ExecutionEngine.java | a8a8260edaaef5c7bd3f703aa6116fc46db29316 | [] | no_license | abmantis/TestApp | 2f362a80188ae7d8cf102182ba2c6a7f522bde73 | a7923dd4bcf7ecf0b7d4fe7656686ca823eb983f | refs/heads/master | 2021-05-27T16:50:39.832834 | 2014-07-18T18:47:04 | 2014-07-18T18:47:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,653 | java |
/* $Author: Madhusudhan.G $
$Revision: #1.0 $
$DateTime: 2014/06/27 $
*/
import java.io.BufferedReader;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
import Communication.ArrayentBackEndCommunication;
import DTO.Appliance;
import DTO.State;
import DataAccessLayer.QueryHandler;
import Interface.IExecutionEngine;
@WebService
public class ExecutionEngine implements IExecutionEngine
{
List<ArrayentBackEndCommunication> _applainces;
int portNumber=8055;
QueryHandler _queryHandler;
List<State> _states;
public Boolean CreateAnAppliance(String said)
{
Appliance app = new Appliance(said, _queryHandler.GetAesKey(said), _queryHandler.GetPassword(said),"11",portNumber++);
_applainces.add(new ArrayentBackEndCommunication(app));
return true;
}
@Override
public Boolean InstantiateAppliance(String said)
{
// TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said && !app._applInstance.get_isApplianceInitialized())
{
app._applInstance.set_isApplianceInitialized(true);
app.CreateArrayentChannel(app._applInstance.get_tcpListenPort());
break;
}
}
return true;
}
@Override
public Boolean StartApplainceCycle(String said)
{
//TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said)
{
try
{
if(app._applInstance.get_isApplianceInitialized() && !app._applInstance.get_isCycleStarted())
{
app._applInstance.set_isCycleStarted(true);
app.AddStates(_states);
app.StartCycle();
return true;
}
}
catch(Exception exp)
{
exp.printStackTrace();
}
}
}
return false;
}
@Override
public Boolean StopApplianceCycle(String said) {
// TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said)
{
if(app._applInstance.get_isApplianceInitialized()&& app._applInstance.get_isCycleStarted())
{
app._applInstance.set_isCycleStarted(false);
_states.clear();
app.StopCycle();
return true;
}
}
}
return false;
}
@Override
public Boolean RemoveAppliance(String said)
{
// TODO Auto-generated method stub
for (ArrayentBackEndCommunication app : _applainces)
{
if(app._applInstance.get_said()== said && app._applInstance.get_isApplianceInitialized())
{
app.KillProcess();
_applainces.remove(app);
break;
}
}
return true;
}
@Override
public String[] GetSAIDs()
{
return (String[])_queryHandler.GetSAIDS().toArray();
}
//@Override
public Boolean UpLoadSAIDs(BufferedReader br)
{
// TODO Auto-generated method stub
try
{
String line;
_queryHandler.Create_SAID_Table();
while((line=br.readLine())!=null)
{
String[] data = line.split(" ");
if(data.length>2)
{
_queryHandler.InsertSAIDData(data[0], data[2], data[1]);
}
}
return true;
}
catch (Exception e)
{
// TODO: handle exception
return false;
}
}
@Override
public Boolean AddState(int id, String stateName, byte api, byte opcode,
byte[] payLoad, int duration) {
_states.add(new State(api, opcode, payLoad, duration, stateName, id));
return true;
}
public ExecutionEngine()
{
_applainces= new ArrayList<ArrayentBackEndCommunication>();
_queryHandler= QueryHandler.GetQueryHandlerObject();
_queryHandler.InitializeConnection("test");
_states= new ArrayList<State>();
}
}
| [
"Madhusudhan_Gangaiah_LTIES@whirlpool.com"
] | Madhusudhan_Gangaiah_LTIES@whirlpool.com |
97adea546d9051da0499055db65101f0631a8285 | 99a7db50a02cf9a7ebec2eaa3633b1eedcae33dc | /Launcher/src/com/jidesoft/plaf/basic/BasicFileSystemTree.java | edd9d70f4eefc44a0955ba48d77f906973b64b96 | [] | no_license | Ren0X1/JavaProject | 6406fdac158b52d750ea0a38da91a1211b4f5efc | 3c4ba1e9aa56f4628eb5df0972e14b7247ae27a8 | refs/heads/master | 2023-06-01T05:52:53.703303 | 2021-06-16T14:46:34 | 2021-06-16T14:46:34 | 305,355,892 | 1 | 2 | null | 2020-10-30T17:46:34 | 2020-10-19T11:06:33 | Java | UTF-8 | Java | false | false | 3,861 | java | /*
* @(#)FileSystemTree.java 9/12/2005
*
* Copyright 2002 - 2005 JIDE Software Inc. All rights reserved.
*/
package com.jidesoft.plaf.basic;
import com.jidesoft.swing.FolderChooser;
import com.jidesoft.swing.JideSwingUtilities;
import com.jidesoft.swing.TreeSearchable;
import javax.swing.*;
import javax.swing.event.TreeExpansionEvent;
import javax.swing.event.TreeExpansionListener;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.ExpandVetoException;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.MouseEvent;
class BasicFileSystemTree extends JTree {
public BasicFileSystemTree(FolderChooser folderChooser) {
super(new BasicFileSystemTreeModel(folderChooser));
initComponents();
}
protected void initComponents() {
setCellRenderer(new BasicFileSystemTreeCellRenderer());
setShowsRootHandles(false);
setRootVisible(false);
setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
setRowHeight(JideSwingUtilities.getLineHeight(this, 17));
expandRow(0);
FolderTreeListener treeListener = new FolderTreeListener();
addTreeWillExpandListener(treeListener);
addTreeExpansionListener(treeListener);
new TreeSearchable(this) {
@Override
protected String convertElementToString(Object object) {
if (object instanceof TreePath) {
Object treeNode = ((TreePath) object).getLastPathComponent();
if (treeNode instanceof BasicFileSystemTreeNode) {
return ((BasicFileSystemTreeNode) treeNode).getName();
}
}
return super.convertElementToString(object);
}
};
}
private class FolderTreeListener implements TreeWillExpandListener, TreeExpansionListener {
private Cursor oldCursor;
// ------------------------------------------------------------------------------------------
// TreeWillExpandListener methods
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
// change to busy cursor
Window window = SwingUtilities.getWindowAncestor(BasicFileSystemTree.this);
if (window != null) {
oldCursor = window.getCursor();
window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
}
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
}
// ------------------------------------------------------------------------------------------
// TreeExpansionListener methods
public void treeExpanded(TreeExpansionEvent event) {
// change cursor back
Window window = SwingUtilities.getWindowAncestor(BasicFileSystemTree.this);
if (window != null) {
window.setCursor(oldCursor != null ? oldCursor : Cursor.getDefaultCursor());
}
oldCursor = null;
}
public void treeCollapsed(TreeExpansionEvent event) {
}
}
@Override
public String getToolTipText(MouseEvent event) {
TreePath path = getPathForLocation(event.getX(), event.getY());
if (path != null && path.getLastPathComponent() instanceof BasicFileSystemTreeNode) {
BasicFileSystemTreeNode node = (BasicFileSystemTreeNode) path.getLastPathComponent();
String typeDescription = node.getTypeDescription();
if (typeDescription == null || typeDescription.length() == 0) {
return node.toString();
}
else {
return node.toString() + " - " + typeDescription;
}
}
else {
return null;
}
}
}
| [
"alexyanamusicpro@gmail.com"
] | alexyanamusicpro@gmail.com |
664d51b5a5a549e1312fbecaa5f4e71fe980a5a7 | 828963c603ffb47576fa3d94ab2e66f78ab1e49c | /app/src/main/java/com/yang/file_explorer/apis/FileOperationHelper.java | cd43486c64e8b5f33092f95ff7f592c41db6df0a | [] | no_license | jqorz/SEFileExplorer | 21f73189678d4e00fef4a25f2239090a60b7c230 | 93f703b56a840d4801e02eeb730b7e60a7b1bf5b | refs/heads/master | 2021-05-08T20:47:50.226515 | 2018-01-31T01:58:04 | 2018-01-31T01:58:15 | 119,620,063 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,869 | java | package com.yang.file_explorer.apis;
import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import android.content.ContentProviderOperation;
import android.content.Context;
import android.content.OperationApplicationException;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.provider.MediaStore;
import android.provider.MediaStore.Files.FileColumns;
import android.text.TextUtils;
import com.yang.file_explorer.entity.FileInfo;
import com.yang.file_explorer.interfaces.IOperationProgressListener;
import com.yang.file_explorer.utils.FileUtil;
public class FileOperationHelper {
private static final String LOG_TAG = "FileOperation";
private ArrayList<FileInfo> mCurFileNameList = new ArrayList<FileInfo>();
private IOperationProgressListener moperationListener;
private ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
private FilenameFilter mFilter = null;
private Context mContext;
private boolean mMoving;
public FileOperationHelper(IOperationProgressListener l, Context context) {
moperationListener = l;
mContext = context;
}
public void setFilenameFilter(FilenameFilter f) {
mFilter = f;
}
public void Copy(ArrayList<FileInfo> files) {
copyFileList(files);
}
public void clear() {
synchronized (mCurFileNameList) {
mCurFileNameList.clear();
}
}
/*
* 创建异步线程
*/
private void asnycExecute(Runnable r) {
final Runnable _r = r;
new AsyncTask() {
@Override
protected Object doInBackground(Object... params) {
synchronized (mCurFileNameList) {
_r.run();
}
try {
mContext.getContentResolver().applyBatch(
MediaStore.AUTHORITY, ops);
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
// TODO: handle exception
e.printStackTrace();
}
if (moperationListener != null) {
moperationListener.onFinish();
}
ops.clear();
return null;
}
}.execute();
}
/*
* 创建文件夹
*/
public boolean CreateFolder(String path, String name) {
File f = new File(FileUtil.makePath(path, name));
if (f.exists())
return false;
return f.mkdir();
}
/*
* 删除文件
*/
public boolean Delete(ArrayList<FileInfo> files) {
copyFileList(files);
asnycExecute(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
for (FileInfo f : mCurFileNameList) {
DeleteFile(f);
}
moperationListener.onFileChanged(FileUtil.getSdDirectory());
clear();
}
});
return true;
}
protected void DeleteFile(FileInfo f) {
if (f == null)
return;
File file = new File(f.filePath);
boolean directory = file.isDirectory();
if (directory) {
for (File child : file.listFiles(mFilter)) {
if (FileUtil.isNormalFile(child.getAbsolutePath())) {
DeleteFile(FileUtil.GetFileInfo(child, mFilter, true));
}
}
}
if (!f.IsDir) {
ops.add(ContentProviderOperation
.newDelete(FileUtil.getMediaUriFromFilename(f.fileName))
.withSelection("_data = ?", new String[] { f.filePath })
.build());
}
file.delete();
}
/*
* 文件重命名
*/
public boolean Rename(FileInfo f, String newName) {
if (f == null || newName == null) {
return false;
}
File file = new File(f.filePath);
String newPath = FileUtil.makePath(
FileUtil.getPathFromFilepath(f.filePath), newName);
final boolean needScan = file.isFile();
try {
boolean ret = file.renameTo(new File(newPath));
if (ret) {
if (needScan) {
moperationListener.onFileChanged(f.filePath);
}
moperationListener.onFileChanged(newPath);
}
return ret;
} catch (SecurityException e) {
e.printStackTrace();
}
return false;
}
/*
* 开始剪切
*/
public void StartMove(ArrayList<FileInfo> files) {
if (mMoving)
return;
mMoving = true;
copyFileList(files);
}
public boolean isMoveState() {
return mMoving;
}
/*
* 移动文件
*/
public boolean EndMove(String path) {
if (!mMoving)
return false;
mMoving = false;
if (TextUtils.isEmpty(path))
return false;
final String _path = path;
asnycExecute(new Runnable() {
@Override
public void run() {
for (FileInfo f : mCurFileNameList) {
MoveFile(f, _path);
}
moperationListener.onFileChanged(FileUtil.getSdDirectory());
clear();
}
});
return true;
}
/*
* 粘贴文件
*/
public boolean Paste(String path) {
if (mCurFileNameList.size() == 0)
return false;
final String _path = path;
asnycExecute(new Runnable() {
@Override
public void run() {
for (FileInfo f : mCurFileNameList) {
CopyFile(f, _path);
}
moperationListener.onFileChanged(FileUtil.getSdDirectory());
clear();
}
});
return true;
}
public boolean canPaste() {
return mCurFileNameList.size() != 0;
}
private void CopyFile(FileInfo f, String dest) {
if (f == null || dest == null) {
return;
}
File file = new File(f.filePath);
if (file.isDirectory()) {
// directory exists in destination, rename it
String destPath = FileUtil.makePath(dest, f.fileName);
File destFile = new File(destPath);
int i = 1;
while (destFile.exists()) {
destPath = FileUtil.makePath(dest, f.fileName + " " + i++);
destFile = new File(destPath);
}
for (File child : file.listFiles(mFilter)) {
if (!child.isHidden()
&& FileUtil.isNormalFile(child.getAbsolutePath())) {
CopyFile(FileUtil.GetFileInfo(child, mFilter, false),
destPath);
}
}
} else {
String destFile = FileUtil.copyFile(f.filePath, dest);
FileInfo destFileInfo = FileUtil.GetFileInfo(destFile);
ops.add(ContentProviderOperation
.newInsert(
FileUtil.getMediaUriFromFilename(destFileInfo.fileName))
.withValue(FileColumns.TITLE, destFileInfo.fileName)
.withValue(FileColumns.DATA, destFileInfo.filePath)
.withValue(
FileColumns.MIME_TYPE,
FileUtil.getMimetypeFromFilename(destFileInfo.fileName))
.withValue(FileColumns.DATE_MODIFIED,
destFileInfo.ModifiedDate)
.withValue(FileColumns.SIZE, destFileInfo.fileSize).build());
}
}
private boolean MoveFile(FileInfo f, String dest) {
if (f == null || dest == null) {
return false;
}
File file = new File(f.filePath);
String newPath = FileUtil.makePath(dest, f.fileName);
try {
File destFile = new File(newPath);
if (file.renameTo(destFile)) {
MoveFileToDB(destFile, file, destFile);
return true;
}
} catch (SecurityException e) {
e.printStackTrace();
}
return false;
}
private void MoveFileToDB(File destFile, File srcFile, File rootFile) {
if (destFile.isDirectory()) {
for (File child : destFile.listFiles(mFilter)) {
if (!child.isHidden()
&& FileUtil.isNormalFile(child.getAbsolutePath())) {
MoveFileToDB(destFile, srcFile, rootFile);
}
}
} else {
int pos = -1;
String destFilePath = destFile.getAbsolutePath();
String srcFilePath = srcFile.getAbsolutePath();
String rootFilePath = rootFile.getAbsolutePath();
if (srcFile.isDirectory()
&& (pos = destFilePath.indexOf(rootFilePath)) != -1) {
srcFilePath = srcFilePath
+ destFilePath.substring(rootFilePath.length(),
destFilePath.length());
}
FileInfo desFileInfo = FileUtil.GetFileInfo(destFilePath);
ops.add(ContentProviderOperation
.newUpdate(
FileUtil.getMediaUriFromFilename(desFileInfo.fileName))
.withSelection("_data = ?",
new String[] { srcFilePath })
.withValue("_data", destFilePath).build());
}
}
private void copyFileList(ArrayList<FileInfo> files) {
synchronized (mCurFileNameList) {
mCurFileNameList.clear();
for (FileInfo f : files) {
mCurFileNameList.add(f);
}
}
}
}
| [
"j1997321@qq.com"
] | j1997321@qq.com |
80bb8c00134fd2ad288617f004e836e9e927d461 | 8de13e531ff142c026c1740940db8532265a5f84 | /Modules/Module4/src/SampleCode6/CanvasWithText.java | dff7b3a279a7adb7fc6f761483fac43c8f3caa5f | [
"MIT"
] | permissive | hackettccp/CSCI112 | 0183f756300fbdd16a68c45a2e4b97c6296e67a8 | 103893f5c3532839f6b0a8ff460f069b324bc199 | refs/heads/master | 2020-08-09T12:10:34.466429 | 2019-12-20T05:50:26 | 2019-12-20T05:50:26 | 214,084,396 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,577 | java | package SampleCode6;
import javax.swing.*;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
/**
* A Canvas subclass that draws text.
*/
public class CanvasWithText extends Canvas {
/**
* Overrides the Canvas superclass's paint method.
* Will instead draw what is specified in this method.
*/
public void paint(Graphics g) {
//Draws a String
g.drawString("Hello World", 60, 50);
//Draws a blue String with a specified font.
g.setColor(Color.BLUE);
g.setFont(new Font("Serif", Font.BOLD, 16));
g.drawString("Hello World!", 200, 50);
//Draws a filled, red 8-sided polygon (octagon)
//X Coordinates of shape 1
int[] shape1_x = {110, 150, 190, 190, 150, 110, 70, 70};
//Y Coordinates fo shape 1
int[] shape1_y = {70, 70, 110, 150, 190, 190, 150, 110};
g.setColor(Color.RED);
g.fillPolygon(shape1_x, shape1_y, 8);
//Draws a white String with a specified font.
g.setColor(Color.WHITE);
g.setFont(new Font("Dialog", Font.BOLD, 28));
g.drawString("STOP", 95, 140);
}
/**
* Main Method. The program begins here.
*/
public static void main(String[] args) {
JFrame window = new JFrame("Canvas Example");
window.setSize(320, 340);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
CanvasWithText c = new CanvasWithText();
window.add(c);
window.setVisible(true);
}
}
| [
"H@ck3t7!1github1"
] | H@ck3t7!1github1 |
c5a69012db40ce9fcbbd4381af26e6f75508012b | f315651879a7c9f7967cfe09e02dd9d9e9424476 | /HireCarJpaWebservice/src/main/java/com/example/repository/IModelRepository.java | 86ba8920d9017c03f51c58fc90374be2e0d4624b | [] | no_license | hamsuhi/IFI-exactly | 668291c1635ee51460a7cbbda3d05c43da2f4a70 | 9d08100bf99c90b82c023db1d9b1087f75be4a8e | refs/heads/master | 2021-04-30T08:14:41.097215 | 2018-03-21T10:41:18 | 2018-03-21T10:41:18 | 121,368,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | package com.example.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.model.Model;
@Repository
public interface IModelRepository extends JpaRepository<Model, Integer> {
Model findByModelName(String name);
}
| [
"nguyenhuong031103@gmail.com"
] | nguyenhuong031103@gmail.com |
2b53d05c4e66330354c2360d9836d686d3429bcd | 3a5a605790acc5105cf7845fa8f89c6962fff184 | /src/test/java/integration/io/github/seleniumquery/by/SelectorsUtilTest.java | 3aa0a9585b06846055d54429af84f6ca161c0222 | [
"Apache-2.0"
] | permissive | hjralyc1/seleniumQuery | 240326eae3e6874e9ffc97185d06054af0c7bac9 | c3559d9d5bef35477712b810a2939402c75be18b | refs/heads/master | 2020-03-28T19:37:01.701292 | 2015-05-02T18:01:42 | 2015-05-22T22:07:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,692 | java | /*
* Copyright (c) 2015 seleniumQuery authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 integration.io.github.seleniumquery.by;
import infrastructure.junitrule.SetUpAndTearDownDriver;
import io.github.seleniumquery.SeleniumQuery;
import io.github.seleniumquery.by.SelectorUtils;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
public class SelectorsUtilTest {
@ClassRule public static SetUpAndTearDownDriver setUpAndTearDownDriverRule = new SetUpAndTearDownDriver();
@Rule public SetUpAndTearDownDriver setUpAndTearDownDriverRuleInstance = setUpAndTearDownDriverRule;
WebDriver driver;
@Before
public void before() {
driver = SeleniumQuery.$.driver().get();
}
@Test
public void testParent() {
// fail("Not yet implemented");
}
@Test
public void lang_function() {
WebElement french_p = driver.findElement(By.id("french-p"));
WebElement brazilian_p = driver.findElement(By.id("brazilian-p"));
WebElement hero_combo = driver.findElement(By.id("hero-combo"));
WebElement htmlElement = driver.findElement(By.cssSelector("html"));
WebElement bodyElement = driver.findElement(By.cssSelector("body"));
assertThat(SelectorUtils.lang(french_p), is("fr"));
assertThat(SelectorUtils.lang(brazilian_p), is("pt-BR"));
assertThat(SelectorUtils.lang(hero_combo), is("pt-BR"));
assertThat(SelectorUtils.lang(bodyElement), is("pt-BR"));
assertThat(SelectorUtils.lang(htmlElement), is(nullValue()));
}
@Test
public void testHasAttribute() {
// fail("Not yet implemented");
}
@Test
public void testGetPreviousSibling() {
// fail("Not yet implemented");
}
@Test
public void itselfWithSiblings() {
WebElement onlyChild = driver.findElement(By.id("onlyChild"));
WebElement grandsonWithSiblings = driver.findElement(By.id("grandsonWithSiblings"));
assertThat(SelectorUtils.itselfWithSiblings(onlyChild).size(), is(1));
List<WebElement> grandsons = SelectorUtils.itselfWithSiblings(grandsonWithSiblings);
assertThat(grandsons.size(), is(3));
assertThat(grandsons.get(0).getAttribute("id"), is("grandsonWithSiblings"));
assertThat(grandsons.get(1).getAttribute("id"), is("grandsonB"));
assertThat(grandsons.get(2).getAttribute("id"), is("grandsonC"));
}
@Test
public void escapeSelector_should_escape_starting_integer() {
String escapedSelector = SelectorUtils.escapeSelector("1a2b3c");
assertThat(escapedSelector, is("\\\\31 a2b3c"));
}
@Test
public void escapeSelector_should_escape_colon() {
String escapedSelector = SelectorUtils.escapeSelector("must:escape");
assertThat(escapedSelector, is("must\\:escape"));
}
@Test
public void escapeSelector_should_escape_hyphen_if_next_char_is_hyphen_or_digit() {
assertThat(SelectorUtils.escapeSelector("-abc"), is("-abc"));
assertThat(SelectorUtils.escapeSelector("-"), is("\\-")); // only hyphen
assertThat(SelectorUtils.escapeSelector("-123"), is("\\-123"));
assertThat(SelectorUtils.escapeSelector("---"), is("\\---"));
}
@Test
public void escapeAttributeValue__should_escape_strings_according_to_how_the_CSS_parser_works() {
// abc -> "abc"
assertThat(SelectorUtils.escapeAttributeValue("abc"), is("\"abc\""));
// a\"bc -> "a\"bc"
assertThat(SelectorUtils.escapeAttributeValue("a\\\"bc"), is("\"a\\\"bc\""));
// a'bc -> "a'bc"
assertThat(SelectorUtils.escapeAttributeValue("a'bc"), is("\"a'bc\""));
// a\tc -> "a\\tc"
assertThat(SelectorUtils.escapeAttributeValue("a\\tc"), is("\"a\\\\tc\""));
}
@Test
public void intoEscapedXPathString() {
assertThat(SelectorUtils.intoEscapedXPathString("abc"), is("'abc'"));
assertThat(SelectorUtils.intoEscapedXPathString("a\"bc"), is("'a\"bc'"));
assertThat(SelectorUtils.intoEscapedXPathString("a'bc"), is("concat('a', \"'\", 'bc')"));
assertThat(SelectorUtils.intoEscapedXPathString("'abc'"), is("concat('', \"'\", 'abc', \"'\", '')"));
}
} | [
"acdcjunior@gmail.com"
] | acdcjunior@gmail.com |
d193b2daf90aea619a3fab380f6924c4c42a6e26 | 38c4451ab626dcdc101a11b18e248d33fd8a52e0 | /identifiers/apache-cassandra-1.2.0/src/java/org/apache/cassandra/db/marshal/AbstractType.java | 073b0d652428ff3c4608b0a0ab725d24fb624b1e | [] | no_license | habeascorpus/habeascorpus-data | 47da7c08d0f357938c502bae030d5fb8f44f5e01 | 536d55729f3110aee058ad009bcba3e063b39450 | refs/heads/master | 2020-06-04T10:17:20.102451 | 2013-02-19T15:19:21 | 2013-02-19T15:19:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,899 | java | org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
db PACKAGE_IDENTIFIER false
marshal PACKAGE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
nio PACKAGE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
util PACKAGE_IDENTIFIER false
Collection TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
util PACKAGE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
java PACKAGE_IDENTIFIER false
util PACKAGE_IDENTIFIER false
Map TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
exceptions PACKAGE_IDENTIFIER false
SyntaxException TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
db PACKAGE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
db PACKAGE_IDENTIFIER false
OnDiskAtom TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
db PACKAGE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
org PACKAGE_IDENTIFIER false
apache PACKAGE_IDENTIFIER false
cassandra PACKAGE_IDENTIFIER false
io PACKAGE_IDENTIFIER false
sstable PACKAGE_IDENTIFIER false
IndexHelper TYPE_IDENTIFIER false
IndexInfo TYPE_IDENTIFIER false
AbstractType TYPE_IDENTIFIER true
T TYPE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
IndexInfo TYPE_IDENTIFIER false
indexComparator VARIABLE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
IndexInfo TYPE_IDENTIFIER false
indexReverseComparator VARIABLE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
columnComparator VARIABLE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
columnReverseComparator VARIABLE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
OnDiskAtom TYPE_IDENTIFIER false
onDiskAtomComparator VARIABLE_IDENTIFIER true
Comparator TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
reverseComparator VARIABLE_IDENTIFIER true
AbstractType METHOD_IDENTIFIER false
indexComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
IndexInfo TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
IndexInfo TYPE_IDENTIFIER false
o1 VARIABLE_IDENTIFIER true
IndexInfo TYPE_IDENTIFIER false
o2 VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
o1 VARIABLE_IDENTIFIER false
lastName VARIABLE_IDENTIFIER false
o2 VARIABLE_IDENTIFIER false
lastName VARIABLE_IDENTIFIER false
indexReverseComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
IndexInfo TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
IndexInfo TYPE_IDENTIFIER false
o1 VARIABLE_IDENTIFIER true
IndexInfo TYPE_IDENTIFIER false
o2 VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
o1 VARIABLE_IDENTIFIER false
firstName VARIABLE_IDENTIFIER false
o2 VARIABLE_IDENTIFIER false
firstName VARIABLE_IDENTIFIER false
columnComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
IColumn TYPE_IDENTIFIER false
c1 VARIABLE_IDENTIFIER true
IColumn TYPE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
c1 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
columnReverseComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
IColumn TYPE_IDENTIFIER false
c1 VARIABLE_IDENTIFIER true
IColumn TYPE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
c1 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
onDiskAtomComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
OnDiskAtom TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
OnDiskAtom TYPE_IDENTIFIER false
c1 VARIABLE_IDENTIFIER true
OnDiskAtom TYPE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER true
comp VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
c1 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
name METHOD_IDENTIFIER false
comp VARIABLE_IDENTIFIER false
comp VARIABLE_IDENTIFIER false
c1 VARIABLE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
t1 VARIABLE_IDENTIFIER true
RangeTombstone TYPE_IDENTIFIER false
c1 VARIABLE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
t2 VARIABLE_IDENTIFIER true
RangeTombstone TYPE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
comp2 VARIABLE_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
t1 VARIABLE_IDENTIFIER false
max VARIABLE_IDENTIFIER false
t2 VARIABLE_IDENTIFIER false
max VARIABLE_IDENTIFIER false
comp2 VARIABLE_IDENTIFIER false
t1 VARIABLE_IDENTIFIER false
data VARIABLE_IDENTIFIER false
compareTo METHOD_IDENTIFIER false
t2 VARIABLE_IDENTIFIER false
data VARIABLE_IDENTIFIER false
comp2 VARIABLE_IDENTIFIER false
c2 VARIABLE_IDENTIFIER false
RangeTombstone TYPE_IDENTIFIER false
reverseComparator VARIABLE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
o1 VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
o2 VARIABLE_IDENTIFIER true
o1 VARIABLE_IDENTIFIER false
remaining METHOD_IDENTIFIER false
o2 VARIABLE_IDENTIFIER false
remaining METHOD_IDENTIFIER false
o2 VARIABLE_IDENTIFIER false
remaining METHOD_IDENTIFIER false
AbstractType TYPE_IDENTIFIER false
compare METHOD_IDENTIFIER false
o2 VARIABLE_IDENTIFIER false
o1 VARIABLE_IDENTIFIER false
T TYPE_IDENTIFIER false
compose METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
bytes VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
decompose METHOD_IDENTIFIER true
T TYPE_IDENTIFIER false
value VARIABLE_IDENTIFIER true
String TYPE_IDENTIFIER false
getString METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
bytes VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
fromString METHOD_IDENTIFIER true
String TYPE_IDENTIFIER false
source VARIABLE_IDENTIFIER true
MarshalException TYPE_IDENTIFIER false
validate METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
bytes VARIABLE_IDENTIFIER true
MarshalException TYPE_IDENTIFIER false
Comparator TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
getReverseComparator METHOD_IDENTIFIER true
reverseComparator VARIABLE_IDENTIFIER false
String TYPE_IDENTIFIER false
getString METHOD_IDENTIFIER true
Collection TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
names VARIABLE_IDENTIFIER true
StringBuilder TYPE_IDENTIFIER false
builder VARIABLE_IDENTIFIER true
StringBuilder TYPE_IDENTIFIER false
ByteBuffer TYPE_IDENTIFIER false
name VARIABLE_IDENTIFIER true
names VARIABLE_IDENTIFIER false
builder VARIABLE_IDENTIFIER false
append METHOD_IDENTIFIER false
getString METHOD_IDENTIFIER false
name VARIABLE_IDENTIFIER false
append METHOD_IDENTIFIER false
builder VARIABLE_IDENTIFIER false
toString METHOD_IDENTIFIER false
String TYPE_IDENTIFIER false
getColumnsString METHOD_IDENTIFIER true
Collection TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
columns VARIABLE_IDENTIFIER true
StringBuilder TYPE_IDENTIFIER false
builder VARIABLE_IDENTIFIER true
StringBuilder TYPE_IDENTIFIER false
IColumn TYPE_IDENTIFIER false
column VARIABLE_IDENTIFIER true
columns VARIABLE_IDENTIFIER false
builder VARIABLE_IDENTIFIER false
append METHOD_IDENTIFIER false
column VARIABLE_IDENTIFIER false
getString METHOD_IDENTIFIER false
append METHOD_IDENTIFIER false
builder VARIABLE_IDENTIFIER false
toString METHOD_IDENTIFIER false
isCommutative METHOD_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
parseDefaultParameters METHOD_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
baseType VARIABLE_IDENTIFIER true
TypeParser TYPE_IDENTIFIER false
parser VARIABLE_IDENTIFIER true
SyntaxException TYPE_IDENTIFIER false
Map TYPE_IDENTIFIER false
String TYPE_IDENTIFIER false
String TYPE_IDENTIFIER false
parameters VARIABLE_IDENTIFIER true
parser VARIABLE_IDENTIFIER false
getKeyValueParameters METHOD_IDENTIFIER false
String TYPE_IDENTIFIER false
reversed VARIABLE_IDENTIFIER true
parameters VARIABLE_IDENTIFIER false
get METHOD_IDENTIFIER false
reversed VARIABLE_IDENTIFIER false
reversed VARIABLE_IDENTIFIER false
isEmpty METHOD_IDENTIFIER false
reversed VARIABLE_IDENTIFIER false
equals METHOD_IDENTIFIER false
ReversedType TYPE_IDENTIFIER false
getInstance METHOD_IDENTIFIER false
baseType VARIABLE_IDENTIFIER false
baseType VARIABLE_IDENTIFIER false
isCompatibleWith METHOD_IDENTIFIER true
AbstractType TYPE_IDENTIFIER false
previous VARIABLE_IDENTIFIER true
previous VARIABLE_IDENTIFIER false
compareCollectionMembers METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
v1 VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
v2 VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
collectionName VARIABLE_IDENTIFIER true
compare METHOD_IDENTIFIER false
v1 VARIABLE_IDENTIFIER false
v2 VARIABLE_IDENTIFIER false
validateCollectionMember METHOD_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
bytes VARIABLE_IDENTIFIER true
ByteBuffer TYPE_IDENTIFIER false
collectionName VARIABLE_IDENTIFIER true
MarshalException TYPE_IDENTIFIER false
validate METHOD_IDENTIFIER false
bytes VARIABLE_IDENTIFIER false
isCollection METHOD_IDENTIFIER true
Override TYPE_IDENTIFIER false
String TYPE_IDENTIFIER false
toString METHOD_IDENTIFIER true
getClass METHOD_IDENTIFIER false
getName METHOD_IDENTIFIER false
| [
"pschulam@gmail.com"
] | pschulam@gmail.com |
a17918eb6211fc2144dc2d0107fec183db4364fa | f34805066fd387b143e7b7de5e2df463df3febc9 | /mssc-brewery/src/main/java/app/wordyourself/msscbrewery/web/model/v2/BeerDtoV2.java | 079ec52ed50a1f7db2acd002e1d666976351459c | [] | no_license | alperarabaci/spring-microservices-cloud | 1c17e10ac836fd038e1045808a242db0f2d60239 | 14ff873c0ec42e73d89cd93c66854f6e7206b853 | refs/heads/master | 2023-06-22T19:22:14.158080 | 2020-08-20T14:08:23 | 2020-08-20T14:08:23 | 282,906,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package app.wordyourself.msscbrewery.web.model.v2;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Positive;
import java.time.OffsetDateTime;
import java.util.UUID;
/**
* alper - 05/08/2020
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BeerDtoV2 {
@Null
private UUID id;
@NotBlank
private String beerName;
@NotNull
private BeerStyleEnum beerStyle;
@Positive
private Long upc;
OffsetDateTime createdDate;
OffsetDateTime lastModifiedDate;
}
| [
"melihalper.arabaci@gmail.com"
] | melihalper.arabaci@gmail.com |
d50ee429e7ff0cc76265f9cd1dfafc218039515b | fb959ce79426f2dbec8c14e2d7d8150b74348030 | /src/main/java/com/example/UserService/data/rest/AddressChoice.java | e9c5c95d49e7deabe28357a53499ecacbd66e954 | [] | no_license | easychan2019new/My-Eshop-UserService | 561a6afa250d2507762db710eccd141f94c33ef3 | 686415f04d3334720f7c954e1c04f00bad252e9f | refs/heads/main | 2023-08-25T20:33:01.147817 | 2021-10-16T02:48:36 | 2021-10-16T02:48:36 | 417,696,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package com.example.UserService.data.rest;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
public class AddressChoice {
private String id;
private String street;
}
| [
"easychan2019@gmail.com"
] | easychan2019@gmail.com |
983301fcfd22c66fd748158506311c464222a474 | 736fc91ed85f6cba8089929bf39b8b76438910e7 | /student-manage/src/main/java/com/syl/sm/service/impl/ClazzServiceImpl.java | 0a735f29e1f4a7e6b9aa9c8d8038218f2df31ee8 | [] | no_license | shiyilinliran/Student_manager | ac3bbf74541e7280211a5446aa30f0aa2d657c7b | 8211b1a2ee227d2eb9423609976707f9144efeb4 | refs/heads/main | 2023-01-29T17:02:53.210244 | 2020-12-10T15:09:00 | 2020-12-10T15:09:00 | 316,143,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,710 | java | package com.syl.sm.service.impl;
import com.syl.sm.entity.Clazz;
import com.syl.sm.factory.ClazzDaoFactory;
import com.syl.sm.factory.DaoFActory;
import com.syl.sm.service.ClazzService;
import java.sql.SQLException;
import java.util.List;
/**
* @ClassName ClazzServiceImpl
* @Description TODO
* @Author admin
* @Date 2020/12/4
**/
public class ClazzServiceImpl implements ClazzService {
@Override
public List<Clazz> getClazzByDepId(int depId) {
List<Clazz> list = null;
try {
list = ClazzDaoFactory.getClazzDaoInstance().selectByDepartmentId(depId);
} catch (SQLException e) {
System.err.println("根据院系id查询班级列表出现异常");
}
return list;
}
@Override
public List<Clazz> selectAll() {
List<Clazz> list = null;
try {
list = DaoFActory.getClazzDaoInstance().selectAll();
} catch (SQLException e) {
System.err.println("查询所有班级列表出现异常");
}
return list;
}
@Override
public int addClazz(Clazz clazz) {
int n = 0;
try {
n = DaoFActory.getClazzDaoInstance().insertClazz(clazz);
} catch (SQLException throwables) {
System.err.println("新增班级出现异常");
}
return n;
}
@Override
public int deleteClazz(int clazzId) {
int n = 0;
try {
n = DaoFActory.getClazzDaoInstance().deleteClazz(clazzId);
} catch (SQLException throwables) {
System.err.println("删除班级出现异常");
}
return n;
}
}
| [
"2226780673@qq.com"
] | 2226780673@qq.com |
0000f1507bf86e2a6664c4b6c03e052f055e7c1c | f601065e7a8a4adcb0befa9fc436354ed8922b5f | /src/main/java/com/ocp/day28/ExceptionDemo7.java | 8786b8e188ae2115056a947292ccbe76b599e2c2 | [] | no_license | Beast090320/Java0316 | a17336ab7ceb8f29a88ffd014f0949bd131911ea | 1a42edf5ba99bfb978f7fdce2d47058a09ec0536 | refs/heads/master | 2023-05-12T05:55:00.830995 | 2021-06-10T13:51:33 | 2021-06-10T13:51:33 | 348,325,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.ocp.day28;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
public class ExceptionDemo7 {
public static void main(String[] args) {
String mybirthday = "2000/1/一";
DateFormat df = DateFormat.getDateInstance();
try {
Date date = df.parse(mybirthday);
System.out.println(date);
} catch (ParseException e) {
System.out.println("日期轉換失敗, " + e);
}
}
}
| [
"a3432@DESKTOP-GAD7FN7"
] | a3432@DESKTOP-GAD7FN7 |
7c5385c205af79b92c043b4f629c24921a34758f | f850ca0edb2aee0a0de939edea33093f20ea8c8e | /src/main/java/fle/api/tile/kinetic/TEGearBoxBase.java | d9d087507a650f7630a64fba92fb95d6fe293037 | [] | no_license | ueyudiud/FLE | e6cd58e461a5863187a0f0434a65f272aeb372d0 | 99559e187b21419cf382bacd4c897fc41b468ef2 | refs/heads/1.10.2 | 2021-01-25T15:19:00.440484 | 2018-06-12T05:25:05 | 2018-06-12T05:25:05 | 39,243,551 | 9 | 2 | null | 2018-01-27T11:38:03 | 2015-07-17T08:31:05 | Java | UTF-8 | Java | false | false | 3,318 | java | /*
* copyright 2016-2018 ueyudiud
*/
package fle.api.tile.kinetic;
import javax.annotation.Nullable;
import farcore.energy.kinetic.IKineticAccess;
import farcore.energy.kinetic.IKineticHandler;
import farcore.energy.kinetic.KineticPackage;
import farcore.handler.FarCoreEnergyHandler;
import nebula.common.tile.TE04Synchronization;
import nebula.common.util.Direction;
/**
* @author ueyudiud
*/
public class TEGearBoxBase extends TE04Synchronization implements IKineticHandler
{
public static enum RotationType
{
EDGE_ROTATE, ROPE_ROTATE, AXIS_ROTATE;
}
public static class KineticPackageExt extends KineticPackage
{
public final RotationType type;
public final Direction direction;
protected KineticPackageExt(RotationType type, Direction direction, double t, double s)
{
super(t, s);
this.type = type;
this.direction = direction;
}
public static KineticPackageExt wrap(RotationType type, KineticPackage pkg, Direction direction)
{
return new KineticPackageExt(type, direction, pkg.torque, pkg.speed);
}
}
public static class KineticPackageGearEdgeRotate extends KineticPackageExt
{
public int gearTeethCount;
public float gearLen;
public float gearTeethLen;
public KineticPackageGearEdgeRotate(Direction direction, double t, double s)
{
super(RotationType.EDGE_ROTATE, direction, t, s);
}
public KineticPackageGearEdgeRotate setGearProperty(IGearHandler handler, Direction direction)
{
this.gearLen = handler.getGearSize(direction);
this.gearTeethLen = handler.getGearTeethSize(direction);
this.gearTeethCount = handler.getGearTeethCount(direction);
return this;
}
}
public static class KineticPackageAxisRotate extends KineticPackageExt
{
public KineticPackageAxisRotate(Direction direction, double t, double s)
{
super(RotationType.AXIS_ROTATE, direction, t, s);
}
}
public static class KineticPackageRopeRotate extends KineticPackageExt
{
public KineticPackageRopeRotate(Direction direction, double t, double s)
{
super(RotationType.ROPE_ROTATE, direction, t, s);
}
}
@Nullable
public RotationType getRotationType(Direction direction)
{
return null;
}
@Override
protected void initServer()
{
super.initServer();
FarCoreEnergyHandler.onAddFromWorld(this);
}
@Override
public void onRemoveFromLoadedWorld()
{
super.onRemoveFromLoadedWorld();
FarCoreEnergyHandler.onRemoveFromWorld(this);
}
@Override
public void update()
{
super.update();
}
@Override
public boolean canAccessKineticEnergyFromDirection(Direction direction)
{
return true;
}
@Override
public boolean isRotatable(Direction direction, KineticPackage pkg)
{
return false;
}
@Override
public void emitKineticEnergy(IKineticAccess access, IKineticHandler destination, Direction direction, KineticPackage pkg)
{
}
@Override
public double receiveKineticEnergy(IKineticAccess access, IKineticHandler source, Direction direction, KineticPackage pkg)
{
return 0;
}
@Override
public void onStuck(Direction direction, KineticPackage pkg)
{
}
@Override
public void kineticPreUpdate(IKineticAccess access)
{
}
}
| [
"ueyudiud@163.com"
] | ueyudiud@163.com |
f018de86bf46edc8f4ca330d9874321b16e4bda0 | db0a10be2c7a60316e879f70d41f97045b06e4c4 | /app/src/main/java/com/ashant/mytwitter/ui/home/HomeFragment.java | 024b963036d92ebd540482b094f7a7dbe608c0fb | [] | no_license | AshantThapa/MyTwitter | b16f589a23d2a4aed3069723a6adb17c4a1dedfa | ac873062db500b2886476de86ce21174dd9ab8b2 | refs/heads/master | 2020-12-08T13:03:35.191579 | 2020-01-10T07:26:59 | 2020-01-10T07:26:59 | 232,988,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package com.ashant.mytwitter.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.ashant.mytwitter.Camera;
import com.ashant.mytwitter.Login_activity;
import com.ashant.mytwitter.R;
import com.ashant.mytwitter.adapter.TweetAdapter;
import com.ashant.mytwitter.api.ApiClass;
import com.ashant.mytwitter.model.TweetM;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class HomeFragment extends Fragment {
Camera cm = new Camera();
Login_activity la = new Login_activity();
RecyclerView recyclerView;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate( R.layout.fragment_home, container, false );
recyclerView = root.findViewById( R.id.HomeRV );
loadCurrentUser();
return root;
}
private void loadCurrentUser() {
String token;
if (la.Token.isEmpty()) {
token = cm.token;
//Toast.makeText(getContext(), "token " +token, Toast.LENGTH_SHORT).show();
} else {
token = la.Token;
// Toast.makeText(getContext(), "token " +token, Toast.LENGTH_SHORT).show();
}
ApiClass usersAPI = new ApiClass();
Call<List<TweetM>> userCall = usersAPI.calls().GetTweet( token );
userCall.enqueue( new Callback<List<TweetM>>() {
@Override
public void onResponse(Call<List<TweetM>> call, Response<List<TweetM>> response) {
if (!response.isSuccessful()) {
Toast.makeText( getContext(), "Code " + response.code(), Toast.LENGTH_SHORT ).show();
return;
}
List<TweetM> tweetMS = response.body();
TweetAdapter tweetAdapter = new TweetAdapter( getContext(), tweetMS );
recyclerView.setAdapter( tweetAdapter );
recyclerView.setLayoutManager( new LinearLayoutManager( getContext() ) );
}
@Override
public void onFailure(Call<List<TweetM>> call, Throwable t) {
Toast.makeText( getContext(), "Error " + t.getLocalizedMessage(), Toast.LENGTH_SHORT ).show();
}
} );
}
} | [
"Ashant Thapa"
] | Ashant Thapa |
a47f9c192384d814561c7214f8b7cdafb00333eb | 05736c4600e142f5a9f84709169aa42acb8fb8b7 | /app/src/main/java/com/pencilbox/netknight/presentor/AppInfoAdapter.java | fbdebebada1ef3c12a9c021040b4761bb2e92f8f | [
"Apache-2.0"
] | permissive | litangyu/NetKnight | bbdf2e4b72eeb0a455d51babe23d9c0c31ce5974 | af208adc89f3dd81d4ce2e92475e00bd12a74b49 | refs/heads/master | 2021-08-14T18:00:21.876776 | 2017-11-16T10:58:28 | 2017-11-16T10:58:28 | 110,961,996 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,963 | java | package com.pencilbox.netknight.presentor;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.TextView;
import com.pencilbox.netknight.R;
import com.pencilbox.netknight.model.App;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by wu on 16/6/27.
*/
public class AppInfoAdapter extends BaseAdapter {
private List<App> list_appinfo = new ArrayList<>();
LayoutInflater inflater = null;
//存放用户选中的item咯,key 为 appId ,value 为 用户选中的position
private Map<Long,Integer> mWiflSelectedMap;
private Map<Long,Integer> mMobileSelectedMap;
public List<App> getDatas(){
return list_appinfo;
}
private Context mContext;
public void addAll(List<App> appLists) {
list_appinfo.addAll(appLists);
for(int i=0;i<appLists.size();i++){
mWiflSelectedMap.put(appLists.get(i).getId(),appLists.get(i).getWifiType());
mMobileSelectedMap.put( appLists.get(i).getId(),appLists.get(i).getMobileDataType());
}
}
public AppInfoAdapter(Context context) {
this.mContext = context;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mWiflSelectedMap = new HashMap<>();
mMobileSelectedMap = new HashMap<>();
}
public int getCount() {
return list_appinfo.size();
}
public App getItem(int position) {
return list_appinfo.get(position);
}
public long getItemId(int position) {
return 0;
}
public View getView(final int position, View convertview, ViewGroup arg2) {
View view = null;
ViewHolder holder = null;
if (convertview == null || convertview.getTag() == null) {
view = inflater.inflate(R.layout.app_items, null);
holder = new ViewHolder(view);
// holder.wifi_spinner = (Spinner) view.findViewById(R.id.wifi_spinner);
// holder.celluar_spinner = (Spinner) view.findViewById(R.id.celluar_spinner);
//我咋监听到是哪一个信息呢
SpinnerAdapter adapter = new SpinnerAdapter(mContext);
holder.wifi_spinner.setAdapter(adapter);
holder.celluar_spinner.setAdapter(adapter);
holder.celluar_spinner.setOnItemSelectedListener(new OnSpinnerItemListener(holder.celluar_spinner,false));
holder.wifi_spinner.setOnItemSelectedListener(new OnSpinnerItemListener(holder.wifi_spinner,true));
view.setTag(holder);
} else {
view = convertview;
holder = (ViewHolder) convertview.getTag();
}
App appInfo = getItem(position);
holder.appIcon.setImageDrawable(appInfo.getIcon());
holder.tvAppLabel.setText(appInfo.getName());
holder.tvPkgName.setText(appInfo.getPkgname());
//存储spinner对应的appId的信息
holder.celluar_spinner.setTag(appInfo);
holder.wifi_spinner.setTag(appInfo);
// int selectedPosition = mMobileSelectedMap.get(appInfo.getId());
holder.celluar_spinner.setSelection(mMobileSelectedMap.get(appInfo.getId()));
holder.wifi_spinner.setSelection(mWiflSelectedMap.get(appInfo.getId()));
if(appInfo.isAccessVpn()){
holder.wifi_spinner.setVisibility(View.VISIBLE);
holder.celluar_spinner.setVisibility(View.VISIBLE);
holder.tv_vpn_through.setVisibility(View.GONE);
}else{
holder.tv_vpn_through.setVisibility(View.VISIBLE);
holder.wifi_spinner.setVisibility(View.GONE);
holder.celluar_spinner.setVisibility(View.GONE);
}
return view;
}
/**
* spinner的Item的监听器
*/
private class OnSpinnerItemListener implements AdapterView.OnItemSelectedListener{
Spinner mSpinner ;
boolean isWifi = true;
public OnSpinnerItemListener(Spinner spinner,boolean isWifi){
mSpinner = spinner;
this.isWifi = isWifi;
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// Log.d("AppInfoAdapter","appId:"+mSpinner.getTag()+" position"+position);
//仅仅是为了存储用户选择了position的信息
App appInfo = (App) mSpinner.getTag();
if(isWifi){
mWiflSelectedMap.put(appInfo.getId(),position);
if(appInfo.getWifiType()!=position){
appInfo.setWifiType(position);
appInfo.save();
}
}else{
mMobileSelectedMap.put(appInfo.getId(),position);
if(appInfo.getMobileDataType()!=position){
appInfo.setMobileDataType(position);
appInfo.save();
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
}
class ViewHolder {
ImageView appIcon;
TextView tvAppLabel, tvPkgName,tv_vpn_through;
Spinner wifi_spinner,celluar_spinner;
public ViewHolder(View view) {
this.appIcon = (ImageView) view.findViewById(R.id.app_icon);
this.tvAppLabel = (TextView) view.findViewById(R.id.tvAppLabel);
this.tvPkgName = (TextView) view.findViewById(R.id.tvPkgName);
this.wifi_spinner = (Spinner) view.findViewById(R.id.wifi_spinner);
this.celluar_spinner= (Spinner) view.findViewById(R.id.celluar_spinner);
this.tv_vpn_through = (TextView) view.findViewById(R.id.tv_vpn_through);
}
}
}
| [
"lty81372860@gmail.com"
] | lty81372860@gmail.com |
815dde7de56aef603eb0cd30793fec27bea61e3d | 4e1a3b17ce93a5e5645ae93bb73e84159f0d27c4 | /src/connection/ConnectionFactory.java | b79d2e70e9993044ad43c0cf68b523d4db11fe17 | [] | no_license | josias84/Candidato | 63229224fb0d160113aa5847fe89ef09f7e14f99 | f2e520226a7caeeac418ffc95703b191fafdf762 | refs/heads/master | 2023-01-19T08:53:47.640734 | 2020-11-30T18:14:49 | 2020-11-30T18:14:49 | 314,052,035 | 0 | 0 | null | null | null | null | MacCentralEurope | Java | false | false | 1,163 | java | package connection;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.JOptionPane;
public class ConnectionFactory {
private final static String url="jdbc:sqlserver://localhost:1433;databaseNAme=bdProduto";
private final static String user="sa";
private final static String password="12345";
public static Connection getConnection() {
try {
DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Erro ao conex„o ao banco de dados!","Erro",2);
}
return null;
}
public static void closeConnection(Connection con) {
if(con!=null) {
try {
con.close();
} catch (SQLException e) {
JOptionPane.showInputDialog(null, "Erro ao finalizar a conex„o ao banco de dados!", "Erro",2);
}
}
}
public static void closeConnection(Connection con, PreparedStatement stmt) {
closeConnection(con);
if(stmt!=null) {
try {
stmt.close();
}catch(SQLException e) {
JOptionPane.showMessageDialog(null, "Erro ao finalizar a conx„o", "Erro",2);
}
}
}
}
| [
"josiasgr@id.uff.br"
] | josiasgr@id.uff.br |
065ff4eda1cc8a21ab51dc883bc171b0da063605 | 303fc5afce3df984edbc7e477f474fd7aee3b48e | /fuentes/ucumari-commons/src/main/java/com/wildc/ucumari/parameters/model/UomConversionDatedPK.java | 042e72bd96a4733dfbcaf3ae04daac8d8a420a3b | [] | no_license | douit/erpventas | 3624cbd55cb68b6d91677a493d6ef1e410392127 | c53dc6648bd5a2effbff15e03315bab31e6db38b | refs/heads/master | 2022-03-29T22:06:06.060059 | 2014-04-21T12:53:13 | 2014-04-21T12:53:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,002 | 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 com.wildc.ucumari.parameters.model;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
*
* @author Cristian
*/
@Embeddable
public class UomConversionDatedPK implements Serializable {
/**
*
*/
private static final long serialVersionUID = 8022559796846068054L;
@Basic(optional = false)
@Column(name = "UOM_ID")
private String uomId;
@Basic(optional = false)
@Column(name = "UOM_ID_TO")
private String uomIdTo;
@Basic(optional = false)
@Column(name = "FROM_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date fromDate;
public UomConversionDatedPK() {
}
public UomConversionDatedPK(String uomId, String uomIdTo, Date fromDate) {
this.uomId = uomId;
this.uomIdTo = uomIdTo;
this.fromDate = fromDate;
}
public String getUomId() {
return uomId;
}
public void setUomId(String uomId) {
this.uomId = uomId;
}
public String getUomIdTo() {
return uomIdTo;
}
public void setUomIdTo(String uomIdTo) {
this.uomIdTo = uomIdTo;
}
public Date getFromDate() {
return fromDate;
}
public void setFromDate(Date fromDate) {
this.fromDate = fromDate;
}
@Override
public int hashCode() {
int hash = 0;
hash += (uomId != null ? uomId.hashCode() : 0);
hash += (uomIdTo != null ? uomIdTo.hashCode() : 0);
hash += (fromDate != null ? fromDate.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof UomConversionDatedPK)) {
return false;
}
UomConversionDatedPK other = (UomConversionDatedPK) object;
if ((this.uomId == null && other.uomId != null) || (this.uomId != null && !this.uomId.equals(other.uomId))) {
return false;
}
if ((this.uomIdTo == null && other.uomIdTo != null) || (this.uomIdTo != null && !this.uomIdTo.equals(other.uomIdTo))) {
return false;
}
if ((this.fromDate == null && other.fromDate != null) || (this.fromDate != null && !this.fromDate.equals(other.fromDate))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.wildc.ucumari.client.modelo.UomConversionDatedPK[ uomId=" + uomId + ", uomIdTo=" + uomIdTo + ", fromDate=" + fromDate + " ]";
}
}
| [
"cmontes375@gmail.com"
] | cmontes375@gmail.com |
e9f4d56b50d894130f9043691b5f46177825a888 | 3f57c3fa5f95bd552206e37a1c335cd4c0fbd90a | /core/src/dev/ky3he4ik/battleship/ai/AIDummy.java | 08f4ae7df9286e38ef4d907c1e97e1b337a758fb | [
"Unlicense"
] | permissive | Ky3He4iK/battleship | 7eac6a9442a6e27fb4bd91e02bd56a708330d94d | bb0f1dda4527a0b447ee67bbd7855f317ec3eca8 | refs/heads/master | 2023-05-19T09:22:00.510698 | 2021-06-08T13:20:47 | 2021-06-08T13:20:47 | 255,083,023 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,269 | java | package dev.ky3he4ik.battleship.ai;
import com.badlogic.gdx.Gdx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Random;
import dev.ky3he4ik.battleship.logic.GameConfig;
import dev.ky3he4ik.battleship.logic.PlayerFinished;
import dev.ky3he4ik.battleship.logic.World;
public class AIDummy extends AI {
private int hitX = -1, hitY = -1;
private Queue<int[]> queue;
public AIDummy(@Nullable PlayerFinished callback, @NotNull World enemy, @NotNull World my, @NotNull GameConfig config) {
super(callback, enemy, my, config);
queue = new LinkedList<>();
}
@Override
public void restart() {
super.restart();
queue.clear();
hitX = -1;
}
@Override
protected void turn() {
if (hitX == -1) {
while (!queue.isEmpty()) {
int[] pair = queue.poll();
if (!enemy.isOpened(pair[0], pair[1])) {
turnX = pair[0];
turnY = pair[1];
rememberCell();
return;
}
}
Random random = new Random();
turnX = random.nextInt(enemy.getWidth());
turnY = random.nextInt(enemy.getHeight());
while (enemy.isOpened(turnX, turnY)) {
turnX = random.nextInt(enemy.getWidth());
turnY = random.nextInt(enemy.getHeight());
}
rememberCell();
} else {
if (hitX > 0)
queue.add(new int[]{hitX - 1, turnY});
if (hitY > 0)
queue.add(new int[]{hitX, turnY - 1});
if (hitX + 1 < enemy.getWidth())
queue.add(new int[]{hitX + 1, turnY});
if (hitY + 1 < enemy.getHeight())
queue.add(new int[]{hitX, turnY + 1});
hitX = -1;
turn();
}
}
protected void rememberCell() {
Gdx.app.debug("AIDummy", "remember cell: " + turnX + "x" + turnY);
if (enemy.getState(turnX, turnY) == World.STATE_UNDAMAGED) {
hitX = turnX;
hitY = turnY;
} else
hitX = -1;
}
}
| [
"ky3he4ik@ky3he4ik"
] | ky3he4ik@ky3he4ik |
b4ed8f234e857b50297acbe2918ef2d593712ca4 | 5b0b8904f367420e269445b03177d5c873ad0569 | /java-design-pattern/src/main/java/lol/kent/practice/pattern/observer/Bootstrap.java | 7d3993e5b6b1650f1dea0d7d0a64458e430ccccc | [
"MIT"
] | permissive | ShunqinChen/practice-java | 565c4c5c93a99ea301516399b8ec3874e8712d64 | 3d9ed2d18335af540022823d6e4516717419cca1 | refs/heads/master | 2023-05-14T14:25:21.303261 | 2023-05-07T12:15:31 | 2023-05-07T12:15:31 | 145,184,406 | 0 | 0 | MIT | 2021-03-31T21:27:51 | 2018-08-18T02:45:45 | Java | UTF-8 | Java | false | false | 891 | java | package lol.kent.practice.pattern.observer;
/**
* 标题、简要说明. <br>
* 类详细说明.
* <p>
* Copyright: Copyright (c) 2019年04月02日 18:11
* <p>
* Company: AMPM Fit
* <p>
*
* @author Shunqin.Chen
* @version x.x.x
*/
public class Bootstrap {
public static void main(String[] args) {
AuthenticationManager manager = new AuthenticationManager();
AuthenticationProvider authenticationProvider = new AuthenticationProvider(manager);
AuthorizationProvider authorizationProvider = new AuthorizationProvider(manager);
Authentication authentication = new Authentication("Kent","password");
manager.authenticate(authentication);
// 删除观察者后,观察者将收不到活动通知
manager.deleteObserver(authenticationProvider);
manager.authenticate(new Authentication("Bob", "123456"));
}
}
| [
"kentchensq@gmail.com"
] | kentchensq@gmail.com |
9cdda7cabff60c83834b537971be7174a4c9c3f2 | 7122806f2f344a3c804318d6df47a92c9ec3ce97 | /app/src/main/java/com/hearatale/phonic/data/model/typedef/SightWordsCategoryDef.java | 421203127f697de87fb6a3ab183a88c2073103cf | [] | no_license | BrainyEducation/Phonics | 851de68f35a75f576d5b6aaaa5091e18b08eff1f | df316165fdadb1d3947cb8371f48752956f74824 | refs/heads/master | 2020-05-01T02:52:42.110700 | 2019-05-17T03:02:33 | 2019-05-17T03:02:33 | 177,230,983 | 1 | 0 | null | 2019-05-17T03:02:34 | 2019-03-23T01:40:10 | Java | UTF-8 | Java | false | false | 276 | java | package com.hearatale.phonic.data.model.typedef;
import android.support.annotation.IntDef;
@IntDef({
SightWordsCategoryDef.PRE_K,
SightWordsCategoryDef.KINDERGARTEN
})
public @interface SightWordsCategoryDef {
int PRE_K = 0;
int KINDERGARTEN = 1;
}
| [
"yizra.g@gmail.com"
] | yizra.g@gmail.com |
82d1a88cfb37441493e2032339bd973a6fe9bda0 | a24a7032125333c45f4cf8d3d708cc3030399a1a | /src/test/java/nz/strydom/gross/ProductControllerTestIT.java | 79cc9ee0f78691738a85157f55c528d3db1d9e6f | [
"MIT"
] | permissive | STRiDGE/gross-re | aad74eb3559c372ac3a419118c320b576bd7f830 | 8287225ab6921455ad10986c99ed574bc8891789 | refs/heads/master | 2021-05-04T10:33:57.560218 | 2016-05-05T11:36:22 | 2016-05-05T11:36:22 | 53,115,976 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package nz.strydom.gross;
import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.test.context.ActiveProfiles;
import nz.strydom.gross.test.SpringContextTestCase;
@ActiveProfiles(value="integrationtest", inheritProfiles=false) // This is optional, but allows us to load a different properties file
public class ProductControllerTestIT extends SpringContextTestCase {
@Test
public void test() {
fail("Not yet implemented");
}
}
| [
"hannes.strydom@tsbbank.co.nz"
] | hannes.strydom@tsbbank.co.nz |
a4bdd187175148f057d89897b694fedcfa97b9d0 | 436ba3c9280015b6473f6e78766a0bb9cfd21998 | /parent/web/src/main/java/by/itacademy/keikom/taxi/web/converter/RateToDTOConverter.java | be6a84d18227c34d0c36902e73d736dc3c34ed2a | [] | no_license | KeMihail/parent | 4ba61debc5581f29a6cabfe2a767dbdeaed57eb6 | 398a7617d7a4c94703e3d85daca1e3b22d8920fa | refs/heads/master | 2022-12-24T09:31:34.156316 | 2019-06-13T20:29:10 | 2019-06-13T20:29:10 | 191,828,552 | 0 | 0 | null | 2022-12-15T23:25:17 | 2019-06-13T20:26:20 | Java | UTF-8 | Java | false | false | 639 | java | package by.itacademy.keikom.taxi.web.converter;
import java.util.function.Function;
import org.springframework.stereotype.Component;
import by.itacademy.keikom.taxi.dao.dbmodel.Rate;
import by.itacademy.keikom.taxi.web.dto.RateDTO;
@Component
public class RateToDTOConverter implements Function<Rate, RateDTO> {
@Override
public RateDTO apply(Rate dbModel) {
RateDTO dto = new RateDTO();
dto.setId(dbModel.getId());
dto.setName(dbModel.getName());
dto.setPriceKilometr(dbModel.getPriceKilometr());
dto.setPriceLanding(dbModel.getPriceLanding());
dto.setPriceMinuteWait(dbModel.getPriceMinuteWait());
return dto;
}
}
| [
"mihaila4038@gmail.com"
] | mihaila4038@gmail.com |
8414259c8e7769d2892194a850e3f4282bcbe17a | 62744eff051fa5d7557ee6f74245679338ceaa81 | /src/main/java/com/demidao/notty/command/EditCommand.java | dfafa1d6de08c9eb0aed5ad67125190176d4e450 | [] | no_license | Demidao/PrettyNottyBot | 93a3da90a0233bb4b307d1c70f6954cd4e318181 | 9fa8a6c3199e6d452c86feae8b75677be14353df | refs/heads/master | 2023-08-28T03:28:53.568373 | 2021-10-31T22:59:24 | 2021-10-31T22:59:24 | 423,249,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.demidao.notty.command;
import com.demidao.notty.service.SendBotMessageService;
import org.telegram.telegrambots.meta.api.objects.Update;
public class EditCommand implements Command{
private final SendBotMessageService sendBotMessageService;
public EditCommand(SendBotMessageService sendBotMessageService) {
this.sendBotMessageService = sendBotMessageService;
}
@Override
public void execute(Update update) {
}
}
| [
"Proletarka1"
] | Proletarka1 |
ebeafb68d9263a7a006e32d65a53dc30de38f2ee | eba353049d4adba3d62e3b27796077d1b25ebb7f | /learning_akka/src/main/java/top/andrewchen1/chapter3/ParseArticle.java | 4cefa5f404b1261c6be2c292f4c4f367be7a7f84 | [] | no_license | andrewchen1/learn_akka_with_mars | caaab688e3375e4636939f081359b8ca47f38322 | 7167890f9a6c81f6daa11bfe391176c2bac1e946 | refs/heads/master | 2020-04-27T23:48:40.820011 | 2019-05-05T02:10:45 | 2019-05-05T02:10:45 | 174,791,224 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 190 | java | package top.andrewchen1.chapter3;
import lombok.Data;
@Data
public class ParseArticle {
private final String url;
public ParseArticle(String url) {
this.url = url;
}
}
| [
"andrewchen7@outlook.com"
] | andrewchen7@outlook.com |
f8fc1fec93092839678c9034c109d3aa47244fe4 | cd3ccc969d6e31dce1a0cdc21de71899ab670a46 | /agp-7.1.0-alpha01/tools/base/build-system/builder/src/test/java/com/android/builder/core/DefaultApiVersionTest.java | df4d9c9140f814d5cbd8ac778dabb95c070130ec | [
"Apache-2.0"
] | permissive | jomof/CppBuildCacheWorkInProgress | 75e76e1bd1d8451e3ee31631e74f22e5bb15dd3c | 9e3475f6d94cb3239f27ed8f8ee81b0abde4ef51 | refs/heads/main | 2023-05-28T19:03:16.798422 | 2021-06-10T20:59:25 | 2021-06-10T20:59:25 | 374,736,765 | 0 | 1 | Apache-2.0 | 2021-06-07T21:06:53 | 2021-06-07T16:44:55 | Java | UTF-8 | Java | false | false | 1,274 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.builder.core;
import static com.google.common.truth.Truth.assertThat;
import com.android.builder.model.ApiVersion;
import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.Test;
public class DefaultApiVersionTest {
@Test
public void checkPreviewSdkVersion() {
ApiVersion version = new DefaultApiVersion("P");
assertThat(version.getApiLevel()).isEqualTo(27);
assertThat(version.getApiString()).isEqualTo("P");
assertThat(version.getCodename()).isEqualTo("P");
}
@Test
public void checkEquals() {
EqualsVerifier.forClass(DefaultApiVersion.class).verify();
}
}
| [
"jomof@google.com"
] | jomof@google.com |
dc282715f8e5366161040519a2175a8d3b942245 | 0a4b6a83792ab567a8c27e1c8feacd8a4b66275e | /main/java/com/bdqn/WebConfig/SpringBootWevMvcConfig.java | 929fc9509738bd0855ba84719f90bffba4b9ed0c | [
"Apache-2.0"
] | permissive | 3144207329/t12 | 837ad754c85ef23115e261c0e89e4ff73bcf9069 | 248b97caaf9d30c140f626d364e613131251ff9c | refs/heads/master | 2020-05-19T11:55:20.674202 | 2019-05-06T07:21:44 | 2019-05-06T07:21:44 | 185,003,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | package com.bdqn.WebConfig;
import com.bdqn.Interceptor.MyHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class SpringBootWevMvcConfig implements WebMvcConfigurer {
@Autowired
private MyHandlerInterceptor myHandlerInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/**").excludePathPatterns("");
}
@Override
public void addViewControllers(ViewControllerRegistry registry){
registry.addViewController("/").setViewName("redirect:/home/login");
// superd.addViewControllers(registry);
}
@Override
public void addCorsMappings(CorsRegistry registry){
registry.addMapping("/**").allowedOrigins("*").allowCredentials(true).allowedMethods("GET","POST").maxAge(3600);
}
}
| [
"“3144207329@qq.com”"
] | “3144207329@qq.com” |
46706abe75472a38339f9bea00d06d1a0dccf348 | 18d0ce394b9138b12d6b5a6c441ea80f408bc6a5 | /plugins/org.jkiss.dbeaver.ext.mssql.ui/src/org/jkiss/dbeaver/ext/mssql/ui/config/SQLServerDatabaseConfigurator.java | 9440934142e67888f7fbd1e55759923b72d76e92 | [
"EPL-1.0",
"Apache-2.0",
"LGPL-2.0-or-later"
] | permissive | ChrisYuan/dbeaver | 851dd6520fbb459f027358a996c2817bd07aaa3d | fb62c59bf96e93ccffa5588f745666ac29ee18c1 | refs/heads/devel | 2021-12-03T21:54:33.813111 | 2021-10-18T16:30:26 | 2021-10-18T16:30:26 | 215,923,469 | 0 | 1 | Apache-2.0 | 2019-10-18T02:16:43 | 2019-10-18T02:16:43 | null | UTF-8 | Java | false | false | 1,691 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2021 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jkiss.dbeaver.ext.mssql.ui.config;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.jkiss.dbeaver.ext.mssql.model.SQLServerDatabase;
import org.jkiss.dbeaver.ext.mssql.ui.SQLServerCreateDatabaseDialog;
import org.jkiss.dbeaver.model.edit.DBEObjectConfigurator;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.ui.UITask;
import org.jkiss.dbeaver.ui.UIUtils;
public class SQLServerDatabaseConfigurator implements DBEObjectConfigurator<SQLServerDatabase> {
@Override
public SQLServerDatabase configureObject(DBRProgressMonitor monitor, Object container, SQLServerDatabase database) {
return UITask.run(() -> {
SQLServerCreateDatabaseDialog dialog = new SQLServerCreateDatabaseDialog(UIUtils.getActiveWorkbenchShell(), database.getDataSource());
if (dialog.open() != IDialogConstants.OK_ID) {
return null;
}
database.setName(dialog.getName());
return database;
});
}
}
| [
"yanuari.channel@gmail.com"
] | yanuari.channel@gmail.com |
2a6d3a5b63c68f2e68ffb6d15df5c2b0a818535d | d8b3522a8eb8ed38b64c171ef40aa1378a31276d | /plugin/src/main/java/be/nokorbis/spigot/commandsigns/command/subcommands/VersionCommand.java | 367cc389f584a73127ccd9b53150578243d376a6 | [
"Apache-2.0"
] | permissive | EnocraftMC/ar-command-signs | c38d8fd99f5a8ecc7ae2972b051266a4ca09ebba | f0862d44aef9e0fd25a7010130137f196af427b9 | refs/heads/master | 2022-03-24T05:40:10.814328 | 2019-12-18T19:03:36 | 2019-12-18T19:03:36 | 261,609,588 | 0 | 1 | null | 2020-05-06T00:00:07 | 2020-05-06T00:00:06 | null | UTF-8 | Java | false | false | 848 | java | package be.nokorbis.spigot.commandsigns.command.subcommands;
import be.nokorbis.spigot.commandsigns.CommandSignsPlugin;
import be.nokorbis.spigot.commandsigns.command.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import java.util.List;
/**
* Created by nokorbis on 1/20/16.
*/
public class VersionCommand extends Command {
public VersionCommand() {
super("version", new String[] {"v"});
this.basePermission = "commandsign.admin.version";
}
@Override
public boolean execute(CommandSender sender, List<String> args) {
sender.sendMessage(ChatColor.AQUA + "CommandSign version : " + CommandSignsPlugin.getPlugin().getDescription().getVersion() + " developed by Nokorbis");
return true;
}
@Override
public void printUsage(CommandSender sender) {
sender.sendMessage("/commandsign version");
}
}
| [
"nokorbis@gmail.com"
] | nokorbis@gmail.com |
3f2fff7a7f121042940f3d63f14e038ceff98cb2 | 40cf40a0c50a44e895703a7705f30c842ed4cbbc | /src/main/java/models/Meta.java | fc4c5d26542dca453a35a5a8da52cbaf03e9885d | [] | no_license | alexcarrdev/azure-demo-poc | 8e2d5c43266451041d4592e760d194dc1952036c | e5755cc14db9a216dd2e8c940c86a872b763afd8 | refs/heads/master | 2023-08-29T22:45:42.523774 | 2021-11-10T15:33:37 | 2021-11-10T15:33:37 | 420,144,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,001 | java | package models;
public class Meta {
private String statementDate;
private String statementBalance;
private String minPaymentDue;
public String getStatementDate() {
return statementDate;
}
public void setStatementDate(String statementDate) {
this.statementDate = statementDate;
}
public String getStatementBalance() {
return statementBalance;
}
public void setStatementBalance(String statementBalance) {
this.statementBalance = statementBalance;
}
public String getMinPaymentDue() {
return minPaymentDue;
}
public void setMinPaymentDue(String minPaymentDue) {
this.minPaymentDue = minPaymentDue;
}
@Override
public String toString() {
return "Meta{" +
"statementDate='" + statementDate + '\'' +
", statementBalance='" + statementBalance + '\'' +
", minPaymentDue='" + minPaymentDue + '\'' +
'}';
}
}
| [
"alexcarrdev@gmail.com"
] | alexcarrdev@gmail.com |
023ba44e4905b9c95d53960e56b382bd3ffd5643 | 48128555cb7374621ccb494ecf69e7268c4442e0 | /src/java/com/imsys/admin/struts/action/SingInAction.java | ce0fad5fd9ec823739d116e274485716ee6fe801 | [] | no_license | julianrojas87/Imsys | b777e98631153fcba3d753e9bdbd175ad5fcc94f | fccd57ecd73ce8a3376a377462afda69812da027 | refs/heads/master | 2021-01-15T12:19:02.044999 | 2014-11-10T21:52:16 | 2014-11-10T21:52:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,854 | 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 com.imsys.admin.struts.action;
import com.imsys.admin.dao.control.AdminControl;
import com.imsys.admin.dao.entity.Usuario;
import com.opensymphony.xwork2.ActionSupport;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.struts2.interceptor.ServletRequestAware;
/**
*
* @author julian
*/
public class SingInAction extends ActionSupport implements ServletRequestAware {
private String username;
private String password;
private HttpSession session;
public String singin() {
// check the entered userName and password
if (getUsername() == null || getUsername().length() < 1) {
session.setAttribute("msj", "Ingrese el Nombre de Usuario.");
return INPUT;
} else if (getPassword() == null || getPassword().length() < 1) {
session.setAttribute("msj", "Ingrese la Contraseña.");
return INPUT;
} else {
AdminControl ac = new AdminControl();
Usuario u = ac.validateLogin(getUsername(), getPassword());
if (u != null) {
if (u.getLactivo().equals("false")) {
session.setAttribute("msj", "El usuario se encuentra bloqueado. Por favor, comuníquese con el administrador.");
return INPUT;
} else {
Calendar cal = Calendar.getInstance(new Locale("en", "US"));
DateFormat dateformat = new SimpleDateFormat("dd/MM/YYYY");
String date = dateformat.format(cal.getTime());
session.setAttribute("date", date);
session.setAttribute("rol", ac.getRolbyCode(Integer.parseInt(u.getVcroll().trim())).getVcdesroll());
session.setAttribute("username", u.getVcnombre());
session.setAttribute("userObject", u);
session.setAttribute("mainopt", "home");
ac.addBitacoraEntry("El usuario [" + u.getVcnombre() + "] ingresó al sistema.", u.getVccoduser(), "Main/SingIn");
return SUCCESS;
}
} else {
session.setAttribute("msj", "El nombre de usuario o contraseña no es valido.");
return INPUT;
}
}
}
public String singout() {
// remove username from the session
if (session.getAttribute("username") != null) {
String name = (String) session.getAttribute("username");
session.removeAttribute("username");
AdminControl ac = new AdminControl();
Usuario u = ac.getUserbyName(name);
if (!(u.getVcnombre() == null)) {
ac.addBitacoraEntry("El usuario [" + u.getVcnombre() + "] salió del sistema.", u.getVccoduser(), "Main/SingOut");
}
}
return SUCCESS;
}
public String goHome() {
session.setAttribute("mainopt", "home");
return SUCCESS;
}
public String goVersion() {
session.setAttribute("mainopt", "version");
return SUCCESS;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void setServletRequest(HttpServletRequest hsr) {
this.session = hsr.getSession();
}
}
| [
"julian.rojas87@gmail.com"
] | julian.rojas87@gmail.com |
d1a77ee3ee6b484417b9b390fe5bf693f5716ce2 | 228a76dcf6ac85479d15d489cb33076004024604 | /src/ExamCreator/ShortQuestion.java | 2b0023ad805d2169276742b2a0c8a1e0f6bc715f | [] | no_license | masterveejr/ExamCreator | 097bb8f26f29cb6a9760d7aef237e465cfb3bdf5 | b87462435dfd43cb0845ff3d1cb96c9ea2122ca1 | refs/heads/master | 2021-05-10T14:40:39.993791 | 2018-01-22T23:05:23 | 2018-01-22T23:05:23 | 118,525,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package ExamCreator;
public class ShortQuestion implements Question {
private String SQQuestion;
private String SQSample;
public ShortQuestion(String q,String s){
this.SQQuestion=q;
this.SQSample=s;
}
public String getSQQuestion() {
return SQQuestion;
}
public String getSQSample() {
return SQSample;
}
@Override
public String toString(){
return "SQ" + " " + SQQuestion + " "+ SQSample;
}
public String examPrinter(){
return SQQuestion;
}
public String AExamPrinter(){
return SQQuestion + " "+ SQSample;
}
}
| [
"maste@169.254.254.250"
] | maste@169.254.254.250 |
1b8c406ec4d48389f31ddaa348047fb3dc95b7b9 | 1b72e05948dfa71d460a17fcc40e0b1a66149aac | /test/ru/job4j/array/EndsWithTest.java | e81c258193ceba2abd14a8f2d3cd915222be8173 | [] | no_license | Manlexey/job4j_elementary | dc5c2f4d4775226e811644cb317810c56e09e516 | c913466ef4d2960e45a6a4ff96baf974d61630aa | refs/heads/master | 2023-07-08T03:30:54.522360 | 2021-08-17T20:05:44 | 2021-08-17T20:05:44 | 287,248,374 | 1 | 0 | null | 2020-08-13T10:24:31 | 2020-08-13T10:24:30 | null | UTF-8 | Java | false | false | 640 | java | package ru.job4j.array;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.*;
public class EndsWithTest {
@Test
public void whenEndWithPrefixThenTrue() {
char[] word = {'H', 'e', 'l', 'l', 'o'};
char[] post = {'l', 'o'};
boolean result = EndsWith.endsWith(word, post);
assertThat(result, is(true));
}
@Test
public void whenNotEndWithPrefixThenFalse() {
char[] word = {'H', 'e', 'l', 'l', 'o'};
char[] post = {'l', 'a'};
boolean result = EndsWith.endsWith(word, post);
assertThat(result, is(false));
}
} | [
"Alexey_3588"
] | Alexey_3588 |
af06498d647cea1865e6610426ce619ca217daea | 3eb74b2a9a1b094b13a244ed37714568c47cc8b8 | /MyProject/src/ch10/Calculator.java | 08dd71b4efcdef7062ed4b3a6411deac7550ebcb | [] | no_license | Gamaspin/javawork | ae25b0963a1f89d59835b04b71e4423430e88798 | 8e345ddd523fa6342103b0d028cb504b14740fe6 | refs/heads/main | 2023-07-07T14:28:43.168465 | 2021-08-05T06:12:09 | 2021-08-05T06:12:09 | 392,977,982 | 0 | 0 | null | 2021-08-05T09:12:13 | 2021-08-05T09:12:13 | null | UTF-8 | Java | false | false | 175 | java | package ch10;
interface Calculator {
long add(long n1, long n2);
long substract(long n1, long n2);
long multiply(long n1, long n2);
double divide(double n1, long n2);
}
| [
"84695780+yoonbung12@users.noreply.github.com"
] | 84695780+yoonbung12@users.noreply.github.com |
f15e6a452ab263980c5206a2e8cef91c2cd0de97 | ed563cb3e2166d02bb3871e498949c90f63f7f94 | /src/main/java/info/masjidy/responses/PrayerTimeListResponse.java | 5ca92bd581348b0e308be9fe1fcb8f734f314d37 | [
"MIT"
] | permissive | mmakhalaf/MasjidyWS | f1876800a0592cb06b488de8654588b40dc44090 | 50e9618b107222f06686e38c6be2969e6fb37540 | refs/heads/master | 2020-04-11T19:13:15.520567 | 2018-12-16T18:11:22 | 2018-12-16T18:11:22 | 162,026,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | package info.masjidy.responses;
import info.masjidy.models.PrayerTime;
import info.masjidy.utils.PrayerTimeList;
import java.util.ArrayList;
import java.util.List;
public class PrayerTimeListResponse {
List<PrayerTimeResponse> prayerTimes = new ArrayList<>();
public PrayerTimeListResponse(PrayerTimeList pts) {
if (pts != null) {
for (PrayerTime pt : pts) {
prayerTimes.add(new PrayerTimeResponse(pt));
}
}
}
/**
* Constructor to be used when all the prayer times are for one mosque.
* This should be more performant as it won't involve getting the id from underlying mosque object
*/
public PrayerTimeListResponse(PrayerTimeList pts, Long mosqueId) {
if (pts != null) {
for (PrayerTime pt : pts) {
prayerTimes.add(new PrayerTimeResponse(pt, mosqueId));
}
}
}
public List<PrayerTimeResponse> getPrayerTimes() {
return prayerTimes;
}
public void setPrayerTimes(List<PrayerTimeResponse> prayerTimes) {
this.prayerTimes = prayerTimes;
}
}
| [
"mmakhalaf@gmail.com"
] | mmakhalaf@gmail.com |
c586cd8a0e1efa0dc22137e7d56fee38a8a32a7e | 493f36971e352088e67296d0bcd547284f541ab8 | /04_implementation/src/hanpuku1/database/TicketList.java | f88f6e9954fbda9191aa7350535bbdc5a87fff9f | [] | no_license | TakedaMasashi46/Team5 | 569fdc9a7141fdfff55146e43d4a4f89cc2f2cf5 | 14fb342c8a8091feb2fdbf585909dfce98ebdab2 | refs/heads/master | 2022-11-16T04:41:18.855632 | 2020-06-16T02:35:00 | 2020-06-16T02:35:00 | 268,668,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 992 | java | package database;
import java.util.ArrayList;
public class TicketList {
ArrayList<Ticket> ticketList =new ArrayList<Ticket>();
public TicketList() {
ticketList.add(new Ticket(1, "水族館", 1000, "2020-6-6", 20));
ticketList.add(new Ticket(2,"映画館",3000,"2020-07-10",50));
ticketList.add(new Ticket(3,"美術館",800,"2020-08-12",10));
}
public String showTicketNumberName() {
String data = "チケット名:チケット番号=";
for(Ticket t:ticketList) {
data+=t.getTicketName();
data+=":";
data+=t.getTicketNumber();
data+="=";
}
return data;
}
public Ticket getTicket(int num) {
for(Ticket t:ticketList ) {
if(num == t.getTicketNumber()) {
return t; //メンバーオブジェクト返す
}
}
return null;
}
public String showAllTicketData() {
String data="";
for(Ticket t:ticketList) {
data+=t.showTicketData();
data+="=";
data+="---------";
data+="=";
}
return data;
}
}
| [
"ma-takeda@cresco.co.jp"
] | ma-takeda@cresco.co.jp |
13172a183dad97adf2ad5998777ea04ae0a056ca | 5e362b9070d4d08234de1d06288ff6692fb6836b | /android/app/src/main/java/com/quantie_18053/MainActivity.java | 57b39b5882778d80bdafebae25fe8189216f06de | [] | no_license | crowdbotics-apps/quantie-18053 | 0a380b0f5cb9d1c4a5200e552a700f7fa3809d01 | b9fe9938b16a3a479303c7768b3a4e162d67e5a8 | refs/heads/master | 2022-10-11T03:19:42.577082 | 2020-06-12T21:37:45 | 2020-06-12T21:37:45 | 271,879,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 371 | java | package com.quantie_18053;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "quantie_18053";
}
}
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
54fe7403e3d690d42f59f2328db39c085d974c98 | f8753a144ef25baafda6c4dd378bddfd6ae4599e | /app/src/main/java/flixster/com/flixster/MainActivity.java | d202d339cdc84308a20696d6e6871f1458fce34e | [] | no_license | mmacedonio/Flixster_Part_2 | 8a8f562770fff2a3b698458fe145f8fbb616177d | 11935cb25e7dcee4454c9c5de575bad5df093963 | refs/heads/master | 2022-04-21T13:32:32.899630 | 2020-04-20T01:48:39 | 2020-04-20T01:48:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,500 | java | package flixster.com.flixster;
import android.os.Bundle;
import android.util.Log;
import com.codepath.asynchttpclient.AsyncHttpClient;
import com.codepath.asynchttpclient.callback.JsonHttpResponseHandler;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import flixster.com.flixster.adapters.MovieAdapter;
import flixster.com.flixster.models.Movie;
import okhttp3.Headers;
public class MainActivity extends AppCompatActivity {
public static final String NOW_PLAYING_URL = "https://api.themoviedb.org/3/movie/now_playing?api_key=a07e22bc18f5cb106bfe4cc1f83ad8ed";
public static final String TAG = "MainActivity";
List<Movie> movies;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerView rvMovies = findViewById(R.id.rvMovies);
movies = new ArrayList<>();
//Create the Adapter
final MovieAdapter movieAdapter = new MovieAdapter(this, movies);
//Set the Adapter on the Recycler View
rvMovies.setAdapter(movieAdapter);
//Set the Layout Manager
rvMovies.setLayoutManager( new LinearLayoutManager(this));
AsyncHttpClient client = new AsyncHttpClient();
client.get(NOW_PLAYING_URL, new JsonHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Headers headers, JSON json) {
Log.d(TAG, "onSuccess");
JSONObject jsonObject = json.jsonObject;
try {
JSONArray results = jsonObject.getJSONArray("results");
Log.i(TAG, "Results" + results.toString());
movies.addAll(Movie.fromJsonArray(results));
movieAdapter.notifyDataSetChanged();
Log.i(TAG, "Movies: " + movies.size());
} catch (JSONException e) {
Log.d(TAG, "Hit JSON Exception", e);
e.printStackTrace();
}
}
@Override
public void onFailure(int statusCode, Headers headers, String response, Throwable throwable) {
Log.d(TAG, "onFailure");
}
});
}
}
| [
"mmacedonio.01@gmail.com"
] | mmacedonio.01@gmail.com |
14e9852466190091c02c92f532831cb1d0177cdc | aed324c76a46911f0bc9241390451990fa6c12c6 | /src/cursojava/executavel/TestandoClassesFilhas.java | b20f4c69da7680f7ee4ded40832cd982e7db7687 | [] | no_license | Marcelo-F/primeiro-programa-java | 728fabd764b97f2d6b58d87d16e0102e93cbef31 | 277b9eed9cfdf8749025d1541c38f69c87a2e038 | refs/heads/master | 2021-01-15T02:40:01.359449 | 2020-03-20T15:08:26 | 2020-03-20T15:08:26 | 242,851,127 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,045 | java | package cursojava.executavel;
import cursojava.classes.Aluno;
import cursojava.classes.Diretor;
import cursojava.classes.Pessoa;
import cursojava.classes.Secretario;
public class TestandoClassesFilhas {
public static void main(String[] args) {
Aluno aluno = new Aluno ();
aluno.setNome("Alex");
Diretor diretor = new Diretor();
diretor.setRegistroEducacao("331232131");
Secretario secretario = new Secretario();
secretario.setExperiencia("Administração");
System.out.println(aluno);
System.out.println(diretor);
System.out.println(secretario);
System.out.println("Salário do aluno é" + aluno.salario());
System.out.println("Salário do diretor é" + diretor.salario());
System.out.println("Salário salario do secretário é" + secretario.salario());
teste(aluno);
teste(diretor);
teste(secretario);
}
public static void teste(Pessoa pessoa) {
System.out.println("Essa pessoa é demais= "+pessoa.getNome()+
" e o salario de" +pessoa.salario());
}
}
| [
"54288817+Marcelo-F@users.noreply.github.com"
] | 54288817+Marcelo-F@users.noreply.github.com |
64137a1bb4526512035b8e58e73532efb913f561 | 31540fa400c62e3823cd37326e46b1055627843b | /src/main/java/com/sapient/ehcahe/ehcachetutorial/cache/UsersCacheService.java | 324411a8056f5a87d708ea3589db6406fa864f34 | [] | no_license | Susmit07/hibernate-eh-cache | 783236692193f9ec892f6a79d6cf524eec478eba | 4b249c2f417baf573e287478c41366c171fe2881 | refs/heads/master | 2020-04-16T17:48:45.208911 | 2019-01-15T05:28:12 | 2019-01-15T05:28:12 | 165,789,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.sapient.ehcahe.ehcachetutorial.cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import com.sapient.ehcahe.ehcachetutorial.model.Users;
import com.sapient.ehcahe.ehcachetutorial.repository.UsersRepository;
@Component
public class UsersCacheService {
@Autowired
UsersRepository usersRepository;
@Cacheable(value = "usersCache", key = "#name")
public Users getUser(String name) {
System.out.println("Retrieving from Database for name: " + name);
return usersRepository.findByName(name);
}
}
| [
"“susmitsircar@gmail.com”"
] | “susmitsircar@gmail.com” |
d9fea2237dff7773d386c1f01e88320dcc4f529a | 0d95242f5de24e865ebaf2652bc155e8666ce307 | /app/src/androidTest/java/com/quanlt/vietcomicmvp/ExampleInstrumentedTest.java | 5d105996b203299e6a4abf226f84605d2f9f7720 | [
"Apache-2.0"
] | permissive | quanlt/VietComicMVP | e10e91d5e158df8359d51f29930d9b381cd8f5f0 | 9428468c17196bb58cdf10f93c0ac47c4bca8ec3 | refs/heads/master | 2021-06-07T19:22:06.924950 | 2016-11-23T12:55:50 | 2016-11-23T12:55:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | package com.quanlt.vietcomicmvp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.quanlt.vietcomicmvp", appContext.getPackageName());
}
}
| [
"quanlt.56@gmail.com"
] | quanlt.56@gmail.com |
9c752199a23db6411279af1472f18baffbaab6a1 | 3998ab9a87c7094915fe39afa418c08baa9eb920 | /src/main/java/com/softsign/graphql/DataFetchers.java | 5ff7445efdcea2531206fa330ac73a21569311be | [] | no_license | MatiasMinian/GraphQL-Test | be169a365d66dcffe62c0f9d74051fce589e8ba9 | 2ceef91df527e865b739336f7ac7af09bf122e16 | refs/heads/master | 2021-06-12T22:19:59.056712 | 2016-12-28T22:32:22 | 2016-12-28T22:32:22 | 76,380,218 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.softsign.graphql;
import com.softsign.model.User;
import graphql.schema.DataFetcher;
public class DataFetchers {
public static DataFetcher userDataFetcher = (environment -> AppDataset.users.get( (Integer)environment.getArguments().get("id") - 1));
public static DataFetcher userTransportsDataFetcher = (environment -> ((User)environment.getSource()).getTransports());
}
| [
"matias.minian@globant.com"
] | matias.minian@globant.com |
8adcf8c78b5769b3f19fe83491ed540c0f625d04 | 1cc621f0cf10473b96f10fcb5b7827c710331689 | /Ex6/Procyon/com/jogamp/common/util/RunnableExecutor.java | 0f56e557f673251378dfe3f9d65971ab4353799e | [] | no_license | nitaiaharoni1/Introduction-to-Computer-Graphics | eaaa16bd2dba5a51f0f7442ee202a04897cbaa1f | 4467d9f092c7e393d9549df9e10769a4b07cdad4 | refs/heads/master | 2020-04-28T22:56:29.061748 | 2019-06-06T18:55:51 | 2019-06-06T18:55:51 | 175,635,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | //
// Decompiled by Procyon v0.5.30
//
package com.jogamp.common.util;
public interface RunnableExecutor
{
public static final RunnableExecutor currentThreadExecutor = new CurrentThreadExecutor();
void invoke(final boolean p0, final Runnable p1);
public static class CurrentThreadExecutor implements RunnableExecutor
{
@Override
public void invoke(final boolean b, final Runnable runnable) {
runnable.run();
}
}
}
| [
"nitaiaharoni1@gmail.com"
] | nitaiaharoni1@gmail.com |
dce3fb6aa3d1de1c1862c99c6f3c16414c72505d | 6cc096998061db8cb1f13e82ccc899aa04e686ff | /src/main/java/com/vectorsearch/faiss/swig/intArray.java | c6e7be649bd61392db8064ceac5f8a103120636b | [
"MIT"
] | permissive | xuqiong1989/JFaiss-CPU | a02aacca1d6f6999fc59dd9dee3e1d63f0dcc46d | 3f12ff474938954aa34e7d831af821eb14db0e5c | refs/heads/master | 2022-12-25T20:44:50.503752 | 2020-09-15T05:57:52 | 2020-09-15T05:57:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,652 | java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.vectorsearch.faiss.swig;
public class intArray {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected intArray(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(intArray obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
swigfaissJNI.delete_intArray(swigCPtr);
}
swigCPtr = 0;
}
}
public intArray(int nelements) {
this(swigfaissJNI.new_intArray(nelements), true);
}
public int getitem(int index) {
return swigfaissJNI.intArray_getitem(swigCPtr, this, index);
}
public void setitem(int index, int value) {
swigfaissJNI.intArray_setitem(swigCPtr, this, index, value);
}
public SWIGTYPE_p_int cast() {
long cPtr = swigfaissJNI.intArray_cast(swigCPtr, this);
return (cPtr == 0) ? null : new SWIGTYPE_p_int(cPtr, false);
}
public static intArray frompointer(SWIGTYPE_p_int t) {
long cPtr = swigfaissJNI.intArray_frompointer(SWIGTYPE_p_int.getCPtr(t));
return (cPtr == 0) ? null : new intArray(cPtr, false);
}
}
| [
"ramanrajarathinam@gmail.com"
] | ramanrajarathinam@gmail.com |
14066f8752cfa152312992de810cf8fdb2e69ca3 | cdc930c5f2ed633b872657705e1b161fbff4c313 | /springboot2-utils/src/main/java/com/letters7/wuchen/springboot2/utils/security/Cryptos.java | e4dbb4214e457197560e1a6fdf217c02c246f32e | [] | no_license | wuchenl/springboot2-scaffold | 56b6a485f7c389c778688b8f327609d61174d8e6 | cf6ef1c7a22405c03bd654e95ccda7562cb8e8f2 | refs/heads/master | 2020-04-27T10:34:21.844066 | 2019-01-16T05:43:08 | 2019-01-16T05:43:08 | 174,260,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,382 | java | package com.letters7.wuchen.springboot2.utils.security;
import com.letters7.wuchen.springboot2.utils.encode.UtilEncode;
import com.letters7.wuchen.springboot2.utils.exception.UtilException;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.util.Arrays;
/**
* 支持HMAC-SHA1消息签名 及 DES/AES对称加密的工具类.
* 支持Hex与Base64两种编码方式.
*
* @author calvin
*/
public class Cryptos {
private static final String AES = "AES";
private static final String AES_CBC = "AES/CBC/PKCS5Padding";
private static final String HMACSHA1 = "HmacSHA1";
private static final String DEFAULT_URL_ENCODING = "UTF-8";
private static final int DEFAULT_HMACSHA1_KEYSIZE = 160; //RFC2401
private static final int DEFAULT_AES_KEYSIZE = 128;
private static final int DEFAULT_IVSIZE = 16;
private static final byte[] DEFAULT_KEY = new byte[]{-97,88,-94,9,70,-76,126,25,0,3,-20,113,108,28,69,125};
private static SecureRandom random = new SecureRandom();
//-- HMAC-SHA1 funciton --//
/**
* 使用HMAC-SHA1进行消息签名, 返回字节数组,长度为20字节.
*
* @param input 原始输入字符数组
* @param key HMAC-SHA1密钥
*/
public static byte[] hmacSha1(byte[] input, byte[] key) {
try {
SecretKey secretKey = new SecretKeySpec(key, HMACSHA1);
Mac mac = Mac.getInstance(HMACSHA1);
mac.init(secretKey);
return mac.doFinal(input);
} catch (GeneralSecurityException e) {
throw UtilException.unchecked(e);
}
}
/**
* 校验HMAC-SHA1签名是否正确.
*
* @param expected 已存在的签名
* @param input 原始输入字符串
* @param key 密钥
*/
public static boolean isMacValid(byte[] expected, byte[] input, byte[] key) {
byte[] actual = hmacSha1(input, key);
return Arrays.equals(expected, actual);
}
/**
* 生成HMAC-SHA1密钥,返回字节数组,长度为160位(20字节).
* HMAC-SHA1算法对密钥无特殊要求, RFC2401建议最少长度为160位(20字节).
*/
public static byte[] generateHmacSha1Key() {
try {
KeyGenerator keyGenerator = KeyGenerator.getInstance(HMACSHA1);
keyGenerator.init(DEFAULT_HMACSHA1_KEYSIZE);
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded();
} catch (GeneralSecurityException e) {
throw UtilException.unchecked(e);
}
}
//-- AES funciton --//
/**
* 使用AES加密原始字符串.
*
* @param input 原始输入字符数组
*/
public static String aesEncrypt(String input) {
try {
return UtilEncode.encodeHex(aesEncrypt(input.getBytes(DEFAULT_URL_ENCODING), DEFAULT_KEY));
} catch (UnsupportedEncodingException e) {
return "";
}
}
/**
* 使用AES加密原始字符串.
*
* @param input 原始输入字符数组
* @param key 符合AES要求的密钥
*/
public static String aesEncrypt(String input, String key) {
try {
return UtilEncode.encodeHex(aesEncrypt(input.getBytes(DEFAULT_URL_ENCODING), UtilEncode.decodeHex(key)));
} catch (UnsupportedEncodingException e) {
return "";
}
}
/**
* 使用AES加密原始字符串.
*
* @param input 原始输入字符数组
* @param key 符合AES要求的密钥
*/
public static byte[] aesEncrypt(byte[] input, byte[] key) {
return aes(input, key, Cipher.ENCRYPT_MODE);
}
/**
* 使用AES加密原始字符串.
*
* @param input 原始输入字符数组
* @param key 符合AES要求的密钥
* @param iv 初始向量
*/
public static byte[] aesEncrypt(byte[] input, byte[] key, byte[] iv) {
return aes(input, key, iv, Cipher.ENCRYPT_MODE);
}
/**
* 使用AES解密字符串, 返回原始字符串.
*
* @param input Hex编码的加密字符串
*/
public static String aesDecrypt(String input) {
try {
return new String(aesDecrypt(UtilEncode.decodeHex(input), DEFAULT_KEY), DEFAULT_URL_ENCODING);
} catch (UnsupportedEncodingException e) {
return "";
}
}
/**
* 使用AES解密字符串, 返回原始字符串.
*
* @param input Hex编码的加密字符串
* @param key 符合AES要求的密钥
*/
public static String aesDecrypt(String input, String key) {
try {
return new String(aesDecrypt(UtilEncode.decodeHex(input), UtilEncode.decodeHex(key)), DEFAULT_URL_ENCODING);
} catch (UnsupportedEncodingException e) {
return "";
}
}
/**
* 使用AES解密字符串, 返回原始字符串.
*
* @param input Hex编码的加密字符串
* @param key 符合AES要求的密钥
*/
public static byte[] aesDecrypt(byte[] input, byte[] key) {
return aes(input, key, Cipher.DECRYPT_MODE);
}
/**
* 使用AES解密字符串, 返回原始字符串.
*
* @param input Hex编码的加密字符串
* @param key 符合AES要求的密钥
* @param iv 初始向量
*/
public static byte[] aesDecrypt(byte[] input, byte[] key, byte[] iv) {
return aes(input, key, iv, Cipher.DECRYPT_MODE);
}
/**
* 使用AES加密或解密无编码的原始字节数组, 返回无编码的字节数组结果.
*
* @param input 原始字节数组
* @param key 符合AES要求的密钥
* @param mode Cipher.ENCRYPT_MODE 或 Cipher.DECRYPT_MODE
*/
private static byte[] aes(byte[] input, byte[] key, int mode) {
try {
SecretKey secretKey = new SecretKeySpec(key, AES);
Cipher cipher = Cipher.getInstance(AES);
cipher.init(mode, secretKey);
return cipher.doFinal(input);
} catch (GeneralSecurityException e) {
throw UtilException.unchecked(e);
}
}
/**
* 使用AES加密或解密无编码的原始字节数组, 返回无编码的字节数组结果.
*
* @param input 原始字节数组
* @param key 符合AES要求的密钥
* @param iv 初始向量
* @param mode Cipher.ENCRYPT_MODE 或 Cipher.DECRYPT_MODE
*/
private static byte[] aes(byte[] input, byte[] key, byte[] iv, int mode) {
try {
SecretKey secretKey = new SecretKeySpec(key, AES);
IvParameterSpec ivSpec = new IvParameterSpec(iv);
Cipher cipher = Cipher.getInstance(AES_CBC);
cipher.init(mode, secretKey, ivSpec);
return cipher.doFinal(input);
} catch (GeneralSecurityException e) {
throw UtilException.unchecked(e);
}
}
/**
* 生成AES密钥,返回字节数组, 默认长度为128位(16字节).
*/
public static String generateAesKeyString() {
return UtilEncode.encodeHex(generateAesKey(DEFAULT_AES_KEYSIZE));
}
/**
* 生成AES密钥,返回字节数组, 默认长度为128位(16字节).
*/
public static byte[] generateAesKey() {
return generateAesKey(DEFAULT_AES_KEYSIZE);
}
/**
* 生成AES密钥,可选长度为128,192,256位.
*/
public static byte[] generateAesKey(int keysize) {
try {
KeyGenerator keyGenerator = KeyGenerator.getInstance(AES);
keyGenerator.init(keysize);
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded();
} catch (GeneralSecurityException e) {
throw UtilException.unchecked(e);
}
}
/**
* 生成随机向量,默认大小为cipher.getBlockSize(), 16字节.
*/
public static byte[] generateIV() {
byte[] bytes = new byte[DEFAULT_IVSIZE];
random.nextBytes(bytes);
return bytes;
}
} | [
"mail@letters7.com"
] | mail@letters7.com |
2c1cb563055796d2b6be44261eb4759f2779bdc9 | 25b3ebc0cf24a3e28e05c5e76faba9dcc5bd8f88 | /src/org/joshy/gfx/node/control/Textbox.java | f4e92e20340c0cf2a987b02b2bed81eb3f9733fd | [] | no_license | joshmarinacci/aminojava | 24a1683a3994e3985299795ea19a99d3d093700e | 6dcddf6100518a7a7c1cb2027d3bbbd496bd5891 | refs/heads/master | 2016-09-06T17:55:34.673930 | 2013-05-20T23:46:38 | 2013-05-20T23:46:38 | 7,651,569 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,530 | java | package org.joshy.gfx.node.control;
import java.text.AttributedString;
import org.joshy.gfx.Core;
import org.joshy.gfx.css.BoxPainter;
import org.joshy.gfx.css.CSSMatcher;
import org.joshy.gfx.css.CSSSkin;
import org.joshy.gfx.css.SizeInfo;
import org.joshy.gfx.draw.FlatColor;
import org.joshy.gfx.draw.Font;
import org.joshy.gfx.draw.GFX;
import org.joshy.gfx.event.ActionEvent;
import org.joshy.gfx.event.Callback;
import org.joshy.gfx.event.EventBus;
import org.joshy.gfx.event.KeyEvent;
import org.joshy.gfx.node.Bounds;
import org.joshy.gfx.node.Insets;
import org.joshy.gfx.stage.Stage;
/**
* The Textbox is a text control for editing a single line of text.
* It will scroll the contents horizontally as needed.
*/
public class Textbox extends TextControl {
private SizeInfo sizeInfo;
private BoxPainter boxPainter;
private CharSequence hintText = "";
private FlatColor selectionColor;
private FlatColor cursorColor;
private AttributedString comp;
private FlatColor textColor;
public static void main(String ... args) throws Exception {
Core.init();
Core.getShared().defer(new Runnable(){
@Override
public void run() {
Stage stage = Stage.createStage();
Textbox tb = new Textbox();
stage.setContent(tb);
Core.getShared().getFocusManager().setFocusedNode(tb);
}
});
}
double xoff = 0;
public Textbox() {
setWidth(100);
setHeight(40);
}
public Textbox(String text) {
this();
setText(text);
}
public Textbox setHintText(CharSequence text) {
this.hintText = text;
return this;
}
@Override
protected double filterMouseX(double x) {
return x - xoff - 0 - styleInfo.calcContentInsets().getLeft();
}
@Override
protected double filterMouseY(double y) {
return y - styleInfo.calcContentInsets().getTop();
}
/* =========== Layout stuff ================= */
@Override
public void doPrefLayout() {
sizeInfo = cssSkin.getSizeInfo(this,styleInfo,text);
if(prefWidth != CALCULATED) {
setWidth(prefWidth);
sizeInfo.width = prefWidth;
} else {
setWidth(sizeInfo.width);
}
if(prefHeight != CALCULATED) {
setHeight(prefHeight);
sizeInfo.height = prefHeight;
} else {
setHeight(sizeInfo.height);
}
layoutText(sizeInfo.contentWidth,sizeInfo.contentHeight);
}
@Override
public void doLayout() {
layoutText(sizeInfo.contentWidth,sizeInfo.contentHeight);
sizeInfo.width = getWidth();
if(sizeInfo != null) {
sizeInfo.width = getWidth();
sizeInfo.height = getHeight();
}
CSSSkin.State state = CSSSkin.State.None;
if(isFocused()) {
state = CSSSkin.State.Focused;
}
boxPainter = cssSkin.createBoxPainter(this, styleInfo, sizeInfo, text, state);
CSSMatcher matcher = CSSSkin.createMatcher(this, state);
selectionColor = new FlatColor(cssSkin.getCSSSet().findColorValue(matcher,"selection-color"));
cursorColor = new FlatColor(cssSkin.getCSSSet().findColorValue(matcher,"cursor-color"));
textColor = new FlatColor(cssSkin.getCSSSet().findColorValue(matcher,"color"));
}
@Override
protected void cursorMoved() {
double cx = getCursor().calculateX();
Insets insets = styleInfo.calcContentInsets();
double fudge = getFont().getAscender();
double w = getWidth() - insets.getLeft() - insets.getRight();
//don't let jump get beyond 1/3rd of the width of the text box
double jump = Math.min(getFont().getAscender()*2,w/3);
if(cx >= w - fudge -xoff) {
xoff -= jump;
}
if(cx + xoff < fudge) {
xoff += jump;
if(xoff > 0) xoff = 0;
}
}
@Override
public double getBaseline() {
return styleInfo.calcContentInsets().getTop()+ styleInfo.contentBaseline;
}
@Override
public Bounds getLayoutBounds() {
return new Bounds(getTranslateX(), getTranslateY(), getWidth(), getHeight());
}
/* =============== Drawing stuff ================ */
@Override
public void draw(GFX g) {
if(!isVisible()) return;
//draw background and border, but skip the text
drawBackground(g);
Insets insets = styleInfo.calcContentInsets();
//set a new clip
Bounds oldClip = g.getClipRect();
g.setClipRect(new Bounds(
styleInfo.margin.getLeft()+styleInfo.borderWidth.getLeft(),
0,
getWidth() - insets.getLeft() - insets.getRight(),
getHeight()));
//filter the text
String text = getText();
text = text + getComposingText();
text = filterText(text);
//draw the selection
if(selection.isActive() && text.length() > 0) {
double start = getCursor().calculateX(0,selection.getStart());
double end = getCursor().calculateX(0,selection.getEnd());
if(end < start) {
double t = start;
start = end;
end = t;
}
g.setPaint(selectionColor);
g.fillRect(
insets.getLeft() + start + xoff,
insets.getTop(),
end-start,
getHeight()-insets.getTop()-insets.getBottom());
}
//draw the text
Font font = getFont();
double y = font.getAscender();
y+=insets.getTop();
double x = insets.getLeft();
if(!focused && text.length() == 0) {
g.setPaint(new FlatColor(0x6080a0));
g.drawText(hintText.toString(), getFont(), x + xoff, y);
}
g.setPaint(textColor);
g.drawText(text, getFont(), x + xoff, y);
//draw the composing underline
if(getComposingText().length() > 0) {
double underlineLen = font.calculateWidth(getComposingText());
g.setPaint(FlatColor.RED);
double fullLen = font.calculateWidth(text);
g.drawLine(x+xoff+fullLen-underlineLen,y+2,x+xoff+fullLen,y+2);
}
//draw the cursor
if(isFocused()) {
g.setPaint(cursorColor);
CursorPosition cursor = getCursor();
double cx = cursor.calculateX() + xoff;
// draw cursor
g.fillRect(
insets.getLeft()+cx, insets.getTop(),
1,
getHeight()-insets.getTop()-insets.getBottom());
}
//restore the old clip
g.setClipRect(oldClip);
}
protected void drawBackground(GFX g) {
boxPainter.draw(g, styleInfo, sizeInfo, "");
}
protected String filterText(String text) {
return text;
}
@Override
protected void processKeyEvent(KeyEvent event) {
if(event.getKeyCode() == KeyEvent.KeyCode.KEY_ENTER) {
ActionEvent act = new ActionEvent(ActionEvent.Action,this);
EventBus.getSystem().publish(act);
} else {
super.processKeyEvent(event);
}
}
public Textbox onAction(Callback<ActionEvent> callback) {
EventBus.getSystem().addListener(this,ActionEvent.Action,callback);
return this;
}
}
| [
"joshua@marinacci.org"
] | joshua@marinacci.org |
e3595420dd2de5bc574683a5e8a088eb80966643 | 26ff3f0dc6f38a254c47f2537f28061ed51d11d0 | /src/main/java/io/vepo/kafka/tool/inspect/KafkaAdminService.java | b53b79831e8e94f1d3da9bb988e4fea0c0cc804d | [
"MIT"
] | permissive | vepo/kafka-tool | ad16800ace8d4b848b9d42c0b18ac0ecbcc93961 | b65a81994592990f8528a8dda8ca5d6b48f156b9 | refs/heads/main | 2022-05-28T08:55:13.283460 | 2022-05-18T02:17:11 | 2022-05-18T02:17:11 | 346,550,524 | 1 | 0 | MIT | 2022-05-18T02:17:12 | 2021-03-11T02:12:00 | Java | UTF-8 | Java | false | false | 6,245 | java | package io.vepo.kafka.tool.inspect;
import static java.util.Arrays.asList;
import static java.util.Collections.emptyList;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static org.apache.kafka.clients.admin.RecordsToDelete.beforeOffset;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.ListOffsetsResult.ListOffsetsResultInfo;
import org.apache.kafka.clients.admin.OffsetSpec;
import org.apache.kafka.clients.admin.TopicDescription;
import org.apache.kafka.common.KafkaFuture;
import org.apache.kafka.common.TopicPartition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.vepo.kafka.tool.settings.KafkaBroker;
public class KafkaAdminService implements Closeable {
private static final Logger logger = LoggerFactory.getLogger(KafkaAdminService.class);
public enum BrokerStatus {
IDLE, CONNECTED
}
public interface KafkaConnectionWatcher {
public void statusChanged(BrokerStatus status);
}
private BrokerStatus status;
private AdminClient adminClient = null;
private ExecutorService executor = Executors.newSingleThreadExecutor();
private List<KafkaConnectionWatcher> watchers;
private KafkaBroker connectedBroker;
public KafkaAdminService() {
this.watchers = new ArrayList<>();
this.status = BrokerStatus.IDLE;
}
public BrokerStatus getStatus() {
return status;
}
public void connect(KafkaBroker kafkaBroker, Consumer<BrokerStatus> callback) {
executor.submit(() -> {
connectedBroker = kafkaBroker;
var properties = new Properties();
properties.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, kafkaBroker.getBootStrapServers());
adminClient = AdminClient.create(properties);
status = BrokerStatus.CONNECTED;
callback.accept(status);
watchers.forEach(consumer -> consumer.statusChanged(status));
});
}
public void watch(KafkaConnectionWatcher watcher) {
this.watchers.add(watcher);
}
public KafkaBroker connectedBroker() {
return connectedBroker.clone();
}
public void emptyTopic(TopicInfo topic) {
executor.submit(() -> {
logger.info("Cleaning topic... topic={}", topic);
if (nonNull(adminClient)) {
logger.info("Describing topic... topic={}", topic);
handle(adminClient.describeTopics(asList(topic.getName())).all(),
this::listOffsets,
error -> logger.error("Error describing topic!", error));
}
});
}
private static <T> void handle(KafkaFuture<T> operation, Consumer<T> successHandler,
Consumer<Throwable> errorHandler) {
operation.whenComplete((result, error) -> {
if (nonNull(error)) {
errorHandler.accept(error);
} else {
successHandler.accept(result);
}
});
}
private void listOffsets(Map<String, TopicDescription> descs) {
handle(adminClient.listOffsets(descs.values()
.stream()
.flatMap(desc -> desc.partitions()
.stream()
.map(partition -> new TopicPartition(desc.name(),
partition.partition())))
.collect(Collectors.toMap((TopicPartition t) -> t,
t -> OffsetSpec.latest())))
.all(),
this::deleteRecords,
error -> logger.error("Could not list offset!", error));
}
private void deleteRecords(Map<TopicPartition, ListOffsetsResultInfo> listOffsetResults) {
handle(adminClient.deleteRecords(listOffsetResults.entrySet()
.stream()
.collect(toMap(entry -> entry.getKey(),
entry -> beforeOffset(entry.getValue()
.offset()))))
.all(),
KafkaAdminService::ignore,
error -> logger.error("Error deleting records!", error));
}
private static <T> void ignore(T value) {
}
public void listTopics(Consumer<List<TopicInfo>> callback) {
executor.submit(() -> {
if (nonNull(adminClient)) {
adminClient.listTopics()
.listings()
.whenComplete((topics, error) -> {
if (isNull(error)) {
callback.accept(topics.stream()
.map(topic -> new TopicInfo(topic.name(), topic.isInternal()))
.collect(toList()));
} else {
callback.accept(emptyList());
}
});
} else {
callback.accept(emptyList());
}
});
}
@Override
public void close() {
logger.info("Closing client...");
connectedBroker = null;
if (nonNull(adminClient)) {
adminClient.close();
}
}
}
| [
"victor.osorio@openet.com"
] | victor.osorio@openet.com |
935ca72ab41701cbf954d8a1a6800ec4cc392bfb | a257713804c4fa85eef46e47cbc5a0e6cdade150 | /app/src/main/java/com/teambition/talk/entity/Quote.java | cc6fb8dc8ff7a96562dc807c664e17388eb4b47d | [
"MIT"
] | permissive | megadotnet/talk-android | 50aa919b3041840953672fbe588caa59252cd06c | 828ba5c2e72284d7790705bc156cc20d84a605bc | refs/heads/master | 2020-03-09T04:13:54.084431 | 2018-04-08T01:50:57 | 2018-04-08T01:50:57 | 128,582,337 | 0 | 0 | MIT | 2018-04-08T01:05:49 | 2018-04-08T01:05:49 | null | UTF-8 | Java | false | false | 1,963 | java | package com.teambition.talk.entity;
import com.teambition.talk.util.StringUtil;
import org.parceler.Parcel;
/**
* Created by zeatual on 14/11/5.
*/
@Parcel(Parcel.Serialization.BEAN)
public class Quote {
String openId;
String text;
String authorName;
String authorAvatarUrl;
String redirectUrl;
String title;
String category;
String thumbnailPicUrl;
String imageUrl;
public String getOpenId() {
return openId;
}
public void setOpenId(String openId) {
this.openId = openId;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getAuthorAvatarUrl() {
return authorAvatarUrl;
}
public void setAuthorAvatarUrl(String authorAvatarUrl) {
this.authorAvatarUrl = authorAvatarUrl;
}
public String getRedirectUrl() {
return redirectUrl;
}
public void setRedirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getThumbnailPicUrl() {
return thumbnailPicUrl;
}
public void setThumbnailPicUrl(String thumbnailPicUrl) {
this.thumbnailPicUrl = thumbnailPicUrl;
}
public String getThumbnailUrl() {
if (StringUtil.isNotBlank(getThumbnailPicUrl())) {
return getThumbnailPicUrl();
} else if (StringUtil.isNotBlank(imageUrl)) {
return imageUrl;
}
return null;
}
}
| [
"wlanjie888@gmail.com"
] | wlanjie888@gmail.com |
c2e9a9056256e4c3e227452b4d753ca1b21b5fe1 | c90538cd8e95644776a8dd4c8f29c153d6fb71ce | /Common/src/messages/GetStaticMapMsg.java | ca0ba5a0d80e761e36d2d724da94acbb1f82550f | [] | no_license | grimmle/point-n-shoot | 43d9a37e9b027709bdc8c6463ed5b5fc6dea4077 | 7ae96f850a74465e50c146333db70c7b21336e06 | refs/heads/main | 2023-06-18T19:23:33.427961 | 2021-07-12T16:44:00 | 2021-07-12T16:44:00 | 313,705,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package messages;
import common.Msg;
public class GetStaticMapMsg implements Msg {
private static final long serialVersionUID = 8576917706186946304L;
public int id;
public Object staticMap;
public Object dynamic;
}
| [
"lennard@netinn.de"
] | lennard@netinn.de |
6ba3b6386ecaf96022cfd6fc836d32be7516cda0 | 306578f3c6d15e0d4b4600c60ce8c827638a3d21 | /src/test/java/insat/gl4/cookme/CookMeApplicationTests.java | 6c775b91e685826e5a118f52f2f7ef43bc8036c5 | [] | no_license | mmmarzouki/cook-me_backend | 982252528869e8e53e4526b36e08204359a02775 | 6ef5728cea986d7bcf809e609c036ed0b5dce429 | refs/heads/master | 2020-04-27T00:24:53.078036 | 2019-05-01T11:38:27 | 2019-05-01T11:38:27 | 173,933,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package insat.gl4.cookme;
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 CookMeApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"mmmarzouki@gmail.com"
] | mmmarzouki@gmail.com |
a492a9b2b49fe2a2f432401d0da10322ead89738 | 84f6d0c1cf9afe7a54c1b0e22708a3310c04453c | /src/main/java/com/fmx/tool/hdfsfilemanager/app/treeviewer/action/Rename.java | 3bd12b182e31c30dcf422e2568b4da1146f2eaa2 | [
"MIT"
] | permissive | FMX/HdfsFileManager | e2987273a609676318a89b017c27c71bc593aaed | 77fa02fd27b3b2214e756f725f8c0d06ac264478 | refs/heads/master | 2020-04-03T01:43:33.746493 | 2018-10-31T05:44:54 | 2018-10-31T05:44:54 | 154,938,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package com.fmx.tool.hdfsfilemanager.app.treeviewer.action;
import org.eclipse.jface.action.Action;
/**
*/
public class Rename extends Action {
}
| [
"fmxfmx@outlook.com"
] | fmxfmx@outlook.com |
6b5a61ea960befd01c249d88ed76dd163c026408 | 7d940553cf07c8c4c644c6f890328c61c82c16ad | /app/src/main/java/gnosisdevelopment/arduinobtweatherstation/DBHelper.java | 5314b88e9a7c4c7370cb9bef8b411cc990e02510 | [
"CC-BY-3.0"
] | permissive | JamesHarley/BTWeatherStation | d19341293cbf806ba064674ed8b39e4fc40053d3 | 7d76953a0565152b37b12a42a4843b78ef5f206a | refs/heads/master | 2020-03-22T13:09:56.343529 | 2018-08-15T22:10:02 | 2018-08-15T22:10:02 | 140,088,113 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,066 | java | package gnosisdevelopment.arduinobtweatherstation;
import java.util.ArrayList;
import java.util.HashMap;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class DBHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "BTWeather.db";
public static final String PREFS_TABLE_NAME = "prefs";
public static final String PREFS_COLUMN_ID = "id";
public static final String PREFS_COLUMN_TEMPSTATE = "tempstate";
public static final String PREFS_COLUMN_HUMIDSTATE = "humidstate";
public static final String PREFS_COLUMN_WINDSTATE = "windstate";
public static final String PREFS_COLUMN_BTDEVICE = "btdevice";
public static final String PREFS_COLUMN_CELSIUS = "celsius";
public static final String PREFS_COLUMN_UPDATE_INTERVAL = "interval";
private HashMap hp;
public DBHelper(Context context) {
super(context, DATABASE_NAME , null, 1);
Log.d("BTWeather - DB", "db init");
}
@Override
public void onCreate(SQLiteDatabase db) {
Log.d("BTWeather - DB", "create db");
db.execSQL(
"create table prefs " +
"(id integer primary key, tempstate boolean,humidstate boolean, windstate boolean,btdevice text, celsius boolean,interval integer)"
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS prefs");
onCreate(db);
}
public boolean insertPrefs (Boolean tempstate,Boolean humidstate, Boolean windstate, String btdevice, Boolean celsius, int interval) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("tempstate", tempstate);
contentValues.put("humidstate", humidstate);
contentValues.put("windstate", windstate);
contentValues.put("btdevice", btdevice);
contentValues.put("celsius", celsius);
contentValues.put("interval", interval);
db.insert("prefs", null, contentValues);
Log.d("BTWeather - DB", "insert db");
return true;
}
public Cursor getData(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs where id="+id+"", null );
return res;
}
public int numberOfRows(){
SQLiteDatabase db = this.getReadableDatabase();
int numRows = (int) DatabaseUtils.queryNumEntries(db, PREFS_TABLE_NAME);
return numRows;
}
public boolean updateContact (Integer id, Boolean tempstate,Boolean humidstate, Boolean windstate, String btdevice, Boolean celsius, int interval) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("tempstate", tempstate);
contentValues.put("humidstate", humidstate);
contentValues.put("windstate", windstate);
contentValues.put("btdevice", btdevice);
contentValues.put("celsius", celsius);
contentValues.put("interval", interval);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
return true;
}
public Integer deletePrefs (Integer id) {
SQLiteDatabase db = this.getWritableDatabase();
return db.delete("prefs",
"id = ? ",
new String[] { Integer.toString(id) });
}
public ArrayList<String> getAllPrefs() {
ArrayList<String> array_list = new ArrayList<String>();
//hp = new HashMap();
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs", null );
res.moveToFirst();
while(res.isAfterLast() == false){
array_list.add(res.getString(res.getColumnIndex(PREFS_COLUMN_ID)));
res.moveToNext();
}
return array_list;
}
public boolean isEmpty(){
if( numberOfRows() >0){
return false;
}
else
return true;
}
public boolean updateTempState(Integer id, boolean tempstate){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("tempstate", tempstate);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
Log.d("BTWeather - DB", "update tempstate");
return true;
}
public boolean updateHumidState(Integer id, boolean humidstate){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("humidstate", humidstate);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
Log.d("BTWeather - DB", "update humid state");
return true;
}
public boolean updateWindState(Integer id, boolean windstate){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("windstate", windstate);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
Log.d("BTWeather - DB", "update windstate");
return true;
}
public boolean updateBT(Integer id, String btdevice){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("btdevice", btdevice);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
return true;
}
public boolean updateCelsius(Integer id, boolean celsius){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("celsius", celsius);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
Log.d("BTWeather - DB", "update celsius");
return true;
}
public boolean updateInterval(Integer id, int interval){
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("interval", interval);
db.update("prefs", contentValues, "id = ? ", new String[] { Integer.toString(id) } );
Log.d("BTWeather - DB", "update interval");
return true;
}
public int getHumidState(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getInt(res.getColumnIndex(DBHelper.PREFS_COLUMN_HUMIDSTATE));}
catch (Exception e ){Log.d("BTWeather-getHumidState", String.valueOf(e));}
return 1;
}
public int getTempState(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getInt(res.getColumnIndex(DBHelper.PREFS_COLUMN_TEMPSTATE));}
catch (Exception e ){Log.d("BTWeatherget-TempState", String.valueOf(e));}
return 1;
}
public int getWindState(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getInt(res.getColumnIndex(DBHelper.PREFS_COLUMN_WINDSTATE));}
catch (Exception e ){Log.d("BTWeatherget-WindState", String.valueOf(e));}
return 1;
}
public String getBTDevice(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getString(res.getColumnIndex(DBHelper.PREFS_COLUMN_BTDEVICE));}
catch (Exception e ){Log.d("BTWeather - getBTDevice", String.valueOf(e));}
return "";
}
public int getCelsius(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getInt(res.getColumnIndex(DBHelper.PREFS_COLUMN_CELSIUS));}
catch (Exception e ){Log.d("BTWeather - getCelsius", String.valueOf(e));}
return 1;
}
public int getInterval(){
try{
SQLiteDatabase db = this.getReadableDatabase();
Cursor res = db.rawQuery( "select * from prefs ",null );
res.moveToFirst();
return res.getInt(res.getColumnIndex(DBHelper.PREFS_COLUMN_UPDATE_INTERVAL));}
catch (Exception e ){Log.d("BTWeatherget-interval", String.valueOf(e));}
return -1;
}
} | [
"jahsnote5@gmail.com"
] | jahsnote5@gmail.com |
4af02b188a9de55975f9765c9cb3a41a933681d4 | f7055526843b8de39ce5678f6fcad903406be5f6 | /server/src/main/java/eu/livotov/labs/webskel/core/quartz/guice/InjectorJobFactory.java | 8f56ff825bf382d9ef9783701bc757a3f9429114 | [] | no_license | lbanas/WebApplicationSkeleton | f39271cb4f524cfacb543558b2c8293a7e1ac55e | 3b44373ee50edca2f2fac6f0eccefec4ed4c68ba | refs/heads/master | 2021-01-18T14:36:49.725803 | 2015-11-04T08:16:38 | 2015-11-04T08:16:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,692 | java | /*
* Copyright 2015 Livotov Labs Ltd.
* Copyright 2009-2012 The 99 Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.livotov.labs.webskel.core.quartz.guice;
import com.google.inject.Injector;
import org.quartz.Job;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.spi.JobFactory;
import org.quartz.spi.TriggerFiredBundle;
import javax.inject.Inject;
/**
* A {@code JobFactory} implementation that delegates Guice creating {@code Job} instances.
*/
final class InjectorJobFactory implements JobFactory
{
/**
* The delegated {@link Injector}.
*/
@Inject
private Injector injector;
/**
* Set the delegated {@link Injector}.
*
* @param injector The delegated {@link Injector}
*/
public void setInjector(Injector injector)
{
this.injector = injector;
}
/**
* {@inheritDoc}
*/
public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler)
throws SchedulerException
{
Class<? extends Job> jobClass = bundle.getJobDetail().getJobClass();
return this.injector.getInstance(jobClass);
}
}
| [
"dmitri@livotov.eu"
] | dmitri@livotov.eu |
e0b5ffcfb891b84cd3a68236654e4e83f0e5a073 | 79b318ac1e234378169fbf96d62f2d4cfcbb52fd | /phonedrohne/Quaternion/src/ch/sharpsoft/quaternion/util/Quaternion.java | ecd058862dea4b29b81770ad9950fa0afb1373b5 | [] | no_license | helios57/phonedrone | 0e508ced1b91d6ce245cba04031c2e6dab65a16e | 9a23565fa535ccedc0b364ecefea22eadba5fdc9 | refs/heads/master | 2021-01-10T10:44:03.958737 | 2013-07-24T13:15:07 | 2013-07-24T13:15:07 | 36,993,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,283 | java | package ch.sharpsoft.quaternion.util;
import ch.sharpsoft.quaternion.v1.Vector3;
public class Quaternion {
private final float w, x, y, z;
public Quaternion(float[] q) {
this.w = q[0];
this.x = q[1];
this.y = q[2];
this.z = q[3];
}
public Quaternion(float w, float x, float y, float z) {
this.w = w;
this.x = x;
this.y = y;
this.z = z;
}
public double norm() {
return Math.sqrt(w * w + x * x + y * y + z * z);
}
public Quaternion normalize() {
final double norm = norm();
return new Quaternion((float) (w / norm), (float) (x / norm),
(float) (y / norm), (float) (z / norm));
}
public Quaternion conjugate() {
return new Quaternion(w, -x, -y, -z);
}
public Quaternion plus(Quaternion b) {
return new Quaternion(w + b.w, x + b.x, y + b.y, z + b.z);
}
// return a new Quaternion whose value is (this * b)
public Quaternion multiply(Quaternion b) {
float w0 = w * b.w - x * b.x - y * b.y - z * b.z;
float x0 = w * b.x + x * b.w + y * b.z - z * b.y;
float y0 = w * b.y - x * b.z + y * b.w + z * b.x;
float z0 = w * b.z + x * b.y - y * b.x + z * b.w;
return new Quaternion(w0, x0, y0, z0);
}
public Vector3 multiply(final Vector3 vec) {
Quaternion vecQuat = new Quaternion(0.0f, vec.getX(), vec.getY(),
vec.getZ());
Quaternion resQuat = multiply(vecQuat).multiply(conjugate());
return (new Vector3(resQuat.x, resQuat.y, resQuat.z));
}
public static Quaternion fromAxis(Vector3 v, float angle) {
Vector3 vn = v.normalize();
float sinAngle = (float) Math.sin(angle / 2);
float x = (vn.getX() * sinAngle);
float y = (vn.getY() * sinAngle);
float z = (vn.getZ() * sinAngle);
float w = (float) Math.cos(angle / 2);
return new Quaternion(w, x, y, z);
}
/**
*
* @param pitch
* in radiants
* @param yaw
* in radiants
* @param roll
* in radiants
* @return
*/
public static Quaternion fromEuler(float pitch, float yaw, float roll) {
// Basically we create 3 Quaternions, one for pitch, one for yaw, one
// for roll
// and multiply those together.
// the calculation below does the same, just shorter
float p = (float) (pitch / 2.0);
float y = (float) (yaw / 2.0);
float r = (float) (roll / 2.0);
float sinp = (float) Math.sin(p);
float siny = (float) Math.sin(y);
float sinr = (float) Math.sin(r);
float cosp = (float) Math.cos(p);
float cosy = (float) Math.cos(y);
float cosr = (float) Math.cos(r);
float _x = sinr * cosp * cosy - cosr * sinp * siny;
float _y = cosr * sinp * cosy + sinr * cosp * siny;
float _z = cosr * cosp * siny - sinr * sinp * cosy;
float _w = cosr * cosp * cosy + sinr * sinp * siny;
return new Quaternion(_w, _x, _y, _z).normalize();
}
public float getW() {
return w;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getZ() {
return z;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Float.floatToIntBits(w);
result = prime * result + Float.floatToIntBits(x);
result = prime * result + Float.floatToIntBits(y);
result = prime * result + Float.floatToIntBits(z);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Quaternion other = (Quaternion) obj;
if (Float.floatToIntBits(w) != Float.floatToIntBits(other.w))
return false;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Float.floatToIntBits(other.y))
return false;
if (Float.floatToIntBits(z) != Float.floatToIntBits(other.z))
return false;
return true;
}
@Override
public String toString() {
return "Q [w=" + String.format("%.4f", w) + ", x="
+ String.format("%.4f", x) + ", y=" + String.format("%.4f", y)
+ ", z=" + String.format("%.4f", z) + "]";
}
public float[] getFloatArray() {
return new float[]{w,x,y,z};
}
public float[] getFloatArrayXYZW() {
return new float[]{x,y,z,w};
}
}
| [
"Helios"
] | Helios |
9ec328d6c229d2538f28978380908afbbc0e9034 | 65eef6677a132162d8e6ba055c0d1b79982be5a3 | /src/DPLL.java | 4c4d8b2199e0cfa57086bba1c7ec3ab3d086bb64 | [] | no_license | ejmejm/Inferencer | 62cb797773b4321dce5f5f7883a5e86c45e8d873 | e3e42ffbf6e344e5a0450b3191e285aed39ce948 | refs/heads/master | 2020-05-18T14:31:16.880388 | 2017-03-08T02:15:27 | 2017-03-08T02:15:27 | 84,247,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,590 | java | import java.util.ArrayList;
import java.util.LinkedList;
public class DPLL {
public static boolean entails(Model model, Statement statement){
State state = new State(model);
ArrayList<State> leafNodes = state.getLeafNodes(state);
boolean entails = true;
for(State node : leafNodes){
if(!node.entails(statement))
entails = false;
}
return entails;
}
public static void printEntails(Model model, Statement statement){
boolean result = entails(model, statement);
if(result)
System.out.println("DPLL: Statement, \"" + statement.getLabel() + "\" is entailed");
else
System.out.println("DPLL: Statement, \"" + statement.getLabel() + "\" is NOT entailed");
}
public static void printTree(Model model){
State state = new State(model);
LinkedList<State> q = new LinkedList<State>();
q.addLast(state);
int cnt = 0;
while(!q.isEmpty()){
State tmp = q.pop();
if(tmp.statement != null)
System.out.println("(" + cnt + ") " + tmp.statement.getLabel() + ": " + tmp.statement.getValue());
if(tmp.children != null && !tmp.children.isEmpty())
for(int i = 0; i < tmp.children.size(); i++)
q.addFirst(tmp.children.get(i));
cnt++;
}
}
private static class State{
Statement statement;
ArrayList<Statement> knownStms;
ArrayList<State> children;
Model model;
public State(Model model){
this.model = model;
knownStms = new ArrayList<Statement>();
statement = null;
children = genAncestors(model);
}
public State(Model model, ArrayList<Statement> knownStms, Statement statement){
this.model = model;
this.knownStms = knownStms;
this.statement = statement;
children = genAncestors(model);
}
public ArrayList<State> genAncestors(Model model){
if(knownStms.size() == model.variables.size())//Maybe do something here
return null;
ArrayList<State> ancestors = new ArrayList<State>();
Statement ancestorStmt = model.getStatementByIndex(knownStms.size());
if(ancestorStmt.isKnown())
ancestors.add(copyHist(ancestorStmt));
else{
ancestors.add(copyHist(ancestorStmt));
ancestors.add(copyHist(ancestorStmt.getSwitchedValue()));
}
if(ancestors.size() == 0)
return null;
return ancestors;
}
private State copyHist(Statement nStatement){
ArrayList<Statement> nKnownStms = new ArrayList<Statement>();
for(Statement s : knownStms)
nKnownStms.add(s);
nKnownStms.add(statement);
return new State(model, nKnownStms, nStatement);
}
public ArrayList<State> getLeafNodes(State state){
ArrayList<State> leafNodes = new ArrayList<State>();
LinkedList<State> q = new LinkedList<State>();
q.addLast(state);
while(!q.isEmpty()){
State tmp = q.pop();
if(tmp.children != null && !tmp.children.isEmpty())
for(int i = 0; i < tmp.children.size(); i++)
q.addLast(tmp.children.get(i));
else{
tmp.knownStms.add(tmp.statement);
leafNodes.add(tmp);
}
}
return leafNodes;
}
private boolean constraintsMet(){
for(Relation r : model.relations) //Make sure constraints are met
if(r.isKnown() && calcValue(r, knownStms) != r.value)
return false; //Return false if one of them is not met
return true; //Otherwise they are all met
}
public boolean entails(Statement statement){
if(constraintsMet() && calcValue(statement, knownStms) != true) //Make sure statement is entailed
return false;
return true;
}
}
private static boolean calcValue(Statement s, ArrayList<Statement> knownStms){
//If the statement is a variable
if(s instanceof Variable){
for(Statement stm : knownStms)
if(stm != null && stm.equals(s))
return stm.value;
System.err.println("ERROR: The variable \"" + s.getLabel() + "\" was not found in the tree but it was in a relationship");
}
//If the statement is a relationship
Relation r = (Relation) s;
/*
boolean p1 = false, p2 = false;
boolean p1k = false, p2k = false;
for(Statement stm : knownStms){
if(stm.equals(r.getS1())){
p1 = stm.value;
p1k = true;
}
if(!r.isAtomic() && stm.equals(r.getS2())){
p2 = stm.value;
p2k = true;
}
}
//If the parts of r1 are not variables then recursively calculate the value of
if(p1k == false)
p1 = calcValue(r.getS1(), knownStms);
if(!r.isAtomic() && p2k == false)
p2 = calcValue(r.getS2(), knownStms);
*/
if(r.isAtomic())
return r.calcValue(calcValue(r.getS1(), knownStms));
return r.calcValue(calcValue(r.getS1(), knownStms), calcValue(r.getS2(), knownStms));
}
}
| [
"ninjaedan@aol.com"
] | ninjaedan@aol.com |
4d7a80afb58a006ecdc778af976c6479203a3751 | faef44ab5a4bfceb292fcf8180c19ef94e84c3ec | /src/main/java/reservation_front/service/impl/TableServiceProxy.java | 505c4f5c42e2dce86d86bdc7ace5ea3c119c2acf | [] | no_license | youyou19/restaurant-reservation-front | 1f3501b650218fd17dcf94796502aff192f8d1d4 | 8a3629cd1fcd60464a09c1a2147fadb5ed9b8ed3 | refs/heads/master | 2022-11-04T14:44:10.725570 | 2020-06-24T07:15:30 | 2020-06-24T07:15:30 | 274,586,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,604 | java | package reservation_front.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import reservation_front.domain.DiningTable;
import reservation_front.dto.DiningTableDto;
import reservation_front.service.TableService;
import java.util.List;
@Service
public class TableServiceProxy implements TableService {
@Autowired
private RestTemplate restTemplate;
private final String ONE_URL = "http://localhost:8088/dining-tables/{id}";
private final String ALL_URL = "http://localhost:8088/dining-tables/";
@Override
public DiningTable get(Long id) {
return restTemplate.getForObject(ONE_URL, DiningTable.class, id);
}
@Override
public List<DiningTable> getAll() {
ResponseEntity<List<DiningTable>> response =
restTemplate.exchange(ALL_URL, HttpMethod.GET, null,
new ParameterizedTypeReference<List<DiningTable>>() {
});
return response.getBody();
}
@Override
public DiningTable add(DiningTableDto p) {
return restTemplate.postForObject(ALL_URL, p, DiningTable.class);
}
@Override
public void update(Long id, DiningTable p) {
restTemplate.put(ONE_URL, p, id);
}
@Override
public void delete(Long id) {
restTemplate.delete(ONE_URL, id);
}
}
| [
"juleswilfrid9@gmail.com"
] | juleswilfrid9@gmail.com |
2d557386ebb2132401429e87c685e71e693d9406 | e2bd16f6feb9d64b7e04fca41ae86485b46afa43 | /app/src/main/java/com/example/servicesample/MainActivity.java | 354b15ff5e14b6b42870a8e074bb4cbc3e33f510 | [] | no_license | KoshiDra/android_ServiceSample2 | 69095a9456a89b3c1f3f80539da7d02889ed49b7 | 0df3f680f6ca41e1c111969492340962a04802f0 | refs/heads/main | 2023-06-03T18:07:30.980841 | 2021-06-27T09:53:35 | 2021-06-27T09:53:35 | 380,159,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,988 | java | package com.example.servicesample;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 通知タップから引継ぎデータを取得
Intent intent = getIntent();
boolean fromNotification = intent.getBooleanExtra("fromNotification", false);
if (fromNotification) {
Button btPlay = findViewById(R.id.btPlay);
Button btStop = findViewById(R.id.btStop);
btPlay.setEnabled(false);
btStop.setEnabled(true);
}
}
/**
* 再生ボタン押下時の処理
* @param view
*/
public void onPlayButtonClick(View view) {
// インテント作成
Intent intent = new Intent(MainActivity.this, SoundManageService.class);
// サービス開始
startService(intent);
// 開始と終了ボタンの押下制御
Button btPlay = findViewById(R.id.btPlay);
Button btStop = findViewById(R.id.btStop);
btPlay.setEnabled(false);
btStop.setEnabled(true);
}
/**
* 停止ボタン押下時の処理
* @param view
*/
public void onStopButtonClick(View view) {
// インテント作成
Intent intent = new Intent(MainActivity.this, SoundManageService.class);
// サービス停止
stopService(intent);
// 開始と終了ボタンの押下制御
Button btPlay = findViewById(R.id.btPlay);
Button btStop = findViewById(R.id.btStop);
btPlay.setEnabled(true);
btStop.setEnabled(false);
}
} | [
"koshidradev@gmail.com"
] | koshidradev@gmail.com |
f006ba31355a3220bd209139230151d1204d6e20 | bb144a9a3691eda39cf72954c32371b62a87cf34 | /src/weeksix/tuesday/challenges/stock_control_system/Order.java | 5f80611707d3dde21d2a1bc3c7af1955dcea523e | [] | no_license | RobertWatkin/GatesHeadCollege | 6ef500031c1013d30edb3887ed531a80fac3c928 | 90a77338da41248c4ebb0ea5e06ba3d2135f2cef | refs/heads/master | 2022-02-28T20:40:23.370215 | 2019-10-14T09:18:39 | 2019-10-14T09:18:39 | 214,985,406 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 544 | java | /*
Written By : Robert Watkin
Date Created : 08/10/2019
*/
package weeksix.tuesday.challenges.stock_control_system;
import java.util.Date;
public class Order {
// Variable Declaration
private int orderID;
private int customerID;
private int quantity;
private Date orderDate;
// Constructor
public Order(int orderID, int customerID, int quantity, Date orderDate) {
this.orderID = orderID;
this.customerID = customerID;
this.quantity = quantity;
this.orderDate = orderDate;
}
}
| [
"robert.watkin@accenture.com"
] | robert.watkin@accenture.com |
d0798e0d4a39d4e6cad40bdcd5e110f66c120c17 | a69254f9f84bba6facc3ffa940ba2e540627d77b | /core/src/main/java/org/jdal/text/PeriodFormatAnnotationFactory.java | 40db674d04b65b778042e4a315207c62dc959910 | [
"Apache-2.0"
] | permissive | chelu/jdal | 3250423e5eaaf5571d6f85045c759abe12adff1f | 2c20b4a7e506d97487a075cd4fa5809e088670cd | refs/heads/master | 2023-03-07T14:09:26.124132 | 2018-05-22T18:52:30 | 2018-05-22T18:52:30 | 13,729,407 | 21 | 12 | null | 2017-01-25T12:20:48 | 2013-10-21T00:10:59 | Java | UTF-8 | Java | false | false | 1,923 | java | /*
* Copyright 2009-2012 Jose Luis Martin.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdal.text;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.springframework.format.AnnotationFormatterFactory;
import org.springframework.format.Formatter;
import org.springframework.format.Parser;
import org.springframework.format.Printer;
/**
* PeriodFormat Annotation Factory.
*
* @author Jose Luis Martin - (jlm@joseluismartin.info)
*/
public class PeriodFormatAnnotationFactory implements AnnotationFormatterFactory<PeriodFormat> {
/**
* {@inheritDoc}
*/
public Set<Class<?>> getFieldTypes() {
return new HashSet<Class<?>>(Arrays.asList(new Class<?>[] {
Short.class, Integer.class, Long.class, Float.class,
Double.class, BigDecimal.class, BigInteger.class }));
}
/**
* {@inheritDoc}
*/
public Printer<?> getPrinter(PeriodFormat annotation, Class<?> fieldType) {
return getFormatter(annotation, fieldType);
}
/**
* {@inheritDoc}
*/
public Parser<?> getParser(PeriodFormat annotation, Class<?> fieldType) {
return getFormatter(annotation, fieldType);
}
/**
* @param annotation
* @param fieldType
* @return
*/
protected Formatter<?> getFormatter(PeriodFormat annotation, Class<?> fieldType) {
return new PeriodFormatter();
}
}
| [
"jlm@joseluismartin.info"
] | jlm@joseluismartin.info |
1da6b3861087983a819e97a6a0009b9d1eacb50f | 4953bb4beb49ae211c4487605668269fb437d2a1 | /src/main/java/com/api/scgapi/models/ApiResponseModel.java | 5d5165d86b97592673d58d43a1e3201f37326c72 | [] | no_license | supacheep-first/scg-api | af09b4aa443d585b0a9243b535b82d09906547bb | c4fe62ade17d6d3348e1baadf41b03fb864319c9 | refs/heads/master | 2023-01-19T01:53:08.923461 | 2020-11-20T06:03:13 | 2020-11-20T06:03:13 | 314,455,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.api.scgapi.models;
import lombok.Data;
import org.springframework.http.HttpStatus;
@Data
public class ApiResponseModel {
private HttpStatus status;
private String body;
}
| [
"first.supacheep@gmail.com"
] | first.supacheep@gmail.com |
710d3fdba96c000a19da5c30b7b948d1547a12fa | ddaede1300f7b125f8c2fd2608e850127b69ffe9 | /JavaExercise/src/main/java/thread/synchronizedDemo/TestMethod.java | 88d5052d8f6477234a342b50915e54807f142746 | [] | no_license | lojack636/DEMO | 6ef57ad454161e3677a8ab8dd4cfa9b284172664 | 3d11c1bc26bfb9478bd9455fce250ef1169a7c49 | refs/heads/master | 2023-01-15T21:40:15.999114 | 2020-11-23T14:58:45 | 2020-11-23T14:58:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | package thread.synchronizedDemo;
/**
* 测试Synchronized
*
* @author qiang
*
*/
public class TestMethod implements Runnable {
private static int number;
TestMethod() {
number = 0;
}
// 修饰非静态的方法
public static synchronized void m1() {
for (int i = 0; i < 3; i++) {
try {
System.out.println(Thread.currentThread().getName() + ":" + (number++));
Thread.sleep(200);
} catch (Exception e) {
System.out.println("异常");
}
}
}
public static synchronized void m2() {//此时方法属于类
for (int i = 0; i < 3; i++) {
try {
System.out.println(Thread.currentThread().getName() + ":" + (number++));
Thread.sleep(200);
} catch (Exception e) {
System.out.println("异常");
}
}
}
@Override
public void run() {
String name = Thread.currentThread().getName();
if (name.equalsIgnoreCase("thread1")) {
m1();
} else {
m2();
}
}
public static void main(String[] args) {
TestMethod testMethod = new TestMethod();
Thread thread1 = new Thread(testMethod,"thread1");
Thread thread2 = new Thread(testMethod,"thread2");
thread1.start();
thread2.start();
}
} | [
"2422321558@qq.com"
] | 2422321558@qq.com |
b3eed91ec6cdee6d1e191ad267e8d5094dfdaf7d | 757ff0e036d1c65d99424abb5601012d525c2302 | /sources/com/fimi/album/widget/CustomVideoView.java | 0352c22c5f2e58d79076fe1e9b0041910ec6217f | [] | no_license | pk1z/wladimir-computin-FimiX8-RE-App | 32179ef6f05efab0cf5af0d4957f0319abe04ad0 | 70603638809853a574947b65ecfaf430250cd778 | refs/heads/master | 2020-11-25T21:02:17.790224 | 2019-12-18T13:28:48 | 2019-12-18T13:28:48 | 228,845,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,905 | java | package com.fimi.album.widget;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.SurfaceTexture;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnBufferingUpdateListener;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnInfoListener;
import android.media.MediaPlayer.OnPreparedListener;
import android.media.MediaPlayer.OnSeekCompleteListener;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.example.album.R;
import com.fimi.kernel.utils.LogUtil;
import java.util.Formatter;
import java.util.Locale;
public class CustomVideoView extends RelativeLayout implements OnClickListener, SurfaceTextureListener, OnPreparedListener, OnCompletionListener, OnInfoListener, OnErrorListener, OnBufferingUpdateListener, OnSeekBarChangeListener {
private static final int LOAD_TOTAL_COUNT = 3;
private static final int STATE_ERROR = 1;
private static final int STATE_IDLE = 0;
private static final int STATE_PAUSE = 2;
private static final int STATE_PLAYING = 1;
private static final String TAG = "CustomVideoView";
private static final int TIME_INVAL = 1000;
private static final int TIME_MSG = 1;
private static float VIDEO_HEIGHT_PERCENT = 0.5625f;
private AudioManager audioManager;
private boolean canPlay = true;
private boolean isMute;
private boolean isUpdateProgressed = false;
private VideoPlayerListener listener;
private RelativeLayout mBottomPlayRl;
private int mCurrentCount;
private TextView mCurrentTimeTv;
private int mDestationHeight;
private StringBuilder mFormatBuilder;
private Formatter mFormatter;
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 1:
if (CustomVideoView.this.isPlaying()) {
if (!CustomVideoView.this.isUpdateProgressed) {
int currentPosition = (int) (Math.round(((double) CustomVideoView.this.getCurrentPosition()) / 1000.0d) * 1000);
CustomVideoView.this.mPlaySb.setProgress(currentPosition);
CustomVideoView.this.mCurrentTimeTv.setText(CustomVideoView.this.setTimeFormatter(currentPosition));
}
if (CustomVideoView.this.listener != null) {
CustomVideoView.this.listener.onBufferUpdate(CustomVideoView.this.getCurrentPosition());
}
sendEmptyMessageDelayed(1, 1000);
return;
}
return;
default:
return;
}
}
};
private boolean mIsComplete;
private boolean mIsRealPause;
private ProgressBar mLoadingBar;
private ImageButton mMiniPlayBtn;
private ViewGroup mParentContainar;
private ImageButton mPlayBackIBtn;
private SeekBar mPlaySb;
private RelativeLayout mPlayerView;
private ScreenEventReciver mScreenEventReciver;
private int mScreenWidth;
private LinearLayout mTopBarLl;
private TextView mTotalTimeTv;
private String mUrl;
private TextureView mVideoView;
private MediaPlayer mediaPlayer;
private TextView nameTv;
private int playerState = 0;
private int showTopBottomBarTime = 0;
private Surface videoSurface;
public interface VideoPlayerListener {
void onAdVideoLoadComplete();
void onAdVideoLoadFailed();
void onAdVideoLoadSuccess();
void onBufferUpdate(int i);
void onClickBackBtn();
void onClickFullScreenBtn();
void onClickPlay();
void onClickVideo();
}
public interface ADFrameImageLoadListener {
void onStartFrameLoad(String str, ImageLoaderListener imageLoaderListener);
}
public interface ImageLoaderListener {
void onLoadingComplete(Bitmap bitmap);
}
private class ScreenEventReciver extends BroadcastReceiver {
private ScreenEventReciver() {
}
/* synthetic */ ScreenEventReciver(CustomVideoView x0, AnonymousClass1 x1) {
this();
}
public void onReceive(Context context, Intent intent) {
Log.i(CustomVideoView.TAG, "onReceive: " + intent.getAction());
String action = intent.getAction();
Object obj = -1;
switch (action.hashCode()) {
case -2128145023:
if (action.equals("android.intent.action.SCREEN_OFF")) {
int obj2 = 1;
break;
}
break;
case 823795052:
if (action.equals("android.intent.action.USER_PRESENT")) {
obj2 = null;
break;
}
break;
}
switch (obj2) {
case null:
if (CustomVideoView.this.playerState != 2) {
return;
}
if (CustomVideoView.this.mIsRealPause) {
CustomVideoView.this.pause();
return;
} else {
CustomVideoView.this.resume();
return;
}
case 1:
if (CustomVideoView.this.playerState == 1) {
CustomVideoView.this.pause();
return;
}
return;
default:
return;
}
}
}
public void timeFunction() {
if (this.mBottomPlayRl.getVisibility() == 0) {
LogUtil.i(TAG, "handleMessage:visible");
this.showTopBottomBarTime++;
if (this.showTopBottomBarTime >= 5) {
this.showTopBottomBarTime = 0;
showBar(false);
return;
}
return;
}
this.showTopBottomBarTime = 0;
}
public CustomVideoView(Context context, ViewGroup parentContainer) {
super(context);
this.mParentContainar = parentContainer;
this.audioManager = (AudioManager) getContext().getSystemService("audio");
initDate();
initView();
registerBroadcastReceiver();
}
private void initDate() {
DisplayMetrics dm = new DisplayMetrics();
((WindowManager) getContext().getSystemService("window")).getDefaultDisplay().getMetrics(dm);
this.mScreenWidth = dm.widthPixels;
this.mDestationHeight = (int) (((float) this.mScreenWidth) * VIDEO_HEIGHT_PERCENT);
this.mFormatBuilder = new StringBuilder();
this.mFormatter = new Formatter(this.mFormatBuilder, Locale.getDefault());
}
private void initView() {
this.mPlayerView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.album_custom_video_view, this);
this.mPlayerView.setOnClickListener(this);
this.mLoadingBar = (ProgressBar) this.mPlayerView.findViewById(R.id.load_iv);
this.mVideoView = (TextureView) this.mPlayerView.findViewById(R.id.play_video_textureview);
this.mVideoView.setOnClickListener(this);
this.mVideoView.setKeepScreenOn(true);
this.mVideoView.setSurfaceTextureListener(this);
this.mTopBarLl = (LinearLayout) this.mPlayerView.findViewById(R.id.shoto_top_tab_ll);
this.mBottomPlayRl = (RelativeLayout) this.mPlayerView.findViewById(R.id.bottom_play_rl);
this.mMiniPlayBtn = (ImageButton) this.mBottomPlayRl.findViewById(R.id.play_btn);
this.mPlaySb = (SeekBar) this.mBottomPlayRl.findViewById(R.id.play_sb);
this.mPlaySb.setOnSeekBarChangeListener(this);
this.mMiniPlayBtn.setOnClickListener(this);
this.mCurrentTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.time_current_tv);
this.mTotalTimeTv = (TextView) this.mBottomPlayRl.findViewById(R.id.total_time_tv);
showBar(false);
this.nameTv = (TextView) findViewById(R.id.photo_name_tv);
this.mPlayBackIBtn = (ImageButton) findViewById(R.id.media_back_btn);
this.mPlayBackIBtn.setOnClickListener(this);
this.mPlayerView.setOnClickListener(this);
LayoutParams params = new LayoutParams(this.mScreenWidth, this.mDestationHeight);
params.addRule(13);
this.mPlayerView.setLayoutParams(params);
}
public void setDataSource(String url) {
this.mUrl = url;
}
public void onClick(View view) {
if (view.getId() == R.id.play_video_textureview) {
if (this.mTopBarLl.getVisibility() == 0) {
this.mTopBarLl.setVisibility(8);
this.mBottomPlayRl.setVisibility(8);
return;
}
this.mTopBarLl.setVisibility(0);
this.mBottomPlayRl.setVisibility(0);
} else if (view.getId() == R.id.play_btn) {
if (this.playerState == 2) {
seekAndResume(this.mPlaySb.getProgress());
} else if (this.playerState == 0) {
load();
} else {
pause();
}
} else if (view.getId() == R.id.media_back_btn && this.listener != null) {
this.listener.onClickBackBtn();
}
}
private void registerBroadcastReceiver() {
if (this.mScreenEventReciver == null) {
this.mScreenEventReciver = new ScreenEventReciver(this, null);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.USER_PRESENT");
getContext().registerReceiver(this.mScreenEventReciver, intentFilter);
}
}
private void unRegisterBroadcastReceiver() {
if (this.mScreenEventReciver != null) {
getContext().unregisterReceiver(this.mScreenEventReciver);
}
}
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
LogUtil.d(TAG, "onSurfaceTextureAvailable");
this.videoSurface = new Surface(surfaceTexture);
checkMediaPlayer();
this.mediaPlayer.setSurface(this.videoSurface);
load();
}
public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) {
LogUtil.d(TAG, "onSurfaceTextureSizeChanged");
}
public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
return false;
}
public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
public boolean onTouchEvent(MotionEvent event) {
return true;
}
/* Access modifiers changed, original: protected */
public void onVisibilityChanged(View changedView, int visibility) {
Log.d(TAG, "onVisibilityChanged: " + visibility + "," + this.mMiniPlayBtn.getVisibility());
super.onVisibilityChanged(changedView, visibility);
if (visibility != 0 || this.playerState != 2) {
pause();
} else if (isRealPause() || isComplete()) {
pause();
} else {
resume();
}
}
public void onPrepared(MediaPlayer mediaPlayer) {
LogUtil.i(TAG, "onPrepare");
showPlayView();
this.mPlaySb.setMax(getDuration());
this.mTotalTimeTv.setText(setTimeFormatter(getDuration()));
this.mediaPlayer = mediaPlayer;
if (this.mediaPlayer != null) {
mediaPlayer.setOnBufferingUpdateListener(this);
this.mCurrentCount = 0;
if (this.listener != null) {
this.listener.onAdVideoLoadSuccess();
}
setCurrentPlayState(2);
resume();
}
}
public void onCompletion(MediaPlayer mp) {
LogUtil.i(TAG, "onCompletion");
if (this.listener != null) {
this.listener.onAdVideoLoadComplete();
}
playBack();
setIsComplete(true);
setIsRealPause(true);
}
public boolean onInfo(MediaPlayer mediaPlayer, int i, int i1) {
return false;
}
public boolean onError(MediaPlayer mp, int what, int extra) {
LogUtil.i(TAG, "do error:" + what + ",extra:" + extra);
this.playerState = 1;
this.mediaPlayer = mp;
if (this.mediaPlayer != null) {
this.mediaPlayer.reset();
}
if (this.mCurrentCount >= 3) {
showPauseView(false);
if (this.listener != null) {
this.listener.onAdVideoLoadFailed();
}
}
stop();
return false;
}
public void load() {
LogUtil.i(TAG, "load:" + this.mUrl);
if (this.playerState == 0) {
showLoadingView();
try {
setCurrentPlayState(0);
checkMediaPlayer();
mute(true);
this.mediaPlayer.setDataSource(this.mUrl);
this.nameTv.setText(this.mUrl.substring(this.mUrl.lastIndexOf("/") + 1));
this.mediaPlayer.prepareAsync();
} catch (Exception e) {
e.printStackTrace();
stop();
}
}
}
public void stop() {
LogUtil.i(TAG, "do stop");
if (this.mediaPlayer != null) {
this.mediaPlayer.reset();
this.mediaPlayer.setOnSeekCompleteListener(null);
this.mediaPlayer.stop();
this.mediaPlayer.release();
this.mediaPlayer = null;
}
this.mHandler.removeCallbacksAndMessages(null);
setCurrentPlayState(0);
if (this.mCurrentCount <= 3) {
this.mCurrentCount++;
load();
return;
}
showPauseView(false);
}
public void pause() {
if (this.playerState == 1) {
LogUtil.i(TAG, "do full pause");
setCurrentPlayState(2);
if (isPlaying()) {
this.mediaPlayer.pause();
if (!this.canPlay) {
this.mediaPlayer.seekTo(0);
}
}
showPauseView(false);
this.mHandler.removeCallbacksAndMessages(null);
}
}
public void resume() {
if (this.playerState == 2) {
mute(false);
LogUtil.i(TAG, "resume");
if (isPlaying()) {
showPauseView(false);
return;
}
entryResumeState();
this.mediaPlayer.setOnSeekCompleteListener(null);
this.mediaPlayer.start();
this.mHandler.sendEmptyMessage(1);
showPauseView(true);
}
}
public void destory() {
LogUtil.i(TAG, "do destory");
if (this.mediaPlayer != null) {
this.mediaPlayer.setOnSeekCompleteListener(null);
this.mediaPlayer.stop();
this.mediaPlayer.release();
this.mediaPlayer = null;
}
setCurrentPlayState(0);
this.mCurrentCount = 0;
setIsComplete(false);
setIsRealPause(false);
unRegisterBroadcastReceiver();
this.mHandler.removeCallbacksAndMessages(null);
showPauseView(false);
}
public void playBack() {
LogUtil.i(TAG, " do play back");
setCurrentPlayState(2);
this.mHandler.removeCallbacksAndMessages(null);
if (this.mediaPlayer != null) {
this.mediaPlayer.setOnSeekCompleteListener(null);
this.mediaPlayer.seekTo(0);
this.mediaPlayer.pause();
}
showPauseView(false);
}
private void setCurrentPlayState(int state) {
this.playerState = state;
}
public boolean isPlaying() {
if (this.mediaPlayer == null || !this.mediaPlayer.isPlaying()) {
return false;
}
return true;
}
private synchronized void checkMediaPlayer() {
if (this.mediaPlayer == null) {
this.mediaPlayer = createMediaPlayer();
}
}
private MediaPlayer createMediaPlayer() {
this.mediaPlayer = new MediaPlayer();
this.mediaPlayer.reset();
this.mediaPlayer.setOnPreparedListener(this);
this.mediaPlayer.setOnCompletionListener(this);
this.mediaPlayer.setOnInfoListener(this);
this.mediaPlayer.setOnErrorListener(this);
this.mediaPlayer.setAudioStreamType(3);
if (this.videoSurface == null || !this.videoSurface.isValid()) {
stop();
} else {
this.mediaPlayer.setSurface(this.videoSurface);
}
return this.mediaPlayer;
}
private void entryResumeState() {
this.canPlay = true;
setCurrentPlayState(1);
setIsRealPause(false);
setIsComplete(false);
}
public void setIsComplete(boolean isComplete) {
this.mIsComplete = isComplete;
}
public void setIsRealPause(boolean isRealPause) {
this.mIsRealPause = isRealPause;
}
public void mute(boolean mute) {
this.isMute = mute;
if (this.mediaPlayer != null && this.audioManager != null) {
float volume = this.isMute ? 0.0f : 1.0f;
this.mediaPlayer.setVolume(volume, volume);
}
}
public void seekAndResume(int position) {
if (this.mediaPlayer != null) {
showPauseView(true);
entryResumeState();
this.mediaPlayer.seekTo(position);
this.mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() {
public void onSeekComplete(MediaPlayer mp) {
LogUtil.d(CustomVideoView.TAG, "do seek and resume");
CustomVideoView.this.mediaPlayer.start();
CustomVideoView.this.mHandler.sendEmptyMessage(1);
}
});
}
}
public void seekAndPause(int position) {
if (this.playerState == 1) {
showPauseView(false);
setCurrentPlayState(2);
if (isPlaying()) {
this.mediaPlayer.seekTo(position);
this.mediaPlayer.setOnSeekCompleteListener(new OnSeekCompleteListener() {
public void onSeekComplete(MediaPlayer mp) {
LogUtil.d(CustomVideoView.TAG, "do seek and pause");
CustomVideoView.this.mediaPlayer.pause();
CustomVideoView.this.mHandler.removeCallbacksAndMessages(null);
}
});
}
}
}
private void showPauseView(boolean show) {
this.mLoadingBar.setVisibility(8);
this.mMiniPlayBtn.setImageResource(show ? R.drawable.album_btn_pause_media : R.drawable.album_icon_play_media);
}
private void showLoadingView() {
this.mLoadingBar.setVisibility(0);
this.mMiniPlayBtn.setImageResource(R.drawable.album_icon_play_media);
this.showTopBottomBarTime = 0;
}
private void showPlayView() {
this.mLoadingBar.setVisibility(8);
this.mMiniPlayBtn.setImageResource(R.drawable.album_btn_pause_media);
this.showTopBottomBarTime = 0;
}
private void showBar(boolean isShow) {
int i;
int i2 = 0;
LinearLayout linearLayout = this.mTopBarLl;
if (isShow) {
i = 0;
} else {
i = 8;
}
linearLayout.setVisibility(i);
RelativeLayout relativeLayout = this.mBottomPlayRl;
if (!isShow) {
i2 = 8;
}
relativeLayout.setVisibility(i2);
}
public int getCurrentPosition() {
if (this.mediaPlayer != null) {
return this.mediaPlayer.getCurrentPosition();
}
return -1;
}
public int getDuration() {
if (this.mediaPlayer != null) {
return this.mediaPlayer.getDuration();
}
return -1;
}
private String setTimeFormatter(int timeMs) {
int totalSeconds = timeMs / 1000;
int seconds = totalSeconds % 60;
int minutes = (totalSeconds / 60) % 60;
int hours = totalSeconds / 3600;
this.mFormatBuilder.setLength(0);
if (hours > 0) {
return this.mFormatter.format("%d:%02d:%02d", new Object[]{Integer.valueOf(hours), Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString();
}
return this.mFormatter.format("%02d:%02d", new Object[]{Integer.valueOf(minutes), Integer.valueOf(seconds)}).toString();
}
public boolean isRealPause() {
return this.mIsRealPause;
}
public boolean isComplete() {
return this.mIsComplete;
}
public void onBufferingUpdate(MediaPlayer mediaPlayer, int i) {
}
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) {
LogUtil.i(TAG, "onProgressChanged:" + this.isUpdateProgressed);
this.isUpdateProgressed = true;
this.showTopBottomBarTime = 0;
this.mCurrentTimeTv.setText(setTimeFormatter(seekBar.getProgress()));
}
}
public void onStartTrackingTouch(SeekBar seekBar) {
LogUtil.i(TAG, "onStartTrackingTouch:" + this.isUpdateProgressed);
this.isUpdateProgressed = true;
this.showTopBottomBarTime = 0;
}
public void onStopTrackingTouch(SeekBar seekBar) {
LogUtil.i(TAG, "onStopTrackingTouch:" + this.isUpdateProgressed);
this.isUpdateProgressed = false;
if (this.playerState == 1) {
seekAndResume(seekBar.getProgress());
}
}
public void setListener(VideoPlayerListener listener) {
this.listener = listener;
}
}
| [
"you@example.com"
] | you@example.com |
5c2885a00683ef38aada972cc6b37b2a20d3bf0b | c085b4593fdbc55337a8112bf7157dc7f0f4c8b0 | /app/src/main/java/edu/illinois/cs465/petlocator/LostPetLocationActivity.java | f96a9785c71f59debc3830bbe973dd3ccaecb682 | [] | no_license | jbuildstuff/PetLocator | ce6c359afa2a62fb8f3cb71c8efc9c5aa98e6cff | 6d6de1a6fb2e595f4669764647702a792215c6a3 | refs/heads/master | 2023-03-02T11:49:15.205897 | 2019-12-31T16:55:31 | 2019-12-31T16:55:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,227 | java | package edu.illinois.cs465.petlocator;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class LostPetLocationActivity extends FragmentActivity implements OnMapReadyCallback, GoogleMap.OnMyLocationButtonClickListener,
GoogleMap.OnMyLocationClickListener, GoogleMap.OnMarkerClickListener, GoogleMap.OnMarkerDragListener, View.OnClickListener {
private GoogleMap mMap;
private View view;
private static LatLng fromPosition = null;
private static LatLng toPosition = null;
private static LatLng finalPos = null;
private static LatLng defaultPos = null;
private static Marker lostPetMarker = null;
private static Location currLocation = null;
private Button pickLocation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lost_pet_location);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
view = inflater.inflate(R.layout.activity_lost_pet_location, container, false);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
if (mapFragment != null) {
mapFragment.getMapAsync(this);
}
return view;
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setOnMyLocationButtonClickListener(this);
mMap.setOnMyLocationClickListener(this);
mMap.setOnMarkerClickListener(this);
mMap.setOnMarkerDragListener(this);
// Add a marker in uiuc and move the camera
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
LatLng siebel = new LatLng(40.1138069, -88.2270939);
defaultPos = siebel;
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
if (location != null) {
defaultPos = new LatLng(location.getLatitude(), location.getLongitude());
}
currLocation = new Location("");
currLocation.setLatitude(defaultPos.latitude);
currLocation.setLongitude(defaultPos.longitude);
lostPetMarker = mMap.addMarker(new MarkerOptions().position(defaultPos).title("Lost Pet Marker").draggable(true));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(defaultPos, 10));
mMap.animateCamera(CameraUpdateFactory.zoomIn());
// Zoom out to zoom level 10, animating with a duration of 2 seconds.
mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null);
pickLocation = (Button) findViewById(R.id.PickLocation);
pickLocation.setOnClickListener(this);
}
@Override
public void onMyLocationClick(@NonNull Location location) {
currLocation = location;
LatLng currLatLng = new LatLng(currLocation.getLatitude(), currLocation.getLongitude());
lostPetMarker.setPosition(currLatLng);
Toast.makeText(this, "Current location:\n" + location, Toast.LENGTH_LONG).show();
}
@Override
public boolean onMyLocationButtonClick() {
if (currLocation == null) {
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return false;
}
Location location = locationManager.getLastKnownLocation(locationManager.getBestProvider(criteria, false));
LatLng currLatLng = new LatLng(location.getLatitude(), location.getLongitude());
lostPetMarker.setPosition(currLatLng);
}
else {
LatLng currLatLng = new LatLng(currLocation.getLatitude(), currLocation.getLongitude());
lostPetMarker.setPosition(currLatLng);
}
// Toast.makeText(this, "Finding your location", Toast.LENGTH_SHORT).show();
// Return false so that we don't consume the event and the default behavior still occurs
// (the camera animates to the user's current position).
return false;
}
@Override
public boolean onMarkerClick(Marker marker) {
Log.i("GoogleMapActivity", "onMarkerClick");
Toast.makeText(getApplicationContext(),
"Marker Clicked: " + marker.getTitle(), Toast.LENGTH_LONG)
.show();
return false;
}
@Override
public void onMarkerDrag(Marker marker) {
// do nothing during drag
}
@Override
public void onMarkerDragEnd(Marker marker) {
toPosition = marker.getPosition();
/*
Toast.makeText(
getApplicationContext(),
"Marker " + marker.getTitle() + " dragged from " + fromPosition
+ " to " + toPosition, Toast.LENGTH_LONG).show();*/
finalPos = toPosition;
}
@Override
public void onMarkerDragStart(Marker marker) {
fromPosition = marker.getPosition();
Log.d(getClass().getSimpleName(), "Drag start at: " + fromPosition);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.PickLocation) {
Intent intent = new Intent(LostPetLocationActivity.this, pet_details.class);
if(finalPos==null)
{
intent.putExtra("LostPetLatitude", (float)defaultPos.latitude);
intent.putExtra("LostPetLongitude", (float)defaultPos.longitude);
}
else{
intent.putExtra("LostPetLatitude", (float)finalPos.latitude);
intent.putExtra("LostPetLongitude", (float)finalPos.longitude);
}
startActivity(intent);
}
}
}
| [
"jlee651@illinois.edu"
] | jlee651@illinois.edu |
050dd6b08ddb50fee3bd9a7a756f830e32eea542 | d3abbbeac102de77fe50a6d400c6aa7c0a80a97c | /src/com/interview/leetcode/MissingNumber.java | 32460dbdf97dd923c356e6ae8360984370e36765 | [] | no_license | teraliv/interview | 6ce0352d285eac1dc02f34a05dbd028bba2aa2f2 | 4fd2bc80e8cf8fe18e2b0f38385e60b0cb93366f | refs/heads/master | 2020-04-24T06:35:04.608247 | 2019-04-01T04:17:45 | 2019-04-01T04:17:45 | 171,770,343 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package com.interview.leetcode;
/**
* 268. Missing Number
*
* Given an array containing n distinct numbers taken from
* 0, 1, 2, ..., n, find the one that is missing from the array.
* Your algorithm should run in linear runtime complexity.
*
* https://leetcode.com/problems/missing-number/
*/
public class MissingNumber {
/**
* Time complexity: O(n)
* Space complexity: O(1)
*
* Logic:
* 1. sum up indexes
* 2. sum up elements in array
* 3. the result is difference between sum of indexes and sum of array elements
*/
public int findMissingNumber(int[] nums) {
int i, sum1 = 0, sum2 = 0;
for (i = 0; i < nums.length; i++) {
sum1 += nums[i];
sum2 += i;
}
sum2 += i;
return sum2 - sum1;
}
public static void main(String[] args) {
MissingNumber mn = new MissingNumber();
int[] nums1 = {3,0,1};
int[] nums2 = {9,6,4,2,3,5,7,0,1};
System.out.println( mn.findMissingNumber(nums1) );
System.out.println( mn.findMissingNumber(nums2) );
}
}
| [
"teraliv@gmail.com"
] | teraliv@gmail.com |
3083a6d62b3280d47555ea81b9aff1e600e43740 | d8ae0563f237551cdfbe707cb367a5dcbae8854c | /bingo-core/src/main/java/org/bingo/security/service/AuthorityService.java | a32f1e037bc17d7ed95e861bc31f57218889f941 | [] | no_license | ERIC0402/bingo | ebda99e1d4f6d14511effc43912927d33d47fce7 | 4782ee19fd54293a0c5f9e0e2da987730ffcc513 | refs/heads/master | 2021-06-16T14:01:38.393305 | 2017-05-11T05:47:44 | 2017-05-11T05:47:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package org.bingo.security.service;
import java.util.List;
import java.util.Set;
import org.bingo.security.model.Authority;
import org.bingo.security.model.User;
public interface AuthorityService {
/**
* 获取该用户所有权限
* @param user
* @return
*/
public Set<Authority> getAuthorities(User user);
/**
* 获取所有权限
* @return
*/
public List<Authority> findAllAuthority();
}
| [
"805494859@qq.com"
] | 805494859@qq.com |
c5ca75282003a98ecf1ae4f664c255e5d197c07d | 05f5127477eff81bf362233f617186252eed46ae | /fun/android/tant-card/src/com/shimoda/oa/util/importer/IDataImportResponse.java | 6aa7c96e1c47db996fe3e329edac3c9eb8a250f0 | [] | no_license | wangym/labs | 2473b16d322c0ae070b5d632d5965686903ee1b3 | b29270e8adf777aa8bdd05b4840949159fff1469 | refs/heads/master | 2020-12-19T23:55:37.155115 | 2016-11-21T07:36:33 | 2016-11-21T07:36:33 | 10,281,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 370 | java | package com.shimoda.oa.util.importer;
import java.util.List;
import com.shimoda.oa.model.SourceContactListVO;
public interface IDataImportResponse {
public void onImportDataComplete(List<SourceContactListVO> contactList, int imported, int current);
public void onImportDataFinish(int imported);
public void onImportDataError(String errorMsg);
}
| [
"chinawym@gmail.com"
] | chinawym@gmail.com |
487894e8c2c2b71eb3b5b0eae7634deac7da5cb6 | dc3ff4ec1cae3067369437bc92fceb9d142036b6 | /src/main/java/org/springframework/amqp/tutorials/tut1/Tut1Config.java | 009043647ca39fcbef59e7082efbcc52a20770c2 | [] | no_license | a-chauhan/rabbitmq-spring-tutorials | 2e587e719784fcb5cc84b36088d7f29a0a37a321 | 86cfebe55c760431baf729aa93f1b90a1deb08b8 | refs/heads/master | 2020-03-21T02:38:09.013418 | 2018-06-20T09:29:41 | 2018-06-20T09:29:41 | 138,008,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package org.springframework.amqp.tutorials.tut1;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile({"tut1","hello-world"})
public class Tut1Config {
@Bean
public Queue hello() {
return new Queue("hello");
}
@Profile("receiver")
@Bean
public Tut1Receiver receiver() {
return new Tut1Receiver();
}
@Profile("sender")
@Bean
public Tut1Sender sender() {
return new Tut1Sender();
}
}
| [
"a-chauhan@mail.nissan.co.jp"
] | a-chauhan@mail.nissan.co.jp |
2e5a0eeb6504e6f8361f3f8ef328aaf28bde7a55 | 97d8cb35e0648aa25708146f4cefd4661cdda71a | /Zadanie03_game/src/StrangeWorld.java | 14092467264d49b72d91dde8b4c69f8206278bfe | [] | no_license | JakubKosmaty/java | 5a23e9465344020bcf9f74cee29e00f53f8c5791 | ce3251ade2dbfdc27870d6e5870298fde15fbdc4 | refs/heads/main | 2023-02-27T20:35:24.673052 | 2021-02-03T22:09:27 | 2021-02-03T22:09:27 | 306,304,941 | 0 | 0 | null | 2020-10-22T12:41:41 | 2020-10-22T10:43:23 | Java | UTF-8 | Java | false | false | 4,959 | java | public class StrangeWorld implements StrangeWorldInterface{
private PhysicsInterface[] physicsInterface;
private int mapSize;
@Override
public void setSize(int size) {
if (size <= 0) {
return;
}
mapSize = size;
physicsInterface = new PhysicsInterface[mapSize * mapSize];
}
private boolean fallDown(int row, int col) {
int blockIndex = getIndex(row, col);
boolean hasFall = false;
while (row >= 0) {
blockIndex = getIndex(row, col);
PhysicsInterface block = physicsInterface[blockIndex];
if (block.canFloatInTheAirWithoutSupport() && !block.willFallIfNotSupportedFromBelow()) {
return false;
}
if (block.willFallIfNotSupportedFromBelow()) {
if (row == 0) {
physicsInterface[blockIndex] = null;
return true;
}
if (physicsInterface[getIndex(row - 1, col)] != null) {
return hasFall;
}
} else if (blockHasNeighbor(row, col)) {
return hasFall;
}
if (row == 0) {
physicsInterface[blockIndex] = null;
return hasFall;
}
hasFall = true;
physicsInterface[getIndex(row - 1, col)] = physicsInterface[blockIndex];
physicsInterface[blockIndex] = null;
row -= 1;
}
return hasFall;
}
// 0 - Right 1 - Left 2 - Up 3 - Down
private int blockGetNeighbor(int dir, int row, int col) {
int index = -1;
int dRow = 0;
int dCol = 0;
if (dir == 0) {
dCol = 1;
} else if (dir == 1) {
dCol = -1;
} else if (dir == 2) {
dRow = 1;
} else if (dir == 3) {
dRow = -1;
} else {
return -1;
}
int neighbourRow = row + dRow;
int neighbourCol = col + dCol;
if (neighbourRow >= mapSize || neighbourRow < 0 || neighbourCol >= mapSize || neighbourCol < 0) {
return -1;
}
return getIndex(neighbourRow, neighbourCol);
}
private boolean blockHasNeighbor(int row, int col) {
for (int i = 0; i < 4; i++) {
int index = blockGetNeighbor(i, row, col);
if (index != -1 && !isIndexAvailable(index)) {
return true;
}
}
return false;
}
private void checkBlock(int row, int col) {
for (int i = 0; i < 4; i++) {
int neighborIndex = blockGetNeighbor(i, row, col);
if (neighborIndex != -1 && !isIndexAvailable(neighborIndex)) {
if (fallDown(getRow(neighborIndex), getCol(neighborIndex))) {
checkBlock(getRow(neighborIndex), getCol(neighborIndex));
break;
}
}
}
}
@Override
public boolean tryAdd(int row, int col, PhysicsInterface block) {
int index = getIndex(row, col);
if (!isIndexAvailable(index)) {
return false;
}
if (block.mustBeSupportedFromAnySideToBePlaced()) {
if (!blockHasNeighbor(row, col)) {
return false;
}
}
if (block.canFloatInTheAirWithoutSupport() && !block.willFallIfNotSupportedFromBelow()) {
physicsInterface[index] = block;
return true;
}
physicsInterface[index] = block;
fallDown(row, col);
return true;
}
@Override
public PhysicsInterface delAndGet(int row, int col) {
int index = getIndex(row, col);
if (isIndexAvailable(index)) {
return null;
}
PhysicsInterface block = physicsInterface[index];
physicsInterface[index] = null;
checkBlock(row, col);
return block;
}
@Override
public PhysicsInterface get(int row, int col) {
return physicsInterface[getIndex(row, col)];
}
private boolean isIndexAvailable(int index) {
return (physicsInterface[index] == null);
}
private int getRow(int index) {
return (int)index / mapSize;
}
private int getCol(int index) {
return (int)index % mapSize;
}
private int getIndex(int row, int col) {
return row * mapSize + col;
}
public void printMap() {
for (int x = 0; x < mapSize; x++) {
for (int y = 0; y < mapSize; y++) {
int index = x * mapSize + y;
if (physicsInterface[index] == null) {
System.out.print("0");
} else {
System.out.print("1");
}
System.out.print(" ");
}
System.out.println();
}
System.out.println("----------------------");
}
}
| [
"jacobkosmaty@gmail.com"
] | jacobkosmaty@gmail.com |
ee895b8707195071578947c14847f0d79780a7f2 | 9707e95b0b96fccdf3a42f5add5e8ef5a035d843 | /Linked List/deep copy of list with forward pointer.java | ed3a1b003e14130da0262ce61e22054dcef61074 | [] | no_license | fanyang209/data-structure | 09ffa4a8b7026e59cc66f94e749ff8f962498f7d | 2fad37f3bb8fd895326cf2b09f073b0f73f2eab2 | refs/heads/master | 2020-12-12T16:42:59.963240 | 2016-08-02T15:39:44 | 2016-08-02T15:39:44 | 53,741,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | public ListNode deepCopy( ListNode head ) {
if( head == null ) {
return head ;
}
ListNode dummy = new ListNode( 0 ) ;
ListNode cur = dummy ;
Map< ListNode, ListNode> map = new HashMap< ListNode, ListNode>() ;
while( head != null ) {
if( !map.containsKey( head ) ) {
map.put( head, new ListNode( head.value ) ) ;
}
cur.next = map.get( head ) ;
if( head.forward != null ) {
if( !map.containsKey( head.forward ) ) {
map.put( head.forward, new ListNode( head.forward.value ) ) ;
}
cur.forward.next = map.get( head.forward) ;
}
head = head.next ;
cur = cur.next ;
}
return dummy.next ;
} | [
"fanyang209@gmail.com"
] | fanyang209@gmail.com |
50d058d6694f851be1d910d665488058e6294404 | 03518d7dc5c799c7db419f3ad7fa15a3a8fe2af6 | /src/main/java/com/sri/ai/expresso/helper/FunctionApplicationContainsArgumentSatisfying.java | d8a3a5cbc0caa712d894c1b8d1162a08e39b6cc6 | [
"BSD-3-Clause"
] | permissive | aic-sri-international/aic-expresso | 35b158baee37fa832b9877c057a1cb6ae3d2f7a9 | 01b0bbc33c2ad37fea12a645cbc6105abc7e5352 | refs/heads/master | 2021-01-23T18:24:18.454471 | 2018-11-01T06:59:38 | 2018-11-01T06:59:38 | 35,304,890 | 9 | 1 | BSD-3-Clause | 2020-10-13T10:06:31 | 2015-05-08T22:27:48 | Java | UTF-8 | Java | false | false | 2,577 | java | /*
* Copyright (c) 2013, SRI International
* All rights reserved.
* Licensed under the The BSD 3-Clause License;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://opensource.org/licenses/BSD-3-Clause
*
* 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 aic-expresso 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.sri.ai.expresso.helper;
import com.google.common.annotations.Beta;
import com.google.common.base.Predicate;
import com.sri.ai.expresso.api.Expression;
import com.sri.ai.util.Util;
/**
* Indicates whether a given expression, assumed to be a function application,
* has an argument satisfying a given predicate.
*/
@Beta
public class FunctionApplicationContainsArgumentSatisfying implements Predicate<Expression> {
private Predicate<Expression> base;
public FunctionApplicationContainsArgumentSatisfying(Predicate<Expression> base) {
super();
this.base = base;
}
@Override
public boolean apply(Expression input) {
boolean result = Util.thereExists(input.getArguments(), base);
return result;
}
} | [
"rodrigobraz@gmail.com@3d43a1d2-4736-3da3-5e10-20935d0d7c2c"
] | rodrigobraz@gmail.com@3d43a1d2-4736-3da3-5e10-20935d0d7c2c |
c98f66c060e2f214c8db073ef49c6206234154ce | d04ff5275808e541ea7c2033e3cb816128a48231 | /chapter_008/src/main/java/ru/job4j/srp/SubtractAction.java | 95a8e1c3d44772527077ee2f8c7245a57de4143c | [] | no_license | VladimirKovtun/job4j | 2b93e25d00f35722c933cb0d480c696f3dc4478d | 0380675efe04d7b714bb5a109e176f99d51318d0 | refs/heads/master | 2022-09-20T07:20:39.631341 | 2020-01-23T13:15:32 | 2020-01-24T06:12:22 | 207,911,194 | 0 | 0 | null | 2022-09-01T23:17:15 | 2019-09-11T21:36:50 | Java | UTF-8 | Java | false | false | 718 | java | package ru.job4j.srp;
import ru.job4j.calculate.Calculate;
/**
* Subtraction action class.
*/
public class SubtractAction extends BaseCalcAction {
public SubtractAction(String number, String text) {
super(number, text);
}
/**
*Execution of subtraction.
*
* @param calculate Class object with calculator methods.
* @param calcHandler A class object that defines behavior.
* @return The result of the subtraction.
*/
@Override
public double execute(Calculate calculate, CalcHandler calcHandler) {
double result = calcHandler.executeTwoVar(calculate::subTract);
System.out.printf("Result is: %.2f%n", result);
return result;
}
}
| [
"vovkammmorkovka@gmail.com"
] | vovkammmorkovka@gmail.com |
5cebf08b0b0cf18bdc8faf0f0612385be89bc353 | 97b0fe480c5ec6cc1720b712ffc77cceca35470d | /src/main/java/me/maxct/asset/dto/LoginVO.java | 672bb9a6c63eb97d9380e7f7f163801282e2c8c9 | [] | no_license | MaoLeYuu/asset-1 | a83683d6e71dabf393363e72459973c9c65a6ca0 | da63c366bc0eedf2d9e12695229adfa6dd80dab4 | refs/heads/master | 2020-07-27T18:32:27.379416 | 2019-05-14T14:06:34 | 2019-05-14T14:06:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package me.maxct.asset.dto;
import lombok.Data;
/**
* @author imaxct
* 2019-03-28 19:41
*/
@Data
public class LoginVO {
private Long id;
private String username;
private String name;
private String token;
private Long expireSecond;
private String depName;
private RoleVO role;
private Long depId;
}
| [
"imaxct@hotmail.com"
] | imaxct@hotmail.com |
8d1dcd014672496fc0ce74197e43f75059a77f47 | 0c8a9b60a6bb4bce19921c0008c9e79c5eb89f31 | /TianTianApp/app/src/main/java/com/tiantianapp/photo/loader/PhotoDirectoryLoader.java | a73d1571df779f9ca83dd5c2f9327a49ea5012ac | [] | no_license | Tareafengye/GankAPi | 9ad0d724c7bb50167bd63c950bb90dfa7da9cd8a | dafd0ef1d9512954c13fcdd69717294edd31aa3b | refs/heads/master | 2021-05-09T05:41:10.848906 | 2018-04-28T08:55:14 | 2018-04-28T08:55:14 | 119,317,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,733 | java | package com.tiantianapp.photo.loader;
import android.content.Context;
import android.net.Uri;
import android.provider.MediaStore.Images.Media;
import android.support.v4.content.CursorLoader;
import static android.provider.MediaStore.MediaColumns.MIME_TYPE;
/**
* Created by Awen <Awentljs@gmail.com>
*/
public class PhotoDirectoryLoader extends CursorLoader {
private final static String IMAGE_JPEG = "image/jpeg";
private final static String IMAGE_PNG = "image/png";
private final static String IMAGE_GIF = "image/gif";
final String[] IMAGE_PROJECTION = {
Media._ID,
Media.DATA,
Media.BUCKET_ID,
Media.BUCKET_DISPLAY_NAME,
Media.DATE_ADDED,
Media.SIZE
};
public PhotoDirectoryLoader(Context context){
this(context,false);
}
public PhotoDirectoryLoader(Context context, boolean showGif) {
super(context);
setProjection(IMAGE_PROJECTION);
setUri(Media.EXTERNAL_CONTENT_URI);
setSortOrder(Media.DATE_ADDED + " DESC");
setSelection(
MIME_TYPE + "=? or " + MIME_TYPE + "=? " + (showGif ? ("or " + MIME_TYPE + "=?") : ""));
String[] selectionArgs;
if (showGif) {
selectionArgs = new String[]{IMAGE_JPEG, IMAGE_PNG, IMAGE_GIF};
} else {
selectionArgs = new String[]{IMAGE_JPEG, IMAGE_PNG};
}
setSelectionArgs(selectionArgs);
}
private PhotoDirectoryLoader(Context context, Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
super(context, uri, projection, selection, selectionArgs, sortOrder);
}
}
| [
"18885640674@163.com"
] | 18885640674@163.com |
d7ef70c9a0541501cca7a3ec10d3a25cd6abe6f5 | 5aa5db9516419cec1c28846a3e8ee5905f6425d7 | /app/src/main/java/com/malcolm/portsmouthunibus/ui/timetable/TimetableViewModel.java | 648c6671b3c1f45d7299f174f92a11f07ba82282 | [] | no_license | malodita/portsunibusandroid | 27ebf5e7b09c86dc245aa500b1892f3ad42b9e91 | fb8ae060d9d18aee595c448ff78263efb14628e0 | refs/heads/master | 2021-01-11T21:58:28.925500 | 2018-08-28T13:08:29 | 2018-08-28T13:08:29 | 78,887,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,733 | java | package com.malcolm.portsmouthunibus.ui.timetable;
import android.app.Application;
import com.malcolm.portsmouthunibus.App;
import com.malcolm.unibusutilities.entity.Times;
import com.malcolm.unibusutilities.repository.MainRepository;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
/**
* The ViewModel
*/
public class TimetableViewModel extends AndroidViewModel {
private final MediatorLiveData<String> countdown;
private MediatorLiveData<List<Times>> timesLiveData;
private MainRepository repository;
private TimetableViewModel(@NonNull Application application, int stop, boolean is24Hours) {
super(application);
repository = ((App) application).getMainRepository();
timesLiveData = new MediatorLiveData<>();
timesLiveData.addSource(repository.findListOfTimesForStop(stop, is24Hours), timesLiveData::setValue);
countdown = new MediatorLiveData<>();
countdown.addSource(repository.getTimetableCountdown(), countdown::setValue);
if (is24Hours) {
repository.fetchListForTimetableCountdown(stop - 1, MainRepository.TWENTYFOUR_HOUR);
} else {
repository.fetchListForTimetableCountdown(stop - 1, MainRepository.TWELVE_HOUR);
}
}
/**
* Fetches a new list of times for an individual bus stop.
* @param stop Id of stop
* @param is24Hours If should be reported in 12 or 24 hour format
*/
void changeListOfStops(int stop, boolean is24Hours){
repository.findListOfTimesForStop(stop, is24Hours);
}
/**
* Exposes the LiveData for monitoring the current list of stop times.
* @return An array of Times suitable for use in a recyclerview
*/
LiveData<List<Times>> getData() {
return timesLiveData;
}
/**
* Exposes the current countdown until the next bus for observation
*
* @return The LiveData representing the countdown. A single string representing the time
*/
LiveData<String> getCurrentCountdown() {
return countdown;
}
/**
* Causes the {@link MainRepository} to fetch the times for a new stop. The LiveData exposed in
* {@link #getCurrentCountdown()} is updated automatically.
* @param stop The new stop to observe. This will always -1 to make it work correctly due to
* the manual get method starting from 0 in the database (Representing eastney)
*/
void updateStopList(int stop, boolean is24Hours){
if (is24Hours) {
repository.fetchListForTimetableCountdown(stop - 1, MainRepository.TWENTYFOUR_HOUR);
} else {
repository.fetchListForTimetableCountdown(stop - 1, MainRepository.TWELVE_HOUR);
} }
@Override
protected void onCleared() {
repository.stopObservingTimetableStop();
super.onCleared();
}
public static class Factory extends ViewModelProvider.NewInstanceFactory{
@NonNull
private final Application application;
private final boolean is24Hours;
private final int stop;
Factory(@NonNull Application application, boolean is24Hours, int stop) {
this.application = application;
this.is24Hours = is24Hours;
this.stop = stop;
}
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
//noinspection unchecked
return (T) new TimetableViewModel(application, stop, is24Hours);
}
}
}
| [
"malodita@gmail.com"
] | malodita@gmail.com |
a3f0224d29dd2fd97f06d1bc6f4289b84150a5cb | f0757b5f6006d2b413aa9ede33d09f33dc954f23 | /textbook_examples/ch08/fig08_07_09/src/Date.java | 47b8c213e397738a3439667da6f02e63f4aa426d | [] | no_license | rdfarwell/Software-Design-Spring-2020 | 7b53e02bb8d3511d0145dae33fa55910e5cf6952 | 86ae23d5e7954d063b21c448130bd01035912db2 | refs/heads/master | 2022-12-19T00:18:56.763541 | 2020-09-30T23:21:20 | 2020-09-30T23:21:20 | 279,748,324 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,592 | java | // Fig. 8.7: Date.java
// Date class declaration.
public class Date {
private static final int[] daysPerMonth =
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
private int month; // 1-12
private int day; // 1-31 based on month
private int year; // any year
// constructor: confirm proper value for month and day given the year
public Date(int month, int day, int year) {
// check if month in range
if (month <= 0 || month > 12)
throw new IllegalArgumentException(
"month (" + month + ") must be 1-12");
// check if day in range for month
if (day <= 0 ||
(day > daysPerMonth[month] && !(month == 2 && day == 29)))
throw new IllegalArgumentException("day (" + day +
") out-of-range for the specified month and year");
// check for leap year if month is 2 and day is 29
if (month == 2 && day == 29 && !(year % 400 == 0 ||
(year % 4 == 0 && year % 100 != 0)))
throw new IllegalArgumentException("day (" + day +
") out-of-range for the specified month and year");
this.month = month;
this.day = day;
this.year = year;
System.out.printf(
"Date object constructor for date %s%n", this);
}
// return a String of the form month/day/year
public String toString() {
return String.format("%d/%d/%d", month, day, year);
}
} // end class Date
/**************************************************************************
* (C) Copyright 1992-2014 by Deitel & Associates, Inc. and *
* Pearson Education, Inc. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
| [
"hans.j.johnson@gmail.com"
] | hans.j.johnson@gmail.com |
2d58c72461a800e6bd12a7c329d33a0669b204d6 | 003d7938bc369519f593b21c477b5b3e68a3d343 | /app/src/main/java/com/feedhenry/armark/Adaptadores/Adaptador_Almacen.java | 8003da63c9d1208b8838d3577661a1b2af18d4f1 | [
"Apache-2.0"
] | permissive | breinergonza/conexion_serv | 1581c1c7b6965adf86787c8471628dce5e6c2c9f | 2052c90442edcdd624b65ff1463d2b950d642e9b | refs/heads/master | 2021-01-11T01:50:53.488192 | 2016-10-23T20:12:32 | 2016-10-23T20:12:32 | 70,848,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,599 | java | package com.feedhenry.armark.Adaptadores;
import android.content.Context;
import android.database.Cursor;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.feedhenry.armark.R;
/**
* Created by ASUS on 20/10/2016.
*/
public class Adaptador_Almacen extends RecyclerView.Adapter<Adaptador_Almacen.ViewHolder> {
private final Context contexto;
private Cursor items;
public OnItemClickListener escuchaAlmacen;
public interface OnItemClickListener {
public void onClick(ViewHolder holder, String idAlmacen);
}
public Adaptador_Almacen(Context contexto,OnItemClickListener escuchaAlmacen) {
this.contexto = contexto;
this.escuchaAlmacen = escuchaAlmacen;
}
@Override
public Adaptador_Almacen.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_lista_almacen,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(Adaptador_Almacen.ViewHolder holder, int position) {
items.moveToPosition(position);
String s;
// asignacion de ui
s= items.getString(ConsultaAlmacen.RAZONSOCIAL);
holder.viewRazonSocial.setText(s);
s= items.getString(ConsultaAlmacen.DESCRIPCION);
holder.viewDescripcion.setText(s);
s= items.getString(ConsultaAlmacen.LOGO);
Glide.with(contexto).load(s).centerCrop().into(holder.viewLogo);
}
@Override
public int getItemCount() {
if (items != null) {
return items.getCount();
}
return 0;
}
public void swapCursor(Cursor nuevoCursor) {
if (nuevoCursor != null) {
items = nuevoCursor;
notifyDataSetChanged();
}
}
public Cursor getCursor() {
return items;
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
// Tomamos las referencias ui
private TextView viewRazonSocial,viewDescripcion;
private ImageView viewLogo;
public ViewHolder(View itemView) {
super(itemView);
viewRazonSocial = (TextView) itemView.findViewById(R.id.txt_razonSocial);
viewDescripcion = (TextView)itemView.findViewById(R.id.txt_descripcion_almacen);
viewLogo = (ImageView)itemView.findViewById(R.id.img_almcen);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
escuchaAlmacen.onClick(this,obtenerIdAlmacen(getAdapterPosition()));
}
}
private String obtenerIdAlmacen(int adapterPosition) {
if (items != null) {
if (items.moveToPosition(adapterPosition)) {
return items.getString(ConsultaAlmacen.ID_ALMACEN);
}
}
return null;
}
interface ConsultaAlmacen {
int ID_ALMACEN = 0;
int IDWEB = 1;
int RAZONSOCIAL = 2;
int NIT = 3;
int DESCRIPCION = 4;
int DIRECCION = 5;
int TELEFONO = 6;
int CORREO= 7;
int POSICIONGPS = 8;
int LOGO = 9;
int MARCADOR = 10;
int REGISTRO = 11;
int MODIFICADOR = 12;
int VISIBLE = 13;
int ACTIVO = 14;
int TAGS = 15;
int X = 16;
int Y = 17;
}
}
| [
"breinergonza@hotmail.com"
] | breinergonza@hotmail.com |
bfc3d20a333ce2f2669f8139673815aaf314cf09 | c74a3488129ac10e204bc56b8718c6ff261ee3a7 | /src/main/java/com/chitter/PeepRepository.java | b95277c9dcd16f8026450102641db8c372d18fd9 | [] | no_license | JohnNewman1/chitter-challenge | 2bef6ec5b482e2f6d9893113cb5ebe96a22f3d21 | fccdff3def2a037587c64a9883c03ae650c6947f | refs/heads/master | 2020-03-19T16:29:00.912220 | 2018-06-09T16:02:56 | 2018-06-09T16:02:56 | 136,716,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 155 | java | package com.chitter;
import org.springframework.data.repository.CrudRepository;
public interface PeepRepository extends CrudRepository<Peep, Long> {
}
| [
"newmanj903@gmail.com"
] | newmanj903@gmail.com |
5103b98279a42ce772ca88df47831093651ca8e7 | 89f9784a63188126ec0be0eed42fc8f5aa558420 | /src/test/java/com/udemy/uat/stepdefs/SignUpStepDefinitions.java | 1373ba2218dbeb83f1a333f86f7a92ad7eee838d | [] | no_license | cgrkhrmn/UdemyMentoringMac | 5f5f6ef55fead780c986e1f44c840cb9dfc7b142 | 35a2bca444cd67394ae929b71248a50e7a36fd9c | refs/heads/master | 2021-07-05T20:54:05.945114 | 2017-09-27T20:15:06 | 2017-09-27T20:15:06 | 105,060,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,729 | java | package com.udemy.uat.stepdefs;
import java.util.Random;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.udemy.uat.pages.HomePage;
import com.udemy.uat.utilities.ConfigurationReader;
import com.udemy.uat.utilities.Driver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class SignUpStepDefinitions {
WebDriver driver = Driver.getInstance();
HomePage homePage=new HomePage();
String name;
String fullName;
@Given("^udemy homepage$")
public void udemy_homepage() throws Throwable {
Driver.getInstance().get(ConfigurationReader.getProperty("url"));
Driver.getInstance().manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
}
@When("^user click sign up button$")
public void user_click_sign_up_button() throws Throwable {
homePage.signUpButton.click();
}
@When("^provide a fullname valid email and password$")
public void provide_a_fullname_valid_email_and_password() throws Throwable {
//Random number created for email uniqueness
Random rand = new Random();
int n = rand.nextInt(5000) + 1;
//Program is asking your name input
// Scanner scan=new Scanner(System.in);
// System.out.println("What is your full name?");
// name=scan.nextLine();
String names[] = {"Jhonny", "Edurardo", "Francis", "Franklin", "Freedy", "Cagcag", "Pranav", "Naci"};
String lastNames[] = {"Jhon", "Edurar", "Frank", "Frankline", "FreedyMac", "Cagcs", "Pranavoc", "Nacika"};
String randomName=names[new Random().nextInt(names.length)];
String randomLastName=lastNames[new Random().nextInt(lastNames.length)];
//creating an email address base on your name response
//String email=name.replace(" ", "").concat(n+"@gmail.com");
fullName=randomName+" "+randomLastName;
String email=(randomName+randomLastName).concat(n+"@gmail.com");
homePage.fullName.sendKeys(fullName);
homePage.emailId.sendKeys(email);
homePage.password.sendKeys("password1234");
}
@When("^click sign up button$")
public void click_sign_up_button() throws Throwable {
homePage.submitButton.click();
}
@Then("^user should be able to signup successfully$")
public void user_should_be_able_to_signup_successfully() throws Throwable {
WebDriverWait wait=new WebDriverWait(Driver.getInstance(), 20);
wait.until(ExpectedConditions.visibilityOf(homePage.nameAvatar));
//Verify if you are sign up successfully.
Assert.assertEquals(homePage.nameAvatar.getAttribute("aria-label"),fullName);
Thread.sleep(5000);
}
} | [
"ckahramanqa@gmail.com"
] | ckahramanqa@gmail.com |
6c5635f51c586e7a9ab2a82cb7bbb987bd419b07 | dc13b04749065664cbd1edb38cf6148a8d6262f5 | /kwdautomation/src/test/java/operations/ReadXLData.java | b81ed36b8a191ed34a3f389d5b47556c45453509 | [] | no_license | deepthi021/SeleniumTests | 78e10e7b78e0161f8f38b443090473de0a4e3b8b | 2cd6891d739eb43fd252bfa293c7b780e389ad53 | refs/heads/master | 2023-05-08T07:10:51.265605 | 2021-05-29T18:56:49 | 2021-05-29T18:56:49 | 370,114,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package operations;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.testng.annotations.Test;
public class ReadXLData {
@Test
public void Test() throws Exception {
File file = new File("C:\\Users\\Deepthi\\eclipse-workspace\\kwdautomation\\src\\test\\java\\testscenarios\\TestCases.xlsx");
FileInputStream stream = new FileInputStream(file);
XSSFWorkbook wb = new XSSFWorkbook(stream);
XSSFSheet sheet = wb.getSheet("testcases");
int rc = sheet.getLastRowNum() - sheet.getFirstRowNum();
System.out.println("No. of rows found = "+rc);
for(int i=0;i<rc;i++) {
int cc = sheet.getRow(i).getLastCellNum();
System.out.println("Row "+ i+ "th data is : ");
for(int j=0;j<cc;j++) {
System.out.println(sheet.getRow(i).getCell(j));
}
System.out.println();
}
}
}
| [
"deepthito@gmail.com"
] | deepthito@gmail.com |
050e7c420d84f38f9ae40061820208ad6a54151b | bf32bc8d88dba3f3fd9e25ee670b44233dce7a46 | /app/src/main/java/com/firatnet/wst/adapter/RecyclerAllPostsCardAdapter.java | 1a724c484bc70af5caee1c82f349acf18e63fe7c | [] | no_license | amroshehk/WTS | af46167b3c1be5cc85c6178f933f4fd68f8fa603 | 2c48314eca0725e67227d78c6beb3f235aaffbe6 | refs/heads/master | 2020-05-30T07:41:20.694714 | 2019-10-16T19:52:41 | 2019-10-16T19:52:41 | 189,602,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,073 | java | package com.firatnet.wst.adapter;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.firatnet.wst.R;
import com.firatnet.wst.activities.PostDetailsActivity;
import com.firatnet.wst.entities.Post;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class RecyclerAllPostsCardAdapter extends RecyclerView.Adapter<RecyclerAllPostsCardAdapter.ViewHolder> {
private ArrayList<Post> posts;
private Context context;
private TextView nonumbers;
ImageLoader imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config;
DisplayImageOptions options;
public RecyclerAllPostsCardAdapter(ArrayList<Post> posts, Context context, TextView nonumbers) {
this.posts = posts;
this.context=context;
this.nonumbers=nonumbers;
config = new ImageLoaderConfiguration.Builder(context)
.build();
ImageLoader.getInstance().init(config);
options = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v= LayoutInflater.from(parent.getContext()).inflate(R.layout.card_buy_posts_layout,parent,false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.number_tv.setText(posts.get(position).getTitle());
holder.created_tv.setText(posts.get(position).getCreated_date());
if (!posts.get(position).getPost_image_url().isEmpty()&&!posts.get(position).getPost_image_url().equals("null"))
{
imageLoader.displayImage(posts.get(position).getPost_image_url(), holder.image, options);
holder.image.setVisibility(View.VISIBLE);
}
else
{
holder.image.setVisibility(View.GONE);
}
}
@Override
public int getItemCount() {
return posts.size();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public int getItemViewType(int position) {
return position;
}
class ViewHolder extends RecyclerView.ViewHolder{
private ProgressDialog progressDialog;
TextView number_tv;
TextView created_tv;
ImageView image;
@SuppressLint("SetTextI18n")
ViewHolder(final View itemView) {
super(itemView);
number_tv = itemView.findViewById(R.id.number_tv);
created_tv = itemView.findViewById(R.id.created_date_tv);
image = itemView.findViewById(R.id.image);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int position=getAdapterPosition();
Intent intent=new Intent(context, PostDetailsActivity.class);
intent.putExtra("DETAILS",posts.get(position));
context.startActivity(intent);
// Snackbar.make(v,"Cliecked detedcted item on "+position,Snackbar.LENGTH_SHORT).
// setAction("Action",null).show();
}
});
}
}
}
| [
"amroshehzen@hotmail.com"
] | amroshehzen@hotmail.com |
d90bee46b1b4db6a0569315194a26e56182a3fa5 | 08be78ee28957fe393bea727228fbe13e5c00df1 | /modules/webcloud/modules/webcloud-pseudocode/src/main/java/com/pseudocode/cloud/zuul/filters/pre/PreDecorationFilter.java | 06b9cf3bca824c2a1b300ce9a7016e4e02c794ce | [] | no_license | javachengwc/java-apply | 432259eadfca88c6f3f2b80aae8e1e8a93df5159 | 98a45c716f18657f0e4181d0c125a73feb402b16 | refs/heads/master | 2023-08-22T12:30:05.708710 | 2023-08-15T08:21:15 | 2023-08-15T08:21:15 | 54,971,501 | 10 | 4 | null | 2022-12-16T11:03:56 | 2016-03-29T11:50:21 | Java | UTF-8 | Java | false | false | 12,283 | java | package com.pseudocode.cloud.zuul.filters.pre;
import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import com.pseudocode.cloud.zuul.filters.Route;
import com.pseudocode.cloud.zuul.filters.RouteLocator;
import com.pseudocode.cloud.zuul.filters.ZuulProperties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.util.StringUtils;
import org.springframework.web.util.UrlPathHelper;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.FORWARD_LOCATION_PREFIX;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.FORWARD_TO_KEY;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.HTTPS_PORT;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.HTTPS_SCHEME;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.HTTP_PORT;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.HTTP_SCHEME;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.PRE_DECORATION_FILTER_ORDER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.PRE_TYPE;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.PROXY_KEY;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.REQUEST_URI_KEY;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.RETRYABLE_KEY;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.SERVICE_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.SERVICE_ID_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.SERVICE_ID_KEY;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.X_FORWARDED_FOR_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.X_FORWARDED_HOST_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.X_FORWARDED_PORT_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.X_FORWARDED_PREFIX_HEADER;
import static com.pseudocode.cloud.zuul.filters.support.FilterConstants.X_FORWARDED_PROTO_HEADER;
//PreDecorationFilter是pre最重要的过滤器
//该过滤器为当前请求做一些预处理,比如说,进行路由规则的匹配,在请求上下文中设置该请求的基本信息以及将路由匹配结果等一些设置信息等,
//这些信息将是后续过滤器进行处理的重要依据,可以通过RequestContext.getCurrentContext()来访问这些信息。
//另外,还对HTTP头请求进行处理,其中包含了一些头域,比如X-Forwarded-Host,X-Forwarded-Port。
//对于这些头域是通过zuul.addProxyHeaders参数进行控制的,而这个参数默认值是true,
//所以zuul在请求跳转时默认会为请求增加X-Forwarded-*头域,包括X-Forwarded-Host,X-Forwarded-Port,X-Forwarded-For,X-Forwarded-Prefix,X-Forwarded-Proto。
public class PreDecorationFilter extends ZuulFilter {
private static final Log log = LogFactory.getLog(PreDecorationFilter.class);
@Deprecated
public static final int FILTER_ORDER = PRE_DECORATION_FILTER_ORDER;
private RouteLocator routeLocator;
private String dispatcherServletPath;
private ZuulProperties properties;
private UrlPathHelper urlPathHelper = new UrlPathHelper();
private ProxyRequestHelper proxyRequestHelper;
public PreDecorationFilter(RouteLocator routeLocator, String dispatcherServletPath, ZuulProperties properties,
ProxyRequestHelper proxyRequestHelper) {
this.routeLocator = routeLocator;
this.properties = properties;
this.urlPathHelper.setRemoveSemicolonContent(properties.isRemoveSemicolonContent());
this.dispatcherServletPath = dispatcherServletPath;
this.proxyRequestHelper = proxyRequestHelper;
}
@Override
public int filterOrder() {
return PRE_DECORATION_FILTER_ORDER;
}
@Override
public String filterType() {
return PRE_TYPE;
}
@Override
public boolean shouldFilter() {
RequestContext ctx = RequestContext.getCurrentContext();
return !ctx.containsKey(FORWARD_TO_KEY) // a filter has already forwarded
&& !ctx.containsKey(SERVICE_ID_KEY); // a filter has already determined serviceId
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
final String requestURI = this.urlPathHelper.getPathWithinApplication(ctx.getRequest());
//路由规则的匹配Route
Route route = this.routeLocator.getMatchingRoute(requestURI);
if (route != null) {
String location = route.getLocation();
if (location != null) {
ctx.put(REQUEST_URI_KEY, route.getPath());
ctx.put(PROXY_KEY, route.getId());
//是否添加敏感头信息
if (!route.isCustomSensitiveHeaders()) {
this.proxyRequestHelper.addIgnoredHeaders(this.properties.getSensitiveHeaders().toArray(new String[0]));
}
else {
this.proxyRequestHelper.addIgnoredHeaders(route.getSensitiveHeaders().toArray(new String[0]));
}
if (route.getRetryable() != null) {
ctx.put(RETRYABLE_KEY, route.getRetryable());
}
if (location.startsWith(HTTP_SCHEME+":") || location.startsWith(HTTPS_SCHEME+":")) {
ctx.setRouteHost(getUrl(location));
ctx.addOriginResponseHeader(SERVICE_HEADER, location);
}
else if (location.startsWith(FORWARD_LOCATION_PREFIX)) {
ctx.set(FORWARD_TO_KEY,
StringUtils.cleanPath(location.substring(FORWARD_LOCATION_PREFIX.length()) + route.getPath()));
ctx.setRouteHost(null);
return null;
}
else {
// set serviceId for use in filters.route.RibbonRequest
//微服务
ctx.set(SERVICE_ID_KEY, location);
ctx.setRouteHost(null);
ctx.addOriginResponseHeader(SERVICE_ID_HEADER, location);
}
//是否添加代理头
if (this.properties.isAddProxyHeaders()) {
addProxyHeaders(ctx, route);
String xforwardedfor = ctx.getRequest().getHeader(X_FORWARDED_FOR_HEADER);
String remoteAddr = ctx.getRequest().getRemoteAddr();
if (xforwardedfor == null) {
xforwardedfor = remoteAddr;
}
else if (!xforwardedfor.contains(remoteAddr)) { // Prevent duplicates
xforwardedfor += ", " + remoteAddr;
}
ctx.addZuulRequestHeader(X_FORWARDED_FOR_HEADER, xforwardedfor);
}
//添加host头
if (this.properties.isAddHostHeader()) {
ctx.addZuulRequestHeader(HttpHeaders.HOST, toHostHeader(ctx.getRequest()));
}
}
}
else {
//Route为null,进行相应的fallback处理
log.warn("No route found for uri: " + requestURI);
String fallBackUri = requestURI;
String fallbackPrefix = this.dispatcherServletPath; // default fallback
// servlet is
// DispatcherServlet
if (RequestUtils.isZuulServletRequest()) {
// remove the Zuul servletPath from the requestUri
log.debug("zuulServletPath=" + this.properties.getServletPath());
fallBackUri = fallBackUri.replaceFirst(this.properties.getServletPath(), "");
log.debug("Replaced Zuul servlet path:" + fallBackUri);
}
else {
// remove the DispatcherServlet servletPath from the requestUri
log.debug("dispatcherServletPath=" + this.dispatcherServletPath);
fallBackUri = fallBackUri.replaceFirst(this.dispatcherServletPath, "");
log.debug("Replaced DispatcherServlet servlet path:" + fallBackUri);
}
if (!fallBackUri.startsWith("/")) {
fallBackUri = "/" + fallBackUri;
}
String forwardURI = fallbackPrefix + fallBackUri;
forwardURI = forwardURI.replaceAll("//", "/");
ctx.set(FORWARD_TO_KEY, forwardURI);
}
return null;
}
private void addProxyHeaders(RequestContext ctx, Route route) {
HttpServletRequest request = ctx.getRequest();
String host = toHostHeader(request);
String port = String.valueOf(request.getServerPort());
String proto = request.getScheme();
if (hasHeader(request, X_FORWARDED_HOST_HEADER)) {
host = request.getHeader(X_FORWARDED_HOST_HEADER) + "," + host;
}
if (!hasHeader(request, X_FORWARDED_PORT_HEADER)) {
if (hasHeader(request, X_FORWARDED_PROTO_HEADER)) {
StringBuilder builder = new StringBuilder();
for (String previous : StringUtils.commaDelimitedListToStringArray(request.getHeader(X_FORWARDED_PROTO_HEADER))) {
if (builder.length()>0) {
builder.append(",");
}
builder.append(HTTPS_SCHEME.equals(previous) ? HTTPS_PORT : HTTP_PORT);
}
builder.append(",").append(port);
port = builder.toString();
}
} else {
port = request.getHeader(X_FORWARDED_PORT_HEADER) + "," + port;
}
if (hasHeader(request, X_FORWARDED_PROTO_HEADER)) {
proto = request.getHeader(X_FORWARDED_PROTO_HEADER) + "," + proto;
}
ctx.addZuulRequestHeader(X_FORWARDED_HOST_HEADER, host);
ctx.addZuulRequestHeader(X_FORWARDED_PORT_HEADER, port);
ctx.addZuulRequestHeader(X_FORWARDED_PROTO_HEADER, proto);
addProxyPrefix(ctx, route);
}
private boolean hasHeader(HttpServletRequest request, String name) {
return StringUtils.hasLength(request.getHeader(name));
}
private void addProxyPrefix(RequestContext ctx, Route route) {
String forwardedPrefix = ctx.getRequest().getHeader(X_FORWARDED_PREFIX_HEADER);
String contextPath = ctx.getRequest().getContextPath();
String prefix = StringUtils.hasLength(forwardedPrefix) ? forwardedPrefix
: (StringUtils.hasLength(contextPath) ? contextPath : null);
if (StringUtils.hasText(route.getPrefix())) {
StringBuilder newPrefixBuilder = new StringBuilder();
if (prefix != null) {
if (prefix.endsWith("/") && route.getPrefix().startsWith("/")) {
newPrefixBuilder.append(prefix, 0, prefix.length() - 1);
}
else {
newPrefixBuilder.append(prefix);
}
}
newPrefixBuilder.append(route.getPrefix());
prefix = newPrefixBuilder.toString();
}
if (prefix != null) {
ctx.addZuulRequestHeader(X_FORWARDED_PREFIX_HEADER, prefix);
}
}
private String toHostHeader(HttpServletRequest request) {
int port = request.getServerPort();
if ((port == HTTP_PORT && HTTP_SCHEME.equals(request.getScheme()))
|| (port == HTTPS_PORT && HTTPS_SCHEME.equals(request.getScheme()))) {
return request.getServerName();
}
else {
return request.getServerName() + ":" + port;
}
}
private URL getUrl(String target) {
try {
return new URL(target);
}
catch (MalformedURLException ex) {
throw new IllegalStateException("Target URL is malformed", ex);
}
}
}
| [
"chengz@ccc.com"
] | chengz@ccc.com |
29cc013f6119244e8113eee8fadf19be85fef42e | cab20f5d0bc94f5b2db00f5000482b316e5a5522 | /src/main/java/com/youngxpepp/instagramcloneserver/global/error/ErrorCode.java | 80aa408532b7aa8ff637fc12b0a6d6635457af53 | [] | no_license | leesangsuk-cloud/instagram-clone-server | afbf8cd459f9750b75f918e95a9abe9509e34e91 | 9692692ddc99a0bbbee07a2aaacbe2a72eeba0ea | refs/heads/master | 2023-04-03T13:11:41.177142 | 2021-04-15T07:47:43 | 2021-04-15T07:47:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,823 | java | package com.youngxpepp.instagramcloneserver.global.error;
import lombok.Getter;
import org.springframework.http.HttpStatus;
@Getter
public enum ErrorCode {
INVALID_INPUT_VALUE(1000, HttpStatus.BAD_REQUEST, "Invalid input value"),
METHOD_NOT_ALLOWED(1001, HttpStatus.METHOD_NOT_ALLOWED, "Method is not allowed"),
ENTITY_NOT_FOUND(1002, HttpStatus.NOT_FOUND, "Entity is not found"),
INTERNAL_SERVER_ERROR(1003, HttpStatus.INTERNAL_SERVER_ERROR, "Internal server error"),
INVALID_TYPE_VALUE(1004, HttpStatus.BAD_REQUEST, "Invalid type value"),
HANDLE_ACCESS_DENIED(1005, HttpStatus.FORBIDDEN, "Access is denied"),
ENTITY_ALREADY_EXIST(1006, HttpStatus.BAD_REQUEST, "Entity already exists"),
// Authentication
AUTHENTICATION_FAILED(2000, HttpStatus.BAD_REQUEST, "Authentication is failed"),
JWT_EXPIRED(2001, HttpStatus.BAD_REQUEST, "JsonWebToken is expired"),
NO_AUTHORIZATION(2003, HttpStatus.FORBIDDEN, "No authorization in header"),
JWT_NO_PREFIX(2004, HttpStatus.BAD_REQUEST, "No prefix in jwt"),
JWT_MALFORMED(2005, HttpStatus.BAD_REQUEST, "JsonWebToken is malformed"),
JWT_SIG_INVALID(2006, HttpStatus.BAD_REQUEST, "JsonWebToken signature is invalid"),
JWT_UNSUPPORTED(2007, HttpStatus.BAD_REQUEST, "JsonWebToken format is unsupported"),
JWT_EXCEPTION(2008, HttpStatus.BAD_REQUEST, "JsonWebToken has a problem"),
WRONG_PASSWORD(2009, HttpStatus.BAD_REQUEST, "Password is wrong");
private final int code;
private final HttpStatus httpStatus;
private final String message;
ErrorCode(int code, HttpStatus httpStatus, String message) {
this.code = code;
this.httpStatus = httpStatus;
this.message = message;
}
public static ErrorCode resolve(int code) {
for (ErrorCode element : ErrorCode.values()) {
if (element.getCode() == code) {
return element;
}
}
return null;
}
}
| [
"youngxpepp@gmail.com"
] | youngxpepp@gmail.com |
5856a9790d9e7a4b0c1a00470449234cd86f090e | 741f751c0475eb1a86b46fa449810f7eb3f3d86a | /v2/googlecloud-to-googlecloud/src/main/java/com/google/cloud/teleport/v2/values/PartitionMetadata.java | 34bd28b12910e7cf84a44c212b7e585eabf43801 | [
"Apache-2.0"
] | permissive | mkuthan/DataflowTemplates | 7f844f349cfc589cb899b90de700175975812442 | 0f2353979e797b811727953d3149f50531d87048 | refs/heads/master | 2022-05-21T01:34:52.726207 | 2022-05-05T13:45:52 | 2022-05-05T13:46:26 | 226,102,831 | 0 | 0 | Apache-2.0 | 2019-12-05T12:58:23 | 2019-12-05T12:58:22 | null | UTF-8 | Java | false | false | 2,047 | java | /*
* Copyright (C) 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.cloud.teleport.v2.values;
import static org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkState;
import com.google.api.services.dataplex.v1.model.GoogleCloudDataplexV1Partition;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import java.io.Serializable;
/**
* Partition metadata for Dataplex.
*
* <p>All values are necessary.
*/
@AutoValue
public abstract class PartitionMetadata implements Serializable {
public abstract String location();
public abstract ImmutableList<String> values();
public static Builder builder() {
return new AutoValue_PartitionMetadata.Builder();
}
public GoogleCloudDataplexV1Partition toDataplexPartition() {
return new GoogleCloudDataplexV1Partition().setLocation(location()).setValues(values());
}
/** Builder for {@link PartitionMetadata}. */
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder setLocation(String value);
public abstract Builder setValues(ImmutableList<String> value);
abstract PartitionMetadata autoBuild();
public PartitionMetadata build() {
PartitionMetadata metadata = autoBuild();
checkState(!metadata.location().isEmpty(), "Location cannot be empty");
ImmutableList<String> values = metadata.values();
checkState(!values.isEmpty(), "Values cannot be empty");
return metadata;
}
}
}
| [
"cloud-teleport@google.com"
] | cloud-teleport@google.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.