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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
402d8b1532864f272708f5eb8046973fdc1b082d | 90969b9b6fc14d4c54a34bfc178312d0a550044e | /app/src/test/java/com/theonedayapps/tapnswitch/ExampleUnitTest.java | 21c0bca7686ac985ccee8ab448102b92d387d1c7 | [] | no_license | Atharva1449/Tap-n-Switch | 572b057243a5348deeb3093bf83cfd029ec6ac76 | fe33a54d6f88fa6a5a001824da6f99eed221b139 | refs/heads/main | 2023-02-06T02:29:01.727702 | 2020-12-24T10:51:25 | 2020-12-24T10:51:25 | 303,718,958 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.theonedayapps.tapnswitch;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"atharva.dawande603@gmail.com"
] | atharva.dawande603@gmail.com |
93fe2b463b538bf5cb9c4922b261a61424196393 | 8b277524cd0d5fa38acc54ba7506aed78f4e67ae | /Kaushik_Hibernate/src/main/java/com/rau/hibernate/model/TwoLegsAnimal.java | 3315b5a7c1e693a3c3339897b58167573116af94 | [] | no_license | singhraushan/new_learning | a3ef3381d18d35d5aef6c1b8b9e442a648b75bfe | 165e9467c99021b218ec1d06c432c252f8678cca | refs/heads/master | 2022-12-24T02:28:45.034712 | 2021-12-16T16:22:59 | 2021-12-16T16:22:59 | 145,468,324 | 4 | 1 | null | 2022-12-16T04:35:20 | 2018-08-20T20:40:29 | Java | UTF-8 | Java | false | false | 864 | java | /**
*
*/
package com.rau.hibernate.model;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
/**
* @author Raushan kumar
*
*/
@Entity
@DiscriminatorValue("TWO_LEGS_ANIMAL")// not mandatory, just for specific value in Discriminator column
public class TwoLegsAnimal extends Animal {
private boolean haveTail;
private String colour;
/**
* @return the haveTail
*/
public boolean isHaveTail() {
return haveTail;
}
/**
* @param haveTail
* the haveTail to set
*/
public void setHaveTail(boolean haveTail) {
this.haveTail = haveTail;
}
/**
* @return the colour
*/
public String getColour() {
return colour;
}
/**
* @param colour
* the colour to set
*/
public void setColour(String colour) {
this.colour = colour;
}
}
| [
"31724633+singhraushan@users.noreply.github.com"
] | 31724633+singhraushan@users.noreply.github.com |
fd738d895d3a817fb05d7511976c823e818412fb | 1d62ea55f6d8e32f538b60e22fb4273e62f770c4 | /src/ThreadStudy/TreadPoolTest.java | 39a01fbedd6347adb5f8b7a431f931fbb93f5593 | [] | no_license | Anapplewj/Learn_java | 0797ad01221c6bfe26af2ba8e75f3483d6bfcaf9 | c6c3bc42f00559cbd8a13800221fa28318e3ee34 | refs/heads/master | 2023-06-29T19:01:33.300267 | 2021-08-07T13:12:45 | 2021-08-07T13:12:45 | 317,239,720 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | package ThreadStudy;
import java.util.concurrent.*;
public class TreadPoolTest {
private Object NullPointerException;
public static void main(String[] args) {
ThreadPoolExecutor pool=new ThreadPoolExecutor(
4,
10,
60,
TimeUnit.SECONDS,
new LinkedBlockingQueue<>(),
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return new Thread(r);
}
},
new ThreadPoolExecutor.CallerRunsPolicy()
// new ThreadPoolExecutor.AbortPolicy()
// new ThreadPoolExecutor.DiscardPolicy()
// new ThreadPoolExecutor.DiscardOldestPolicy()
);
pool.execute(new Runnable() {
@Override
public void run() {
System.out.println(1);
}
});
ExecutorService single=Executors.newSingleThreadExecutor();
ExecutorService fixed=Executors.newFixedThreadPool(4);
ExecutorService catched=Executors.newCachedThreadPool();
ScheduledExecutorService scheduled=Executors.newScheduledThreadPool(4);
}
}
| [
"2648175705@qq.com"
] | 2648175705@qq.com |
dff915ddf5cfc9eab9a74020f855cad780302c2b | 592eb3c39bbd5550c5406abdfd45f49c24e6fd6c | /autoweb/src/main/java/com/surveygen/struts/action/SurveyGenLoginViewAction.java | 3efb7771bfbf5c5e24831bf3dcd817e8aa497d06 | [] | no_license | passionblue/autoweb | f77dc89098d59fddc48a40a81f2f2cf27cd08cfb | 8ea27a5b83f02f4f0b66740b22179bea4d73709e | refs/heads/master | 2021-01-17T20:33:28.634291 | 2016-06-17T01:38:45 | 2016-06-17T01:38:45 | 60,968,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | /*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.surveygen.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.jtrend.struts.core.DefaultViewManager;
import com.jtrend.struts.core.LoginViewAction;
import com.jtrend.struts.core.ViewAction;
import com.surveygen.app.SurveyGenAppInitiator;
import com.surveygen.app.SurveyGenViewManager;
import com.surveygen.db.User;
import com.surveygen.ds.UserDS;
import com.surveygen.struts.form.LoginForm;
/**
* MyEclipse Struts
* Creation date: 07-14-2007
*
* XDoclet definition:
* @struts.action path="/loginFormSubmit" name="loginForm" input="/jsp/form/login.jsp" scope="request" validate="true"
* @struts.action-forward name="default" path="/jsp/layout/layout.jsp"
*/
public class SurveyGenLoginViewAction extends LoginViewAction {
/*
public void initApp() {
try {
m_logger.debug("SurveyGenCoreAction.initApp()");
SurveyGenAppInitiator.init();
} catch (Exception e) {
m_logger.error(e);
}
//m_viewManager = SurveyGenViewManager.getInstance();
m_viewManager = DefaultViewManager.getInstance();
}
*/
private static Logger m_logger = Logger.getLogger(SurveyGenLoginViewAction.class);
} | [
"joshua@joshua-dell"
] | joshua@joshua-dell |
54526b7593381a41d16e16b74dea2288a070805f | ea2e35711386d34e1bdfef8a15e71fa734281f6e | /src/main/java/chap03/Smaple01.java | b32cf0e3d10de0065fc24f58b14e0c0f906a786c | [] | no_license | SHINDONGDONG/JavaRemind | d86cbed8568d40141597b5d6e1374c7264494c85 | 01515944cf0cc3f93fa9c340cd4d8146ef2f4f80 | refs/heads/master | 2023-01-27T11:41:36.018061 | 2020-12-10T22:26:54 | 2020-12-10T22:26:54 | 316,898,671 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package chap03;
public class Smaple01 {
/**
* @param args
* alt+shift + j가 주석 입니다.
*/
public static void main(String[] args) {
System.out.println("1234");
System.out.println("1234");
System.out.println("1234");
System.out.println("1234");
System.out.println("1234");
System.out.println("1234");
}
}
| [
"homerjay@naver.com"
] | homerjay@naver.com |
a324ec305bbc2045613e38d1ddb70fd34a328db7 | 308fd86b83256ba55d1183257be483fee8378e55 | /src/javaapplication1/ArraylistExample2.java | 9db84c4dbaac8f2e6914a5787f02f90c2713529b | [] | no_license | Navpreet76/java_review | dbf8bce344aefc35c314112b924b9571a77217e8 | 925e5b5a773c737e2c5ccb9e0d03a7742ef08ac0 | refs/heads/master | 2021-04-27T08:06:31.026889 | 2018-02-23T16:42:18 | 2018-02-23T16:42:18 | 122,646,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java |
package javaapplication1;
import java.util.*;
public class ArraylistExample2 {
public static void main(String[] args) {
ArrayList<String>list = new ArrayList<String>();//Create Array list
list.add("Nick");//Adding objects to array list
list.add("Navpreet");
list.add("Michelle");
list.add("Clive");
list.add("Nancy");
//Traversing through the list with Iterator
Iterator itr = list.iterator();
while(itr.hasNext())
{
System.out.println(itr.next());
}
}
}
| [
"colchhina@192.168.1.101"
] | colchhina@192.168.1.101 |
f7e606a9ba779f933b5f0b3452593c1409673a87 | 0df3b7512ca516ebe2e79091689623afaed61c20 | /test/helloworldmvc/model/BDModelImplementationTest.java | 75f4acdb12305558ad85a29eafdd27b48c7950e6 | [] | no_license | UnaiUrti/Reto0DIN | bb3da9fc184c0b0eb9658d01d910236f334533ba | 0e311a8c2c02ec2cd4e93816c025942f9d133e10 | refs/heads/master | 2023-08-18T14:51:42.242362 | 2021-09-30T07:24:08 | 2021-09-30T07:24:08 | 407,517,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | 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 helloworldmvc.model;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author UnaiUrtiaga,AdrianFranco
*/
public class BDModelImplementationTest {
/**
* This is the test class which tests if the database implementation
* works right
*/
@Test
public void testGetGreeting() {
Model model = new FileModelImplementation();
String greet = "HELLO WORLD!";
assertEquals(greet, model.getGreeting());
}
}
| [
"penemax572@gmail.com"
] | penemax572@gmail.com |
89345cd646dd4950202fa325f4adbfb11f2c30f4 | 94f6f2a555e02a8439515418073034ef737e7311 | /app/src/main/java/com/codewithdj/heal_player/MusicAdapter.java | 1bf112b843520b0022add35f51c871ddcd6d3ca2 | [] | no_license | YudhishSharma/Music_Player_App | 14789bf8972fc47e862584a595d944344024ff1f | 5f95aeec7b25d943874eb182d259d7cb327b37c8 | refs/heads/master | 2023-03-16T06:50:24.072785 | 2021-02-24T09:57:28 | 2021-02-24T09:57:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,215 | java | package com.codewithdj.heal_player;
import android.content.Context;
import android.content.Intent;
import android.media.MediaMetadataRetriever;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.MyViewHolder> {
private Context mContext;
static ArrayList<MusicFiles> mFiles;
MusicAdapter(Context mContext , ArrayList<MusicFiles> mFiles)
{
this.mFiles = mFiles;
this.mContext = mContext;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.music_items , parent , false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, final int position) {
holder.file_name.setText(mFiles.get(position).getTitle());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext , PlayerActivity.class);
intent.putExtra("position" , position );
mContext.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return mFiles.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView file_name;
ImageView album_art;
public MyViewHolder(View itemView) {
super(itemView);
file_name = itemView.findViewById(R.id.music_file_name);
album_art = itemView.findViewById(R.id.music_img);
}
}
void updateList(ArrayList<MusicFiles> musicFilesArrayList)
{
mFiles = new ArrayList<>();
mFiles.addAll(musicFilesArrayList);
notifyDataSetChanged();
}
}
| [
"djyudi23sep@gmail.com"
] | djyudi23sep@gmail.com |
676ea57b95fbfa8a32e2b8a8e9b2b4205d7ad14f | 9cc774ed55147d9bfe12f5127640114a6682a0c0 | /Tank Game/project_intResources/MultiplayersTankGame/MapLoader.java | ed08b625e1c0e901e8d003afc7ed4672d7b15a4f | [] | no_license | ShanKwanCho/CSC_413_SP18 | eb31257c75a4fb5f154c2f143f0710a7657e67f3 | 7aca2d15b8bcf012f67d38e7f916aebed3ff59b1 | refs/heads/master | 2020-03-23T17:09:02.710498 | 2018-07-21T21:44:05 | 2018-07-21T21:44:05 | 141,845,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,286 | java | import java.io.*;
import java.util.List;
import java.util.ArrayList;
import java.net.*;
public class MapLoader {
// MapLoader is a singleton class!
private static final MapLoader mapLoader = new MapLoader();
private BufferedReader br = null;
private static final int SIZE = 40;
int lineNumber = 0;
int columnNumber = 0;
List<Location> wallMap = new ArrayList<Location>();
public void read() {
URL url = MapLoader.class.getResource("Resources/wallMap");
try {
br = new BufferedReader(new InputStreamReader(url.openStream())); // BufferedReader should read from URL
while (true) {
String line = br.readLine();
if (line == null) {
break;
}
char [] charArray = line.toCharArray();
for (int i = 0; i < SIZE; i++) {
if (charArray[i] == 'P') {
wallMap.add(new Location(i, lineNumber, "Wall"));
} else if (charArray[i] == 'D') {
wallMap.add(new Location(i, lineNumber, "DestructableWall"));
}
}
lineNumber++;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
public List<Location> getWallMap() {
return wallMap;
}
public static MapLoader getInstance() {
return mapLoader;
}
}
| [
"scho4@mail.sfsu.edu"
] | scho4@mail.sfsu.edu |
c423056b39bdd820758bc69eaf2713e7afdb8ed6 | 4fca4e3208e09ddaaf12c044c1edc9f98ffa2a8b | /app/src/main/java/com/taniaticona/servicios/clinicadental/ItemDetailActivity.java | 1522ca9a122e29879eaa8662ed3da68782f6a1dd | [] | no_license | JackieTC/AppBasico | 53b46b28e2c0963ca678b22f161f2af0f89e6af2 | f5427ce5fd99232520b7f294548b8fb93316c859 | refs/heads/master | 2021-01-10T16:27:10.800427 | 2016-01-12T06:20:10 | 2016-01-12T06:20:10 | 49,477,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,564 | java | package com.taniaticona.servicios.clinicadental;
import android.support.v7.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.View;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.widget.TextView;
/**
* An activity representing a single Item detail screen. This
* activity is only used on handset devices. On tablet-size devices,
* item details are presented side-by-side with a list of items
* in a {@link ItemListActivity}.
* <p/>
* This activity is mostly just a 'shell' activity containing nothing
* more than a {@link ItemDetailFragment}.
*/
public class ItemDetailActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//agregue
setContentView(R.layout.activity_item_detail);
Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "consultas al correo: INFO@BRILLANTESONRISA.COM", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
// Show the Up button in the action bar.
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// savedInstanceState is non-null when there is fragment state
// saved from previous configurations of this activity
// (e.g. when rotating the screen from portrait to landscape).
// In this case, the fragment will automatically be re-added
// to its container so we don't need to manually add it.
// For more information, see the Fragments API guide at:
//
// http://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity
// using a fragment transaction.
Bundle arguments = new Bundle();
arguments.putString(ItemDetailFragment.ARG_ITEM_ID,
getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID));
ItemDetailFragment fragment = new ItemDetailFragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.item_detail_container, fragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
NavUtils.navigateUpTo(this, new Intent(this, ItemListActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"jackeline15tc@gmail.com"
] | jackeline15tc@gmail.com |
25c8df438193c1833b4500bd462d079d83690f70 | 302c4b0f382629b8fb898546c62bc82dd6288edf | /src/main/java/com/suzhoukeleqi/entity/ProductListItem.java | 3b304f8ddf3edc66781759daf86199813a426fef | [
"MIT"
] | permissive | 499636235/Szkeleqi | 7ee613d1aa8319ee517d86b316eb065543236689 | 920259ea7bbd666b87dc171b47581d261cd6850b | refs/heads/master | 2023-05-15T06:08:53.504072 | 2021-06-05T16:51:29 | 2021-06-05T16:51:29 | 290,834,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package com.suzhoukeleqi.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductListItem {
private Integer listIndex;
private Integer productId;
private String productName;
private String picturePath;
}
| [
"499636235@qq.com"
] | 499636235@qq.com |
c79496c2e5ae43a7a007e20e7067bac74e932521 | bbad69822950e11b5ba9638f3d7493a16aeeaaba | /src/main/java/com/mxdl/service/NewsTypeService.java | 08be1bf3d84255b7bc1ce9d33bf5829388d5687a | [] | no_license | mxdldev/spring-boot-security-oauth2-flycloud | 609295df52e60bfcee1d94d6c43107e2dbc24955 | 369400e3d330509bc4095256817d09f3abe77dc7 | refs/heads/master | 2021-04-16T20:39:54.883819 | 2020-03-23T09:22:40 | 2020-03-23T09:22:40 | 249,383,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.mxdl.service;
import com.mxdl.dao.NewsTypeDao;
import com.mxdl.model.NewsType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Description: <BlogService><br>
* Author: mxdl<br>
* Date: 2019/2/19<br>
* Version: V1.0.0<br>
* Update: <br>
*/
@Service
public class NewsTypeService {
@Autowired
NewsTypeDao newsTypeDao;
public NewsType saveNewsType(NewsType newstype) {
return newsTypeDao.save(newstype);
}
public void deleteBlog(long id) {
newsTypeDao.delete(id);
}
public List<NewsType> findListNewsType(){
return newsTypeDao.findAll();
}
}
| [
"geduo_83@163.com"
] | geduo_83@163.com |
6d112c548fc1559e2bb1c24511cc4ec51bbab390 | 70d5c4d4cccca08672a92cc485cb22a55257c75a | /151-Reverse-Words-in-a-String/solution.java | 54ce587317eafa9954b825ec79d1a611c5f8453a | [] | no_license | always414/leetcode | 097001a318aaf7fae14e13a8b8790dd4ff52cdb8 | ec23770f2ad926337fd7553621e11ed147d44b2a | refs/heads/master | 2020-04-06T07:07:58.297239 | 2016-08-31T04:44:39 | 2016-08-31T04:44:39 | 60,560,541 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 480 | java | import java.util.Arrays;
public class Solution {
public String reverseWords(String s) {
String[] beforeReverse = s.split("\\s+");
StringBuilder sb = new StringBuilder();
for (int i = beforeReverse.length - 1; i >= 0; i--) {
if (beforeReverse[i].length() > 0) {
if (i != beforeReverse.length-1) {
sb.append(" ");
}
sb.append(beforeReverse[i]);
}
}
return sb.toString();
}
} | [
"yichenzhang14@gmail.com"
] | yichenzhang14@gmail.com |
ba7197dd7aa60571855d02151b649f7cfad110c8 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-tnb/src/main/java/com/amazonaws/services/tnb/model/transform/DeleteSolFunctionPackageRequestMarshaller.java | b5abc7a8502d2014aee5fa5107c7c1c8fd2219ff | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 2,085 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.tnb.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.tnb.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DeleteSolFunctionPackageRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DeleteSolFunctionPackageRequestMarshaller {
private static final MarshallingInfo<String> VNFPKGID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH)
.marshallLocationName("vnfPkgId").build();
private static final DeleteSolFunctionPackageRequestMarshaller instance = new DeleteSolFunctionPackageRequestMarshaller();
public static DeleteSolFunctionPackageRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(DeleteSolFunctionPackageRequest deleteSolFunctionPackageRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteSolFunctionPackageRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteSolFunctionPackageRequest.getVnfPkgId(), VNFPKGID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
fec80466f2a39e65f5c2ff103d21cbbaae113060 | f1144a202eda18f693b5cb005d763b5ec2d45bb3 | /br.com.agilbits.swt.extension/src/br/com/agilbits/swt/extension/zoom/FitToWidthZoom.java | 77d2fc6784a7495ce1fb89c698ff7f2a60d3c935 | [] | no_license | agilbits/eclipse_editor_widget | 9d28f442587e38e14db27f43be957c3155895c2d | 08c674a98a5da88517aecb08a23dd1e9d1ab2aa3 | refs/heads/master | 2016-09-01T22:12:40.669124 | 2011-10-28T03:32:44 | 2011-10-28T03:32:44 | 2,662,813 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 812 | java | package br.com.agilbits.swt.extension.zoom;
import org.eclipse.swt.custom.ExtendedStyledText;
public class FitToWidthZoom implements ZoomOption {
public static final Float CODE = -2f;
public double getScalingFactor(ExtendedStyledText styledText) {
double fullWidth = styledText.getPageWidth() + 2 * ExtendedStyledText.EXTERNAL_PAGE_MARGIN;
return styledText.getClientArea().width / fullWidth;
}
@Override
public int hashCode() {
return 13;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
return true;
}
public Float getZoomCode() {
return CODE;
}
}
| [
"thenano@gmail.com"
] | thenano@gmail.com |
2c0836d489a697621e1ff085bd1f41b76b04d039 | 56cd784b8e6ddab76ea98a4946f609e9f5e8f720 | /app/src/main/java/com/bingley/materialdesign/utils/newj/LogUtils.java | 903e41bac99ee51852c8800250bb0ce9a70870f8 | [] | no_license | bingely/materialDesign | 02fbc701e6517e17c82e4acfec18a4ffc9fcac74 | ff59c071b6f6d4c3fb8b3ceef45aad521b1fe83f | refs/heads/master | 2021-01-13T14:40:07.248334 | 2017-06-21T09:32:58 | 2017-06-21T09:32:58 | 76,615,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,878 | java | package com.bingley.materialdesign.utils.newj;
import android.os.Environment;
import android.support.annotation.IntDef;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Formatter;
import java.util.Locale;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/09/21
* desc : Log相关工具类
* </pre>
*/
public final class LogUtils {
public static final int V = Log.VERBOSE;
public static final int D = Log.DEBUG;
public static final int I = Log.INFO;
public static final int W = Log.WARN;
public static final int E = Log.ERROR;
public static final int A = Log.ASSERT;
@IntDef({V, D, I, W, E, A})
@Retention(RetentionPolicy.SOURCE)
private @interface TYPE {
}
private static final char[] T = new char[]{'V', 'D', 'I', 'W', 'E', 'A'};
private static final int FILE = 0x10;
private static final int JSON = 0x20;
private static final int XML = 0x30;
private static ExecutorService executor;
private static String defaultDir;// log默认存储目录
private static String dir; // log存储目录
private static boolean sLogSwitch = true; // log总开关,默认开
private static boolean sLog2ConsoleSwitch = true; // logcat是否打印,默认打印
private static String sGlobalTag = null; // log标签
private static boolean sTagIsSpace = true; // log标签是否为空白
private static boolean sLogHeadSwitch = true; // log头部开关,默认开
private static boolean sLog2FileSwitch = false;// log写入文件开关,默认关
private static boolean sLogBorderSwitch = true; // log边框开关,默认开
private static int sConsoleFilter = V; // log控制台过滤器
private static int sFileFilter = V; // log文件过滤器
private static final String FILE_SEP = System.getProperty("file.separator");
private static final String LINE_SEP = System.getProperty("line.separator");
private static final String TOP_BORDER = "╔═══════════════════════════════════════════════════════════════════════════════════════════════════";
private static final String LEFT_BORDER = "║ ";
private static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════════════════════════════";
private static final int MAX_LEN = 4000;
private static final Format FORMAT = new SimpleDateFormat("MM-dd HH:mm:ss.SSS ", Locale.getDefault());
private static final String NULL_TIPS = "Log with null object.";
private static final String NULL = "null";
private static final String ARGS = "args";
private LogUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
public static class Builder {
public Builder() {
if (defaultDir != null) return;
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
&& Utils.getContext().getExternalCacheDir() != null)
defaultDir = Utils.getContext().getExternalCacheDir() + FILE_SEP + "log" + FILE_SEP;
else {
defaultDir = Utils.getContext().getCacheDir() + FILE_SEP + "log" + FILE_SEP;
}
}
public Builder setLogSwitch(boolean logSwitch) {
LogUtils.sLogSwitch = logSwitch;
return this;
}
public Builder setConsoleSwitch(boolean consoleSwitch) {
LogUtils.sLog2ConsoleSwitch = consoleSwitch;
return this;
}
public Builder setGlobalTag(final String tag) {
if (isSpace(tag)) {
LogUtils.sGlobalTag = "";
sTagIsSpace = true;
} else {
LogUtils.sGlobalTag = tag;
sTagIsSpace = false;
}
return this;
}
public Builder setLogHeadSwitch(boolean logHeadSwitch) {
LogUtils.sLogHeadSwitch = logHeadSwitch;
return this;
}
public Builder setLog2FileSwitch(boolean log2FileSwitch) {
LogUtils.sLog2FileSwitch = log2FileSwitch;
return this;
}
public Builder setDir(final String dir) {
if (isSpace(dir)) {
LogUtils.dir = null;
} else {
LogUtils.dir = dir.endsWith(FILE_SEP) ? dir : dir + FILE_SEP;
}
return this;
}
public Builder setDir(final File dir) {
LogUtils.dir = dir == null ? null : dir.getAbsolutePath() + FILE_SEP;
return this;
}
public Builder setBorderSwitch(boolean borderSwitch) {
LogUtils.sLogBorderSwitch = borderSwitch;
return this;
}
public Builder setConsoleFilter(@TYPE int consoleFilter) {
LogUtils.sConsoleFilter = consoleFilter;
return this;
}
public Builder setFileFilter(@TYPE int fileFilter) {
LogUtils.sFileFilter = fileFilter;
return this;
}
@Override
public String toString() {
return "switch: " + sLogSwitch
+ LINE_SEP + "console: " + sLog2ConsoleSwitch
+ LINE_SEP + "tag: " + (sTagIsSpace ? "null" : sGlobalTag)
+ LINE_SEP + "head: " + sLogHeadSwitch
+ LINE_SEP + "file: " + sLog2FileSwitch
+ LINE_SEP + "dir: " + (dir == null ? defaultDir : dir)
+ LINE_SEP + "border: " + sLogBorderSwitch
+ LINE_SEP + "consoleFilter: " + T[sConsoleFilter - V]
+ LINE_SEP + "fileFilter: " + T[sFileFilter - V];
}
}
public static void v(Object contents) {
log(V, sGlobalTag, contents);
}
public static void v(String tag, Object... contents) {
log(V, tag, contents);
}
public static void d(Object contents) {
log(D, sGlobalTag, contents);
}
public static void d(String tag, Object... contents) {
log(D, tag, contents);
}
public static void i(Object contents) {
log(I, sGlobalTag, contents);
}
public static void i(String tag, Object... contents) {
log(I, tag, contents);
}
public static void w(Object contents) {
log(W, sGlobalTag, contents);
}
public static void w(String tag, Object... contents) {
log(W, tag, contents);
}
public static void e(Object contents) {
log(E, sGlobalTag, contents);
}
public static void e(String tag, Object... contents) {
log(E, tag, contents);
}
public static void a(Object contents) {
log(A, sGlobalTag, contents);
}
public static void a(String tag, Object... contents) {
log(A, tag, contents);
}
public static void file(Object contents) {
log(FILE | D, sGlobalTag, contents);
}
public static void file(@TYPE int type, Object contents) {
log(FILE | type, sGlobalTag, contents);
}
public static void file(String tag, Object contents) {
log(FILE | D, tag, contents);
}
public static void file(@TYPE int type, String tag, Object contents) {
log(FILE | type, tag, contents);
}
public static void json(String contents) {
log(JSON | D, sGlobalTag, contents);
}
public static void json(@TYPE int type, String contents) {
log(JSON | type, sGlobalTag, contents);
}
public static void json(String tag, String contents) {
log(JSON | D, tag, contents);
}
public static void json(@TYPE int type, String tag, String contents) {
log(JSON | type, tag, contents);
}
public static void xml(String contents) {
log(XML | D, sGlobalTag, contents);
}
public static void xml(@TYPE int type, String contents) {
log(XML | type, sGlobalTag, contents);
}
public static void xml(String tag, String contents) {
log(XML | D, tag, contents);
}
public static void xml(@TYPE int type, String tag, String contents) {
log(XML | type, tag, contents);
}
private static void log(final int type, String tag, final Object... contents) {
if (!sLogSwitch || (!sLog2ConsoleSwitch && !sLog2FileSwitch)) return;
int type_low = type & 0x0f, type_high = type & 0xf0;
if (type_low < sConsoleFilter && type_low < sFileFilter) return;
final String[] tagAndHead = processTagAndHead(tag);
String body = processBody(type_high, contents);
if (sLog2ConsoleSwitch && type_low >= sConsoleFilter) {
print2Console(type_low, tagAndHead[0], tagAndHead[1] + body);
}
if (sLog2FileSwitch || type_high == FILE) {
if (type_low >= sFileFilter) print2File(type_low, tagAndHead[0], tagAndHead[2] + body);
}
}
private static String[] processTagAndHead(String tag) {
if (!sTagIsSpace && !sLogHeadSwitch) {
tag = sGlobalTag;
} else {
StackTraceElement targetElement = new Throwable().getStackTrace()[3];
String className = targetElement.getClassName();
String[] classNameInfo = className.split("\\.");
if (classNameInfo.length > 0) {
className = classNameInfo[classNameInfo.length - 1];
}
if (className.contains("$")) {
className = className.split("\\$")[0];
}
if (sTagIsSpace) {
tag = isSpace(tag) ? className : tag;
}
if (sLogHeadSwitch) {
String head = new Formatter()
.format("%s, %s(%s.java:%d)",
Thread.currentThread().getName(),
targetElement.getMethodName(),
className,
targetElement.getLineNumber())
.toString();
return new String[]{tag, head + LINE_SEP, " [" + head + "]: "};
}
}
return new String[]{tag, "", ": "};
}
private static String processBody(int type, Object... contents) {
String body = NULL_TIPS;
if (contents != null) {
if (contents.length == 1) {
Object object = contents[0];
body = object == null ? NULL : object.toString();
if (type == JSON) {
body = formatJson(body);
} else if (type == XML) {
body = formatXml(body);
}
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0, len = contents.length; i < len; ++i) {
Object content = contents[i];
sb.append(ARGS)
.append("[")
.append(i)
.append("]")
.append(" = ")
.append(content == null ? NULL : content.toString())
.append(LINE_SEP);
}
body = sb.toString();
}
}
return body;
}
private static String formatJson(String json) {
try {
if (json.startsWith("{")) {
json = new JSONObject(json).toString(4);
} else if (json.startsWith("[")) {
json = new JSONArray(json).toString(4);
}
} catch (JSONException e) {
e.printStackTrace();
}
return json;
}
private static String formatXml(String xml) {
try {
Source xmlInput = new StreamSource(new StringReader(xml));
StreamResult xmlOutput = new StreamResult(new StringWriter());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
transformer.transform(xmlInput, xmlOutput);
xml = xmlOutput.getWriter().toString().replaceFirst(">", ">" + LINE_SEP);
} catch (Exception e) {
e.printStackTrace();
}
return xml;
}
private static void print2Console(final int type, String tag, String msg) {
if (sLogBorderSwitch) {
print(type, tag, TOP_BORDER);
msg = addLeftBorder(msg);
}
int len = msg.length();
int countOfSub = len / MAX_LEN;
if (countOfSub > 0) {
print(type, tag, msg.substring(0, MAX_LEN));
String sub;
int index = MAX_LEN;
for (int i = 1; i < countOfSub; i++) {
sub = msg.substring(index, index + MAX_LEN);
print(type, tag, sLogBorderSwitch ? LEFT_BORDER + sub : sub);
index += MAX_LEN;
}
sub = msg.substring(index, len);
print(type, tag, sLogBorderSwitch ? LEFT_BORDER + sub : sub);
} else {
print(type, tag, msg);
}
if (sLogBorderSwitch) print(type, tag, BOTTOM_BORDER);
}
private static void print(final int type, final String tag, String msg) {
Log.println(type, tag, msg);
}
private static String addLeftBorder(String msg) {
if (!sLogBorderSwitch) return msg;
StringBuilder sb = new StringBuilder();
String[] lines = msg.split(LINE_SEP);
for (String line : lines) {
sb.append(LEFT_BORDER).append(line).append(LINE_SEP);
}
return sb.toString();
}
private static void print2File(final int type, final String tag, final String msg) {
Date now = new Date(System.currentTimeMillis());
String format = FORMAT.format(now);
String date = format.substring(0, 5);
String time = format.substring(6);
final String fullPath = (dir == null ? defaultDir : dir) + date + ".txt";
if (!createOrExistsFile(fullPath)) {
Log.e(tag, "log to " + fullPath + " failed!");
return;
}
StringBuilder sb = new StringBuilder();
sb.append(time)
.append(T[type - V])
.append("/")
.append(tag)
.append(msg)
.append(LINE_SEP);
final String content = sb.toString();
if (executor == null) {
executor = Executors.newSingleThreadExecutor();
}
executor.execute(new Runnable() {
@Override
public void run() {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(fullPath, true));
bw.write(content);
Log.d(tag, "log to " + fullPath + " success!");
} catch (IOException e) {
e.printStackTrace();
Log.e(tag, "log to " + fullPath + " failed!");
} finally {
try {
if (bw != null) {
bw.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
});
}
private static boolean createOrExistsFile(String filePath) {
File file = new File(filePath);
if (file.exists()) return file.isFile();
if (!createOrExistsDir(file.getParentFile())) return false;
try {
return file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
private static boolean createOrExistsDir(File file) {
return file != null && (file.exists() ? file.isDirectory() : file.mkdirs());
}
private static boolean isSpace(String s) {
if (s == null) return true;
for (int i = 0, len = s.length(); i < len; ++i) {
if (!Character.isWhitespace(s.charAt(i))) {
return false;
}
}
return true;
}
public static byte[] compress(byte input[]) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Deflater compressor = new Deflater(1);
try {
compressor.setInput(input);
compressor.finish();
final byte[] buf = new byte[2048];
while (!compressor.finished()) {
int count = compressor.deflate(buf);
bos.write(buf, 0, count);
}
} finally {
compressor.end();
}
return bos.toByteArray();
}
public static byte[] uncompress(byte[] input) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Inflater decompressor = new Inflater();
try {
decompressor.setInput(input);
final byte[] buf = new byte[2048];
while (!decompressor.finished()) {
int count = 0;
try {
count = decompressor.inflate(buf);
} catch (DataFormatException e) {
e.printStackTrace();
}
bos.write(buf, 0, count);
}
} finally {
decompressor.end();
}
return bos.toByteArray();
}
} | [
"linmb@qq.com"
] | linmb@qq.com |
2c3ad1d724c0c76deee772b66242c41d831fac85 | 251603bf9844702d724ee10584e7bdba88e0a9b2 | /app/src/main/java/com/example/mysecondapp/MainActivity.java | 83c1d074749f94e64cc727a81662ca38015c8e8a | [] | no_license | VanCleef76/AndroidHomeWork1 | 3785b332e7a55eb0aff86a7ddc6303292f32a5be | a4763dc95e108d6521e20631f703950d41a59028 | refs/heads/master | 2023-04-19T15:50:44.563242 | 2021-04-26T18:04:52 | 2021-04-26T18:04:52 | 361,851,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.example.mysecondapp;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"gogos76@mail.ru"
] | gogos76@mail.ru |
1b0b0e38f9bc18d6732285d2499b68468bd2bc19 | 80419f33ff8c977032b514f65e09e9d3e6cdb6df | /src/main/java/co/cpl/service/impl/BussinessManagerImpl.java | f8f6c9503add8b8e92d0fe633b7229b78f967e62 | [] | no_license | otonielmax/cpl-incidence-be-api | 7a91dbdb0033c759504c93b9245db429b68da83d | d3b417e0d740b1b2ba33cb9d5a10f0634a987e63 | refs/heads/master | 2020-04-02T14:26:19.683296 | 2019-02-08T16:27:03 | 2019-02-08T16:27:03 | 154,524,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,147 | java | /******************************************************************
*
* This code is for the Complaints service project.
*
*
* © 2018, Complaints Management All rights reserved.
*
*
******************************************************************/
package co.cpl.service.impl;
import co.cpl.data.IncidenceImageRepository;
import co.cpl.domain.Incidence;
import co.cpl.domain.IncidenceImage;
import co.cpl.domain.Users;
import co.cpl.dto.IncidenceDto;
import co.cpl.dto.IncidenceImageDto;
import co.cpl.dto.UsersDto;
import co.cpl.service.BusinessManager;
import co.cpl.data.IncidenceRepository;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
/***
* Implementation for business manager module
*
* @author jmunoz
*
*/
@Component
public class BussinessManagerImpl implements BusinessManager{
//private IncidenceRepository IncidenceRepository;
private static IncidenceRepository incidenceRepository;
private static IncidenceImageRepository incidenceImageRepository;
public BussinessManagerImpl() {
incidenceRepository = new IncidenceRepository();
incidenceImageRepository = new IncidenceImageRepository();
}
@Override
public IncidenceDto findIncidenceById(String Id) {
Optional<Incidence> users = incidenceRepository.findIncidenceById(Id);
if (!users.isPresent()) {throw new HttpClientErrorException(HttpStatus.NOT_FOUND); }
//TODO: Replace this code for mapper approach
IncidenceDto response = new IncidenceDto();
response.setId(users.get().getId());
response.setTitle(users.get().getTitle());
response.setDescription(users.get().getDescription());
response.setDateDevice(users.get().getDate_device());
response.setDateUser(users.get().getDate_user());
response.setPlaca(users.get().getPlaca());
response.setStatus(users.get().getStatus());
response.setType(users.get().getType());
response.setCreateDate(users.get().getCreatedAt());
response.setUpdateDate(users.get().getUpdatedAt());
response.setDirectionGpsLat(users.get().getDirectionGpsLat());
response.setDirectionGpsLng(users.get().getDirectionGpsLng());
response.setDirectionUserLat(users.get().getDirectionUserLat());
response.setDirectionUserLng(users.get().getDirectionUserLng());
return response;
}
@Override
public List<IncidenceDto> findIncidenceByIdUser(String id) {
List<Incidence> users = incidenceRepository.findIncidenceByIdUser(id);
List<IncidenceDto> response = new LinkedList<>();
if(users.isEmpty()) {
return response;
}
for (Incidence user: users) {
IncidenceDto userDto = new IncidenceDto();
userDto.setId(user.getId());
userDto.setTitle(user.getTitle());
userDto.setDescription(user.getDescription());
userDto.setPlaca(user.getPlaca());
userDto.setDateDevice(user.getDate_device());
userDto.setDateUser(user.getDate_user());
userDto.setDirectionGps(user.getDirection_gps());
userDto.setStatus(user.getStatus());
userDto.setType(user.getType());
userDto.setDirectionUser(user.getDirection_user());
userDto.setCreateDate(user.getCreatedAt());
userDto.setUpdateDate(user.getUpdatedAt());
userDto.setDirectionGpsLat(user.getDirectionGpsLat());
userDto.setDirectionGpsLng(user.getDirectionGpsLng());
userDto.setDirectionUserLat(user.getDirectionUserLat());
userDto.setDirectionUserLng(user.getDirectionUserLng());
response.add(userDto);
}
return response;
}
@Override
public String getLastIdIncidence() {
List<Incidence> users = incidenceRepository.getLastIdIncidence();
if(users.isEmpty()) {
return null;
}
return users.get(0).getId();
}
@Override
public List<IncidenceDto> getIncidences(int limit, int offset) {
List<Incidence> users = incidenceRepository.getIncidences(limit, offset);
List<IncidenceDto> response = new LinkedList<>();
if(users.isEmpty()) {
return response;
}
for (Incidence user: users) {
IncidenceDto userDto = new IncidenceDto();
userDto.setId(user.getId());
userDto.setTitle(user.getTitle());
userDto.setDescription(user.getDescription());
userDto.setPlaca(user.getPlaca());
userDto.setDateDevice(user.getDate_device());
userDto.setDateUser(user.getDate_user());
userDto.setDirectionGps(user.getDirection_gps());
userDto.setStatus(user.getStatus());
userDto.setType(user.getType());
userDto.setDirectionUser(user.getDirection_user());
userDto.setCreateDate(user.getCreatedAt());
userDto.setUpdateDate(user.getUpdatedAt());
userDto.setDirectionGpsLat(user.getDirectionGpsLat());
userDto.setDirectionGpsLng(user.getDirectionGpsLng());
userDto.setDirectionUserLat(user.getDirectionUserLat());
userDto.setDirectionUserLng(user.getDirectionUserLng());
response.add(userDto);
}
return response;
}
@Override
public Boolean createIncidence(IncidenceDto usersDto) {
return incidenceRepository.createIncidence(usersDto);
}
@Override
public Boolean createIncidenceImage(IncidenceImageDto dto) {
return incidenceImageRepository.createIncidenceImage(dto);
}
@Override
public List<IncidenceImageDto> getIncidencesImageByIdIncidence(String id) {
List<IncidenceImage> users = incidenceImageRepository.getIncidenceImageByIdIncidence(id);
List<IncidenceImageDto> response = new LinkedList<>();
if(users.isEmpty()) {
return response;
}
for (IncidenceImage user: users) {
IncidenceImageDto userDto = new IncidenceImageDto();
userDto.setId(user.getId());
userDto.setUrl(user.getUrl());
userDto.setUrlDisplay(user.getUrlDisplay());
userDto.setIdIncidence(user.getId_incidence());
userDto.setCreateDate(user.getCreatedAt());
userDto.setUpdateDate(user.getUpdatedAt());
response.add(userDto);
}
return response;
}
@Override
public Boolean updateIncidence(IncidenceDto usersDto) {
return incidenceRepository.updateIncicence(usersDto);
}
@Override
public void deleteIncidence(String userId) {
Optional<Incidence> currentUser = incidenceRepository.findIncidenceById(userId);
if (!currentUser.isPresent()) {
throw new HttpClientErrorException(HttpStatus.NOT_FOUND);
}
incidenceRepository.deleteIncidence(userId);
}
}
| [
"otonielmax@hotmail.com"
] | otonielmax@hotmail.com |
97d56aa8e53ac09ee0013a15b351dfd1c879bbdd | bdaf69d1be66cf0593907c4b10645d57ceabbc16 | /src/main/java/com/javaex/vo/GalleryVo.java | 8c7e54411d43de1197dc47923eb31522ad9bcdfa | [] | no_license | Maroban/mysite5 | 94867565152f7dc623156c20413f8cfe94064974 | 7e1f052f1ede750cfd31da92c9e9cb3939f7402c | refs/heads/master | 2023-07-01T11:40:33.866091 | 2021-08-12T13:48:34 | 2021-08-12T13:48:34 | 389,928,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,579 | java | package com.javaex.vo;
import org.springframework.web.multipart.MultipartFile;
public class GalleryVo {
// 필드
private int no;
private int user_no;
private String content;
private String filePath;
private String orgName;
private String saveName;
private long fileSize;
private MultipartFile imgFile;
private String name;
// 생성자
public GalleryVo() {
}
public GalleryVo(int user_no, String content, String filePath, String orgName, String saveName, long fileSize) {
this.user_no = user_no;
this.content = content;
this.filePath = filePath;
this.orgName = orgName;
this.saveName = saveName;
this.fileSize = fileSize;
}
public GalleryVo(int no, int user_no, String content, String filePath, String orgName, String saveName, long fileSize) {
this.no = no;
this.user_no = user_no;
this.content = content;
this.filePath = filePath;
this.orgName = orgName;
this.saveName = saveName;
this.fileSize = fileSize;
}
// 메소드 - GS
public int getNo() {
return no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public MultipartFile getImgFile() {
return imgFile;
}
public void setImgFile(MultipartFile imgFile) {
this.imgFile = imgFile;
}
public void setNo(int no) {
this.no = no;
}
public int getUser_no() {
return user_no;
}
public void setUser_no(int user_no) {
this.user_no = user_no;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getSaveName() {
return saveName;
}
public void setSaveName(String saveName) {
this.saveName = saveName;
}
public long getFileSize() {
return fileSize;
}
public void setFileSize(long fileSize) {
this.fileSize = fileSize;
}
// 메소드 - 일반
@Override
public String toString() {
return "GalleryVo [no=" + no + ", user_no=" + user_no + ", content=" + content + ", filePath=" + filePath + ", orgName=" + orgName + ", saveName=" + saveName + ", fileSize=" + fileSize + "]";
}
}
| [
"dbtmdqja207@naver.com"
] | dbtmdqja207@naver.com |
34c96aeda8212677a0e9f87cc06652d535265c89 | 441f1c20f324c1b8af552a858ca7b6ce0556e826 | /spring-data-requery/src/main/java/org/springframework/data/requery/repository/query/ParameterMetadataProvider.java | 83525f70136b1e4ed0babd1a72188e73cdc3992c | [
"Apache-2.0"
] | permissive | monkyeg/spring-data-requery | b795942322e19ff4cd61c26f51bb4e83486a807a | 066bb2d054814003d2b4874e549f31cd26a7ca82 | refs/heads/master | 2020-04-03T13:55:52.435051 | 2018-10-12T17:38:19 | 2018-10-12T17:38:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,962 | java | /*
* Copyright 2018 Coupang Ltd.
*
* 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.springframework.data.requery.repository.query;
import io.requery.query.Expression;
import io.requery.query.FieldExpression;
import io.requery.query.NamedExpression;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.repository.query.Parameter;
import org.springframework.data.repository.query.Parameters;
import org.springframework.data.repository.query.ParametersParameterAccessor;
import org.springframework.data.repository.query.parser.Part;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ObjectUtils;
import javax.persistence.criteria.ParameterExpression;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Supplier;
/**
* Helper class to allow easy creation of {@link ParameterMetadata}s.
*
* @author debop
* @since 18. 6. 14
*/
@Slf4j
public class ParameterMetadataProvider {
private final Iterator<? extends Parameter> parameters;
private final List<ParameterMetadata<?>> expressions;
private final @Nullable Iterator<Object> bindableParameterValues;
public ParameterMetadataProvider(ParametersParameterAccessor accessor) {
this(accessor.iterator(), accessor.getParameters());
}
public ParameterMetadataProvider(Parameters<?, ?> parameters) {
this(null, parameters);
}
public ParameterMetadataProvider(@Nullable Iterator<Object> bindableParameterValues,
Parameters<?, ?> parameters) {
Assert.notNull(parameters, "Parameters must not be null!");
this.parameters = parameters.getBindableParameters().iterator();
this.expressions = new ArrayList<>();
this.bindableParameterValues = bindableParameterValues;
}
public List<ParameterMetadata<?>> getExpressions() { return Collections.unmodifiableList(expressions); }
@SuppressWarnings("unchecked")
public <T> ParameterMetadata<T> next(Part part) {
Assert.isTrue(parameters.hasNext(), "No parameter available for part. part=" + part);
Parameter parameter = parameters.next();
return (ParameterMetadata<T>) next(part, parameter.getType(), parameter);
}
@SuppressWarnings("unchecked")
public <T> ParameterMetadata<T> next(Part part, Class<T> type) {
Parameter parameter = parameters.next();
Class<?> typeToUse = ClassUtils.isAssignable(type, parameter.getType()) ? parameter.getType() : type;
return (ParameterMetadata<T>) next(part, typeToUse, parameter);
}
private <T> ParameterMetadata<T> next(Part part, Class<T> type, Parameter parameter) {
log.debug("get next parameter ... part={}, type={}, parameter={}", part, type, parameter);
Assert.notNull(type, "Type must not be null!");
/*
* We treat Expression types as Object vales since the real value to be bound as a parameter is determined at query time.
*/
Class<T> reifiedType = Expression.class.equals(type) ? (Class<T>) Object.class : type;
Supplier<String> name = () -> parameter.getName()
.orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named"));
NamedExpression<T> expression = parameter.isExplicitlyNamed()
? NamedExpression.of(name.get(), reifiedType)
: NamedExpression.of(String.valueOf(parameter.getIndex()), reifiedType);
Object value = bindableParameterValues == null ? ParameterMetadata.PLACEHOLDER : bindableParameterValues.next();
ParameterMetadata metadata = new ParameterMetadata(expression, part.getType(), value);
expressions.add(metadata);
return metadata;
}
@Slf4j
static class ParameterMetadata<T> {
static final Object PLACEHOLDER = new Object();
private final FieldExpression<T> expression;
private final Part.Type type;
private final Object value;
/**
* Creates a new {@link ParameterMetadata}.
*/
public ParameterMetadata(FieldExpression<T> expression,
Part.Type type,
@Nullable Object value) {
this.expression = expression;
this.type = value == null && Part.Type.SIMPLE_PROPERTY.equals(type) ? Part.Type.IS_NULL : type;
this.value = value;
}
/**
* Returns the {@link ParameterExpression}.
*
* @return the expression
*/
public FieldExpression<T> getExpression() {
return expression;
}
public Object getValue() {
return value;
}
/**
* Returns whether the parameter shall be considered an {@literal IS NULL} parameter.
*/
public boolean isIsNullParameter() {
return Part.Type.IS_NULL.equals(type);
}
/**
* Prepares the object before it's actually bound to the {@link javax.persistence.Query;}.
*
* @param value must not be {@literal null}.
*/
@Nullable
public Object prepare(Object value) {
Assert.notNull(value, "Value must not be null!");
Class<? extends T> expressionType = expression.getClassType();
log.debug("Prepare value... type={}, value={}, expressionType={}", type, value, expressionType);
if (String.class.equals(expressionType)) {
switch (type) {
case STARTING_WITH:
return String.format("%s%%", value.toString());
case ENDING_WITH:
return String.format("%%%s", value.toString());
case CONTAINING:
case NOT_CONTAINING:
return String.format("%%%s%%", value.toString());
default:
return value;
}
}
return value;
// return Collection.class.isAssignableFrom(expressionType) //
// ? persistenceProvider.potentiallyConvertEmptyCollection(toCollection(value)) //
// : value;
}
/**
* Returns the given argument as {@link Collection} which means it will return it as is if it's a
* {@link Collections}, turn an array into an {@link ArrayList} or simply wrap any other value into a single element
* {@link Collections}.
*
* @param value the value to be converted to a {@link Collection}.
* @return the object itself as a {@link Collection} or a {@link Collection} constructed from the value.
*/
@Nullable
private static Collection<?> toCollection(@Nullable Object value) {
if (value == null) {
return null;
}
if (value instanceof Collection) {
return (Collection<?>) value;
}
if (ObjectUtils.isArray(value)) {
return Arrays.asList(ObjectUtils.toObjectArray(value));
}
return Collections.singleton(value);
}
}
}
| [
"debop@coupang.com"
] | debop@coupang.com |
2a1a77f6ec4bf238ad29c4b6abc0ad5021c61f01 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /MATE-20_EMUI_11.0.0/src/main/java/com/android/server/wifi/hwcoex/HiCoexChrImpl.java | 68cf69f5b3f1dabefd717f53a7fdac85afff29be | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,834 | java | package com.android.server.wifi.hwcoex;
import android.content.Context;
import android.os.Bundle;
import com.android.server.wifi.HwWifiCHRService;
import com.android.server.wifi.HwWifiCHRServiceImpl;
public class HiCoexChrImpl {
private static final int EID_NR_STATE_INFO = 909009120;
private static final int EID_NR_STATISTIC_INFO = 909009121;
private static final int MILLISECOND_UNIT = 1000;
private static final int MIN_TRIGGER_INTERVAL = 1000;
private static final String TAG = "HiCoexChrImpl";
private static HiCoexChrImpl mHiCoexChrImpl;
private int mApBand = -1;
private int mApChannelCnt = 0;
private int mApChannelOptimizationCnt = 0;
private int mCellBw = 0;
private int mCellFreq = 0;
private Context mContext;
private HwWifiCHRService mHwWifiCHRService;
private int mNrPriority = 0;
private int mNrState = 0;
private int mNrTxBlockTime = 0;
private int mNrTxTotalTime = 0;
private int mP2pChannelCnt = 0;
private int mP2pChannelOptimizationCnt = 0;
private int mWifiAct = 0;
private int mWifiPriorSceneId = 0;
private int mWifiPriorTime = 0;
private int mWifiPriorTotalTime = 0;
private HiCoexChrImpl(Context context) {
this.mContext = context;
this.mHwWifiCHRService = HwWifiCHRServiceImpl.getInstance();
}
public static void createHiCoexChrImpl(Context context) {
if (mHiCoexChrImpl == null) {
mHiCoexChrImpl = new HiCoexChrImpl(context);
}
}
public static HiCoexChrImpl getInstance() {
return mHiCoexChrImpl;
}
public void setNrState(int nrState) {
this.mNrState = nrState;
}
public void setNrPriority(int nrPriority) {
this.mNrPriority = nrPriority;
}
public void setCellFreq(int cellFreq) {
this.mCellFreq = cellFreq;
}
public void setCellBw(int cellBw) {
this.mCellBw = cellBw;
}
public void setWifiAct(int wifiAct) {
this.mWifiAct = wifiAct;
}
public void setWifiPriorSceneId(int wifiPriorSceneId) {
this.mWifiPriorSceneId = wifiPriorSceneId;
}
public void setApBand(int apBand) {
this.mApBand = apBand;
}
public void updateCoexPriority(int time, int priority, int wifiScene, boolean isNrNetwork) {
HiCoexUtils.logD(TAG, "updateCoexPriority:" + time + ",priority:" + priority + ",wifiScene:" + wifiScene + ",isNrNetwork:" + isNrNetwork);
boolean needUpload = true;
if (priority == 1) {
this.mNrTxTotalTime += time;
this.mWifiPriorTotalTime += time;
} else if (priority == 0) {
this.mWifiPriorTime += time;
this.mWifiPriorTotalTime += time;
this.mWifiPriorSceneId = wifiScene;
} else if (priority != 2) {
needUpload = false;
} else if (isNrNetwork) {
this.mWifiPriorTotalTime += time;
} else {
needUpload = false;
}
if (needUpload && time > 1000) {
uploadHiCoexStatisticChr();
}
}
public void updateApChannelOptimization(int apBand, boolean isOptimized) {
int i = this.mApBand;
if (i == apBand || i == -1) {
HiCoexUtils.logD(TAG, "updateApChannelOptimization: band:" + apBand + ", isOptimized:" + isOptimized);
this.mApChannelCnt = this.mApChannelCnt + 1;
if (isOptimized) {
this.mApChannelOptimizationCnt++;
}
uploadHiCoexStatisticChr();
}
}
public void updateP2pChannelOptimization(boolean isOptimized) {
this.mP2pChannelCnt++;
if (isOptimized) {
this.mP2pChannelOptimizationCnt++;
}
uploadHiCoexStatisticChr();
}
public void updateApChannelOptimizationCnt() {
this.mApChannelOptimizationCnt++;
}
public void updateApChannelCnt() {
this.mApChannelCnt++;
}
public void updateP2pChannelOptimizationCnt() {
this.mP2pChannelOptimizationCnt++;
}
public void updateP2pChannelCnt() {
this.mP2pChannelCnt++;
}
public void updateWifiPriorTime(int wifiPriorTime) {
this.mWifiPriorTime += wifiPriorTime;
}
public void updateWifiPriorTotalTime(int nrTime) {
this.mWifiPriorTotalTime += nrTime;
}
public void updateNrTxBlockTime(int blockTime) {
this.mNrTxBlockTime += blockTime;
}
public void updateNrRxTotalTime(int txTotalTime) {
this.mNrTxTotalTime += txTotalTime;
}
public void uploadHiCoexNrStateChr() {
if (this.mHwWifiCHRService != null) {
HiCoexUtils.logD(TAG, "upload HiCoex NR State CHR");
this.mHwWifiCHRService.uploadDFTEvent((int) EID_NR_STATE_INFO, buildHiCoexNrStateChrBundle());
resetNrStateParameters();
}
}
public void uploadHiCoexStatisticChr() {
if (this.mHwWifiCHRService != null) {
HiCoexUtils.logD(TAG, "upload HiCoex Statistic CHR");
this.mHwWifiCHRService.uploadDFTEvent((int) EID_NR_STATISTIC_INFO, buildHiCoexStatisticChrBundle());
resetStatisticParameters();
}
}
private void resetNrStateParameters() {
this.mNrState = 0;
this.mNrPriority = 0;
this.mCellFreq = 0;
this.mCellBw = 0;
this.mWifiAct = 0;
}
private void resetStatisticParameters() {
this.mApChannelOptimizationCnt = 0;
this.mApChannelCnt = 0;
this.mP2pChannelOptimizationCnt = 0;
this.mP2pChannelCnt = 0;
this.mWifiPriorTime = 0;
this.mWifiPriorTotalTime = 0;
this.mWifiPriorSceneId = 0;
this.mNrTxBlockTime = 0;
this.mNrTxTotalTime = 0;
}
private Bundle buildHiCoexNrStateChrBundle() {
Bundle data = new Bundle();
data.putInt("nrState", this.mNrState);
data.putInt("nrPriority", this.mNrPriority);
data.putInt("cellFreq", this.mCellFreq);
data.putInt("cellBW", this.mCellBw);
data.putInt("wifiAct", this.mWifiAct);
return data;
}
private Bundle buildHiCoexStatisticChrBundle() {
Bundle data = new Bundle();
data.putInt("apChanOpCnt", this.mApChannelOptimizationCnt);
data.putInt("apChanCnt", this.mApChannelCnt);
data.putInt("p2pChanOpCnt", this.mP2pChannelOptimizationCnt);
data.putInt("p2pChanCnt", this.mP2pChannelCnt);
data.putInt("wifiProrTime", this.mWifiPriorTime / 1000);
data.putInt("wifiProrTotalTime", this.mWifiPriorTotalTime / 1000);
data.putInt("wifiProrSce1", this.mWifiPriorSceneId);
data.putInt("nrTxBlockTime", this.mNrTxBlockTime / 1000);
data.putInt("nrTxTotalTime", this.mNrTxTotalTime / 1000);
return data;
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
3fc22c4427087c6d237fdbcc527ecafef8e5cafa | 0e3898dbcb55563c96d11f93c06e8e2a3b8b545f | /Model/src/com/pq/tracs/model/dao/ContractGuaranteeViewImpl.java | 6d3664fba4d92ff5e55c13fd3aefb3c961b77631 | [] | no_license | AALIYAR/PQ-TRACS | a811913cbcbe015d85c48a76447d1e01186b2f27 | 79a98fcb21007675d7fb083ebf21d074990f40ff | refs/heads/master | 2020-04-02T10:42:16.724392 | 2018-10-23T13:46:16 | 2018-10-23T13:46:16 | 154,350,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package com.pq.tracs.model.dao;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class ContractGuaranteeViewImpl extends TracsView {
/**This is the default constructor (do not remove)
*/
public ContractGuaranteeViewImpl() {
}
}
| [
"43814640+AALIYAR@users.noreply.github.com"
] | 43814640+AALIYAR@users.noreply.github.com |
ab15edffb25f7645eca3e267eb3ecce33c4e2b9e | 3d3f24531a0bf7f181eb7a8e0f77d57c7a3c3dbe | /submission/project/ReceiverApp/java/edu/osu/urban_security/security_receiver_app/UsersAdapter.java | f41202c78a53b8ad1a2a28856e9872a0069ba05b | [] | no_license | NickSkiljan/UrbanSecurity | 5d378486fb6af7eeeac59693d4b515de66dbcdff | 7aa4b7d44dbe1884a044df9cf510fb34da245193 | refs/heads/master | 2021-04-27T12:26:30.441891 | 2018-04-20T01:35:31 | 2018-04-20T01:35:31 | 122,419,046 | 1 | 1 | null | 2018-04-11T03:38:37 | 2018-02-22T02:08:30 | Java | UTF-8 | Java | false | false | 2,490 | java | package edu.osu.urban_security.security_receiver_app;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
* Authors: Nick, Sunny, Maxwell
* Adapter for our recycler view that allows us to populate the recycler view with decrypted
* sos-user's personal information
*/
public class UsersAdapter extends ArrayAdapter<User> {
public UsersAdapter(Context context, ArrayList<User> users) {
super(context, 0, users);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position
User user = getItem(position);
// Check if an existing view is being reused, otherwise inflate the view
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.activity_main, parent, false);
}
// Lookup view for data population
TextView tvName = (TextView) convertView.findViewById(R.id.tvName);
TextView tvLatitude = (TextView) convertView.findViewById(R.id.tvLatitude);
TextView tvLongitude = (TextView) convertView.findViewById(R.id.tvLongitude);
TextView tvAltitude = (TextView) convertView.findViewById(R.id.tvAltitude);
AES aes = new AES();
String username = "default";
String latitude = "default";
String longitude = "default";
String altitude = "default";
try {
SecretKey key = new SecretKeySpec(AES.AESSecretKeyInBytes, 0, AES.AESSecretKeyInBytes.length, "AES");
username = AES.decryptString(key, user.name);
latitude = AES.decryptString(key, user.latitude);
longitude = AES.decryptString(key, user.longitude);
altitude = AES.decryptString(key, user.altitude);
} catch (Exception e) {
e.printStackTrace();
}
// Populate the data into the template view using the data object
tvName.setText(username);
tvLatitude.setText("Lat: " + latitude);
tvLongitude.setText("Long: " + longitude);
tvAltitude.setText("Alt: " + altitude);
// Return the completed view to render on screen
return convertView;
}
} | [
"patel.2222@osu.edu"
] | patel.2222@osu.edu |
88afe512ed19aa4cf4d0f65e152c0c34ac8e5718 | 790d1435fdb9de7b1b728a2dd5677d96fa3a2df9 | /src/ver05/MenuItem.java | 23ded28535fc365f42077d836fdd9d3452e65492 | [] | no_license | Dukere/JavaProj01 | ac0f427dc337a00e3ab7d41a0cd105537d7f392f | 892783e56e4adf7aa5979f0166133b8065c9f2be | refs/heads/master | 2022-04-11T07:58:36.664337 | 2020-03-30T09:42:09 | 2020-03-30T09:42:09 | 250,215,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 117 | java | package ver05;
interface MenuItem {
String INPUT = "1", SEARCH = "2", DELETE = "3", SHOW = "4", EXIT = "5";
}
| [
"Kosmo_21@DESKTOP-KULH7LN"
] | Kosmo_21@DESKTOP-KULH7LN |
e3f03417e62a76473382b8199c50afaa2e181cfb | 5957ec44eb2529d8fa7bef9c71577484d814181c | /android/support/v4/os/ResultReceiver.java | 002eb55807c643c3882ff1ce0004e5ba721ef558 | [] | no_license | icancode23/7teachers | 78c0367dce6ddc44a0e4dc52dbb5d915f69d8ef8 | 59c57762eb6c40253b84866150405f083a4e6731 | refs/heads/master | 2021-09-03T02:08:58.562005 | 2018-01-04T19:35:43 | 2018-01-04T19:35:43 | 116,299,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,927 | java | package android.support.v4.os;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import android.os.RemoteException;
import android.support.annotation.RestrictTo;
import android.support.annotation.RestrictTo.Scope;
import android.support.v4.os.IResultReceiver.Stub;
@RestrictTo({Scope.LIBRARY_GROUP})
public class ResultReceiver implements Parcelable {
public static final Creator<ResultReceiver> CREATOR = new C01121();
final Handler mHandler;
final boolean mLocal;
IResultReceiver mReceiver;
static class C01121 implements Creator<ResultReceiver> {
C01121() {
}
public ResultReceiver createFromParcel(Parcel in) {
return new ResultReceiver(in);
}
public ResultReceiver[] newArray(int size) {
return new ResultReceiver[size];
}
}
class MyRunnable implements Runnable {
final int mResultCode;
final Bundle mResultData;
MyRunnable(int resultCode, Bundle resultData) {
this.mResultCode = resultCode;
this.mResultData = resultData;
}
public void run() {
ResultReceiver.this.onReceiveResult(this.mResultCode, this.mResultData);
}
}
class MyResultReceiver extends Stub {
MyResultReceiver() {
}
public void send(int resultCode, Bundle resultData) {
if (ResultReceiver.this.mHandler != null) {
ResultReceiver.this.mHandler.post(new MyRunnable(resultCode, resultData));
} else {
ResultReceiver.this.onReceiveResult(resultCode, resultData);
}
}
}
public ResultReceiver(Handler handler) {
this.mLocal = true;
this.mHandler = handler;
}
public void send(int resultCode, Bundle resultData) {
if (this.mLocal) {
if (this.mHandler != null) {
this.mHandler.post(new MyRunnable(resultCode, resultData));
} else {
onReceiveResult(resultCode, resultData);
}
} else if (this.mReceiver != null) {
try {
this.mReceiver.send(resultCode, resultData);
} catch (RemoteException e) {
}
}
}
protected void onReceiveResult(int resultCode, Bundle resultData) {
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel out, int flags) {
synchronized (this) {
if (this.mReceiver == null) {
this.mReceiver = new MyResultReceiver();
}
out.writeStrongBinder(this.mReceiver.asBinder());
}
}
ResultReceiver(Parcel in) {
this.mLocal = false;
this.mHandler = null;
this.mReceiver = Stub.asInterface(in.readStrongBinder());
}
}
| [
"ernipunarora@gmail.com"
] | ernipunarora@gmail.com |
bdc2930693673d2ef6e1a0d358af89d65f369d0c | f34f28f65152a55e45988a5903c18807c938c395 | /back-spring/gate/src/main/java/com/gate/planner/gate/dao/course/CourseMemoRepository.java | 030cbe93e3e00b619af309f659d1637a0898c73c | [] | no_license | sssu4gate/back-springboot | d8901038f3728361b49173b00eb05b65376adf39 | 919855532930574d7dd95a19bc1a51e1918b5721 | refs/heads/master | 2023-04-04T08:09:53.374625 | 2021-04-09T12:37:58 | 2021-04-09T12:37:58 | 293,478,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.gate.planner.gate.dao.course;
import com.gate.planner.gate.model.entity.course.memo.CourseMemo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CourseMemoRepository extends JpaRepository<CourseMemo, Long> {
}
| [
"rlaxowns7916@gmail.com"
] | rlaxowns7916@gmail.com |
be2767f716072a931d1fa3e87eec0e1a63cce2e5 | 6bb18a7945eb2b4a7f83ebc291bcf6d39c279737 | /java-training/lessons/projects/stages-0/user-platform/user-web/src/main/java/com/jizhi/geektime/function/ThrowableFunction.java | eb069d679e40dbb917a713bb02fec155a6e28aef | [] | no_license | liveForExperience/geektime-java-traning | 62e79db9e1d0557f7317f8a8b3034d915c83e034 | 2e2200e940f388ac487ff19724f8a3dee2928b2b | refs/heads/master | 2023-03-18T14:21:44.446260 | 2021-03-10T00:27:14 | 2021-03-10T00:27:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.jizhi.geektime.function;
/**
* 能抛出异常的函数接口
* @author jizhi7
* @since 1.0
**/
@FunctionalInterface
public interface ThrowableFunction<T, R> {
/**
* 该函数,消费参数,返回数据
* @param t 进入函数的参数
* @return 函数返回的数据
* @throws Throwable 函数抛出的异常
*/
R apply(T t) throws Throwable;
}
| [
"1060944044@qq.com"
] | 1060944044@qq.com |
ff1e03d90d244772a76cd70cb371ef108b94e538 | ef55582db965dd6bd6c5862d4705f345a6059046 | /demo/ExtJsWebBase/src/main/java/cn/tj/baseextweb/fw/interceptor/CheckUserSessionState.java | 0404ca7b23313f281972e740f24f584159fa2ff7 | [] | no_license | xinghen91/demo | d6a75a56674ddd7f877299d4b3a0ce862f8c0c69 | 1ca5f7196423b7957b505dfd5573b37173379aa8 | refs/heads/master | 2021-05-29T09:28:19.814211 | 2015-08-13T06:29:48 | 2015-08-13T06:30:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package cn.tj.baseextweb.fw.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class CheckUserSessionState extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// String path = request.getServletPath();
// if (path.matches(Const.INTERCEPTOR_PATH) && !path.matches(Const.NO_INTERCEPTOR_PATH)) {
//
// HttpSession session = request.getSession();
// User user = (User) session.getAttribute(Const.USER_KEY);
// if (user != null) {
// return true;
// } else {
// response.sendRedirect(request.getContextPath() + "/timeout.jsp");
// return false;
// }
// } else {
return true;
// }
}
}
| [
"Administrator@PC-20141215FBVZ"
] | Administrator@PC-20141215FBVZ |
58e2278a748c7f3c3409dbbc5a8cc72e5642e1d5 | 70e56a2d9e76bebdfafe400b000c1ebf6b45a329 | /app/src/main/java/com/example/binding/butterknife/ButterKnifeActivity.java | a3803b652e95a03c74a189698a1fc76d6876593d | [] | no_license | AntonioVitiello/DataBindingExample | 0f7412272c3a781216330461a8a969b73422cb2f | 0175902855c84aa81893fac8558eb74eea4e6a25 | refs/heads/master | 2021-05-02T03:28:16.418630 | 2018-04-02T18:28:27 | 2018-04-02T18:28:27 | 120,896,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,751 | java | package com.example.binding.butterknife;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import com.example.binding.R;
import com.example.binding.newschool.DataBindingActivity;
import com.example.binding.newschool.Movie;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ButterKnifeActivity extends AppCompatActivity {
@BindView(R.id.et1) EditText et1;
@BindView(R.id.et2) EditText et2;
@BindView(R.id.et3) EditText et3;
@BindView(R.id.et4) EditText et4;
@BindView(R.id.et5) EditText et5;
@BindView(R.id.et6) EditText et6;
@BindView(R.id.et7) EditText et7;
@BindView(R.id.et8) EditText et8;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_butter_knife);
// ButterKnife INITIALIZATION!
ButterKnife.bind(this);
initializeView();
}
private void initializeView(){
Movie movie = new Movie.Builder()
.name("This is ButterKnifeActivity")
.posterUrl("insert movie poster url")
.posterUrl2("insert 2nd movie poster url")
.trailerURL("insert movie trailer url")
.build();
et1.setHint(movie.getName());
et2.setHint(movie.getPosterUrl());
et3.setHint(movie.getPosterUrl2());
et4.setHint(movie.getTrailerURL());
}
@OnClick(R.id.startNewDataBinding)
public void startNewDataBinding(View view) {
Intent intent = new Intent(this, DataBindingActivity.class);
startActivity(intent);
}
}
| [
"vitiello.antonio@gmail.com"
] | vitiello.antonio@gmail.com |
cbb547abc7b32cb4265013a594333ee454ad4ad9 | b5355ca5426f1eb1c6a3eb7eee71eb9e21c65943 | /app/src/main/java/com/example/android/bakingapp/ui/RecipeIngredientListAdapter.java | f37b4e62d1c87c9309fe919291e6dc99ddb48551 | [] | no_license | Teldot/BakingApp | f831acf6b871dc7c265a24bb0320b076c23219d7 | 252bf1845459724fa880c713e90d23c00e6158fb | refs/heads/master | 2021-05-08T15:48:58.696981 | 2018-03-19T03:39:22 | 2018-03-19T03:39:22 | 120,127,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,546 | java | package com.example.android.bakingapp.ui;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.android.bakingapp.R;
import com.example.android.bakingapp.data.entities.Ingredient;
/**
* Created by Mauricio Torres
* on 04/02/2018.
*/
public class RecipeIngredientListAdapter extends RecyclerView.Adapter<RecipeIngredientListAdapter.RecipeIngredientLisAdapterViewHolder> {
private final Context mContext;
private Ingredient[] ingredientsData;
public RecipeIngredientListAdapter(Context context) {
mContext = context;
}
@Override
public RecipeIngredientLisAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(mContext);
View view = inflater.inflate(R.layout.recipe_ingredient_list_item, parent, false);
return new RecipeIngredientLisAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(RecipeIngredientLisAdapterViewHolder holder, int position) {
if (getIngredientsData() == null) return;
Ingredient ingredient = getIngredientsData()[position];
holder.tv_ingred_name.setText(ingredient.Ingredient);
holder.tv_ingred_qty.setText(String.valueOf(ingredient.Quantity));
holder.tv_ingred_measure.setText(ingredient.Measure);
}
@Override
public int getItemCount() {
if (ingredientsData == null) return 0;
else return ingredientsData.length;
}
private Ingredient[] getIngredientsData() {
return ingredientsData;
}
public void swapData(Ingredient[] ingredients) {
if (ingredients == null || ingredients.length == 0) {
ingredientsData = null;
this.notifyDataSetChanged();
return;
}
ingredientsData = ingredients;
this.notifyDataSetChanged();
}
public class RecipeIngredientLisAdapterViewHolder extends RecyclerView.ViewHolder {
public final TextView tv_ingred_name, tv_ingred_qty, tv_ingred_measure;
public RecipeIngredientLisAdapterViewHolder(View itemView) {
super(itemView);
tv_ingred_name = itemView.findViewById(R.id.tv_ingredient_name);
tv_ingred_qty = itemView.findViewById(R.id.tv_ingredient_qty);
tv_ingred_measure = itemView.findViewById(R.id.tv_ingredient_measure);
}
}
}
| [
"teldot@gmail.com"
] | teldot@gmail.com |
682554caa57d1e5ef9ab96cfb5dd00f32fc4e899 | 045996666aa740c66af6bd61c56400c41949729f | /board/src/main/java/me/minseok/board/domain/Board.java | 0883d8d6cd9ddd64d406c381a5916a54aca706b8 | [] | no_license | cms5380/board_comment_check | b953c27f95a59a19157cb83090ba8fe59c9f8c16 | a6823e3c0cba467f38d39ecb9f83fc7489f742fc | refs/heads/main | 2023-06-05T12:15:42.066177 | 2021-06-28T07:24:17 | 2021-06-28T07:24:17 | 355,918,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package me.minseok.board.domain;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class Board extends Common{
/** 번호 (PK) */
private Long id;
/** 제목 */
private String title;
/** 내용 */
private String content;
/** 작성자 */
private String writer;
/** 조회 수 */
private int viewCnt;
/** 공지 여부 */
private Boolean noticeYn;
/** 비밀 여부 */
private Boolean secretYn;
}
| [
"cms1297@gmail.com"
] | cms1297@gmail.com |
2b67fe979e6442398212164f0d51a57febe8a498 | 532a194cf436aa95fa785959bf832cd5d62ccaa5 | /SchoolCalendarProject/SchoolCalendar/src/main/java/com/finalproject/schoolcalendar/activities/AddSubjectActivity.java | 431c88ae3a281defc2397f6397c89231ac119658 | [] | no_license | fanni-p/School-Calendar-Android | d715240240e29b192669b106b73546b7ce0a3d7f | 2ce64dd2fcb3bd6f1c6f9cec91011bfd438caf0b | refs/heads/master | 2016-09-06T02:48:11.453865 | 2013-11-17T19:42:29 | 2013-11-17T19:42:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,027 | java | package com.finalproject.schoolcalendar.activities;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import com.finalproject.schoolcalendar.R;
import com.finalproject.schoolcalendar.data.DataPersister;
import com.finalproject.schoolcalendar.data.HttpResponseHelper;
import com.finalproject.schoolcalendar.enums.ColorEnum;
import com.finalproject.schoolcalendar.helpers.ColorConverter;
import com.finalproject.schoolcalendar.helpers.SessionManager;
import com.finalproject.schoolcalendar.models.SubjectModel;
import java.util.HashMap;
/**
* Created by Fani on 11/17/13.
*/
public class AddSubjectActivity extends Activity {
private static final String LAST_ACTIVITY = "LastActivity";
private Handler mHandler;
private ColorEnum mColor;
private String mTeacher;
private String mSubjectName;
private String mAccessToken;
private int mCurrentSelection;
private SubjectModel mSubjectModel;
private HandlerThread mHandledThread;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_subject);
this.mColor = null;
this.mTeacher = null;
this.mSubjectName = null;
SessionManager sessionManager = new SessionManager(getApplicationContext());
HashMap<String, String> user = sessionManager.getUserDetails();
this.mAccessToken = user.get(SessionManager.KEY_ACCESSTOKEN);
this.mHandledThread = new HandlerThread("AddSubjectServiceThread");
this.mHandledThread.start();
Looper looper = this.mHandledThread.getLooper();
if (looper != null) {
this.mHandler = new Handler(looper);
}
this.setupCreateButton();
this.setupSpinner();
}
@Override
protected void onPause() {
super.onPause();
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
@Override
protected void onDestroy() {
super.onDestroy();
this.mHandledThread.quit();
this.mHandledThread = null;
}
private void setupCreateButton() {
Button loginButton = (Button) this.findViewById(R.id.add_subject_createbutton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AddSubjectActivity.this.handleCreateButtonCommand();
}
});
}
private void setupSpinner() {
final Spinner spinner = (Spinner) findViewById(R.id.add_subject_color_spinner);
spinner.setAdapter(new ArrayAdapter<ColorEnum>
(this, android.R.layout.simple_spinner_item, ColorEnum.values()));
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (AddSubjectActivity.this.mCurrentSelection != position) {
ColorEnum selection = (ColorEnum) spinner.getItemAtPosition(position);
if (selection != null) {
String convertedColor = ColorConverter.ParseColor(selection.name());
int color = Color.parseColor(convertedColor);
spinner.setBackgroundColor(color);
}
AddSubjectActivity.this.mCurrentSelection = position;
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
return;
}
});
}
private void handleCreateButtonCommand() {
final String accessToken = this.mAccessToken;
final SubjectModel subjectModel = this.createSubjectModel();
if (subjectModel != null) {
this.mHandler.post(new Runnable() {
@Override
public void run() {
HttpResponseHelper response = DataPersister.AddNewSubject(subjectModel, accessToken);
AddSubjectActivity.this.handleAddSubjectResponse(response);
}
});
}
}
private void handleAddSubjectResponse(HttpResponseHelper response) {
if (response.isStatusOk()) {
Class<?> activityClass;
SharedPreferences preferences = getSharedPreferences(LAST_ACTIVITY, MODE_PRIVATE);
try {
activityClass = Class.forName(preferences.getString(LAST_ACTIVITY, AllSubjectsActivity.class.getName()));
} catch (ClassNotFoundException e) {
activityClass = AllSubjectsActivity.class;
}
Intent intent = new Intent(this, activityClass);
this.startActivity(intent);
finish();
}
}
private SubjectModel createSubjectModel() {
EditText subjectNameBox = (EditText) this.findViewById(R.id.add_subject_new_subjectname);
EditText teacherBox = (EditText) this.findViewById(R.id.add_subject_new_teacher);
Spinner colorBox = (Spinner) this.findViewById(R.id.add_subject_color_spinner);
this.mSubjectName = subjectNameBox.getText().toString();
this.mTeacher = teacherBox.getText().toString();
this.mColor = (ColorEnum) colorBox.getSelectedItem();
String color = null;
if (this.mColor != null) {
color = this.mColor.name();
}
if (this.mSubjectName != null) {
this.mSubjectModel = new SubjectModel(this.mSubjectName, this.mTeacher, color);
}
return this.mSubjectModel;
}
} | [
"fanni@abv.bg"
] | fanni@abv.bg |
b5f05d83a05f1ba42b35ed74e4297be8584ea1f2 | f8e6a972da48741270a273bcefece6dd846c7f62 | /app/src/main/java/com/example/lifestyleapp/DatabaseCustomFunctions.java | 7b100dc7649753cf954d8f559d6f5794b0d6a30a | [] | no_license | Matt-Parker99/LifestyleApp | 066349f8b297b24cd40d7aa1f564474d45265bf1 | 82bd6c6addcd921d9d953cf948ae01109b591970 | refs/heads/master | 2022-12-24T04:57:57.615839 | 2020-10-01T18:33:13 | 2020-10-01T18:33:13 | 256,202,401 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,811 | java | package com.example.lifestyleapp;
import android.util.Log;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.storage.FileDownloadTask;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class DatabaseCustomFunctions {
public final FirebaseAuth mAuth;
public final FirebaseFirestore mStorage;
public final StorageReference mStorageRef;
public final FirebaseUser user;
public final String UserId;
// Constructor
public DatabaseCustomFunctions(){
this.mAuth = FirebaseAuth.getInstance();
this.mStorage = FirebaseFirestore.getInstance();
this.mStorageRef = FirebaseStorage.getInstance().getReference();
this.user = this.mAuth.getCurrentUser();
this.UserId = this.user.getUid();
}
public void createNewIngredient(String name, Double price){
try {
Map<String, Object> data = new HashMap<>();
data.put("name", name);
data.put("price", price);
mStorage.collection("products").add(data);
} catch (Exception e) {
Log.e("databaseCustomFunctions : CreateNewIngredients", e.getLocalizedMessage());
e.printStackTrace();
}
}
public String getRecipeDescription(String recipeName) {
String result = "Error on reading "+recipeName+" !";
StorageReference recipeRef = mStorageRef.child("recipeDescriptions/"+recipeName);
File localFile = null;
try {
localFile = File.createTempFile(recipeName, "txt");
} catch (IOException e) {
e.printStackTrace();
}
try {
FileDownloadTask download = recipeRef.getFile(localFile);
while (download.isInProgress()) {
}
if (download.isSuccessful()){
StringBuilder text = new StringBuilder();
try {
BufferedReader br = new BufferedReader(new FileReader(localFile));
String line;
while ((line = br.readLine()) != null) {
text.append(line);
text.append('\n');
}
br.close();
result = text.toString();
}
catch (IOException e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
| [
"55714310+markog1999@users.noreply.github.com"
] | 55714310+markog1999@users.noreply.github.com |
863a8ed7d82cd0fe422f3534ae82d009fb3f45aa | 372453ffbe9eb42364abf84a95654b1e18695ff3 | /microservice2/src/main/java/com/wiproevents/services/springdata/UserPreferenceSpecification.java | ad2563b47cf95c73e7aa5f1d142b0aa8e5a918ad | [] | no_license | kinfkong/tc-attendee | ac7c033003ee9cda81418e774ac8163b38695631 | 8986055cf932a26b1c66373da9f57707c91dd3fc | refs/heads/master | 2021-05-01T22:01:00.376276 | 2018-02-18T04:12:35 | 2018-02-18T04:12:35 | 120,983,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.wiproevents.services.springdata;
import com.microsoft.azure.spring.data.documentdb.core.query.Query;
import com.wiproevents.entities.criteria.BaseSearchCriteria;
import com.wiproevents.entities.UserPreference;
import com.wiproevents.utils.springdata.extensions.DocumentDbSpecification;
import lombok.AllArgsConstructor;
import java.util.Map;
/**
* The specification used to query User by criteria.
*/
@AllArgsConstructor
public class UserPreferenceSpecification implements DocumentDbSpecification<UserPreference> {
/**
* The criteria. Final.
*/
private final BaseSearchCriteria criteria;
@Override
public Query toQuery(Query query, Map<String, Object> values) {
return query;
}
}
| [
"kinfkong@126.com"
] | kinfkong@126.com |
43bbec57547910849222af3775bc40b3991be3fa | f6b20e204617d03af6a30728d5d8d539640ab782 | /src/com/biz/for_each/For_03.java | aeef9f1d79a8039fccd76673399edd01cebfdaec | [] | no_license | dbtls1000/JAVA_04 | 936fec95554ed32b6ebee36141f1e2c5229ed6ca | 5b807fc272b30b2f88c5db853dd6f0e40f85936d | refs/heads/master | 2020-05-30T04:50:03.979818 | 2019-05-31T07:33:18 | 2019-05-31T07:33:18 | 189,549,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.biz.for_each;
public class For_03 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int intSum = 0;
int intE = 1;
intSum = intSum + intE; //1
intE++; //2
intSum = intSum + intE; //1 + 2
intE++; //3
intSum = intSum + intE; //1 + 2 + 3
intSum = 0;
for(int i =1; i <= 10 ; i++) {
System.out.println(i);
intSum += i;
}
// 짝수만 더하기
int intSum2 = 0;
for(int i =0; i <= 10 ; i+=2) {
System.out.println(i);
intSum2 += i;
}
System.out.println(intSum2);
// 홀수만 더하기
int intSum3 = 0;
for(int i =1; i <= 11 ; i+=2) {
System.out.println(i);
intSum3 += i;
}
System.out.println(intSum3);
intSum = 0;
// for를 이용해서 i값이 2,4,6,8,10 만 나타나도록
for (int i = 2; i <= 10 ; i +=2) {
intSum += i;
}
System.out.println("짝수의 합 :" + intSum);
intSum = 0;
// for를 이용해서 1값이 1,3,5,7,9 만 나타나도록
for (int i = 1; i <= 10 ; i +=2) {
intSum += i;
}
System.out.println("홀수의 합 :" + intSum);
for(int i = 1;i < 100; i++);
for(int i = 1; i < 100 ; i++) {
for(long j =1 ; j < 1000000000; j++);
System.out.println(i);
}
}
}
| [
"dbsqhtjs@naver.com"
] | dbsqhtjs@naver.com |
a231a985881e6de49ec9b09bb3e251ebc4c6f7b8 | dab155e9b0d5af19ac9d3fc9db0a4b02f8e6ac65 | /src/main/java/com/cathetine/simpleChat/response/CommonReturnType.java | 90ef009c99f556c58c05fb69e0adc3cac6850356 | [] | no_license | xjk971020/SimpleWeChat | d9b314679a7bdef296147e043af3e73077f69021 | 79680efda86282a78e55cc26b70a08499fd912d2 | refs/heads/master | 2022-06-27T11:22:03.208350 | 2019-12-01T09:06:08 | 2019-12-01T09:06:08 | 218,782,633 | 0 | 0 | null | 2022-06-21T02:09:03 | 2019-10-31T14:16:57 | Java | UTF-8 | Java | false | false | 904 | java | package com.cathetine.simpleChat.response;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author:xjk
* @Date 2019/10/31 15:01
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommonReturnType {
/**
* 返回数据状态: "success" "fail"
*/
private String status;
/**
* 返回数据
* 如果状态为success,则返回ui显示所需数据
* 如果状态为fail,则返回失败信息
*/
private Object data;
public static CommonReturnType create(Object data) {
return new CommonReturnType("success", data);
}
public static CommonReturnType create(Object data, String status) {
CommonReturnType commonReturnType = new CommonReturnType();
commonReturnType.setData(data);
commonReturnType.setStatus(status);
return commonReturnType;
}
}
| [
"823840954@qq.com"
] | 823840954@qq.com |
4ac7df5814e00d17ec9c192ddc0202bc192cf5ab | ebbcffc3521f2229b76898ced2d803b52d395cd9 | /src/main/java/com/kly/ants/Pattern/factory/ConcreteFactoryA2.java | 83764fb6abb683b06be91d82585f21f3bf908d2e | [] | no_license | lingyukong/ants | 2498e761b51abff624695efc7ff8342444d67fad | c99e07be0eb2f68dbacd78932f33fae753b107be | refs/heads/main | 2023-04-17T06:34:01.168961 | 2021-05-03T15:09:42 | 2021-05-03T15:09:42 | 330,420,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package com.kly.ants.Pattern.factory;
public class ConcreteFactoryA2 implements Factory{
public Product createProduct() {
return new ConcreteProductA2();
}
}
| [
"1225208185@qq.com"
] | 1225208185@qq.com |
ff158945ac1e40b090885943c0e90c1e6b388baa | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Quartz/Quartz81.java | b282841baedf1422c8d21eb6509c3e08ee6de664 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 787 | java | public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) {
if (jobListener.getName() == null || jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (globalJobListeners) {
globalJobListeners.put(jobListener.getName(), jobListener);
LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>();
if(matchers != null && matchers.size() > 0)
matchersL.addAll(matchers);
else
matchersL.add(EverythingMatcher.allJobs());
globalJobListenersMatchers.put(jobListener.getName(), matchersL);
}
}
| [
"Qing.Mi@my.cityu.edu.hk"
] | Qing.Mi@my.cityu.edu.hk |
33771895ecb54841535d53c2d92f8d8d90defb0f | afba6718a521e269f12d79bbe150e7c30b3696e6 | /app/src/main/java/me/kaede/frescosample/RecyclerView/RecyclerViewFragment.java | 8a464a4012373c0169661b539be9ab6299b6c277 | [] | no_license | xiangyunwan/fresco-sample-usage-master | 1407c7ce3350226011291755d2c429b5bbb8f0e5 | d715cf76128fbf8ee2a09ba118d9c91e5bf918b7 | refs/heads/master | 2020-12-24T19:12:40.287032 | 2016-04-13T09:20:21 | 2016-04-13T09:20:21 | 56,138,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,877 | java | package me.kaede.frescosample.recyclerview;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import me.kaede.frescosample.ImageApi;
import me.kaede.frescosample.R;
import java.util.List;
public class RecyclerViewFragment extends Fragment{
private static final String BUNDLE_INDEX = "BUNDLE_INDEX";
private int index;
public static RecyclerViewFragment newInstance(int index) {
RecyclerViewFragment fragment = new RecyclerViewFragment();
Bundle args = new Bundle();
args.putInt(BUNDLE_INDEX, index);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
index = getArguments().getInt(BUNDLE_INDEX);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
//find view
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerview);
//init
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(index+1,StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
MyAdapter adapter = new MyAdapter(index);
recyclerView.setAdapter(adapter);
recyclerView.setHasFixedSize(false);
List<String> datas;
switch (index) {
case 0:
default:
datas = ImageApi.jk.getUrls();
break;
case 1:
datas = ImageApi.girly.getUrls();
break;
case 2:
datas = ImageApi.legs.getUrls();
break;
}
adapter.setDatas(datas);
return view;
}
}
| [
"zhangzhenzhong1@jd.com"
] | zhangzhenzhong1@jd.com |
175210db9d6963ea5f5badce9ba3984ad685787f | 99d7cca239deefcbd24d308f407d25fdea9c5860 | /src/main/java/Modelo/VentaDAO.java | d703b23a3d3df0b3050cd0cd9c84e4d3c9becb33 | [] | no_license | napenar/SistemaDeVentas | 563540c810f44f7cfd260044e4180d87deea4f45 | 62a54d83f276b3cfe8d477f76b82c9855b391dbe | refs/heads/master | 2023-08-16T11:46:17.314702 | 2021-10-14T13:15:58 | 2021-10-14T13:15:58 | 416,044,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,897 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Modelo;
import config.Conexion;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
*
* @author NORVEY
*/
public class VentaDAO {
Connection con;
Conexion cn = new Conexion();
PreparedStatement ps;
ResultSet rs;
int r;
public String GenerarSerie() {
String numeroserie = "";
String sql = "select max(idventas) from ventas";
try {
con = cn.Conexion();
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
numeroserie = rs.getString(1);
}
ps.close();
cn.getCon().close();
} catch (Exception e) {
System.out.println("Error en VentaDAO generarserie " + e);
}
return numeroserie;
}
public String idVentas(){
String idventas = "";
String sql = "select max(idventas) from ventas";
try {
con = cn.Conexion();
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
idventas = rs.getString(1);
}
ps.close();
cn.getCon().close();
} catch (Exception e) {
System.out.println("Error en VentaDAO idVentas " + e);
}
return idventas;
}
public int guardarVenta(Venta ve){
String sql = "insert into ventas(idcliente,idempleado,numeroserie,fechaventas,monto,estado) values(?,?,?,?,?,?)";
try {
con = cn.Conexion();
ps = con.prepareStatement(sql);
ps.setInt(1, ve.getIdcliente());
ps.setInt(2, ve.getIdempleado());
ps.setString(3, ve.getNumserie());
ps.setDate(4, Date.valueOf(ve.getFecha()));
ps.setDouble(5, ve.getPrecio());
ps.setString(6, ve.getEstado());
r=ps.executeUpdate();
ps.close();
cn.getCon().close();
} catch (Exception e) {
System.out.println("Error en VentaDAO guardarventa " + e);
}
return r;
}
public int guardarDetalventas(Venta venta){
String sql = "insert into detalle_ventas(idventas,idproducto,cantidad,precioventa) values(?,?,?,?)";
try {
con=cn.Conexion();
ps=con.prepareStatement(sql);
ps.setInt(1, venta.getId());
ps.setInt(2, venta.getIdproducto());
ps.setInt(3, venta.getCantidad());
ps.setDouble(4, venta.getPrecio());
r = ps.executeUpdate();
} catch (Exception e) {
}
return r;
}
}
| [
"napenar@correo.udistrital.edu.co"
] | napenar@correo.udistrital.edu.co |
c96cfc16bf9eb5d4e3d10ef7009da25b220fed83 | 02733e43da8c998f69070ed558feb56654075f21 | /src/main/java/com/udacity/jwdnd/course1/cloudstorage/config/SecurityConfig.java | 4fd73f913c31d2ca404a7490cfdb5a0bbaa3ad77 | [] | no_license | anuragbnrj/cloudstorage | bd2f5ec55a58301d4f6f266bce59d398990c3717 | 108b04b0abbe96846e4c81c3d6a0bdc742d4c5cf | refs/heads/main | 2023-03-28T02:36:06.518942 | 2021-04-01T21:14:20 | 2021-04-01T21:14:20 | 353,439,700 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package com.udacity.jwdnd.course1.cloudstorage.config;
import com.udacity.jwdnd.course1.cloudstorage.service.AuthenticationService;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final AuthenticationService authenticationService;
public SecurityConfig(AuthenticationService authenticationService) {
this.authenticationService = authenticationService;
}
@Override
protected void configure(AuthenticationManagerBuilder auth) {
auth.authenticationProvider(this.authenticationService);
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/signup", "/css/**", "/js/**", "/h2-console/**").permitAll()
.anyRequest().authenticated();
http.csrf().disable();
http.headers().frameOptions().disable();
http.authorizeRequests().and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/home", true)
.permitAll()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/login?logout=true")
.permitAll();
}
}
| [
"anuragbnrj@gmail.com"
] | anuragbnrj@gmail.com |
17659a3b9e9089be965ce11daa17aa59ff15753f | 229922987e10fed06caa951efd88510a2c758f95 | /src/main/java/com/first/IOC/demo/MyApp.java | 0ecb31ccadce8db6ef4ae0c8809102dff7c2b199 | [] | no_license | Sinegubovskii/Spring | 8644c8b56304d2b3286d353d40bda82af7aaafb4 | 25d06dffd625c7214983808320d7fb0e957890fb | refs/heads/master | 2020-04-30T20:23:57.122339 | 2019-03-22T03:29:26 | 2019-03-22T03:29:26 | 177,065,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package com.first.IOC.demo;
public class MyApp {
public static void main(String[] arg){
iCoach theCoach = new BaseballCoach();
System.out.println(theCoach.getDailyWorkout());
}
}
| [
""
] | |
0fa3e76179493bd875e49604fa7660cf8cd38323 | 7a3d5f07072bee1b665ed80cc08bba455e790a8f | /src/com/xianhe/mis/PathSelectPanel.java | 178db20df33f57bf3c19c046186ffc03f2dcf8e9 | [] | no_license | 13950256550/DesignExpert | 9ec2911727a460abe41bfe89bcff37b7af7ee7bc | 609026b0a50b90e787b2bcadf7b49a906a23cdfe | refs/heads/master | 2020-04-05T13:08:44.429947 | 2017-07-07T09:20:59 | 2017-07-07T09:20:59 | 95,123,461 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,623 | java | package com.xianhe.mis;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.log4j.Logger;
import org.ini4j.Ini;
import org.ini4j.Profile.Section;
import com.xianhe.core.common.EnvReadWriteUtil;
import com.xianhe.core.common.WorkPath;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.CheckBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.DirectoryChooser;
import javafx.stage.Stage;
public class PathSelectPanel extends BorderPane{
public static Logger logger = Logger.getLogger(PathSelectPanel.class);
private TableView<WorkPath> tableView = new TableView<WorkPath>();
private Stage stage = null;
public PathSelectPanel(Stage stage) {
this.stage = stage;
tableView.setEditable(true);
this.setCenter(tableView);
String[] columns = new String[]{"序号","目录名称","目录路径"};
String[] propertys = new String[]{"id","name","path"};
int[] widths = new int[]{50,120,300};
setColumns(columns,widths);
setDatas();
HBox buttonPanel = new HBox();
buttonPanel.setPadding(new Insets(5,5,5,5));
buttonPanel.setSpacing(20);
buttonPanel.setAlignment(Pos.CENTER);
this.setBottom(buttonPanel);
Button button1 = new Button("添加");
Button button2 = new Button("删除");
Button button3 = new Button("确定");
Button button4 = new Button("取消");
buttonPanel.getChildren().addAll(button1,button2,button3,button4);
button1.setOnAction((ActionEvent e) -> {
final DirectoryChooser directoryChooser =new DirectoryChooser();
final File selectedDirectory = directoryChooser.showDialog(MainFrame.primaryStage);
if(selectedDirectory!=null){
String id = String.valueOf(tableView.getItems().size()+1);
String name = selectedDirectory.getName();
String path = selectedDirectory.getAbsolutePath();
WorkPath workPath = new WorkPath(id,name,path,false);
tableView.getItems().add(workPath);
}
});
button2.setOnAction((ActionEvent e) -> {
int index = tableView.getSelectionModel().getSelectedIndex();
tableView.getItems().remove(index);
});
button3.setOnAction((ActionEvent e) -> {
Ini ini = EnvReadWriteUtil.getEvnIni();
File file = EnvReadWriteUtil.getEnvFile();
int id = 1;
for(WorkPath workPath:tableView.getItems()){
if(workPath.isDefaultPath()){
Section session = ini.get("ENVNUM");
session.put("DEFAULT", String.valueOf(id));
break;
}
id++;
}
List<Section> sections = ini.getAll("ITEM");
int count = sections.size();
for(int i=count-1;i>=0;i--){
sections.remove(i);
}
id = 1;
for(WorkPath workPath:tableView.getItems()){
Section session = ini.add("ITEM");
session.add("ID", String.valueOf(id));
session.add("NAME", workPath.getName());
session.add("PATH", workPath.getPath());
id++;
}
try {
ini.store(file);
} catch (IOException exception) {
exception.printStackTrace();
}
stage.close();
});
button4.setOnAction((ActionEvent e) -> {
stage.close();
});
this.setPrefHeight(200);
this.setPrefWidth(500);
}
public void setColumns(String[] columns, int[] widths) {
if (columns != null && widths != null && columns.length > 0) {
TableColumn<WorkPath, Boolean> col1 = new TableColumn<WorkPath, Boolean>("选择");
col1.setCellValueFactory(new PropertyValueFactory<WorkPath,Boolean>("defaultPath"));
col1.setCellFactory(CheckBoxTableCell.forTableColumn(col1));
col1.setEditable(true);
/*
col1.setOnEditCommit((CellEditEvent<WorkPath, Boolean> event)->{
logger.info(event.getNewValue()+":"+event.getOldValue());
ObservableList<WorkPath> list = tableView.getItems();
if(event.getNewValue()){
for(WorkPath workPath:list){
workPath.setDefaultPath(false);
logger.info(workPath);
}
}
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setDefaultPath(event.getNewValue());
logger.info(row);
});
*/
tableView.getColumns().add(col1);
TableColumn<WorkPath, String> col = new TableColumn<WorkPath, String>(columns[0]);
col.setPrefWidth(widths[0]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("id"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setId(event.getNewValue());
logger.info(row);
});
col.setEditable(true);
tableView.getColumns().add(col);
col = new TableColumn<WorkPath, String>(columns[1]);
col.setPrefWidth(widths[1]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("name"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setName(event.getNewValue());
logger.info(row);
});
col.setEditable(true);
tableView.getColumns().add(col);
col = new TableColumn<WorkPath, String>(columns[2]);
col.setPrefWidth(widths[2]);
col.setCellValueFactory(new PropertyValueFactory<WorkPath,String>("path"));
col.setCellFactory(TextFieldTableCell.forTableColumn());
col.setOnEditCommit((CellEditEvent<WorkPath, String> event)->{
WorkPath row = event.getTableView().getItems().get(event.getTablePosition().getRow());
row.setPath(event.getNewValue());
logger.info(row);
});
//col.setEditable(true);
tableView.getColumns().add(col);
}
}
public void setDatas(){
Ini ini = EnvReadWriteUtil.getEvnIni();
Section session = ini.get("ENVNUM");
String defaultId = session.get("DEFAULT");
ObservableList<WorkPath> list = tableView.getItems();
for (Section aSession : ini.getAll("ITEM")) {
boolean defaultPath = false;
if(aSession.get("ID").equals(defaultId)){
defaultPath = true;
}
WorkPath dataRow = new WorkPath(aSession.get("ID"),aSession.get("NAME"),aSession.get("PATH"),defaultPath);
list.add(dataRow);
}
}
}
| [
"13940256550@139.com"
] | 13940256550@139.com |
b5600fedfcce7745fa250c685140dcbaca17ab19 | b8ce64fdec0061b861a03488e9823b780a51f07a | /DoitMission_15/app/src/androidTest/java/org/techtown/doitmission_15/ExampleInstrumentedTest.java | 5439cb3500a14a43e88ec20f78ae1c2528190b75 | [] | no_license | seorima/DoitAndroid | d89949af367d88a21109794e995e91b76361251f | 8fde09252a6594d5666c0727224f576450416de5 | refs/heads/master | 2023-03-25T01:30:08.315216 | 2021-03-13T16:24:46 | 2021-03-13T16:24:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package org.techtown.doitmission_15;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("org.techtown.doitmission_15", appContext.getPackageName());
}
} | [
"yoicch19@gmail.com"
] | yoicch19@gmail.com |
9befa3e99ec9487763d8f2991772e98382f7add6 | 5acf068c99a9a642e0200806e38de11099c78fb3 | /src/main/java/io/example/Main.java | cb346159de54cf2e381c022b7f81a6e73497c7fc | [] | no_license | rrizun/kafka-embedded | dd9faa8e535b69216024f38cfe45dd22449e1e03 | 5726663919a4a90a92fdc81f7caf309f213dfb61 | refs/heads/master | 2020-04-27T21:36:13.739848 | 2019-03-09T14:30:06 | 2019-03-09T14:30:06 | 174,704,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,161 | java | package io.example;
import java.io.IOException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.EnableScheduling;
import io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain;
/**
* Main
*/
@EnableScheduling
@SpringBootApplication
public class Main {
public static void main(String... args) {
SpringApplication.run(Main.class, args);
}
@EventListener
public void applicationStartedEvent(ApplicationStartedEvent event) throws Exception {
log("applicationStartedEvent");
new Thread() {
@Override
public void run() {
log("run");
try {
SchemaRegistryMain
.main(new String[] { "/tmp/confluent.kSXDqvVg/schema-registry/schema-registry.properties" });
} catch (IOException e) {
e.printStackTrace();
}
}
}.start();
}
private void log(Object... args) {
new LogHelper(this).log(args);
}
}
| [
"rrizun@gmail.com"
] | rrizun@gmail.com |
0ad09101b0dcb380f15efe39e60aca2e7ad43e41 | 3b74874edf06141944cc2032228eef6a5cf2ab80 | /src/main/java/mapTest/p01/iterator/MapTest.java | b3b433140b67321bcb5b8c8ec8e96564959e7117 | [] | no_license | HomeInGuanglunshan/CodeTestMavenized | 7e4797b6f7bed3715d6a5279b6971fdf1859a1df | b3a06bb5a13f39398b397e1917345d017259ef7a | refs/heads/master | 2023-07-25T12:33:10.245323 | 2023-07-13T07:56:59 | 2023-07-13T07:56:59 | 304,035,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package mapTest.p01.iterator;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public class MapTest {
public static void main(String[] args) {
Map<String, String> map = new HashMap<String, String>();
map.put("sgsfg", "1");
map.put("safsv", "2");
map.put("3uyijy", "3");
map.put("et6jgh4", "4");
for (Iterator<Entry<String, String>> it = map.entrySet().iterator(); it.hasNext();) {
Entry<String, String> entry = it.next();
System.out.println(entry.getKey() + "---" + entry.getValue());
}
// Map<?, ?> emptyMap = Collections.EMPTY_MAP;
// System.out.println(emptyMap);
System.out.println(map.put("sgsfg", "34456"));
}
}
| [
"2467055745@qq.com"
] | 2467055745@qq.com |
7725d1f8518d71702769a33a7d8f5686cd78577d | 5c8b89691490ec7fc747ce2a11645e06f521625c | /benchmark_ui/src/main/java/com/zealp/benchmark_ui/module/me/iwf/photopicker/widget/TouchImageView.java | 0a4f48febee9278bc6639a6cc7bca7945583936d | [] | no_license | ZealP/Android_BenchmarkUI | d08286bee1e743a6dd90502bcb9a7e9d74468b5e | 096afd4a7a2f73a24b1f1451aea5850b5ade74b3 | refs/heads/master | 2021-07-20T00:37:47.372118 | 2021-07-15T09:17:15 | 2021-07-15T09:17:15 | 170,269,487 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 42,844 | java | /*
* TouchImageView.java
* By: Michael Ortiz
* Updated By: Patrick Lackemacher
* Updated By: Babay88
* Updated By: @ipsilondev
* Updated By: hank-cp
* Updated By: singpolyma
* -------------------
* Extends Android ImageView to include pinch zooming, panning, fling and double tap zoom.
*/
package com.zealp.benchmark_ui.module.me.iwf.photopicker.widget;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;
import android.widget.OverScroller;
import android.widget.Scroller;
public class TouchImageView extends ImageView {
private static final String DEBUG = "DEBUG";
//
// SuperMin and SuperMax multipliers. Determine how much the image can be
// zoomed below or above the zoom boundaries, before animating back to the
// min/max zoom boundary.
//
private static final float SUPER_MIN_MULTIPLIER = .75f;
private static final float SUPER_MAX_MULTIPLIER = 1.25f;
//
// Scale of image ranges from minScale to maxScale, where minScale == 1
// when the image is stretched to fit view.
//
private float normalizedScale;
//
// Matrix applied to image. MSCALE_X and MSCALE_Y should always be equal.
// MTRANS_X and MTRANS_Y are the other values used. prevMatrix is the matrix
// saved prior to the screen rotating.
//
private Matrix matrix, prevMatrix;
private enum State {NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM}
;
private State state;
private float minScale;
private float maxScale;
private float superMinScale;
private float superMaxScale;
private float[] m;
private Context context;
private Fling fling;
private ScaleType mScaleType;
private boolean imageRenderedAtLeastOnce;
private boolean onDrawReady;
private ZoomVariables delayedZoomVariables;
//
// Size of view and previous view size (ie before rotation)
//
private int viewWidth, viewHeight, prevViewWidth, prevViewHeight;
//
// Size of image when it is stretched to fit view. Before and After rotation.
//
private float matchViewWidth, matchViewHeight, prevMatchViewWidth, prevMatchViewHeight;
private ScaleGestureDetector mScaleDetector;
private GestureDetector mGestureDetector;
private GestureDetector.OnDoubleTapListener doubleTapListener = null;
private OnTouchListener userTouchListener = null;
private OnTouchImageViewListener touchImageViewListener = null;
public TouchImageView(Context context) {
super(context);
sharedConstructing(context);
}
public TouchImageView(Context context, AttributeSet attrs) {
super(context, attrs);
sharedConstructing(context);
}
public TouchImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
sharedConstructing(context);
}
private void sharedConstructing(Context context) {
super.setClickable(true);
this.context = context;
mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
mGestureDetector = new GestureDetector(context, new GestureListener());
matrix = new Matrix();
prevMatrix = new Matrix();
m = new float[9];
normalizedScale = 1;
if (mScaleType == null) {
mScaleType = ScaleType.FIT_CENTER;
}
minScale = 1;
maxScale = 3;
superMinScale = SUPER_MIN_MULTIPLIER * minScale;
superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
setImageMatrix(matrix);
setScaleType(ScaleType.MATRIX);
setState(State.NONE);
onDrawReady = false;
super.setOnTouchListener(new PrivateOnTouchListener());
}
@Override
public void setOnTouchListener(OnTouchListener l) {
userTouchListener = l;
}
public void setOnTouchImageViewListener(OnTouchImageViewListener l) {
touchImageViewListener = l;
}
public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener l) {
doubleTapListener = l;
}
@Override
public void setImageResource(int resId) {
super.setImageResource(resId);
savePreviousImageValues();
fitImageToView();
}
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
savePreviousImageValues();
fitImageToView();
}
@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
savePreviousImageValues();
fitImageToView();
}
@Override
public void setImageURI(Uri uri) {
super.setImageURI(uri);
savePreviousImageValues();
fitImageToView();
}
@Override
public void setScaleType(ScaleType type) {
if (type == ScaleType.FIT_START || type == ScaleType.FIT_END) {
throw new UnsupportedOperationException(
"TouchImageView does not support FIT_START or FIT_END");
}
if (type == ScaleType.MATRIX) {
super.setScaleType(ScaleType.MATRIX);
} else {
mScaleType = type;
if (onDrawReady) {
//
// If the image is already rendered, scaleType has been called programmatically
// and the TouchImageView should be updated with the new scaleType.
//
setZoom(this);
}
}
}
@Override
public ScaleType getScaleType() {
return mScaleType;
}
/**
* Returns false if image is in initial, unzoomed state. False, otherwise.
*
* @return true if image is zoomed
*/
public boolean isZoomed() {
return normalizedScale != 1;
}
/**
* Return a Rect representing the zoomed image.
*
* @return rect representing zoomed image
*/
public RectF getZoomedRect() {
if (mScaleType == ScaleType.FIT_XY) {
throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY");
}
PointF topLeft = transformCoordTouchToBitmap(0, 0, true);
PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true);
float w = getDrawable().getIntrinsicWidth();
float h = getDrawable().getIntrinsicHeight();
return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h);
}
/**
* Save the current matrix and view dimensions
* in the prevMatrix and prevView variables.
*/
private void savePreviousImageValues() {
if (matrix != null && viewHeight != 0 && viewWidth != 0) {
matrix.getValues(m);
prevMatrix.setValues(m);
prevMatchViewHeight = matchViewHeight;
prevMatchViewWidth = matchViewWidth;
prevViewHeight = viewHeight;
prevViewWidth = viewWidth;
}
}
@Override
public Parcelable onSaveInstanceState() {
Bundle bundle = new Bundle();
bundle.putParcelable("instanceState", super.onSaveInstanceState());
bundle.putFloat("saveScale", normalizedScale);
bundle.putFloat("matchViewHeight", matchViewHeight);
bundle.putFloat("matchViewWidth", matchViewWidth);
bundle.putInt("viewWidth", viewWidth);
bundle.putInt("viewHeight", viewHeight);
matrix.getValues(m);
bundle.putFloatArray("matrix", m);
bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce);
return bundle;
}
@Override
public void onRestoreInstanceState(Parcelable state) {
if (state instanceof Bundle) {
Bundle bundle = (Bundle) state;
normalizedScale = bundle.getFloat("saveScale");
m = bundle.getFloatArray("matrix");
prevMatrix.setValues(m);
prevMatchViewHeight = bundle.getFloat("matchViewHeight");
prevMatchViewWidth = bundle.getFloat("matchViewWidth");
prevViewHeight = bundle.getInt("viewHeight");
prevViewWidth = bundle.getInt("viewWidth");
imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered");
super.onRestoreInstanceState(bundle.getParcelable("instanceState"));
return;
}
super.onRestoreInstanceState(state);
}
@Override
protected void onDraw(Canvas canvas) {
onDrawReady = true;
imageRenderedAtLeastOnce = true;
if (delayedZoomVariables != null) {
setZoom(delayedZoomVariables.scale, delayedZoomVariables.focusX, delayedZoomVariables.focusY,
delayedZoomVariables.scaleType);
delayedZoomVariables = null;
}
super.onDraw(canvas);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
savePreviousImageValues();
}
/**
* Get the max zoom multiplier.
*
* @return max zoom multiplier.
*/
public float getMaxZoom() {
return maxScale;
}
/**
* Set the max zoom multiplier. Default value: 3.
*
* @param max max zoom multiplier.
*/
public void setMaxZoom(float max) {
maxScale = max;
superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
}
/**
* Get the min zoom multiplier.
*
* @return min zoom multiplier.
*/
public float getMinZoom() {
return minScale;
}
/**
* Get the current zoom. This is the zoom relative to the initial
* scale, not the original resource.
*
* @return current zoom multiplier.
*/
public float getCurrentZoom() {
return normalizedScale;
}
/**
* Set the min zoom multiplier. Default value: 1.
*
* @param min min zoom multiplier.
*/
public void setMinZoom(float min) {
minScale = min;
superMinScale = SUPER_MIN_MULTIPLIER * minScale;
}
/**
* Reset zoom and translation to initial state.
*/
public void resetZoom() {
normalizedScale = 1;
fitImageToView();
}
/**
* Set zoom to the specified scale. Image will be centered by default.
*/
public void setZoom(float scale) {
setZoom(scale, 0.5f, 0.5f);
}
/**
* Set zoom to the specified scale. Image will be centered around the point
* (focusX, focusY). These floats range from 0 to 1 and denote the focus point
* as a fraction from the left and top of the view. For example, the top left
* corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
*
* @param scale
* @param focusX
* @param focusY
*/
public void setZoom(float scale, float focusX, float focusY) {
setZoom(scale, focusX, focusY, mScaleType);
}
/**
* Set zoom to the specified scale. Image will be centered around the point
* (focusX, focusY). These floats range from 0 to 1 and denote the focus point
* as a fraction from the left and top of the view. For example, the top left
* corner of the image would be (0, 0). And the bottom right corner would be (1, 1).
*
* @param scale
* @param focusX
* @param focusY
* @param scaleType
*/
public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) {
//
// setZoom can be called before the image is on the screen, but at this point,
// image and view sizes have not yet been calculated in onMeasure. Thus, we should
// delay calling setZoom until the view has been measured.
//
if (!onDrawReady) {
delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType);
return;
}
if (scaleType != mScaleType) {
setScaleType(scaleType);
}
resetZoom();
scaleImage(scale, viewWidth / 2, viewHeight / 2, true);
matrix.getValues(m);
m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f));
m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f));
matrix.setValues(m);
fixTrans();
setImageMatrix(matrix);
}
/**
* Set zoom parameters equal to another TouchImageView. Including scale, position,
* and ScaleType.
*
* @param img TouchImageView
*/
public void setZoom(TouchImageView img) {
PointF center = img.getScrollPosition();
setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
}
/**
* Return the point at the center of the zoomed image. The PointF coordinates range
* in value between 0 and 1 and the focus point is denoted as a fraction from the left
* and top of the view. For example, the top left corner of the image would be (0, 0).
* And the bottom right corner would be (1, 1).
*
* @return PointF representing the scroll position of the zoomed image.
*/
public PointF getScrollPosition() {
Drawable drawable = getDrawable();
if (drawable == null) {
return null;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
PointF point = transformCoordTouchToBitmap(viewWidth / 2, viewHeight / 2, true);
point.x /= drawableWidth;
point.y /= drawableHeight;
return point;
}
/**
* Set the focus point of the zoomed image. The focus points are denoted as a fraction from the
* left and top of the view. The focus points can range in value between 0 and 1.
*
* @param focusX X
* @param focusY Y
*/
public void setScrollPosition(float focusX, float focusY) {
setZoom(normalizedScale, focusX, focusY);
}
/**
* Performs boundary checking and fixes the image matrix if it
* is out of bounds.
*/
private void fixTrans() {
matrix.getValues(m);
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float fixTransX = getFixTrans(transX, viewWidth, getImageWidth());
float fixTransY = getFixTrans(transY, viewHeight, getImageHeight());
if (fixTransX != 0 || fixTransY != 0) {
matrix.postTranslate(fixTransX, fixTransY);
}
}
/**
* When transitioning from zooming from focus to zoom from center (or vice versa)
* the image can become unaligned within the view. This is apparent when zooming
* quickly. When the content size is less than the view size, the content will often
* be centered incorrectly within the view. fixScaleTrans first calls fixTrans() and
* then makes sure the image is centered correctly within the view.
*/
private void fixScaleTrans() {
fixTrans();
matrix.getValues(m);
if (getImageWidth() < viewWidth) {
m[Matrix.MTRANS_X] = (viewWidth - getImageWidth()) / 2;
}
if (getImageHeight() < viewHeight) {
m[Matrix.MTRANS_Y] = (viewHeight - getImageHeight()) / 2;
}
matrix.setValues(m);
}
private float getFixTrans(float trans, float viewSize, float contentSize) {
float minTrans, maxTrans;
if (contentSize <= viewSize) {
minTrans = 0;
maxTrans = viewSize - contentSize;
} else {
minTrans = viewSize - contentSize;
maxTrans = 0;
}
if (trans < minTrans) return -trans + minTrans;
if (trans > maxTrans) return -trans + maxTrans;
return 0;
}
private float getFixDragTrans(float delta, float viewSize, float contentSize) {
if (contentSize <= viewSize) {
return 0;
}
return delta;
}
private float getImageWidth() {
return matchViewWidth * normalizedScale;
}
private float getImageHeight() {
return matchViewHeight * normalizedScale;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0
|| drawable.getIntrinsicHeight() == 0) {
setMeasuredDimension(0, 0);
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
viewWidth = setViewSize(widthMode, widthSize, drawableWidth);
viewHeight = setViewSize(heightMode, heightSize, drawableHeight);
//
// Set view dimensions
//
setMeasuredDimension(viewWidth, viewHeight);
//
// Fit content within view
//
fitImageToView();
}
/**
* If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise,
* it is made to fit the screen according to the dimensions of the previous image matrix. This
* allows the image to maintain its zoom after rotation.
*/
private void fitImageToView() {
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0
|| drawable.getIntrinsicHeight() == 0) {
return;
}
if (matrix == null || prevMatrix == null) {
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
//
// Scale image for view
//
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch (mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
//
// FIT_START and FIT_END not supported
//
throw new UnsupportedOperationException(
"TouchImageView does not support FIT_START or FIT_END");
}
//
// Center the image
//
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
//
// Stretch and center image to fit view
//
matrix.setScale(scaleX, scaleY);
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
normalizedScale = 1;
} else {
//
// These values should never be 0 or we will set viewWidth and viewHeight
// to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues
// to set them equal to the current values.
//
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues();
}
prevMatrix.getValues(m);
//
// Rescale Matrix after rotation
//
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
//
// TransX and TransY from previous matrix
//
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
//
// Width
//
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth,
prevViewWidth, viewWidth, drawableWidth);
//
// Height
//
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight,
prevViewHeight, viewHeight, drawableHeight);
//
// Set the matrix to the adjusted scale and translate values.
//
matrix.setValues(m);
}
fixTrans();
setImageMatrix(matrix);
}
/**
* Set view dimensions based on layout params
*/
private int setViewSize(int mode, int size, int drawableWidth) {
int viewSize;
switch (mode) {
case MeasureSpec.EXACTLY:
viewSize = size;
break;
case MeasureSpec.AT_MOST:
viewSize = Math.min(drawableWidth, size);
break;
case MeasureSpec.UNSPECIFIED:
viewSize = drawableWidth;
break;
default:
viewSize = size;
break;
}
return viewSize;
}
/**
* After rotating, the matrix needs to be translated. This function finds the area of image
* which was previously centered and adjusts translations so that is again the center,
* post-rotation.
*
* @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y
* @param trans the value of trans in that axis before the rotation
* @param prevImageSize the width/height of the image before the rotation
* @param imageSize width/height of the image after rotation
* @param prevViewSize width/height of view before rotation
* @param viewSize width/height of view after rotation
* @param drawableSize width/height of drawable
*/
private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize,
float imageSize, int prevViewSize, int viewSize, int drawableSize) {
if (imageSize < viewSize) {
//
// The width/height of image is less than the view's width/height. Center it.
//
m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f;
} else if (trans > 0) {
//
// The image is larger than the view, but was not before rotation. Center it.
//
m[axis] = -((imageSize - viewSize) * 0.5f);
} else {
//
// Find the area of the image which was previously centered in the view. Determine its distance
// from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage
// to calculate the trans in the new view width/height.
//
float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize;
m[axis] = -((percentage * imageSize) - (viewSize * 0.5f));
}
}
private void setState(State state) {
this.state = state;
}
public boolean canScrollHorizontallyFroyo(int direction) {
return canScrollHorizontally(direction);
}
@Override
public boolean canScrollHorizontally(int direction) {
matrix.getValues(m);
float x = m[Matrix.MTRANS_X];
if (getImageWidth() < viewWidth) {
return false;
} else if (x >= -1 && direction < 0) {
return false;
} else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) {
return false;
}
return true;
}
/**
* Gesture Listener detects a single click or long click and passes that on
* to the view's listener.
*
* @author Ortiz
*/
private class GestureListener extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
if (doubleTapListener != null) {
return doubleTapListener.onSingleTapConfirmed(e);
}
return performClick();
}
@Override
public void onLongPress(MotionEvent e) {
performLongClick();
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (fling != null) {
//
// If a previous fling is still active, it should be cancelled so that two flings
// are not run simultaenously.
//
fling.cancelFling();
}
fling = new Fling((int) velocityX, (int) velocityY);
compatPostOnAnimation(fling);
return super.onFling(e1, e2, velocityX, velocityY);
}
@Override
public boolean onDoubleTap(MotionEvent e) {
boolean consumed = false;
if (doubleTapListener != null) {
consumed = doubleTapListener.onDoubleTap(e);
}
if (state == State.NONE) {
float targetZoom = (normalizedScale == minScale) ? maxScale : minScale;
DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, e.getX(), e.getY(), false);
compatPostOnAnimation(doubleTap);
consumed = true;
}
return consumed;
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
if (doubleTapListener != null) {
return doubleTapListener.onDoubleTapEvent(e);
}
return false;
}
}
public interface OnTouchImageViewListener {
public void onMove();
}
/**
* Responsible for all touch events. Handles the heavy lifting of drag and also sends
* touch events to Scale Detector and Gesture Detector.
*
* @author Ortiz
*/
private class PrivateOnTouchListener implements OnTouchListener {
//
// Remember last point position for dragging
//
private PointF last = new PointF();
@Override
public boolean onTouch(View v, MotionEvent event) {
mScaleDetector.onTouchEvent(event);
mGestureDetector.onTouchEvent(event);
PointF curr = new PointF(event.getX(), event.getY());
if (state == State.NONE || state == State.DRAG || state == State.FLING) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
last.set(curr);
if (fling != null) fling.cancelFling();
setState(State.DRAG);
break;
case MotionEvent.ACTION_MOVE:
if (state == State.DRAG) {
float deltaX = curr.x - last.x;
float deltaY = curr.y - last.y;
float fixTransX = getFixDragTrans(deltaX, viewWidth, getImageWidth());
float fixTransY = getFixDragTrans(deltaY, viewHeight, getImageHeight());
matrix.postTranslate(fixTransX, fixTransY);
fixTrans();
last.set(curr.x, curr.y);
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
setState(State.NONE);
break;
}
}
setImageMatrix(matrix);
//
// User-defined OnTouchListener
//
if (userTouchListener != null) {
userTouchListener.onTouch(v, event);
}
//
// OnTouchImageViewListener is set: TouchImageView dragged by user.
//
if (touchImageViewListener != null) {
touchImageViewListener.onMove();
}
//
// indicate event was handled
//
return true;
}
}
/**
* ScaleListener detects user two finger scaling and scales image.
*
* @author Ortiz
*/
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
setState(State.ZOOM);
return true;
}
@Override
public boolean onScale(ScaleGestureDetector detector) {
scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true);
//
// OnTouchImageViewListener is set: TouchImageView pinch zoomed by user.
//
if (touchImageViewListener != null) {
touchImageViewListener.onMove();
}
return true;
}
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
super.onScaleEnd(detector);
setState(State.NONE);
boolean animateToZoomBoundary = false;
float targetZoom = normalizedScale;
if (normalizedScale > maxScale) {
targetZoom = maxScale;
animateToZoomBoundary = true;
} else if (normalizedScale < minScale) {
targetZoom = minScale;
animateToZoomBoundary = true;
}
if (animateToZoomBoundary) {
DoubleTapZoom doubleTap =
new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true);
compatPostOnAnimation(doubleTap);
}
}
}
private void scaleImage(double deltaScale, float focusX, float focusY,
boolean stretchImageToSuper) {
float lowerScale, upperScale;
if (stretchImageToSuper) {
lowerScale = superMinScale;
upperScale = superMaxScale;
} else {
lowerScale = minScale;
upperScale = maxScale;
}
float origScale = normalizedScale;
normalizedScale *= deltaScale;
if (normalizedScale > upperScale) {
normalizedScale = upperScale;
deltaScale = upperScale / origScale;
} else if (normalizedScale < lowerScale) {
normalizedScale = lowerScale;
deltaScale = lowerScale / origScale;
}
matrix.postScale((float) deltaScale, (float) deltaScale, focusX, focusY);
fixScaleTrans();
}
/**
* DoubleTapZoom calls a series of runnables which apply
* an animated zoom in/out graphic to the image.
*
* @author Ortiz
*/
private class DoubleTapZoom implements Runnable {
private long startTime;
private static final float ZOOM_TIME = 500;
private float startZoom, targetZoom;
private float bitmapX, bitmapY;
private boolean stretchImageToSuper;
private AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator();
private PointF startTouch;
private PointF endTouch;
DoubleTapZoom(float targetZoom, float focusX, float focusY, boolean stretchImageToSuper) {
setState(State.ANIMATE_ZOOM);
startTime = System.currentTimeMillis();
this.startZoom = normalizedScale;
this.targetZoom = targetZoom;
this.stretchImageToSuper = stretchImageToSuper;
PointF bitmapPoint = transformCoordTouchToBitmap(focusX, focusY, false);
this.bitmapX = bitmapPoint.x;
this.bitmapY = bitmapPoint.y;
//
// Used for translating image during scaling
//
startTouch = transformCoordBitmapToTouch(bitmapX, bitmapY);
endTouch = new PointF(viewWidth / 2, viewHeight / 2);
}
@Override
public void run() {
float t = interpolate();
double deltaScale = calculateDeltaScale(t);
scaleImage(deltaScale, bitmapX, bitmapY, stretchImageToSuper);
translateImageToCenterTouchPosition(t);
fixScaleTrans();
setImageMatrix(matrix);
//
// OnTouchImageViewListener is set: double tap runnable updates listener
// with every frame.
//
if (touchImageViewListener != null) {
touchImageViewListener.onMove();
}
if (t < 1f) {
//
// We haven't finished zooming
//
compatPostOnAnimation(this);
} else {
//
// Finished zooming
//
setState(State.NONE);
}
}
/**
* Interpolate between where the image should start and end in order to translate
* the image so that the point that is touched is what ends up centered at the end
* of the zoom.
*/
private void translateImageToCenterTouchPosition(float t) {
float targetX = startTouch.x + t * (endTouch.x - startTouch.x);
float targetY = startTouch.y + t * (endTouch.y - startTouch.y);
PointF curr = transformCoordBitmapToTouch(bitmapX, bitmapY);
matrix.postTranslate(targetX - curr.x, targetY - curr.y);
}
/**
* Use interpolator to get t
*/
private float interpolate() {
long currTime = System.currentTimeMillis();
float elapsed = (currTime - startTime) / ZOOM_TIME;
elapsed = Math.min(1f, elapsed);
return interpolator.getInterpolation(elapsed);
}
/**
* Interpolate the current targeted zoom and get the delta
* from the current zoom.
*/
private double calculateDeltaScale(float t) {
double zoom = startZoom + t * (targetZoom - startZoom);
return zoom / normalizedScale;
}
}
/**
* This function will transform the coordinates in the touch event to the coordinate
* system of the drawable that the imageview contain
*
* @param x x-coordinate of touch event
* @param y y-coordinate of touch event
* @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip
* return value
* to the bounds of the bitmap size.
* @return Coordinates of the point touched, in the coordinate system of the original drawable.
*/
private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float finalX = ((x - transX) * origW) / getImageWidth();
float finalY = ((y - transY) * origH) / getImageHeight();
if (clipToBitmap) {
finalX = Math.min(Math.max(finalX, 0), origW);
finalY = Math.min(Math.max(finalY, 0), origH);
}
return new PointF(finalX, finalY);
}
/**
* Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
* drawable's coordinate system to the view's coordinate system.
*
* @param bx x-coordinate in original bitmap coordinate system
* @param by y-coordinate in original bitmap coordinate system
* @return Coordinates of the point in the view's coordinate system.
*/
private PointF transformCoordBitmapToTouch(float bx, float by) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float px = bx / origW;
float py = by / origH;
float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px;
float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py;
return new PointF(finalX, finalY);
}
/**
* Fling launches sequential runnables which apply
* the fling graphic to the image. The values for the translation
* are interpolated by the Scroller.
*
* @author Ortiz
*/
private class Fling implements Runnable {
CompatScroller scroller;
int currX, currY;
Fling(int velocityX, int velocityY) {
setState(State.FLING);
scroller = new CompatScroller(context);
matrix.getValues(m);
int startX = (int) m[Matrix.MTRANS_X];
int startY = (int) m[Matrix.MTRANS_Y];
int minX, maxX, minY, maxY;
if (getImageWidth() > viewWidth) {
minX = viewWidth - (int) getImageWidth();
maxX = 0;
} else {
minX = maxX = startX;
}
if (getImageHeight() > viewHeight) {
minY = viewHeight - (int) getImageHeight();
maxY = 0;
} else {
minY = maxY = startY;
}
scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX, maxX, minY, maxY);
currX = startX;
currY = startY;
}
public void cancelFling() {
if (scroller != null) {
setState(State.NONE);
scroller.forceFinished(true);
}
}
@Override
public void run() {
//
// OnTouchImageViewListener is set: TouchImageView listener has been flung by user.
// Listener runnable updated with each frame of fling animation.
//
if (touchImageViewListener != null) {
touchImageViewListener.onMove();
}
if (scroller.isFinished()) {
scroller = null;
return;
}
if (scroller.computeScrollOffset()) {
int newX = scroller.getCurrX();
int newY = scroller.getCurrY();
int transX = newX - currX;
int transY = newY - currY;
currX = newX;
currY = newY;
matrix.postTranslate(transX, transY);
fixTrans();
setImageMatrix(matrix);
compatPostOnAnimation(this);
}
}
}
@TargetApi(VERSION_CODES.GINGERBREAD)
private class CompatScroller {
Scroller scroller;
OverScroller overScroller;
boolean isPreGingerbread;
public CompatScroller(Context context) {
if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) {
isPreGingerbread = true;
scroller = new Scroller(context);
} else {
isPreGingerbread = false;
overScroller = new OverScroller(context);
}
}
public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX,
int minY, int maxY) {
if (isPreGingerbread) {
scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
} else {
overScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY);
}
}
public void forceFinished(boolean finished) {
if (isPreGingerbread) {
scroller.forceFinished(finished);
} else {
overScroller.forceFinished(finished);
}
}
public boolean isFinished() {
if (isPreGingerbread) {
return scroller.isFinished();
} else {
return overScroller.isFinished();
}
}
public boolean computeScrollOffset() {
if (isPreGingerbread) {
return scroller.computeScrollOffset();
} else {
overScroller.computeScrollOffset();
return overScroller.computeScrollOffset();
}
}
public int getCurrX() {
if (isPreGingerbread) {
return scroller.getCurrX();
} else {
return overScroller.getCurrX();
}
}
public int getCurrY() {
if (isPreGingerbread) {
return scroller.getCurrY();
} else {
return overScroller.getCurrY();
}
}
}
@TargetApi(VERSION_CODES.JELLY_BEAN)
private void compatPostOnAnimation(Runnable runnable) {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
postOnAnimation(runnable);
} else {
postDelayed(runnable, 1000 / 60);
}
}
private class ZoomVariables {
public float scale;
public float focusX;
public float focusY;
public ScaleType scaleType;
public ZoomVariables(float scale, float focusX, float focusY, ScaleType scaleType) {
this.scale = scale;
this.focusX = focusX;
this.focusY = focusY;
this.scaleType = scaleType;
}
}
private void printMatrixInfo() {
float[] n = new float[9];
matrix.getValues(n);
Log.d(DEBUG, "Scale: " + n[Matrix.MSCALE_X] + " TransX: " + n[Matrix.MTRANS_X] + " TransY: "
+ n[Matrix.MTRANS_Y]);
}
} | [
"ZealP@github.com"
] | ZealP@github.com |
83547c6127b6adb7b93989b1cddbb1afcecc5c2e | 8270d89d5b7711806efc96d26380e7c51c7b8ec6 | /src/main/java/pattern/structural/adapter/AC220.java | 2b7cfe3dd90986efdcdc2688b3a44f7ae1ab7a30 | [] | no_license | luran0821/DesignPattern | 173fb57b3f4d90a88ee89f0ded05509eab5ca66f | 909545b6b6f2122e82369ff9f13522b4d72f9c1e | refs/heads/master | 2023-08-19T08:06:39.255340 | 2019-10-06T12:56:00 | 2019-10-06T12:56:00 | 212,748,434 | 0 | 0 | null | 2023-08-04T19:33:34 | 2019-10-04T06:17:57 | Java | UTF-8 | Java | false | false | 207 | java | package pattern.structural.adapter;
public class AC220 {
public int outputAC220V(){
int output = 220;
System.out.println("输出交流点" + output+ "V");
return output;
}
}
| [
"luran0821@gmail.com"
] | luran0821@gmail.com |
fe2bbf8e6678ce286551e6961735c6e661f1ddf6 | 44aeaa528a9e3cfa0597808ca031695f7c836593 | /src/main/java/kr/ac/kopo/kopo08/domain/Board.java | ab938ec88c5c82361722fa4e911fdb509b9de9b5 | [] | no_license | EunbInn/BoardUsingSpring | 3fb691cd65f2fcdd88245847c6388443c83df6d6 | 5a6d6efc9bd36dfdd7a527a7c3038728b0920946 | refs/heads/master | 2023-07-03T04:24:53.002073 | 2021-07-21T12:13:58 | 2021-07-21T12:13:58 | 383,960,180 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package kr.ac.kopo.kopo08.domain;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
@Entity
public class Board {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column
private Long id;
@Column
private String title;
//fetch type이 Lazy로 되어있으면 늦게 가져옴 느긋하게 eager은 바로
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "board")
private List<BoardItem> boardItems;
public Board() {
}
public Board(Long id) {
this.id = id;
}
public Board(Long id, String title) {
this.id = id;
this.title = title;
}
public Board(String title) {
this.title = title;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<BoardItem> getBoardItems() {
return boardItems;
}
public void setBoardItems(List<BoardItem> boardItem) {
this.boardItems = boardItem;
}
}
| [
"dsino@naver.com"
] | dsino@naver.com |
14c906f33d047f8e8e668885dee99f72ea239185 | 682082f4ea06ea438e0243c5504918cef9d6c58a | /ReviewExamen/src/smokers/agent.java | 8023b49f40364e272ee90b51d65959b536177563 | [] | no_license | HassenBenSlima/Thread-Java | ae7883fb14430d75ab7e31b25cf06d0dbf07d231 | c113991f558deaaeda5038592fe5a49e58c28c13 | refs/heads/master | 2020-08-08T06:11:10.541014 | 2019-10-08T22:41:05 | 2019-10-08T22:41:05 | 213,749,479 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 794 | java | package smokers;
public class agent extends Thread {
private table smokingtable;
public agent(table pSmokingtable) {
smokingtable = pSmokingtable;
}
@Override
public void run() {
while (true) {
try {
Thread.sleep(5000);
smokingtable.setAgentElements();
// this triggers the smoker-threads to look at the table
output("The agents puts " + smokingtable.getAgentElements() + " on the table.");
// pause the agent while one smoker thread is running
pause();
} catch (Exception e) {
}
}
}
public synchronized void wake() {
try {
notify();
} catch (Exception e) {
}
}
public synchronized void pause() {
try {
this.wait();
} catch (Exception e) {
}
}
private void output(String pOutput) {
System.out.println(pOutput);
}
}
| [
"Hassen.BenSlima"
] | Hassen.BenSlima |
1304ae9cb877260582cd2779b1086f60c20e5da8 | b4337734b343a0a424a117523ac04cb8eff32788 | /src/AESim/Nurse.java | ba525d1fb68f6dfacd42e32d06f773e43e9fd765 | [] | no_license | paescude/AESim | b8cf81743e9449897170b627e916001c38238844 | b195a443d07e3ed47b59201e3dc34824ccaf278e | refs/heads/master | 2020-05-17T16:04:14.750532 | 2013-12-06T17:07:57 | 2013-12-06T17:07:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,322 | java | package AESim;
import java.util.ArrayList;
import cern.jet.random.Uniform;
import Datos.Reader;
import Funciones.MathFunctions;
import repast.simphony.engine.schedule.IAction;
import repast.simphony.engine.schedule.ISchedule;
import repast.simphony.engine.schedule.ScheduleParameters;
import repast.simphony.engine.schedule.ScheduledMethod;
import repast.simphony.engine.watcher.Watch;
import repast.simphony.engine.watcher.WatcherTriggerSchedule;
import repast.simphony.random.RandomHelper;
import repast.simphony.space.grid.Grid;
import repast.simphony.space.grid.GridPoint;
public class Nurse extends Staff {
public static final double[] NURSE_TRIAGE_PARAMS = { 5, 10, 12 };
private static int count;
private double[] timeTriage = new double[3];
public Nurse(Grid<Object> grid, int x1, int y1, int idNum, int multiTasking) {
this.grid = grid;
this.available = true;
this.setId("Nurse " + idNum);
this.idNum = idNum;
this.numAvailable = 0;
this.initPosX = x1;
this.initPosY = y1;
this.myResource = null;
this.multiTaskingFactor = multiTasking;
this.patientsInMultitask = new ArrayList<Patient>();
this.setTimeTriage(NURSE_TRIAGE_PARAMS);
}
@Override
public void resetVariables() {
// TODO Auto-generated method stub
this.setInShift(false);
this.setAvailable(false);
int i = this.idNum;
int x = 18;
int y = i + 4;
grid.moveTo(this, x, y);
}
@Override
public void requiredAtWork() {
// TODO Auto-generated method stub
if (this.isInShift() == false) {
System.out.println(this.getId() + " will move to nurse area"
+ " method: schedule work"
+ " this method is being called by " + this.getId());
grid.moveTo(this, this.initPosX, this.initPosY);
this.numAvailable = this.multiTaskingFactor;
this.setInShift(true);
this.setAvailable(true);
System.out.println(this.getId() + " is in shift and is available at "
+ getTime());
}
}
@Override
public void decideWhatToDoNext() {
if (this.numAvailable == this.multiTaskingFactor && checkIfAnyForTriage()){
this.checkConditionsForTriage();
} else if (this.numAvailable > 0){
if (checkIfAnyForTriage()){
} else {
this.moveToNurseArea();
}
}
}
private void moveToNurseArea() {
if (this.patientsInMultitask.size() < this.multiTaskingFactor) {
boolean flag = false;
int y = 2;
int x;
for (int j = 0; j < 2; j++) {
for (int i = 1; i < 6; i++) {
Object o = grid.getObjectAt(i + 6, y + j);
if (o == null) {
x = i + 6;
grid.moveTo(this, x, y + j);
System.out.println(this.getId()
+ " has moved to nurses area "
+ this.getLoc().toString()
+ " at time " + getTime());
flag = true;
break;
}
if (flag) {
break;
}
}
if (flag) {
break;
}
}
this.setInShift(true);
this.setAvailable(true);
System.out.println(this.getId()
+ " is in shift and is available at " + getTime());
} else {
this.setAvailable(false);
}
}
private boolean checkIfAnyForTriage() {
Object o = getGrid().getObjectAt(2,2);
if (o instanceof Patient){
return true;
} else {
return false;
}
}
@Watch(watcheeClassName = "AESim.Patient", watcheeFieldNames = "wasFirstInQueueTriage", triggerCondition = "$watcher.getNumAvailable()==$watcher.getMultiTaskingFactor()", whenToTrigger = WatcherTriggerSchedule.IMMEDIATE)
public void checkConditionsForTriage() {
printTime();
Resource rAvailable = findResourceAvailable("triage cubicle ");
if (rAvailable != null) {
GridPoint loc = rAvailable.getLoc();
int locX = loc.getX();
int locY = loc.getY();
if (this.available) {
// System.out.println(" this is: " + this.getId());
Patient fstpatient = null;
// The head of the queue is at (x,y-1)
Object o = grid.getObjectAt(2, 2);
if (o != null) {
if (o instanceof Patient) {
fstpatient = (Patient) o;
grid.moveTo(this, locX, locY);
grid.moveTo(fstpatient, locX, locY);
this.setMyResource(rAvailable);
fstpatient.setMyResource(rAvailable);
GridPoint locQueue = this.getQueueLocation(
"queueTriage ", grid);
QueueSim queue = ((QueueSim) grid.getObjectAt(
locQueue.getX(), locQueue.getY()));
queue.removeFromQueue(fstpatient);
queue.elementsInQueue();
/* se utiliza esto (no engageWithPatient) porque el triage ocupa totalmente a la enfermera */
this.setNumAvailable(0);
this.setAvailable(false);
rAvailable.setAvailable(false);
System.out.println("Start triage " + fstpatient.getId() + " with " + this.getId());
scheduleEndTriage(fstpatient);
Patient newfst = null;
Object o2 = grid.getObjectAt(locQueue.getX(),
locQueue.getY());
if (o2 instanceof QueueSim) {
QueueSim newQueue = (QueueSim) o2;
if (newQueue.firstInQueue() != null) {
newfst = newQueue.firstInQueue();
grid.moveTo(newfst, locQueue.getX(),
(locQueue.getY() + 1));
}
}
}
}
} else {
// System.out.println("estoy en el watch y hay cola");
}
}
}
public void scheduleEndTriage(Patient fstpatient) {
double serviceTime = MathFunctions.distLognormal(NURSE_TRIAGE_PARAMS[0],
NURSE_TRIAGE_PARAMS[1], NURSE_TRIAGE_PARAMS[2]);
ISchedule schedule = repast.simphony.engine.environment.RunEnvironment
.getInstance().getCurrentSchedule();
double timeEndService = schedule.getTickCount() + serviceTime;
this.nextEndingTime= timeEndService;
fstpatient.settTriage(serviceTime);
System.out.println(" triage " + fstpatient.getId()
+ " expected to end at " + timeEndService);
ScheduleParameters scheduleParams = ScheduleParameters
.createOneTime(timeEndService);
EndTriage action2 = new EndTriage(this, fstpatient);
fstpatient.setTimeEndCurrentService(timeEndService);
schedule.schedule(scheduleParams, action2);
}
private static class EndTriage implements IAction {
private Nurse nurse;
private Patient patient;
private EndTriage(Nurse nurse, Patient patient) {
this.nurse = nurse;
this.patient = patient;
}
@Override
public void execute() {
nurse.endTriage(this.nurse, this.patient);
}
}
public void endTriage(Nurse nurse, Patient patient) {
printTime();
System.out.println("end triage " + patient.getId());
this.getMyResource().setAvailable(true);
this.setMyResource(null);
patient.setMyResource(null);
System.out.println(patient.getId() + " will get triage category");
nurse.startTriage(patient);
int totalProcess = patient.getTotalProcesses();
patient.setTotalProcesses(totalProcess+1);
this.setAvailable(true);
/* se utiliza esto (no releaseWithPatient) porque el triage ocupa totalmente a la enfermera */
this.setNumAvailable(this.multiTaskingFactor);
this.decideWhatToDoNext();
}
private void startTriage(Patient patient) {
Uniform unif = RandomHelper.createUniform();
double rnd = unif.nextDouble();
float[][] probsTriage = Reader.getMatrixTriagePropByArrival();
//only patients by walk in are triaged by nurse. Ambulance patients are triaged ny ambulanceIn
double rndDNW = RandomHelper.createUniform().nextDouble();
float [][] matrixDNW = Reader.getArrayDNW();
if (rndDNW <= matrixDNW[getHour()][0]) {
this.removePatientFromDepartment(patient);
}
else {
if (rnd <= probsTriage[0][0]) {
patient.setTriage("Blue ");
patient.setTriageNum(1);
double rndTreat = Math.random();
if (rndTreat < Patient.PROB_BLUE_PATIENT_IN_TREATMENT) {
patient.setGoToTreatRoom(true);
patient.addToQ("qBlue ");
} else {
this.removePatientFromDepartment(patient);
}
} else if (probsTriage[0][0] < rnd && rnd <= probsTriage[1][0]) {
patient.setTriage("Green ");
patient.setTriageNum(2);
patient.addToQ("qGreen ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[1][0] < rnd && rnd <= probsTriage[2][0]) {
patient.setTriage("Yellow ");
patient.setTriageNum(3);
patient.addToQ("qYellow ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[2][0] < rnd && rnd <= probsTriage[3][0]) {
patient.setTriage("Orange ");
patient.setTriageNum(4);
patient.addToQ("qOrange ");
patient.setGoToTreatRoom(true);
} else if (probsTriage[3][0] < rnd && rnd <= probsTriage[4][0]) {
patient.setTriage("Red ");
patient.setTriageNum(5);
patient.addToQ("qRed ");
patient.setGoToTreatRoom(true);
}
System.out.println(patient.getId() + " triage num = "
+ patient.getTriageNum() + " has moved to "
+ patient.getCurrentQueue().getId());
}
}
@ScheduledMethod(start = 0, priority = 99, shuffle = false)
public void initNumNurses() {
printTime();
System.out.println("When simulation starts, the nurse conditions are "
+ this.getId());
GridPoint currentLoc = grid.getLocation(this);
int currentX = currentLoc.getX();
int currentY = currentLoc.getY();
if (currentX == 18) {
this.setAvailable(false);
this.setInShift(false);
System.out.println(this.getId()
+ " is not in shift and is not available, time: "
+ getTime());
} else if (currentY == 2) {
this.setAvailable(true);
this.setInShift(true);
System.out.println(this.getId()
+ " is in shift and is available, time: " + getTime());
}
int id = this.idNum;
float sum = 0;
switch (id) {
case 1:
this.setMyShiftMatrix(Reader.getMatrixNurse1());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse1()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 2:
this.setMyShiftMatrix(Reader.getMatrixNurse2());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse2()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 3:
this.setMyShiftMatrix(Reader.getMatrixNurse3());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse3()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 4:
this.setMyShiftMatrix(Reader.getMatrixNurse4());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse4()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
case 5:
this.setMyShiftMatrix(Reader.getMatrixNurse5());
for (int i = 0; i < 7; i++) {
sum = 0;
for (int j = 0; j < 23; j++) {
sum = sum + Reader.getMatrixNurse5()[j][i];
}
this.durationOfShift[i] = sum;
}
break;
default:
break;
}
System.out.println(this.getId() + " shift's duration ["
+ this.durationOfShift[0] + " ," + this.durationOfShift[1]
+ "," + this.durationOfShift[2] + " ,"
+ this.durationOfShift[3] + " ," + this.durationOfShift[4]
+ ", " + this.durationOfShift[5] + ", "
+ this.durationOfShift[6] + "]");
}
public static void initSaticVars() {
setCount(1);
}
public static int getCount() {
return count;
}
public static void setCount(int count) {
Nurse.count = count;
}
public double[] getTimeTriage() {
return timeTriage;
}
public void setTimeTriage(double[] timeTriage) {
this.timeTriage = timeTriage;
}
}
| [
"paescude@gmail.com"
] | paescude@gmail.com |
f3543250f2af6fc4699f47ceae4c60db20eb09ba | f94510f053eeb8dd18ea5bfde07f4bf6425401c2 | /app/src/main/java/com/zhiyicx/thinksnsplus/modules/currency/withdraw/WithdrawCurrencyComponent.java | 15e142a091d7487b71aa54e16884a8f6798a610f | [] | no_license | firwind/3fou_com_android | e13609873ae030f151c62dfaf836a858872fa44c | 717767cdf96fc2f89238c20536fa4b581a22d9aa | refs/heads/master | 2020-03-28T09:02:56.431407 | 2018-09-07T02:14:54 | 2018-09-07T02:14:54 | 148,009,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package com.zhiyicx.thinksnsplus.modules.currency.withdraw;
import com.zhiyicx.common.dagger.scope.FragmentScoped;
import com.zhiyicx.thinksnsplus.base.AppComponent;
import com.zhiyicx.thinksnsplus.base.InjectComponent;
import dagger.Component;
/**
* author: huwenyong
* date: 2018/7/18 14:23
* description:
* version:
*/
@FragmentScoped
@Component(dependencies = AppComponent.class, modules = WithdrawCurrencyPresenterMoudle.class)
public interface WithdrawCurrencyComponent extends InjectComponent<WithdrawCurrencyActivity>{
}
| [
"836462331@qq.com"
] | 836462331@qq.com |
a99013e81c0f8696bd567625a98ed00a8c75f3e6 | 7de840e11447e9784f63c4281b03e93d8cf69457 | /oneVRE/GWT/OneVREGWT/src/main/java/com/googlecode/onevre/gwt/client/ag/types/VectorJSO.java | 29e5b72115df3f4802689ac30af36d90570723e6 | [
"BSD-2-Clause"
] | permissive | rowleya/onevre | 553cedc7e868ae399608676310fd5274b7465ece | 4e6a6de560a8f4feea60e2e0010471c749fe8a6f | refs/heads/master | 2016-09-05T23:34:29.889486 | 2011-02-21T16:04:26 | 2011-02-21T16:04:26 | 32,145,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.googlecode.onevre.gwt.client.ag.types;
import com.google.gwt.core.client.JavaScriptObject;
public class VectorJSO<T extends JavaScriptObject> extends JavaScriptObject {
protected VectorJSO() {
}
public final native T get(int i) /*-{
return this.get(i);
}-*/;
public final native int size() /*-{
return this.size();
}-*/;
}
| [
"ts23gm@ff34145c-7872-3b35-6561-e9169588922b"
] | ts23gm@ff34145c-7872-3b35-6561-e9169588922b |
bc02a43245f3bbc60e37fa517ef2af3263db614d | e6c155058c93631bcc852e12af330fd0331a3b9e | /Problem1.java | 20547a449485624ada214439e17c3e2bf179c35f | [] | no_license | Breezy95/assignment | c938e401517785eeec069de274ffd456dae4cb4b | c017c7a6d9cc4076282cf5affd94a053e90df77e | refs/heads/master | 2020-03-29T01:22:03.912939 | 2018-09-19T03:16:18 | 2018-09-19T03:16:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,172 | java | //Fabrice Benoit
//109108791
import java.io.*;
import java.util.Collections;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.*;
public class Problem1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList<Integer> arr = new ArrayList<Integer>();
try { // 1st part of question, creates file
File f = new File("integerFile.txt");
FileWriter fw = new FileWriter(f, false);
PrintWriter pw = new PrintWriter(fw);
for(int i = 0; i<100;i++) {
pw.print((int)(Math.random()*101) + " ");
pw.flush();
}
}
catch(IOException ex) { System.out.println("Cannot create the file");}
catch(Exception exc) { System.out.println("Error Occurred at file reading");}
try {
File f = new File("integerFile.txt");
Scanner input = new Scanner(f);
while(input.hasNext()) {
arr.add(input.nextInt());
}
} catch(IOException ex) {
System.out.println("scanner error");
}
catch(Exception excep){ System.out.println("Error in file reading");}
arr.sort(null);
//Collections.sort(arr);
System.out.println(arr.toString().substring(1, arr.toString().length()-1));
}
}
| [
"35083230+Breezy95@users.noreply.github.com"
] | 35083230+Breezy95@users.noreply.github.com |
2e41a46a36d474993055305a4ec422543795047d | a36dce4b6042356475ae2e0f05475bd6aed4391b | /2005/NRI-AppLogic/source/com/nri/exception/DuplicateKeyException.java | 037783f2f1a8bcc67065d0e4bbe8e879ee5431f4 | [] | no_license | ildar66/WSAD_NRI | b21dbee82de5d119b0a507654d269832f19378bb | 2a352f164c513967acf04d5e74f36167e836054f | refs/heads/master | 2020-12-02T23:59:09.795209 | 2017-07-01T09:25:27 | 2017-07-01T09:25:27 | 95,954,234 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.nri.exception;
public class DuplicateKeyException extends MappingException {
/**
* Constructor for DuplicateKeyException
*/
public DuplicateKeyException() {
super();
}
/**
* Constructor for DuplicateKeyException
*/
public DuplicateKeyException(String arg0) {
super(arg0);
}
public DuplicateKeyException(Exception arg0, String desc) {
super(arg0, desc);
}
}
| [
"ildar66@inbox.ru"
] | ildar66@inbox.ru |
d995b6b0c4d0315068e59ae0309a2d167c2531b1 | 8f9ffa5632e7da3ce0737d4f3bb012aa10949183 | /app/src/test/java/com/khokan/todo_list/ExampleUnitTest.java | 2709d075c962199b598759da903af6b056365cd3 | [] | no_license | Khokan-Barai/ToDo-List | 3f9fe93536721c8cf4df7721b7ce4ab9b407328c | 91900c2dd34d1c7ef2c619863b97383bc569ae4a | refs/heads/master | 2020-04-07T00:39:40.079674 | 2018-11-16T19:48:18 | 2018-11-16T19:48:18 | 157,913,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.khokan.todo_list;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"khokanbarai522@gmail.com"
] | khokanbarai522@gmail.com |
4065828c5cc223171619166497d6c37ce1186671 | 4e2bc2fcb042672c53ba63b485eb6b6191b056a1 | /Digraph.java | 4b3c67251b43d8b1baffb56dab143db342b5f10a | [] | no_license | mmxcraft/java_sample | fe125924a8ce48b7009e50f89bb710728e9ca84c | 930945918234177e7ceaa97751bef07d9e26f31d | refs/heads/master | 2021-01-21T10:29:42.383169 | 2017-06-28T07:13:34 | 2017-06-28T07:13:34 | 91,693,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | import edu.princeton.cs.algs4.In;
import edu.princeton.cs.algs4.Bag;
import edu.princeton.cs.algs4.StdOut;
/**
* Created by mofma on 2017/5/2.
*/
public class Digraph {
private final int V;
private int E;
private Bag<Integer>[] adj;
public Digraph(int V) {
this.V = V;
this.E = 0;
adj = (Bag<Integer> []) new Bag[V];
for (int v = 0; v < V; v++)
adj[v] = new Bag<Integer>();
}
public Digraph(In in) {
this(in.readInt());
int E = in.readInt();
for (int i = 0; i < E; i++) {
int v = in.readInt();
int w = in.readInt();
addEdge(v, w);
}
}
public int V() {
return V;
}
public int E() {
return E;
}
public void addEdge(int v, int w) {
adj[v].add(w);
E++;
}
public Iterable<Integer> adj(int v) {
return adj[v];
}
public Digraph reverse() {
Digraph R = new Digraph(V);
for (int v = 0; v < V; v++)
for ( int w: adj[v])
R.addEdge(w, v);
return R;
}
public String toString() {
String s = V + " vertices, " + E + " edges\n";
for (int v = 0 ; v < V; v++){
s += v + ": ";
for(int w: this.adj[v])
s += w + " ";
s += "\n";
}
return s;
}
public static void main(String[] args) {
String fileName = args[0];
In in = new In(fileName);
Digraph dG = new Digraph(in);
StdOut.print(dG);
}
}
| [
"morpheus1977@hotmail.com"
] | morpheus1977@hotmail.com |
d68fb4081deca0ce53385643a9ed2e78713cf0f9 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/dbeaver/2018/12/JDBCObjectCache.java | bbefbac9285d5806ba8359e81f408e8395e3b286 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 5,984 | java | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
*
* 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.model.impl.jdbc.cache;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCStatement;
import org.jkiss.dbeaver.model.impl.AbstractObjectCache;
import org.jkiss.dbeaver.model.messages.ModelMessages;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.struct.DBSObject;
import java.sql.SQLException;
import java.util.*;
/**
* Various objects cache.
* Simple cache which may read objects from database and keep them.
*/
public abstract class JDBCObjectCache<OWNER extends DBSObject, OBJECT extends DBSObject> extends AbstractObjectCache<OWNER, OBJECT>
{
public static final int DEFAULT_MAX_CACHE_SIZE = 1000000;
private static final Log log = Log.getLog(JDBCObjectCache.class);
// Maximum number of objects in cache
private int maximumCacheSize = DEFAULT_MAX_CACHE_SIZE;
protected JDBCObjectCache() {
}
public void setMaximumCacheSize(int maximumCacheSize) {
this.maximumCacheSize = maximumCacheSize;
}
abstract protected JDBCStatement prepareObjectsStatement(@NotNull JDBCSession session, @NotNull OWNER owner)
throws SQLException;
@Nullable
abstract protected OBJECT fetchObject(@NotNull JDBCSession session, @NotNull OWNER owner, @NotNull JDBCResultSet resultSet)
throws SQLException, DBException;
@NotNull
@Override
public Collection<OBJECT> getAllObjects(@NotNull DBRProgressMonitor monitor, @Nullable OWNER owner)
throws DBException
{
if (!isFullyCached()) {
loadObjects(monitor, owner);
}
return getCachedObjects();
}
@Override
public OBJECT getObject(@NotNull DBRProgressMonitor monitor, @NotNull OWNER owner, @NotNull String name)
throws DBException
{
if (!isFullyCached()) {
this.loadObjects(monitor, owner);
}
return getCachedObject(name);
}
protected synchronized void loadObjects(DBRProgressMonitor monitor, OWNER owner)
throws DBException
{
if (isFullyCached() || monitor.isCanceled()) {
return;
}
List<OBJECT> tmpObjectList = new ArrayList<>();
DBPDataSource dataSource = owner.getDataSource();
if (dataSource == null) {
throw new DBException(ModelMessages.error_not_connected_to_database);
}
try {
try (JDBCSession session = DBUtils.openMetaSession(monitor, owner, "Load objects from " + owner.getName())) {
try (JDBCStatement dbStat = prepareObjectsStatement(session, owner)) {
monitor.subTask("Load " + getCacheName());
dbStat.setFetchSize(DBConstants.METADATA_FETCH_SIZE);
dbStat.executeStatement();
JDBCResultSet dbResult = dbStat.getResultSet();
if (dbResult != null) {
try {
while (dbResult.next()) {
if (monitor.isCanceled()) {
break;
}
OBJECT object = fetchObject(session, owner, dbResult);
if (object == null) {
continue;
}
tmpObjectList.add(object);
// Do not log every object load. This overheats UI in case of long lists
//monitor.subTask(object.getName());
if (tmpObjectList.size() == maximumCacheSize) {
log.warn("Maximum cache size exceeded (" + maximumCacheSize + ") in " + this);
break;
}
}
} finally {
dbResult.close();
}
}
}
} catch (SQLException ex) {
throw new DBException(ex, dataSource);
}
} catch (DBException e) {
if (!handleCacheReadError(e)) {
throw e;
}
}
Comparator<OBJECT> comparator = getListOrderComparator();
if (comparator != null) {
tmpObjectList.sort(comparator);
}
detectCaseSensitivity(owner);
mergeCache(tmpObjectList);
this.invalidateObjects(monitor, owner, new CacheIterator());
}
protected String getCacheName() {
return getClass().getSimpleName();
}
// Can be implemented to provide custom cache error handler
protected boolean handleCacheReadError(DBException error) {
return false;
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
589362dd27929720369b26ec15b824a0406d560b | fb6399ebaa4788ad52c288728044da3bd46dca67 | /src/main/java/com/sprint/models/domain/MemberWithoutPwd.java | ec0290f806eec1be17f98b9c620afe5c1346650b | [] | no_license | enough617/VIPManager | ffb00a6bbc181a8be4a58f633f204d771c825b9e | d5da17da4d4f6cce27d57227337c67e48124b894 | refs/heads/master | 2021-12-15T10:57:09.799586 | 2017-08-17T11:42:30 | 2017-08-17T11:44:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,484 | java | package com.sprint.models.domain;
import java.util.Date;
public class MemberWithoutPwd {
private int id;
private Date createTime;
private Date updateTime;
private String cardNumber;
private String memberRank;
private String memberName;
private String memberPhone;
private int status;
private double money;
public void setId(int id) {
this.id = id;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public void setCardNumber(String cardNumber) {
this.cardNumber = cardNumber;
}
public void setMemeberRank(String memberRank) {
this.memberRank = memberRank;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public void setMemberPhone(String memberPhone) {
this.memberPhone = memberPhone;
}
public void setStatus(int status) {
this.status = status;
}
public void setMoney(double money) {
this.money = money;
}
public int getId() {
return id;
}
public Date getCreateTime() {
return createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public String getCardNumber() {
return cardNumber;
}
public String getMemberRank() {
return memberRank;
}
public String getMemberPhone() {
return memberPhone;
}
public String getMemberName() {
return memberName;
}
public int getStatus() {
return status;
}
public double getMoney() {
return money;
}
}
| [
"x_zhaohu@163.com"
] | x_zhaohu@163.com |
341a7b8f22c200b4c8f600f08dda89f0fe4ef893 | ec67d903843cc666fa42bd4f25c68756d4f2774d | /api-service/src/main/java/com/bitmark/apiservice/params/query/AbsQueryBuilder.java | cdd77475904837605f8b50288c6f508270c7a494 | [
"ISC"
] | permissive | nguyennh-0786/bitmark-sdk-java | 13b0f37a9bcf1f37e17ebccab3503a493aa89963 | 63163440134fe19a2eb3e6e23d7e49e288cf869c | refs/heads/master | 2020-08-01T11:48:04.374810 | 2019-07-02T08:24:47 | 2019-07-02T08:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,299 | java | package com.bitmark.apiservice.params.query;
import com.bitmark.apiservice.utils.HttpUtils;
import com.google.gson.annotations.SerializedName;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.TreeMap;
import static com.bitmark.apiservice.utils.HttpUtils.buildArrayQueryString;
/**
* @author Hieu Pham
* @since 9/16/18
* Email: hieupham@bitmark.com
* Copyright © 2018 Bitmark. All rights reserved.
*/
public abstract class AbsQueryBuilder implements QueryBuilder {
@Override
public QueryParams build() {
return new QueryParamsImpl(this);
}
@Override
public String toUrlQuery() {
try {
StringBuilder builder = new StringBuilder();
Map<String, Object> valueMap = getValues(this);
int iteration = 0;
for (Map.Entry<String, Object> entry : valueMap.entrySet()) {
iteration++;
String name = entry.getKey();
Object value = entry.getValue();
if (value.getClass().isArray()) {
builder.append(HttpUtils.buildArrayQueryString(name, value));
} else {
builder.append(name).append("=").append(value.toString());
}
if (iteration < valueMap.size()) builder.append("&");
}
return builder.toString();
} catch (IllegalAccessException e) {
return null;
}
}
private Map<String, Object> getValues(QueryBuilder builder) throws IllegalAccessException {
Map<String, Object> valueMap = new TreeMap<>();
Field[] fields = builder.getClass().getDeclaredFields();
if (fields.length > 0) {
for (Field field : fields) {
field.setAccessible(true);
Object value = field.get(builder);
if (value == null) continue;
SerializedName annotationName = field.getAnnotation(SerializedName.class);
String name;
if (annotationName != null) {
name = annotationName.value();
} else {
name = field.getName();
}
valueMap.put(name, value);
}
}
return valueMap;
}
}
| [
"hieupham@bitmark.com"
] | hieupham@bitmark.com |
2681c6978abd53389e356d16c11618fe847e44ff | 2797280c63fb027887ad5db57b4f1938a7fb03bb | /src/com/fantest/Off.java | 05a6b9f4de0ed637e7400e74b5824916191cf799 | [] | no_license | NavyaK-T/FanTest-Problem | fba774f2c33b28ca3f43482a3084ec8c55d61e38 | e7dbae08c840536721b3a92418ab66ee3798ff7b | refs/heads/master | 2023-04-17T13:49:42.911148 | 2021-04-23T21:05:19 | 2021-04-23T21:05:19 | 361,004,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package com.fantest;
public class Off implements SpeedLevel {
@Override
public void pull(CeilingFanPullChain pullChain) {
pullChain.setCurrentState(new SpeedLevelOne());
System.out.println("Speed level 1 with direction "+pullChain.getCurrentDirection());
}
}
| [
"abc@example.com"
] | abc@example.com |
e03f42d26a36687ddbc4cde161d361ae36817e49 | cd688316a5bd8b1feca59b0229875c7ff1c6440e | /app/src/main/java/com/rachcode/peykman/mFood/MakananItem.java | 03f15726dd0d679b8784758726f471b1ea093ec7 | [] | no_license | mohsen-yousefi/taxi2 | 8829aba70de0d88830af839901ea12060c07f8dc | 9189108773bdbc5d51123150d0a197580d47f6b3 | refs/heads/master | 2022-01-29T22:20:45.714089 | 2019-08-04T06:22:56 | 2019-08-04T06:22:56 | 198,158,737 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,560 | java | package com.rachcode.peykman.mFood;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.rachcode.peykman.config.General;
import com.mikepenz.fastadapter.items.AbstractItem;
import com.rachcode.peykman.GoTaxiApplication;
import com.rachcode.peykman.R;
import com.rachcode.peykman.model.PesananFood;
import com.rachcode.peykman.utils.Log;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.realm.Realm;
/**
* Created by Androgo on 1/3/2017.
*/
public class MakananItem extends AbstractItem<MakananItem, MakananItem.ViewHolder> {
public int id;
public String namaMenu;
public String deskripsiMenu;
public long harga;
public long cost;
public int quantity;
public String catatan;
public String foto;
Context context;
OnCalculatePrice calculatePrice;
private Realm realm;
private TextWatcher catatanUpdater;
public MakananItem(Context context, OnCalculatePrice calculatePrice) {
this.context = context;
this.calculatePrice = calculatePrice;
catatanUpdater = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
catatan = s.toString();
if (quantity > 0) UpdatePesanan(id, cost, quantity, catatan);
}
@Override
public void afterTextChanged(Editable s) {
}
};
}
@Override
public int getType() {
return R.id.makanan_item;
}
@Override
public void bindView(final MakananItem.ViewHolder holder, List payloads) {
super.bindView(holder, payloads);
realm = GoTaxiApplication.getInstance(context).getRealmInstance();
holder.makananText.setText(namaMenu);
holder.deskripsiText.setText(deskripsiMenu);
holder.hargaText.setText(getFormattedPrice(harga));
holder.quantityText.setText(String.valueOf(quantity));
holder.notesText.setEnabled(quantity > 0);
holder.notesText.setText(catatan);
Glide.with(holder.imageproduct.getContext()).load(foto).centerCrop().into(holder.imageproduct);
holder.notesText.addTextChangedListener(catatanUpdater);
holder.addQuantity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
quantity++;
holder.quantityText.setText("" + quantity);
holder.notesText.setEnabled(true);
CalculateCost();
if (quantity == 1) {
AddPesanan(id, cost, quantity, catatan);
} else if (quantity > 1) {
UpdatePesanan(id, cost, quantity, catatan);
}
if (calculatePrice != null) calculatePrice.calculatePrice();
}
});
holder.removeQuantity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (quantity - 1 >= 0) {
quantity--;
holder.quantityText.setText(String.valueOf(quantity));
CalculateCost();
UpdatePesanan(id, cost, quantity, catatan);
if (quantity == 0) {
DeletePesanan(id);
holder.notesText.setText("");
holder.notesText.setEnabled(false);
}
}
if (calculatePrice != null) calculatePrice.calculatePrice();
}
});
}
private void CalculateCost() {
cost = quantity * harga;
//Log.e("Cost", cost+"");
}
private void AddPesanan(int idMakanan, long totalHarga, int qty, String notes) {
PesananFood pesananfood = new PesananFood();
pesananfood.setIdMakanan(idMakanan);
pesananfood.setTotalHarga(totalHarga);
pesananfood.setQty(qty);
pesananfood.setCatatan(notes);
realm.beginTransaction();
realm.copyToRealm(pesananfood);
realm.commitTransaction();
Log.e("Added", idMakanan + "");
Log.e("Added", qty + "");
}
private void UpdatePesanan(int idMakanan, long totalHarga, int qty, String notes) {
realm.beginTransaction();
PesananFood updateFood = realm.where(PesananFood.class).equalTo("idMakanan", idMakanan).findFirst();
updateFood.setTotalHarga(totalHarga);
updateFood.setQty(qty);
updateFood.setCatatan(notes);
realm.copyToRealm(updateFood);
realm.commitTransaction();
Log.e("Updated", qty + "");
}
private void DeletePesanan(int idMakanan) {
realm.beginTransaction();
PesananFood deleteFood = realm.where(PesananFood.class).equalTo("idMakanan", idMakanan).findFirst();
deleteFood.deleteFromRealm();
realm.commitTransaction();
}
@Override
public int getLayoutRes() {
return R.layout.item_makanan;
}
private String getFormattedPrice(long price) {
String formattedTotal = NumberFormat.getNumberInstance(Locale.US).format(price);
return String.format(Locale.US, General.MONEY +" %s .00", formattedTotal);
}
public interface OnCalculatePrice {
void calculatePrice();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.makanan_text)
TextView makananText;
@BindView(R.id.deskripsi_text)
TextView deskripsiText;
@BindView(R.id.harga_text)
TextView hargaText;
@BindView(R.id.notes_text)
EditText notesText;
@BindView(R.id.add_quantity)
TextView addQuantity;
@BindView(R.id.quantity_text)
TextView quantityText;
@BindView(R.id.remove_quantity)
TextView removeQuantity;
@BindView(R.id.image_product)
ImageView imageproduct;
public ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
| [
"mohsen.nezhadyousefi@gmail.com"
] | mohsen.nezhadyousefi@gmail.com |
b7a93827e4c692d2ddc9841c5647c233936b310f | 962daca6d378f8a278657618990e7e43bd7a9d91 | /src/main/java/com/testRepository/testclass2.java | d8ceff5f05121043c8aba80b2cc6a2f11c50bbb2 | [] | no_license | PoojaSapre/testRepository | e838d2a83ceffdbb6e3a5bb97d43116a15e9f445 | 2942f87c1ce6909ccd377dcb9006549f5b4ec398 | refs/heads/master | 2021-05-19T00:33:26.867851 | 2020-03-31T05:13:54 | 2020-03-31T05:13:54 | 251,496,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package com.testRepository;
public class testclass2 {
}
| [
"poojasapre11@gmail.com"
] | poojasapre11@gmail.com |
f89155da2ad4e17f618edd44369dee883b9269cb | e418cd85b1280ad02495eff32096529518cefb11 | /app/src/main/java/com/icss/shopmax/Model/Rent_Car_Data.java | e57b775983f9e8bae9fb8b051146df805276ddf3 | [] | no_license | LokeshInfo/Shop_Max_Dual | 9dcd8cad02549de73403ac590d3b2242d5e630c9 | 9c7c745147bc88e40a99b661eb4ec8c1476f54eb | refs/heads/master | 2021-04-20T23:44:37.370545 | 2020-04-20T09:08:54 | 2020-04-20T09:08:54 | 249,726,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package com.icss.shopmax.Model;
public class Rent_Car_Data {
private String name;
private String car_model;
private String price;
private String type;
public Rent_Car_Data(String name, String car_model, String price, String type) {
this.name = name;
this.car_model = car_model;
this.price = price;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCar_model() {
return car_model;
}
public void setCar_model(String car_model) {
this.car_model = car_model;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| [
"lokesh.gadekar@infocentroidtech.com"
] | lokesh.gadekar@infocentroidtech.com |
a1055fb2e7fd00598ca1e55ec91208ddff26fab5 | f9dd598e066541b510c93120cc3aa198a814acf9 | /pulice_catering/src/main/java/com/huayu/CG_KC_SJ/acquisition_methods/sql/SelectSqla.java | 3e47a378d1712f64ac95a910298322e212f40974 | [] | no_license | lishuai524/-pulice_catering2 | a6f2b8c97809876d1d95888fffaa723a9943f28a | 742aec882eb3e18ee3b748da2026f2768a745687 | refs/heads/master | 2022-12-23T02:02:19.240396 | 2019-07-03T03:27:15 | 2019-07-03T03:27:15 | 194,971,373 | 0 | 0 | null | 2022-12-16T08:53:54 | 2019-07-03T03:15:31 | Rich Text Format | UTF-8 | Java | false | false | 909 | java | package com.huayu.CG_KC_SJ.acquisition_methods.sql;
import com.huayu.CG_KC_SJ.acquisition_methods.entity.Acquisition_methods;
public class SelectSqla {
public String select(Acquisition_methods acquisition_methods){
StringBuffer stringBuffer=new StringBuffer();
stringBuffer.append("select * from acquisition_methods where 1=1");
if(acquisition_methods!=null) {
if ( acquisition_methods.getAcquisition_Methods() != null && !"".equals(acquisition_methods.getAcquisition_Methods())) {
stringBuffer.append(" and Acquisition_Methods like '%" + acquisition_methods.getAcquisition_Methods() + "%'");
}else if (acquisition_methods.getSid() != null && !"".equals(acquisition_methods.getSid())) {
stringBuffer.append(" and sid =" + acquisition_methods.getSid());
}
}
return stringBuffer.toString();
}
}
| [
"1019023472@qq.com"
] | 1019023472@qq.com |
bc458b5db7a9fb59176808cbe62b3dbf146b0df3 | 343773ae835dbbaefde9f653f9211570bd8455d6 | /src/api/java/thaumcraft/api/aspects/AspectRegistryEvent.java | f671ccf092a3eab2d26ba935a567db782cc0f1ed | [
"MIT"
] | permissive | DaedalusGame/EmbersRekindled | a06895d5bc3d0cf6739965828eab96edcdd35a78 | a2437713ea29ee9ca76b3e14f6e67f8e8862ccaa | refs/heads/rekindled | 2022-05-01T12:03:20.268625 | 2021-03-03T19:13:27 | 2021-03-03T19:13:27 | 135,477,242 | 41 | 37 | MIT | 2022-03-26T17:47:02 | 2018-05-30T17:38:40 | Java | UTF-8 | Java | false | false | 737 | java | package thaumcraft.api.aspects;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* This event is called when Thaumcraft is ready to accept the registration of aspects associated with items or entities.
* Subscribe to this event like you would any other forge event. The <b>register</b> object contains the methods you use to register aspects.
* <p><i>IMPORTANT: Do NOT instantiate this class or AspectEventProxy and use the methods directly - there is no guarantee that they will work like you expect.</i>
*/
public class AspectRegistryEvent extends Event {
/** this should always be set by TC itself - do not assign your own proxy */
public AspectEventProxy register;
public AspectRegistryEvent() {
}
}
| [
"bordlistian@hotmail.de"
] | bordlistian@hotmail.de |
14795730e96b05776f956c27c8e9f3f669229f68 | f03fa2e830454cbc54a2834b68f8d4490d429834 | /insight-log-storage/src/main/java/io/fabric8/insight/log/storage/InsightEventHandler.java | d9e9e66e08e58a49f3a09980aa0257c16c4fd0cb | [] | no_license | charanrsc/insight | 596521aa1d2c678704ad23d1198f06a00938269a | 57ebd6d71358a341edb747530df486e6e6156288 | refs/heads/master | 2021-05-28T17:10:44.665881 | 2015-01-09T14:00:44 | 2015-01-09T14:00:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,152 | java | /**
* Copyright 2005-2014 Red Hat, Inc.
*
* Red Hat 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 io.fabric8.insight.log.storage;
import io.fabric8.insight.storage.StorageService;
import org.apache.felix.scr.annotations.*;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import static io.fabric8.insight.log.storage.InsightUtils.formatDate;
import static io.fabric8.insight.log.storage.InsightUtils.quote;
@Component(immediate = true, name = "io.fabric8.insight.log.storage.events")
@Service(EventHandler.class)
@Properties({
@Property(name = "event.topics", value = "*")
})
public class InsightEventHandler implements EventHandler {
public static final String LOG_TYPE = "es.evt.type";
private static final Logger LOGGER = LoggerFactory.getLogger(InsightLogAppender.class);
private String name;
private String type = "events";
@Reference
private StorageService storageService;
@Activate
public void activate(Map<String, ?> configuration) {
name = System.getProperty("runtime.id");
if (configuration.containsKey(LOG_TYPE)) {
type = (String) configuration.get(LOG_TYPE);
}
}
@Modified
public void modified(Map<String, ?> configuration) {
if (configuration.containsKey(LOG_TYPE)) {
type = (String) configuration.get(LOG_TYPE);
} else {
type = "log";
}
}
public void handleEvent(final Event event) {
try {
StringBuilder writer = new StringBuilder();
writer.append("{ \"host\": ");
quote(name, writer);
writer.append(", \"topic\": ");
quote(event.getTopic(), writer);
writer.append(", \"properties\": { ");
boolean first = true;
long timestamp = 0;
for (String name : event.getPropertyNames()) {
if (first) {
first = false;
} else {
writer.append(", ");
}
quote(name, writer);
writer.append(": ");
Object value = event.getProperty(name);
if (value == null) {
writer.append("null");
} else if (EventConstants.TIMESTAMP.equals(name) && value instanceof Long) {
timestamp = (Long) value;
quote(formatDate(timestamp), writer);
} else if (value.getClass().isArray()) {
writer.append(" [ ");
boolean vfirst = true;
for (Object v : ((Object[]) value)) {
if (!vfirst) {
writer.append(", ");
} else {
vfirst = false;
}
quote(v.toString(), writer);
}
writer.append(" ] ");
} else {
quote(value.toString(), writer);
}
}
writer.append(" } }");
if (timestamp == 0) {
timestamp = System.currentTimeMillis();
}
if (type != null && storageService != null) {
storageService.store(type, timestamp, writer.toString());
}
} catch (Exception e) {
LOGGER.warn("Error appending log to elastic search", e);
}
}
}
| [
"jimmidyson@gmail.com"
] | jimmidyson@gmail.com |
2acdc48baea3318d9ca57c2517790962a50c234e | 19aec9324bfdc393961cd83b1e1ddba9ca5540d1 | /src/java/entity/Timing.java | f2f9de2ad19cccc01aefdc8fb9950022726b43ad | [] | no_license | sumansta/Project404 | 2b40f6979ac70c15fd14379346165916771c8114 | 9e9d3e7fe49c8efb3ece729f62591136a2064c07 | refs/heads/master | 2021-07-03T11:25:36.957384 | 2017-09-24T10:44:55 | 2017-09-24T10:44:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | 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 entity;
/**
*
* @author Ark
*/
public class Timing {
private int id;
private String first, second, third, fourth;
public Timing() {
}
public Timing(int id, String first, String second, String third, String fourth) {
this.id = id;
this.first = first;
this.second = second;
this.third = third;
this.fourth = fourth;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getSecond() {
return second;
}
public void setSecond(String second) {
this.second = second;
}
public String getThird() {
return third;
}
public void setThird(String third) {
this.third = third;
}
public String getFourth() {
return fourth;
}
public void setFourth(String fourth) {
this.fourth = fourth;
}
}
| [
"archanzels@gmail.com"
] | archanzels@gmail.com |
76da2efab00bff60a613ae7241357e1678eb5617 | f37aea479e86301b7e8160a5f2eb25012ddf2969 | /src/net/pixelcade/virtualautominer/Task.java | a5a1ac50e7f5b9db44b3b4342c53ff2e4af7b4e6 | [] | no_license | Unknowncall/VirtualAutoMiner | 58aaf8dc0cce20ebcf059e8d2d2c16284fbe5543 | b4f6b8aebdada5f5249204d138ca956e32e0df3a | refs/heads/master | 2021-05-13T14:41:33.818775 | 2018-01-14T23:41:38 | 2018-01-14T23:41:38 | 116,746,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,190 | java | package net.pixelcade.virtualautominer;
import java.text.DecimalFormat;
import org.bukkit.entity.Player;
import com.vk2gpz.tokenenchant.api.TokenEnchantAPI;
import net.md_5.bungee.api.ChatColor;
public class Task implements Runnable {
private VirtualAutoMiner plugin;
public Task(VirtualAutoMiner virtualAutoMiner) {
this.plugin = virtualAutoMiner;
}
@Override
public void run() {
for (Player player : this.plugin.getServer().getOnlinePlayers()) {
if (this.plugin.getSave().getString("players." + player.getUniqueId().toString()) != null) {
if (this.plugin.getSave().getInt("players." + player.getUniqueId().toString() + ".amount") > 0) {
double payout = this.plugin.getSave()
.getInt("players." + player.getUniqueId().toString() + ".amount")
* this.plugin.getProductivityPerMiner();
VirtualAutoMiner.getEconomy().depositPlayer(player, (payout * 5.00));
DecimalFormat df2 = new DecimalFormat("0.00");
df2.setGroupingUsed(true);
df2.setGroupingSize(3);
double tokenPayout = this.plugin.getSave()
.getInt("players." + player.getUniqueId().toString() + ".amount")
* VirtualAutoMiner.tokenProductivityPerMiner;
TokenEnchantAPI.getInstance().addTokens(player, tokenPayout * 5);
if (!(this.plugin.getSave().getBoolean("players." + player.getUniqueId().toString() + ".silentMessage"))) {
player.sendMessage(ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "-------" + ChatColor.RESET + " " + ChatColor.GREEN + "AutoMiner Payout " + ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "-------");
player.sendMessage("");
player.sendMessage(ChatColor.GREEN + "$: " + ChatColor.YELLOW + df2.format(payout * 5));
player.sendMessage(ChatColor.GREEN + "✪: " + ChatColor.YELLOW + tokenPayout * 5);
player.sendMessage("");
player.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "TIP:");
player.sendMessage(ChatColor.GRAY + "/am silent to disable this.");
player.sendMessage("");
player.sendMessage(ChatColor.GRAY + "" + ChatColor.STRIKETHROUGH + "------------------------------");
}
}
}
}
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
19f5478f637a73fcd2cb7216313bfeaf59588807 | 40dd5ac56b327cbd58cdc06859b13647634bf3de | /assignment_1/src/main/assignment/Assignment_1_1_24.java | f4c016f3b35d3dadc79a82c4b14255e767f882ed | [] | no_license | skomefen/algorithm | f7cc731b0bd641d1461160d2498f553c95fb78ad | 83dbf4e4a665bf4116e758efd0d7c4a06f8800d7 | refs/heads/master | 2020-12-30T12:44:22.775299 | 2017-07-06T14:25:19 | 2017-07-06T14:25:19 | 91,350,591 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 531 | java | package main.assignment;
public class Assignment_1_1_24 {
public static int gcd(int first,int second){
if(first<0||second<0){
throw new RuntimeException("请输入大于0的数");
}
if(first<second){
int key = 0;
key = first;
first = second;
second = key;
}
if(second==0){
return first;
}
if(first%second==0){
return second;
}
return gcd(second,first%second);
}
public static void main(String[] args){
int first = 0;
int second = 11111;
System.out.println(gcd(first, second));
}
}
| [
"1072760797@qq.com"
] | 1072760797@qq.com |
302285bff0f7385b0c32b1183f3719c66d31e709 | ac9755d08b16d9a7ae3f7f97858889855068ad53 | /lang/lucene-chinese/src/test/java/org/carrot2/language/chinese/AbstractLanguageComponentsTest.java | f4aa5d045eaf064a6c8044f1d982cf32657859a9 | [
"LicenseRef-scancode-bsd-ack-carrot2",
"BSD-3-Clause",
"Apache-2.0"
] | permissive | rahulanishetty/carrot2 | febaddececa6c18f435645ae74438e89561ab0ae | cb4adcc3b4ea030f4b64e2d0b881f43b51a90ae6 | refs/heads/master | 2022-02-19T03:18:34.730395 | 2022-01-10T08:32:00 | 2022-01-10T08:32:04 | 91,449,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,254 | java | /*
* Carrot2 project.
*
* Copyright (C) 2002-2021, Dawid Weiss, Stanisław Osiński.
* All rights reserved.
*
* Refer to the full license file "carrot2.LICENSE"
* in the root folder of the repository checkout or at:
* https://www.carrot2.org/carrot2.LICENSE
*/
package org.carrot2.language.chinese;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import org.assertj.core.api.Assertions;
import org.carrot2.language.LanguageComponents;
import org.carrot2.language.Stemmer;
import org.carrot2.language.StopwordFilter;
import org.carrot2.language.Tokenizer;
import org.carrot2.util.MutableCharArray;
import org.junit.Test;
public abstract class AbstractLanguageComponentsTest {
protected final LanguageComponents components;
private final String[][] stemmingPairs;
private final String[] stopWords;
AbstractLanguageComponentsTest(String language, String[] stopWords, String[][] stemmingPairs)
throws IOException {
this.components = LanguageComponents.loader().load().language(language);
this.stemmingPairs = stemmingPairs;
this.stopWords = stopWords;
}
/** */
@Test
public void testStemmerAvailable() {
assertNotNull(components.get(Stemmer.class));
}
/** */
@Test
public void testStemming() {
final Stemmer stemmer = components.get(Stemmer.class);
for (String[] pair : stemmingPairs) {
CharSequence stem = stemmer.stem(pair[0]);
Assertions.assertThat(stem == null ? null : stem.toString()).isEqualTo(pair[1]);
}
}
/** */
@Test
public void testCommonWords() {
StopwordFilter wordFilter = components.get(StopwordFilter.class);
for (String word : stopWords) {
Assertions.assertThat(wordFilter.test(new MutableCharArray(word))).as(word).isFalse();
}
}
protected List<String> tokenize(Tokenizer tokenizer, String input) throws IOException {
tokenizer.reset(new StringReader(input));
MutableCharArray buffer = new MutableCharArray();
ArrayList<String> tokens = new ArrayList<>();
while (tokenizer.nextToken() >= 0) {
tokenizer.setTermBuffer(buffer);
tokens.add(buffer.toString());
}
return tokens;
}
}
| [
"dawid.weiss@carrotsearch.com"
] | dawid.weiss@carrotsearch.com |
984d77024a60a11a8edb0cf3c86f7644f7fcc2e3 | 5bc4b5337becaa4d55c620e9e078985e1743060b | /app/src/main/java/io/github/teccheck/bluechat/ChatMessagesListAdapter.java | 574c92f35c093aa42852813c1ad6b9d2d59de1d4 | [] | no_license | TecCheck/BlueChat | ab96b48404a7ce33b3126234f2df98ca91b05190 | b35e6366d1ff5ff50c0251747a631f815f671be2 | refs/heads/master | 2023-02-12T05:58:30.234847 | 2021-01-14T15:55:41 | 2021-01-14T15:55:41 | 328,942,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,464 | java | package io.github.teccheck.bluechat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class ChatMessagesListAdapter extends RecyclerView.Adapter<ChatMessagesListAdapter.ViewHolder> {
ArrayList<Message> messages = new ArrayList<>();
public ChatMessagesListAdapter() {
}
public void addMessage(Message message){
messages.add(message);
notifyItemChanged(messages.size() - 1);
}
@NonNull
@Override
public ChatMessagesListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ChatMessagesListAdapter.ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_chat_message, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ChatMessagesListAdapter.ViewHolder holder, int position) {
Message message = messages.get(position);
View root = holder.itemView;
TextView text = root.findViewById(R.id.message_text);
text.setText(message.text);
}
@Override
public int getItemCount() {
return messages.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View view) {
super(view);
}
}
}
| [
"mcteccy@gmail.com"
] | mcteccy@gmail.com |
1d33ecdec3e92dd831bc0037e7fbe525f743959c | c813354639ebe71154d81b34892b1607a063b78c | /src/ConsoleExercises.java | c7325defc3f5b0a3a0ca32b123b3e459500e9e0d | [] | no_license | VictorFHernandez/codeup-java-exercises | 75cc9be52f8200c1a6b23ce23a76ba147307da7e | 716735a258dfee25dd745f55e7799516a8e2258b | refs/heads/main | 2023-04-22T21:00:20.913982 | 2021-05-11T02:42:38 | 2021-05-11T02:42:38 | 360,674,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | import java.util.Scanner;
public class ConsoleExercises {
public static void main(String[] args){
//part 1:
double pi = 3.14159;
System.out.format("The value of pi is approximately %.2f.\n", pi);
// part 2:
Scanner sc = new Scanner(System.in);
// System.out.println("Please enter your number.");
// int number = sc.nextInt();
// System.out.println("number " + number);
// System.out.println("Please enter 3 words.");
// String word1 = sc.next();
// String word2 = sc.next();
// String word3 = sc.next();
// System.out.printf("%s\n%s\n%s\n", word1, word2, word3);
// System.out.println("what do you want?");
// String something = sc.nextLine();
// System.out.println("you have entered:");
// System.out.println(something);
// part 3
System.out.println("enter length of classroom");
int length = Integer.parseInt(sc.nextLine());
System.out.println("enter the width of the classroom");
int width = Integer.parseInt(sc.nextLine());
int area = length * width;
int perimeter = (length * 2) + (width * 2);
System.out.printf("the area is: %d\n", area);
System.out.printf("the perimeter is: %d\n", perimeter);
}
}
| [
"victorfhernandez3@gmail.com"
] | victorfhernandez3@gmail.com |
0c7d0c649469be079f6f408b45f755c64924580b | 91495537eef3896888c47395ff4f8238a57842e3 | /src/main/java/com/blogspot/ofarukkurt/primeadminbsb/controllers/EmployeeController.java | c9d999a5c2eadf148654fab2461ef7dbe8728987 | [] | no_license | Doomsayeramg/ocoyoacac | fb585682d58a019c20aa5fa29f3cba85e6348168 | c211ae0e755a83156a193e26cfa3edbcc4013b92 | refs/heads/master | 2021-07-13T20:06:44.032230 | 2017-10-19T04:26:43 | 2017-10-19T04:26:43 | 107,495,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,675 | java | package com.blogspot.ofarukkurt.primeadminbsb.controllers;
import com.blogspot.ofarukkurt.primeadminbsb.models.Employee;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.inject.Inject;
@Named(value = "employeeController")
@ViewScoped
public class EmployeeController extends AbstractController<Employee> {
@Inject
private SalespersonController salespersonController;
@Inject
private PersonController personController;
public EmployeeController() {
// Inform the Abstract parent controller of the concrete Employee Entity
super(Employee.class);
}
/**
* Resets the "selected" attribute of any parent Entity controllers.
*/
public void resetParents() {
salespersonController.setSelected(null);
personController.setSelected(null);
}
/**
* Sets the "items" attribute with a collection of Purchaseorderheader
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Purchaseorderheader page
*/
public String navigatePurchaseorderheaderList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Purchaseorderheader_items", this.getSelected().getPurchaseorderheaderList());
}
return "/purchaseorderheader/index";
}
/**
* Sets the "selected" attribute of the Salesperson controller in order to
* display its data in its View dialog.
*
* @param event Event object for the widget that triggered an action
*/
public void prepareSalesperson(ActionEvent event) {
if (this.getSelected() != null && salespersonController.getSelected() == null) {
salespersonController.setSelected(this.getSelected().getSalesperson());
}
}
/**
* Sets the "items" attribute with a collection of Employeedepartmenthistory
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Employeedepartmenthistory page
*/
public String navigateEmployeedepartmenthistoryList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Employeedepartmenthistory_items", this.getSelected().getEmployeedepartmenthistoryList());
}
return "/employeedepartmenthistory/index";
}
/**
* Sets the "items" attribute with a collection of Jobcandidate entities
* that are retrieved from Employee?cap_first and returns the navigation
* outcome.
*
* @return navigation outcome for Jobcandidate page
*/
public String navigateJobcandidateList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Jobcandidate_items", this.getSelected().getJobcandidateList());
}
return "/jobcandidate/index";
}
/**
* Sets the "items" attribute with a collection of Document entities that
* are retrieved from Employee?cap_first and returns the navigation outcome.
*
* @return navigation outcome for Document page
*/
public String navigateDocumentList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Document_items", this.getSelected().getDocumentList());
}
return "/document/index";
}
/**
* Sets the "selected" attribute of the Person controller in order to
* display its data in its View dialog.
*
* @param event Event object for the widget that triggered an action
*/
public void preparePerson(ActionEvent event) {
if (this.getSelected() != null && personController.getSelected() == null) {
personController.setSelected(this.getSelected().getPerson());
}
}
/**
* Sets the "items" attribute with a collection of Employeepayhistory
* entities that are retrieved from Employee?cap_first and returns the
* navigation outcome.
*
* @return navigation outcome for Employeepayhistory page
*/
public String navigateEmployeepayhistoryList() {
if (this.getSelected() != null) {
FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("Employeepayhistory_items", this.getSelected().getEmployeepayhistoryList());
}
return "/employeepayhistory/index";
}
}
| [
"doomsayer@a06e73f0-31e7-469f-847e-579a3b180b19"
] | doomsayer@a06e73f0-31e7-469f-847e-579a3b180b19 |
2430692c01390a7f153ad50197330ff7b57bce96 | 3afc16a1b4ff54ec5492edfc1ca3ca5b8d524a05 | /src/main/java/ru/zvezdov/ocprof/chapter_1/AdvancedClassDesign/StaticAndFinal/StaticBlocks.java | 462c6e14b3e690597998a93735efc01add74b7a5 | [] | no_license | Zvezdov7/MyOCP | 2646a56bd73426d15f11f697fdef472717904ca6 | f59c30d867e371f1b58ffc3eb90ad9dd34e19b47 | refs/heads/master | 2021-01-19T07:37:32.126591 | 2017-06-29T14:10:14 | 2017-06-29T14:10:14 | 87,561,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package ru.zvezdov.ocprof.chapter_1.AdvancedClassDesign.StaticAndFinal;
/**
* @author Dmitry Zvezdov
* 09.05.17.
*/
public class StaticBlocks {
public static void main(String[] args) {
Blocks b;
System.out.println("1");
b = new Blocks();
System.out.println("2");
String string = new String();
Blocks c = new Blocks();
}
public static long getLong(int i){
return i;
}
}
class Blocks{
static {
System.out.println("I'm statis");
}
{
System.out.println("I'm non-static");
}
}
| [
"dszvezdo@mts.ru"
] | dszvezdo@mts.ru |
6bf846174950dfcc3d8b27a650917e534929b35e | 129da0925c791f91d471ffdd17392fcfc21face4 | /src/main/java/com/example/emos/wx/db/dao/TbFaceModelDao.java | 5eb82d358a4a1243dd6faa8615c0afed0e409704 | [] | no_license | GZK0329/OA_SYSTEM | 9751e0fce6d7e37da2db956a7a58096ae1d1b8e3 | dcd20584fc5649aed8b11556a8364a2c24618416 | refs/heads/master | 2023-08-18T07:17:24.507728 | 2021-09-16T16:25:16 | 2021-09-16T16:25:16 | 404,238,985 | 0 | 0 | null | 2021-09-16T16:25:17 | 2021-09-08T06:40:23 | Java | UTF-8 | Java | false | false | 301 | java | package com.example.emos.wx.db.dao;
import com.example.emos.wx.db.pojo.TbFaceModel;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TbFaceModelDao {
String searchFaceModel(int userId);
void insertFaceModel(TbFaceModel model);
void deleteFaceModel(int userId);
} | [
"gzk0329@gmail.com"
] | gzk0329@gmail.com |
2e26ea17f2de473accff88b0b4214232a2ab805c | 37ed62436a8174e28797e5a35de0ccd0a613fdde | /Graphics/Filter/src/ru/nsu/fit/g15203/kostyleva/XorBorder.java | 12db03ff1c51dd3e77946c2d55a49a0ca815dcb7 | [] | no_license | VictoriaKostyleva/nsu_labs | a2844064f64b3a45dca5f6a78003828d19112b39 | faa1dc76b8729c2891f691683815e72b910d4ae9 | refs/heads/master | 2021-09-11T01:23:45.609581 | 2018-04-05T15:44:32 | 2018-04-05T15:44:32 | 105,536,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,965 | java | package ru.nsu.fit.g15203.kostyleva;
import javax.swing.border.AbstractBorder;
import java.awt.*;
import java.awt.image.BufferedImage;
public class XorBorder extends AbstractBorder {
private final int DASH_LENGTH = 5;
private int x0;
private int y0;
private BufferedImage bufferedImage;
public XorBorder(int x0, int y0, BufferedImage bufferedImage) {
this.x0 = x0;
this.y0 = y0;
this.bufferedImage = bufferedImage;
}
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
super.paintBorder(c, g, x, y, width, height);
width -= 2;
height -= 2;
Graphics2D g2d = (Graphics2D) g;
int count = 0;
boolean isDash = false;
// System.out.println(x);
// System.out.println(y);
for (int i = 0; i < width; i++) {
if (!isDash) {
Color color = new Color(bufferedImage.getRGB(i + x0, y0));//top
g2d.setColor(new Color(255 - color.getRed(),255 - color.getGreen(),255 - color.getBlue()));
g2d.drawLine(i, y, i, y);
color = new Color(bufferedImage.getRGB(i + x0, width - 1 + y0));//bottom
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(i, width - 1, i, width - 1);
isDash = count % DASH_LENGTH == 0;
} else {
Color color = new Color(bufferedImage.getRGB(i + x0, y0));
g2d.setColor(color);
g2d.drawLine(i, y, i, y);
color = new Color(bufferedImage.getRGB(i + x0, width - 1 + y0));
g2d.setColor(color);
g2d.drawLine(i, width - 1, i, width - 1);
isDash = count % DASH_LENGTH != 0;
}
count++;
}
for (int i = 0; i < height; i++) {
if (!isDash) {
Color color = new Color(bufferedImage.getRGB(x0, i + y0));
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(x, i, x, i);
color = new Color(bufferedImage.getRGB(height - 1 + x0, i + y0));
g2d.setColor(new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()));
g2d.drawLine(height - 1, i, height - 1, i);
isDash = count % DASH_LENGTH == 0;
}
else {
Color color = new Color(bufferedImage.getRGB(x0, i + y0));
g2d.setColor(color);
g2d.drawLine(x, i, x, i);
color = new Color(bufferedImage.getRGB(height - 1 + x0, i + y0));
g2d.setColor(color);
g2d.drawLine(height - 1, i, height - 1, i);
isDash = count % DASH_LENGTH != 0;
}
count++;
}
}
}
| [
"kostyleva.viktoriya@gmail.com"
] | kostyleva.viktoriya@gmail.com |
5240542f7ece60394fdcd529a31489bfbd559a9c | 4a55692a757cc5dcc6de7166638b0e5073e76c84 | /app/src/main/java/com/korsolution/antif/VehicleDBClass.java | 47c4958ab7e250a284e5380e434901f2a546d4ae | [] | no_license | Cutiesz/Antif | 56843385dddcf6640316a2603ddd786683b4c8e0 | f7ab2e0631a40c4cfe4eb645c77a83ac370c54a3 | refs/heads/master | 2021-08-31T12:17:02.617081 | 2017-12-21T08:18:27 | 2017-12-21T08:18:27 | 105,964,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,646 | java | package com.korsolution.antif;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteStatement;
import android.util.Log;
/**
* Created by Kontin58 on 24/9/2559.
*/
public class VehicleDBClass extends SQLiteOpenHelper {
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "vehicledb";
// Table Name
private static final String TABLE_VEHICLE = "vehicle";
public VehicleDBClass(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("CREATE TABLE " + TABLE_VEHICLE +
"(ID INTEGER PRIMARY KEY AUTOINCREMENT," +
" IMEI TEXT(100)," +
" VEHICLE_DISPLAY TEXT(100)," +
" VEHICLE_NAME TEXT(100)," +
" HISTORY_DATETIME TEXT(100)," +
" LATITUDE TEXT(100)," +
" LONGITUDE TEXT(100)," +
" PLACE TEXT(100)," +
" ANGLE TEXT(100)," +
" SPEED TEXT(100)," +
" STATUS TEXT(100)," +
" IS_CUT_ENGINE TEXT(100)," +
" IS_IQNITION TEXT(100)," +
" IS_AUTHEN TEXT(100)," +
" SIM TEXT(100)," +
" TEL_EMERGING_1 TEXT(100)," +
" TEL_EMERGING_2 TEXT(100)," +
" TEL_EMERGING_3 TEXT(100)," +
" IS_UNPLUG_GPS TEXT(100)," +
" GSM_SIGNAL TEXT(100)," +
" NUM_SAT TEXT(100)," +
" CAR_IMAGE_FRONT TEXT(100)," +
" CAR_IMAGE_BACK TEXT(100)," +
" CAR_IMAGE_LEFT TEXT(100)," +
" CAR_IMAGE_RIGHT TEXT(100)," +
" STATUS_UPDATE TEXT(100)," +
" VEHICLE_TYPE_NAME TEXT(100)," +
" VEHICLE_BRAND_NAME TEXT(100)," +
" MODEL TEXT(100)," +
" YEAR TEXT(100)," +
" VEHICLE_COLOR TEXT(100));");
Log.d("CREATE TABLE","Create Table Successfully.");
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
// Insert Data
public long Insert(String strIMEI, String strVEHICLE_DISPLAY, String strVEHICLE_NAME,
String strHISTORY_DATETIME, String strLATITUDE, String strLONGITUDE,
String strPLACE, String strANGLE, String strSPEED, String strSTATUS,
String strIS_CUT_ENGINE, String strIS_IQNITION, String strIS_AUTHEN, String strSIM,
String strTEL_EMERGING_1, String strTEL_EMERGING_2, String strTEL_EMERGING_3,
String strIS_UNPLUG_GPS, String strGSM_SIGNAL, String strNUM_SAT,
String strCAR_IMAGE_FRONT, String strCAR_IMAGE_BACK, String strCAR_IMAGE_LEFT,
String strCAR_IMAGE_RIGHT, String strSTATUS_UPDATE,
String strVEHICLE_TYPE_NAME, String strVEHICLE_BRAND_NAME, String strMODEL, String strYEAR, String strVEHICLE_COLOR) {
// TODO Auto-generated method stub
try {
SQLiteDatabase db;
db = this.getWritableDatabase(); // Write Data
SQLiteStatement insertCmd;
String strSQL = "INSERT INTO " + TABLE_VEHICLE
+ "(IMEI, VEHICLE_DISPLAY, VEHICLE_NAME, HISTORY_DATETIME, LATITUDE, LONGITUDE, PLACE, ANGLE, SPEED, STATUS, IS_CUT_ENGINE, IS_IQNITION, IS_AUTHEN, SIM, TEL_EMERGING_1, TEL_EMERGING_2, TEL_EMERGING_3, IS_UNPLUG_GPS, GSM_SIGNAL, NUM_SAT, CAR_IMAGE_FRONT, CAR_IMAGE_BACK, CAR_IMAGE_LEFT, CAR_IMAGE_RIGHT, STATUS_UPDATE, VEHICLE_TYPE_NAME, VEHICLE_BRAND_NAME, MODEL, YEAR, VEHICLE_COLOR) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
insertCmd = db.compileStatement(strSQL);
insertCmd.bindString(1, strIMEI);
insertCmd.bindString(2, strVEHICLE_DISPLAY);
insertCmd.bindString(3, strVEHICLE_NAME);
insertCmd.bindString(4, strHISTORY_DATETIME);
insertCmd.bindString(5, strLATITUDE);
insertCmd.bindString(6, strLONGITUDE);
insertCmd.bindString(7, strPLACE);
insertCmd.bindString(8, strANGLE);
insertCmd.bindString(9, strSPEED);
insertCmd.bindString(10, strSTATUS);
insertCmd.bindString(11, strIS_CUT_ENGINE);
insertCmd.bindString(12, strIS_IQNITION);
insertCmd.bindString(13, strIS_AUTHEN);
insertCmd.bindString(14, strSIM);
insertCmd.bindString(15, strTEL_EMERGING_1);
insertCmd.bindString(16, strTEL_EMERGING_2);
insertCmd.bindString(17, strTEL_EMERGING_3);
insertCmd.bindString(18, strIS_UNPLUG_GPS);
insertCmd.bindString(19, strGSM_SIGNAL);
insertCmd.bindString(20, strNUM_SAT);
insertCmd.bindString(21, strCAR_IMAGE_FRONT);
insertCmd.bindString(22, strCAR_IMAGE_BACK);
insertCmd.bindString(23, strCAR_IMAGE_LEFT);
insertCmd.bindString(24, strCAR_IMAGE_RIGHT);
insertCmd.bindString(25, strSTATUS_UPDATE);
insertCmd.bindString(26, strVEHICLE_TYPE_NAME);
insertCmd.bindString(27, strVEHICLE_BRAND_NAME);
insertCmd.bindString(28, strMODEL);
insertCmd.bindString(29, strYEAR);
insertCmd.bindString(30, strVEHICLE_COLOR);
return insertCmd.executeInsert();
} catch (Exception e) {
return -1;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAll() {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE/* + " Where BlockId = '" + strBlockId + "'"*/;
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAllByVehicleName(String _VEHICLE_NAME) {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE + " Where VEHICLE_NAME = '" + _VEHICLE_NAME + "'";
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Select All Data Array 2 dimention
public String[][] SelectAllByVehicleDisplay(String _VEHICLE_DISPLAY) {
// TODO Auto-generated method stub
try {
String arrData[][] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE + " Where VEHICLE_DISPLAY = '" + _VEHICLE_DISPLAY + "'";
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null)
{
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()][cursor.getColumnCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i][0] = cursor.getString(0);
arrData[i][1] = cursor.getString(1);
arrData[i][2] = cursor.getString(2);
arrData[i][3] = cursor.getString(3);
arrData[i][4] = cursor.getString(4);
arrData[i][5] = cursor.getString(5);
arrData[i][6] = cursor.getString(6);
arrData[i][7] = cursor.getString(7);
arrData[i][8] = cursor.getString(8);
arrData[i][9] = cursor.getString(9);
arrData[i][10] = cursor.getString(10);
arrData[i][11] = cursor.getString(11);
arrData[i][12] = cursor.getString(12);
arrData[i][13] = cursor.getString(13);
arrData[i][14] = cursor.getString(14);
arrData[i][15] = cursor.getString(15);
arrData[i][16] = cursor.getString(16);
arrData[i][17] = cursor.getString(17);
arrData[i][18] = cursor.getString(18);
arrData[i][19] = cursor.getString(19);
arrData[i][20] = cursor.getString(20);
arrData[i][21] = cursor.getString(21);
arrData[i][22] = cursor.getString(22);
arrData[i][23] = cursor.getString(23);
arrData[i][24] = cursor.getString(24);
arrData[i][25] = cursor.getString(25);
arrData[i][26] = cursor.getString(26);
arrData[i][27] = cursor.getString(27);
arrData[i][28] = cursor.getString(28);
arrData[i][29] = cursor.getString(29);
arrData[i][30] = cursor.getString(30);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
public String[] SelectVehicleName() {
// TODO Auto-generated method stub
try {
String arrData[] = null;
SQLiteDatabase db;
db = this.getReadableDatabase(); // Read Data
String strSQL = "SELECT * FROM " + TABLE_VEHICLE/* + " Where BlockId = '" + strBlockId + "'"*/;
Cursor cursor = db.rawQuery(strSQL, null);
if(cursor != null) {
if (cursor.moveToFirst()) {
arrData = new String[cursor.getCount()];
/***
* [x][0] = MemberID
* [x][1] = Name
* [x][2] = Tel
*/
int i= 0;
do {
arrData[i] = cursor.getString(3);
i++;
} while (cursor.moveToNext());
}
}
cursor.close();
return arrData;
} catch (Exception e) {
return null;
}
}
// Delete Data
public long Delete(/*String strMemberID*/) {
// TODO Auto-generated method stub
try {
SQLiteDatabase db;
db = this.getWritableDatabase(); // Write Data
// for API 11 and above
SQLiteStatement insertCmd;
String strSQL = "DELETE FROM " + TABLE_VEHICLE/* + " WHERE MemberID = ? "*/;
insertCmd = db.compileStatement(strSQL);
/*insertCmd.bindString(1, strMemberID);*/
return insertCmd.executeUpdateDelete();
} catch (Exception e) {
return -1;
}
}
}
| [
"sumeth.cute@gmail.com"
] | sumeth.cute@gmail.com |
c3e9d069e162d34d77d5f1834a529fd7efb93e34 | b5e265bcada4ec5934f86a27184c6707594bab18 | /Tropika_rev2/src/view/MainMenu.java | b12a8a23881c86bfc25b8acf9ec4e3a4d35c9a35 | [] | no_license | akmalulginan/jajaka | 0d99b64f9a378e069516c70d983b5147e52f1d05 | db121c02869d9963c71279ab03a6a4ac28ad2950 | refs/heads/master | 2021-01-10T14:58:37.039187 | 2016-02-18T19:41:10 | 2016-02-18T19:41:10 | 49,662,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,107 | 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 view;
import control.MenuControl;
import javax.swing.JButton;
import javax.swing.UIManager;
/**
*
* @author sipit
*/
public class MainMenu extends javax.swing.JFrame {
/**
* Creates new form Menu
*/
private MenuControl menuControl = new MenuControl();
public MainMenu() {
this.setExtendedState(this.getExtendedState() | MainMenu.MAXIMIZED_BOTH);
initComponents();
}
public JButton getCariButton() {
return cariButton;
}
public JButton getGudangButton() {
return gudangButton;
}
public JButton getHakAksesButton() {
return hakAksesButton;
}
public JButton getHargaButton() {
return hargaButton;
}
public JButton getHistoryButton() {
return historyButton;
}
public JButton getItemButton() {
return itemButton;
}
public JButton getKaryawanButton() {
return karyawanButton;
}
public JButton getKelompokButton() {
return kelompokButton;
}
public JButton getLaporanGudangButton() {
return laporanGudangButton;
}
public JButton getLaporanPembelianButton() {
return laporanPembelianButton;
}
public JButton getLaporanPenjualanButton() {
return laporanPenjualanButton;
}
public JButton getPasswordButton() {
return passwordButton;
}
public JButton getPembelianButton() {
return pembelianButton;
}
public JButton getPenjualanButton() {
return penjualanButton;
}
public JButton getSupplierButton() {
return supplierButton;
}
public JButton getTransaksiButton() {
return transaksiButton;
}
public JButton getTransaksiGudangButton() {
return transaksiGudangButton;
}
public JButton getUserButton() {
return userButton;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
masterDataTab = new javax.swing.JPanel();
gudangButton = new javax.swing.JButton();
itemButton = new javax.swing.JButton();
hargaButton = new javax.swing.JButton();
kelompokButton = new javax.swing.JButton();
supplierButton = new javax.swing.JButton();
karyawanTab = new javax.swing.JPanel();
karyawanButton = new javax.swing.JButton();
cariButton = new javax.swing.JButton();
securityTab = new javax.swing.JPanel();
userButton = new javax.swing.JButton();
passwordButton = new javax.swing.JButton();
hakAksesButton = new javax.swing.JButton();
historyButton = new javax.swing.JButton();
transaksiTab = new javax.swing.JPanel();
pembelianButton = new javax.swing.JButton();
penjualanButton = new javax.swing.JButton();
transaksiGudangButton = new javax.swing.JButton();
transaksiButton = new javax.swing.JButton();
laporanTab = new javax.swing.JPanel();
laporanGudangButton = new javax.swing.JButton();
laporanPembelianButton = new javax.swing.JButton();
laporanPenjualanButton = new javax.swing.JButton();
jPanel24 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
pane = new javax.swing.JTabbedPane();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Aplikasi PT Tropika");
setBackground(new java.awt.Color(51, 51, 51));
jTabbedPane1.setBackground(new java.awt.Color(255, 255, 255));
jTabbedPane1.setForeground(new java.awt.Color(40, 40, 40));
jTabbedPane1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jTabbedPane1.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jTabbedPane1.setOpaque(true);
masterDataTab.setBackground(new java.awt.Color(255, 255, 255));
gudangButton.setBackground(new java.awt.Color(204, 215, 222));
gudangButton.setForeground(new java.awt.Color(40, 40, 40));
gudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Gudang.png"))); // NOI18N
gudangButton.setText("<html><hr>Gudang");
gudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
gudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
gudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
gudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
gudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gudangButtonActionPerformed(evt);
}
});
itemButton.setBackground(new java.awt.Color(204, 215, 222));
itemButton.setForeground(new java.awt.Color(40, 40, 40));
itemButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Item.png"))); // NOI18N
itemButton.setText("<html><hr>Item");
itemButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
itemButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
itemButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
itemButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
itemButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
itemButtonActionPerformed(evt);
}
});
hargaButton.setBackground(new java.awt.Color(204, 215, 222));
hargaButton.setForeground(new java.awt.Color(40, 40, 40));
hargaButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Harga.png"))); // NOI18N
hargaButton.setText("<html><hr>Harga");
hargaButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
hargaButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
hargaButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
hargaButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
hargaButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hargaButtonActionPerformed(evt);
}
});
kelompokButton.setBackground(new java.awt.Color(204, 215, 222));
kelompokButton.setForeground(new java.awt.Color(40, 40, 40));
kelompokButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Kelompok.png"))); // NOI18N
kelompokButton.setText("<html><hr>Kategori");
kelompokButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
kelompokButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
kelompokButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
kelompokButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
kelompokButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kelompokButtonActionPerformed(evt);
}
});
supplierButton.setBackground(new java.awt.Color(204, 215, 222));
supplierButton.setForeground(new java.awt.Color(40, 40, 40));
supplierButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Supplier.png"))); // NOI18N
supplierButton.setText("<html><hr>Supplier");
supplierButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
supplierButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
supplierButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
supplierButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
supplierButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
supplierButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout masterDataTabLayout = new javax.swing.GroupLayout(masterDataTab);
masterDataTab.setLayout(masterDataTabLayout);
masterDataTabLayout.setHorizontalGroup(
masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(masterDataTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(gudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(itemButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hargaButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(kelompokButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(supplierButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(584, Short.MAX_VALUE))
);
masterDataTabLayout.setVerticalGroup(
masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(masterDataTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(masterDataTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(gudangButton)
.addComponent(supplierButton)
.addComponent(kelompokButton)
.addComponent(hargaButton)
.addComponent(itemButton))
.addContainerGap(12, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Master Data", masterDataTab);
karyawanTab.setBackground(new java.awt.Color(255, 255, 255));
karyawanButton.setBackground(new java.awt.Color(204, 215, 222));
karyawanButton.setForeground(new java.awt.Color(40, 40, 40));
karyawanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/UserKaryawan.png"))); // NOI18N
karyawanButton.setText("<html><hr>Karyawan");
karyawanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
karyawanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
karyawanButton.setMaximumSize(new java.awt.Dimension(2147483647, 79));
karyawanButton.setMinimumSize(new java.awt.Dimension(77, 79));
karyawanButton.setPreferredSize(new java.awt.Dimension(77, 79));
karyawanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
karyawanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
karyawanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
karyawanButtonActionPerformed(evt);
}
});
cariButton.setBackground(new java.awt.Color(204, 215, 222));
cariButton.setForeground(new java.awt.Color(40, 40, 40));
cariButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Preview.png"))); // NOI18N
cariButton.setText("<html><hr>Cari");
cariButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
cariButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
cariButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
cariButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
cariButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cariButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout karyawanTabLayout = new javax.swing.GroupLayout(karyawanTab);
karyawanTab.setLayout(karyawanTabLayout);
karyawanTabLayout.setHorizontalGroup(
karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(karyawanTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(karyawanButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cariButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(845, Short.MAX_VALUE))
);
karyawanTabLayout.setVerticalGroup(
karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(karyawanTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(karyawanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(karyawanButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cariButton))
.addContainerGap(12, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Karyawan", karyawanTab);
securityTab.setBackground(new java.awt.Color(255, 255, 255));
userButton.setBackground(new java.awt.Color(204, 215, 222));
userButton.setForeground(new java.awt.Color(40, 40, 40));
userButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/UserSkurity.png"))); // NOI18N
userButton.setText("<html><hr>User");
userButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
userButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
userButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
userButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
userButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
userButtonActionPerformed(evt);
}
});
passwordButton.setBackground(new java.awt.Color(204, 215, 222));
passwordButton.setForeground(new java.awt.Color(40, 40, 40));
passwordButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Password.png"))); // NOI18N
passwordButton.setText("<html><hr>Password");
passwordButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
passwordButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
passwordButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
passwordButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
passwordButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
passwordButtonActionPerformed(evt);
}
});
hakAksesButton.setBackground(new java.awt.Color(204, 215, 222));
hakAksesButton.setForeground(new java.awt.Color(40, 40, 40));
hakAksesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/HakAkses.png"))); // NOI18N
hakAksesButton.setText("<html><hr>Hak Akses");
hakAksesButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
hakAksesButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
hakAksesButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
hakAksesButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
hakAksesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
hakAksesButtonActionPerformed(evt);
}
});
historyButton.setBackground(new java.awt.Color(204, 215, 222));
historyButton.setForeground(new java.awt.Color(40, 40, 40));
historyButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/History.png"))); // NOI18N
historyButton.setText("<html><hr>History");
historyButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
historyButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
historyButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
historyButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
javax.swing.GroupLayout securityTabLayout = new javax.swing.GroupLayout(securityTab);
securityTab.setLayout(securityTabLayout);
securityTabLayout.setHorizontalGroup(
securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(securityTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(userButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(passwordButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(hakAksesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(665, Short.MAX_VALUE))
);
securityTabLayout.setVerticalGroup(
securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(securityTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(securityTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(historyButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hakAksesButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(passwordButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(userButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Security", securityTab);
transaksiTab.setBackground(new java.awt.Color(255, 255, 255));
pembelianButton.setBackground(new java.awt.Color(204, 215, 222));
pembelianButton.setForeground(new java.awt.Color(40, 40, 40));
pembelianButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiPembelian.png"))); // NOI18N
pembelianButton.setText("<html><hr>Pembelian");
pembelianButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
pembelianButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
pembelianButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
pembelianButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
pembelianButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pembelianButtonActionPerformed(evt);
}
});
penjualanButton.setBackground(new java.awt.Color(204, 215, 222));
penjualanButton.setForeground(new java.awt.Color(40, 40, 40));
penjualanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiPenjualan.png"))); // NOI18N
penjualanButton.setText("<html><hr>Penjualan");
penjualanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
penjualanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
penjualanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
penjualanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
penjualanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
penjualanButtonActionPerformed(evt);
}
});
transaksiGudangButton.setBackground(new java.awt.Color(204, 215, 222));
transaksiGudangButton.setForeground(new java.awt.Color(40, 40, 40));
transaksiGudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TransaksiGudang.png"))); // NOI18N
transaksiGudangButton.setText("<html><hr>Gudang");
transaksiGudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
transaksiGudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
transaksiGudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
transaksiGudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
transaksiGudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
transaksiGudangButtonActionPerformed(evt);
}
});
transaksiButton.setBackground(new java.awt.Color(204, 215, 222));
transaksiButton.setForeground(new java.awt.Color(40, 40, 40));
transaksiButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Transfer.png"))); // NOI18N
transaksiButton.setText("<html><hr>Transaksi");
transaksiButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
transaksiButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
transaksiButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
transaksiButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
javax.swing.GroupLayout transaksiTabLayout = new javax.swing.GroupLayout(transaksiTab);
transaksiTab.setLayout(transaksiTabLayout);
transaksiTabLayout.setHorizontalGroup(
transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(transaksiTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(pembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(penjualanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(transaksiGudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(transaksiButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(667, Short.MAX_VALUE))
);
transaksiTabLayout.setVerticalGroup(
transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(transaksiTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(transaksiTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(transaksiButton)
.addComponent(penjualanButton)
.addComponent(pembelianButton)
.addComponent(transaksiGudangButton))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Transaksi", transaksiTab);
laporanTab.setBackground(new java.awt.Color(255, 255, 255));
laporanGudangButton.setBackground(new java.awt.Color(204, 215, 222));
laporanGudangButton.setForeground(new java.awt.Color(40, 40, 40));
laporanGudangButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanGudang.png"))); // NOI18N
laporanGudangButton.setText("<html><hr>Gudang");
laporanGudangButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanGudangButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanGudangButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanGudangButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanGudangButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanGudangButtonActionPerformed(evt);
}
});
laporanPembelianButton.setBackground(new java.awt.Color(204, 215, 222));
laporanPembelianButton.setForeground(new java.awt.Color(40, 40, 40));
laporanPembelianButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanPembelian.png"))); // NOI18N
laporanPembelianButton.setText("<html><hr>Pembelian");
laporanPembelianButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanPembelianButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanPembelianButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanPembelianButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanPembelianButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanPembelianButtonActionPerformed(evt);
}
});
laporanPenjualanButton.setBackground(new java.awt.Color(204, 215, 222));
laporanPenjualanButton.setForeground(new java.awt.Color(40, 40, 40));
laporanPenjualanButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/LaporanPenjualan.png"))); // NOI18N
laporanPenjualanButton.setText("<html><hr>Penjualan");
laporanPenjualanButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
laporanPenjualanButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
laporanPenjualanButton.setVerticalAlignment(javax.swing.SwingConstants.TOP);
laporanPenjualanButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
laporanPenjualanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
laporanPenjualanButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout laporanTabLayout = new javax.swing.GroupLayout(laporanTab);
laporanTab.setLayout(laporanTabLayout);
laporanTabLayout.setHorizontalGroup(
laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addContainerGap()
.addComponent(laporanGudangButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(laporanPembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(laporanPenjualanButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(754, Short.MAX_VALUE))
);
laporanTabLayout.setVerticalGroup(
laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addContainerGap()
.addGroup(laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(laporanTabLayout.createSequentialGroup()
.addGroup(laporanTabLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(laporanPenjualanButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(laporanPembelianButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(laporanTabLayout.createSequentialGroup()
.addComponent(laporanGudangButton)
.addGap(13, 13, 13))))
);
jTabbedPane1.addTab("Laporan", laporanTab);
jPanel24.setBackground(new java.awt.Color(75, 191, 96));
jLabel1.setBackground(new java.awt.Color(255, 255, 255));
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Aplikasi PT Tropica SIC");
jLabel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel2.setForeground(new java.awt.Color(255, 255, 255));
jLabel2.setText("Jl. Sunan Demak No. 01 Rawamangun Jakarta Timur DKI");
jPanel7.setBackground(new java.awt.Color(65, 166, 83));
jLabel3.setBackground(new java.awt.Color(255, 255, 255));
jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/app.png"))); // NOI18N
javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
.addContainerGap(36, Short.MAX_VALUE)
.addComponent(jLabel3)
.addGap(31, 31, 31))
);
jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel3)
.addContainerGap(19, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
jPanel24.setLayout(jPanel24Layout);
jPanel24Layout.setHorizontalGroup(
jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel24Layout.createSequentialGroup()
.addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel24Layout.setVerticalGroup(
jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel24Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addContainerGap())
);
pane.setBackground(new java.awt.Color(204, 215, 222));
pane.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
paneMouseClicked(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jTabbedPane1)
.addComponent(pane, javax.swing.GroupLayout.Alignment.TRAILING)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pane, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE))
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void itemButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemButtonActionPerformed
// TODO add your handling code here:
ItemPanel barang = new ItemPanel();
menuControl.newTab(barang, pane);
}//GEN-LAST:event_itemButtonActionPerformed
private void gudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gudangButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new GudangPanel(), pane);
}//GEN-LAST:event_gudangButtonActionPerformed
private void hargaButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hargaButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new DataHargaPanel(), pane);
}//GEN-LAST:event_hargaButtonActionPerformed
private void kelompokButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kelompokButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new KategoriPanel(), pane);
}//GEN-LAST:event_kelompokButtonActionPerformed
private void supplierButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supplierButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new SupplierPanel(), pane);
}//GEN-LAST:event_supplierButtonActionPerformed
private void karyawanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_karyawanButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new KaryawanPanel(), pane);
}//GEN-LAST:event_karyawanButtonActionPerformed
private void cariButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cariButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new DataKaryawanPanel(), pane);
}//GEN-LAST:event_cariButtonActionPerformed
private void userButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_userButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new PenggunaPanel(), pane);
}//GEN-LAST:event_userButtonActionPerformed
private void passwordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passwordButtonActionPerformed
menuControl.newTab(new PasswordPanel(), pane);
}//GEN-LAST:event_passwordButtonActionPerformed
private void hakAksesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hakAksesButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new HakAksesPanel(), pane);
}//GEN-LAST:event_hakAksesButtonActionPerformed
private void pembelianButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pembelianButtonActionPerformed
// TODO add your handling code here:
menuControl.newTab(new PembelianBarangPanel(), pane);
}//GEN-LAST:event_pembelianButtonActionPerformed
private void paneMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_paneMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_paneMouseClicked
private void penjualanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_penjualanButtonActionPerformed
menuControl.newTab(new PenjualanBarangPanel(), pane);
}//GEN-LAST:event_penjualanButtonActionPerformed
private void laporanGudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanGudangButtonActionPerformed
menuControl.newTab(new LaporanGudangPanel(), pane);
}//GEN-LAST:event_laporanGudangButtonActionPerformed
private void laporanPembelianButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanPembelianButtonActionPerformed
menuControl.newTab(new LaporanPembelianPanel(), pane);
}//GEN-LAST:event_laporanPembelianButtonActionPerformed
private void laporanPenjualanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_laporanPenjualanButtonActionPerformed
menuControl.newTab(new LaporanPenjualanPanel(), pane);
}//GEN-LAST:event_laporanPenjualanButtonActionPerformed
private void transaksiGudangButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transaksiGudangButtonActionPerformed
menuControl.newTab(new TransaksiGudangPanel(), pane);
}//GEN-LAST:event_transaksiGudangButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
// try {
// UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
// } catch (Exception e) {
// System.out.println("UIManager Exception : " + e);
// }
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainMenu().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cariButton;
private javax.swing.JButton gudangButton;
private javax.swing.JButton hakAksesButton;
private javax.swing.JButton hargaButton;
private javax.swing.JButton historyButton;
private javax.swing.JButton itemButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel24;
private javax.swing.JPanel jPanel7;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JButton karyawanButton;
private javax.swing.JPanel karyawanTab;
private javax.swing.JButton kelompokButton;
private javax.swing.JButton laporanGudangButton;
private javax.swing.JButton laporanPembelianButton;
private javax.swing.JButton laporanPenjualanButton;
private javax.swing.JPanel laporanTab;
private javax.swing.JPanel masterDataTab;
private javax.swing.JTabbedPane pane;
private javax.swing.JButton passwordButton;
private javax.swing.JButton pembelianButton;
private javax.swing.JButton penjualanButton;
private javax.swing.JPanel securityTab;
private javax.swing.JButton supplierButton;
private javax.swing.JButton transaksiButton;
private javax.swing.JButton transaksiGudangButton;
private javax.swing.JPanel transaksiTab;
private javax.swing.JButton userButton;
// End of variables declaration//GEN-END:variables
}
| [
"akmalulginan@gmail.com"
] | akmalulginan@gmail.com |
91402e063464d873d52dcc31edc5b4cd59de1859 | b24ebe2ab101a9c7a76de51fc72d30318a173ecf | /src/com/bmob/im/demo/ui/LoginActivity.java | b04fea7d3f40120512b5a38ab7c14ec4593fe053 | [
"Apache-2.0"
] | permissive | Domonlee/Bmob_IM | 4c726457fb01c0fdc5a900d38ecfcfc87c612c9d | 344de91fb94fb0154c8055b223e375895bc6dcdf | refs/heads/master | 2016-09-08T02:07:29.345875 | 2014-10-24T01:02:52 | 2014-10-24T01:02:52 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,630 | java | package com.bmob.im.demo.ui;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import cn.bmob.im.bean.BmobChatUser;
import cn.bmob.im.util.BmobLog;
import cn.bmob.v3.listener.SaveListener;
import com.bmob.im.demo.R;
import com.bmob.im.demo.config.BmobConstants;
import com.bmob.im.demo.util.CommonUtils;
/**
* @ClassName: LoginActivity
* @Description: TODO
* @author smile
* @date 2014-6-3 下午4:41:42
*/
public class LoginActivity extends BaseActivity implements OnClickListener {
EditText et_username, et_password;
Button btn_login;
TextView btn_register, btn_forgot;
BmobChatUser currentUser;
private MyBroadcastReceiver receiver = new MyBroadcastReceiver();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
init();
// 注册退出广播
IntentFilter filter = new IntentFilter();
filter.addAction(BmobConstants.ACTION_REGISTER_SUCCESS_FINISH);
registerReceiver(receiver, filter);
}
private void init() {
et_username = (EditText) findViewById(R.id.et_username);
et_password = (EditText) findViewById(R.id.et_password);
btn_login = (Button) findViewById(R.id.btn_login);
btn_register = (TextView) findViewById(R.id.btn_register);
btn_forgot = (TextView) findViewById(R.id.btn_forgotpsw);
btn_login.setOnClickListener(this);
btn_register.setOnClickListener(this);
}
public class MyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null
&& BmobConstants.ACTION_REGISTER_SUCCESS_FINISH
.equals(intent.getAction())) {
finish();
}
}
}
@Override
public void onClick(View v) {
if (v == btn_register) {
Intent intent = new Intent(LoginActivity.this,
RegisterActivity.class);
startActivity(intent);
} else {
boolean isNetConnected = CommonUtils.isNetworkAvailable(this);
if (!isNetConnected) {
ShowToast(R.string.network_tips);
return;
}
login();
}
}
private void login() {
String name = et_username.getText().toString();
String password = et_password.getText().toString();
if (TextUtils.isEmpty(name)) {
ShowToast(R.string.toast_error_username_null);
return;
}
if (TextUtils.isEmpty(password)) {
ShowToast(R.string.toast_error_password_null);
return;
}
final ProgressDialog progress = new ProgressDialog(LoginActivity.this);
progress.setMessage("正在登陆...");
progress.setCanceledOnTouchOutside(false);
progress.show();
userManager.login(name, password, new SaveListener() {
@Override
public void onSuccess() {
runOnUiThread(new Runnable() {
@Override
public void run() {
progress.setMessage("正在获取好友列表...");
}
});
// 更新用户的地理位置以及好友的资料
updateUserInfos();
progress.dismiss();
Intent intent = new Intent(LoginActivity.this,
MainInActivity.class);
startActivity(intent);
finish();
}
@Override
public void onFailure(int errorcode, String arg0) {
progress.dismiss();
BmobLog.i(arg0);
ShowToast(arg0);
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(receiver);
}
}
| [
"viplizhao@gmail.com"
] | viplizhao@gmail.com |
afae2f4b17d0757022ad04cda52ffcf8d6be8e3f | fb8f2df4765cbb6c48b2ed3b6201176e4a7af208 | /cloudfoundry-client-lib/src/main/java/org/cloudfoundry/client/lib/util/CloudEntityResourceMapper.java | 079780cf6e65e24502c55955fab74b4c5ee42f6c | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | philwebb/vcap-java-client | 39cfce5c2b5d9b933b5d1acbb29f8476d82be340 | bd6fc39637f20c43db3181f891d0c99bbbebfff4 | refs/heads/master | 2021-01-16T02:36:47.087221 | 2012-08-06T19:04:39 | 2012-08-06T19:04:39 | 2,829,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,796 | java | /*
* Copyright 2009-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.cloudfoundry.client.lib.util;
import org.cloudfoundry.client.lib.domain.CloudEntity;
import org.cloudfoundry.client.lib.domain.CloudOrganization;
import org.cloudfoundry.client.lib.domain.CloudService;
import org.cloudfoundry.client.lib.domain.CloudServiceOffering;
import org.cloudfoundry.client.lib.domain.CloudServicePlan;
import org.cloudfoundry.client.lib.domain.CloudSpace;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* Class handling the mapping of the cloud domain objects
*
* @author: Thomas Risberg
*/
//TODO: use some more advanced JSON mapping framework?
public class CloudEntityResourceMapper {
SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
@SuppressWarnings("unchecked")
public String getNameOfJsonResource(Map<String, Object> resource) {
return getEntityAttribute(resource, "name", String.class);
}
@SuppressWarnings("unchecked")
public <T> T mapJsonResource(Map<String, Object> resource, Class<T> targetClass) {
if (targetClass == CloudSpace.class) {
return (T) mapSpaceResource(resource);
}
if (targetClass == CloudService.class) {
return (T) mapServiceInstanceResource(resource);
}
if (targetClass == CloudServiceOffering.class) {
return (T) mapServiceResource(resource);
}
throw new IllegalArgumentException(
"Error during mapping - unsupported class for entity mapping " + targetClass.getName());
}
private CloudSpace mapSpaceResource(Map<String, Object> resource) {
Map<String, Object> organizationMap = getEmbeddedResource(resource, "organization");
CloudOrganization organization = null;
if (organizationMap != null) {
organization = mapOrganizationResource(organizationMap);
}
CloudSpace space =
new CloudSpace(getMeta(resource), getEntityAttribute(resource, "name", String.class), organization);
return space;
}
private CloudOrganization mapOrganizationResource(Map<String, Object> resource) {
CloudOrganization org = new CloudOrganization(getMeta(resource), getEntityAttribute(resource, "name", String.class));
return org;
}
private CloudService mapServiceInstanceResource(Map<String, Object> resource) {
CloudService cloudService = new CloudService(
getMeta(resource),
getEntityAttribute(resource, "name", String.class));
Map<String, Object> servicePlanResource = getEmbeddedResource(resource, "service_plan");
Map<String, Object> serviceResource = null;
if (servicePlanResource != null) {
serviceResource = getEmbeddedResource(servicePlanResource, "service");
}
if (servicePlanResource != null && serviceResource != null) {
//TODO: assuming vendor corresponds to the service.provider and not service_instance.vendor_data
cloudService.setLabel(getEntityAttribute(serviceResource, "label", String.class));
cloudService.setProvider(getEntityAttribute(serviceResource, "provider", String.class));
cloudService.setVersion(getEntityAttribute(serviceResource, "version", String.class));
}
if (servicePlanResource != null) {
cloudService.setPlan(getEntityAttribute(servicePlanResource, "name", String.class));
}
return cloudService;
}
private CloudServiceOffering mapServiceResource(Map<String, Object> resource) {
CloudServiceOffering cloudServiceOffering = new CloudServiceOffering(
getMeta(resource),
getEntityAttribute(resource, "label", String.class),
getEntityAttribute(resource, "provider", String.class),
getEntityAttribute(resource, "version", String.class));
cloudServiceOffering.setDescription(getEntityAttribute(resource, "description", String.class));
List<Map<String, Object>> servicePlanList = getEmbeddedResourceList(getEntity(resource), "service_plans");
if (servicePlanList != null) {
for (Map<String, Object> servicePlanResource : servicePlanList) {
CloudServicePlan servicePlan =
new CloudServicePlan(
getMeta(servicePlanResource),
getEntityAttribute(servicePlanResource, "name", String.class),
cloudServiceOffering);
cloudServiceOffering.addCloudServicePlan(servicePlan);
}
}
return cloudServiceOffering;
}
@SuppressWarnings("unchecked")
private CloudEntity.Meta getMeta(Map<String, Object> entity) {
Map<String, Object> metadata = (Map<String, Object>) entity.get("metadata");
UUID guid = UUID.fromString(String.valueOf(metadata.get("guid")));
Date createdDate = null;
String created = String.valueOf(metadata.get("created_at"));
if (created != null) {
try {
createdDate = dateFormatter.parse(created);
} catch (ParseException ignore) {}
}
Date updatedDate = null;
String updated = String.valueOf(metadata.get("updated_at"));
if (updated != null) {
try {
updatedDate = dateFormatter.parse(updated);
} catch (ParseException ignore) {}
}
int version = 2; // this is always 2 for v2
CloudEntity.Meta meta = new CloudEntity.Meta(guid, createdDate, updatedDate, version);
return meta;
}
@SuppressWarnings("unchecked")
private Map<String, Object> getEntity(Map<String, Object> resource) {
return (Map<String, Object>) resource.get("entity");
}
@SuppressWarnings("unchecked")
private <T> T getEntityAttribute(Map<String, Object> resource, String attributeName, Class<T> targetClass) {
Map<String, Object> entity = (Map<String, Object>) resource.get("entity");
if (targetClass == String.class) {
return (T) String.valueOf(entity.get(attributeName));
}
throw new IllegalArgumentException(
"Error during mapping - unsupported class for attribute mapping " + targetClass.getName());
}
@SuppressWarnings("unchecked")
private Map<String, Object> getEmbeddedResource(Map<String, Object> resource, String embeddedResourceName) {
Map<String, Object> entity = (Map<String, Object>) resource.get("entity");
return (Map<String, Object>) entity.get(embeddedResourceName);
}
@SuppressWarnings("unchecked")
private List<Map<String, Object>> getEmbeddedResourceList(Map<String, Object> resource, String embeddedResourceName) {
return (List<Map<String, Object>>) resource.get(embeddedResourceName);
}
}
| [
"trisberg@vmware.com"
] | trisberg@vmware.com |
c2e0fd1af53649c3a6b22f0b1830f4076a955e67 | d6efaccae1ce0e92347d55434101790f258fd9f7 | /src/textcomparer/Main.java | 82d697014a9d2dd5945efdceee7daf2a1ba54ba7 | [] | no_license | jankeymeulen/TextComparer | bdf86151e6ed5581803bcb2fe373e0d4f4960e62 | 49384242ee72bab39c6bc451428f851d5ab8c79e | refs/heads/master | 2021-01-10T08:53:41.101957 | 2015-06-03T11:07:05 | 2015-06-03T11:07:05 | 36,798,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,929 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package textcomparer;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
/**
*
* @author jan
*/
public class Main
{
public static void main(String[] args) throws IOException
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex)
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
Model model = new Model();
MainWindow frame = model.createMainWindow();
if (args.length != 0)
{
if (args.length == 7)
{
model.setSrcFile(new File(args[0]));
model.setDstFile(new File(args[1]));
model.setMaxDist(new Integer(args[2]));
model.setMinLength(new Integer(args[3]));
model.setMaxWindow(new Integer(args[4]));
model.setMaxSkip(new Integer(args[5]));
model.setMinWords(new Integer(args[6]));
}
else
{
System.err.println("Usage: java -jar TextComparer.jar srcFile DstFile"
+ "maxDist minLength maxWindow maxSkip minWords");
}
}
frame.start();
}
}
| [
"jkeymeulen@jkeymeulen-macpro.roam.corp.google.com"
] | jkeymeulen@jkeymeulen-macpro.roam.corp.google.com |
8dd825864c74ec1dba215680d9b55de153ed578b | dd429d4aaf2782f8f3e016c5c3e9730fa8c0de4d | /core/src/com/svmc/mixxgame/attribute/Entity.java | c742e2d01af9d6393f61e22d64ab704dd865f972 | [] | no_license | Coder5540/mixxgame | 3c7d32bc72993e762cb77e7b24903d1a1d342595 | 2ecf0ad687aad5cb5b1460fb35b694855a87de68 | refs/heads/master | 2021-01-09T22:48:39.065046 | 2014-12-18T09:26:09 | 2014-12-18T09:26:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 67 | java | package com.svmc.mixxgame.attribute;
public interface Entity {
}
| [
"Coder5540@gmail.com"
] | Coder5540@gmail.com |
efbd3dc9b2b944011b003e6d1d5aab4894ef178c | 0e1d9d284c0a9fdc60f06a144f6bc7cc94a18780 | /android/app/src/main/java/com/pesquisacnpj/MainApplication.java | 229a3d8486d46ae996cb259e3cd05dbdb6f1e751 | [] | no_license | CPessoni/pesquisacnpj | e6834ff0d9496666970f2b53ce796f6bba4375df | 3ebc4d4af4b7c623bb0158dd6d8233e1160a6385 | refs/heads/master | 2020-04-17T02:43:11.933133 | 2019-01-24T12:05:54 | 2019-01-24T12:05:54 | 166,149,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,048 | java | package com.pesquisacnpj;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
| [
"cleytonpessoni@gmail.com"
] | cleytonpessoni@gmail.com |
7d3031811bd9cd06374c6b63e8cf1e928fc530a8 | e9f223191c660fdd5ba27d7b6b38cd13e6d9565b | /projects/MachineCoding/src/org/coding/textlineeditor/command/impl/PasteCommand.java | 41d85c80fbb184cda757288851210bd2e0607e6b | [] | no_license | kumarvishal09/Mywork | 99b100ae9022302c9bd8d9568a890d19ab36e081 | a27ff4c0d8c64f6da554d8561783f5a733366d4a | refs/heads/master | 2021-07-06T01:03:51.884212 | 2021-05-04T04:58:56 | 2021-05-04T04:58:56 | 236,689,268 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package org.coding.textlineeditor.command.impl;
import org.coding.textlineeditor.Doc;
import org.coding.textlineeditor.command.Changeable;
import org.coding.textlineeditor.event.Event;
import org.coding.textlineeditor.event.PasteEvent;
public class PasteCommand implements Changeable {
private Doc doc;
public PasteCommand(Doc doc) {
this.doc = doc;
}
@Override public void execute(Event event) {
PasteEvent pasteEvent = (PasteEvent)event;
this.doc.paste(pasteEvent.getLineNumber());
}
@Override public void undo() {
this.doc.unApplyMomento();
}
@Override public void redo() {
this.doc.applyMomento();
}
}
| [
"kumarvishal1802@gmail.com"
] | kumarvishal1802@gmail.com |
01cae1fb57830f71e53f815a427d6122a4003098 | 17537c091572a94c58975214094fdfeedb57fde1 | /core/server/clientProject/commonClient/src/main/java/com/home/commonClient/net/response/login/ClientHotfixResponse.java | d20e8986061b541e7937e4fed29c321381f29b46 | [
"Apache-2.0"
] | permissive | mengtest/home3 | dc2e5f910bbca6e536ded94d3f749671f0ca76d5 | a15a63694918483b2e4853edab197b5cdddca560 | refs/heads/master | 2023-01-29T13:49:23.822515 | 2020-12-11T10:17:39 | 2020-12-11T10:17:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,088 | java | package com.home.commonClient.net.response.login;
import com.home.commonBase.data.login.ClientVersionData;
import com.home.commonClient.constlist.generate.GameResponseType;
import com.home.commonClient.net.base.GameResponse;
import com.home.shine.bytes.BytesReadStream;
import com.home.shine.support.DataWriter;
import com.home.shine.support.collection.IntObjectMap;
import com.home.shine.support.pool.DataPool;
/** 客户端版本热更新消息(generated by shine) */
public class ClientHotfixResponse extends GameResponse
{
/** 数据类型ID */
public static final int dataID=GameResponseType.ClientHotfix;
/** 客户端版本 */
public ClientVersionData clientVersion;
public ClientHotfixResponse()
{
_dataID=GameResponseType.ClientHotfix;
}
/** 获取数据类名 */
@Override
public String getDataClassName()
{
return "ClientHotfixResponse";
}
/** 执行 */
@Override
protected void execute()
{
}
/** 读取字节流(完整版) */
@Override
protected void toReadBytesFull(BytesReadStream stream)
{
super.toReadBytesFull(stream);
stream.startReadObj();
this.clientVersion=new ClientVersionData();
this.clientVersion.readBytesFull(stream);
stream.endReadObj();
}
/** 读取字节流(简版) */
@Override
protected void toReadBytesSimple(BytesReadStream stream)
{
super.toReadBytesSimple(stream);
this.clientVersion=new ClientVersionData();
this.clientVersion.readBytesSimple(stream);
}
/** 转文本输出 */
@Override
protected void toWriteDataString(DataWriter writer)
{
super.toWriteDataString(writer);
writer.writeTabs();
writer.sb.append("clientVersion");
writer.sb.append(':');
if(this.clientVersion!=null)
{
this.clientVersion.writeDataString(writer);
}
else
{
writer.sb.append("ClientVersionData=null");
}
writer.writeEnter();
}
/** 回池 */
@Override
protected void toRelease(DataPool pool)
{
super.toRelease(pool);
this.clientVersion=null;
}
}
| [
"359944951@qq.com"
] | 359944951@qq.com |
12204995bfd388c53b1c4d353d3931b9c179670f | df37953eab4f6baabaa711f0f5a0297ae446660c | /src/AlexandraShokhan/lesson4/Task2.java | 10170b9d95553b383baa10f3dfb7ca405fde0b00 | [] | no_license | Shumski-Sergey/JC2019-09 | da54c55facd19242c439c3f900c48678eafcfc43 | 7065c371d1c83e86fec4180e6adb1b34d30739e5 | refs/heads/master | 2020-08-02T19:03:56.232185 | 2020-02-11T19:28:42 | 2020-02-11T19:28:42 | 211,473,198 | 0 | 17 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package AlexandraShokhan.lesson4;
// 1.В задаче на поиск максимальной оценки, вывести не саму оценку, а ее номер.
import java.util.concurrent.ThreadLocalRandom;
public class Task2 {
public static void main(String[] args) {
int[] grades;
grades = createRandomArray(6,1,100);
int maxGrade = findMaxIndex(grades);
int gradeNumber = maxGrade + 1;
System.out.println("The number of the max grade is " + gradeNumber + ".");
}
// Метод, который возврашает случайное число от min до max.
public static int getRandomNum(int min, int max) {
int i = ThreadLocalRandom.current().nextInt(min, max + 1);
return i;
}
// Метод, который возврашает массив случайных чисел определенной длины.
public static int[] createRandomArray(int arrayLength, int minValue, int maxValue) {
int [] randomArray;
randomArray = new int[arrayLength];
for (int i = 0; i < randomArray.length; i++) {
randomArray[i] = getRandomNum(minValue, maxValue);
}
return randomArray;
}
// Метод, который возврашает индекс максимального числа из массива.
public static int findMaxIndex(int array[]) {
int max = array[0];
int maxIndex = 0;
for (int i = 0; i < array.length; i++) {
if (max < array[i]) {
max = array[i];
maxIndex = i;
}
}
return maxIndex;
}
}
| [
"alexandra.shokhan@gmail.com"
] | alexandra.shokhan@gmail.com |
ca315b67168a436da8b0da83cb3bd36b915a5de9 | 2b622a23d85b74ab783931b4d5199c1efa784ecb | /tide-test/tide-test-server/src/main/java/org/granite/tide/test/security/ExceptionHandler.java | afee656d57701d3ae1cb55948795c8de39b53f77 | [] | no_license | sbwolff/graniteds-samples | 976e005c369e5735d14fa4b2c03555a6dd9595e9 | 4ed68b6956c7ab4a3303ca306999147a85bf86e6 | refs/heads/master | 2021-01-21T00:17:42.527249 | 2009-08-06T14:56:26 | 2009-08-06T14:56:26 | 33,420,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package org.granite.tide.test.security;
import java.util.Map;
import org.granite.messaging.service.ExceptionConverter;
import org.granite.messaging.service.ServiceException;
public class ExceptionHandler implements ExceptionConverter {
public boolean accepts(Throwable t) {
//return emsg.faultCode == "Persistence.EntityNotFound"; // only accept EntityNotFound exception
return true; // Accept every single exception...
}
public ServiceException convert(
Throwable t, String detail, Map<String, Object> extendedData) {
System.err.println("--- "+t);
ServiceException se = new ServiceException(
"AnyException", t.getMessage(), detail, t
);
se.getExtendedData().putAll(extendedData);
return se;
}
} | [
"anthibug@6f0b6db0-715c-11de-a9df-91707ec8e704"
] | anthibug@6f0b6db0-715c-11de-a9df-91707ec8e704 |
e9f35782772d4690e88434cf449b12d8c2321ec6 | a28267bfa0c90bc5b84ee427dcc972bc2e35411a | /i18n-spigot/src/main/java/com/blackypaw/mc/i18n/interceptor/v1_11/InterceptorScoreboard.java | 8417fcb0d2b7c1dc7f5af6ce420b32aaa9a5e512 | [
"BSD-3-Clause"
] | permissive | cieldeville/I18N | bff9ac0e3b8041b7c487a5461be20600a038eee0 | 1d105e5432c3dd99c3ce1173fe0babbda96f034d | refs/heads/master | 2021-06-20T08:50:59.685696 | 2017-06-21T15:45:06 | 2017-06-21T15:45:06 | 56,890,583 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,048 | java | /*
* Copyright (c) 2016, BlackyPaw
* All rights reserved.
*
* This code is licensed under a BSD 3-Clause license. For further license details view the LICENSE file in the root folder of this source tree.
*/
package com.blackypaw.mc.i18n.interceptor.v1_11;
import com.blackypaw.mc.i18n.I18NSpigotImpl;
import com.blackypaw.mc.i18n.InterceptorBase;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.ListenerPriority;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.google.gson.Gson;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
/**
* @author BlackyPaw
* @version 1.0
*/
public class InterceptorScoreboard extends InterceptorBase {
public InterceptorScoreboard( Plugin plugin, Gson gson, I18NSpigotImpl i18n ) {
super( plugin, gson, i18n, ListenerPriority.LOWEST, PacketType.Play.Server.SCOREBOARD_OBJECTIVE, PacketType.Play.Server.SCOREBOARD_SCORE, PacketType.Play.Server.SCOREBOARD_TEAM );
}
@Override
public void onPacketSending( PacketEvent event ) {
if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_OBJECTIVE ) {
this.onScoreboardObjective( event );
} else if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_SCORE ) {
this.onScoreboardScore( event );
} else if ( event.getPacketType() == PacketType.Play.Server.SCOREBOARD_TEAM ) {
this.onScoreboardTeam( event );
}
}
private void onScoreboardObjective( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
int mode = packet.getIntegers().read( 0 );
if ( mode == 0 || mode == 2 ) {
String message = packet.getStrings().read( 1 );
String translation = this.translateMessageIfAppropriate( this.i18n.getLocale( player.getUniqueId() ), message );
if ( message != translation ) {
packet.getStrings().write( 1, translation );
}
}
}
private void onScoreboardScore( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
String message = packet.getStrings().read( 0 );
String translation = this.translateMessageIfAppropriate( this.i18n.getLocale( player.getUniqueId() ), message );
if ( message != translation ) {
packet.getStrings().write( 0, translation );
}
}
private void onScoreboardTeam( PacketEvent event ) {
final Player player = event.getPlayer();
final PacketContainer packet = event.getPacket();
final Locale locale = this.i18n.getLocale( player.getUniqueId() );
int mode = packet.getIntegers().read( 1 );
if ( mode == 0 || mode == 2 ) {
String displayName = packet.getStrings().read( 1 );
String prefix = packet.getStrings().read( 2 );
String suffix = packet.getStrings().read( 3 );
String translatedDisplayName = this.translateMessageIfAppropriate( locale, displayName );
String translatedPrefix = this.translateMessageIfAppropriate( locale, prefix );
String translatedSuffix = this.translateMessageIfAppropriate( locale, suffix );
if ( displayName != translatedDisplayName ) {
packet.getStrings().write( 1, translatedDisplayName );
}
if ( prefix != translatedPrefix ) {
packet.getStrings().write( 2, translatedPrefix );
}
if ( suffix != translatedSuffix ) {
packet.getStrings().write( 3, translatedSuffix );
}
}
if ( mode == 0 || mode == 3 || mode == 4 ) {
List<String> entries = (List<String>) packet.getSpecificModifier( Collection.class ).read( 0 );
if ( entries.size() > 0 ) {
for ( int i = 0; i < entries.size(); ++i ) {
String entry = entries.get( i );
String translatedEntry = this.translateMessageIfAppropriate( locale, entry );
if ( entry != translatedEntry ) {
entries.set( i, translatedEntry );
}
}
}
}
}
}
| [
"developers@blackypaw.com"
] | developers@blackypaw.com |
a374c8284580c8f40f3063c7a934652f065fe2a7 | ec01419a153633004a08a091d243bd63709f7956 | /appTramDocuConcytecAdvancedFD/src/tramitedoc/concytec/action/AActionPuenteDocumento.java | d67dc0b852dda7b9e8d95e610ca7bab1698fde06 | [] | no_license | angelnoa/TramiteDoc-FD | 5c3f4b024d4421486d92e1f3eb88a2de424e9472 | e2e2d3e60886efd44d91981a674d1a358cce6aa1 | refs/heads/master | 2021-01-10T13:50:01.720613 | 2016-01-25T15:20:57 | 2016-01-25T15:20:57 | 50,359,496 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 13,925 | java | package tramitedoc.concytec.action;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
import java.util.Vector;
import javax.sql.DataSource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import tramitedoc.concytec.dao.*;
import tramitedoc.concytec.form.*;
import tramitedoc.concytec.bean.*;
import tramitedoc.concytec.dao.interfaces.*;
import tramitedoc.concytec.util.*;
import tramitedoc.concytec.dao.sql.*;
import java.sql.Connection;
import java.sql.SQLException;
/**
* AUTOR : Machuca Ovalle
* FECHA : 03-04-2006
* VERSION : 1.0
* DESCRIPCIÓN : Accion de Logeo
*/
public class AActionPuenteDocumento extends ValidaSessionAction{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
HttpSession session = request.getSession(false);
/*Verificar si la sesion se perdio*/
if (session==null){
return (mapping.findForward("expiracion"));
}
int li_retorno=0;
String ls_accion=null;
String ls_cod_doc=null;
String ls_estado=null;
String ls_secuencia=null;
String ls_pagina=null;
String ls_msg_error=null;
String ls_cod_padre=null;
String ls_codigo_inicia=null;
String codigo_oficina=null;
String ls_fecha_rpta=null;
String ls_codigo_expediente="";
String ls_descripcion_tipo="";
String ls_numero_documento="";
String ls_naturaleza_documento="";
String ls_correlativo_deriva="";
String ls_descripcion_oficina="";
String ls_oficina="";
codigo_oficina = String.valueOf(session.getAttribute("codigo_oficina"));
ls_accion = request.getParameter("operacion");
ls_cod_doc = request.getParameter("codigo");
ls_secuencia = request.getParameter("secuencia");
ls_estado = request.getParameter("estado");
ls_codigo_inicia = request.getParameter("codigo_inicia");
ls_fecha_rpta = request.getParameter("fecha_rpta");
ls_codigo_expediente = request.getParameter("codigo_expediente");
ls_descripcion_tipo = request.getParameter("descripcion_tipo");
ls_numero_documento = request.getParameter("numero_documento");
ls_naturaleza_documento = request.getParameter("naturaleza_documento");
ls_correlativo_deriva = request.getParameter("correlativo_deriva");
ls_descripcion_oficina = request.getParameter("descripcion_oficina");
ls_oficina = request.getParameter("oficina");
System.out.println("el ls_accion" + ls_accion);
System.out.println("el ls_cod_doc" + ls_cod_doc);
System.out.println("el ls_secuencia" + ls_secuencia);
System.out.println("el ls_estado" + ls_estado);
System.out.println("el ls_codigo_inicia" + ls_codigo_inicia);
System.out.println("el ls_fecha_rpta" + ls_fecha_rpta);
System.out.println("el ls_codigo_expediente" + ls_codigo_expediente);
System.out.println("el ls_descripcion_tipo" + ls_descripcion_tipo);
System.out.println("el ls_numero_documento" + ls_numero_documento);
System.out.println("el ls_naturaleza_documento" + ls_naturaleza_documento);
System.out.println("el ls_correlativo_deriva" + ls_correlativo_deriva);
System.out.println("el ls_nombre_personal" + ls_descripcion_oficina);
System.out.println("el ls_oficina" + ls_oficina);
try {
Connection cnx = getConnection(request, "principal");
System.out.println("El cnx ==> " + cnx);
IUsuarioDAO daoIUsuarioDAO = new SqlUsuarioDAO();
//BMesaPartes BMesaPartesVO=new BMesaPartes();
session.removeAttribute("accion_mp");
session.removeAttribute("documento");
session.removeAttribute("secuencia");
session.removeAttribute("codigo_inicia");
session.removeAttribute("codigo_expediente");
session.removeAttribute("descripcion_tipo");
session.removeAttribute("numero_documento");
session.removeAttribute("naturaleza_documento");
session.removeAttribute("fecha_rpta");
session.removeAttribute("correlativo_deriva");
session.removeAttribute("descripcion_oficina");
session.removeAttribute("detalleConsulta");
session.removeAttribute("mensaje");
session.setAttribute("accion_mp", ls_accion);
session.setAttribute("documento", ls_cod_doc);
session.setAttribute("secuencia",ls_secuencia);
session.setAttribute("codigo_inicia", ls_codigo_inicia);
session.setAttribute("codigo_expediente", ls_codigo_expediente);
session.setAttribute("descripcion_tipo", ls_descripcion_tipo);
session.setAttribute("numero_documento", ls_numero_documento);
session.setAttribute("naturaleza_documento", ls_naturaleza_documento);
session.setAttribute("fecha_rpta", ls_fecha_rpta);
session.setAttribute("correlativo_deriva", ls_correlativo_deriva);
session.setAttribute("descripcion_oficina", ls_descripcion_oficina);
session.setAttribute("oficina", ls_oficina);
System.out.println("ls_accion" + ls_accion);
if (ls_accion == null) {
ls_accion = "";
}
if (ls_accion.equals("R")) {
// Activamos el Action de Recorrido ....
if(ls_fecha_rpta.equals("") || ls_fecha_rpta==null ){
return (mapping.findForward("recorridofecnull"));
}else{
return (mapping.findForward("recorrido"));
}
}
if (ls_accion.equals("D")) {
// Activamos La Pagina de Derivación ....
if (ls_estado.equals("3") || ls_estado.equals("1"))
{
// Solo se puede Derivar cuando el Estado es Tramite ....
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.setAttribute("cod_padre", ls_cod_padre);
session.setAttribute("derivar", "derivar");
return (mapping.findForward("derivacion"));
}
else
{
ls_msg_error = "Para Derivar un Documento el estado debe ser Recibido..!";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("A")) {
// Activamos pagina de Archivar ....
if (ls_estado.equals("3") || ls_estado.equals("4"))
{
return (mapping.findForward("archivar"));
//ls_pagina = "pag_archivar.jsp";
}
else
{
ls_msg_error = "El Estado del Documento debe ser Recibido ó Derivado";
session.setAttribute("error", ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("E")) {
// Activamos pagina de Recibir un Doc ....
// ls_pagina = "pag_serie_expediente.jsp";
if (ls_estado.equals("2") || ls_estado.equals("3")|| ls_estado.equals("6"))
{
li_retorno = daoIUsuarioDAO.parametro(cnx);
System.out.println("li_retorno" + li_retorno);
session.setAttribute("correlativorecepcion",String.valueOf(li_retorno));
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
ls_codigo_inicia = request.getParameter("codigo_inicia");
System.out.println("ls_codigo_inicia" + ls_codigo_inicia);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.removeAttribute("estadodoc");
session.setAttribute("cod_padre",ls_cod_padre);
session.setAttribute("derivar","derivar");
session.setAttribute("estadodoc", ls_estado);
if(ls_cod_doc.equals(ls_cod_padre)){
System.out.println("si el codigo inicia es igual al codigo padre");
if(codigo_oficina.equals("1")&& ls_naturaleza_documento.equals("I")){
System.out.println("si el codigo de oficina es mesa de partes");
return (mapping.findForward("preliquidardoc"));
}
return (mapping.findForward("recibirdoc"));
}else{
System.out.println("si el codigo inicia es diferente al codigo padre");
if(codigo_oficina.equals("2")){
System.out.println("si el codigo de oficina es secretaria");
return (mapping.findForward("recibirdoc"));
}
if(codigo_oficina.equals("1")){
System.out.println("si el codigo de oficina es mesa de partes");
return (mapping.findForward("preliquidardoc"));
}
}
}
else
{
ls_msg_error = "El Estado del Documento debe ser Pendiente";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("S")) {
// la accion es salir del sistema
return (mapping.findForward("cerrarsession"));
}
if (ls_accion.equals("W")) {
// Activamos pagina de Recibir un Doc ....
// ls_pagina = "pag_serie_expediente.jsp";
if (ls_estado.equals("3"))
{
BMesaPartes BMesaPartesVO = daoIUsuarioDAO.of_obtener_padre(cnx,ls_cod_doc);
ls_cod_padre = BMesaPartesVO.getCodigo_inicia();
System.out.println("ls_cod_padre" + ls_cod_padre);
session.removeAttribute("cod_padre");
session.removeAttribute("derivar");
session.setAttribute("cod_padre",ls_cod_padre);
session.setAttribute("derivar","derivar");
return (mapping.findForward("asociarintent"));
}
else
{
ls_msg_error = "El Estado del Documento debe ser Recibido";
session.setAttribute("error",ls_msg_error);
return (mapping.findForward("mensaje"));
}
}
if (ls_accion.equals("M")) {
// Activamos pagina de Modificar Documento ....
BMesaPartes detalleConsulta = daoIUsuarioDAO.of_detalle_documento(cnx,ls_oficina,ls_cod_doc,ls_secuencia);
System.out.println("detalleConsulta" + detalleConsulta);
session.setAttribute("detalleConsulta", detalleConsulta);
return (mapping.findForward("modificardoc"));
}
}
catch (Exception e) {
e.printStackTrace();
}
return (mapping.findForward("error"));
}
}
| [
"anghelo.dj87@gmail.com"
] | anghelo.dj87@gmail.com |
e8ef82a8bd15642b9033784c35e60dc39bcb94e7 | 67cae444096bdc9d110c7bf2170e965fc963e527 | /WBHGEF_Palette/src/wbhgef/Perspective.java | b03209e53904621a786a47d52b057bfa973920d0 | [] | no_license | Jevinliu/GEF-Demo | 0b4110dfd74a0d04802ec9999c2dae60a8a26d78 | 7c7972370ea2db8ccb368c1539de3817680b1131 | refs/heads/master | 2021-05-04T10:02:31.447357 | 2016-12-14T02:25:54 | 2016-12-14T02:25:54 | 52,586,163 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 590 | java | package wbhgef;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
public class Perspective implements IPerspectiveFactory {
private static final String ID_TABS_FOLDER = "PropertySheet";
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(true);
IFolderLayout tabs = layout.createFolder(ID_TABS_FOLDER,
IPageLayout.LEFT, 0.3f, editorArea);
tabs.addView(IPageLayout.ID_OUTLINE);
tabs.addPlaceholder(IPageLayout.ID_PROP_SHEET);
}
}
| [
"857684042@qq.com"
] | 857684042@qq.com |
b7d7514d83fc150c7b4923424e5f032d126fe6fc | c17cadd6dc969c37deb0bfc6ca0d3740c0e6940b | /BasicCoreJava/src/Array/EnhancedForLoop.java | 40a80f0effc1951be9e34ce7da8e7b6e5b9c9482 | [] | no_license | bilwa93/03072020automation | d16b41673f08b1bd1dc7018c3e158f1dde154de3 | d23b10d020cf323143d396afc79d13c53d4321a9 | refs/heads/master | 2022-11-13T14:54:48.841344 | 2020-07-04T06:49:45 | 2020-07-04T06:49:45 | 276,959,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 178 | java | package Array;
public class EnhancedForLoop {
public static void main(String[] args) {
// TODO Auto-generated method stub
String[] name= {"Name1","Name2","Name3"};
}
}
| [
"bilwa.p1893@gmail.com"
] | bilwa.p1893@gmail.com |
361df97718c238b8ac3ba616d2adcd87b9114e12 | cfc60fc1148916c0a1c9b421543e02f8cdf31549 | /src/testcases/CWE789_Uncontrolled_Mem_Alloc/CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d.java | fdbb176624fa51406685c61253a1dfbac2e1554a | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujinhua/GitFun | c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2 | 987f72fdccf871ece67f2240eea90e8c1971d183 | refs/heads/master | 2021-01-18T05:46:03.351267 | 2012-09-11T16:43:44 | 2012-09-11T16:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,554 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d.java
Label Definition File: CWE789_Uncontrolled_Mem_Alloc.int.label.xml
Template File: sources-sink-53d.tmpl.java
*/
/*
* @description
* CWE: 789 Uncontrolled Memory Allocation
* BadSource: getQueryStringServlet Parse id param out of the querystring without getParam
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: HashMap
* BadSink : Create a HashMap using data as the initial size
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE789_Uncontrolled_Mem_Alloc;
import testcasesupport.*;
import javax.servlet.http.*;
import java.util.HashMap;
public class CWE789_Uncontrolled_Mem_Alloc__getQueryStringServlet_53d
{
public void bad_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
/* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */
HashMap list = new HashMap(data);
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(int data , HttpServletRequest request, HttpServletResponse response) throws Throwable
{
/* POTENTIAL FLAW: Create a HashMap using data as the initial size. data may be very large, creating memory issues */
HashMap list = new HashMap(data);
}
}
| [
"amitf@chackmarx.com"
] | amitf@chackmarx.com |
bc7833d4758d48d162797d2da4cf3fb61bb33623 | e672e1bcfe9168c1e3779c5f3b3f3b8f8d6e2a35 | /src/com/wxp/swt/jface/sample/PersonListLabelProvider.java | 4e4ebe13162d3a9d8607f5892bd701a30a0276bd | [] | no_license | accordionmaster/FavoritesPlugins | 2a8a75e7bb8164c28f34d55c544ca0db047ca2e0 | 32f37e432a1e79931d1d1abfe2fb81fbde4948cd | refs/heads/master | 2022-12-12T10:48:52.311210 | 2020-09-11T08:17:06 | 2020-09-11T08:17:06 | 255,007,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.wxp.swt.jface.sample;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
public class PersonListLabelProvider extends LabelProvider {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
Person person = (Person) element;
return person.firstName + " " + person.lastName;
}
}
| [
"accordionmaster@163.com"
] | accordionmaster@163.com |
40fe0885f1945a334f06b52425d23daaead063e2 | 98119c1d07b88c31eee153bef508b4b33c701ae1 | /.svn/pristine/40/40fe0885f1945a334f06b52425d23daaead063e2.svn-base | 05a3cfc532ef3faec7360ffe4e45b3f10414d7cb | [] | no_license | ghyaolong/spay-admin | dc8e8b394f4f3ba0847eae9cec0d3a10d769c5c3 | 024dccd05b8a882e74540d288dd96f89ddf5d2cf | refs/heads/master | 2021-01-21T17:37:25.410908 | 2017-05-21T15:20:46 | 2017-05-21T15:20:46 | 91,966,533 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,277 | package com.syhbuy.spay.admin.entity;
import java.math.BigDecimal;
public class dispenseBuyRecord {
private String id;//购买记录ID
private String activityId; //活动ID
private BigDecimal buyAmount;//购买金额
private BigDecimal faceValue; //面值
private Long buyTime;//购买时间
private String purchaser;//购买人
private String status;//状态
private String isDel;
private Long delTime;
private String orderId;//订单id
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getActivityId() {
return activityId;
}
public void setActivityId(String activityId) {
this.activityId = activityId == null ? null : activityId.trim();
}
public BigDecimal getBuyAmount() {
return buyAmount;
}
public void setBuyAmount(BigDecimal buyAmount) {
this.buyAmount = buyAmount;
}
public BigDecimal getFaceValue() {
return faceValue;
}
public void setFaceValue(BigDecimal faceValue) {
this.faceValue = faceValue;
}
public Long getBuyTime() {
return buyTime;
}
public void setBuyTime(Long buyTime) {
this.buyTime = buyTime;
}
public String getPurchaser() {
return purchaser;
}
public void setPurchaser(String purchaser) {
this.purchaser = purchaser == null ? null : purchaser.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getIsDel() {
return isDel;
}
public void setIsDel(String isDel) {
this.isDel = isDel == null ? null : isDel.trim();
}
public Long getDelTime() {
return delTime;
}
public void setDelTime(Long delTime) {
this.delTime = delTime;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId == null ? null : orderId.trim();
}
} | [
"289911401@qq.com"
] | 289911401@qq.com | |
c6243cbfc92da5da99d06e75e99fd11ac6c7fb27 | 19f2e871122e35ac830e2d00c9d90857371a70d9 | /score-board/app/src/main/java/com/codecool/scoreboard/apiservice/RetrofitClient.java | 236b87f588d445525102a1ae63a0eec1ae6ebe30 | [] | no_license | CodecoolGlobal/score-board-java-kagnest | ea7a458c26007e0d2b1c3fd393e681cdc8df9d93 | 3fd9ea2fca2e5808ee152dc5155085bbc7ad8c14 | refs/heads/development | 2022-11-07T01:39:44.356200 | 2020-06-26T13:19:59 | 2020-06-26T13:19:59 | 272,633,502 | 0 | 0 | null | 2020-06-26T13:20:00 | 2020-06-16T06:59:42 | Java | UTF-8 | Java | false | false | 1,134 | java | package com.codecool.scoreboard.apiservice;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
public class RetrofitClient {
private static Retrofit retrofit = null;
private static String BASE_URL = "https://www.thesportsdb.com/api/v1/json/1/";
public static Retrofit getClient() {
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.build();
if (retrofit == null) {
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(client)
.build();
}
return retrofit;
}
}
| [
"agnes.kadlot@gmail.com"
] | agnes.kadlot@gmail.com |
b8f71dd09952a950324c2289f320be70e9eb4835 | 17ea252660c5d98dc719ce1d2b1c9e89f306e5e6 | /src/top/lolcl/dao/RoleRightMapper.java | ebeba0b4151cae3b1a70038fc081c2b338301be8 | [] | no_license | sanchoziyan/MyBlogBack | 36e0195442bdcd836cedccb24f14fa557f8aa612 | abd344be7b6c7aa73672d9a147dac4e5eb5fd4c3 | refs/heads/master | 2020-04-14T19:10:51.928103 | 2019-01-04T02:46:11 | 2019-01-04T02:46:11 | 164,048,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package top.lolcl.dao;
import java.util.List;
import top.lolcl.entity.RoleRight;
public interface RoleRightMapper {
int insert(RoleRight record);
int insertSelective(RoleRight record);
List<RoleRight> selectByROID(String roid);
} | [
"997109508@qq.com"
] | 997109508@qq.com |
fe3c3448bc8601af8babe1b9ef197ca88a9bb0d5 | 5693307cb78192cdea0cbbde015c39cc9c881f09 | /src/main/java/org/apache/storm/executionengine/topologyLayer/TopologyOperator.java | 46f899c16ef4efd07d8360a0e2e9105c6fa7cee3 | [] | no_license | caofangkun/apache-pig-on-storm | 1fe6e4aeb4078ebdf5c9b2b76414a5c0946c4310 | 725f70d7e52cc69f2ed2fa5f0cc367c7236c564c | refs/heads/master | 2016-09-06T17:14:37.473783 | 2015-08-04T09:54:24 | 2015-08-04T09:54:24 | 40,099,755 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,941 | java | package org.apache.storm.executionengine.topologyLayer;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.storm.executionengine.physicalLayer.PhysicalOperator;
import org.apache.storm.executionengine.physicalLayer.plans.PhysicalPlan;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POCounter;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POPartition;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.PORank;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POTap;
import org.apache.storm.executionengine.physicalLayer.relationalOperators.POUnion;
import org.apache.storm.executionengine.topologyLayer.plans.TopologyOperatorPlanVisitor;
import org.apache.pig.impl.plan.NodeIdGenerator;
import org.apache.pig.impl.plan.Operator;
import org.apache.pig.impl.plan.OperatorKey;
import org.apache.pig.impl.plan.PlanException;
import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.impl.util.MultiMap;
/**
* An operator model for TopologyOperator.
*/
public class TopologyOperator extends Operator<TopologyOperatorPlanVisitor> {
private static final long serialVersionUID = 1L;
// The sub physical plan that should be executed
public PhysicalPlan topoPlan;
// Indicates that the map plan creation
// is complete
boolean topoDone = false;
// Indicates that there is an operator which uses endOfAllInput flag in the
// plan
boolean endOfAllInputInMap = false;
// Indicates if this job is an order by job
boolean globalSort = false;
// Indicates if this is a limit after a sort
boolean limitAfterSort = false;
// Indicate if the entire purpose for this map reduce job is doing limit,
// does not change
// anything else. This is to help POPackageAnnotator to find the right
// POPackage to annotate
boolean limitOnly = false;
// The sort order of the columns;
// asc is true and desc is false
boolean[] sortOrder;
// Sort order for secondary keys;
boolean[] secondarySortOrder;
public Set<String> UDFs;
public Set<PhysicalOperator> scalars;
// Indicates if a UDF comparator is used
boolean isUDFComparatorUsed = false;
transient NodeIdGenerator nig;
private String scope;
int requestedParallelism = -1;
// estimated at runtime
int estimatedParallelism = -1;
// calculated at runtime
int runtimeParallelism = -1;
/* Name of the Custom Partitioner used */
String customPartitioner = null;
// Map of the physical operator in physical plan to the one in MR plan: only
// needed
// if the physical operator is changed/replaced in MR compilation due to,
// e.g., optimization
public MultiMap<PhysicalOperator, PhysicalOperator> phyToMRMap;
//
private List<POPartition> outputPartitions = new ArrayList<POPartition>();
private List<POPartition> inputPartitions = new ArrayList<POPartition>();
private Map<String, List<PhysicalOperator>> partitionSeen = new HashMap<String, List<PhysicalOperator>>();
// private Map<PhysicalOperator, String> partitionSeen = new
// HashMap<PhysicalOperator, String>();
public TopologyOperator(OperatorKey k) {
super(k);
topoPlan = new PhysicalPlan();
UDFs = new HashSet<String>();
scalars = new HashSet<PhysicalOperator>();
nig = NodeIdGenerator.getGenerator();
scope = k.getScope();
phyToMRMap = new MultiMap<PhysicalOperator, PhysicalOperator>();
}
public boolean hasTap() {
if (this.topoPlan == null || this.topoPlan.size() == 0) {
return false;
}
for (PhysicalOperator root : this.topoPlan.getRoots()) {
if (root instanceof POTap) {
return true;
}
}
return false;
}
public List<POPartition> getOutputPartitions() {
return outputPartitions;
}
public List<POPartition> getInputPartitions() {
return inputPartitions;
}
public void setPartitionSeen(Map<String, List<PhysicalOperator>> partitionSeen) {
this.partitionSeen = partitionSeen;
}
/**
* TODO form Partition to other PhysicalOperators
*
* @param alias
* @return
*/
public Map<String, List<String>> getPartitionSuccessors() {
Map<String, List<String>> all = new HashMap<String, List<String>>();
for (POPartition po : inputPartitions) {
if (partitionSeen.containsKey(po.getAlias())) {
List<PhysicalOperator> tos = partitionSeen.get(po.getAlias());
List<String> ret = new ArrayList<String>();
for (PhysicalOperator to : tos) {
ret.add(to.getAlias());
}
all.put(po.getAlias(), ret);
}
}
return all;
}
private String shiftStringByTabs(String DFStr, String tab) {
StringBuilder sb = new StringBuilder();
String[] spl = DFStr.split("\n");
for (int i = 0; i < spl.length; i++) {
sb.append(tab);
sb.append(spl[i]);
sb.append("\n");
}
sb.delete(sb.length() - "\n".length(), sb.length());
return sb.toString();
}
/**
* Uses the string representation of the component plans to identify itself.
*/
@Override
public String name() {
String udfStr = getUDFsAsStr();
StringBuilder sb = new StringBuilder("Topology" + "("
+ requestedParallelism + (udfStr.equals("") ? "" : ",") + udfStr + ")"
+ " - " + mKey.toString() + ":\n");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (!topoPlan.isEmpty()) {
topoPlan.explain(baos);
String mp = new String(baos.toByteArray());
sb.append(shiftStringByTabs(mp, "| "));
} else
sb.append("Physical Plan Empty");
return sb.toString();
}
private String getUDFsAsStr() {
StringBuilder sb = new StringBuilder();
if (UDFs != null && UDFs.size() > 0) {
for (String str : UDFs) {
sb.append(str.substring(str.lastIndexOf('.') + 1));
sb.append(',');
}
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
@Override
public boolean supportsMultipleInputs() {
return true;
}
@Override
public boolean supportsMultipleOutputs() {
return true;
}
@Override
public void visit(TopologyOperatorPlanVisitor v) throws VisitorException {
v.visitTopologyOperator(this);
}
public boolean isTopoDone() {
return topoDone;
}
public void setTopoDone(boolean topoDone) {
this.topoDone = topoDone;
}
public void setTopoDoneSingle(boolean topoDone) throws PlanException {
this.topoDone = topoDone;
if (topoDone && topoPlan.getLeaves().size() > 1) {
topoPlan.addAsLeaf(getUnion());
}
}
public void setTopoDoneMultiple(boolean topoDone) throws PlanException {
this.topoDone = topoDone;
if (topoDone && topoPlan.getLeaves().size() > 0) {
topoPlan.addAsLeaf(getUnion());
}
}
private POUnion getUnion() {
return new POUnion(new OperatorKey(scope, nig.getNextNodeId(scope)));
}
public boolean isGlobalSort() {
return globalSort;
}
public void setGlobalSort(boolean globalSort) {
this.globalSort = globalSort;
}
public boolean isLimitAfterSort() {
return limitAfterSort;
}
public void setLimitAfterSort(boolean las) {
limitAfterSort = las;
}
public boolean isLimitOnly() {
return limitOnly;
}
public void setLimitOnly(boolean limitOnly) {
this.limitOnly = limitOnly;
}
public void setSortOrder(boolean[] sortOrder) {
if (null == sortOrder)
return;
this.sortOrder = new boolean[sortOrder.length];
for (int i = 0; i < sortOrder.length; ++i) {
this.sortOrder[i] = sortOrder[i];
}
}
public void setSecondarySortOrder(boolean[] secondarySortOrder) {
if (null == secondarySortOrder)
return;
this.secondarySortOrder = new boolean[secondarySortOrder.length];
for (int i = 0; i < secondarySortOrder.length; ++i) {
this.secondarySortOrder[i] = secondarySortOrder[i];
}
}
public boolean[] getSortOrder() {
return sortOrder;
}
public boolean[] getSecondarySortOrder() {
return secondarySortOrder;
}
/**
* @return whether end of all input is set in the map plan
*/
public boolean isEndOfAllInputSetInMap() {
return endOfAllInputInMap;
}
/**
* @param endOfAllInputInMap
* the streamInMap to set
*/
public void setEndOfAllInputInMap(boolean endOfAllInputInMap) {
this.endOfAllInputInMap = endOfAllInputInMap;
}
public int getRequestedParallelism() {
return requestedParallelism;
}
public String getCustomPartitioner() {
return customPartitioner;
}
public boolean isRankOperation() {
return getRankOperationId().size() != 0;
}
public ArrayList<String> getRankOperationId() {
ArrayList<String> operationIDs = new ArrayList<String>();
Iterator<PhysicalOperator> mapRoots = this.topoPlan.getRoots().iterator();
while (mapRoots.hasNext()) {
PhysicalOperator operation = mapRoots.next();
if (operation instanceof PORank)
operationIDs.add(((PORank) operation).getOperationID());
}
return operationIDs;
}
public boolean isCounterOperation() {
return (getCounterOperation() != null);
}
public boolean isRowNumber() {
POCounter counter = getCounterOperation();
return (counter != null) ? counter.isRowNumber() : false;
}
public String getOperationID() {
POCounter counter = getCounterOperation();
return (counter != null) ? counter.getOperationID() : null;
}
private POCounter getCounterOperation() {
PhysicalOperator operator;
Iterator<PhysicalOperator> it = this.topoPlan.getLeaves().iterator();
while (it.hasNext()) {
operator = it.next();
if (operator instanceof POCounter)
return (POCounter) operator;
}
return null;
}
}
| [
"caofangkun@gmail.com"
] | caofangkun@gmail.com |
868abe8d1e927ed028ea1da3b850b6eb23b9da3b | c9191f99c1af05b655609cbd11bd42240a6c5cc2 | /core/src/main/java/io/rainrobot/wake/core/json/IdabelCollectionDeSerializer.java | da5251ee9ef85f6962f4790eafe919ae9405abcc | [] | no_license | extremeFunk/WakeApp | 09a0df27c8a24961ceed04da31bc9363e1fe1493 | 2294c3007309b0af7e0c5993f64c31834aa594ee | refs/heads/master | 2020-07-24T20:19:02.526324 | 2019-11-11T21:48:16 | 2019-11-11T21:48:16 | 157,155,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package io.rainrobot.wake.core.json;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonNode;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import io.rainrobot.wake.core.Idabel;
public abstract class IdabelCollectionDeSerializer <T extends Idabel>
extends JsonDeserializer<Collection<T>> {
@Override
public Collection<T> deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
JsonNode tree = p.getCodec().readTree(p);
List<JsonNode> nodeList = tree.findValues(IdabelSerilizer.LABEL);
Collection<T> pojoList = getCollection();
nodeList.forEach(n -> {
T t = getInstance();
t.setId(n.asInt());
pojoList.add(t);
});
return pojoList;
}
protected abstract T getInstance();
protected abstract Collection<T> getCollection();
}
| [
"roy.barak.m@gmail.com"
] | roy.barak.m@gmail.com |
c652cf54de86da2de3f3ecf90abdf0ae0d3671e9 | 3cf20776cd836f08414436fc01158ed114966ca6 | /JW_201802104029/src/bysj/Dao/TeacherDao.java | 21bfbe463c313bd38f7e1fe04c2f12be6857e394 | [] | no_license | chen-yiqian/JW_201802104029_27 | a91ae4eb57921f4cdbe5dfb13b11c00f88b21967 | 17f35902b9e0f0fb39e99c6b6117c5dd0b9a4477 | refs/heads/master | 2020-09-20T03:25:32.717672 | 2019-11-27T07:03:54 | 2019-11-27T07:03:54 | 224,366,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,522 | java | package bysj.Dao;
import bysj.Daomain.Degree;
import bysj.Daomain.Department;
import bysj.Daomain.ProfTitle;
import bysj.Daomain.Teacher;
import bysj.Service.DegreeService;
import bysj.Service.DepartmentService;
import bysj.Service.ProfTitleService;
import bysj.Service.TeacherService;
import bysj.Util.JdbcHelper;
import java.sql.*;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
public final class TeacherDao {
private static TeacherDao teacherDao=new TeacherDao();
public static TeacherDao getInstance(){
return teacherDao;
}
public Collection<Teacher> findAll() throws SQLException {
//创建一个HashSet对象,并把它加到set
Set teachers=new HashSet<Teacher>();
//获得连接对象
Connection connection = JdbcHelper.getConn();
//在该连接上创建语句盒子对象
Statement statement = connection.createStatement();
//执行sql查询语句并获得结果集对象
ResultSet resultSet= statement.executeQuery("select * from teacher");
//若结果集仍有下一条记录,则执行循环体
while (resultSet.next()){
ProfTitle profTitle=ProfTitleDao.getInstance().find(resultSet.getInt("proftitle_id"));
Degree degree=DegreeDao.getInstance().find(resultSet.getInt("degree_id"));
Department department=DepartmentDao.getInstance().find(resultSet.getInt("department_id"));
//获得数据库的信息,并用于在网页中显示
Teacher teacher = new Teacher(resultSet.getInt("id"),
resultSet.getString("name"),
profTitle,
degree,
department);
//添加到集合中
teachers.add(teacher);
}
return teachers;
}
public Teacher find(Integer id)throws SQLException{
Teacher teacher = null;
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String findteacher="select * from teacher where id=?";
//在该连接上创建预编译语句对象
PreparedStatement preparedStatement=connection.prepareStatement(findteacher);
//为预编译语句赋值
preparedStatement.setInt(1,id);
//创建ResultSet对象,执行预编译语句
ResultSet resultSet=preparedStatement.executeQuery();
//由于id不能取重复值,故结果集中最多有一条记录
//若结果集有一条记录,则以当前记录中的id,description,no,remarks值为参数,创建Degree对象
//若结果集中没有记录,则本方法返回null
if(resultSet.next()){
ProfTitle profTitle= ProfTitleService.getInstance().find(resultSet.getInt("proftitle_id"));
Degree degree= DegreeService.getInstance().find(resultSet.getInt("degree_id"));
Department department=DepartmentService.getInstance().find(resultSet.getInt("department_id"));
//获得数据库的信息
teacher=new Teacher(
resultSet.getInt("id"),
resultSet.getString("name"),
profTitle,
degree,
department
);
}
//关闭
JdbcHelper.close(preparedStatement,connection);
return teacher;
}
public boolean update(Teacher teacher)throws SQLException{
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String updateteacher="update teacher set name=?,proftitle_id=?,degree_id=?,department_id=? where id=?";
//创建PreparedStatement接口对象,包装编译后的目标代码(可以设置参数,安全性高)
PreparedStatement preparedStatement=connection.prepareStatement(updateteacher);
//为预编译的语句参数赋值
preparedStatement.setString(1,teacher.getName());
preparedStatement.setInt(2,teacher.getTitle().getId());
preparedStatement.setInt(3,teacher.getDegree().getId());
preparedStatement.setInt(4,teacher.getDepartment().getId());
preparedStatement.setInt(5,teacher.getId());
//执行预编译对象的executeUpdate()方法,获取修改记录的行数
int affected=preparedStatement.executeUpdate();
//关闭
JdbcHelper.close(preparedStatement,connection);
return affected>0;
}
public boolean add(Teacher teacher)throws SQLException{
//获得连接对象
Connection connection = JdbcHelper.getConn();
//创建sql语句
String addTeacher_sql = "insert into teacher(name,proftitle_id,degree_id,department_id) values " + "(?,?,?,?)";
//在该连接上创建预编译语句对象
PreparedStatement pstmt = connection.prepareStatement(addTeacher_sql);
//为预编译参数赋值
pstmt.setString(1,teacher.getName());
pstmt.setInt(2,teacher.getTitle().getId());
pstmt.setInt(3,teacher.getDegree().getId());
pstmt.setInt(4,teacher.getDepartment().getId());
//执行预编译对象的executeUpdate方法,获取添加的记录行数
int affectedRowNum=pstmt.executeUpdate();
//关闭
JdbcHelper.close(pstmt,connection);
return affectedRowNum>0;
}
public boolean delete(Integer id) throws SQLException {
//获得连接对象
Connection connection=JdbcHelper.getConn();
//创建sql语句
String deleteTeacher_sql="DELETE FROM teacher WHERE id=?";
//在该连接上创建预编译语句对象
PreparedStatement pstmt=connection.prepareStatement(deleteTeacher_sql);
//为预编译参数赋值
pstmt.setInt(1,id);
//执行预编译对象的executeUpdate()方法,获取删除记录的行数
int affectedRowNum=pstmt.executeUpdate();
//关闭
JdbcHelper.close(pstmt,connection);
return affectedRowNum > 0;
}
}
| [
"1270644701@qq.com"
] | 1270644701@qq.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.