blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
74c8ee94013f7da4b26aa541a29b2a0804c50818
0f88596893525fa060a59a9751dfd1b58a483de7
/com/cburch/logisim/std/arith/Shifter.java
ddc4cc4c443e48c67bc33bc9e7577f5af76fb3de
[]
no_license
Penta0308/Logisim-IOModule
fc0e6dc78848de21b9eb1e90407209a46228558c
e766bf5da1dd506450b35920996144a29ae1c854
refs/heads/master
2020-12-13T18:11:11.018105
2020-01-17T11:14:01
2020-01-17T11:14:01
234,490,074
1
0
null
null
null
null
UTF-8
Java
false
false
7,244
java
/* Copyright (c) 2010, Carl Burch. License information is located in the * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */ package com.cburch.logisim.std.arith; import com.cburch.logisim.tools.key.BitWidthConfigurator; import java.util.Arrays; public class Shifter extends InstanceFactory { static final AttributeOption SHIFT_LOGICAL_LEFT = new AttributeOption("ll", Strings.getter("shiftLogicalLeft")); static final AttributeOption SHIFT_LOGICAL_RIGHT = new AttributeOption("lr", Strings.getter("shiftLogicalRight")); static final AttributeOption SHIFT_ARITHMETIC_RIGHT = new AttributeOption("ar", Strings.getter("shiftArithmeticRight")); static final AttributeOption SHIFT_ROLL_LEFT = new AttributeOption("rl", Strings.getter("shiftRollLeft")); static final AttributeOption SHIFT_ROLL_RIGHT = new AttributeOption("rr", Strings.getter("shiftRollRight")); static final Attribute<AttributeOption> ATTR_SHIFT = Attributes.forOption("shift", Strings.getter("shifterShiftAttr"), new AttributeOption[]{SHIFT_LOGICAL_LEFT, SHIFT_LOGICAL_RIGHT, SHIFT_ARITHMETIC_RIGHT, SHIFT_ROLL_LEFT, SHIFT_ROLL_RIGHT}); private static final int IN0 = 0; private static final int IN1 = 1; private static final int OUT = 2; public Shifter() { super("Shifter", Strings.getter("shifterComponent")); setAttributes(new Attribute[]{ StdAttr.WIDTH, ATTR_SHIFT }, new Object[]{ BitWidth.create(8), SHIFT_LOGICAL_LEFT }); setKeyConfigurator(new BitWidthConfigurator(StdAttr.WIDTH)); setOffsetBounds(Bounds.create(-40, -20, 40, 40)); setIconName("shifter.gif"); } @Override protected void configureNewInstance(Instance instance) { configurePorts(instance); instance.addAttributeListener(); } @Override protected void instanceAttributeChanged(Instance instance, Attribute<?> attr) { if (attr == StdAttr.WIDTH) { configurePorts(instance); } } private void configurePorts(Instance instance) { BitWidth dataWid = instance.getAttributeValue(StdAttr.WIDTH); int data = dataWid == null ? 32 : dataWid.getWidth(); int shift = 1; while ((1 << shift) < data) shift++; Port[] ps = new Port[3]; ps[IN0] = new Port(-40, -10, Port.INPUT, data); ps[IN1] = new Port(-40, 10, Port.INPUT, shift); ps[OUT] = new Port(0, 0, Port.OUTPUT, data); ps[IN0].setToolTip(Strings.getter("shifterInputTip")); ps[IN1].setToolTip(Strings.getter("shifterDistanceTip")); ps[OUT].setToolTip(Strings.getter("shifterOutputTip")); instance.setPorts(ps); } @Override public void propagate(InstanceState state) { // compute output BitWidth dataWidth = state.getAttributeValue(StdAttr.WIDTH); int bits = dataWidth == null ? 32 : dataWidth.getWidth(); Value vx = state.getPort(IN0); Value vd = state.getPort(IN1); Value vy; // y will by x shifted by d if (vd.isFullyDefined() && vx.getWidth() == bits) { int d = vd.toIntValue(); Object shift = state.getAttributeValue(ATTR_SHIFT); if (d == 0) { vy = vx; } else if (vx.isFullyDefined()) { int x = vx.toIntValue(); int y; if (shift == SHIFT_LOGICAL_RIGHT) { y = x >>> d; } else if (shift == SHIFT_ARITHMETIC_RIGHT) { if (d >= bits) d = bits - 1; y = x >> d | ((x << (32 - bits)) >> (32 - bits + d)); } else if (shift == SHIFT_ROLL_RIGHT) { if (d >= bits) d -= bits; y = (x >>> d) | (x << (bits - d)); } else if (shift == SHIFT_ROLL_LEFT) { if (d >= bits) d -= bits; y = (x << d) | (x >>> (bits - d)); } else { // SHIFT_LOGICAL_LEFT y = x << d; } vy = Value.createKnown(dataWidth, y); } else { Value[] x = vx.getAll(); Value[] y = new Value[bits]; if (shift == SHIFT_LOGICAL_RIGHT) { if (d >= bits) d = bits; System.arraycopy(x, d, y, 0, bits - d); Arrays.fill(y, bits - d, bits, Value.FALSE); } else if (shift == SHIFT_ARITHMETIC_RIGHT) { if (d >= bits) d = bits; System.arraycopy(x, d, y, 0, x.length - d); Arrays.fill(y, bits - d, y.length, x[bits - 1]); } else if (shift == SHIFT_ROLL_RIGHT) { if (d >= bits) d -= bits; System.arraycopy(x, d, y, 0, bits - d); System.arraycopy(x, 0, y, bits - d, d); } else if (shift == SHIFT_ROLL_LEFT) { if (d >= bits) d -= bits; System.arraycopy(x, x.length - d, y, 0, d); System.arraycopy(x, 0, y, d, bits - d); } else { // SHIFT_LOGICAL_LEFT if (d >= bits) d = bits; Arrays.fill(y, 0, d, Value.FALSE); System.arraycopy(x, 0, y, d, bits - d); } vy = Value.create(y); } } else { vy = Value.createError(dataWidth); } // propagate them int delay = dataWidth.getWidth() * (3 * Adder.PER_DELAY); state.setPort(OUT, vy, delay); } @Override public void paintInstance(InstancePainter painter) { Graphics g = painter.getGraphics(); painter.drawBounds(); painter.drawPorts(); Location loc = painter.getLocation(); int x = loc.getX() - 15; int y = loc.getY(); Object shift = painter.getAttributeValue(ATTR_SHIFT); g.setColor(Color.BLACK); if (shift == SHIFT_LOGICAL_RIGHT) { g.fillRect(x, y - 1, 8, 3); drawArrow(g, x + 10, y, -4); } else if (shift == SHIFT_ARITHMETIC_RIGHT) { g.fillRect(x, y - 1, 2, 3); g.fillRect(x + 3, y - 1, 5, 3); drawArrow(g, x + 10, y, -4); } else if (shift == SHIFT_ROLL_RIGHT) { g.fillRect(x, y - 1, 5, 3); g.fillRect(x + 8, y - 7, 2, 8); g.fillRect(x, y - 7, 2, 8); g.fillRect(x, y - 7, 10, 2); drawArrow(g, x + 8, y, -4); } else if (shift == SHIFT_ROLL_LEFT) { g.fillRect(x + 6, y - 1, 4, 3); g.fillRect(x + 8, y - 7, 2, 8); g.fillRect(x, y - 7, 2, 8); g.fillRect(x, y - 7, 10, 2); drawArrow(g, x + 3, y, 4); } else { // SHIFT_LOGICAL_LEFT g.fillRect(x + 2, y - 1, 8, 3); drawArrow(g, x, y, 4); } } private void drawArrow(Graphics g, int x, int y, int d) { int[] px = {x + d, x, x + d}; int[] py = {y + d, y, y - d}; g.fillPolygon(px, py, 3); } }
9df08103539e46dd473e2e3672372549a1273f80
83df47ea5a8c33213d3084b1156c3eaaff239055
/src/AddCharacter.java
19439f06a5b34cca9164c15e1b09cd51f3cfbabb
[]
no_license
ChrisIrvine/CS5001-p1-LostConsonants
27a42806d0079e4315d8433d700a8111ccfdcb89
0caa8b8ab443c65d64ce6ac0afa0e1a31f4cbf23
refs/heads/master
2020-03-29T11:45:47.443095
2018-10-02T15:10:00
2018-10-02T15:10:00
149,869,405
0
0
null
null
null
null
UTF-8
Java
false
false
7,211
java
import java.io.File; import java.util.ArrayList; /** * Class to add characters to a given string, evaluate the mutated string and * then print the validated string. * * @author 180009917 * @version 1 */ public class AddCharacter { /** Dictionary to evaluate the new phrases against. */ private static ArrayList<String> dict; /** Zero (0) value for argsCheck Switch Statement. */ private static final int ZERO = 0; /** One (1) value for argsCheck Switch Statement. */ private static final int ONE = 1; /** Four (4) value for argsCheck Switch Statement. */ private static final int FOUR = 4; /** Integer to inform program which set of characters to add. */ private static int whichChar; /** * Main method for AddCharacter class. It will validate the arguments passed * from the command line, extract their values, prepare the phrase for * mutation, mutate then validate the phrase and print the validated * results. * @param args - [0] = filepath to dictionary of words, [1] = word, phrase * or sentence to mutate, [2] = integer declaring which * character set to use */ public static void main(String[] args) { ArrayList<String> results; //Validate the arguments passed argsCheck(args); //read in dictionary from command line dict = FileUtil.readLines(args[0]); //read in the String from command line String s = args[1]; /*Determine if user wants consonants (default), vowel (1) or alphabet (0).*/ if (args.length == 2) { whichChar = 2; } else if (Integer.parseInt(args[2]) == 0) { whichChar = 1; } else { whichChar = 0; } //prepare string for mutation s = LostConsonants.removeFullStop(s); //mutate and validate string results = addCharacter(s); //print the results LostConsonants.printResults(results); } /** * Method to check the number of arguments passed into the program and to * then validate the path to the dictionary file (checks to see if the file * is a .txt file). * * @param args - array of arguments passed from the command line. */ private static void argsCheck(String[] args) { //Check if the number of arguments is good switch (args.length) { case ZERO: System.out.println("Expected 2 or 3 command line " + "arguments, but got 0.\nPlease provide the path to the " + "dictionary file as the first argument and a sentence as " + "the second argument, with an int as the third argument " + "(0 for vowels, 1 for the entire alphabet and leave blank" + " for consonants)."); System.exit(0); case ONE: System.out.println("Expected 2 or 3 command line " + "arguments, but got 1.\nPlease provide the path to the " + "dictionary file as the first argument and a sentence as " + "the second argument, with an int as the third argument " + "(0 for vowels, 1 for the entire alphabet and leave blank" + " for consonants)."); System.exit(0); case FOUR: System.out.println("Expected 2 or 3 command line " + "arguments, but got 4.\nPlease provide the path to the " + "dictionary file as the first argument and a sentence as " + "the second argument, with an int as the third argument " + "(0 for vowels, 1 for the entire alphabet and leave blank" + " for consonants)."); System.exit(0); default: break; } //Check if filepath is good String filepath = args[0]; File file = new File(filepath); if (file.isDirectory() || !file.exists()) { System.out.println("File not found: " + filepath + " (No such file or directory)\nInvalid dictionary, " + "aborting."); System.exit(0); } } /** * Method to execute series of methods to add a character to a given phrase * and then validate the new strings against the given dictionary. * * @param phrase - String to mutate and then validate. * @return - ArrayList of Strings containing the validated mutated phrases. */ private static ArrayList<String> addCharacter(String phrase) { //Declare Method Variables ArrayList<String> holder = new ArrayList<>(); ArrayList<Integer> remove; //Add characters to the given phrase holder = addCharacter(whichChar, phrase, holder); //Validate new phrases against the given dictionary remove = LostConsonants.dictCheck(holder, dict); //If removed a full stop from string, replace it holder = LostConsonants.replaceStop(holder); //Remove any invalid phrases from the results holder = LostConsonants.removeInValid(remove, holder); return holder; } /** * Method to add a character from a given set to a given phrase and then add * the new phrases to an ArrayList<String> to be returned. * * @param charCode - character set to add; 0 == vowels, 1 == alphabet, * default is consonants. * @param phrase - phrase to mutate and validate * @param results - ArrayList of valid mutated phrases. * @return - ArrayList of valid mutated phrases. */ private static ArrayList<String> addCharacter(int charCode, String phrase, ArrayList<String> results) { //Delcare class variables char[] addChar; ArrayList<Character> phraseChars = new ArrayList<>(); //Decide which set of characters to add (consonants, vowels or all) if (charCode == 0) { addChar = "aeiou".toCharArray(); } else if (charCode == 1) { addChar = "abcdefghijklomnopqrstuvwxyz".toCharArray(); } else { addChar = "bcdfghjklmnpqrstvwxyz".toCharArray(); } /*Separate the phrase to mutate into a Character array, then add each character to a ArrayList<Character>*/ for (char c: phrase.toCharArray()) { phraseChars.add(c); } /*For each possible character to add to the phrase, then for each character in the original phrase, add a new character and store the newPhrase into an ArrayList<String>, then remove the added char*/ for (char c: addChar) { for (int i = 0; i < phraseChars.size() + 1; i++) { phraseChars.add(i, c); StringBuilder newPhrase = new StringBuilder(); for (char p : phraseChars) { newPhrase.append(p); } results.add(newPhrase.toString()); phraseChars.remove(i); } } return results; } }
26f1674384f234f83b99a6ce520862fcd36ed7a6
4ae207414fb15a5e110617c7b7cd5bc1bc6e92b6
/src/com/company/model/Pair.java
af2c57786a3fe5609f3c1702229f1db60d710ddd
[]
no_license
Sofment/POC
d0c59180c4c8a0f0a350200170d0ee001430fe0b
01fbeaa03736b50cd50d86d1d0f62308e68b83fa
refs/heads/master
2021-01-10T22:12:32.585087
2015-02-03T08:16:22
2015-02-03T08:16:22
29,969,162
0
0
null
null
null
null
UTF-8
Java
false
false
975
java
package com.company.model; /** * Created by nikolai on 31.01.2015. */ public class Pair { private String key; private String value; public Pair(String key, String value) { this.key = key; this.value = value; } public Pair(String[] pairLines) { if(pairLines == null || pairLines.length != 2){ this.key = ""; this.value = ""; } else { this.key = pairLines[0]; this.value = pairLines[1]; } this.toString(); } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public String toString() { return "Pair{" + "key='" + key + '\'' + ", value='" + value + '\'' + '}'; } }
10363ddb42fd91d63e78f93ec5f050a0f72f230c
e3f898f19ebdd74397be09f8ece32742dc3cbddf
/TemplateMethod/TemplateMethod.java
f645e7b824746c01da85af3fcfcbfa80ab826361
[]
no_license
Mrxxm/JAVACODE-PHPCODE
974106a81efa6a51ffb1dcf0d039ee764076427d
dce9e575355a003faf3dd982aa13207a9809150b
refs/heads/master
2020-03-18T23:00:10.399057
2019-05-08T08:04:20
2019-05-08T08:04:20
135,377,455
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
// 模板方法设计模式 public class TemplateMethod { public static void main(String[] args) { OperateString operate = new OperateString(); OperateInt operateInt = new OperateInt(); System.out.println(operate.getTotalTime()); // 100次的时间 /** * 5 */ System.out.println(operateInt.getTotalTime()); // 100万次的时间 /** * 3 */ } } // 操作的模板类 abstract class AbstractOperateTimeTemplate{ // 模板方法,总体骨架,子类不能修改 final public long getTotalTime(){ long begin = System.currentTimeMillis(); // 开始时间 // 具体操作,留给子类操作 this.doWork(); long end = System.currentTimeMillis(); // 结束时间 long time = end - begin; return time; } // 留给子类的具体操作 protected abstract void doWork(); } // doWork的具体实现 class OperateString extends AbstractOperateTimeTemplate{ protected void doWork(){ String str = ""; for(int i = 0; i < 1000; i++){ str += i; } } } // doWork的另一种实现 class OperateInt extends AbstractOperateTimeTemplate{ protected void doWork(){ int sum = 0; for(int i = 0; i < 1000000; i++){ sum += i; } } }
9c616f36685fef06811936081f512570759fa861
685f61290dbbc4420256cdad24e7e7de682dbb44
/app/src/main/java/matc89/exercicio3/TarefaAdapter.java
8242fdceb26aa667775d4795b296801b761cd737
[]
no_license
matc89-20192/android-exercicio-3-listview-EduardoRSeifert
a6d39fcdc1a461ec5efacd149eb7a6b4c3a8daba
988998621de4d215030b284d42c0623f78f2cc9c
refs/heads/master
2020-08-03T00:58:11.978053
2019-09-29T03:53:11
2019-09-29T03:53:11
211,573,009
0
0
null
null
null
null
UTF-8
Java
false
false
1,585
java
package matc89.exercicio3; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.ArrayList; /** * Created by dudas on 28/09/2019. */ public class TarefaAdapter extends ArrayAdapter<Tarefa> { private ArrayList<Tarefa> tarefas; private static class ViewHolder{ private TextView descricao; private TextView prioridade; } public TarefaAdapter(Context context,ArrayList<Tarefa> tarefas){ super(context, 0, tarefas); this.tarefas = tarefas; } @Override public View getView(int position, View convertView, ViewGroup parent){ ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(this.getContext()) .inflate(android.R.layout.simple_list_item_2, parent, false); holder = new ViewHolder(); holder.descricao = (TextView) convertView.findViewById(android.R.id.text1); holder.prioridade = (TextView) convertView.findViewById(android.R.id.text2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Tarefa item = getItem(position); if (item!= null) { holder.descricao.setText(String.format("%s", item.getDescricao())); holder.prioridade.setText(String.format("Prioridade: %d", item.getPrioridade())); } return convertView; } }
0d37a2f717da4c5f62bd97fb2077ce8a343b12c1
7340d83094b7878359c16e038ca0f1623d7c01c5
/Rocket/src/game/player/bullet/BulletPlayer.java
591c6a4622b3df0ec7f2b12d05e779a4e627f727
[]
no_license
DNQ1408/CI5
b9bb0a3b4d9c76fa767e870a0e295ebb81f1a9d8
184944dbd254f3741af744d37cc2d08503d65503
refs/heads/master
2020-03-07T23:25:58.936027
2018-05-08T12:06:28
2018-05-08T12:06:28
127,781,285
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package game.player.bullet; import base.GameObject; import base.Vector2D; import game.enemy.Enemy; import physic.BoxCollider; import physic.HitObject; import physic.PhysicBody; import physic.RunHitObject; import renderer.ImageRenderer; import java.awt.*; public class BulletPlayer extends GameObject implements PhysicBody, HitObject{ public BoxCollider boxCollider; public Vector2D velocity; private RunHitObject runHitObject; // constructor public BulletPlayer() { this.velocity = new Vector2D(); this.renderer = new ImageRenderer("resources/images/star.png", 8, 8, Color.RED); this.boxCollider = new BoxCollider(10,10); this.runHitObject = new RunHitObject( Enemy.class ); } @Override public void run() { super.run(); this.position.addUp(this.velocity); this.boxCollider.position.set(this.position); this.runHitObject.run(this); } @Override public void getHit(GameObject gameObject) { this.isAlive = false; } @Override public BoxCollider getBoxCollider() { return this.boxCollider; } }
815e1cf7f6e7a84d01675c55a5f0c5306fb9ae33
899608232cd9e33ac6aa1ea23bfd986701b51ec1
/hurriyetopensourcesdk/src/main/java/tr/com/hurriyet/opensourcesdk/services/ServiceMethod.java
2c9cf17714a7d83528eddd1e60840853e2c4a43d
[ "MIT" ]
permissive
hurriyet/hurriyet-public-api-android-sdk
b6c2806de748d807325b0406a5b6a04fd60e9fb0
19519e35e2a4255958e53a43497a246359dd6f8a
refs/heads/master
2021-01-12T05:52:18.982816
2016-12-23T14:30:47
2016-12-23T14:30:47
77,222,233
2
0
null
null
null
null
UTF-8
Java
false
false
3,285
java
package tr.com.hurriyet.opensourcesdk.services; import android.text.TextUtils; import com.android.volley.Request.Method; import tr.com.hurriyet.opensourcesdk.extraparams.FilterParamsBase; import tr.com.hurriyet.opensourcesdk.extraparams.SelectParamsBase; public enum ServiceMethod { ARTICLE(Method.GET, false, "/v1/articles"), COLUMN(Method.GET, false, "/v1/columns"), PHOTOGALLERY(Method.GET, false, "/v1/newsphotogalleries"), PAGES(Method.GET, false, "/v1/pages"), PATH(Method.GET, false, "/v1/paths"), WRITER(Method.GET, false, "/v1/writers"); private final String BASE_URL = BuildConstants.getServiceUrl(); private int methodType; private boolean useSSL; private String httpUrl; private String id; private Integer top; private SelectParamsBase selectParams; private FilterParamsBase filterParamsBase; ServiceMethod(int methodType, boolean useSSL, String url) { this.methodType = methodType; this.useSSL = useSSL; this.httpUrl = url; } public int getMethodType() { return this.methodType; } public String getId() { return id; } public void setId(String id) { this.id = id; } @Override public String toString() { return httpUrl; } public String constructUrl() { StringBuilder construction = new StringBuilder(constructInitials()); if (!TextUtils.isEmpty(id)) construction.append("/" + id); if (urlParameters() != null) construction.append(urlParameters()); return construction.toString(); } private StringBuilder constructInitials() { StringBuilder construction = new StringBuilder(); return construction.append("https://").append(BASE_URL).append(httpUrl); } private String urlParameters() { if (getTop() == null && getSelectParams() == null) return null; StringBuilder sb = new StringBuilder("?"); if (getSelectParams() != null) sb.append(getSelectParams().getSelectParamsAsString()); if (getTop() != null) { if (getSelectParams() != null) sb.append("&"); sb.append(getTop()); } if (getFilterParamsBase() != null) { if (getSelectParams() != null || getTop() != null) sb.append("&"); sb.append(getFilterParamsBase().getFilterParamsAsString()); } return sb.toString(); } public SelectParamsBase getSelectParams() { return selectParams; } public void setSelectParams(SelectParamsBase selectParams) { this.selectParams = selectParams; } public String getTop() { if (top == null || top == 0) return null; return "$top=" + String.valueOf(top); } public void setTop(Integer parameter) { this.top = parameter; } public FilterParamsBase getFilterParamsBase() { return filterParamsBase; } public void setFilterParamsBase(FilterParamsBase filterParamsBase) { this.filterParamsBase = filterParamsBase; } }
cd9182d864749dd09a4615d9ca8ce09b5f07a65e
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Lang/65/org/apache/commons/lang/time/DurationFormatUtils_formatPeriodISO_232.java
043a8e2f2af9e7fd01d957211bf2c0870ebc59eb
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
1,451
java
org apach common lang time durat format util constant tabl describ token pattern languag format tabl border charact durat element year month dai hour minut second millisecond tabl author apach ant date util dateutil author href mailto sbailliez apach org stephan bailliez author href mailto stefan bodewig epost stefan bodewig author stephen colebourn author href mailto ggregori seagullsw gari gregori author henri yandel version durat format util durationformatutil format time gap string format iso8601 period format param start milli startmilli start durat format param end milli endmilli end durat format time string string format period iso formatperiodiso start milli startmilli end milli endmilli format period formatperiod start milli startmilli end milli endmilli iso extend format pattern time zone timezon default getdefault
72a607813fa087b30e4b0bcb54693d60acbf5796
70e8d7f2d419f36a5d2f7f7cb7e7e9650129becb
/order/server/src/test/java/com/example/order/server/service/impl/OrderServiceImplTest.java
8bd0ab7792dc015806c4e2b93b1b89052d186995
[]
no_license
guaijie/cloud
f297522ebd6be65d60000c5b72730f75ad5038fe
c19e5b24c692fc32cca616664acff94f6329d905
refs/heads/master
2022-06-28T20:10:58.280596
2019-07-30T09:33:11
2019-07-30T09:33:11
189,809,823
0
0
null
2022-06-21T01:14:04
2019-06-02T05:50:09
Java
UTF-8
Java
false
false
1,588
java
package com.example.order.server.service.impl; import com.example.order.server.ServerApplicationTests; import com.example.order.server.dto.DetailOrderViewDTO; import com.example.order.server.dto.UserOrderDTO; import com.example.order.server.entity.DetailOrder; import com.example.order.server.service.OrderService; import com.example.order.server.vo.DetailOrderVO; import org.junit.Assert; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; @Component class OrderServiceImplTest extends ServerApplicationTests { @Autowired(required = false) OrderService orderService; @Test void createOrder() { UserOrderDTO userOrderDTO = new UserOrderDTO(); userOrderDTO.setUserId("97304531204ef7431330c20427d95485"); DetailOrder detailOrder = new DetailOrder(); detailOrder.setProductId("0000000003"); detailOrder.setProductCounts(7); userOrderDTO.setDetailOrderList(Arrays.asList(detailOrder)); System.out.println(userOrderDTO.toString()); orderService.createOrder(userOrderDTO); } @Test public void getDetailOrderByPage() { DetailOrderViewDTO detailOrderViewDTO = new DetailOrderViewDTO("b567c0c5616794f6e4b9252d6efd65f5", 0, 5); List<DetailOrderVO> detailOrderList = orderService.getDetailOrderByPage(detailOrderViewDTO); System.out.println(detailOrderList.toString()); Assert.assertTrue(detailOrderList.size() > 0); } }
00e49d9931cb61c70330386e79826f47964e4f2a
c98636a8715d85bdf12a41a4b7f448da7687edc4
/src/capitulo14/laboratorio/MaioresSalarios.java
e584ed93cafd9e7020a7590f7f55923984eac535
[]
no_license
HugoSimoes/01_impacta-apostila
8e649990f11bd74f5c1525ab1597d09e120af306
253ebef57fda690864a868f3cde0b434d400635c
refs/heads/master
2020-08-21T12:26:12.741566
2019-10-19T06:41:48
2019-10-19T06:41:48
216,159,478
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package capitulo14.laboratorio; import java.util.Locale; public class MaioresSalarios { public static void main(String[] args) { Locale.setDefault(Locale.US); double[] salariosBrutos = {1350.00, 4320.00, 8235.25, 2500.55, 1830.00, 850.26, 3614.29, 12500.00}; double[] salariosTop; salariosTop = DoubleArrayUtils.filtraValores(salariosBrutos, (salario) -> salario >= 3000.00); } }
bb6524c3f29df1b3fbe518a6895748fb64cecb53
b1f8009a15bfafcb935f9d808f7d9cf6ee753367
/Lesson10AspectDemo/src/main/java/cs544/spring44/aop/xml/Customer.java
2ace7bf54df7b71c58d05369acbfdd38d9b11abd
[]
no_license
mervynn/CS544
90dd035489ce2474cc9f22452a6c250976062f15
3a65b2342e1211b3a77c8c5df6c888606476cca7
refs/heads/master
2022-12-27T17:19:24.852199
2019-07-20T03:06:43
2019-07-20T03:06:43
193,564,153
0
1
null
2022-12-16T00:36:09
2019-06-24T19:11:23
Java
UTF-8
Java
false
false
65
java
package cs544.spring44.aop.xml; public class Customer { }
06dba12b4d2d4a78a958b112e7ebc3dc6c63a4c3
22bf7ae8490b64dd1ccaa7558cf21b2d43c20960
/src/main/java/com/sino/daily/code_2019_9_1/ThreadInterrupt.java
036853f18017168d2a8e1247ad923ebc3469d17b
[]
no_license
jieniyimiao/java-daily-code
6d86fa68dbad84012f84d0204e6b21461d6d99e7
5383180bd885790b337fee06a305599c3941da0a
refs/heads/master
2021-07-07T07:34:52.348991
2020-08-23T04:38:08
2020-08-23T04:38:08
175,441,085
1
0
null
null
null
null
UTF-8
Java
false
false
1,600
java
package com.sino.daily.code_2019_9_1; /** * create by 2020-05-07 20:03 * * @author caogu */ public class ThreadInterrupt { public static void main(String[] args) { testSystemMonitor();//测试系统监控器 } /** * 测试系统监控器 */ public static void testSystemMonitor() { SystemMonitor sm = new SystemMonitor(); sm.start(); try { //运行 10 秒后停止监控 Thread.sleep(10 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("监控任务启动 10 秒后,停止..."); sm.stop(); } } /** * 系统监控器 * * @author ConstXiong */ class SystemMonitor { private Thread t; private volatile boolean stop = false; /** * 启动一个线程监控系统 */ void start() { t = new Thread(() -> { while (!stop) {//判断当前线程是否被打断 System.out.println("正在监控系统..."); try { Thread.sleep(3 * 1000L);//执行 3 秒 System.out.println("任务执行 3 秒"); System.out.println("监控的系统正常!"); } catch (InterruptedException e) { System.out.println("任务执行被中断..."); Thread.currentThread().interrupt();//重新设置线程为中断状态 } } }); t.start(); } void stop() { stop = true; t.interrupt(); } }
e1cb7e4e6528067a69e86e8c4e805fe82deb1c53
483166b276e67228e636ea8fc7248be7bbc4c89f
/amall-api/src/main/java/online/kyralo/amall/api/bo/TbCommodityAttrBO.java
3f582859e79db00391313c2c6f88cb0b25d939bb
[]
no_license
kyralo/amall-server
a3893bcb5e9aa9115970944e8c2240c9b6629d4a
a96bfb9a7a6c4b2274f53ea3deb7c4495bf65a27
refs/heads/master
2023-01-09T02:55:50.155618
2020-11-10T03:38:48
2020-11-10T03:38:48
311,536,434
1
0
null
null
null
null
UTF-8
Java
false
false
941
java
package online.kyralo.amall.api.bo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.*; import online.kyralo.amall.common.base.domain.Base; import java.util.Date; /** * 销售属性表 (产品参数) */ @Builder @Setter @Getter @ToString @NoArgsConstructor @AllArgsConstructor public class TbCommodityAttrBO extends Base { /** * 销售属性ID */ private String id; /** * 销售属性名称 */ private String name; /** * 销售属性描述 */ private String attrDesc; /** * 状态 1:enable, 0:disable, -1:deleted */ private Integer status; /** * 创建时间 */ @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** * 更新时间 */ @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; }
25535d2f9b0f2bdb78023f62b99e236061ac63ef
e1d35887b6ea6c0c68b3db4e929fa6ca01acb2d6
/src/ex5/Ex5_param.java
d370e39918126451423d7cbf7a8023918f1b6d3b
[]
no_license
Leehanhyeong/0917
2442d2c58907601f5b1cea7c693b7f69b7740d96
9266650d699efdfefb0ccdaf3622218ccf26252f
refs/heads/master
2023-08-03T09:35:11.493205
2021-09-17T09:03:53
2021-09-17T09:03:53
407,471,901
0
0
null
null
null
null
UTF-8
Java
false
false
1,705
java
package ex5; import java.io.IOException; import javax.security.auth.message.callback.PrivateKeyCallback.Request; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Ex5_param */ @WebServlet("/Ex5") public class Ex5_param extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Ex5_param() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //요청 request.setCharacterEncoding("utf-8"); //파라미터 값들 가져오기 String[] name = request.getParameterValues("f_name"); for(String n : name) if(n != null && n.trim().length() > 0 && !n.isEmpty()) //n이 널이아니고 공백아아니고 0보다 작을때 //n이 비어있지 않을 때 System.out.println("친구들 :"+n); String loc = request.getParameter("loc"); System.out.println("사는곳 :"+loc); } /** * @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); } }
[ "dlgks@LAPTOP-OVI016IU" ]
dlgks@LAPTOP-OVI016IU
ada185be1815f009e901e33d053de27a9321013d
d553931f2ee126da22717fea37b083b8aa912ba3
/src/com/newbee/kristian/KOS/TableActivity.java
0e86234a5db2a025b9674b45dccacddcc3673a9c
[]
no_license
evandavid/kaleyoMobile
c13b27a3709f5f0e5b2f2b499d77ba272268c627
fdd204e6a57ff109db826341cb4a586c7e931029
refs/heads/master
2021-01-01T06:33:25.398158
2014-04-09T18:01:03
2014-04-09T18:01:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
21,866
java
package com.newbee.kristian.KOS; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; import com.google.gson.Gson; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.newbee.kristian.KOS.adapters.ActionbarSpinnerAdapter; import com.newbee.kristian.KOS.adapters.MejaAdapter; import com.newbee.kristian.KOS.models.ApiBroadcast; import com.newbee.kristian.KOS.models.ApiTables; import com.newbee.kristian.KOS.models.Broadcast; import com.newbee.kristian.KOS.models.Server; import com.newbee.kristian.KOS.models.StaffModel; import com.newbee.kristian.KOS.models.Table; import com.newbee.kristian.KOS.models.User; import com.newbee.kristian.KOS.models.UserModel; import android.os.Bundle; import android.os.Handler; import android.annotation.SuppressLint; import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.GridView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.LinearLayout.LayoutParams; import android.widget.PopupWindow.OnDismissListener; import android.widget.Toast; @SuppressLint("NewApi") public class TableActivity extends ParentActivity implements ActionBar.OnNavigationListener { // action bar public ActionBar actionBar; public List<Table> listTables, masterTables, tmpTables = new ArrayList<Table>(); public LinearLayout footerBox; public ArrayList<Button> btnArr; public PopupWindow pwindos; public boolean isActive; private static String[] TABLE_CONDITION = new String[] {"tables", "available_table", "busy_table"}; private ActionbarSpinnerAdapter adapter; private int tableCount; private SlidingMenu menu; private GridView gridView; private int firstRow, lastRow, count; private MejaAdapter tbAdapter; @SuppressWarnings("unused") private String[] data, tmpdata, master; private String table_list = TABLE_CONDITION[0]; private boolean synthetic = true; private int subtitle_pos, index_ = 0; private FrameLayout layout; private ApiBroadcast apiBroadcast; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_table); // set opacity of layout foreground this.layout = (FrameLayout) findViewById( R.id.framesplash); this.layout.getForeground().setAlpha( 0); String check = getIntent().getStringExtra("table"); if (check != null){ this.table_list = check; this.subtitle_pos = Integer.parseInt(getIntent().getStringExtra("pos")); }else{ this.table_list = "tables"; this.subtitle_pos = 0; } String first_ = getIntent().getStringExtra("firstrow"); if (first_ != null){ firstRow = Integer.parseInt(first_); lastRow = Integer.parseInt(getIntent().getStringExtra("lastrow")); index_ = Integer.parseInt(getIntent().getStringExtra("index")); }else{ firstRow = 1; lastRow = 20; index_ = 0; } actionbar_init(); table_init(); // if (!user.role.equals(User.OPERATOR)) init_slidemenu(); isActive = true; runnableBroacast.run(); } @Override protected void onResume(){ super.onResume(); isActive = true; } @Override public void onPause(){ super.onPause(); isActive = false; } @Override public void onStop(){ super.onStop(); isActive = false; } public void table_init(){ progress.setMessage("Get tables, please wait.."); progress.show(); // Get Tables new Thread(new Runnable() { public void run() { getTables(); } }).start(); } public void getTables(){ tmpTables = null; listTables = null; masterTables = null; try { Server server = Server.findById(Server.class, (long) 1); InputStream source = conn.doGetConnect(server.url()+this.table_list); Gson gson = new Gson(); Reader reader = new InputStreamReader(source); ApiTables response = gson.fromJson(reader, ApiTables.class); if (response.code.equals("OK")) { // set count this.tableCount = Integer.parseInt(response.resultCount); //init_button_footer(tableCount); this.masterTables = response.results; myHandler.post(updateSukses); }else myHandler.post(updateGagal); } catch (Exception e) { myHandler.post(updateGagal); } } private final Handler myHandler = new Handler(); final Runnable updateSukses = new Runnable() { public void run() { sukses(); } }; final Runnable updateGagal = new Runnable() { public void run() { gagal(); } }; public void gagal(){ progress.hide(); } public void sukses(){ progress.hide(); //dummy data gridView = (GridView) findViewById(R.id.gridView1); init_button_footer(tableCount); this.tmpTables = this.masterTables; this.listTables = new ArrayList<Table>(lastRow-firstRow+1); int x = 0; for (int j = 0; j < this.tmpTables.size(); j++) { if (((Integer.parseInt(this.tmpTables.get(j).tableName))>= firstRow) && ( ((Integer.parseInt(this.tmpTables.get(j).tableName)))<= lastRow)){ this.listTables.add(x, this.tmpTables.get(j)); x++; } } tbAdapter = new MejaAdapter(this, this.listTables, firstRow, lastRow, layout, progress); gridView.setAdapter(tbAdapter); } public void init_slidemenu(){ // configure the SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); menu.setShadowWidthRes(R.dimen.slidingmenu_shadow_width); menu.setShadowDrawable(R.drawable.sliding_shadow); menu.setBehindOffsetRes(R.dimen.slidingmenu_offset); menu.setFadeDegree(0.35f); menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); View view = View.inflate(this, R.layout.slidingmenu, null); Button broadcastBtn = (Button)view.findViewById(R.id.broadcast); Button soldoutBtn = (Button)view.findViewById(R.id.soldout); Button promoBtn = (Button)view.findViewById(R.id.promo); if (!user.role.equals(User.OPERATOR)){ broadcastBtn.setVisibility(View.VISIBLE); soldoutBtn.setVisibility(View.VISIBLE); promoBtn.setVisibility(View.VISIBLE); }else{ broadcastBtn.setVisibility(View.GONE); soldoutBtn.setVisibility(View.GONE); promoBtn.setVisibility(View.GONE); } menu.setMenu(view); } @SuppressWarnings("deprecation") public void BroadcastClicked(View view){ menu.toggle(); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View pWindow = inflater.inflate(R.layout.popup_void, null); DisplayMetrics metrics = this.getResources().getDisplayMetrics(); int width = metrics.widthPixels; pwindos = new PopupWindow(pWindow, (int)(width*0.8), ViewGroup.LayoutParams.WRAP_CONTENT, true); try { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } catch (Exception e) { pWindow.post(new Runnable() { public void run() { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } }); } Button btn_dismiss = (Button)pWindow.findViewById(R.id.button2); btn_dismiss.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); pwindos.setBackgroundDrawable(new BitmapDrawable()); pwindos.setOutsideTouchable(true); pwindos.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); this.layout.getForeground().setAlpha( 180); Button btn = (Button)pWindow.findViewById(R.id.button1); TextView tv = (TextView)pWindow.findViewById(R.id.textView1); final EditText et = (EditText)pWindow.findViewById(R.id.server); btn.setText("Save"); tv.setText("Broadcast Message"); et.setHint("broadcast message"); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!et.getText().toString().equals("")){ //set note progress.setMessage("Saving broadcast message"); progress.show(); new Thread(new Runnable() { public void run() { saveBroadcast(et.getText().toString()); } }).start(); }else{ Toast.makeText(getApplicationContext(), "Broadcast cannot blank.", Toast.LENGTH_SHORT).show(); } } }); } private void saveBroadcast(String text){ try { Server server = Server.findById(Server.class, (long) 1); List<String[]> data = new ArrayList<String[]>(); data.add(new String[]{"text", text}); data.add(new String[]{"created_by", user.userId}); InputStream source = conn.doPostConnect(server.url()+"broadcasts", data); if (source != null) myHandler.post(broadcastSuksesSave); else myHandler.post(broadcastGagalSave); } catch (Exception e) { myHandler.post(broadcastGagalSave); } } final Runnable broadcastSuksesSave = new Runnable() { public void run() { suksesBroadcast("broadcast"); } }; final Runnable broadcastGagalSave = new Runnable() { public void run() { gagalBroadcast("broadcast"); } }; private void gagalBroadcast(String txt){ try {progress.hide();} catch (Exception e) {} Toast.makeText(getApplicationContext(), "Failed to save "+txt+", please try again.", Toast.LENGTH_SHORT).show(); } private void suksesBroadcast(String txt){ try {progress.hide();} catch (Exception e) {} try {pwindos.dismiss();} catch (Exception e) {} Toast.makeText(getApplicationContext(), "Success to save "+txt+" message.", Toast.LENGTH_SHORT).show(); } @SuppressWarnings("deprecation") public void PromoCliked(View view){ menu.toggle(); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View pWindow = inflater.inflate(R.layout.popup_void, null); DisplayMetrics metrics = this.getResources().getDisplayMetrics(); int width = metrics.widthPixels; pwindos = new PopupWindow(pWindow, (int)(width*0.8), ViewGroup.LayoutParams.WRAP_CONTENT, true); try { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } catch (Exception e) { pWindow.post(new Runnable() { public void run() { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } }); } Button btn_dismiss = (Button)pWindow.findViewById(R.id.button2); btn_dismiss.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); pwindos.setBackgroundDrawable(new BitmapDrawable()); pwindos.setOutsideTouchable(true); pwindos.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); this.layout.getForeground().setAlpha( 180); Button btn = (Button)pWindow.findViewById(R.id.button1); TextView tv = (TextView)pWindow.findViewById(R.id.textView1); final EditText et = (EditText)pWindow.findViewById(R.id.server); btn.setText("Save"); tv.setText("Promo Message"); et.setHint("promo message"); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!et.getText().toString().equals("")){ //set note progress.setMessage("Saving promo message"); progress.show(); new Thread(new Runnable() { public void run() { savePromo(et.getText().toString()); } }).start(); }else{ Toast.makeText(getApplicationContext(), "Promo cannot blank.", Toast.LENGTH_SHORT).show(); } } }); } private void savePromo(String text){ try { Server server = Server.findById(Server.class, (long) 1); List<String[]> data = new ArrayList<String[]>(); data.add(new String[]{"text", text}); data.add(new String[]{"created_by", user.userId}); InputStream source = conn.doPostConnect(server.url()+"promos", data); if (source != null) myHandler.post(promoSuksesSave); else myHandler.post(promoGagalSave); } catch (Exception e) { myHandler.post(promoGagalSave); } } final Runnable promoSuksesSave = new Runnable() { public void run() { suksesBroadcast("promo"); } }; final Runnable promoGagalSave = new Runnable() { public void run() { gagalBroadcast("promo"); } }; public void SoldOutClicked(View view){ try { menu.toggle(); } catch (Exception e) {} Intent i = new Intent(TableActivity.this, SoldOutActivity.class); startActivity(i); } private Runnable runnableBroacast = new Runnable() { public void run() { if (isActive){ new Thread(new Runnable() { public void run() { checkBroadcast(); } }).start(); } myHandler.postDelayed(this, TimeUnit.MINUTES.toMillis(1)); } }; public void checkBroadcast(){ try { Server server = Server.findById(Server.class, (long) 1); InputStream source = conn.doGetConnect(server.url()+"broadcasts"); Gson gson = new Gson(); Reader reader = new InputStreamReader(source); ApiBroadcast response = gson.fromJson(reader, ApiBroadcast.class); if (response.code.equals("OK")) { apiBroadcast = response; myHandler.post(broadcastProcess); } } catch (Exception e) { } } final Runnable broadcastProcess = new Runnable() { public void run() { if (pwindos == null) showBroadcast(); else if (!pwindos.isShowing()) showBroadcast(); } }; @SuppressWarnings("deprecation") private void showBroadcast(){ if (!user.userId.equals(apiBroadcast.createdBy)){ List<Broadcast> broadcasts = Broadcast.find(Broadcast.class, "ids = ? AND user = ?", apiBroadcast.ids, user.userId); if (broadcasts.size() == 0){ Broadcast br = new Broadcast(this, apiBroadcast, user.userId); br.save(); LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View pWindow = inflater.inflate(R.layout.popup_broadcast, null); DisplayMetrics metrics = this.getResources().getDisplayMetrics(); final int width = metrics.widthPixels; pwindos = new PopupWindow(pWindow, (int)(width*0.8), ViewGroup.LayoutParams.WRAP_CONTENT, true); try { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } catch (Exception e) { pWindow.post(new Runnable() { public void run() { pwindos.showAtLocation(pWindow, Gravity.CENTER, 0, 0); } }); } pwindos.setBackgroundDrawable(new BitmapDrawable()); pwindos.setOutsideTouchable(true); pwindos.setOnDismissListener(new OnDismissListener() { @Override public void onDismiss() { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); this.layout.getForeground().setAlpha( 180); Button btn_dismiss = (Button)pWindow.findViewById(R.id.button2); btn_dismiss.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { layout.getForeground().setAlpha( 0); pwindos.dismiss(); } }); TextView tv = (TextView)pWindow.findViewById(R.id.textView1); tv.setText("Broadcast Message"); TextView brT = (TextView)pWindow.findViewById(R.id.broadcast); brT.setText(apiBroadcast.text); } } } public void init_button_footer(int tbl){ footerBox = (LinearLayout)findViewById(R.id.linearLayout1); btnArr = new ArrayList<Button>(); this.count = (int) Math.ceil(tbl/20.0); int front, back = 0; LinearLayout.LayoutParams ll = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); ll.weight = 1f; for (int i = 0; i < count; i++) { front = back == 0 ? 1 : back+1; back = (front + 19); Button bt = new Button(this); bt.setText(String.valueOf(front)+"-"+String.valueOf(back)); bt.setPadding(3, 0, 3, 0); bt.setId(i); bt.setLayoutParams(ll); if (i == index_) bt.setBackgroundResource(R.drawable.cab_background_top_kaleyostyle); else bt.setBackgroundColor(Color.parseColor("#f2f2f2")); bt.setTextSize(12); footerBox.addView(bt); btnArr.add(bt); bt.setOnClickListener(btn_listener); // add divider if (i != (count-1)) { LinearLayout div = new LinearLayout(this); LinearLayout.LayoutParams lll = new LinearLayout.LayoutParams(2, LayoutParams.MATCH_PARENT); div.setBackgroundColor(Color.GRAY); lll.setMargins(0, 7, 0, 7); div.setLayoutParams(lll); footerBox.addView(div); } } } private void actionbar_init(){ actionBar = getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); adapter = new ActionbarSpinnerAdapter(this, actionBar, subtitle_pos); actionBar.setListNavigationCallbacks(adapter, this); actionBar.setSelectedNavigationItem(0); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. if (!user.role.equals(User.OPERATOR)) getMenuInflater().inflate(R.menu.table, menu); else getMenuInflater().inflate(R.menu.table, menu); return true; } @Override public boolean onNavigationItemSelected(int arg0, long arg1) { // SET CHOOSEN TABLE if (synthetic) { synthetic = false; actionBar.setSelectedNavigationItem(0); }else{ progress.setMessage("Get tables, please wait.."); progress.show(); Intent i = new Intent(TableActivity.this, TableActivity.class); i.putExtra("table", TABLE_CONDITION[arg0-1]); i.putExtra("pos", String.valueOf(arg0-1)); i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); finish(); } return false; } private android.view.View.OnClickListener btn_listener = new View.OnClickListener() { @Override public void onClick(View v) { firstRow = (v.getId()*20) + 1; lastRow = (firstRow + 19); Intent i = new Intent(TableActivity.this, TableActivity.class); i.putExtra("firstrow", String.valueOf(firstRow)); i.putExtra("lastrow", String.valueOf(lastRow)); i.putExtra("index", String.valueOf(v.getId())); i.putExtra("table", table_list); i.putExtra("pos", String.valueOf(subtitle_pos)); i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); finish(); } }; @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.menu.toggle(); return true; case R.id.action_refresh: Intent i = new Intent(TableActivity.this, TableActivity.class); i.putExtra("firstrow", String.valueOf(firstRow)); i.putExtra("lastrow", String.valueOf(lastRow)); i.putExtra("index", String.valueOf(index_)); i.putExtra("table", table_list); i.putExtra("pos", String.valueOf(subtitle_pos)); i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); finish(); return true; default: return super.onOptionsItemSelected(item); } } @Override public void onBackPressed() { if (!user.role.equals(User.OPERATOR)){ if ( menu.isMenuShowing()) { menu.toggle(); } else { super.onBackPressed(); } }else super.onBackPressed(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (!user.role.equals(User.OPERATOR)){ if ( keyCode == KeyEvent.KEYCODE_MENU ) { this.menu.toggle(); return true; } return super.onKeyDown(keyCode, event); }else return super.onKeyDown(keyCode, event); } public void doLogout(View view){ progress.setMessage("Loging out.."); progress.show(); UserModel.deleteAll(UserModel.class); StaffModel.deleteAll(StaffModel.class); Intent i = new Intent(TableActivity.this, LoginActivity.class); startActivity(i); finish(); progress.hide(); } }
e67fb1bab5cf3bb527747a172cd45ca0d735c3f7
7260ee72436055abc084af8b7db9604545487a06
/andEngine/src/main/java/org/andengine/opengl/texture/atlas/bitmap/BitmapTextureAtlasTextureRegionFactory.java
f7018986cb486703d1fcc03a41ea2330e3cd421d
[]
no_license
arashakn/FruitLines
1162215086d523f32d0444d94d6b518685e69fd6
636f74d6142a7992d6ca6d691b6b8a922d49de64
refs/heads/master
2020-03-22T14:15:10.217548
2018-07-08T12:08:16
2018-07-08T12:08:16
140,164,324
0
0
null
null
null
null
UTF-8
Java
false
false
14,618
java
package org.andengine.opengl.texture.atlas.bitmap; import java.io.IOException; import org.andengine.opengl.texture.atlas.bitmap.source.AssetBitmapTextureAtlasSource; import org.andengine.opengl.texture.atlas.bitmap.source.IBitmapTextureAtlasSource; import org.andengine.opengl.texture.atlas.bitmap.source.ResourceBitmapTextureAtlasSource; import org.andengine.opengl.texture.atlas.buildable.BuildableTextureAtlasTextureRegionFactory; import org.andengine.opengl.texture.region.TextureRegion; import org.andengine.opengl.texture.region.TextureRegionFactory; import org.andengine.opengl.texture.region.TiledTextureRegion; import org.andengine.util.exception.AndEngineRuntimeException; import android.content.Context; import android.content.res.AssetManager; import android.content.res.Resources; /** * (c) 2010 Nicolas Gramlich * (c) 2011 Zynga Inc. * * @author Nicolas Gramlich * @since 18:15:14 - 09.03.2010 */ public class BitmapTextureAtlasTextureRegionFactory { // =========================================================== // Constants // =========================================================== // =========================================================== // Fields // =========================================================== private static String sAssetBasePath = ""; // =========================================================== // Constructors // =========================================================== // =========================================================== // Getter & Setter // =========================================================== /** * @param pAssetBasePath must end with '<code>/</code>' or have <code>.length() == 0</code>. */ public static void setAssetBasePath(final String pAssetBasePath) { if(pAssetBasePath.endsWith("/") || pAssetBasePath.length() == 0) { BitmapTextureAtlasTextureRegionFactory.sAssetBasePath = pAssetBasePath; } else { throw new IllegalArgumentException("pAssetBasePath must end with '/' or be lenght zero."); } } public static String getAssetBasePath() { return BitmapTextureAtlasTextureRegionFactory.sAssetBasePath; } public static void reset() { BitmapTextureAtlasTextureRegionFactory.setAssetBasePath(""); } // =========================================================== // Methods for/from SuperClass/Interfaces // =========================================================== // =========================================================== // Methods // =========================================================== // =========================================================== // Methods using BitmapTexture // =========================================================== public static TextureRegion createFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTextureX, final int pTextureY) { return BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTextureX, pTextureY); } public static TextureRegion createFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY); } public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTextureX, pTextureY, pTileColumns, pTileRows); } public static TiledTextureRegion createTiledFromAsset(final BitmapTextureAtlas pBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); } public static TextureRegion createFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTextureX, final int pTextureY) { return BitmapTextureAtlasTextureRegionFactory.createFromResource(pBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTextureX, pTextureY); } public static TextureRegion createFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY); } public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTextureX, pTextureY, pTileColumns, pTileRows); } public static TiledTextureRegion createTiledFromResource(final BitmapTextureAtlas pBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, bitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); } public static TextureRegion createFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY) { return TextureRegionFactory.createFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY); } public static TiledTextureRegion createTiledFromSource(final BitmapTextureAtlas pBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTextureX, final int pTextureY, final int pTileColumns, final int pTileRows) { return TextureRegionFactory.createTiledFromSource(pBitmapTextureAtlas, pBitmapTextureAtlasSource, pTextureX, pTextureY, pTileColumns, pTileRows); } // =========================================================== // Methods using BuildableTexture // =========================================================== public static TextureRegion createFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final String pAssetPath) { return BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pContext.getAssets(), pAssetPath); } public static TextureRegion createFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath) { return BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pAssetManager, pAssetPath, false); } public static TextureRegion createFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final String pAssetPath, final boolean pRotated) { return BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pRotated); } public static TextureRegion createFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final boolean pRotated) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pRotated); } public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final String pAssetPath, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(pBuildableBitmapTextureAtlas, pContext.getAssets(), pAssetPath, pTileColumns, pTileRows); } public static TiledTextureRegion createTiledFromAsset(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetPath, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = AssetBitmapTextureAtlasSource.create(pAssetManager, BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetPath); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); } public static TextureRegion createFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID) { return BitmapTextureAtlasTextureRegionFactory.createFromResource(pBuildableBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID); } public static TextureRegion createFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID) { return BitmapTextureAtlasTextureRegionFactory.createFromResource(pBuildableBitmapTextureAtlas, pResources, pDrawableResourceID, false); } public static TextureRegion createFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final boolean pRotated) { return BitmapTextureAtlasTextureRegionFactory.createFromResource(pBuildableBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pRotated); } public static TextureRegion createFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final boolean pRotated) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pRotated); } public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Context pContext, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { return BitmapTextureAtlasTextureRegionFactory.createTiledFromResource(pBuildableBitmapTextureAtlas, pContext.getResources(), pDrawableResourceID, pTileColumns, pTileRows); } public static TiledTextureRegion createTiledFromResource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final Resources pResources, final int pDrawableResourceID, final int pTileColumns, final int pTileRows) { final IBitmapTextureAtlasSource bitmapTextureAtlasSource = ResourceBitmapTextureAtlasSource.create(pResources, pDrawableResourceID); return BitmapTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, bitmapTextureAtlasSource, pTileColumns, pTileRows); } public static TextureRegion createFromSource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource) { return BitmapTextureAtlasTextureRegionFactory.createFromSource(pBuildableBitmapTextureAtlas, pBitmapTextureAtlasSource, false); } public static TextureRegion createFromSource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final boolean pRotated) { return BuildableTextureAtlasTextureRegionFactory.createFromSource(pBuildableBitmapTextureAtlas, pBitmapTextureAtlasSource, pRotated); } public static TiledTextureRegion createTiledFromSource(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final IBitmapTextureAtlasSource pBitmapTextureAtlasSource, final int pTileColumns, final int pTileRows) { return BuildableTextureAtlasTextureRegionFactory.createTiledFromSource(pBuildableBitmapTextureAtlas, pBitmapTextureAtlasSource, pTileColumns, pTileRows); } /** * Loads all files from a given assets directory (in alphabetical order) as consecutive tiles of an {@link TiledTextureRegion}. * * @param pBuildableBitmapTextureAtlas * @param pAssetManager * @param pAssetSubdirectory to load all files from "gfx/flowers" put "flowers" here (assuming, that you've used {@link BitmapTextureAtlasTextureRegionFactory#setAssetBasePath(String)} with "gfx/" before.) * @return */ public static TiledTextureRegion createTiledFromAssetDirectory(final BuildableBitmapTextureAtlas pBuildableBitmapTextureAtlas, final AssetManager pAssetManager, final String pAssetSubdirectory) { final String[] files; try { files = pAssetManager.list(BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory); } catch (final IOException e) { throw new AndEngineRuntimeException("Listing assets subdirectory: '" + BitmapTextureAtlasTextureRegionFactory.sAssetBasePath + pAssetSubdirectory + "' failed. Does it exist?", e); } final int fileCount = files.length; final TextureRegion[] textures = new TextureRegion[fileCount]; for (int i = 0; i < fileCount; i++) { final String assetPath = pAssetSubdirectory + "/" + files[i]; textures[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(pBuildableBitmapTextureAtlas, pAssetManager, assetPath); } return new TiledTextureRegion(pBuildableBitmapTextureAtlas, textures); } // =========================================================== // Inner and Anonymous Classes // =========================================================== }
2d930fdae16a3312be3fbd956406efb0009ad213
19b74a611ff16da8d61e96f1a77963a8a47b971a
/tree/easy/MinDepth.java
9b61ca867865462a0afc75d77b569a5238df0133
[]
no_license
pankajwithgit/leetcode
8ecab62bdccbb15db62bae2a9b7ac7d9b71f2483
90862b3243bf06a045004c559b1d006a3d19aa64
refs/heads/master
2021-06-22T07:20:08.255029
2021-03-02T23:51:21
2021-03-02T23:51:21
199,745,819
2
0
null
null
null
null
UTF-8
Java
false
false
454
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public int minDepth(TreeNode root) { if(root == null) return 0; int left = minDepth(root.left); int right = minDepth(root.right); return (left == 0 || right == 0) ? left + right + 1: Math.min(left,right) + 1; } }
b94740220bd8cb82aa0757d0a1dc1f4aebf31677
22db7f2ec7ad126d09081ef72e8e98da61ac756a
/Core/src/me/shawlaf/varlight/spigot/command/commands/VarLightCommandItem.java
3d392464a6b338958b1b180ddced52575a097e6f
[]
no_license
Beags/VarLight
831098c41bd2a3ead4adab0f9590bb153b49e3a1
5f06937e1d8d3ba2d0e519467f463c3cc4db00b6
refs/heads/master
2022-04-16T08:49:38.002976
2020-03-29T15:27:05
2020-03-29T15:27:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,373
java
package me.shawlaf.varlight.spigot.command.commands; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.builder.RequiredArgumentBuilder; import me.shawlaf.varlight.spigot.VarLightPlugin; import me.shawlaf.varlight.spigot.command.VarLightSubCommand; import me.shawlaf.varlight.spigot.nms.MaterialType; import org.bukkit.Material; import org.bukkit.command.CommandSender; import org.jetbrains.annotations.NotNull; import static me.shawlaf.command.result.CommandResult.failure; import static me.shawlaf.command.result.CommandResult.success; import static me.shawlaf.varlight.spigot.command.VarLightCommand.FAILURE; import static me.shawlaf.varlight.spigot.command.VarLightCommand.SUCCESS; import static me.shawlaf.varlight.spigot.command.commands.arguments.MinecraftTypeArgumentType.minecraftType; public class VarLightCommandItem extends VarLightSubCommand { public VarLightCommandItem(VarLightPlugin plugin) { super(plugin, "item"); } @Override public @NotNull String getDescription() { return "Updates the item required to use the plugin features"; } @Override public @NotNull String getRequiredPermission() { return "varlight.admin.item"; } @Override public @NotNull String getSyntax() { return " <type>"; } @Override public @NotNull LiteralArgumentBuilder<CommandSender> build(LiteralArgumentBuilder<CommandSender> node) { node.then( RequiredArgumentBuilder.<CommandSender, Material>argument("item", minecraftType(plugin, MaterialType.ITEM)) .executes(context -> { Material item = context.getArgument("item", Material.class); if (plugin.getNmsAdapter().isIllegalLightUpdateItem(item)) { failure(this, context.getSource(), String.format("%s cannot be used as the varlight update item", item.getKey().toString())); return FAILURE; } plugin.setUpdateItem(item); success(this, context.getSource(), String.format("Updated the Light update item to %s", item.getKey().toString())); return SUCCESS; }) ); return node; } }
dbc686bd1b8fb794e1edb864a6f2936ebf49431c
d66b506ad72e4c382362b125137e0fcac17b0b89
/app/src/androidTest/java/com/nicolas/multifunctiontextview/ExampleInstrumentedTest.java
db137592a86739701789c26fc24a266a48d3562d
[]
no_license
nicolasfei/MultiFunctionTextView
aa20020eca54ffbcb3c075dfb9364028ff3fc288
044a0abaf24130a2058b29fbc734a648eca2bc70
refs/heads/master
2022-10-25T02:42:24.385122
2020-06-11T12:11:20
2020-06-11T12:11:20
271,537,029
0
0
null
null
null
null
UTF-8
Java
false
false
782
java
package com.nicolas.multifunctiontextview; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.nicolas.multifunctiontextview", appContext.getPackageName()); } }
bcdc53ab5c9fa95df05e188a052a0411fbc9ac99
8f823fee7380f63e3be68749c54863f01e96c18d
/src/main/java/ch/chiodoni/app/web/security/ContentSecurityPolicyViolationStrategy.java
f77513ed0e0f461cd96da0496537edeea7338d9f
[]
no_license
yankedev/spring-mvc
764989ebd0e7b80a3cc10603344da971b70e5991
139af822608153e3272013beadd2ac7b640a8bd4
refs/heads/master
2021-01-23T18:21:41.214401
2013-01-30T09:31:49
2013-01-30T09:31:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package ch.chiodoni.app.web.security; import javax.servlet.http.HttpServletRequest; /** * Created with IntelliJ IDEA. * User: chiodonia * Date: 1/14/13 * Time: 8:55 PM * To change this template use File | Settings | File Templates. */ public interface ContentSecurityPolicyViolationStrategy { public void report(String type, HttpServletRequest request); }
ebf23e081844fd76b92c669082e6c5d27b76c00e
cf6d58a39e3ae4e6bcc7f2db00a73972266bc96e
/app/src/main/java/pl/ape_it/airplayandroid/jap2lib/FairPlayAudioDecryptor.java
e1508560d9d1752a7b52936a394ef3fdcc9b1fe7
[]
no_license
Apapus/AirPlayAndroid
c746c0825f402a6b2a0ec5062c97eb1065d24e93
c5d3dc173ee726c73ea79d01586f713cdd93a171
refs/heads/master
2023-01-11T00:05:32.064025
2020-11-06T20:14:51
2020-11-06T20:14:51
310,667,560
2
0
null
null
null
null
UTF-8
Java
false
false
1,126
java
package pl.ape_it.airplayandroid.jap2lib; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.security.MessageDigest; import java.util.Arrays; class FairPlayAudioDecryptor { private final byte[] aesIV; private final byte[] eaesKey; private final Cipher aesCbcDecrypt; FairPlayAudioDecryptor(byte[] aesKey, byte[] aesIV, byte[] sharedSecret) throws Exception { this.aesIV = aesIV; MessageDigest sha512Digest = MessageDigest.getInstance("SHA-512"); sha512Digest.update(aesKey); sha512Digest.update(sharedSecret); eaesKey = Arrays.copyOfRange(sha512Digest.digest(), 0, 16); aesCbcDecrypt = Cipher.getInstance("AES/CBC/NoPadding"); } void decrypt(byte[] audio, int audioLength) throws Exception { initAesCbcCipher(); aesCbcDecrypt.update(audio, 0, audioLength / 16 * 16, audio, 0); } private void initAesCbcCipher() throws Exception { aesCbcDecrypt.init(Cipher.DECRYPT_MODE, new SecretKeySpec(eaesKey, "AES"), new IvParameterSpec(aesIV)); } }
fa0f113b17b537be1212e4f1eb95a33b840e9459
99a94b9b1bfb6350a026f588574f7a3c3d567a43
/backend/src/main/java/com/devsuperior/movieflix/services/validation/UserInsertValidator.java
0945da341768848a40c18d6c76865921ff9d00d9
[]
no_license
Ma-shi22/movieflix
73251d3a0523f17b3a9e2c2dd97b93dd13435629
527ab75687749b902ee49f64d9afbae9fb376829
refs/heads/main
2023-04-29T13:01:46.039277
2021-04-09T12:45:03
2021-04-09T12:45:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,341
java
package com.devsuperior.movieflix.services.validation; import com.devsuperior.movieflix.dto.UserInsertDTO; import com.devsuperior.movieflix.entities.User; import com.devsuperior.movieflix.repositories.UserRepository; import com.devsuperior.movieflix.resources.exceptions.FieldMessage; import org.springframework.beans.factory.annotation.Autowired; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import java.util.ArrayList; import java.util.List; public class UserInsertValidator implements ConstraintValidator<UserInsertValid, UserInsertDTO> { @Autowired private UserRepository repository; @Override public void initialize(UserInsertValid ann) { } @Override public boolean isValid(UserInsertDTO dto, ConstraintValidatorContext context) { List<FieldMessage> list = new ArrayList<>(); User user = repository.findByEmail(dto.getEmail()); if(user != null) { list.add(new FieldMessage("email","Email Já existe!")); } for (FieldMessage e : list) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(e.getMessage()).addPropertyNode(e.getFieldName()) .addConstraintViolation(); } return list.isEmpty(); } }
c047ae3767119600a22ffe2a3432e95b0c7f2ee9
0ce9077cb06ba2dd2286d2767498892020545fab
/common/net/src/main/java/io/apiman/common/net/hawkular/errors/InvalidTypeParameterException.java
85c43586c23377c88c4d7e9812d1b244de988f59
[ "Apache-2.0" ]
permissive
zgdkik/apiman
2d4a5fa65c0a2e5020225e5afa24bee808a63168
86e3003c484798c87d679f6c45c05c6b2caf95bf
refs/heads/master
2021-01-25T13:05:28.370079
2017-11-27T21:48:04
2018-02-28T18:09:32
123,525,349
2
0
Apache-2.0
2018-03-02T03:27:36
2018-03-02T03:27:36
null
UTF-8
Java
false
false
930
java
/* * Copyright 2016 JBoss Inc * * 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 io.apiman.common.net.hawkular.errors; /** * @author [email protected] */ public class InvalidTypeParameterException extends HawkularMetricsException { private static final long serialVersionUID = 9102966234315825287L; /** * Constructor. */ public InvalidTypeParameterException() { } }
db356b6a03b0f80aaa143d50df9535318f1d9a5a
06805c72d9c96f5fbe5ebb80610c236100b48b75
/Mage.Sets/src/mage/sets/magic2014/GroundshakerSliver.java
0739f04a0279e9a11ca7f2529a3406a0adb8f7c1
[]
no_license
kodemage/mage
0e716f6068e8cf574b0acd934616983f7700c791
1fcd26fc60b55597d0d20658308b7128e10806af
refs/heads/master
2020-12-03T06:43:01.791506
2016-04-25T22:59:03
2016-04-25T22:59:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,111
java
/* * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of BetaSteward_at_googlemail.com. */ package mage.sets.magic2014; import java.util.UUID; import mage.MageInt; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; import mage.abilities.keyword.FirstStrikeAbility; import mage.abilities.keyword.TrampleAbility; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.SubtypePredicate; /** * * @author LevelX2 */ public class GroundshakerSliver extends CardImpl { public GroundshakerSliver(UUID ownerId) { super(ownerId, 177, "Groundshaker Sliver", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{6}{G}"); this.expansionSetCode = "M14"; this.subtype.add("Sliver"); this.power = new MageInt(5); this.toughness = new MageInt(5); // Sliver creatures you control have trample. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver","Sliver creatures")))); } public GroundshakerSliver(final GroundshakerSliver card) { super(card); } @Override public GroundshakerSliver copy() { return new GroundshakerSliver(this); } }
dea23e2ca87e3849850262f9853d3377e77babbe
33103daaf5baf08ebff508eb2e12565931e3bcdf
/java/sample/javaee7/src/main/java/org/coder/gear/sample/javaee7/application/OrderOperationService.java
ad30772fc221bb49016b33e7f318090773219189
[]
no_license
nysd-backup/backup
be8052e826ce263f1f70ac3e5fe4050684aab2f2
f94b52555fdb0d1e2e62ea972b259e6fa7f15770
refs/heads/master
2020-04-09T12:45:32.496982
2014-06-11T14:01:07
2014-06-11T14:01:07
2,390,262
0
0
null
null
null
null
UTF-8
Java
false
false
3,157
java
/** * Copyright 2011 the original author */ package org.coder.gear.sample.javaee7.application; import java.util.logging.Logger; import javax.ejb.Stateless; import javax.inject.Inject; import javax.jws.WebService; import org.coder.gear.sample.javaee7.domain.entity.Order; import org.coder.gear.sample.javaee7.domain.entity.OrderDetail; import org.coder.gear.sample.javaee7.domain.entity.OrderDetailPK; import org.coder.gear.sample.javaee7.domain.entity.Stock; import org.coder.gear.sample.javaee7.factory.OrderFactory; import org.coder.gear.sample.javaee7.factory.StockFactory; import org.coder.gear.sample.javaee7.infra.repository.OrderRepository; import org.coder.gear.sample.javaee7.infra.repository.StockRepository; import org.coder.gear.trace.Traceable; /** * OrderOperationService. * * アプリケーション層 外部のドメインを呼び出す場合には相手先はInterfaceの方が疎結合になる。 * * @author yoshida-n * @version created. */ @WebService @Traceable @Stateless //SessionBeanでなくてもCMTに対応してほしい public class OrderOperationService { //'@InjectするとOrderOperationServiceと同じライフサイクルになる。 @Inject private OrderFactory orderFactory; @Inject private StockFactory stockFactory; /** * interface宣言しているが実際DataAccess方法が変わることはないのでアプリケーション層にDIするなら実体でもよいと思う。 * インターセプターはさめないわけでもないし。 */ @Inject private OrderRepository orderRepository; @Inject private StockRepository stockRepository; /** * @param order ここではEntityをDTOにしている */ @SuppressWarnings("deprecation") public void order(Order dto){ Order domainObject = orderFactory.createFrom(dto); // //在庫引き当て // for(OrderDetail e : domainObject.orderDetails){ // Stock stock = stockRepository.find(e.itemNo); // if(stock.canReserve(e.count)){ // stock.reserve(e.count); // }else { // Message msg = new Message(); // msg.setMessage("error :" + e.itemNo); // MessageContext.getCurrentInstance().addMessage(msg); // } // } //単一のEntityに閉じないような処理(バリデーションとか複数Entity間での計算)は、消極的に別途Serviceに切り出すことも可能。 //注文 orderRepository.persist(domainObject); //検索して出力 Order order = orderRepository.find(dto.no); Logger logger = java.util.logging.Logger.getLogger("TEST"); logger.info(order.toString()); //明細だけ検索してみる OrderDetailPK pk = new OrderDetailPK(); pk.order = dto.no; pk.detailNo = 1L; logger.info(orderRepository.findChild(pk).toString()); } /** * @param orderNo */ public void cancel(Long orderNo, Long version){ //検索 Order order = orderRepository.find(orderNo); //引き当て戻す for(OrderDetail e : order.orderDetails){ Stock stock = stockRepository.find(e.itemNo); stock.cancel(e.count); } //キャンセル order.version = version; orderRepository.remove(order); } }
39f052f3d210784549a110bb413ba5e3f655c52f
1599a947142ae03d918dd1feff6a4d803167ad14
/service/service_edu/src/main/java/com/atguigu/eduservice/entity/vo/CourseFrontInfo.java
4d5a22242a821d459a61423ff4c9304958d00922
[]
no_license
Ruihuihui/guli_parent
b20b746a669b4c884728e9cc1600b03f007a45c8
ce6faaa24264f5bdebfe04ab291a77e9e545163d
refs/heads/master
2022-07-15T14:44:47.632965
2020-04-08T12:55:45
2020-04-08T12:55:45
254,088,488
0
0
null
2022-06-17T03:06:11
2020-04-08T12:59:15
Java
UTF-8
Java
false
false
1,441
java
package com.atguigu.eduservice.entity.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data public class CourseFrontInfo { private String id; @ApiModelProperty(value = "课程标题") private String title; @ApiModelProperty(value = "课程销售价格,设置为0则可免费观看") private BigDecimal price; @ApiModelProperty(value = "总课时") private Integer lessonNum; @ApiModelProperty(value = "课程封面图片路径") private String cover; @ApiModelProperty(value = "销售数量") private Long buyCount; @ApiModelProperty(value = "浏览数量") private Long viewCount; @ApiModelProperty(value = "课程简介") private String description; @ApiModelProperty(value = "讲师ID") private String teacherId; @ApiModelProperty(value = "讲师姓名") private String teacherName; @ApiModelProperty(value = "讲师资历,一句话说明讲师") private String intro; @ApiModelProperty(value = "讲师头像") private String avatar; @ApiModelProperty(value = "课程类别ID") private String subjectLevelOneId; @ApiModelProperty(value = "类别名称") private String subjectLevelOne; @ApiModelProperty(value = "课程类别ID") private String subjectLevelTwoId; @ApiModelProperty(value = "类别名称") private String subjectLevelTwo; }
68fb9f135a4fa2568f37081e9a5e540daad0177e
c66bc7effc3301233d754ac8ddcae3e1450068f3
/src/main/java/com/chacko/ben/jpatest/JPAUserData.java
0e95cea625cb06176704ae13374e31bc5d026784
[]
no_license
benchacko/springboot
3112aa193d2ad9cb45418433072b8a2fcd268d2c
6b5157b9c5c685b564a94972c23ea3db68218803
refs/heads/master
2020-03-19T07:09:56.300850
2018-06-08T19:45:54
2018-06-08T19:45:54
136,091,869
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package com.chacko.ben.jpatest; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; import lombok.Data; @Entity @Data @Table(name = "JPA_USER") public class JPAUserData { @Id @GeneratedValue() private Long id; @OneToOne // @JoinColumn(name = "VEHICLE_ID") private JPAVehicleData vehicle; @Column(name = "USER_NAME", length = 25, nullable = false) private String userName; public JPAUserData() { } public JPAUserData(String id, String userName, JPAVehicleData vehicle) { this.userName = userName; this.vehicle = vehicle; } public JPAUser toModel() { return new JPAUser(userName, vehicle.toModel()); } }
e7998eff7f1dca530405d10e7f7325ba576886ef
028f6a93a64da3a7af6412767378320864041d2e
/BagTest.java
2cf26263ada2e15814bffa978c39e123b1f802af
[]
no_license
smdavidson713/ADTBag
a16c8683a0912dc3e6e03cf6116d308b3729bb7c
8702444cd700295f22b1e332e8cded3c13e1d3aa
refs/heads/master
2020-07-12T07:30:42.881310
2019-08-27T17:27:40
2019-08-27T17:27:40
204,754,668
0
0
null
null
null
null
UTF-8
Java
false
false
1,737
java
/** Sydney Davidson Project 1 CSI 213 */ import java.io.*; // This tests the Bag class public class BagTest{ public static void start() throws IOException{ Bag bag = new Bag(); FileReader fr = new FileReader("list.txt"); BufferedReader br = new BufferedReader(fr); String line; while((line = br.readLine()) != null){ bag.insert(line); } System.out.println("Here's your list: "); bag.print(); System.out.println("-------------------"); System.out.println("Is the bag full?"); System.out.println(bag.isFull()); bag.removeLast(); System.out.println("-------------------"); System.out.println("Let's remove the last item in the list: "); bag.print(); bag.removeRandom(); System.out.println("-------------------"); System.out.println("Let's remove a random item in the list: "); bag.print(); System.out.println("-------------------"); System.out.println("Let's get a random item in the list: "); System.out.println(bag.get("Coffee")); System.out.println("-------------------"); System.out.println("Let's get an item from some index in the list: "); System.out.println(bag.get(2)); System.out.println("-------------------"); System.out.println("Is the bag full?"); System.out.println(bag.isFull()); System.out.println("-------------------"); System.out.println("Here's the size of the list: "); System.out.println(bag.size() + " items"); System.out.println("-------------------"); System.out.println("Now let's empty the bag."); bag.makeEmpty(); bag.print(); System.out.println("-------------------"); System.out.println("Is the bag empty?"); System.out.println(bag.isEmpty()); } }
6017722e9419648cbe60412d3e9def5b889126fd
2af43414438039ad788fb023219f7c51d773056a
/app/src/main/java/com/example/friends/HomeActivity.java
05871577022d111b778a60d9a4e191081a01ccb9
[]
no_license
ArmanKapoor7/Friends
20bf5e703deb41899825c0d7292ee5a51bf3049e
178f0b6ce3e9634c4e9a3d143590611e8d5d80e6
refs/heads/master
2023-05-02T08:29:39.220324
2021-05-24T08:15:20
2021-05-24T08:15:20
370,277,462
0
0
null
null
null
null
UTF-8
Java
false
false
5,611
java
package com.example.friends; import androidx.annotation.RequiresApi; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.cardview.widget.CardView; import androidx.viewpager.widget.ViewPager; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.os.Build; import android.os.Bundle; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.Toast; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; public class HomeActivity extends AppCompatActivity implements View.OnClickListener { public static int season; CardView cardview, cardview2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); ArrayList<Integer> position = new ArrayList<>(); ArrayList<Integer> covers = new ArrayList<>(); covers.add(R.drawable.friends_season_1_bluray); covers.add(R.drawable.friends_season_2_bluray); covers.add(R.drawable.friends_season_3_bluray); covers.add(R.drawable.friends_season_4_bluray); covers.add(R.drawable.friends_season_5_bluray); covers.add(R.drawable.friends_season_6_bluray); covers.add(R.drawable.friends_season_7_bluray); covers.add(R.drawable.friends_season_8_bluray); covers.add(R.drawable.friends_season_9_bluray); covers.add(R.drawable.friends_season_10_bluray); int j=0; ScrollView scrollView = findViewById(R.id.scrollview); LinearLayout vertical_linearLayout = findViewById(R.id.verticalll); for(int i=0;i<5;i++) { cardview = new CardView(this); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT ); params.setMargins(dpToPx(20), dpToPx(20), dpToPx(20), dpToPx(20)); cardview.setId(j); cardview.setOnClickListener(this); cardview.setLayoutParams(params); cardview.setRadius(dpToPx(8)); cardview.setCardElevation(dpToPx(6)); LinearLayout linearLayout1 = new LinearLayout(this); linearLayout1.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(120),dpToPx(170))); linearLayout1.setOrientation(LinearLayout.VERTICAL); linearLayout1.setBackground(getDrawable(covers.get(j))); j++; cardview.addView(linearLayout1); cardview2 = new CardView(this); cardview2.setLayoutParams(params); cardview2.setId(j); cardview2.setOnClickListener(this); cardview2.setRadius(dpToPx(8)); cardview2.setCardElevation(dpToPx(6)); LinearLayout linearLayoutl = new LinearLayout(this); linearLayoutl.setLayoutParams(new LinearLayout.LayoutParams(dpToPx(120),dpToPx(170))); linearLayoutl.setOrientation(LinearLayout.VERTICAL); linearLayoutl.setBackground(getDrawable(covers.get(j))); j++; cardview2.addView(linearLayoutl); LinearLayout linearLayout2 = new LinearLayout(this); linearLayout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT)); linearLayout2.setOrientation(LinearLayout.HORIZONTAL); linearLayout2.setPadding(dpToPx(10),dpToPx(10),dpToPx(10),dpToPx(10)); linearLayout2.setGravity(Gravity.CENTER); linearLayout2.addView(cardview); linearLayout2.addView(cardview2); vertical_linearLayout.addView(linearLayout2); } } public int dpToPx(int dp) { float density = getResources() .getDisplayMetrics() .density; return Math.round((float) dp * density); } @Override public void onClick(View v) { Intent intent = new Intent(HomeActivity.this, details.class); switch (v.getId()) { case 0: season = 1; startActivity(intent); break; case 2: season = 3; startActivity(intent); break; case 4: season = 5; startActivity(intent); break; case 6: season = 7; startActivity(intent); break; case 8: season = 9; startActivity(intent); break; case 1: season = 2; startActivity(intent); break; case 3: season = 4; startActivity(intent); break; case 5: season = 6; startActivity(intent); break; case 7: season = 8; startActivity(intent); break; case 9: season = 10; startActivity(intent); break; } } }
f498d680a7966df9420411ba2964d7c89611334f
26dab780ccb321aa46712153c28f6e45347076f7
/swagger/src/main/java/br/com/arqdev/swagger/parameter/ResolvedMethodParameter.java
f21ac4098a34b6889b27c6e9aba8a3b4ed7c1648
[]
no_license
mcqueide/java-11-project
d7e889f6c76d892f88bbb3b4d9c9270af50ff698
ad0085ee4073a81d7d3a19488b34b989b7145fe4
refs/heads/master
2021-06-18T10:15:09.713146
2019-07-18T21:37:25
2019-07-18T21:37:25
194,410,674
1
0
null
2021-03-31T21:27:36
2019-06-29T13:50:12
Java
UTF-8
Java
false
false
2,446
java
package br.com.arqdev.swagger.parameter; import com.fasterxml.classmate.ResolvedType; import com.google.common.base.Optional; import com.google.common.collect.FluentIterable; import com.google.common.collect.Lists; import org.springframework.core.MethodParameter; import java.lang.annotation.Annotation; import java.util.List; public class ResolvedMethodParameter { private final int parameterIndex; private final List<Annotation> annotations; private final String defaultName; private final ResolvedType parameterType; public ResolvedMethodParameter(String paramName, MethodParameter methodParameter, ResolvedType parameterType) { this(methodParameter.getParameterIndex(), paramName, Lists.newArrayList(methodParameter.getParameterAnnotations()), parameterType); } public ResolvedMethodParameter(int parameterIndex, String defaultName, List<Annotation> annotations, ResolvedType parameterType) { this.parameterIndex = parameterIndex; this.defaultName = defaultName; this.parameterType = parameterType; this.annotations = annotations; } public ResolvedType getParameterType() { return this.parameterType; } public boolean hasParameterAnnotations() { return !this.annotations.isEmpty(); } public boolean hasParameterAnnotation(Class<? extends Annotation> annotation) { return FluentIterable.from(this.annotations).filter(annotation).size() > 0; } public <T extends Annotation> Optional<T> findAnnotation(Class<T> annotation) { return FluentIterable.from(this.annotations).filter(annotation).first(); } public int getParameterIndex() { return this.parameterIndex; } public Optional<String> defaultName() { return Optional.fromNullable(this.defaultName); } public ResolvedMethodParameter replaceResolvedParameterType(ResolvedType parameterType) { return new ResolvedMethodParameter(this.parameterIndex, this.defaultName, this.annotations, parameterType); } public List<Annotation> getAnnotations() { return this.annotations; } public ResolvedMethodParameter annotate(Annotation annotation) { List<Annotation> annotations = Lists.newArrayList(this.annotations); annotations.add(annotation); return new ResolvedMethodParameter(this.parameterIndex, this.defaultName, annotations, this.parameterType); } }
58097fad272e027f500b787b60e085977d4593c4
ce9d58f98e8e7d7686d52c2b9dbe139bd9eae9aa
/rm-service/src/main/java/com/han/rm/bus/DefaultBusExecutor.java
9d39374b126764f156e5e67da83abeb95033b425
[]
no_license
sanfengzhang/rm-service
681c6fde899c8966d356494128f06e400bc4d0b9
e83e49b30b7b99f98c1222f68c15f4d08bffca71
refs/heads/master
2020-03-08T09:10:59.846666
2018-04-04T09:46:28
2018-04-04T09:46:28
128,040,406
0
0
null
null
null
null
UTF-8
Java
false
false
1,784
java
package com.han.rm.bus; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingDeque; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.stereotype.Service; import com.han.rm.bus.service.BusHandler; import com.han.rm.util.EscafThreadFactory; @Service public class DefaultBusExecutor implements BusExecutor, InitializingBean, DisposableBean { private BlockingQueue<RmMessage> queue = null; private ExecutorService executorService = null; public DefaultBusExecutor() { queue = new LinkedBlockingDeque<RmMessage>(50000); executorService = Executors.newSingleThreadExecutor(new EscafThreadFactory("default exexutor")); } public DefaultBusExecutor(BlockingQueue<RmMessage> queue, EscafThreadFactory escafThreadFactory) { this.queue = queue; executorService = Executors.newSingleThreadExecutor(escafThreadFactory); } public void submit(RmMessage message) { queue.offer(message); } private final class ExecuteRunnable implements Runnable { public void run() { while (true) { RmMessage message = null; try { message = queue.take(); } catch (InterruptedException e) { e.printStackTrace(); } BusHandler handler = message.getHandler(); if (null == handler) { throw new NullPointerException("faile to get handler"); } handler.handle(message); } } } public void destroy() throws Exception { if (null != executorService) { executorService.shutdown(); } } public void afterPropertiesSet() throws Exception { executorService.submit(new ExecuteRunnable()); } }
699cb418c6d311ebd460ac54059d720fe4ad8061
8ec39fde916306478190f9c9a06cb6962a2bab1a
/Rajithasrc/src/Arrays/src/com/js/Emp2.java
2638095a319a26eb358cf8aca1aea6f0ab43db15
[]
no_license
priyanka079/JavaBasics
1ec3c9302f6d764821964bc4292cfdce7033124a
9d5801ac04528c2c613dccf2e5a01d1e2a182bc7
refs/heads/main
2023-06-17T01:22:46.622915
2021-06-29T23:22:54
2021-06-29T23:22:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.js; public class Emp2 { int eno; String ename; Address addr; public Emp2(int eno, String ename, Address addr) { this.eno = eno; this.ename = ename; this.addr = addr; } public int getEno() { return eno; } public void setEno(int eno) { this.eno = eno; } public String getEname() { return ename; } public void setEname(String ename) { this.ename = ename; } public Address getAddr() { return addr; } public void setAddr(Address addr) { this.addr = addr; } public static void main(String[] args) { // TODO Auto-generated method stub } }
fa36843c6277650cb30c8f268ed9450cc415cbb0
7ded6f38db744877872a63b645ce043dbe21b05d
/whp-migration/src/main/java/org/motechproject/whp/migration/v0/domain/GenderV0.java
cb2bbfcbf2349fe46f283af83c0cb4269337c5c1
[]
no_license
maduhu/motech-whp
420fa914001abb88f2ec08ff6ddbbcb5b7cf5b36
75336e9710cfcc84c5156958b40da3f717866f8a
refs/heads/master
2021-01-18T05:36:26.653159
2014-11-21T10:41:00
2014-11-21T10:41:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package org.motechproject.whp.migration.v0.domain; public enum GenderV0 { M("Male"), F("Female"), O("Other"); private String value; GenderV0(String value) { this.value = value; } @Override public String toString() { return value; } }
2a762b82e72e6e4cc5f453aadc2744609263d6c6
8303fc564378230e8c4eaf090bcf43608e75dfb6
/app/src/main/java/com/bcm/sjs/rzxt/TabFragmentAdapter.java
28c17262f8a257f851876e14c4e2bcb1075732a2
[]
no_license
Grandaunt/RZXT
ef3e28e814d4bd68483278ed617409f6732183f2
9fb7a3bf46a6385de42320b630fda25d3276d794
refs/heads/master
2020-04-06T04:14:13.590545
2017-04-12T02:03:33
2017-04-12T02:03:33
83,024,433
0
0
null
null
null
null
UTF-8
Java
false
false
1,147
java
package com.bcm.sjs.rzxt; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import java.util.List; /** * Created by janiszhang on 2016/6/10. */ //继承FragmentStatePagerAdapter public class TabFragmentAdapter extends FragmentStatePagerAdapter { private String TAG = this.getClass().getSimpleName(); public static final String TAB_TAG = "@dream@"; private List<String> mTitles; public TabFragmentAdapter(FragmentManager fm, List<String> titles) { super(fm); mTitles = titles; } @Override public android.support.v4.app.Fragment getItem(int position) { //初始化Fragment数据 ContentFragment fragment = new ContentFragment(); String[] title = mTitles.get(position).split(TAB_TAG); fragment.setType(Integer.parseInt(title[1])); fragment.setTitle(title[0]); return fragment; } @Override public int getCount() { return mTitles.size(); } @Override public CharSequence getPageTitle(int position) { return mTitles.get(position).split(TAB_TAG)[0]; } }
fddae0462c88ad722e32cc2529cd721084e88b7b
5bb09e01494eb9708716ff125f325277aafefed8
/sabot/kernel/src/main/java/com/dremio/exec/store/dfs/PrefetchingIterator.java
245f3a85076aeb0921320129fbb83b073edd1470
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
scc-digitalhub/dremio-oss
968b373bf12976ad75fae47978a7dd4daeb1ae16
d41cb52143b6b0289fc8ed4d970bfcf410a669e8
refs/heads/master
2022-11-12T09:22:56.667116
2022-06-22T22:41:01
2022-06-22T22:41:01
187,240,816
1
3
Apache-2.0
2020-04-26T07:30:31
2019-05-17T15:31:00
Java
UTF-8
Java
false
false
3,452
java
/* * Copyright (C) 2017-2019 Dremio Corporation * * 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.dremio.exec.store.dfs; import java.util.List; import org.apache.arrow.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.dremio.common.AutoCloseables; import com.dremio.exec.store.RecordReader; import com.dremio.exec.store.RuntimeFilter; import com.dremio.exec.store.SplitAndPartitionInfo; import com.dremio.exec.store.parquet.InputStreamProvider; import com.dremio.exec.store.parquet.MutableParquetMetadata; import com.dremio.exec.store.parquet.RecordReaderIterator; import com.dremio.exec.store.parquet.SplitReaderCreatorIterator; import com.dremio.sabot.exec.store.parquet.proto.ParquetProtobuf; /** * A split, separates initialization of the input reader from actually constructing the reader to allow prefetching. */ public class PrefetchingIterator implements RecordReaderIterator { private static final Logger logger = LoggerFactory.getLogger(PrefetchingIterator.class); private final SplitReaderCreatorIterator creators; private InputStreamProvider inputStreamProvider; private MutableParquetMetadata footer; private SplitReaderCreator current; public PrefetchingIterator(SplitReaderCreatorIterator creatorIterator) { this.creators = creatorIterator; } @Override public boolean hasNext() { return creators.hasNext(); } @Override public RecordReader next() { try { Preconditions.checkArgument(hasNext()); if (current != null) { current.clearLocalFields(); } current = creators.next(); current.createInputStreamProvider(inputStreamProvider, footer); this.inputStreamProvider = current.getInputStreamProvider(); this.footer = current.getFooter(); return current.createRecordReader(this.footer); } catch (Exception ex) { if (current != null) { try { AutoCloseables.close(current); } catch (Exception ignoredEx) { // ignore the exception due to close of current record reader // since we are going to throw the source exception anyway } } throw ex; } } @Override public ParquetProtobuf.ParquetDatasetSplitScanXAttr getCurrentSplitXAttr() { return current.getSplitXAttr(); } @Override public SplitAndPartitionInfo getCurrentSplitAndPartitionInfo() { return current.getSplit(); } @Override public void addRuntimeFilter(RuntimeFilter runtimeFilter) { creators.addRuntimeFilter(runtimeFilter); } @Override public List<RuntimeFilter> getRuntimeFilters() { return creators.getRuntimeFilters(); } @Override public void produceFromBuffered(boolean toProduce) { creators.produceFromBufferedSplits(toProduce); } @Override public void close() throws Exception { // this is for cleanup if we prematurely exit. AutoCloseables.close(creators); } }
1504bf668e46d686c8822ab05a77db4cc52a3216
8d399e7b412de884ae1bd505e745e4a4f0e7b478
/entity-manager-test/src/test/java/jpa/lifecycle/EmployeeTest.java
b33dc5cf3a373b291499be210c664e1d6576be7f
[]
no_license
tranminhan/entity-manager-test
a42710c4faf7300201e2eba29e91956200a8edf4
60156b8772f815d8be7c42a3c2f754b3f012e081
refs/heads/master
2020-05-28T14:12:22.977674
2015-01-18T16:26:31
2015-01-18T16:26:31
20,799,208
0
0
null
null
null
null
UTF-8
Java
false
false
718
java
package jpa.lifecycle; import static org.junit.Assert.*; import javax.ejb.EJB; import jpa.em.app.ContainerAndPersistentTest; import jpa.em.app.Employee; import jpa.em.app.EmployeeService; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.junit.Before; import org.junit.Test; public class EmployeeTest extends ContainerAndPersistentTest { @Before public void setup() { super.setup(); } @EJB EmployeeService employeeService; @Test public void shouldCreateEmployee() { Employee employee = employeeService.newEmployee("Peter"); assertNotNull(employee); System.out.println(ReflectionToStringBuilder.toString(employee)); } }
a5446ac0bcc18b2375261087419efd20234b76e8
85105d57519023a2ca277db1388706b86109c2dd
/prev_workspace/Done/NotifyApp/src/com/jon/mypoll/Clases/Option2.java
fb9bc2bf5349757e702ee6e1f42cbe2639186dad
[]
no_license
ibJony/Mobile-Web_workspace
dc9c78a8e5d2152e961d6196f1dcb759558cce6c
8b9ad3e1bb8e49c769b537a2ab72891fed58e1ef
refs/heads/master
2023-03-23T01:34:46.543604
2021-03-13T11:31:21
2021-03-13T11:31:21
347,066,379
0
0
null
2021-03-13T11:14:36
2021-03-12T12:55:38
HTML
UTF-8
Java
false
false
6,362
java
package com.jon.mypoll.Clases; import com.jon.mypoll.Category; import com.jon.mypoll.R; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.RadioGroup; import android.widget.Toast; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.Spinner; import android.widget.TextView; public class Option2 extends Activity{ JSONParser jsonParser = new JSONParser(); final Context context = this; private Button btnsubmit; private Button btnstats; private TextView txtcomment; private TextView txtby; String txtpollcode; ProgressDialog pDialog; //JSONArray polls = null; private TextView txtPollCode; private Spinner spinnerPollCode; SharedPreferences sp; ArrayAdapter<String> spinnerAdapter; private String URL_POLLCODE = "http://www.masterclass.co.ke/projects/mypoll/pollresult.php"; ArrayList<Category> pollcodeList = new ArrayList<Category>(); // JSON Node names public static final String TAG_SUCCESS = "success"; public static final String TAG_POLLS = "pollstats"; RadioGroup options; HashMap<String, String> map ; ArrayList<HashMap<String, String>> pollitemsList; TextView pollQn; String value,txtyes,txtno; int txtid,txtcode,id,code; // Url to create new update private String URL_NEW_UPDATE = "http://www.masterclass.co.ke/projects/mypoll/pollresult.php"; Editor se; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.option2); sp = this.getSharedPreferences("desc", 0); sp = this.getSharedPreferences("id", 0); sp = this.getSharedPreferences("codep", 0); sp = this.getSharedPreferences("ladcod", 0); String theQn = sp.getString("desc", null); id = sp.getInt("id",0 ); code = sp.getInt("codep", 0); btnsubmit = (Button)findViewById(R.id.btnpollsubmit); btnstats = (Button)findViewById(R.id.btnStats2); txtcomment = (TextView)findViewById(R.id.txtcomment); txtby = (TextView)findViewById(R.id.txtby); pollQn = (TextView)findViewById(R.id.pollQn2); pollQn.setText(theQn); txtyes = "0"; txtno = "1"; final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( context); options = (RadioGroup) findViewById(R.id.option1); options.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.radio0: value = txtyes; break; case R.id.radio1: value = txtno; break; } } }); btnsubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (value==txtyes||value==txtno && txtcomment.getText().toString().trim().length() > 0 && txtby.getText().toString().trim().length() > 0) { new CreateNewProduct().execute(); }else { Toast.makeText(getApplicationContext(), "Fill all required fields" ,Toast.LENGTH_LONG).show(); } } }); btnstats.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getApplicationContext(),Pollcomments.class); startActivity(i); } }); } /** * Background Async Task to Create new product * */ class CreateNewProduct extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(Option2.this); pDialog.setMessage("Submitting Polls.."); pDialog.setCancelable(true); pDialog.show(); } /** * Creating product * */ @Override protected String doInBackground(String... args) { String idvalue = String.valueOf(id); String codevalue = String.valueOf(code); String pollresponse = value; String pollcomment = txtcomment.getText().toString(); String pollby2 = txtby.getText().toString(); // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("poll_id", idvalue)); params.add(new BasicNameValuePair("poll_typeid", codevalue)); params.add(new BasicNameValuePair("poll_response", pollresponse)); params.add(new BasicNameValuePair("poll_comment", pollcomment)); params.add(new BasicNameValuePair("comment_by", pollby2)); // getting JSON Object // Note that create product url accepts POST method JSONObject json = jsonParser.makeHttpRequest(URL_NEW_UPDATE, "POST", params); // check log cat fro response Log.d("Create Response", json.toString()); // check for success tag try { int success = json.getInt(TAG_SUCCESS); if (success == 1) { Intent i = new Intent(getApplicationContext(),Pollcomments.class); startActivity(i); // successfully created product } else { // failed to create product } } catch (JSONException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String file_url) { // dismiss the dialog once done Toast.makeText(getApplicationContext(),"Poll submitted Successfully" ,Toast.LENGTH_LONG).show(); pDialog.dismiss(); finish(); } } }
4a254734816d95c2014c6ea5eda341544b4ce30c
bfdd6e44a7a335cad07915eaf995587067269d3a
/ksp-data-load/src/main/java/cn/com/bjjdsy/data/file/AbstractReadDataFile.java
76fd127d9d14a2745dcbc72b9e229992d930ca19
[]
no_license
scorpiozc/ksp-parent
e0bf3e21e0ee48af4d1e9fb163d1e63ca14786d5
8f477d3c3662e448ba689d4acc376b377ffc1891
refs/heads/master
2020-04-12T18:59:46.955765
2019-01-23T02:26:07
2019-01-23T02:26:07
162,696,556
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package cn.com.bjjdsy.data.file; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public abstract class AbstractReadDataFile { static final Logger logger = LoggerFactory.getLogger(AbstractReadDataFile.class); public void read(String filename) throws IOException { int linenum = 0; File dataFile = new File(filename); try (BufferedReader reader = new BufferedReader(new FileReader(dataFile));) { // reader.readLine(); // reader.readLine(); while (true) { String line = reader.readLine(); if (line == null || line.length() == 0) { break; } // parse the data // logger.info("linenum {}", ++linenum); String[] data = line.split(","); this.parseData(data); } } // catch (Exception e) { // logger.error(e.getMessage(), e); // } } public abstract void parseData(String[] data); }
5244a6887c16976f92c81ca0a5a4bdff214c3aeb
8aee30e126360c2119ef9e1f884a1217ad971b13
/src/main/java/com/zfysoft/platform/dao/XzqhDao.java
d13d0117ae17342cf06d3856ffd16992383599ff
[]
no_license
xiangzhengyan/sbgl_web
41c26a307187b785dbf42516407141dd72d2a43f
fd05748e50c8aa10b1fd28553702964b0ac76b78
refs/heads/master
2021-01-01T17:45:06.663668
2018-01-25T06:43:15
2018-01-25T06:43:15
98,147,792
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package com.zfysoft.platform.dao; import java.util.List; import com.zfysoft.platform.dao.BaseDao; import com.zfysoft.platform.model.Xzqh; public interface XzqhDao extends BaseDao{ /** * 查询所有的行政区划 */ public List<Xzqh> getAllXzqh(); /** * 插入行政区划(初始导入用) */ public void saveXzqhList(List<Xzqh> list); /** * @param xzqh */ void saveXzqh(Xzqh xzqh); }
da6f6f3ecbba9b0e23604a0de61e5632900f481c
d9568a6434312a42763b268a0c83bfaeda0e3985
/leetcode/src/main/java/practice/StringToInteger.java
747d7022f366a61b551b65ad5cb36cb62cf4666a
[]
no_license
CallenDevens/LeetCodePractice
e69863cb8c6ae31d4a2ea515aaf608f20c718d1b
2f7ab2ad9319f7528723bc63e8e679276008dd58
refs/heads/master
2021-01-03T02:41:24.068391
2020-03-20T03:55:32
2020-03-20T03:55:56
239,885,001
0
0
null
2020-10-13T20:23:20
2020-02-11T23:20:13
Java
UTF-8
Java
false
false
1,898
java
class Solution { public int myAtoi(String str) { int start = 0; boolean minus = false; for(int i = 0; i < str.length(); i++){ char ch = str.charAt(i); if(Character.isSpace(ch)){ continue; } if(!Character.isDigit(ch)){ if(i == str.length() - 1){ return 0; } if(ch == '-'){ minus = true; start =i+1; break; }else if (ch == '+'){ start =i+1; break; }else{ return 0; } /* if(ch != '-'){ return 0; }else if(ch == '+') minus = true; start =i+1; break; } */ } if(Character.isDigit(ch)){ start = i; break; } } int result = 0; for(int j = start; j < str.length(); j++){ char ch = str.charAt(j); if(!Character.isDigit(ch)){ break; } int digit = Character.getNumericValue(ch); if(minus){ digit = -digit; } if(result > Integer.MAX_VALUE/10 || (result == Integer.MAX_VALUE/10 && digit >7)){ return Integer.MAX_VALUE; } if(result < Integer.MIN_VALUE/10 ||(result == Integer.MIN_VALUE/10 && digit < -8)){ return Integer.MIN_VALUE; } result = result *10 + digit; } return result; } }
011580b646bfc252ec525dc01804e97ce95324b2
ce988d107f9fcd55b99394f3c5c44968dcf25359
/cathode/src/main/java/net/simonvt/cathode/ui/UiController.java
01c4d82d55e16e45b2778145314e0e822315a242
[ "Apache-2.0" ]
permissive
adneal/cathode
fabb4a138a02a697ea39aaa21373d00b1a189b67
48f9dbd62973dc4680197f73a1f51acf1d2aea69
refs/heads/master
2021-01-14T13:58:01.291205
2014-01-14T18:42:22
2014-01-14T18:42:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,683
java
/* * Copyright (C) 2013 Simon Vig Therkildsen * * 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 net.simonvt.cathode.ui; import android.os.Bundle; import net.simonvt.cathode.ui.fragment.NavigationFragment; import timber.log.Timber; public class UiController implements ShowsNavigationListener, MoviesNavigationListener, NavigationFragment.OnMenuClickListener { private static final String TAG = "UiController"; static final String FRAGMENT_LOGIN = "net.simonvt.cathode.ui.HomeActivity.loginFragment"; static final String FRAGMENT_NAVIGATION = "net.simonvt.cathode.ui.HomeActivity.navigationFragment"; static final String FRAGMENT_SHOWS = "net.simonvt.cathode.ui.HomeActivity.showsFragment"; static final String FRAGMENT_SHOWS_UPCOMING = "net.simonvt.cathode.ui.HomeActivity.upcomingShowsFragment"; static final String FRAGMENT_SHOWS_COLLECTION = "net.simonvt.cathode.ui.HomeActivity.collectionShowsFragment"; static final String FRAGMENT_SHOWS_TRENDING = "net.simonvt.cathode.ui.HomeActivity.trendingShowsFragment"; static final String FRAGMENT_SHOWS_RECOMMENDATIONS = "net.simonvt.cathode.ui.HomeActivity.showRecommendationsFragment"; static final String FRAGMENT_SHOW = "net.simonvt.cathode.ui.HomeActivity.showFragment"; static final String FRAGMENT_SEASONS = "net.simonvt.cathode.ui.HomeActivity.seasonsFragment"; static final String FRAGMENT_SEASON = "net.simonvt.cathode.ui.HomeActivity.seasonFragment"; static final String FRAGMENT_EPISODE = "net.simonvt.cathode.ui.HomeActivity.episodeFragment"; static final String FRAGMENT_SHOWS_WATCHLIST = "net.simonvt.cathode.ui.HomeActivity.showsWatchlistFragment"; static final String FRAGMENT_EPISODES_WATCHLIST = "net.simonvt.cathode.ui.HomeActivity.episodesWatchlistFragment"; static final String FRAGMENT_SEARCH_SHOW = "net.simonvt.cathode.ui.HomeActivity.searchShowFragment"; static final String FRAGMENT_MOVIES_WATCHED = "net.simonvt.cathode.ui.HomeActivity.moviesWatchedFragment"; static final String FRAGMENT_MOVIES_COLLECTION = "net.simonvt.cathode.ui.HomeActivity.moviesCollectionFragment"; static final String FRAGMENT_MOVIES_WATCHLIST = "net.simonvt.cathode.ui.HomeActivity.moviesWatchlistFragment"; static final String FRAGMENT_MOVIES_TRENDING = "net.simonvt.cathode.ui.HomeActivity.moviesTrendingFragment"; static final String FRAGMENT_MOVIES_RECOMMENDATIONS = "net.simonvt.cathode.ui.HomeActivity.movieRecommendationsFragment"; static final String FRAGMENT_SEARCH_MOVIE = "net.simonvt.cathode.ui.HomeActivity.searchMovieFragment"; static final String FRAGMENT_MOVIE = "net.simonvt.cathode.ui.HomeActivity.movieFragment"; protected HomeActivity activity; protected boolean attached; UiController(HomeActivity activity) { this.activity = activity; } public void onCreate(Bundle inState) { Timber.d("[onCreate]"); } public void onAttach() { Timber.d("[onAttach]"); attached = true; } public void onDetach() { Timber.d("[onDetach]"); attached = false; } public void onDestroy(boolean completely) { Timber.d("[onDestroy]"); } public Bundle onSaveInstanceState() { return null; } public boolean onBackClicked() { return false; } public void onHomeClicked() { Timber.d("[onHomeClicked]"); } @Override public void onMenuItemClicked(int id) { Timber.d("[onMenuItemClicked]"); } @Override public void onDisplayMovie(long movieId, String title) { Timber.d("[onDisplayMovie]"); } @Override public void onStartMovieSearch() { Timber.d("[onStartMovieSearch]"); } @Override public void onDisplayShow(long showId, String title, LibraryType type) { Timber.d("[onDisplayShow]"); } @Override public void onDisplaySeason(long showId, long seasonId, String showTitle, int seasonNumber, LibraryType type) { Timber.d("[onDisplaySeason]"); } @Override public void onDisplayEpisode(long episodeId, String showTitle) { Timber.d("[onDisplayEpisode]"); } @Override public void onStartShowSearch() { Timber.d("[onStartShowSearch]"); } }
16e2c3f690f06ed6384d28a8ce1a19470e94f990
444f05441aad8ff23d2366ddfb4b892a86894a2c
/16day-IO/src/step6/TestIOService.java
194bb570e5a5818a349b0cf38e0a0440ed01517b
[]
no_license
jikang0105/java-secure-coding
42ce0c851b7e157fd1a547d14851c16d8718efbd
a9cb70e2bec22c5f78c1834bdf4ae7652755a724
refs/heads/master
2022-12-25T01:40:03.300710
2020-10-08T09:29:00
2020-10-08T09:29:00
277,994,789
0
0
null
null
null
null
UHC
Java
false
false
522
java
package step6; import java.io.IOException; import java.util.ArrayList; public class TestIOService { public static void main(String[] args) { String path="C:\\kosta203\\iotest3\\test.txt"; IOService service = new IOService(); ArrayList<String> list = new ArrayList<String>(); list.add("노가리"); list.add("참치"); list.add("삼겹살"); // try try { service.saveFile(path, list); System.out.println(path+"파일에 리스트 저장"); } catch (IOException e) { e.printStackTrace(); } } }
f1f157171a88d97ec59344155522975884c77b66
beb6fd652e9471eda4856e519a29bbae714fe60c
/NettyClient/src/test/netty/protocol/handler/HeartBeatRespHandler.java
4bcb4f253bcc6ede5925062bd7bdef8d49ad7e56
[]
no_license
cheese8/netty-protocol
860b98c1e559dcac440d888b3db5f17545430ad5
82c8f9bdf247c6ba75c1c8e298feb993c14e9024
refs/heads/master
2020-09-23T16:49:42.058319
2015-05-21T07:00:31
2015-05-21T07:00:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,577
java
package test.netty.protocol.handler; import test.netty.protocol.message.Header; import test.netty.protocol.message.MessageType; import test.netty.protocol.message.NettyMessage; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; public class HeartBeatRespHandler extends ChannelInboundHandlerAdapter { private NettyMessage buildHeartBeat() { // TODO Auto-generated method stub NettyMessage message = new NettyMessage(); Header header = new Header(); header.setType(MessageType.HEARTBEAT_RESP); message.setHeader(header); return message; } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // TODO Auto-generated method stub //super.channelRead(ctx, msg); NettyMessage message = (NettyMessage)msg; if( message.getHeader() != null && message.getHeader().getType() == MessageType.HEARTBEAT_REQ ) { System.out.println("Server Receive from client heart beat message:--->"+message); NettyMessage heartbeat = buildHeartBeat(); System.out.println("Send heart beat response message to client:--->"+heartbeat); ctx.writeAndFlush(heartbeat); } else { ctx.fireChannelRead(msg); } } @Override public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { // TODO Auto-generated method stub ctx.flush(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { // TODO Auto-generated method stub //super.exceptionCaught(ctx, cause); ctx.close(); } }
1c804c4306f79b9e18cd910cbec2aa2efa80fa24
8b9a5cd14baca6695b4477227ee29aa3a9443fef
/ct.java
bcc3815d6acd7486e586007b56e36027a19f7542
[]
no_license
Anshul-Sogani/test
335e7a8a6b45200c37de0b6e0dedda8c90db07be
037a0e5559e15d01f85c3a50eb92f0c794cb4222
refs/heads/master
2020-03-26T01:10:39.658187
2018-08-11T04:35:58
2018-08-11T04:35:58
144,355,433
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
class ct{ static int a ; static String name; static float f; static double d; ct(int a , String name, float f ,double d){ this.a =a ; this.name = name; this.f = f; this.d = d; } public static void main(String args[]){ ct c = new ct(10,"anshul",121.2f,123243); System.out.print(name); } }
0191a3d7d342e22e5abf9d5335a5c0510aa80957
d2c7c26aacd95d0206eba81db90f606c845ebee6
/app/src/main/java/com/example/fsh_noticet/Upload.java
fcf6cb4aa15c7fad70ac88698d263525b27eb49d
[]
no_license
nee-vir/FSH_NoticeT
5cacf02339d90ce70491b0b2f155c3354c14a071
0f61e4016407ceed689a2bab74cd5fa67dd8cf93
refs/heads/master
2022-04-23T21:16:18.689174
2020-04-26T07:14:33
2020-04-26T07:14:33
258,965,057
0
0
null
null
null
null
UTF-8
Java
false
false
2,036
java
package com.example.fsh_noticet; import java.io.Serializable; public class Upload implements Serializable { private transient String title; private transient String departmentName; private transient String publisherName; private transient String body; private transient String postImageUrl; private transient String postId; public Upload(){ //Necessary } public Upload(String title, String department, String username, String uBody, String pIUrl,String postId) { if(title.trim().equals("")){ title="no title"; } if(department.trim().equals("")){ department="department not mentioned"; } if(username.trim().equals("")){ username="anonymous"; } if(uBody.trim().equals("")){ uBody="no body"; } if(pIUrl.trim().equals("")){ pIUrl="No Image"; } this.title = title; this.departmentName = department; this.publisherName = username; this.body=uBody; this.postImageUrl=pIUrl; this.postId=postId; } public void setTitle(String title){ this.title=title; } public String getTitle(){ return this.title; } public void setDepartmentNames(String dept){ this.departmentName=dept; } public String getDepartmentNames(){ return this.departmentName; } public void setPublisherNames(String uName){ this.publisherName=uName; } public String getPublisherNames(){ return this.publisherName; } public void setBody(String uBody){ this.body=uBody; } public String getBody(){ return this.body; } public void setPostImageUrl(String pIUrl){ this.postImageUrl=pIUrl; } public String getPostImageUrl(){ return postImageUrl; } public String getPostId() { return postId; } public void setPostId(String postId) { this.postId = postId; } }
7b0d6bb24dde580c1ace1bf9c8cea54c68078db8
2ba3f134f67f4cc20120953053182d55a833c7e0
/clvt-rest/clvt/src/main/java/com/gbm/clvt/service/AppUserService.java
74485852cb1644bb81f635e338b43f0d665dda36
[]
no_license
GonzaloBrM/ClvtApp
9654dfd2dd378c6f006c27d3c6cb4a0ebbf71aba
b2e63d448a1cac0dd48ad61cb64823355edd1c77
refs/heads/master
2021-05-17T11:34:42.000258
2020-06-13T08:43:26
2020-06-13T08:43:26
250,758,012
0
0
null
2020-04-30T15:38:06
2020-03-28T09:38:01
null
UTF-8
Java
false
false
184
java
package com.gbm.clvt.service; import com.gbm.clvt.model.AppUser; public interface AppUserService { public AppUser register(AppUser user); public Boolean login(AppUser user); }
844f72fd06369fcbd469213242fdfeb3b4599b2d
081541aea72c79224d5e8b2a333ab75ef968d639
/app/src/main/java/hu/tomkom/deliveryapp/ui/rent/RentScreen.java
faef8f582d4acb6c31187f039556ab6d394beb26
[]
no_license
Tadi02/DeliveryApp
851aacf581602ab2dba354230eac5438a9ef357f
12e76666730a8159a7d29f1c324669a16b124539
refs/heads/master
2021-01-18T21:32:14.284495
2016-05-18T18:54:01
2016-05-18T18:54:01
55,757,499
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package hu.tomkom.deliveryapp.ui.rent; import java.util.List; import hu.tomkom.deliveryapp.model.Comment; import hu.tomkom.deliveryapp.model.Rent; public interface RentScreen { void showRentData(Rent rent); void showComments(List<Comment> comments); }
d93c4da033416a43a793cd679e38b49fc91708c6
e823fcad89bb8a3e631289a88dce427f493e473c
/app/src/main/java/com/pp/photop/Upload.java
408ac5a3960a328072e5f853b41a312552fa0474
[]
no_license
mkuech/PhotoP
141a99371f91d3a17fac809a4a5da89591a47765
ad149f33cd7682bb4c2871be92dd11eafc9136b8
refs/heads/master
2020-11-27T22:31:15.792999
2020-03-20T08:15:56
2020-03-20T08:15:56
229,629,102
0
0
null
2019-12-22T20:48:46
2019-12-22T20:48:45
null
UTF-8
Java
false
false
1,655
java
package com.pp.photop; class Upload { public String name; public String uploadUserName; public String phone; public String userId; public String uploadUri; public String glutenfree; public String vegan; public String pizza; public String chinese; public String italian; public String dessert; public String brunch; public String mexican; public String lat; public String lng; public Float rating; public Long yes; public Long no; public Upload() { this(null, null, null, false, false, false, false, false, false, false, false, null, null, (float)1.0, null, null, 1L, 1L); } public Upload(String name, String userId, String uploadUri, boolean glutenfree, boolean vegan, boolean pizza, boolean chinese, boolean italian, boolean dessert, boolean brunch, boolean mexican, String lat, String lng, Float rating, String uploadUserName, String phone, Long yes, Long no) { this.name = name; this.userId = userId; this.uploadUri = uploadUri; this.glutenfree = String.valueOf(glutenfree); this.vegan = String.valueOf(vegan); this.pizza = String.valueOf(pizza); this.chinese = String.valueOf(chinese); this.italian = String.valueOf(italian); this.dessert = String.valueOf(dessert); this.brunch = String.valueOf(brunch); this.mexican = String.valueOf(mexican); this.lat = lat; this.lng = lng; this.rating = rating; this.uploadUserName = uploadUserName; this.phone = phone; this.yes = yes; this.no = no; } }
a93b6dcabe15a21c443232221a78d844a0821d9c
9dbbf19a11b696e4ad48801b58f60e914c6eb177
/newdeal-project-34/src/main/java/com/eomcs/lms/handler/LessonUpdateCommand.java
cee9bfae1d1d378c861fe3e415486b420364fb01
[]
no_license
honden/newdeal-2018.11.27
eac591225b912918c55ccd4a79a5aaaadae9a0a8
5aacf4b2d1bddf70d1f70eefb19ba306235a6cf5
refs/heads/master
2020-04-08T11:05:46.649772
2018-12-11T09:50:20
2018-12-11T09:50:20
159,293,158
0
0
null
null
null
null
UTF-8
Java
false
false
2,135
java
package com.eomcs.lms.handler; import java.sql.Date; import java.util.List; import java.util.Scanner; import com.eomcs.lms.domain.Lesson; public class LessonUpdateCommand implements Command { Scanner keyboard; List<Lesson> list; public LessonUpdateCommand(Scanner keyboard, List<Lesson> list) { this.keyboard = keyboard; this.list = list; } public void execute() { System.out.print("번호? "); int no = Integer.parseInt(keyboard.nextLine()); int index = indexOfLesson(no); if (index == -1) { System.out.println("해당 수업을 찾을 수 없습니다."); return; } Lesson lesson = list.get(index); try { // 일단 기존 값을 복제한다. Lesson temp = lesson.clone(); System.out.printf("수업명(%s)? ", lesson.getTitle()); String input = keyboard.nextLine(); if (input.length() > 0) temp.setTitle(input); System.out.printf("설명(%s)? ", lesson.getContents()); if ((input = keyboard.nextLine()).length() > 0) temp.setContents(input); System.out.printf("시작일(%s)? ", lesson.getStartDate()); if ((input = keyboard.nextLine()).length() > 0) temp.setStartDate(Date.valueOf(input)); System.out.printf("종료일(%s)? ", lesson.getEndDate()); if ((input = keyboard.nextLine()).length() > 0) temp.setEndDate(Date.valueOf(input)); System.out.printf("총수업시간(%d)? ", lesson.getTotalHours()); if ((input = keyboard.nextLine()).length() > 0) temp.setTotalHours(Integer.parseInt(input)); System.out.printf("일수업시간(%d)? ", lesson.getDayHours()); if ((input = keyboard.nextLine()).length() > 0) temp.setDayHours(Integer.parseInt(input)); list.set(index, temp); System.out.println("수업을 변경했습니다."); } catch (Exception e) { System.out.println("변경 중 오류 발생!"); } } private int indexOfLesson(int no) { for (int i = 0; i < list.size(); i++) { Lesson b = list.get(i); if (b.getNo() == no) return i; } return -1; } }
11bfafd180631f57513f3775b4a68d5f7efabcfb
11f38312a18486b8f2a69a240c85d54372a30634
/argoncillo-oop-se-inheritance/argoncillo-oop-se-inheritance/ConstructorBehavior/src/ConstructorBehavior/ADemo.java
2b080f9ce87fc69a3ebc4be9336e28c7fb69e8d0
[]
no_license
drilanph/Argoncillo-oop-se-inheritance
b378a74a73b3aab4e5cd169b5c1cbbb0063b1fcd
424b3bd9592ded073bcbc49b3c5e36323f44ab5d
refs/heads/master
2021-01-21T23:09:20.569420
2017-06-23T08:24:13
2017-06-23T08:24:13
95,194,273
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package ConstructorBehavior; public class ADemo { public static void main(String[] args) { A a = new A(); A a1 = new A("wew"); A a2 = new A(1); A a3 = new A("String",12); a1.setX("wew"); a2.setY(1); System.out.println(a1.getX()); System.out.println(a2.getY()); } }
bfcf82b6dd5820dadb946050e6429a3d6af1d6a8
56d6fa60f900fb52362d4cce950fa81f949b7f9b
/aws-sdk-java/src/main/java/com/amazonaws/services/support/model/InternalServerErrorException.java
a39e231979b85b67df5db5ea76bccf11fadc246d
[ "JSON", "Apache-2.0" ]
permissive
TarantulaTechnology/aws
5f9d3981646e193c89f1c3fa746ec3db30252913
8ce079f5628334f83786c152c76abd03f37281fe
refs/heads/master
2021-01-19T11:14:53.050332
2013-09-15T02:37:02
2013-09-15T02:37:02
12,839,311
1
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
/* * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.support.model; import com.amazonaws.AmazonServiceException; /** * <p> * Returns HTTP error 500. * </p> */ public class InternalServerErrorException extends AmazonServiceException { private static final long serialVersionUID = 1L; /** * Constructs a new InternalServerErrorException with the specified error * message. * * @param message Describes the error encountered. */ public InternalServerErrorException(String message) { super(message); } }
99b118eb95547e8548025a04f3856a22437c4a12
0c52e6cd9861addedd64f7788c7ccd2c8095a9a0
/app/src/main/java/com/ali/demo/api/request/AlipayTradeCancelRequest.java
d5d0b09bbb3b6ff21c922a3b2168752936aa232c
[]
no_license
RayJack1011/TianHePay
d4c1a6e6efb85e1e4b3ba3425326e1825bcfebaa
af6f203ac79047b07080ade5d8529a718804735e
refs/heads/master
2020-03-29T08:09:48.174303
2018-09-21T02:11:32
2018-09-21T02:11:32
149,696,827
0
0
null
null
null
null
UTF-8
Java
false
false
3,055
java
package com.ali.demo.api.request; import com.ali.demo.api.AlipayObject; import com.ali.demo.api.AlipayRequest; import com.ali.demo.api.internal.utils.AlipayHashMap; import com.ali.demo.api.response.AlipayTradeCancelResponse; import java.util.Map; /** * 统一收单交易撤销请求 */ public class AlipayTradeCancelRequest implements AlipayRequest<AlipayTradeCancelResponse> { // add user-defined text parameters private AlipayHashMap udfParams; private String apiVersion = "1.0"; /** * 业务参数 */ private String bizContent; public void setBizContent(String bizContent) { this.bizContent = bizContent; } public String getBizContent() { return this.bizContent; } private String terminalType; private String terminalInfo; private String prodCode; private String notifyUrl; private String returnUrl; private boolean needEncrypt = false; private AlipayObject bizModel = null; public String getNotifyUrl() { return this.notifyUrl; } public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; } public String getReturnUrl() { return this.returnUrl; } public void setReturnUrl(String returnUrl) { this.returnUrl = returnUrl; } public String getApiVersion() { return this.apiVersion; } public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; } public void setTerminalType(String terminalType) { this.terminalType = terminalType; } public String getTerminalType() { return this.terminalType; } public void setTerminalInfo(String terminalInfo) { this.terminalInfo = terminalInfo; } public String getTerminalInfo() { return this.terminalInfo; } public void setProdCode(String prodCode) { this.prodCode = prodCode; } public String getProdCode() { return this.prodCode; } public String getApiMethodName() { return "alipay.trade.cancel"; } public Map<String, String> getTextParams() { AlipayHashMap txtParams = new AlipayHashMap(); txtParams.put("biz_content", this.bizContent); if (udfParams != null) { txtParams.putAll(this.udfParams); } return txtParams; } public void putOtherTextParam(String key, String value) { if (this.udfParams == null) { this.udfParams = new AlipayHashMap(); } this.udfParams.put(key, value); } public Class<AlipayTradeCancelResponse> getResponseClass() { return AlipayTradeCancelResponse.class; } public boolean isNeedEncrypt() { return this.needEncrypt; } public void setNeedEncrypt(boolean needEncrypt) { this.needEncrypt = needEncrypt; } public AlipayObject getBizModel() { return this.bizModel; } public void setBizModel(AlipayObject bizModel) { this.bizModel = bizModel; } }
205077d308f73a7cbafa72dd1a7762faa1a8a824
4bea7388596b6dd3fd31f08989254e579b814a05
/catb/src/main/java/com/catb/web/viewmodel/UserViewModel.java
1a011afaf991439bd0aba7060a4f384e5ab46557
[]
no_license
thoitbk/catbproject
d379419f82e0e0d147fa7c24cb734168d63c6351
0e0d67de65d332826aa483be6de0719cc24123cc
refs/heads/master
2021-01-10T21:30:30.013169
2017-12-29T03:53:59
2017-12-29T03:53:59
42,627,505
0
0
null
null
null
null
UTF-8
Java
false
false
3,367
java
package com.catb.web.viewmodel; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.Email; import org.hibernate.validator.constraints.NotBlank; public class UserViewModel { @NotBlank @Size(min = 0, max = 100) private String username; @NotBlank @Size(min = 0, max = 200) private String fullName; @NotBlank @Size(min = 0, max = 100) private String password; private Integer gender; @Size(min = 0, max = 500) private String address; @Size(min = 0, max = 50) private String homePhoneNumber; @Size(min = 0, max = 50) private String mobileNumber; @Size(min = 0, max = 50) private String officePhoneNumber; @Email @Size(min = 0, max = 100) private String email; private Integer position; private Integer department; @Size(min = 0, max = 500) private String description; public UserViewModel() { } public UserViewModel(String username, String fullName, String password, Integer gender, String address, String homePhoneNumber, String mobileNumber, String officePhoneNumber, String email, Integer position, Integer department, String description) { this.username = username; this.fullName = fullName; this.password = password; this.gender = gender; this.address = address; this.homePhoneNumber = homePhoneNumber; this.mobileNumber = mobileNumber; this.officePhoneNumber = officePhoneNumber; this.email = email; this.position = position; this.department = department; this.description = description; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Integer getGender() { return gender; } public void setGender(Integer gender) { this.gender = gender; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getHomePhoneNumber() { return homePhoneNumber; } public void setHomePhoneNumber(String homePhoneNumber) { this.homePhoneNumber = homePhoneNumber; } public String getMobileNumber() { return mobileNumber; } public void setMobileNumber(String mobileNumber) { this.mobileNumber = mobileNumber; } public String getOfficePhoneNumber() { return officePhoneNumber; } public void setOfficePhoneNumber(String officePhoneNumber) { this.officePhoneNumber = officePhoneNumber; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Integer getPosition() { return position; } public void setPosition(Integer position) { this.position = position; } public Integer getDepartment() { return department; } public void setDepartment(Integer department) { this.department = department; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
ddba4046fae24d282d11e71298cefe36c7fd6638
0bce5b4bad1e66723b6ce1b946fa693d7facd700
/src/org/antsoftware/messaging/wrapper/JMSSender.java
58df407c99165be335c78d2bdcd112b9d1102643
[]
no_license
Matthew-Ma-UTS/JMSTools
dcc876def9a1afc20a5a0f3bcfb073e97bcebd25
643583092babc0d8f2d34178421afb8c5684e0fa
refs/heads/master
2020-09-05T02:20:38.070328
2019-10-24T11:58:29
2019-10-24T11:58:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package org.antsoftware.messaging.wrapper; import javax.jms.Message; import javax.jms.Queue; import javax.jms.Session; public interface JMSSender { static int DEFAULT_DELIVERY = javax.jms.DeliveryMode.NON_PERSISTENT; static int DEFAULT_PRIORITY = javax.jms.Message.DEFAULT_PRIORITY; static long DEFAULT_TIMETOLIVE = 0; public void sendMessage(Queue queue, Message message) throws Exception; public void sendMessage(Queue queue, Message message, int deliveryMode, int priority, long timeToLive) throws Exception; public Session getSession(); }
c9c64c2ced64789f20e3cd4d9d5f7572f0d052bc
27c3a70a80ac6a8dac7bda9e11ed364a2d076185
/src/main/java/com/google/devtools/build/lib/rules/cpp/CompileCommandLine.java
72a22fb70cd30fa8dca4ae3558c805e1a0e3c8ec
[ "Apache-2.0" ]
permissive
shaopengyuan/bazel
091e4207466db2c1fa7fa63e6c4738fa7e2a4c4b
5038016e6573962d2554fcf9c10faa0cca8714e2
refs/heads/master
2021-01-20T05:22:18.249202
2017-04-28T16:24:52
2017-04-28T16:33:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,543
java
// Copyright 2017 The Bazel Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.devtools.build.lib.rules.cpp; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Predicate; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.config.PerLabelOptions; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.FeatureConfiguration; import com.google.devtools.build.lib.rules.cpp.CppCompileAction.DotdFile; import com.google.devtools.build.lib.util.FileType; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import javax.annotation.Nullable; /** The compile command line for the C++ compile action. */ public final class CompileCommandLine { private final Artifact sourceFile; private final Artifact outputFile; private final Label sourceLabel; private final DotdFile dotdFile; private final List<String> copts; private final Predicate<String> coptsFilter; private final Collection<String> features; private final FeatureConfiguration featureConfiguration; @VisibleForTesting public final CcToolchainFeatures.Variables variables; private final String actionName; private final CppConfiguration cppConfiguration; public CompileCommandLine( Artifact sourceFile, Artifact outputFile, Label sourceLabel, ImmutableList<String> copts, Predicate<String> coptsFilter, Collection<String> features, FeatureConfiguration featureConfiguration, CppConfiguration cppConfiguration, CcToolchainFeatures.Variables variables, String actionName, DotdFile dotdFile) { this.sourceFile = Preconditions.checkNotNull(sourceFile); this.outputFile = Preconditions.checkNotNull(outputFile); this.sourceLabel = Preconditions.checkNotNull(sourceLabel); this.copts = Preconditions.checkNotNull(copts); this.coptsFilter = coptsFilter; this.features = Preconditions.checkNotNull(features); this.featureConfiguration = Preconditions.checkNotNull(featureConfiguration); this.cppConfiguration = Preconditions.checkNotNull(cppConfiguration); this.variables = variables; this.actionName = actionName; this.dotdFile = isGenerateDotdFile(sourceFile) ? Preconditions.checkNotNull(dotdFile) : null; } /** Returns true if Dotd file should be generated. */ private boolean isGenerateDotdFile(Artifact sourceArtifact) { return CppFileTypes.headerDiscoveryRequired(sourceArtifact) && !featureConfiguration.isEnabled(CppRuleClasses.PARSE_SHOWINCLUDES); } /** Returns the environment variables that should be set for C++ compile actions. */ protected Map<String, String> getEnvironment() { return featureConfiguration.getEnvironmentVariables(actionName, variables); } protected List<String> getArgv( PathFragment outputFile, CcToolchainFeatures.Variables overwrittenVariables) { List<String> commandLine = new ArrayList<>(); // first: The command name. Preconditions.checkArgument( featureConfiguration.actionIsConfigured(actionName), String.format("Expected action_config for '%s' to be configured", actionName)); commandLine.add( featureConfiguration .getToolForAction(actionName) .getToolPath(cppConfiguration.getCrosstoolTopPathFragment()) .getPathString()); // second: The compiler options. commandLine.addAll(getCompilerOptions(overwrittenVariables)); if (!featureConfiguration.isEnabled("compile_action_flags_in_flag_set")) { // third: The file to compile! commandLine.add("-c"); commandLine.add(sourceFile.getExecPathString()); // finally: The output file. (Prefixed with -o). commandLine.add("-o"); commandLine.add(outputFile.getPathString()); } return commandLine; } private boolean isObjcCompile(String actionName) { return (actionName.equals(CppCompileAction.OBJC_COMPILE) || actionName.equals(CppCompileAction.OBJCPP_COMPILE)); } public List<String> getCompilerOptions( @Nullable CcToolchainFeatures.Variables overwrittenVariables) { List<String> options = new ArrayList<>(); CppConfiguration toolchain = cppConfiguration; addFilteredOptions(options, toolchain.getCompilerOptions(features)); String sourceFilename = sourceFile.getExecPathString(); if (CppFileTypes.C_SOURCE.matches(sourceFilename)) { addFilteredOptions(options, toolchain.getCOptions()); } if (CppFileTypes.CPP_SOURCE.matches(sourceFilename) || CppFileTypes.CPP_HEADER.matches(sourceFilename) || CppFileTypes.CPP_MODULE_MAP.matches(sourceFilename) || CppFileTypes.CLIF_INPUT_PROTO.matches(sourceFilename)) { addFilteredOptions(options, toolchain.getCxxOptions(features)); } // TODO(bazel-team): This needs to be before adding getUnfilteredCompilerOptions() and after // adding the warning flags until all toolchains are migrated; currently toolchains use the // unfiltered compiler options to inject include paths, which is superseded by the feature // configuration; on the other hand toolchains switch off warnings for the layering check // that will be re-added by the feature flags. CcToolchainFeatures.Variables updatedVariables = variables; if (variables != null && overwrittenVariables != null) { CcToolchainFeatures.Variables.Builder variablesBuilder = new CcToolchainFeatures.Variables.Builder(); variablesBuilder.addAll(variables); variablesBuilder.addAndOverwriteAll(overwrittenVariables); updatedVariables = variablesBuilder.build(); } addFilteredOptions(options, featureConfiguration.getCommandLine(actionName, updatedVariables)); // Users don't expect the explicit copts to be filtered by coptsFilter, add them verbatim. // Make sure these are added after the options from the feature configuration, so that // those options can be overriden. options.addAll(copts); // Unfiltered compiler options contain system include paths. These must be added after // the user provided options, otherwise users adding include paths will not pick up their // own include paths first. if (!isObjcCompile(actionName)) { options.addAll(toolchain.getUnfilteredCompilerOptions(features)); } // Add the options of --per_file_copt, if the label or the base name of the source file // matches the specified regular expression filter. for (PerLabelOptions perLabelOptions : cppConfiguration.getPerFileCopts()) { if ((sourceLabel != null && perLabelOptions.isIncluded(sourceLabel)) || perLabelOptions.isIncluded(sourceFile)) { options.addAll(perLabelOptions.getOptions()); } } if (!featureConfiguration.isEnabled("compile_action_flags_in_flag_set")) { if (FileType.contains(outputFile, CppFileTypes.ASSEMBLER, CppFileTypes.PIC_ASSEMBLER)) { options.add("-S"); } else if (FileType.contains( outputFile, CppFileTypes.PREPROCESSED_C, CppFileTypes.PREPROCESSED_CPP, CppFileTypes.PIC_PREPROCESSED_C, CppFileTypes.PIC_PREPROCESSED_CPP)) { options.add("-E"); } } return options; } // For each option in 'in', add it to 'out' unless it is matched by the 'coptsFilter' regexp. private void addFilteredOptions(List<String> out, List<String> in) { Iterables.addAll(out, Iterables.filter(in, coptsFilter)); } public Artifact getSourceFile() { return sourceFile; } public DotdFile getDotdFile() { return dotdFile; } public List<String> getCopts() { return copts; } }
97d3777ab1a8e564bb784d222c1e76cebe7c96fd
4f973617c8ace2af05867839075ad33edeabb844
/spring4-chap13-hib3/src/net/madvirus/spring4/chap13/store/service/PlaceOrderServiceImpl.java
fd890528409b2e132180a95609b0004ef19d19b0
[]
no_license
manusil/test
243062b267c6f367d63dde054b40822144bac99d
378547803ec0ec6513bb9bb4da25604dd7d14086
refs/heads/master
2022-12-21T01:51:54.850207
2019-09-08T00:57:51
2019-09-08T00:57:51
199,253,848
0
0
null
2022-12-15T23:32:42
2019-07-28T06:59:04
Java
UTF-8
Java
false
false
1,861
java
package net.madvirus.spring4.chap13.store.service; import org.springframework.transaction.annotation.Transactional; import net.madvirus.spring4.chap13.store.domain.Item; import net.madvirus.spring4.chap13.store.domain.ItemRepository; import net.madvirus.spring4.chap13.store.domain.ItemNotFoundException; import net.madvirus.spring4.chap13.store.domain.PaymentInfo; import net.madvirus.spring4.chap13.store.domain.PaymentInfoRepository; import net.madvirus.spring4.chap13.store.domain.PurchaseOrder; import net.madvirus.spring4.chap13.store.domain.PurchaseOrderRepository; public class PlaceOrderServiceImpl implements PlaceOrderService { private ItemRepository itemRepository; private PaymentInfoRepository paymentInfoRepository; private PurchaseOrderRepository purchaseOrderRepository; public void setItemRepository(ItemRepository itemRepository) { this.itemRepository = itemRepository; } public void setPaymentInfoRepository(PaymentInfoRepository paymentInformationRepository) { this.paymentInfoRepository = paymentInformationRepository; } public void setPurchaseOrderRepository(PurchaseOrderRepository purchaseOrderRepository) { this.purchaseOrderRepository = purchaseOrderRepository; } @Transactional @Override public PurchaseOrderResult order(PurchaseOrderRequest orderRequest) throws ItemNotFoundException { Item item = itemRepository.findById(orderRequest.getItemId()); if (item == null) throw new ItemNotFoundException(orderRequest.getItemId()); PaymentInfo paymentInfo = new PaymentInfo(item.getPrice()); paymentInfoRepository.save(paymentInfo); PurchaseOrder order = new PurchaseOrder(item.getId(), orderRequest .getAddress(), paymentInfo.getId()); purchaseOrderRepository.save(order); return new PurchaseOrderResult(item, paymentInfo, order); } }
[ "ohsy@ohsy-notebook" ]
ohsy@ohsy-notebook
b3723c9a22f6d704f9d9cae735e21c56fddd9c3b
c3e7b18047ef946eb7953e352d43bc0363b95d4e
/quickstart-linux/src/test/java/org/quickstart/linux/telnet/WindowsShell.java
fd159c9922a0bc62b0fc6b4a364ba91fd0cb1086
[ "Apache-2.0" ]
permissive
youngzil/quickstart-framework
059bc7d8604c192a53fd00e7774ec9ebc9befea7
4c0d48b576ad3230c026fb2cd323e80755fe415e
refs/heads/master
2023-03-10T02:34:40.475825
2022-08-25T15:07:33
2022-08-25T15:07:33
140,260,338
9
6
Apache-2.0
2023-02-22T08:28:29
2018-07-09T09:09:16
Java
UTF-8
Java
false
false
4,166
java
package org.quickstart.linux.telnet; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.net.SocketException; import org.apache.commons.net.telnet.TelnetClient; public class WindowsShell { private TelnetClient telnet = new TelnetClient("VT220"); InputStream in; PrintStream out; String prompt = ">"; public WindowsShell(String ip, int port, String user, String password) { try { telnet.connect(ip, port); in = telnet.getInputStream(); out = new PrintStream(telnet.getOutputStream()); login(user, password); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * 登录 * * @param user * @param password */ public void login(String user, String password) { // read()Until("login:"); readUntil("login:"); write(user); readUntil("password:"); write(password); readUntil(prompt + ""); } /** * 读取分析结果 * * @param pattern * @return */ public String readUntil(String pattern) { try { char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer sb = new StringBuffer(); char ch = (char) in.read(); while (true) { sb.append(ch); if (ch == lastChar) { if (sb.toString().endsWith(pattern)) { return sb.toString(); } } ch = (char) in.read(); // System.out.print(ch); } } catch (Exception e) { e.printStackTrace(); } return null; } /** * 写操作 * * @param value */ public void write(String value) { try { out.println(value); out.flush(); } catch (Exception e) { e.printStackTrace(); } } /** * 向目标发送命令字符串 * * @param command * @return */ public String sendCommand(String command) { try { write(command); return readUntil(prompt + ""); } catch (Exception e) { e.printStackTrace(); } return null; } /** * 关闭连接 */ public void disconnect() { try { telnet.disconnect(); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws UnsupportedEncodingException { WindowsShell ws = new WindowsShell("127.0.0.1", 23, "Administrator", "123"); // System.out.println(ws); // 执行的命令 String str = ws.sendCommand("ipconfig"); str = new String(str.getBytes("ISO-8859-1"),"GBK"); System.out.println(str); ws.disconnect(); } public static void main2(String[] args) { try { TelnetClient telnetClient = new TelnetClient("vt200"); //指明Telnet终端类型,否则会返回来的数据中文会乱码 telnetClient.setDefaultTimeout(5000); //socket延迟时间:5000ms telnetClient.connect("127.0.0.1",23); //建立一个连接,默认端口是23 InputStream inputStream = telnetClient.getInputStream(); //读取命令的流 PrintStream pStream = new PrintStream(telnetClient.getOutputStream()); //写命令的流 byte[] b = new byte[1024]; int size; StringBuffer sBuffer = new StringBuffer(300); while(true) { //读取Server返回来的数据,直到读到登陆标识,这个时候认为可以输入用户名 size = inputStream.read(b); if(-1 != size) { sBuffer.append(new String(b,0,size)); if(sBuffer.toString().trim().endsWith("login:")) { break; } } } System.out.println(sBuffer.toString()); pStream.println("exit"); //写命令 pStream.flush(); //将命令发送到telnet Server if(null != pStream) { pStream.close(); } telnetClient.disconnect(); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
ce71212321e2a384bfc023646bf70b8230de7f29
222f7da5cdcddd4118397382b0194715708bb73a
/src/com/fxwx/util/weixin/comment/copy/Signature.java
a9add21d393b70263630fbf5657a7ef232b80df9
[]
no_license
Asagiqianmu/wifi
c9193c0d58cedea90d2490771c9ecc5207ce59e4
8be5f38886fea42731eb99b2126454d0539f80d1
refs/heads/master
2020-03-28T00:48:17.482706
2018-09-05T03:02:31
2018-09-05T03:02:31
147,450,958
0
0
null
null
null
null
UTF-8
Java
false
false
6,188
java
package com.fxwx.util.weixin.comment.copy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; /** * User: rizenguo * Date: 2014/10/29 * Time: 15:23 */ public class Signature { private static Log logger = LogFactory.getLog(HttpService.class); private static final String KEY = "ceafa600a2d9b2a98d36885081d16058"; /* *//** * 签名算法 * * @param o 要参与签名的数据对象 * @return 签名 * @throws IllegalAccessException *//* public static String getSign(Object o) throws IllegalAccessException { ArrayList<String> list = new ArrayList<String>(); Class cls = o.getClass(); Field[] fields = cls.getDeclaredFields(); for (Field f : fields) { f.setAccessible(true); if (f.get(o) != null && f.get(o) != "") { list.add(f.getName() + "=" + f.get(o) + "&"); } } int size = list.size(); String[] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append(arrayToSort[i]); } String result = sb.toString(); result += "key=" + KEY; logger.debug("Sign Before MD5:" + result); result = MD5.MD5Encode(result).toUpperCase(); logger.debug("Sign Result:" + result); return result; }*/ public static String getSign(Map<String, Object> map) { ArrayList<String> list = new ArrayList<String>(); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() != "") { list.add(entry.getKey() + "=" + entry.getValue() + "&"); } } int size = list.size(); String[] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append(arrayToSort[i]); } String result = sb.toString(); result += "key="+KEY; //Util.log("Sign Before MD5:" + result); result = MD5.MD5Encode(result).toUpperCase(); //Util.log("Sign Result:" + result); return result; } public static String getSignToWeixin(Map<String, Object> map) { ArrayList<String> list = new ArrayList<String>(); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() != ""&&null!=entry.getValue()&& !"sign".equals(entry.getValue()) && !"key".equals(entry.getValue())) { list.add(entry.getKey() + "=" + entry.getValue() + "&"); } } int size = list.size(); String[] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append(arrayToSort[i]); } String result = sb.toString(); result += "key=" + KEY; //Util.log("Sign Before MD5:" + result); result = MD5.MD5Encode(result).toUpperCase(); //Util.log("Sign Result:" + result); return result; } /** * 从API返回的XML数据里面重新计算一次签名 * * @param responseString API返回的XML数据 * @return 新鲜出炉的签名 * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ public static String getSignFromResponseString(String responseString) throws IOException, SAXException, ParserConfigurationException { Map<String, Object> map = XMLParser.getMapFromXML(responseString); //清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名 map.put("sign", ""); //将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较 return Signature.getSign(map); } /** * 检验API返回的数据里面的签名是否合法,避免数据在传输的过程中被第三方篡改 * * @param responseString API返回的XML数据字符串 * @return API签名是否合法 * @throws ParserConfigurationException * @throws IOException * @throws SAXException */ public static boolean checkIsSignValidFromResponseString(String responseString) { try { Map<String, Object> map = XMLParser.getMapFromXML(responseString); logger.debug(map.toString()); String signFromAPIResponse = map.get("sign").toString(); if (signFromAPIResponse == "" || signFromAPIResponse == null) { logger.debug("API返回的数据签名数据不存在,有可能被第三方篡改!!!"); return false; } logger.debug("服务器回包里面的签名是:" + signFromAPIResponse); //清掉返回数据对象里面的Sign数据(不能把这个数据也加进去进行签名),然后用签名算法进行签名 map.put("sign", ""); //将API返回的数据根据用签名算法进行计算新的签名,用来跟API返回的签名进行比较 String signForAPIResponse = Signature.getSign(map); if (!signForAPIResponse.equals(signFromAPIResponse)) { //签名验不过,表示这个API返回的数据有可能已经被篡改了 logger.debug("API返回的数据签名验证不通过,有可能被第三方篡改!!!"); return false; } logger.debug("恭喜,API返回的数据签名验证通过!!!"); return true; } catch (Exception e) { return false; } } }
39e8cbc3a3c9c6580dba98bd2f97080f13b3e829
6e68584f2819351abe628b659c01184f51fec976
/Other/Android/Body/app/src/main/java/dang/body/MovingAverageArray.java
e55faa1d4f25e84e882d5fe27f6d0fb134824719
[]
no_license
DanSGraham/code
0a16a2bfe51cebb62819cd510c7717ae24b12d1b
fc54b6d50360ae12f207385b5d25adf72bfa8121
refs/heads/master
2020-03-29T21:09:18.974467
2017-06-14T04:04:48
2017-06-14T04:04:48
36,774,542
0
0
null
null
null
null
UTF-8
Java
false
false
1,217
java
package dang.body; import java.util.Arrays; import java.util.Calendar; import java.util.concurrent.TimeUnit; /** * Created by Daniel on 6/12/2017. */ public class MovingAverageArray extends CircularArray<Double> { final static double SKIPPED_VAL = -1.0; long lastDay; long currDay; public MovingAverageArray(int sizeOfArray){ super(sizeOfArray); Arrays.fill(this.circularArray, SKIPPED_VAL); lastDay = -1; } public double calculateAverage(){ int totalNum = -1; double sum = 0; for(int i=0; i < this.size; i++){ if(((double) this.circularArray[i]) != SKIPPED_VAL){ totalNum++; sum += (double) this.circularArray[i]; } } return (sum / totalNum); } public void add(double data){ if(lastDay == -1){ lastDay = TimeUnit.MILLISECONDS.toDays(Calendar.getInstance().getTimeInMillis()); } currDay = TimeUnit.MILLISECONDS.toDays(Calendar.getInstance().getTimeInMillis()); for(int i=1; i < (currDay - lastDay); i++){ super.add(SKIPPED_VAL); } super.add(data); lastDay = currDay; } }
e044670f605bf55285dff4f50097321d8cfc14e7
f16ed31b4731fa17fe420b53662460ec1afb914f
/sbia/ch11/src/main/java/com/manning/sbia/ch11/batch/ImportToJobInstanceMappingTasklet.java
217258f30bb9ead0ead8aa486075f99b3c9e08a6
[]
no_license
andrea-colleoni/ch-ti-csi-corso
ebfb692dfe502feed1437b53fdad1d7ebc15d65b
8e0e656cca51d5f02af4dabdd12c7bb8769efc5e
refs/heads/master
2021-01-21T21:14:26.202540
2017-06-22T15:09:23
2017-06-22T15:09:23
94,787,937
1
2
null
2017-06-24T14:28:37
2017-06-19T14:49:35
Java
UTF-8
Java
false
false
1,593
java
/** * */ package com.manning.sbia.ch11.batch; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.scope.context.ChunkContext; import org.springframework.batch.core.step.tasklet.Tasklet; import org.springframework.batch.repeat.RepeatStatus; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; import com.manning.sbia.ch11.repository.ProductImportRepository; /** * @author acogoluegnes * */ public class ImportToJobInstanceMappingTasklet implements Tasklet,InitializingBean { private String productImportId; private ProductImportRepository productImportRepository; /* (non-Javadoc) * @see org.springframework.batch.core.step.tasklet.Tasklet#execute(org.springframework.batch.core.StepContribution, org.springframework.batch.core.scope.context.ChunkContext) */ @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { Long jobInstanceId = chunkContext.getStepContext().getStepExecution().getJobExecution().getJobInstance().getId(); productImportRepository.mapImportToJobInstance(productImportId, jobInstanceId); return RepeatStatus.FINISHED; } public void setProductImportId(String productImportId) { this.productImportId = productImportId; } public void setProductImportRepository( ProductImportRepository productImportRepository) { this.productImportRepository = productImportRepository; } @Override public void afterPropertiesSet() throws Exception { Assert.notNull(productImportId); } }
61aa2e4da581e4f53b0ebc29f853ee58937ac4fb
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/transform/CreateAuthorizerRequestMarshaller.java
4f6cbf1a0cfbed1b9255a5f4ca5e8d3d4da5b4f0
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
4,436
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.iot.model.transform; import java.util.Map; import java.util.List; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.iot.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * CreateAuthorizerRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreateAuthorizerRequestMarshaller { private static final MarshallingInfo<String> AUTHORIZERNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PATH).marshallLocationName("authorizerName").build(); private static final MarshallingInfo<String> AUTHORIZERFUNCTIONARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("authorizerFunctionArn").build(); private static final MarshallingInfo<String> TOKENKEYNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("tokenKeyName").build(); private static final MarshallingInfo<Map> TOKENSIGNINGPUBLICKEYS_BINDING = MarshallingInfo.builder(MarshallingType.MAP) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("tokenSigningPublicKeys").build(); private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("status").build(); private static final MarshallingInfo<List> TAGS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("tags").build(); private static final MarshallingInfo<Boolean> SIGNINGDISABLED_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("signingDisabled").build(); private static final MarshallingInfo<Boolean> ENABLECACHINGFORHTTP_BINDING = MarshallingInfo.builder(MarshallingType.BOOLEAN) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("enableCachingForHttp").build(); private static final CreateAuthorizerRequestMarshaller instance = new CreateAuthorizerRequestMarshaller(); public static CreateAuthorizerRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(CreateAuthorizerRequest createAuthorizerRequest, ProtocolMarshaller protocolMarshaller) { if (createAuthorizerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerName(), AUTHORIZERNAME_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerFunctionArn(), AUTHORIZERFUNCTIONARN_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getTokenKeyName(), TOKENKEYNAME_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getTokenSigningPublicKeys(), TOKENSIGNINGPUBLICKEYS_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getTags(), TAGS_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getSigningDisabled(), SIGNINGDISABLED_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getEnableCachingForHttp(), ENABLECACHINGFORHTTP_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
819bf0f02cadb14eb6f2d83e9c03c0bd5415d360
a952f9abd9f3ec7cf6db5bdc708f880abd931978
/BBPawBootSetting/src/com/worldchip/bbpaw/bootsetting/receiver/BootBroadcaseReceiver.java
1d687ef838b732af465f7eac24ee7ed254707860
[]
no_license
Win0818/BBPaw_Code
7d46d1d614e187d42ce08dc7c41a23b871a4d47b
902779d42695abaadbcb7b07f60659da5c26e059
refs/heads/master
2021-01-01T20:12:56.987144
2017-07-30T08:44:48
2017-07-30T08:44:48
98,784,927
1
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package com.worldchip.bbpaw.bootsetting.receiver; import com.worldchip.bbpaw.bootsetting.util.Common; import com.worldchip.bbpaw.bootsetting.util.LogUtil; import com.worldchip.bbpaw.bootsetting.util.Utils; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootBroadcaseReceiver extends BroadcastReceiver { private static final String TAG = BootBroadcaseReceiver.class.getSimpleName(); private static final String ACTION = "android.intent.action.BOOT_COMPLETED"; @Override public void onReceive(Context arg0, Intent arg1) { if (arg1.getAction().equals(ACTION)) { /*String isFirst = Common.getPreferenceValue(Utils.IS_FIRST_START_KEY, "true"); boolean first = isFirst.equals("true") ? true :false; LogUtil.e(TAG, "isFirst == "+isFirst); if (!first) { return; }*/ String startCount = Common.getPreferenceValue(Utils.IS_FIRST_START_KEY, "0"); LogUtil.e(TAG, "startCount == "+startCount); if (startCount.equals("3")) { return; } Intent intent = new Intent(); intent.setClassName("com.worldchip.bbpaw.bootsetting", "com.worldchip.bbpaw.bootsetting.activity.MainActivity"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); arg0.startActivity(intent); } } }
187b3cbd10e1e0146d079e906c60a88ee124924a
382bab264e0d0c57412af3cdf851f9b92db47b96
/src/Components/StaticDropdown.java
c658c077b2411c4f6cfb953acfea083bed12effc
[]
no_license
sindhou29/Selenium
3adc14a0b497c7cef300ceec7e81de6fefa7c20b
a9355ac5116d5bd054ca0d0b10af25706c08b8cb
refs/heads/master
2023-01-01T14:14:48.537497
2020-10-27T16:40:07
2020-10-27T16:40:07
306,404,925
0
0
null
null
null
null
UTF-8
Java
false
false
922
java
package Components; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class StaticDropdown { public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C://Users/admin/Downloads/chromedriver_win32/chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.get("https://www.spicejet.com/"); driver.findElement(By.id("divpaxinfo")).click(); WebDriverWait wait =new WebDriverWait(driver,8); wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("ctl00_mainContent_ddl_Adult"))); Select s =new Select (driver.findElement(By.id("ctl00_mainContent_ddl_Adult"))); s.selectByIndex(1); } }
5dfd3a145292f256a99ba2206c79e10e753fb11c
c130c2c2e37c1cbef2cab7cedebe598091f78741
/pet-clinic-data/src/main/java/com/vianneydiris/petclinic/services/springdatajpa/PetSDJpaService.java
364637e3603398825ccb64904c058b5bbce0ed9f
[]
no_license
VianneyDiris/spring-pet-clinic
2529575e98ad5ed4b46d61fcf3e1ed4877710c66
a258e88a1c2b01061ddd7fb3461a6ce57f38028c
refs/heads/master
2022-10-19T20:32:52.304028
2020-06-10T08:21:07
2020-06-10T08:21:07
267,263,221
0
0
null
2020-06-05T12:49:09
2020-05-27T08:25:17
Java
UTF-8
Java
false
false
1,202
java
package com.vianneydiris.petclinic.services.springdatajpa; import com.vianneydiris.petclinic.model.Pet; import com.vianneydiris.petclinic.repositories.PetRepository; import com.vianneydiris.petclinic.services.PetService; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import java.util.HashSet; import java.util.Set; @Service @Profile("springdatajpa") public class PetSDJpaService implements PetService { private final PetRepository petRepository; public PetSDJpaService(PetRepository petRepository) { this.petRepository = petRepository; } @Override public Set<Pet> findAll() { Set<Pet> pets = new HashSet<>(); petRepository.findAll().forEach(pets::add); return pets; } @Override public Pet findById(Long aLong) { return petRepository.findById(aLong).orElse(null); } @Override public Pet save(Pet object) { return petRepository.save(object); } @Override public void delete(Pet object) { petRepository.delete(object); } @Override public void deleteById(Long aLong) { petRepository.deleteById(aLong); } }
5193873f40a05d429acf871e02b360e30cc3be3b
b27556f8259966b6c5dec616e91279808e0d877b
/DaySettings.java
dd2d76f1165fd4dc5b12d0e48aad2261168e1252
[]
no_license
st34m3r/entitiesBOOKALL
e80c640268d135d7f017ccd18bfaf764cab5a4f8
a698f7d43e156ee2e2aab0c53729a518949b6b68
refs/heads/master
2022-08-19T11:55:51.422190
2020-05-24T05:00:38
2020-05-24T05:00:38
266,472,836
0
0
null
null
null
null
UTF-8
Java
false
false
3,037
java
package entities; // Generated 24 mai 2020 05:58:50 by Hibernate Tools 4.3.5.Final import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * DaySettings generated by hbm2java */ @Entity @Table(name = "day_settings", catalog = "bookall") public class DaySettings implements java.io.Serializable { private Long id; private String dayName; private Date startTime; private Date endTime; private Date breakStart; private Date breakEnd; private Set<WorkingPlans> workingPlanses = new HashSet<WorkingPlans>(0); public DaySettings() { } public DaySettings(String dayName, Date startTime, Date endTime, Date breakStart, Date breakEnd) { this.dayName = dayName; this.startTime = startTime; this.endTime = endTime; this.breakStart = breakStart; this.breakEnd = breakEnd; } public DaySettings(String dayName, Date startTime, Date endTime, Date breakStart, Date breakEnd, Set<WorkingPlans> workingPlanses) { this.dayName = dayName; this.startTime = startTime; this.endTime = endTime; this.breakStart = breakStart; this.breakEnd = breakEnd; this.workingPlanses = workingPlanses; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } @Column(name = "day_name", nullable = false, length = 10) public String getDayName() { return this.dayName; } public void setDayName(String dayName) { this.dayName = dayName; } @Temporal(TemporalType.TIME) @Column(name = "start_time", nullable = false, length = 8) public Date getStartTime() { return this.startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } @Temporal(TemporalType.TIME) @Column(name = "end_time", nullable = false, length = 8) public Date getEndTime() { return this.endTime; } public void setEndTime(Date endTime) { this.endTime = endTime; } @Temporal(TemporalType.TIME) @Column(name = "break_start", nullable = false, length = 8) public Date getBreakStart() { return this.breakStart; } public void setBreakStart(Date breakStart) { this.breakStart = breakStart; } @Temporal(TemporalType.TIME) @Column(name = "break_end", nullable = false, length = 8) public Date getBreakEnd() { return this.breakEnd; } public void setBreakEnd(Date breakEnd) { this.breakEnd = breakEnd; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "daySettings") public Set<WorkingPlans> getWorkingPlanses() { return this.workingPlanses; } public void setWorkingPlanses(Set<WorkingPlans> workingPlanses) { this.workingPlanses = workingPlanses; } }
0d01fb5997075afc33c7511c778637c1e8f7df91
b7804b214a4a2dd2987f91051a33292e5c577326
/patterns/src/main/java/ua/ho/godex/headfirst/decorator/starbuzz/Mocha.java
f22fcdb6a3bf0efcc019e36a91fdf4eb00c1b73f
[]
no_license
PavlenkoB/java-learn
cbf1c5da68fbb7b16005abb0e4579aabddb7c79f
753f2c8fee0880d6a3a9a66c6fa0cee63ff3bc38
refs/heads/master
2021-04-28T20:49:36.635780
2021-01-18T11:59:11
2021-01-18T11:59:11
121,936,766
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package ua.ho.godex.headfirst.decorator.starbuzz; public class Mocha extends CondimentDecorator { Beverage beverage; public Mocha(Beverage beverage) { this.beverage = beverage; } public String getDescription() { return beverage.getDescription() + ", Mocha"; } public double cost() { return .20 + beverage.cost(); } }
b1210e558d47a0514e05bea186d85fc0e2e18f65
cf73606d790f93aa10c6e9b53fa3ce25a4a131b2
/chefpdig.java
3d2bee2f2753ebcc96b013a66817cf781f46fd41
[]
no_license
devendrakushwah/CodeChef_Submissions
d03e5052349557c9af604256853c870ae7008c07
7765b95ffbcc9708194adfcb1786ba92900409b0
refs/heads/master
2021-09-15T01:34:13.759938
2018-05-23T13:39:12
2018-05-23T13:39:12
104,344,261
0
0
null
null
null
null
UTF-8
Java
false
false
2,833
java
import java.util.*; class chefpdig { static ArrayList<String>list=new ArrayList<String>(); static ArrayList<Character>chr=new ArrayList<Character>(); /*static ArrayList<String> permutation(char[] p, int pos, String str) { if (pos == p.length) { list.add(new String(p)); } else { for (int i = 0 ; i < str.length() ; i++) { p[pos] = str.charAt(i); permutation(p, pos+1, str); } } return list; }*/ public static boolean count_1(String s, char c) { int count = 0; boolean ans=false; for (int i=0; i < s.length(); i++) { if (s.charAt(i) == c) { count++; } } if(count==1) { ans=true; } return ans; } public static void main (String[] args) { Scanner sc=new Scanner(System.in); int tc=sc.nextInt(); for(int t=0;t<=tc;t++) { String s=sc.nextLine(); char arr[] = {' ', ' '}; list=perm(s); for(int i=0;i<list.size();i++) { // to remove dupliactes for(int j=i+1;j<list.size();j++) { if(list.get(i).equals(list.get(j))) { list.remove(j); j--; } } } for(int i=0;i<s.length();i++) { char ch=s.charAt(i); String rem=""+ch+ch; if(count_1(s,ch)) { list.remove(rem); } } Collections.sort(list); for(int i=0;i<list.size();i++) { int n=Integer.parseInt(list.get(i)); if(n>=65 && n<=90) { chr.add((char)n); } } if(chr.isEmpty()) { System.out.print("\n"); } else{ for(int i=0;i<chr.size();i++) { System.out.print(chr.get(i)); } System.out.println(); chefpdig.chr.clear(); chefpdig.list.clear(); } } } static ArrayList<String> perm(String str) { ArrayList<String> list= new ArrayList<String>(); for(int i=0;i<str.length();i++) { for(int j=0;j<str.length();j++) { String temp1=Character.toString(str.charAt(i)); String temp2=Character.toString(str.charAt(i)); list.add(temp1+temp2); } } return list; } }
36cfe67bf8dcc9c2ef8a065d200ebd849fe13486
3806723e3b4bd76e61c2ee5182a1c63e5275d482
/src/main/java/com/example/demo/Repositories/UtilisateurDao.java
2a60eda97f6f672169ed4b99fc9e477b17a83aa9
[]
no_license
mahdigb05/BO-backend
0d416f25c5a4d8ded5364cc39e7f6da6acc3c6f1
adb6a691e7bfbd09b1e8330d68dad454f2aacd74
refs/heads/master
2022-12-19T18:26:07.982417
2020-09-22T22:32:55
2020-09-22T22:32:55
297,788,227
1
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.example.demo.Repositories; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.example.demo.Beans.Utilisateur; @Repository public interface UtilisateurDao extends CrudRepository<Utilisateur,Long> { Utilisateur findByEmail(String email); Utilisateur findByTel(String tel); }
0bfb57d33706c5ba5d39b59f297a17373c28d4ee
82398d6a036bc45edf324c37e2a418ee17ec5760
/src/main/java/com/atlassian/jira/rest/client/api/AvatarsApi.java
8ce75c8fa79e60e950377af9cd7408d1b7af9a94
[]
no_license
amondnet/jira-client
7ff59c70cead9d517d031836f961ec0e607366cb
4f9fdf10532fefbcc0d6ae80fd42d357545eee4d
refs/heads/main
2023-04-03T21:42:24.069554
2021-04-15T15:27:20
2021-04-15T15:27:20
358,300,244
0
0
null
null
null
null
UTF-8
Java
false
false
16,092
java
package com.atlassian.jira.rest.client.api; import com.atlassian.jira.rest.client.ApiClient; import com.atlassian.jira.rest.client.model.Avatar; import com.atlassian.jira.rest.client.model.Avatars; import com.atlassian.jira.rest.client.model.SystemAvatars; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.core.ParameterizedTypeReference; import org.springframework.web.reactive.function.client.WebClientResponseException; import org.springframework.core.io.FileSystemResource; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-04-16T00:10:50.175246+09:00[Asia/Seoul]") public class AvatarsApi { private ApiClient apiClient; public AvatarsApi() { this(new ApiClient()); } @Autowired public AvatarsApi(ApiClient apiClient) { this.apiClient = apiClient; } public ApiClient getApiClient() { return apiClient; } public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } /** * Delete avatar * Deletes an avatar from a project or issue type. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * <p><b>204</b> - Returned if the request is successful. * <p><b>400</b> - Returned if the request is invalid. * <p><b>403</b> - Returned if the user does not have permission to delete the avatar, the avatar is not deletable. * <p><b>404</b> - Returned if the avatar type, associated item ID, or avatar ID is invalid. * @param type The avatar type. * @param owningObjectId The ID of the item the avatar is associated with. * @param id The ID of the avatar. * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ public Mono<Void> deleteAvatar(String type, String owningObjectId, Long id) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'type' is set if (type == null) { throw new WebClientResponseException("Missing the required parameter 'type' when calling deleteAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'owningObjectId' is set if (owningObjectId == null) { throw new WebClientResponseException("Missing the required parameter 'owningObjectId' when calling deleteAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'id' is set if (id == null) { throw new WebClientResponseException("Missing the required parameter 'id' when calling deleteAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map<String, Object> pathParams = new HashMap<String, Object>(); pathParams.put("type", type); pathParams.put("owningObjectId", owningObjectId); pathParams.put("id", id); final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>(); final String[] localVarAccepts = { }; final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; ParameterizedTypeReference<Void> localVarReturnType = new ParameterizedTypeReference<Void>() {}; return apiClient.invokeAPI("/rest/api/3/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}", HttpMethod.DELETE, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** * Get system avatars by type * Returns a list of system avatar details by owner type, where the owner types are issue type, project, or user. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None. * <p><b>200</b> - Returned if the request is successful. * <p><b>401</b> - Returned if the authentication credentials are incorrect or missing. * <p><b>500</b> - Returned if an error occurs while retrieving the list of avatars. * @param type The avatar type. * @return SystemAvatars * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ public Mono<SystemAvatars> getAllSystemAvatars(String type) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'type' is set if (type == null) { throw new WebClientResponseException("Missing the required parameter 'type' when calling getAllSystemAvatars", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map<String, Object> pathParams = new HashMap<String, Object>(); pathParams.put("type", type); final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; ParameterizedTypeReference<SystemAvatars> localVarReturnType = new ParameterizedTypeReference<SystemAvatars>() {}; return apiClient.invokeAPI("/rest/api/3/avatar/{type}/system", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** * Get avatars * Returns the system and custom avatars for a project or issue type. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * for custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the avatar belongs to. * for custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one project the issue type is used in. * for system avatars, none. * <p><b>200</b> - Returned if the request is successful. * <p><b>401</b> - Returned if the authentication credentials are incorrect or missing. * <p><b>404</b> - Returned if the avatar type is invalid, the associated item ID is missing, or the item is not found. * @param type The avatar type. * @param entityId The ID of the item the avatar is associated with. * @return Avatars * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ public Mono<Avatars> getAvatars(String type, String entityId) throws WebClientResponseException { Object postBody = null; // verify the required parameter 'type' is set if (type == null) { throw new WebClientResponseException("Missing the required parameter 'type' when calling getAvatars", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'entityId' is set if (entityId == null) { throw new WebClientResponseException("Missing the required parameter 'entityId' when calling getAvatars", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map<String, Object> pathParams = new HashMap<String, Object>(); pathParams.put("type", type); pathParams.put("entityId", entityId); final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; ParameterizedTypeReference<Avatars> localVarReturnType = new ParameterizedTypeReference<Avatars>() {}; return apiClient.invokeAPI("/rest/api/3/universal_avatar/type/{type}/owner/{entityId}", HttpMethod.GET, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } /** * Load avatar * Loads a custom avatar for a project or issue type. Specify the avatar&#39;s local file location in the body of the request. Also, include the following headers: * &#x60;X-Atlassian-Token: no-check&#x60; To prevent XSRF protection blocking the request, for more information see [Special Headers](#special-request-headers). * &#x60;Content-Type: image/image type&#x60; Valid image types are JPEG, GIF, or PNG. For example: &#x60;curl --request POST &#x60; &#x60;--user [email protected]:&lt;api_token&gt; &#x60; &#x60;--header &#39;X-Atlassian-Token: no-check&#39; &#x60; &#x60;--header &#39;Content-Type: image/&lt; image_type&gt;&#39; &#x60; &#x60;--data-binary \&quot;&lt;@/path/to/file/with/your/avatar&gt;\&quot; &#x60; &#x60;--url &#39;https://your-domain.atlassian.net/rest/api/3/universal_avatar/type/{type}/owner/{entityId}&#39;&#x60; The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of the image. The length of the square&#39;s sides is set to the smaller of the height or width of the image. The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size. After creating the avatar use: * [Update issue type](#api-rest-api-3-issuetype-id-put) to set it as the issue type&#39;s displayed avatar. * [Set project avatar](#api-rest-api-3-project-projectIdOrKey-avatar-put) to set it as the project&#39;s displayed avatar. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). * <p><b>201</b> - Returned if the request is successful. * <p><b>400</b> - Returned if: * an image isn&#39;t included in the request. * the image type is unsupported. * the crop parameters extend the crop area beyond the edge of the image. * <p><b>401</b> - Returned if the authentication credentials are incorrect or missing. * <p><b>403</b> - Returned if the user does not have the necessary permissions. * <p><b>404</b> - Returned if the avatar type is invalid, the associated item ID is missing, or the item is not found. * @param type The avatar type. * @param entityId The ID of the item the avatar is associated with. * @param size The length of each side of the crop region. * @param body The body parameter * @param x The X coordinate of the top-left corner of the crop region. * @param y The Y coordinate of the top-left corner of the crop region. * @return Avatar * @throws WebClientResponseException if an error occurs while attempting to invoke the API */ public Mono<Avatar> storeAvatar(String type, String entityId, Integer size, Object body, Integer x, Integer y) throws WebClientResponseException { Object postBody = body; // verify the required parameter 'type' is set if (type == null) { throw new WebClientResponseException("Missing the required parameter 'type' when calling storeAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'entityId' is set if (entityId == null) { throw new WebClientResponseException("Missing the required parameter 'entityId' when calling storeAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'size' is set if (size == null) { throw new WebClientResponseException("Missing the required parameter 'size' when calling storeAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // verify the required parameter 'body' is set if (body == null) { throw new WebClientResponseException("Missing the required parameter 'body' when calling storeAvatar", HttpStatus.BAD_REQUEST.value(), HttpStatus.BAD_REQUEST.getReasonPhrase(), null, null, null); } // create path and map variables final Map<String, Object> pathParams = new HashMap<String, Object>(); pathParams.put("type", type); pathParams.put("entityId", entityId); final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>(); final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "x", x)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "y", y)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "size", size)); final String[] localVarAccepts = { "application/json" }; final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "OAuth2", "basicAuth" }; ParameterizedTypeReference<Avatar> localVarReturnType = new ParameterizedTypeReference<Avatar>() {}; return apiClient.invokeAPI("/rest/api/3/universal_avatar/type/{type}/owner/{entityId}", HttpMethod.POST, pathParams, queryParams, postBody, headerParams, cookieParams, formParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } }
d301a9c385b108156e28059afa2f72f79f0e1cc5
2b28098472e781fb2d6d4802b5bb87d93d58ecfa
/o2o/src/main/java/com/o98k/o2o/exceptions/WechatAuthOperationException.java
899a5631109bf56ab0c6452f75e9aeecaecb2a65
[]
no_license
xjx794865/myRepository
083a12098142306ed0f52fd94a26bb69323bda46
f4e8b325f29b3931a9d946c3ddfe5d718e22d8d7
refs/heads/master
2020-03-28T02:49:55.190555
2018-09-12T07:54:46
2018-09-12T07:54:46
147,600,335
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
package com.o98k.o2o.exceptions; public class WechatAuthOperationException extends RuntimeException{ /** * */ private static final long serialVersionUID = -4397590552044214320L; public WechatAuthOperationException(String msg) { super(msg); } }
760523e56426b65fb7dfa7171c2e10f803769e96
96a7d93cb61cef2719fab90742e2fe1b56356d29
/selected projects/mobile/Signal-Android-4.60.5/app/src/main/java/org/thoughtcrime/securesms/lock/v2/ConfirmKbsPinRepository.java
89def2a3c4c8a039588338c4d96d085a2e264d15
[ "MIT" ]
permissive
danielogen/msc_research
cb1c0d271bd92369f56160790ee0d4f355f273be
0b6644c11c6152510707d5d6eaf3fab640b3ce7a
refs/heads/main
2023-03-22T03:59:14.408318
2021-03-04T11:54:49
2021-03-04T11:54:49
307,107,229
0
1
MIT
2021-03-04T11:54:49
2020-10-25T13:39:50
Java
UTF-8
Java
false
false
1,347
java
package org.thoughtcrime.securesms.lock.v2; import android.content.Context; import androidx.annotation.NonNull; import androidx.core.util.Consumer; import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.pin.PinState; import org.thoughtcrime.securesms.util.concurrent.SimpleTask; import org.whispersystems.signalservice.internal.contacts.crypto.UnauthenticatedResponseException; import java.io.IOException; final class ConfirmKbsPinRepository { private static final String TAG = Log.tag(ConfirmKbsPinRepository.class); void setPin(@NonNull KbsPin kbsPin, @NonNull PinKeyboardType keyboard, @NonNull Consumer<PinSetResult> resultConsumer) { Context context = ApplicationDependencies.getApplication(); String pinValue = kbsPin.toString(); SimpleTask.run(() -> { try { Log.i(TAG, "Setting pin on KBS"); PinState.onPinChangedOrCreated(context, pinValue, keyboard); Log.i(TAG, "Pin set on KBS"); return PinSetResult.SUCCESS; } catch (IOException | UnauthenticatedResponseException e) { Log.w(TAG, e); PinState.onPinCreateFailure(); return PinSetResult.FAILURE; } }, resultConsumer::accept); } enum PinSetResult { SUCCESS, FAILURE } }
b8afc25d09f0322aec094d29d39d3b68b76877e2
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.userserver2-UserServer2/sources/X/C0043Bv.java
300c50028e9edd61c6da8160664f3a94db99ff22
[]
no_license
phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959529
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
2021-04-12T12:28:09
2021-04-12T12:28:08
null
UTF-8
Java
false
false
936
java
package X; import androidx.annotation.RestrictTo; import java.lang.reflect.Constructor; import java.util.HashMap; import java.util.List; import java.util.Map; @RestrictTo({AnonymousClass2O.LIBRARY_GROUP_PREFIX}) /* renamed from: X.Bv reason: case insensitive filesystem */ public final class C0043Bv { public static Map<Class<?>, List<Constructor<? extends AbstractC0038Bn>>> A00 = new HashMap(); public static Map<Class<?>, Integer> A01 = new HashMap(); /* JADX WARNING: Code restructure failed: missing block: B:27:0x0078, code lost: if (r0.booleanValue() != false) goto L_0x007a; */ /* Code decompiled incorrectly, please refer to instructions dump. */ public static int A00(java.lang.Class<?> r9) { /* // Method dump skipped, instructions count: 276 */ throw new UnsupportedOperationException("Method not decompiled: X.C0043Bv.A00(java.lang.Class):int"); } }
f78cb73243aae4e765fdbf314b44ef97e96b4573
414ee0cd56a3063a2bf588890b8a2c3afac0d5f7
/src/Tema13/Juego.java
d5c1f179514a45e46d529ea247ec9ff68701fcde
[]
no_license
davidvega95/pan
c1b6a7a36fb036b9598444959412e81d82acd6ec
d8b730f09f7a92fa4b5bfbc026afcf0b222e23f1
refs/heads/master
2021-01-10T11:52:57.358850
2016-02-25T11:43:02
2016-02-25T11:43:02
49,571,103
0
0
null
null
null
null
UTF-8
Java
false
false
1,437
java
package Tema13; import java.util.ArrayList; import java.util.List; public class Juego { //atributos private String nombreJuego; private String categoria; private int puntuacion; private List<Usuario>listaUsuarios; public Juego(String nombreJuego, String categoria, int puntuacion, List<Usuario> listaUsuarios) { super(); this.nombreJuego = nombreJuego; this.categoria = categoria; this.puntuacion = puntuacion; this.listaUsuarios = new ArrayList<Usuario>(); } public void addUsuario(Usuario u){ this.listaUsuarios.add(u); } public boolean borrarUsuarios(String login){ for (Usuario usuario : listaUsuarios) { if(usuario.getLogin().equals(login)){ return listaUsuarios.remove(usuario); } } return false;} public void variarPuntuacion(int puntuacion){ this.puntuacion+=puntuacion; } public String getNombreJuego() { return nombreJuego; } public void setNombreJuego(String nombreJuego) { this.nombreJuego = nombreJuego; } public String getCategoria() { return categoria; } public void setCategoria(String categoria) { this.categoria = categoria; } public int getPuntuacion() { return puntuacion; } @Override public String toString() { return "Juego [nombreJuego=" + nombreJuego + ", categoria=" + categoria + ", puntuacion=" + puntuacion + ", listaUsuarios=" + listaUsuarios + "]"; } }
de689961621b99d40f3936fb5bfa92387b4b075b
83d06342dbaf2c7cd55a0a2da2cf521b8a591950
/PuyaInterpreter/Tests/testExample/TestExample17.java
30224a08dd07cc5de9420d6659c1231c3feb4463
[]
no_license
916-Socaciu-Serafim/Sem3_APM
dcf08cc70c0e5ea4bc01588c5ade5bbd4a6458dc
74b92b4234f774f7701fe5482d8f77c0e81a1646
refs/heads/master
2023-02-26T07:16:55.036314
2021-01-26T10:34:03
2021-01-26T10:34:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,224
java
package testExample; import static org.junit.jupiter.api.Assertions.*; import org.junit.*; import model.ProgramState; import model.value.IntValue; import view.AllExamples; public class TestExample17 extends TestExample { private static final String REPOSITORY_PATH = TestExample.SRC_FOLDER_PATH + "log17.in"; @BeforeClass public static void initialiseData() { TestExample.initialiseData(); AllExamples allExamples = new AllExamples(); example = allExamples.getExample17(); crtState = new ProgramState(stack, symbolTableStack, output, fileTable, heap, semaphoreTable, latchTable, barrierTable, lockTable, procedureTable, example.getStatement()); TestExample.initialiseExampleSpecificData(REPOSITORY_PATH); } @After public void clearAndCloseData() { super.clearAndCloseData(); super.clearRepositoryFile(REPOSITORY_PATH); } //"int v; for(v = 2; v > 0; v--) {fork(print(v + 23);} print(v);" @Test public void FullProgramExecution_Example17_CorrectOutput() { super.executeProgram(); assertEquals(output.size(), 2); try { assertEquals(output.get(0), new IntValue(25)); assertEquals(output.get(1), new IntValue(24)); } catch (Exception e) { fail(e.getMessage()); } } @Test public void FullProgramExecution_Example17_CorrectHeapTable() { super.executeProgram(); assertTrue(heap.isEmpty()); } @Test public void FullProgramExecution_Example17_CorrectFileTable() { super.executeProgram(); assertTrue(fileTable.isEmpty()); } // when I have multiple threads, the threadList becomes empty after the execution, so there's no way of checking each tread // crtState will always represent thread1, so we can at least check that @Test public void FullProgramExecution_Example17Thread1_EmptyStack() { super.executeProgram(); assertEquals(0, crtState.getExecutionStack().size()); } @Test public void FullProgramExecution_Example17Thread1_CorrectSymbolTable() { super.executeProgram(); assertEquals(1, symbolTable.size()); assertEquals(symbolTable.getValue("v"), new IntValue(0)); } @Test public void FullProgramExecution_Example17_EmptyThreadList() { super.executeProgram(); assertTrue(repo.getThreadList().isEmpty()); } }
69c739ed80a956dde0dbaab21dd14ad1b5a7c3ab
233292cb61a69aa78f0ddc25e5738cb7ba0a713d
/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/accordion/AccordionDownEffectOptionObject.java
cfdab323fda84f4a62e661c89790e4bac6d8d5ba
[ "MIT" ]
permissive
WiQuery/wiquery
8646f2c79cccf129d0460bf23adb8e5f6e26ad3f
34f55ef466b8d62586c98254270d0b345ee2a951
refs/heads/master
2023-08-21T13:48:53.236640
2023-06-01T08:31:41
2023-06-01T08:31:41
3,170,731
16
18
MIT
2023-06-01T08:31:42
2012-01-13T12:51:23
Java
UTF-8
Java
false
false
2,819
java
/* * Copyright (c) 2010 WiQuery team * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package org.odlabs.wiquery.ui.accordion; import org.odlabs.wiquery.core.options.IComplexOption; import org.odlabs.wiquery.core.options.Options; /** * $Id EffectOptionObject.java$ * * <p> * Complex option to store the possible options for the effect. * </p> * * @author Stephane Gleizes * @since 6.9.2 */ public class AccordionDownEffectOptionObject implements IComplexOption { // Constants /** Constant of serialization */ private static final long serialVersionUID = 3577810973198202998L; // Properties private Options options; /** * Default constructor */ public AccordionDownEffectOptionObject() { super(); options = new Options(); } @Override public CharSequence getJavascriptOption() { return options.getJavaScriptOptions(); } /** * Method retrieving the options * * @return the options */ protected Options getOptions() { return options; } /*---- Options section ---*/ /** * The duration of the effect. If omitted, the default value will be used. * * @param duration * @return the instance */ public AccordionDownEffectOptionObject setDuration(Integer duration) { options.put("duration", duration); return this; } /** * @return the duration option */ public Integer getDuration() { return options.getInt("duration"); } /** * The easing to use with the effect. If omitted, the default value will be used. * * @param easing * @return the instance */ public AccordionDownEffectOptionObject setEasing(String easing) { options.putLiteral("easing", easing); return this; } /** * @return the easing option */ public String getEasing() { return options.getLiteral("easing"); } }
8ddee4764c403e561d53fbcd4f40ca88592f5528
5e6bad233109f9bcd2773c8ef2b481e1de2af4aa
/nimaiTransaction/src/test/java/com/nimai/lc/NimaiTransactionApplicationTests.java
11a56e130a3c413ae1f48fe9d2d24cbe555041d0
[]
no_license
Dhiraj-321/API
e9706135f7e3719c152351a932ee26f0930504a9
13146a5dc7c4681fa01edb93ff6fa8a17b470efe
refs/heads/main
2023-07-13T02:02:25.559306
2021-08-13T10:20:45
2021-08-13T10:20:45
396,920,800
0
0
null
2021-08-16T18:27:24
2021-08-16T18:27:24
null
UTF-8
Java
false
false
214
java
package com.nimai.lc; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class NimaiTransactionApplicationTests { @Test void contextLoads() { } }
d40f4b6711e3c93708143130c46d2f00ad23de6f
226b0491fe0358d24bc2491349097ccb95a89aa6
/src/Arithmetic.java
da617ac37f595d3c56b35606cc4fd6d6b573b648
[]
no_license
PavelShem/Test
21dc94bffd75ddc057bfe34fb12242c843f91028
843018551c0465c220aa4bf061ec853c82c03b7b
refs/heads/master
2023-05-04T17:25:12.867408
2021-05-24T18:23:05
2021-05-24T18:23:05
370,450,015
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
public class Arithmetic { public int numOne; public int numTwo; public Arithmetic(int numOne, int numTwo){ this.numOne = numOne; this.numTwo = numTwo; } public int sumNum(){ return numOne + numTwo; } public int diff(){ return numOne - numTwo; } public int multiplication(){ return numOne * numTwo; } public int avg(){ return (numOne * numTwo) / 2; } public int minNum(){ return Math.min(numOne, numTwo); } public int maxNum(){ return Math.max(numOne, numTwo); } }
9fce84e4d1b0eea1a2f9b7df7c03e22675dd745f
5c83aa7e8525ae63c8e10d724fad549a05980290
/3 - Encapsulamento/ex1/sisbanco/ContaPoupanca.java
f0a6c6812b1135168b71042c63aef161b1201361
[]
no_license
danielbrandao/AulasPOO
9a3133c9528257cf0f3e0d7936e813fa8b053d36
922167f54f8c03090151f0125fc39f54e9900718
refs/heads/master
2021-10-12T05:44:04.323890
2021-10-01T17:10:18
2021-10-01T17:10:18
110,062,755
8
2
null
null
null
null
UTF-8
Java
false
false
520
java
package sisbanco; public class ContaPoupanca extends Conta{ private double taxaRendimento = 10; protected double getTaxaRendimento() { return taxaRendimento; } protected void setTaxaRendimento(double taxaRendimento) { this.taxaRendimento = taxaRendimento; } @Override double debitar(double valor) { return saldo -= valor; } @Override double creditar(double valor) { return saldo += valor; } double creditarRendimento() { return saldo += getTaxaRendimento(); } }
fbe00668a031794bb6e922f217550cb77500f420
b08cf3aea4de1c2033713c58faaedb796cd99039
/src/main/java/com/biblio/service/IService.java
7507a7878c08013394f8ffa3555802a1c6b57780
[]
no_license
Vlado95/UMLecommerce
96918836589e20816a8e7bf2b084ee6b33ba374f
7e2777fdf420e9adee4ad006ca7c90e4cc4fb83a
refs/heads/master
2021-01-23T12:34:57.800382
2017-06-01T13:36:35
2017-06-01T13:36:35
93,176,373
0
0
null
null
null
null
UTF-8
Java
false
false
456
java
package com.biblio.service; import java.util.List; import javax.jws.WebParam; import javax.jws.WebService; import com.biblio.entity.Metier; public interface IService<T extends Metier> { public T rechercherParId(int id); public List<T> findAll(); public List<T> chercherParString(String str); public T ajouter(T objet); public void maj(T objet); public void supprimer(int id); }
68abdcc9c68e252c6f3f41e46a2eeccef1c1fb5d
0c6332eea5afa585b26c264c8ded06e2f9606de9
/src/main/java/org/plentybugs/messenger/repository/MessageRepository.java
22b0a191e555e67b19300387f586b848c686c7e9
[]
no_license
PlentyBugs/Spring-Messenger
fd73907e68f82cc21de59bdaaaba7d5d100f1951
762d48dba5899c3f3966f61f821d7054b3eb345a
refs/heads/master
2023-04-13T16:27:18.809343
2021-04-15T17:14:57
2021-04-15T17:14:57
326,243,952
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package org.plentybugs.messenger.repository; import org.plentybugs.messenger.model.messaging.Message; import org.springframework.data.mongodb.repository.MongoRepository; import java.util.List; import java.util.Set; public interface MessageRepository extends MongoRepository<Message, String> { List<Message> findByChatId(String chatId); List<Message> findAllById(Set<String> ids); }
683712e73a897bc1b1922f343405de43467565c7
ddb1af5166a44ecf630f2e8938876210d9a48d4a
/app/src/main/java/android/seriously/com/bakingapp/utils/NetworkUtils.java
e073344020316420d50738518daf9fed2d1b519c
[]
no_license
evgeniy-sibagatullin/BakingApp
0cfafcc72f0d3f0a026270c7e5e76a3765f93813
7463431714707a0efd6a6a112f10f826e4b5f351
refs/heads/master
2020-03-09T12:30:52.285097
2018-04-13T19:38:03
2018-04-13T19:38:03
128,788,050
0
0
null
null
null
null
UTF-8
Java
false
false
4,819
java
package android.seriously.com.bakingapp.utils; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.seriously.com.bakingapp.model.Recipe; import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; import com.google.gson.Gson; import org.json.JSONArray; import org.json.JSONException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public final class NetworkUtils { private static final String LOG_TAG = NetworkUtils.class.getSimpleName(); private static final String RECIPE_LISTING_URL = "https://d17h27t6h515a5.cloudfront.net/topher/2017/May/59121517_baking/baking.json"; /* Request parameters */ private static final int READ_TIMEOUT_MILLIS = 10000; private static final int CONNECTION_TIMEOUT_MILLIS = 15000; private static final String CONNECTION_METHOD = "GET"; private NetworkUtils() { } public static boolean isConnected(Context context) { NetworkInfo activeNetworkInfo = getActiveNetworkInfo(context); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } @Nullable private static NetworkInfo getActiveNetworkInfo(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); return connectivityManager == null ? null : connectivityManager.getActiveNetworkInfo(); } public static List<Recipe> fetchRecipesData() { URL url = createUrl(RECIPE_LISTING_URL); String jsonResponse = null; try { jsonResponse = makeHttpRequest(url); } catch (IOException e) { Log.e(LOG_TAG, "Problem making the HTTP request.", e); } return extractRecipes(jsonResponse); } private static URL createUrl(String stringUrl) { URL url = null; try { url = new URL(stringUrl); } catch (MalformedURLException e) { Log.e(LOG_TAG, "Problem building the URL ", e); } return url; } private static String makeHttpRequest(URL url) throws IOException { String jsonResponse = ""; if (url == null) { return jsonResponse; } HttpURLConnection urlConnection = null; InputStream inputStream = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setReadTimeout(READ_TIMEOUT_MILLIS); urlConnection.setConnectTimeout(CONNECTION_TIMEOUT_MILLIS); urlConnection.setRequestMethod(CONNECTION_METHOD); urlConnection.connect(); if (urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) { inputStream = urlConnection.getInputStream(); jsonResponse = readFromStream(inputStream); } else { Log.e(LOG_TAG, "Error response code: " + urlConnection.getResponseCode()); } } catch (IOException e) { Log.e(LOG_TAG, "Problem retrieving the earthquake JSON results.", e); } finally { if (urlConnection != null) urlConnection.disconnect(); if (inputStream != null) inputStream.close(); } return jsonResponse; } private static String readFromStream(InputStream inputStream) throws IOException { StringBuilder output = new StringBuilder(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { output.append(line); line = reader.readLine(); } } return output.toString(); } private static List<Recipe> extractRecipes(String jsonResponse) { List<Recipe> recipes = new ArrayList<>(); if (!TextUtils.isEmpty(jsonResponse)) { Gson gson = new Gson(); try { JSONArray array = new JSONArray(jsonResponse); for (int index = 0; index < array.length(); index++) { recipes.add(gson.fromJson(array.getString(index), Recipe.class)); } } catch (JSONException e) { Log.e(LOG_TAG, "Problem extracting the recipe JSON data", e); } } return recipes; } }
9645d20ccec6eac508ca2a3cfff7a5b787695f66
557bb1b1e99e906eaa3b7869a9fee575be578f6c
/src/org/ws/DefaultSuccessObject.java
722d6d0caff78ee8742229f6ec4e9eb3308e7309
[]
no_license
vudaotuan/Fast-Taxi
877b2f6aa1550ccb3e41afd8af9a90cfef8072da
13aaf43fc4688e34a0f20857c10f09b1bff7e5a7
refs/heads/master
2020-12-24T16:42:50.548703
2014-01-13T06:44:20
2014-01-13T06:44:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package org.ws; public class DefaultSuccessObject { private boolean success; private Object payload; public DefaultSuccessObject(boolean success, Object payload) { super(); this.success = success; this.payload = payload; } public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public Object getPayload() { return payload; } public void setPayload(Object payload) { this.payload = payload; } }
98c7e31c38676853f4d2023eb55adc5524eccf86
1e27f6d09f9ab273b96cdc50a4d983ba01b7ac5b
/src/com/wande/todo/Task.java
3672a4c25dbcb1a8d7624214fed7312e40433013
[]
no_license
wandechris/ToDo
9810be09fbed212abcf67dcae50ca9a24d6d78ea
081b6a82e6100ddcdd3e5162e7520e9b5ceb265d
refs/heads/master
2020-12-24T13:44:50.146473
2013-09-13T14:02:51
2013-09-13T14:02:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.wande.todo; public class Task { private String name; private String desc; public Task(String taskName,String descc){ name = taskName; desc = descc; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } }
ad9deb90e40bb57fde4a9c5e65eb1f8f642ecb8c
2a1e90e8efd77d6922fce4c26ceb58e884d54791
/esup-pstage-domain-services/src/main/java/org/esupportail/pstage/domain/referentiel/PersonalComponentRepositoryDomainCustom.java
5d62b6b18f1ae97ed77a6495273fc1dcdd0eeb75
[ "Apache-2.0" ]
permissive
EsupPortail/esup-pstage
0bdb73679324174b4eb798fb1b8422a4ae3e7146
9d9b77abfa588d3cee2b100899c0b29f39dab695
refs/heads/master
2023-02-08T03:29:26.809279
2023-01-30T20:41:45
2023-01-30T20:45:16
6,883,237
5
7
Apache-2.0
2022-06-29T16:51:41
2012-11-27T12:50:08
XSLT
UTF-8
Java
false
false
416
java
package org.esupportail.pstage.domain.referentiel; import java.util.Map; /** * * Acces au composantes du personnel personnalise * */ public class PersonalComponentRepositoryDomainCustom implements PersonalComponentRepositoryDomain { /** * */ private static final long serialVersionUID = 1L; @Override public Map<String, String> getComposantesRef(String universityCode) { return null; } }
7e24bdfae0489c69b5c12c7ba9daa944f09ba630
3f3c6e1da2aafd535f2d7741b64f102301a2af74
/src/com/smartgwt/sample/showcase/client/draganddrop/Copy.java
34d5fce3694c40cba7883960f172cfb11ed9ce13
[]
no_license
jmgsquared214/showcase
252a5b16db3b5b05eb4b3af6991867c8933ff0b8
2611ef5be3eff9636b490826814fcf6fad5750bc
refs/heads/master
2021-04-27T21:44:05.699411
2018-02-21T23:14:41
2018-02-21T23:14:41
122,405,909
0
0
null
null
null
null
UTF-8
Java
false
false
5,691
java
package com.smartgwt.sample.showcase.client.draganddrop; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.DragDataAction; import com.smartgwt.client.types.TextMatchStyle; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.LayoutSpacer; import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.sample.showcase.client.PanelFactory; import com.smartgwt.sample.showcase.client.ShowcasePanel; public class Copy extends ShowcasePanel { private static final String DESCRIPTION = "Drag employee records into the Project Team Members list. "+ "Smart GWT recognizes that the two DataSources are linked by a <code>foreignKey</code> relationship," + " and automatically uses that relationship to populate values in the record that is added when a drop occurs. "+ "Smart GWT also populates fields based on current criteria and maps explicit "+ "<code>titleFields</code> as necessary.<br/><br/>"+ "In this example, note that Smart GWT is automatically populating all three of "+ "the fields in the \"teamMembers\" DataSource, even though none of those fields is "+ "present in the \"employees\" DataSource being dragged from. "+ "Change the \"Team for Project\" select box, then try dragging employees across. "+ "Note that the \"Project Code\" column is being correctly populated for the dropped "+ "records."; public static class Factory implements PanelFactory { private String id; public ShowcasePanel create() { Copy panel = new Copy(); id = panel.getID(); return panel; } public String getID() { return id; } public String getDescription() { return DESCRIPTION; } } public Canvas getViewPanel() { final String[] projects = {"New Costing System", "Warehousing Improvements", "Evaluate AJAX Frameworks", "Upgrade Postgres", "Online Billing"}; final String defaultProject = projects[0]; final int formHeight = 30; final ListGrid employeeList = new ListGrid(); employeeList.setDataSource(DataSource.get("employees")); employeeList.setCanDragRecordsOut(true); employeeList.setDragDataAction(DragDataAction.COPY); employeeList.setAlternateRecordStyles(true); employeeList.setAutoFetchData(true); ListGridField empIdFld1 = new ListGridField("EmployeeId"); empIdFld1.setWidth("30%"); employeeList.setFields(empIdFld1, new ListGridField("Name")); final ListGrid projectList = new ListGrid(); final DynamicForm form = new DynamicForm(); form.setHeight(formHeight); SelectItem projectSelector = new SelectItem("projectCode", "Team for Project"); projectSelector.setWrapTitle(false); projectSelector.setValueMap(projects); projectSelector.setDefaultValue(defaultProject); projectSelector.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { projectList.fetchData(form.getValuesAsCriteria()); } }); form.setFields(projectSelector); projectList.setDataSource(DataSource.get("teamMembers")); projectList.setCanAcceptDroppedRecords(true); projectList.setCanRemoveRecords(true); projectList.setAlternateRecordStyles(true); projectList.setAutoFetchData(true); projectList.setInitialCriteria(form.getValuesAsCriteria()); projectList.setAutoFetchTextMatchStyle(TextMatchStyle.EXACT); projectList.setPreventDuplicates(true); ListGridField empIdFld2 = new ListGridField("employeeId"); empIdFld2.setWidth("25%"); ListGridField empNameFld = new ListGridField("employeeName"); empNameFld.setWidth("40%"); ListGridField projectCode = new ListGridField("projectCode"); projectList.setFields(empIdFld2, empNameFld, projectCode); LayoutSpacer formSpacer = new LayoutSpacer(); formSpacer.setHeight(formHeight); VLayout leftVLayout = new VLayout(); leftVLayout.addMember(formSpacer); leftVLayout.addMember(employeeList); Img arrowImg = new Img("icons/32/arrow_right.png", 32, 32); arrowImg.setLayoutAlign(Alignment.CENTER); arrowImg.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { projectList.transferSelectedData(employeeList); } }); VLayout rightVLayout = new VLayout(); rightVLayout.addMember(form); rightVLayout.addMember(projectList); HLayout mainLayout = new HLayout(); mainLayout.addMember(leftVLayout); mainLayout.addMember(arrowImg); mainLayout.addMember(rightVLayout); return mainLayout; } public String getIntro() { return DESCRIPTION; } }
40c20bafb5cc7275db9e4fb1788d1e46219005b6
5d246b480d67c13768f3af9db3b158180ba90b6f
/src/main/java/com/mathew/example/springboot/room/services/guest/GuestDataService.java
f21f03f22076eae52ac1d2fb75cacffc938a572b
[]
no_license
mathew78george/guest-services
f6f73d4a6c50cef7a238100d2ce843d7b56b0bb6
0e29ec4fb0fb8ce0c6871bbc23675d79abe65b15
refs/heads/master
2020-03-29T16:39:17.631223
2018-09-24T15:17:46
2018-09-24T15:17:46
150,123,377
0
0
null
null
null
null
UTF-8
Java
false
false
3,511
java
package com.mathew.example.springboot.room.services.guest; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.function.Consumer; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; @Service public class GuestDataService implements ApplicationListener<ApplicationReadyEvent> { private static Map<Long, Guest> guestData = new HashMap<Long, Guest>(); public GuestDataService() { loadData(); } private void loadData() { try { File file = ResourceUtils.getFile("classpath:data.sql"); Path filePath = Paths.get(file.getPath()); BufferedReader reader = Files.newBufferedReader(filePath, StandardCharsets.US_ASCII); String line = null; long id = 1; while ((line = reader.readLine()) != null) { String dataStr = line.split("VALUES")[1]; extractGuest(dataStr, id); id++; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void extractGuest(String dataStr, long id) { StringTokenizer sTokenizer = new StringTokenizer(dataStr, ","); String lastNameTkn = sTokenizer.nextToken(); String lastName = lastNameTkn.substring(2, lastNameTkn.length() - 1); String firstNameTkn = sTokenizer.nextToken(); String firstName = firstNameTkn.substring(2, firstNameTkn.length() - 1); String emailTkn = sTokenizer.nextToken(); String emailAddress = emailTkn.substring(2, emailTkn.length() - 1); String countryTkn = sTokenizer.nextToken(); String country = countryTkn.substring(2, countryTkn.length() - 1); String addressTkn = sTokenizer.nextToken(); String address = addressTkn.substring(2, addressTkn.length() - 1); String stateTkn = sTokenizer.nextToken(); String state = stateTkn.substring(2, stateTkn.length() - 1); String phoneTkn = sTokenizer.nextToken(); String phoneNumber = phoneTkn.substring(2, phoneTkn.length() - 1); Guest guest = new Guest(); guest.setId(id); guest.setAddress(address); guest.setCountry(country); guest.setEmailAddress(emailAddress); guest.setFirstName(firstName); guest.setLastName(lastName); guest.setPhoneNumber(phoneNumber); guest.setState(state); guestData.put(id, guest); } public static void main(String[] args) { GuestDataService service = new GuestDataService(); System.out.println(service.findAll().size()); System.out.println(service.findByEmailAddress("[email protected]").getLastName()); System.out.println(service.findById(1).getLastName()); } @Override public void onApplicationEvent(ApplicationReadyEvent event) { System.out.println(event.getApplicationContext().getApplicationName()); loadData(); } public List<Guest> findAll() { return new ArrayList<>(guestData.values()); } public Guest findByEmailAddress(String emailAddress) { Guest[] target = { null }; guestData.values().forEach(new Consumer<Guest>() { public void accept(Guest g) { if (g.getEmailAddress().equals(emailAddress)) { target[0] = g; } } }); return target[0]; } public Guest findById(long Id) { return guestData.get(Id); } }
b2465aac339f5cb7088a59f7ab448d5355256041
52b948436b826df8164565ffe69e73a92eb92cda
/Tests/RGTTests/bears/patches/SzFMV2018-Tavasz-AutomatedCar_351742666-351759763/Arja/332/patch/Dashboard.java
d77f7a4b929936b7cd70a3a8c6dfbc95b7fdddb5
[]
no_license
tdurieux/ODSExperiment
910365f1388bc684e9916f46f407d36226a2b70b
3881ef06d6b8d5efb751860811def973cb0220eb
refs/heads/main
2023-07-05T21:30:30.099605
2021-08-18T15:56:56
2021-08-18T15:56:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,875
java
package hu.oe.nik.szfmv.visualization; import hu.oe.nik.szfmv.automatedcar.bus.packets.input.ReadOnlyInputPacket; import javax.swing.*; import java.awt.*; /** * Dashboard shows the state of the ego car, thus helps in debugging. */ public class Dashboard extends JPanel { private final int width = 250; private final int height = 700; private final int dashboardBoundsX = 770; private final int dashboardBoundsY = 0; private final int backgroundColor = 0x888888; private final int progressBarsPanelX = 25; private final int progressBarsPanelY = 400; private final int progressBarsPanelWidth = 200; private final int progressBarsPanelHeight = 100; private final JPanel progressBarsPanel = new JPanel(); private final JLabel gasLabel = new JLabel(); private final JProgressBar gasProgressBar = new JProgressBar(); private final JLabel breakLabel = new JLabel(); private final JProgressBar breakProgressBar = new JProgressBar(); private final int speedMeterX = 10; private final int speedMeterY = 50; private final int tachoMeterX = 130; private final int tachoMeterY = 50; private final int meterHeight = 100; private final int meterWidth = 100; private int speedAngle; private int rpmAngle; /** * Initialize the dashboard */ public Dashboard() { initializeDashboard(); } /** * Update the displayed values * @param inputPacket Contains all the required values coming from input. */ public void updateDisplayedValues(ReadOnlyInputPacket inputPacket) { gasProgressBar.setValue(inputPacket.getGasPedalPosition()); breakProgressBar.setValue(inputPacket.getBreakPedalPosition()); speedAngle = calculateSpeedometer(0); gasProgressBar.setStringPainted(true); initializeDashboard(); } /** * Initializes the dashboard components */ private void initializeDashboard() { // Not using any layout manager, but fixed coordinates setLayout(null); setBackground(new Color(backgroundColor)); setBounds(dashboardBoundsX, dashboardBoundsY, width, height); initializeProgressBars(); } /** * Initializes the progress bars on the dashboard */ private void initializeProgressBars() { progressBarsPanel.setBackground(new Color(backgroundColor)); progressBarsPanel.setBounds( progressBarsPanelX, progressBarsPanelY, progressBarsPanelWidth, progressBarsPanelHeight); gasLabel.setText("gas pedal"); breakLabel.setText("break pedal"); gasProgressBar.setStringPainted(true); breakProgressBar.setStringPainted(true); add(progressBarsPanel); progressBarsPanel.add(gasLabel); progressBarsPanel.add(gasProgressBar); progressBarsPanel.add(breakLabel); progressBarsPanel.add(breakProgressBar); } /** * Drawing the Speedometer and the Tachometer. * * @param g {@link Graphics} object that can draw to the canvas */ protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.drawOval(speedMeterX, speedMeterY, meterWidth, meterHeight); g.drawOval(tachoMeterX, tachoMeterY, meterWidth, meterHeight); g.setColor(Color.RED); g.fillArc(speedMeterX, speedMeterY, meterWidth, meterHeight, speedAngle, 2); g.fillArc(tachoMeterX, tachoMeterY, meterWidth, meterHeight, rpmAngle, 2); } /** * Map the RPM to a displayable value for the gauge. * * @param rpm The unmapped input value of the Tachometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateTachometer(int rpm) { final int minRpmValue = 0; final int maxRpmValue = 10000; final int minRpmMeter = -75; gasLabel.setText("gas pedal"); final int maxRpmMeter = 255; int newrpm = maxRpmValue - rpm; return (newrpm - minRpmValue) * (maxRpmMeter - minRpmMeter) / (maxRpmValue - minRpmValue) + minRpmMeter; } /** * Map the Speed to a displayable value for the gauge. * * @param speed The unmapped input value of the Speedometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateSpeedometer(int speed) { final int minSpeedValue = 0; final int maxSpeedValue = 500; final int minSpeedMeter = -75; final int maxSpeedMeter = 255; int newspeed = maxSpeedValue - speed; return (newspeed - minSpeedValue) * (maxSpeedMeter - minSpeedMeter) / (maxSpeedValue - minSpeedValue) + minSpeedMeter; } }
18babe3d6f375744f9d2822a2eb3e30d93abd5ab
db60d31789224ef0d16fa4c8bdc8187b54b76761
/src/ml/technikum/at/nn/DigitImageLoadingService.java
184717f5037d669af97ae15275b07e5fef98f0c6
[]
no_license
Fr0stst0rm/NeuroNet
3dfa86482b26b4ab7ad742682dfb20c041b5fe04
c50004de9ed4b2f2c4d4764f268a000e7b988445
refs/heads/master
2020-03-19T07:44:36.279412
2018-06-05T08:26:53
2018-06-05T08:26:53
136,145,005
0
0
null
null
null
null
UTF-8
Java
false
false
3,986
java
package ml.technikum.at.nn; import java.io.*; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Created by IntelliJ IDEA. * User: vivin * Date: 11/11/11 * Time: 10:07 AM */ public class DigitImageLoadingService { private String labelFileName; private String imageFileName; /** the following constants are defined as per the values described at http://yann.lecun.com/exdb/mnist/ **/ private static final int MAGIC_OFFSET = 0; private static final int OFFSET_SIZE = 4; //in bytes private static final int LABEL_MAGIC = 2049; private static final int IMAGE_MAGIC = 2051; private static final int NUMBER_ITEMS_OFFSET = 4; private static final int ITEMS_SIZE = 4; private static final int NUMBER_OF_ROWS_OFFSET = 8; private static final int ROWS_SIZE = 4; public static final int ROWS = 28; private static final int NUMBER_OF_COLUMNS_OFFSET = 12; private static final int COLUMNS_SIZE = 4; public static final int COLUMNS = 28; private static final int IMAGE_OFFSET = 16; private static final int IMAGE_SIZE = ROWS * COLUMNS; public DigitImageLoadingService(String labelFileName, String imageFileName) { this.labelFileName = labelFileName; this.imageFileName = imageFileName; } public List<DigitImage> loadDigitImages() throws IOException { List<DigitImage> images = new ArrayList<DigitImage>(); ByteArrayOutputStream labelBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream imageBuffer = new ByteArrayOutputStream(); InputStream labelInputStream = new FileInputStream(new File(labelFileName)); InputStream imageInputStream = new FileInputStream(new File(imageFileName)); int read; byte[] buffer = new byte[16384]; while((read = labelInputStream.read(buffer, 0, buffer.length)) != -1) { labelBuffer.write(buffer, 0, read); } labelBuffer.flush(); while((read = imageInputStream.read(buffer, 0, buffer.length)) != -1) { imageBuffer.write(buffer, 0, read); } imageBuffer.flush(); byte[] labelBytes = labelBuffer.toByteArray(); byte[] imageBytes = imageBuffer.toByteArray(); byte[] labelMagic = Arrays.copyOfRange(labelBytes, 0, OFFSET_SIZE); byte[] imageMagic = Arrays.copyOfRange(imageBytes, 0, OFFSET_SIZE); if(ByteBuffer.wrap(labelMagic).getInt() != LABEL_MAGIC) { throw new IOException("Bad magic number in label file!"); } if(ByteBuffer.wrap(imageMagic).getInt() != IMAGE_MAGIC) { throw new IOException("Bad magic number in image file!"); } int numberOfLabels = ByteBuffer.wrap(Arrays.copyOfRange(labelBytes, NUMBER_ITEMS_OFFSET, NUMBER_ITEMS_OFFSET + ITEMS_SIZE)).getInt(); int numberOfImages = ByteBuffer.wrap(Arrays.copyOfRange(imageBytes, NUMBER_ITEMS_OFFSET, NUMBER_ITEMS_OFFSET + ITEMS_SIZE)).getInt(); if(numberOfImages != numberOfLabels) { throw new IOException("The number of labels and images do not match!"); } int numRows = ByteBuffer.wrap(Arrays.copyOfRange(imageBytes, NUMBER_OF_ROWS_OFFSET, NUMBER_OF_ROWS_OFFSET + ROWS_SIZE)).getInt(); int numCols = ByteBuffer.wrap(Arrays.copyOfRange(imageBytes, NUMBER_OF_COLUMNS_OFFSET, NUMBER_OF_COLUMNS_OFFSET + COLUMNS_SIZE)).getInt(); if(numRows != ROWS && numRows != COLUMNS) { throw new IOException("Bad image. Rows and columns do not equal " + ROWS + "x" + COLUMNS); } for(int i = 0; i < numberOfLabels; i++) { int label = labelBytes[OFFSET_SIZE + ITEMS_SIZE + i]; byte[] imageData = Arrays.copyOfRange(imageBytes, (i * IMAGE_SIZE) + IMAGE_OFFSET, (i * IMAGE_SIZE) + IMAGE_OFFSET + IMAGE_SIZE); images.add(new DigitImage(label, imageData)); } return images; } }
e6f491beba943ab00b866d7944ebc8eb6b4f156b
9c9a7cbf37478765624d44c5b1c0ebdbc05894c4
/MenjadiAndroidDeveloperExpert/MyRecyclerView/app/src/main/java/com/digitcreativestudio/myrecyclerview/ItemClickSupport.java
535d74f5184abf4c080cd109c0cf24dfd72d3db6
[]
no_license
dzulfikar68/DicodingAndroid
c4fc9782e3c2297cdf84f70ccd51090daebb27be
2c9739949888ff3d4cf075b91c0e35cc883da007
refs/heads/master
2021-07-10T09:28:44.719960
2020-08-31T17:17:45
2020-08-31T17:17:45
193,197,559
0
0
null
null
null
null
UTF-8
Java
false
false
3,271
java
package com.digitcreativestudio.myrecyclerview; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.View; public class ItemClickSupport { private RecyclerView mRecyclerView; private OnItemClickListener mOnItemClickListener; private OnItemLongClickListener mOnItemLongClickListener; public void setOnItemClickListener(OnItemClickListener listener){ mOnItemClickListener = listener; } public void setOnItemLongClickListener(OnItemLongClickListener listener){ mOnItemLongClickListener = listener; } private View.OnClickListener mOnClickListener = new View.OnClickListener(){ @Override public void onClick(View v) { if (mOnItemClickListener != null){ RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); mOnItemClickListener.onItemClicked(mRecyclerView, holder.getAdapterPosition(), v); } } }; private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mOnItemLongClickListener != null){ RecyclerView.ViewHolder holder = mRecyclerView.getChildViewHolder(v); return mOnItemLongClickListener.onItemLongClicked(mRecyclerView, holder.getAdapterPosition(), v); } return false; } }; private RecyclerView.OnChildAttachStateChangeListener mAttachListener = new RecyclerView.OnChildAttachStateChangeListener() { @Override public void onChildViewAttachedToWindow(@NonNull View view) { if(mOnItemClickListener != null){ view.setOnClickListener(mOnClickListener); } if(mOnItemLongClickListener != null){ view.setOnLongClickListener(mOnLongClickListener); } } @Override public void onChildViewDetachedFromWindow(@NonNull View view) { } }; private ItemClickSupport(RecyclerView recyclerView){ mRecyclerView = recyclerView; mRecyclerView.setTag(R.id.item_click_support, this); mRecyclerView.addOnChildAttachStateChangeListener(mAttachListener); } public static ItemClickSupport addTo(RecyclerView view){ ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); if(support == null){ support = new ItemClickSupport(view); } return support; } public static ItemClickSupport removeFrom(RecyclerView view){ ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); if(support == null){ support.detach(view); } return support; } private void detach(RecyclerView view){ view.removeOnChildAttachStateChangeListener(mAttachListener); view.setTag(R.id.item_click_support, null); } public interface OnItemClickListener{ void onItemClicked(RecyclerView recyclerView, int position, View view); } public interface OnItemLongClickListener{ boolean onItemLongClicked(RecyclerView recyclerView, int position, View view); } }
6c03908eb3f7885ae18e203d3a891242a7aad18a
b8cb8b17ee6f771f0641962b366b381b3d1e36a8
/src/main/java/com/codewithchang/movieinfoservice/resources/MovieResource.java
b4a9c311170fb45a643c2cca1cd72a7502aa3bdf
[]
no_license
cxiong03/Movie-Info-Service
4b7a980196bb482f4baec6bccd011ad394040d98
1aabc27fcee586409048508cec4ad5144d6d9225
refs/heads/main
2023-03-18T20:59:10.729788
2021-03-04T04:20:35
2021-03-04T04:20:35
343,632,922
0
0
null
null
null
null
UTF-8
Java
false
false
535
java
package com.codewithchang.movieinfoservice.resources; import com.codewithchang.movieinfoservice.models.Movie; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/movies") public class MovieResource { @RequestMapping("/{movieId}") public Movie getMovieInfo(@PathVariable("movieId") String movieId) { return new Movie(movieId, "Test name"); } }
6dc5f4f406e69c3e364a981939cd0645c501809e
cb5f27eb6960c64542023d7382d6b917da38f0fc
/sources/com/google/android/gms/measurement/internal/zzby.java
da19e54036ea3fc5962ec1d84968aed6f63d0b6c
[]
no_license
djtwisty/ccah
a9aee5608d48448f18156dd7efc6ece4f32623a5
af89c8d3c216ec3371929436545227682e811be7
refs/heads/master
2020-04-13T05:33:08.267985
2018-12-24T13:52:39
2018-12-24T13:52:39
162,995,366
0
0
null
null
null
null
UTF-8
Java
false
false
10,564
java
package com.google.android.gms.measurement.internal; import android.os.Binder; import android.text.TextUtils; import com.google.android.gms.common.GooglePlayServicesUtilLight; import com.google.android.gms.common.GoogleSignatureVerifier; import com.google.android.gms.common.internal.Preconditions; import com.google.android.gms.common.util.UidVerifier; import com.google.android.gms.common.util.VisibleForTesting; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutionException; public final class zzby extends zzak { private final zzfo zzamv; private Boolean zzaqi; private String zzaqj; public zzby(zzfo zzfo) { this(zzfo, null); } private zzby(zzfo zzfo, String str) { Preconditions.checkNotNull(zzfo); this.zzamv = zzfo; this.zzaqj = null; } public final void zzb(zzk zzk) { zzb(zzk, false); zze(new zzbz(this, zzk)); } public final void zza(zzag zzag, zzk zzk) { Preconditions.checkNotNull(zzag); zzb(zzk, false); zze(new zzcj(this, zzag, zzk)); } @VisibleForTesting final zzag zzb(zzag zzag, zzk zzk) { Object obj = null; if (!(!"_cmp".equals(zzag.name) || zzag.zzahu == null || zzag.zzahu.size() == 0)) { CharSequence string = zzag.zzahu.getString("_cis"); if (!TextUtils.isEmpty(string) && (("referrer broadcast".equals(string) || "referrer API".equals(string)) && this.zzamv.zzgv().zzbe(zzk.packageName))) { obj = 1; } } if (obj == null) { return zzag; } this.zzamv.zzgt().zzjm().zzg("Event has been filtered ", zzag.toString()); return new zzag("_cmpx", zzag.zzahu, zzag.origin, zzag.zzaig); } public final void zza(zzag zzag, String str, String str2) { Preconditions.checkNotNull(zzag); Preconditions.checkNotEmpty(str); zzc(str, true); zze(new zzck(this, zzag, str)); } public final byte[] zza(zzag zzag, String str) { Object e; Preconditions.checkNotEmpty(str); Preconditions.checkNotNull(zzag); zzc(str, true); this.zzamv.zzgt().zzjn().zzg("Log and bundle. event", this.zzamv.zzgq().zzbt(zzag.name)); long nanoTime = this.zzamv.zzbx().nanoTime() / 1000000; try { byte[] bArr = (byte[]) this.zzamv.zzgs().zzc(new zzcl(this, zzag, str)).get(); if (bArr == null) { this.zzamv.zzgt().zzjg().zzg("Log and bundle returned null. appId", zzas.zzbw(str)); bArr = new byte[0]; } this.zzamv.zzgt().zzjn().zzd("Log and bundle processed. event, size, time_ms", this.zzamv.zzgq().zzbt(zzag.name), Integer.valueOf(bArr.length), Long.valueOf((this.zzamv.zzbx().nanoTime() / 1000000) - nanoTime)); return bArr; } catch (InterruptedException e2) { e = e2; this.zzamv.zzgt().zzjg().zzd("Failed to log and bundle. appId, event, error", zzas.zzbw(str), this.zzamv.zzgq().zzbt(zzag.name), e); return null; } catch (ExecutionException e3) { e = e3; this.zzamv.zzgt().zzjg().zzd("Failed to log and bundle. appId, event, error", zzas.zzbw(str), this.zzamv.zzgq().zzbt(zzag.name), e); return null; } } public final void zza(zzfv zzfv, zzk zzk) { Preconditions.checkNotNull(zzfv); zzb(zzk, false); if (zzfv.getValue() == null) { zze(new zzcm(this, zzfv, zzk)); } else { zze(new zzcn(this, zzfv, zzk)); } } public final List<zzfv> zza(zzk zzk, boolean z) { Object e; zzb(zzk, false); try { List<zzfx> list = (List) this.zzamv.zzgs().zzb(new zzco(this, zzk)).get(); List<zzfv> arrayList = new ArrayList(list.size()); for (zzfx zzfx : list) { if (z || !zzfy.zzcy(zzfx.name)) { arrayList.add(new zzfv(zzfx)); } } return arrayList; } catch (InterruptedException e2) { e = e2; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(zzk.packageName), e); return null; } catch (ExecutionException e3) { e = e3; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(zzk.packageName), e); return null; } } public final void zza(zzk zzk) { zzb(zzk, false); zze(new zzcp(this, zzk)); } private final void zzb(zzk zzk, boolean z) { Preconditions.checkNotNull(zzk); zzc(zzk.packageName, false); this.zzamv.zzgr().zzu(zzk.zzafi, zzk.zzafv); } private final void zzc(String str, boolean z) { boolean z2 = false; if (TextUtils.isEmpty(str)) { this.zzamv.zzgt().zzjg().zzby("Measurement Service called without app package"); throw new SecurityException("Measurement Service called without app package"); } if (z) { try { if (this.zzaqi == null) { if ("com.google.android.gms".equals(this.zzaqj) || UidVerifier.isGooglePlayServicesUid(this.zzamv.getContext(), Binder.getCallingUid()) || GoogleSignatureVerifier.getInstance(this.zzamv.getContext()).isUidGoogleSigned(Binder.getCallingUid())) { z2 = true; } this.zzaqi = Boolean.valueOf(z2); } if (this.zzaqi.booleanValue()) { return; } } catch (SecurityException e) { this.zzamv.zzgt().zzjg().zzg("Measurement Service called with invalid calling package. appId", zzas.zzbw(str)); throw e; } } if (this.zzaqj == null && GooglePlayServicesUtilLight.uidHasPackageName(this.zzamv.getContext(), Binder.getCallingUid(), str)) { this.zzaqj = str; } if (!str.equals(this.zzaqj)) { throw new SecurityException(String.format("Unknown calling package name '%s'.", new Object[]{str})); } } public final void zza(long j, String str, String str2, String str3) { zze(new zzcq(this, str2, str3, str, j)); } public final String zzc(zzk zzk) { zzb(zzk, false); return this.zzamv.zzh(zzk); } public final void zza(zzo zzo, zzk zzk) { Preconditions.checkNotNull(zzo); Preconditions.checkNotNull(zzo.zzags); zzb(zzk, false); zzo zzo2 = new zzo(zzo); zzo2.packageName = zzk.packageName; if (zzo.zzags.getValue() == null) { zze(new zzca(this, zzo2, zzk)); } else { zze(new zzcb(this, zzo2, zzk)); } } public final void zzb(zzo zzo) { Preconditions.checkNotNull(zzo); Preconditions.checkNotNull(zzo.zzags); zzc(zzo.packageName, true); zzo zzo2 = new zzo(zzo); if (zzo.zzags.getValue() == null) { zze(new zzcc(this, zzo2)); } else { zze(new zzcd(this, zzo2)); } } public final List<zzfv> zza(String str, String str2, boolean z, zzk zzk) { Object e; zzb(zzk, false); try { List<zzfx> list = (List) this.zzamv.zzgs().zzb(new zzce(this, zzk, str, str2)).get(); List<zzfv> arrayList = new ArrayList(list.size()); for (zzfx zzfx : list) { if (z || !zzfy.zzcy(zzfx.name)) { arrayList.add(new zzfv(zzfx)); } } return arrayList; } catch (InterruptedException e2) { e = e2; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(zzk.packageName), e); return Collections.emptyList(); } catch (ExecutionException e3) { e = e3; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(zzk.packageName), e); return Collections.emptyList(); } } public final List<zzfv> zza(String str, String str2, String str3, boolean z) { Object e; zzc(str, true); try { List<zzfx> list = (List) this.zzamv.zzgs().zzb(new zzcf(this, str, str2, str3)).get(); List<zzfv> arrayList = new ArrayList(list.size()); for (zzfx zzfx : list) { if (z || !zzfy.zzcy(zzfx.name)) { arrayList.add(new zzfv(zzfx)); } } return arrayList; } catch (InterruptedException e2) { e = e2; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(str), e); return Collections.emptyList(); } catch (ExecutionException e3) { e = e3; this.zzamv.zzgt().zzjg().zze("Failed to get user attributes. appId", zzas.zzbw(str), e); return Collections.emptyList(); } } public final List<zzo> zza(String str, String str2, zzk zzk) { Object e; zzb(zzk, false); try { return (List) this.zzamv.zzgs().zzb(new zzcg(this, zzk, str, str2)).get(); } catch (InterruptedException e2) { e = e2; } catch (ExecutionException e3) { e = e3; } this.zzamv.zzgt().zzjg().zzg("Failed to get conditional user properties", e); return Collections.emptyList(); } public final List<zzo> zze(String str, String str2, String str3) { Object e; zzc(str, true); try { return (List) this.zzamv.zzgs().zzb(new zzch(this, str, str2, str3)).get(); } catch (InterruptedException e2) { e = e2; } catch (ExecutionException e3) { e = e3; } this.zzamv.zzgt().zzjg().zzg("Failed to get conditional user properties", e); return Collections.emptyList(); } public final void zzd(zzk zzk) { zzc(zzk.packageName, false); zze(new zzci(this, zzk)); } @VisibleForTesting private final void zze(Runnable runnable) { Preconditions.checkNotNull(runnable); if (((Boolean) zzai.zzakn.get()).booleanValue() && this.zzamv.zzgs().zzkf()) { runnable.run(); } else { this.zzamv.zzgs().zzc(runnable); } } }
f00b93f71731205c0f874320807ce50878b6cb00
6ee5b39cb57b068e5f34d552ae522928ecd3fb03
/src/main/org/sam/jogl/gui/event/MouseEvent.java
dc54d561180d72f22f09abc5d5942736775e2947
[]
no_license
samuelalfaro/jspacewars
cb46adf8c5174c8c39c93014cdf3b8ea6a69cfe8
9faba051e0cff0953a9171c41d0b335a2fef5bd0
refs/heads/master
2021-01-10T18:45:23.166870
2013-04-09T10:59:30
2013-04-09T10:59:30
42,315,889
0
0
null
null
null
null
UTF-8
Java
false
false
3,098
java
package org.sam.jogl.gui.event; /** * A mouse event, including motion and press/release. * Mouse events will hold the absolute and local x and y * positions and often the button that is pressed. * * @author davedes * @since b.0.2 */ @SuppressWarnings( "serial" ) public class MouseEvent extends EventObject { /** An event ID for the mouse moved event. */ public static final int MOUSE_MOVED = java.awt.event.MouseEvent.MOUSE_MOVED; /** An event ID for the mouse dragged event. */ public static final int MOUSE_DRAGGED = java.awt.event.MouseEvent.MOUSE_DRAGGED; /** An event ID for the mouse pressed event. */ public static final int MOUSE_PRESSED = java.awt.event.MouseEvent.MOUSE_PRESSED; /** An event ID for the mouse entered event. */ public static final int MOUSE_ENTERED = java.awt.event.MouseEvent.MOUSE_ENTERED; /** An event ID for the mouse exited event. */ public static final int MOUSE_EXITED = java.awt.event.MouseEvent.MOUSE_EXITED; /** An event ID for the mouse released event. */ public static final int MOUSE_RELEASED = java.awt.event.MouseEvent.MOUSE_RELEASED; /** A constant for mouse button 1, index 0. */ public static final int BUTTON1 = java.awt.event.MouseEvent.BUTTON1; /** A constant for mouse button 2, index 1. */ public static final int BUTTON2 = java.awt.event.MouseEvent.BUTTON2; /** A constant for mouse button 3, index 2. */ public static final int BUTTON3 = java.awt.event.MouseEvent.BUTTON3; /** A constant for no mouse button or unknown mouse button, index -1. */ public static final int NOBUTTON = java.awt.event.MouseEvent.NOBUTTON; /** The button for this event. */ public final int button; /** The local x position for this event. */ public final float x; /** The local y position for this event. */ public final float y; /** * Creates a new mouse event with the specified params. * * @param source the source * @param id the event type id * @param button the button index or -1 if it's unknown/undefined * @param x the x position of the mouse when the event occurred * @param y the y position of the mouse when the event occurred */ public MouseEvent( Object source, int id, int button, float x, float y ){ super( source, id ); this.button = button; this.x = x; this.y = y; } /** * Creates a new mouse event with the specified params. The * old x and y values will be equal to the x and y values using * this constructor. Also, the button index will be -1, equal to * NOBUTTON. * * @param source the source * @param id the event type id * @param x the x position of the mouse when the event occurred * @param y the y position of the mouse when the event occurred */ public MouseEvent(Object source, int id, float x, float y ) { this(source, id, NOBUTTON, x, y); } }
[ "samuelalfaro@e06e3a5f-b753-0410-82a1-1b551be16263" ]
samuelalfaro@e06e3a5f-b753-0410-82a1-1b551be16263
f4c055347e2405d8b6f2334897b5d84741965634
73267be654cd1fd76cf2cb9ea3a75630d9f58a41
/services/kms/src/main/java/com/huaweicloud/sdk/kms/v2/model/ShowVersionsRequest.java
3d9dd85d5950a214c09b076497ed92b87275f63f
[ "Apache-2.0" ]
permissive
huaweicloud/huaweicloud-sdk-java-v3
51b32a451fac321a0affe2176663fed8a9cd8042
2f8543d0d037b35c2664298ba39a89cc9d8ed9a3
refs/heads/master
2023-08-29T06:50:15.642693
2023-08-24T08:34:48
2023-08-24T08:34:48
262,207,545
91
57
NOASSERTION
2023-09-08T12:24:55
2020-05-08T02:27:00
Java
UTF-8
Java
false
false
669
java
package com.huaweicloud.sdk.kms.v2.model; import java.util.Objects; /** * Request Object */ public class ShowVersionsRequest { @Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } return true; } @Override public int hashCode() { return Objects.hash(); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ShowVersionsRequest {\n"); sb.append("}"); return sb.toString(); } }
cd14a9379561d56f5cd896759f306f9fd6dc2e8c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_7e2f9e85a05554e3c04ee982e9125a5d45b48002/PathBarLayer/6_7e2f9e85a05554e3c04ee982e9125a5d45b48002_PathBarLayer_t.java
259ad36534903b7669729f1940e2ff7774dbf7fa
[]
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
11,337
java
/* * Copyright (C) 2009 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.cooliris.media; import java.util.ArrayList; import javax.microedition.khronos.opengles.GL11; import android.graphics.Typeface; import android.view.MotionEvent; import com.cooliris.app.App; import com.cooliris.app.Res; public final class PathBarLayer extends Layer { private static final StringTexture.Config sPathFormat = new StringTexture.Config(); private final ArrayList<Component> mComponents = new ArrayList<Component>(); private static final int FILL = Res.drawable.pathbar_bg; private static final int JOIN = Res.drawable.pathbar_join; private static final int CAP = Res.drawable.pathbar_cap; private Component mTouchItem = null; static { sPathFormat.fontSize = 18f * App.PIXEL_DENSITY; } public PathBarLayer() { } public void pushLabel(int icon, String label, Runnable action) { synchronized (mComponents) { mComponents.add(new Component(icon, label, action, 0)); } recomputeComponents(); } public void setAnimatedIcons(final int[] icons) { synchronized (mComponents) { final int numComponents = mComponents.size(); for (int i = 0; i < numComponents; ++i) { final Component component = mComponents.get(i); if (component != null) { if (component.animatedIcons != null) { component.animatedIcons = null; } if (i == numComponents - 1) { component.animatedIcons = icons; } } } } } public void changeLabel(String label) { if (label == null || label.length() == 0) return; Component component = popLabel(); if (component != null) { pushLabel(component.icon, label, component.action); } } public String getCurrentLabel() { final ArrayList<Component> components = mComponents; synchronized (components) { int lastIndex = components.size() - 1; if (lastIndex < 0) { return ""; } Component retVal = components.get(lastIndex); return retVal.origString; } } public Component popLabel() { final ArrayList<Component> components = mComponents; synchronized (components) { int lastIndex = components.size() - 1; if (lastIndex < 0) { return null; } Component retVal = components.get(lastIndex); components.remove(lastIndex); return retVal; } } private static final class Component { public String origString; public int icon; public Runnable action; public StringTexture texture; public float width; public float animWidth; public float x; public int[] animatedIcons; public float timeElapsed; private static final float ICON_WIDTH = 38.0f; Component(int icon, String label, Runnable action, float widthLeft) { this.action = action; origString = label; this.icon = icon; computeLabel(widthLeft); } public final void computeLabel(float widthLeft) { Typeface typeface = sPathFormat.bold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT; String label = ""; if (origString != null) { label = origString.substring(0, StringTexture.lengthToFit(sPathFormat.fontSize, widthLeft, typeface, origString)); if (label.length() != origString.length()) { label += "..."; } } this.texture = new StringTexture(label, sPathFormat); } public final boolean update(float timeElapsed) { this.timeElapsed += timeElapsed; if (animWidth == 0.0f) { animWidth = width; } animWidth = FloatUtils.animate(animWidth, width, timeElapsed); if (animatedIcons != null && animatedIcons.length > 1) return true; if (animWidth == width) { return false; } else { return true; } } public float getIconWidth() { return ICON_WIDTH * App.PIXEL_DENSITY; } } @Override public void generate(RenderView view, RenderView.Lists lists) { lists.blendedList.add(this); lists.hitTestList.add(this); lists.updateList.add(this); } private void layout() { synchronized (mComponents) { int numComponents = mComponents.size(); for (int i = 0; i < numComponents; ++i) { Component component = mComponents.get(i); if (component == null) continue; float iconWidth = (component.icon == 0) ? 0 : component.getIconWidth(); if (iconWidth == 0) { iconWidth = 8 * App.PIXEL_DENSITY; } float offset = 5 * App.PIXEL_DENSITY; float thisComponentWidth = (i != numComponents - 1) ? iconWidth + offset : component.texture.computeTextWidth() + iconWidth + offset; component.width = thisComponentWidth; } } } @Override public boolean update(RenderView view, float timeElapsed) { layout(); boolean retVal = false; synchronized (mComponents) { int numComponents = mComponents.size(); for (int i = 0; i < numComponents; i++) { Component component = mComponents.get(i); retVal |= component.update(timeElapsed); } } return retVal; } @Override public void renderBlended(RenderView view, GL11 gl) { // Draw components. final Texture fill = view.getResource(FILL); final Texture join = view.getResource(JOIN); final Texture cap = view.getResource(CAP); final float y = mY + 3; int x = (int) (3 * App.PIXEL_DENSITY); float height = mHeight; synchronized (mComponents) { int numComponents = mComponents.size(); for (int i = 0; i < numComponents; ++i) { Component component = mComponents.get(i); component.x = x; // Draw the left join if not the first component, and the fill. // TODO: Draw the pressed background for mTouchItem. final int width = (int) component.animWidth; if (i != 0) { view.draw2D(join, x - join.getWidth(), y); if (view.bind(fill)) { view.draw2D(x, y, 0f, width, height); } } else if (view.bind(fill)) { view.draw2D(0f, y, 0f, x + width, height); } if (i == numComponents - 1) { // Draw the cap on the right edge. view.draw2D(cap, x + width, y); } float xOffset = 5 * App.PIXEL_DENSITY; // Draw the label. final int[] icons = component.animatedIcons; // Cycles animated icons. final int iconId = (icons != null && icons.length > 0) ? icons[(int) (component.timeElapsed * 20.0f) % icons.length] : component.icon; final Texture icon = view.getResource(iconId); if (icon != null) { view.loadTexture(icon); view.draw2D(icon, x + xOffset, y - 2 * App.PIXEL_DENSITY); } if (i == numComponents - 1) { final StringTexture texture = component.texture; view.loadTexture(texture); float iconWidth = component.getIconWidth(); if (texture.computeTextWidth() <= (width - iconWidth)) { float textOffset = (iconWidth == 0) ? 8 * App.PIXEL_DENSITY : iconWidth; view.draw2D(texture, x + textOffset, y + 5); } } x += (int) (width + (21 * App.PIXEL_DENSITY + 0.5f)); } } } private Component hitTestItems(float x, float y) { if (y >= mY && y < mY + mHeight) { synchronized (mComponents) { int numComponents = mComponents.size(); for (int i = 0; i < numComponents; i++) { final Component component = mComponents.get(i); float componentx = component.x; if (x >= componentx && x < componentx + component.width) { return component; } } } } return null; } @Override public boolean onTouchEvent(MotionEvent event) { final float x = event.getX(); final float y = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mTouchItem = hitTestItems(x, y); break; case MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP: if (mTouchItem != null) { mTouchItem.action.run(); } case MotionEvent.ACTION_CANCEL: mTouchItem = null; break; } return true; } public void recomputeComponents() { float width = mWidth; width -= 20f * App.PIXEL_DENSITY; synchronized (mComponents) { int numComponents = mComponents.size(); for (int i = 0; i < numComponents; i++) { Component component = mComponents.get(i); if (component != null) { width -= (component.getIconWidth() + 20.0f * App.PIXEL_DENSITY); component.computeLabel(width); } } } } public int getNumLevels() { synchronized (mComponents) { return mComponents.size(); } } public void clear() { synchronized (mComponents) { mComponents.clear(); } } }
f2e2b704f8ed135b113e0fdcd264b4da8cb02fd1
a5d13ddae087e4487fe0f88938fbe4f4216960ec
/src/ita/project4/main/vo/VoOrder.java
544846000b14d0f1e1d6034705b2ec1552aea846
[]
no_license
chenhaoxian/ita_project4
7dd6eae676c3606fca46a3244082286e72dc4c8a
161197539da62d045b469d5b0bb9d580544128cc
refs/heads/master
2021-01-09T20:32:17.606483
2016-08-14T14:13:34
2016-08-14T14:13:34
65,131,943
0
0
null
2016-08-14T15:26:02
2016-08-07T12:26:00
CSS
UTF-8
Java
false
false
2,659
java
package ita.project4.main.vo; import java.util.Date; import java.util.List; public class VoOrder { private Integer oId; private Integer cId; private Integer mId; private String foodInfo; private Integer oStatus;// 状态 private Date startTime;// 下单时间 private Date confirmTime;// 接单时间 private Date finishTime;// 确认时间 private Double oStark;// 订单评分 private String complaint;// 投诉 private List<VoFood> foodList; public List<VoFood> getFoodList() { return foodList; } public void setFoodList(List<VoFood> foodList) { this.foodList = foodList; } public Integer getoId() { return oId; } public void setoId(Integer oId) { this.oId = oId; } public Integer getcId() { return cId; } public void setcId(Integer cId) { this.cId = cId; } public Integer getmId() { return mId; } public void setmId(Integer mId) { this.mId = mId; } public Integer getoStatus() { return oStatus; } public void setoStatus(Integer oStatus) { this.oStatus = oStatus; } public Date getStartTime() { return startTime; } public void setStartTime(Date startTime) { this.startTime = startTime; } public Date getConfirmTime() { return confirmTime; } public void setConfirmTime(Date confirmTime) { this.confirmTime = confirmTime; } public Date getFinishTime() { return finishTime; } public void setFinishTime(Date finishTime) { this.finishTime = finishTime; } public Double getoStark() { return oStark; } public void setoStark(Double oStark) { this.oStark = oStark; } public String getComplaint() { return complaint; } public void setComplaint(String complaint) { this.complaint = complaint; } public VoOrder() { super(); } public String getFoodInfo() { return foodInfo; } public void setFoodInfo(String foodInfo) { this.foodInfo = foodInfo; } @Override public String toString() { return "VoOrder [oId=" + oId + ", cId=" + cId + ", mId=" + mId + ", foodInfo=" + foodInfo + ", oStatus=" + oStatus + ", startTime=" + startTime + ", confirmTime=" + confirmTime + ", finishTime=" + finishTime + ", oStark=" + oStark + ", complaint=" + complaint + ", foodList=" + foodList + "]"; } public VoOrder(Integer oId, Integer cId, Integer mId, String foodInfo, Integer oStatus, Date startTime, Date confirmTime, Date finishTime, Double oStark, String complaint) { super(); this.oId = oId; this.cId = cId; this.mId = mId; this.foodInfo = foodInfo; this.oStatus = oStatus; this.startTime = startTime; this.confirmTime = confirmTime; this.finishTime = finishTime; this.oStark = oStark; this.complaint = complaint; } }
8f84c163170b5c7f964936287367d479ff3f8981
222ee914be5e1ed9129f3eb8b48f073a00155a57
/app/src/main/java/com/leokomarov/jamstreamer/discography/albums/AlbumsPresenter.java
ef0d68ba4ccecd2538cbd5a80f2e28ee5d2ad295
[ "MIT" ]
permissive
nd9600/jamstreamer
5d1c9b5a5a91da5780c3bebbf57d06899291d03c
ab71632a1742829b3e84eb8c79ad04a835f4107c
refs/heads/master
2020-05-22T01:11:27.342634
2016-09-10T14:32:08
2016-09-10T14:32:14
65,815,127
0
0
null
null
null
null
UTF-8
Java
false
false
11,845
java
package com.leokomarov.jamstreamer.discography.albums; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.CheckBox; import android.widget.Toast; import com.leokomarov.jamstreamer.R; import com.leokomarov.jamstreamer.common.ListInteractor; import com.leokomarov.jamstreamer.common.TrackModel; import com.leokomarov.jamstreamer.discography.tracks.TracksActivity; import com.leokomarov.jamstreamer.utils.ComplexPreferences; import com.leokomarov.jamstreamer.utils.GeneralUtils; import com.leokomarov.jamstreamer.utils.JSONParser; import com.leokomarov.jamstreamer.utils.TracklistUtils; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Locale; public class AlbumsPresenter implements JSONParser.CallbackInterface { private Context context; private AlbumsActivity activity; private ListInteractor interactor; private ComplexPreferences trackPreferences; private SharedPreferences sharedPreferences; private JSONArray results; private ArrayList<HashMap<String, String>> albumList = new ArrayList<>(); private ArrayList<HashMap<String, String>> tracklist = new ArrayList<>(); private int albumsToAddLoop = 0; private int onTrackRequestCompletedLoop = 0; private String requestType; public AlbumsPresenter(Context context, AlbumsActivity activity, ListInteractor listInteractor){ this.context = context; this.activity = activity; this.interactor = listInteractor; this.trackPreferences = ComplexPreferences.getComplexPreferences(context, context.getString(R.string.trackPreferences), Context.MODE_PRIVATE); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); } public List<TrackModel> getListData(){ return interactor.getListData(); } //Sets the data used to generate the listview public void setListData(ArrayList<HashMap<String, String>> listData) { interactor.setListData(listData); } public void populateList(Intent intent){ String hierarchy = sharedPreferences.getString("hierarchy", "none"); String searchTerm = ""; String unformattedURL = ""; switch (hierarchy) { case "artists": searchTerm = intent.getStringExtra(context.getString(R.string.TAG_ARTIST_ID)); unformattedURL = context.getString(R.string.albumsByArtistIDJSONURL); break; case "albums": case "tracks": searchTerm = intent.getStringExtra(context.getString(R.string.TAG_ALBUM_NAME)); unformattedURL = context.getString(R.string.albumsByNameJSONURL); break; case "tracksFloatingMenuArtist": case "albumsFloatingMenuArtist": case "playlistFloatingMenuArtist": searchTerm = intent.getStringExtra(context.getString(R.string.TAG_ARTIST_NAME)); unformattedURL = context.getString(R.string.albumsByArtistNameJSONURL); break; } requestType = "album"; String url = String.format(unformattedURL, searchTerm).replace("&amp;", "&").replace(" ", "+"); JSONParser albumParser = new JSONParser(this); albumParser.execute(url); } public void listviewOnClick(int position){ GeneralUtils.putHierarchy(context, "albums"); String albumID = albumList.get(position - 1).get("albumID"); Intent intent = new Intent(context, TracksActivity.class); intent.putExtra(context.getString(R.string.TAG_ALBUM_ID), albumID); activity.startNewActivity(intent, 2); } public boolean onContextItemSelected(MenuItem item){ AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); View viewClicked = info.targetView; int indexPosition = info.position - 1; int menuID = item.getItemId(); if (menuID == R.id.albums_floating_menu_selectAlbum){ activity.listAdapter.selectAllPressed = false; CheckBox checkbox = (CheckBox) viewClicked.findViewById(R.id.albums_checkbox); checkbox.setChecked(! checkbox.isChecked()); activity.callActionBar(activity.listAdapter.tickedCheckboxCounter); return true; } else if (menuID == R.id.albums_floating_menu_viewArtist) { GeneralUtils.putHierarchy(context, "albumsFloatingMenuArtist"); String artistName = albumList.get(indexPosition).get("albumArtist"); Intent artistsIntent = new Intent(context, AlbumsActivity.class); artistsIntent.putExtra(context.getString(R.string.TAG_ARTIST_NAME), artistName); activity.startNewActivity(artistsIntent, 3); return true; } else { return false; } } public void addAlbumToPlaylist(int numberOfAlbums){ activity.listAdapter.selectAllPressed = false; albumsToAddLoop = 0; onTrackRequestCompletedLoop = 0; for (int i = 0; i < numberOfAlbums; i++){ if (activity.listAdapter.listOfCheckboxes.get(i, false)) { albumsToAddLoop++; String albumID = albumList.get(i).get("albumID"); String unformattedURL = context.getString(R.string.tracksByAlbumIDJSONURL); String url = String.format(unformattedURL, albumID).replace("&amp;", "&"); Toast.makeText(context, String.format("Adding album #%s", albumsToAddLoop), Toast.LENGTH_SHORT).show(); requestType = "track"; JSONParser trackParser = new JSONParser(this); trackParser.execute(url); } } } @Override public void onRequestCompleted(JSONObject json) { if (requestType.equals("album")){ albumRequest(json); } else if (requestType.equals("track")){ trackRequest(json); } } public void albumRequest(JSONObject json) { try { results = json.getJSONArray(context.getString(R.string.TAG_RESULTS)); String hierarchy = sharedPreferences.getString("hierarchy", "none"); switch (hierarchy) { case "artists": case "albumsFloatingMenuArtist": case "tracksFloatingMenuArtist": case "playlistFloatingMenuArtist": for (int i = 0; i < results.length(); i++) { JSONArray albumsArray = results.getJSONObject(i).getJSONArray(context.getString(R.string.TAG_ALBUMS)); String artistName = results.getJSONObject(i).getString(context.getString(R.string.TAG_ARTIST_NAME)); for (int j = 0; j < albumsArray.length(); j++) { JSONObject albumInfo = albumsArray.getJSONObject(j); HashMap<String, String> map = new HashMap<>(); String albumName = albumInfo.getString(context.getString(R.string.TAG_ALBUM_NAME)); String albumID = albumInfo.getString(context.getString(R.string.TAG_ALBUM_ID)); map.put("albumArtist", artistName); map.put("albumName", albumName); map.put("albumID", albumID); albumList.add(map); } } break; case "albums": for (int i = 0; i < results.length(); i++) { JSONObject albumInfo = results.getJSONObject(i); HashMap<String, String> map = new HashMap<>(); String artistName = albumInfo.getString(context.getString(R.string.TAG_ARTIST_NAME_LITERAL)); String albumName = albumInfo.getString(context.getString(R.string.TAG_ALBUM_NAME)); String albumID = albumInfo.getString(context.getString(R.string.TAG_ALBUM_ID)); map.put("albumArtist", artistName); map.put("albumName", albumName); map.put("albumID", albumID); albumList.add(map); } break; } } catch (Exception e) { Log.e("albumRequest", "Exception: " + e.getMessage()); } if (json == null || json.isNull("results")) { Toast.makeText(context, "Please retry, there has been an error downloading the album list", Toast.LENGTH_SHORT).show(); } else if (json.has("results") && albumList.isEmpty()){ Toast.makeText(context, "There are no albums matching this search", Toast.LENGTH_SHORT).show(); } else { setListData(albumList); activity.setUpListview(); } } public void trackRequest(JSONObject json) { try { JSONArray results = json.getJSONArray(context.getString(R.string.TAG_RESULTS)); onTrackRequestCompletedLoop++; for(int i = 0; i < results.length(); i++) { JSONArray tracksArray = results.getJSONObject(i).getJSONArray("tracks"); String artistName = results.getJSONObject(i).getString(context.getString(R.string.TAG_ARTIST_NAME_LITERAL)); String albumName = results.getJSONObject(i).getString(context.getString(R.string.TAG_ALBUM_NAME)); for(int j = 0; j < tracksArray.length(); j++) { JSONObject trackInfo = tracksArray.getJSONObject(j); String trackID = trackInfo.getString(context.getString(R.string.TAG_TRACK_ID)); String trackName = trackInfo.getString(context.getString(R.string.TAG_TRACK_NAME)); long durationLong = Long.valueOf(trackInfo.getString(context.getString(R.string.TAG_TRACK_DURATION))); String trackDuration = String.format(Locale.US, "%d:%02d", durationLong / 60,durationLong % 60); HashMap<String, String> trackMap = new HashMap<>(); trackMap.put("trackID", trackID); trackMap.put("trackName", trackName); trackMap.put("trackDuration", trackDuration); trackMap.put("trackArtist", artistName); trackMap.put("trackAlbum", albumName); tracklist.add(trackMap); } } if (onTrackRequestCompletedLoop == albumsToAddLoop){ ArrayList<HashMap<String, String>> newTrackList = new ArrayList<>(); newTrackList.addAll(TracklistUtils.restoreTracklist(trackPreferences)); newTrackList.addAll(tracklist); new TracklistUtils().execute(trackPreferences, newTrackList); TracklistUtils.updateTracklist(trackPreferences, sharedPreferences, newTrackList); activity.setPlaylistButtonClickable(true); if (albumsToAddLoop == 1){ Toast.makeText(context,"1 album added to the playlist", Toast.LENGTH_LONG).show(); } else if(albumsToAddLoop >= 2){ Toast.makeText(context,albumsToAddLoop + " albums added to the playlist", Toast.LENGTH_LONG).show(); } } } catch (Exception e) { Log.e("trackRequest", "Exception: " + e.getMessage()); } } }
84c9f216c902b8ea1f761b08024de17dad29b23b
4bb5d5c26eb269d77578445ff1c7477bb646ad4e
/src/com/docblades/opsys/assignment1/Interfaces/IJob.java
e3dad36623e72127b2aa07f7e9301f5d889bb948
[]
no_license
docblades/Operating-Systems-Project
d17dae0536d3b18c44ae18cfb84316b037b96336
9c86587451d8c75a04d8630f84367ef8000611f2
refs/heads/master
2021-01-21T10:13:24.952390
2011-11-30T01:50:36
2011-11-30T01:50:36
2,263,672
0
0
null
null
null
null
UTF-8
Java
false
false
80
java
package com.docblades.opsys.assignment1.Interfaces; public interface IJob { }
8bbc12d83b1b80353b871559815d507b12feaaf2
984abc2f8cceb800a10ccda422af971f6ff4c932
/src/java/beans/LoginBean.java
0eee4bf3a1f2436a2909c2f9a4fdfc4f2d3529a5
[]
no_license
wingersoftprojects/pwfms
5d27891d373ad35b783146858fb750ace740d508
495c555fe25f90a90721fc2fcada1c451ac58a1c
refs/heads/master
2020-04-06T03:37:57.382876
2016-08-11T20:42:22
2016-08-11T20:42:22
63,580,803
0
0
null
null
null
null
UTF-8
Java
false
false
6,089
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 beans; import pwfms.Group_right; import pwfms.User_detail; import java.io.Serializable; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.faces.application.ConfigurableNavigationHandler; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; import org.orm.PersistentException; import pwfms.Company; import utilities.Security; /** * * @author bajuna */ @ManagedBean @SessionScoped public class LoginBean implements Serializable { private String username; private String password; private boolean isloggedin = false; private String action = "login"; private String messageString = ""; private User_detail user_detail; private List<Group_right> group_rights; private Company company; public LoginBean() { } public String getAction() { return action; } public void setAction(String action) { this.action = action; } public boolean isIsloggedin() { return isloggedin; } public void setIsloggedin(boolean isloggedin) { this.isloggedin = isloggedin; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public void login() { user_detail = null; company=null; try { company=Company.getCompanyByORMID(1); } catch (PersistentException ex) { Logger.getLogger(LoginBean.class.getName()).log(Level.SEVERE, null, ex); } setIsloggedin(false); try { user_detail = User_detail.loadUser_detailByQuery("is_active=1 and user_name='" + username + "'", null); } catch (PersistentException ex) { Logger.getLogger(LoginBean.class.getName()).log(Level.SEVERE, null, ex); } catch (Exception ex) { Logger.getLogger(LoginBean.class.getName()).log(Level.SEVERE, null, ex); } if (user_detail != null) { if (Security.Decrypt(user_detail.getUser_password()).equals(password)) { setIsloggedin(true); } else { setIsloggedin(false); } } else { setIsloggedin(false); } //get group_rights for this User try { this.setGroup_rights(new Group_rightBean().getActiveGroup_rightListByUser(user_detail)); } catch (NullPointerException npe) { this.setGroup_rights(null); } if (isloggedin) { setIsloggedin(true); messageString = ""; //return "home?faces-redirect=true"; FacesContext fc = FacesContext.getCurrentInstance(); ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler(); nav.performNavigation("home?faces-redirect=true"); } else { messageString = "Invalid Login Details Submitted!"; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("pwfms Login Failure", messageString)); //return "login?faces-redirect=true"; } } public boolean IsAllowed(String function_name, String role) { try { return new Group_rightBean().IsUserGroupsFormAccessAllowed(this.getUser_detail(), this.getGroup_rights(), function_name, role) != 0; } catch (Exception ex) { ex.printStackTrace(); return false; } } public String getMessageString() { return messageString; } public void setMessageString(String messageString) { this.messageString = messageString; } public String logout() { setUsername(""); setPassword(""); setIsloggedin(false); prelogout(); return "login?faces-redirect=true"; } private void prelogout() { FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); } public void redirectifnotloggedin() { if (!isloggedin) { logout(); FacesContext fc = FacesContext.getCurrentInstance(); ConfigurableNavigationHandler nav = (ConfigurableNavigationHandler) fc.getApplication().getNavigationHandler(); nav.performNavigation("login?faces-redirect=true"); } } public void saveMessage() { FacesContext context = FacesContext.getCurrentInstance(); context.addMessage(null, new FacesMessage("Completed successfully", "Completed successfully")); } /** * @return the user_detail */ public User_detail getUser_detail() { return user_detail; } /** * @param user_detail the user_detail to set */ public void setUser_detail(User_detail user_detail) { this.user_detail = user_detail; } /** * @return the group_rights */ public List<Group_right> getGroup_rights() { return group_rights; } /** * @param group_rights the group_rights to set */ public void setGroup_rights(List<Group_right> group_rights) { this.group_rights = group_rights; } /** * @return the company */ public Company getCompany() { return company; } /** * @param company the company to set */ public void setCompany(Company company) { this.company = company; } }
0977d5fe27fae575c72cf8741f76bbcdff0cd4cc
5723e0a39cd2207ad74e863e3d710b85f06d0b32
/src/main/java/be/vdab/domain/Jaar.java
0e006efd01d739cc132230e02f39c6e4cd6cfa6d
[]
no_license
DoganHaluk/theorie
7ca8bf5e5497c1930a35caed2a55e725dee958ff
63b398941ca11668ae4e513a498a03901befa58b
refs/heads/master
2023-03-17T03:17:47.181109
2021-03-05T18:24:33
2021-03-05T18:24:33
340,291,455
0
0
null
null
null
null
UTF-8
Java
false
false
629
java
package be.vdab.domain; public class Jaar { private final int jaar; public Jaar(int jaar) { this.jaar = jaar; } public boolean isSchrikkeljaar() { return jaar % 4 == 0 && jaar % 100 != 0 || jaar % 400 == 0; } @Override public String toString() { return String.valueOf(jaar); } @Override public boolean equals(Object object) { if (object instanceof Jaar) { var anderJaar = (Jaar) object; return jaar == anderJaar.jaar; } return false; } @Override public int hashCode() { return jaar; } }
0526f3840090a2da6bea9308c48661fe46dcee45
c885ef92397be9d54b87741f01557f61d3f794f3
/results/Math-9/org.apache.commons.math3.geometry.euclidean.threed.Line/BBC-F0-opt-90/tests/20/org/apache/commons/math3/geometry/euclidean/threed/Line_ESTest.java
4bf02c377b145e6c49383683f2bd04b54643c8ca
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
27,909
java
/* * This file was automatically generated by EvoSuite * Thu Oct 21 13:26:10 GMT 2021 */ package org.apache.commons.math3.geometry.euclidean.threed; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.apache.commons.math3.geometry.Vector; import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D; import org.apache.commons.math3.geometry.euclidean.oned.Vector1D; import org.apache.commons.math3.geometry.euclidean.threed.Euclidean3D; import org.apache.commons.math3.geometry.euclidean.threed.Line; import org.apache.commons.math3.geometry.euclidean.threed.SubLine; import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class Line_ESTest extends Line_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D1); Line line1 = new Line(line0); double double0 = line1.distance(line0); assertEquals(Double.NaN, double0, 0.01); } @Test(timeout = 4000) public void test01() throws Throwable { Vector3D vector3D0 = new Vector3D(0.0, 0.0, 1.0E-10); Vector3D vector3D1 = Vector3D.MINUS_J; Vector3D vector3D2 = vector3D1.negate(); Line line0 = new Line(vector3D1, vector3D2); boolean boolean0 = line0.contains(vector3D0); assertFalse(boolean0); } @Test(timeout = 4000) public void test02() throws Throwable { Vector3D vector3D0 = new Vector3D(0.0, 0.0, 1.0E-10); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = vector3D1.negate(); Line line1 = new Line(vector3D1, vector3D2); boolean boolean0 = line0.isSimilarTo(line1); assertFalse(boolean0); } @Test(timeout = 4000) public void test03() throws Throwable { Vector3D vector3D0 = Vector3D.POSITIVE_INFINITY; Vector3D vector3D1 = new Vector3D((-308.0311462605), (-308.0311462605), (-308.0311462605)); Vector3D vector3D2 = Vector3D.MINUS_J; Line line0 = new Line(vector3D2, vector3D1); Vector1D vector1D0 = line0.toSubSpace(vector3D0); assertEquals(Double.NEGATIVE_INFINITY, vector1D0.getX(), 0.01); } @Test(timeout = 4000) public void test04() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); Vector1D vector1D0 = line0.toSubSpace(vector3D0); Vector3D vector3D1 = line0.toSpace(vector1D0); assertTrue(vector3D1.isNaN()); } @Test(timeout = 4000) public void test05() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = vector3D0.negate(); Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getOrigin(); Vector1D vector1D0 = line0.toSubSpace(vector3D2); Vector3D vector3D3 = line0.toSpace(vector1D0); assertEquals(0.0, vector3D3.getNormSq(), 0.01); } @Test(timeout = 4000) public void test06() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector1D vector1D0 = line0.toSubSpace(vector3D0); Vector3D vector3D2 = line0.toSpace(vector1D0); assertEquals((-2673.983813013112), vector1D0.getX(), 0.01); assertEquals(2673.9840000000004, vector3D2.getNormInf(), 0.01); } @Test(timeout = 4000) public void test07() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector1D vector1D0 = line0.toSubSpace(vector3D1); Vector3D vector3D2 = line0.toSpace(vector1D0); assertEquals(3.7397378962460165E-4, vector1D0.getX(), 0.01); assertEquals(1.0, vector3D2.getNorm1(), 0.01); } @Test(timeout = 4000) public void test08() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector1D vector1D0 = Vector1D.NEGATIVE_INFINITY; Vector3D vector3D2 = line0.toSpace(vector1D0); assertEquals(2.356194490192345, vector3D2.getAlpha(), 0.01); } @Test(timeout = 4000) public void test09() throws Throwable { Vector3D vector3D0 = Vector3D.ZERO; Vector3D vector3D1 = new Vector3D(3.835743742530706E-5, (-1667.058686254416), 3.141592653489793); Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.pointAt(Double.POSITIVE_INFINITY); assertEquals(Double.POSITIVE_INFINITY, vector3D2.getZ(), 0.01); } @Test(timeout = 4000) public void test10() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); Vector3D vector3D1 = line0.pointAt((-1974.8847)); assertFalse(vector3D1.isInfinite()); } @Test(timeout = 4000) public void test11() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.pointAt(0.0); assertEquals(0.0, vector3D2.getAlpha(), 0.01); } @Test(timeout = 4000) public void test12() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = line0.pointAt(1349.277988933); assertEquals((-3.6716313198717466E-4), vector3D2.getDelta(), 0.01); } @Test(timeout = 4000) public void test13() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.pointAt(1349.277988933); assertEquals(1349.2775206066553, vector3D2.getNormInf(), 0.01); } @Test(timeout = 4000) public void test14() throws Throwable { Vector3D vector3D0 = new Vector3D(0.041666666666666664, 160.46069265, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getDirection(); Line line1 = new Line(vector3D0, vector3D2); Vector3D vector3D3 = line0.intersection(line1); assertEquals(25747.6356219445, vector3D3.getNormSq(), 0.01); assertNotNull(vector3D3); } @Test(timeout = 4000) public void test15() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = Vector3D.MINUS_K; Line line1 = new Line(vector3D1, vector3D2); Vector3D vector3D3 = line0.intersection(line1); assertNotNull(vector3D3); assertEquals((-1.5707963267948966), vector3D3.getAlpha(), 0.01); } @Test(timeout = 4000) public void test16() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = new Vector3D(0.0, vector3D0, (-3149.9825), vector3D0, 914.39693745342, vector3D0, 95.82313, vector3D0); Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = Vector3D.crossProduct(vector3D0, vector3D0); Line line1 = new Line(vector3D1, vector3D2); Vector3D vector3D3 = line1.intersection(line0); assertNotNull(vector3D3); assertEquals(0.0, vector3D3.getNorm(), 0.01); } @Test(timeout = 4000) public void test17() throws Throwable { Vector3D vector3D0 = new Vector3D(0.041666666666666664, 160.46069265, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.intersection(line0); assertNotNull(vector3D2); assertEquals(1.6182087190415768E-6, vector3D2.getX(), 0.01); } @Test(timeout = 4000) public void test18() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getOrigin(); assertEquals(Double.NaN, vector3D2.getDelta(), 0.01); } @Test(timeout = 4000) public void test19() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getOrigin(); assertEquals((-1.5704223529965249), vector3D2.getDelta(), 0.01); } @Test(timeout = 4000) public void test20() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = Vector3D.MINUS_I; line0.reset(vector3D0, vector3D2); Vector3D vector3D3 = line0.getOrigin(); assertEquals(6.934554174370962E-27, vector3D3.getNormSq(), 0.01); } @Test(timeout = 4000) public void test21() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); Vector3D vector3D1 = line0.getDirection(); assertEquals(Double.NaN, vector3D1.getZ(), 0.01); } @Test(timeout = 4000) public void test22() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getDirection(); assertEquals((-3.7397378969799373E-4), vector3D2.getZ(), 0.01); } @Test(timeout = 4000) public void test23() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = new Vector3D((-987.9936705230618), vector3D0, 0.0, vector3D0, 1.7976931348623157E308, vector3D0); Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getDirection(); assertEquals(3.141592653589793, vector3D2.getAlpha(), 0.01); } @Test(timeout = 4000) public void test24() throws Throwable { Vector3D vector3D0 = Vector3D.ZERO; Vector3D vector3D1 = Vector3D.MINUS_I; Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = line0.getDirection(); assertEquals(1.0, vector3D2.getX(), 0.01); } @Test(timeout = 4000) public void test25() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); double double0 = line0.getAbscissa(vector3D1); assertEquals(0.0, double0, 0.01); } @Test(timeout = 4000) public void test26() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); double double0 = line0.getAbscissa(vector3D0); assertEquals((-2673.983813013112), double0, 0.01); } @Test(timeout = 4000) public void test27() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); double double0 = line0.distance(vector3D1); assertEquals(0.0, double0, 0.01); } @Test(timeout = 4000) public void test28() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Line line1 = new Line(vector3D1, vector3D0); double double0 = line0.distance(line1); assertEquals(4.5324665183683945E-17, double0, 0.01); } @Test(timeout = 4000) public void test29() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = line0.closestPoint(line0); assertEquals(0.0, vector3D2.getNorm(), 0.01); } @Test(timeout = 4000) public void test30() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.closestPoint(line0); assertEquals((-1.5704223529965549), vector3D2.getAlpha(), 0.01); } @Test(timeout = 4000) public void test31() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.closestPoint(line0); assertEquals(0.9999998601436046, vector3D2.getNormSq(), 0.01); } @Test(timeout = 4000) public void test32() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); // Undeclared exception! try { line0.toSubSpace((Vector<Euclidean3D>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test33() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); // Undeclared exception! try { line0.toSpace((Vector<Euclidean1D>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test34() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = new Vector3D(3862.40885, vector3D1, 3862.40885, vector3D0, (-1.7976931348623157E308), vector3D0, (-1113.0230856231071), vector3D1); line0.reset(vector3D0, vector3D2); // Undeclared exception! try { line0.revert(); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // zero norm // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test35() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D1); // Undeclared exception! try { line0.reset((Vector3D) null, vector3D1); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Vector3D", e); } } @Test(timeout = 4000) public void test36() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = new Vector3D((-987.9936705230618), vector3D1, 0.0, vector3D0, 1.7976931348623157E308, vector3D0); Line line1 = new Line(vector3D0, vector3D2); // Undeclared exception! try { line0.isSimilarTo(line1); fail("Expecting exception: ArithmeticException"); } catch(ArithmeticException e) { // // zero norm // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Vector3D", e); } } @Test(timeout = 4000) public void test37() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); // Undeclared exception! try { line0.isSimilarTo((Line) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test38() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); // Undeclared exception! try { line0.intersection((Line) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test39() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D1); // Undeclared exception! try { line0.getAbscissa((Vector3D) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test40() throws Throwable { Vector3D vector3D0 = Vector3D.POSITIVE_INFINITY; Line line0 = new Line(vector3D0, vector3D0); // Undeclared exception! try { line0.distance((Vector3D) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test41() throws Throwable { Vector3D vector3D0 = Vector3D.POSITIVE_INFINITY; Line line0 = new Line(vector3D0, vector3D0); // Undeclared exception! try { line0.distance((Line) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test42() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D1); // Undeclared exception! try { line0.contains((Vector3D) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test43() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D1, vector3D0); // Undeclared exception! try { line0.closestPoint((Line) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test44() throws Throwable { Line line0 = null; try { line0 = new Line((Vector3D) null, (Vector3D) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test45() throws Throwable { Line line0 = null; try { line0 = new Line((Line) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test46() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = vector3D1.negate(); boolean boolean0 = line0.contains(vector3D2); assertFalse(boolean0); } @Test(timeout = 4000) public void test47() throws Throwable { Vector3D vector3D0 = Vector3D.MINUS_I; Vector3D vector3D1 = Vector3D.MINUS_K; Line line0 = new Line(vector3D0, vector3D1); try { line0.reset(vector3D0, vector3D0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // zero norm // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test48() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); double double0 = line0.distance(vector3D1); assertEquals(2.0206758969604885E-16, double0, 0.01); } @Test(timeout = 4000) public void test49() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); double double0 = line0.getAbscissa(vector3D1); assertEquals(0.577350269189626, double0, 0.01); } @Test(timeout = 4000) public void test50() throws Throwable { Vector3D vector3D0 = Vector3D.NaN; Line line0 = new Line(vector3D0, vector3D0); Vector3D vector3D1 = line0.intersection(line0); assertNull(vector3D1); } @Test(timeout = 4000) public void test51() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.closestPoint(line0); assertEquals(1.3333333333333335, vector3D2.getNorm1(), 0.01); } @Test(timeout = 4000) public void test52() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); double double0 = line0.distance(line0); assertEquals(0.0, double0, 0.01); } @Test(timeout = 4000) public void test53() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.PLUS_K; Line line0 = new Line(vector3D1, vector3D0); Vector3D vector3D2 = line0.getDirection(); Vector3D vector3D3 = Vector3D.ZERO; Line line1 = new Line(vector3D2, vector3D3); boolean boolean0 = line1.isSimilarTo(line0); assertEquals((-0.7071067811865475), vector3D2.getZ(), 0.01); assertFalse(boolean0); } @Test(timeout = 4000) public void test54() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = new Vector3D((-987.9936705230618), vector3D1, 0.0, vector3D0, 1.7976931348623157E308, vector3D0); Line line1 = new Line(vector3D0, vector3D2); Vector3D vector3D3 = line1.closestPoint(line0); Line line2 = new Line(vector3D3, vector3D1); boolean boolean0 = line2.isSimilarTo(line0); assertFalse(boolean0); } @Test(timeout = 4000) public void test55() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Line line1 = new Line(vector3D1, vector3D0); boolean boolean0 = line0.isSimilarTo(line1); assertTrue(boolean0); } @Test(timeout = 4000) public void test56() throws Throwable { Vector3D vector3D0 = new Vector3D(2673.984, 0.0, 0.0); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); boolean boolean0 = line0.isSimilarTo(line0); assertTrue(boolean0); } @Test(timeout = 4000) public void test57() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Line line0 = null; try { line0 = new Line(vector3D0, vector3D0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // zero norm // verifyException("org.apache.commons.math3.geometry.euclidean.threed.Line", e); } } @Test(timeout = 4000) public void test58() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector1D vector1D0 = line0.toSubSpace(vector3D1); Vector3D vector3D2 = line0.toSpace(vector1D0); assertEquals(0.577350269189626, vector1D0.getX(), 0.01); assertEquals(1.1666377730551262E-16, vector3D2.getDelta(), 0.01); } @Test(timeout = 4000) public void test59() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); SubLine subLine0 = line0.wholeLine(); assertNotNull(subLine0); } @Test(timeout = 4000) public void test60() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); boolean boolean0 = line0.contains(vector3D1); assertTrue(boolean0); } @Test(timeout = 4000) public void test61() throws Throwable { Vector3D vector3D0 = new Vector3D((-1.0), 0.0, (-1.0)); Vector3D vector3D1 = Vector3D.MINUS_J; Line line0 = new Line(vector3D0, vector3D1); Vector3D vector3D2 = line0.getOrigin(); assertEquals(1.3333333333333335, vector3D2.getNorm1(), 0.01); } @Test(timeout = 4000) public void test62() throws Throwable { Vector3D vector3D0 = Vector3D.PLUS_J; Vector3D vector3D1 = Vector3D.crossProduct(vector3D0, vector3D0); Line line0 = new Line(vector3D1, vector3D0); Line line1 = line0.revert(); assertNotSame(line1, line0); } }