blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
42d2c5857c54c07778b35604bd5330e2c161360b
7619a471d660e0e4159b0b6eb96539914aa569e9
/src/main/java/clinica/repository/DispensacaoRepository.java
8d044258ff60339367b352c11a359fb5b9801ef0
[]
no_license
luansoares-o/DesafioBackEnd-Luan
042e2ae2e4db7c568893f7eca29423b8abfdfd53
1e6ec5c4820f26a3ed31d1b250d46a82e7865c4a
refs/heads/master
2021-05-04T04:18:18.208658
2018-02-05T16:26:20
2018-02-05T16:26:20
120,331,076
0
0
null
null
null
null
UTF-8
Java
false
false
443
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 clinica.repository; import clinica.Model.Dispensacao; import org.springframework.data.jpa.repository.JpaRepository; /** * * @author Luan */ public interface DispensacaoRepository extends JpaRepository<Dispensacao, Long>{ }
[ "Luan@192.168.25.232" ]
Luan@192.168.25.232
44c99f46321c74a966876a836c822ab70a438551
dc51ccbe867a788597de7eb7f1ce473cc3926824
/src/BadSuspend.java
03d85be63e467f5d421a62be500e5cc1c41a8f3a
[]
no_license
StaticWalk/thraed
342a0355923d90c3e6e809535717b1d9a0d4c08b
b9ef7b34a31d83557d93d384f2698812f728ae5f
refs/heads/master
2021-05-11T06:00:38.763588
2018-03-05T12:30:19
2018-03-05T12:30:19
117,977,438
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
/** * Created by xiongxiaoyu on 2018/1/11. */ public class BadSuspend { public static Object u=new Object(); static ChangeObjectThreader t1=new ChangeObjectThreader("t1"); static ChangeObjectThreader t2=new ChangeObjectThreader("t2"); public static class ChangeObjectThreader extends Thread{ public ChangeObjectThreader(String name){ super.setName(name); } @Override public void run(){ synchronized (u){ System.out.println("in "+getName()); Thread.currentThread().suspend(); } } } public static void main(String[] args) throws InterruptedException { t1.start(); Thread.sleep(1000); t2.start(); t1.resume(); t2.resume(); t1.join(); t2.join(); } }
[ "957400829@qq.com" ]
957400829@qq.com
02ac8f33d5401bbd56185c845801b57a810d281d
28b22f339af6cd584ae5f86e58f657d9b07a05d4
/app/src/main/java/com/bassbosster/slider/autoimageslider/IndicatorView/animation/controller/AnimationController.java
0e0e34b28469696f66cb57e2e5133b12586c61aa
[]
no_license
sudhirs745/Slider
064f9bc886a560329806b9b23ec3aaab58f2c83c
3b948aa0df6dfbf42b1c39deebe03cb86580bf83
refs/heads/master
2020-11-29T15:03:34.958913
2019-12-25T19:37:27
2019-12-25T19:37:27
230,145,789
0
0
null
null
null
null
UTF-8
Java
false
false
10,089
java
package com.bassbosster.slider.autoimageslider.IndicatorView.animation.controller; import androidx.annotation.NonNull; import com.bassbosster.slider.autoimageslider.IndicatorView.animation.controller.ValueController; import com.bassbosster.slider.autoimageslider.IndicatorView.animation.type.AnimationType; import com.bassbosster.slider.autoimageslider.IndicatorView.animation.type.BaseAnimation; import com.bassbosster.slider.autoimageslider.IndicatorView.draw.data.Indicator; import com.bassbosster.slider.autoimageslider.IndicatorView.draw.data.Orientation; import com.bassbosster.slider.autoimageslider.IndicatorView.utils.CoordinatesUtils; public class AnimationController { private ValueController valueController; private ValueController.UpdateListener listener; private BaseAnimation runningAnimation; private Indicator indicator; private float progress; private boolean isInteractive; public AnimationController(@NonNull Indicator indicator, @NonNull ValueController.UpdateListener listener) { this.valueController = new ValueController(listener); this.listener = listener; this.indicator = indicator; } public void interactive(float progress) { this.isInteractive = true; this.progress = progress; animate(); } public void basic() { this.isInteractive = false; this.progress = 0; animate(); } public void end() { if (runningAnimation != null) { runningAnimation.end(); } } private void animate() { AnimationType animationType = indicator.getAnimationType(); switch (animationType) { case NONE: listener.onValueUpdated(null); break; case COLOR: colorAnimation(); break; case SCALE: scaleAnimation(); break; case WORM: wormAnimation(); break; case FILL: fillAnimation(); break; case SLIDE: slideAnimation(); break; case THIN_WORM: thinWormAnimation(); break; case DROP: dropAnimation(); break; case SWAP: swapAnimation(); break; case SCALE_DOWN: scaleDownAnimation(); break; } } private void colorAnimation() { int selectedColor = indicator.getSelectedColor(); int unselectedColor = indicator.getUnselectedColor(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .color() .with(unselectedColor, selectedColor) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void scaleAnimation() { int selectedColor = indicator.getSelectedColor(); int unselectedColor = indicator.getUnselectedColor(); int radiusPx = indicator.getRadius(); float scaleFactor = indicator.getScaleFactor(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .scale() .with(unselectedColor, selectedColor, radiusPx, scaleFactor) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void wormAnimation() { int fromPosition = indicator.isInteractiveAnimation() ? indicator.getSelectedPosition() : indicator.getLastSelectedPosition(); int toPosition = indicator.isInteractiveAnimation() ? indicator.getSelectingPosition() : indicator.getSelectedPosition(); int from = CoordinatesUtils.getCoordinate(indicator, fromPosition); int to = CoordinatesUtils.getCoordinate(indicator, toPosition); boolean isRightSide = toPosition > fromPosition; int radiusPx = indicator.getRadius(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .worm() .with(from, to, radiusPx, isRightSide) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void slideAnimation() { int fromPosition = indicator.isInteractiveAnimation() ? indicator.getSelectedPosition() : indicator.getLastSelectedPosition(); int toPosition = indicator.isInteractiveAnimation() ? indicator.getSelectingPosition() : indicator.getSelectedPosition(); int from = CoordinatesUtils.getCoordinate(indicator, fromPosition); int to = CoordinatesUtils.getCoordinate(indicator, toPosition); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .slide() .with(from, to) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void fillAnimation() { int selectedColor = indicator.getSelectedColor(); int unselectedColor = indicator.getUnselectedColor(); int radiusPx = indicator.getRadius(); int strokePx = indicator.getStroke(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .fill() .with(unselectedColor, selectedColor, radiusPx, strokePx) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void thinWormAnimation() { int fromPosition = indicator.isInteractiveAnimation() ? indicator.getSelectedPosition() : indicator.getLastSelectedPosition(); int toPosition = indicator.isInteractiveAnimation() ? indicator.getSelectingPosition() : indicator.getSelectedPosition(); int from = CoordinatesUtils.getCoordinate(indicator, fromPosition); int to = CoordinatesUtils.getCoordinate(indicator, toPosition); boolean isRightSide = toPosition > fromPosition; int radiusPx = indicator.getRadius(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .thinWorm() .with(from, to, radiusPx, isRightSide) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void dropAnimation() { int fromPosition = indicator.isInteractiveAnimation() ? indicator.getSelectedPosition() : indicator.getLastSelectedPosition(); int toPosition = indicator.isInteractiveAnimation() ? indicator.getSelectingPosition() : indicator.getSelectedPosition(); int widthFrom = CoordinatesUtils.getCoordinate(indicator, fromPosition); int widthTo = CoordinatesUtils.getCoordinate(indicator, toPosition); int paddingTop = indicator.getPaddingTop(); int paddingLeft = indicator.getPaddingLeft(); int padding = indicator.getOrientation() == Orientation.HORIZONTAL ? paddingTop : paddingLeft; int radius = indicator.getRadius(); int heightFrom = radius * 3 + padding; int heightTo = radius + padding; long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .drop() .duration(animationDuration) .with(widthFrom, widthTo, heightFrom, heightTo, radius); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void swapAnimation() { int fromPosition = indicator.isInteractiveAnimation() ? indicator.getSelectedPosition() : indicator.getLastSelectedPosition(); int toPosition = indicator.isInteractiveAnimation() ? indicator.getSelectingPosition() : indicator.getSelectedPosition(); int from = CoordinatesUtils.getCoordinate(indicator, fromPosition); int to = CoordinatesUtils.getCoordinate(indicator, toPosition); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .swap() .with(from, to) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } private void scaleDownAnimation() { int selectedColor = indicator.getSelectedColor(); int unselectedColor = indicator.getUnselectedColor(); int radiusPx = indicator.getRadius(); float scaleFactor = indicator.getScaleFactor(); long animationDuration = indicator.getAnimationDuration(); BaseAnimation animation = valueController .scaleDown() .with(unselectedColor, selectedColor, radiusPx, scaleFactor) .duration(animationDuration); if (isInteractive) { animation.progress(progress); } else { animation.start(); } runningAnimation = animation; } }
[ "sudhirs745@gmail.com" ]
sudhirs745@gmail.com
c6a221e3e055a8b27f022ee0f97768d232c95c41
7025e5f55cbc1019c2920b3a63c2ca151e1f1c1d
/app/src/main/java/com/example/zpf/animmenu/ChartActivity.java
066df3101d2c6505be8875c83e5a61778d99f504
[]
no_license
nsacer/AnimMenu
98c31db4c56fba14ef39116fff1fa05dafff5e4c
e5f0c56c18c90c2deb1ac32245bea82facdf5f02
refs/heads/master
2021-07-19T00:11:33.855278
2021-01-28T04:13:12
2021-01-28T04:13:12
94,008,312
1
1
null
null
null
null
UTF-8
Java
false
false
8,162
java
package com.example.zpf.animmenu; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.graphics.BitmapFactory; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.animation.AccelerateDecelerateInterpolator; import android.widget.Button; import android.widget.EditText; import android.widget.PopupWindow; import android.widget.TextView; import org.xutils.view.annotation.ContentView; import org.xutils.view.annotation.Event; import customview.CircleRingGraph; import customview.CircleView; import customview.ProgressScore; import customview.SpiderChart; import customview.TextDiagram; import customview.TurtleGraph; import utils.DisplayUtil; @ContentView(R.layout.activity_chart) public class ChartActivity extends BaseActivity implements View.OnClickListener { private TextView tvNumberChange; private CircleView circleView; private CircleRingGraph circleRingGraph; private EditText etProgress; private TurtleGraph turtleGraph; /** spiderchart数据 */ private static final float[] spiderData = new float[] {96, 88, 60, 20, 46}; private SpiderChart spiderChart; /** TextDiagram */ private TextDiagram td; private PopupWindow popWin = new PopupWindow(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initView(); } private void initView() { initViewOne(); initViewTwo(); initViewThree(); initViewFour(); initViewFive(); initPopWindow(); initTextDiagram(); } /////////////////////--------字母变换动画--------////////////////////// /** */ private void initViewOne() { Button btnOne = (Button) findViewById(R.id.btn_start_anim_one); btnOne.setOnClickListener(this); //转换TextView显示 TextView tvCharInfo = (TextView) findViewById(R.id.tv_char_info); char temp = 'A'; int startI = temp; temp = 'a'; int starti = temp; temp = 'Z'; int endZ = temp; temp = 'z'; int endz = temp; String sInfo = "A -> " + startI + " | a -> " + starti + " | Z -> " + endZ + " | z -> " + endz; tvCharInfo.setText(sInfo); //动态显示TextView tvNumberChange = (TextView) findViewById(R.id.tv_number); } /** * 从A -> Z 动画变换的Evaluator */ private class CharEvaluator implements TypeEvaluator<Character> { @Override public Character evaluate(float fraction, Character startValue, Character endValue) { int startI = startValue; int endI = endValue; int curI = (int) (startI + fraction * (endI - startI)); return (char) curI; } } /** * 从A -> Z 变换动画 */ private void doCharChangeAnim() { ValueAnimator animator = ValueAnimator.ofObject(new CharEvaluator(), 'A', 'Z'); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { char result = (char) animation.getAnimatedValue(); tvNumberChange.setText(String.valueOf(result)); } }); animator.setDuration(3000); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.start(); } /////////////////////--------圆形缩放动画--------////////////////////// private void initViewTwo() { Button btnTwo = (Button) findViewById(R.id.btn_start_anim_two); btnTwo.setOnClickListener(this); circleView = (CircleView) findViewById(R.id.circle_view); } /////////////////////--------进度条动画--------////////////////////// private void initViewThree() { Button btnThree = (Button) findViewById(R.id.btn_start_anim_three); btnThree.setOnClickListener(this); circleRingGraph = (CircleRingGraph) findViewById(R.id.circle_ring_progress); etProgress = (EditText) findViewById(R.id.et_progress); } /////////////////////--------TurtleGraph--------////////////////////// private void initViewFour() { Button btnTurtle = (Button) findViewById(R.id.btn_start_anim_four); btnTurtle.setOnClickListener(this); Button btnCancel = (Button) findViewById(R.id.btn_cancel_anim_four); btnCancel.setOnClickListener(this); turtleGraph = (TurtleGraph) findViewById(R.id.turtle_graph); } /////////////////////--------SpiderChart--------////////////////////// private void initViewFive() { spiderChart = (SpiderChart) findViewById(R.id.spiderChart); spiderChart.setOnClickListener(this); (findViewById(R.id.btn_spider_anim)).setOnClickListener(this); } ////////////////////---------横向柱状图对比---------/////////////////////// private void initTextDiagram() { td = (TextDiagram) findViewById(R.id.td); td.setContent("this is the bottom"); td.setStockName("重阳股份", "汾酒集团"); // td.setStockValue("12.69", "36.08", true); td.setStockValue("12.69", "-36.08", true); // td.setStockValue("-12.69", "-36.08", true); findViewById(R.id.btn_td_anim).setOnClickListener(this); } /** * Button Click Event */ @Override public void onClick(View v) { switch (v.getId()) { case R.id.btn_start_anim_one: doCharChangeAnim(); break; case R.id.btn_start_anim_two: circleView.doAnimation(); break; case R.id.btn_start_anim_three: if (TextUtils.isEmpty(etProgress.getText())) Snackbar.make(v, "请输入0~360之间的数", Snackbar.LENGTH_SHORT).show(); else circleRingGraph.setProgress(Integer.parseInt(etProgress.getText().toString())); break; case R.id.btn_start_anim_four: turtleGraph.doAnimator(); break; case R.id.btn_cancel_anim_four: turtleGraph.cancelAnimator(); break; case R.id.spiderChart: showPopWindow(); break; case R.id.btn_spider_anim: spiderChart.doAnimation(spiderData); break; case R.id.btn_td_anim: td.startAnimation(); break; default: break; } } /** * 初始化PopWindow */ private void initPopWindow() { View view = LayoutInflater.from(this).inflate(R.layout.pop_window_layout, null); view.findViewById(R.id.iv_close_pop).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { popWin.dismiss(); } }); popWin.setWidth(Info.DISPLAY_SCREEN_WIDTH - DisplayUtil.dip2px(this, 32)); popWin.setHeight(Info.DISPLAY_SCREEN_HEIGHT * 8 / 11); popWin.setContentView(view); popWin.setAnimationStyle(R.style.PopWindowAnimation); } /** * show popWin */ private void showPopWindow() { if (!popWin.isShowing()) popWin.showAtLocation(((ViewGroup) findViewById(android.R.id.content)).getChildAt(0), Gravity.BOTTOM, 0, 0); } @Event(R.id.btn_progress_score_anim) private void startProgressScore(View view) { ProgressScore progressScore = (ProgressScore) findViewById(R.id.progress_score); progressScore.setBitmapIndicatorHead(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_cat)); progressScore.setProgressAndStartAnim(120); } }
[ "1250855973@qq.com" ]
1250855973@qq.com
93912569ac252d7f8e593f277f7c8399b700a244
34da63814aa5b614e6fbfcda41e8cdeab3bd781c
/languages/cypher/source_gen/neo4j/cypher/behavior/IOrderByExpression_BehaviorDescriptor.java
074e239474b2dfcdc1e3ae95c468cac529e4d267
[]
no_license
rduga/Neo4jCypher
e03570903510d217a7d707de3100521e38cbcf49
37099407d7bfa1bfc0fb18ed9eab1f2f17c38316
refs/heads/master
2020-05-19T07:42:42.358882
2013-12-05T14:38:45
2013-12-05T14:38:45
9,096,506
2
4
null
null
null
null
UTF-8
Java
false
false
115
java
package neo4j.cypher.behavior; /*Generated by MPS */ public interface IOrderByExpression_BehaviorDescriptor { }
[ "radooo.php5@gmail.com" ]
radooo.php5@gmail.com
06bab0014f729f8002bab82466fadf44664b9e53
e1d52ea506dafa0c473e0ddb716a274a364a95f5
/Grammar/co.edu.uniandes.gramaticaPayments.ui/xtend-gen/co/edu/uniandes/ui/quickfix/PagosQuickfixProvider.java
f90cdb2b27617581e4cadc9db8a77280cc7c94f0
[]
no_license
MISO-MDE/PILA
6401ced52866d828ffc798fea55096e39dd67dc6
6c51ec2ec6f4946917429ad16b520872bfc9f8fd
refs/heads/master
2020-05-23T08:12:53.967638
2016-12-01T17:49:52
2016-12-01T17:49:52
70,280,425
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
/** * generated by Xtext 2.10.0 */ package co.edu.uniandes.ui.quickfix; import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider; /** * Custom quickfixes. * * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#quick-fixes */ @SuppressWarnings("all") public class PagosQuickfixProvider extends DefaultQuickfixProvider { }
[ "gab.zapata@uniandes.edu.co" ]
gab.zapata@uniandes.edu.co
c3ad4a25d32cd9afc0b99afc19228060d7c14514
65c32a90494fda22e529a49884755105fab5e256
/plugins/org.apache.karaf.eik.felix/src/main/java/org/apache/karaf/eik/felix/Activator.java
0f2eedae763c2a8c5ae1f01c1fc0922a0dd5ca20
[ "Apache-2.0" ]
permissive
kidaak/karaf-eik
4519dc74f5b129123ff6cc3aefc840ffd16dff4e
68b656ccd180829fae056d6f57c4eab6b252375b
refs/heads/master
2020-12-14T09:54:53.466543
2015-12-11T15:48:10
2015-12-11T15:48:10
47,835,113
0
0
null
2015-12-11T15:43:27
2015-12-11T15:43:27
null
UTF-8
Java
false
false
1,633
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.karaf.eik.felix; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; /** * The activator class controls the plug-in life cycle */ public class Activator extends AbstractUIPlugin { // The plug-in ID public static final String PLUGIN_ID = "org.apache.karaf.eik.felix"; // The shared instance private static Activator plugin; /** * The constructor */ public Activator() { } @Override public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } @Override public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); } /** * Returns the shared instance * * @return the shared instance */ public static Activator getDefault() { return plugin; } }
[ "kidakadeshia@gmail.com" ]
kidakadeshia@gmail.com
f2c852b06dd0d7115bc2d4219f128f7bb7a955da
faaaa66643d91c147a4ef32227d478c274a06147
/src/Mains/JazzForMax.java
a6a0670b24ccc5505d25647dd826ef508f327892
[]
no_license
EDBE/RM_Shimon_Dev
53f5a21fbf8d4068510a86cc8d5a46d4de719e5d
8e9d7ac62fb1e4783b4bf91bdcaa484c88fa3e00
refs/heads/master
2021-04-26T14:56:11.046049
2015-11-24T01:15:39
2015-11-24T01:15:39
46,766,118
0
0
null
null
null
null
UTF-8
Java
false
false
14,081
java
package Mains; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.Callable; import InputOutput.ReadFile; import Jazz.Jazz; import Jazz.PhraseParameters; import Jazz.Chords; import Jazz.ScaleTheory; import com.cycling74.max.*; public class JazzForMax extends MaxObject { Jazz jazzGenerator; List<Integer> phrase; List<Integer> harmonyRoots; List<String> harmonyTypes; List<Integer> melodyNotes; List<Integer> scaleSequence; List<List<Integer>> phraseLocations; int phraseNum; Chords chords = new Chords(); ScaleTheory scaleTheory = new ScaleTheory(); Integer lastRoot = -1; String lastType = ""; Random rand = new Random(); PhraseParameters phraseVars = new PhraseParameters(); List<PhraseParameters> phraseParams; //script variables int[][] instructions; int instructionCount = 0; int timeUnitCount = 1; int[][] improvInstructions; int improvInstructionCount = 0; int step = 0,stepMin=0,stepMax = 10; //outlets int PITCH_PARAM = 4; int COLOR_PARAM = 5; int HARMONIC_PARAM = 6; int DENSITY_PARAM = 7; int COMPLEXITY_PARAM = 8; int[] ARM_COMMANDS = new int[]{9,10,11,12}; boolean playingBafana=false; public JazzForMax(Atom[] args) { declareInlets(new int[]{DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL}); declareOutlets(new int[]{DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL,DataTypes.ALL}); } public void bang() { if(lastType.equalsIgnoreCase(harmonyTypes.get(step))!=true || lastRoot!= harmonyRoots.get(step)){ //if(rand.nextFloat() <.1){ int[] chordNotes = chords.chordTexts.get(harmonyTypes.get(step)); for(int i=0;i<chordNotes.length;i++){ if(chordNotes[i] == 1){ outlet(2,harmonyRoots.get(step)+i); } } } lastType = harmonyTypes.get(step); lastRoot = harmonyRoots.get(step); String tempString = chords.rootNames.get(harmonyRoots.get(step))+" " +scaleTheory.scales.get(scaleSequence.get(step)); outlet(3,"set",tempString); /* if(melodyNotes.get(step)!=-1){ outlet(1,127); }else{ outlet(1,100); }*/ if(phrase.get(step)!=-1){ outlet(1,127); outlet(0,phrase.get(step)); } step++; if(step >=stepMax){ step=stepMin; } } public void goToStep(int i){ step = i; } public void inlet(int i) { if(playingBafana == true){ } } /* public void inlet(float f) { int inlet = getInlet(); switch(inlet){ case 0: phraseVars.pitchWeight = f; break; case 1: phraseVars.colorWeight = f; break; case 2: phraseVars.densityWeight = f; break; case 3: phraseVars.complexityWeight = f; break; case 4: phraseVars.harmonicTensionWeight = f; break; } } */ /* public void list(Atom[] list) { int inlet = getInlet(); switch(inlet){ case 0: for(int i=0;i<list.length;i++){ phraseVars.pitchContours[i] = list[i].toFloat(); } break; case 1: for(int i=0;i<list.length;i++){ phraseVars.colorContours[i] = list[i].toFloat(); } break; case 2: for(int i=0;i<list.length;i++){ phraseVars.densityContours[i] = list[i].toFloat(); } break; case 3: for(int i=0;i<list.length;i++){ phraseVars.complexityContours[i] = list[i].toFloat(); } break; case 4: for(int i=0;i<list.length;i++){ phraseVars.harmonicTensionContours[i] = list[i].toFloat(); } break; } } */ public void inlet(float f) { int inlet = getInlet(); switch(inlet){ case 0: phraseParams.get(phraseNum).pitchWeight = f; break; case 1: phraseParams.get(phraseNum).colorWeight = f; break; case 2: phraseParams.get(phraseNum).densityWeight = f; break; case 3: phraseParams.get(phraseNum).complexityWeight = f; break; case 4: phraseParams.get(phraseNum).harmonicTensionWeight = f; break; } } public void list(Atom[] list) { int inlet = getInlet(); switch(inlet){ case 0: for(int i=0;i<list.length;i++){ phraseParams.get(phraseNum).pitchContours[i] = list[i].toFloat(); } break; case 1: for(int i=0;i<list.length;i++){ phraseParams.get(phraseNum).colorContours[i] = list[i].toFloat(); } break; case 2: for(int i=0;i<list.length;i++){ phraseParams.get(phraseNum).densityContours[i] = list[i].toFloat(); } break; case 3: for(int i=0;i<list.length;i++){ phraseParams.get(phraseNum).complexityContours[i] = list[i].toFloat(); } break; case 4: for(int i=0;i<list.length;i++){ phraseParams.get(phraseNum).harmonicTensionContours[i] = list[i].toFloat(); } break; } } public void createPhrase(){ //phrase = jazzGenerator.generatePhrase(phraseVars); harmonyRoots = jazzGenerator.getHarmonyRoots(); harmonyTypes = jazzGenerator.getHarmonyTypes(); //melodyNotes = jazzGenerator.getMelodyNotes(); scaleSequence = jazzGenerator.getScaleSequence(); } public void createRhythmicPhrase(){ jazzGenerator.generateRhythmicPhrase1(phraseVars); } public void createImprovisation(){ phrase = jazzGenerator.generatePhrases(phraseLocations,phraseParams); harmonyRoots = jazzGenerator.getHarmonyRoots(); harmonyTypes = jazzGenerator.getHarmonyTypes(); scaleSequence = jazzGenerator.getScaleSequence(); } public void segmentPhrases(){ phraseLocations = jazzGenerator.segmentSongIntoPhrases(); System.out.println("total phrases = " + phraseLocations.size()); phraseParams = new ArrayList<PhraseParameters>(); for(int i=0;i<phraseLocations.size();i++){ phraseParams.add(new PhraseParameters()); } } public void setPhraseNum(int phraseNum){ this.phraseNum = phraseNum; System.out.println(phraseLocations.get(phraseNum)); outlet(PITCH_PARAM,phraseParams.get(phraseNum).pitchContours); outlet(COLOR_PARAM,phraseParams.get(phraseNum).colorContours); outlet(HARMONIC_PARAM,phraseParams.get(phraseNum).harmonicTensionContours); outlet(DENSITY_PARAM,phraseParams.get(phraseNum).densityContours); outlet(COMPLEXITY_PARAM,phraseParams.get(phraseNum).complexityContours); } public void playPhrase(int phraseNum){ stepMin = phraseLocations.get(phraseNum).get(0)*12; stepMax = phraseLocations.get(phraseNum).get(1)*12; step = stepMin; } public void playSong(){ stepMin = 0; stepMax = phrase.size(); step = stepMin; } public void updatePhrase(){ phrase = jazzGenerator.updatePhrase(phraseLocations.get(phraseNum), phraseParams.get(phraseNum)); } // // public void loadScript(){ // // //ReadFile fileReader = new ReadFile("/Users/masonbretan/Desktop/songScript109_4.txt"); //dance of jupiter and venus // ReadFile fileReader = new ReadFile("/Users/masonbretan//iltur_short.txt"); //iltur // List<String> lines = new ArrayList<String>(fileReader.getLines()); // instructions = fileReader.interpretScript(lines); // System.out.println("melody script loaded, instruction count = "+instructions.length); // // // // fileReader = new ReadFile("/Users/masonbretan/Desktop/improvScript.txt"); // lines = new ArrayList<String>(fileReader.getLines()); // improvInstructions = fileReader.interpretScript(lines); // System.out.println("improv script loaded, instruction count = "+improvInstructions.length); // // } public void loadJupiter(){ ReadFile fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/dance of jupiter and venus/songScript109_4.txt"); List<String> lines = new ArrayList<String>(fileReader.getLines()); instructions = fileReader.interpretScript(lines); System.out.println("jupiter melody script loaded, instruction count = "+instructions.length); fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/dance of jupiter and venus/improvScript.txt"); lines = new ArrayList<String>(fileReader.getLines()); improvInstructions = fileReader.interpretScript(lines); System.out.println("jupiter improv script loaded, instruction count = "+improvInstructions.length); } // public void loadIltur_Short(){ // // ReadFile fileReader = new ReadFile("/Users/masonbretan/Desktop/iltur3 Today Show/Tiltur_short.txt"); //iltur // List<String> lines = new ArrayList<String>(fileReader.getLines()); // instructions = fileReader.interpretScript(lines); // System.out.println("iltur_short melody script loaded, instruction count = "+instructions.length); // } // public void loadIltur2(){ ReadFile fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/iltur 2/iltur2Script.txt"); //iltur List<String> lines = new ArrayList<String>(fileReader.getLines()); System.out.println(lines.size()); instructions = fileReader.interpretScript(lines); System.out.println("iltur2 melody/improv script loaded, instruction count = "+instructions.length); } // public void loadPitty(){ // // ReadFile fileReader = new ReadFile("/Users/masonbretan/Desktop/pittyScript.txt"); //iltur // List<String> lines = new ArrayList<String>(fileReader.getLines()); // instructions = fileReader.interpretScript(lines); // System.out.println("pitty melody script loaded, instruction count = "+instructions.length); // } // public void loadSteadyAsSheGoes(){ ReadFile fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/steady as she goes/steady as she goes script.txt"); //iltur List<String> lines = new ArrayList<String>(fileReader.getLines()); instructions = fileReader.interpretScript(lines); System.out.println("steady as she goes marimba script loaded, instruction count = "+instructions.length); } public void loadIltur3(){ ReadFile fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/iltur 3/iltur3 Script.txt"); //iltur List<String> lines = new ArrayList<String>(fileReader.getLines()); System.out.println(lines.size()); instructions = fileReader.interpretScript(lines); System.out.println("iltur3 melody script loaded, instruction count = "+instructions.length); } public void loadWhatYouSay(){ ReadFile fileReader = new ReadFile("/Users/musictechnology/Documents/IntelliJ_Shimon/Songs/what you say/whatyousay_script.txt"); //iltur List<String> lines = new ArrayList<String>(fileReader.getLines()); System.out.println(lines.size()); instructions = fileReader.interpretScript(lines); System.out.println("what you say melody script loaded, instruction count = "+instructions.length); } public void initializeScript(){ instructionCount = 0; improvInstructionCount = 0; timeUnitCount=1; outputArmCommands(0); } public void performScript(){ if(instructionCount < instructions.length){ outputArmCommands(instructionCount); instructionCount++; System.out.println("instruction count = "+ instructionCount); } /*if(instructionCount < instructions.length){ if(timeUnitCount == instructions[instructionCount][6]){ outputArmCommands(instructionCount); instructionCount++; } } timeUnitCount++; */ } public void performNonMidiScript(){ if(instructionCount < instructions.length){ if(timeUnitCount == instructions[instructionCount][6]){ outputArmCommands(instructionCount); instructionCount++; } } timeUnitCount++; } public void playInstructionCount(int count){ //outputArmCommands(i); System.out.println("playing instruction count " + count); instructionCount = count; timeUnitCount = instructions[instructionCount][6]; int[] command = new int[3]; for(int i=3;i>-1;i--){ if(instructions[count][i]!=-1){ command[2] = 0; if(instructions[count][i] == instructions[count][4]){ command[2] = 115; } command[0] = i; command[1] = instructions[count][i]; outlet(ARM_COMMANDS[i],command); } } } private void outputArmCommands(int instructionCount){ int[] command = new int[3]; //arm, position and velocity if(instructionCount>=1){ for(int i=0;i<4;i++){ if(instructions[instructionCount][i]!=-1){ command[2] = 0; if(instructions[instructionCount][i] == instructions[instructionCount][4]){ command[2] = 110; } if(instructions[instructionCount][i] != instructions[instructionCount-1][i] || command[2] != 0){ command[0] = i; command[1] = instructions[instructionCount][i]; outlet(ARM_COMMANDS[i],command); } } } }else{ for(int i=3;i>-1;i--){ if(instructions[instructionCount][i]!=-1){ command[2] = 0; if(instructions[instructionCount][i] == instructions[instructionCount][4]){ command[2] = 115; } command[0] = i; command[1] = instructions[instructionCount][i]; outlet(ARM_COMMANDS[i],command); } } } } public void performImprovScript(){ if(improvInstructionCount < improvInstructions.length){ outputImprovArmCommands(improvInstructionCount); improvInstructionCount++; } } private void outputImprovArmCommands(int instructionCount){ int[] command = new int[3]; //arm, position and velocity if(instructionCount>=1){ for(int i=2;i<4;i++){ if(improvInstructions[instructionCount][i]!=-1){ command[2] = 0; if(improvInstructions[instructionCount][i] == improvInstructions[instructionCount][4]){ command[2] = 115; } if(improvInstructions[instructionCount][i] != improvInstructions[instructionCount-1][i] || command[2] != 0){ command[0] = i; command[1] = improvInstructions[instructionCount][i]; outlet(ARM_COMMANDS[i],command); } } } }else{ for(int i=3;i>-1;i--){ if(improvInstructions[instructionCount][i]!=-1){ command[2] = 0; if(improvInstructions[instructionCount][i] == improvInstructions[instructionCount][4]){ command[2] = 115; } command[0] = i; command[1] = improvInstructions[instructionCount][i]; outlet(ARM_COMMANDS[i],command); } } } } }
[ "ltangmt@gmail.com" ]
ltangmt@gmail.com
ff3b24912a1c98eade32923fd093ed3d3cacf944
9f65935b36c4bc42ec8d2569d1573413a53400ec
/Wearable/src/main/java/com/example/android/sunshine/app/MyWatchFace.java
1dc0d25d14a60fed49856cd141afdb50e66e5284
[ "Apache-2.0" ]
permissive
duvernea/Sunshine
f8f306abe93ac581266da461efe5f9f1096d4da5
c93112d969da2e30fb5f83b7bb86fdab6847a360
refs/heads/master
2021-01-21T14:09:00.429718
2016-05-08T12:35:50
2016-05-08T12:35:50
54,609,533
0
1
null
null
null
null
UTF-8
Java
false
false
19,663
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.sunshine.app; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.support.v4.content.res.ResourcesCompat; import android.support.wearable.watchface.CanvasWatchFaceService; import android.support.wearable.watchface.WatchFaceStyle; import android.text.format.Time; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.SurfaceHolder; import android.view.WindowInsets; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.wearable.DataApi; import com.google.android.gms.wearable.DataEvent; import com.google.android.gms.wearable.DataEventBuffer; import com.google.android.gms.wearable.DataItem; import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMapItem; import com.google.android.gms.wearable.Wearable; import java.lang.ref.WeakReference; import java.util.TimeZone; import java.util.concurrent.TimeUnit; /** * Digital watch face with seconds. In ambient mode, the seconds aren't displayed. On devices with * low-bit ambient mode, the text is drawn without anti-aliasing in ambient mode. */ public class MyWatchFace extends CanvasWatchFaceService { private static final String TAG = MyWatchFace.class.getSimpleName(); private static final Typeface NORMAL_TYPEFACE = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL); /** * Update rate in milliseconds for interactive mode. Currently updates every 10 seconds */ private static final long INTERACTIVE_UPDATE_RATE_MS = TimeUnit.SECONDS.toMillis(10); /** * Handler message id for updating the time periodically in interactive mode. */ private static final int MSG_UPDATE_TIME = 0; public static final String KEY_MIN_TEMP = "min_temp"; public static final String KEY_MAX_TEMP = "max_temp"; public static final String KEY_WEATHER_CONDITION_ID = "weather_id"; @Override public Engine onCreateEngine() { return new Engine(); } private static class EngineHandler extends Handler { private final WeakReference<MyWatchFace.Engine> mWeakReference; public EngineHandler(MyWatchFace.Engine reference) { mWeakReference = new WeakReference<>(reference); } @Override public void handleMessage(Message msg) { MyWatchFace.Engine engine = mWeakReference.get(); if (engine != null) { switch (msg.what) { case MSG_UPDATE_TIME: engine.handleUpdateTimeMessage(); break; } } } } private class Engine extends CanvasWatchFaceService.Engine implements DataApi.DataListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { final Handler mUpdateTimeHandler = new EngineHandler(this); boolean mRegisteredTimeZoneReceiver = false; private static final String DEGREE_SYMBOL = "\u00b0"; Paint mBackgroundPaint; Paint mTextWhitePaint; Paint mTextLightPaint; Paint mTextMaxTempPaint; Paint mTextMinTempPaint; boolean mAmbient; Time mTime; final BroadcastReceiver mTimeZoneReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { //TODO Time classes used in this example are different than the watch face sample. Which impelemntation is better? mTime.clear(intent.getStringExtra("time-zone")); mTime.setToNow(); } }; private Integer mMinTemp; private Integer mMaxTemp; private Integer mWeatherId; private float mTimeWidth; private float mDateWidth; private float mTimeHeight; private float mDateHeight; private float mMaxTempWidth; private float mMinTempWidth; private float mMaxTempHeight; GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(MyWatchFace.this) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .addApi(Wearable.API) .build(); /** * Whether the display supports fewer bits for each color in ambient mode. When true, we * disable anti-aliasing in ambient mode. */ boolean mLowBitAmbient; @Override public void onCreate(SurfaceHolder holder) { super.onCreate(holder); setWatchFaceStyle(new WatchFaceStyle.Builder(MyWatchFace.this) .setCardPeekMode(WatchFaceStyle.PEEK_MODE_VARIABLE) .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE) .setShowSystemUiTime(false) .setAcceptsTapEvents(true) .setStatusBarGravity(Gravity.LEFT | Gravity.TOP) //.setHotwordIndicatorGravity(Gravity.RIGHT | Gravity.TOP) .build()); Resources resources = MyWatchFace.this.getResources(); mBackgroundPaint = new Paint(); mBackgroundPaint.setColor(resources.getColor(R.color.primary)); mTextWhitePaint = new Paint(); mTextWhitePaint = createTextPaint(resources.getColor(R.color.digital_text)); mTextLightPaint = new Paint(); mTextLightPaint = createTextPaint(resources.getColor(R.color.primary_light)); mTextMaxTempPaint = new Paint(); mTextMaxTempPaint = createTextPaint(resources.getColor(R.color.digital_text)); mTextMinTempPaint = new Paint(); mTextMinTempPaint = createTextPaint(resources.getColor(R.color.primary_light)); mTime = new Time(); } @Override public void onDestroy() { mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); super.onDestroy(); } private Paint createTextPaint(int textColor) { Paint paint = new Paint(); paint.setColor(textColor); paint.setTypeface(NORMAL_TYPEFACE); paint.setAntiAlias(true); return paint; } @Override public void onVisibilityChanged(boolean visible) { super.onVisibilityChanged(visible); Log.d(TAG, "onVisibilityChanged"); if (visible) { registerReceiver(); mGoogleApiClient.connect(); // Update time zone in case it changed while we weren't visible. mTime.clear(TimeZone.getDefault().getID()); mTime.setToNow(); } else { unregisterReceiver(); if (mGoogleApiClient != null && mGoogleApiClient.isConnected()) { Wearable.DataApi.removeListener(mGoogleApiClient, this); mGoogleApiClient.disconnect(); Log.d(TAG, "disconnecting GoogleApiClient"); } } // Whether the timer should be running depends on whether we're visible (as well as // whether we're in ambient mode), so we may need to start or stop the timer. updateTimer(); } private void registerReceiver() { if (mRegisteredTimeZoneReceiver) { return; } mRegisteredTimeZoneReceiver = true; IntentFilter filter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED); MyWatchFace.this.registerReceiver(mTimeZoneReceiver, filter); } private void unregisterReceiver() { if (!mRegisteredTimeZoneReceiver) { return; } mRegisteredTimeZoneReceiver = false; MyWatchFace.this.unregisterReceiver(mTimeZoneReceiver); } @Override public void onApplyWindowInsets(WindowInsets insets) { super.onApplyWindowInsets(insets); // Load resources that have alternate values for round watches. Resources resources = MyWatchFace.this.getResources(); boolean isRound = insets.isRound(); float textSize = resources.getDimension(isRound ? R.dimen.digital_text_size_round : R.dimen.digital_text_size); mTextWhitePaint.setTextSize(textSize); mTextLightPaint.setTextSize(resources.getDimension(R.dimen.date_text_size)); mTextMinTempPaint.setTextSize(resources.getDimension(R.dimen.min_temp_text_size)); mTextMaxTempPaint.setTextSize(resources.getDimension(R.dimen.max_temp_text_size)); mTimeHeight = mTextWhitePaint.getTextSize(); mDateHeight = mTextLightPaint.getTextSize(); mMaxTempHeight = mTextMaxTempPaint.getTextSize(); } @Override public void onPropertiesChanged(Bundle properties) { // method is called giving very special display support super.onPropertiesChanged(properties); Log.d(TAG, "onPropertiesChanged run.."); boolean burnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION, false); //TODO set typeface based on burnInProtection mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false); } @Override public void onTimeTick() { // this method is called in ambient mode once/minute super.onTimeTick(); // tell framework canvas needs to be redrawn (onDraw() method) invalidate(); } @Override public void onAmbientModeChanged(boolean inAmbientMode) { // called whenever a switch has been made between modes Log.d(TAG, "onAmbientModeChanged"); super.onAmbientModeChanged(inAmbientMode); if (mAmbient != inAmbientMode) { mAmbient = inAmbientMode; if (mLowBitAmbient) { mTextWhitePaint.setAntiAlias(!inAmbientMode); mTextLightPaint.setAntiAlias(!inAmbientMode); mTextMaxTempPaint.setAntiAlias(!inAmbientMode); mTextMinTempPaint.setAntiAlias(!inAmbientMode); } // force onDraw refresh after these changes if (!mAmbient) { } else { } invalidate(); } // Whether the timer should be running depends on whether we're visible (as well as // whether we're in ambient mode), so we may need to start or stop the timer. updateTimer(); } @Override public void onDraw(Canvas canvas, Rect bounds) { // onDraw is called alot, so should be efficient // it is called in both ambient and interactive mode Log.d(TAG, "onDraw"); int width = bounds.width(); int height = bounds.height(); // Draw the background. if (isInAmbientMode()) { canvas.drawColor(Color.BLACK); } else { canvas.drawRect(0, 0, width, height, mBackgroundPaint); } double centerX = width / 2f; double centerY = height / 2f; // Draw Line Separator int lineLength = width/4; canvas.drawLine((float) centerX-lineLength/2, (float) centerY, (float) centerX+lineLength/2, (float) centerY, mTextLightPaint); float topTextBaselineOffset = height/2/5; // Draw H:MM in ambient and interactive modes mTime.setToNow(); String time = String.format("%d:%02d", mTime.hour, mTime.minute); // Day of the week Integer weekDay = Utility.getDay(mTime.weekDay); String weekDayAbbrev; if (weekDay != null) { weekDayAbbrev = getResources().getString(weekDay); } else { weekDayAbbrev = ""; } // Month of the year Integer yearMonth = Utility.getMonth(mTime.month); String yearMonthAbbrev; // Calculate the positioning of time and date strings based on available space float topMargin = 30; // in pixels float dateMargin = (height/2 -mDateHeight - mTimeHeight - topMargin)/2; if (yearMonth != null) { yearMonthAbbrev = getResources().getString(yearMonth); } else { yearMonthAbbrev = ""; } String formattedDate = weekDayAbbrev + ", " + yearMonthAbbrev + " " + mTime.monthDay; // Measure the text to be drawn on the screen mTimeWidth = mTextWhitePaint.measureText(time); mDateWidth = mTextLightPaint.measureText(formattedDate); if (mMaxTemp != null && mMinTemp != null) { mMaxTempWidth = mTextMaxTempPaint.measureText(Integer.toString(mMaxTemp) + DEGREE_SYMBOL); mMinTempWidth = mTextMinTempPaint.measureText(Integer.toString(mMinTemp)+ DEGREE_SYMBOL); } // convert DP to pixels // Draw the top half of screen canvas.drawText(time, (float) centerX - mTimeWidth / 2, (float) centerY - dateMargin * 2 - mDateHeight, mTextWhitePaint); canvas.drawText(formattedDate, (float)centerX-mDateWidth/2, (float) centerY-dateMargin, mTextLightPaint); // Draw the bottom half of the screen, if not in ambient mode if (!isInAmbientMode()) { // Canvas uses px - need to convert from dp and do math in px Resources r = getResources(); int artMargin = (int) getResources().getDimension(R.dimen.art_margin_top); float artMarginPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, artMargin, r.getDisplayMetrics()); int art = (int) getResources().getDimension(R.dimen.weather_art_size); float artPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, art, r.getDisplayMetrics()); float offsetTextPx = (artPx - mMaxTempHeight) / 2f; float textBaselinePx = (float) centerY + artMarginPx + artPx - offsetTextPx; // equal spacing between art, int weatherInfoSpacing = (int) ((width - artPx - mMinTempWidth - mMaxTempWidth) / 4); if (mWeatherId != null) { int weatherImage = Utility.getArtResourceForWeatherCondition(mWeatherId); Drawable weatherArt = ResourcesCompat.getDrawable(getResources(), weatherImage, null); weatherArt.setBounds((int) (weatherInfoSpacing), (int) (centerY + artMarginPx), (int) (weatherInfoSpacing + artPx), (int) (centerY + artPx + artMarginPx)); weatherArt.draw(canvas); } if (mMaxTemp != null) { canvas.drawText(Integer.toString(mMaxTemp) + DEGREE_SYMBOL, (float) 2 * weatherInfoSpacing + artPx, textBaselinePx, mTextMaxTempPaint); } if (mMinTemp != null) { canvas.drawText(Integer.toString(mMinTemp) + DEGREE_SYMBOL, (float) 3 * weatherInfoSpacing + artPx + mMaxTempWidth, textBaselinePx, mTextMinTempPaint); } } } /** * Starts the {@link #mUpdateTimeHandler} timer if it should be running and isn't currently * or stops it if it shouldn't be running but currently is. */ private void updateTimer() { mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); if (shouldTimerBeRunning()) { mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME); } } /** * Returns whether the {@link #mUpdateTimeHandler} timer should be running. The timer should * only run when we're visible and in interactive mode. */ private boolean shouldTimerBeRunning() { return isVisible() && !isInAmbientMode(); } /** * Handle updating the time periodically in interactive mode. */ private void handleUpdateTimeMessage() { invalidate(); if (shouldTimerBeRunning()) { long timeMs = System.currentTimeMillis(); long delayMs = INTERACTIVE_UPDATE_RATE_MS - (timeMs % INTERACTIVE_UPDATE_RATE_MS); mUpdateTimeHandler.sendEmptyMessageDelayed(MSG_UPDATE_TIME, delayMs); } } @Override public void onConnected(Bundle bundle) { // called when connection to Google Play services is established Log.d(TAG, "onConnected running..."); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "onConnected: " + bundle); } // notify Google Play services that we are interested in listening for data layer events Wearable.DataApi.addListener(mGoogleApiClient, Engine.this); } @Override public void onConnectionSuspended(int i) { Log.d(TAG, "onConnectionSuspended running..."); } @Override public void onDataChanged(DataEventBuffer dataEventBuffer) { Log.d(TAG, "onDataChanged"); for (DataEvent event : dataEventBuffer) { DataItem dataItem = event.getDataItem(); DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItem); DataMap config = dataMapItem.getDataMap(); for (String configKey : config.keySet()) { if (configKey.equals(KEY_MIN_TEMP)) { mMinTemp = config.getInt(KEY_MIN_TEMP); } if (configKey.equals(KEY_MAX_TEMP)) { mMaxTemp = config.getInt(KEY_MAX_TEMP); } if (configKey.equals(KEY_WEATHER_CONDITION_ID)) { mWeatherId = config.getInt(KEY_WEATHER_CONDITION_ID); } } } } @Override public void onConnectionFailed(ConnectionResult connectionResult) { Log.d(TAG, "onConnectionFailed running..."); } } }
[ "duverneay@gmail.com" ]
duverneay@gmail.com
1342a062c430d9f26a9f11e1093ccbd1d71416ab
15ba5d990699e6b7b2ab91047b603608d678f592
/ks-enroll-api/src/main/java/org/kuali/student/enrollment/courseseatcount/service/CourseSeatCountService.java
f94a7137a3c9edf38e9bfb1b6eb5f2acfbe36580
[]
no_license
k2student/service-api
0e16b36069c4110d23c557b4bfd1c9fa29ad1b1d
a30fdeaf9a44350039676ea71251e5cf6d67a946
refs/heads/master
2021-01-10T19:50:51.911243
2014-12-03T21:26:32
2014-12-03T21:26:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
16,076
java
/** * Copyright 2014 The Kuali Foundation * * Licensed under the Educational Community 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.osedu.org/licenses/ECL-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.kuali.student.enrollment.courseseatcount.service; import org.kuali.rice.core.api.criteria.QueryByCriteria; import org.kuali.student.enrollment.courseseatcount.dto.CourseSeatCountInfo; import org.kuali.student.r2.common.dto.ContextInfo; import org.kuali.student.r2.common.dto.StatusInfo; import org.kuali.student.r2.common.dto.ValidationResultInfo; import org.kuali.student.r2.common.exceptions.DataValidationErrorException; import org.kuali.student.r2.common.exceptions.DoesNotExistException; import org.kuali.student.r2.common.exceptions.InvalidParameterException; import org.kuali.student.r2.common.exceptions.MissingParameterException; import org.kuali.student.r2.common.exceptions.OperationFailedException; import org.kuali.student.r2.common.exceptions.PermissionDeniedException; import org.kuali.student.r2.common.exceptions.ReadOnlyException; import org.kuali.student.r2.common.exceptions.VersionMismatchException; import javax.jws.WebParam; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import java.util.List; @WebService(name = "CourseSeatCountService", targetNamespace = CourseSeatCountServiceConstants.NAMESPACE) @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) public interface CourseSeatCountService { /** * Retrieves a Course Seat Count by ID * * @param courseSeatCountId the CourseSeatCount Id * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return the Person * @throws DoesNotExistException courseSeatCountId not found * @throws InvalidParameterException invalid courseSeatCountId or contextInfo * @throws MissingParameterException courseSeatCountId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public CourseSeatCountInfo getCourseSeatCount( @WebParam(name = "courseSeatCountId") String courseSeatCountId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Retrieves a list of courseSeatCounts by a list of CourseSeatCount IDs * * @param courseSeatCountIds a list of CourseSeatCount IDs * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return a List of CourseSeatCounts * @throws DoesNotExistException courseSeatCountId not found * @throws InvalidParameterException invalid courseSeatCountId or contextInfo * @throws MissingParameterException courseSeatCountId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<CourseSeatCountInfo> getCourseSeatCountsByIds( @WebParam(name = "courseSeatCountId") List<String> courseSeatCountIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Gets the CourseSeatCount for a particular activity. * * @param activityOfferingId the identifier for the activityOffering that you want the seatcount. * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return CourseSeatCount. * @throws InvalidParameterException activityOfferingId or contextInfo is not valid * @throws MissingParameterException activityOfferingId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public CourseSeatCountInfo getCourseSeatCountByActivityOffering( @WebParam(name = "activityOfferingId") String activityOfferingId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Gets the CourseSeatCount for a list of activitys. * * @param activityOfferingIds the identifier for the activityOfferings that you want the seatcounts. * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return CourseSeatCounts. * @throws InvalidParameterException activityOfferingId or contextInfo is not valid * @throws MissingParameterException activityOfferingId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<CourseSeatCountInfo> getSeatCountsByActivityOfferings( @WebParam(name = "activityOfferingIds") List<String> activityOfferingIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Retrieves a list of CourseSeatCount Ids by CourseSeatCount type. * * @param courseSeatCountTypeKey the personTypeKey to search by * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return a List of CourseSeatCount IDs * @throws DoesNotExistException courseSeatCountId not found * @throws InvalidParameterException invalid courseSeatCountId or contextInfo * @throws MissingParameterException courseSeatCountId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<String> getCourseSeatCountIdsByType( @WebParam(name = "courseSeatCountTypeKey") String courseSeatCountTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Searches for CourseSeatCount Ids based on the criteria and returns a list of CourseSeatCount identifiers which match the search criteria. * * @param criteria the search criteria * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return a List of CourseSeatCount IDs * @throws InvalidParameterException invalid criteria or contextInfo * @throws MissingParameterException courseSeatCountId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<String> searchForCourseSeatCountIds( @WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Searches for courseSeatCounts based on the criteria and returns a list of courseSeatCounts which match the search criteria. * * @param criteria the search criteria * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return a List of CourseSeatCount * @throws InvalidParameterException invalid courseSeatCountId or contextInfo * @throws MissingParameterException courseSeatCountId or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<CourseSeatCountInfo> searchForCourseSeatCounts( @WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Validates a CourseSeatCount. If an identifier is present for the CourseSeatCount and a record is found for that identifier, the validation * checks if the CourseSeatCount can be updated to the new values. If an identifier is not present or a record does not exist, the * validation checks if the CourseSeatCount with the given data can be created. * * @param validationTypeKey the identifier for the validation Type * @param courseSeatCountTypeKey the identifier for the person type key to be validated * @param courseSeatCountInfo the courseSeatCount to be validated * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return a list of validation results or an empty list if validation succeeded * @throws DoesNotExistException validationTypeKey or courseSeatCountTypeKey is not found * @throws InvalidParameterException courseSeatCountInfo or contextInfo is not valid * @throws MissingParameterException validationTypeKey, courseSeatCountTypeKey, courseSeatCountInfo, or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public List<ValidationResultInfo> validateCourseSeatCount( @WebParam(name = "validationTypeKey") String validationTypeKey, @WebParam(name = "courseSeatCountTypeKey") String courseSeatCountTypeKey, @WebParam(name = "courseSeatCountInfo") CourseSeatCountInfo courseSeatCountInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; /** * Creates a new CourseSeatCount. The CourseSeatCount Id, Type, and Meta information may not be set in the supplied data. * * @param courseSeatCountTypeKey the identifier for the person type to be validated * @param courseSeatCountInfo the courseSeatCount to be validated * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return the new CourseSeatCount * @throws DataValidationErrorException supplied data is invalid * @throws DoesNotExistException personTypeKey does not exist or is not supported * @throws InvalidParameterException personInfo or contextInfo is not valid * @throws MissingParameterException personTypeKey, personInfo, or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred * @throws ReadOnlyException an attempt at supplying information designated as read only */ public CourseSeatCountInfo createCourseSeatCount( @WebParam(name = "courseSeatCountTypeKey") String courseSeatCountTypeKey, @WebParam(name = "courseSeatCountInfo")CourseSeatCountInfo courseSeatCountInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException; /** * Updates an existing CourseSeatCount. The CourseSeatCount Id, Type, and Meta information may not be changed. * * @param courseSeatCountId the identifier for the CourseSeatCount to be updated * @param courseSeatCountInfo the courseSeatCount to be validated * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return the updated CourseSeatCount * @throws DataValidationErrorException supplied data is invalid * @throws DoesNotExistException courseSeatCountId is not found * @throws InvalidParameterException courseSeatCountId, courseSeatCountInfo or contextInfo is not valid * @throws MissingParameterException courseSeatCountId, courseSeatCountInfo, or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred * @throws ReadOnlyException an attempt at supplying information designated as read only * @throws VersionMismatchException if someone else has updated this courseSeatCount record since you fetched the version you are * updating. */ public CourseSeatCountInfo updateCourseSeatCount( @WebParam(name = "courseSeatCountId") String courseSeatCountId, @WebParam(name = "courseSeatCountInfo") CourseSeatCountInfo courseSeatCountInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException; /** * Deletes an existing CourseSeatCount and all it's related parts * * @param courseSeatCountId the identifier for the courseSeatCount to be deleted * @param contextInfo Context information containing the principalId and locale information about the caller of service * operation * @return the status of the delete operation. This must always be true. * @throws DoesNotExistException courseSeatCountInfo is not found * @throws InvalidParameterException courseSeatCountInfo or contextInfo is not valid * @throws MissingParameterException courseSeatCountInfo or contextInfo is missing or null * @throws OperationFailedException unable to complete request * @throws PermissionDeniedException an authorization failure occurred */ public StatusInfo deleteCourseSeatCount( @WebParam(name = "courseSeatCountId") String courseSeatCountId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; }
[ "rsarijlou@0ac02d80-fb3f-11dc-a574-c57244a850eb" ]
rsarijlou@0ac02d80-fb3f-11dc-a574-c57244a850eb
d176ebf2a7d4e1928d5bfd03334268de1d24fde9
519de3b9fca2d6f905e7f3498884094546432c30
/kk-4.x/frameworks/base/services/java/com/android/server/am/ProcessList.java
b828698aca8f89e401dd47e17321576a588c64bf
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
hongshui3000/mt5507_android_4.4
2324e078190b97afbc7ceca22ec1b87b9367f52a
880d4424989cf91f690ca187d6f0343df047da4f
refs/heads/master
2020-03-24T10:34:21.213134
2016-02-24T05:57:53
2016-02-24T05:57:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
24,631
java
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.am; import java.io.FileOutputStream; import java.io.IOException; import android.app.ActivityManager; import com.android.internal.util.MemInfoReader; import com.android.server.wm.WindowManagerService; import android.content.res.Resources; import android.graphics.Point; import android.os.SystemProperties; import android.util.Slog; import android.view.Display; /** * Activity manager code dealing with processes. */ final class ProcessList { // The minimum time we allow between crashes, for us to consider this // application to be bad and stop and its services and reject broadcasts. static final int MIN_CRASH_INTERVAL = 60*1000; // OOM adjustments for processes in various states: // Adjustment used in certain places where we don't know it yet. // (Generally this is something that is going to be cached, but we // don't know the exact value in the cached range to assign yet.) static final int UNKNOWN_ADJ = 16; // This is a process only hosting activities that are not visible, // so it can be killed without any disruption. static final int CACHED_APP_MAX_ADJ = 15; static final int CACHED_APP_MIN_ADJ = 9; // The B list of SERVICE_ADJ -- these are the old and decrepit // services that aren't as shiny and interesting as the ones in the A list. static final int SERVICE_B_ADJ = 8; // This is the process of the previous application that the user was in. // This process is kept above other things, because it is very common to // switch back to the previous app. This is important both for recent // task switch (toggling between the two top recent apps) as well as normal // UI flow such as clicking on a URI in the e-mail app to view in the browser, // and then pressing back to return to e-mail. static final int PREVIOUS_APP_ADJ = 7; // This is a process holding the home application -- we want to try // avoiding killing it, even if it would normally be in the background, // because the user interacts with it so much. static final int HOME_APP_ADJ = 6; // This is a process holding an application service -- killing it will not // have much of an impact as far as the user is concerned. static final int SERVICE_ADJ = 5; // This is a process with a heavy-weight application. It is in the // background, but we want to try to avoid killing it. Value set in // system/rootdir/init.rc on startup. static final int HEAVY_WEIGHT_APP_ADJ = 4; // This is a process currently hosting a backup operation. Killing it // is not entirely fatal but is generally a bad idea. static final int BACKUP_APP_ADJ = 3; // This is a process only hosting components that are perceptible to the // user, and we really want to avoid killing them, but they are not // immediately visible. An example is background music playback. static final int PERCEPTIBLE_APP_ADJ = 2; // This is a process only hosting activities that are visible to the // user, so we'd prefer they don't disappear. static final int VISIBLE_APP_ADJ = 1; // This is the process running the current foreground app. We'd really // rather not kill it! static final int FOREGROUND_APP_ADJ = 0; // This is a system persistent process, such as telephony. Definitely // don't want to kill it, but doing so is not completely fatal. static final int PERSISTENT_PROC_ADJ = -12; // The system process runs at the default adjustment. static final int SYSTEM_ADJ = -16; // Special code for native processes that are not being managed by the system (so // don't have an oom adj assigned by the system). static final int NATIVE_ADJ = -17; // Memory pages are 4K. static final int PAGE_SIZE = 4*1024; // The minimum number of cached apps we want to be able to keep around, // without empty apps being able to push them out of memory. static final int MIN_CACHED_APPS = 2; // The maximum number of cached processes we will keep around before killing them. // NOTE: this constant is *only* a control to not let us go too crazy with // keeping around processes on devices with large amounts of RAM. For devices that // are tighter on RAM, the out of memory killer is responsible for killing background // processes as RAM is needed, and we should *never* be relying on this limit to // kill them. Also note that this limit only applies to cached background processes; // we have no limit on the number of service, visible, foreground, or other such // processes and the number of those processes does not count against the cached // process limit. static final int MAX_CACHED_APPS = 24; // We allow empty processes to stick around for at most 30 minutes. static final long MAX_EMPTY_TIME = 30*60*1000; // The maximum number of empty app processes we will let sit around. private static final int MAX_EMPTY_APPS = computeEmptyProcessLimit(MAX_CACHED_APPS); // The number of empty apps at which we don't consider it necessary to do // memory trimming. static final int TRIM_EMPTY_APPS = MAX_EMPTY_APPS/2; // The number of cached at which we don't consider it necessary to do // memory trimming. static final int TRIM_CACHED_APPS = ((MAX_CACHED_APPS-MAX_EMPTY_APPS)*2)/3; // Threshold of number of cached+empty where we consider memory critical. static final int TRIM_CRITICAL_THRESHOLD = 3; // Threshold of number of cached+empty where we consider memory critical. static final int TRIM_LOW_THRESHOLD = 5; // These are the various interesting memory levels that we will give to // the OOM killer. Note that the OOM killer only supports 6 slots, so we // can't give it a different value for every possible kind of process. private final int[] mOomAdj = new int[] { FOREGROUND_APP_ADJ, VISIBLE_APP_ADJ, PERCEPTIBLE_APP_ADJ, BACKUP_APP_ADJ, CACHED_APP_MIN_ADJ, CACHED_APP_MAX_ADJ }; // These are the low-end OOM level limits. This is appropriate for an // HVGA or smaller phone with less than 512MB. Values are in KB. private final long[] mOomMinFreeLow = new long[] { 8192, 12288, 16384, 24576, 28672, 32768 }; // These are the high-end OOM level limits. This is appropriate for a // 1280x800 or larger screen with around 1GB RAM. Values are in KB. private final long[] mOomMinFreeHigh = new long[] { 49152, 61440, 73728, 86016, 98304, 122880 }; // The actual OOM killer memory levels we are using. private final long[] mOomMinFree = new long[mOomAdj.length]; private final long mTotalMemMb; private long mCachedRestoreLevel; private boolean mHaveDisplaySize; ProcessList() { MemInfoReader minfo = new MemInfoReader(); minfo.readMemInfo(); mTotalMemMb = minfo.getTotalSize()/(1024*1024); updateOomLevels(0, 0, false); } void applyDisplaySize(WindowManagerService wm) { if (!mHaveDisplaySize) { Point p = new Point(); wm.getBaseDisplaySize(Display.DEFAULT_DISPLAY, p); if (p.x != 0 && p.y != 0) { updateOomLevels(p.x, p.y, true); mHaveDisplaySize = true; } } } private void updateOomLevels(int displayWidth, int displayHeight, boolean write) { //MTK Modified Begin if ("true".equals(SystemProperties.get("ro.config.low_ram", "false"))) { //adjust the LMK minfree values, it seems LMK would be triggered when cached memory is smaller than each minfree value //(1M,12M,16M,24M,28M,32M)*3 /* mOomMinFree[0] = 1024*3; mOomMinFree[1] = 12288*3; mOomMinFree[2] = 16384*3; mOomMinFree[3] = 24576*3; mOomMinFree[4] = 28672*3; mOomMinFree[5] = 32768*3; */ mOomMinFree[0] = 1024*4; mOomMinFree[1] = 2048*4; mOomMinFree[2] = 4096*4; mOomMinFree[3] = 8192*4; mOomMinFree[4] = 10240*4; mOomMinFree[5] = 20480*4; } else { // Scale buckets from avail memory: at 300MB we use the lowest values to // 700MB or more for the top values. float scaleMem = ((float)(mTotalMemMb-300))/(700-300); // Scale buckets from screen size. int minSize = 480*800; // 384000 int maxSize = 1280*800; // 1024000 230400 870400 .264 float scaleDisp = ((float)(displayWidth*displayHeight)-minSize)/(maxSize-minSize); if (false) { Slog.i("XXXXXX", "scaleMem=" + scaleMem); Slog.i("XXXXXX", "scaleDisp=" + scaleDisp + " dw=" + displayWidth + " dh=" + displayHeight); } //StringBuilder adjString = new StringBuilder(); //StringBuilder memString = new StringBuilder(); float scale = scaleMem > scaleDisp ? scaleMem : scaleDisp; if (scale < 0) scale = 0; else if (scale > 1) scale = 1; int minfree_adj = Resources.getSystem().getInteger( com.android.internal.R.integer.config_lowMemoryKillerMinFreeKbytesAdjust); int minfree_abs = Resources.getSystem().getInteger( com.android.internal.R.integer.config_lowMemoryKillerMinFreeKbytesAbsolute); if (false) { Slog.i("XXXXXX", "minfree_adj=" + minfree_adj + " minfree_abs=" + minfree_abs); } for (int i=0; i<mOomAdj.length; i++) { long low = mOomMinFreeLow[i]; long high = mOomMinFreeHigh[i]; mOomMinFree[i] = (long)(low + ((high-low)*scale)); } if (minfree_abs >= 0) { for (int i=0; i<mOomAdj.length; i++) { mOomMinFree[i] = (long)((float)minfree_abs * mOomMinFree[i] / mOomMinFree[mOomAdj.length - 1]); } } if (minfree_adj != 0) { for (int i=0; i<mOomAdj.length; i++) { mOomMinFree[i] += (long)((float)minfree_adj * mOomMinFree[i] / mOomMinFree[mOomAdj.length - 1]); if (mOomMinFree[i] < 0) { mOomMinFree[i] = 0; } } } } // The maximum size we will restore a process from cached to background, when under // memory duress, is 1/3 the size we have reserved for kernel caches and other overhead // before killing background processes. mCachedRestoreLevel = (getMemLevel(ProcessList.CACHED_APP_MAX_ADJ)/1024) / 3; StringBuilder adjString = new StringBuilder(); StringBuilder memString = new StringBuilder(); for (int i=0; i<mOomAdj.length; i++) { if (i > 0) { adjString.append(','); memString.append(','); } adjString.append(mOomAdj[i]); memString.append((mOomMinFree[i]*1024)/PAGE_SIZE); } // Ask the kernel to try to keep enough memory free to allocate 3 full // screen 32bpp buffers without entering direct reclaim. int reserve = displayWidth * displayHeight * 4 * 3 / 1024; int reserve_adj = Resources.getSystem().getInteger(com.android.internal.R.integer.config_extraFreeKbytesAdjust); int reserve_abs = Resources.getSystem().getInteger(com.android.internal.R.integer.config_extraFreeKbytesAbsolute); if (reserve_abs >= 0) { reserve = reserve_abs; } if (reserve_adj != 0) { reserve += reserve_adj; if (reserve < 0) { reserve = 0; } } //Slog.i("XXXXXXX", "******************************* MINFREE: " + memString); if (write) { writeFile("/sys/module/lowmemorykiller/parameters/adj", adjString.toString()); writeFile("/sys/module/lowmemorykiller/parameters/minfree", memString.toString()); SystemProperties.set("sys.sysctl.extra_free_kbytes", Integer.toString(reserve)); } // GB: 2048,3072,4096,6144,7168,8192 // HC: 8192,10240,12288,14336,16384,20480 } public static int computeEmptyProcessLimit(int totalProcessLimit) { return (totalProcessLimit*2)/3; } private static String buildOomTag(String prefix, String space, int val, int base) { if (val == base) { if (space == null) return prefix; return prefix + " "; } return prefix + "+" + Integer.toString(val-base); } public static String makeOomAdjString(int setAdj) { if (setAdj >= ProcessList.CACHED_APP_MIN_ADJ) { return buildOomTag("cch", " ", setAdj, ProcessList.CACHED_APP_MIN_ADJ); } else if (setAdj >= ProcessList.SERVICE_B_ADJ) { return buildOomTag("svcb ", null, setAdj, ProcessList.SERVICE_B_ADJ); } else if (setAdj >= ProcessList.PREVIOUS_APP_ADJ) { return buildOomTag("prev ", null, setAdj, ProcessList.PREVIOUS_APP_ADJ); } else if (setAdj >= ProcessList.HOME_APP_ADJ) { return buildOomTag("home ", null, setAdj, ProcessList.HOME_APP_ADJ); } else if (setAdj >= ProcessList.SERVICE_ADJ) { return buildOomTag("svc ", null, setAdj, ProcessList.SERVICE_ADJ); } else if (setAdj >= ProcessList.HEAVY_WEIGHT_APP_ADJ) { return buildOomTag("hvy ", null, setAdj, ProcessList.HEAVY_WEIGHT_APP_ADJ); } else if (setAdj >= ProcessList.BACKUP_APP_ADJ) { return buildOomTag("bkup ", null, setAdj, ProcessList.BACKUP_APP_ADJ); } else if (setAdj >= ProcessList.PERCEPTIBLE_APP_ADJ) { return buildOomTag("prcp ", null, setAdj, ProcessList.PERCEPTIBLE_APP_ADJ); } else if (setAdj >= ProcessList.VISIBLE_APP_ADJ) { return buildOomTag("vis ", null, setAdj, ProcessList.VISIBLE_APP_ADJ); } else if (setAdj >= ProcessList.FOREGROUND_APP_ADJ) { return buildOomTag("fore ", null, setAdj, ProcessList.FOREGROUND_APP_ADJ); } else if (setAdj >= ProcessList.PERSISTENT_PROC_ADJ) { return buildOomTag("pers ", null, setAdj, ProcessList.PERSISTENT_PROC_ADJ); } else if (setAdj >= ProcessList.SYSTEM_ADJ) { return buildOomTag("sys ", null, setAdj, ProcessList.SYSTEM_ADJ); } else if (setAdj >= ProcessList.NATIVE_ADJ) { return buildOomTag("ntv ", null, setAdj, ProcessList.NATIVE_ADJ); } else { return Integer.toString(setAdj); } } public static String makeProcStateString(int curProcState) { String procState; switch (curProcState) { case -1: procState = "N "; break; case ActivityManager.PROCESS_STATE_PERSISTENT: procState = "P "; break; case ActivityManager.PROCESS_STATE_PERSISTENT_UI: procState = "PU"; break; case ActivityManager.PROCESS_STATE_TOP: procState = "T "; break; case ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND: procState = "IF"; break; case ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND: procState = "IB"; break; case ActivityManager.PROCESS_STATE_BACKUP: procState = "BU"; break; case ActivityManager.PROCESS_STATE_HEAVY_WEIGHT: procState = "HW"; break; case ActivityManager.PROCESS_STATE_SERVICE: procState = "S "; break; case ActivityManager.PROCESS_STATE_RECEIVER: procState = "R "; break; case ActivityManager.PROCESS_STATE_HOME: procState = "HO"; break; case ActivityManager.PROCESS_STATE_LAST_ACTIVITY: procState = "LA"; break; case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY: procState = "CA"; break; case ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT: procState = "Ca"; break; case ActivityManager.PROCESS_STATE_CACHED_EMPTY: procState = "CE"; break; default: procState = "??"; break; } return procState; } public static void appendRamKb(StringBuilder sb, long ramKb) { for (int j=0, fact=10; j<6; j++, fact*=10) { if (ramKb < fact) { sb.append(' '); } } sb.append(ramKb); } // The minimum amount of time after a state change it is safe ro collect PSS. public static final int PSS_MIN_TIME_FROM_STATE_CHANGE = 15*1000; // The maximum amount of time we want to go between PSS collections. public static final int PSS_MAX_INTERVAL = 30*60*1000; // The minimum amount of time between successive PSS requests for *all* processes. public static final int PSS_ALL_INTERVAL = 10*60*1000; // The minimum amount of time between successive PSS requests for a process. private static final int PSS_SHORT_INTERVAL = 2*60*1000; // The amount of time until PSS when a process first becomes top. private static final int PSS_FIRST_TOP_INTERVAL = 10*1000; // The amount of time until PSS when a process first goes into the background. private static final int PSS_FIRST_BACKGROUND_INTERVAL = 20*1000; // The amount of time until PSS when a process first becomes cached. private static final int PSS_FIRST_CACHED_INTERVAL = 30*1000; // The amount of time until PSS when an important process stays in the same state. private static final int PSS_SAME_IMPORTANT_INTERVAL = 15*60*1000; // The amount of time until PSS when a service process stays in the same state. private static final int PSS_SAME_SERVICE_INTERVAL = 20*60*1000; // The amount of time until PSS when a cached process stays in the same state. private static final int PSS_SAME_CACHED_INTERVAL = 30*60*1000; public static final int PROC_MEM_PERSISTENT = 0; public static final int PROC_MEM_TOP = 1; public static final int PROC_MEM_IMPORTANT = 2; public static final int PROC_MEM_SERVICE = 3; public static final int PROC_MEM_CACHED = 4; private static final int[] sProcStateToProcMem = new int[] { PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT PROC_MEM_PERSISTENT, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PROC_MEM_TOP, // ActivityManager.PROCESS_STATE_TOP PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_BACKUP PROC_MEM_IMPORTANT, // ActivityManager.PROCESS_STATE_HEAVY_WEIGHT PROC_MEM_SERVICE, // ActivityManager.PROCESS_STATE_SERVICE PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_RECEIVER PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_HOME PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_LAST_ACTIVITY PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT PROC_MEM_CACHED, // ActivityManager.PROCESS_STATE_CACHED_EMPTY }; private static final long[] sFirstAwakePssTimes = new long[] { PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_FIRST_TOP_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_BACKUP PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_HEAVY_WEIGHT PSS_FIRST_BACKGROUND_INTERVAL, // ActivityManager.PROCESS_STATE_SERVICE PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_RECEIVER PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_HOME PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_LAST_ACTIVITY PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT PSS_FIRST_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_EMPTY }; private static final long[] sSameAwakePssTimes = new long[] { PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_PERSISTENT_UI PSS_SHORT_INTERVAL, // ActivityManager.PROCESS_STATE_TOP PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_BACKUP PSS_SAME_IMPORTANT_INTERVAL, // ActivityManager.PROCESS_STATE_HEAVY_WEIGHT PSS_SAME_SERVICE_INTERVAL, // ActivityManager.PROCESS_STATE_SERVICE PSS_SAME_SERVICE_INTERVAL, // ActivityManager.PROCESS_STATE_RECEIVER PSS_SAME_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_HOME PSS_SAME_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_LAST_ACTIVITY PSS_SAME_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY PSS_SAME_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_ACTIVITY_CLIENT PSS_SAME_CACHED_INTERVAL, // ActivityManager.PROCESS_STATE_CACHED_EMPTY }; public static boolean procStatesDifferForMem(int procState1, int procState2) { return sProcStateToProcMem[procState1] != sProcStateToProcMem[procState2]; } public static long computeNextPssTime(int procState, boolean first, boolean sleeping, long now) { final long[] table = sleeping ? (first ? sFirstAwakePssTimes : sSameAwakePssTimes) : (first ? sFirstAwakePssTimes : sSameAwakePssTimes); return now + table[procState]; } long getMemLevel(int adjustment) { for (int i=0; i<mOomAdj.length; i++) { if (adjustment <= mOomAdj[i]) { return mOomMinFree[i] * 1024; } } return mOomMinFree[mOomAdj.length-1] * 1024; } /** * Return the maximum pss size in kb that we consider a process acceptable to * restore from its cached state for running in the background when RAM is low. */ long getCachedRestoreThresholdKb() { return mCachedRestoreLevel; } private void writeFile(String path, String data) { FileOutputStream fos = null; try { fos = new FileOutputStream(path); fos.write(data.getBytes()); } catch (IOException e) { Slog.w(ActivityManagerService.TAG, "Unable to write " + path); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } } } }
[ "342981011@qq.com" ]
342981011@qq.com
6a5cefd88ef584a665d9db7a713ef0d1e0e720e2
d27aac871660a8d1c5a6d5b7e61b40b376e957fc
/app/build/generated/source/buildConfig/test/debug/com/android/swipe/test/BuildConfig.java
0e4dfc74be72017bf7e495129a8c4f3f629664de
[]
no_license
binil1931/MachineTest_json_parsing_and_layout_animation
60e284ebc03580072f08e08459db689c75a0cdef
d921c87b0d95db9e6e03e8e6b87da58b92e9a774
refs/heads/master
2021-01-19T08:31:17.102797
2015-09-11T10:56:46
2015-09-11T10:56:46
42,303,386
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
/** * Automatically generated file. DO NOT MODIFY */ package com.android.swipe.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.android.swipe.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = -1; public static final String VERSION_NAME = ""; }
[ "binil1931@gmail.com" ]
binil1931@gmail.com
4cdc16d71b984d3da78fa66f8a9f36ab73aaa4d8
3dea1a7bd0722494144fda232cd51e5fcb6ad920
/publiclibrary/src/main/java/com/library/util/volley/FastStringRequest.java
8cd89ff5e29a68e5803bba34a0adb49299f5eb25
[]
no_license
luozhimin0918/KxtPkx
59b53259fcde26f6cdfeb835bac7831ab8307516
94e4fc15f1307d10fde73891d138ab8cf9307ae9
refs/heads/master
2021-01-23T07:26:57.698708
2017-03-28T06:52:09
2017-03-28T06:52:09
86,425,236
1
0
null
null
null
null
UTF-8
Java
false
false
2,291
java
package com.library.util.volley; import com.android.volley.NetworkResponse; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.toolbox.HttpHeaderParser; import java.io.UnsupportedEncodingException; import java.lang.reflect.Method; import java.util.Map; /** * @author Mr'Dai * @date 2016/5/18 14:26 * @Title: MobileLibrary * @Package com.dxmobile.library * @Description: */ public class FastStringRequest extends Request<String> { private Response.Listener<String> mSuccessListener; private Map<String, String> mParams; public FastStringRequest(String url, Response.Listener<String> listener, Response.ErrorListener errorListener) { this(Method.GET, url, null, listener, errorListener); } public FastStringRequest(int method, String url, Map<String, String> mParams, Response.Listener<String> listener, Response.ErrorListener errorListener) { super(method, url, errorListener); this.mSuccessListener = listener; this.mParams = mParams; } @Override protected void onFinish() { super.onFinish(); mSuccessListener = null; } @Override protected Response<String> parseNetworkResponse(NetworkResponse response) { String parsed; try { parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers)); } catch (UnsupportedEncodingException e) { parsed = new String(response.data); } return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response)); } /** * Subclasses must implement this to perform delivery of the parsed * response to their listeners. The given response is guaranteed to * be non-null; responses that fail to parse are not delivered. * * @param response The parsed response returned by * {@link #parseNetworkResponse(NetworkResponse)} */ @Override protected void deliverResponse(String response) { if (mSuccessListener != null) { mSuccessListener.onResponse(response); } } @Override public Map<String, String> getParams() { return mParams; } }
[ "54543534@domain.com" ]
54543534@domain.com
a4f10edfb309bf7df961b0febc7b40ee6e3718d0
6ce88a15d15fc2d0404243ca8415c84c8a868905
/bitcamp-java-basic/src/step23/ex02/Client3.java
f6f89495b3c62bd884c48874efaf3e804c5884d2
[]
no_license
SangKyeongLee/bitcamp
9f6992ce2f3e4425f19b0af19ce434c4864e610b
a26991752920f280f6404565db2b13a0c34ca3d9
refs/heads/master
2021-01-24T10:28:54.595759
2018-08-10T07:25:57
2018-08-10T07:25:57
123,054,474
0
0
null
null
null
null
UTF-8
Java
false
false
1,309
java
// 대기열 테스트 package step23.ex02; import java.io.PrintStream; import java.net.Socket; import java.util.Scanner; public class Client3 { public static void main(String[] args) throws Exception { Scanner keyScan = new Scanner(System.in); System.out.println("클라이언트 실행!"); keyScan.nextLine(); System.out.println("서버에 연결 요청 중..."); Socket socket = new Socket("localhost", 8888); System.out.println("서버에 연결됨!"); // 서버의 대기열에 접속 순서대로 대기한다. // 서버에서 연결이 승인되면, 비로서 입출력을 할 수 있다. PrintStream out = new PrintStream(socket.getOutputStream()); Scanner in = new Scanner(socket.getInputStream()); System.out.println("입출력 스트림 준비!"); System.out.println("서버에 데이터 전송중..."); out.println(args[0]); System.out.println("서버에 데이터 전송 완료!"); System.out.println("서버로부터 데이터 수신 중..."); System.out.println(in.nextLine()); System.out.println("서버로부터 데이터 수신 완료!"); // 자원해제 socket.close(); } }
[ "sangkyeong.lee93@gmail.com" ]
sangkyeong.lee93@gmail.com
8658e53998f497a864b2a3eef8e88aeefd7487d3
a20b7cb862153fc4063ca6410181ed93134c1fac
/CloneObjects.java
6034200b7d60644635510d271ecc004d311fbd18
[]
no_license
ShivamButale/Java
1a35cf95ad886ff5d5c275a9d3c4132387d47b6b
4cc93fc4add941dff97ed387f337c828b39eddfb
refs/heads/master
2021-06-03T09:21:36.835643
2020-07-28T16:29:23
2020-07-28T16:29:23
147,961,721
1
0
null
null
null
null
UTF-8
Java
false
false
620
java
public class CloneObjects implements Cloneable{ String name; int record; public CloneObjects(String name, int record) { this.name = name; this.record = record; } public void show() { System.out.println("Welcome "+name+". Your score is : "+record); } public static void main(String[] args) { CloneObjects co = new CloneObjects("David", 98); try { CloneObjects co1 = (CloneObjects)co.clone(); co1.show(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } } }
[ "shiv@DESKTOP-4BVFQV7.localdomain" ]
shiv@DESKTOP-4BVFQV7.localdomain
cb358cc0451027ee995feb703ba54ef9e8486f84
83f2e2ff911340f169649aab07e1d6b47a1bba38
/src/main/java/com/sample/service/exception/UserAlreadyExistsException.java
f198b660643bf61e9d8ff1c2436ec485770e4be5
[]
no_license
Sureszkumar/study-tracker
99522337d37bda2d96bf5fa63c3c04767d31d029
df2aecd1443aafe56e1b6258cf7150dfa96a6fd7
refs/heads/master
2020-05-29T15:42:16.607672
2016-07-13T15:08:14
2016-07-13T15:08:14
63,093,285
0
0
null
null
null
null
UTF-8
Java
false
false
201
java
package com.sample.service.exception; public class UserAlreadyExistsException extends RuntimeException { public UserAlreadyExistsException(final String message) { super(message); } }
[ "Suresh-Kumar.Selvaraj@rabobank.nl" ]
Suresh-Kumar.Selvaraj@rabobank.nl
efdcf3f79c92bd34ec4d7ef52cadde498893741b
a7362a6d07e08c53baf2fd75f6c54bc5713fc970
/cometd-java/cometd-java-websocket/cometd-java-websocket-javax-server/src/main/java/org/cometd/websocket/server/WebSocketTransport.java
c5bba0f568b89cca6abb1d57ab4c77a9800451ee
[ "Apache-2.0" ]
permissive
ichenzhifan/cometd
8bc2d88ae0cc9531cb7a574899197769b4bdff79
bbfdb240cf1c9f6be01cfdac79e34b61bccc3c94
refs/heads/master
2021-01-22T21:37:07.733952
2016-07-26T16:28:30
2016-07-26T16:28:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,442
java
/* * Copyright (c) 2008-2016 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.cometd.websocket.server; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.Executor; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import javax.websocket.CloseReason; import javax.websocket.DeploymentException; import javax.websocket.Endpoint; import javax.websocket.EndpointConfig; import javax.websocket.Extension; import javax.websocket.HandshakeResponse; import javax.websocket.MessageHandler; import javax.websocket.SendHandler; import javax.websocket.SendResult; import javax.websocket.Session; import javax.websocket.server.HandshakeRequest; import javax.websocket.server.ServerContainer; import javax.websocket.server.ServerEndpointConfig; import org.cometd.bayeux.server.ServerMessage; import org.cometd.bayeux.server.ServerSession; import org.cometd.server.AbstractServerTransport; import org.cometd.server.BayeuxServerImpl; import org.cometd.websocket.server.common.AbstractBayeuxContext; import org.cometd.websocket.server.common.AbstractWebSocketTransport; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.component.LifeCycle; public class WebSocketTransport extends AbstractWebSocketTransport<Session> { public WebSocketTransport(BayeuxServerImpl bayeux) { super(bayeux); } @Override public void init() { super.init(); final ServletContext context = (ServletContext)getOption(ServletContext.class.getName()); if (context == null) throw new IllegalArgumentException("Missing ServletContext"); String cometdURLMapping = (String)getOption(COMETD_URL_MAPPING_OPTION); if (cometdURLMapping == null) throw new IllegalArgumentException("Missing '" + COMETD_URL_MAPPING_OPTION + "' parameter"); ServerContainer container = (ServerContainer)context.getAttribute(ServerContainer.class.getName()); if (container == null) throw new IllegalArgumentException("Missing WebSocket ServerContainer"); // JSR 356 does not support a input buffer size option int maxMessageSize = getOption(MAX_MESSAGE_SIZE_OPTION, container.getDefaultMaxTextMessageBufferSize()); container.setDefaultMaxTextMessageBufferSize(maxMessageSize); long idleTimeout = getOption(IDLE_TIMEOUT_OPTION, container.getDefaultMaxSessionIdleTimeout()); container.setDefaultMaxSessionIdleTimeout(idleTimeout); String protocol = getProtocol(); List<String> protocols = protocol == null ? null : Collections.singletonList(protocol); Configurator configurator = new Configurator(context); for (String mapping : normalizeURLMapping(cometdURLMapping)) { ServerEndpointConfig config = ServerEndpointConfig.Builder.create(WebSocketScheduler.class, mapping) .subprotocols(protocols) .configurator(configurator) .build(); try { container.addEndpoint(config); } catch (DeploymentException x) { throw new RuntimeException(x); } } } @Override public void destroy() { Executor threadPool = getExecutor(); if (threadPool instanceof LifeCycle) { try { ((LifeCycle)threadPool).stop(); } catch (Exception x) { _logger.trace("", x); } } super.destroy(); } protected boolean checkOrigin(String origin) { return true; } protected void modifyHandshake(HandshakeRequest request, HandshakeResponse response) { } protected void send(final Session wsSession, final ServerSession session, String data, final Callback callback) { if (_logger.isDebugEnabled()) _logger.debug("Sending {}", data); // Async write. wsSession.getAsyncRemote().sendText(data, new SendHandler() { @Override public void onResult(SendResult result) { Throwable failure = result.getException(); if (failure == null) { callback.succeeded(); } else { handleException(wsSession, session, failure); callback.failed(failure); } } }); } private class WebSocketScheduler extends Endpoint implements AbstractServerTransport.Scheduler, MessageHandler.Whole<String> { private final AbstractWebSocketScheduler delegate; private volatile Session _wsSession; private WebSocketScheduler(WebSocketContext context) { delegate = new AbstractWebSocketScheduler(context) { @Override protected void close(final int code, String reason) { try { // Limits of the WebSocket APIs, otherwise an exception is thrown. reason = reason.substring(0, Math.min(reason.length(), 30)); if (_logger.isDebugEnabled()) _logger.debug("Closing {}/{}", code, reason); _wsSession.close(new CloseReason(CloseReason.CloseCodes.getCloseCode(code), reason)); } catch (Throwable x) { _logger.trace("Could not close WebSocket session " + _wsSession, x); } } @Override protected void schedule(boolean timeout, ServerMessage.Mutable expiredConnectReply) { schedule(_wsSession, timeout, expiredConnectReply); } }; } @Override public void onOpen(Session wsSession, EndpointConfig config) { _wsSession = wsSession; wsSession.addMessageHandler(this); } @Override public void onClose(Session wsSession, CloseReason closeReason) { delegate.onClose(closeReason.getCloseCode().getCode(), closeReason.getReasonPhrase()); } @Override public void onError(Session wsSession, Throwable failure) { delegate.onError(failure); } @Override public void cancel() { delegate.cancel(); } @Override public void schedule() { delegate.schedule(); } @Override public void onMessage(String data) { if (_logger.isDebugEnabled()) _logger.debug("WebSocket Text message on {}@{}/{}@{}", WebSocketTransport.this.getClass().getSimpleName(), Integer.toHexString(WebSocketTransport.this.hashCode()), getClass().getSimpleName(), Integer.toHexString(hashCode())); delegate.onMessage(_wsSession, data); } } private class WebSocketContext extends AbstractBayeuxContext { private WebSocketContext(ServletContext context, HandshakeRequest request, Map<String, Object> userProperties) { super(context, request.getRequestURI().toString(), request.getQueryString(), request.getHeaders(), request.getParameterMap(), request.getUserPrincipal(), (HttpSession)request.getHttpSession(), // Hopefully these will become a standard, for now they are Jetty specific. (InetSocketAddress)userProperties.get("javax.websocket.endpoint.localAddress"), (InetSocketAddress)userProperties.get("javax.websocket.endpoint.remoteAddress"), retrieveLocales(userProperties)); } } private static List<Locale> retrieveLocales(Map<String, Object> userProperties) { @SuppressWarnings("unchecked") List<Locale> locales = (List<Locale>)userProperties.get("javax.websocket.upgrade.locales"); if (locales == null || locales.isEmpty()) return Collections.singletonList(Locale.getDefault()); return locales; } private class Configurator extends ServerEndpointConfig.Configurator { private final ServletContext servletContext; private Configurator(ServletContext servletContext) { this.servletContext = servletContext; } @Override public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) { ContextHolder context = provideContext(); context.bayeuxContext = new WebSocketContext(servletContext, request, sec.getUserProperties()); WebSocketTransport.this.modifyHandshake(request, response); } @Override public boolean checkOrigin(String originHeaderValue) { return WebSocketTransport.this.checkOrigin(originHeaderValue); } @Override public String getNegotiatedSubprotocol(List<String> supported, List<String> requested) { ContextHolder context = provideContext(); context.protocolMatches = checkProtocol(supported, requested); if (context.protocolMatches) return super.getNegotiatedSubprotocol(supported, requested); _logger.warn("Could not negotiate WebSocket SubProtocols: server{} != client{}", supported, requested); return null; } @Override public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) { List<Extension> negotiated = new ArrayList<>(); for (Extension extension : requested) { String name = extension.getName(); boolean option = getOption(ENABLE_EXTENSION_PREFIX_OPTION + name, true); if (option) negotiated.add(extension); } return negotiated; } @Override @SuppressWarnings("unchecked") public <T> T getEndpointInstance(Class<T> endpointClass) throws InstantiationException { ContextHolder context = provideContext(); if (!getBayeux().getAllowedTransports().contains(getName())) throw new InstantiationException("Transport not allowed"); if (!context.protocolMatches) throw new InstantiationException("Could not negotiate WebSocket SubProtocols"); T instance = (T)new WebSocketScheduler(context.bayeuxContext); context.clear(); return instance; } private ContextHolder provideContext() { ContextHolder result = ContextHolder.holder.get(); if (result == null) { result = new ContextHolder(); result.clear(); ContextHolder.holder.set(result); } return result; } } private static class ContextHolder { private static final ThreadLocal<ContextHolder> holder = new ThreadLocal<>(); private WebSocketContext bayeuxContext; private boolean protocolMatches; public void clear() { bayeuxContext = null; // Use a sensible default in case getNegotiatedSubprotocol() is not invoked. protocolMatches = true; } } }
[ "simone.bordet@gmail.com" ]
simone.bordet@gmail.com
c3a26fa3f6132dee9cdb1bef47c8baaca81cefca
d04bb7cb9cdf3a8d6dfb65631b7fbf29e0b6501f
/spring-h/src/main/java/aop1/ArithmeticCalculatorImpl.java
a4a9e8402a05b7d984c36f71470bb0cb40d20e67
[ "Apache-2.0" ]
permissive
hy123f/spring5.1.12
3703348e530fcb4aa9d1cda9772a96b3cafe48f8
4e8095aab28b76a6791a97fdf6ced1917db4e433
refs/heads/master
2022-12-26T01:23:42.694663
2020-10-12T07:18:14
2020-10-12T07:18:14
260,438,340
0
0
null
null
null
null
UTF-8
Java
false
false
519
java
package aop1; import org.springframework.stereotype.Component; @Component("arithmeticCalculator") public class ArithmeticCalculatorImpl implements ArithmeticCalculator { @Override public int add(int i, int j) { int result = i + j; return result; } @Override public int sub(int i, int j) { int result = i - j; return result; } @Override public int mul(int i, int j) { int result = i * j; return result; } @Override public int div(int i, int j) { int result = i / j; return result; } }
[ "282713917@qq.com" ]
282713917@qq.com
789d85fb52e2e009b6f4fbaccdfb42515d920943
1db1b803b66c96ebe41e55da0744592e1e66bf96
/tags/0.3/sources/visidia/gui/presentation/userInterfaceEdition/undo/FusionneSommet.java
9c7e21e83c32d30c4487076365c5f24852e861ad
[]
no_license
BackupTheBerlios/visidia-svn
22a90e1485e622be38673cd148b9edc228d30df6
4389ab47c96268f0856552c7eb80a006cdbecdb8
refs/heads/master
2021-01-01T17:06:12.030971
2007-04-11T02:13:09
2007-04-11T02:13:09
40,804,154
1
0
null
null
null
null
UTF-8
Java
false
false
2,515
java
package visidia.gui.presentation.userInterfaceEdition.undo; import visidia.gui.presentation.*; import visidia.gui.metier.*; import java.util.*; /** Cette classe contient les informations pour annuler les fusions de * sommets intervenant lors du deplacement d'un sommet existant : il * faut pouvoir recreer le sommet qui est detruit lors la fusion, lui * redonner sa position initiale, et reaffecter les extrémites des * arêtes. **/ public class FusionneSommet implements UndoObject { /** *le sommet qui sera detruit par la fusion(le sommet qu'on deplace) **/ protected SommetDessin sommetDetruit; /** * le sommet sur lequel est realise la fusion. **/ protected SommetDessin sommetGarde; private Vector aretesEntrantes; private Vector aretesSortantes; /** * l'abscisse initiale du sommet detruit. */ protected int original_X; /** *l'ordonnée initiale du sommet detruit. **/ protected int original_Y; public FusionneSommet(SommetDessin sommetDetruit, SommetDessin sommetGarde, int original_X, int original_Y) { this.sommetDetruit = sommetDetruit; this.sommetGarde = sommetGarde; aretesEntrantes = new Vector(); aretesSortantes = new Vector(); Enumeration e = sommetDetruit.getSommet().aretesEntrantes(); while (e.hasMoreElements()) { this.aretesEntrantes.addElement(((Arete)e.nextElement()).getAreteDessin()); } e = (sommetDetruit.getSommet()).aretesSortantes(); while (e.hasMoreElements()) { this.aretesSortantes.addElement(((Arete)e.nextElement()).getAreteDessin()); } this.original_X = original_X; this.original_Y = original_Y; } public void undo() { sommetDetruit.getVueGraphe().putObject(sommetDetruit); int i; for (i=0; i<aretesSortantes.size(); i++) { ((AreteDessin)aretesSortantes.elementAt(i)).changerOrigine(sommetDetruit); } for (i=0; i<aretesEntrantes.size(); i++) { ((AreteDessin)aretesEntrantes.elementAt(i)).changerDestination(sommetDetruit); } sommetDetruit.placer(original_X, original_Y); } public void redo() { int i; for (i=0; i<aretesSortantes.size(); i++) { ((AreteDessin)aretesSortantes.elementAt(i)).changerOrigine(sommetGarde); } for (i=0; i<aretesEntrantes.size(); i++) { ((AreteDessin)aretesEntrantes.elementAt(i)).changerDestination(sommetGarde); } sommetDetruit.getVueGraphe().delObject(sommetDetruit); } public FormeDessin content() { return sommetDetruit; } }
[ "cassou@bb92ad23-c20a-0410-a792-9a0895785805" ]
cassou@bb92ad23-c20a-0410-a792-9a0895785805
2f10b62c7cc21f15f51ef9a6348d205627109501
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_252a9b20186636f52749e369b8af6f834c427937/ThreadJob/4_252a9b20186636f52749e369b8af6f834c427937_ThreadJob_s.java
b573372bc4423e3b96154850b172f00cbecf52b1
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
16,131
java
/******************************************************************************* * Copyright (c) 2004, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM - Initial API and implementation *******************************************************************************/ package org.eclipse.core.internal.jobs; import org.eclipse.core.internal.runtime.RuntimeLog; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.*; /** * Captures the implicit job state for a given thread. */ class ThreadJob extends Job { /** * Set to true if this thread job is running in a thread that did * not own a rule already. This means it needs to acquire the * rule during beginRule, and must release the rule during endRule. * @GuardedBy("JobManager.implicitJobs") */ protected boolean acquireRule = false; /** * Indicates that this thread job did report to the progress manager * that it will be blocked, and therefore when it begins it must * be reported to the job manager when it is no longer blocked. * @GuardedBy("JobManager.implicitJobs") */ boolean isBlocked = false; /** * True if this ThreadJob has begun execution * @GuardedBy("this") */ protected boolean isRunning = false; /** * Used for diagnosing mismatched begin/end pairs. This field * is only used when in debug mode, to capture the stack trace * of the last call to beginRule. */ private RuntimeException lastPush = null; /** * The actual job that is running in the thread that this * ThreadJob represents. This will be null if this thread * job is capturing a rule acquired outside of a job. * @GuardedBy("JobManager.implicitJobs") */ protected Job realJob; /** * The stack of rules that have been begun in this thread, but not yet ended. * @GuardedBy("JobManager.implicitJobs") */ private ISchedulingRule[] ruleStack; /** * Rule stack pointer. * INV: 0 <= top <= ruleStack.length * @GuardedBy("JobManager.implicitJobs") */ private int top; /** * Waiting state for thread jobs is independent of the internal state. When * this variable is true, this ThreadJob is waiting in joinRun() * @GuardedBy("jobStateLock") */ boolean isWaiting; ThreadJob(ISchedulingRule rule) { super("Implicit Job"); //$NON-NLS-1$ setSystem(true); // calling setPriority will try to acquire JobManager.lock, breaking // lock acquisition protocol. Since we are constructing this thread, // we can call internalSetPriority ((InternalJob) this).internalSetPriority(Job.INTERACTIVE); ruleStack = new ISchedulingRule[2]; top = -1; ((InternalJob) this).internalSetRule(rule); } /** * An endRule was called that did not match the last beginRule in * the stack. Report and log a detailed informational message. * @param rule The rule that was popped * @GuardedBy("JobManager.implicitJobs") */ private void illegalPop(ISchedulingRule rule) { StringBuffer buf = new StringBuffer("Attempted to endRule: "); //$NON-NLS-1$ buf.append(rule); if (top >= 0 && top < ruleStack.length) { buf.append(", does not match most recent begin: "); //$NON-NLS-1$ buf.append(ruleStack[top]); } else { if (top < 0) buf.append(", but there was no matching beginRule"); //$NON-NLS-1$ else buf.append(", but the rule stack was out of bounds: " + top); //$NON-NLS-1$ } buf.append(". See log for trace information if rule tracing is enabled."); //$NON-NLS-1$ String msg = buf.toString(); if (JobManager.DEBUG || JobManager.DEBUG_BEGIN_END) { System.out.println(msg); Throwable t = lastPush == null ? new IllegalArgumentException() : lastPush; IStatus error = new Status(IStatus.ERROR, JobManager.PI_JOBS, 1, msg, t); RuntimeLog.log(error); } Assert.isLegal(false, msg); } /** * Client has attempted to begin a rule that is not contained within * the outer rule. */ private void illegalPush(ISchedulingRule pushRule, ISchedulingRule baseRule) { StringBuffer buf = new StringBuffer("Attempted to beginRule: "); //$NON-NLS-1$ buf.append(pushRule); buf.append(", does not match outer scope rule: "); //$NON-NLS-1$ buf.append(baseRule); String msg = buf.toString(); if (JobManager.DEBUG) { System.out.println(msg); IStatus error = new Status(IStatus.ERROR, JobManager.PI_JOBS, 1, msg, new IllegalArgumentException()); RuntimeLog.log(error); } Assert.isLegal(false, msg); } /** * Returns true if the monitor is canceled, and false otherwise. * Protects the caller from exception in the monitor implementation. */ private boolean isCanceled(IProgressMonitor monitor) { try { return monitor.isCanceled(); } catch (RuntimeException e) { //logged message should not be translated IStatus status = new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "ThreadJob.isCanceled", e); //$NON-NLS-1$ RuntimeLog.log(status); } return false; } /** * Returns true if this thread job was scheduled and actually started running. * @GuardedBy("this") */ synchronized boolean isRunning() { return isRunning; } /** * A reentrant method which will run this <code>ThreadJob</code> immediately if there * are no existing jobs with conflicting rules, or block until the rule can be acquired. If this * job must block, the <code>LockListener</code> is given a chance to override. * If override is not granted, then this method will block until the rule is available. If * <code>LockListener#canBlock</code> returns <tt>true</tt>, then the <code>monitor</code> * <i>will not</i> be periodically checked for cancellation. It will only be rechecked if this * thread is interrupted. If <code>LockListener#canBlock</code> returns <tt>false</tt> The * <code>monitor</code> <i>will</i> be checked periodically for cancellation. * * When a UI is present, it is recommended that the <code>LockListener</code> * should not allow the UI thread to block without checking the <code>monitor</code>. This * ensures that the UI remains responsive. * * @see LockListener#aboutToWait(Thread) * @see LockListener#canBlock() * @see JobManager#transferRule(ISchedulingRule, Thread) * @return <tt>this</tt>, or the <code>ThreadJob</code> instance that was * unblocked (due to transferRule) in the case of reentrant invocations of this method. * * @param monitor - The <code>IProgressMonitor</code> used to report blocking status and * cancellation. * * @throws OperationCanceledException if this job was canceled before it was started. */ ThreadJob joinRun(final IProgressMonitor monitor) { if (isCanceled(monitor)) throw new OperationCanceledException(); final Thread currentThread = Thread.currentThread(); // check if there is a blocking thread before waiting InternalJob blockingJob = manager.findBlockingJob(this); Thread blocker = blockingJob == null ? null : blockingJob.getThread(); boolean interrupted = false; try { // just return if lock listener decided to grant immediate access if (manager.getLockManager().aboutToWait(blocker)) return this; // Ask lock manager if it safe to block this thread if (manager.getLockManager().canBlock()) return waitForRun(monitor, blockingJob, blocker, false); WaitForRunThread runner = new WaitForRunThread(this, blockingJob, blocker); runner.start(); try { manager.reportBlocked(monitor, blockingJob); while (true) { if (isCanceled(monitor)) throw new OperationCanceledException(); synchronized (runner.getNotifier()) { if (runner.isFinished()) break; try { runner.getNotifier().wait(250); } catch (InterruptedException e) { interrupted = true; } // check to see if the thread runner was aborted early first if (runner.isFinished()) break; } blockingJob = manager.findBlockingJob(this); // the rule could have been transferred to *this* thread while we were waiting blocker = blockingJob == null ? null : blockingJob.getThread(); if (blocker == currentThread && blockingJob instanceof ThreadJob) { // so abort our thread, but only return if the runner wasn't already done if (runner.shutdown()) { // now we are just the nested acquire case ThreadJob result = (ThreadJob) blockingJob; result.push(getRule()); result.isBlocked = this.isBlocked; return result; } } } // if thread is still running, shut it down runner.shutdown(); if (runner.getException() != null) throw runner.getException(); return runner.getResult(); } finally { manager.reportUnblocked(monitor); } } finally { manager.getLockManager().aboutToRelease(); if (interrupted) Thread.currentThread().interrupt(); } } ThreadJob waitForRun(IProgressMonitor monitor, InternalJob blockingJob, Thread blocker, boolean forked) { ThreadJob result = this; boolean interrupted = false; try { waitStart(monitor, blockingJob); // if we didn't fork, we need have the manager monitor our progress // monitor. The manager will interrupt us when cancellation status // changes. if (!forked) manager.beginMonitoring(this, monitor); final Thread currentThread = Thread.currentThread(); // Check all conditions under the manager.lock. Anything that can // cause a change in any condition must also notify() the lock. // Invoke aboutToWait() once per newly discovered blocker. // aboutToWait() must be called without holding any locks. while (true) { //inner loop until interrupted or the blocking job changes while (true) { // try to run the job blockingJob = manager.runNow(this); if (blockingJob == null) return this; Thread newBlocker = blockingJob == null ? null : blockingJob.getThread(); // Rules are never transferred to us if we're inside a WaitForRunThread if (!forked) { // the rule could have been transferred to this thread while we were waiting if (newBlocker == currentThread && blockingJob instanceof ThreadJob) { // now we are just the nested acquire case result = (ThreadJob) blockingJob; result.push(getRule()); result.isBlocked = this.isBlocked; return result; } } if (blocker == newBlocker) { synchronized (blockingJob.jobStateLock) { try { blockingJob.jobStateLock.wait(); } catch (InterruptedException e) { interrupted = true; // Must break here to ensure aboutToWait() is called outside the lock. break; } } } else { // we got a different blocker blocker = newBlocker; break; } } // monitor is foreign code, do not hold locks while calling into monitor if (isCanceled(monitor)) throw new OperationCanceledException(); if (manager.getLockManager().aboutToWait(blocker)) return this; // if we don't return immediately, we need to re-acquire the // lock and re-check all conditions before waiting } } finally { if (this == result) waitEnd(monitor); if (!forked) manager.endMonitoring(this); if (interrupted) Thread.currentThread().interrupt(); } } /** * Pops a rule. Returns true if it was the last rule for this thread * job, and false otherwise. * @GuardedBy("JobManager.implicitJobs") */ boolean pop(ISchedulingRule rule) { if (top < 0 || ruleStack[top] != rule) illegalPop(rule); ruleStack[top--] = null; return top < 0; } /** * Adds a new scheduling rule to the stack of rules for this thread. Throws * a runtime exception if the new rule is not compatible with the base * scheduling rule for this thread. * @GuardedBy("JobManager.implicitJobs") */ void push(final ISchedulingRule rule) { final ISchedulingRule baseRule = getRule(); if (++top >= ruleStack.length) { ISchedulingRule[] newStack = new ISchedulingRule[ruleStack.length * 2]; System.arraycopy(ruleStack, 0, newStack, 0, ruleStack.length); ruleStack = newStack; } ruleStack[top] = rule; if (JobManager.DEBUG_BEGIN_END) lastPush = (RuntimeException) new RuntimeException().fillInStackTrace(); //check for containment last because we don't want to fail again on endRule if (baseRule != null && rule != null && !baseRule.contains(rule)) illegalPush(rule, baseRule); } /** * Reset all of this job's fields so it can be reused. Returns false if * reuse is not possible * @GuardedBy("JobManager.implicitJobs") */ boolean recycle() { //don't recycle if still running for any reason if (getState() != Job.NONE) return false; //clear and reset all fields acquireRule = isRunning = isBlocked = false; realJob = null; setRule(null); setThread(null); if (ruleStack.length != 2) ruleStack = new ISchedulingRule[2]; else ruleStack[0] = ruleStack[1] = null; top = -1; return true; } /** (non-Javadoc) * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) */ public IStatus run(IProgressMonitor monitor) { synchronized (this) { isRunning = true; } return ASYNC_FINISH; } /** * Records the job that is actually running in this thread, if any * @param realJob The running job * @GuardedBy("JobManager.implicitJobs") */ void setRealJob(Job realJob) { this.realJob = realJob; } /** * Returns true if this job should cause a self-canceling job * to cancel itself, and false otherwise. * @GuardedBy("JobManager.implicitJobs") */ boolean shouldInterrupt() { return realJob == null ? true : !realJob.isSystem(); } /* (non-javadoc) * For debugging purposes only */ public String toString() { StringBuffer buf = new StringBuffer("ThreadJob"); //$NON-NLS-1$ buf.append('(').append(realJob).append(',').append(getRuleStack()).append(')'); return buf.toString(); } String getRuleStack() { StringBuffer buf = new StringBuffer(); buf.append('['); for (int i = 0; i <= top && i < ruleStack.length; i++) buf.append(ruleStack[i]).append(','); buf.append(']'); return buf.toString(); } /** * Reports that this thread was blocked, but is no longer blocked and is able * to proceed. * @param monitor The monitor to report unblocking to. */ private void waitEnd(IProgressMonitor monitor) { final LockManager lockManager = manager.getLockManager(); final Thread currentThread = Thread.currentThread(); if (isRunning()) { lockManager.addLockThread(currentThread, getRule()); //need to re-acquire any locks that were suspended while this thread was blocked on the rule lockManager.resumeSuspendedLocks(currentThread); } else { //tell lock manager that this thread gave up waiting lockManager.removeLockWaitThread(currentThread, getRule()); } manager.implicitJobs.removeWaiting(this); } /** * Indicates the start of a wait on a scheduling rule. Report the * blockage to the progress manager and update the lock manager. * @param monitor The monitor to report blocking to * @param blockingJob The job that is blocking this thread, or <code>null</code> */ private void waitStart(IProgressMonitor monitor, InternalJob blockingJob) { manager.getLockManager().addLockWaitThread(Thread.currentThread(), getRule()); isBlocked = true; manager.reportBlocked(monitor, blockingJob); manager.implicitJobs.addWaiting(this); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
86115c99f6877dd8e1eea2e799b3e4534f35c555
7496e0a7e9b68e14492bf167c775ddbb83f8757e
/src/pkgfinal/java/purchaseoutstanding.java
36efc088faecca91af90b94da814fe334a8774f3
[]
no_license
SouravSingh05/ManagementInformationSystem
5158b8c13aa739d12468a07d8c0bda98846ee79c
12369d1b1f030d0d9ce35b799c8a02272ea00543
refs/heads/master
2022-11-17T22:05:37.581251
2020-07-12T07:05:01
2020-07-12T07:05:01
279,010,604
0
0
null
null
null
null
UTF-8
Java
false
false
11,809
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 pkgfinal.java; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.swing.JOptionPane; import net.proteanit.sql.DbUtils; /** * * @author DELL */ public class purchaseoutstanding extends javax.swing.JFrame { Connection conn=null; ResultSet rs=null; PreparedStatement pst=null; /** * Creates new form purchaseoutstanding */ public purchaseoutstanding() { initComponents(); } /* private void view_table(){ try{ conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/sales","root",""); String sql; sql="select * from sales where Date_of_Entry=?"; pst=conn.prepareStatement(sql); pst.setString(1,ac.getText()); rs=pst.executeQuery(); tb.setModel(DbUtils.resultSetToTableModel(rs));; } catch(Exception e) { JOptionPane.showMessageDialog(null,e); } }*/ /** * 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() { jButton1 = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); a = new javax.swing.JTextField(); b = new javax.swing.JTextField(); c = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); ac = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); jButton1.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jButton1.setText("UPDATE"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1); jButton1.setBounds(153, 270, 91, 54); jLabel4.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N jLabel4.setText("Payment Made"); getContentPane().add(jLabel4); jLabel4.setBounds(30, 176, 140, 23); jButton2.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jButton2.setText("CLEAR"); jButton2.setToolTipText(""); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); getContentPane().add(jButton2); jButton2.setBounds(298, 270, 73, 54); jButton3.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N jButton3.setText("CANCEL"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); getContentPane().add(jButton3); jButton3.setBounds(430, 270, 81, 54); a.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { aKeyReleased(evt); } }); getContentPane().add(a); a.setBounds(210, 140, 218, 20); b.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { bKeyReleased(evt); } }); getContentPane().add(b); b.setBounds(210, 180, 218, 20); c.setEditable(false); c.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { cKeyReleased(evt); } }); getContentPane().add(c); c.setBounds(210, 220, 218, 20); jLabel1.setFont(new java.awt.Font("Arial", 1, 24)); // NOI18N jLabel1.setText("Purchase Outstanding"); getContentPane().add(jLabel1); jLabel1.setBounds(30, 24, 256, 29); jLabel2.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N jLabel2.setText("Customer Id"); getContentPane().add(jLabel2); jLabel2.setBounds(30, 94, 130, 23); jLabel3.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N jLabel3.setText("Amount Due"); getContentPane().add(jLabel3); jLabel3.setBounds(30, 135, 130, 23); jButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton4.setText("New Due"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); getContentPane().add(jButton4); jButton4.setBounds(30, 217, 116, 25); jButton5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jButton5.setText("Find"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); getContentPane().add(jButton5); jButton5.setBounds(470, 90, 109, 25); getContentPane().add(ac); ac.setBounds(210, 90, 214, 20); setSize(new java.awt.Dimension(688, 529)); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed this.dispose(); // TODO add your handling code here: }//GEN-LAST:event_jButton3ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed a.setText(" "); b.setText(" "); c.setText(" "); }//GEN-LAST:event_jButton2ActionPerformed private void aKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_aKeyReleased // TODO add your handling code here: int key=evt.getKeyCode(); if(key==10) { b.requestFocus();// TODO add your handling code here: } }//GEN-LAST:event_aKeyReleased private void bKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_bKeyReleased // TODO add your handling code here: int key=evt.getKeyCode(); if(key==10) { c.requestFocus();// TODO add your handling code here: } }//GEN-LAST:event_bKeyReleased private void cKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cKeyReleased // TODO add your handling code here: }//GEN-LAST:event_cKeyReleased private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: String ad= a.getText(); String as= ad.trim(); int d= Integer.parseInt(as); int e= Integer.parseInt(b.getText()); int f=d-e; c.setText(f+" "); }//GEN-LAST:event_jButton4ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: Connection conn=null; ResultSet rs=null; PreparedStatement pst=null; try{ conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/mis","root",""); String sql="select New_Due from purchase where Customer_Id=?"; pst=conn.prepareStatement(sql); pst.setString(1,ac.getText()); rs=pst.executeQuery(); if(rs.next()) { int ad=rs.getInt("New_Due"); a.setText(ad+" "); } } catch(Exception e){ JOptionPane.showMessageDialog(null, e); } }//GEN-LAST:event_jButton5ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed Connection conn=null; ResultSet rs=null; PreparedStatement pst=null; try{ conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/purchase","root",""); String sql; sql="update purchase set New_Due=? where Party_Name=?"; pst=conn.prepareStatement(sql); pst.setString(1,c.getText()); pst.setString(2,ac.getText()); pst.executeUpdate(); JOptionPane.showMessageDialog(null,"Updated"); } catch(Exception e) { JOptionPane.showMessageDialog(null,e); } }//GEN-LAST:event_jButton1ActionPerformed /** * @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(purchaseoutstanding.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(purchaseoutstanding.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(purchaseoutstanding.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(purchaseoutstanding.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new purchaseoutstanding().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JTextField ac; private javax.swing.JTextField b; private javax.swing.JTextField c; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; // End of variables declaration//GEN-END:variables }
[ "singhsourav370@gmail.com" ]
singhsourav370@gmail.com
93cf771882f536bfb3eab464626ebc7904ab4257
0a46c72f07a214a9b35f48c9f24f9bf677581fc9
/src/main/java/pl/sdacademy/immutability/Runner.java
b83238ddfa932aa4c2dabd83fba4aaa06008092d
[]
no_license
arqarq/immutability
e4fb10be54bfdd154ae23560bfccc3b6ca0078cd
e011affa0dfdc993f21e1a6d85dce7e027a39ff0
refs/heads/master
2020-03-31T08:38:00.113009
2018-10-15T16:51:53
2018-10-15T16:51:53
152,065,563
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package pl.sdacademy.immutability; import static pl.sdacademy.immutability.Currency.*; class Runner { public static void main(String[] args) { BookCollection bookCollection = new BookCollectionImpl(); bookCollection.addBook(new Book(1, "Tytuł", "Autor", new Price(29, PLN))); bookCollection.addBook(new Book(2, "Tytuł2", "Autor2", new Price(39, EUR))); bookCollection.addBook(new Book(3, "Tytuł3", "Autor3", new Price(49, USD))); System.out.println(bookCollection); bookCollection.printAllBooks(); System.out.println(bookCollection.findBookByTitle("Tytuł3")); System.out.println(bookCollection.findBookByTitle("Tytuł4")); } }
[ "43341071+arqarq@users.noreply.github.com" ]
43341071+arqarq@users.noreply.github.com
ce3b284f231a6149c1d6b4118e98305de1e79463
17a9dfc3dbddbe76d68c6b91701f616a70bc95ba
/codes/maven/plant_diseases_android/src/main/java/plant/diseases/android/DiseasesConstants.java
784774f5ecf5ce58dbddbd736017f45ea3fc9fde
[]
no_license
bjrenyong/plant_diseases_app
6a25d31e77fa2521e396581228730aeaef0f5214
e2aae510b9de6a6979c2faa40cc45cd5beec1309
refs/heads/master
2021-01-13T02:19:25.380015
2014-07-02T13:11:48
2014-07-02T13:11:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
780
java
package plant.diseases.android; import java.util.ResourceBundle; /** * Created by Timothy on 2014/6/28. */ public class DiseasesConstants { private static final ResourceBundle RB_ANDROID = ResourceBundle.getBundle("android"); /** 此应用所有资源的根路径 */ private static final String DISEASES_RESOURCES_ROOT_DIR = "/diseases"; /** 拍照图片存放地址 **/ private static final String DISEASES_CAMERA_DIR = "/camera_photo"; /** server端json和文件上传请求URL */ public static final String DISEASES_JSON_UPLOADFILE_URL = RB_ANDROID.getString("DISEASES_JSON_UPLOADFILE_URL"); /** * 取得拍照图片本地保存地址 * @return */ public static String getPhotoSaveDir() { return DISEASES_RESOURCES_ROOT_DIR + DISEASES_CAMERA_DIR; } }
[ "bjrenyong@gmail.com" ]
bjrenyong@gmail.com
76f388eccfd4bcabdde5b59b16e473813a356d47
c3a36b1c76c9f4969084ee72b6de8cceb7a78437
/microservizio2 (item-itemlent)/src/main/java/it/contrader/SpringWebApplication.java
ab81b7f85c3a22da948c95c57db7edc2faa67430
[]
no_license
AnthonyContrader/HardwareTracking
36ef1a996c51783ac7e964ea216bd0c22ec463a4
80b618b30fb56dfa5f37b5654cb4ac13b8dd3672
refs/heads/main
2023-02-19T17:53:43.507337
2021-01-13T13:12:46
2021-01-13T13:12:46
313,263,819
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package it.contrader; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication(scanBasePackages={"it.contrader"}) public class SpringWebApplication { public static void main(String[] args) { SpringApplication.run(SpringWebApplication.class, args); } }
[ "briffasimone94sr@gmail.com" ]
briffasimone94sr@gmail.com
6a590cb85ada158f3f97358d47d67bd25ed196a0
404d6c5294e2fac206946440f310b360990faeea
/app/src/main/java/com/xiuxiu/adapter/professorAdapter.java
8394452c87bf6944e8b08aa148e243bbac22ff7c
[]
no_license
HJSir/MyApplication
14f357da35e234a87badf9fcdc5f08ed57202420
75bb51e2140f21235fa238beb6d2a378a56e452c
refs/heads/master
2020-12-30T11:02:50.474109
2017-07-31T02:16:32
2017-07-31T02:16:32
98,842,908
0
0
null
null
null
null
UTF-8
Java
false
false
1,875
java
package com.xiuxiu.adapter; import android.content.Context; import android.support.v4.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.R; import com.xiuxiu.entity.professorBean; import com.xiuxiu.entity.shopBean; import java.util.List; public class professorAdapter extends BaseAdapter { private List<professorBean> mlist; private LayoutInflater mInflater; public professorAdapter(Context context, List<professorBean> list) { mlist=list; mInflater=LayoutInflater.from(context); } @Override public int getCount() { return mlist.size(); } @Override public Object getItem(int position) { return mlist.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if(convertView==null){ viewHolder = new ViewHolder(); convertView =mInflater.inflate(R.layout.listview_professor,null); viewHolder.prof_name= (TextView) convertView.findViewById(R.id.tv_professorName); viewHolder.prof_time= (TextView) convertView.findViewById(R.id.tv_professorTime); convertView.setTag(viewHolder); }else{ viewHolder = (ViewHolder) convertView.getTag(); } professorBean bean=mlist.get(position); viewHolder.prof_name.setText(bean.getProfessorName()); viewHolder.prof_time.setText(bean.getProfessorTime()); return convertView; } class ViewHolder{ // private ImageView shop_image; private TextView prof_name; private TextView prof_time; } }
[ "1296586911@qq.com" ]
1296586911@qq.com
2c278d3ea068ddecc3186a3eb5917cba464536f2
ec1e0dd8f9820abd52ba60e5d1b96acf474ab615
/src/main/java/com/whxx/hms/service/RoomSrv.java
a88d810d16adff83c5e1c0dd24383e164f62b255
[]
no_license
13thlancer/hotelManager
f8b2b4e8dda82392102bd1dc06e65c61c857dd44
8827006a7d91e7ea8ae87204bc5fb66fa066ce98
refs/heads/master
2020-03-21T08:04:50.141369
2018-06-22T15:29:34
2018-06-22T15:29:34
138,318,746
0
1
null
null
null
null
UTF-8
Java
false
false
166
java
package com.whxx.hms.service; import java.util.List; import java.util.Map; public interface RoomSrv { List<String> getRoomList(Map<String, String> paramMap); }
[ "799923145@qq.com" ]
799923145@qq.com
ecb37e4ea0b778f3a83abb2a71f115736305b9fa
9108e25d328ac8b51a9fe65eecb80e5730720ef4
/HomeworkAssignment/src/w2l8/problem2/MarketingComparator.java
3708beaa994508ab1e416ebb29d7863253f58b75
[]
no_license
flormariavg/FPP_NOV_2018
bb864490f2bf312b7bf1e525d03e8e68ae27782c
92edb3ff789add018223b9f40cb4749829c7b4cc
refs/heads/master
2020-04-08T09:58:58.828421
2018-12-17T13:32:17
2018-12-17T13:32:17
159,248,640
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package w2l8.problem2; import java.util.Comparator; public class MarketingComparator implements Comparator<Marketing>{ @Override public int compare(Marketing m1, Marketing m2) { if(Double.compare(m1.salesamount, m2.salesamount) !=0) return Double.compare(m1.salesamount,m2.salesamount); else if(m1.employeename.compareTo(m2.employeename) !=0) return m1.employeename.compareTo(m2.employeename); else return m1.productname.compareTo(m2.productname); } }
[ "flormariavg@gmail.com" ]
flormariavg@gmail.com
ebee3084dd71ff593f85d0fa69b7da063683e18e
d185b693a706b0d84d9f0161fee53a8aef5fe5e7
/level1/WaterMelon.java
f5d9b69d3cdc247d91981abe7fa6cc77568b540b
[]
no_license
eeejjj2131/programmers
ed18570cbcb485b272b3e7088f4ccb9535000386
b932b06fd3ff8664bf36863dcbd25dd7be0f8e87
refs/heads/master
2021-05-12T12:28:11.485137
2018-01-14T08:45:04
2018-01-14T08:45:04
117,414,675
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package com.ej.programmers; /* * water_melon함수는 정수 n을 매개변수로 입력받습니다. 길이가 n이고, 수박수박수...와 같은 패턴을 유지하는 문자열을 리턴하도록 함수를 완성하세요. 예를들어 n이 4이면 '수박수박'을 리턴하고 3이라면 '수박수'를 리턴하면 됩니다. */ public class WaterMelon { public String watermelon(int n){ String[] wm = {"수", "박"}; StringBuffer sb = new StringBuffer(); for(int i = 0; i<n; i++){ sb.append(wm[i%2]); } String s = sb.toString(); return s; } // 실행을 위한 테스트코드입니다. public static void main(String[] args){ WaterMelon wm = new WaterMelon(); System.out.println("n이 3인 경우: " + wm.watermelon(3)); System.out.println("n이 4인 경우: " + wm.watermelon(4)); } }
[ "eunjin2131@gmail.com" ]
eunjin2131@gmail.com
6326c8e62b782f684f1d3233e34889bfd241d4fc
717abd007f5a299536a6697667aa05c459238835
/src/Adapter/Sample1/Banner.java
312c8f1795f1222cae2af38258e01eca1562685c
[]
no_license
aksh-t/DesignPatternByHyuki
40abf78fd2694eb579bc505ef84588ae1d5342ed
45c775d5725115e14dd25941b395ab9546caf3fb
refs/heads/master
2022-12-27T17:57:01.419492
2020-10-25T17:42:30
2020-10-25T17:42:30
255,655,801
0
0
null
2020-10-25T17:42:31
2020-04-14T15:59:51
Java
UTF-8
Java
false
false
327
java
package Adapter.Sample1; public class Banner { private String string; public Banner(String string) { this.string = string; } public void showWithParen() { System.out.println("(" + string + ")"); } public void showWithAster() { System.out.println("*" + string + "*"); } }
[ "tanno.ao@gmail.com" ]
tanno.ao@gmail.com
c7709b38db274ea4b496ea769f1fd275e83b5495
5a8f9a79b19a976b7710a9d7792cab8a2330915c
/sandbox/java/src/main/java/xyz/yunfeiImplementAlgs4/MergeX.java
ca8cb3ba48b7885cdb187773623353913f232f38
[ "MIT" ]
permissive
qiuyuguo/bioinfo_toolbox
7d7ad7e60d4ab016ce5f16446b6e7ddbe73259a0
7b2cf7c62034ac45adfcb4278178ce60496209a7
refs/heads/master
2021-01-19T23:26:33.053855
2017-04-19T14:07:37
2017-04-19T14:07:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,344
java
/****************************************************************************** * Compilation: javac MergeX.java * Execution: java MergeX < input.txt * Dependencies: StdOut.java StdIn.java * Data files: http://algs4.cs.princeton.edu/22mergesort/tiny.txt * http://algs4.cs.princeton.edu/22mergesort/words3.txt * * Sorts a sequence of strings from standard input using an * optimized version of mergesort. * * % more tiny.txt * S O R T E X A M P L E * * % java MergeX < tiny.txt * A E E L M O P R S T X [ one string per line ] * * % more words3.txt * bed bug dad yes zoo ... all bad yet * * % java MergeX < words3.txt * all bad bed bug dad ... yes yet zoo [ one string per line ] * ******************************************************************************/ package yunfeiImplementAlgs4; import edu.princeton.cs.algs4.StdIn; import edu.princeton.cs.algs4.StdOut; import edu.princeton.cs.algs4.Stopwatch; /** * The <tt>MergeX</tt> class provides static methods for sorting an * array using an optimized version of mergesort. * <p> * For additional documentation, see <a href="http://algs4.cs.princeton.edu/22mergesort">Section 2.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne */ public class MergeX { //speed up mergesort with insertion sort private static final int CUTOFF = 7; //cutoff for insertion sort private MergeX() {} public static void sort(Comparable[] a) { if (a == null) return; Comparable[] aux = new Comparable[a.length]; sort(a, aux, 0, a.length - 1); } public static void sort(Comparable[] a, Comparable[] aux, int lo, int hi) { if (lo >= hi) return; if (hi - lo <= CUTOFF) { insertion(a, lo, hi); return; } int mid = lo + (hi - lo) / 2; sort(a, aux, lo, mid); sort(a, aux, mid + 1, hi); merge(a, aux, lo, mid, hi); } private static void merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi) { //copy elements to auxillary array for (int i = lo; i <= hi; i++) aux[i] = a[i]; int i = lo; //pointer for first half int j = mid + 1; //pointer for second half for (int k = lo; k <= hi; k++) { if (i > mid) a[k] = aux[j++]; else if (j > hi) a[k] = aux[i++]; else if (less(aux[j], aux[i])) a[k] = aux[j++]; //this is critical for stable sorting //if we use aux[j++], original order will be broken else a[k] = aux[i++]; } } private static void insertion(Comparable[] a, int lo, int hi) { if (lo >= hi) return; for (int i = lo; i <= hi; i++) { for (int j = i - 1; j >= lo && less(a[j + 1], a[j]); j--) { exch(a, j + 1, j); } } } // exchange a[i] and a[j] private static void exch(Object[] a, int i, int j) { Object swap = a[i]; a[i] = a[j]; a[j] = swap; } // is a[i] < a[j]? private static boolean less(Comparable a, Comparable b) { return a.compareTo(b) < 0; } private static void show(Object[] a) { for (int i = 0; i < a.length; i++) { StdOut.println(a[i]); } } public static void main(String[] args) { String[] a = StdIn.readAllStrings(); String[] b = new String[a.length]; for (int i = 0; i < a.length; i++) { b[i] = a[i]; } Stopwatch timer = new Stopwatch(); //edu.princeton.cs.algs4.MergeX.sort(a); MergeX.sort(a); StdOut.print(timer.elapsedTime()); int count = 5; for (String x : a) { System.out.println(x); count --; if (count < 0) break; } Stopwatch timer2 = new Stopwatch(); //edu.princeton.cs.algs4.Merge.sort(b); Merge.sort(b); StdOut.print(timer2.elapsedTime()); count = 5; for (String x : b) { System.out.println(x); count --; if (count < 0) break; } } }
[ "yunfei.guo@bina.roche.com" ]
yunfei.guo@bina.roche.com
cc0fda1b02e8e48dfc3965864bced1e368cd321c
602f06298e7d6ba7be6f84e7037f179c611e0797
/src/main/java/com/wildcodeschool/ekolis/EkolisApplication.java
4ea95d6901a050f75211d2c6c60cf25aa542d1a8
[]
no_license
et3rnity45/Ekolis
e36039cf0b613d595fecbc5485d2b2dd47962236
3a948af35764054b9f2f074ce6fe6699ece4366a
refs/heads/dev
2020-11-26T08:03:42.672562
2019-12-20T11:41:46
2019-12-20T11:41:46
229,010,032
1
1
null
2019-12-20T03:07:28
2019-12-19T08:32:02
HTML
UTF-8
Java
false
false
318
java
package com.wildcodeschool.ekolis; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class EkolisApplication { public static void main(String[] args) { SpringApplication.run(EkolisApplication.class, args); } }
[ "quentinlgr45160@gmail.com" ]
quentinlgr45160@gmail.com
11abd7eb279f1a4adcf8f742f9706eb6c7c6775e
35d1bf7931672cb5e036131ea2c82aafd7d6d461
/app/src/androidTest/java/com/example/augmentedhighereducationfortruckdrivers/HelpActivityTest.java
1ec6f00967a1838de64c4f68d45e62e1887d6963
[]
no_license
PearlBajaj/Capstone-TruckieAcademy
0b9200a5843d273dfff47e77240dc188546b782d
238e6292006e793ccb552a6422479205a1826acf
refs/heads/master
2022-09-04T03:57:34.692231
2020-05-29T05:41:00
2020-05-29T05:41:00
267,774,482
0
0
null
null
null
null
UTF-8
Java
false
false
6,013
java
package com.example.augmentedhighereducationfortruckdrivers; import android.content.Intent; import android.view.View; import androidx.test.rule.ActivityTestRule; import org.hamcrest.core.IsNot; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.assertion.ViewAssertions.matches; import static androidx.test.espresso.matcher.ViewMatchers.isClickable; import static androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast; import static androidx.test.espresso.matcher.ViewMatchers.isEnabled; import static androidx.test.espresso.matcher.ViewMatchers.isSelected; import static androidx.test.espresso.matcher.ViewMatchers.withId; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.not; import static org.junit.Assert.*; public class HelpActivityTest { @Rule public ActivityTestRule<HelpActivity> hActivityTestRule = new ActivityTestRule<HelpActivity>(HelpActivity.class, false, false); public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class); private HelpActivity hActivity = null; @Before public void setUp() throws Exception { hActivity = hActivityTestRule.getActivity(); } @Test public void testLaunch() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); } @Test public void buttonIsClickable() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(isClickable())); } @Test public void buttonIsEnabled() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(isEnabled())); } @Test public void buttonIsDisplayed() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(isDisplayed())); } @Test public void buttonIsCompletelyDisplayed() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(isCompletelyDisplayed())); } @Test public void testWelcomeBack() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); assertEquals(HelpActivity.text1, "Welcome back."); } @Test public void testWhetherToolBarIsDisplayedAtLeast1() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.node_name_view1)).check(matches(isDisplayingAtLeast(1))); } @Test public void testWhetherToolBarIsDisplayedAtLeast2() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.node_name_view1)).check(matches(isDisplayingAtLeast(2))); } @Test public void testWhetherToolBarIsDisplayedAtLeast10() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.node_name_view1)).check(matches(isDisplayingAtLeast(10))); } @Test public void buttonIsNotSelectable() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(not(isSelected()))); } @Test public void testButtonIsNotEmpty() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.node_name_view1)).check(matches(not(withText("")))); } @Test public void textViewIsNotClickable() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(not(isClickable()))); } @Test public void testViewIsEnabled() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(isEnabled())); } @Test public void textViewIsDisplayed() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(isDisplayed())); } @Test public void textViewIsCompletelyDisplayed() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(isCompletelyDisplayed())); } @Test public void testTextViewWhetherToolBarIsDisplayedAtLeast1() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.text_1)).check(matches(isDisplayingAtLeast(1))); } @Test public void testTextViewWhetherToolBarIsDisplayedAtLeast2() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.text_1)).check(matches(isDisplayingAtLeast(2))); } @Test public void testTextViewWhetherToolBarIsDisplayedAtLeast10() { Intent intent = new Intent(); hActivityTestRule.launchActivity(intent); onView(withId(R.id.text_1)).check(matches(isDisplayingAtLeast(10))); } @Test public void testTextViewIsSelectable() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(isSelected())); } @Test public void testTextViewIsNotEmpty() { Intent i = new Intent(); hActivityTestRule.launchActivity(i); onView(withId(R.id.text_1)).check(matches(not(withText("")))); } @After public void tearDown() throws Exception { hActivity = null; } }
[ "pbaj0157@uni.sydney.edu.au" ]
pbaj0157@uni.sydney.edu.au
0a0a0b8f23640c72ca45098bd4d2bcf3a0d18026
fb1df2ea6f072cbcebdcd6ad4ec082712ff5369f
/HerokuDataTestLoad/src/test/java/com/heroku/HerokuDataTestLoadApplicationTests.java
4327db0debbad201cfbeb7750cb7588d11ecd643
[]
no_license
saimuth/HerokuDataLoadTest
e58daea644871aacb42a09cfe137dab07316de41
5e9f11a524deeb46e7c5cad8235e4ca94c2fab9a
refs/heads/main
2023-01-18T14:48:16.483841
2020-11-23T15:43:58
2020-11-23T15:43:58
315,361,846
0
0
null
null
null
null
UTF-8
Java
false
false
3,068
java
package com.heroku; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.junit.Before; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import com.heroku.dao.HerokuDataDaoImpl; import com.heroku.model.ResponseAnswer; import com.heroku.service.HerokuDataServiceImpl; @SpringBootTest @RunWith(SpringRunner.class) @AutoConfigureMockMvc class HerokuDataTestLoadApplicationTests { @Test void contextLoads() { } @Mock private HerokuDataDaoImpl herokuDataDaoImpl; @InjectMocks private HerokuDataServiceImpl herokuDataServiceImpl; /* * @InjectMocks private JdbcTemplate jdbcTemplate; */ @Before public void init() { MockitoAnnotations.initMocks(this); } @Test public void insertResponseAnswerDataTest() { List<ResponseAnswer> responseanswer = new ArrayList<ResponseAnswer>(); Date d = new Date(); ResponseAnswer rsa = new ResponseAnswer(); java.sql.Date fromdate = new java.sql.Date(d.getTime()); Timestamp ts = new Timestamp(d.getTime()); for (int i = 0; i < 10; i++) { rsa.setLastmodifieddate(ts); rsa.setIsdeleted(true); rsa.setAnswer__c("answer" + i); rsa.setResponse__c("response" + i); rsa.setName("name" + i); rsa.setSystemmodstamp(ts); rsa.setConnectionsentid("consentid" + i); rsa.setOwnerid("ownerid" + i); rsa.setCreatedbyid("createdid" + i); rsa.setCreateddate(ts); rsa.setConnectionreceivedid("conrviedid" + i); rsa.setLastmodifiedbyid("lastmedbyyid" + i); rsa.setSfid("sfid" + i); rsa.setId(Long.valueOf(i)); rsa.set_hc_lastop("hclasttop" + i); rsa.set_hc_err("hcerror" + i); responseanswer.add(rsa); } //Mockito.when(herokuDataDaoImpl.insertResponseAnswerData(responseanswer) // Mockito.when(herokuDataDaoImpl.insertResponseAnswerData(responseanswer)).thenReturn(Mockito.any()); // herokuDataServiceImpl.insertResponseAnswerData(); } /* * @Test public void insertResponseDataTest() { * herokuDataServiceImpl.insertResponseData(); } * * @Test public void insertApplicationDataTest() { * herokuDataServiceImpl.insertApplicationData(); } * * @Test public void insertAssessmentDataTest() { * herokuDataServiceImpl.insertAssessmentData();; } * * @Test public void insertEmailMessageDataTest() { * herokuDataServiceImpl.insertEmailMessageData(); } * * * @Test public void insertErrorLogDataTest() { * herokuDataServiceImpl.insertErrorLogData(); } * * @Test public void insertIntegrationTransactionDataTest() { * herokuDataServiceImpl.insertIntegrationTransactionData(); } */ }
[ "noreply@github.com" ]
saimuth.noreply@github.com
91ff2c18fdbe1877c508ebc50a1020aae97443ed
4daf2216b5b81f5ef82e428d8ed3269a2cdf6418
/src/main/java/cn/hzy/demo/service/DeptService.java
3bf176520d0aca1e10f024e70049f36b22313a39
[]
no_license
1332498780/quickstart
6ce875d41eec2e99a7aee6bb58c4b250cbd05426
142d78f365a1663fc7c0ebd39b78c20042260c0b
refs/heads/master
2023-04-23T03:41:57.251845
2021-05-07T15:37:03
2021-05-07T15:37:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
196
java
package cn.hzy.demo.service; import cn.hzy.demo.model.DDept; import cn.hzy.demo.model.Dept; import java.util.List; public interface DeptService { void insert(); String findAll(); }
[ "huangzhuyun@haohandata.com.cn" ]
huangzhuyun@haohandata.com.cn
2aef027e46e4d767de83a05c1c157cf234eca253
d1f95baefdbe6393467767788fb9e710a13f4869
/src/main/java/com/alibaba/druid/sql/dialect/mysql/ast/statement/MySqlPartitionByList.java
2aff940a4fb56102e69e0025ee1a87890d1d069d
[]
no_license
jilen/druid
19cec538ba655ddde455ad7e63af45fad3ff94df
0da4c693d3e1aa3d5506089887ee013964cce0bf
refs/heads/master
2021-01-18T18:55:57.735649
2013-06-27T07:03:41
2013-06-27T07:03:41
11,017,656
9
0
null
null
null
null
UTF-8
Java
false
false
2,130
java
/* * Copyright 1999-2011 Alibaba Group Holding 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 com.alibaba.druid.sql.dialect.mysql.ast.statement; import java.util.ArrayList; import java.util.List; import com.alibaba.druid.sql.ast.SQLExpr; import com.alibaba.druid.sql.ast.SQLName; import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor; public class MySqlPartitionByList extends MySqlPartitioningClause { private static final long serialVersionUID = 1L; private SQLExpr expr; private List<SQLName> columns = new ArrayList<SQLName>(); private SQLExpr partitionCount; @Override public void accept0(MySqlASTVisitor visitor) { if (visitor.visit(this)) { acceptChild(visitor, expr); acceptChild(visitor, columns); acceptChild(visitor, partitionCount); acceptChild(visitor, getPartitions()); } visitor.endVisit(this); } public SQLExpr getExpr() { return expr; } public void setExpr(SQLExpr expr) { if (expr != null) { expr.setParent(this); } this.expr = expr; } public SQLExpr getPartitionCount() { return partitionCount; } public void setPartitionCount(SQLExpr partitionCount) { this.partitionCount = partitionCount; } public List<SQLName> getColumns() { return columns; } public void setColumns(List<SQLName> columns) { this.columns = columns; } }
[ "szujobs@hotmail.com" ]
szujobs@hotmail.com
c0506863f15d85b7d7398ff7a7617a25980f7642
515a2e5570c865190784cb4500c083b689ab1bae
/Lab 5 and 6 JSF Tag and Navigation/Lab 6 JSFTravel/src/java/managedBeans/LoginJSFManagedBean.java
cf84fec62d0b85d44a3350182bb0e5c044550b15
[]
no_license
JuliaChenJing/WAA
930451c81296f56be1d2f8d02adc49f92ef941bd
5d2bf53b90a4db786ee847457fc5d7d42d9c69a0
refs/heads/master
2021-01-24T02:22:00.214580
2018-05-21T02:31:21
2018-05-21T02:31:21
122,843,578
0
0
null
null
null
null
UTF-8
Java
false
false
918
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 managedBeans; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class LoginJSFManagedBean { String userId; String password; public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String submit() { if (this.userId.equals("admin") && this.password.equals("admin")) { return "loginSuccess.xhtml"; } else { return "loginFailure.xhtml"; } } }
[ "juliachenjing@gmail.com" ]
juliachenjing@gmail.com
ce28642c17138c794cf5c7fe1b9ea12b4ffd4a4f
eb922b31917c92e1a8622d88cf1d1d0bb7688464
/app/src/main/java/com/example/sampleandroid/http/TrustUserSSLCertsSocketFactory.java
cd2e36c128239609e0f8ac16b119e24a976b01d0
[]
no_license
shanyaodan/androidProSample-master
f17ed2a2115c2dbad86e4bd79b3b4581751f5e7c
4665b5dd922364e08eedaa503dd1ada06b568898
refs/heads/master
2016-09-06T14:18:12.530435
2015-07-13T05:46:52
2015-07-13T05:46:52
38,985,166
0
0
null
null
null
null
UTF-8
Java
false
false
5,364
java
package com.example.sampleandroid.http; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import java.security.GeneralSecurityException; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.TrustManager; import org.apache.http.conn.scheme.SocketFactory; import org.apache.http.conn.ssl.BrowserCompatHostnameVerifier; import org.apache.http.conn.ssl.SSLSocketFactory; import android.annotation.SuppressLint; import android.net.SSLCertificateSocketFactory; import android.os.Build; /** * Custom SSLSocketFactory that adds Self-Signed (trusted) certificates, and SNI * support. * * Loosely based on: * http://blog.dev001.net/post/67082904181/android-using-sni-and * -tlsv1-2-with-apache-httpclient * * Ref: https://github.com/wordpress-mobile/WordPress-Android/issues/1288 * */ public class TrustUserSSLCertsSocketFactory extends SSLSocketFactory { private SSLCertificateSocketFactory mFactory; private static final BrowserCompatHostnameVerifier mHostnameVerifier = new BrowserCompatHostnameVerifier(); public TrustUserSSLCertsSocketFactory() throws IOException, GeneralSecurityException { super(null); // No handshake timeout used mFactory = (SSLCertificateSocketFactory) SSLCertificateSocketFactory .getDefault(0); TrustManager[] trustAllowedCerts; try { trustAllowedCerts = new TrustManager[] { new WPTrustManager( SelfSignedSSLCertsManager.getInstance(null) .getLocalKeyStore()) }; mFactory.setTrustManagers(trustAllowedCerts); } catch (GeneralSecurityException e1) { } } public static SocketFactory getDefault() throws IOException, GeneralSecurityException { return new TrustUserSSLCertsSocketFactory(); } public Socket createSocket() throws IOException { return mFactory.createSocket(); } @Override public Socket createSocket(Socket plainSocket, String host, int port, boolean autoClose) throws IOException { if (autoClose) { // we don't need the plainSocket plainSocket.close(); } SSLSocket ssl = (SSLSocket) mFactory.createSocket( InetAddress.getByName(host), port); return enableSNI(ssl, host); } @SuppressLint("NewApi") private Socket enableSNI(SSLSocket ssl, String host) throws SSLPeerUnverifiedException { // enable TLSv1.1/1.2 if available // (see https://github.com/rfc2822/davdroid/issues/229) ssl.setEnabledProtocols(ssl.getSupportedProtocols()); // set up SNI before the handshake if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { mFactory.setHostname(ssl, host); } else { try { java.lang.reflect.Method setHostnameMethod = ssl.getClass() .getMethod("setHostname", String.class); setHostnameMethod.invoke(ssl, host); } catch (Exception e) { } } // verify hostname and certificate SSLSession session = ssl.getSession(); if (!mHostnameVerifier.verify(host, session)) { // the verify failed. We need to check if the current certificate is // in Trusted Store. try { Certificate[] errorChain = ssl.getSession() .getPeerCertificates(); X509Certificate[] X509CertificateChain = new X509Certificate[errorChain.length]; for (int i = 0; i < errorChain.length; i++) { X509Certificate x509Certificate = (X509Certificate) errorChain[0]; X509CertificateChain[i] = x509Certificate; } if (X509CertificateChain.length == 0) { throw new SSLPeerUnverifiedException( "Cannot verify hostname: " + host); } if (!SelfSignedSSLCertsManager.getInstance(null) .isCertificateTrusted(X509CertificateChain[0])) { SelfSignedSSLCertsManager.getInstance(null) .setLastFailureChain(X509CertificateChain); throw new SSLPeerUnverifiedException( "Cannot verify hostname: " + host); } } catch (GeneralSecurityException e) { throw new SSLPeerUnverifiedException("Cannot verify hostname: " + host); } catch (IOException e) { throw new SSLPeerUnverifiedException("Cannot verify hostname: " + host); } catch (Exception e) { // We don't want crash the app here for an unexpected error throw new SSLPeerUnverifiedException("Cannot verify hostname: " + host); } } return ssl; } public Socket createSocket(InetAddress inaddr, int i, InetAddress inaddr1, int j) throws IOException { SSLSocket ssl = (SSLSocket) mFactory .createSocket(inaddr, i, inaddr1, j); return enableSNI(ssl, inaddr.getHostName()); } public Socket createSocket(InetAddress inaddr, int i) throws IOException { SSLSocket ssl = (SSLSocket) mFactory.createSocket(inaddr, i); return enableSNI(ssl, inaddr.getHostName()); } public Socket createSocket(String s, int i, InetAddress inaddr, int j) throws IOException { SSLSocket ssl = (SSLSocket) mFactory.createSocket(s, i, inaddr, j); return enableSNI(ssl, inaddr.getHostName()); } public Socket createSocket(String s, int i) throws IOException { SSLSocket ssl = (SSLSocket) mFactory.createSocket(s, i); return enableSNI(ssl, s); } public String[] getDefaultCipherSuites() { return mFactory.getDefaultCipherSuites(); } public String[] getSupportedCipherSuites() { return mFactory.getSupportedCipherSuites(); } }
[ "735383226@qq.com" ]
735383226@qq.com
a5942dddf44070b2d9c80b981783ee5d6df5a915
8d87655a9ee58f156a0b68e073b989e4ac3209f4
/app/src/main/java/com/yeghon/myfarmapp/ui/main/CropsActivity.java
b22fa202dc8934313ec782cb4d2a985f0feebe6e
[ "Apache-2.0" ]
permissive
Yeghon/MyFarmApp
64916fdf20bf11fe35493aaba956a6b7f6251d76
a4af1acd00992813bc95c92deba6366db190b7f0
refs/heads/master
2022-12-25T01:47:33.120621
2020-10-08T15:42:32
2020-10-08T15:42:32
299,051,380
0
0
null
null
null
null
UTF-8
Java
false
false
293
java
package com.yeghon.myfarmapp.ui.main; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; /** * Created on Thursday, 10/8/20 * By YeghonHaron. * Copyright 2020 Yjungle Inc. */ public class CropsActivity extends Fragment { }
[ "haronyegon90@gmail.com" ]
haronyegon90@gmail.com
6d2204007ae84ee1b534da5989fb3573cb739ada
0dd38dbe46b12cdda22f4dea4dec6f24a53e9605
/springboot/springbootdemo2/src/main/java/Application.java
c85725fd6af413187598f73a99531a7d7804a870
[]
no_license
liushuang/microservice-ppt
da2c25d4bf4a817314f8cde0662b2fad6db97516
ed2482fb32523d8948a46d81657d2cb9a83d7dc3
refs/heads/master
2022-12-25T11:30:37.342207
2019-07-15T03:24:14
2019-07-15T03:24:14
194,486,327
2
0
null
2022-12-16T00:20:56
2019-06-30T07:08:01
Java
UTF-8
Java
false
false
572
java
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @SpringBootApplication public class Application { @ResponseBody @RequestMapping("/hello") public String hello(){ return "Hello world"; } public static void main(String[] args){ SpringApplication.run(Application.class); } }
[ "525982193@qq.com" ]
525982193@qq.com
086339062c3ccd43445586bec8f4414dc079ddbd
ce6dc319aeacd8ab68cb98a0a1c24eeea93cde29
/com/sqli/train/wagons/Head.java
65f2c654b1772580a18a0ffe179236859abac895
[]
no_license
MedJawad/SQLI-Train-Challenge
c244335561214ffe049ad9cf840e6e55bc0cde78
571b909f33c28e5e6956c6dcbcfccf3a874b36e4
refs/heads/master
2023-01-22T20:38:59.158665
2020-11-24T13:46:38
2020-11-24T13:46:38
315,644,966
1
0
null
null
null
null
UTF-8
Java
false
false
474
java
package com.sqli.train.wagons; import com.sqli.train.ITrain; import com.sqli.train.Representation; public class Head extends TrainDecorator { public Head(ITrain train) { super(train); } @Override public String getRepresentation() { if(train.getRepresentation().isEmpty()) return train.getRepresentation()+ Representation.LHEAD; return train.getRepresentation()+Representation.SEPARATOR+ Representation.RHEAD; } }
[ "mohamedjawad.aatafay@gmail.com" ]
mohamedjawad.aatafay@gmail.com
af152e6d3a54ebfe48a8da972d967e6dc55d3e5e
cde8fe31ee9903f8583b82d7750b023553e736b6
/app/src/main/java/it/alessioricco/tsflickr/api/RestAdapterFactory.java
de055829d5123799fb9ff43ff3a272ec7ad27e98
[]
no_license
alessioricco/TsFlickr
28978af97d00b77a1ac0345a8a7541cb40510917
7863e426aa0f5656e538034b8c7da0c4b9c2b6fb
refs/heads/master
2021-01-19T00:57:54.581989
2016-11-11T10:35:45
2016-11-11T10:35:45
73,289,298
0
0
null
null
null
null
UTF-8
Java
false
false
2,177
java
package it.alessioricco.tsflickr.api; import android.util.Log; import java.io.IOException; import it.alessioricco.tsflickr.injection.ObjectGraphSingleton; import retrofit2.Retrofit; import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; import rx.schedulers.Schedulers; /** * factory for calling the public flickr endpoint * the adapter will return an Observable * the request will be logged on the console * * for testing this class with a mock server * we should override getBaseUrl() * * todo: make it more abstract (make it indipendent from the base url) */ public class RestAdapterFactory { protected String getBaseUrl() { return "https://api.flickr.com"; } public RestAdapterFactory() { ObjectGraphSingleton.getInstance().inject(this); } /** * build an OkHttp client * mostly used for logging the correct endpoint url * * todo: we can inject it * @return okhttp3.OkHttpClient */ private okhttp3.OkHttpClient createClient() { return new okhttp3.OkHttpClient() .newBuilder() .addInterceptor(new okhttp3.Interceptor() { @Override public okhttp3.Response intercept(Chain chain) throws IOException { okhttp3.Request request = chain.request(); Log.i("rest", request.url().toString()); return chain.proceed(chain.request()); } }).build(); } // todo: refactor to be a class and not a method /** * build a REST Json adapter * able to return Observable results * * @return */ public Retrofit createJSONRestAdapter() { final RxJavaCallAdapterFactory rxAdapter = RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()); return new Retrofit.Builder() .baseUrl(getBaseUrl()) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(rxAdapter) .client(createClient()) .build(); } }
[ "alessio.ricco@gmail.com" ]
alessio.ricco@gmail.com
565b00d73247faf8b21a4a38b54faef941bf8eb1
ba33da805c0dff98c04154661876815335beb759
/CSC176/textbook/book/ShowGridPane.java
45b1dd6debe742d191d322991fa8e8e27b3b6548
[ "OFL-1.1", "MIT", "Unlicense" ]
permissive
XiangHuang-LMC/ijava-binder
edd2eab8441a8b6de12ebcda1b160141b95f079e
4aac9e28ec62d386c908c87b927e1007834ff58a
refs/heads/master
2020-12-23T20:45:50.518280
2020-03-20T20:15:03
2020-03-20T20:15:03
237,268,296
4
0
Unlicense
2020-01-30T17:36:57
2020-01-30T17:36:56
null
UTF-8
Java
false
false
1,623
java
import javafx.application.Application; import javafx.geometry.HPos; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class ShowGridPane extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane and set its properties GridPane pane = new GridPane(); pane.setAlignment(Pos.CENTER); pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5)); pane.setHgap(5.5); pane.setVgap(5.5); // Place nodes in the pane pane.add(new Label("First Name:"), 0, 0); pane.add(new TextField(), 1, 0); pane.add(new Label("MI:"), 0, 1); pane.add(new TextField(), 1, 1); pane.add(new Label("Last Name:"), 0, 2); pane.add(new TextField(), 1, 2); Button btAdd = new Button("Add Name"); pane.add(btAdd, 1, 3); GridPane.setHalignment(btAdd, HPos.RIGHT); // Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage.setTitle("ShowGridPane"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage } /** * The main method is only needed for the IDE with limited * JavaFX support. Not needed for running from the command line. */ public static void main(String[] args) { launch(args); } }
[ "huangxx@lemoyne.edu" ]
huangxx@lemoyne.edu
3d997813df21ceb6dd3bd84d4517dea850f8fb21
138d04e1d95b761e213f841b7f6bcd338a1c557b
/app/src/main/java/com/chen/app/ui/kline/KLineEntity.java
1369a236271ce3ecec342dda5864dff2c3fb8c45
[ "Apache-2.0" ]
permissive
wallee98/EasyAndroid
fcc9c4a4515d14deced838bf781975687db5cea4
85ffc5e307c6171767e14bbfaf992b8d62ec1cc6
refs/heads/master
2023-04-24T12:11:06.725030
2021-05-12T11:35:50
2021-05-12T11:35:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,407
java
package com.chen.app.ui.kline; import com.chen.app.k_line.entity.IKLine; /** * K线实体 * Created by tifezh on 2016/5/16. */ public class KLineEntity implements IKLine { public String getDatetime() { return Date; } @Override public float getOpenPrice() { return Open; } @Override public float getHighPrice() { return High; } @Override public float getLowPrice() { return Low; } @Override public float getClosePrice() { return Close; } @Override public float getMA5Price() { return MA5Price; } @Override public float getMA10Price() { return MA10Price; } @Override public float getMA20Price() { return MA20Price; } @Override public float getDea() { return dea; } @Override public float getDif() { return dif; } @Override public float getMacd() { return macd; } @Override public float getK() { return k; } @Override public float getD() { return d; } @Override public float getJ() { return j; } @Override public float getRsi1() { return rsi1; } @Override public float getRsi2() { return rsi2; } @Override public float getRsi3() { return rsi3; } @Override public float getUp() { return up; } @Override public float getMb() { return mb; } @Override public float getDn() { return dn; } @Override public float getVolume() { return Volume; } @Override public float getMA5Volume() { return MA5Volume; } @Override public float getMA10Volume() { return MA10Volume; } public String Date; public float Open; public float High; public float Low; public float Close; public float Volume; public float MA5Price; public float MA10Price; public float MA20Price; public float dea; public float dif; public float macd; public float k; public float d; public float j; public float rsi1; public float rsi2; public float rsi3; public float up; public float mb; public float dn; public float MA5Volume; public float MA10Volume; }
[ "chenyanqiang@mbcloud.com" ]
chenyanqiang@mbcloud.com
5776ff69e285c7a909b07e541d4054591958423e
31ed56dc2f57e7dd23c6a3a551fd589beda635c9
/src/main/java/top/yyqdemao/mytime/api/constant/ContentType.java
69aeebb8d098dd5e825187b8ebce10f347501057
[]
no_license
catborry/mytime
62cb7269fdaae2e1b371e34f1ed4bf0ee92b468d
dc25f9927504ca24b5b321342722c09528a51991
refs/heads/master
2020-05-03T07:22:11.625658
2019-04-03T02:54:29
2019-04-03T02:54:29
178,317,895
0
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package top.yyqdemao.mytime.api.constant; /** * 常用HTTP Content-Type常量 */ public class ContentType { //表单类型Content-Type public static final String CONTENT_TYPE_FORM = "application/x-www-form-urlencoded; charset=UTF-8"; // 流类型Content-Type public static final String CONTENT_TYPE_STREAM = "application/octet-stream; charset=UTF-8"; //JSON类型Content-Type public static final String CONTENT_TYPE_JSON = "application/json; charset=UTF-8"; //XML类型Content-Type public static final String CONTENT_TYPE_XML = "application/xml; charset=UTF-8"; //文本类型Content-Type public static final String CONTENT_TYPE_TEXT = "application/text; charset=UTF-8"; }
[ "2591981044@qq.com" ]
2591981044@qq.com
613384d587c56b60770c7097a50586dd52187bc2
51e39be02959da13b9e3b9808546236db4f6c5d5
/src/main/java/com/govind/helloworld/controller/HomeController.java
eda409f2d93091a31d12ca68c3982c5bd362576a
[]
no_license
govindkailas/springboot-helloworld
1b6e20727d6ecfe42aef376519ba28f0342ae171
39d752947aa2d190f908f36ad2ae3cd5a54f5308
refs/heads/master
2022-12-31T18:06:43.690816
2020-10-04T16:28:02
2020-10-04T16:28:02
301,150,686
0
0
null
null
null
null
UTF-8
Java
false
false
479
java
package com.govind.helloworld.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @Controller public class HomeController { @GetMapping("/") public String hello(){ return "hello"; } @GetMapping("/message") public String message(Model model) { model.addAttribute("message", "This is a custom message"); return "message"; } }
[ "gkailathuvalap@gkailathuva-a01.vmware.com" ]
gkailathuvalap@gkailathuva-a01.vmware.com
9e6dfef2dccce0fbadab2a1fafdc30a1a49140a7
88a47df5695fe4d30ee4e1ad344cb9c549cebc34
/app2/src/main/java/com/apptwo/app2/App2Application.java
96cb079e049fadfb0a38b9a47ba96ba46a618be2
[]
no_license
PravinKumarTY/SSOImplCode
cfcbf5bd2bf8abf21d282efbc72a2fbcbb6e7b27
4eba78a550e939ab574488e09748439a8cce37ca
refs/heads/master
2020-09-30T19:50:25.954451
2019-12-14T17:29:04
2019-12-14T17:29:04
227,360,498
0
0
null
2019-12-14T10:05:48
2019-12-11T12:26:31
Java
UTF-8
Java
false
false
407
java
package com.apptwo.app2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; @SpringBootApplication @EnableOAuth2Sso public class App2Application { public static void main(String[] args) { SpringApplication.run(App2Application.class, args); } }
[ "pravin.k@testyantra.in" ]
pravin.k@testyantra.in
4d561f51abeadb2330e5c68fbf6a7fe63d1221f4
a6b4f5ce45322390e302be96211294941703873c
/src/jp/co/hybitz/transit/TransitSearcherFactory.java
75f50f581228611bb6b177ea7423b3a64603bf81
[]
no_license
ichylinux/EasyGoogleTransit
48d1524b6b476cee4466ee0f4aaa1da311cb84c8
093cb0f52a08f8f76e4995b8f19703dd2c3a70ea
refs/heads/master
2016-09-01T18:22:50.801172
2012-11-10T06:00:33
2012-11-10T06:00:33
675,016
0
1
null
null
null
null
UTF-8
Java
false
false
2,089
java
/** * Copyright (C) 2010 Hybitz.co.ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * */ package jp.co.hybitz.transit; import jp.co.hybitz.common.Engine; import jp.co.hybitz.common.Platform; import jp.co.hybitz.common.Searcher; import jp.co.hybitz.transit.goo.GooMobileTransitSearcher; import jp.co.hybitz.transit.google.MobileSearcher20100827; import jp.co.hybitz.transit.model.TransitQuery; import jp.co.hybitz.transit.model.TransitResult; /** * @author ichy <ichylinux@gmail.com> */ public class TransitSearcherFactory { public static Searcher<TransitQuery, TransitResult> createSearcher(Engine engine) { if (engine == Engine.GOO) { return new GooMobileTransitSearcher(Platform.HTML); } else if (engine == Engine.GOOGLE) { return new MobileSearcher20100827(Platform.GENERIC); } throw new IllegalArgumentException("検索エンジンの指定が不正です。engine=" + engine); } public static Searcher<TransitQuery, TransitResult> createSearcher(Engine engine, Platform platform) { if (engine == Engine.GOO) { return new GooMobileTransitSearcher(Platform.HTML); } else if (engine == Engine.GOOGLE) { return new MobileSearcher20100827(platform); } throw new IllegalArgumentException("検索エンジンの指定が不正です。engine=" + engine); } }
[ "ichy@VAIO-Z" ]
ichy@VAIO-Z
633bee8e75da198120c57d4d34a8a4b26b36915f
dd7e9009520165eda51ae0fdb2d73af59a944f40
/src/main/java/com/qst/servlet/EmployeeLoginServlet.java
dfa5ef08620f170e542e29c6be0a9d297b08595d
[]
no_license
jishoukang/test
723694ca10bbc2d282ea518530d2cd7e0cc766ff
982185cc09bfd31f09f7b4a9fd7cfb1db299f0dc
refs/heads/master
2023-02-15T04:12:35.753114
2021-01-03T15:16:03
2021-01-03T15:16:03
326,430,518
0
0
null
null
null
null
UTF-8
Java
false
false
2,330
java
package com.qst.servlet; import com.qst.bean.Employee; import com.qst.bean.Salary; import com.qst.dao.EmployeeDAO; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; @WebServlet(urlPatterns = "/EmployeeLoginServlet") public class EmployeeLoginServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); // 获取前台提交的账号和密码 String account = request.getParameter("account"); String password = request.getParameter("password"); // 根据account和密码查询申请人 EmployeeDAO employeeDAO = new EmployeeDAO(); Employee employee = employeeDAO.getEmployeeByAccountAndPass(account, password); // Salary salary=new Salary(); // salary.setId(employee.getId()); // 将当前登录用户的建立ID,保存到Session中 String employeeID=employee.getId(); String salaryID=employee.getId(); request.getSession().setAttribute("SESSION_employeeID",employeeID); request.getSession().setAttribute("SESSION_salaryID",salaryID); if(employee!=null){ //信息放入请求作用域,在主页面展示该对象信息 request.setAttribute("employee",employee); // 请求转发到主页面 request.getRequestDispatcher("person_info.jsp").forward(request,response); } else{ //通过response对象给客户端一个错误提示 PrintWriter writer = response.getWriter(); writer.write("<script>"); writer.write(" alert('账号或密码错误!!');"); writer.write("window.location.href='employee_login.jsp'"); writer.write("</script>"); writer.flush(); writer.close(); } } }
[ "1831971665@qq.com" ]
1831971665@qq.com
e670362cdeeedc3d606782eb7b1dc428c0ee06de
dcdf6bb206e528d9e93cedaa0fe4cadd2e93f603
/src/main/java/com/zhongying/crm/controller/pc/AreaController.java
41a3f047ef8960e155e1cde594537af9160139f5
[]
no_license
encnencn/learnCrm
b7bb01f83ef6f4cd18afe9098d2d0aef5bfc2965
70f429013b3db44272b6c4b6f4ab834b3ba9d453
refs/heads/master
2020-04-13T10:49:41.288703
2019-01-24T09:10:30
2019-01-24T09:10:30
163,154,477
0
0
null
null
null
null
UTF-8
Java
false
false
1,919
java
package com.zhongying.crm.controller.pc; import java.util.List; import javax.annotation.Resource; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.alibaba.fastjson.JSONArray; import com.zhongying.crm.model.Area; import com.zhongying.crm.service.AreaService; /** * @author feng * @version 1.15, 2017年5月17日 下午2:54:28 * */ @RestController public class AreaController { @Resource private AreaService areaService; @RequestMapping("/queryAllArea") public JSONArray queryAllArea() { JSONArray jsonTable = new JSONArray(); List<Area> arealist = areaService.queryAllArea(); for (Area area : arealist) { jsonTable.add(area); } return jsonTable; } @RequestMapping("/queryByAreaName") public JSONArray queryByAreaName(String areaName) { JSONArray jsonTable = new JSONArray(); Area area= areaService.queryByAreaName(areaName); if(area == null){ return jsonTable; } else{ jsonTable.add(area); return jsonTable; } } @RequestMapping("/deleteArea") public Boolean deleteArea(Integer id){ return areaService.deleteArea(id); } @RequestMapping("/saveArea") public Boolean saveArea(String name){ if(areaService.queryByAreaName(name)==null){ return areaService.saveArea(name); }else{ return false; } } @RequestMapping("/updateAreaSubmit") public Boolean updateAreaSubmit(Integer id,String areaName){ Area area=areaService.queryAreaById(id); if(area.getName().equals(areaName)){ return true; }else{ if(areaService.queryByAreaName(areaName)==null){ return areaService.updateAreaSubmit(id,areaName); }else{ return false; } } } @RequestMapping("/quyuNameExistOrnot") public Boolean quyuNameExistOrnot(String name){ if(areaService.queryByAreaName(name)==null){ return true; }else{ return false; } } }
[ "931526599@qq.com" ]
931526599@qq.com
061c6fcc797f492df155da6e1020dea590bbc1ac
e356b4e10e20d580bdc53d967dba71380a3f1dfd
/java/jflex/testing/assertion/ThrowingRunnable.java
465647091efb0199aa09280262805871d21223fc
[ "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
tool-recommender-bot/jflex
114f20cdb545cd34204230fa93090d7ea3607946
52e5915e79fafed8342dbbbdc9a5de093ce6ca48
refs/heads/master
2020-04-18T21:45:09.508117
2019-01-26T01:52:34
2019-01-26T01:52:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
276
java
package jflex.testing.assertion; /** * Similar to {@link Runnable} where the {@link #run()} returns something and can throw something. * * <p>This facilitates the use of method references in Java 8. */ public interface ThrowingRunnable { void run() throws Throwable; }
[ "noreply@github.com" ]
tool-recommender-bot.noreply@github.com
c1ac0d85e5e61059788dcf2c6a02bfe09d3317fc
9ced4820f3bc3510ed9806772cdaeb8bac094173
/src/main/java/com/gtja/wiki/WikiDriver.java
71b6c20fa2006e3f9e44f511f3f4eb8139dec091
[]
no_license
yixiao1874/hadoop
f93cd11715a730329c89648cd54ce9c5973a5e61
4c940d2989624da1fa7afdb0cb4d99f63ee2b8ec
refs/heads/master
2021-09-12T12:58:12.359084
2018-04-17T00:50:06
2018-04-17T00:50:06
114,966,204
1
0
null
null
null
null
UTF-8
Java
false
false
5,935
java
package com.gtja.wiki; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.mahout.math.VarLongWritable; import org.apache.mahout.math.VectorWritable; import java.io.IOException; public class WikiDriver { public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); //执行远端文件 conf.set("fs.defaultFS", "hdfs://192.168.56.100:9000"); //conf.set("dfs.replication", "2");//默认为3 //远端执行 conf.set("mapreduce.job.jar", "target/hadoop.jar"); conf.set("mapreduce.framework.name", "yarn"); conf.set("yarn.resourcemanager.hostname", "master"); conf.set("mapreduce.app-submission.cross-platform", "true"); Job job1 = Job.getInstance(conf); job1.setMapperClass(WikipediaToItemPrefsMapper.class); job1.setReducerClass(WikipediaToUserVectorReducer.class); job1.setMapOutputKeyClass(VarLongWritable.class); job1.setMapOutputValueClass(VarLongWritable.class); //将job1输出的文件格式设置为SequenceFileOutputFormat job1.setOutputKeyClass(VarLongWritable.class); job1.setOutputValueClass(VectorWritable.class); FileInputFormat.setInputPaths(job1, "/input/mywiki.txt"); FileOutputFormat.setOutputPath(job1, new Path("/output/wikiout")); job1.waitForCompletion(true); Job job2 = Job.getInstance(conf); job2.setMapperClass(UserVectorToCooccurrenceMapper.class); job2.setReducerClass(UserVectorToCooccurrenceReducer.class); job2.setMapOutputKeyClass(IntWritable.class); job2.setMapOutputValueClass(IntWritable.class); job2.setOutputKeyClass(IntWritable.class); job2.setOutputValueClass(VectorWritable.class); //将job2的输入文件格式设置为SequenceFileInputFormat FileInputFormat.setInputPaths(job1, "/output/wikiout"); FileOutputFormat.setOutputPath(job2, new Path("/output/wikiout1")); job2.waitForCompletion(true); /*if (args.length!=2) { System.out.println("useage: <input dir> <output dir>"); return 1; } OperatingFiles(args[0], args[1]); Configuration job1Conf = new Configuration(); Job job1 = new Job(job1Conf, "job1"); job1.setJarByClass(WikiDriver.class); job1.setMapperClass(WikipediaToItemPrefsMapper.class); job1.setReducerClass(WikipediaToUserVectorReducer.class); job1.setMapOutputKeyClass(VarLongWritable.class); job1.setMapOutputValueClass(VarLongWritable.class); //将job1输出的文件格式设置为SequenceFileOutputFormat job1.setOutputFormatClass(SequenceFileOutputFormat.class); job1.setOutputKeyClass(VarLongWritable.class); job1.setOutputValueClass(VectorWritable.class); FileInputFormat.addInputPath(job1, new Path(args[0])); FileOutputFormat.setOutputPath(job1, new Path(TMP_PATH)); Configuration job2Conf = new Configuration(); Job job2 = new Job(job2Conf, "job2"); job2.setJarByClass(WikiDriver.class); job2.setMapperClass(UserVectorToCooccurrenceMapper.class); job2.setReducerClass(UserVectorToCooccurrenceReducer.class); job2.setMapOutputKeyClass(IntWritable.class); job2.setMapOutputValueClass(IntWritable.class); job2.setOutputKeyClass(IntWritable.class); job2.setOutputValueClass(VectorWritable.class); //将job2的输入文件格式设置为SequenceFileInputFormat job2.setInputFormatClass(SequenceFileInputFormat.class); FileInputFormat.addInputPath(job2, new Path(TMP_PATH)); FileOutputFormat.setOutputPath(job2, new Path(args[1])); ControlledJob ctrlJob1 = new ControlledJob(job1.getConfiguration()); ctrlJob1.setJob(job1); ControlledJob ctrlJob2 = new ControlledJob(job2.getConfiguration()); ctrlJob2.setJob(job2); ctrlJob2.addDependingJob(ctrlJob1); JobControl JC = new JobControl("wiki job"); JC.addJob(ctrlJob1); JC.addJob(ctrlJob2); Thread thread = new Thread(JC); thread.start(); while (true) { if(JC.allFinished()) { System.out.println(JC.getSuccessfulJobList()); JC.stop(); System.exit(0); } if (JC.getFailedJobList().size() > 0) { System.out.println(JC.getFailedJobList()); JC.stop(); System.exit(1); } }*/ } /*//操作hdfs的文件夹 static void OperatingFiles(String input, String output) { Path inputPath = new Path(input); Path outputPath = new Path(output); Path tmpPath = new Path(TMP_PATH); Configuration conf = new Configuration(); conf.addResource(new Path(HADOOP_HOME+"/core-site.xml")); conf.addResource(new Path(HADOOP_HOME+"/hdfs-site.xml")); try { FileSystem hdfs = FileSystem.get(conf); if (!hdfs.exists(inputPath)) { System.out.println("input path no exist!"); } if (hdfs.exists(outputPath)) { System.out.println("output path:"+outputPath.toString()+ " exist, deleting this path..."); hdfs.delete(outputPath,true); } if (hdfs.exists(tmpPath)) { System.out.println("tmp path:"+tmpPath.toString()+ " exist, deleting this path..."); hdfs.delete(tmpPath,true); } } catch (Exception e) { } }*/ }
[ "1499957726@qq.com" ]
1499957726@qq.com
41f7e7a66217ba57788ae29180f9f556356346d3
44ce357ee9ca8df2f399f7e0fcdf385b7b34c245
/src/main/java/org/apache/commons/math3/complex/ComplexFormat.java
e4b89b4e2e7735bfc9aaa3d6ae4761735c845153
[]
no_license
silas1037/SkEye
a8712f273e1cadd69e0be7d993963016df227cb5
ed0ede814ee665317dab3209b8a33e38df24a340
refs/heads/master
2023-01-20T20:25:00.940114
2020-11-29T04:01:05
2020-11-29T04:01:05
315,267,911
0
0
null
null
null
null
UTF-8
Java
false
false
7,751
java
package org.apache.commons.math3.complex; import java.text.FieldPosition; import java.text.NumberFormat; import java.text.ParsePosition; import java.util.Locale; import org.apache.commons.math3.exception.MathIllegalArgumentException; import org.apache.commons.math3.exception.MathParseException; import org.apache.commons.math3.exception.NoDataException; import org.apache.commons.math3.exception.NullArgumentException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.util.CompositeFormat; public class ComplexFormat { private static final String DEFAULT_IMAGINARY_CHARACTER = "i"; private final String imaginaryCharacter; private final NumberFormat imaginaryFormat; private final NumberFormat realFormat; public ComplexFormat() { this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER; this.imaginaryFormat = CompositeFormat.getDefaultNumberFormat(); this.realFormat = this.imaginaryFormat; } public ComplexFormat(NumberFormat format) throws NullArgumentException { if (format == null) { throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT, new Object[0]); } this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER; this.imaginaryFormat = format; this.realFormat = format; } public ComplexFormat(NumberFormat realFormat2, NumberFormat imaginaryFormat2) throws NullArgumentException { if (imaginaryFormat2 == null) { throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT, new Object[0]); } else if (realFormat2 == null) { throw new NullArgumentException(LocalizedFormats.REAL_FORMAT, new Object[0]); } else { this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER; this.imaginaryFormat = imaginaryFormat2; this.realFormat = realFormat2; } } public ComplexFormat(String imaginaryCharacter2) throws NullArgumentException, NoDataException { this(imaginaryCharacter2, CompositeFormat.getDefaultNumberFormat()); } public ComplexFormat(String imaginaryCharacter2, NumberFormat format) throws NullArgumentException, NoDataException { this(imaginaryCharacter2, format, format); } public ComplexFormat(String imaginaryCharacter2, NumberFormat realFormat2, NumberFormat imaginaryFormat2) throws NullArgumentException, NoDataException { if (imaginaryCharacter2 == null) { throw new NullArgumentException(); } else if (imaginaryCharacter2.length() == 0) { throw new NoDataException(); } else if (imaginaryFormat2 == null) { throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT, new Object[0]); } else if (realFormat2 == null) { throw new NullArgumentException(LocalizedFormats.REAL_FORMAT, new Object[0]); } else { this.imaginaryCharacter = imaginaryCharacter2; this.imaginaryFormat = imaginaryFormat2; this.realFormat = realFormat2; } } public static Locale[] getAvailableLocales() { return NumberFormat.getAvailableLocales(); } public String format(Complex c) { return format(c, new StringBuffer(), new FieldPosition(0)).toString(); } public String format(Double c) { return format(new Complex(c.doubleValue(), 0.0d), new StringBuffer(), new FieldPosition(0)).toString(); } public StringBuffer format(Complex complex, StringBuffer toAppendTo, FieldPosition pos) { pos.setBeginIndex(0); pos.setEndIndex(0); CompositeFormat.formatDouble(complex.getReal(), getRealFormat(), toAppendTo, pos); double im = complex.getImaginary(); if (im < 0.0d) { toAppendTo.append(" - "); toAppendTo.append(formatImaginary(-im, new StringBuffer(), pos)); toAppendTo.append(getImaginaryCharacter()); } else if (im > 0.0d || Double.isNaN(im)) { toAppendTo.append(" + "); toAppendTo.append(formatImaginary(im, new StringBuffer(), pos)); toAppendTo.append(getImaginaryCharacter()); } return toAppendTo; } private StringBuffer formatImaginary(double absIm, StringBuffer toAppendTo, FieldPosition pos) { pos.setBeginIndex(0); pos.setEndIndex(0); CompositeFormat.formatDouble(absIm, getImaginaryFormat(), toAppendTo, pos); if (toAppendTo.toString().equals("1")) { toAppendTo.setLength(0); } return toAppendTo; } public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) throws MathIllegalArgumentException { if (obj instanceof Complex) { return format((Complex) obj, toAppendTo, pos); } if (obj instanceof Number) { return format(new Complex(((Number) obj).doubleValue(), 0.0d), toAppendTo, pos); } throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_FORMAT_INSTANCE_AS_COMPLEX, obj.getClass().getName()); } public String getImaginaryCharacter() { return this.imaginaryCharacter; } public NumberFormat getImaginaryFormat() { return this.imaginaryFormat; } public static ComplexFormat getInstance() { return getInstance(Locale.getDefault()); } public static ComplexFormat getInstance(Locale locale) { return new ComplexFormat(CompositeFormat.getDefaultNumberFormat(locale)); } public static ComplexFormat getInstance(String imaginaryCharacter2, Locale locale) throws NullArgumentException, NoDataException { return new ComplexFormat(imaginaryCharacter2, CompositeFormat.getDefaultNumberFormat(locale)); } public NumberFormat getRealFormat() { return this.realFormat; } public Complex parse(String source) throws MathParseException { ParsePosition parsePosition = new ParsePosition(0); Complex result = parse(source, parsePosition); if (parsePosition.getIndex() != 0) { return result; } throw new MathParseException(source, parsePosition.getErrorIndex(), Complex.class); } public Complex parse(String source, ParsePosition pos) { int sign; int initialIndex = pos.getIndex(); CompositeFormat.parseAndIgnoreWhitespace(source, pos); Number re = CompositeFormat.parseNumber(source, getRealFormat(), pos); if (re == null) { pos.setIndex(initialIndex); return null; } int startIndex = pos.getIndex(); switch (CompositeFormat.parseNextCharacter(source, pos)) { case 0: return new Complex(re.doubleValue(), 0.0d); case '+': sign = 1; break; case '-': sign = -1; break; default: pos.setIndex(initialIndex); pos.setErrorIndex(startIndex); return null; } CompositeFormat.parseAndIgnoreWhitespace(source, pos); Number im = CompositeFormat.parseNumber(source, getRealFormat(), pos); if (im == null) { pos.setIndex(initialIndex); return null; } else if (!CompositeFormat.parseFixedstring(source, getImaginaryCharacter(), pos)) { return null; } else { return new Complex(re.doubleValue(), im.doubleValue() * ((double) sign)); } } }
[ "silas1037@163.com" ]
silas1037@163.com
0ef272113890e75e6453d58bf99b4ad8f567fe37
9925689fafd5f2fd7c5d5e9d48ba4cf8a7ffc016
/src/mk/game/common/model/IMoveListener.java
e0e78a6a87330f82e62568a4fe1bfcbb8546d80e
[]
no_license
krasnymark/Game
78c91e369730c3e8beb3c87efbf52c31a43c437b
dd21b1243adbf232076f8a23e8314128f115baad
refs/heads/master
2020-03-18T18:31:43.940552
2018-05-28T02:16:35
2018-05-28T02:16:35
135,098,698
1
0
null
null
null
null
UTF-8
Java
false
false
217
java
/** * */ package mk.game.common.model; import java.util.EventListener; /** * @author mark * */ public interface IMoveListener extends EventListener { public void applyMove(MoveEvent moveEvent, int player); }
[ "krasnymark@gmail.com" ]
krasnymark@gmail.com
49f2d001072f6869ccc54855cd074114d1675908
53d5cbad5c0118d7c4ee80944c8b86efd91af0a9
/server/src/main/java/org/jzb/execution/application/AdminService.java
c0ac11f85f02b3371cd96bba53238b7ec6bdc72f
[]
no_license
ixtf/japp-execution
bc54e41bdda09e6cf18fa39904a1126336fd040e
b387f725a5293f353fe052fbb7b742d72b506332
refs/heads/master
2021-01-18T23:56:12.982708
2019-03-22T07:49:52
2019-03-22T07:49:52
40,085,653
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
package org.jzb.execution.application; import org.jzb.execution.application.command.ChannelUpdateCommand; import org.jzb.execution.application.command.PlanAuditCommand; import org.jzb.execution.domain.Channel; import java.security.Principal; /** * Created by jzb on 17-4-15. */ public interface AdminService { void auditPlan(Principal principal, String planId, PlanAuditCommand command); void unAuditPlan(Principal principal, String planId); Channel create(Principal principal, ChannelUpdateCommand command); Channel update(Principal principal, String id, ChannelUpdateCommand command); void deleteChannel(Principal principal, String id); void deleteRedEnvelopeOrganization(Principal principal, String id); }
[ "ixtf1984@gmail.com" ]
ixtf1984@gmail.com
85da7f0f84793bbfa64bf1bf914c45de585059bb
864b3c3a4ba5711ed5c36521994444605de7fc6c
/src/main/java/dev/dcn/test/StaticNetwork.java
7670746fd57371db5ddd0971f15687b2153c991e
[]
no_license
DCN-dev/ether-tools
b2033a5a84542b76a66c4fcab72d56954490bd72
7890ccaf8346f9c2c8ae17ebdf67a6bcf9037440
refs/heads/master
2020-07-25T16:22:57.044126
2019-09-17T18:28:28
2019-09-17T18:28:28
208,353,588
0
0
null
null
null
null
UTF-8
Java
false
false
2,082
java
package dev.dcn.test; import dev.dcn.ether_net.EtherDebugNet; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameterNumber; import org.web3j.protocol.core.methods.response.EthBlockNumber; import java.io.IOException; import java.math.BigInteger; import java.util.HashMap; import java.util.Stack; public class StaticNetwork { public static final BigInteger GAS_LIMIT = BigInteger.valueOf(8000000); private static EtherDebugNet network = null; public static void Start() { try { HashMap<String, String> accounts = new HashMap<>(); for (Credentials key : Accounts.keys) { accounts.put(key.getEcKeyPair().getPrivateKey().toString(16), "1000000000000000000000000000000000"); } network = new EtherDebugNet(5123, "localhost", accounts, 8000000, 9999); } catch (Exception e) { throw new RuntimeException(e); } Runtime.getRuntime().addShutdownHook(new Thread(network::close)); } public static Web3j Web3() { return network.web3(); } public static BigInteger GetBalance(String address) throws IOException { EthBlockNumber block = StaticNetwork.Web3().ethBlockNumber().send(); return Web3().ethGetBalance(address, new DefaultBlockParameterNumber(block.getBlockNumber())).send().getBalance(); } private static final Stack<BigInteger> checkpoints = new Stack<>(); public static void Checkpoint() { try { checkpoints.push(network.checkpoint().send().id()); } catch (IOException e) { throw new RuntimeException(e); } } public static void Revert() { try { network.revert(checkpoints.pop()).send(); } catch (IOException e) { throw new RuntimeException(e); } } public static long IncreaseTime(long seconds) throws IOException { return network.increaseTime(BigInteger.valueOf(seconds)).send().getValue().longValueExact(); } }
[ "patrick@merklex.io" ]
patrick@merklex.io
da31fa3343bbe4463862895a75deacabf8228f0f
cb33a9f7c2244402ee81dc9b71dde3922e234ea9
/app/src/main/java/com/example/android_learning/MainActivity.java
c69496788c69b3100ed178ef725bcc5cd7221b3b
[]
no_license
Wander323/android_learning
7a804e7784205a0a57a2200503d474802bbf61f8
ea2a54047c0ada274d2330627025f8550f78e387
refs/heads/master
2020-12-05T23:32:57.802961
2020-01-07T08:21:44
2020-01-07T08:21:44
232,278,094
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.example.android_learning; 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); } }
[ "18826077578@qq.com" ]
18826077578@qq.com
0bc56e1ab11b16b0993f8d700074c0748f952ea4
7fa9c6b0fa1d0726ae1cda0199716c811a1ea01b
/Crawler/data/MessageRepositoryTest.java
c3502d217b72110eba05d06bf5e75c15504893b8
[]
no_license
NayrozD/DD2476-Project
b0ca75799793d8ced8d4d3ba3c43c79bb84a72c0
94dfb3c0a470527b069e2e0fd9ee375787ee5532
refs/heads/master
2023-03-18T04:04:59.111664
2021-03-10T15:03:07
2021-03-10T15:03:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,073
java
3 https://raw.githubusercontent.com/mqxu/spring-boot-review/master/spring-boot-jpa/src/test/java/com/soft1851/springboot/jpa/dao/MessageRepositoryTest.java package com.soft1851.springboot.jpa.dao; import com.soft1851.springboot.jpa.model.Message; import com.soft1851.springboot.jpa.service.MessageService; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Example; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; @Slf4j @SpringBootTest class MessageRepositoryTest { @Autowired private MessageRepository messageRepository; @Test public void testSave() { Message message = Message.builder().msgText("软件1851").msgSummary("沉迷学习").build(); // 保存单个对象 messageRepository.save(message); List<Message> messages = new ArrayList<>(Arrays.asList( Message.builder().msgText("后端").msgSummary("SpringBoot").build(), Message.builder().msgText("前端").msgSummary("Vue.js").build(), Message.builder().msgText("移动端").msgSummary("Flutter").build())); // 保存多个 messageRepository.saveAll(messages); } @Test public void testDelete() { Message message = Message.builder().msgId(1) .msgText("软件1851").msgSummary("沉迷学习").build(); // 删除单条记录 // 根据主键删除 messageRepository.deleteById(1); // 或者参数为对象,根据主键删除 messageRepository.delete(message); // 删除集合 message = Message.builder().msgId(5) .msgText("Monday").msgSummary("study").build(); List<Message> messages = new ArrayList<>(); messages.add(message); message = Message.builder().msgId(6) .msgText("Tuesday").msgSummary("study").build(); messages.add(message); // 删除集合:一条一条删除 messageRepository.deleteAll(messages); // 删除集合:一条 sql,拼接 or语句 messageRepository.deleteInBatch(messages); // 删除全部 // 删除所有:先findAll,然后一条一条删除,最后提交事务 messageRepository.deleteAll(); // 删除所有:使用一条 sql messageRepository.deleteAllInBatch(); } @Autowired private MessageService messageService; @Test public void testUpdate() { // 根据主键更新 Message message = Message.builder().msgId(2) .msgText("后端架构").msgSummary("SpringCloud").build(); messageRepository.saveAndFlush(message); // 批量更新 List<Message> messages = new ArrayList<>(); messages.add(Message.builder().msgId(5).msgText("workday").msgSummary("study").build()); messages.add(Message.builder().msgId(6).msgText("weekend").msgSummary("play").build()); messageService.batchUpdate(messages); } @Test public void testSelect() { // 查询所有 messageRepository.findAll().forEach(msg -> log.info(msg.toString())); // 分页查询全部,返回封装了的分页信息, jpa页码从0开始 Page<Message> pageInfo = messageRepository.findAll( PageRequest.of(1, 3, Sort.Direction.ASC, "msgId")); log.info("总记录数: {}", pageInfo.getTotalElements()); log.info("当前页记录数: {}", pageInfo.getNumberOfElements()); log.info("每页记录数: {}", pageInfo.getSize()); log.info("获取总页数: {}", pageInfo.getTotalPages()); log.info("查询结果: {}", pageInfo.getContent()); log.info("当前页(从0开始计): {}", pageInfo.getNumber()); log.info("是否为首页: {}", pageInfo.isFirst()); log.info("是否为尾页: {}", pageInfo.isLast()); // 条件查询 Message message = Message.builder().msgSummary("study").build(); List<Message> messages = messageRepository.findAll(Example.of(message)); log.info("满足条件的记录有:"); messages.forEach(msg -> log.info(msg.toString())); // 单个查询 Message msg = Message.builder().msgId(2).build(); Optional<Message> optionalMessage = messageRepository.findOne(Example.of(msg)); log.info("单个查询结果: {}", optionalMessage.orElse(null)); } @Test public void testCustomSQL() { Integer num = messageRepository.insertMessage("自定义SQL", "JPA"); log.info("增加的数据条数: {}", num); Integer updateNum = messageRepository.updateName("JPQL", 1); log.info("修改的数据条数: {}", updateNum); } }
[ "veronika.cucorova@gmail.com" ]
veronika.cucorova@gmail.com
13f170b5bdeddeff48e5e217307a95434879b513
d1fdaf6fe4d5628ae76f5c1be393b42be1c29513
/common_lib/src/main/java/com/common_lib/android/fragment/tabs/FragmentTabActivity.java
32e44b416fd569e9360d869212c0650732b54507
[]
no_license
mandeepji/mysmarthands-android
d83c9dc726463dcadd73b010f0672b4fcffebb13
7e9e51f06705313133370cd69deb7efa0a87affa
refs/heads/master
2021-07-10T01:16:26.513187
2017-10-07T17:42:14
2017-10-07T17:42:14
106,114,033
0
0
null
null
null
null
UTF-8
Java
false
false
5,027
java
package com.common_lib.android.fragment.tabs; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.widget.TabHost; import android.widget.TabHost.OnTabChangeListener; import android.widget.TabHost.TabContentFactory; import java.util.HashMap; public abstract class FragmentTabActivity extends FragmentActivity implements OnTabChangeListener { // protected FragmentTabHost tabHost; // doesn't work protected TabHost tabHost; protected HashMap<String, TabInfo> mapTabInfo = new HashMap<String, TabInfo>(); protected TabInfo lastTab = null; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(!this.setContentView()){ setContentView(getLayoutResID()); } initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { tabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); } } private void initialiseTabHost(Bundle args) { tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.setup(); // tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost); // tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); addTabs(args); tabHost.setOnTabChangedListener(this); this.onTabChanged(defaultTabID()); } private void addTab(TabHost.TabSpec tabSpec, TabInfo tabInfo) { // Attach a Tab view factory to the spec tabSpec.setContent(new TabFactory(this)); String tag = tabSpec.getTag(); // Check to see if we already have a fragment for this tab, probably // from a previously saved state. If so, deactivate it, because our // initial state is that a tab isn't shown. tabInfo.fragment = this.getSupportFragmentManager().findFragmentByTag(tag); if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) { FragmentTransaction ft = this.getSupportFragmentManager().beginTransaction(); ft.detach(tabInfo.fragment); ft.commit(); this.getSupportFragmentManager().executePendingTransactions(); } tabHost.addTab(tabSpec); this.mapTabInfo.put(tabInfo.tag,tabInfo); } public void addTab(String label, Class<?> fragClass, Bundle bundle) { TabHost.TabSpec spec = tabHost.newTabSpec(label); View tabIndicatorView = this.getTabIndicatorView(label,LayoutInflater.from(this),bundle); if( tabIndicatorView == null ){ spec.setIndicator(label); } else{ spec.setIndicator(tabIndicatorView); } TabInfo tabInfo = new TabInfo(label, fragClass, bundle); this.addTab(spec, tabInfo); } public Fragment getTabFragment(String fragID){ return mapTabInfo.get(fragID).fragment; } public String getCurrentTabTag(){ return tabHost.getCurrentTabTag(); } public Fragment getCurrentFragment(){ return getTabFragment( getCurrentTabTag() ); } // ------------------------------------------------+ // customization overides public View getTabIndicatorView(String label,LayoutInflater inflater,Bundle bundle){ return null; } public boolean setContentView(){ return false; } public void addTabs(Bundle bundle){ } public abstract String defaultTabID(); public int getLayoutResID(){ return 0; } public abstract int getTabContentResID(); // ------------------------------------------------+ @Override public void onTabChanged(String tabId) { TabInfo newTab = this.mapTabInfo.get(tabId); if (lastTab != newTab) { FragmentTransaction ft = this.getSupportFragmentManager() .beginTransaction(); if (lastTab != null) { if (lastTab.fragment != null) { // ft.detach(mLastTab.fragment); ft.hide(lastTab.fragment); } } if (newTab != null) { if (newTab.fragment == null) { newTab.fragment = Fragment.instantiate(this, newTab.clss.getName(), newTab.args); ft.add(getTabContentResID(), newTab.fragment, newTab.tag); } else { // ft.attach(newTab.fragment); ft.show(newTab.fragment); } } lastTab = newTab; ft.commit(); this.getSupportFragmentManager().executePendingTransactions(); } } // ------------------------------------------------+ private class TabInfo { private String tag; private Class<?> clss; private Bundle args; private Fragment fragment; TabInfo(String tag, Class<?> clazz, Bundle args) { this.tag = tag; this.clss = clazz; this.args = args; } } // ------------------------------------------------+ class TabFactory implements TabContentFactory { private final Context mContext; public TabFactory(Context context) { mContext = context; } /** * (non-Javadoc) * * @see TabContentFactory#createTabContent(String) */ public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } // ------------------------------------------------+ }
[ "mandeepji@gmail.com" ]
mandeepji@gmail.com
56aec39fad6f9ed4347ebaa5eb9f17a50fc0e899
7f367dd2b211369f419b4c1193bb88694fdae6a2
/BookShelf/app/src/test/java/com/talentica/bookshelf/repository/ResetPassRepositoryTest.java
8a6ccff13103827c38ff1baf75b20e957da75c48
[]
no_license
shaktisinghmoyal/TeamPolyglot-ANDROID
00c28e9e4cb18cb2c2e02a89b7482cefa9203166
905014b0c281edfcbfaafb00f231db32944d6ca6
refs/heads/master
2020-05-20T12:58:12.508518
2016-08-26T13:23:51
2016-08-26T13:23:54
58,918,441
0
1
null
2016-05-16T09:02:29
2016-05-16T09:02:29
null
UTF-8
Java
false
false
1,140
java
package com.talentica.bookshelf.repository; import com.talentica.data.networking.DummyRestApi; import com.talentica.data.repository.ResetPassRepository; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import rx.Observable; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.verify; public class ResetPassRepositoryTest { private ResetPassRepository resetPassRepository; @Mock private DummyRestApi dummyRestApi; @Before public void setUp() { MockitoAnnotations.initMocks(this); resetPassRepository = new ResetPassRepository(dummyRestApi); } @Test public void testForForgotPass() { given(dummyRestApi.dummyLoginModule(anyString(), anyString())).willReturn(Observable.just(new JSONObject())); resetPassRepository.tryForResetPass("shakti.singh0708@gmail.com"); verify(dummyRestApi).dummyLoginModule("reshakt", "SHAmoy123"); // verify(bookEntityDataMapper).transform(bookList); } }
[ "shakti.singh0708@gmail.com" ]
shakti.singh0708@gmail.com
fd0f76660c63845c8784ec3895fbc6ca028fe21c
366bc1e3848f2291ffcb270c36d71b44df1fcec1
/app/src/main/java/smartassist/appreciate/be/smartassist/utils/ModuleHelper.java
4cbd388cbf2dd78be39ddc11dc203e6c3d789713
[]
no_license
henridev/City-Assistant
0e208cacd9e1180500b60bdf3bc4a629ac906bfb
841804fed77f6d2f33ef5fe81f178eff97eb1fe5
refs/heads/master
2021-06-10T13:12:13.057279
2016-11-08T09:45:32
2016-11-08T09:45:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,720
java
package smartassist.appreciate.be.smartassist.utils; import smartassist.appreciate.be.smartassist.model.Module; /** * Created by Inneke on 26/01/2015. */ public class ModuleHelper { public static Module getModule(int id) { switch (id) { case 1: return Module.POI; case 2: return Module.NEWS; case 3: return Module.WEATHER; case 4: return Module.CALENDAR; case 5: return Module.EMERGENCY; case 6: return Module.PHOTOS; case 7: return Module.RSS; case 8: return Module.CAREBOOK; case 9: return Module.CHAT; case 10: return Module.VITALS; case 11: return Module.MEDICATION; case 12: return Module.INVOICES; case 13: return Module.HABITANTS; default: return null; } } public static int getModuleId(Module module) { if(module == Module.POI) return 1; if(module == Module.NEWS) return 2; if(module == Module.WEATHER) return 3; if(module == Module.CALENDAR) return 4; if(module == Module.EMERGENCY) return 5; if(module == Module.PHOTOS) return 6; if(module == Module.RSS) return 7; if(module == Module.CAREBOOK) return 8; if(module == Module.CHAT) return 9; if(module == Module.VITALS) return 10; if(module == Module.MEDICATION) return 11; if(module == Module.INVOICES) return 12; if(module == Module.HABITANTS) return 13; return -1; } }
[ "ismael@silverback-it.be" ]
ismael@silverback-it.be
1e4c894e078b0ee9b74d0788aeb73ee93105db6f
dbca126e8c85ebabb4d29d96df0e37780b90c2b8
/VisiteGrafiDFVeBFV/src/it/polito/esame/model/Model.java
3b76a488c1d24bbc2f6dadd815604c46d59245bd
[]
no_license
Tecniche-di-Programmazione-2016/VisiteGrafiDFVeBFV
5fef48d0c5c1c8f5ae364ed4f95b65e538e23fc2
1c7626c5fbc6297ba9ad39b0c0f0589c2b157ef9
refs/heads/master
2021-05-31T23:54:12.733028
2016-06-25T17:27:11
2016-06-25T17:28:17
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
5,828
java
package it.polito.esame.model; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; import org.jgrapht.GraphPath; import org.jgrapht.Graphs; import org.jgrapht.UndirectedGraph; import org.jgrapht.alg.DijkstraShortestPath; import org.jgrapht.graph.DefaultEdge; import org.jgrapht.graph.SimpleGraph; import org.jgrapht.traverse.BreadthFirstIterator; import org.jgrapht.traverse.DepthFirstIterator; import org.jgrapht.traverse.GraphIterator; import it.polito.esame.dao.ParoleDAO; public class Model { int length; List<Parola> dizionario; /* * OSS: conviene definire parole come attributo perché non la uso * solo nel metodo caricaParole() ma anche per fare la ricerca del cammino */ List<Parola> parole; // conterrà tutte le parole di lunghezza length UndirectedGraph<Parola, DefaultEdge> grafo; public Model(){ ParoleDAO dao = new ParoleDAO(); dizionario = dao.getAllParola(); } public ParoleStats caricaParole(int lun){ length=lun; parole = new ArrayList<>();//è giusto instanziarla qua??? //carico le parole di lunghezza prefissata for(Parola p : dizionario){ if(p.getNome().length()== length) parole.add(p); } grafo = new SimpleGraph<Parola,DefaultEdge>(DefaultEdge.class); Graphs.addAllVertices(grafo, parole); for(Parola p1:parole){ for(Parola p2 : parole){ if(sonoCollegati(p1,p2)) grafo.addEdge(p1, p2); } } ParoleStats stats = new ParoleStats(); stats.setTotParole(parole.size()); stats.setTotColl(grafo.edgeSet().size()); Parola maxDeg=null; for(Parola p:parole){ if(maxDeg==null || grafo.degreeOf(p)>grafo.degreeOf(maxDeg)){ maxDeg = p; } } stats.setParola(maxDeg); stats.setDegP(grafo.degreeOf(maxDeg)); return stats; } /* * Restituisce true se p1 e p2 differiscono in una sola lettera */ public boolean sonoCollegati(Parola p1,Parola p2){ int count = 0; for(int i=0; i<p1.getNome().length();i++){ if(p1.getNome().charAt(i)!=p2.getNome().charAt(i)) count++; } if(count==1){ //System.out.println("("+p1.getNome()+","+p2.getNome()+")"); return true; } return false; } public List<Parola> cercaCammino(String s1, String s2){ Parola p1temp = new Parola(s1); Parola p2temp = new Parola(s2); /* * RICORDA di fare tutti i check necessari, se no rischi di non * gestire delle eccezioni!!! */ if(parole.contains(p1temp) && parole.contains(p2temp)){ Parola p1 = parole.get(parole.indexOf(p1temp)); Parola p2 = parole.get(parole.indexOf(p2temp)); DijkstraShortestPath<Parola,DefaultEdge> cammino = new DijkstraShortestPath<>(grafo,p1,p2); /* * OSS: conviene farsi restituire il GraphPath invece della List<DefaultEdge> * perché Graphs ha un metodo che, se gli passi un GraphPath, ti restituisce * tutti i vertici che compongono tale path!!! */ GraphPath<Parola,DefaultEdge> path = cammino.getPath(); if(path==null){ return null; } else{ return Graphs.getPathVertexList(path); } } return null; } /* * OSS: La visita in ampiezza BFV si può anche implementare senza usare * l' iterator di java...Una sua implementazione ricorre all'uso di una * coda FIFO, qui chiamata toVisit, per estrarre i vertici per livelli ed * è: * Queue<Parola> BFV(Parola p){ Queue<Parola> toVisit = new LinkedList<Parola>(); Queue<Parola> visited = new LinkedList<Parola>(); //aggiungo la source toVisit.add(p); Parola estratta; while((estratta = toVisit.poll())!=null){ if(!visited.contains(estratta)){ visited.add(estratta); for(Parola p2 : Graphs.neighborListOf(grafo, estratta)) toVisit.add(p2);//li metto in fondo alla coda } } return visited; } */ public Queue<Parola> visitaBFV(String s1) { //essendo FIFO, capisco come visita il grafo Queue<Parola> Visited = new LinkedList<Parola>(); Parola p1temp = new Parola(s1); /* * RICORDA di fare tutti i check necessari, se no rischi di non * gestire delle eccezioni!!! */ if(!parole.contains(p1temp)) return null; Parola p1 = parole.get(parole.indexOf(p1temp)); GraphIterator<Parola, DefaultEdge> bfv = new BreadthFirstIterator<Parola, DefaultEdge>(grafo, p1); while (bfv.hasNext()) { Parola p = bfv.next(); Visited.add(p); } return Visited; } /* * OSS: La visita in profondità DFV si può anche implementare senza usare * l' iterator di java...Una sua implementazione ricorre all'uso della * ricorsione ed è: * Queue<Parola> DFV(Parola p){ Queue<Parola> visited = new LinkedList<Parola>(); recursiveDFV(p,visited); return visited; } void recursiveDFV(Parola p, Queue<Parola> visited){ if(visited.contains(p)) return; //ho già visitato p e quindi anche tutti i suoi vicini a cascata visited.add(p); for(Parola p2 : Graphs.neighborListOf(grafo,p)) recursiveDFV(p2,visited);//li metto in fondo alla coda } */ public Queue<Parola> visitaDFV(String s2) { //essendo FIFO, capisco come visita il grafo Queue<Parola> Visited = new LinkedList<Parola>(); Parola p2temp = new Parola(s2); /* * RICORDA di fare tutti i check necessari, se no rischi di non * gestire delle eccezioni!!! */ if(!parole.contains(p2temp)) return null; Parola p2 = parole.get(parole.indexOf(p2temp)); GraphIterator<Parola, DefaultEdge> dfv = new DepthFirstIterator<Parola, DefaultEdge>(grafo, p2); while (dfv.hasNext()) { Parola p = dfv.next(); Visited.add(p); } return Visited; } }
[ "s227332@studenti.polito.it" ]
s227332@studenti.polito.it
dd089b83184bd86156dc7327bce65cf0643487ea
ea08f1834bd0f0b6dd41471b7bad5196a923039b
/src/main/java/com/literarnoudruzenje/handlers/SaveLectorForm.java
d1dee9793f9d570c95868444704af4da218f26ac
[]
no_license
petarcurcin/LiterarnoUdruzenje-Backend
94b076f8f694385d82d51f24c538a08cb42e76bb
e98912de658f95e4af998cc68c0a678c8b4cf096
refs/heads/master
2023-03-04T21:07:44.996141
2021-02-05T12:29:34
2021-02-05T12:29:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.literarnoudruzenje.handlers; import com.literarnoudruzenje.dto.FormSubmissionDto; import org.camunda.bpm.engine.delegate.DelegateTask; import org.camunda.bpm.engine.delegate.TaskListener; import org.springframework.stereotype.Service; import java.util.List; @Service public class SaveLectorForm implements TaskListener { @Override public void notify(DelegateTask delegateTask) { List<FormSubmissionDto> dto = (List<FormSubmissionDto>) delegateTask.getVariable("registration"); delegateTask.setVariable( "lectorForm", dto); } }
[ "56953463+SaraFojkar@users.noreply.github.com" ]
56953463+SaraFojkar@users.noreply.github.com
84015cb316f362d73a09ac1d99ce37d957d8b838
77220c612ea4c2e20316e151f098aaeeb513df13
/src/main/java/io/stacs/nav/crypto/jce/ECKeyFactory.java
db10cf20edd90a5ba0d97856c415cd92484276be
[ "MIT" ]
permissive
hashstacs-inc/stacs-crypto
d186cb53752ecc3618842f05a46537c1a5c738f6
88d174884caea12000edc0290c6bfa3a694e0562
refs/heads/master
2021-08-28T07:33:35.719640
2020-03-26T05:57:53
2020-03-26T05:57:53
225,767,229
0
0
null
null
null
null
UTF-8
Java
false
false
2,669
java
/* * Copyright (c) [2016] [ <ether.camp> ] * This file is part of the ethereumJ library. * * The ethereumJ library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ethereumJ library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the ethereumJ library. If not, see <http://www.gnu.org/licenses/>. */ package io.stacs.nav.crypto.jce; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Provider; /** * The type Ec key factory. */ public final class ECKeyFactory { /** * The constant ALGORITHM. */ public static final String ALGORITHM = "EC"; private static final String ALGORITHM_ASSERTION_MSG = "Assumed the JRE supports EC key factories"; private ECKeyFactory() { } private static class Holder { private static final KeyFactory INSTANCE; static { try { INSTANCE = KeyFactory.getInstance(ALGORITHM); } catch (NoSuchAlgorithmException ex) { throw new AssertionError(ALGORITHM_ASSERTION_MSG, ex); } } } /** * Gets instance. * * @return the instance */ public static KeyFactory getInstance() { return Holder.INSTANCE; } /** * Gets instance. * * @param provider the provider * @return the instance * @throws NoSuchProviderException the no such provider exception */ public static KeyFactory getInstance(final String provider) throws NoSuchProviderException { try { return KeyFactory.getInstance(ALGORITHM, provider); } catch (NoSuchAlgorithmException ex) { throw new AssertionError(ALGORITHM_ASSERTION_MSG, ex); } } /** * Gets instance. * * @param provider the provider * @return the instance */ public static KeyFactory getInstance(final Provider provider) { try { return KeyFactory.getInstance(ALGORITHM, provider); } catch (NoSuchAlgorithmException ex) { throw new AssertionError(ALGORITHM_ASSERTION_MSG, ex); } } }
[ "11871958@qq.com" ]
11871958@qq.com
79132b75412dbfb83aaf394116401e9ed457f33b
3b02771b6609ca81e6af01a4b73d3267d5fd0784
/a_chap07/src/chap07/eX9.java
a3ec7e7c3e69c3015556233553ef382605ba7146
[]
no_license
koreanjorba/room
53feceb5d05fc7c0e31c1d36e90155270644d914
a78d56d43e6d2737c84a7fac10c3474dab4e8731
refs/heads/master
2020-07-30T06:26:21.942666
2019-10-01T11:33:50
2019-10-01T11:33:50
null
0
0
null
null
null
null
UHC
Java
false
false
889
java
package chap07; import java.util.Calendar; public class eX9 { public static void main(String[] args) { Week today = null; Calendar cal = Calendar.getInstance(); int week = cal.get(Calendar.DAY_OF_WEEK); switch(week) { case 1: today = Week.SUNDAY; break; case 2: today = Week.MONDAY; break; case 3: today = Week.TUESDAY; break; case 4: today = Week.WEDNESDAY; break; case 5: today = Week.THURSDAY; break; case 6: today = Week.FRIDAY; break; case 7: today = Week.SATURDAY; break; } System.out.println("오늘 요일: " + today); if(today == Week.SUNDAY) { System.out.println("일요일에는 축구를 합니다."); }else { System.out.println("열심히 자바 공부합니다."); } } }
[ "hwanghkt@gmail.com" ]
hwanghkt@gmail.com
a7a4c85cd9350eb02db4c641d3a882d8ed689885
78d82ecb057be6f97c6272d97829e62cd1ac4a5f
/src/service/impl/ReporteSalidaMaterialesImpl.java
7c766877ece2d7ed6152b75b04ca4f65f80a4ab1
[]
no_license
ErickCohen08/IgERP
f5a23063c1bb5db4b4e27d3039d97580e47f9add
cc1d64fcc0ac67fcf1d8814381be1865a78c6763
refs/heads/master
2021-01-19T11:35:14.792210
2018-10-25T03:00:51
2018-10-25T03:00:51
87,979,954
0
0
null
null
null
null
UTF-8
Java
false
false
1,094
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 service.impl; import entity.ReporteSalidaMaterialBE; import java.io.File; import java.io.FileInputStream; import java.util.List; import service.ReporteSalidaMateriales; /** * * @author vector */ public class ReporteSalidaMaterialesImpl implements ReporteSalidaMateriales{ @Override public void generaExcelAllSalidaMateriales(List<ReporteSalidaMaterialBE> listReporte, String rutaArchivo, String nombreArchivo) throws Exception { /* Abrimos la plantilla */ //FileInputStream file = new FileInputStream(new File("reporteSalidaMateriales.xlsx")); FileInputStream file = new FileInputStream(new File("D:\\Documentos Erick Cohen\\ProyectosJava\\IgERP\\src\\recursos\\reporteSalidaMateriales.xlsx")); /* Creamos el libro */ workbook = new HSSFWorkbook(file); HSSFRow row = null; HSSFCell cell = null; } }
[ "ercohen@vectoritcgroup.com" ]
ercohen@vectoritcgroup.com
05bcb1d0a02d79ddd786509b3e7927e656bbcb90
5d6886eb6867bb92d3f5b5b4719567a27c1b4d45
/Tank_Game/csc413-tankgame-KamyC/src/Jinghan/Cao/PowerUp.java
0d3d74495bfe80372df631eed7c780c95b7686de
[ "MIT" ]
permissive
KamyC/CSC413_Software-Development
d94c7e42f4e25325ffffd8866cf78f4456c996c2
bc6443d5346f2a67f3aa38c0c1020f93dbc6d7e4
refs/heads/master
2020-04-26T03:50:48.979090
2019-04-12T08:29:39
2019-04-12T08:29:39
173,281,236
0
0
null
null
null
null
UTF-8
Java
false
false
978
java
package Jinghan.Cao; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; public class PowerUp { private BufferedImage img; private int x,y; private boolean picked=false; public PowerUp(int x, int y){ this.x=x; this.y=y; } public void loadPowerUp(){ try{ this.img= ImageIO.read(new File("Pickup.gif")); }catch (IOException e){ e.printStackTrace(); } } public void changeState(){ this.picked=true; } public void drawPickUp(Graphics g){ if(this.picked){ // System.out.println("Picked"); } else{ this.loadPowerUp(); g.drawImage(this.img,this.x,this.y,null); } } public int getX(){ return this.x; } public int getY(){ return this.y; } }
[ "noreply@github.com" ]
KamyC.noreply@github.com
7b35d49714ce43de83b27dcbb29e76d371980d11
7c70e49e9fbbae31a4e7908bb468b36f7ecc9429
/src/main/java/learn/spring/di/sfgdi/service/ConstructorGreetingService.java
0eca4876a852cfcceaf7798c3597b0d104801996
[]
no_license
rlongying/sfg-di
51248cc227e260b30155cae80f5dfee7fef91ab5
ac0d395fefe1c602d723dc848680a960479debe7
refs/heads/master
2022-10-10T06:50:46.109069
2020-06-10T21:31:30
2020-06-10T21:31:30
270,514,244
0
0
null
2020-06-08T03:27:52
2020-06-08T03:27:52
null
UTF-8
Java
false
false
267
java
package learn.spring.di.sfgdi.service; import org.springframework.stereotype.Service; @Service public class ConstructorGreetingService implements GreetingService { @Override public String sayGreeting() { return "Hello world - Constructor"; } }
[ "wmj900823@gmail.com" ]
wmj900823@gmail.com
50aa6cc35f7953ca38ebf2a906b9319494b8a966
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/21/21_c0ac69438578dce5564d8165c308102607c4a1b7/TreeCache/21_c0ac69438578dce5564d8165c308102607c4a1b7_TreeCache_t.java
e6c6596015accaafc21239c5031a609b8ffad347
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
27,175
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.curator.framework.recipes.cache; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.CuratorEvent; import org.apache.curator.framework.listen.ListenerContainer; import org.apache.curator.framework.state.ConnectionState; import org.apache.curator.framework.state.ConnectionStateListener; import org.apache.curator.utils.EnsurePath; import org.apache.curator.utils.ThreadUtils; import org.apache.curator.utils.ZKPaths; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.Closeable; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Exchanger; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicReference; /** * <p>A utility that attempts to keep all data from all children of a ZK path locally cached. This class * will watch the ZK path, respond to update/create/delete events, pull down the data, etc. You can * register a listener that will get notified when changes occur.</p> * <p/> * <p><b>IMPORTANT</b> - it's not possible to stay transactionally in sync. Users of this class must * be prepared for false-positives and false-negatives. Additionally, always use the version number * when updating data to avoid overwriting another process' change.</p> */ @SuppressWarnings("NullableProblems") public class TreeCache implements Closeable { private final Logger log = LoggerFactory.getLogger(getClass()); private final CuratorFramework client; private final String path; private final ExecutorService executorService; private final boolean cacheData; private final boolean dataIsCompressed; private final EnsurePath ensurePath; private final BlockingQueue<Operation> operations = new LinkedBlockingQueue<Operation>(); private final ListenerContainer<PathChildrenCacheListener> listeners = new ListenerContainer<PathChildrenCacheListener>(); private final ConcurrentMap<String, ChildData> currentData = Maps.newConcurrentMap(); private final AtomicReference<Map<String, ChildData>> initialSet = new AtomicReference<Map<String, ChildData>>(); private static final ChildData NULL_CHILD_DATA = new ChildData(null, null, null); private static final String CHILD_OF_ZNODE_PATTERN = "%s/[^ /]*"; private final Watcher childrenWatcher = new Watcher() { @Override public void process(WatchedEvent event) { switch (event.getType()) { case None: break; default: offerOperation(new TreeRefreshOperation(TreeCache.this, event.getPath(), RefreshMode.STANDARD)); } } }; private final Watcher dataWatcher = new Watcher() { @Override public void process(WatchedEvent event) { try { if ( event.getType() == Event.EventType.NodeDeleted ) { remove(event.getPath()); } else if ( event.getType() == Event.EventType.NodeDataChanged ) { offerOperation(new GetDataFromTreeOperation(TreeCache.this, event.getPath())); } } catch ( Exception e ) { handleException(e); } } }; @VisibleForTesting volatile Exchanger<Object> rebuildTestExchanger; private final ConnectionStateListener connectionStateListener = new ConnectionStateListener() { @Override public void stateChanged(CuratorFramework client, ConnectionState newState) { handleStateChange(newState); } }; private static final ThreadFactory defaultThreadFactory = ThreadUtils.newThreadFactory("PathChildrenCache"); /** * @param client the client * @param path path to watch * @param mode caching mode * @deprecated use {@link #TreeCache(org.apache.curator.framework.CuratorFramework, String, boolean)} instead */ @SuppressWarnings("deprecation") public TreeCache(CuratorFramework client, String path, PathChildrenCacheMode mode) { this(client, path, mode != PathChildrenCacheMode.CACHE_PATHS_ONLY, false, Executors.newSingleThreadExecutor(defaultThreadFactory)); } /** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat */ public TreeCache(CuratorFramework client, String path, boolean cacheData) { this(client, path, cacheData, false, Executors.newSingleThreadExecutor(defaultThreadFactory)); } /** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param threadFactory factory to use when creating internal threads */ public TreeCache(CuratorFramework client, String path, boolean cacheData, ThreadFactory threadFactory) { this(client, path, cacheData, false, Executors.newSingleThreadExecutor(threadFactory)); } /** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param dataIsCompressed if true, data in the path is compressed * @param threadFactory factory to use when creating internal threads */ public TreeCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, ThreadFactory threadFactory) { this(client, path, cacheData, dataIsCompressed, Executors.newSingleThreadExecutor(threadFactory)); } /** * @param client the client * @param path path to watch * @param cacheData if true, node contents are cached in addition to the stat * @param dataIsCompressed if true, data in the path is compressed * @param executorService ExecutorService to use for the PathChildrenCache's background thread */ public TreeCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, final ExecutorService executorService) { this.client = client; this.path = path; this.cacheData = cacheData; this.dataIsCompressed = dataIsCompressed; this.executorService = executorService; ensurePath = client.newNamespaceAwareEnsurePath(path); } /** * Start the cache. The cache is not started automatically. You must call this method. * * @throws Exception errors */ public void start() throws Exception { start(StartMode.NORMAL); } /** * Same as {@link #start()} but gives the option of doing an initial build * * @param buildInitial if true, {@link #rebuild()} will be called before this method * returns in order to get an initial view of the node; otherwise, * the cache will be initialized asynchronously * @deprecated use {@link #start(StartMode)} * @throws Exception errors */ public void start(boolean buildInitial) throws Exception { start(buildInitial ? StartMode.BUILD_INITIAL_CACHE : StartMode.NORMAL); } /** * Method of priming cache on {@link TreeCache#start(StartMode)} */ public enum StartMode { /** * cache will _not_ be primed. i.e. it will start empty and you will receive * events for all nodes added, etc. */ NORMAL, /** * {@link TreeCache#rebuild()} will be called before this method returns in * order to get an initial view of the node. */ BUILD_INITIAL_CACHE, /** * After cache is primed with initial values (in the background) a * {@link PathChildrenCacheEvent.Type#INITIALIZED} will be posted */ POST_INITIALIZED_EVENT } /** * Start the cache. The cache is not started automatically. You must call this method. * * @param mode Method for priming the cache * @throws Exception errors */ public void start(StartMode mode) throws Exception { Preconditions.checkState(!executorService.isShutdown(), "already started"); mode = Preconditions.checkNotNull(mode, "mode cannot be null"); client.getConnectionStateListenable().addListener(connectionStateListener); executorService.execute ( new Runnable() { @Override public void run() { mainLoop(); } } ); switch ( mode ) { case NORMAL: { offerOperation(new TreeRefreshOperation(this, path, RefreshMode.STANDARD)); break; } case BUILD_INITIAL_CACHE: { rebuild(); break; } case POST_INITIALIZED_EVENT: { initialSet.set(Maps.<String, ChildData>newConcurrentMap()); offerOperation(new TreeRefreshOperation(this, path, RefreshMode.POST_INITIALIZED)); break; } } } /** * NOTE: this is a BLOCKING method. Completely rebuild the internal cache by querying * for all needed data WITHOUT generating any events to send to listeners. * * @throws Exception errors */ public void rebuild() throws Exception { Preconditions.checkState(!executorService.isShutdown(), "cache has been closed"); ensurePath.ensure(client.getZookeeperClient()); clear(); List<String> children = client.getChildren().forPath(path); for ( String child : children ) { String fullPath = ZKPaths.makePath(path, child); internalRebuildNode(fullPath); if ( rebuildTestExchanger != null ) { rebuildTestExchanger.exchange(new Object()); } } // this is necessary so that any updates that occurred while rebuilding are taken offerOperation(new TreeRefreshOperation(this, path, RefreshMode.FORCE_GET_DATA_AND_STAT)); } /** * NOTE: this is a BLOCKING method. Rebuild the internal cache for the given node by querying * for all needed data WITHOUT generating any events to send to listeners. * * @param fullPath full path of the node to rebuild * @throws Exception errors */ public void rebuildNode(String fullPath) throws Exception { Preconditions.checkArgument(ZKPaths.getPathAndNode(fullPath).getPath().equals(path), "Node is not part of this cache: " + fullPath); Preconditions.checkState(!executorService.isShutdown(), "cache has been closed"); ensurePath.ensure(client.getZookeeperClient()); internalRebuildNode(fullPath); // this is necessary so that any updates that occurred while rebuilding are taken // have to rebuild entire tree in case this node got deleted in the interim offerOperation(new TreeRefreshOperation(this, path, RefreshMode.FORCE_GET_DATA_AND_STAT)); } /** * Close/end the cache * * @throws java.io.IOException errors */ @Override public void close() throws IOException { //Preconditions.checkState(!executorService.isShutdown(), "has not been started"); client.getConnectionStateListenable().removeListener(connectionStateListener); executorService.shutdownNow(); } /** * Return the cache listenable * * @return listenable */ public ListenerContainer<PathChildrenCacheListener> getListenable() { return listeners; } /** * Return the current data. There are no guarantees of accuracy. This is * merely the most recent view of the data. The data is returned in sorted order. * * @return list of children and data */ public List<ChildData> getCurrentData() { return ImmutableList.copyOf(Sets.<ChildData>newTreeSet(currentData.values())); } /** * Return the current data for the given path. There are no guarantees of accuracy. This is * merely the most recent view of the data. If there is no child with that path, <code>null</code> * is returned. * * @param fullPath full path to the node to check * @return data or null */ public ChildData getCurrentData(String fullPath) { return currentData.get(fullPath); } /** * As a memory optimization, you can clear the cached data bytes for a node. Subsequent * calls to {@link ChildData#getData()} for this node will return <code>null</code>. * * @param fullPath the path of the node to clear */ public void clearDataBytes(String fullPath) { clearDataBytes(fullPath, -1); } /** * As a memory optimization, you can clear the cached data bytes for a node. Subsequent * calls to {@link ChildData#getData()} for this node will return <code>null</code>. * * @param fullPath the path of the node to clear * @param ifVersion if non-negative, only clear the data if the data's version matches this version * @return true if the data was cleared */ public boolean clearDataBytes(String fullPath, int ifVersion) { ChildData data = currentData.get(fullPath); if ( data != null ) { if ( (ifVersion < 0) || (ifVersion == data.getStat().getVersion()) ) { data.clearData(); return true; } } return false; } /** * Clear out current data and begin a new query on the path * * @throws Exception errors */ public void clearAndRefresh() throws Exception { currentData.clear(); offerOperation(new TreeRefreshOperation(this, path, RefreshMode.STANDARD)); } /** * Clears the current data without beginning a new query and without generating any events * for listeners. */ public void clear() { currentData.clear(); } enum RefreshMode { STANDARD, FORCE_GET_DATA_AND_STAT, POST_INITIALIZED } void refresh(final String path, final RefreshMode mode) throws Exception { ensurePath.ensure(client.getZookeeperClient()); final BackgroundCallback callback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { processChildren(path, event.getChildren(), mode); } }; client.getChildren().usingWatcher(childrenWatcher).inBackground(callback).forPath(path); } void callListeners(final PathChildrenCacheEvent event) { listeners.forEach ( new Function<PathChildrenCacheListener, Void>() { @Override public Void apply(PathChildrenCacheListener listener) { try { listener.childEvent(client, event); } catch ( Exception e ) { handleException(e); } return null; } } ); } void getDataAndStat(final String fullPath) throws Exception { BackgroundCallback existsCallback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { applyNewData(fullPath, event.getResultCode(), event.getStat(), null); } }; BackgroundCallback getDataCallback = new BackgroundCallback() { @Override public void processResult(CuratorFramework client, CuratorEvent event) throws Exception { applyNewData(fullPath, event.getResultCode(), event.getStat(), event.getData()); } }; if ( cacheData ) { if ( dataIsCompressed ) { client.getData().decompressed().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath); } else { client.getData().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath); } } else { client.checkExists().usingWatcher(dataWatcher).inBackground(existsCallback).forPath(fullPath); } } /** * Default behavior is just to log the exception * * @param e the exception */ protected void handleException(Throwable e) { log.error("", e); } @VisibleForTesting protected void remove(String fullPath) { ChildData data = currentData.remove(fullPath); if ( data != null ) { offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_REMOVED, data))); } Map<String, ChildData> localInitialSet = initialSet.get(); if ( localInitialSet != null ) { localInitialSet.remove(fullPath); maybeOfferInitializedEvent(localInitialSet); } } private void internalRebuildNode(String fullPath) throws Exception { if ( cacheData ) { try { Stat stat = new Stat(); byte[] bytes = dataIsCompressed ? client.getData().decompressed().storingStatIn(stat).forPath(fullPath) : client.getData().storingStatIn(stat).forPath(fullPath); currentData.put(fullPath, new ChildData(fullPath, stat, bytes)); } catch ( KeeperException.NoNodeException ignore ) { // node no longer exists - remove it currentData.remove(fullPath); } } else { Stat stat = client.checkExists().forPath(fullPath); if ( stat != null ) { currentData.put(fullPath, new ChildData(fullPath, stat, null)); } else { // node no longer exists - remove it currentData.remove(fullPath); } } } private void handleStateChange(ConnectionState newState) { switch ( newState ) { case SUSPENDED: { offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CONNECTION_SUSPENDED, null))); break; } case LOST: { offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CONNECTION_LOST, null))); break; } case RECONNECTED: { try { offerOperation(new TreeRefreshOperation(this, path, RefreshMode.FORCE_GET_DATA_AND_STAT)); offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CONNECTION_RECONNECTED, null))); } catch ( Exception e ) { handleException(e); } break; } } } private void processChildren(final String path, List<String> children, RefreshMode mode) throws Exception { List<String> fullPaths = Lists.newArrayList(Lists.transform ( children, new Function<String, String>() { @Override public String apply(String child) { return ZKPaths.makePath(path, child); } } )); Set<String> removedNodes = Sets.filter(Sets.newHashSet(currentData.keySet()), new Predicate<String>() { @Override public boolean apply(String input) { if (input.matches(String.format(CHILD_OF_ZNODE_PATTERN, path))) { return true; } else { return false; } } }); removedNodes.removeAll(fullPaths); for ( String fullPath : removedNodes ) { remove(fullPath); } for ( String name : children ) { String fullPath = ZKPaths.makePath(path, name); if ( (mode == RefreshMode.FORCE_GET_DATA_AND_STAT) || !currentData.containsKey(fullPath) ) { getDataAndStat(fullPath); } updateInitialSet(name, NULL_CHILD_DATA); offerOperation(new TreeRefreshOperation(this, fullPath, mode)); } maybeOfferInitializedEvent(initialSet.get()); } private void applyNewData(String fullPath, int resultCode, Stat stat, byte[] bytes) { if ( resultCode == KeeperException.Code.OK.intValue() ) // otherwise - node must have dropped or something - we should be getting another event { ChildData data = new ChildData(fullPath, stat, bytes); ChildData previousData = currentData.put(fullPath, data); if ( previousData == null ) // i.e. new { offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_ADDED, data))); } else if ( previousData.getStat().getVersion() != stat.getVersion() ) { offerOperation(new TreeEventOperation(this, new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.CHILD_UPDATED, data))); } updateInitialSet(ZKPaths.getNodeFromPath(fullPath), data); } } private void updateInitialSet(String name, ChildData data) { Map<String, ChildData> localInitialSet = initialSet.get(); if ( localInitialSet != null ) { localInitialSet.put(name, data); maybeOfferInitializedEvent(localInitialSet); } } private void maybeOfferInitializedEvent(Map<String, ChildData> localInitialSet) { if ( !hasUninitialized(localInitialSet) ) { // all initial children have been processed - send initialized message if ( initialSet.getAndSet(null) != null ) // avoid edge case - don't send more than 1 INITIALIZED event { final List<ChildData> children = ImmutableList.copyOf(localInitialSet.values()); PathChildrenCacheEvent event = new PathChildrenCacheEvent(PathChildrenCacheEvent.Type.INITIALIZED, null) { @Override public List<ChildData> getInitialData() { return children; } }; offerOperation(new TreeEventOperation(this, event)); } } } private boolean hasUninitialized(Map<String, ChildData> localInitialSet) { if ( localInitialSet == null ) { return false; } Map<String, ChildData> uninitializedChildren = Maps.filterValues ( localInitialSet, new Predicate<ChildData>() { @Override public boolean apply(ChildData input) { return (input == NULL_CHILD_DATA); // check against ref intentional } } ); return (uninitializedChildren.size() != 0); } private void mainLoop() { while ( !Thread.currentThread().isInterrupted() ) { try { operations.take().invoke(); } catch ( InterruptedException e ) { Thread.currentThread().interrupt(); break; } catch ( Exception e ) { handleException(e); } } } private void offerOperation(Operation operation) { operations.remove(operation); // avoids herding for refresh operations operations.offer(operation); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b03b56b93f654b7accfc279a90699b4013e2e531
34a3e6e079b402994d8d369acb8aa6f21d4886db
/src/main/java/com/alleyz/school/config/WebMvcConfigure.java
c355c3c013ba5d682e2638b9d126bddf007f42b8
[]
no_license
zhangtwgg/school-admin
ffe6d5423681c3440ef1e03428a0fb820bbe6354
0fe7206f59964bfb7f6388791b77da9f6c1b00ff
refs/heads/master
2021-01-21T19:20:59.734595
2017-05-21T04:32:49
2017-05-21T04:32:49
92,138,168
0
1
null
null
null
null
UTF-8
Java
false
false
572
java
package com.alleyz.school.config; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * Created by alleyz on 2017/5/18 0018. */ @Configuration public class WebMvcConfigure extends WebMvcConfigurerAdapter{ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/page/**").addResourceLocations( "classpath:/page/"); } }
[ "zhw120728@hotmail.com" ]
zhw120728@hotmail.com
9192762e55370fc089de7e9c806978002fbd45b5
25b7a623e9762c095cd5aae5fa188cb0504d5537
/ChessGame2018/src/main/java/tools/ChessPiecePos.java
147c144a2f3d6b2a66e94f1e136a6360813543d4
[ "MIT" ]
permissive
TraiW/Design_Pattern
8d43881651aa3dd81bd7be4a3d53a46834e532b5
e470590fad6afa837fc35cac8cd39a770948d3b1
refs/heads/master
2020-04-10T21:17:46.081592
2018-12-11T10:39:16
2018-12-11T10:39:16
161,292,445
0
0
null
null
null
null
UTF-8
Java
false
false
2,261
java
package tools; import model.Coord; import model.Couleur; /** * @author francoise.perrin * */ public enum ChessPiecePos { TOURBLANC("Tour", Couleur.BLANC, new Coord[] {new Coord(0,7), new Coord(7,7)}), CAVALIERBLANC("Cavalier", Couleur.BLANC, new Coord[] {new Coord(1,7), new Coord(6,7)}), FOUBLANC("Fou", Couleur.BLANC, new Coord[] {new Coord(2,7), new Coord(5,7)}), REINEBLANC("Reine", Couleur.BLANC, new Coord[] {new Coord(3,7)}), ROIBLANC("Roi", Couleur.BLANC, new Coord[] {new Coord(4,7)}), PIONBLANC("PionBlanc", Couleur.BLANC, new Coord[] {new Coord(0,6), new Coord(1,6), new Coord(2,6), new Coord(3,6), new Coord(4,6), new Coord(5,6), new Coord(6,6), new Coord(7,6)}), // PIONBLANC("Pion", Couleur.BLANC, new Coord[] {new Coord(0,6), new Coord(1,6), new Coord(2,6), new Coord(3,6), // new Coord(4,6), new Coord(5,6), new Coord(6,6), new Coord(7,6)}), TOURNOIR("Tour", Couleur.NOIR, new Coord[] {new Coord(0,0), new Coord(7,0)}), CAVALIERNOIR("Cavalier", Couleur.NOIR, new Coord[] {new Coord(1,0), new Coord(6,0)}), FOUNOIR("Fou", Couleur.NOIR, new Coord[] {new Coord(2,0), new Coord(5,0)}), REINENOIR("Reine", Couleur.NOIR, new Coord[] {new Coord(3,0)}), ROINOIR("Roi", Couleur.NOIR, new Coord[] {new Coord(4,0)}), PIONNOIR("PionNoir", Couleur.NOIR, new Coord[] {new Coord(0,1), new Coord(1,1), new Coord(2,1), new Coord(3,1), new Coord(4,1), new Coord(5,1), new Coord(6,1), new Coord(7,1)}); // PIONNOIR("Pion", Couleur.NOIR, new Coord[] {new Coord(0,1), new Coord(1,1), new Coord(2,1), new Coord(3,1), // new Coord(4,1), new Coord(5,1), new Coord(6,1), new Coord(7,1)}) // ; public String nom; public Couleur couleur; public Coord[] coords = new Coord[8] ; ChessPiecePos( String nom, Couleur couleur, Coord[] coords) { this.nom = nom;this.couleur = couleur; this.coords = coords; } public static void main(String[] args) { for (int i = 0; i < ChessPiecePos.values().length; i++) { System.out.print(ChessPiecePos.values()[i].name() + " \t"); System.out.print(ChessPiecePos.values()[i].nom + " \t"); for (int j = 0; j < (ChessPiecePos.values()[i].coords).length; j++) { System.out.print(ChessPiecePos.values()[i].coords[j] + " "); } System.out.println(); } } }
[ "valentinw@hotmail.fr" ]
valentinw@hotmail.fr
387678738bbfe7527151f6bc21d2ced2a8819f94
1d928c3f90d4a0a9a3919a804597aa0a4aab19a3
/java/neo4j/2017/8/AbstractDynamicStore.java
9ff78574c9e3d0b44f7b9f50a3b7a40a614395ea
[]
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
8,970
java
/* * Copyright (c) 2002-2017 "Neo Technology," * Network Engine for Objects in Lund AB [http://neotechnology.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.neo4j.kernel.impl.store; import java.io.File; import java.nio.ByteBuffer; import java.nio.file.OpenOption; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.neo4j.helpers.collection.Iterables; import org.neo4j.helpers.collection.Pair; import org.neo4j.io.pagecache.PageCache; import org.neo4j.io.pagecache.PageCursor; import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.impl.store.format.RecordFormat; import org.neo4j.kernel.impl.store.id.IdGenerator; import org.neo4j.kernel.impl.store.id.IdGeneratorFactory; import org.neo4j.kernel.impl.store.id.IdType; import org.neo4j.kernel.impl.store.record.DynamicRecord; import org.neo4j.kernel.impl.store.record.Record; import org.neo4j.logging.LogProvider; /** * An abstract representation of a dynamic store. Record size is set at creation as the contents of the * first record and read and used when opening the store in future sessions. * <p> * Instead of a fixed record this class uses blocks to store a record. If a * record size is greater than the block size the record will use one or more * blocks to store its data. * <p> * A dynamic store don't have a {@link IdGenerator} because the position of a * record can't be calculated just by knowing the id. Instead one should use * another store and store the start block of the record located in the * dynamic store. Note: This class makes use of an id generator internally for * managing free and non free blocks. * <p> * Note, the first block of a dynamic store is reserved and contains information * about the store. * <p> * About configuring block size: Record size is the whole record size including the header (next pointer * and what not). The term block size is equivalent to data size, which is the size of the record - header size. * User configures block size and the block size is what is passed into the constructor to the store. * The record size is what's stored in the header (first record). {@link #getRecordDataSize()} returns * the size which was configured at the store creation, {@link #getRecordSize()} returns what the store header says. */ public abstract class AbstractDynamicStore extends CommonAbstractStore<DynamicRecord,IntStoreHeader> implements DynamicRecordAllocator { public AbstractDynamicStore( File fileName, Config conf, IdType idType, IdGeneratorFactory idGeneratorFactory, PageCache pageCache, LogProvider logProvider, String typeDescriptor, int dataSizeFromConfiguration, RecordFormat<DynamicRecord> recordFormat, String storeVersion, OpenOption... openOptions ) { super( fileName, conf, idType, idGeneratorFactory, pageCache, logProvider, typeDescriptor, recordFormat, new DynamicStoreHeaderFormat( dataSizeFromConfiguration, recordFormat ), storeVersion, openOptions ); } public static void allocateRecordsFromBytes( Collection<DynamicRecord> recordList, byte[] src, DynamicRecordAllocator dynamicRecordAllocator ) { assert src != null : "Null src argument"; DynamicRecord nextRecord = dynamicRecordAllocator.nextRecord(); int srcOffset = 0; int dataSize = dynamicRecordAllocator.getRecordDataSize(); do { DynamicRecord record = nextRecord; record.setStartRecord( srcOffset == 0 ); if ( src.length - srcOffset > dataSize ) { byte[] data = new byte[dataSize]; System.arraycopy( src, srcOffset, data, 0, dataSize ); record.setData( data ); nextRecord = dynamicRecordAllocator.nextRecord(); record.setNextBlock( nextRecord.getId() ); srcOffset += dataSize; } else { byte[] data = new byte[src.length - srcOffset]; System.arraycopy( src, srcOffset, data, 0, data.length ); record.setData( data ); nextRecord = null; record.setNextBlock( Record.NO_NEXT_BLOCK.intValue() ); } recordList.add( record ); assert record.getData() != null; } while ( nextRecord != null ); } /** * @return a {@link ByteBuffer#slice() sliced} {@link ByteBuffer} wrapping {@code target} or, * if necessary a new larger {@code byte[]} and containing exactly all concatenated data read from records */ public static ByteBuffer concatData( Collection<DynamicRecord> records, byte[] target ) { int totalLength = 0; for ( DynamicRecord record : records ) { totalLength += record.getLength(); } if ( target.length < totalLength ) { target = new byte[totalLength]; } ByteBuffer buffer = ByteBuffer.wrap( target, 0, totalLength ); for ( DynamicRecord record : records ) { buffer.put( record.getData() ); } buffer.position( 0 ); return buffer; } /** * @return Pair&lt; header-in-first-record , all-other-bytes &gt; */ public static Pair<byte[], byte[]> readFullByteArrayFromHeavyRecords( Iterable<DynamicRecord> records, PropertyType propertyType ) { byte[] header = null; List<byte[]> byteList = new ArrayList<>(); int totalSize = 0; int i = 0; for ( DynamicRecord record : records ) { int offset = 0; if ( i++ == 0 ) { // This is the first one, read out the header separately header = propertyType.readDynamicRecordHeader( record.getData() ); offset = header.length; } byteList.add( record.getData() ); totalSize += record.getData().length - offset; } byte[] bArray = new byte[totalSize]; assert header != null : "header should be non-null since records should not be empty: " + Iterables.toString( records, ", " ); int sourceOffset = header.length; int offset = 0; for ( byte[] currentArray : byteList ) { System.arraycopy( currentArray, sourceOffset, bArray, offset, currentArray.length - sourceOffset ); offset += currentArray.length - sourceOffset; sourceOffset = 0; } return Pair.of( header, bArray ); } @Override public DynamicRecord nextRecord() { DynamicRecord record = new DynamicRecord( nextId() ); record.setCreated(); record.setInUse( true ); return record; } public void allocateRecordsFromBytes( Collection<DynamicRecord> target, byte[] src ) { allocateRecordsFromBytes( target, src, this ); } @Override public String toString() { return super.toString() + "[fileName:" + storageFileName.getName() + ", blockSize:" + getRecordDataSize() + "]"; } public Pair<byte[]/*header in the first record*/, byte[]/*all other bytes*/> readFullByteArray( Iterable<DynamicRecord> records, PropertyType propertyType ) { for ( DynamicRecord record : records ) { ensureHeavy( record ); } return readFullByteArrayFromHeavyRecords( records, propertyType ); } private static class DynamicStoreHeaderFormat extends IntStoreHeaderFormat { DynamicStoreHeaderFormat( int dataSizeFromConfiguration, RecordFormat<DynamicRecord> recordFormat ) { super( dataSizeFromConfiguration + recordFormat.getRecordHeaderSize() ); } @Override public void writeHeader( PageCursor cursor ) { if ( header < 1 || header > 0xFFFF ) { throw new IllegalArgumentException( "Illegal block size[" + header + "], limit is 65535" ); } super.writeHeader( cursor ); } } }
[ "rodrigosoaresilva@gmail.com" ]
rodrigosoaresilva@gmail.com
d8a80a4f91815b03dd0704b040af4f002930e3e0
86ad8b7df712408333e98187746418a5f9eda7ec
/src/main/java/com/cf/sectest/DisplayServlet.java
9d1410fa8a2fec2d980ce0993685baf364beaac1
[]
no_license
shamanthmps/cfsectest
1db1a60a041111c3e1a01c77b2db8bdd45c49f76
9f67c6a33d9541d2acf1a6810aa93e27b473a01d
refs/heads/master
2021-06-24T11:32:52.118455
2017-08-20T21:10:40
2017-08-20T21:10:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,071
java
package com.cf.sectest; import java.io.IOException; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.sap.xs2.security.container.SecurityContext; import com.sap.xs2.security.container.UserInfoException; /** * Servlet implementation class DisplayServlet */ public class DisplayServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public DisplayServlet() { // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().append("<!DOCTYPE HTML>" + "<html><head>" + "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />" + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" + "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/static.css\">" + "<title>XSA Security Demo Backend</title></head>"); response.getWriter().append("<body><div class=\"content\">"); response.getWriter().append("<h2>Display Role</h2>"); response.getWriter().append("<table>"); try { response.getWriter().append("<tr><td>").append("Identiy Zone").append("</td><td>").append(SecurityContext.getUserInfo().getIdentityZone()).append("</td></tr>"); response.getWriter().append("<tr><td>").append("EMail").append("</td><td>").append(SecurityContext.getUserInfo().getEmail()).append("</td></tr>"); response.getWriter().append("<tr><td>").append("UserId").append("</td><td>").append(SecurityContext.getUserInfo().getLogonName()).append("</td></tr>"); } catch (UserInfoException e) { // TODO Auto-generated catch block response.getWriter().append("<tr><td>").append("Error").append("</td><td>").append(e.getLocalizedMessage()).append("</td></tr>"); } @SuppressWarnings("unchecked") Enumeration<String> headerNames = request.getHeaderNames(); if (headerNames != null) { while (headerNames.hasMoreElements()) { String header = headerNames.nextElement(); if (header.equals("authorization")) { response.getWriter().append("<tr><td>JWT</td><td><textarea readonly>") .append(request.getHeader(header)) .append("</textarea></td></tr>"); } } } response.getWriter().append("</table>"); response.getWriter().append("</div class=\"content\"></body></html>"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
[ "noreply@github.com" ]
shamanthmps.noreply@github.com
e40eae4540ea44167e2a9a621227910f9bcf896a
fbe8ffe0df68ecd2d7c0d370b14b37c192c5d0bd
/app/src/androidTest/java/com/github/alexgreench/pattern_builder/ExampleInstrumentedTest.java
ec02fb545bd3b74d7c86020d10322786fe6672cb
[]
no_license
ALEXGREENCH/pattern_builder
daba2c051ace848f76957c974fe74195dfa9db8c
c882f9d5c7c4b469088a4cfac55ef1052aec5a61
refs/heads/master
2020-04-07T19:00:02.217165
2018-11-22T02:39:51
2018-11-22T02:39:51
158,632,550
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.github.alexgreench.pattern_builder; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.github.alexgreench.pattern_builder", appContext.getPackageName()); } }
[ "melnikov-as@pa-resultant.ru" ]
melnikov-as@pa-resultant.ru
1454a6f78c218292ad84ce22bc51d406ca4ca9f3
a018f3269a89573f00d02dea9e37ccd0319fd52d
/app/src/main/java/com/newsmvpdemo/inject/components/VideoPlayerComponent.java
36a7978fc0dca83418966b65d64f1a403034099d
[]
no_license
BY-AJ/MvpDemo
c1846b39da13455f4792c36417b900631cef15c1
a3488a188d8cfb5552690f3e36fada983029c233
refs/heads/master
2020-03-18T04:12:38.608083
2018-08-16T01:44:06
2018-08-16T01:44:06
134,276,017
0
0
null
null
null
null
UTF-8
Java
false
false
478
java
package com.newsmvpdemo.inject.components; import com.newsmvpdemo.inject.PerActivity; import com.newsmvpdemo.inject.modules.VideoPlayerModule; import com.newsmvpdemo.module.home.VideoPlayerActivity; import dagger.Component; /** * Created by ictcxq on 2018/3/17. */ @PerActivity @Component(dependencies = ApplicationComponent.class,modules = VideoPlayerModule.class) public interface VideoPlayerComponent { void inject(VideoPlayerActivity activity); }
[ "yubing429898077@gmail.com" ]
yubing429898077@gmail.com
de3cecf35e2f2120d3ef689cb1fe6130fe619382
c913c0010b21dc21a7d56dd04f99c8c8c79103f1
/ProjectDocBao/app/src/main/java/com/example/administrator/miniproject/MyDapter.java
3abeb594ced844c9705938645f241a7989528b01
[]
no_license
TuanAnhID1999/TinTuc24
3d244892b3e1bd6f7db221e072df7a6c2e98ed12
d614a863e1b5031146b29ece0091ec9bd46bb861
refs/heads/master
2020-03-29T10:08:08.725296
2018-09-21T16:19:48
2018-09-21T16:19:48
149,790,630
0
0
null
null
null
null
UTF-8
Java
false
false
1,100
java
package com.example.administrator.miniproject; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class MyDapter extends FragmentPagerAdapter { private String tab[] = {"Tin Tức", "Đã Lưu", "Yêu Thích"}; private FragmentFirst tabTintuc; private FragmenThree tabLuu; private FragmentSenCon tabThich; public MyDapter(FragmentManager fm) { super(fm); tabTintuc = new FragmentFirst(); tabLuu = new FragmenThree(); tabThich = new FragmentSenCon(); } @Override public Fragment getItem(int i) { if (i == 0) { return tabTintuc; } else if (i == 1) { return tabLuu; } else if (i == 2) { return tabThich; } return null; } @Override public int getCount() { return tab.length; } @Nullable @Override public CharSequence getPageTitle(int position) { return tab[position]; } }
[ "43467987+TuanAnhID1999@users.noreply.github.com" ]
43467987+TuanAnhID1999@users.noreply.github.com
11cac6d8c53a070c40898c8f4f8e50ffb1d0eb5f
3a1bc9b88019d266a57485fa8f6997c74658311f
/subprojects/core/src/main/groovy/org/gradle/logging/internal/TerminalDetector.java
62fa544d752dd6315f79d6a2d22f029f7b84cac7
[]
no_license
ipsi/gradle-ear
475bd6ee2ab27dcc7e4ae0e3ad87d8168e36d355
896c023c261c8886327d759483606935fd53efd5
refs/heads/master
2021-01-15T19:40:47.629568
2011-04-06T12:15:52
2011-04-06T12:15:52
1,505,785
1
1
null
null
null
null
UTF-8
Java
false
false
3,283
java
/* * Copyright 2010 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.gradle.logging.internal; import org.apache.commons.io.IOUtils; import org.fusesource.jansi.WindowsAnsiOutputStream; import org.gradle.api.GradleException; import org.gradle.api.UncheckedIOException; import org.gradle.api.specs.Spec; import org.gradle.util.OperatingSystem; import org.gradle.util.PosixUtil; import java.io.*; public class TerminalDetector implements Spec<FileDescriptor> { public TerminalDetector(File libCacheDir) { // Some hackery to prevent JNA from creating a shared lib in the tmp dir, as it does not clean things up File tmpDir = new File(libCacheDir, "jna"); tmpDir.mkdirs(); String libName = System.mapLibraryName("jnidispatch"); File libFile = new File(tmpDir, libName); if (!libFile.exists()) { String resourceName = "/com/sun/jna/" + OperatingSystem.current().getNativePrefix() + "/" + libName; try { InputStream lib = getClass().getResourceAsStream(resourceName); if (lib == null) { throw new GradleException(String.format("Could not locate JNA native lib resource '%s'.", resourceName)); } try { FileOutputStream outputStream = new FileOutputStream(libFile); try { IOUtils.copy(lib, outputStream); } finally { outputStream.close(); } } finally { lib.close(); } } catch (IOException e) { throw new UncheckedIOException(e); } } // System.load(libFile.getAbsolutePath()); System.setProperty("jna.boot.library.path", tmpDir.getAbsolutePath()); } public boolean isSatisfiedBy(FileDescriptor element) { if (OperatingSystem.current().isWindows()) { // Use Jansi's detection mechanism try { new WindowsAnsiOutputStream(new ByteArrayOutputStream()); return true; } catch (IOException ignore) { // Not attached to a console return false; } } // Use jna-posix to determine if we're connected to a terminal if (!PosixUtil.current().isatty(element)) { return false; } // Dumb terminal doesn't support control codes. Should really be using termcap database. String term = System.getenv("TERM"); if (term != null && term.equals("dumb")) { return false; } // Assume a terminal return true; } }
[ "a@rubygrapefruit.net" ]
a@rubygrapefruit.net
41d16b2a91668d3648c6c36c7930ca24f1c330e7
88737f2222f7113acada7a1a7f277207e0ea0def
/fresh-api/src/main/java/com/fresh/api/controllers/ApiFeedBackController.java
0088624c27d4160904655c6ab7b48ecf847264b5
[]
no_license
xiaoeazy/fresh
c465ef7b766453244341aa9c540eaeafa805b557
25c72a45270549b25f970bb576003e0a6ff9b8bc
refs/heads/master
2020-04-23T16:16:41.752654
2019-02-18T14:06:07
2019-02-18T14:06:07
159,462,905
0
0
null
null
null
null
UTF-8
Java
false
false
1,084
java
package com.fresh.api.controllers; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.fresh.api.annotation.LoginUser; import com.fresh.api.util.ApiBaseAction; import com.fresh.manager.pojo.shop.Feedback; import com.fresh.manager.pojo.shop.User; import com.fresh.manager.shop.service.IFeedbackService; @RestController @RequestMapping("/api/feedback") public class ApiFeedBackController extends ApiBaseAction { @Autowired private IFeedbackService apiFeedBackService; /** * 保存 */ @RequestMapping("/save") public Object save(@LoginUser User loginUser,@RequestBody Feedback feedback) { try { apiFeedBackService.saveForApi(loginUser,feedback); return toResponsSuccess("感谢你的反馈"); } catch (Exception e) { // TODO Auto-generated catch block return toResponsFail("反馈失败"); } } }
[ "huan@huan-pc" ]
huan@huan-pc
0caec3b728f35909274abc8dbd3bd49fbe4bb9e7
96f1afad941c88408c1ba35edf2397a8429add4e
/app/src/test/java/com/patrick/worldtrip/ExampleUnitTest.java
76ea8b41233421e21cc28a62faf2643b3687467f
[]
no_license
SquireMaster/WorldTrip
883ee075a4bf578ca7f2169f81204df7f9c89ff7
680f4eca41e95d19b7e757690e2bd11892edffb5
refs/heads/master
2021-01-11T01:24:28.897391
2016-10-12T15:07:54
2016-10-12T15:07:54
70,711,769
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.patrick.worldtrip; 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() throws Exception { assertEquals(4, 2 + 2); } }
[ "patrick@Masters-MacBook-Pro.local" ]
patrick@Masters-MacBook-Pro.local
fc65778d2845269ef9234daf7f130c81ddb4882b
0e4aa68c1d459a573523b550e92be2793fb1ac37
/client/src/main/java/cn/trafficdata/KServer/client/Utils/DailUtils.java
4a0dfc0a2f8c583a47f2bd4ce7bc8f7c57e37fe7
[]
no_license
kinglf/KServer
ab258cde1213e55e7514c43a29688579cfee1200
5b59a7b44dfd18b2a940774eaa253c07d8cf5e8d
refs/heads/master
2021-01-11T04:14:00.227943
2016-11-10T09:15:40
2016-11-10T09:15:40
71,202,301
0
0
null
null
null
null
UTF-8
Java
false
false
183
java
package cn.trafficdata.KServer.client.Utils; /** * Created by Kinglf on 2016/11/8. */ public class DailUtils { public static boolean dailAdsl(){ return false; } }
[ "kinglf@live.cn" ]
kinglf@live.cn
a4526767abfa5e18c132453bf28bd63b0dfce1c8
56490ad3315abf4206e3ba201319f151df4939cc
/lecture4/Assignment3.java
8e26c995ad6a7204dc1845e9ddcd8971a777842f
[]
no_license
sweetyburnwal/Java
4e669aa6a64097498851459587548e38557cdfe3
44fdfb22b1ed1512746b25927f66ad215fff5ab2
refs/heads/master
2020-06-18T21:31:59.286558
2019-07-11T19:53:24
2019-07-11T19:53:24
196,456,801
0
0
null
null
null
null
UTF-8
Java
false
false
1,716
java
package lecture4; /** * Created by piyush0 on 13/06/17. */ public class Assignment3 { public static void main(String[] args) { int binary = any2any(8, 2, 57); System.out.println(binary); } public static int any2any(int srcBase, int destBase, int num) { int decimal = any2dec(srcBase, num); return dec2any(destBase, decimal); } public static int bin2dec(int bin) { int dec = 0; int twoPower = 1; while (bin != 0) { int rem = bin % 10; int component = rem * twoPower; dec += component; twoPower = twoPower * 2; bin = bin / 10; } return dec; } public static int dec2bin(int dec) { int bin = 0; int tenPower = 1; while (dec != 0) { int rem = dec % 2; int component = rem * tenPower; dec += component; tenPower = tenPower * 10; dec = dec / 2; } return bin; } public static int dec2any(int destBase, int dec) { int num = 0; int tenPower = 1; while (dec != 0) { int rem = dec % destBase; int component = rem * tenPower; num += component; tenPower *= 10; dec = dec / destBase; } return num; } public static int any2dec(int srcBase, int num) { int dec = 0; int basePower = 1; while (num != 0) { int rem = num % 10; int component = rem * basePower; dec += component; basePower *= srcBase; num = num / 10; } return dec; } }
[ "rohitkr0807@gmail.com" ]
rohitkr0807@gmail.com
3ada252f9c76c5377dbdd96db6fa4bf70c12ecde
35f88840897cf85108534aa78fd5e0e0fa2a93e7
/WS1-03/Ex4/PGMImage.java
a763d8b4d8861a5649cd387546a2b68d61f6069a
[]
no_license
x1417641995/Bham-sw-1
0fbc5023db47d4afaa3eb457b3fcb59d189b21de
95cd9ec40b5b1f32921865b1d1c3a5983959a491
refs/heads/master
2020-09-12T11:22:56.180762
2019-11-18T09:19:17
2019-11-18T09:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,524
java
import java.io.*; import java.util.Scanner; /** * The class creates an image in form of a greyscale image which is * read in from a file. It contains a method to crop the left upper * half of the picture and write it out again. * * @version 2015-10-19 * @author Manfred Kerber */ public class PGMImage{ private int width; private int height; private int maxShade; private String typeOfFile; private short[][] pixels; /** * @param filename The name of a file that contains an image in * pgm format of type P2. * */ public PGMImage(String filename) { // try since the file may not exist. try { // we read from the scanner s which is linked to the file filename. Scanner s = new Scanner(new File(filename)); /* The field variables are assigned by reading in from a file. The file should start with something like P2 150 176 255 where P2 is the file type, 150 the width of the image, 176 the height, and 255 the maximal grey value. Then follow 150*176 grey values between 0 and 255. */ // We read the initial element that is in our case "P2" typeOfFile = s.next(); // Next we read the width, the height, and the maxShade. width = s.nextInt(); height = s.nextInt(); maxShade = s.nextInt(); //We initialize and read in the different pixels. pixels = new short[height][width]; System.out.println("File not f."); for (int i=0; i<height; i++){ for (int j=0; j<width; j++) { pixels[i][j] = s.nextShort(); } } // We finished reading and close the scanner s. s.close(); } catch (IOException e){ //If the file is not found, an error message is printed, //and an empty image is created. System.out.println("File not found."); typeOfFile = "P2"; width = 0; height = 0; maxShade = 0; pixels = new short[width][height]; } } /** * @return The width of the image. */ public int getWidth(){ return width; } /** * @return The height of the image. */ public int getHeight(){ return height; } /** * @return The maximal grey value of the image. */ public int getMaxShade(){ return maxShade; } /** * @return The file type of the image. */ public String getTypeOfFile(){ return typeOfFile; } /** * @return The matrix representing the pixels of the image. */ public short[][] getPixels(){ return pixels; } /** * The method crops the left upper half of an image. * @param filename The filename of the file in which the cropped * image should be saved. */ public void crop (String filename){ try { BufferedWriter out = new BufferedWriter(new FileWriter(filename)); // We write the file type to out. out.write(getTypeOfFile() + "\n"); // We write the dimensions to out. out.write((getWidth()/2) + " " + (getHeight()/2) +"\n"); // We write maximal number. out.write(getMaxShade() + "\n"); byte counter = 0; for (int i=0; i<getHeight()/2; i++){ for (int j=0; j<getWidth()/2; j++){ out.write(getPixels()[i][j] + " "); counter++; if (counter == 15){ out.write("\n"); counter = 0; } } } out.write("\n"); // We close the file. out.close(); } catch (IOException e){ //Errors are caught. System.out.println("File not found."); } } public int[][] quarter(String filename){ int a = 0; int b ; for(int i = 1; i < quarter.length ; i++ ) { for(int j = 1; j<quarter[i].length ;j++) { for(int i2 = i - 1; i < 3; i++ ) { for(int j2 = j - 1; j<3 ;j++) { a = a + quarter[i2][j2]; } } b = a/9; quarter[i][j] = b; } } /* * An example. */ public static void main(String[] args) { PGMImage cs = new PGMImage("ComputerScience.pgm"); cs.crop("ComputerScienceCrop.pgm"); } }
[ "noreply@github.com" ]
x1417641995.noreply@github.com
5ab5802f54eccdbbcfd344995bce382b27796e48
7b38457339ee141896f1de5697aac70cdc58bc05
/src/edu/indiana/d2i/seqmining/clustering/KMeansDriver.java
55227bac4e7d6e90938fc34e032b40c1bd373867
[ "Apache-2.0" ]
permissive
guangchen/parallel-sequential-pattern-miner
887ded805b785e42696618aa719fbcc4ee919d19
c9c19e0b42c552896c118c12a5eeb639037ed395
refs/heads/master
2021-01-17T11:37:22.840792
2014-08-25T19:17:38
2014-08-25T19:17:38
12,470,189
2
2
null
null
null
null
UTF-8
Java
false
false
4,087
java
package edu.indiana.d2i.seqmining.clustering; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import org.doomdark.uuid.UUIDGenerator; import cgl.imr.base.TwisterException; import cgl.imr.base.TwisterMonitor; import cgl.imr.base.impl.JobConf; import cgl.imr.client.TwisterDriver; import edu.indiana.d2i.seqmining.Constants; import edu.indiana.d2i.seqmining.ds.EventSpaceCentroids; import edu.indiana.d2i.seqmining.util.ClusteringUtils; public class KMeansDriver { private static String usage = "Usage: java edu.indiana.d2i.seqmining.clustering.KMeansDriver" + " <seed centroid file> <num map tasks> <partition file> <property file>"; private UUIDGenerator uuidGen = UUIDGenerator.getInstance(); public void driveMapReduce(String partitionFile, int numMapTasks, String centroidFilePath, Properties prop) throws TwisterException, IOException { int numReducers = 1; // we need only one reducer // job configurations JobConf jobConf = new JobConf("kmeans-map-reduce-" + uuidGen.generateTimeBasedUUID()); jobConf.setMapperClass(KMeansMapTask.class); jobConf.setReducerClass(KMeansReduceTask.class); jobConf.setCombinerClass(KMeansCombiner.class); jobConf.setNumMapTasks(numMapTasks); jobConf.setNumReduceTasks(numReducers); // jobConf.setFaultTolerance(); TwisterDriver driver = new TwisterDriver(jobConf); driver.configureMaps(partitionFile); // load centroids file EventSpaceCentroids centroids = ClusteringUtils .loadFromCentroidFile(centroidFilePath); boolean converged = false; boolean reachedMaxIter = false; int loopCount = 0; int numMaxIteration = Integer.parseInt(prop .getProperty(Constants.CLUSTERING_MAX_NUM_ITER)); float threshold = Float.parseFloat(prop .getProperty(Constants.CLUSTERING_CONVERGE_THRESHOLD)); TwisterMonitor monitor = null; while (!(converged || reachedMaxIter)) { monitor = driver.runMapReduceBCast(centroids); monitor.monitorTillCompletion(); EventSpaceCentroids newCentroids = ((KMeansCombiner) driver .getCurrentCombiner()).getResults(); loopCount++; System.out.println("Done iteration " + loopCount); if (ClusteringUtils.isConverged(centroids, newCentroids, threshold)) { System.out.println("Converged at iteration # " + loopCount); converged = true; } if (loopCount >= numMaxIteration) { System.out.println("Reached maximum iteration # " + numMaxIteration + ", going to exit the loop"); reachedMaxIter = true; } // for next iteration centroids = newCentroids; // post-adjust centroids ClusteringUtils.adjustESCentroids(centroids); } // save centroids to file ClusteringUtils.saveCentroidToFile(centroids, prop.getProperty(Constants.CLUSTERING_OUTFILE_PATH)); // close driver driver.close(); } /** * @param args * @throws IOException * @throws FileNotFoundException */ public static void main(String[] args) throws FileNotFoundException, IOException { // TODO Auto-generated method stub if (args.length != 4) { System.err.println(usage); System.exit(1); } String centroidFilePath = args[0]; int numMapTasks = Integer.parseInt(args[1]); String partitionFile = args[2]; Properties prop = new Properties(); prop.load(new FileInputStream(args[3])); KMeansDriver driver = null; try { driver = new KMeansDriver(); double beginTime = System.currentTimeMillis(); driver.driveMapReduce(partitionFile, numMapTasks, centroidFilePath, prop); double endTime = System.currentTimeMillis(); System.out .println("------------------------------------------------------"); System.out.println("Kmeans clustering took " + (endTime - beginTime) / 1000 + " seconds."); System.out .println("------------------------------------------------------"); } catch (Exception e) { e.printStackTrace(); } } }
[ "gruan@umail.iu.edu" ]
gruan@umail.iu.edu
428f9e68f272717a2c97c6b3dc3c44f214e628cb
4878daf5f7b97518e929e0b1851874605e0d9ac0
/src/main/java/com/futuristlabs/p2p/repos/jdbc/JDBCUserActionsRepository.java
1d43be37376563d950beeb6cd8453ede2d9c03fd
[]
no_license
majamaja/PriorityCoachRepository
5bad016c7e31f97e30d37f07c88ae71183dca63c
c8530ce0239b615bc2f806f4ed9c8133be0266a7
refs/heads/master
2020-04-11T07:55:41.400788
2018-10-15T12:23:50
2018-10-15T12:23:50
161,626,371
0
0
null
null
null
null
UTF-8
Java
false
false
4,807
java
package com.futuristlabs.p2p.repos.jdbc; import com.futuristlabs.p2p.func.useractions.UserActionsLog; import com.futuristlabs.p2p.func.useractions.UserActionsLogStatus; import com.futuristlabs.p2p.func.useractions.UserActionsRepository; import org.joda.time.DateTime; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.stereotype.Repository; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.UUID; @Repository public class JDBCUserActionsRepository extends JDBCRepository implements UserActionsRepository { @Override public List<UserActionsLog> modifiedActionsLogs(UUID userId, DateTime modifiedSince) { final String sql = onlyModifiedForUser( " SELECT id, user_id, life_upgrade_action_id, action_date, times_done " + " FROM user_actions_log "); final MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("modifiedSince", modifiedSince != null ? modifiedSince.toDate() : null); params.addValue("userId", userId.toString()); return db.returnList(sql, params, new UserActionsLogRowMapper()); } @Override public List<UserActionsLog> modifiedActionsLogsRestricted(final UUID userId, final DateTime modifiedSince, final UUID friendId) { final String sql = onlyModifiedForUser( " SELECT id, user_id, life_upgrade_action_id, action_date, times_done " + " FROM user_actions_log ", " AND life_upgrade_action_id IN (SELECT life_upgrade_action_id FROM user_permissions WHERE user_id = :userId AND access_to = :friendId AND visible = true) "); final MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("modifiedSince", modifiedSince != null ? modifiedSince.toDate() : null); params.addValue("userId", userId.toString()); params.addValue("friendId", friendId.toString()); return db.returnList(sql, params, new UserActionsLogRowMapper()); } @Override public List<UUID> deletedActionsLogs(UUID userId, DateTime modifiedSince) { final String sql = deletedSinceForUser("user_actions_log"); final MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("modifiedSince", modifiedSince != null ? modifiedSince.toDate() : null); params.addValue("userId", userId.toString()); return db.returnList(sql, params, new UUIDMapper()); } @Override public void modifyActionsLogs(UUID userId, List<UserActionsLog> userActionsLogs) { if (userActionsLogs == null || userActionsLogs.isEmpty()) { return; } final String sql = " INSERT INTO user_actions_log (id, user_id, life_upgrade_action_id, action_date, status, times_done) " + " VALUES (:id, :userId, :lifeUpgradeActionId, :actionDate, :status, :timesDone) " + " ON DUPLICATE KEY UPDATE life_upgrade_action_id = :lifeUpgradeActionId, action_date = :actionDate, status = :status, times_done = :timesDone "; for (UserActionsLog userActionsLog : userActionsLogs) { final MapSqlParameterSource params = new MapSqlParameterSource(); params.addValue("id", userActionsLog.getId().toString()); params.addValue("userId", userId.toString()); params.addValue("lifeUpgradeActionId", userActionsLog.getLifeUpgradeActionId().toString()); params.addValue("actionDate", userActionsLog.getActionDateAsDate().toDate()); params.addValue("status", UserActionsLogStatus.DONE.toString()); params.addValue("timesDone", userActionsLog.getTimesDone()); db.update(sql, params); } } @Override public void deleteActionsLogs(UUID userId, List<UUID> userActionsLogs) { deleteFromTable("user_actions_log", userId, userActionsLogs); } private static class UserActionsLogRowMapper implements RowMapper<UserActionsLog> { @Override public UserActionsLog mapRow(ResultSet rs, int rowNum) throws SQLException { final UUID id = UUID.fromString(rs.getString("id")); final UUID lifeUpgradeActionId = UUID.fromString(rs.getString("life_upgrade_action_id")); final DateTime actionDate = new DateTime(rs.getTimestamp("action_date")); final int timesDone = rs.getInt("times_done"); final UserActionsLog log = new UserActionsLog(); log.setId(id); log.setLifeUpgradeActionId(lifeUpgradeActionId); log.setActionDateAsDate(actionDate); log.setTimesDone(timesDone); return log; } } }
[ "stef.vartolomeev@gmail.com" ]
stef.vartolomeev@gmail.com
f09ae41dbab3b421c4a58610e3ed0934caf73dc2
54c6ce85c84e7d9a7e45f9a13f6494df6c86ab08
/Java/workspace/Day7/src/com/bimapalma/day7/POTest.java
6aaa211ad96dc12ce87f9dcccc755963990bc3e4
[]
no_license
AinulMutaqin/BimaTraining
6daee714bc0aea00145df7c342a56846a8c9903c
48fe25f99c9f05c26d98fccd528d6bc736d90a00
refs/heads/master
2021-01-17T07:26:15.123199
2016-07-21T07:27:14
2016-07-21T07:27:14
18,900,318
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package com.bimapalma.day7; import java.util.ArrayList; public class POTest { public static void main(String[] args) { // TODO Auto-generated method stub PO po = new PO(); po.setHeader("Purchase pupuk"); Item pupuk = new Item(); ArrayList daftarItem = po.getItem(); daftarItem.add(pupuk); // String namaProd = ((Item)); // // ArrayList items = po.getItem(); // Item item = } }
[ "ainul.mutaqin@ilcs.co.id" ]
ainul.mutaqin@ilcs.co.id
a5f6993f4a979b5a235b99446879a166f98548cc
8aff3dd270d7de736de5577d4d67e8c367542bf0
/BBSSDKDemo/src/main/java/cn/byr/bbs/sdkdemo/openAPI/bean/Mail.java
084f1a77f4a5eee6b8528b2740ac55e4abbd5f36
[]
no_license
hangdj/byrbbsSDK
871a54c780770211365729c0616438b6e8872c2c
b4a0e82aee94defd2cb27c95e6a1e99260893338
refs/heads/master
2021-06-13T00:23:25.279423
2017-03-12T02:42:17
2017-03-12T02:42:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,619
java
package cn.byr.bbs.sdkdemo.openAPI.bean; /** * 信件结构体 * * @author dss886 * @since 2014-9-7 */ public class Mail { /** * 信件编号,此编号为/mail/:box/:num中的num */ private int index; /** * 是否标记为m */ private boolean is_m; /** * 是否已读 */ private boolean is_read; /** * 是否回复 */ private boolean is_reply; /** * 是否有附件 */ private boolean has_attachment; /** * 信件标题 */ private String title; /** * 发信人 */ private User user; /** * 发信时间 */ private int post_time; /** * 所属信箱名 */ private String box_name; /** * 信件内容 * 只存在于/mail/:box/:num中 */ private String content; /** * 信件的附件列表 * 只存在于/mail/:box/:num中 */ private Attachment attachment; public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public boolean isIs_m() { return is_m; } public void setIs_m(boolean is_m) { this.is_m = is_m; } public boolean isIs_read() { return is_read; } public void setIs_read(boolean is_read) { this.is_read = is_read; } public boolean isIs_reply() { return is_reply; } public void setIs_reply(boolean is_reply) { this.is_reply = is_reply; } public boolean isHas_attachment() { return has_attachment; } public void setHas_attachment(boolean has_attachment) { this.has_attachment = has_attachment; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public int getPost_time() { return post_time; } public void setPost_time(int post_time) { this.post_time = post_time; } public String getBox_name() { return box_name; } public void setBox_name(String box_name) { this.box_name = box_name; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Attachment getAttachment() { return attachment; } public void setAttachment(Attachment attachment) { this.attachment = attachment; } }
[ "alsoblack222@gmail.com" ]
alsoblack222@gmail.com
a0a4117cc6e402cda1ecaaf01288c9a4a05ff446
0c500a1b900055d4e7c678b61883a89516e1693a
/app/src/main/java/com/example/adnanshaukat/myapplication/View/Customer/FragmentMainCustomer.java
7b66bc5d512a2b6380f7765a6ace0071137988b6
[]
no_license
adnanshaukat425/good_tranport_android
a49a11272af5c8d43cf0e4df328fd561474fec90
34b41671f6b3de75b4ef0a7c59904d19be886f3e
refs/heads/master
2020-04-04T16:52:05.788351
2019-08-31T05:50:11
2019-08-31T05:50:11
156,096,892
1
0
null
null
null
null
UTF-8
Java
false
false
4,926
java
package com.example.adnanshaukat.myapplication.View.Customer; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.adnanshaukat.myapplication.R; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.charts.LineChart; import com.github.mikephil.charting.components.AxisBase; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.data.Entry; import com.github.mikephil.charting.data.LineData; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.formatter.IAxisValueFormatter; import java.util.ArrayList; import java.util.List; /** * Created by AdnanShaukat on 01/12/2018. */ public class FragmentMainCustomer extends Fragment { View view; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_main_customer, container, false); populate_chart(); return view; } private void populate_chart(){ LineChart line_chart = (LineChart) view.findViewById(R.id.line_chart); BarChart bar_chart = (BarChart) view.findViewById(R.id.bar_chart); final String[] bar_x_axis = new String[]{"Mon", "Tues", "Wed", "Thurs", "Fri", "Sat", "Sun"}; final String[] line_x_axis = new String[]{"Hassan", "Ifran", "Mahmood", "Khan", "Rafique"}; int[] line_y_axis = new int[]{25, 38, 53, 21, 9, 12, 69}; int[] bar_y_axis = new int[]{105, 58, 23, 72, 40, 11, 99}; List<Entry> line_entries = new ArrayList<Entry>(); List<BarEntry> bar_entries = new ArrayList<BarEntry>(); for (int i = 0; i < line_x_axis.length; i++) { Entry entry = new Entry(i, line_y_axis[i], line_x_axis); line_entries.add(entry); } for (int i = 0; i < bar_x_axis.length; i++) { BarEntry barEntry = new BarEntry(i, bar_y_axis[i], bar_x_axis); bar_entries.add(barEntry); } IAxisValueFormatter line_x_formatter = new IAxisValueFormatter() { @Override public String getFormattedValue(float value, AxisBase axis) { return line_x_axis[(int) value]; } }; IAxisValueFormatter bar_x_formatter = new IAxisValueFormatter() { @Override public String getFormattedValue(float value, AxisBase axis) { return bar_x_axis[(int) value]; } }; XAxis line_xAxis = line_chart.getXAxis(); line_xAxis.setGranularity(1f); // minimum axis-step (interval) is 1 line_xAxis.setValueFormatter(line_x_formatter); line_xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); line_xAxis.setTextSize(12f); XAxis bar_xAxis = bar_chart.getXAxis(); bar_xAxis.setGranularity(1f); // minimum axis-step (interval) is 1 bar_xAxis.setValueFormatter(bar_x_formatter); bar_xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); bar_xAxis.setTextSize(12f); LineDataSet dataset = new LineDataSet(line_entries, ""); LineData line_data = new LineData(dataset); line_data.setValueTextSize(12); BarDataSet bar_data_set = new BarDataSet(bar_entries, ""); BarData bar_data = new BarData(bar_data_set); bar_chart.setData(bar_data); bar_data.setValueTextColor(R.color.colorPrimary); bar_data.setValueTextSize(12); line_chart.setData(line_data); // Description bar_description = new Description(); // bar_description.setText("Your last week trips count"); // bar_description.setTextColor(R.color.colorPrimary); // bar_description.setTextSize(11f); bar_chart.setDescription(null); // // Description line_description = new Description(); // line_description.setText("Your top 5 dirver of the week"); // line_description.setTextColor(R.color.colorPrimary); // line_description.setTextSize(11f); line_chart.setDescription(null); line_chart.setNoDataText("No Drivers available right now"); line_chart.animateX(1000); line_chart.animateY(1000); line_chart.animate().setDuration(1000); line_chart.invalidate(); bar_chart.setNoDataText("No trips available right now"); bar_chart.setGridBackgroundColor(R.color.fillColor); bar_chart.animateX(1000); bar_chart.animateY(1000); bar_chart.animate().setDuration(1000); bar_chart.invalidate(); } }
[ "adnanshaukat425@gmail.com" ]
adnanshaukat425@gmail.com
e16080d2716a914b513c75750646f2131188e3c6
b68807706d0464b2f1df97f8548b46c1ba9b165b
/.svn/pristine/e1/e16080d2716a914b513c75750646f2131188e3c6.svn-base
dd074de3b6a0a45f46432a7ab5215fe37354b89d
[ "LicenseRef-scancode-mit-specification-disclaimer", "Xerox", "Apache-2.0" ]
permissive
tikue/jcs2-snapshot
376f34eb0ab57a654599ab6c7a5850ffd271f4a7
92bcf5c3764d3319f1ecbed429153406a232841f
refs/heads/master
2021-01-02T22:18:05.331748
2014-02-11T12:14:26
2014-02-11T12:14:26
16,729,637
0
1
null
2016-03-09T15:40:11
2014-02-11T12:07:19
Java
UTF-8
Java
false
false
3,827
package org.apache.commons.jcs.auxiliary.disk.file; import org.apache.commons.jcs.auxiliary.AuxiliaryCacheAttributes; import org.apache.commons.jcs.auxiliary.disk.AbstractDiskCacheAttributes; /** * Configuration values for the file disk cache. */ public class FileDiskCacheAttributes extends AbstractDiskCacheAttributes { /** Don't change. */ private static final long serialVersionUID = -7371586172678836062L; /** Default file count limit: -1 means no limit */ public static final int DEFAULT_MAX_NUMBER_OF_FILES = -1; /** Max number of files */ private int maxNumberOfFiles = DEFAULT_MAX_NUMBER_OF_FILES; /** Default limit on the number of times we will retry a delete. */ public static final int DEFAULT_MAX_RETRIES_ON_DELETE = 10; /** Max number of retries on delete */ private int maxRetriesOnDelete = DEFAULT_MAX_RETRIES_ON_DELETE; /** Default touch rule. */ public static final boolean DEFAULT_TOUCH_ON_GET = false; /** Default limit on the number of times we will retry a delete. */ public static final int DEFAULT_MAX_RETRIES_ON_TOUCH = 10; /** Max number of retries on touch */ private int maxRetriesOnTouch = DEFAULT_MAX_RETRIES_ON_TOUCH; /** * Should we touch on get. If so, we will reset the last modified time. If you have a max file * size set, this will make the removal strategy LRU. If this is false, then the oldest will be * removed. */ private boolean touchOnGet = DEFAULT_TOUCH_ON_GET; /** * Returns a copy of the attributes. * <p> * @return AuxiliaryCacheAttributes */ @Override public AuxiliaryCacheAttributes copy() { try { return (AuxiliaryCacheAttributes) this.clone(); } catch ( Exception e ) { // swallow } return this; } /** * @param maxNumberOfFiles the maxNumberOfFiles to set */ public void setMaxNumberOfFiles( int maxNumberOfFiles ) { this.maxNumberOfFiles = maxNumberOfFiles; } /** * @return the maxNumberOfFiles */ public int getMaxNumberOfFiles() { return maxNumberOfFiles; } /** * @param maxRetriesOnDelete the maxRetriesOnDelete to set */ public void setMaxRetriesOnDelete( int maxRetriesOnDelete ) { this.maxRetriesOnDelete = maxRetriesOnDelete; } /** * @return the maxRetriesOnDelete */ public int getMaxRetriesOnDelete() { return maxRetriesOnDelete; } /** * @param touchOnGet the touchOnGet to set */ public void setTouchOnGet( boolean touchOnGet ) { this.touchOnGet = touchOnGet; } /** * @return the touchOnGet */ public boolean isTouchOnGet() { return touchOnGet; } /** * @param maxRetriesOnTouch the maxRetriesOnTouch to set */ public void setMaxRetriesOnTouch( int maxRetriesOnTouch ) { this.maxRetriesOnTouch = maxRetriesOnTouch; } /** * @return the maxRetriesOnTouch */ public int getMaxRetriesOnTouch() { return maxRetriesOnTouch; } /** * Write out the values for debugging purposes. * <p> * @return String */ @Override public String toString() { StringBuffer str = new StringBuffer(); str.append( "DiskFileCacheAttributes " ); str.append( "\n diskPath = " + diskPath ); str.append( "\n maxNumberOfFiles = " + getMaxNumberOfFiles() ); str.append( "\n maxRetriesOnDelete = " + getMaxRetriesOnDelete() ); return str.toString(); } }
[ "tkuehn@cmu.edu" ]
tkuehn@cmu.edu
8ca5c804a151701a1be1e40cac5f988bb53af98b
318f01d9c7d6d5615c32eaf3a48b38e72c89dec6
/thirdpp-trust-channel/src/main/java/com/zendaimoney/trust/channel/entity/cmb/FileTop.java
5c830dd6be5d3b2b27c6035e4771055a10c65552
[]
no_license
ichoukou/thirdapp
dce52f5df2834f79a51895475b995a3e758be8c0
aae0a1596e06992b600a1a442723b833736240e3
refs/heads/master
2020-05-03T03:12:33.064089
2018-04-18T06:00:14
2018-04-18T06:00:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package com.zendaimoney.trust.channel.entity.cmb; /** * 批量报文File首行抽象类 * @author mencius * */ public abstract class FileTop { }
[ "gaohongxuhappy@163.com" ]
gaohongxuhappy@163.com
52f1ec4147b7e319afca5e659a35f00e31c2ca05
4131896155168c1342cc6cd736b42c5a523cb4c4
/FormAutomation/src/utilities/XLUtil.java
909420be94c46ee6f96eda8060823eeebd93487c
[]
no_license
Ash-sharma/GoogleFormAtuomation
3bc100c147227af05cfb805679884b22f3e83554
b37acc0d6d4ca1a5d739cc1e6db5c03e4b664c7a
refs/heads/master
2023-05-13T20:41:42.303838
2020-03-04T19:43:43
2020-03-04T19:43:43
244,943,096
0
0
null
null
null
null
UTF-8
Java
false
false
1,648
java
package utilities; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class XLUtil { public static FileInputStream fi; public static FileOutputStream fo; public static XSSFWorkbook wb; public static XSSFSheet ws; public static XSSFRow row; public static XSSFCell cell; public static int getRowCount(String xlfile,String xlsheet) throws IOException { fi=new FileInputStream(xlfile); wb=new XSSFWorkbook(fi); ws=wb.getSheet(xlsheet); int rowcount=ws.getLastRowNum(); wb.close(); fi.close(); return rowcount; } public static int getCellCount(String xlfile,String xlsheet,int rownum) throws IOException { fi=new FileInputStream(xlfile); wb=new XSSFWorkbook(fi); ws=wb.getSheet(xlsheet); row=ws.getRow(rownum); int cellcount=row.getLastCellNum(); wb.close(); fi.close(); return cellcount; } public static String getCellData(String xlfile,String xlsheet,int rownum,int colnum) throws IOException { fi=new FileInputStream(xlfile); wb=new XSSFWorkbook(fi); ws=wb.getSheet(xlsheet); row=ws.getRow(rownum); cell=row.getCell(colnum); String data; try { DataFormatter formatter = new DataFormatter(); String cellData = formatter.formatCellValue(cell); return cellData; } catch (Exception e) { data=""; } wb.close(); fi.close(); return data; } }
[ "ash@localhost" ]
ash@localhost
9978b04804048c26d54c71443d5eeec4cb7ede51
da52f32bb672e4bfa5324a4bbb1e2cff677ef73d
/ConstructBinaryTreefromPreorderandInorderTraversal/Solution.java
7326c7b8934f279839082b604182974d5d2e236e
[]
no_license
kingxueyuf/LeetCode
bc91a23e6247b2b9661c4a4f696531c6cc08d401
aed4b0747cfc44dc7fcc8c911c334a2d4c0b42d5
refs/heads/master
2020-12-24T08:41:00.881008
2016-08-30T22:35:20
2016-08-30T22:35:25
17,264,961
0
0
null
null
null
null
UTF-8
Java
false
false
950
java
package ConstructBinaryTreefromPreorderandInorderTraversal; /** * Definition for binary tree public class TreeNode { int val; TreeNode left; * TreeNode right; TreeNode(int x) { val = x; } } */ public class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { return construct(preorder, 0, preorder.length - 1, inorder, 0, inorder.length - 1); } private TreeNode construct(int[] preorder, int i, int j, int[] inorder, int k, int l) { if (i > j) return null; if (k > l) return null; TreeNode root = new TreeNode(preorder[i]); int in = 0; for (int index = k; index <= l; index++) { if (inorder[index] == root.val) in = index; } root.left = construct(preorder, i + 1, i + in - k, inorder, k, in - 1); root.right = construct(preorder, i + in - k + 1, j, inorder, in + 1, l); return root; } } class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } }
[ "robin.xueyufan@gmail.com" ]
robin.xueyufan@gmail.com
139475280f12a3f79c4a4ea2dea8fc89c1feddf1
7d68d11402b1625babc060c475cbfa5ea30b0bca
/app/src/main/java/mess056/sndhrdw/sidw8580H_70.java
8a769eefdbcb73be6dcb76d354499704fe4bc3ee
[ "Apache-2.0" ]
permissive
javaemus/ArcoFlexDroid
c94495059829decd8808f72ead0a12e639a5d474
e9ece569f14b65c906612e2574d15dacbf4bfc80
refs/heads/master
2023-04-25T15:18:28.719274
2021-05-05T10:46:10
2021-05-05T10:46:10
250,279,580
0
0
null
null
null
null
UTF-8
Java
false
false
25,259
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 mess056.sndhrdw; /** * * @author chusogar */ public class sidw8580H_70 { public static final int waveform70_8580[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x70, 0x20,0x70,0x70,0x7c,0x7c,0x7e,0x7f,0x7f,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x3f, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x9f,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80, 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xcf, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0xc0,0xc0,0xc0,0xc0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0x80,0x80,0x80,0x80, 0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0x80,0x80,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xe0,0xe0,0xe3,0xc0,0xc0,0xc0,0xc0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, 0xc0,0xe0,0xe0,0xe0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xe0, 0xc0,0xc0,0xc0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0, 0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xf0,0xf0,0xf0, 0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xf0,0xe0,0xe0,0xe0,0xf0, 0xf0,0xf0,0xf0,0xf0,0xe0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0, 0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf8,0xf8,0xf0,0xf0,0xf0,0xf8, 0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xf8,0xfc,0xfc, 0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfc,0xfe,0xfe,0xfe,0xfe,0xff, 0xff,0xff,0xff,0xff }; }
[ "chusogar@gmail.com" ]
chusogar@gmail.com
f92c78a446bbd8554247d01f3e664707140dfb7f
4697cc8632e1734c6fb2927f7f2f28d26b906f48
/app/src/main/java/com/gj/quiz/quiztopia/MainActivity.java
4dd8d65810aceb0d53364a406668b00b0c16386d
[]
no_license
jeounggene/CV-Trivia-Spree
cd70492850e99a04bad5a53fe87fa77b013538fc
d9932090ddc2f2c5e03f89b66b8dabf4b9461a79
refs/heads/master
2021-01-04T07:52:50.303183
2020-06-18T23:47:55
2020-06-18T23:47:55
240,454,722
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package com.gj.quiz.quiztopia; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import java.util.Timer; import java.util.TimerTask; public class MainActivity extends AppCompatActivity { private final int DELAY = 5000; private Timer timer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate( savedInstanceState ); setContentView( R.layout.activity_main ); timer = new Timer(); timer.schedule( new TimerTask() { @Override public void run() { Intent intent = new Intent(MainActivity.this, Menu.class); startActivity( intent ); finish(); } }, DELAY ); } @Override public void onBackPressed() { timer.cancel(); super.onBackPressed(); } }
[ "jeounggene@gmail.com" ]
jeounggene@gmail.com
a13b24d0bdeadd50b8b1fc1cd1c2571155c1927b
ba4b320e4eae204f944fb0df523386e1fd997826
/src/projetsessionunofficial/FileReader.java
4a76229b116af0c5b4f472f07e8e5a9068cc50ca
[]
no_license
mohamad-yehia/ProjetDeSessionUnofficial
936ddf5f8c5c7e5f3c785100432f383217c88eb6
be6ba3fa07ba4d595d61295b7f8e94dd98cc4aaa
refs/heads/master
2016-09-10T18:48:27.746218
2015-01-30T03:00:03
2015-01-30T03:00:03
29,751,261
0
1
null
null
null
null
UTF-8
Java
false
false
1,040
java
/* * Copyright 2011 Jacques Berger. * * 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 projetsessionunofficial; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.commons.io.IOUtils; public class FileReader { public static String loadFileIntoString(String filePath, String fileEncoding) throws FileNotFoundException, IOException { return IOUtils.toString(new FileInputStream(filePath), fileEncoding); } }
[ "mohamad.yeh@gmail.com" ]
mohamad.yeh@gmail.com
643484d2620124824835fc3c220cb4fec36dee0a
be046a6a8e6fceb6656ecf6bc230962525cafc0e
/ProjetS5_Serveur/src/Model/LoginDB.java
99df107c81da1a61bf7e8d9575d5475c0f8927dd
[]
no_license
MaimounaBah/GestionDesRessourcesUniversitaires
258c0531ba21a71d82ba23966100a3a030c795ad
a7a69bf0a6e3b21872fc760023a1f38671f48ead
refs/heads/main
2023-07-11T19:02:05.541501
2021-08-25T16:59:00
2021-08-25T16:59:00
344,959,360
0
0
null
null
null
null
UTF-8
Java
false
false
2,341
java
package Model; import java.io.Serializable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; public class LoginDB implements Serializable { /** * */ private static final long serialVersionUID = -611148642005061843L; ConnexionDB connexionDB; PreparedStatement prepare; static boolean isLogged = false; static Utilisateur loggedUser; UtilisateurGroupeDB utilisateurGroupeDB; public LoginDB(ConnexionDB connexionDB){ this.connexionDB = connexionDB; utilisateurGroupeDB = new UtilisateurGroupeDB(connexionDB); } public Utilisateur getUtilisateurByLoginMotdepasse(String login, String motdepasse) { Utilisateur utilisateur = null; try { //conn = connexionDB.connect("projets5_grunivertaires", "root",""); Statement state = connexionDB.conn.createStatement(); ResultSet rsult = state.executeQuery("SELECT * FROM utilisateur where usernameU = '"+ login +"' and motDePasse = '"+motdepasse+"' ;"); if (rsult.next()) { ArrayList<String> roles = new ArrayList<>(); for (String s : rsult.getObject(5).toString().split(",")) roles.add(s); utilisateur = new Utilisateur(Integer.valueOf(rsult.getObject(1).toString()), rsult.getObject(2).toString() , rsult.getObject(3).toString(), rsult.getObject(4).toString() , rsult.getObject(5).toString(), roles); ArrayList<Groupe> groupes = new ArrayList<>(); for (UtilisateurGroupe ug: utilisateurGroupeDB.getAllUtilisateursGroupe()) if (ug.getUtilisateur().getId() == utilisateur.getId()) groupes.add(ug.getGroupe()); for (Message m: new MessageDB(connexionDB, new TicketDB(connexionDB,new GroupeDB(connexionDB))).getUserMessages(utilisateur)) { if (!groupes.contains(m.getTicket().getGroupe())) { groupes.add(m.getTicket().getGroupe()); } } utilisateur.setGroupes(groupes); loggedUser = utilisateur; isLogged = true; } } catch(Exception e) { e.printStackTrace(); } return utilisateur; } public static Utilisateur getUtilisateur() { return loggedUser; } public static boolean isLogged() { return isLogged; } public static void isLogout() { isLogged = false; } }
[ "maimounab537@icloud.com" ]
maimounab537@icloud.com
e25907050c9fc4da31c9172d873d6dba19db4299
2aaf821cd124ed92b5750616b876a9dfcc88bd66
/src/main/java/com/urusy/news/entity/DevToUserEntity.java
7ba1947af7f306a06862285ee72f40fb09f8b809
[]
no_license
urusy/news-backend
0c3a370b9de1839a183b41ed385ab41053d64569
cb26fa6c2c736c7dc69c8c40eac8d45fca70b74e
refs/heads/main
2023-03-15T03:21:37.715830
2021-03-16T12:35:52
2021-03-16T12:35:52
334,665,700
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package com.urusy.news.entity; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; @Setter @Getter public class DevToUserEntity { private String name; private String username; @JsonProperty("twitter_username") private String twitterUsername; @JsonProperty("github_username") private String githubUsername; @JsonProperty("website_url") private String websiteUrl; @JsonProperty("profile_image") private String profileImage; @JsonProperty("profile_image_90") private String profileImage90; }
[ "urushima0613@gmail.com" ]
urushima0613@gmail.com
95873f5bae232b1d670db3978f1af110bb70c360
a1e6c9be76d8f57e1e4dff320999f836717b7080
/src/main/java/com/dbs/mcare/service/admin/agg/repository/dao/AggUserTmp.java
6bcb595393511ed16c3afacef374c9010b6eb080
[]
no_license
LEESOOMIN911/soominlee
2ef7c0d8cd5ca6b5151a501efbd5710245fe817f
d9e107a796f8d091d96445daa322457c6fe257ae
refs/heads/master
2021-01-25T01:07:41.739126
2017-06-09T02:18:31
2017-06-09T02:18:31
94,728,155
0
0
null
null
null
null
UTF-8
Java
false
false
837
java
package com.dbs.mcare.service.admin.agg.repository.dao; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; /** * 사용자 정보 통계를 위한 임시 테이블용 * @author aple * */ @JsonIgnoreProperties(ignoreUnknown = true) public class AggUserTmp { // 연령대 private Integer ageOrder; // 우편번호 private String postnoValue; // 통계결과로 얻어지는 값 private Integer dataCnt; public Integer getAgeOrder() { return ageOrder; } public void setAgeOrder(Integer ageOrder) { this.ageOrder = ageOrder; } public String getPostnoValue() { return postnoValue; } public void setPostnoValue(String postnoValue) { this.postnoValue = postnoValue; } public Integer getDataCnt() { return dataCnt; } public void setDataCnt(Integer dataCnt) { this.dataCnt = dataCnt; } }
[ "hyeeunkwon@idatabank.com" ]
hyeeunkwon@idatabank.com
5aa2c889b175cc3169e1f6f613824dbc3e401917
056bd992b1d346f820d1429d92e7a4ffc1e320bd
/src/main/java/com/liha/entities/repository/AccessRuleRepository.java
71b3e7d0f28b2626a40650fd58bf6062d9a440df
[]
no_license
leehuian/redis-proxy
ab01aea0bfb29bc9b93f03eaba7b6919f406d0f3
db3fcaecfa796eb974ab653c84b078ed44d53151
refs/heads/master
2020-03-30T03:34:08.819973
2018-09-30T08:14:16
2018-09-30T08:14:16
150,695,274
1
0
null
null
null
null
UTF-8
Java
false
false
490
java
package com.liha.entities.repository; import com.liha.entities.mysql.AccessRule; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface AccessRuleRepository extends JpaRepository<AccessRule, Integer> { AccessRule findAllByRuleID(int ruleid); List<AccessRule> findAll(); List<AccessRule> findAllBySysID(int sysID); List<AccessRule> findAllByRule(String rule); }
[ "lihuian@cmbchina.com" ]
lihuian@cmbchina.com
e578860f712685dbd98011126a134a5908d66de1
b66935f3d7ed5ccedd38d8098b0ea131814d3cad
/RajawaliExamples/src/com/monyetmabuk/rajawali/tutorials/examples/interactive/TouchAndDragFragment.java
bd98ab2291a601586255f9a5e8851b91c0e58c32
[]
no_license
alchenerd/AN_AR_UFO_ball
5f8c500d52f1971b3ff11b782d655aaf30dc013b
3c7e6730ae7aaaabdd31db13b8e1d4105cfaecc2
refs/heads/master
2022-05-31T18:10:06.718392
2019-09-20T14:24:30
2019-09-20T14:24:30
209,801,280
0
0
null
null
null
null
UTF-8
Java
false
false
5,680
java
package com.monyetmabuk.rajawali.tutorials.examples.interactive; import javax.microedition.khronos.opengles.GL10; import rajawali.Object3D; import rajawali.materials.Material; import rajawali.math.Matrix4; import rajawali.math.vector.Vector3; import rajawali.primitives.Sphere; import rajawali.util.GLU; import rajawali.util.ObjectColorPicker; import rajawali.util.OnObjectPickedListener; import android.content.Context; import android.opengl.GLES20; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import com.monyetmabuk.rajawali.tutorials.R; import com.monyetmabuk.rajawali.tutorials.examples.AExampleFragment; public class TouchAndDragFragment extends AExampleFragment implements OnTouchListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSurfaceView.setOnTouchListener(this); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); LinearLayout ll = new LinearLayout(getActivity()); ll.setOrientation(LinearLayout.VERTICAL); ll.setGravity(Gravity.BOTTOM); TextView label = new TextView(getActivity()); label.setText(R.string.touch_and_drag_fragment_info); label.setTextSize(20); label.setGravity(Gravity.CENTER_HORIZONTAL); label.setHeight(100); ll.addView(label); mLayout.addView(ll); return mLayout; } @Override protected AExampleRenderer createRenderer() { return new TouchAndDragRenderer(getActivity()); } @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: ((TouchAndDragRenderer) mRenderer).getObjectAt(event.getX(), event.getY()); break; case MotionEvent.ACTION_MOVE: ((TouchAndDragRenderer) mRenderer).moveSelectedObject(event.getX(), event.getY()); break; case MotionEvent.ACTION_UP: ((TouchAndDragRenderer) mRenderer).stopMovingSelectedObject(); break; } return true; } private final class TouchAndDragRenderer extends AExampleRenderer implements OnObjectPickedListener { private ObjectColorPicker mPicker; private Object3D mSelectedObject; private int[] mViewport; private double[] mNearPos4; private double[] mFarPos4; private Vector3 mNearPos; private Vector3 mFarPos; private Vector3 mNewObjPos; private Matrix4 mViewMatrix; private Matrix4 mProjectionMatrix; public TouchAndDragRenderer(Context context) { super(context); } protected void initScene() { mViewport = new int[] { 0, 0, mViewportWidth, mViewportHeight }; mNearPos4 = new double[4]; mFarPos4 = new double[4]; mNearPos = new Vector3(); mFarPos = new Vector3(); mNewObjPos = new Vector3(); mViewMatrix = getCurrentCamera().getViewMatrix(); mProjectionMatrix = getCurrentCamera().getProjectionMatrix(); mPicker = new ObjectColorPicker(this); mPicker.setOnObjectPickedListener(this); try { Material material = new Material(); for (int i = 0; i < 20; i++) { Sphere sphere = new Sphere(.3f, 12, 12); sphere.setMaterial(material); sphere.setColor(0x333333 + (int) (Math.random() * 0xcccccc)); sphere.setX(-4 + (Math.random() * 8)); sphere.setY(-4 + (Math.random() * 8)); sphere.setZ(-2 + (Math.random() * -6)); sphere.setDrawingMode(GLES20.GL_LINE_LOOP); mPicker.registerObject(sphere); getCurrentScene().addChild(sphere); } } catch (Exception e) { e.printStackTrace(); } } public void onSurfaceChanged(GL10 gl, int width, int height) { super.onSurfaceChanged(gl, width, height); mViewport[2] = mViewportWidth; mViewport[3] = mViewportHeight; mViewMatrix = getCurrentCamera().getViewMatrix(); mProjectionMatrix = getCurrentCamera().getProjectionMatrix(); } public void getObjectAt(float x, float y) { mPicker.getObjectAt(x, y); } public void onObjectPicked(Object3D object) { mSelectedObject = object; } public void moveSelectedObject(float x, float y) { if (mSelectedObject == null) return; // // -- unproject the screen coordinate (2D) to the camera's near plane // GLU.gluUnProject(x, mViewportHeight - y, 0, mViewMatrix.getDoubleValues(), 0, mProjectionMatrix.getDoubleValues(), 0, mViewport, 0, mNearPos4, 0); // // -- unproject the screen coordinate (2D) to the camera's far plane // GLU.gluUnProject(x, mViewportHeight - y, 1.f, mViewMatrix.getDoubleValues(), 0, mProjectionMatrix.getDoubleValues(), 0, mViewport, 0, mFarPos4, 0); // // -- transform 4D coordinates (x, y, z, w) to 3D (x, y, z) by dividing // each coordinate (x, y, z) by w. // mNearPos.setAll(mNearPos4[0] / mNearPos4[3], mNearPos4[1] / mNearPos4[3], mNearPos4[2] / mNearPos4[3]); mFarPos.setAll(mFarPos4[0] / mFarPos4[3], mFarPos4[1] / mFarPos4[3], mFarPos4[2] / mFarPos4[3]); // // -- now get the coordinates for the selected object // double factor = (Math.abs(mSelectedObject.getZ()) + mNearPos.z) / (getCurrentCamera().getFarPlane() - getCurrentCamera() .getNearPlane()); mNewObjPos.setAll(mFarPos); mNewObjPos.subtract(mNearPos); mNewObjPos.multiply(factor); mNewObjPos.add(mNearPos); mSelectedObject.setX(mNewObjPos.x); mSelectedObject.setY(mNewObjPos.y); } public void stopMovingSelectedObject() { mSelectedObject = null; } } }
[ "alchenerd@gmail.com" ]
alchenerd@gmail.com
9c6a0e4fa654ffc9d4a41b5d6ce8947a24259619
56ff8fd44407fe7fd239f0cfb194c8c14e8dfad0
/Conditional Statements Advanced/exercises/OnTimeForTheExam.java
8cbf6ab77d9c488437a3d4810e70da42fdaffaa1
[]
no_license
ausendzhikova/Programming-Basics-with-Java
352bffbb33e27ab0fa6d3051509f89a7407f5451
2ee063c9b84dc5dceffd5dcfc81de64db518352a
refs/heads/main
2023-07-15T06:47:17.710729
2021-08-26T10:47:48
2021-08-26T10:47:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,118
java
package exercises; import java.util.Scanner; public class OnTimeForTheExam { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int hourOfExam = Integer.parseInt(scanner.nextLine()); int minutesOfExam = Integer.parseInt(scanner.nextLine()); int hourOfArrival = Integer.parseInt(scanner.nextLine()); int minutesOfArrival = Integer.parseInt(scanner.nextLine()); int minutesExam = hourOfExam * 60 + minutesOfExam; int minutesArrival = hourOfArrival * 60 + minutesOfArrival; int difference = minutesExam - minutesArrival; if (difference <= 30 && difference>=0) { System.out.println("On time"); } else if (difference > 30) { System.out.println("Early"); } else if (minutesArrival > minutesExam) { System.out.println("Late"); } if (minutesArrival != minutesExam) { if ( difference>=0 && difference < 60) { System.out.printf("%d minutes before the start", difference); } else if (difference >= 60) { int hour = difference / 60; int overage = difference % 60; if (overage < 10) { System.out.printf("%d:0%d hours before the start", hour, overage); } else { System.out.printf("%d:%d hours before the start", hour, overage); } } else if (minutesArrival - minutesExam < 60) { System.out.printf("%d minutes after the start", minutesArrival - minutesExam); } else if (minutesArrival - minutesExam >= 60) { int hour = (minutesArrival - minutesExam) / 60; int overage = (minutesArrival - minutesExam) % 60; if (overage < 10) { System.out.printf("%d:0%d hours after the start", hour, overage); } else { System.out.printf("%d:%d hours after the start", hour, overage); } } } System.out.println(); } }
[ "73290490+ausendzhikova@users.noreply.github.com" ]
73290490+ausendzhikova@users.noreply.github.com
ed568a39c67d51fdb45bd408fa8c4b7cf18dd563
2ec45b8c828ab66b0dc45a000a97c39fd5609d92
/src/main/java/com/alipay/api/response/AlipayCommerceOperationTaskListQueryResponse.java
1ce153da0a9ca8fc6f762f1f7623c517abd19a20
[ "Apache-2.0" ]
permissive
aceb985/alipay-sdk-java-all
5c0c8b1b91505c47689c45dbc42e629e73f487a8
e87bc8e7f6750e168a5f9d37221124c085d1e3c1
refs/heads/master
2023-08-20T17:42:44.662840
2021-10-18T13:03:06
2021-10-18T13:03:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,095
java
package com.alipay.api.response; import java.util.List; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.internal.mapping.ApiListField; import com.alipay.api.domain.TaskInfo; import com.alipay.api.domain.TaskTitleInfo; import com.alipay.api.AlipayResponse; /** * ALIPAY API: alipay.commerce.operation.task.list.query response. * * @author auto create * @since 1.0, 2021-10-09 11:20:34 */ public class AlipayCommerceOperationTaskListQueryResponse extends AlipayResponse { private static final long serialVersionUID = 5183386133888794393L; /** * 是否存在下一页 */ @ApiField("has_next_page") private Boolean hasNextPage; /** * 分页数 */ @ApiField("page_number") private Long pageNumber; /** * 任务列表 */ @ApiListField("task_list") @ApiField("task_info") private List<TaskInfo> taskList; /** * 顶部卡片信息 */ @ApiField("task_title") private TaskTitleInfo taskTitle; /** * 总分页数 */ @ApiField("total_pages") private Long totalPages; /** * 总数 */ @ApiField("total_size") private Long totalSize; public void setHasNextPage(Boolean hasNextPage) { this.hasNextPage = hasNextPage; } public Boolean getHasNextPage( ) { return this.hasNextPage; } public void setPageNumber(Long pageNumber) { this.pageNumber = pageNumber; } public Long getPageNumber( ) { return this.pageNumber; } public void setTaskList(List<TaskInfo> taskList) { this.taskList = taskList; } public List<TaskInfo> getTaskList( ) { return this.taskList; } public void setTaskTitle(TaskTitleInfo taskTitle) { this.taskTitle = taskTitle; } public TaskTitleInfo getTaskTitle( ) { return this.taskTitle; } public void setTotalPages(Long totalPages) { this.totalPages = totalPages; } public Long getTotalPages( ) { return this.totalPages; } public void setTotalSize(Long totalSize) { this.totalSize = totalSize; } public Long getTotalSize( ) { return this.totalSize; } }
[ "jishupei.jsp@alibaba-inc.com" ]
jishupei.jsp@alibaba-inc.com