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
5b53eda2f954cb6554cb2312b7c87ba0bf53bd7e
9d8376bc433b807eb6839adbe6c946436bad16c0
/src/java_chobo2/ch10/DateToCalendarEx.java
81cb65eed58dc0383d45c348ddd0c92ca5c1e213
[]
no_license
mywns123/java_chobo2
96238611714c9b6672636cd9b5ae6e44924177ee
ae5f6b94bc4b88bd700e0b8e168fc4c4245bc59a
refs/heads/master
2023-03-21T23:03:26.493958
2021-03-09T07:47:35
2021-03-09T07:47:35
341,818,610
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package java_chobo2.ch10; import java.util.Calendar; import java.util.Date; public class DateToCalendarEx { @SuppressWarnings("deprecation") public static void main(String[] args) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(2020, 0, 1); System.out.println(cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DATE)); Date d = new Date(); d.setYear(19); d.setMonth(0); d.setDate(1); System.out.printf("%tF %n", d); convCalToDate(cal); convDateToCal(d); } private static void convCalToDate(Calendar cal) { System.out.println("convert Calendar To Date()"); Date d = new Date(cal.getTimeInMillis()); System.out.printf("%tF %n", d); } private static void convDateToCal(Date d) { System.out.println("convDateToCal()"); Calendar cal = Calendar.getInstance(); cal.setTime(d); System.out.println(cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DATE)); } }
54d4a74b26b47f50c3378ca0a07f661ab17aaf22
72bb6bbdded8809ba9aefc0ce65d90a0708392fa
/src/org/overload1/CompanyInfo.java
fefbaeb3b24b4756dd04188d60d048fa8336e7d0
[]
no_license
balajigithub003/Jan7am
60179e9715d7cc388d2ed4186fe02654c05bbac8
8db0096df97b8f0d7040f0370d14fb9dab657a9d
refs/heads/master
2023-06-08T06:45:06.674773
2023-05-30T15:56:01
2023-05-30T15:56:01
232,458,534
0
0
null
2023-05-30T16:00:52
2020-01-08T02:18:07
Java
UTF-8
Java
false
false
841
java
package org.overload1; //Description //You have to overload the method companyName() based on different Number of arguments. public class CompanyInfo { //method implement public void companyName(int comId, String comName) { System.out.println("The company details are "+ comId+comName); } public void companyName(int comId,String comName,float comNetwort) { System.out.println("The company details are"+comId+comName+comNetwort); } public void companyName(int comId,String comName,float comNetwort,char comRank ) { System.out.println("The company details are "+comId+comName+comNetwort+comRank); } public static void main(String[] args) { CompanyInfo com = new CompanyInfo(); com.companyName(3377, "Hexaware"); com.companyName(3377, "Hexaware",35.000f ); com.companyName(3377, "Hexaware", 35.000f, 'A'); } }
5d32dad4a6a7c47b764dcc10a62886b400cbaae5
c019b4a9d9700ae168d5574df8b569dcc310112b
/src/main/java/project/BlockClusterNonogramMinDom_LB.java
a70a72bc83c26b17ae31785a231a90f4cd1ce4e0
[]
no_license
palmieri-anthony/Nonogram
d61851d1cc3ce0d24812b512189720d04f58a742
d8d0ad46e85e6354f1ec4e639753b5dd97248ea8
refs/heads/master
2021-01-01T05:41:11.264936
2015-03-09T10:03:10
2015-03-09T10:03:10
30,118,047
2
0
null
null
null
null
UTF-8
Java
false
false
6,829
java
package project; import java.util.Collection; import java.util.List; import solver.Solver; import solver.constraints.Constraint; import solver.constraints.ICF; import solver.constraints.IntConstraintFactory; import solver.constraints.LCF; import solver.constraints.nary.automata.FA.FiniteAutomaton; import solver.constraints.nary.automata.FA.IAutomaton; import solver.search.strategy.IntStrategyFactory; import solver.variables.BoolVar; import solver.variables.IntVar; import solver.variables.VariableFactory; import util.tools.ArrayUtils; public class BlockClusterNonogramMinDom_LB extends AbstractNonogrammProblem { public BlockClusterNonogramMinDom_LB(int line, int column) { super(line, column); } public BlockClusterNonogramMinDom_LB(String pathNono, String pathCsv) { super(pathNono, pathCsv); } /** * representing the nonogramm form square[i][j]=1 <=> the j pixel of row i * is painted . 0 otherwise. */ BoolVar[][] square; /** * placement of row cluster. rowCluster[i][t]=k <=> the cluster t has the * leftmost pixel on row i, column k. * Remark, the second dimension will be adjust according to the number of block */ IntVar [][] rowCluster ; /** * placement of column cluster. columnCluster[i][t]=k <=> the cluster t has the * leftmost pixel on column i, row k. * Remark, the second dimension will be adjust according to the number of block */ IntVar [][] columnCluster ; @Override protected void buildConstraint() { square= new BoolVar[line][column]; rowCluster = new IntVar[line][1]; columnCluster = new IntVar [this.column][1] ; square = VariableFactory .boolMatrix("c", this.line, this.column, solver); buildCluster(rowCluster,lineData,column,"row"); buildCluster(columnCluster,columnData,line,"column"); //sens xij => cluster ik <=> j initInblockVarRow(); initInblockVarColumn(); for (int j = 0; j < line; j++) { solver.post(ICF.sum(square[j], VariableFactory.fixed(this.sumLine.get(j), solver))); } for (int i = 0; i < column; i++) { BoolVar[] col = ArrayUtils.getColumn(square, i); solver.post(ICF.sum(col, VariableFactory.fixed(this.sumColumn.get(i), solver))); } } private void initInblockVarRow() { //pour chaque ligne for (int i = 0; i < square.length; i++) { //pour chaque element de la ligne for (int j = 0; j < square[i].length; j++) { //si il existe un cluster > 0 if(lineData.get(i).size()>0){ //si x[i][j]=1 alors .... sinon ... solver.post(LCF.ifThenElse(square[i][j], LCF.or(createOrConstraintXij1(i,j,square[i][j],rowCluster,this.lineData)), LCF.and(createOrConstraintXij0(i,j,square[i][j],rowCluster,this.lineData)))); } } } } private void initInblockVarColumn() { //pour chaque ligne BoolVar[][] transpose = ArrayUtils.transpose(square); for (int i = 0; i < transpose.length; i++) { //pour chaque cluster for (int j = 0; j < transpose[i].length; j++) { //si il existe un cluster > 0 if(columnData.get(i).size()>0){ //si x[i][j]=1 alors .... sinon ... solver.post(LCF.ifThenElse(transpose[i][j], LCF.or(createOrConstraintXij1(i,j,transpose[i][j],columnCluster,this.columnData)), LCF.and(createOrConstraintXij0(i,j,transpose[i][j],columnCluster,this.columnData)))); } } } } private Constraint[] createOrConstraintXij1(int line, int column, BoolVar boolVar, IntVar[][] cluster, List<List<Integer>> data) { //need as much as number of row cluster to ensure that the variable is in a block. Constraint[] tabConstraint = new Constraint[cluster[line].length]; for (int k = 0; k < cluster[line].length; k++) { Constraint supConstraint = ICF.arithm(cluster[line][k],"<=", column); Constraint lessConstraint = ICF.arithm(cluster[line][k],">", column-data.get(line).get(k)); tabConstraint[k]=supConstraint; tabConstraint[k]=LCF.and(supConstraint,lessConstraint); } return tabConstraint; } private Constraint[] createOrConstraintXij0(int line, int column, BoolVar boolVar, IntVar[][] cluster, List<List<Integer>> lineData) { //need as much as number of row cluster to ensure that the variable is in a block. Constraint[] tabConstraint = new Constraint[cluster[line].length]; for (int k = 0; k < cluster[line].length; k++) { Constraint supConstraint = ICF.arithm(cluster[line][k],">", column); Constraint lessConstraint = ICF.arithm(cluster[line][k],"<=", column-lineData.get(line).get(k)); tabConstraint[k]=LCF.or(supConstraint,lessConstraint); } return tabConstraint; } private void buildCluster(IntVar[][] cluster, List<List<Integer>> data, int n,String qualifier) { for(int i=0;i<cluster.length;i++){ //creation du tableau contenant les clusters cluster[i]= new IntVar[data.get(i).size()]; //pour chaque cluster de chaque ensemble(ligne colonne) for (int j = 0; j < data.get(i).size(); j++) { //create (left|top)most cluster variable cluster[i][j]= VariableFactory.integer(qualifier+"cluster["+i+"]["+j+"]", 0, n-data.get(i).get(j), solver); //si il existe plusieurs cluster alors on introduit un ordre if(j>0){ //get a blank //ensure position of next cluster is next the previous + size of previous + 1 for a blank. solver.post(ICF.arithm(cluster[i][j], "-", cluster[i][j-1], ">", (data.get(i).get(j-1)))); } } } } @Override public void configureSearch() { for(int i=0;i<rowCluster.length;i++){ solver.set(IntStrategyFactory.minDom_LB(this.rowCluster[i])); } for (int i = 0; i < columnCluster.length; i++) { solver.set(IntStrategyFactory.minDom_LB(this.columnCluster[i])); } } @Override public void prettyOut() { // for (int i = 0; i < line; i++) { // for (int j = 0; j < column; j++) { // System.out.print(square[i][j].getValue() + ", "); // // } // System.out.println(); // } // // // for (int i = 0; i < square.length; i++) { // checkSequence(square[i],lineData.get(i)); // } // BoolVar[][] transpose= ArrayUtils.transpose(square); // for (int j = 0; j< transpose.length; j++) { // checkSequence(transpose[j],columnData.get(j)); // } } // private void checkSequence(BoolVar[] boolVars, List<Integer> list) { // int cmptContigous=0; // int cmptCluster=0; // for (BoolVar var : boolVars) { // cmptContigous+=var.getValue(); // if(v+(n-k) -1ar.getValue()==0){ // if (cmptContigous>0) { // assert list.get(cmptCluster)==cmptContigous; // cmptContigous=0; // cmptCluster++; // } // } // } // if (cmptContigous>0) { // assert list.get(cmptCluster)==cmptContigous; // } // // } @Override public void solve() { level=level.SILENT; solver.findSolution(); writeResult(); } public static void main(String[] args) { new BlockClusterNonogramMinDom_LB(args[1],args[3]).execute(args); } }
003a3127eb8c6d24476495a295a00590cd54a14e
9b8c6cbeb07c074a667ee687a9fb2b3707396fd4
/test-case/springboot-rabbitmq/src/main/java/com/redcode/workbench/springbootrabbitmq/listener/TopicMsgRec1.java
f1ae7fb711f89dc39fd7e6070f25ffdea772e275
[]
no_license
simplezzy/red_workbench
b1ba4b9bebb929c29b903b2f7632765bd8e84be8
ac01bf6a2345f10a6009ebbca7baf5929eb587dd
refs/heads/master
2020-04-05T13:07:16.406101
2017-07-03T10:43:57
2017-07-03T10:43:57
95,100,023
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
package com.redcode.workbench.springbootrabbitmq.listener; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; @Component public class TopicMsgRec1 { @RabbitListener(queues = "topic.message") public void onMessage(String msg) { System.out.println("topicMessageReceiver1: " + msg); } }
4a0d5d65f989411c0d8a86c33e8bac11d08eed49
c30beecbe25d811e252a62e89c38b929e8601282
/src/main/java/com/raymor/kpi/db/web/rest/ClientForwardController.java
45256574d28a356618819b848f6e5e4607f44d7c
[]
no_license
alfonsomarquez1/kpi-db-raymor
e7ef431a29386bfdabd2ed8eb3d304ac88c3e42f
d6c5ec6911924fb6c6359a189b9effbe36a07c65
refs/heads/master
2022-11-30T20:17:10.095544
2020-08-16T17:53:45
2020-08-16T17:53:45
287,995,847
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
package com.raymor.kpi.db.web.rest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @Controller public class ClientForwardController { /** * Forwards any unmapped paths (except those containing a period) to the client {@code index.html}. * @return forward to client {@code index.html}. */ @GetMapping(value = "/**/{path:[^\\.]*}") public String forward() { return "forward:/"; } }
89a921c23ee368471d840e835a116e6335e880bb
c9dc3ffd69dc60ad20bfbc2c56c63fe553809ac2
/src/main/java/com/example/demo/CommentApplication.java
69b1e121323bb65b2142ea1f8002aa6c17856f8f
[]
no_license
shensongpeng/comment
d359f5677897fae6187adecb27d8acd088882c11
9adcf7f87bf8ea28d4d183422a15ad6559e92563
refs/heads/master
2023-01-31T02:18:11.943280
2020-12-11T07:10:03
2020-12-11T07:10:03
320,489,626
0
1
null
null
null
null
UTF-8
Java
false
false
323
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CommentApplication { public static void main(String[] args) { SpringApplication.run(CommentApplication.class, args); } }
ca20abc0b0a7d7cba72fa1a8fc9bbe0780f97f19
e562fd1103e2c5d8ac50d53d83ed8dd96ffb1948
/app/src/main/java/org/geometerplus/android/fbreader/SelectionBookmarkAction.java
078d42de1c0b29cf4c0de6af1515d78268a23a29
[]
no_license
nobady/BookReader
1ba21eecc6d9214d77f1211a5fc6dd2788765df5
c41ced8f2449693fc7480536dc58516293e8731b
refs/heads/master
2020-07-27T14:34:55.754992
2016-08-25T15:33:07
2016-08-25T15:33:07
65,986,301
1
0
null
null
null
null
UTF-8
Java
false
false
2,365
java
/* * Copyright (C) 2007-2013 Geometer Plus <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package org.geometerplus.android.fbreader; import android.content.Intent; import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.fbreader.book.Bookmark; import org.geometerplus.fbreader.book.SerializerUtil; import org.geometerplus.fbreader.fbreader.FBReaderApp; import org.geometerplus.android.fbreader.style.StyleListActivity; import org.geometerplus.android.util.UIUtil; public class SelectionBookmarkAction extends FBAndroidAction { SelectionBookmarkAction(FBReader baseApplication, FBReaderApp fbreader) { super(baseApplication, fbreader); } @Override protected void run(Object... params) { final boolean existingBookmark; final Bookmark bookmark; if (params.length != 0) { existingBookmark = true; bookmark = (Bookmark) params[0]; } else { existingBookmark = false; bookmark = Reader.addSelectionBookmark(); UIUtil.showMessageText( BaseActivity, ZLResource.resource("selection").getResource("bookmarkCreated").getValue() .replace("%s", bookmark.getText()) ); } final Intent intent = new Intent(BaseActivity.getApplicationContext(), StyleListActivity.class); intent.putExtra(FBReader.BOOKMARK_KEY, SerializerUtil.serialize(bookmark)); intent.putExtra(StyleListActivity.EXISTING_BOOKMARK_KEY, existingBookmark); OrientationUtil.startActivity(BaseActivity, intent); } }
2d19a1e01bf4a525c6853ad4e249702466923383
fb3a98008a5b1e1e9aaa12bef1d1a5be333b0534
/src/com/kgmyshin/ideaplugin/eventbus3/ReceiverFilter.java
553dc4ee441ed93a45141e5feeb203230b6069dc
[ "Apache-2.0" ]
permissive
stanleyguevara/eventbus3-intellij-plugin
b1296c9a2fb829c21b206a1b40b917fd5a59215f
146b51c6915e4df510bc3d97266ac43d9f196d29
refs/heads/master
2021-01-20T02:57:38.844926
2018-01-24T14:04:36
2018-01-24T14:04:36
89,476,976
1
1
null
2018-01-24T14:04:37
2017-04-26T12:14:16
Java
UTF-8
Java
false
false
1,109
java
package com.kgmyshin.ideaplugin.eventbus3; import com.intellij.psi.*; import com.intellij.usages.Usage; import com.intellij.usages.UsageInfo2UsageAdapter; /** * Created by kgmyshin on 2015/06/07. */ public class ReceiverFilter implements Filter { @Override public boolean shouldShow(Usage usage) { PsiElement element = ((UsageInfo2UsageAdapter) usage).getElement(); if (element instanceof PsiJavaCodeReferenceElement) { if ((element = element.getParent()) instanceof PsiTypeElement) { if ((element = element.getParent()) instanceof PsiParameter) { if ((element = element.getParent()) instanceof PsiParameterList) { if ((element = element.getParent()) instanceof PsiMethod) { PsiMethod method = (PsiMethod) element; if (PsiUtils.isEventBusReceiver(method)) { return true; } } } } } } return false; } }
1dbb5133eee675406141c014053611a32547415b
167dbd0e892e63f2e21b06d879c2264d9add00ad
/src/main/java/com/github/turchev/carrepairshop/view/UiException.java
3b7eae877dac6f1362b24026798163f17615ecce
[]
no_license
turchev/car-repair-shop
81b4264ea09826a989e18c031db8addb3a74c9a7
83af7b5c3ce854d431848db01513a940ee60f5d4
refs/heads/master
2022-02-06T14:58:07.561816
2021-12-15T06:33:50
2021-12-15T06:33:50
144,964,598
0
1
null
2022-01-04T16:32:45
2018-08-16T09:11:02
Java
UTF-8
Java
false
false
244
java
package com.github.turchev.carrepairshop.view; public class UiException extends Exception { public UiException(Throwable throwable) { super(throwable); } public UiException(String string) { super(string); } }
ce03d269642432a0bf5f1e80541738a8404ce2fe
26895eb9bb0923eca390157e2742d2c08bce63a9
/HomeWork2/src/Tasks/Shape.java
2c07fa278820cf66faf45cab07da14cdd317b2f1
[]
no_license
Jack1Life/Java
9bf2ad32536ba637f33e79fd862e5db7eca39a7e
4e9000cff4212bb52d8e7656270570647ca13c61
refs/heads/master
2020-06-30T02:24:04.170299
2019-08-27T13:35:59
2019-08-27T13:35:59
200,691,936
0
0
null
null
null
null
UTF-8
Java
false
false
136
java
package Tasks; public abstract class Shape { abstract double getPerimetr(); abstract double getArea(); abstract String getInfo(); }
911fd3d1eb0f24a41c101e7d9d3bd28ede005a6e
61b4787bf43b0a2a97f20387c5aad27ca929716c
/JokeGenerator/app/src/main/java/com/example/jokegenerator/SearchHistoryActivity.java
0d42f3a21f43f6304f4d5dad866e791416aa0554
[]
no_license
TheMattMan04/Joke-Generator
f9d0289dcdf62f0294d1a3f79cee4efb16a2e544
38c6436d311fb0b7aab8a133451418632036e255
refs/heads/master
2020-06-13T04:53:47.035454
2020-06-03T13:25:54
2020-06-03T13:25:54
194,542,694
0
0
null
null
null
null
UTF-8
Java
false
false
1,452
java
package com.example.jokegenerator; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; public class SearchHistoryActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { private ListView listView; private ArrayAdapter<String> adapter; private ArrayList<String> jokesHistory; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_joke_list); listView = (ListView)findViewById(R.id.jokeList); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); jokesHistory = getIntent().getStringArrayListExtra("jokesList"); for (String joke : jokesHistory) { adapter.add(joke); } listView.setAdapter(adapter); listView.setOnItemClickListener(this); } @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String joke = adapter.getItem(i); Intent intent = new Intent(SearchHistoryActivity.this, JokeViewActivity.class); intent.putExtra("joke", joke); startActivity(intent); } }
c69ff61341f1d8306e944548f1519dc08f569e20
ff6ea8c42b894a7224c842193ef5bd10e332ea33
/app/src/main/java/iit2/app/settingpage.java
d4e382f4bd97f24c577be7cdd2a646108639d021
[]
no_license
Sidhanthsur/MTC_APP
4fca5c4fc41771df16772c37a9fd2839b82a0b25
d3af4fa1a0b78ab31e946002bcadd346c02769f7
refs/heads/master
2016-08-05T20:46:05.803259
2015-01-10T18:49:43
2015-01-10T18:49:43
29,066,738
0
0
null
null
null
null
UTF-8
Java
false
false
2,129
java
package iit2.app; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.method.LinkMovementMethod; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; public class settingpage extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settingpage); //This opens a link TextView mLink = (TextView) findViewById(R.id.helpoption); if (mLink != null) { mLink.setMovementMethod(LinkMovementMethod.getInstance()); } } //Function called when Feedback is pressed public void sendfeedback(View view) { Intent email = new Intent(android.content.Intent.ACTION_SEND); email.setType("text/html"); // email.putExtra(Intent.EXTRA_CC,new String[]{"Your CC Mail ID"}); //CHange Id here email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"}); email.putExtra(android.content.Intent.EXTRA_SUBJECT, "FeedBack"); startActivity(email); } //THis function creates an intent to bind 'settings' and 'about' activites public void openaboutpage(View view) { Intent intent = new Intent(); intent.setClass(this,aboutpage.class); startActivity(intent); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. // getMenuInflater().inflate(R.menu.settingpage, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
568a87f3761d87ea9fe70080bc8ec5eda52fc9c1
229a32b4cc0d0bafc2286159c31c6e12306bc8ca
/src/main/java/com/lin/missyou/vo/CategoriesAllVO.java
ea9b6b67c908d1afca5b188d3f816c88575adc38
[]
no_license
Jamboy/mpApiDemo
1a66ac808a6effcbaa26a677a3b9b9f2e9dd8d39
46fb820573a1c8367f3e6d348fe9e903f327be8f
refs/heads/main
2023-06-15T00:00:24.355957
2021-07-08T03:04:55
2021-07-08T03:04:55
383,980,597
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
/** * @作者 7七月 * @微信公号 林间有风 * @开源项目 $ http://7yue.pro * @免费专栏 $ http://course.7yue.pro * @我的课程 $ http://imooc.com/t/4294850 * @创建时间 2020-03-09 19:11 */ package com.lin.missyou.vo; import com.lin.missyou.model.Category; import lombok.Getter; import lombok.Setter; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @Getter @Setter public class CategoriesAllVO { private List<CategoryPureVO> roots; private List<CategoryPureVO> subs; public CategoriesAllVO(Map<Integer, List<Category>> map) { // List<Category> roots = map.get(1); this.roots = map.get(1).stream() .map(CategoryPureVO::new) .collect(Collectors.toList()); this.subs = map.get(2).stream() .map(CategoryPureVO::new) .collect(Collectors.toList()); } }
6ab95d08c8fd41c655b0c97e6023fff5c79f71e1
c9acf52748532cc5081675a3362c4f8c13b26e4f
/src/main/java/org/xmlsoap/schemas/soap/encoding/ShortDocument.java
43ca900014abce0b2ee5c1bb2a214e92c9243662
[]
no_license
Malandru/BanjikoService
751874798e7175f23c64a3e86edee637d8221837
ae9211dcdc8c64e4794b51de0662b06af2d6ced8
refs/heads/master
2020-08-26T21:44:27.114382
2019-10-24T14:14:32
2019-10-24T14:14:32
217,157,714
0
0
null
null
null
null
UTF-8
Java
false
false
8,558
java
/* * An XML document type. * Localname: short * Namespace: http://schemas.xmlsoap.org/soap/encoding/ * Java type: org.xmlsoap.schemas.soap.encoding.ShortDocument * * Automatically generated - do not modify. */ package org.xmlsoap.schemas.soap.encoding; /** * A document containing one short(@http://schemas.xmlsoap.org/soap/encoding/) element. * * This is a complex type. */ public interface ShortDocument extends org.apache.xmlbeans.XmlObject { public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType) org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(ShortDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s5C152683714F7B99C44842EF24EA444A").resolveHandle("shorta940doctype"); /** * Gets the "short" element */ org.xmlsoap.schemas.soap.encoding.Short getShort(); /** * Sets the "short" element */ void setShort(org.xmlsoap.schemas.soap.encoding.Short xshort); /** * Appends and returns a new empty "short" element */ org.xmlsoap.schemas.soap.encoding.Short addNewShort(); /** * A factory class with static methods for creating instances * of this type. */ public static final class Factory { public static org.xmlsoap.schemas.soap.encoding.ShortDocument newInstance() { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument newInstance(org.apache.xmlbeans.XmlOptions options) { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); } /** @param xmlAsString the string value to parse */ public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); } /** @param file the file from which to load an xml document */ public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); } public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.xmlsoap.schemas.soap.encoding.ShortDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (org.xmlsoap.schemas.soap.encoding.ShortDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } private Factory() { } // No instance of this class allowed } }
05cd432a90b08fac45466b659e3bd6e10d3ca5c8
c25164c5176f4fb9534463ce6647697692ba6ff9
/prototype/src/net/ircubic/eventmap/ConflictResolution.java
2cb02919dd8585a490e59e51ef1036c9e368351e
[]
no_license
ircubic/School-project--Plandroid
2df70a859b234713b8f2b15acd5ab4a40eb47e54
15f546f3d96479c355863b32c62e4886d1e44f10
refs/heads/master
2016-09-06T16:56:42.968751
2011-07-25T11:21:00
2011-07-25T11:21:00
2,100,549
0
0
null
null
null
null
UTF-8
Java
false
false
2,858
java
package net.ircubic.eventmap; import java.io.Serializable; import java.util.ArrayList; import java.util.Random; import android.app.ListActivity; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; public class ConflictResolution extends ListActivity { public static final int RESOLVE = 0; private FriendConflictAdapter adapter; private final ArrayList<FriendConflict> conflicts = new ArrayList<FriendConflict>(); @Override protected void onCreate(final Bundle savedInstanceState) { final Intent data = getIntent(); final Serializable x = data.getSerializableExtra("conflicts"); if (x != null) { @SuppressWarnings("unchecked") final ArrayList<Long> ids = (ArrayList<Long>)x; if (ids.size() > 0) { final String where = String.format("%s IN (%s)", FriendProvider.KEY_ID, TextUtils.join(",", ids)); final Cursor c = managedQuery(FriendProvider.CONTENT_URI, null, where, null, FriendProvider.KEY_NAME + " ASC"); final String[] events = {"Wedding", "Birthday party", "Movie evening", "Dinner", "Lunch", "Get-together", "Going to nightclub", "Family night", "Game-night", "Date"}; final Random rand = new Random(); while (c.moveToNext()) { final Long id = c.getLong(0); final String name = c.getString(1); final String message = events[rand.nextInt(events.length)]; conflicts.add(new FriendConflict(id, name, message)); } } } if (conflicts.size() == 0) { final Toast toast = Toast.makeText(getApplicationContext(), "Tried to handle a zero-conflict", Toast.LENGTH_LONG); toast.show(); finish(); } final TextView desctext = new TextView(this); desctext.setText(R.string.conflict_description); getListView().addHeaderView(desctext); final Button finish = new Button(this); finish.setText(R.string.conflict_finish_button); finish.setOnClickListener(new OnClickListener() { public void onClick(final View v) { finishResolving(); } }); getListView().addFooterView(finish); adapter = new FriendConflictAdapter(this, conflicts); setListAdapter(adapter); setTitle(R.string.title_resolve_conflict); super.onCreate(savedInstanceState); } protected void finishResolving() { // TODO Finish resolving setResult(RESULT_OK); finish(); } public void removeClicked(final View v) { final ImageButton removeButton = (ImageButton)v; final View parent = (View)removeButton.getParent(); final FriendConflict f = (FriendConflict)parent .getTag(R.id.conflict_position); conflicts.remove(f); adapter.notifyDataSetChanged(); } }
993859de7e5b5ddb0ca48359ace74d18f26aadba
15b9da747ef461c8d6c1e1e285424e921dbe9a40
/wonDemo/DemoAop2/src/main/java/com/example/Interceptor.java
d507a8f69f6e2c0ea364d6d5d402bbd379179479
[]
no_license
wonhoLee/wonStudy
2e3d6757bfc4434071c5d416a73bf189078cc122
e206597be598aa16811ed050e65bc5d582c3bf62
refs/heads/master
2023-01-24T21:26:41.003290
2021-01-16T13:57:40
2021-01-16T13:57:40
148,777,648
0
0
null
2023-01-06T01:36:16
2018-09-14T11:09:19
Java
UTF-8
Java
false
false
2,282
java
package com.example; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; @Aspect @ConfigurationProperties("interceptor") public class Interceptor { private static final Logger logger = LoggerFactory.getLogger(Interceptor.class); /** * Message to print on startup */ private String message = "Startup"; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } // @Around("execution(* *(..)) && !within(com.example.Interceptor)" // + " && (within(org.springframework.context.annotation.Condition+) || within(com.example..*))") // public Object intercept(ProceedingJoinPoint joinPoint) throws Throwable { // Object result = joinPoint.proceed(); // logger.debug("AspectJ intercept: " + joinPoint.toShortString() + ": " + result); // return result; // } @Around("execution(* *(..)) && within(com.example..*) && !within(com.example.Interceptor+)") public Object stack(ProceedingJoinPoint joinPoint) throws Throwable { logger.debug("AspectJ stack: " + joinPoint.toShortString()); return joinPoint.proceed(); } @Pointcut("@annotation(MaskingAnno)") public void callAt(MaskingAnno secured) { } @Around("callAt(MaskingAnno)") public Object around(ProceedingJoinPoint pjp, MaskingAnno secured) throws Throwable { logger.info("WON!!!!!!!!!!!!!"); return pjp.proceed(); } @Pointcut("@annotation(MaskingFieldAnno)") public void callAt2(MaskingFieldAnno secured) { } @Around("callAt2(MaskingFieldAnno)") public Object around2(ProceedingJoinPoint pjp, MaskingFieldAnno secured) throws Throwable { logger.info(pjp.toShortString()); logger.info("WON2222222222"); return pjp.proceed(); } @EventListener public void started(ContextRefreshedEvent event) { logger.debug("AspectJ started: " + message + ": " + event); } }
8017fc0c7677c02dfbaff89f13415469519cd815
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.socialplatform-base/sources/com/oculus/messengervr/oc/$$Lambda$MessageListObservableUtil$BWKbb5snBT5SDnix3KtNwycssU42.java
9c23e3cc7b3d114fa0a759317b60d9c700935f00
[]
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
606
java
package com.oculus.messengervr.oc; import X.AbstractC12851yS; /* renamed from: com.oculus.messengervr.oc.-$$Lambda$MessageListObservableUtil$BWKbb5snBT5SDnix3KtNwycssU42 reason: invalid class name */ public final /* synthetic */ class $$Lambda$MessageListObservableUtil$BWKbb5snBT5SDnix3KtNwycssU42 implements AbstractC12851yS { public static final /* synthetic */ $$Lambda$MessageListObservableUtil$BWKbb5snBT5SDnix3KtNwycssU42 INSTANCE = new $$Lambda$MessageListObservableUtil$BWKbb5snBT5SDnix3KtNwycssU42(); @Override // X.AbstractC12851yS public final void accept(Object obj) { } }
3db0addf7fef92d61d806145e512db85c4c0fee2
be45dc2a1e60564770de12de9c4fcd909bf4132e
/displayjokeslibrary/src/androidTest/java/com/pklein/displayjokeslibrary/ExampleInstrumentedTest.java
c41601d324adf69c8aaa93ad1e187c7b8fed55dc
[]
no_license
PaulineKlein/BuildItBigger
e5affb8351ed686220ed4c92f932bf2daa026adf
0944c5ae57f0cf1d55de11550b0a1794933b3fee
refs/heads/master
2020-03-19T02:23:03.821807
2018-06-07T18:56:33
2018-06-07T18:56:33
135,624,011
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.pklein.displayjokeslibrary; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.pklein.displayjokeslibrary.test", appContext.getPackageName()); } }
aea9bc768b715b4cf42d4fbadb9ec8618c8d70f2
4968c5642c5e5261b635d3f31e1890fba7277868
/fav/frontend/src/main/java/org/express/common/bean/FieldMeta.java
75bdfe2df17e0c5af8613b5215cdfb7abdaf6633
[]
no_license
cllcsh/collectionplus
01116dc8594e0be6e5a10623e3db2ec9d103d2c2
4a62418d73745a9136d4163527d532e2d3e8b483
refs/heads/master
2016-08-11T16:16:24.556377
2016-04-21T07:51:03
2016-04-21T07:51:03
54,613,229
0
0
null
2016-03-24T14:39:53
2016-03-24T03:55:39
null
UTF-8
Java
false
false
1,008
java
package org.express.common.bean; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * bean注解类 * @author Rei Ayanami * */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD,ElementType.METHOD}) public @interface FieldMeta { /** * 是否为主键 * @return */ boolean isPrimary() default false; /** * 字段名称 * @return */ String name() default ""; /** * 是否可编辑 * @return */ boolean editable() default true; /** * 是否显示 * @return */ boolean display() default true; /** * 字段描述 * @return */ String description() default ""; /** * 排序字段 * @return */ int order() default 0; /** * 是否原生属性 * @return */ boolean isNative() default true; }
51c563e3d5e8975ed6d9838455f48775d53ff2fe
a76da95806a21c60d2b2f5377f3e09b6b4df010d
/HomeWork/src/day06/Test04.java
5746967e38a2c2d315a32cb0af7471526d97c8dc
[]
no_license
Threkt/HomeWork
1b0900dae360e5cf9e2232140e4c02bbea78d31a
647003964d3302ca8789e8292ff7047ed5ad0377
refs/heads/master
2022-11-28T02:42:29.307772
2020-08-12T12:32:10
2020-08-12T12:32:10
281,938,477
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package day06; import org.junit.Test; import java.io.File; /** * 获取并输出当前目录下的所有文件和目录的名字 * @author Bonnie * */ public class Test04 { @Test public void Test01() { File file = new File("."); System.out.println(file.getAbsoluteFile()); String[] list = file.list(); for (String s : list) { System.out.println(s); } } }
7b80d417f895215bcffbca600e5809b64421710c
166a311278883254eab2bad60c4883d6f5648bfc
/[new]JavaEclipseProject/src/officeEntities/Group.java
0132021f2156dea239d5accdf26070b2ad3265ce
[]
no_license
chawk073uofc/sisyphus-1-room-allocation
9818ee522ea43715074ac732d97435b6d08483e1
10f6c6c05c8d3f1ec32714dd61a312dbfc48e405
refs/heads/master
2021-03-19T07:29:30.332861
2017-06-24T05:21:16
2017-06-24T05:21:16
94,376,110
0
0
null
null
null
null
UTF-8
Java
false
false
4,940
java
package officeEntities; import java.util.HashMap; import java.util.Map; import java.util.TreeSet; /** * This class represents a group in the office allocation problem. It includes a list of the group's * members and heads along with methods to add members and to check membership. * @author Branko Bajic * */ import cpsc433.Entity; /** * * @author chrishawk_MacBookAir * */ public class Group extends Entity { private static Map<String, Group> groups =new HashMap<>(); //All instances of class Group currently instantiated. private Map<String, Person> members = new HashMap<>(); private Map<String, Person> groupHeads = new HashMap<>(); /** * Constructor for class Group. Creates a group with the given name. * @param groupName */ public Group(String groupName) { super(groupName); if (!exists(groupName)){ groups.put(groupName, this); } } /** * Constructor for class Group. Creates a group with the given name and assigns the given person * to the group's list of people. * @param groupName name of the group * @param person name of the person */ public Group(String groupName, Person person) { super(groupName); if(!groups.containsKey(this.getName())){ //O(1) groups.put(groupName, this); //O(1) } members.put(person.getName(), person); } /** * Returns an object representing a group with a given name , if such group exists. * @param name the name of a group which may or may not exist * @return the group object which has the given name * @throws NoSuchGroupException if a group by the given name is not found */ public static Group getEntityWithName(String groupName) throws NoSuchGroupException{ Group g = groups.get(groupName); //O(1) if (g == null) throw new NoSuchGroupException(); return g; } /** * Returns true if this group has a member by the name given. * @param personName * @return */ public boolean hasMember(String personName) { return members.containsKey(personName);//O(1) } /** * Assigns the person with the given name to be the head of this group. Creates a person * object with the given name if one does not already exist. * @param personName */ public void setGroupHead(String personName) { Person personObj; try { personObj = Person.getEntityWithName(personName); } catch (NoSuchPersonException e) { personObj= new Person(personName); } if(!groupHeads.containsKey(personObj.getName())){ groupHeads.put(personObj.getName(), personObj); } if(!members.containsKey(personObj.getName())){ members.put(personObj.getName(), personObj); } //add group-head to person's attribute list personObj.addAttribute(Attribute.GROUP_HEAD); //add group to person's groups structure personObj.addGroup(this.getName()); } /** * Returns true if the named person is the head of this group. * @param personName * @return */ public boolean hasGroupHead(String personName) { return !groupHeads.isEmpty(); } /** * Returns true if the named group exists. * @param groupName * @return boolean */ public static boolean exists(String groupName){ return groups.containsKey(groupName); //O(1) } /** * String representation of group. String contains information about all the * group's members and heads. * @return a string representation of a group */ @Override public String toString(){ String groupStr = ""; groupStr += "group(" + this.getName() + ")\n"; for(Person member : members.values()){ groupStr += "group(" + member.getName() + ", " + this.getName() + ")\n"; } for(Person groupHead: groupHeads.values()){ groupStr += "heads-group(" + groupHead.getName() + ", " + this.getName() + ")\n"; } return groupStr; } /** * Builds a string representing all the Group objects instantiated by calling the * toString() method of each. * @return a string representing all known information about all groups */ public static String groupInfoString(){ String groupStr = ""; for(Group g: groups.values()){ groupStr += g; } groupStr += "\n"; return groupStr; } /** * Assigns a person to the group . * @param person the person being added */ public void addMember(Person person){ members.put(person.getName(), person); } public static Map<String, Group> getGroups(){ return groups; } public static Map<String, Person> getAllGroupHeads(){ Map<String, Person> returnMap = new HashMap<>(); //returnMap.putAll(groups); for (Map.Entry<String, Group> entry : groups.entrySet()) { returnMap.putAll(entry.getValue().getGroupHeads()); // TODO: remove duplicates } return returnMap; } public Map<String, Person> getGroupHeads(){ return groupHeads; } public Map<String, Person> getMembers(){ return members; } }
5ea8d24ae1c87fc8f8612c12ebfb1fe9a74e8ae6
3c7abb96bc7754e003849b0736d8113d0cdf0dab
/JReviewBoardApi/src/com/reviewboard/api/model/diffcomment/Links.java
eb7c5cc91bf4bafd5c04bde58d57b2e62b936cbc
[]
no_license
shaikidris/jreviewboardapi
4198e1cddec9a8fca06900a435958ffca20257f3
7fcb943531fdc49705ef3ade927007a2410cd2d3
refs/heads/master
2021-01-01T17:28:13.216406
2012-06-04T16:46:24
2012-06-04T16:46:24
41,742,731
0
0
null
null
null
null
UTF-8
Java
false
false
4,726
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.09.26 at 08:02:07 PM BRT // package com.reviewboard.api.model.diffcomment; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{}user" minOccurs="0"/> * &lt;element ref="{}self"/> * &lt;choice> * &lt;element ref="{}create"/> * &lt;sequence> * &lt;element ref="{}filediff"/> * &lt;element ref="{}update"/> * &lt;element ref="{}delete"/> * &lt;/sequence> * &lt;/choice> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "user", "self", "create", "filediff", "update", "delete" }) @XmlRootElement(name = "links") public class Links { protected User user; @XmlElement(required = true) protected Self self; protected Create create; protected Filediff filediff; protected Update update; protected Delete delete; /** * Gets the value of the user property. * * @return * possible object is * {@link User } * */ public User getUser() { return user; } /** * Sets the value of the user property. * * @param value * allowed object is * {@link User } * */ public void setUser(User value) { this.user = value; } /** * Gets the value of the self property. * * @return * possible object is * {@link Self } * */ public Self getSelf() { return self; } /** * Sets the value of the self property. * * @param value * allowed object is * {@link Self } * */ public void setSelf(Self value) { this.self = value; } /** * Gets the value of the create property. * * @return * possible object is * {@link Create } * */ public Create getCreate() { return create; } /** * Sets the value of the create property. * * @param value * allowed object is * {@link Create } * */ public void setCreate(Create value) { this.create = value; } /** * Gets the value of the filediff property. * * @return * possible object is * {@link Filediff } * */ public Filediff getFilediff() { return filediff; } /** * Sets the value of the filediff property. * * @param value * allowed object is * {@link Filediff } * */ public void setFilediff(Filediff value) { this.filediff = value; } /** * Gets the value of the update property. * * @return * possible object is * {@link Update } * */ public Update getUpdate() { return update; } /** * Sets the value of the update property. * * @param value * allowed object is * {@link Update } * */ public void setUpdate(Update value) { this.update = value; } /** * Gets the value of the delete property. * * @return * possible object is * {@link Delete } * */ public Delete getDelete() { return delete; } /** * Sets the value of the delete property. * * @param value * allowed object is * {@link Delete } * */ public void setDelete(Delete value) { this.delete = value; } }
d8746f4a64801d2b8dcd4d2c6b2164641d7ecf7a
9537f25878b5dfc8d1d00fe7dc493e2e55a187a7
/src/rm/node/TSemicolonsym.java
84ec22f5da29b4d669fb9c5d5b775f921fafc761
[]
no_license
mlterpstra92/RM
31b65f84445587cdfbf75163b8cb858f3ad85744
574a3c56170d8b5702205ec35bbea5cb4b5f206c
refs/heads/master
2016-09-05T21:18:26.018174
2014-02-19T14:13:49
2014-02-19T14:13:49
10,155,448
1
0
null
null
null
null
UTF-8
Java
false
false
762
java
/* This file was generated by SableCC (http://www.sablecc.org/). */ package rm.node; import rm.analysis.*; @SuppressWarnings("nls") public final class TSemicolonsym extends Token { public TSemicolonsym() { super.setText(";"); } public TSemicolonsym(int line, int pos) { super.setText(";"); setLine(line); setPos(pos); } @Override public Object clone() { return new TSemicolonsym(getLine(), getPos()); } @Override public void apply(Switch sw) { ((Analysis) sw).caseTSemicolonsym(this); } @Override public void setText(@SuppressWarnings("unused") String text) { throw new RuntimeException("Cannot change TSemicolonsym text."); } }
[ "maarten@bazenpc" ]
maarten@bazenpc
422ac08146834854c15e758d526dd62d22aa7607
e2d5deb56c9161cbed7d05624a62185110afec40
/VideoManager/src/main/java/io/github/appuhafeez/video/repository/FileMetadataRepo.java
f8f8bff5d4cc7b37deb64639469f4b0711ff5296
[]
no_license
appuhafeez/video-player
00db018defc1dd2a23db4ed7ce79c0a0311316de
ed83e5daad5687418254613e5e1597c68378f34b
refs/heads/master
2021-07-09T16:48:14.420451
2020-03-14T13:15:02
2020-03-14T13:15:02
233,349,721
0
0
null
2021-03-31T21:40:38
2020-01-12T06:37:42
Java
UTF-8
Java
false
false
2,011
java
package io.github.appuhafeez.video.repository; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import io.github.appuhafeez.video.entity.FileMetaData; import io.github.appuhafeez.video.enums.SearchCriteria; @Repository public class FileMetadataRepo{ @Autowired private EntityManager entityManager; @Transactional public void save(FileMetaData data) { entityManager.persist(data); } public List<FileMetaData> searchList(String searchString, int startIndex, int endIndex, SearchCriteria criteria){ Query query = getSearchQuery(criteria); query.setParameter("searchString","%"+searchString+"%"); query.setFirstResult(startIndex); query.setMaxResults(endIndex); return query.getResultList(); } private Query getSearchQuery(SearchCriteria criteria) { Query query = null; if(criteria.equals(SearchCriteria.HEADING)) { query = entityManager.createQuery("from FileMetaData fd where fd.heading LIKE :searchString"); }else if(criteria.equals(SearchCriteria.DESCRIPTION)) { query = entityManager.createQuery("from FileMetaData fd where fd.description LIKE :searchString"); }else if(criteria.equals(SearchCriteria.HASHTAGS)) { query = entityManager.createQuery("from FileMetaData fd where fd.hashtags LIKE :searchString"); } return query; } public int getCount(String searchString, SearchCriteria criteria) { return getAllData(searchString, criteria).size(); } public List<FileMetaData> getAllData(String searchString, SearchCriteria criteria){ Query query = getSearchQuery(criteria); query.setParameter("searchString","%"+searchString+"%"); return query.getResultList(); } public FileMetaData getFileMetadata(String id) { return entityManager.find(FileMetaData.class, id); } public void update(FileMetaData data) { entityManager.merge(data); } }
247eaf8949e729bd5e0681c4bfae307f114b79f3
bee36866c53546826042d9fb11f049bebb465f1d
/Kuis2/Person.java
5428f02f7433643e931890ac455edd2ec684b789
[]
no_license
ravielze/OOP-sie-2021
42aa687a88dc5309b59b764041ed24807d080619
4fe734184daaa4f0f334aac4b008131e33361dea
refs/heads/master
2023-04-12T06:26:08.725513
2021-04-22T03:12:26
2021-04-22T03:12:26
335,888,541
0
1
null
null
null
null
UTF-8
Java
false
false
369
java
public abstract class Person { private String name; public Person(String name) { this.name = name; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "{" + " name='" + getName() + "'" + "}"; } }
352a21876ec8b19207654add29476f94cd5e04a1
1ab35450de23d891cceb2a0affc98f3218927724
/src/FileOpUtils.java
eddf0eec802c405bae3eead11f8c21960aef1334
[]
no_license
adamwitzel/Edifice
91615e6e2cea6728d2ea1a84b91ae788015cb0bf
8c1b874bbad8dbeca191e96cf6e3b3064195a107
refs/heads/master
2021-05-19T18:56:08.152820
2020-04-05T01:44:18
2020-04-05T01:44:18
252,073,129
0
0
null
null
null
null
UTF-8
Java
false
false
2,321
java
import java.io.File; import java.io.FilenameFilter; import javax.swing.JFileChooser; public class FileOpUtils { public static String[] getFilesInDirectory(String directory) { File folder = new File(directory); String[] files = folder.list(); return files; } public static String[] getSubdirectories(String directory) { File file = new File(directory); String[] directories = file.list(new FilenameFilter() { @Override public boolean accept(File current, String name) { return new File(current, name).isDirectory(); } }); return directories; } public static boolean renameFileName(String oldName, String newName) { File oldFile = new File(oldName); String newNameString = oldFile.getParent() + "\\" + newName; File newFile = new File(newNameString); if(oldFile.renameTo(newFile)){ return true; }else{ return false; } } /* public static boolean renameFileFull(String oldName, String newName) { File oldFile = new File(oldName); File newFile = new File(newName); if(oldFile.renameTo(newFile)){ return true; }else{ return false; } } */ public static String selectFile() { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File("E:\\Downloads\\jdown")); chooser.setDialogTitle("Select File"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().toString(); } else { System.out.println("No Selection "); return "No Selection "; } } public static String selectDirectory(String startLocation) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(startLocation)); chooser.setDialogTitle("Select Directory"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().toString(); } else { System.out.println("No Selection "); return "No Selection "; } } }
db427302493b727fda13acfbf8f89feb736841b9
c3b473fadf4227084bcf5b0006d23a7acdcab182
/src/main/java/com/antuansoft/mongodb/connection/UserRepository.java
ae8b045109b26732edcccb3307a29151969ee64b
[]
no_license
amitchaulagain/multi-tenant-app
93591c54be6834dcfeccd03504f43bd6a96af925
2d6e83c039679a112ae2f072bad604afcb68419b
refs/heads/master
2020-07-06T13:38:39.231098
2016-08-27T22:44:02
2016-08-27T22:44:02
66,738,470
1
0
null
null
null
null
UTF-8
Java
false
false
1,406
java
package com.antuansoft.mongodb.connection; import com.antuansoft.mongodb.domain.Order; import org.jongo.Jongo; import org.jongo.MongoCollection; import org.jongo.MongoCursor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.stereotype.Repository; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; /** * Created by amit on 5/6/16. */ public class UserRepository extends MongoConnection { // DBCollection collection; MongoCollection collection; public UserRepository(HttpServletRequest request) throws UnknownHostException { super(request); setCollection(); } @Override public void setCollection() throws UnknownHostException { Jongo jongo = new Jongo(getMongoConnection()); //collection = getMongoConnection().getCollection("order"); collection=jongo.getCollection("order"); } public List<Order> findAll() throws IOException { MongoCursor<Order> all = collection.find().as(Order.class); List<Order> orders = new ArrayList<Order>(); while (all.hasNext()) { orders.add(all.next()); } return orders; } }
65a8086f037437ca645fbc557167a1da3314fb9d
af0c6341bd69f38d4712d236751af7f94085d82b
/src/main/java/task6/dao/MySQLProducerDao.java
021aa30fbde49c787301d4e0005cdac1009da8eb
[]
no_license
Alikhano/lvlp
86e6f4bb4b48296b9f33823786bee7a45860c52d
3773b2ca1be272bd7b29a5b5a71658025b4993e3
refs/heads/master
2021-05-06T16:03:23.793002
2017-12-26T20:33:57
2017-12-26T20:33:57
113,700,421
0
0
null
2017-12-20T15:31:20
2017-12-09T20:51:58
Java
UTF-8
Java
false
false
4,537
java
package task6.dao; import task6.ConnectionFactory; import task6.domain.ResultsProducer; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; public class MySQLProducerDao implements ProducerDao { private final ConnectionFactory connectionFactory; public MySQLProducerDao(ConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } @Override public ResultsProducer create(String name, String address) { ResultSet set1; ResultsProducer result; try (Connection connection = connectionFactory.getConnection("onlineshop", "root", "Mikkeli9586")) { Statement statement = connection.createStatement(); int rowUpdated = statement.executeUpdate("insert into producer(name, address) value (\"" + name + "\", \"" + address + "\")"); if (rowUpdated == 0) { return null; } set1 = statement.executeQuery("select * from producer where name = \"" + name + "\""); set1.next(); result = new ResultsProducer(set1.getInt(1), set1.getString(2), set1.getString(3)); return result; } catch (SQLException e) { throw new RuntimeException(e); } } @Override public ResultsProducer update(String name, String address) { ResultSet set2; ResultsProducer result; try (Connection connection = connectionFactory.getConnection("onlineshop", "root", "Mikkeli9586")) { Statement statement = connection.createStatement(); int rowUpdated = statement.executeUpdate("update producer set address = \"" + address + "\" where name = \"" + name + "\""); if (rowUpdated == 0) { return null; } set2 = statement.executeQuery("select * from producer where address = \"" + address + "\""); set2.next(); result = new ResultsProducer(set2.getInt(1), set2.getString(2), set2.getString(3)); return result; } catch (SQLException e) { throw new RuntimeException(e); } } @Override public ResultsProducer delete(int id) { ResultSet set3; ResultsProducer result; try (Connection connection = connectionFactory.getConnection("onlineshop", "root", "Mikkeli9586")) { Statement statement = connection.createStatement(); int rowUpdated = statement.executeUpdate("delete from producer where producerId =" + id); if (rowUpdated == 0) { return null; } set3 = statement.getResultSet(); result = new ResultsProducer(set3.getInt(1), set3.getString(2), set3.getString(3)); return result; } catch (SQLException e) { throw new RuntimeException(e); } } @Override public ResultsProducer getById(int id) { ResultSet set4; ResultsProducer result; try (Connection connection = connectionFactory.getConnection("onlineshop", "root", "Mikkeli9586")) { Statement statement = connection.createStatement(); int rowUpdated = statement.executeUpdate("select * from producer where producerId =" + id); if (rowUpdated == 0) { return null; } set4 = statement.getResultSet(); result = new ResultsProducer(set4.getInt(1),set4.getString(2), set4.getString(3)); return result; } catch (SQLException e) { throw new RuntimeException(e); } } @Override public ArrayList<ResultsProducer> getAll() { ResultsProducer result; ArrayList<ResultsProducer> list = new ArrayList<>(); try (Connection connection = connectionFactory.getConnection("onlineshop", "root", "Mikkeli9586")) { Statement statement = connection.createStatement(); ResultSet set = statement.executeQuery("select * from producer"); while (set.next()) { System.out.println("ID " + set.getInt(1) + " name " + set.getString(2) + " address " + set.getString(3)); result = new ResultsProducer(set.getInt(1), set.getString(2), set.getString(3)); list.add(result); } return list; } catch (SQLException e) { throw new RuntimeException(e); } } }
a93685895ae4087d294640bd52458bd9bf170cad
9c2aea5d85b1e8c6e76b62773270cc7425df12b0
/src/com/Edward/PicArrangement/Main.java
e3ab2530023386e05358884faadf6de23851775c
[]
no_license
warcraft23/HuaWeiOJ
26670c86129a87f40a5a5997a594ab484869b4f9
b8df4a25cf0ac001a87d5a3a83fb3f28b176e502
refs/heads/master
2020-04-02T01:26:37.750750
2015-09-22T14:23:00
2015-09-22T14:23:00
42,938,656
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.Edward.PicArrangement; import java.util.Arrays; import java.util.Scanner; public class Main { static String picArragement(String str){ String res=""; int length=str.length(); if(length==0||length>1024) return res; char[] chars=new char[length]; chars=str.toCharArray(); int lengthChar=chars.length; for(int i=0;i<lengthChar;i++){ if(!((chars[i]>='0'&&chars[i]<='9')||(chars[i]>='a'&&chars[i]<='z')||(chars[i]>='A'&&chars[i]<='Z'))){ for(int j=i+1;j<lengthChar;j++){ chars[j-1]=chars[j]; lengthChar--; } } } Arrays.sort(chars,0,lengthChar); for(int i=0;i<lengthChar;i++){ res+=chars[i]; } return res; } public static void main(String args[]){ Scanner scan=new Scanner(System.in); String str=scan.nextLine(); String res=picArragement(str); System.out.println(res); } }
83138e42ec55fe1be84e612b87e21b4cb5082f22
d0c51bd8ba6452c1a3fba7d420f830829a5a33e9
/src/org/openmrs/module/rgrta/service/EncounterService.java
589381190830bbbc6c4ba913c62394839ee9b330
[]
no_license
CHIRDL-Openmrs-Modules/rgrta
1b241b98d450dca474173229538624c0efdabafe
22f76f2c7001ce50f387814be90c5171ff7e2586
refs/heads/master
2021-01-19T12:39:16.127860
2015-08-27T14:38:31
2015-08-27T14:38:31
25,689,717
0
0
null
2015-08-27T14:38:31
2014-10-24T13:26:36
Java
UTF-8
Java
false
false
250
java
package org.openmrs.module.rgrta.service; import org.springframework.transaction.annotation.Transactional; /** * @author Tammy Dugan * */ @Transactional public interface EncounterService extends org.openmrs.api.EncounterService { }
84cc3b4b6405fc20ba2b9a542758434429e6b6c6
51cc9acab04946897d50844c2a5d93b7e5e743eb
/Components/CommonCore/Source/gov/sandia/cognition/math/matrix/custom/ParallelMatrixFunction.java
3032ee3ae33c725277e02705c89ce0cddcdaf955
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
Markoy8/Foundry
c9da8bb224cf6fd089a7e5d700631e4c12280380
c3ec00a8efe08a25dd5eae7150b788e4486c0e6e
refs/heads/master
2021-06-28T09:40:51.709574
2020-12-10T08:20:26
2020-12-10T08:20:26
151,100,445
0
0
NOASSERTION
2018-10-01T14:16:01
2018-10-01T14:16:01
null
UTF-8
Java
false
false
7,778
java
/* * File: ParallelMatrixFunction.java * Authors: Jeremy D. Wendt * Company: Sandia National Laboratories * Project: Cognitive Foundry * * Copyright 2015, Sandia Corporation. Under the terms of Contract * DE-AC04-94AL85000, there is a non-exclusive license for use of this work by * or on behalf of the U.S. Government. Export of this program may require a * license from the United States Government. See CopyrightHistory.txt for * complete details. */ package gov.sandia.cognition.math.matrix.custom; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * This package-private class simplifies parallelizing Matrix operations. It * uses generics for defining the two (possibly different) input types, and the * output type. This should be used for parallel operations where the output can * be stored separately for each row (for instance in matrix/vector multiplies, * where the output is a vector with independent values for each row's output). * * @author Jeremy D. Wendt * @since 3.4.3 * @param <InputType1> The first part of the input * @param <InputType2> The second part of the input * @param <OutputType> The output type */ abstract class ParallelMatrixFunction<InputType1, InputType2, OutputType> implements Callable<Integer> { /** * The minimum index for the row that should be used in the operation (row * on input1, likely column on input2). */ protected int minRow; /** * The maximum index for the row that should be used in the operation * (not-inclusive (as in the for loop goes i = minRow; i &lt; maxRow); row * on input1, likely column on input2). */ protected int maxRow; /** * The left-part of the operation. For instance, in matrix-vector * multiplication, this is the matrix. Each thread should only read from * rows between minRow and maxRow (for caching purposes). This should not be * changed at all during the operations. */ protected InputType1 input1; /** * The right-part of the operation. For instance, in matrix-vector * multiplication, this is the vector. This should not be changed at all * during the operations. */ protected InputType2 input2; /** * The result of the operation. Each thread will only write to rows between * minRow and maxRow (not inclusive). The results of the operation will * alter this -- and the caller should maintain a copy. */ protected OutputType output; /** * Private because this should never be called. Ever. No matter what. */ private ParallelMatrixFunction() { throw new UnsupportedOperationException( "Null constructor not supported."); } /** * Passes in the necessary arguments to initialize an instance. Shallow * copies of all inputs are made. * * @param input1 The first input * @param input2 The second input * @param output The output -- the callee will see the results of the * parallel operations in this * @param minRow The minimum row for this thread to operate on * @param maxRow The maximum row (not inclusive) for this thread to operate * on */ public ParallelMatrixFunction( final InputType1 input1, final InputType2 input2, final OutputType output, final int minRow, final int maxRow) { this.input1 = input1; this.input2 = input2; this.output = output; this.minRow = minRow; this.maxRow = maxRow; } /** * This needs to be extended by operation-specific classes. NOTE: The return * type will be ignored (it's just required by the Callable interface). * * @return Is ignored. * @throws Exception Part of the interface. Please don't throw exceptions * unless you really need to. */ @Override abstract public Integer call() throws Exception; /** * This static method handles all the logic of splitting up the chunks of a * matrix problem and calling the chunks in parallel. * * @param <InputType1> The type for the left operand * @param <InputType2> The type for the right operand * @param <OutputType> The type for the result * @param input1 The left operand * @param input2 The right operand * @param output The result -- this will change as a result of operations * @param numPieces The number of pieces to split the problem into -- can be * more than the number of threads if you think the pieces may be non-equal * in size. * @param numThreads The number of threads to create for solving the problem * @param numRows The number of rows in the problem (usually input1's * numRows) * @param factory The factory for creating ParallelMatrixFunction instnaces */ public static <InputType1, InputType2, OutputType> void solve( final InputType1 input1, final InputType2 input2, final OutputType output, final int numPieces, final int numThreads, final int numRows, final Factory<InputType1, InputType2, OutputType> factory) { double numRowsPer = numRows / ((double) numPieces); numRowsPer = Math.max(numRowsPer, 1.0); List<ParallelMatrixFunction<InputType1, InputType2, OutputType>> pieces = new ArrayList<>( numPieces); int minRow, maxRow; minRow = 0; for (int i = 0; i < numPieces; ++i) { if (i == (numPieces - 1)) { maxRow = numRows; } else { maxRow = (int) Math.round((i + 1) * numRowsPer); } maxRow = Math.min(maxRow, numRows); pieces.add(factory.init(input1, input2, output, minRow, maxRow)); minRow = maxRow; // Break out early if there were more pieces than rows if (minRow >= numRows) { break; } } ExecutorService threads = Executors.newFixedThreadPool(numThreads); try { threads.invokeAll(pieces); } catch (InterruptedException e) { throw new RuntimeException("Threads stopped prematurely", e); } finally { threads.shutdown(); } } /** * A factory for creating the necessary parallel-aware solvers * * @param <InputType1> The left input's type * @param <InputType2> The right input's type * @param <OutputType> The output's type */ public static interface Factory<InputType1, InputType2, OutputType> { /** * Creates an instance of the parallel-aware solver with the input * values stored for the call method. * * @param input1 The left input * @param input2 The right input * @param output The output -- this will be altered by the call method * (between minRow (inclusive) and maxRow (not inclusive)). * @param minRow The minimum row to affect (inclusive) * @param maxRow The maximum row to affect (not inclusive) * @return A new instance of the correct parallel-aware solver with the * input values stored for the call method. */ ParallelMatrixFunction<InputType1, InputType2, OutputType> init( InputType1 input1, InputType2 input2, OutputType output, int minRow, int maxRow); } }
97b8b98801ce5429457510701e6b5475e381e50a
b04a04b297f6b6032d2558f21d6ace73f740454a
/src/sda/training/treesOwn/Node.java
8686240f3b6115d13b4c4335d633ea1c32f28ae7
[]
no_license
chrzasz/sda.training
e6f9fe1a59a354179ef5864b93fd55835003e4a9
6457b4090015cbb208ba530aa34d803597eda2db
refs/heads/master
2020-04-10T19:49:44.247390
2019-01-18T14:16:25
2019-01-18T14:16:25
152,871,567
0
0
null
null
null
null
UTF-8
Java
false
false
267
java
package sda.training.treesOwn; /** * Created by Grzegorz Chrzaszczyk on 21-10-2018 10:18 AM */ public class Node { int value; Node left; Node right; Node(int value) { this.value = value; right = null; left = null; } }
d9c64ffa52488cc138981e120d6cb9473a4208f8
b5bc67927e4bf1e0894e924aca10c701096a6c0c
/pet-clinic-data/src/main/java/prtk/springframework/sbpetclinic/services/map/AbstractMapService.java
e81c69b505978c98937551ae4ce12354abdddee6
[]
no_license
erprtkjn/sb-pet-clinic
032a3d88e8bfb59c1d10baf70f5aa91a53745bcc
75c7655485cdd298d15359247790820c501597e7
refs/heads/master
2022-10-25T04:59:39.870346
2020-06-17T23:03:43
2020-06-17T23:03:43
262,157,746
0
0
null
2020-06-11T23:51:20
2020-05-07T21:01:31
Java
UTF-8
Java
false
false
912
java
package prtk.springframework.sbpetclinic.services.map; import prtk.springframework.sbpetclinic.model.BaseEntity; import java.util.*; public abstract class AbstractMapService<T extends BaseEntity, ID extends Long> { protected Map<Long, T> map = new HashMap<>(); Set<T> findAll() { return new HashSet<>(map.values()); } T findById(ID id) { return map.get(id); } T save(T object) { map.put(getNextId(), object); return object; } void deleteByID(ID id) { map.remove(id); } void delete(T object) { map.entrySet().removeIf(idtEntry -> idtEntry.getValue().equals(object)); } private Long getNextId() { Long nextId = null; try { nextId = Collections.max(map.keySet()) + 1; } catch (NoSuchElementException e) { nextId = 1L; } return nextId; } }
79e4e844756abf842453ebf02b5031944e861147
4438e0d6d65b9fd8c782d5e13363f3990747fb60
/mobile-dto/src/main/java/com/cencosud/mobile/dto/users/EstadoCumpleResumenDTO.java
882d44723c0caee27631eda85ed036ad668a5cb8
[]
no_license
cencosudweb/mobile
82452af7da189ed6f81637f8ebabea0dbd241b4a
37a3a514b48d09b9dc93e90987715d979e5414b6
refs/heads/master
2021-09-01T21:41:24.713624
2017-12-28T19:34:28
2017-12-28T19:34:28
115,652,291
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package com.cencosud.mobile.dto.users; import java.io.Serializable; import org.apache.commons.lang.builder.ToStringBuilder; /** * * @author jose * */ public class EstadoCumpleResumenDTO implements Serializable { private static final long serialVersionUID = 3657265432071279059L; private Long id; private String description; public EstadoCumpleResumenDTO() { } public EstadoCumpleResumenDTO(Long id) { this.id = id; } @Override public String toString() { return ToStringBuilder.reflectionToString(this); } public Long getId() { return id; } public String getDescription() { return description; } public void setId(Long id) { this.id = id; } public void setDescription(String description) { this.description = description; } }
8223b16c935df2e66e4863a0596cdd6893d056a8
26ce2e5d791da69b0c88821320631a4daaa5228c
/src/main/java/br/com/swconsultoria/efd/contribuicoes/registros/blocoA/RegistroA111.java
13716f389a645f28e00811430b39b3c93ce5258e
[ "MIT" ]
permissive
Samuel-Oliveira/Java-Efd-Contribuicoes
b3ac3b76f82a29e22ee37c3fb0334d801306c1d4
da29df5694e27024df3aeda579936c792fac0815
refs/heads/master
2023-08-04T06:39:32.644218
2023-07-28T00:39:59
2023-07-28T00:39:59
94,896,966
8
6
MIT
2022-04-06T15:30:13
2017-06-20T13:55:12
Java
UTF-8
Java
false
false
765
java
/** * */ package br.com.swconsultoria.efd.contribuicoes.registros.blocoA; /** * @author Yuri Lemes * */ public class RegistroA111 { private final String reg = "A111"; private String num_proc; private String ind_proc; /** * @return the num_proc */ public String getNum_proc() { return num_proc; } /** * @param num_proc * the num_proc to set */ public void setNum_proc(String num_proc) { this.num_proc = num_proc; } /** * @return the ind_proc */ public String getInd_proc() { return ind_proc; } /** * @param ind_proc * the ind_proc to set */ public void setInd_proc(String ind_proc) { this.ind_proc = ind_proc; } /** * @return the reg */ public String getReg() { return reg; } }
c07769495dd2dc37ec243d45f7b2b31c77a6c986
a0e3385a3ed9e969b0ed5ff8849591810450d29a
/Version6/RepairPlan.java
ac87f866ebe737e92feabcbd82e60febf155feb3
[]
no_license
mountainrider56/372GroupProject1
b935b3541db93d4ebd904008389d696ccc88dc3e
e7fe672888b8ad706911de84906615c5fae3b2ce
refs/heads/master
2021-05-22T22:24:31.193639
2020-04-19T02:18:39
2020-04-19T02:18:39
253,124,152
0
1
null
2020-04-17T12:55:14
2020-04-05T00:17:04
Java
UTF-8
Java
false
false
1,113
java
public class RepairPlan { private Customer customer; private Appliance appliance; // public double balance ; public RepairPlan(Customer customer, Appliance appliance) { this.customer = customer; this.appliance = appliance; customer.setEnrolledInRepairPlanStatus(true); // this.balance = 0 ; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public Appliance getAppliance() { return appliance; } public void setAppliance(Appliance appliance) { this.appliance = appliance; } // public double getBalance() { // return balance; // } // public void setBalance(double balance) { // this.balance = balance; // } /** * String form of the appliance * */ public String toString() { return "Customer Name :" + customer.getName() + ", phone : " + customer.getPhone() + ", Id : " + customer.getId() + "\n" + ", Account Balance : " + customer.getAccountBalance() + "-----" + " Appliance Brand : " + appliance.getBrandName() + ", Model :" + appliance.getModelName() + "\n" + "\n"; } }
aeff6d772bd1fc2e812a5c33bf8d134fe7d9816d
2d7181a3c0f2d1191dffd355fd826aa829e5fd39
/src/test/java/cn/spsilab/locatethings/ExampleUnitTest.java
03712c0f043794ec1eedd546f79b1bdb3b854657
[]
no_license
spsi308/LocateThings
74f8fb0599acfbef0a525879fcebaeec7f288584
ce3bf8922ebbdb9f73277ffa0130f93d663791a4
refs/heads/master
2021-01-19T11:57:58.093046
2017-03-07T02:48:13
2017-03-07T02:48:13
82,274,154
1
0
null
null
null
null
UTF-8
Java
false
false
401
java
package cn.spsilab.locatethings; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
0e93980617a123713a10db1f8d41d312314f28cb
150a9ece3d89c58a836993cf0be11d1946bf5171
/editCount.java
bb6addb0ae394a22b892f955c30b3a7b5d44a75f
[]
no_license
kvt3/CrackTheCoding
1ea13d66d92ea6a09a519bf4ee9bbef7b46d13cd
b251ff5c365888baf95ad6f1dd975695689f7b50
refs/heads/master
2021-07-08T21:55:43.792127
2017-10-07T23:25:19
2017-10-07T23:25:19
104,755,011
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package practice; /* complexit is O(n) */ public class editCount { public static void main(String[] args) { // TODO Auto-generated method stub boolean a = checkEdit("pale","ple"); boolean b = checkEdit("pales","pale"); boolean c = checkEdit("pale","bale"); boolean d = checkEdit("pale","bake"); System.out.println(a+"\n"+b+"\n"+c+"\n"+d); } public static boolean checkEdit(String str1, String str2){ int len1 = str1.length(); int len2 = str2.length(); int cnt=0; int i = 0; int j = 0; while(j< len2 && i < len1){ if(len1 == len2){ /*replace operation*/ if(str1.charAt(i) != str2.charAt(j)){ cnt++; } } else if((len1 - len2) == 1){ /*remove operation*/ if(str1.charAt(i) != str2.charAt(j)){ cnt++; j--; } }else if((len2 - len1) == 1){ /*insert operation*/ if(str1.charAt(i) != str2.charAt(j)){ cnt++; i--; } }else{ return false; } i++; j++; } if(cnt > 1){ return false; }else{ return true; } } }
4a83fe610ac4292bdcdf6a04b40008323cd35c70
cff261e541ba1cbe97d51928cf545cadb42530b4
/Old/World/Blocks/Abstract/TriggerableBlock.java
4f198d587ef8c1cfafa7b2f48f00016553149577
[]
no_license
GlitchyDev/GANOS
080362dfe15f5dc723c5ce2a175df58c36f4354d
36bc08bdad282b54222f2677e576383ad80b5b7a
refs/heads/master
2021-01-09T05:34:21.552164
2019-10-19T01:18:28
2019-10-19T01:18:28
169,134,299
2
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package com.GlitchyDev.Old.World.Blocks.Abstract; import com.GlitchyDev.Old.World.Entities.EntityBase; import com.GlitchyDev.Old.World.Entities.MovementType; public interface TriggerableBlock { /** * Triggered when an EntityBase enters a TriggerableBlock, is not final * @param movementType * @param entityBase * @return Success of movement */ boolean enterBlock(MovementType movementType, EntityBase entityBase); /** * Triggered when an EntityBase exits a TriggerableBlock, is not final * @param movementType * @param entityBase * @return Success of movement */ boolean exitBlock(MovementType movementType, EntityBase entityBase); /** * Triggered when an EntityBase enters a TriggerableBlock successfully * @param movementType * @param entityBase * @return Success of movement */ void enterBlockSccessfully(MovementType movementType, EntityBase entityBase); /** * Triggered when an EntityBase exits a TriggerableBlock successfully * @param movementType * @param entityBase * @return Success of movement */ void exitBlockSuccessfully(MovementType movementType, EntityBase entityBase); }
f47892f4a94d3da3c8acc36695f8d582401d6d24
05b272f20f40c2b7848d88a7eea4b12f1c828824
/MiniJava/src/main/java/scanner/ScannerFacade.java
cb6254cda53d1378be35afcee623e6ca4b4ac009
[ "MIT" ]
permissive
ArvinSamiei/session5SeLab
de9aafbc2ab444b74573bcf9d8e95fc0fd884abc
6dd42125a36218c62f7c7181ecbd44ce5f57a06a
refs/heads/master
2023-01-05T22:08:24.269766
2020-11-09T16:01:44
2020-11-09T16:01:44
311,392,948
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package scanner; import scanner.token.Token; import java.util.Scanner; public class ScannerFacade { private LexicalAnalyzer lexicalAnalyzer; public ScannerFacade(Scanner scanner) { this.lexicalAnalyzer = new LexicalAnalyzer(scanner); } public Token getNextToken() { return lexicalAnalyzer.getNextToken(); } }
f8311eaa69c323ce7306a173b0adc2f0986c2d7a
6045ce2e867ba53818f68457e4903f23b7ecda76
/src/main/java/com/nanyin/repository/ProjectStatusRepository.java
0b5d9adf4ca90179b79649fd0aff6a90e7765116
[]
no_license
sixminutestogg/ssm-web-project
b61ca35b5cfe2b36c07ba966e72107171e1c0c36
1e1e4eccad3c8550f0816fd991128e2acb43ddcf
refs/heads/master
2020-06-22T23:58:09.954526
2019-07-23T09:13:59
2019-07-23T09:13:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package com.nanyin.repository; import com.nanyin.entity.Project; import com.nanyin.entity.ProjectLevel; import com.nanyin.entity.ProjectStatus; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Component; import java.util.List; @Component public interface ProjectStatusRepository extends JpaRepository<ProjectStatus,Integer> { List<ProjectStatus> findByOrderByOrdAsc(); }
b34382606ff6a1a17eb8966ab13ee83af279944b
5fecc7dad99fed02521b59af0bcd0bdedbdc089c
/radixeng/src/main/java/br/radixeng/controller/GraphController.java
1a58f41d45bdfce9e52df83609062f7966236c97
[]
no_license
rodrigo020295/projeto-de-rotas
73d19784d703436eaac54d167488fa84b5b56f0c
9dff0e32789754e804cad9f001c005ad5cd59a63
refs/heads/main
2023-04-07T04:02:42.169259
2021-04-23T13:16:19
2021-04-23T13:16:19
360,870,405
1
0
null
null
null
null
UTF-8
Java
false
false
2,941
java
package br.radixeng.controller; import br.radixeng.model.Graph; import br.radixeng.model.Route; import br.radixeng.model.Routes; import br.radixeng.service.GraphService; import br.radixreng.model.RouteDistance; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class GraphController { private final GraphService graphService; public GraphController(GraphService graphService) { this.graphService = graphService; } @PostMapping(path = "/graph") public ResponseEntity createGraph(@RequestBody Graph graph) { if (graph.isSameSourceAndTarget(graph.getData())) { return new ResponseEntity("Existem rota(s) com saída e destino iguais", HttpStatus.BAD_REQUEST); } for (Route route : graph.getData()) { route.setGraph(graph); } Graph graphResponse = graphService.createGraph(graph); return new ResponseEntity(graphResponse, HttpStatus.CREATED); } @GetMapping(path = "/graph/{graphId}") public ResponseEntity findById(@PathVariable Integer graphId) { return graphService.findById(graphId) .map(record -> ResponseEntity.ok().body(record)) .orElse(new ResponseEntity("Grafo não localizado", HttpStatus.NOT_FOUND)); } @PostMapping(path = "/routes/from/{town1}/to/{town2}") public ResponseEntity findAvariableRoutes(@RequestBody Graph graph, @PathVariable String town1, @PathVariable String town2, @RequestParam Integer maxStop) { Route.createRouteList(graph.getData()); List<Routes> routesList = Route.calculateTrips(town1, town2, t -> t <= maxStop, maxStop); if (routesList.isEmpty()) { return new ResponseEntity("Grafo não localizado", HttpStatus.NOT_FOUND); } else { return new ResponseEntity(routesList, HttpStatus.OK); } } @PostMapping(path = "/distance/from/{town1}/to/{town2}") public ResponseEntity findMinimumRouteDistance(@RequestBody Graph graph, @PathVariable String town1, @PathVariable String town2) { if (town1.equalsIgnoreCase(town2)) { return new ResponseEntity(0, HttpStatus.OK); } Route.createRouteList(graph.getData()); RouteDistance routeDistance = Route.findMinimumRouteDistance(town1, town2); if (routeDistance == null) { return new ResponseEntity(-1, HttpStatus.NOT_FOUND); } return new ResponseEntity(routeDistance, HttpStatus.OK); } }
[ "Cliente@Cliente-PC" ]
Cliente@Cliente-PC
3ab551aef570f1ea8b20c6162b1fceff2c15b718
7ebfc9e651fefad56676c37f7a62fb7b22b525be
/baseproject-framework-monitor/src/main/java/com/baseproject/framework/monitor/BaseProjectFrameworkMonitorApplication.java
3fdd27e73cd77aed7ebb37fc4a4a648f7192671c
[]
no_license
yelanting/ManagePlatformBaseProjectFramework
a92ca5089d4a9729da245432ed1e0eb902022668
0069349422ec065b687f7d817a8675917f98094f
refs/heads/master
2023-01-03T11:47:23.572249
2019-11-19T08:55:22
2019-11-19T08:55:22
222,648,949
0
0
null
2022-12-10T07:13:39
2019-11-19T08:42:32
Java
UTF-8
Java
false
false
616
java
package com.baseproject.framework.monitor; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import de.codecentric.boot.admin.server.config.EnableAdminServer; /** * 启动器 * @author Administrator * @date Jan 15, 2019 */ @EnableAdminServer @EnableDiscoveryClient @SpringBootApplication public class BaseProjectFrameworkMonitorApplication { public static void main(String[] args) { SpringApplication.run(BaseProjectFrameworkMonitorApplication.class, args); } }
376c3d3a6d990f81bc6904a5e0e2cb26450e88f6
dc82250eb527587635ab439ba49cb215c686bc9a
/app/src/main/java/com/kotov/ffmpeg/custompager/PagerAdapter.java
15c494fb408f795af0c46bbb82834c244352ee04
[ "Apache-2.0" ]
permissive
dmitriykotov333/Ffmpeg_Android
e760b8075df6681efec4aa7ca6a76ed5fc0ef44c
59b02204b62f6733c6c8358f7bb077a912b1fb87
refs/heads/master
2023-02-23T02:46:19.376300
2021-01-30T16:54:56
2021-01-30T16:54:56
274,659,261
0
1
Apache-2.0
2021-01-30T18:11:04
2020-06-24T12:07:56
Java
UTF-8
Java
false
false
1,028
java
package com.kotov.ffmpeg.custompager; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.List; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; public class PagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public PagerAdapter(FragmentManager manager) { super(manager); } @NotNull @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } }
54de85f53c9735483c684562285ae46c87709187
dcb7ecb0eb558a3c5abff8cea875e4fa78f1f9f0
/src/main/java/com/web/config/WebMvcConfig.java
4488b3856926ae33cf97caacf1e214c60511d918
[]
no_license
lordchavez/oraclejson
90c9eacb44c5d94900bfe9ad479861474a434c13
ba2dac9243daddeb8e91d51b10e7917ae1e1d592
refs/heads/master
2023-06-17T18:39:13.361459
2021-07-12T19:51:05
2021-07-12T19:51:05
372,913,245
0
0
null
null
null
null
UTF-8
Java
false
false
1,123
java
package com.web.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @Configuration @EnableWebMvc public class WebMvcConfig extends WebMvcConfigurerAdapter { @Autowired AdminInterceptor adminInterceptor; // Static Resource Config @Override public void addResourceHandlers( ResourceHandlerRegistry registry ) { } @Override public void configureDefaultServletHandling( DefaultServletHandlerConfigurer configurer ) { configurer.enable(); } @Override public void addInterceptors( InterceptorRegistry registry ) { registry.addInterceptor( adminInterceptor ).addPathPatterns( "/" ); } }
055ac210977d3f995ec9af6f52ba1f4cdb16fbae
d9ea3ae7b2c4e9a586e61aed23e6e997eaa38687
/11.GOF23开发模式/★★★开发模式/代理模式/静态代理/exp1/WeddingCompany.java
8bce0bc7b0c846be6f6535849e27daf40ac5a426
[]
no_license
yuanhaocn/Fu-Zusheng-Java
6e5dcf9ef3d501102af7205bb81674f880352158
ab872bcfe36d985a651a5e12ecb6132ad4d2cb8e
refs/heads/master
2020-05-15T00:20:47.872967
2019-04-16T11:06:18
2019-04-16T11:06:18
null
0
0
null
null
null
null
GB18030
Java
false
false
544
java
package 静态代理.exp1; //2,代理角色--->代理class忙前忙后需要持有真实角色的引用 public class WeddingCompany implements Marry{ private You you; public WeddingCompany() { } public WeddingCompany(You you) { super(); this.you = you; } private void befor() { System.out.println("布置婚房。。。"); } private void after() { System.out.println("闹洞房。。。"); } @Override public void marry() { befor();//<<---代理给你忙前 you.marry(); after();//《---代理给你忙后 } }
d60b2cd667b6be1898b33ac636aafacb145a423a
110c90c7b659897324cff84cb00f9761fb4297cd
/c3.unicap.br.almir.ip1/src/lista8/Exercicio11_lista8.java
f5ca4b982aec91f96c23ec9329bf1ccdfc75ddfa
[ "MIT" ]
permissive
luisfelipe3d/base-cod-java
7ec580354c74484dde6942aaa5f97f8674bc161a
8a19086ab2e0c0e27f7f2a5dd616c0a49b40accb
refs/heads/master
2021-06-22T03:06:58.409961
2020-12-08T04:23:06
2020-12-08T04:23:06
146,921,903
0
2
MIT
2020-06-06T12:31:10
2018-08-31T17:17:12
Java
UTF-8
Java
false
false
2,490
java
/* Exercicio : Faça um programa em JAVA para ler o sexo(1-masculino, 2-feminino) e a altura de um grupo de 50 pessoas. O programa deve calcular; a) Altura média das mulheres e a altura média dos homens; b) A maior e o menor altura do grupo, dizendo se a altura é de um homem ou de uma mulher. */ package lista8; import java.util.Scanner; public class Exercicio11_lista8 { public static void main(String[] args) { Scanner in = new Scanner (System.in); int sexo,i=0; double altura_m=0,altura_h=0,maior_h=0,maior_m=0, menor_h=Integer.MAX_VALUE,media_h=0,media_m=0, menor_m=Integer.MAX_VALUE; do { do{ System.out.println("Digite seu sexo: "); System.out.println("1. Masculino."); System.out.println("2. Feminino."); System.out.print("sexo: "); sexo = in.nextInt(); } while (sexo != 1 && sexo != 2); switch(sexo){ case 1: System.out.print("Digite sua altura: "); altura_h = in.nextDouble(); if (altura_h > maior_h ) maior_h = altura_h; media_h = media_h + altura_h; if (altura_h < menor_h) menor_h = altura_h; break; case 2: System.out.print("Digite sua altura: "); altura_m = in.nextDouble(); if (altura_m > maior_m) maior_m = altura_m; media_m = (media_m + altura_m); if (altura_m < menor_m) menor_m = altura_m; break; default: System.out.println("Opção inválida!!"); } i++; } while (i !=4); if (maior_h > maior_m) System.out.println("Maior altura é: "+maior_h+". Homem."); else System.out.println("Maior altura é: "+maior_m+". Mulher."); if (menor_h < menor_m) System.out.println("Menor altura é: "+menor_h+". Homem"); else System.out.println("Menor altura é: "+menor_m+". Mulher."); System.out.println("Média Homens: "+(media_h/4)); System.out.println("Média Mulheres: "+(media_m/4)); } }
4afd9730fcf58bd377ff5df4d845882dbe216a7b
f1c15ca8530a06bbb827f770cfd0fffafa5d7f2c
/app/src/main/java/com/absolute/groove/mcentral/activities/LicenseActivity.java
2ebd952318d511a370c6b5769cb1b4dcf0ecd3a2
[]
no_license
rohitnotes/Music_Central
24313aa21cc43c8b1d7ebcabd635d69d30bcfef0
9f45cfa251b4578de134f81338712c1f59f944ff
refs/heads/master
2022-11-08T16:27:35.075339
2020-07-10T05:16:40
2020-07-10T05:16:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,110
java
/* * Copyright (c) 2019 Hemanth Savarala. * * Licensed under the GNU General Public License v3 * * This is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by * the Free Software Foundation either version 3 of the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. */ package com.absolute.groove.mcentral.activities; import android.graphics.Color; import android.os.Bundle; import android.view.MenuItem; import android.webkit.WebView; import androidx.annotation.NonNull; import androidx.appcompat.widget.Toolbar; import org.jetbrains.annotations.Nullable; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import com.absolute.groove.appthemehelper.ThemeStore; import com.absolute.groove.appthemehelper.util.ATHUtil; import com.absolute.groove.appthemehelper.util.ColorUtil; import com.absolute.groove.appthemehelper.util.ToolbarContentTintHelper; import com.absolute.groove.mcentral.R; import com.absolute.groove.mcentral.activities.base.AbsBaseActivity; /** * Created by hemanths on 2019-09-27. */ public class LicenseActivity extends AbsBaseActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { setDrawUnderStatusBar(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_license); setStatusbarColorAuto(); setNavigationbarColorAuto(); setLightNavigationBar(true); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ToolbarContentTintHelper.colorBackButton(toolbar); toolbar.setBackgroundColor(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface)); WebView webView = findViewById(R.id.license); try { StringBuilder buf = new StringBuilder(); InputStream json = getAssets().open("oldindex.html"); BufferedReader in = new BufferedReader(new InputStreamReader(json, StandardCharsets.UTF_8)); String str; while ((str = in.readLine()) != null) { buf.append(str); } in.close(); // Inject color values for WebView body background and links final boolean isDark = ATHUtil.INSTANCE.isWindowBackgroundDark(this); final String backgroundColor = colorToCSS(ATHUtil.INSTANCE.resolveColor(this, R.attr.colorSurface, Color.parseColor(isDark ? "#424242" : "#ffffff"))); final String contentColor = colorToCSS(Color.parseColor(isDark ? "#ffffff" : "#000000")); final String changeLog = buf.toString() .replace("{style-placeholder}", String.format("body { background-color: %s; color: %s; }", backgroundColor, contentColor)) .replace("{link-color}", colorToCSS(ThemeStore.Companion.accentColor(this))) .replace("{link-color-active}", colorToCSS(ColorUtil.INSTANCE.lightenColor(ThemeStore.Companion.accentColor(this)))); webView.loadData(changeLog, "text/html", "UTF-8"); } catch (Throwable e) { webView.loadData("<h1>Unable to load</h1><p>" + e.getLocalizedMessage() + "</p>", "text/html", "UTF-8"); } } @Override public boolean onOptionsItemSelected(@NonNull MenuItem item) { if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } return super.onOptionsItemSelected(item); } private String colorToCSS(int color) { return String.format("rgb(%d, %d, %d)", Color.red(color), Color.green(color), Color.blue(color)); // on API 29, WebView doesn't load with hex colors } }
d6828713eb071dafd99ee2e454bb34ca9ddde993
5be8c5c03c12e05d845c3102ff0a2948cf6638a8
/core/camel-support/src/main/java/org/apache/camel/support/resume/ResumeActionAwareAdapter.java
563f64c88892656ac716b16b26802dadf6d8917e
[ "Apache-2.0" ]
permissive
Talend/apache-camel
cfc4657dc28a6c5701854b0889b9e0d090675b05
fe9484bf5236f7af665c35cc7ed29527def8fe48
refs/heads/master
2023-08-10T14:15:19.145861
2023-06-28T06:30:44
2023-06-28T06:30:44
35,226,644
15
61
Apache-2.0
2023-08-29T11:53:02
2015-05-07T15:03:34
Java
UTF-8
Java
false
false
2,804
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.support.resume; import java.nio.ByteBuffer; import org.apache.camel.resume.Cacheable; import org.apache.camel.resume.Deserializable; import org.apache.camel.resume.Offset; import org.apache.camel.resume.OffsetKey; import org.apache.camel.resume.ResumeAction; import org.apache.camel.resume.ResumeActionAware; import org.apache.camel.resume.ResumeAdapter; import org.apache.camel.resume.cache.ResumeCache; import org.apache.camel.spi.annotations.JdkService; /** * A simple resume adapter that support caching, deserialization and actions. This is usually suitable for supporting * resume operations that have simple cache storage requirements, but delegate the resume action to the integrations * (i.e.: such as when resuming from database components, where the resume operation can only be determined by the * integration itself) */ @JdkService(ResumeAdapter.RESUME_ADAPTER_FACTORY) public class ResumeActionAwareAdapter implements ResumeActionAware, Cacheable, Deserializable { private ResumeCache<Object> cache; private ResumeAction resumeAction; @Override public void setResumeAction(ResumeAction resumeAction) { this.resumeAction = resumeAction; } @Override public void resume() { cache.forEach(resumeAction::evalEntry); } private boolean add(Object key, Object offset) { cache.add(key, offset); return true; } @Override public boolean add(OffsetKey<?> key, Offset<?> offset) { return add(key.getValue(), offset.getValue()); } @Override public void setCache(ResumeCache<?> cache) { this.cache = (ResumeCache<Object>) cache; } @Override public ResumeCache<?> getCache() { return cache; } @Override public boolean deserialize(ByteBuffer keyBuffer, ByteBuffer valueBuffer) { Object key = deserializeKey(keyBuffer); Object value = deserializeValue(valueBuffer); return add(key, value); } }
072cec80546ea854ffcead58ab6b91c3f17a97c4
2b85dd448a2f0ae0cd1ecce4b62729b170acdaaa
/code/src/de/rfh/crm/server/appointmentService/boundary/AppointmentServicePersistence.java
1766f1b4d9c24950dbcc698c85ece0737d7473e8
[]
no_license
ffmaikgodinho/RFH-WS2014-AppDev2-Projektarbeit
1ef3f4727aacd08a4ec18a47a819d9774a3c72ef
e1d1b496108729d3343019049d64cf80d54aa6be
refs/heads/master
2016-09-06T13:10:57.442082
2015-01-31T10:45:44
2015-01-31T10:45:44
27,626,535
0
0
null
null
null
null
UTF-8
Java
false
false
380
java
package de.rfh.crm.server.appointmentService.boundary; import java.util.UUID; import de.rfh.crm.server.appointmentService.entity.Appointment; public interface AppointmentServicePersistence { Appointment getAppointment(UUID id); void deleteAppointment(UUID id); void createAppointment(Appointment appointment); void updateAppointment(Appointment appointment); }
b8d177f33dd33fef49ea866d328c8173a0a72b41
34969093f70070018d216a913ec3a06b081bbfe0
/com/company/Solution867.java
59cc9aa6d217192bc14c04d0dffbcfa6f371c91e
[]
no_license
wsnwsn321/LeetcodeKiller
642c50c4fd1416b51dff719a6d3a00a02a777375
b98098cc690967816ad4b08f76760af302764baa
refs/heads/master
2021-06-06T16:39:37.047040
2020-02-23T03:36:34
2020-02-23T03:36:34
139,386,377
4
1
null
null
null
null
UTF-8
Java
false
false
697
java
package com.company; public class Solution867 { public static void main(String[] args) { int[][] A = new int[3][3]; int count = 0; for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[i].length; j++) { A[i][j] = count; } } transpose(A); System.out.println(); } public static int[][] transpose ( int[][] A) { int[][] result = new int[A[0].length][A.length]; for (int i = 0; i < A.length; i++) { for (int j = 0; j < A[0].length; j++) { result[j][i]=A[i][j]; } } return result; } }
[ "7758258wsn" ]
7758258wsn
a099a73e323e0c53d686a1ac8fc55f810b3c9df9
f3cedaf0a246058dab4a4d26c63352b8b5f9acbc
/src/main/java/com/genersoft/iot/vmp/web/ApiController.java
002b2cc52c3fb242b6890febf479ecc2b7045b7e
[]
no_license
tanbinh123/banma-GB28181Server
77ce0cf9c584dcb963f8ba655fbdd91c7c3a7362
60e99dc0912a231375619177e6b71216799c7f60
refs/heads/main
2023-02-28T12:03:24.330377
2021-02-05T01:59:02
2021-02-05T01:59:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,319
java
package com.genersoft.iot.vmp.web; import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.conf.SipConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; /** * 兼容LiveGBS的API:系统接口 */ @Controller @CrossOrigin @RequestMapping(value = "/api/v1") public class ApiController { private final static Logger logger = LoggerFactory.getLogger(ApiController.class); @Autowired private SipConfig sipConfig; @RequestMapping("/getserverinfo") private JSONObject getserverinfo(){ JSONObject result = new JSONObject(); result.put("Authorization","ceshi"); result.put("Hardware",""); result.put("InterfaceVersion","2.5.5"); result.put("IsDemo",""); result.put("Hardware","false"); result.put("APIAuth","false"); result.put("RemainDays","永久"); result.put("RunningTime",""); result.put("ServerTime","2020-09-02 17:11"); result.put("StartUpTime","2020-09-02 17:11"); result.put("Server",""); result.put("SIPSerial", sipConfig.getSipId()); result.put("SIPRealm", sipConfig.getSipDomain()); result.put("SIPHost", sipConfig.getSipIp()); result.put("SIPPort", sipConfig.getSipPort()); result.put("ChannelCount","1000"); result.put("VersionType",""); result.put("LogoMiniText",""); result.put("LogoText",""); result.put("CopyrightText",""); return result; } @RequestMapping(value = "/userinfo") private JSONObject userinfo(){ // JSONObject result = new JSONObject(); // result.put("ID","ceshi"); // result.put("Hardware",""); // result.put("InterfaceVersion","2.5.5"); // result.put("IsDemo",""); // result.put("Hardware","false"); // result.put("APIAuth","false"); // result.put("RemainDays","永久"); // result.put("RunningTime",""); // result.put("ServerTime","2020-09-02 17:11"); // result.put("StartUpTime","2020-09-02 17:11"); // result.put("Server",""); // result.put("SIPSerial", sipConfig.getSipId()); // result.put("SIPRealm", sipConfig.getSipDomain()); // result.put("SIPHost", sipConfig.getSipIp()); // result.put("SIPPort", sipConfig.getSipPort()); // result.put("ChannelCount","1000"); // result.put("VersionType",""); // result.put("LogoMiniText",""); // result.put("LogoText",""); // result.put("CopyrightText",""); return null; } /** * 系统接口 - 登录 * @param username 用户名 * @param password 密码(经过md5加密,32位长度,不带中划线,不区分大小写) * @return */ @RequestMapping(value = "/login") @ResponseBody private JSONObject login(String username,String password ){ if (logger.isDebugEnabled()) { logger.debug(String.format("模拟接口> 登录 API调用,username:%s ,password:%s ", username, password)); } JSONObject result = new JSONObject(); result.put("CookieToken","ynBDDiKMg"); result.put("URLToken","MOBkORkqnrnoVGcKIAHXppgfkNWRdV7utZSkDrI448Q.oxNjAxNTM4NDk3LCJwIjoiZGJjODg5NzliNzVj" + "Nzc2YmU5MzBjM2JjNjg1ZWFiNGI5ZjhhN2Y0N2RlZjg3NWUyOTJkY2VkYjkwYmEwMTA0NyIsInQiOjE2MDA5MzM2OTcsInUiOiI" + "4ODlkZDYyM2ViIn0eyJlIj.GciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJhb"); result.put("TokenTimeout",604800); result.put("AuthToken","MOBkORkqnrnoVGcKIAHXppgfkNWRdV7utZSkDrI448Q.oxNjAxNTM4NDk3LCJwIjoiZGJjODg5NzliNzVj" + "Nzc2YmU5MzBjM2JjNjg1ZWFiNGI5ZjhhN2Y0N2RlZjg3NWUyOTJkY2VkYjkwYmEwMTA0NyIsInQiOjE2MDA5MzM2OTcsInUiOiI" + "4ODlkZDYyM2ViIn0eyJlIj.GciOiJIUzI1NiIsInR5cCI6IkpXVCJ9eyJhb"); result.put("Token","ynBDDiKMg"); return result; } }
f5ad8fc772455520dbe65e630822ecbc71985de1
6ed3d3ec7861c3471747b1307d48b8f8e9d3f38f
/src/microsoft/exchange/webservices/data/XmlNameTable.java
62cdab18824d9f93c35b9059a14c8e65581728b4
[]
no_license
msld/EWS-Java-API
583c49a27e72f7282c07cde9439039941e843815
146467ed1a9b3684c038467fcc5265654460541d
refs/heads/master
2021-01-23T18:10:47.029613
2013-05-30T12:16:13
2013-05-30T12:16:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,390
java
/************************************************************************** * copyright file="XmlNameTable.java" company="Microsoft" * Copyright (c) Microsoft Corporation. All rights reserved. * * Defines the XmlNameTable.java. **************************************************************************/ package microsoft.exchange.webservices.data; import microsoft.exchange.webservices.data.exceptions.ArgumentNullException; import microsoft.exchange.webservices.data.exceptions.ArgumentOutOfRangeException; /** * Table of atomized String objects. */ public abstract class XmlNameTable { /** * Initializes a new instance of the XmlNameTable class. */ protected XmlNameTable() { }; /** * When overridden in a derived class, atomizes the specified String and * adds it to the XmlNameTable. * * @param array * : The name to add. * @return The new atomized String or the existing one if it already exists. * @throws System.ArgumentNullException * : array is null. */ public abstract String Add(String array); /** * Reads an XML Schema from the supplied stream. * * @param array * The character array containing the name to add. * @param offset * Zero-based index into the array specifying the first character * of the name. * @param length * The number of characters in the name. * @return The new atomized String or the existing one if it already exists. * If length is zero, String.Empty is returned * @throws System.IndexOutOfRangeException * 0 > offset -or- offset >= array.Length -or- length > * array.Length The above conditions do not cause an exception * to be thrown if length =0. * @throws System.ArgumentOutOfRangeException * length < 0. */ public abstract String Add(char[] array, int offset, int length); /** * When overridden in a derived class, gets the atomized String containing * the same value as the specified String. * * @param array * The name to look up. * @return The atomized String or null if the String has not already been * atomized. * @throws System.ArgumentNullException * : array is null. */ public abstract String Get(String array); /** * When overridden in a derived class, gets the atomized String containing * the same characters as the specified range of characters in the given * array. * * @param array * The character array containing the name to add. * @param offset * Zero-based index into the array specifying the first character * of the name. * @param length * The number of characters in the name. * @return The atomized String or null if the String has not already been * atomized. If length is zero, String.Empty is returned * @throws System.IndexOutOfRangeException * 0 > offset -or- offset >= array.Length -or- length > * array.Length The above conditions do not cause an exception * to be thrown if length =0. * @throws System.ArgumentOutOfRangeException * length < 0. */ public abstract String Get(char[] array, int offset, int length); }
[ "therion66" ]
therion66
f42eb3a0abd2978124351443664c3b8f3824dd05
40d8b6f24e4a549dfd91552acf1a49b47eff0113
/src/main/java/com/shieldbug1/core/api/package-info.java
c4a262bb12c913d401f97d27d9d6dc5572ec724e
[]
no_license
TheGreyGhost/S1Core
b224d97229dc049967f848e00826c5ef7201fe04
673a712e8784055d637d9ea861ee2cd5faf430d2
refs/heads/master
2020-12-03T06:32:41.704471
2014-12-30T11:46:59
2014-12-30T11:46:59
29,300,358
1
1
null
2015-01-15T14:14:24
2015-01-15T14:14:22
Java
UTF-8
Java
false
false
2,819
java
/** * This package is all public 'api'. Anything here is less library based, and more based more on modding. * This allows interfaces, methods, etc, to be stripped at runtime through use of {@code @Optional.*} annotations. * <br></br> * The {@link S1CoreAPI} class contains methods intended to be used by other mods, as these methods are guaranteed * not to change on short notice. * <br></br> * The API contract: * <br></br> * <ol> * <li>Deprecation Phases</li> * <ol> * <li> * Available: This applies to most things included in this API. If something is 'available', it is the * 'recommended' way of doing something. Something marked as 'Available' cannot be removed without going * through the deprecation cycle. * </li> * <li> * Beta: This applies to anything that is marked with a {@code @Beta} annotation. If something is marked * as Beta, it can be changed or removed at any time. If a class file is marked as beta, both the class * and any material contained by the class should be assumed as Beta. Material marked as 'Beta' could also * be relatively safe to use - look for any JavaDoc to see any further information. Reasons something may * be marked as 'Beta' include: * <ul> * <li>Instability</li> * <li>Known bugs</li> * <li>New/Developing Idea</li> * </ul> * </li> * <li> * Deprecated: This applies to anything that is marked with a {@code @Deprecated} annotation. If something * from the available state is going to be removed, it will be marked as deprecated for the duration of: * <ul> * <li>Two weeks - if the feature is small, or relatively unused,</li> * <li>The next minor version change of the API, if the feature is relatively small, * but requires medium to large changes of code, or</li> * <li>The next major version change of the API, if the feature is large and/or requires a large * amount of change in code.</li> * </ul> * Material marked as 'Deprecated' will always also contain an alternative and an explanation for * deprecation, as well as the deprecation date. Please note that there is another reason for the use * of the {@code @Deprecated} annotation, which is on material that should not be accessed as it * is there for internal purposes only. * </li> * </ol> * </ol> */ @API(apiVersion = "1.0", owner = S1Core.MOD_ID, provides = "S1CORE|API") package com.shieldbug1.core.api; //TODO continue API contract import net.minecraftforge.fml.common.API; import com.shieldbug1.core.S1Core;
91ca3c70033331ddf018f21e1ec467a7d131cfbc
e895898ba0b622ae8a01d82d444c5c5827cd7861
/src/main/java/org/prettycat/dataflow/asm/XMLProtocol.java
4d1929cccde0830b0bd23912ab8e0873e6ca929a
[]
no_license
lschuetze/asm-dataflow
4142885268bb3b37258d288e59518ba75be870f1
dfdcd8dbc77ac981827139fdc05ca16c8d88dba0
refs/heads/master
2021-01-21T10:19:41.094799
2017-08-31T12:05:53
2017-08-31T12:05:53
101,978,453
0
0
null
null
null
null
UTF-8
Java
false
false
2,618
java
package org.prettycat.dataflow.asm; import org.w3c.dom.Document; import org.w3c.dom.Element; public class XMLProtocol { public static final String NAMESPACE = "https://xmlns.zombofant.net/prettycat/1.0/asm"; public static Element createASMElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "asm"); return result; } public static Element createMethodElement( Document doc, String fqmn) { Element result = doc.createElementNS(NAMESPACE, "method"); result.setAttribute("id", fqmn); return result; } public static Element createParametersElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "parameters"); return result; } public static Element createParameterElement( Document doc, String uid, String fqtn) { Element result = doc.createElementNS(NAMESPACE, "parameter"); result.setAttribute("id", uid); result.setAttribute("type", fqtn); return result; } public static Element createInstructionsElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "insns"); return result; } public static Element createInstructionElement( Document doc, int opcode, int lineNumber, String uid) { Element result = doc.createElementNS(NAMESPACE, "insn"); result.setAttribute("opcode", ""+opcode); result.setAttribute("line", ""+lineNumber); result.setAttribute("id", uid); return result; } public static Element createExitsElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "exits"); return result; } public static Element createExitElement( Document doc, String uid, boolean exceptional) { Element result = doc.createElementNS(NAMESPACE, "exit"); result.setAttribute("to", uid); result.setAttribute("exceptional", ""+exceptional); return result; } public static Element createInputsElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "inputs"); return result; } public static Element createInputElement( Document doc) { Element result = doc.createElementNS(NAMESPACE, "input"); return result; } public static Element createValueOfElement(Document doc, String uid) { Element result = doc.createElementNS(NAMESPACE, "value-of"); result.setAttribute("from", uid); return result; } public static Element createUnknownElement(Document doc) { Element result = doc.createElementNS(NAMESPACE, "unknown"); return result; } public static Element createMergeElement(Document doc) { Element result = doc.createElementNS(NAMESPACE, "merge"); return result; } }
f9c888b185de3e5a5f37d76bd8b6ad88e7684e77
e1256cf6e84d0abdffffb0846ba5fb8020ebb7b6
/src/edu/cmu/weikunl/mochifitness/MainFragment.java
93971427a99f0f227a43c637da39893d5a130360
[]
no_license
weikunliang/MochiFitness
3fb9aecf0090cfad9eb107cf99f4ef0ad17b4f39
f3457feb34d2cd570977a25de3311c8a2bf2b411
refs/heads/master
2021-01-23T07:26:07.498015
2015-02-07T08:08:17
2015-02-07T08:08:17
30,441,978
0
0
null
null
null
null
UTF-8
Java
false
false
2,747
java
package edu.cmu.weikunl.mochifitness; import java.util.Arrays; import com.facebook.Session; import com.facebook.SessionState; import com.facebook.UiLifecycleHelper; import com.facebook.widget.LoginButton; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MainFragment extends Fragment { private static final String TAG = "MainFragment"; private UiLifecycleHelper uiHelper; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.activity_main, container, false); LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton); authButton.setFragment(this); authButton.setReadPermissions(Arrays.asList("user_likes", "user_status")); return view; } private void onSessionStateChange(Session session, SessionState state, Exception exception) { if (state.isOpened()) { Log.i(TAG, "Logged in..."); } else if (state.isClosed()) { Log.i(TAG, "Logged out..."); } } private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { onSessionStateChange(session, state, exception); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(getActivity(), callback); uiHelper.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); // For scenarios where the main activity is launched and user // session is not null, the session state change notification // may not be triggered. Trigger it if it's open/closed. Session session = Session.getActiveSession(); if (session != null && (session.isOpened() || session.isClosed()) ) { onSessionStateChange(session, session.getState(), null); } uiHelper.onResume(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } }
27dd5d3006747247e80c676d504dd404a96d43ba
40665051fadf3fb75e5a8f655362126c1a2a3af6
/ibinti-bugvm/389dda9293e5de1e85cc1b1250b3ce1dc7486a67/4954/AsymmetricCipherKeyPairGenerator.java
919f92b3f113a1a70735ecd785201ad486ddf363
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
591
java
package com.bugvm.bouncycastle.crypto; /** * interface that a public/private key pair generator should conform to. */ public interface AsymmetricCipherKeyPairGenerator { /** * intialise the key pair generator. * * @param param the parameters the key pair is to be initialised with. */ public void init(KeyGenerationParameters param); /** * return an AsymmetricCipherKeyPair containing the generated keys. * * @return an AsymmetricCipherKeyPair containing the generated keys. */ public AsymmetricCipherKeyPair generateKeyPair(); }
2778f11737a9f7a2683d727ebd84c798dad5861f
c0b960db047482c249b1e7e74abaaf5171a56b8f
/src/algorithm/OrdenarVetor.java
e15b6382155cf63941b5ec1094456ad3698cea39
[]
no_license
jonatasrd/logica
7e0054f69391a78a1b3561a176928157fd5c09aa
7e614f135f1c8e7dfaa2a58ec416f077da8abe82
refs/heads/master
2021-09-09T17:49:58.661154
2018-03-18T18:09:27
2018-03-18T18:09:27
125,625,886
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package algorithm; public class OrdenarVetor { public static void main(String[] args) { int quantidade = 10000; int[] vetor = new int[quantidade]; for (int i = 0; i < vetor.length; i++) { vetor[i] = (int) (Math.random() * quantidade); } long tempoInicial = System.currentTimeMillis(); ordernaVetor(vetor); long tempoFinal = System.currentTimeMillis(); System.out.println("Executado em = " + (tempoFinal - tempoInicial) + " ms"); } public static int[] ordernaVetor(int vetor[]) { for (int i = 0; i < vetor.length; i++) { for (int j = i + 1; j < vetor.length; j++) { int temp; if (vetor[i] > vetor[j]) { temp = vetor[j]; vetor[j] = vetor[i]; vetor[i] = temp; } } } return vetor; } }
07211f3ed156c104ebe5695f60b07592c54df5fa
5621138cff27c31e979c78063ac82ff44c83aec0
/src/minecraft/mattparks/mods/starcraft/mercury/wgen/village/GCMercuryComponentVillageStartPiece.java
3056efe48d3d8dd806c031c1f33d068aa06633d2
[]
no_license
nikolaStarcraft/Starcraft-2
efbde65f26ee4889a6fc384a7fe7add09396f59a
6405557ab9bcf1c24514722b3599ab77c8f48231
refs/heads/master
2021-01-15T10:52:27.109300
2014-03-01T10:42:07
2014-03-01T10:42:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,674
java
package mattparks.mods.starcraft.mercury.wgen.village; import java.util.ArrayList; import java.util.Random; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.biome.WorldChunkManager; public class GCMercuryComponentVillageStartPiece extends GCMercuryComponentVillageWell { public WorldChunkManager worldChunkMngr; public int terrainType; public GCMercuryStructureVillagePieceWeight structVillagePieceWeight; public ArrayList<GCMercuryStructureVillagePieceWeight> structureVillageWeightedPieceList; public ArrayList<Object> field_74932_i = new ArrayList<Object>(); public ArrayList<Object> field_74930_j = new ArrayList<Object>(); public GCMercuryComponentVillageStartPiece() { } public GCMercuryComponentVillageStartPiece(WorldChunkManager par1WorldChunkManager, int par2, Random par3Random, int par4, int par5, ArrayList<GCMercuryStructureVillagePieceWeight> par6ArrayList, int par7) { super((GCMercuryComponentVillageStartPiece) null, 0, par3Random, par4, par5); this.worldChunkMngr = par1WorldChunkManager; this.structureVillageWeightedPieceList = par6ArrayList; this.terrainType = par7; this.startPiece = this; } @Override protected void func_143012_a(NBTTagCompound nbt) { super.func_143012_a(nbt); nbt.setInteger("TerrainType", this.terrainType); } @Override protected void func_143011_b(NBTTagCompound nbt) { super.func_143011_b(nbt); this.terrainType = nbt.getInteger("TerrainType"); } public WorldChunkManager getWorldChunkManager() { return this.worldChunkMngr; } }
086dc2c1b07bf9dfe285902cb6e99cea1014e763
4d99c23aafa01d2ce6f7ca3cf944751e304f4b68
/BSc-Assignments-master/Vote-Counting/Candidate.java
ae526db11c0581ce04113a4e84d73dcbd39f73f3
[]
no_license
sam-o-floinn/academic
c53b82de1f0080e9a75313ab5bf05b7cee82c80b
e69aae9c610185ef0f18aa54fd3d0156abdadca0
refs/heads/master
2022-04-21T05:56:17.864851
2020-04-14T16:59:53
2020-04-14T16:59:53
255,659,322
0
0
null
null
null
null
UTF-8
Java
false
false
746
java
/* @author Sam O'Floinn, 109539794. Created for Assignment A4, CS2504, Kieran Herley. * This class creates a candidate to be elected in an election. * Here, we define their name and party, and also the methods for users to retrieve these. * */ public class Candidate { /* The candidate's name and party are defined at object-creation time by the user. */ public Candidate(String name, String party) { candidateName = name; candidateParty = party; } /* These two getter methods retrieve both the candidate's name and party. */ public String getName() { return candidateName; } public String getParty() { return candidateParty; } private String candidateName; private String candidateParty; }
86ea0359ce677210bff35e375f9f31545a86ffe7
5d4cc5c19edcd3d92c14074be439897b14c3d563
/model/src/main/java/tarce/model/FindProductByConditionResponse.java
71e98385009745053e26d535ac9f18fbdc46df7f
[]
no_license
zouwansheng/MyOdoo
752325a6f60a936c9ed42fdadfe5fa6c92cafe0a
df18ec69164020fac6604b68022b9122aa5c206f
refs/heads/master
2021-01-22T07:42:36.469579
2017-05-27T05:21:52
2017-05-27T05:21:52
92,573,104
1
0
null
2017-05-27T05:25:02
2017-05-27T05:25:02
null
UTF-8
Java
false
false
5,957
java
package tarce.model; import java.io.Serializable; import java.text.DecimalFormat; /** * Created by Daniel.Xu on 2017/2/8. */ public class FindProductByConditionResponse { /** * jsonrpc : 2.0 * id : null * result : {"res_data":{"product":{"area":{"id":false,"name":false},"image_medium":"http://192.168.2.111:8069/linkloving_app_api/get_product_image?product_id=48204","id":46537,"product_name":" HS310-成品(星夜·追梦人)-RT-CN"},"theoretical_qty":-387,"product_qty":0},"res_msg":"","res_code":1} */ private String jsonrpc; private Object id; private ResultBean result; public String getJsonrpc() { return jsonrpc; } public void setJsonrpc(String jsonrpc) { this.jsonrpc = jsonrpc; } public Object getId() { return id; } public void setId(Object id) { this.id = id; } public ResultBean getResult() { return result; } public void setResult(ResultBean result) { this.result = result; } public static class ResultBean { /** * res_data : {"product":{"area":{"id":false,"name":false},"image_medium":"http://192.168.2.111:8069/linkloving_app_api/get_product_image?product_id=48204","id":46537,"product_name":" HS310-成品(星夜·追梦人)-RT-CN"},"theoretical_qty":-387,"product_qty":0} * res_msg : * res_code : 1 */ private ResDataBean res_data; private String res_msg; private int res_code; public ResDataBean getRes_data() { return res_data; } public void setRes_data(ResDataBean res_data) { this.res_data = res_data; } public String getRes_msg() { return res_msg; } public void setRes_msg(String res_msg) { this.res_msg = res_msg; } public int getRes_code() { return res_code; } public void setRes_code(int res_code) { this.res_code = res_code; } public static class ResDataBean implements Serializable{ public String getError() { return error; } public void setError(String error) { this.error = error; } /** * product : {"area":{"id":false,"name":false},"image_medium":"http://192.168.2.111:8069/linkloving_app_api/get_product_image?product_id=48204","id":46537,"product_name":" HS310-成品(星夜·追梦人)-RT-CN"} * theoretical_qty : -387 * product_qty : 0 */ private String error ; private ProductBean product; private int theoretical_qty; private int product_qty; public ProductBean getProduct() { return product; } public void setProduct(ProductBean product) { this.product = product; } public int getTheoretical_qty() { return theoretical_qty; } public void setTheoretical_qty(int theoretical_qty) { this.theoretical_qty = theoretical_qty; } public int getProduct_qty() { return product_qty; } public void setProduct_qty(int product_qty) { this.product_qty = product_qty; } public static class ProductBean { /** * area : {"id":false,"name":false} * image_medium : http://192.168.2.111:8069/linkloving_app_api/get_product_image?product_id=48204 * id : 46537 * product_name : HS310-成品(星夜·追梦人)-RT-CN */ private AreaBean area; private String image_medium; private int id; private String product_name; public AreaBean getArea() { return area; } public void setArea(AreaBean area) { this.area = area; } public String getImage_medium() { return image_medium; } public void setImage_medium(String image_medium) { this.image_medium = image_medium; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getProduct_name() { return product_name; } public void setProduct_name(String product_name) { this.product_name = product_name; } public static class AreaBean { /** * id : false * name : false */ private Object id; private Object name; public Object getId() { if (id instanceof Boolean){ id = 0 ; }if (id instanceof Double){ id = Integer.parseInt(new DecimalFormat("0").format(id)); } return id; } public void setId(int id) { this.id = id; } public Object getName() { if (name instanceof Boolean){ name = ""; } return name; } public void setName(String name) { this.name = name; } } } } } }
25b8ec324f7a1c3f6166fb463d5a3929052a48ad
f55f1023c90a0b7dbfee8e57e4dd1fb3e0e5663f
/android/app/src/main/java/com/pushnotification/MainApplication.java
0da569e068169d1de69a85cb80dd76a4acf4e7b7
[]
no_license
tpmabdulkareem/Push-Notification-App
02d5675f5a446fac5210b84266e90c772fa3e78f
ec028b9c98d2cfbde888a13a0c54e1d1a84d323d
refs/heads/master
2023-02-04T01:36:01.267899
2020-04-08T10:43:40
2020-04-08T10:43:40
254,030,183
2
0
null
2023-01-26T19:13:00
2020-04-08T08:32:57
Java
UTF-8
Java
false
false
2,710
java
package com.pushnotification; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new ReactNativePushNotificationPackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.pushnotification.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
3c582fb06cd6b1f22894af4bc807a2badd1d3231
cbc61ffb33570a1bc55bb1e754510192b0366de2
/ole-common/ole-utility/src/main/java/org/kuali/ole/docstore/model/xmlpojo/work/license/onixpl/TimePointIDTypeCode.java
f2965540817a4a88bdc0eac59925ddea2db05aea
[ "ECL-2.0" ]
permissive
VU-libtech/OLE-INST
42b3656d145a50deeb22f496f6f430f1d55283cb
9f5efae4dfaf810fa671c6ac6670a6051303b43d
refs/heads/master
2021-07-08T11:01:19.692655
2015-05-15T14:40:50
2015-05-15T14:40:50
24,459,494
1
0
ECL-2.0
2021-04-26T17:01:11
2014-09-25T13:40:33
Java
UTF-8
Java
false
false
1,528
java
package org.kuali.ole.docstore.model.xmlpojo.work.license.onixpl; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * Created by IntelliJ IDEA. * User: Pranitha * Date: 5/30/12 * Time: 1:18 PM * To change this template use File | Settings | File Templates. * <p/> * <p>Java class for TimePointIDTypeCode. * <p/> * <p>The following schema fragment specifies the expected content contained within this class. * <p/> * <pre> * &lt;simpleType name="TimePointIDTypeCode"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="onixPL:YYYYMMDD"/> * &lt;/restriction> * &lt;/simpleType> * </pre> */ @XmlType(name = "TimePointIDTypeCode", namespace = "http://www.editeur.org/onix-pl") @XmlEnum public enum TimePointIDTypeCode { /** * A date according to the Gregorian Calendar expressed as year month day. */ @XmlEnumValue("onixPL:YYYYMMDD") ONIX_PL_YYYYMMDD("onixPL:YYYYMMDD"); private final String value; TimePointIDTypeCode(String v) { value = v; } public String value() { return value; } public static TimePointIDTypeCode fromValue(String v) { for (TimePointIDTypeCode c : TimePointIDTypeCode.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
34608449b552a98bfe1c613c22a495968607dcea
9cdc32db10ceccb342163d5f63646cf3c1ae004b
/blog.server/src/main/java/com/zlz/blog/server/config/GlobalExceptionHandler.java
ba22090ca141bceb22918af6253bb6d17cff996b
[]
no_license
githubzlz/blog-service-show
4c9f45dfc6ac931d5583f01a58d6df3dbe4a85b8
1843897fd2aca96638c789f8967612cad89d9abf
refs/heads/master
2023-01-05T00:33:20.721615
2020-11-04T00:49:27
2020-11-04T00:49:27
286,966,241
0
0
null
null
null
null
UTF-8
Java
false
false
1,031
java
package com.zlz.blog.server.config; import com.zlz.blog.common.exception.BlogException; import com.zlz.blog.common.response.ResultSet; import lombok.extern.log4j.Log4j2; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestController; /** * @author zhulinzhong * @version 1.0 CreateTime:2020-06-06 09:17 * @description 全局统一异常处理 */ @ControllerAdvice @RestController @Log4j2 public class GlobalExceptionHandler { @ExceptionHandler(value = Exception.class) public ResultSet exceptionHandler(Exception e) { if (e instanceof BlogException) { log.error("异常[{}]", e); return ResultSet.error(e.getMessage()); // return ResultSet.error("哦吼,发生错误了,请重试一次吧!"); } else { log.error("异常[{}]", e); return ResultSet.error("未知错误,请联系管理员!"); } } }
87a96b355a3b57cce01263cd8bce7dafad71800b
f487532281c1c6a36a5c62a29744d8323584891b
/sdk/java/src/main/java/com/pulumi/azure/lighthouse/inputs/DefinitionPlanArgs.java
7307edbe65dbbe13160930b23a6a9bfc32341aba
[ "BSD-3-Clause", "MPL-2.0", "Apache-2.0" ]
permissive
pulumi/pulumi-azure
a8f8f21c46c802aecf1397c737662ddcc438a2db
c16962e5c4f5810efec2806b8bb49d0da960d1ea
refs/heads/master
2023-08-25T00:17:05.290397
2023-08-24T06:11:55
2023-08-24T06:11:55
103,183,737
129
57
Apache-2.0
2023-09-13T05:44:10
2017-09-11T20:19:15
Java
UTF-8
Java
false
false
4,827
java
// *** WARNING: this file was generated by pulumi-java-gen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** package com.pulumi.azure.lighthouse.inputs; import com.pulumi.core.Output; import com.pulumi.core.annotations.Import; import java.lang.String; import java.util.Objects; public final class DefinitionPlanArgs extends com.pulumi.resources.ResourceArgs { public static final DefinitionPlanArgs Empty = new DefinitionPlanArgs(); /** * The plan name of the marketplace offer. * */ @Import(name="name", required=true) private Output<String> name; /** * @return The plan name of the marketplace offer. * */ public Output<String> name() { return this.name; } /** * The product code of the plan. * */ @Import(name="product", required=true) private Output<String> product; /** * @return The product code of the plan. * */ public Output<String> product() { return this.product; } /** * The publisher ID of the plan. * */ @Import(name="publisher", required=true) private Output<String> publisher; /** * @return The publisher ID of the plan. * */ public Output<String> publisher() { return this.publisher; } /** * The version of the plan. * */ @Import(name="version", required=true) private Output<String> version; /** * @return The version of the plan. * */ public Output<String> version() { return this.version; } private DefinitionPlanArgs() {} private DefinitionPlanArgs(DefinitionPlanArgs $) { this.name = $.name; this.product = $.product; this.publisher = $.publisher; this.version = $.version; } public static Builder builder() { return new Builder(); } public static Builder builder(DefinitionPlanArgs defaults) { return new Builder(defaults); } public static final class Builder { private DefinitionPlanArgs $; public Builder() { $ = new DefinitionPlanArgs(); } public Builder(DefinitionPlanArgs defaults) { $ = new DefinitionPlanArgs(Objects.requireNonNull(defaults)); } /** * @param name The plan name of the marketplace offer. * * @return builder * */ public Builder name(Output<String> name) { $.name = name; return this; } /** * @param name The plan name of the marketplace offer. * * @return builder * */ public Builder name(String name) { return name(Output.of(name)); } /** * @param product The product code of the plan. * * @return builder * */ public Builder product(Output<String> product) { $.product = product; return this; } /** * @param product The product code of the plan. * * @return builder * */ public Builder product(String product) { return product(Output.of(product)); } /** * @param publisher The publisher ID of the plan. * * @return builder * */ public Builder publisher(Output<String> publisher) { $.publisher = publisher; return this; } /** * @param publisher The publisher ID of the plan. * * @return builder * */ public Builder publisher(String publisher) { return publisher(Output.of(publisher)); } /** * @param version The version of the plan. * * @return builder * */ public Builder version(Output<String> version) { $.version = version; return this; } /** * @param version The version of the plan. * * @return builder * */ public Builder version(String version) { return version(Output.of(version)); } public DefinitionPlanArgs build() { $.name = Objects.requireNonNull($.name, "expected parameter 'name' to be non-null"); $.product = Objects.requireNonNull($.product, "expected parameter 'product' to be non-null"); $.publisher = Objects.requireNonNull($.publisher, "expected parameter 'publisher' to be non-null"); $.version = Objects.requireNonNull($.version, "expected parameter 'version' to be non-null"); return $; } } }
8397e58ab370dd1d48b0814b741acd7de266bd86
2aa2f5549c554f5e3c2028d72f9dcb07be910bc2
/src/controller/ClienteController.java
2f0fe83700503cc2683a61c478132ee087b5d855
[]
no_license
BrunoMCarnauba/sistema_assistencia_tecnica
d79db0c6a11af9e0f82f3bdf0ee935f2ca93f3e5
d4462091f038eb7ba9dfab8b8d0908791f68a839
refs/heads/master
2022-12-30T21:49:41.435851
2020-10-07T01:03:51
2020-10-07T01:03:51
301,885,986
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,218
java
package controller; import java.io.Serializable; import java.util.ArrayList; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import javax.faces.event.ActionEvent; import dao.ClienteDao; import model.ClienteBean; import utilities.FacesUtil; @SuppressWarnings("serial") //Para sumir com uma advertência - https://youtu.be/iHwaZU2YSbo?t=402 @ManagedBean // Diz que essa classe é um ManagedBean, responsável pela lógica da tela. No xhtml ela vai ser chamada de clienteController. @ViewScoped // O Bean que tem ViewScoped, só irá existir em memória quando estiver manipulando a tela dele. public class ClienteController implements Serializable { private ClienteBean cliente = new ClienteBean(); private ClienteDao clienteDAO = new ClienteDao(); public ClienteBean getCliente() { return cliente; } public void setCliente(ClienteBean cliente) { this.cliente = cliente; } public ArrayList<ClienteBean> listarClientes(){ return this.clienteDAO.listarClientes(); } public void novoCliente() { this.cliente = new ClienteBean(); } public void btnSalvar() { //Serve tanto para o cadastro quanto para o editar if(this.cliente.getId() == 0) { //O id é gerado automaticamente e não setado pelo usuário, então se não existir, quer dizer que é um novo cadastro e não edição. https://stackoverflow.com/questions/13747859/how-to-check-if-an-int-is-a-null this.cadastrarCliente(); } else { this.editarCliente(); } } private boolean validarCamposCustom() { //Outras validações boolean validacaoAprovada = true; if(this.cliente.getTelefone_celular().equals("") && this.cliente.getTelefone_fixo().equals("")) { FacesUtil.adicionarMensagemErro("Você precisa preencher pelo menos um campo de telefone"); validacaoAprovada = false; } return validacaoAprovada; } public void cadastrarCliente() { if(this.validarCamposCustom() == true) { //Se passar na validação if(this.clienteDAO.cadastrarCliente(this.cliente) == true) { FacesUtil.adicionarMensagemInfo("Cliente cadastrado com sucesso!"); novoCliente(); //Para limpar o objeto e consequentemente os campos do formulário com o auxilio da propriedade update do commandButton. } else { FacesUtil.adicionarMensagemErro("Houve um erro ao tentar cadastrar o cliente."); } } } public void btnEditar(ActionEvent evento) { this.cliente = (ClienteBean) evento.getComponent().getAttributes().get("clienteSelecionado"); } public void editarCliente() { if(this.validarCamposCustom() == true) { //Se passar na validação if(this.clienteDAO.editarCliente(this.cliente) == true) { FacesUtil.adicionarMensagemInfo("Cliente editado com sucesso!"); } else { FacesUtil.adicionarMensagemErro("Houve um erro ao tentar editar o cliente."); } } } public void deletarCliente(ActionEvent evento) { this.cliente = (ClienteBean) evento.getComponent().getAttributes().get("clienteSelecionado"); if(this.clienteDAO.deletarCliente(this.cliente) == true) { FacesUtil.adicionarMensagemInfo("Cliente deletado com sucesso!"); } else { FacesUtil.adicionarMensagemErro("Houve um erro ao tentar deletar o cliente."); } } }
9ae4f7d78d0ddfdbeddaae0c40e9deec3a939fa0
417bbe4b144239de79afa0fbc57b079aff5b3d5c
/src/main/java/com/example/demo/dao/UserMapper.java
e443b10a3a7f89fdcdcfd68fa7d9f5f35b9d0902
[]
no_license
Holly0203/Homework02
be4b4ad4604717369b33580aeda275fa4b679345
3e47386cf026fbd81c338f5e4239b7c66bbe0851
refs/heads/master
2020-04-13T03:47:24.272951
2018-12-24T02:45:19
2018-12-24T02:45:19
162,942,263
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.example.demo.dao; import com.example.demo.Model.User; import org.springframework.stereotype.Repository; @Repository public interface UserMapper { public void insertuser(String phone,String password); public User queryuser(String phone); }
7ab8f98229f320bd998239631f55ff7215e81584
851059c566b1f74e4378329f193e7b78f967c417
/android/app/src/main/java/com/clock/MainApplication.java
2035300a0143259c693781a2f907b7b52221bac4
[]
no_license
adrianowead/react-native-clock
971d2cffd00b39402eb6e388703a56a11031fb5d
f5adbade1ae6b53382f9bdad9ab4483772e2c759
refs/heads/master
2020-05-22T07:09:13.248299
2019-05-12T13:29:59
2019-05-12T13:29:59
186,258,595
0
0
null
null
null
null
UTF-8
Java
false
false
1,041
java
package com.clock; import android.app.Application; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
124be08cab3e9c2adc9c1cb295541af18745b5c5
bf6bcaf9dc3a91bdd78e3f1134972cccda978caa
/Runtime/src/reflect-thunk/Constructor.java
143c999572312c1d978c382d3864d3507bdd8d26
[]
no_license
fenghaitao/Harpoon
3eac8f4e99b94d593d30f58b5c31755eaaa13d64
bcec08dbbaed226fe653203e18d6a2c3a8b105a9
refs/heads/master
2021-01-18T19:41:17.512746
2011-02-20T17:52:44
2011-02-20T17:52:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,387
java
package java.lang.reflect; /** * The Constructor class represents a constructor of a class. It also allows * dynamic creation of an object, via reflection. Invocation on Constructor * objects knows how to do widening conversions, but throws * {@link IllegalArgumentException} if a narrowing conversion would be * necessary. You can query for information on this Constructor regardless * of location, but construction access may be limited by Java language * access controls. If you can't do it in the compiler, you can't normally * do it here either.<p> * * <B>Note:</B> This class returns and accepts types as Classes, even * primitive types; there are Class types defined that represent each * different primitive type. They are <code>java.lang.Boolean.TYPE, * java.lang.Byte.TYPE,</code>, also available as <code>boolean.class, * byte.class</code>, etc. These are not to be confused with the * classes <code>java.lang.Boolean, java.lang.Byte</code>, etc., which are * real classes.<p> * * Also note that this is not a serializable class. It is entirely feasible * to make it serializable using the Externalizable interface, but this is * on Sun, not me. * * @author C. Scott Ananian <[email protected]> * @author John Keiser * @author Eric Blake <[email protected]> * @see Member * @see Class * @see java.lang.Class#getConstructor(Object[]) * @see java.lang.Class#getDeclaredConstructor(Object[]) * @see java.lang.Class#getConstructors() * @see java.lang.Class#getDeclaredConstructors() * @since 1.1 * @status updated to 1.4 */ public final class Constructor extends AccessibleObject implements Member { // uninstantiable: all instances are static private Constructor() { } // native methods public native Class getDeclaringClass(); public native String getName(); public native int getModifiers(); public native Class[] getParameterTypes(); public native Class[] getExceptionTypes(); public native Object newInstance(Object[] oa) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException; // object-contract methods. public boolean equals(Object o) { Method m; if (this==o) return true; // common case. try { m = (Method) o; } catch (ClassCastException e) { return false; } if (!getDeclaringClass().equals(m.getDeclaringClass())) return false; Class[] mypt=getParameterTypes(), yourpt=m.getParameterTypes(); if (mypt.length!=yourpt.length) return false; for (int i=0; i<mypt.length; i++) if (!mypt[i].equals(yourpt[i])) return false; return true; } public int hashCode() { return getDeclaringClass().getName().hashCode(); } public String toString() { StringBuffer r = new StringBuffer(); int m = getModifiers(); if (m!=0) { r.append(Modifier.toString(m)); r.append(' '); } r.append(Field.getTypeName(getDeclaringClass())); r.append('('); Class hcp[] = getParameterTypes(); for (int i=0; i<hcp.length; i++) { r.append(Field.getTypeName(hcp[i])); if (i < hcp.length-1) r.append(','); } r.append(')'); Class ecp[] = getExceptionTypes(); if (ecp.length > 0) { r.append(" throws "); for (int i=0; i<ecp.length; i++) { r.append(ecp[i].getName());// can't be primitive or array type. if (i < ecp.length-1) r.append(','); } } return r.toString(); } }
099015fb9a6dbbbbf4310ac462d807b0e512504f
61cf3109eaf4561e071d93f9daf0d3cf9155ca9f
/src/com/rbt/index/testSearch.java
c1e793fa00597a223abdc0ad6337f7f5e83e4846
[]
no_license
haoouwen/epf
b620fe05c93db178a122cfef778d31c036a2a822
abe0f1ed564f33dcf766591c5f9b04ce2b5e8094
refs/heads/master
2021-01-19T13:46:10.278247
2017-08-20T10:40:12
2017-08-20T10:40:12
100,859,509
1
2
null
null
null
null
UTF-8
Java
false
false
2,034
java
package com.rbt.index; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.apache.lucene.queryParser.ParseException; import org.apache.lucene.search.highlight.InvalidTokenOffsetsException; import com.browseengine.bobo.api.BrowseException; public class testSearch { public static void main(String args[]) throws IOException, ParseException, InvalidTokenOffsetsException, BrowseException { List paraList = new ArrayList(); ParaModel pm = new ParaModel(); /* String[] fields = {"title","attr_desc"}; pm.setSearch_type(Constants.MULTI); pm.setFields(fields); pm.setSearch_value("2346564772"); */ // String[] fields = {"cat_id"}; // pm.setFields(fields); // pm.setSearch_type(Constants.MULTI); // pm.setSearch_value("1121137758"); pm.setSearch_key("cat_name"); pm.setSearch_type(Constants.NORMAL); pm.setSearch_value("女双肩包"); paraList.add(pm); // lucene排序 // Sort sort=new Sort(); // SortField sf=new SortField("supply_id", SortField.STRING,true);//升序 // sort.setSort(new SortField[]{sf}); List list = new SearchIndex("goods").search(paraList, null, 1, 20); System.out.println(list.size()+"==========="); // 循环输出 // List list = new SearchIndex("categoryattr").search(paraList, null, 0, 0); System.out.println("我的查询结果列表是:"); // System.out.println(list.toString()); for (int i = 0; i < list.size(); i++) { HashMap listMap=(HashMap)list.get(i); String attr_desc="",cat_attr="",supply_id="",title="",area_attr=""; if(listMap.get("goods_name")!=null){ area_attr=listMap.get("goods_name").toString(); } if(listMap.get("cat_attr")!=null){ cat_attr=listMap.get("cat_attr").toString(); } System.out.println(title+"========="+cat_attr+"======"); } List lista = new SearchIndex("goods").catInfoNum(paraList); System.out.println(lista); //new SearchIndex("supply").areaInfoNum(paraList,"1111111111"); } }
[ "Administrator@USER-20170608NM" ]
Administrator@USER-20170608NM
117e04b3cc11f6adc3b90eba633f263371d07504
c0c8defcda70990410a6de6e53d59b9d38c70fba
/backend/src/main/java/br/com/cadastro/clientes/model/entity/Cliente.java
f6c5b69d68e08e9cf3001871941eb18bc8e4e1cd
[]
no_license
yancarlos99/cadastro-clientes
40f66f11f64e3bdd51a0ff24967e944e6a9e05f0
ac5a57a1f38a5b91c705f1bdd5dde00c724feca7
refs/heads/master
2023-01-19T01:22:11.427954
2020-11-26T16:52:10
2020-11-26T16:52:10
313,498,642
1
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
package br.com.cadastro.clientes.model.entity; import java.time.LocalDate; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.PrePersist; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import org.hibernate.validator.constraints.br.CPF; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @NoArgsConstructor @AllArgsConstructor @Builder public class Cliente { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty(message = "{campo.nome.obrigatorio}") @Column(nullable = false, length = 150) private String nome; @NotNull(message = "{campo.cpf.obrigatorio}") @CPF(message = "{campo.cpf.invalido}") @Column(nullable = false, length = 11) private String cpf; @Column(name = "data_cadastro", updatable = false) @JsonFormat(pattern = "dd/MM/yyyy") private LocalDate dataCadastro; @PrePersist public void prePrersist() { setDataCadastro(LocalDate.now()); } }
5c6cfed86340ada4a2c8d3043318b0f2db64d8a1
f5049214ff99cdd7c37da74619b60ac4a26fc6ba
/runtime/security/eu.agno3.runtime.security/src/main/java/eu/agno3/runtime/security/password/internal/DateMatcher.java
564ae4b5271fa019056ea4011ec9e5497e55cf15
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
AgNO3/code
d17313709ee5db1eac38e5811244cecfdfc23f93
b40a4559a10b3e84840994c3fd15d5f53b89168f
refs/heads/main
2023-07-28T17:27:53.045940
2021-09-17T14:25:01
2021-09-17T14:31:41
407,567,058
0
2
null
null
null
null
UTF-8
Java
false
false
7,306
java
/** * © 2015 AgNO3 Gmbh & Co. KG * All right reserved. * * Created: 21.03.2015 by mbechler */ package eu.agno3.runtime.security.password.internal; import java.util.Collection; import java.util.LinkedList; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author mbechler * */ public class DateMatcher implements PasswordMatcher { private static final Pattern YEAR_PATTERN = Pattern.compile("19\\d\\d|200\\d|201\\d/"); //$NON-NLS-1$ private static final Pattern DATE_WITHOUT_SEP_PATTERN = Pattern.compile("\\d{4,8}"); //$NON-NLS-1$ private static final Pattern DATE_SEP_PREFIX_PATTERN = Pattern .compile("(\\d{1,2})(\\s|-|/|\\\\|_|\\.)(\\d{1,2})\\2(19\\d{2}|200\\d|201\\d|\\d{2})"); //$NON-NLS-1$ private static final Pattern DATE_SEP_SUFFIX_PATTERN = Pattern .compile("(19\\d{2}|200\\d|201\\d|\\d{2})(\\s|-|/|\\\\|_|\\.)(\\d{1,2})\\2(\\d{1,2})"); //$NON-NLS-1$ /** * {@inheritDoc} * * @see eu.agno3.runtime.security.password.internal.PasswordMatcher#match(java.lang.String) */ @Override public Collection<MatchEntry> match ( String password ) { Collection<MatchEntry> matches = new LinkedList<>(); addYearMatches(matches, password); addDateWithSepMatches(matches, password); addDateWithoutSepMatches(matches, password); return matches; } /** * @param matches * @param password */ private static void addDateWithoutSepMatches ( Collection<MatchEntry> matches, String password ) { Matcher matcher = DATE_WITHOUT_SEP_PATTERN.matcher(password); int pos = 0; while ( matcher.find(pos) ) { int newPos = -1; if ( matcher.group().length() <= 6 ) { // try 2 digit year suffix newPos = Math.max( newPos, tryMatchWithoutSep( matches, password, matcher, pos, matcher.group().substring(0, matcher.group().length() - 2), Integer.parseInt(matcher.group().substring(matcher.group().length() - 2)), true)); // try 2 digit year prefix newPos = Math.max( newPos, tryMatchWithoutSep( matches, password, matcher, pos, matcher.group().substring(2), Integer.parseInt(matcher.group().substring(0, 2)), true)); } else { // try 4 digit year suffix newPos = Math.max( newPos, tryMatchWithoutSep( matches, password, matcher, pos, matcher.group().substring(0, matcher.group().length() - 4), Integer.parseInt(matcher.group().substring(matcher.group().length() - 4)), false)); // try 4 digit year prefix newPos = Math.max( newPos, tryMatchWithoutSep( matches, password, matcher, pos, matcher.group().substring(4), Integer.parseInt(matcher.group().substring(0, 4)), false)); } if ( newPos < 0 ) { pos += 1; } else { pos = newPos; } } } /** * @param matches * @param password * @param matcher * @param pos * @param dayOrMonth1 * @param dayOrMonth2 * @param year * @return */ private static int tryMatchWithoutSep ( Collection<MatchEntry> matches, String password, Matcher matcher, int pos, String dayAndMonth, int year, boolean shortYear ) { int dayOrMonth1; int dayOrMonth2; if ( dayAndMonth.length() == 2 ) { dayOrMonth1 = Integer.parseInt(dayAndMonth.substring(0, 1)); dayOrMonth2 = Integer.parseInt(dayAndMonth.substring(1)); } else if ( dayAndMonth.length() >= 3 ) { dayOrMonth1 = Integer.parseInt(dayAndMonth.substring(0, 2)); dayOrMonth2 = Integer.parseInt(dayAndMonth.substring(2)); } else { return -1; } if ( validDate(dayOrMonth1, dayOrMonth2, year, shortYear) ) { matches.add(new DateMatchEntry(password.substring(matcher.start(), matcher.end()), matcher.start(), year, false)); return matcher.end(); } return -1; } /** * @param matches * @param password */ private static void addDateWithSepMatches ( Collection<MatchEntry> matches, String password ) { Matcher matcher = DATE_SEP_PREFIX_PATTERN.matcher(password); int pos = 0; while ( matcher.find(pos) ) { int dayOrMonth1 = Integer.parseInt(matcher.group(1)); int dayOrMonth2 = Integer.parseInt(matcher.group(3)); int year = Integer.parseInt(matcher.group(4)); if ( validDate(dayOrMonth1, dayOrMonth2, year, year <= 100) ) { matches.add(new DateMatchEntry(password.substring(matcher.start(), matcher.end()), matcher.start(), year, true)); } pos = matcher.end(); } pos = 0; matcher = DATE_SEP_SUFFIX_PATTERN.matcher(password); while ( matcher.find(pos) ) { int dayOrMonth1 = Integer.parseInt(matcher.group(1)); int dayOrMonth2 = Integer.parseInt(matcher.group(3)); int year = Integer.parseInt(matcher.group(4)); if ( validDate(dayOrMonth1, dayOrMonth2, year, year <= 100) ) { matches.add(new DateMatchEntry(password.substring(matcher.start(), matcher.end()), matcher.start(), year, true)); } pos = matcher.end(); } } /** * @param dayOrMonth1 * @param dayOrMonth2 * @param year * @return */ private static boolean validDate ( int dayOrMonth1, int dayOrMonth2, int year, boolean shortYear ) { if ( dayOrMonth1 > 31 || dayOrMonth2 > 31 ) { return false; } if ( dayOrMonth1 > 12 && dayOrMonth2 > 12 ) { return false; } // zxcvbn checks for year range in 1900 - 2019 if ( !shortYear && ( year < 1900 || year > 2019 ) ) { return false; } return true; } /** * @param matches * @param password */ private static void addYearMatches ( Collection<MatchEntry> matches, String password ) { Matcher matcher = YEAR_PATTERN.matcher(password); int pos = 0; while ( matcher.find(pos) ) { matches.add(new MatchEntry(password.substring(matcher.start(), matcher.end()), matcher.start(), MatchType.YEAR)); pos = matcher.end(); } } }
d677b4bb8fc3bc486094dc7601973ce6f6430762
1011ed798a29c101bbb91c44f680cb77d9fe21cf
/test_study/test_ActivityforResult/app/src/main/java/com/example/ybbaek/test_activityforresult/MainActivity.java
d2d9799f31f58b17370c92fe84c0f46f6df9d1f4
[]
no_license
yunbum/Android
fe431552389355794821fdc3d50afad8339b4255
66693270f68bb0922bdd53730011968e9be6de16
refs/heads/master
2020-03-19T14:33:02.952262
2018-09-28T23:43:45
2018-09-28T23:43:45
136,628,171
1
0
null
null
null
null
UTF-8
Java
false
false
1,518
java
package com.example.ybbaek.test_activityforresult; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends AppCompatActivity implements View.OnClickListener { public static final int REQUEST_CODE = 1000; private EditText mNameEdtxt; private EditText mAgeEdtxt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNameEdtxt = findViewById(R.id.edtxt_name); mAgeEdtxt = findViewById(R.id.edtxt_age); findViewById(R.id.btn_submit).setOnClickListener(this); } @Override public void onClick(View v) { Intent intent = new Intent(this, SecondActivity.class); intent.putExtra("name", mNameEdtxt.getText().toString()); intent.putExtra("age", mAgeEdtxt.getText().toString()); //startActivity(intent); startActivityForResult(intent, REQUEST_CODE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE && resultCode == RESULT_OK && data != null){ String result = data.getStringExtra("result"); Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); } } }
bb45c7a330d8044791d7f3b61f270a745db5a849
467b6b19c4a4d269a91eb42f2963d3722d0be229
/word2javabean/src/main/java/poi/ExportDocImpl.java
231093cdb389b7e45b584e4f452f2775d976198b
[]
no_license
newxpp/hello-world
7b2f15efe84854733af2e06ad87ee8f7d496fe72
a33d4f30ad21dbbf07dabbf04de87e0bc494bb41
refs/heads/master
2020-06-04T21:04:27.951389
2015-02-11T18:02:15
2015-02-11T18:02:15
30,657,306
0
0
null
2015-02-11T16:45:20
2015-02-11T16:28:44
null
GB18030
Java
false
false
2,919
java
package poi; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.usermodel.Paragraph; import org.apache.poi.hwpf.usermodel.Range; import org.apache.poi.hwpf.usermodel.Table; import org.apache.poi.hwpf.usermodel.TableCell; import org.apache.poi.hwpf.usermodel.TableIterator; import org.apache.poi.hwpf.usermodel.TableRow; import org.apache.poi.poifs.filesystem.POIFSFileSystem; import freemarker.Test; import freemarker.UpperFirstCharacter; import freemarker.template.Configuration; import freemarker.template.Template; public class ExportDocImpl { public static void main(String[] args) { Configuration cfg = new Configuration(); try { cfg.setClassForTemplateLoading(Test.class, "/"); // 指定模板所在的classpath目录 cfg.setSharedVariable("upperFC", new UpperFirstCharacter()); // 添加一个"宏"共享变量用来将属性名首字母大写 Template t = cfg.getTemplate("javabean.temp"); // 指定模板 FileOutputStream fos = new FileOutputStream(new File( "c:/Student.java")); // java文件的生成目录 FileInputStream in = new FileInputStream("c:\\test.doc");// 载入文档 POIFSFileSystem pfs = new POIFSFileSystem(in); HWPFDocument hwpf = new HWPFDocument(pfs); Range range = hwpf.getRange();// 得到文档的读取范围 TableIterator it = new TableIterator(range); // 迭代文档中的表格 while (it.hasNext()) { Table tb = (Table) it.next(); // 模拟数据源 Map data = new HashMap(); data.put("package", "edu"); // 包名 data.put("className", "Student"); List<Map> pros = new ArrayList<>(); // 迭代行,默认从0开始 for (int i = 0; i < tb.numRows(); i++) { TableRow tr = tb.getRow(i); Map pro = new HashMap(); // 迭代列,默认从0开始 pro.put("proType", getCellValue(tr, 2)); pro.put("proComment", getCellValue(tr, 1)); pro.put("proName", getCellValue(tr, 0)); pros.add(pro); } // end for data.put("properties", pros); t.process(data, new OutputStreamWriter(fos, "utf-8")); // fos.flush(); } // end while fos.close(); } catch (Exception e) { e.printStackTrace(); } }// end method private static String getCellValue(TableRow tr, int columnIndex) { TableCell td = tr.getCell(columnIndex);// 取得单元格 // 取得单元格的内容 StringBuilder sb = new StringBuilder(); for (int k = 0; k < td.numParagraphs(); k++) { Paragraph para = td.getParagraph(k); String s = para.text(); sb.append(s.replaceAll("\\W$", "")); } // end for return sb.toString(); } }
[ "Administrator@BZWMYY3XVYQXGMP" ]
Administrator@BZWMYY3XVYQXGMP
65f73cb703fc0ed3716b960a7bf2e54422565723
19b756a4af96ad186575e8a4a0f47d8e16ce0192
/src/Generic/Node.java
224e3f12912faa4f82866a9febbad84e1d62e1ce
[]
no_license
842Mono/CSEN901_AISearchStrategies_Project1
c150adcaf4769d6e9171eb9b19c0b4ea161d86da
a42380a6fd0ef24f6cb5d3f3fc8a1b295cd65929
refs/heads/master
2020-03-30T08:02:11.134988
2018-10-19T16:35:04
2018-10-19T16:35:04
150,983,633
0
1
null
null
null
null
UTF-8
Java
false
false
397
java
package Generic; public class Node { public Node parent; public Operator operator; //how this node was reached. public int totalCost; public int depth; public int heuristic; public Node() {} public Node(Node parent, Operator operator, int cost, int depth) { this.parent = parent; this.operator = operator; this.totalCost = cost; this.depth = depth; this.heuristic = 0; } }
60cfe8d547d4008d10e26a809b8e600b340a840e
220a40330fe9682ece590e0d78ba76e5ec525be0
/EasyClinic/src/org/xortican/controller/EditDet.java
ea6e7fdb010a87f89adf78da7000f445f3d81ed0
[]
no_license
augustinbca/Eacyclinic
adeb88a42699ab8628504e098abb56ca9915e2de
8391c9d9886c9c952256632a7ab26126e429e0a1
refs/heads/master
2020-04-30T14:22:59.175309
2019-03-21T07:37:53
2019-03-21T07:37:53
176,889,331
2
0
null
null
null
null
UTF-8
Java
false
false
1,746
java
package org.xortican.controller; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.xortican.util.JdbcCon; /** * Servlet implementation class EditDet */ @WebServlet("/EditDet") public class EditDet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EditDet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @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); String id=request.getParameter("userId"); System.out.println(id); RequestDispatcher dispatcher = request.getRequestDispatcher("Process.jsp"); dispatcher.forward(request, response); } }
[ "Augustin@DESKTOP-BDTIHEQ" ]
Augustin@DESKTOP-BDTIHEQ
b4f942d838558a7fe75ba6004d2d5571cdf94548
73b3dbf5df68a1f67e569e231543c6f33aa71ffd
/chapter 6/Computer_Assisted_InstructionTest.java
1a3e636a53e6ce591a916e5ef45c8144f52a0853
[]
no_license
ray-abel12/Deitel-Java-How-to-Program-Solutions
5d50b06bad5dee764b75400bdc3d931ed176b36b
33eb9741804cc3f53b82540c6d3d3458f0306bee
refs/heads/master
2020-08-09T21:19:12.043649
2020-05-03T06:25:03
2020-05-03T06:25:03
214,176,773
1
0
null
null
null
null
UTF-8
Java
false
false
208
java
package exercises; public class Computer_Assisted_InstructionTest { public static void main(String[] args) { //Computer_Assisted_Instruction.question(); Computer_Assisted_Instruction.solve(); // } }
5a2d3f1843d354e389fcd9dd6c50264fc4d287ce
a1a6244fa3ef089d9c277e44c17be2c68eba493c
/app/src/main/java/a/a/a/Ix.java
ce80471625d07c9d39f8ca4fa109fa9c8b753eeb
[]
no_license
AnandaRauf/Sketchware-Pro
69a6aafebbb17bdd1968bc4d694ff00c26b7ad7a
f78cade7ed456711c672772e9b4f2279ab9d50d7
refs/heads/main
2023-08-14T19:00:47.907198
2021-09-12T15:35:16
2021-09-12T15:35:16
405,687,323
1
0
null
2021-09-12T16:04:08
2021-09-12T16:04:07
null
UTF-8
Java
false
false
17,690
java
package a.a.a; import android.Manifest; import android.app.Service; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Intent; import com.besome.sketch.beans.ProjectFileBean; import com.google.gson.Gson; import java.util.ArrayList; import java.util.HashMap; import mod.agus.jcoderz.handle.component.ConstVarManifest; import mod.agus.jcoderz.lib.FilePathUtil; import mod.agus.jcoderz.lib.FileResConfig; import mod.agus.jcoderz.lib.FileUtil; import mod.hey.studios.build.BuildSettings; import mod.hey.studios.project.ProjectSettings; import mod.hey.studios.util.Helper; import mod.hilal.saif.android_manifest.AndroidManifestInjector; public class Ix { public Nx a = new Nx("manifest"); public ArrayList<ProjectFileBean> b; public BuildSettings buildSettings; public jq c; public FilePathUtil fpu = new FilePathUtil(); public FileResConfig frc; public ProjectSettings settings; public Ix(jq jq, ArrayList<ProjectFileBean> projectFileBeans) { c = jq; b = projectFileBeans; buildSettings = new BuildSettings(jq.sc_id); frc = new FileResConfig(c.sc_id); a.a("xmlns", "android", "http://schemas.android.com/apk/res/android"); } /** * Adds FileProvider metadata to AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @return The {@code provider} {@link Nx} tag */ public final Nx a(Nx nx) { Nx providerTag = new Nx("provider"); providerTag.a("android", "authorities", c.a + ".provider"); providerTag.a("android", "name", "androidx.core.content.FileProvider"); providerTag.a("android", "exported", "false"); providerTag.a("android", "grantUriPermissions", "true"); Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "android.support.FILE_PROVIDER_PATHS"); metadataTag.a("android", "resource", "@xml/provider_paths"); providerTag.a(metadataTag); nx.a(providerTag); return providerTag; } /** * Adds a permission to AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @param str The {@code uses-permission} {@link Nx} tag */ public final void a(Nx nx, String str) { Nx usesPermissionTag = new Nx("uses-permission"); usesPermissionTag.a("android", "name", str); nx.a(usesPermissionTag); } /** * Adds Firebase metadata to AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @return The {@code provider} {@link Nx} tag */ public final Nx b(Nx nx) { Nx providerTag = new Nx("provider"); providerTag.a("android", "name", "com.google.firebase.provider.FirebaseInitProvider"); providerTag.a("android", "authorities", c.a + ".firebaseinitprovider"); providerTag.a("android", "exported", "false"); providerTag.a("android", "initOrder", "100"); nx.a(providerTag); Nx serviceTag = new Nx("service"); serviceTag.a("android", "name", "com.google.firebase.components.ComponentDiscoveryService"); serviceTag.a("android", "exported", "false"); if (c.i) { Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"); metadataTag.a("android", "value", "com.google.firebase.components.ComponentRegistrar"); serviceTag.a(metadataTag); } if (c.j) { Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "com.google.firebase.components:com.google.firebase.database.DatabaseRegistrar"); metadataTag.a("android", "value", "com.google.firebase.components.ComponentRegistrar"); serviceTag.a(metadataTag); } if (c.k) { Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "com.google.firebase.components:com.google.firebase.storage.StorageRegistrar"); metadataTag.a("android", "value", "com.google.firebase.components.ComponentRegistrar"); serviceTag.a(metadataTag); } ConstVarManifest.handleMetadata(serviceTag, c.x); nx.a(serviceTag); return providerTag; } /** * Adds the Google Maps SDK API key metadata to AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @return The {@code meta-data} {@link Nx} tag */ public final Nx c(Nx nx) { Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "com.google.android.geo.API_KEY"); metadataTag.a("android", "value", "@string/google_maps_key"); nx.a(metadataTag); return metadataTag; } /** * Specifies in AndroidManifest that the app uses Apache HTTP legacy library. * * @param nx AndroidManifest {@link Nx} object * @return The {@code uses-library} {@link Nx} tag */ public final Nx d(Nx nx) { Nx usesLibraryTag = new Nx("uses-library"); usesLibraryTag.a("android", "name", "org.apache.http.legacy"); usesLibraryTag.a("android", "required", "false"); nx.a(usesLibraryTag); return usesLibraryTag; } /** * Adds metadata about the GMS library version (a resource integer). * * @param nx {@link Nx} object to add the {@code meta-data} tag to * @return The {@code meta-data} {@link Nx} object */ public final Nx e(Nx nx) { Nx metadataTag = new Nx("meta-data"); metadataTag.a("android", "name", "com.google.android.gms.version"); metadataTag.a("android", "value", "@integer/google_play_services_version"); nx.a(metadataTag); return metadataTag; } public void f(Nx nx) { ConstVarManifest.handleAttrComponent(nx, c.x); } /** * Registers a {@link BroadcastReceiver} in AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @param componentName The component name of the broadcast * @see ComponentName */ public final void writeBroadcast(Nx nx, String componentName) { Nx receiverTag = new Nx("receiver"); receiverTag.a("android", "name", componentName); Nx intentFilterTag = new Nx("intent-filter"); Nx actionTag = new Nx("action"); actionTag.a("android", "name", componentName); intentFilterTag.a(actionTag); receiverTag.a(intentFilterTag); nx.a(receiverTag); } /** * Registers a {@link Service} in AndroidManifest. * * @param nx AndroidManifest {@link Nx} object * @param str The component name of the service */ public final void writeService(Nx nx, String str) { Nx serviceTag = new Nx("service"); serviceTag.a("android", "name", str); serviceTag.a("android", "enabled", "true"); nx.a(serviceTag); } public void setYq(yq yqVar) { settings = new ProjectSettings(yqVar.b); } /** * Builds an AndroidManifest. * * @return The AndroidManifest as {@link String} */ public String a() { boolean addRequestLegacyExternalStorage = false; a.a("", "package", c.a); if (!c.a()) { if (c.b(jq.PERMISSION_CALL_PHONE)) { a(a, Manifest.permission.CALL_PHONE); } if (c.b(jq.PERMISSION_INTERNET)) { a(a, Manifest.permission.INTERNET); } if (c.b(jq.PERMISSION_VIBRATE)) { a(a, Manifest.permission.VIBRATE); } if (c.b(jq.PERMISSION_ACCESS_NETWORK_STATE)) { a(a, Manifest.permission.ACCESS_NETWORK_STATE); } if (c.b(jq.PERMISSION_CAMERA)) { a(a, Manifest.permission.CAMERA); } if (c.b(jq.PERMISSION_READ_EXTERNAL_STORAGE)) { try { if (Integer.parseInt(settings.getValue(ProjectSettings.SETTING_TARGET_SDK_VERSION, "28")) >= 28) { addRequestLegacyExternalStorage = true; } } catch (NumberFormatException ignored) { } a(a, Manifest.permission.READ_EXTERNAL_STORAGE); } if (c.b(jq.PERMISSION_WRITE_EXTERNAL_STORAGE)) { a(a, Manifest.permission.WRITE_EXTERNAL_STORAGE); } if (c.b(jq.PERMISSION_RECORD_AUDIO)) { a(a, Manifest.permission.RECORD_AUDIO); } if (c.b(jq.PERMISSION_BLUETOOTH)) { a(a, Manifest.permission.BLUETOOTH); } if (c.b(jq.PERMISSION_BLUETOOTH_ADMIN)) { a(a, Manifest.permission.BLUETOOTH_ADMIN); } if (c.b(jq.PERMISSION_ACCESS_FINE_LOCATION)) { a(a, Manifest.permission.ACCESS_FINE_LOCATION); } } if (FileUtil.isExistFile(fpu.getPathPermission(c.sc_id))) { for (String s : frc.getPermissionList()) { a(a, s); } } ConstVarManifest.handlePermissionComponent(a, c.x); AndroidManifestInjector.getP(a, c.sc_id); Nx applicationTag = new Nx("application"); applicationTag.a("android", "allowBackup", "true"); applicationTag.a("android", "label", "@string/app_name"); if (addRequestLegacyExternalStorage) { applicationTag.a("android", "requestLegacyExternalStorage", "true"); } applicationTag.a("android", "icon", "@drawable/app_icon"); if (!buildSettings.getValue(BuildSettings.SETTING_NO_HTTP_LEGACY, BuildSettings.SETTING_GENERIC_VALUE_FALSE) .equals(BuildSettings.SETTING_GENERIC_VALUE_TRUE)) { applicationTag.a("android", "usesCleartextTraffic", "true"); } if (c.f) { applicationTag.a("android", "name", settings.getValue(ProjectSettings.SETTING_APPLICATION_CLASS, ".SketchApplication")); } AndroidManifestInjector.getAppAttrs(applicationTag, c.sc_id); for (ProjectFileBean projectFileBean : b) { if (!projectFileBean.fileName.contains("_fragment")) { Nx activityTag = new Nx("activity"); String javaName = projectFileBean.getJavaName(); activityTag.a("android", "name", "." + javaName.substring(0, javaName.indexOf(".java"))); if (!AndroidManifestInjector.getActivityAttrs(activityTag, c.sc_id, projectFileBean.getJavaName())) { activityTag.a("android", "configChanges", "orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"); activityTag.a("android", "hardwareAccelerated", "true"); activityTag.a("android", "supportsPictureInPicture", "true"); } if (!AndroidManifestInjector.isActivityThemeUsed(activityTag, c.sc_id, projectFileBean.getJavaName())) { if (c.g) { if (projectFileBean.hasActivityOption(2)) { activityTag.a("android", "theme", "@style/AppTheme.FullScreen"); } } else if (projectFileBean.hasActivityOption(ProjectFileBean.PROJECT_FILE_TYPE_DRAWER)) { if (projectFileBean.hasActivityOption(ProjectFileBean.OPTION_ACTIVITY_TOOLBAR)) { activityTag.a("android", "theme", "@style/NoStatusBar"); } else { activityTag.a("android", "theme", "@style/FullScreen"); } } else if (!projectFileBean.hasActivityOption(ProjectFileBean.OPTION_ACTIVITY_TOOLBAR)) { activityTag.a("android", "theme", "@style/NoActionBar"); } } if (!AndroidManifestInjector.isActivityOrientationUsed(activityTag, c.sc_id, projectFileBean.getJavaName())) { int orientation = projectFileBean.orientation; if (orientation == ProjectFileBean.ORIENTATION_PORTRAIT) { activityTag.a("android", "screenOrientation", "portrait"); } else if (orientation == ProjectFileBean.ORIENTATION_LANDSCAPE) { activityTag.a("android", "screenOrientation", "landscape"); } } f(activityTag); if (!AndroidManifestInjector.isActivityKeyboardUsed(activityTag, c.sc_id, projectFileBean.getJavaName())) { String keyboardSetting = vq.a(projectFileBean.keyboardSetting); if (keyboardSetting.length() > 0) { activityTag.a("android", "windowSoftInputMode", keyboardSetting); } } if (projectFileBean.fileName.equals(AndroidManifestInjector.getLauncherActivity(c.sc_id))) { Nx intentFilterTag = new Nx("intent-filter"); Nx actionTag = new Nx("action"); actionTag.a("android", "name", Intent.ACTION_MAIN); intentFilterTag.a(actionTag); Nx categoryTag = new Nx("category"); categoryTag.a("android", "name", Intent.CATEGORY_LAUNCHER); intentFilterTag.a(categoryTag); activityTag.a(intentFilterTag); } applicationTag.a(activityTag); } } if (c.f) { Nx activityTag = new Nx("activity"); activityTag.a("android", "name", ".DebugActivity"); activityTag.a("android", "screenOrientation", "portrait"); applicationTag.a(activityTag); } if (c.l) { Nx activityTag = new Nx("activity"); activityTag.a("android", "name", "com.google.android.gms.ads.AdActivity"); activityTag.a("android", "configChanges", "keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"); activityTag.a("android", "theme", "@android:style/Theme.Translucent"); applicationTag.a(activityTag); } if (c.h || c.l || c.m) { e(applicationTag); } if (c.h) { b(applicationTag); } if (c.u) { a(applicationTag); } if (c.m) { c(applicationTag); } ConstVarManifest.handleBgTaskComponent(applicationTag, c.x); if (FileUtil.isExistFile(fpu.getManifestJava(c.sc_id))) { ArrayList<HashMap<String, Object>> activityAttrs = getActivityAttrs(); for (String s : frc.getJavaManifestList()) { writeJava(applicationTag, s, activityAttrs); } } if (buildSettings.getValue(BuildSettings.SETTING_NO_HTTP_LEGACY, BuildSettings.SETTING_GENERIC_VALUE_FALSE) .equals(BuildSettings.SETTING_GENERIC_VALUE_FALSE)) { d(applicationTag); } if (FileUtil.isExistFile(fpu.getManifestService(c.sc_id))) { for (String s : frc.getServiceManifestList()) { writeService(applicationTag, s); } } if (FileUtil.isExistFile(fpu.getManifestBroadcast(c.sc_id))) { for (String s : frc.getBroadcastManifestList()) { writeBroadcast(applicationTag, s); } } a.a(applicationTag); return AndroidManifestInjector.mHolder(a.b(), c.sc_id); } public final void writeJava(Nx nx, String activityName, ArrayList<HashMap<String, Object>> arrayList) { Nx activityTag = new Nx("activity"); boolean specifiedActivityName = false; boolean specifiedConfigChanges = false; for (HashMap<String, Object> hashMap : arrayList) { if (hashMap.containsKey("name") && hashMap.containsKey("value")) { Object nameObject = hashMap.get("name"); Object valueObject = hashMap.get("value"); if (nameObject instanceof String && valueObject instanceof String) { String name = nameObject.toString(); String value = valueObject.toString(); if (name.equals(activityName)) { activityTag.b(value); if (value.contains("android:name=")) { specifiedActivityName = true; } else if (value.contains("android:configChanges=")) { specifiedConfigChanges = true; } } } } } if (!specifiedActivityName) { activityTag.a("android", "name", activityName); } if (!specifiedConfigChanges) { activityTag.a("android", "configChanges", "orientation|screenSize"); } nx.a(activityTag); } public ArrayList<HashMap<String, Object>> getActivityAttrs() { String activityAttributesPath = FileUtil.getExternalStorageDir().concat("/.sketchware/data/").concat(c.sc_id).concat("/Injection/androidmanifest/attributes.json"); if (FileUtil.isExistFile(activityAttributesPath)) { try { return new Gson().fromJson(FileUtil.readFile(activityAttributesPath), Helper.TYPE_MAP_LIST); } catch (Exception ignored) { } } return new ArrayList<>(); } }
7d8f5ea54ce32c87729b23720211eb1a229dd054
b7caa44bcde98cf612b71e5770e1a425bed8c883
/app/src/main/java/com/example/myapplication/otpsignin.java
21db888fdefd114a52b1d83a5a4e93a7ce872e65
[]
no_license
quoraboy/RENTCAR
c8a5bf77577ce68418da337de94e771df5ceba7a
5e2a5c266510e06f8d3a5daf26c7044d64cb0c08
refs/heads/master
2022-11-30T23:34:23.270594
2020-08-12T09:48:31
2020-08-12T09:48:31
202,772,349
0
0
null
null
null
null
UTF-8
Java
false
false
8,071
java
package com.example.myapplication; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.FirebaseException; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.PhoneAuthCredential; import com.google.firebase.auth.PhoneAuthProvider; import java.util.concurrent.TimeUnit; public class otpsignin extends AppCompatActivity { private EditText phonetxt; private EditText codetxt; private Button btnOTP; private FirebaseAuth mAuth; private String TAG ="xyz"; private int btntype=0; private PhoneAuthProvider.OnVerificationStateChangedCallbacks mcallback; private String mVerificationId; private PhoneAuthProvider.ForceResendingToken mResendToken; public static String phonenumber ; public static String mDeviceNum; SharedPreferences sharedPref; SharedPreferences.Editor editor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_otpsignin); mAuth=FirebaseAuth.getInstance(); phonetxt=(EditText) findViewById(R.id.phoneEditText); codetxt=(EditText) findViewById(R.id.codeEditText); btnOTP= (Button) findViewById(R.id.btnotp); codetxt.setEnabled(false); btnOTP.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(btntype==0) { phonenumber=phonetxt.getText().toString(); phonetxt.setEnabled(true); codetxt.setEnabled(true); PhoneAuthProvider.getInstance(). verifyPhoneNumber(phonenumber,60, TimeUnit.SECONDS, otpsignin.this, mcallback); } else { String verificationcode=codetxt.getText().toString(); //verificationcode contain the OTP PhoneAuthCredential cridential=PhoneAuthProvider.getCredential(mVerificationId,verificationcode); signInWithPhoneAuthCredential(cridential); } } }); mcallback=new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { @Override public void onVerificationCompleted(PhoneAuthCredential phoneAuthCredential) { //When the code is send and the enter // phone no. is in the phone in which app is runing this meathod is going to run Toast.makeText(otpsignin.this,"Code send to your phone",Toast.LENGTH_SHORT).show(); signInWithPhoneAuthCredential(phoneAuthCredential); } @Override public void onVerificationFailed(FirebaseException e) { //If sms didn't receive this gonna call Toast.makeText(otpsignin.this,"Something went wrong",Toast.LENGTH_SHORT).show(); } @Override public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken token) { //This meathod is call when ever the enter // phone no. is in the other mobile other than the installed app phone no. // The SMS verification code has been sent to the provided phone number, we // now need to ask the user to enter the code and then construct a credential // by combining the code with a verification ID. Toast.makeText(otpsignin.this, verificationId, Toast.LENGTH_SHORT).show(); Log.d(TAG, "onCodeSent:" + verificationId); Toast.makeText(otpsignin.this,"On code sent meathod",Toast.LENGTH_SHORT).show(); // Save verification ID and resending token so we can use them later btntype=1; mVerificationId = verificationId; mResendToken = token; btnOTP.setText("Verify code"); // ... } }; } private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) { mAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener <AuthResult>() { @Override public void onComplete(@NonNull Task <AuthResult> task) { if (task.isSuccessful()) { // Sign in success, update UI with the signed-in user's information Log.d(TAG, "signInWithCredential:success"); FirebaseUser user = task.getResult().getUser(); mDeviceNum = phonenumber; sharedPref = getSharedPreferences("num", Context.MODE_PRIVATE); editor = sharedPref.edit(); editor.putString("Phone",phonenumber); editor.commit(); Intent intent=new Intent(otpsignin.this, NavigationDrawer.class); //intent.putExtra( "phoneno",); startActivity(intent); finish(); // ... } else { // Sign in failed, display a message and update the UI Toast.makeText(otpsignin.this,"ERROR",Toast.LENGTH_SHORT).show(); Log.w(TAG, "signInWithCredential:failure", task.getException()); if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) { // The verification code entered was invalid } } } }); } int backButtonCount = 0; @Override public void onBackPressed() { backButtonCount++; // Toast.makeText(this,String.valueOf(backButtonCount) , Toast.LENGTH_SHORT).show(); // DrawerLayout drawer = findViewById(R.id.drawer_layout); // if (drawer.isDrawerOpen(GravityCompat.START)) { // drawer.closeDrawer(GravityCompat.START); // backButtonCount=0; // } if(backButtonCount > 1) { Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); // Toast.makeText(this, "aaaaaaaaaaa", Toast.LENGTH_SHORT).show(); backButtonCount=0; } else { Toast.makeText(this, "Press the back button once again to close the application.", Toast.LENGTH_SHORT).show(); // backButtonCount++; } // else { // super.onBackPressed(); // } } }
3eb205710d861153935e2acf38b5e521b0a1c821
0b058a8dbdf9210212801fc902f874a21fe4480a
/museum-highcharts/src/main/java/com/qingruan/highcharts/api/Credits.java
5be0837b26e477f710c728c65ac88d1afcd01a4c
[]
no_license
Leibosite/museum-parent
feaa30a152757ae322c5150e5b4394ec5e9ddd2d
ff47cbc5deda44f107490da7e0f62c34058c4095
refs/heads/master
2016-08-12T18:31:03.772954
2016-03-02T06:01:39
2016-03-02T06:01:39
52,937,951
1
2
null
null
null
null
UTF-8
Java
false
false
340
java
package com.qingruan.highcharts.api; import com.qingruan.highcharts.api.base.BaseObject; public class Credits extends BaseObject { private Boolean enabled; public boolean istEnabled() { return enabled; } public Credits setEnabled(boolean enabled) { this.enabled = enabled; return this; } }
d484bd52fc2a9d3e15223fb48956eb92c30fc122
379f713da6654d2e5c50b6156d90dd34fbdc5956
/spring-boot-2-rest-service-with-hateoas/src/main/java/com/in28minutes/springboot/rest/example/student/StudentResource.java
747db24f4ad2a9d627123bfaf05f2ad55ed1a2ca
[]
no_license
Deepake456/SpringProjects
7b22ce4f84f861e3de1170d53c0d91080b21d3f3
d6a34e52b2446498069cbc4665e46e3e24ef8470
refs/heads/master
2022-02-15T08:08:01.364158
2019-08-19T02:50:55
2019-08-19T02:50:55
198,143,943
0
0
null
null
null
null
UTF-8
Java
false
false
2,686
java
package com.in28minutes.springboot.rest.example.student; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; import java.net.URI; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.hateoas.Resource; import org.springframework.hateoas.mvc.ControllerLinkBuilder; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @RestController public class StudentResource { @Autowired private StudentRepository studentRepository; @GetMapping("/students") public List<Student> retrieveAllStudents() { return studentRepository.findAll(); } @GetMapping("/students/{id}") public Resource<Student> retrieveStudent(@PathVariable long id) { Optional<Student> student = studentRepository.findById(id); if (!student.isPresent()) throw new StudentNotFoundException("id-" + id); Resource<Student> resource = new Resource<Student>(student.get()); ControllerLinkBuilder linkTo = linkTo(methodOn(this.getClass()).retrieveAllStudents()); resource.add(linkTo.withRel("all-students")); return resource; } @DeleteMapping("/students/{id}") public void deleteStudent(@PathVariable long id) { studentRepository.deleteById(id); } @PostMapping("/students") public ResponseEntity<Object> createStudent(@RequestBody Student student) { Student savedStudent = studentRepository.save(student); URI location = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}") .buildAndExpand(savedStudent.getId()).toUri(); return ResponseEntity.created(location).build(); } @PutMapping("/students/{id}") public ResponseEntity<Object> updateStudent(@RequestBody Student student, @PathVariable long id) { Optional<Student> studentOptional = studentRepository.findById(id); if (!studentOptional.isPresent()) return ResponseEntity.notFound().build(); student.setId(id); studentRepository.save(student); return ResponseEntity.noContent().build(); } }
ddcc6eab88f177ac0959af3285f0780adb33012e
b7fa70ab07e567614556b0e8d5cd3d18c22246bc
/src/main/java/hudson/plugins/clearcase/history/Filter.java
01221c48ce43e0536b704c9a9c41023b61a39b40
[]
no_license
jglick/clearcase-plugin
6979d9c3eb9a87400b97c3e4304760f108460c54
b5d381d339abb2625f7d66e4e0771976f15ec278
refs/heads/master
2021-01-16T19:51:11.623136
2013-07-18T14:15:24
2013-07-18T14:15:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,531
java
/** * The MIT License * * Copyright (c) 2007-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Erik Ramfelt, * Henrik Lynggaard, Peter Liljenberg, Andrew Bayer * * 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 hudson.plugins.clearcase.history; /** * @author Henrik L. Hansen ([email protected]) */ public interface Filter { public boolean accept(HistoryEntry element); public boolean requiresMinorEvents(); }
8b260729eacbb8906fa1d459d5a26d327f52fd40
6f2e3a609e5a1601d4e590c47954c167b7d56142
/HFDP/Ch6/.metadata/.plugins/org.eclipse.core.resources/.history/33/1070da4d0ba500111b8fd8be7e19507f
964b056eec9c6718fb1a87928544d44c1c210fc7
[]
no_license
nathanh89/training
ba005091b8508f64420ef2bdd6c91e2ac1ea46a8
00f296eef3ffa373f3a38769d3b959f77530fe79
refs/heads/master
2020-06-01T04:35:21.208871
2012-11-08T11:05:57
2012-11-08T11:05:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
339
package com.visionarysoftwaresolutions.hfdpch6.bookstyle.remotecontrol; public class CeilingFanOnCommand implements Command { CeilingFan ceilingFan; public CeilingFanOnCommand(CeilingFan ceilingFan) { this.ceilingFan = ceilingFan; } public void execute() { ceilingFan.high(); } public void undo(){ ceilingFan.off(); } }
2b4d9ca6e4e4a81d0403b7ac2857fd996bce276f
c796230089b71e116050676580a8bf6687b05108
/src/test/java/com/fortunes/test/wanda/BirthOncePlusTest.java
33001ef7c8dd7865c026a027636a0d7109ed067a
[]
no_license
yaoyuanloo/gdsb
3b0639df4f9a11fdd63ccecaa454c348b9aeb2e4
fd1a7f9f2e744717e03563ac808f6e8e7ef4f110
refs/heads/master
2020-03-26T10:32:05.244458
2018-08-15T03:56:45
2018-08-15T03:56:45
144,802,732
0
0
null
null
null
null
UTF-8
Java
false
false
5,172
java
package com.fortunes.test.wanda; import com.fortunes.javamg.common.utils.DateUtils; import com.fortunes.test.DubboTest; import com.wondersgroup.interfaceServiceVS.unemploymentVS.u1.f14030102.F14030102Service; import com.wondersgroup.interfaceServiceVS.unemploymentVS.u1.f14030102.params.*; import org.junit.Test; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import java.text.ParseException; /** * Created by cxd on 2016/10/30 0030. */ public class BirthOncePlusTest extends DubboTest { @Autowired F14030102Service service; /** * 生育一次性待遇查询 checkOnceTreatmentOfBirth; * * OnceTreatmentOfBirthIP基类,该基类包含以下几个字段: * Long aac001; // 人员ID * String aaa027; // 统筹区编码 * * OnceTreatmentOfBirthOP基类,该基类包含以下几个字段: * boolean bizSuccess; * String errorCode; * String message; * Long aae211; //待遇核定年月 * Long aae210; //待遇享受开始时间 * Long aic301; //待遇享受结束时间 * Long ajc099; // 剩余领取月数 * Double aae128; //待遇金额 */ @Test public void test(){ OnceTreatmentOfBirthIP p = new OnceTreatmentOfBirthIP(); p.setAaa027("440000"); p.setAac001(1000001694L); OnceTreatmentOfBirthOP o = service.checkOnceTreatmentOfBirth(p); out(o); } /** * 生育一次性待遇计算 queryOnceTreatmentOfBirth * * QueryOnceTreatmentOfBirthIP基类,该基类包含以下几个字段: * Long aae211; //待遇核定年月 * Long ajc099; // 剩余领取月数 * Double aae128; //待遇金额 * String aaa027; // 统筹区编码 * Long aac001; // 人员ID * * QueryOnceTreatmentOfBirthOP基类,该基类包含以下几个字段: * boolean bizSuccess; //业务是否成功true表示成功,false表示失败 * String errorCode; //错误码 * String message; //信息 * int totalCounts;// 总记录条数 * int totalPage; // 总页数 * int currentPage;// 当前页码 * int rows; // Pagesize每页大小 * List<OnceCalculationDetail> onceCalculationDetail ; * * OnceCalculationDetail实体包含以下字段: * String aaa036; //待遇项目名称 * Double aae128; //待遇金额 * String aae013; //备注 */ @Test public void test1(){ QueryOnceTreatmentOfBirthIP p = new QueryOnceTreatmentOfBirthIP(); p.setAaa027("440000"); p.setAae128(4800D); p.setAjc099(6L); p.setAac001(1000001694L); p.setAae211(20161028L); QueryOnceTreatmentOfBirthOP o = service.queryOnceTreatmentOfBirth(p); out(o); } /** * 生育一次性保存 saveOnceTreatmentOfBirth * * SaveOnceTreatmentOfBirthIP基类,该基类包含以下几个字段: * Long aae211; //待遇核定年月 * Long aae210; //待遇享受开始时间 * Long aic301; //待遇享受结束时间 * Long ajc099; // 剩余领取月数 * Double aae128; //待遇金额 * Long aac001; // 人员ID * String aaa027; // 统筹区编码 * Date bmc001; //生育日期 * List<OnceCalculationDetail> onceCalculationDetail ; * * OnceCalculationDetail包括一下字段: * String aaa036; //待遇项目名称 * Double aae128; //待遇金额 * String aae013; //备注 * * SaveOnceTreatmentOfBirthOP基类,该基类包含以下几个字段: * boolean bizSuccess; * String errorCode; * String message; * 错误码和提示信息如下: * GDYLSY_001:传入参数为空 * GDYLSY_002:基础信息错误 * GDYLSY_003:操作不成功 */ @Test public void test2(){ //查询 OnceTreatmentOfBirthIP p1 = new OnceTreatmentOfBirthIP(); p1.setAaa027("440000"); p1.setAac001(1000001694L); OnceTreatmentOfBirthOP o1 = service.checkOnceTreatmentOfBirth(p1); out(o1); //计算 QueryOnceTreatmentOfBirthIP p2 = new QueryOnceTreatmentOfBirthIP(); p2.setAaa027("440000"); p2.setAae128(4800D); p2.setAjc099(6L); p2.setAac001(1000001694L); p2.setAae211(20161028L); QueryOnceTreatmentOfBirthOP o2 = service.queryOnceTreatmentOfBirth(p2); out(o2); //保存 SaveOnceTreatmentOfBirthIP p = new SaveOnceTreatmentOfBirthIP(); p.setAac001(1000001694L); p.setAaa027("440000"); try { p.setBmc001(DateUtils.parseDate("20161001", "yyyyMMdd")); } catch (ParseException e) { e.printStackTrace(); } BeanUtils.copyProperties(p1, p); BeanUtils.copyProperties(o1, p); BeanUtils.copyProperties(o2, p); SaveOnceTreatmentOfBirthOP o = service.saveOnceTreatmentOfBirth(p); out(o); } }
95a3c7ee28c16007292eaa2a6a43dce90068afef
cc52c565fcd82b34c6f49552b57cc21a48433871
/src/commands/CallbackInterface.java
56022441b4396dd8dd92c63ac0f1bb81535fe588
[]
no_license
christ0208/CashlessPay
025a171f7ecc28be421dee761b0ebb229b2499b2
bdaf9ec36b0e18bac14735a54e4a542279b4b53c
refs/heads/master
2022-04-20T01:17:51.792217
2020-04-03T00:44:09
2020-04-03T00:44:09
239,225,066
0
0
null
null
null
null
UTF-8
Java
false
false
82
java
package commands; public interface CallbackInterface { public void execute(); }
ee0e1ebb23c48d2d1b763b218a81ae38fb915aa4
1c91bade6df69b364f185b168553485363207aed
/app/src/main/java/cn/ewhale/dispatchingeventstest/ViewPageEx.java
25898c47b2d1e8e5559b143774ec1ec42c243483
[]
no_license
YGLLL/DispatchingEventsTest
f89efb829b67238668d40fd2615eb39cb89dfc47
70b4dc2538ba987a6f25dc46708b6956d419260c
refs/heads/master
2020-05-21T00:20:42.728564
2019-05-09T15:22:04
2019-05-09T15:22:04
185,824,205
0
0
null
null
null
null
UTF-8
Java
false
false
1,474
java
package cn.ewhale.dispatchingeventstest; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; /** * create by ygl * 2019/5/9 8:12 */ public class ViewPageEx extends ViewPager { private static final String TAG = "ViewPageEx"; public ViewPageEx(@NonNull Context context) { super(context); } public ViewPageEx(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if(ev.getAction()==MotionEvent.ACTION_DOWN) { return false; }else { return true; } } @Override public boolean onTouchEvent(MotionEvent ev) { switch (ev.getAction()){ case MotionEvent.ACTION_DOWN: Log.e(TAG,"MotionEvent.ACTION_DOWN"); break; case MotionEvent.ACTION_MOVE: Log.e(TAG,"MotionEvent.ACTION_MOVE"); break; case MotionEvent.ACTION_UP: Log.e(TAG,"MotionEvent.ACTION_UP"); break; case MotionEvent.ACTION_CANCEL: Log.e(TAG,"MotionEvent.ACTION_CANCEL"); break; } return super.onTouchEvent(ev); } }
5d8b85d304ac343b75d0bd3b8132f83f88f8022f
1d0bde75c3d3270ebf9e768c30684b9ccf10bf3c
/BaseLibrary/src/main/java/io/github/trylovecatch/baselibrary/log/LogPrinter.java
75d76b895d445cacfb0f7605152a3e1b9a7ceb1b
[]
no_license
TryLoveCatch/ganhuo
c1b73628e621f8de36af78bc798dd02cc946e446
c536fcc09dd07b37d932c39b5a44f478e68b60d1
refs/heads/master
2021-01-10T15:17:06.523912
2017-07-04T11:47:40
2017-07-04T11:47:40
46,768,653
4
0
null
null
null
null
UTF-8
Java
false
false
2,565
java
package io.github.trylovecatch.baselibrary.log; import android.support.annotation.NonNull; public final class LogPrinter extends Timber.DebugTree { private PrintStyle style; /** * 因为如果设置了tag,那么会在timber中多走一个方法,方法栈会发生变化,造成不准确的情况。 */ private boolean isCustomTag = true; private final LogBuilder logBuilder; private static final String PROPERTY = System.getProperty("line.separator"); LogPrinter(LogBuilder logBuilder) { this.logBuilder = logBuilder; this.style = logBuilder.style; } /** * Auto tag */ @Override protected String createStackElementTag(StackTraceElement ignored) { String tag; isCustomTag = false; if (logBuilder.globalTag != null) { tag = logBuilder.globalTag; } else { int offset = Logger.STACK_OFFSET + logBuilder.methodOffset - 2; // 调整栈的位置 final StackTraceElement[] stackTrace = new Throwable().getStackTrace(); final int length = stackTrace.length; tag = super.createStackElementTag(length > offset ? stackTrace[offset] : stackTrace[length - 1]); } return maybeAddPrefix(tag); } public String maybeAddPrefix(String tag) { String tagPrefix = logBuilder.tagPrefix; if (tagPrefix != null) { tag = tagPrefix + "-" + tag; } return tag; } /** * @param tag from {@link #createStackElementTag(StackTraceElement)} */ @Override protected void log(int priority, String tag, @NonNull String message, Throwable ignored) { if (style.beforePrint() != null) { super.log(priority, tag, style.beforePrint(), null); } String[] lines = message.split(PROPERTY); for (int i = 0, length = lines.length; i < length; i++) { String logStr = style.printLog(lines[i], i, length); super.log(priority, tag, logStr, null); } if (style.afterPrint() != null) { super.log((priority), tag, style.afterPrint(), null); } isCustomTag = true; } /** * 根据级别显示log * * @return 默认所有级别都显示 */ @Override protected boolean isLoggable(String tag, int priority) { return priority >= logBuilder.priority; } boolean isCustomTag() { return isCustomTag; } public LogBuilder getLogBuilder() { return logBuilder; } }
781bc66deb7b66870e046dec08bc4380c80b053c
4223c2c2353743f82c5089227b0efed5d92df51c
/core/core-service/src/main/java/com/dreameddeath/core/service/model/common/ServiceInfoVersionInstanceDescription.java
8e903cf857adc446b0223c649e9b4224c6df92d1
[]
no_license
dreameddeath/couchbase-testing
8623f168c327c01eda140e1329fe5b396791b636
127c8a8ba0bfc82f521d607f7640d567bb08f195
refs/heads/master
2021-01-23T15:54:17.274829
2018-09-03T00:16:17
2018-09-03T00:16:17
17,785,813
7
1
null
null
null
null
UTF-8
Java
false
false
2,556
java
/* * * * Copyright Christophe Jeunesse * * * * 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.dreameddeath.core.service.model.common; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Collection; import java.util.Collections; import java.util.Set; import java.util.TreeSet; /** * Created by Christophe Jeunesse on 02/10/2015. */ public class ServiceInfoVersionInstanceDescription { @JsonProperty("uid") private String uid; @JsonProperty("address") private String address; @JsonProperty("port") private Integer port; @JsonProperty("uriSpec") private String uriSpec; @JsonProperty("daemonUid") private String daemonUid; @JsonProperty("webServerUid") private String webServerUid; @JsonProperty("protocols") private Set<String> protocols=new TreeSet<>(); public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public Integer getPort() { return port; } public void setPort(Integer port) { this.port = port; } public String getUriSpec() { return uriSpec; } public void setUriSpec(String uriSpec) { this.uriSpec = uriSpec; } public String getDaemonUid() { return daemonUid; } public void setDaemonUid(String daemonUid) { this.daemonUid = daemonUid; } public String getWebServerUid() { return webServerUid; } public void setWebServerUid(String webServerUid) { this.webServerUid = webServerUid; } public Set<String> getProtocols() { return Collections.unmodifiableSet(protocols); } public void setProtocols(Collection<String> protocols) { this.protocols.clear(); this.protocols.addAll(protocols); } }
da4d640b912675affc78576972077f0fadf9ddff
acb78a78fff1c2a75d0e159c9f8d6a619872cc91
/src/whitehole/smg/DemoObject.java
def997e41a22894fb8ab02925c19fdaeba9da01e
[]
no_license
DJRolls/Whitehole
042da75183d522ff9e1371924399d947ed30dba0
f63fe72fdd5533d5277662b8925557c3335f88a1
refs/heads/master
2023-01-04T17:31:28.191977
2020-11-03T10:54:17
2020-11-03T10:54:17
301,265,131
1
0
null
2020-10-05T01:35:49
2020-10-05T01:33:48
null
UTF-8
Java
false
false
5,548
java
/* Copyright 2012 The Whitehole team This file is part of Whitehole. Whitehole is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Whitehole is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Whitehole. If not, see http://www.gnu.org/licenses/. */ package whitehole.smg; import whitehole.PropertyGrid; import whitehole.vectors.Vector3; public class DemoObject extends LevelObject { public DemoObject(ZoneArchive zone, String filepath, Bcsv.Entry entry) { this.zone = zone; String[] stuff = filepath.split("/"); directory = stuff[0]; layer = stuff[1].toLowerCase(); file = stuff[2]; data = entry; name = (String)data.get("TimeSheetName"); loadDBInfo(); renderer = null; uniqueID = -1; position = new Vector3((float)data.get("pos_x"), (float)data.get("pos_y"), (float)data.get("pos_z")); rotation = new Vector3((float)data.get("dir_x"), (float)data.get("dir_y"), (float)data.get("dir_z")); scale = new Vector3((float)data.get("scale_x"), (float)data.get("scale_y"), (float)data.get("scale_z")); } public DemoObject(ZoneArchive zone, String filepath, int game, String objname, Vector3 pos) { this.zone = zone; String[] stuff = filepath.split("/"); directory = stuff[0]; layer = stuff[1].toLowerCase(); file = stuff[2]; data = new Bcsv.Entry(); name = objname; loadDBInfo(); renderer = null; uniqueID = -1; position = pos; rotation = new Vector3(0f, 0f, 0f); scale = new Vector3(1f, 1f, 1f); data.put("name", name); data.put("pos_x", position.x); data.put("pos_y", position.y); data.put("pos_z", position.z); data.put("dir_x", rotation.x); data.put("dir_y", rotation.y); data.put("dir_z", rotation.z); data.put("scale_x", scale.x); data.put("scale_y", scale.y); data.put("scale_z", scale.z); data.put("SW_APPEAR", -1); data.put("SW_DEAD", -1); data.put("SW_A", -1); data.put("SW_B", -1); if (game == 2) data.put("SW_AWAKE", -1); else data.put("SW_SLEEP", -1); data.put("l_id", 0); data.put("name", 0); data.put("DemoName", 0); data.put("TimeSheetName", 0); data.put("DemoSkip", 0); } @Override public void save() { data.put("name", name); data.put("pos_x", position.x); data.put("pos_y", position.y); data.put("pos_z", position.z); data.put("dir_x", rotation.x); data.put("dir_y", rotation.y); data.put("dir_z", rotation.z); data.put("scale_x", scale.x); data.put("scale_y", scale.y); data.put("scale_z", scale.z); } @Override public void getProperties(PropertyGrid panel) { panel.addCategory("obj_position", "Position"); panel.addField("pos_x", "X position", "float", null, position.x); panel.addField("pos_y", "Y position", "float", null, position.y); panel.addField("pos_z", "Z position", "float", null, position.z); panel.addField("dir_x", "X rotation", "float", null, rotation.x); panel.addField("dir_y", "Y rotation", "float", null, rotation.y); panel.addField("dir_z", "Z rotation", "float", null, rotation.z); panel.addField("scale_x", "X scale", "float", null, scale.x); panel.addField("scale_y", "Y scale", "float", null, scale.y); panel.addField("scale_z", "Z scale", "float", null, scale.z); panel.addCategory("obj_eventinfo", "Event IDs"); panel.addField("SW_APPEAR", "SW_APPEAR", "int", null, data.get("SW_APPEAR")); panel.addField("SW_DEAD", "SW_DEAD", "int", null, data.get("SW_DEAD")); panel.addField("SW_A", "SW_A", "int", null, data.get("SW_A")); panel.addField("SW_B", "SW_B", "int", null, data.get("SW_B")); if (zone.gameMask == 2) panel.addField("SW_AWAKE", "SW_AWAKE", "int", null, data.get("SW_AWAKE")); else panel.addField("SW_SLEEP", "SW_SLEEP", "int", null, data.get("SW_SLEEP")); panel.addCategory("obj_objinfo", "Object settings"); panel.addField("l_id", "Object ID", "int", null, data.get("l_id")); panel.addField("name", "Name", "int", null, data.get("Name")); panel.addField("DemoName", "DemoName", "int", null, data.get("DemoName")); panel.addField("TimeSheetName", "TimeSheetName", "int", null, data.get("TimeSheetName")); panel.addField("DemoSkip", "DemoSkip", "int", null, data.get("DemoSkip")); } /*@Override public void render(GLRenderer.RenderInfo info) { // TODO some good rendering? }*/ @Override public String toString() { String l = layer.equals("common") ? "Common" : "Layer"+layer.substring(5).toUpperCase(); return dbInfo.name + " [" + l + "]"; } }
14bff07818921c4d1bbb5823558551b5ceaaa3f5
092c76fcc6c411ee77deef508e725c1b8277a2fe
/hybris/bin/ext-accelerator/b2bpunchout/src/de/hybris/platform/b2b/punchout/PunchOutUtils.java
be52162801f70ab7a3fdda9cfdeaff9adac3dc60
[ "MIT" ]
permissive
BaggaShivanshu2/hybris-bookstore-tutorial
4de5d667bae82851fe4743025d9cf0a4f03c5e65
699ab7fd8514ac56792cb911ee9c1578d58fc0e3
refs/heads/master
2022-11-28T12:15:32.049256
2020-08-05T11:29:14
2020-08-05T11:29:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,080
java
/* * [y] hybris Platform * * Copyright (c) 2000-2016 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with hybris. * * */ package de.hybris.platform.b2b.punchout; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.PropertyException; import javax.xml.bind.Unmarshaller; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import org.apache.commons.codec.binary.Base64; import org.cxml.CXML; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import com.sun.org.apache.xerces.internal.impl.Constants; public class PunchOutUtils { private static final String XML_WITHOUT_STANDALONE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; private static final String DOCTYPE = "<!DOCTYPE cXML SYSTEM \"http://xml.cXML.org/schemas/cXML/1.2.024/cXML.dtd\">"; protected static final String LOAD_EXTERNAL_DTD = Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE; protected static final String EXTERNAL_GENERAL_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE; protected static final String EXTERNAL_PARAMETER_ENTITIES = Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE; public static CXML unmarshallCXMLFromFile(final String relativeFilePath) throws FileNotFoundException { final InputStream fileInputStream = PunchOutUtils.class.getClassLoader().getResourceAsStream(relativeFilePath); if (fileInputStream == null) { throw new FileNotFoundException("Could not find file [" + relativeFilePath + "]"); } try { final JAXBContext jaxbContext = JAXBContext.newInstance(CXML.class); final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); final SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating(false); spf.setFeature(LOAD_EXTERNAL_DTD, false); spf.setFeature(EXTERNAL_GENERAL_ENTITIES, false); spf.setFeature(EXTERNAL_PARAMETER_ENTITIES, false); spf.setXIncludeAware(false); final SAXParser parser = spf.newSAXParser(); final XMLReader xmlReader = parser.getXMLReader(); final SAXSource source = new SAXSource(xmlReader, new InputSource(fileInputStream)); return (CXML) unmarshaller.unmarshal(source); } catch (final Exception e) { throw new PunchOutException(PunchOutResponseCode.INTERNAL_SERVER_ERROR, e.getMessage(), e); } } public static String marshallFromBeanTree(final CXML cxml) { final StringWriter writer = new StringWriter(); try { final JAXBContext context = JAXBContext.newInstance(CXML.class); final Marshaller m = context.createMarshaller(); removeStandalone(m); setHeader(m); m.marshal(cxml, writer); } catch (final JAXBException e) { throw new PunchOutException(e.getErrorCode(), e.getMessage(), e); } // FIXME - just testing - do it properly String xml = writer.toString(); xml = XML_WITHOUT_STANDALONE + DOCTYPE + xml; return xml; } public static void removeStandalone(final Marshaller marshaller) throws PropertyException { marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE); } public static void setHeader(final Marshaller m) throws PropertyException { m.setProperty("com.sun.xml.internal.bind.xmlHeaders", XML_WITHOUT_STANDALONE + DOCTYPE); } /** * Transforms a CXML into a Base64 String. * * @param cxml * the cxml object. * @return Base64 String */ public static String transformCXMLToBase64(final CXML cxml) { final String cXML = marshallFromBeanTree(cxml); final String cXMLEncoded = Base64.encodeBase64String(cXML.getBytes()); return cXMLEncoded; } }
bf62fe8ca7bc166c471ceb113042ba8a4993586b
a77691f0bda37126f424d4280fb7fb9606f3781e
/src/main/java/org/frekele/cielo/lio/remote/client/converter/deserialize/BigDecimalJsonDeserialize.java
fc83a72ddaaa444df07b1e0d70ac23db0f136f47
[ "MIT" ]
permissive
frekele/cielo-lio-remote-client
e75089a5ae8dfba590a506b01b64968b089cf4eb
7f97dda6b7aa48bb9086f0d51029025642e3685b
refs/heads/master
2023-05-25T05:16:27.867824
2020-05-25T06:00:34
2020-05-25T06:00:34
117,420,215
6
1
MIT
2023-05-09T18:06:47
2018-01-14T10:17:23
Java
UTF-8
Java
false
false
1,003
java
package org.frekele.cielo.lio.remote.client.converter.deserialize; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import java.io.IOException; import java.math.BigDecimal; /** * @author frekele - Leandro Kersting de Freitas */ public class BigDecimalJsonDeserialize extends StdDeserializer<BigDecimal> { private static final int SCALE = 2; protected BigDecimalJsonDeserialize() { super(BigDecimal.class); } @Override public BigDecimal deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (jsonParser != null) { Long value = jsonParser.readValueAs(Long.class); if (value != null) { return BigDecimal.valueOf(value, SCALE); } } return null; } }
f285b36cbae947d4e285d482e3180eb2f1e6f3cf
3578f72df5b5c12b08c60f4e7f8946522a054480
/app/src/main/java/com/example/desarrollo/Entidades/MensajesPersuasivos.java
6713c3837c72939a4e9ecf9f1fe32f2b8a6a55e9
[]
no_license
todostodo/qwerty123zxcvbnmasdfghjkl
327b791938ef613319f51c1f23a7bc85ffe5af10
2e438447beb5fec6e3632cb68d97ebcdaef5d5e0
refs/heads/master
2020-12-12T19:02:02.288589
2020-07-11T01:14:18
2020-07-11T01:14:18
234,205,078
0
0
null
null
null
null
UTF-8
Java
false
false
557
java
package com.example.desarrollo.Entidades; public class MensajesPersuasivos { private String idMsgPersuasivo; private String titulo; private String mensaje; public MensajesPersuasivos(String id, String titulo, String mensaje) { this.idMsgPersuasivo = id; this.titulo = titulo; this.mensaje = mensaje; } public String getIdMsgPersuasivo() { return idMsgPersuasivo; } public String getTitulo() { return titulo; } public String getMensaje() { return mensaje; } }
f853004d1dd19f9b830ebe4573b3f3c4ff69e227
1b30ae6b34099a060cccec21b25e90d3b24f1b33
/src/test/java/org/certificatic/dao/test/AlumnoDAOTest.java
9ca337e32aabd07dbe872b8ef75fa349f494ba79
[]
no_license
EduardoCM/SpringAnotacionesJdbc
206550154069b847125e5b81e543e5b4b126f822
6cf140edfadb88b70378c21bf10fc44d69935408
refs/heads/master
2020-03-30T18:20:32.157709
2018-10-04T05:03:05
2018-10-04T05:03:05
151,495,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,854
java
package org.certificatic.dao.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.List; import org.apache.log4j.Logger; import org.certificatic.bean.Alumno; import org.certificatic.dao.AlumnoDAO; import org.certificatic.dao.AlumnoDAOImpl; import org.certificatic.service.AlumnoService; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/resources/spring-config.xml" }) public class AlumnoDAOTest { private static final Logger logger = Logger.getLogger(AlumnoDAOTest.class); @Autowired AlumnoService alumnoService; @Test public void testSave() { Alumno alumno = new Alumno(); alumno.setNombre("EduardoService"); alumno.setApellido("CastilloService"); assertTrue(alumnoService.save(alumno)); } @Test public void testFindAll() { List<Alumno> alumnos = alumnoService.findAll(); assertTrue(alumnos.size() > 0); } @Test public void testFindById() { Alumno alumno = alumnoService.findById(1); logger.info(alumno); assertNotNull(alumno); } @Test public void testFindByNombre() { List<Alumno> alumnosNombre = alumnoService.findByNombre("Eduardo"); assertNotNull(alumnosNombre); } @Test public void testUpdateAlumno() { Alumno alumnoNew = new Alumno(); alumnoNew.setIdAlumno(1); alumnoNew.setNombre("NombreActualizadoDos"); alumnoNew.setApellido("ApellidoActualizadoDos"); assertTrue(alumnoService.update(alumnoNew)); } @Test public void testDeleteAlumno() { alumnoService.delete(4); } }
75affd081a0ee0846cb5bf89628af134963b0e83
7e6ffe33851173968c33936d7db54e01c9e612f6
/src/GenericError.java
2b33df6832165984f58505b9eb16e090bff25621
[]
no_license
zebaslam/Custom-Tree-API
babaeda4374b66c8af7756511512ad95ebd06c72
48dffb6c95ae53c3d422ddf0be0541423b582e48
refs/heads/master
2020-12-11T05:55:20.902749
2014-01-11T06:57:04
2014-01-11T06:57:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
/** * A generic Exception handling class used to handle various exceptions within this assignment * @author Zeb Aslam 108041523 * */ public class GenericError extends Error { //used this to satisfy compiler private static final long serialVersionUID = -6690154863361458021L; /** * The constructor takes in a string that will be used to generate the error message using the super constructor from the error class. * @param x -The value that the message will have */ public GenericError(String x){ super(x); } }
59057dffe7cfc682c8bd99d6d5d9fe09012b91c0
6d1162784f17d17a498fc0ca080eeb8e7cd2c582
/Concurrent/SourceCode/Concurrency/src/main/java/com/mmall/concurrency/example/publish/Escape.java
86ebcb6d424efc6a38822e3defdf1a136b91f8d2
[ "MIT" ]
permissive
Gravitational-Field/GF-Concurrent
caae412f3f84ab258dda11f6fa8e52e2bffff92a
9ff3ba6ad932de610cc2d2a56802faaaf41bf03f
refs/heads/main
2023-03-13T13:58:58.213762
2021-03-16T01:57:55
2021-03-16T01:57:55
348,181,464
0
0
null
null
null
null
UTF-8
Java
false
false
586
java
package main.java.com.mmall.concurrency.example.publish; import main.java.com.mmall.concurrency.annoations.NotRecommend; import main.java.com.mmall.concurrency.annoations.NotThreadSafe; import lombok.extern.slf4j.Slf4j; @Slf4j @NotThreadSafe @NotRecommend public class Escape { private int thisCanBeEscape = 0; public Escape () { new InnerClass(); } private class InnerClass { public InnerClass() { log.info("{}", Escape.this.thisCanBeEscape); } } public static void main(String[] args) { new Escape(); } }
9d033b37e7d2f61734959042d18523002007285b
755d29db8d0f7b47a3c6c9c1f3fd4b2fa8e3c785
/Android/app/src/main/java/com/example/sree/outlaymanagement/ElectricitybillActivity.java
5ae84a50f0cce59f16c05d18c7a053817a725f37
[]
no_license
sreelakshmishaji/Outlay_management
0ed76d32e246ce36e33ffd0eed952c5f830d54e0
ea30c0edc8477b52f38b00f199063512274a9eb1
refs/heads/master
2020-04-07T17:35:25.092372
2018-11-23T05:01:38
2018-11-23T05:01:38
158,575,648
0
0
null
null
null
null
UTF-8
Java
false
false
3,230
java
package com.example.sree.outlaymanagement; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONObject; public class ElectricitybillActivity extends AppCompatActivity implements View.OnClickListener { Button confirm; EditText serviceno; SharedPreferences sh; String id; String sh_name = "MyData"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_electricitybill); Toast.makeText(this, "hello", Toast.LENGTH_SHORT).show(); confirm = findViewById(R.id.btnconform); confirm.setOnClickListener(this); serviceno = findViewById(R.id.edtserviceno); sh = getSharedPreferences(sh_name, MODE_PRIVATE); id = sh.getString("User_id", " "); } @Override public void onClick(View view) { if (view == confirm) { String servicenum = serviceno.getText().toString(); if (servicenum.equals("")) { serviceno.setError("Enter Serviceno"); } else if (!(servicenum.length() >= 9 && servicenum.length() <= 13)) { serviceno.setError("Enter a Valid Service Number"); } else { Bill data = new Bill(); data.execute(id,servicenum); // Intent i = new Intent(this, PayElectricityActivity.class); // i.putExtra("service", servicenum); // startActivity(i); } } } private class Bill extends AsyncTask<String, String, String> { @Override protected String doInBackground(String... strings) { WebServiceCaller wc = new WebServiceCaller(); wc.setSoapObject("ebillservice"); wc.addProperty("Personid", strings[0]); wc.addProperty("Serviceno", strings[1]); wc.callWebService(); return wc.getResponse(); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); // Toast.makeText(ElectricitybillActivity.this, s, Toast.LENGTH_SHORT).show(); String bill=""; JSONArray ji= null; try { ji = new JSONArray(s); JSONObject jos = ji.getJSONObject(0); bill = jos.getString("BillNo"); if(bill.equals("0")) { Toast.makeText(ElectricitybillActivity.this, "Incorrect Service Number", Toast.LENGTH_SHORT).show(); serviceno.setText(""); } else { Intent i = new Intent(ElectricitybillActivity.this, PayElectricityActivity.class); i.putExtra("service", s); startActivity(i); } } catch(Exception e) { } } } }
8f3bab8be88c6e30aa5615371e150dd84602c026
7559bead0c8a6ad16f016094ea821a62df31348a
/src/com/vmware/vim25/VmAutoRenameEvent.java
82f3a929305a7f33b714e6c112665422380b4e9d
[]
no_license
ZhaoxuepengS/VsphereTest
09ba2af6f0a02d673feb9579daf14e82b7317c36
59ddb972ce666534bf58d84322d8547ad3493b6e
refs/heads/master
2021-07-21T13:03:32.346381
2017-11-01T12:30:18
2017-11-01T12:30:18
109,128,993
1
1
null
null
null
null
UTF-8
Java
false
false
2,038
java
package com.vmware.vim25; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for VmAutoRenameEvent complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="VmAutoRenameEvent"> * &lt;complexContent> * &lt;extension base="{urn:vim25}VmEvent"> * &lt;sequence> * &lt;element name="oldName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="newName" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "VmAutoRenameEvent", propOrder = { "oldName", "newName" }) public class VmAutoRenameEvent extends VmEvent { @XmlElement(required = true) protected String oldName; @XmlElement(required = true) protected String newName; /** * Gets the value of the oldName property. * * @return * possible object is * {@link String } * */ public String getOldName() { return oldName; } /** * Sets the value of the oldName property. * * @param value * allowed object is * {@link String } * */ public void setOldName(String value) { this.oldName = value; } /** * Gets the value of the newName property. * * @return * possible object is * {@link String } * */ public String getNewName() { return newName; } /** * Sets the value of the newName property. * * @param value * allowed object is * {@link String } * */ public void setNewName(String value) { this.newName = value; } }
5266bd396e9cb1420397abc8e0dad7a51ce8a9db
6141823cac3e32036e711e0063ffb4b7ad2d809e
/ExamenTPJunio/Practica6/src/es/ucm/fdi/tp/basecode/bgame/model/FiniteRectBoard.java
fda76dbec974c324b5e1722d5ef080eb0e310be5
[]
no_license
Nhala86/ExamenTP
1665e254952e7b2fed38364cd98a4d0127daa70a
5e5763b9dd4c7ed1147602208626c2472d084658
refs/heads/master
2020-04-06T07:10:57.873463
2016-08-25T11:02:09
2016-08-25T11:02:09
63,145,453
0
0
null
null
null
null
UTF-8
Java
false
false
4,807
java
package es.ucm.fdi.tp.basecode.bgame.model; /** * An implementation of a finite rectangular board. * * <p> * Implementacion de un tablero rectangular de dimensión finita. * */ public class FiniteRectBoard extends BasicBoard { private static final long serialVersionUID = 1L; /** * The internal representation of the board. Simply a matrix of objects of * type {@link Piece}. * * <p> * Representacion interna del tablero: una matriz de objetos de tipo * {@link Piece}. */ private Piece[][] board; /** * The number of occupied cells in the board. * * <p> * Numero de casillas ocupadas en el tablero. */ private int occupied; /** * The number of cells in the board -- {@code rows*cols}. Just to avoid * recalculating the value, etc. * * <p> * Numero total de casillas en el tablero --{@code rows*cols}. Se utiliza * para evitar recalcular el valor. */ private int numOfCells; /** * Number of columns in the board. * <p> * Numero de columnas del tablero. */ private int cols; /** * Number of rows in the board. * <p> * Numero de filas del tablero. */ private int rows; /** * This constructor constructs a finite rectangular board of a given * dimension. * * <p> * Construye un tablero rectangular finito de una dimension determinada. * * @param rows * Number of rows. * <p> * Numero de filas. * @param cols * Number of columns. * <p> * Numero de columnas. */ public FiniteRectBoard(int rows, int cols) { if (rows <= 0 || cols <= 0) { throw new GameError("Invalid finte rectangular board size (" + rows + "," + cols + ")"); } this.rows = rows; this.cols = cols; board = new Piece[rows][cols]; occupied = 0; numOfCells = rows * cols; } @Override public void setPosition(int row, int col, Piece p) { if (row < 0 || row >= rows || col < 0 || col >= cols) { throw new GameError("Trying to access an invalid position (" + row + "," + col + ")"); } Piece q = board[row][col]; // we get the current piece at position // (row,col) just to correctly update the // number of occupied cells. if (p == null && q != null) occupied--; else if (p != null && q == null) occupied++; board[row][col] = p; } @Override public Piece getPosition(int row, int col) { if (row < 0 || row >= rows || col < 0 || col >= cols) { throw new GameError("Trying to access an invalid position (" + row + "," + col + ")"); } return board[row][col]; } @Override public int getRows() { return rows; } @Override public int getCols() { return cols; } private void copyTo(FiniteRectBoard newboard) { // ask the super class to copy its stuff first. super.copyTo(newboard); // copy the actual board newboard.board = new Piece[rows][cols]; for (int i = 0; i < rows; i++) for (int j = 0; j < cols; j++) newboard.board[i][j] = board[i][j]; newboard.cols = cols; newboard.rows = rows; // copy cell count information newboard.occupied = occupied; newboard.numOfCells = numOfCells; } @Override public Board copy() { FiniteRectBoard newboard = new FiniteRectBoard(rows, cols); copyTo(newboard); return newboard; } @Override public boolean isFull() { return occupied == numOfCells; } @Override public boolean isEmpty() { return occupied == 0; } /** * Generates a string that represents the board. The symbols used to print * the board are the first characters of the piece identifier. * * <p> * Genera un string que representa el tablero. El simbolo utilizado para * cada ficha es el primer caracter de su id. * * @return A string representation of the board. */ @Override public String toString() { StringBuilder render = new StringBuilder(); int height = getRows(); int width = getCols(); for (int r = 0; r < height; ++r) { render.append(" +"); for (int c = 0; c < width; ++c) render.append("---+"); render.append("\n"); render.append("" + (r % 10) + " |"); for (int c = 0; c < width; ++c) { if (getPosition(r, c) == null) { render.append(" |"); } else { render.append(" " + getPosition(r, c).toString().charAt(0) + " |"); } } // for columns render.append("\n"); } // for rows render.append(" +"); for (int c = 0; c < width; ++c) render.append("---+"); render.append("\n"); render.append(" "); for (int c = 0; c < width; ++c) render.append(" " + (c % 10) + " "); render.append("\n"); return render.toString(); } }
40d2462e70c3c9fa2522eaf673d15fce4c7a65d3
5ebd630076f9eb6af7a01b7d2edcb9c184bc86f8
/src/NewJFrame.java
c2935522cedfab3f7b6ac861414007b5e6bc4345
[]
no_license
swatikp99/calc-java
1e37d3cb177126ac7710994ebfbc6d413b127dc0
09f9f28d3100a0e4fe89942520a445191a83ccc1
refs/heads/main
2023-03-03T14:00:35.529603
2021-02-12T19:31:27
2021-02-12T19:31:27
338,413,101
0
0
null
null
null
null
UTF-8
Java
false
false
7,600
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. */ /** * * @author Swatik */ public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jTextField2 = new javax.swing.JTextField(); jTextField1 = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jPanel1.setBackground(new java.awt.Color(230, 230, 230)); jTextField2.setBackground(new java.awt.Color(204, 255, 204)); jTextField2.setFont(new java.awt.Font("Bahnschrift", 0, 14)); // NOI18N jTextField2.setForeground(new java.awt.Color(102, 102, 102)); jTextField2.setHorizontalAlignment(javax.swing.JTextField.RIGHT); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jTextField1.setBackground(new java.awt.Color(204, 255, 204)); jTextField1.setFont(new java.awt.Font("Bahnschrift", 0, 24)); // NOI18N jTextField1.setForeground(new java.awt.Color(102, 102, 102)); jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT); jTextField1.setBorder(null); jTextField1.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(32, 32, 32) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(18, 18, 18) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(19, Short.MAX_VALUE))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 109, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(2, 2, 2) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 266, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: jTextField1.setText(jTextField1.getText()+0); }//GEN-LAST:event_jTextField2ActionPerformed private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: jTextField1.setText(jTextField1.getText()+0); }//GEN-LAST:event_jTextField1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; // End of variables declaration//GEN-END:variables }
b5d9a39903af567a130263891569237cc2276507
7634f5b09d2680adecdd1b93415335caa76ea4da
/arrow/src/main/java/org/apache/iceberg/arrow/ArrowSchemaUtil.java
4d51803a5b90dc2c8f3e3192bd20e28177ae369d
[ "Apache-2.0" ]
permissive
funcheetah/iceberg
15beb4fddde998292b1c1f11ce46788fb093f439
c88ec3f2352789a213f3d409cec3ec36238d0ef0
refs/heads/master
2022-06-06T06:48:46.872077
2021-05-13T23:40:06
2021-05-13T23:40:06
238,067,296
1
0
Apache-2.0
2020-02-03T21:38:44
2020-02-03T21:38:43
null
UTF-8
Java
false
false
5,005
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.iceberg.arrow; import java.util.List; import java.util.Map; import org.apache.arrow.vector.types.DateUnit; import org.apache.arrow.vector.types.FloatingPointPrecision; import org.apache.arrow.vector.types.TimeUnit; import org.apache.arrow.vector.types.pojo.ArrowType; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.types.pojo.Schema; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; import org.apache.iceberg.relocated.com.google.common.collect.Lists; import org.apache.iceberg.types.Types; import org.apache.iceberg.types.Types.ListType; import org.apache.iceberg.types.Types.MapType; import org.apache.iceberg.types.Types.NestedField; import org.apache.iceberg.types.Types.StructType; public class ArrowSchemaUtil { private static final String ORIGINAL_TYPE = "originalType"; private static final String MAP_TYPE = "mapType"; private ArrowSchemaUtil() { } /** * Convert Iceberg schema to Arrow Schema. * * @param schema iceberg schema * @return arrow schema */ public static Schema convert(final org.apache.iceberg.Schema schema) { ImmutableList.Builder<Field> fields = ImmutableList.builder(); for (NestedField f : schema.columns()) { fields.add(convert(f)); } return new Schema(fields.build()); } public static Field convert(final NestedField field) { final ArrowType arrowType; final List<Field> children = Lists.newArrayList(); Map<String, String> metadata = null; switch (field.type().typeId()) { case BINARY: // Spark doesn't support BYTE(fixed_size) type, so cast it to VarBinary case FIXED: arrowType = ArrowType.Binary.INSTANCE; break; case BOOLEAN: arrowType = ArrowType.Bool.INSTANCE; break; case INTEGER: arrowType = new ArrowType.Int(Integer.SIZE, true /* signed */); break; case LONG: arrowType = new ArrowType.Int(Long.SIZE, true /* signed */); break; case FLOAT: arrowType = new ArrowType.FloatingPoint(FloatingPointPrecision.SINGLE); break; case DOUBLE: arrowType = new ArrowType.FloatingPoint(FloatingPointPrecision.DOUBLE); break; case DECIMAL: final Types.DecimalType decimalType = (Types.DecimalType) field.type(); arrowType = new ArrowType.Decimal(decimalType.precision(), decimalType.scale()); break; case STRING: arrowType = ArrowType.Utf8.INSTANCE; break; case TIME: arrowType = new ArrowType.Time(TimeUnit.MICROSECOND, Long.SIZE); break; case TIMESTAMP: arrowType = new ArrowType.Timestamp(TimeUnit.MICROSECOND, ((Types.TimestampType) field.type()).shouldAdjustToUTC() ? "UTC" : null); break; case DATE: arrowType = new ArrowType.Date(DateUnit.DAY); break; case STRUCT: final StructType struct = field.type().asStructType(); arrowType = ArrowType.Struct.INSTANCE; for (NestedField nested : struct.fields()) { children.add(convert(nested)); } break; case LIST: final ListType listType = field.type().asListType(); arrowType = ArrowType.List.INSTANCE; for (NestedField nested : listType.fields()) { children.add(convert(nested)); } break; case MAP: metadata = ImmutableMap.of(ORIGINAL_TYPE, MAP_TYPE); final MapType mapType = field.type().asMapType(); arrowType = new ArrowType.Map(false); List<Field> entryFields = Lists.transform(mapType.fields(), ArrowSchemaUtil::convert); Field entry = new Field("", new FieldType(field.isOptional(), arrowType, null), entryFields); children.add(entry); break; default: throw new UnsupportedOperationException("Unsupported field type: " + field); } return new Field(field.name(), new FieldType(field.isOptional(), arrowType, null, metadata), children); } }