blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
7b2a8b4a678390af88dd87c60f30e6361c10eb10
776c2afdeaf3825630987e597b217267a28e673a
/src/main/java/com/cursomc/domain/PagamentoComBoleto.java
55a37da88fa852ef20988770fa63b6ff6f58dc7e
[]
no_license
phileng7/springboot2-ionic-backend
b42e722bd1e6f680ae60a2dd3aa41778d8b30e78
c8a1fa875b794b53bc59efb4d013d724a2e15a93
refs/heads/master
2020-03-14T21:13:05.465943
2018-07-16T22:25:47
2018-07-16T22:25:47
131,783,724
0
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
package com.cursomc.domain; import java.util.Date; import javax.persistence.Entity; import com.cursomc.domain.enums.EstadoPagamento; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonTypeName; @Entity @JsonTypeName("pagamentoComBoleto") public class PagamentoComBoleto extends Pagamento { private static final long serialVersionUID = 1L; @JsonFormat(pattern="dd/MM/yyyy HH:mm") private Date dataVencimento; @JsonFormat(pattern="dd/MM/yyyy HH:mm") private Date dataPagamento; public PagamentoComBoleto() { } public PagamentoComBoleto(Integer id, EstadoPagamento estado, Pedido pedido, Date dataVencimento, Date dataPagamento) { super(id, estado, pedido); this.dataVencimento = dataVencimento; this.dataPagamento = dataPagamento; } public Date getDataVencimento() { return dataVencimento; } public void setDataVencimento(Date dataVencimento) { this.dataVencimento = dataVencimento; } public Date getDataPagamento() { return dataPagamento; } public void setDataPagamento(Date dataPagamento) { this.dataPagamento = dataPagamento; } }
[ "fmesy@outlook.com" ]
fmesy@outlook.com
485a1db265beb7711f8c4e050541c5c5269e8dc4
2550ad0940c74ebfde831964f5918bc47ea579fa
/server/src/main/java/com/imooc/product/dataobject/ProductCategory.java
47c32f22a937aa26d62562be88b2de14ffb92e5f
[]
no_license
mixluo/product
7818ea3329ff81a0d62cca5351d52e1edbca723c
1e9eecfd078beaaeab63f3779ce609d0d3f0cabf
refs/heads/master
2020-03-26T02:02:55.235228
2018-10-25T13:04:47
2018-10-25T13:04:47
144,394,529
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.imooc.product.dataobject; import lombok.Data; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import java.util.Date; @Data @Entity public class ProductCategory { @Id @GeneratedValue private Integer categoryId; private String categoryName; private Integer categoryType; private Date createTime; private Date updateTime; }
[ "luoqiang92@126.com" ]
luoqiang92@126.com
80175f89edf271a563bdea329bd18ffc1bfa35ab
4780a0dbe951c925bd73de6573ec212fdfd0d32d
/src/main/java/com/github/leozin/service/JwtTokenService.java
1ffc0f4cd05717754babc89a550eb14b2a4e9456
[]
no_license
leozin/auth-service-quarkus
bee0aaecb2f97544c892a202faf0009dfe6c61ef
c02c821cb3657019bece2bfbf97e60b2d75267bf
refs/heads/main
2023-08-27T13:16:38.838469
2021-10-31T16:51:51
2021-10-31T16:51:51
410,922,692
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.github.leozin.service; import io.smallrye.jwt.build.Jwt; import javax.enterprise.context.ApplicationScoped; import java.util.Arrays; import java.util.HashSet; @ApplicationScoped public class JwtTokenService implements TokenService { public String generateToken(String email) { return Jwt.issuer("github.com/leozin").upn(email) .expiresIn(30L) .groups(new HashSet<>(Arrays.asList("user"))) .sign(); } }
[ "lrafaeli@shutterstock.com" ]
lrafaeli@shutterstock.com
8ee31724fe741490cf5ce77f52c6ef45b6331572
c857249309244bc39c4c663ba7c83f091fb8479a
/src/atmdbank/AdminDTO.java
0bf0e3cdf4d80017b5ea64e277c571cbd5b8808a
[]
no_license
ddogru/D-Bank-ATM-with-Java
b2687058e3b378549582d6f817a7e460a6293099
94828dee4211bb141fe0da652665850cd6a580f9
refs/heads/main
2023-02-13T17:37:23.213909
2021-01-14T22:35:45
2021-01-14T22:35:45
329,747,689
0
0
null
null
null
null
UTF-8
Java
false
false
1,100
java
package atmdbank; public class AdminDTO { private String adminName ; private String adminSurname; private int adminID; private int adminPass; AdminDTO(String adminName,String adminSurname,int adminID, int adminPass){ this.adminName = adminName; this.adminSurname = adminSurname; this.adminID = adminID; this.adminPass = adminPass; } public void setAdminName(String adminName) { this.adminName = adminName; } public String getAdminName() { return this.adminName; } public void setAdminSurname(String adminSurname) { this.adminSurname = adminSurname; } public String getAdminSurname() { return this.adminSurname; } public void setAdminID(int adminID) { this.adminID = adminID; } public int getAdminID() { return this.adminID ; } public void setAdminPass(int adminPass) { this.adminPass= adminPass; } public int getAdminPass() { return this.adminPass; } public String toString() { return this.adminName+"," +this.adminSurname+"," +this.adminID+","+this.adminPass; } }
[ "noreply@github.com" ]
noreply@github.com
13a36323b2291650075323bf244bdf4c7633d2b8
a192c81da2b6ffdab83d74a9c44b2fb3acecf631
/src/main/java/com/jiang/wxshop/enums/CodeEnum.java
efdf4b72d01775a505ff2bf413e46d2321c4f258
[]
no_license
jiangqianghua/wxshop
4f59710fd1076e1f0ffba871e9beae5d3cfe6378
c2b22a77fafeaf931da59d349bdc76dc8a718cca
refs/heads/master
2021-09-12T22:50:29.640519
2018-04-22T02:50:31
2018-04-22T02:50:31
112,972,560
0
0
null
null
null
null
UTF-8
Java
false
false
83
java
package com.jiang.wxshop.enums; public interface CodeEnum { Integer getCode(); }
[ "jiangqianghua@jiangqianghuadeMacBook-Pro.local" ]
jiangqianghua@jiangqianghuadeMacBook-Pro.local
1831fa3852891a65cb445f112f2fc3c63fd7b9a8
35f5afb247302766fa665c5fd80c0c1c3c8e6579
/src/main/java/com/unb/opendatagraph/domain/DataRequest.java
eecb057bbb7621606593093e6d85119c6029ce84
[ "Apache-2.0" ]
permissive
rpinheiroalmeida/opendatagraph
0851e05426c00e00382193b94a23e33f357aff0d
34f01b9bcf44c2cdba93ec255537bf0e25ad3201
refs/heads/master
2022-11-17T06:49:44.925074
2019-11-04T19:37:01
2019-11-04T19:37:01
219,059,749
0
1
Apache-2.0
2022-11-15T23:51:03
2019-11-01T20:42:50
Java
UTF-8
Java
false
false
857
java
package com.unb.opendatagraph.domain; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.neo4j.ogm.annotation.GeneratedValue; import org.neo4j.ogm.annotation.Id; import org.neo4j.ogm.annotation.NodeEntity; import org.neo4j.ogm.annotation.Relationship; import java.util.List; @NodeEntity(label = "Activity") @Data @NoArgsConstructor @AllArgsConstructor @Builder public class DataRequest { @Id @GeneratedValue private Long id; private String name; private String program; private String version; private String description; private String startAtTime; private String endAtTime; private String software; private List<String> request; @Relationship(type = "Used") private DW dwUsed; @Relationship(type = "WasAssociatedWith") private UnBGOLD unBGOLDWasAssociatedWith; }
[ "rpinheiroalmeida@gmail.com" ]
rpinheiroalmeida@gmail.com
c5fcf4fce3fb3a55491734f94d67ae29d379fbf6
4d22afd8582191a341a6438c32b666763003b79f
/TZ_studio/lesson4/Test_tz_qq/gen/com/example/qq/BuildConfig.java
6d69408d31021f9d62bdfaf232d8513e06de98ed
[]
no_license
Moon-College/July_PublicWork
2715b3c58c07bffeaad4df48cbf1dff78e43eb85
b0e907c542974c9cf2f93a9c9cc27be525824aed
refs/heads/master
2021-01-16T19:00:44.771289
2015-11-08T16:47:20
2015-11-08T16:47:20
37,726,204
19
10
null
null
null
null
UTF-8
Java
false
false
156
java
/** Automatically generated file. DO NOT MODIFY */ package com.example.qq; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "hu-dabing@163.com" ]
hu-dabing@163.com
0e698218ef541ee60164b2f290aa14b3b2168cd8
b0843640efd58416ee4da0344964c572dc092bd1
/common/src/main/java/com/library/android/common/baseconstants/BaseConstants.java
8703d91c6bbd517b6ab4a2b478e3c78fc8884f82
[]
no_license
sagarpatel288/EmailApp
e967bf3f2bbb1db93c673b74a2103ec30464b05b
2354572d975abecadf3d3fac02fca5e1c65b4267
refs/heads/master
2020-06-27T12:31:18.678565
2019-08-25T18:40:52
2019-08-25T18:40:52
199,955,208
1
1
null
null
null
null
UTF-8
Java
false
false
903
java
package com.library.android.common.baseconstants; public class BaseConstants { // Note: 11/27/2018 by sagar Default null value to be compared public static final int NULL = (int) -1L; // Note: 11/27/2018 by sagar App tag to be used in logs public static final String TAG = " :commonLog: "; // Note: 11/27/2018 by sagar Error message to print or show while trying to use reflection for typeface utility public static final String STR_MSG_ERROR_TYPEFACE_REFLECTION = "Use getInstance() method to get single instance of this class"; // Note: 11/27/2018 by sagar Delay in millisecond to perform continuous touch event for quantity modification public static final long DELAY = 100; public static final class ItemViewType { public static final int ITEM_VIEW_TYPE = 1; public static final int PROGRESS_BAR_CIRCULAR_LOADING = 2; } }
[ "sagarpatel288@gmail.com" ]
sagarpatel288@gmail.com
1aa0523fd0b98b77c7c98ecd43a4cf6cee147e3c
9014451935dd5fa7f9baf574d1dc83411d57f556
/src/main/java/ua/gov/controller/ObligorController.java
01e0247c5a0eaf250204e645d924232a6ea159ee
[]
no_license
AnnaZavgorodnia/DebtorsRegister
4a77f82161355577b0a41a64e87f0e032f957b41
c82b72d65524eb4cb50d5aee9eb07fce640d6ff1
refs/heads/master
2022-09-13T01:13:22.395942
2020-05-18T07:12:04
2020-05-18T07:12:04
264,857,979
0
0
null
null
null
null
UTF-8
Java
false
false
3,276
java
package ua.gov.controller; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import ua.gov.dto.ObligorDTO; import ua.gov.dto.RecordDTO; import ua.gov.exception.ResponseException; import ua.gov.model.Obligor; import ua.gov.model.Record; import ua.gov.service.ObligorService; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; import java.util.stream.Collectors; @RestController @RequestMapping(path="/api/search-debtor", produces="application/json") @CrossOrigin(origins="*") @RequiredArgsConstructor public class ObligorController { private final ObligorService service; @ResponseStatus(HttpStatus.OK) @GetMapping public List<Record> searchDebtors(@RequestParam(name = "fullName", required = false) String fullName, @RequestParam(name = "birthDate", required = false) LocalDate birthDate, @RequestParam(name = "identificationCode", required = false) String identificationCode, @RequestParam(name = "chargebackCategory", required = false) Long chargebackCategory, @RequestParam(name = "isLegalEntity") Boolean isLegalEntity){ if(fullName == null && identificationCode == null){ throw new RuntimeException("Search parameters are missing"); } ObligorDTO dto = new ObligorDTO(); dto.setFullName(fullName); dto.setBirthDate(birthDate); dto.setIdentificationCode(identificationCode); dto.setChargebackCategory(chargebackCategory); dto.setIsLegalEntity(isLegalEntity); try{ Obligor obligor = service.findObligorsRecords(dto); if(dto.getChargebackCategory() != null){ return obligor.getRecords().stream() .filter(el -> el.getChargebackCategory().getId().equals(chargebackCategory)) .collect(Collectors.toList()); } return obligor.getRecords(); } catch (RuntimeException e){ return new ArrayList<>(); } } @ResponseStatus(HttpStatus.OK) @GetMapping("/{id}") public Obligor findObligorById(@PathVariable Long id){ return service.findObligorById(id); } @ResponseStatus(HttpStatus.BAD_REQUEST) @ExceptionHandler(RuntimeException.class) @ResponseBody public ResponseException handleRuntimeException(RuntimeException ex) { return new ResponseException(ex.getMessage()); } }
[ "annazavgorodnya.work@gmail.com" ]
annazavgorodnya.work@gmail.com
e78e93036f207631fe318460db0d5a0ecd0b0386
ab4a74ec5a72bfed4d788628f9e83c9f67352237
/reservation-common/src/main/java/com/reservation/common/component/UseCase.java
29641c9a900c464f4163b3a3d3285c9dbedc16cf
[]
no_license
Ignatovw99/Reservation-API
c29e4e4e62b12eb2944c059a65c44d042ea63639
5918aa008b90a887b7a9045abd6c861d8e14a750
refs/heads/master
2023-08-13T20:10:23.166046
2021-10-18T05:08:45
2021-10-18T05:08:45
297,589,119
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.reservation.common.component; import org.springframework.core.annotation.AliasFor; import org.springframework.stereotype.Component; import java.lang.annotation.*; @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @Component public @interface UseCase { /** * The value may indicate a suggestion for a logical component name, * to be turned into a Spring bean in case of an autodetected component. * Returns: the suggested component name, if any (or empty String otherwise) */ @AliasFor(annotation = Component.class) String value() default ""; }
[ "lyuboslavw@gmail.com" ]
lyuboslavw@gmail.com
833992517b5ee29051bcb1c74ee6bb7f3de0791f
8f7430290bfec179a163ca20cad5221d4306fe2d
/Unit 4/EvanKanter_431_Circle.java
31c6bf08d0b1504483b53ba6132c09fdb62e036e
[]
no_license
evank28/ICS4UN
1e9efe0e824249e4ad1595586fa503b77c950b71
91e701271dbd4fe8cb38a30869a5fa0617587784
refs/heads/master
2022-04-15T08:23:01.459033
2020-02-19T05:25:03
2020-02-19T05:25:03
164,485,392
0
0
null
null
null
null
UTF-8
Java
false
false
2,893
java
// Creates the Circle class as per instructions //Modified from 411 import java.util.*; public class EvanKanter_431_Circle { public static void main (String[] args) { Circle spot = new Circle(5) ; Circle.displayAreaFormula() ; Circle.displayCircumfrenceFormula() ; System.out.println("Circle Radius: " +spot.getRadius() ); System.out.println("Circle Area: "+spot.area() ); System.out.println("Circle Circumference: " +spot.circumference () ); System.out.println("\n############## Let's repeat without changing the radius ############## \nNote that no calculations will be performed \n"); System.out.println("Circle Radius: " +spot.getRadius() ); System.out.println("Circle Area: "+spot.area() ); System.out.println("Circle Circumference: " +spot.circumference () ); System.out.println("\n############## TIME TO CHANGE THE RADIUS ############## \nNote that calculations will be performed \nEnter the new Radius:"); Scanner stdin = new Scanner(System.in); spot.newRadius(stdin.nextDouble()); System.out.println("Circle Radius: " +spot.getRadius() ); System.out.println("Circle Area: "+spot.area() ); System.out.println("Circle Circumference: " +spot.circumference () ); } } class Circle { private double radius; private static final double pi = Math.PI; private double lastARadius, lastCRadius, area, circumference; //By creating these instance fields, // Combined with the if statement below, // the only time calculations are performed // is when the radius has changed. public Circle (double radius) { this.radius = radius; } public double getRadius() { return radius; } public double area () { if (lastARadius != radius) { //System.out.println("Performing A calculation"); area = pi * radius * radius; lastARadius = radius; } return area; } public void newRadius(double newRadius) { radius = newRadius; } public double circumference () { if (lastCRadius != radius) { //System.out.println("Performing C calculation"); circumference = 2 * pi * radius ; lastCRadius = radius; } return circumference; } public static void displayCircumfrenceFormula() { System.out.println("C = 2 * pi * r"); } public static void displayAreaFormula() { System.out.println("A = pi * r^2"); } }
[ "evankanter28@gmail.com" ]
evankanter28@gmail.com
570558ff32f82815a563598c4085f69b00119682
5568054b8f6c65e4bef58d46543eb12c66e3803d
/BitsandPizzas-CardView-RecyclerView-Adapter-LayoutManager/java/com/example/alex/bitsandpizzas/MainActivity.java
c078bf8c4f948086af46d22b123860c7ee8d8372
[]
no_license
Investik/android
eec9e105488dfc10e9b6806da236f52e3b318293
a94ebdb39c11022b845828d088d331d4fd54a307
refs/heads/master
2016-08-12T20:59:06.637013
2016-03-14T13:25:10
2016-03-14T13:25:10
53,109,753
0
0
null
null
null
null
UTF-8
Java
false
false
7,586
java
package com.example.alex.bitsandpizzas; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.view.MenuItemCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.ShareActionProvider; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; public class MainActivity extends AppCompatActivity { private ShareActionProvider shareActionProvider; private String[] titles; private ListView drawerList; private ActionBarDrawerToggle drawerToggle; DrawerLayout drawerLayout; private int currentPosition = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); titles = getResources().getStringArray(R.array.titles); drawerList = (ListView) findViewById(R.id.drawer); drawerList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_activated_1, titles)); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList.setOnItemClickListener(new DrawerItemClickListener()); if (savedInstanceState!=null){ currentPosition = savedInstanceState.getInt("position"); setActionTitle(currentPosition); } else selectItem(0); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.open_drawer, R.string.close_drawer) { public void onDrawerClosed(View view) { super.onDrawerClosed(view); invalidateOptionsMenu(); } public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); invalidateOptionsMenu(); } }; drawerLayout.setDrawerListener(drawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getFragmentManager().addOnBackStackChangedListener( new FragmentManager.OnBackStackChangedListener() { public void onBackStackChanged() { FragmentManager fragMan = getFragmentManager(); Fragment fragment = fragMan.findFragmentByTag("visible_fragment"); if (fragment instanceof TopFragment) { currentPosition = 0; } if (fragment instanceof PizzaMaterialFragment) { currentPosition = 1; } if (fragment instanceof CocktailMaterialFragment) { currentPosition = 2; } if (fragment instanceof StoresFragment) { currentPosition = 3; } setActionTitle(currentPosition); drawerList.setItemChecked(currentPosition, true); } } ); } //Sync the state of the ActionBarDrawerToggle with the state of the drawer. @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); drawerToggle.syncState(); } //Pass any configuration changes to the ActionBarDrawerToggle. @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); drawerToggle.onConfigurationChanged(newConfig); } @Override public boolean onPrepareOptionsMenu(Menu menu) { // If the drawer is open, hide action items related to the content view boolean drawerOpen = drawerLayout.isDrawerOpen(drawerList); menu.findItem(R.id.action_share).setVisible(!drawerOpen); return super.onPrepareOptionsMenu(menu); } //Add items in the menu resource file to the action bar. @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); MenuItem menuItem = menu.findItem(R.id.action_share); shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem); shareActionProvider.setShareIntent(setIntent("Example text")); return super.onCreateOptionsMenu(menu); } private class DrawerItemClickListener implements ListView.OnItemClickListener{ @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectItem(position); } } private void selectItem(int position){ currentPosition = position; Fragment fragment; switch (position) { case 1: fragment = new PizzaMaterialFragment(); break; case 2: fragment = new CocktailMaterialFragment(); break; case 3: fragment = new StoresFragment(); break; default: fragment = new TopFragment(); } FragmentTransaction ft=getFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, fragment, "visible_fragment"); ft.addToBackStack(null); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); setActionTitle(position); drawerLayout.closeDrawer(drawerList); } private void setActionTitle(int position){ String title; if (position==0) title = getResources().getString(R.string.app_name); else title = titles[position]; if (title!=null) getSupportActionBar().setTitle(title); } //Pass the Share action an intent for it to share. public Intent setIntent(String text){ Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); return intent; } //This method is called when the user clicks on an item in the action bar. @Override public boolean onOptionsItemSelected(MenuItem item) { //Let the ActionBarDrawerToggle handle being clicked. if (drawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.action_create_order: Intent intent = new Intent(this, OrderActivity.class); startActivity(intent); return true; case R.id.action_settings: return true; default: return super.onOptionsItemSelected(item); } } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("position", currentPosition); } }
[ "alexander.meleshkin@mail.ru" ]
alexander.meleshkin@mail.ru
de18a2912e1bb8c5c8d43a97584688149c61f3d6
27a6d5884ed17722a0b9c88428d1c72b31c24df9
/kafkaconsumer/src/main/java/com/kafka/kafkaconsumer/service/KafkaMessageHandler.java
f4fa77cac4e38d3c062e26ac791a7b0c6313c757
[]
no_license
GBBP1813/Kafka
4a864612f678d63bd780a9f45a110fbf74f3e4a4
edda17c69f1ede0909a639a4022cd916ded1ca76
refs/heads/master
2021-05-18T12:11:13.356444
2020-03-30T08:12:32
2020-03-30T08:12:32
251,239,020
3
0
null
null
null
null
UTF-8
Java
false
false
1,286
java
package com.kafka.kafkaconsumer.service; import com.fasterxml.jackson.databind.ObjectMapper; import com.kafka.kafkaconsumer.entrity.PersonDTO; import com.kafka.kafkaconsumer.utils.ThreadPoolUtils; import lombok.extern.slf4j.Slf4j; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.springframework.kafka.listener.BatchMessageListener; import org.springframework.stereotype.Service; import java.util.List; /** * 使用batchmessagelistener来监听消息进行消费 */ @Slf4j @Service public class KafkaMessageHandler implements BatchMessageListener<String, String> { private final ObjectMapper objectMapper = new ObjectMapper(); @Override public void onMessage(List<ConsumerRecord<String, String>> consumerRecords) { for (ConsumerRecord<String, String> record :consumerRecords) { new ThreadPoolUtils().addTask(() -> handler(record)); } } public void handler (ConsumerRecord<String, String> record) { try{ PersonDTO personDTO = objectMapper.readValue(record.value(), PersonDTO.class); log.info("消费的topic:{},分区:{}, message:{}", record.topic(), record.partition(), personDTO.toString()); }catch (Exception e) { e.printStackTrace(); } } }
[ "guanyangfan@souche.com" ]
guanyangfan@souche.com
a4b9ff9c69cbb5429ae7152177c04c2e1020da3f
9a42230c81a76e55abe4cda2f27c28ff6c7d5607
/Lab5/uwera/src/main/java/com/example/uwera/UweraApplication.java
18bcbc7c0721c37c01547c83a7b1caebca16510a
[]
no_license
mniyonshuti/Softwate-Architecture
0d2c1689fd7a6a710375062f7236de5cc5af7e60
97c528794237112cfc688a9b045b0a12fe11e82c
refs/heads/master
2022-12-08T03:57:18.991550
2020-08-01T23:46:13
2020-08-01T23:46:13
281,229,403
0
0
null
2020-08-01T23:46:15
2020-07-20T21:29:01
Java
UTF-8
Java
false
false
320
java
package com.example.uwera; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class UweraApplication { public static void main(String[] args) { SpringApplication.run(UweraApplication.class, args); } }
[ "mniyonshuti@Mosess-MBP.attlocal.net" ]
mniyonshuti@Mosess-MBP.attlocal.net
2b10ab999425f7be20fd359665184743c3031723
715b465c1da6e7c2ca2af67ac3bab9de5ce7dfd7
/java/evans-server1.2/src/br/com/evans/behavior/nodes/core/ReportBehavior.java
a03d1a542e608132378737c9ef0fb357cd123e7e
[]
no_license
gabrieltnishimura/evans
ee539f67dfb528ee72bad87aef19f9fd407f1ec7
4a362670a507a227adbdad82e1e2d6c1a0bea237
refs/heads/master
2021-01-10T11:09:52.786301
2017-01-11T19:42:37
2017-01-11T19:42:37
44,867,744
0
0
null
null
null
null
UTF-8
Java
false
false
352
java
package br.com.evans.behavior.nodes.core; import java.util.List; import org.bson.types.ObjectId; public class ReportBehavior extends BehaviorNode { public ReportBehavior(int id, String name, List<String> responseWhenAccessed) { super(id, name, responseWhenAccessed); } public ReportBehavior(ObjectId internalId) { super(internalId); } }
[ "gabriel.t.nishimura@accenture.com" ]
gabriel.t.nishimura@accenture.com
275569f73a8c062f358da55f4a4898dec6cc24ca
68a5999adb34316d55514042fa449b1cb05b670b
/src/main/java/com/csse/restapi/restapireact/services/impl/CarGalleryImpl.java
ba229de160fc3047fae115f5a0cae2c6568019af
[]
no_license
omirzakov/eshop_spring_server
07b0edcba4ae5e8320374b91aaea7684889fdb26
2b8bc610b4479221bee2edc6a1258e10622cc8a4
refs/heads/main
2023-05-04T08:32:24.666310
2021-05-19T16:48:52
2021-05-19T16:48:52
341,911,680
0
0
null
null
null
null
UTF-8
Java
false
false
1,213
java
package com.csse.restapi.restapireact.services.impl; import com.csse.restapi.restapireact.entities.CarGallery; import com.csse.restapi.restapireact.entities.Cars; import com.csse.restapi.restapireact.repositories.CarGalleryRepository; import com.csse.restapi.restapireact.services.CarGalleryService; import com.csse.restapi.restapireact.services.CarService; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; public class CarGalleryImpl implements CarGalleryService { @Autowired private CarGalleryRepository carGalleryRepository; @Override public CarGallery addPicture(CarGallery picture) { return carGalleryRepository.save(picture); } @Override public CarGallery savePicture(CarGallery picture) { return carGalleryRepository.save(picture); } @Override public CarGallery getPicture(Long id) { return carGalleryRepository.findById(id).get(); } @Override public void deletePicture(CarGallery picture) { carGalleryRepository.delete(picture); } @Override public List<CarGallery> getAllPhotoItem(Long id) { return carGalleryRepository.findAllByPublicationId(id); } }
[ "huistowns@gmail.com" ]
huistowns@gmail.com
77a57c5c87059325f6a38dce4cd5ce929d7e4b9e
b6b65103fa4bc6cb393e2a04dadaff034415e2a6
/core/src/com/manik/level/LevelTick.java
a94a50690c94d97d64141ca05a5b44253903e0ba
[ "MIT" ]
permissive
corpusluteum/Pirate-Island
fb54917e0ddbfc33aff2a0581fe44443930ca9a9
c48f4fe8a4d5b5d1d0db5bd6222909c9ba5b2b1a
refs/heads/master
2020-06-26T18:12:27.265846
2016-11-01T21:26:41
2016-11-01T21:26:41
66,597,251
0
1
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.manik.level; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.manik.imageLoader.ImageLoader; public class LevelTick { private float xKord; private float yKord; private float width; private float height; private Rectangle collisionRect; public LevelTick(float xKord, float yKord, float width, float height){ this.xKord=xKord; this.yKord=yKord; this.width=width; this.height=height; collisionRect=new Rectangle(xKord, yKord, width, height); } public void render(SpriteBatch sb){ sb.begin(); sb.draw(ImageLoader.mapRegion,xKord,yKord,width,height); sb.end(); } public void update(float delta){ collisionRect.x=xKord; collisionRect.y=yKord; collisionRect.width= width; collisionRect.height=height; } public Rectangle getCollisionRect() { return collisionRect; } public void setCollisionRect(Rectangle collisionRect) { this.collisionRect = collisionRect; } }
[ "emiine.aydiin@gmail.com" ]
emiine.aydiin@gmail.com
261632f4ab88744559d951c1d31c4ca68ac3cdde
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_a978c933a614c1ff2995e4a6875bc57fcd79a876/IgnoreIssuesConfiguration/23_a978c933a614c1ff2995e4a6875bc57fcd79a876_IgnoreIssuesConfiguration_t.java
aa8aef1dbb25f2c4a404f3f1ad10235fad0864ca
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,962
java
/* * SonarQube, open source software quality management tool. * Copyright (C) 2008-2013 SonarSource * mailto:contact AT sonarsource DOT com * * SonarQube is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * SonarQube is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.core.issue.ignore; import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyFieldDefinition; import org.sonar.api.resources.Qualifiers; import org.sonar.api.CoreProperties; import com.google.common.collect.ImmutableList; import org.sonar.api.config.PropertyDefinition; import java.util.List; public final class IgnoreIssuesConfiguration { public static final String CONFIG_DOCUMENTATION_LINK = "More information on the " + "<a href=\"http://docs.codehaus.org/display/SONAR/Project+Administration#ProjectAdministration-IgnoringIssues\">Project Administration page</a>.<br/>"; public static final String SUB_CATEGORY_IGNORE_ISSUES = "issues"; public static final String CORE_KEY_PREFIX = "sonar.issue.ignore"; public static final String MULTICRITERIA_SUFFIX = ".multicriteria"; public static final String PATTERNS_MULTICRITERIA_KEY = CORE_KEY_PREFIX + MULTICRITERIA_SUFFIX; public static final String RESOURCE_KEY = "resourceKey"; public static final String RULE_KEY = "ruleKey"; public static final String LINE_RANGE_KEY = "lineRange"; public static final String BLOCK_SUFFIX = ".block"; public static final String PATTERNS_BLOCK_KEY = CORE_KEY_PREFIX + BLOCK_SUFFIX; public static final String BEGIN_BLOCK_REGEXP = "beginBlockRegexp"; public static final String END_BLOCK_REGEXP = "endBlockRegexp"; public static final String ALLFILE_SUFFIX = ".allfile"; public static final String PATTERNS_ALLFILE_KEY = CORE_KEY_PREFIX + ALLFILE_SUFFIX; public static final String FILE_REGEXP = "fileRegexp"; private IgnoreIssuesConfiguration() { // static configuration declaration only } static final int LARGE_SIZE = 40; static final int SMALL_SIZE = 10; public static List<PropertyDefinition> getPropertyDefinitions() { return ImmutableList.of( PropertyDefinition.builder(PATTERNS_MULTICRITERIA_KEY) .category(CoreProperties.CATEGORY_EXCLUSIONS) .subCategory(SUB_CATEGORY_IGNORE_ISSUES) .name("Multi-criteria Exclusion Patterns") .description("Patterns used to identify which issues are ignored.<br/>" + CONFIG_DOCUMENTATION_LINK) .onQualifiers(Qualifiers.PROJECT) .index(3) .fields( PropertyFieldDefinition.build(RESOURCE_KEY) .name("File Path Pattern") .description("Pattern used to match files which should be ignored.") .type(PropertyType.STRING) .indicativeSize(LARGE_SIZE) .build(), PropertyFieldDefinition.build(RULE_KEY) .name("Rule Key Pattern") .description("Pattern used to match rules which should be ignored.") .type(PropertyType.STRING) .indicativeSize(LARGE_SIZE) .build(), PropertyFieldDefinition.build(LINE_RANGE_KEY) .name("Line Range") .description("Range of lines that should be ignored.") .type(PropertyType.STRING) .indicativeSize(SMALL_SIZE) .build()) .build(), PropertyDefinition.builder(PATTERNS_BLOCK_KEY) .category(CoreProperties.CATEGORY_EXCLUSIONS) .subCategory(SUB_CATEGORY_IGNORE_ISSUES) .name("Block Exclusion Patterns") .description("Patterns used to identify blocks in which issues are ignored.<br/>" + CONFIG_DOCUMENTATION_LINK) .onQualifiers(Qualifiers.PROJECT) .index(2) .fields( PropertyFieldDefinition.build(BEGIN_BLOCK_REGEXP) .name("Regular Expression for Start of Block") .description("If this regular expression is found in a file, then following lines are ignored until end of block.") .type(PropertyType.STRING) .indicativeSize(LARGE_SIZE) .build(), PropertyFieldDefinition.build(END_BLOCK_REGEXP) .name("Regular Expression for End of Block") .description("If specified, this regular expression is used to determine the end of code blocks to ignore. If not, then block ends at the end of file.") .type(PropertyType.STRING) .indicativeSize(LARGE_SIZE) .build()) .build(), PropertyDefinition.builder(PATTERNS_ALLFILE_KEY) .category(CoreProperties.CATEGORY_EXCLUSIONS) .subCategory(SUB_CATEGORY_IGNORE_ISSUES) .name("File Exclusion Patterns") .description("Patterns used to identify files in which issues are ignored.<br/>" + CONFIG_DOCUMENTATION_LINK) .onQualifiers(Qualifiers.PROJECT) .index(1) .fields( PropertyFieldDefinition.build(FILE_REGEXP) .name("Regular Expression") .description("If this regular expression is found in a file, then the whole file is ignored.") .type(PropertyType.STRING) .indicativeSize(LARGE_SIZE) .build()) .build()); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
1a6d7d4b3f2be4c3e1e04e9205484958a8d821fe
73725d3d37d646a8d9d493e4a53f48844124df0b
/app/src/main/java/com/cpm/xmlhandler/StoreSaleInfoXmlHandler.java
f8f47f3607007af4ed41e938edfe1a5fdc3bc2a9
[]
no_license
JeevanPrasad1991/GSKOralCare_New
50c073f0fe8d0ac1825b1f87902acf2bf280f812
3452b4c89797cd534742be545878026dd0f2c636
refs/heads/master
2021-04-27T06:55:26.623514
2018-02-23T12:50:22
2018-02-23T12:50:22
122,621,134
0
0
null
null
null
null
UTF-8
Java
false
false
2,344
java
package com.cpm.xmlhandler; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; import com.cpm.gettersetter.StoreSaleInfoGetterSetter; import com.cpm.gettersetter.UserInfoGetterSetter; public class StoreSaleInfoXmlHandler extends DefaultHandler{ String elementValue = null; Boolean elementOn = false; public static StoreSaleInfoGetterSetter data = null; public static StoreSaleInfoGetterSetter getXMLData() { return data; } public static void setXMLData(StoreSaleInfoGetterSetter data) { StoreSaleInfoXmlHandler.data = data; } /** * This will be called when the tags of the XML starts. **/ @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { elementOn = true; if (localName.equals("begin")) { data = new StoreSaleInfoGetterSetter(); } else if (localName.equals("STORE_SALES")) { /** * We can get the values of attributes for eg. if the CD tag had an attribute( <CD attr= "band">Akon</CD> ) * we can get the value "band". Below is an example of how to achieve this. * * String attributeValue = attributes.getValue("attr"); * data.setAttribute(attributeValue); * * */ } } /** * This will be called when the tags of the XML end. **/ @Override public void endElement(String uri, String localName, String qName) throws SAXException { elementOn = false; /** * Sets the values after retrieving the values from the XML tags * */ if (localName.equalsIgnoreCase("BRAND_ID")) data.setBRAND_ID(elementValue); else if (localName.equalsIgnoreCase("SKU_ID")) data.setSKU_ID(elementValue); /*else if (localName.equalsIgnoreCase("ARTICLE_NO")) data.setARTICLE_NO(elementValue);*/ else if (localName.equalsIgnoreCase("BRAND_SEQUENCE")) data.setBRAND_SEQUENCE(elementValue); else if (localName.equalsIgnoreCase("SKU_SEQUENCE")) data.setSKU_SEQUENCE(elementValue); /*else if (localName.equalsIgnoreCase("MRP")) data.setMRP(elementValue);*/ } /** * This is called to get the tags value **/ @Override public void characters(char[] ch, int start, int length) throws SAXException { if (elementOn) { elementValue = new String(ch, start, length); elementOn = false; } } }
[ "jeevanp@cpmindia.com" ]
jeevanp@cpmindia.com
1699e14ec320546af48e930d71018f52323797ea
988b5494544d88a8b7dbfd1e3ab684ecfbad130b
/app/src/main/java/com/tranxitpro/app/Retrofit/ResponseListener.java
d2d5b798ca5321517100fc4b96f95ddd569c1376
[]
no_license
svn292/tranxit_user
09244d1a3041004ce0061d9a806b981057a134a8
425a06e8e3a9cc42c49d043d0d1e9a5ec5134ceb
refs/heads/master
2022-04-14T09:40:12.989723
2020-03-30T10:05:57
2020-03-30T10:05:57
251,268,023
0
1
null
null
null
null
UTF-8
Java
false
false
218
java
package com.tranxitpro.app.Retrofit; import org.json.JSONArray; /** * Created by Esack N on 7/24/2017. */ public interface ResponseListener { void getJSONArrayResult(String strTag, JSONArray arrayResponse); }
[ "svn292@gmail.com" ]
svn292@gmail.com
b389bdc3fde5e9fd7e6688927783b9fb42ba8c14
4fe94df838f88fe429e167defef126258b59e261
/src/mediator/AbstratctMediator.java
30ca654419855494e5824850dd30d07963dbb3bc
[]
no_license
diyinqianchang/JavaModel
342e2a9f2f2a522633ef85a543918d73722658b2
8cadee73ffc30dd1a1b87fbf1b22f097d3437423
refs/heads/master
2021-01-20T19:26:24.338190
2017-02-21T15:35:05
2017-02-21T15:35:05
60,941,794
0
0
null
null
null
null
GB18030
Java
false
false
395
java
package mediator; public abstract class AbstratctMediator { protected Purchase purchase; protected Sale sale; protected Stock stock; //怎么关联起来 通过构造方法传值 public AbstratctMediator() { purchase = new Purchase(this); sale = new Sale(this) ; stock = new Stock(this); } public abstract void execute(String str,Object...objects); }
[ "zhangguolin-1990@163.com" ]
zhangguolin-1990@163.com
5245f373c42e305a74a090626da4486fca8baf8d
bdce118bf9633e10661dccfbb88bb72c7f90a6e5
/src/main/java/jp/tsubakicraft/tradeshift/config/PropertySources.java
153d61c1fe8619ea4f379dc99367f9fb545b8efb
[]
no_license
kazz12211/easyreport
4d54c0a5c4b65c5dd9c77f4a1927ae2d2a49ad85
5b25d095ce9b21d4cd1334c127e1f8452f180188
refs/heads/master
2020-03-11T23:02:03.915430
2018-11-05T00:56:41
2018-11-05T00:56:41
130,310,459
0
0
null
null
null
null
UTF-8
Java
false
false
1,362
java
package jp.tsubakicraft.tradeshift.config; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; @Configuration(value = "propertySources") public class PropertySources { @Autowired ApplicationProperties applicationProperties; private String tradeshiftAPIDomainName; private String clientID; private String clientSecret; private String redirectUri; private String tradeshiftAppVersion; @PostConstruct public void PropertySourcesInit() { this.tradeshiftAppVersion = applicationProperties.getTradeshiftAppVersion(); this.tradeshiftAPIDomainName = applicationProperties.getTradeshiftAPIDomainName(); this.clientID = applicationProperties.getClientID(); this.clientSecret = applicationProperties.getClientSecret(); this.redirectUri = applicationProperties.getRedirectUri(); } public String getTradeshiftAppVersion() { return tradeshiftAppVersion; } public String getTradeshiftAPIDomainName() { return tradeshiftAPIDomainName; } public String getClientID() { return clientID; } public String getClientSecret() { return clientSecret; } public String getRedirectUri() { return redirectUri; } }
[ "kazz12211@gmail.com" ]
kazz12211@gmail.com
aba540f20cb7e000d6d6d47a8d74e7ba18e3789a
9e3c19356eddf48569319be2e784f0724a1f08d7
/unit4/MultidimensionalArrayExample.java
064f7d6b1c592674dc2a3cc4e469633b34b7e21b
[ "MIT" ]
permissive
teals-heights-high-school/fall-2018-code-samples
4b13a65b4b9d4c2a0663c67d1063d5d665e1fe8e
8287e141cb19bf2c755c2ae4ba48691dfb704b9e
refs/heads/master
2020-04-20T17:47:14.106838
2019-02-05T03:23:29
2019-02-05T03:23:29
168,999,195
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
public class MultidimensionalArrayExample { public static void main(String[] args) { int[][] twoDimensionalArray = new int[5][5]; twoDimensionalArray[0][0] = 1; twoDimensionalArray[1][1] = 1; twoDimensionalArray[2][2] = 1; twoDimensionalArray[3][3] = 1; twoDimensionalArray[4][4] = 1; for (int row = 0; row < twoDimensionalArray.length; row++) { for (int column = 0; column < twoDimensionalArray[0].length; column++) { System.out.print(twoDimensionalArray[row][column]); } System.out.println(); } } }
[ "scott.c.enriquez@gmail.com" ]
scott.c.enriquez@gmail.com
5ce7fd12ad75e7d4d6ab72b50fa387a576baf513
d7cea1e98a427d582b3c1574f75859fdda9b7693
/src/main/java/com/example/MarchukSecurityApplicaton.java
29ad00c351bb594b5daeb71b28ed56334c183489
[]
no_license
ivan-marchuk/ivan_spring
73bb95f77d6dc3b0f16f2dd78831e7b1358c1911
c7350f7baf6a0bf1f6906f16714680ef76e5d241
refs/heads/master
2023-05-31T06:37:41.252475
2017-06-20T21:18:00
2017-06-20T21:18:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
339
java
package com.example; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MarchukSecurityApplicaton { public static void main(String[] args) throws Throwable { SpringApplication.run(MarchukSecurityApplicaton.class, args); } }
[ "iimarchuk95@gmail.com" ]
iimarchuk95@gmail.com
7ceacf134a0b6525a2dc9516edae270331553f2b
4237e68c181635d4d0522bda1d741fb0d9f3875f
/src/test/java/com/ast/parse/ParserTest.java
fe219620f75ed8243e176c53da678bea7cac5c12
[]
no_license
dongshen/AST
b75d867de09e8c4da85c3ad0c0fff17a530c3c3d
6c8e6c8ecb70f4ccc7cf32eae04f1d6ad4e1f063
refs/heads/master
2021-01-10T20:03:52.991498
2019-02-11T15:50:40
2019-02-11T15:50:40
27,675,751
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
package com.ast.parse; import java.io.IOException; import java.util.List; import org.junit.Test; import com.ast.Util.FileUtil; public class ParserTest { @Test public void testParseDemoVisitor() { String input = "Test.java"; char[] output = null; try { output = FileUtil.convertFileToArray(input); Parser.parseDemoVisitor(output); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Test public void testParseDemoVisitor_filefolder() { String output = null; try { List<String> lists = FileUtil.getFilesInDir(); for (String input : lists) { output = FileUtil.readFileToString(input); Parser.parseDemoVisitor(output); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "shendong@shendong-PC" ]
shendong@shendong-PC
8bf0d86cd244fc77cb2469df3c548ce1d11147c9
d3a96f5496287ab0ff04613c239d7f267e0a2c89
/helloWorld.java
29499ca2938654a3881f834957c38cb5ad7d2906
[]
no_license
ilayserr/hello-world
39ab92b7a7671c2e8d81467cc79bcc24efdb4342
97aa39a59cf6d098593c07dd65221f3d8161a39f
refs/heads/master
2021-01-13T03:03:16.993046
2016-12-21T09:11:04
2016-12-21T09:11:04
77,032,411
0
0
null
null
null
null
UTF-8
Java
false
false
175
java
/** * A standard hello-world program * @author Ilay * */ public class helloWorld { public static void main (String[] args){ System.out.println("Hello world"); } }
[ "ilay@Ilays-MacBook-Pro-2.local" ]
ilay@Ilays-MacBook-Pro-2.local
7959ea778bf0e77fc38dd85cbfdf1c15b09a107a
5b81821c095793972147345fe5c8cd5c9cd1710c
/groovy-masker/src/main/java/CdcGroovy.java
b946162b0a00ffdf3077795315ad081a4c84cb21
[]
no_license
zinal/IIDR-Masker
f99e020a6af0357bd80d118620301474b2d210fc
6739692cb16e0d34d0fea2f8e39043f89984cff0
refs/heads/master
2021-12-29T19:48:58.041867
2021-12-13T06:32:18
2021-12-13T06:32:18
238,220,507
2
1
null
2021-08-02T09:11:55
2020-02-04T14:05:05
Java
UTF-8
Java
false
false
7,668
java
import com.datamirror.ts.derivedexpressionmanager.*; import groovy.lang.GroovyShell; import groovy.lang.Script; import java.io.File; import java.util.HashMap; import java.util.Map; /** * Groovy dynamic scripting for IBM CDC. * This code is provided "as is", without warranty of any kind. * * Put the CdcGroovy.class into {cdc-install-dir}/lib. * Copy groovy-2.5.10.jar to the same directory. * Create file system.cp in instance/INAME/conf directory, with: * lib/groovy-2.5.10.jar * * javac CdcGroovy.java -classpath ts.jar:groovy-2.5.10.jar * * %USERFUNC("JAVA","CdcGroovy","script-name", COLUMN) */ public class CdcGroovy implements DEUserExitIF { public static final String VERSION = "CdcGroovy 1.3 2021-10-25"; private final String instanceId = Integer.toHexString( System.identityHashCode(this)); private final File scriptHome; // Ugly data structure to avoid the need to have multiple class files private final Map<String, Object[]> scripts = new HashMap<>(); private GroovyShell groovyShell = null; public CdcGroovy() { String scriptHomeVal = System.getProperty("cdcgroovy.de.path"); if (scriptHomeVal==null || scriptHomeVal.trim().length()==0) { scriptHome = new File(System.getProperty("user.home"), "cdcgroovy"); } else { scriptHome = new File(scriptHomeVal); } // Trace version and script directory on load System.out.println(VERSION + ", scripts path: " + scriptHome.getPath() + (scriptHome.isDirectory() ? " (available)" : "(UNAVAILABLE)")); } /** * Load and call the Groovy script with the specified arguments. * * @param args Object[] * @return String as Object * @throws com.datamirror.ts.derivedexpressionmanager.UserExitInvalidArgumentException * @throws com.datamirror.ts.derivedexpressionmanager.UserExitInvokeException */ @Override public Object invoke(Object[] args) throws UserExitInvalidArgumentException, UserExitInvokeException { // At least one argument is expected - it is the script name if (args.length < 1) { throw new UserExitInvalidArgumentException(getClass().getName() + ": insufficient number of arguments, " + "expects a script name"); } // Check we actually got a script name if (!(args[0] instanceof String)) { throw new UserExitInvalidArgumentException(getClass().getName() + ": The script name must be String"); } String scriptName = (String) args[0]; try { // Load script (or locate it in the cache) Script script = locateScript(scriptName); if (script==null) throw new Exception("Script not found: " + scriptName); // Call the "invoke" method, passing our arguments return script.invokeMethod("invoke", args); } catch(Exception ex) { // Convert the original exception to a debugging message throw new UserExitInvokeException(buildMessage(ex)); } } /** * Look up for the script with the specified name, * compile it if necessary (if it has not yet been loaded), * and return the compiled implementation. * @param name Script name * @return Compiled script, or null if script has not been found * @throws Exception */ private Script locateScript(String name) throws Exception { // This may not be necessary, but I was not able to find anywhere // if the invoke() method may or may not be called concurrently. synchronized(scripts) { File f = null; // Look up for already loaded script Object[] info = scripts.get(name); if (info != null) { // In case we have one, let's check whether its timestamp // has been recently checked for changes. final long curTv = System.currentTimeMillis(); if ( curTv - getInfoMark(info) < 2000L ) return getInfoScript(info); // We now need to check whether the script has changed updateInfoMark(info, curTv); f = generateScriptFilename(name); if (f.canRead()) { // Compare the timestamp long stamp = f.lastModified(); if (stamp == getInfoStamp(info)) { // Same timestamp as we have seen during load. // We can return the already-cached version. return getInfoScript(info); } } else { // TODO: print warning about missing file. // Still returning the already-cached version. return getInfoScript(info); } } if (f==null) f = generateScriptFilename(name); if (f.canRead()) { // Load and cache the script info = loadInfo(f); scripts.put(name, info); return getInfoScript(info); } else { // No script available return null; } } } /** * Build the full script filename from the script name. * @param name Script name * @return Filename (may not exist, or may be unavailable). */ private File generateScriptFilename(String name) { return new File(scriptHome, name + ".groovy"); } /** * Load the script from the specified file. * @param f File * @return Compiled scriot * @throws Exception If no file or bad script */ private Object[] loadInfo(File f) throws Exception { if (groovyShell == null) groovyShell = new GroovyShell(); long stamp = f.lastModified(); Script script = groovyShell.parse(f); System.out.println(" ** " + instanceId + " loaded " + f.getAbsolutePath()); return new Object[] { script, stamp, System.currentTimeMillis() }; } private static Script getInfoScript(Object[] info) { return (Script) info[0]; } private static long getInfoStamp(Object[] info) { return (Long) info[1]; } private static long getInfoMark(Object[] info) { return (Long) info[2]; } private static void updateInfoMark(Object[] info, long mark) { info[2] = mark; } /** * Collect the exception chain as a string to support debugging. * @param ex Exception which has been caught. * @return Generated exception chain description. */ public static String buildMessage(Throwable ex) { final StringBuilder sb = new StringBuilder(); while (ex != null) { sb.append(ex.getClass().getName()); if (ex.getStackTrace()!=null && ex.getStackTrace().length > 0) { sb.append(" at "); StackTraceElement ste = ex.getStackTrace()[0]; sb.append(ste.getFileName()).append(":") .append(ste.getLineNumber()); sb.append(", method ").append(ste.getClassName()) .append("/").append(ste.getMethodName()); } sb.append(" -> ").append(ex.getMessage()); if (ex.getCause()!=null) sb.append(" *** | "); ex = ex.getCause(); } return sb.toString(); } }
[ "mzinal@ru.ibm.com" ]
mzinal@ru.ibm.com
d5bf35ad2f53ded0e9482867fd3745d8141eb923
b26426b697788dab66806583a84e8613a8d0a18a
/L4DStats/src/providers/ProfileProvider.java
2b5513af8a326a27d2ec1ae5a5492896d9cda0d2
[]
no_license
DylanMeeus/L4DPerspective
8674d35649d8e78322f81fb5aaf56f2e80887327
58e0f7250971c4949a56f673aca68710b5ede8bd
refs/heads/master
2016-09-09T13:01:39.143979
2015-02-12T22:23:14
2015-02-12T22:23:14
30,415,239
0
0
null
null
null
null
UTF-8
Java
false
false
821
java
package providers; import handlers.ProfileHandler; import java.net.URL; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; import core.Profile; /** * Provides the profile data * @author Dylan * */ public class ProfileProvider { public Profile getProfile(String steamID) { String url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=C9D49868B7FE152D5C0A052CB0B6A7D8&steamids=" + steamID + "&format=xml"; ProfileHandler handler = new ProfileHandler(); try { XMLReader xmlReader = XMLReaderFactory.createXMLReader(); xmlReader.setContentHandler(handler); xmlReader.parse(new InputSource(new URL(url).openStream())); } catch (Exception ex) { ex.printStackTrace(); } return handler.getProfile(); } }
[ "meeusdylan@hotmail.com" ]
meeusdylan@hotmail.com
9faf062550083549e9d5f255181f654879ad0e71
caa70044912671faee919e980e5ba78173396f41
/app/src/main/java/com/example/android_development_assignment_2/Piece.java
aad22c017db6ff90ecbeef93fbd1561ffd48755e
[]
no_license
berkekocar/Android-English-Checker-Game-
5bd7a48ddbce65686a8a8bf82e22647412c5f9b6
0867de84f2d599ecb3ce81ea6c88c5b0aa6e8dda
refs/heads/master
2022-12-24T20:48:37.222930
2020-09-24T16:39:13
2020-09-24T16:39:13
298,307,697
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.example.android_development_assignment_2; public class Piece { Boolean isActive=false; Boolean isHighlighted; Boolean isKing; public Piece(){ isActive=Boolean.FALSE; isHighlighted=Boolean.FALSE; isKing=Boolean.FALSE; } public void setPiece(){ isActive=Boolean.TRUE; } }
[ "e.berkekocar@gmail.com" ]
e.berkekocar@gmail.com
714cff8c86626cf5dcc913e3028710ce1df7eb05
3ffa42b6e17f07d0aae631b0be4abb901e221d01
/app/src/test/java/com/kishor/android/quizapp/ExampleUnitTest.java
aa8fc79cb6e5a4d68bd99cd3c0ba3574c533141a
[]
no_license
kishorvrs/Quiz-App
523f43c2e91e08ec3901f1a6b130e33a934521a3
4842daa0480ce876e4a8a21fa9949fa2f4ee012d
refs/heads/master
2022-11-05T01:05:41.843912
2020-07-06T04:53:29
2020-07-06T04:53:29
277,436,970
1
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.kishor.android.quizapp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "kishorvrs@gmail.com" ]
kishorvrs@gmail.com
c7ad72f93f504fe9b25645ea8355bb48d0cad2be
e8ebbc64a711410d90654c9d2bdc782d9865f8f7
/JavaSourceCode/src/monitor/cmcMonitorController.java
088e28b8940234cd059b298b69d1e504b63b0519
[]
no_license
koenberton/HowestMay2019
6fb51a4874ae43c4ec479bfc180b290a711ba819
875321d7170610b0aa00eb51626c1b6fb4727a27
refs/heads/master
2020-05-18T17:17:16.639480
2019-05-02T10:17:23
2019-05-02T10:17:23
184,550,319
1
0
null
null
null
null
UTF-8
Java
false
false
3,853
java
package monitor; import java.util.ArrayList; import cbrTekStraktorModel.cmcProcSettings; import logger.logLiason; public class cmcMonitorController { cmcProcSettings xMSet=null; logLiason logger=null; private cmcMonitorDialog monitorHandle=null; private cmcMonitorDialog previousMonitorHandle=null; //------------------------------------------------------------ private void do_log(int logLevel , String sIn) //------------------------------------------------------------ { if( logger != null ) logger.write( this.getClass().getName() , logLevel , sIn); else if (logLevel == 0 ) System.err.println(sIn); else System.out.println(sIn); } //------------------------------------------------------------ private void do_error(String sIn) //------------------------------------------------------------ { do_log(0,sIn); } // --------------------------------------------------------------------------------- public cmcMonitorController(cmcProcSettings is, logLiason ilog) // --------------------------------------------------------------------------------- { xMSet = is; logger = ilog; } //----------------------------------------------------------------------- public void startMonitor(String FolderName) //----------------------------------------------------------------------- { monitorHandle = new cmcMonitorDialog( null , xMSet , logger , FolderName ); syncMonitor(); } //----------------------------------------------------------------------- public void syncMonitorEnd(String BulkFileName) //----------------------------------------------------------------------- { if( BulkFileName == null ) return; if( xMSet.getmoma().setEndTimeOnScanList(BulkFileName) ) syncMonitor(); } //----------------------------------------------------------------------- public void syncMonitorComment(String BulkFileName,String Comment) //----------------------------------------------------------------------- { if( (BulkFileName == null) || (Comment == null) ) return; if( xMSet.getmoma().setCommentOnScanList(BulkFileName , Comment) ) syncMonitor(); } //----------------------------------------------------------------------- public void syncMonitor() //----------------------------------------------------------------------- { ArrayList<cmcMonitorItem> pl = xMSet.getmoma().getMonitorList(); try { if( monitorHandle == null ) return; if( monitorHandle.hasBeenClosed() ) return; for(int i= 0;i<pl.size();i++) monitorHandle.upsertMonitorItemLine(pl.get(i)); monitorHandle.endTransmissionAndGetFinal(); } catch(Exception e ) { do_error("Cannot upsert to monitor [" + e.getMessage() ); } } //----------------------------------------------------------------------- public void closeMonitor() //----------------------------------------------------------------------- { try { if( monitorHandle == null ) return; monitorHandle.forceClose(); } catch(Exception e ) { do_error("Cannot close monitor [" + e.getMessage() ); } } //----------------------------------------------------------------------- public void requestDelayedClose() //----------------------------------------------------------------------- { try { if( monitorHandle == null ) return; monitorHandle.requestDelayedClose(); } catch(Exception e ) { do_error("Cannot request to close monitor [" + e.getMessage() ); } } /* public void pushMonitorHandle() { previousMonitorHandle = monitorHandle; } public void popMonitorHandle() { monitorHandle = previousMonitorHandle; } */ }
[ "noreply@github.com" ]
noreply@github.com
3f1f1eeeaf11ef3b5879b74bce4b94b3ea38fae1
311f113ca96ddd935e95ef2ae34cb95877b98727
/app/src/main/java/com/android/tasker/repository/RepoCallBack.java
14bc47446060637dda6b2f97c2b29d8768a70358
[]
no_license
iamdeowanshi/Tasker
93e77416e532aa59e251e723c79ef319a70d0b59
490182b802872c829a4105d2a2185c40a0493d17
refs/heads/master
2021-06-03T21:45:12.630074
2017-10-13T18:54:40
2017-10-13T18:54:40
42,518,908
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
package com.android.tasker.repository; /** * Created by Sibi on 05/10/15. */ public interface RepoCallBack<T> { void onSuccess(T data); void onFailure(Throwable tr); }
[ "mahesh.mohan@tecsolsoftware.com" ]
mahesh.mohan@tecsolsoftware.com
2d46a6e7e0d98e8f807a4065e233ffeee1b0b1d7
8f0b68bdfc3620b637e65c813a8711817078e0bd
/src/UML_Line/MyLine.java
3e7ad22180f482e493299196eefc467a2eda8b8e
[]
no_license
ShyDawTon/UML_Demo
4520075f6d7da7497057a557d3b859d0977bf8f5
b0f6d41dde4b69857016eff6ca0bcd881aa160cf
refs/heads/master
2023-06-05T11:19:20.176984
2021-06-16T16:34:03
2021-06-16T16:34:03
350,795,844
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package UML_Line; import UML_Shape.MyShape; import UML_Shape.Port; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.geom.Line2D; import javax.swing.JComponent; public abstract class MyLine extends JComponent{ /** * MyLine variable */ protected Port p1,p2; protected Color color; public MyLine() { super(); } public MyLine(Port p1, Port p2, Color color) { super(); this.p1 = p1; this.p2 = p2; this.color = color; } public void draw(Graphics g) { g.setColor(color); g.drawLine(p1.getLocation().x, p1.getLocation().y, p2.getLocation().x, p2.getLocation().y); drawArrow(g); } public abstract void drawArrow(Graphics g); }
[ "dog24932516@gmail.com" ]
dog24932516@gmail.com
424cd1b59fbdb3663b5a03be1c413b48b0f9189e
26bc78fb4b9f3b2221d5ff72ca73ab242d506ac9
/app/src/main/java/com/kuruvatech/quickbuy/Faq.java
1bf9ffd49b3eb026c2d7cf91e62eb262b929d02a
[]
no_license
dayasudhan/quickbuy
4bb3163af48f52f63462bf3a4fbe8e58b40b2ab8
f3fa28cce0eb662ecff191066261cbd6fd7792f8
refs/heads/main
2023-01-19T02:24:09.380903
2020-11-27T14:28:13
2020-11-27T14:28:13
304,217,675
0
0
null
null
null
null
UTF-8
Java
false
false
1,895
java
package com.kuruvatech.quickbuy; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import android.widget.ExpandableListView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.kuruvatech.quickbuy.adapter.ExpandableListAdapter; /** * Created by Gagan on 9/14/2016. */ public class Faq extends AppCompatActivity { ExpandableListAdapter listAdapter; ExpandableListView expListView; List<String> listDataHeader; HashMap<String, List<String>> listDataChild; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.help_faq); // get the listview expListView = (ExpandableListView) findViewById(R.id.lvExp); // preparing list data prepareListData(); listAdapter = new ExpandableListAdapter(this, listDataHeader, listDataChild); // setting list adapter expListView.setAdapter(listAdapter); } /* * Preparing the list data */ private void prepareListData() { listDataHeader = new ArrayList<String>(); listDataChild = new HashMap<String, List<String>>(); // Adding child data listDataHeader.add("question1"); listDataHeader.add("question2"); listDataHeader.add("question3"); // Adding child data List<String> top250 = new ArrayList<String>(); top250.add("Ansewr1"); List<String> nowShowing = new ArrayList<String>(); nowShowing.add("Answer2"); List<String> comingSoon = new ArrayList<String>(); comingSoon.add("answer3"); listDataChild.put(listDataHeader.get(0), top250); // Header, Child data listDataChild.put(listDataHeader.get(1), nowShowing); listDataChild.put(listDataHeader.get(2), comingSoon); } }
[ "dayasudhankg@gmail.com" ]
dayasudhankg@gmail.com
104f3fa3e5eb82c0ffecf9d2f4db37de2af2d832
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_c14723513bde8781d3285cae5d4a6ff732266ad2/JcrProperty/9_c14723513bde8781d3285cae5d4a6ff732266ad2_JcrProperty_t.java
65397c71b8820340a4924bd45f0e1686d1ae5a6d
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,526
java
package brix.jcr.api; import java.io.InputStream; import java.util.Calendar; import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.Value; import javax.jcr.nodetype.PropertyDefinition; import brix.jcr.api.wrapper.WrapperAccessor; /** * * @author Matej Knopp */ public interface JcrProperty extends JcrItem, Property { public static class Wrapper { public static JcrProperty wrap(Property delegate, JcrSession session) { return WrapperAccessor.JcrPropertyWrapper.wrap(delegate, session); } }; public Property getDelegate(); public boolean getBoolean(); public Calendar getDate(); public PropertyDefinition getDefinition(); public double getDouble(); public long getLength(); public long[] getLengths(); public long getLong(); public JcrNode getNode(); public InputStream getStream(); public String getString(); public int getType(); public JcrValue getValue(); public JcrValue[] getValues(); public void setValue(Value value); public void setValue(Value[] values); public void setValue(String value); public void setValue(String[] values); public void setValue(InputStream value); public void setValue(long value); public void setValue(double value); public void setValue(Calendar value); public void setValue(boolean value); public void setValue(Node value); }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f0729509291d17fdef74c62352e2dde20e69cec8
3b7c0897be9693ca314c4262141c30996f1067d2
/src/main/java/com/myspringdemo/service/impl/LifeycycleServiceImpl.java
0e4449b5fc788dba3f29923bcb1deaf878ebd9c1
[]
no_license
zhaochao1024/myRepository
e85160aa0e33c19ff0b87afd4706d684a9e11b11
22b51085b6753da255ab7c4da4ed1b62ef6223d2
refs/heads/master
2021-01-23T02:41:19.433081
2017-04-18T07:55:18
2017-04-18T07:55:18
86,020,171
0
0
null
null
null
null
UTF-8
Java
false
false
886
java
package com.myspringdemo.service.impl; import com.myspringdemo.service.LifeycycleService; import org.springframework.context.SmartLifecycle; import org.springframework.stereotype.Service; /** * Created by treebear on 2017/4/10. */ @Service public class LifeycycleServiceImpl implements LifeycycleService,SmartLifecycle,Runnable { public boolean isAutoStartup() { return true; } public void stop(Runnable callback) { System.out.println("lifecycle stop !!!"); } public void start() { System.out.println("lifecycle start !!!"); } public void stop() { } public boolean isRunning() { return true; } public int getPhase() { return 0; } public void printf() { System.out.println("printf"); } public void run() { System.out.println("lifecycle sotp !!!"); } }
[ "chao.zhao@treebear.cn" ]
chao.zhao@treebear.cn
e679b66d118f685ae9f4e11075d15ebc6b4d9f62
d61b64552510a927e01235534c737123d69266c1
/src/main/java/interfaces/IMixingTransaction.java
7d83d19424f0d99aa21342b9733f5aeb1b1284a2
[]
no_license
kshewani/jobcoinmixer
f336ce8317581e3103eaba0875d61c9c0f01b528
038ccf49282ad5f8f721f12d6e01bd59c711e543
refs/heads/main
2023-07-29T05:52:18.791654
2021-09-11T09:47:10
2021-09-11T09:47:10
404,211,537
0
0
null
null
null
null
UTF-8
Java
false
false
178
java
package interfaces; public interface IMixingTransaction extends ITransaction { int getMixingRequestId(); IAccount getAccount(); IMixingRequest getMixingRequest(); }
[ "kamlesh.shewani@gmail.com" ]
kamlesh.shewani@gmail.com
7f399f399461d6a42cbdea8ea836a6da56e8800f
f424d439f5c29ad8716848a731ac5232a65d2576
/src/main/java/com/feng/util/HtmlUnitUtils.java
e5d85c1b12f7058b632b04493c363e26fc0b68fe
[ "Apache-2.0" ]
permissive
fengsam6/webmagic-learn
25c8f78e9420818e8605f9c6522353d5d69f9f9e
b4611de8277a0bc1f6732f45e34be08c23065842
refs/heads/master
2022-02-05T04:50:15.461990
2022-01-15T08:50:18
2022-01-15T08:50:18
184,259,441
6
3
Apache-2.0
2022-01-15T08:50:19
2019-04-30T12:37:15
Java
UTF-8
Java
false
false
1,694
java
//package com.feng.util; // //import com.gargoylesoftware.htmlunit.BrowserVersion; //import com.gargoylesoftware.htmlunit.WebClient; //import com.gargoylesoftware.htmlunit.html.HtmlPage; // //import java.io.IOException; ///** // *webclient 模拟浏览器进行解析页面 // */ //public class HtmlUnitUtils { // /** // * 获取页面文档字串(等待异步JS执行) // * // * @param url 页面URL // * @return // * @throws Exception // */ // public static HtmlPage getHtmlPage(String url) { // final WebClient webClient = new WebClient(BrowserVersion.CHROME ); // HtmlPage page = null; // // webClient.getOptions().setTimeout(15000);//设置网页响应时间 // webClient.getOptions().setUseInsecureSSL(true);//是否 // webClient.getOptions().setRedirectEnabled(true);//是否自动加载重定向 // webClient.getOptions().setThrowExceptionOnScriptError(false);//是否抛出页面javascript错误 // webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);//是否抛出response的错误 // webClient.getOptions().setJavaScriptEnabled(false);// HtmlUnit对JavaScript的支持不好,关闭之 // webClient.getOptions().setCssEnabled(false);// HtmlUnit对CSS的支持不好,关闭之 // // // try { // page = webClient.getPage(url); // } catch (IOException e) { // e.printStackTrace(); // } finally { // webClient.closeAllWindows(); // } // return page; // } // // public static String getHtmlPageResponse(String url){ // HtmlPage page = getHtmlPage(url); // return page.asXml(); // } //}
[ "1073612350@qq.com" ]
1073612350@qq.com
bdce70953e4695fd125649ff9a9550932503de26
f6c19c77c3e73cefb46439464de8023ae6003d2f
/jpa/jpatuts/kindergarten9/src/main/java/com/kenneth/kindergarten/ejb/KindergartenBean.java
b7dd5675571f306e7871c5d823b9dfb353552e1d
[]
no_license
kenny999/javaee
61ca196bc3d93ec5944f12b1bfa0e8e6c9fa7773
acee1b0067d8cc7f68440c5f3af10d8fa44409a3
refs/heads/master
2020-03-18T01:28:08.757444
2019-01-22T14:22:05
2019-01-22T14:22:05
134,143,295
0
0
null
null
null
null
UTF-8
Java
false
false
5,642
java
package com.kenneth.kindergarten.ejb; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import com.kenneth.kindergarten.entities.Child; import com.kenneth.kindergarten.entities.Educator; import com.kenneth.kindergarten.entities.Garment; import com.kenneth.kindergarten.entities.Kindergarten; import com.kenneth.kindergarten.entities.Section; @Stateless public class KindergartenBean { @PersistenceContext private EntityManager em; public Kindergarten create() { // Create the Kindergarten Böleängen. // Create the section Ekan. // Create the Children Elin, Manda and Mille // Create the educators Kristian and Sandra // Set Elin and Manda as children of Kristian // Set Mille as child of Sandra // Create "Gul tröja" and "Lurviga byxor" as garments of Elin // Create "Onepiece" as garment of Manda // Create "Stor mössa" and "Tuffa skor" as garments of Mille Kindergarten kindergarten = new Kindergarten(); kindergarten.setName("Böleängen"); Section section = new Section(); section.setName("Ekan"); section.setKindergarten(kindergarten); Collection<Section> sections = new ArrayList<>(); sections.add(section); kindergarten.setSections(sections); Collection<Child> childrenOfEkan = new ArrayList<>(); Child childElin = createChildWithName("Elin", section); childrenOfEkan.add(childElin); Child childManda = createChildWithName("Manda", section); childrenOfEkan.add(childManda); Child childMille = createChildWithName("Mille", section); childrenOfEkan.add(childMille); Collection<Child> childrenOfKristian = new ArrayList<>(); childrenOfKristian.add(childElin); childrenOfKristian.add(childManda); Educator educatorKristian = createEducatorWithNameAndChilds("Kristian", childrenOfKristian); Collection<Child> childrenOfSandra = new ArrayList<>(); childrenOfSandra.add(childMille); Educator educatorSandra = createEducatorWithNameAndChilds("Sandra", childrenOfSandra); associateEducatorWithSection(educatorKristian, section); associateEducatorWithSection(educatorSandra, section); setGarmentToChild(childElin, "Gul tröja"); setGarmentToChild(childElin, "Lurviga byxor"); setGarmentToChild(childManda, "Onepiece"); setGarmentToChild(childMille, "Stor mössa"); setGarmentToChild(childMille, "Tuffa skor"); em.persist(section); em.persist(kindergarten); for(Child child : childrenOfEkan){ em.persist(child); for(Garment garment : child.getGarments()){ em.persist(garment); } } for(Educator educator : section.getEducators()){ em.persist(educator); } return kindergarten; } private void associateEducatorWithSection(Educator educator, Section section) { educator.setSection(section); Collection<Educator> educators = section.getEducators(); if(educators == null){ educators = new ArrayList<>(); section.setEducators(educators); } educators.add(educator); } private Educator createEducatorWithNameAndChilds(String name, Collection<Child> childs) { Educator educator = new Educator(); educator.setName(name); for(Child child : childs){ child.setEducator(educator); } return educator; } private void setGarmentToChild(Child child, String name) { Garment garment = new Garment(); garment.setName(name); garment.setChild(child); Collection<Garment> garments = child.getGarments(); if(garments == null){ garments = new ArrayList<>(); } garments.add(garment); child.setGarments(garments); } private Child createChildWithName(String name, Section section){ Child child = new Child(); child.setName(name); child.setSection(section); Collection<Child> childs = section.getChilds(); if(childs == null){ childs = new ArrayList<>(); } childs.add(child); section.setChilds(childs); return child; } public void addChildToFirstSectionOfKindergarten(Long kindergartenId) { // Add child Elis, with Garments Spidermantröja // Associate Elis with the first section // Associate Elis with the first Educator of this section Kindergarten kindergarten = em.find(Kindergarten.class, kindergartenId); Child child = new Child(); child.setName("Elis"); Garment garment = new Garment(); garment.setName("Spidermantröja"); garment.setChild(child); Collection<Garment> garments = new ArrayList<>(); garments.add(garment); child.setGarments(garments); em.persist(garment); em.persist(child); Collection<Section> sections = kindergarten.getSections(); if(sections.size() > 0){ for(Section section : sections){ Collection<Child> childs = section.getChilds(); childs.add(child); child.setSection(section); Collection<Educator> educators = section.getEducators(); for(Educator educator : educators){ child.setEducator(educator); break; } break; } } } public void addGarmentToChild(Kindergarten kindergarten, String childName){ // Add garment "Blå vantar" to Mille kindergarten = em.merge(kindergarten); TypedQuery<Child> query = em.createNamedQuery(Child.findChildByName, Child.class); query.setParameter("childName", childName); Child child = query.getSingleResult(); if(child != null){ Garment garment = new Garment(); garment.setName("Blå vantar"); garment.setChild(child); Collection<Garment> garments = new ArrayList<>(); garments.add(garment); child.setGarments(garments); em.persist(garment); } } }
[ "kenneth.selin@frontwalker.se" ]
kenneth.selin@frontwalker.se
f70f0e854bf5e27b3451435927f3cdb5df50b184
1217868309d2175babd489c4bccc6f418fafc98b
/src/main/java/org/jhipster/projet/web/rest/ReclamationResource.java
451f2e6e1ddb2e97547d41060b1085294e14543c
[]
no_license
haythemmechmech/Reclamation
d623ab0000bb6b7b6c3ff577bb9046aa14e318d8
ee954f5bb6d2ac84d0e823ab39c3bd82a7c1579b
refs/heads/master
2023-01-01T19:42:18.969078
2020-10-25T19:15:43
2020-10-25T19:15:43
307,171,324
0
0
null
null
null
null
UTF-8
Java
false
false
5,025
java
package org.jhipster.projet.web.rest; import com.codahale.metrics.annotation.Timed; import org.jhipster.projet.domain.Reclamation; import org.jhipster.projet.repository.ReclamationRepository; import org.jhipster.projet.web.rest.errors.BadRequestAlertException; import org.jhipster.projet.web.rest.util.HeaderUtil; import io.github.jhipster.web.util.ResponseUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; /** * REST controller for managing Reclamation. */ @RestController @RequestMapping("/api") public class ReclamationResource { private final Logger log = LoggerFactory.getLogger(ReclamationResource.class); private static final String ENTITY_NAME = "reclamation"; private final ReclamationRepository reclamationRepository; public ReclamationResource(ReclamationRepository reclamationRepository) { this.reclamationRepository = reclamationRepository; } /** * POST /reclamations : Create a new reclamation. * * @param reclamation the reclamation to create * @return the ResponseEntity with status 201 (Created) and with body the new reclamation, or with status 400 (Bad Request) if the reclamation has already an ID * @throws URISyntaxException if the Location URI syntax is incorrect */ @PostMapping("/reclamations") @Timed public ResponseEntity<Reclamation> createReclamation(@RequestBody Reclamation reclamation) throws URISyntaxException { log.debug("REST request to save Reclamation : {}", reclamation); if (reclamation.getId() != null) { throw new BadRequestAlertException("A new reclamation cannot already have an ID", ENTITY_NAME, "idexists"); } Reclamation result = reclamationRepository.save(reclamation); return ResponseEntity.created(new URI("/api/reclamations/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString())) .body(result); } /** * PUT /reclamations : Updates an existing reclamation. * * @param reclamation the reclamation to update * @return the ResponseEntity with status 200 (OK) and with body the updated reclamation, * or with status 400 (Bad Request) if the reclamation is not valid, * or with status 500 (Internal Server Error) if the reclamation couldn't be updated * @throws URISyntaxException if the Location URI syntax is incorrect */ @PutMapping("/reclamations") @Timed public ResponseEntity<Reclamation> updateReclamation(@RequestBody Reclamation reclamation) throws URISyntaxException { log.debug("REST request to update Reclamation : {}", reclamation); if (reclamation.getId() == null) { throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull"); } Reclamation result = reclamationRepository.save(reclamation); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, reclamation.getId().toString())) .body(result); } /** * GET /reclamations : get all the reclamations. * * @param eagerload flag to eager load entities from relationships (This is applicable for many-to-many) * @return the ResponseEntity with status 200 (OK) and the list of reclamations in body */ @GetMapping("/reclamations") @Timed public List<Reclamation> getAllReclamations(@RequestParam(required = false, defaultValue = "false") boolean eagerload) { log.debug("REST request to get all Reclamations"); return reclamationRepository.findAllWithEagerRelationships(); } /** * GET /reclamations/:id : get the "id" reclamation. * * @param id the id of the reclamation to retrieve * @return the ResponseEntity with status 200 (OK) and with body the reclamation, or with status 404 (Not Found) */ @GetMapping("/reclamations/{id}") @Timed public ResponseEntity<Reclamation> getReclamation(@PathVariable Long id) { log.debug("REST request to get Reclamation : {}", id); Optional<Reclamation> reclamation = reclamationRepository.findOneWithEagerRelationships(id); return ResponseUtil.wrapOrNotFound(reclamation); } /** * DELETE /reclamations/:id : delete the "id" reclamation. * * @param id the id of the reclamation to delete * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("/reclamations/{id}") @Timed public ResponseEntity<Void> deleteReclamation(@PathVariable Long id) { log.debug("REST request to delete Reclamation : {}", id); reclamationRepository.deleteById(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } }
[ "haythem.mechmech@gmail.com" ]
haythem.mechmech@gmail.com
4ca0d7d9a5ec5ac664d5242cacd48213e792fd2a
3aa6c5a9d667bf16ba661889e4b43c5790c92bf8
/src/main/java/com/benecard/pbf/codegen/visitor/MethodAggregator.java
a86869b2d2da84946b484c713ae4613cf25950db
[]
no_license
ksmith97/CodeGenUtil
68a53bc195c07f249d3585d51e7f491c76ee81d7
407f0d1773f103be9b37fda80a2536e8dcf72dc8
refs/heads/master
2021-01-23T11:50:35.627857
2013-12-06T01:18:20
2013-12-06T01:18:20
14,970,227
1
1
null
null
null
null
UTF-8
Java
false
false
1,065
java
/** * */ package com.benecard.pbf.codegen.visitor; import japa.parser.ast.body.ClassOrInterfaceDeclaration; import japa.parser.ast.body.MethodDeclaration; import japa.parser.ast.body.ModifierSet; import japa.parser.ast.visitor.VoidVisitorAdapter; import java.util.List; /** * @author ksmith_cntr * */ public class MethodAggregator extends VoidVisitorAdapter<List<MethodDeclaration>> { @Override public void visit( final MethodDeclaration d, final List<MethodDeclaration> arg ) { if ( ModifierSet.hasModifier( d.getModifiers(), ModifierSet.PUBLIC ) || ModifierSet.hasModifier( d.getModifiers(), ModifierSet.PROTECTED ) ) { //This is used to exclude methods inside hopefully marked as private inner classes. if ( d.getParentNode() instanceof ClassOrInterfaceDeclaration && ModifierSet.hasModifier( ( (ClassOrInterfaceDeclaration) d.getParentNode() ).getModifiers(), ModifierSet.PUBLIC ) ) { arg.add( d ); } } } }
[ "ksmith_cntr@BCFMPAISXKSD.benecard.local" ]
ksmith_cntr@BCFMPAISXKSD.benecard.local
a96a7bde303d67e479659808b0ed7c3e9e186cf2
d06c6bccc94069b73d93e39bb8f8ceca75a90702
/repo/tip/tags/tip-pm-51lib/src/com/cie2/tip/entities/TaskItem.java
8d46ecc43a7ca35dca9431d9f6f9bfdf27ecbaf5
[]
no_license
PaulWoooong/tip-pm
df48d8bd36128ba4d3593763d62a355f2be241f4
ca703f3767ba66ee179dfa2e53cc7468dfff7625
refs/heads/master
2020-05-20T16:25:00.467478
2009-05-31T10:34:35
2009-05-31T10:34:35
38,351,917
0
0
null
null
null
null
UTF-8
Java
false
false
3,890
java
package com.cie2.tip.entities; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import org.apache.tapestry5.beaneditor.NonVisual; import org.apache.tapestry5.beaneditor.Validate; @Entity public class TaskItem implements Serializable{ public enum TaskType { Voted, Assigned, Bonus } public enum TaskStatus { Created, Available, Started, Finished, Returned, UnderTreshold } public enum TaskStatusLimited { Started, Finished } private Long id; private User createdBy; private User workBy; private User pointAckBy; private String title; private String description; private TaskType taskType; private TaskStatus taskStatus; private int voteUp; private int voteDown; private int point; private Date createdDate; private Date startDate; private Date lastChangedDate; private Project project; private Category category; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @NonVisual public Long getId() { return id; } @ManyToOne(targetEntity=User.class) @JoinColumn(name="CREATED_BY") public User getCreatedBy() { return createdBy; } @ManyToOne(targetEntity=User.class) @JoinColumn(name="POINT_ACK_BY") public User getPointAckBy() { return pointAckBy; } @ManyToOne(targetEntity=User.class) @JoinColumn(name="WORK_BY") public User getWorkBy() { return workBy; } @Validate("required") public String getTitle() { return title; } public String getDescription() { return description; } public TaskStatus getTaskStatus() { return taskStatus; } public TaskType getTaskType() { return taskType; } public int getVoteUp() { return voteUp; } public int getVoteDown() { return voteDown; } public int getPoint() { return point; } @NonVisual public Date getCreatedDate() { return createdDate; } @NonVisual public Date getLastChangedDate() { return lastChangedDate; } @NonVisual public Date getStartDate() { return startDate; } @ManyToOne @JoinColumn(name="PROJECT_ID") public Project getProject() { return project; } @ManyToOne(targetEntity=Category.class) @JoinColumn(name="CATEGORY_ID") public Category getCategory() { return category; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public void setDescription(String description) { this.description = description; } public void setId(Long id) { this.id = id; } public void setLastChangedDate(Date lastChangedDate) { this.lastChangedDate = lastChangedDate; } public void setPoint(int point) { this.point = point; } public void setStartDate(Date startDate) { this.startDate = startDate; } public void setTaskStatus(TaskStatus taskStatus) { this.taskStatus = taskStatus; } public void setTaskType(TaskType taskType) { this.taskType = taskType; } public void setTitle(String title) { this.title = title; } public void setCreatedBy(User user) { this.createdBy = user; } public void setVoteUp(int vote) { this.voteUp = vote; } public void setProject(Project project) { this.project = project; } public void setCategory(Category category) { this.category = category; } public void setPointAckBy(User pointAckBy) { this.pointAckBy = pointAckBy; } public void setWorkBy(User workBy) { this.workBy = workBy; } public void setVoteDown(int voteDown) { this.voteDown = voteDown; } }
[ "abangkis@aa2e8436-b5c8-11dd-bba1-afcbec1a1e1f" ]
abangkis@aa2e8436-b5c8-11dd-bba1-afcbec1a1e1f
59806c405b84cdb32a1259cf56c8c02dd7d941f0
4750a733c3365bcc5fb0d61154c52956be76c690
/src/main/java/in/stackroute/ms/security/AuthenticationResponse.java
3adce2911fe2b2f959f8d2f78e6229f39e032bb5
[]
no_license
kartheekgade/NewsApp_NewsApi_SpringBoot
78ee766943719077c433c685db19081a9b0f44ce
a5f814e1f96608abddb91d6117470bfb1984ecce
refs/heads/master
2023-06-17T15:10:14.920269
2021-07-12T10:12:00
2021-07-12T10:12:00
367,574,752
0
0
null
null
null
null
UTF-8
Java
false
false
229
java
package in.stackroute.ms.security; public class AuthenticationResponse { private final String jwt; public String getJwt() { return jwt; } public AuthenticationResponse(String jwt) { super(); this.jwt = jwt; } }
[ "gade.reddy@globallogic.com" ]
gade.reddy@globallogic.com
a35bd5c469eeb8be9f912ab49d86bde18c20f4f1
60e8428672f441a7493574cc1ac53a8a343e5ff5
/enos-sdk-core/src/main/java/com/envisioniot/enos/iot_mqtt_sdk/core/IResponseCallback.java
91388bfd49b0e7d070a27f13a9c7b22662709502
[ "MIT" ]
permissive
EnvisionIot/enos-device-sdk-java
305a1660679671cad7f29a35531ebb1745100e13
ba7b48c07c9dd0608fd492045f7d13db2c6dfdb7
refs/heads/master
2022-12-23T01:09:19.269561
2022-05-17T02:27:39
2022-05-17T02:27:39
226,071,320
2
12
MIT
2022-12-13T06:46:06
2019-12-05T10:03:27
Java
UTF-8
Java
false
false
588
java
package com.envisioniot.enos.iot_mqtt_sdk.core; import com.envisioniot.enos.iot_mqtt_sdk.core.msg.IMqttResponse; /** * Called when the response message returns or unexpected error happens. * * @author zhensheng.cai * @date 2018/7/19. */ public interface IResponseCallback<T extends IMqttResponse> { /** * handle the async response of the mqtt request * * @param response */ void onResponse(T response); /** * Handle exception we hit while waiting for the response * * @param failure */ void onFailure(Exception failure); }
[ "jieyuan.shen@envisioncn.com" ]
jieyuan.shen@envisioncn.com
2391895665619fed2452b3918590587954ad87c1
ecce6f70285a1a50da00835b8ceaf6e0651ecfa8
/Magma/bukkit/src/main/java/net/avicus/magma/channel/distributed/DistributedChannel.java
5e6c812fafe73bfc323d79ab0c6d3261d0a04606
[ "MIT" ]
permissive
Avicus/AvicusNetwork
d59b69f5ee726c54edf73fb89149cd3624a4e0cd
26c2320788807b2452f69d6f5b167a2fbb2df698
refs/heads/master
2022-06-14T22:55:45.083832
2022-01-23T06:21:43
2022-01-23T06:21:43
119,120,459
25
20
MIT
2022-05-20T20:53:20
2018-01-27T01:10:39
Java
UTF-8
Java
false
false
1,173
java
package net.avicus.magma.channel.distributed; import java.util.Map; import net.avicus.magma.Magma; import net.avicus.magma.channel.Channel; import net.avicus.magma.database.model.impl.Server; import net.avicus.magma.database.model.impl.User; import net.md_5.bungee.api.chat.BaseComponent; /** * A distributed channel. */ public interface DistributedChannel extends Channel { /** * Invoked when a distributed message is being sent to this channel. * * @param server the server * @param source the source * @param components the message * @param context the context */ void distributedRead(Server server, User source, BaseComponent[] components, Map<String, String> context); /** * Send a distributed message is being sent to this channel. * * @param server the server * @param source the source * @param components the message * @param context the context */ default void distributedWrite(Server server, User source, BaseComponent[] components, Map<String, String> context) { Magma.get().getRedis() .publish(new DistributedChannelRedisMessage(this, server, source, components, context)); } }
[ "keenan@keenant.com" ]
keenan@keenant.com
8d79ff78e2896de6456c2c977783becf142135c3
d3e5ab5a86c001cc32dbf538c77421f6b6dce198
/AndroidStudioProjects/note-me-master/app/src/main/java/com/xstudioo/noteme/Search.java
c2a26f425e3607cfa5cda2d02ac6d3e9629a80a2
[]
no_license
Champagnepagcois/note-me-master
ec6f39154f54605066bf305088ac894d8329fa90
b15512997e2e5a43242136d316dc7a51f2b99167
refs/heads/master
2023-02-24T12:37:56.049235
2020-03-21T02:05:20
2020-03-21T02:05:20
223,183,634
1
0
null
2021-01-26T05:33:39
2019-11-21T13:43:48
Java
UTF-8
Java
false
false
328
java
package com.xstudioo.noteme; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class Search extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); } }
[ "marlonrorodriguez2b@gail.com" ]
marlonrorodriguez2b@gail.com
2f3939fdcb8145fa929b7e88c7f9592d37e3d339
2b104ace49c258e1dbd4f1181872b17fcfe645a5
/src/main/java/com/zcm/springboot/util/HttpServletRequestUtil.java
2501a8697f97fe8f57691394673b8b90cf2b0d05
[]
no_license
zcmdlbd/springbootdemo
5aa53eaae7596a4276ebeb0731b0dcd5f3d2566d
2000554acf6d19e15664d2f0085fb72697b842e5
refs/heads/master
2022-07-11T06:00:55.139832
2019-08-06T03:16:47
2019-08-06T03:16:47
196,494,696
0
0
null
2022-06-17T02:22:45
2019-07-12T02:28:36
Java
UTF-8
Java
false
false
1,150
java
/** * Copyright 2019-2029 geekidea(https://github.com/geekidea) * * 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.zcm.springboot.util; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; /** * 获取当前请求的HttpServletRequest对象 * @author geekidea * @date 2018-11-08 */ public class HttpServletRequestUtil { public static HttpServletRequest getRequest() { return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); } }
[ "zhangchengming@sinochx.com" ]
zhangchengming@sinochx.com
c545ba911265d411cb67326b5fdb6c7b87fd9aff
670854bcb8768942c6554e545310c22880fb55f3
/app/src/main/java/com/example/urban_crew_extended/SearchActivity.java
6740f100d46ed336565665519094bf71ce70f86c
[]
no_license
DananjayaPerera/Urban-Crew-Extended
a06848ed89e34407b64ec94d220c52cab48406de
557ef8684563a538edf67256dcb64a546a37494a
refs/heads/master
2020-07-30T19:14:15.647075
2019-09-23T12:16:54
2019-09-23T12:16:54
210,328,504
0
0
null
null
null
null
UTF-8
Java
false
false
1,839
java
package com.example.urban_crew_extended; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.SearchView; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; public class SearchActivity extends AppCompatActivity { ListView search_cars; ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); search_cars = (ListView)findViewById(R.id.search_cars); ArrayList<String> arrCars = new ArrayList<>(); arrCars.addAll(Arrays.asList(getResources().getStringArray(R.array.my_cars))); adapter = new ArrayAdapter<String>( SearchActivity.this, android.R.layout.simple_list_item_1, arrCars ); search_cars.setAdapter(adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.search_cars, menu); MenuItem item = menu.findItem(R.id.search_cars); SearchView searchView = (SearchView)item.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { adapter.getFilter().filter(s); return false; } }); return super.onCreateOptionsMenu(menu); } }
[ "dananjayaperera655@gmail.com" ]
dananjayaperera655@gmail.com
506e3fe14c18b334f60e9956f11a854bd6d5eda3
2f5ac67f3b92f15f0d3a9c4d73a79f11b80f81be
/src/main/java/ru/lagoshny/task/manager/domain/entity/UserRole.java
d8a29d831f5a18f557392e48c4d1e682056ff4c2
[]
no_license
lagoshny/task-manager-back
93f41fd397f6bd18184f695da3a301ff65a620b7
495c07ea61b334bf9ee759747e4d3c48051bf9e3
refs/heads/master
2022-02-09T03:31:02.688290
2021-09-29T14:03:06
2021-09-29T14:03:06
216,344,294
0
0
null
2022-01-21T23:32:33
2019-10-20T10:31:52
Java
UTF-8
Java
false
false
1,989
java
package ru.lagoshny.task.manager.domain.entity; import ru.lagoshny.task.manager.domain.entity.enums.UserRoleEnum; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.Objects; /** * Domain object for hold mapping {@link User} to {@link UserRoleEnum}. * This simple implementation means that one user has one role. */ @Entity @Table(uniqueConstraints = @UniqueConstraint(name = "uk_user_role", columnNames = {"user_id", "role"})) public class UserRole extends AbstractIdPersistence { /** * {@link User} who is assigned the {@link #role}. */ @NotNull @ManyToOne(optional = false, fetch = FetchType.LAZY) @JoinColumn(foreignKey = @ForeignKey(name = "fk_user_role_user")) private User user; /** * Role {@link UserRoleEnum} that granted to {@link #user}. */ @NotNull @Column(nullable = false) private UserRoleEnum role; public UserRole() { } public UserRole(@org.jetbrains.annotations.NotNull final User user, @org.jetbrains.annotations.NotNull final UserRoleEnum role) { this.user = user; this.role = role; } public User getUser() { return user; } public void setUser(final User user) { this.user = user; } public UserRoleEnum getRole() { return role; } public void setRole(final UserRoleEnum role) { this.role = role; } @Override public boolean equals(final Object rafThat) { if (this == rafThat) { return true; } if (!(rafThat instanceof UserRole)) { return false; } if (!super.equals(rafThat)) { return false; } final UserRole that = (UserRole) rafThat; return Objects.equals(this.user, that.user) && this.role == that.role; } @Override public int hashCode() { return Objects.hash(super.hashCode(), user, role); } }
[ "ilya@lagoshny.ru" ]
ilya@lagoshny.ru
3a5895830c015ccf664bae9d00242564259cc430
39af3c6c1dbef04504b66b5cf5bba761527dcbeb
/app/src/androidTest/java/com/picturest11/picturest/ExampleInstrumentedTest.java
440b0bb9f7405653216781690b24c2a68547a955
[]
no_license
Siddharth3/Picturest
241482e46d0f762621dd34b89248091e31f5f86a
40594d476a148abf5d20947b40ebc0378370e7af
refs/heads/master
2020-04-07T20:31:48.274879
2018-11-26T12:24:32
2018-11-26T12:24:32
158,692,246
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package com.picturest11.picturest; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.picturest11.pictureset11", appContext.getPackageName()); } }
[ "siddharth.sahni@smartron.com" ]
siddharth.sahni@smartron.com
3346abfaf8a85604c52c648d42cefa32d9726795
4fdf96449f54a0852d37c53fc4397d70474a22ee
/app/src/main/java/com/feeder/android/util/ImageLoaderManager.java
4fa44d7c53e09c765668b6048379b3394e5f04d0
[]
no_license
Nergal1/Feeder2
8a06e049e9d76afa6c4fa87b02d3d62cb41d5ee4
9e99db36082b29c99b1464b6896ff9df245a1213
refs/heads/master
2020-03-30T00:56:42.381097
2018-09-30T02:30:57
2018-09-30T02:30:57
150,551,634
0
0
null
2018-09-27T08:07:31
2018-09-27T08:07:31
null
UTF-8
Java
false
false
2,071
java
package com.feeder.android.util; import android.content.Context; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; import com.nostra13.universalimageloader.core.DisplayImageOptions; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import me.zsr.feeder.R; /** * @description: * @author: Match * @date: 1/27/17 */ public class ImageLoaderManager { public static void init(Context context) { ColorDrawable defaultDrawable = new ColorDrawable(context.getResources().getColor(R.color.main_grey_light)); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultDrawable) .showImageForEmptyUri(defaultDrawable) .showImageOnFail(defaultDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); // TODO: 1/28/17 dependent on device performance ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(options) .memoryCache(new LruMemoryCache(8 * 1024 * 1024)) .diskCacheSize(100 * 1024 * 1024) .diskCacheFileCount(100) .writeDebugLogs() .build(); ImageLoader.getInstance().init(config); } public static DisplayImageOptions getSubsciptionIconOptions(Context context) { Drawable defaultDrawable = context.getResources().getDrawable(R.drawable.ic_rss_feed_black_24dp); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultDrawable) .showImageForEmptyUri(defaultDrawable) .showImageOnFail(defaultDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); return options; } }
[ "zsrscut@gmail.com" ]
zsrscut@gmail.com
7a8a276c10a579a469f005391ca2fb28d2ffebc1
75f444d7ddf67869f53d5e125cbc5cd597f1fae3
/thematic-data-hibernate/src/test/java/com/yulintu/thematic/data/hibernate/test/services/ServiceSJZD.java
1e890a962b69f9329249e8ae9c2156991914a229
[]
no_license
bowzar/thematic
b8bb62b54b8600290bd01a77450f1b9cbdf0ae6b
aba40b5d1597aa908ee623d2af35df41876197f9
refs/heads/master
2021-03-30T21:18:32.344204
2018-05-07T03:43:31
2018-05-07T03:43:31
124,641,891
3
1
null
null
null
null
UTF-8
Java
false
false
172
java
package com.yulintu.thematic.data.hibernate.test.services; import com.yulintu.thematic.data.Service; public interface ServiceSJZD extends Service { boolean any(); }
[ "bowzar@qq.com" ]
bowzar@qq.com
76e33ec038f0a067f3f9cab8f25d4fd4794f8b51
c2492e0691b5e398618412c95169562a6660b988
/springboot_backend/src/main/java/com/anhtran/springboot/service/ProductService.java
2b78d18a243530932b2cc3fe43d5e21b246de621
[]
no_license
AnhTran1099/springboot_angular12_crud
3ca134a2027d118069c57d33e8535dd34c5cf5c3
4db201702c2c736d68cfb8d36aea7a52fba33af2
refs/heads/master
2023-07-07T02:41:33.598897
2021-08-03T09:29:51
2021-08-03T09:29:51
392,246,544
0
0
null
null
null
null
UTF-8
Java
false
false
330
java
package com.anhtran.springboot.service; import com.anhtran.springboot.model.Product; import java.util.List; public interface ProductService { Product saveProduct(Product product); List<Product> saveProducts(List<Product> products); List<Product> getProducts(); // Product getProductById(long productId); }
[ "anh94701@gmail.com" ]
anh94701@gmail.com
e549a5026369d595f3975e681e5384f1cf306992
1882f70d94c0f04ef33ef2a38ccb19694083d7bc
/pet-clinic-data/src/main/java/guru/spring/framework/sfgpetclinic/repositories/PetTypeRepository.java
9098524e43bfd5b08814f5c1c3ab18279a0d744f
[]
no_license
kwingert94/sfg-pet-clinic
b1d5433d7c730afafda63a703752c6f15f3e9305
a70624868b98fd602e004164f03f01031bb2b766
refs/heads/master
2023-04-23T20:53:15.693030
2021-05-17T19:47:56
2021-05-17T19:47:56
367,147,060
0
0
null
2021-05-17T02:10:44
2021-05-13T18:59:19
Java
UTF-8
Java
false
false
251
java
package guru.spring.framework.sfgpetclinic.repositories; import guru.spring.framework.sfgpetclinic.model.PetType; import org.springframework.data.repository.CrudRepository; public interface PetTypeRepository extends CrudRepository<PetType,Long> { }
[ "speedy_d_w@yahoo.com" ]
speedy_d_w@yahoo.com
d0ade15f62c8869bd0054ebea3ddda9e19499fca
6a234442cfbb1f78dc2f64cecadaca4e7373b240
/build/generated-sources/jax-ws/gov/usda/nrcs/wcc/ns/awdbwebservice/StationElement.java
c95cffc8172ba2d93f5ab9e637ced7550aa8ffed
[]
no_license
dougemil/msse676Client
7f625c6fd2d286362df67595032296aaab76d998
05aacd9d1df82569f27d19b46ca100e94260b7d3
refs/heads/master
2016-09-06T06:46:22.008732
2013-07-13T00:01:34
2013-07-13T00:01:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,659
java
package gov.usda.nrcs.wcc.ns.awdbwebservice; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for stationElement complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="stationElement"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="beginDate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="dataPrecision" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="dataSource" type="{http://www.wcc.nrcs.usda.gov/ns/awdbWebService}dataSource" minOccurs="0"/> * &lt;element name="duration" type="{http://www.wcc.nrcs.usda.gov/ns/awdbWebService}duration" minOccurs="0"/> * &lt;element name="elementCd" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="endDate" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="heightDepth" type="{http://www.wcc.nrcs.usda.gov/ns/awdbWebService}heightDepth" minOccurs="0"/> * &lt;element name="ordinal" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="originalUnitCd" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="stationTriplet" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="storedUnitCd" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "stationElement", propOrder = { "beginDate", "dataPrecision", "dataSource", "duration", "elementCd", "endDate", "heightDepth", "ordinal", "originalUnitCd", "stationTriplet", "storedUnitCd" }) public class StationElement { protected String beginDate; protected Integer dataPrecision; protected DataSource dataSource; protected Duration duration; protected String elementCd; protected String endDate; protected HeightDepth heightDepth; protected int ordinal; protected String originalUnitCd; protected String stationTriplet; protected String storedUnitCd; /** * Gets the value of the beginDate property. * * @return * possible object is * {@link String } * */ public String getBeginDate() { return beginDate; } /** * Sets the value of the beginDate property. * * @param value * allowed object is * {@link String } * */ public void setBeginDate(String value) { this.beginDate = value; } /** * Gets the value of the dataPrecision property. * * @return * possible object is * {@link Integer } * */ public Integer getDataPrecision() { return dataPrecision; } /** * Sets the value of the dataPrecision property. * * @param value * allowed object is * {@link Integer } * */ public void setDataPrecision(Integer value) { this.dataPrecision = value; } /** * Gets the value of the dataSource property. * * @return * possible object is * {@link DataSource } * */ public DataSource getDataSource() { return dataSource; } /** * Sets the value of the dataSource property. * * @param value * allowed object is * {@link DataSource } * */ public void setDataSource(DataSource value) { this.dataSource = value; } /** * Gets the value of the duration property. * * @return * possible object is * {@link Duration } * */ public Duration getDuration() { return duration; } /** * Sets the value of the duration property. * * @param value * allowed object is * {@link Duration } * */ public void setDuration(Duration value) { this.duration = value; } /** * Gets the value of the elementCd property. * * @return * possible object is * {@link String } * */ public String getElementCd() { return elementCd; } /** * Sets the value of the elementCd property. * * @param value * allowed object is * {@link String } * */ public void setElementCd(String value) { this.elementCd = value; } /** * Gets the value of the endDate property. * * @return * possible object is * {@link String } * */ public String getEndDate() { return endDate; } /** * Sets the value of the endDate property. * * @param value * allowed object is * {@link String } * */ public void setEndDate(String value) { this.endDate = value; } /** * Gets the value of the heightDepth property. * * @return * possible object is * {@link HeightDepth } * */ public HeightDepth getHeightDepth() { return heightDepth; } /** * Sets the value of the heightDepth property. * * @param value * allowed object is * {@link HeightDepth } * */ public void setHeightDepth(HeightDepth value) { this.heightDepth = value; } /** * Gets the value of the ordinal property. * */ public int getOrdinal() { return ordinal; } /** * Sets the value of the ordinal property. * */ public void setOrdinal(int value) { this.ordinal = value; } /** * Gets the value of the originalUnitCd property. * * @return * possible object is * {@link String } * */ public String getOriginalUnitCd() { return originalUnitCd; } /** * Sets the value of the originalUnitCd property. * * @param value * allowed object is * {@link String } * */ public void setOriginalUnitCd(String value) { this.originalUnitCd = value; } /** * Gets the value of the stationTriplet property. * * @return * possible object is * {@link String } * */ public String getStationTriplet() { return stationTriplet; } /** * Sets the value of the stationTriplet property. * * @param value * allowed object is * {@link String } * */ public void setStationTriplet(String value) { this.stationTriplet = value; } /** * Gets the value of the storedUnitCd property. * * @return * possible object is * {@link String } * */ public String getStoredUnitCd() { return storedUnitCd; } /** * Sets the value of the storedUnitCd property. * * @param value * allowed object is * {@link String } * */ public void setStoredUnitCd(String value) { this.storedUnitCd = value; } }
[ "dougemil@gmail.com" ]
dougemil@gmail.com
69b0ee6febf3978ba254d03212a5840d2501d80b
3f523dbf49fd7dc20959bd9fb1045a4196fe8ae0
/src/main/java/com/gaoshin/dbshard2/impl/TimedShardResolver.java
df75f62288652c1eb21b2b74e998978017df44cb
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
zhangyongjiang/dbshard2
8bc4892d723bd599a4ba32d1998b10629420f980
5434ea2ba827143fbcf75e4649a1633f7b131df1
refs/heads/master
2021-01-19T02:37:24.009559
2017-02-24T01:21:04
2017-02-24T01:21:04
45,443,563
0
0
null
null
null
null
UTF-8
Java
false
false
3,334
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 com.gaoshin.dbshard2.impl; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import com.gaoshin.dbshard2.ShardResolver; import common.util.reflection.ReflectionUtil; public abstract class TimedShardResolver<T> implements ShardResolver<T> { protected static final SimpleDateFormat sdf; static { sdf = new SimpleDateFormat("yyyyMMddHHmmss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); } public abstract int getShardIdForTime(Long created); public abstract long getShardStartTime(int shardId); protected long startTime; protected Calendar startCal; public int getShardIdForTime(String yyyyMMddHHmmss) throws ParseException { return getShardIdForTime(sdf.parse(yyyyMMddHHmmss).getTime()); } public int getShardIdForNow() { Long now = System.currentTimeMillis(); return getShardIdForTime(now); } public int getNumberOfShards() { return getNumberOfShards((Long)null); } public int getNumberOfShards(String endTime) throws ParseException { return getNumberOfShards(sdf.parse(endTime).getTime()); } public int getNumberOfShards(Long endTime) { if(endTime == null || endTime == 0) endTime = System.currentTimeMillis(); return getShardIdForTime(endTime) + 1; } public long getStartTime() { return startTime; } public void setStartTime(long startTime) { this.startTime = startTime; this.startCal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); this.startCal.setTimeInMillis(startTime); } public void setStartTime(String yyyyMMddHHmmss) throws ParseException { setStartTime(sdf.parse(yyyyMMddHHmmss).getTime()); } @Override public int getShardId(T obj) { Long created = 0l; try { created = (Long) ReflectionUtil.getFieldValue(obj, "created"); } catch (Exception e) { throw new RuntimeException(e); } return getShardIdForTime(created); } public String getShardDateString(Long created) { int shardId = getShardIdForTime(created); long shardStartTime = getShardStartTime(shardId); return sdf.format(new Date(shardStartTime)); } public String getShardDateString(String created) throws ParseException { return getShardDateString(sdf.parse(created).getTime()); } }
[ "zhangyongjiang@gmail.com" ]
zhangyongjiang@gmail.com
20cd29dd27c25ed0c7fc9f5fe2f8551f46a38e51
e953930a5c841597e7d4b12e6cdce8c251395817
/parte-08/case-03-testcontainers/src/main/java/com/jornada/demo/service/UsuarioExterno.java
0201ee80ea8aa2c32981300bf49b642cc08b80ed
[ "MIT" ]
permissive
igorgsousa/livro
a58110ce3d8241f6b7509913e32ec36a2c315f1e
8a04ae162b0936c2ff95bc2775100286252c9457
refs/heads/master
2022-11-17T03:22:13.677164
2020-07-22T12:40:28
2020-07-22T12:40:28
282,736,348
2
0
MIT
2020-07-26T21:29:06
2020-07-26T21:29:06
null
UTF-8
Java
false
false
771
java
package com.jornada.demo.service; import java.net.URI; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import com.jornada.demo.domain.Usuario; @Service public class UsuarioExterno { private final RestTemplate restTemplate; public UsuarioExterno(RestTemplate restTemplate) { this.restTemplate = restTemplate; } public void criaUsuario(Usuario usuario) throws Exception { final String baseUrl = "http://servico-parceiro/api/usuarios"; URI uri = new URI(baseUrl); ResponseEntity<?> result = restTemplate.postForEntity(uri, usuario, ResponseEntity.class); System.out.println(result.getStatusCodeValue()); } }
[ "sandrogiacom@gmail.com" ]
sandrogiacom@gmail.com
c3634f69320c8b28580a728a54057de0560081e1
37f76e68d46fbe54a3eb5cbd03b10035f10ee9d8
/src/main/java/com/decimatech/tarim/controller/VendorController.java
cff7734a3a4572455f871249c31f21f08e852b20
[]
no_license
FatihErdem/tarim
53f2d78a80293b05346dac467079d2e19e17e41c
f53d63c141455f88909c998557371a95366ad336
refs/heads/master
2021-03-24T09:31:23.643138
2016-06-23T03:36:50
2016-06-23T03:36:50
59,466,651
0
0
null
null
null
null
UTF-8
Java
false
false
4,557
java
package com.decimatech.tarim.controller; import com.decimatech.tarim.model.entity.City; import com.decimatech.tarim.model.entity.District; import com.decimatech.tarim.model.entity.Vendor; import com.decimatech.tarim.service.CityService; import com.decimatech.tarim.service.DistrictService; import com.decimatech.tarim.service.UtilityService; import com.decimatech.tarim.service.VendorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.core.session.SessionInformation; import org.springframework.security.core.session.SessionRegistry; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import javax.validation.Valid; import java.util.ArrayList; import java.util.List; import java.util.Objects; @Controller @PreAuthorize("hasAuthority('ADMIN')") @RequestMapping(value = "/vendors") public class VendorController { @Autowired private CityService cityService; @Autowired private DistrictService districtService; @Autowired private VendorService vendorService; @Autowired private UtilityService utilityService; @RequestMapping(value = "/create", method = RequestMethod.GET) public String getVendorCreateForm(@ModelAttribute Vendor vendor) { return "admin/vendorCreateForm"; } @RequestMapping(value = "/create", method = RequestMethod.POST) public String createVendor(@Valid @ModelAttribute Vendor vendor, BindingResult result, Model model) { if (result.hasErrors()) { City vendorCity = cityService.getCityById(vendor.getVendorCity()); District vendorDistrict = districtService.getDistrictById(vendor.getVendorDistrict()); model.addAttribute("vendor", vendor); model.addAttribute("city", vendorCity); model.addAttribute("district", vendorDistrict); return "admin/vendorCreateForm"; } else { vendorService.registerVendor(vendor); return "redirect:/vendors"; } } @RequestMapping(value = "", method = RequestMethod.GET) public String getVendorList(Model model) { List<Vendor> vendors = vendorService.getAllVendors(); model.addAttribute("vendors", vendors); return "admin/vendorList"; } @RequestMapping(value = "/details/{id}", method = RequestMethod.GET) public String getVendorDetails(@PathVariable("id") Long id, Model model) { Vendor vendor = vendorService.getVendorByVendorId(id); City vendorCity = cityService.getCityById(vendor.getVendorCity()); District vendorDistrict = districtService.getDistrictById(vendor.getVendorDistrict()); model.addAttribute("vendor", vendor); model.addAttribute("city", vendorCity); model.addAttribute("district", vendorDistrict); return "admin/vendorUpdateForm"; } @RequestMapping(value = "/details/{id}", method = RequestMethod.POST) public String updateVendor(@PathVariable("id") Long id, @Valid @ModelAttribute Vendor vendor, BindingResult result, Model model) { if (result.hasErrors()) { if (Objects.equals(vendor.getPassword(), "")) { Vendor oldVendor = vendorService.getVendorByVendorId(id); vendor.setVendorId(id); vendor.setPassword(oldVendor.getPassword()); vendorService.updateVendor(vendor); return "redirect:/vendors"; } else { City vendorCity = cityService.getCityById(vendor.getVendorCity()); District vendorDistrict = districtService.getDistrictById(vendor.getVendorDistrict()); model.addAttribute("vendor", vendor); model.addAttribute("city", vendorCity); model.addAttribute("district", vendorDistrict); return "admin/vendorUpdateForm"; } } else { // Sifre degisince vendor force logout oluyor utilityService.expireSessionWithUserId(id); vendor.setVendorId(id); vendorService.updateVendor(vendor); return "redirect:/vendors"; } } }
[ "93.fatiherdem@gmail.com" ]
93.fatiherdem@gmail.com
9c1cfd554a46ee1a65a0e5ee40bc808ba89e8b7b
f9e703f874d8ec6daf9b1d1216f1b2c67c9de85a
/src/com/HM/servlet/reserveServlet.java
e8da251dfd6462fb3de12e9973fabf5e293b0c03
[]
no_license
Journey888/HotelManagement
1f1546e157e57c878d99d8bed64546588909a7c9
3661bf1bd5e897d11bd85d231629da847c669390
refs/heads/main
2022-12-30T06:29:45.602473
2020-10-14T10:02:39
2020-10-14T10:02:39
303,959,415
0
0
null
null
null
null
UTF-8
Java
false
false
3,209
java
package com.HM.servlet; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.HM.entity.RReserveF; import com.HM.service.Otherservice; /** * Servlet implementation class reserveServlet */ public class reserveServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public reserveServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String rno = request.getParameter("Rno"); String startdate = request.getParameter("startdate"); String enddate = request.getParameter("enddate"); String rent = request.getParameter("Rent"); String x = request.getParameter("sex"); String sex="男"; if(x.equals("1")) sex="女"; String idcard = request.getParameter("idcard"); String phone = request.getParameter("phone"); String email = request.getParameter("email"); String name = request.getParameter("name"); String size = request.getParameter("Size"); Otherservice a = new Otherservice(); RReserveF b = a.findbyId(idcard); if(b!=null) { request.setAttribute("reserve_msg","预约失败,您已存在预约"); RequestDispatcher re=request.getRequestDispatcher("RReserve.jsp"); re.forward(request, response); } else { /* * a.insertRF(rno, name, idcard, startdate, enddate, size, rent); * response.sendRedirect("Fmain.jsp"); */ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String nowdate = sdf.format(new Date()); String roomstate = "预约"; String clientstate = "预约"; request.setAttribute("reserve_msg","预约成功"); if(startdate.equals(nowdate)) { roomstate = "入住"; clientstate = "入住"; request.setAttribute("reserve_msg","欢迎入住"); } /* System.out.println(roomstate+rno); */ if(a.findClient(idcard)==null) { a.insertClient(name, sex, phone, email, rno, idcard, clientstate); } else { a.updateClient(idcard, rno, name, sex, phone, email,clientstate); } a.insertRF(rno, name, idcard, startdate, enddate, size, rent); a.setRoomState(roomstate, rno); RequestDispatcher re=request.getRequestDispatcher("RReserve.jsp"); re.forward(request, response); } } }
[ "noreply@github.com" ]
noreply@github.com
593a4c080ed3f285d72a4324b44b0d24302e1b25
f9f1c53b1bfab203f70c607e5dd2dcd63f5391c5
/src/Interfaces/Contenido/ActCalendario.java
e57ec4582f1870df3799203e27067d42ee8d0144
[]
no_license
jose-prieto/Los.Clubes.De.Lectura
b38a36eac75e0c3780dc02e272c41c01d5c15f0c
442550407c37582437a181cd52b26ef1f02488ef
refs/heads/master
2022-07-17T05:20:22.044302
2020-05-18T03:51:40
2020-05-18T03:51:40
209,187,267
0
0
null
null
null
null
UTF-8
Java
false
false
23,303
java
package Interfaces.Contenido; import java.awt.Color; import javax.swing.border.LineBorder; import ControladorBD.QueriesJose; import java.sql.Date; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; public class ActCalendario extends javax.swing.JPanel { ProcedimientosExtra listen = new ProcedimientosExtra(); Dialogo diag = new Dialogo(); QueriesJose query = new QueriesJose(); int val = 5; int val2 = 0; int cont = 0; public ActCalendario() { initComponents(); listen.FieldListener(IdGrup); Libro.setVisible(false); libro.setVisible(false); Moderador.setVisible(false); moderador.setVisible(false); } public boolean val (){ ResultSet rs; rs = query.Info2(getGrup()); if (rs != null){ cont = 0; try { do{ cont++; }while (rs.next()); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } if (IdGrup.getText().equals("Ej. 123")){ IdGrup.setBorder(new LineBorder(Color.red)); JOptionPane.showMessageDialog(null, "Debe rellenar los campos obligatorios", "Error", JOptionPane.ERROR_MESSAGE); return false; }else if (query.bucarclub(getGrup()) == null){ IdGrup.setBorder(new LineBorder(Color.red)); return false; }else{ IdGrup.setBorder(new LineBorder(Color.gray)); } if (cont < val){ JOptionPane.showMessageDialog(null, "El grupo: "+getGrup()+"\nDebe tener un mínimo de: "+val+ " personas\nPara organizar una reunión\nY el grupo solo cuenta con: "+cont+ " personas", "Error", JOptionPane.ERROR_MESSAGE); return false; } return true; } public int getGrup(){ if (IdGrup.getText().equals("Ej. 123") || IdGrup.getText().equals("")){ return 0; }else { return Integer.parseInt(IdGrup.getText()); } } public int getMod(){ if (IdGrup.getText().equals("Ej. 123") || IdGrup.getText().equals("")){ return 0; }else { return Integer.parseInt(IdGrup.getText()); } } public boolean Actualizar(){ return query.grupAct(Dias.getSelectedItem().toString(), Integer.parseInt(Character.toString(HoraI.getSelectedItem().toString().charAt(0))), Integer.parseInt(Character.toString(HoraF.getSelectedItem().toString().charAt(0))), getGrup()); } public boolean crearReuN(){ ResultSet rs, rs2; rs = query.Info2(getGrup()); rs2 = query.Info(getGrup(), Integer.parseInt(Moderador.getSelectedItem().toString())); if (rs2 != null){ try { query.crearReuN(indexFecha(), getGrup(), rs2.getInt(1), Libro.getSelectedItem().toString(), rs2.getDate(2), Integer.parseInt(Moderador.getSelectedItem().toString())); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } }else if (rs != null){ cont = 0; try { do{ cont++; query.Inasistencia(indexFecha(), getGrup(), rs.getInt(1), rs.getDate(2), rs.getInt(3)); }while (rs.next()); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } return false; } public boolean actReu(){ return (query.actReu(indexFecha(), getGrup())); } public int indexFecha(){ return Dias.getSelectedIndex() + 8; } public void vaciar(){ HoraI.setEnabled(false); HoraF.setEnabled(false); Libro.setVisible(false); libro.setVisible(false); Moderador.setVisible(false); moderador.setVisible(false); IdGrup.setForeground(new Color(204,204,255)); IdGrup.setText("Ej. 123"); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); IdGrup = new javax.swing.JTextField(); Dias = new javax.swing.JComboBox<>(); HoraI = new javax.swing.JComboBox<>(); Registrar = new javax.swing.JButton(); Label1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); HoraF = new javax.swing.JComboBox<>(); Libro = new javax.swing.JComboBox<>(); libro = new javax.swing.JLabel(); Moderador = new javax.swing.JComboBox<>(); moderador = new javax.swing.JLabel(); setMaximumSize(new java.awt.Dimension(707, 541)); setMinimumSize(new java.awt.Dimension(707, 541)); setPreferredSize(new java.awt.Dimension(707, 541)); jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLabel1.setText("I.D del grupo"); IdGrup.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N IdGrup.setForeground(new java.awt.Color(204, 204, 255)); IdGrup.setText("Ej. 123"); IdGrup.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray)); IdGrup.addFocusListener(new java.awt.event.FocusAdapter() { public void focusLost(java.awt.event.FocusEvent evt) { IdGrupFocusLost(evt); } }); IdGrup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { IdGrupActionPerformed(evt); } }); IdGrup.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { IdGrupKeyTyped(evt); } }); Dias.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N Dias.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes" })); HoraI.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N HoraI.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "5:00 pm", "6:00 pm", "7:00 pm" })); HoraI.setEnabled(false); HoraI.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { HoraIItemStateChanged(evt); } }); Registrar.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N Registrar.setText("Registrar"); Registrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RegistrarActionPerformed(evt); } }); Label1.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N Label1.setForeground(new java.awt.Color(255, 0, 0)); Label1.setText("(*)"); Label1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseEntered(java.awt.event.MouseEvent evt) { Label1MouseEntered(evt); } public void mouseExited(java.awt.event.MouseEvent evt) { Label1MouseExited(evt); } }); jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLabel2.setText("Día de reunión"); jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLabel3.setText("Hora comienza"); jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N jLabel4.setText("Hora termina"); HoraF.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N HoraF.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "6:00 pm", "7:00 pm" })); HoraF.setEnabled(false); Libro.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N Libro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { LibroActionPerformed(evt); } }); libro.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N libro.setText("Libro a leer"); Moderador.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N Moderador.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ModeradorActionPerformed(evt); } }); moderador.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N moderador.setText("Moderador"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(54, 54, 54) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(moderador) .addGap(48, 48, 48) .addComponent(Moderador, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 475, Short.MAX_VALUE) .addComponent(Registrar)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jLabel1)) .addGap(21, 21, 21) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Dias, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(IdGrup))) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel3) .addComponent(libro)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(Libro, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(HoraI, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(HoraF, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE))))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(Label1) .addGap(60, 60, 60)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(81, 81, 81) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(IdGrup, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(Label1)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Dias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(HoraI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4) .addComponent(HoraF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Libro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(libro)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(Moderador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(moderador)) .addGap(18, 18, 18) .addComponent(Registrar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(194, Short.MAX_VALUE)) ); }// </editor-fold>//GEN-END:initComponents private void RegistrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RegistrarActionPerformed // TODO add your handling code here: ResultSet rs,rs2; if (val2 == 1){ if (val() && Actualizar()){ crearReuN(); vaciar(); JOptionPane.showMessageDialog(null, "Próxima reunión pautada para el dia: "+Dias.getSelectedItem().toString()+ "\nDesde las "+HoraI.getSelectedItem().toString()+" a las "+HoraF.getSelectedItem().toString(), "Mensaje", JOptionPane.INFORMATION_MESSAGE); } }else{ if (val() && Actualizar()){ query.BorraInasist(Integer.parseInt(IdGrup.getText())); actReu(); rs = query.Info2(Integer.parseInt(IdGrup.getText())); if (rs != null){ cont = 0; try { do{ cont++; query.Inasistencia(indexFecha(), getGrup(), rs.getInt(1), rs.getDate(2), rs.getInt(3)); }while (rs.next()); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } vaciar(); JOptionPane.showMessageDialog(null, "Próxima reunión pautada para el dia: "+Dias.getSelectedItem().toString()+ "\nDesde las "+HoraI.getSelectedItem().toString()+" a las "+HoraF.getSelectedItem().toString(), "Mensaje", JOptionPane.INFORMATION_MESSAGE); } } }//GEN-LAST:event_RegistrarActionPerformed private void Label1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Label1MouseEntered // TODO add your handling code here: diag.posicion(Label1.getLocationOnScreen().x-29, Label1.getLocationOnScreen().y+15); diag.setVisible(true); }//GEN-LAST:event_Label1MouseEntered private void Label1MouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Label1MouseExited // TODO add your handling code here: diag.setVisible(false); }//GEN-LAST:event_Label1MouseExited private void IdGrupKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_IdGrupKeyTyped // TODO add your handling code here: char c = evt.getKeyChar(); if (c < '0' || c > '9' || IdGrup.getText().length() > 2){ evt.consume(); } }//GEN-LAST:event_IdGrupKeyTyped private void IdGrupFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_IdGrupFocusLost // TODO add your handling code here: if (getGrup() != 0){ ResultSet res = query.bucarclub(getGrup()); try { if (res != null){ if (res.getString(2).equals("niños")){ val = 7; HoraI.removeItemAt(2); HoraI.setEnabled(true); HoraF.setEnabled(true); HoraI.removeItem("7:00 pm"); }else { HoraI.setEnabled(true); HoraF.setEnabled(true); if (val == 7){ HoraI.addItem("7:00 pm"); } if (res.getString(2).equals("jovenes")){ val = 5; } if (res.getString(2).equals("adultos")){ val = 10; } } if (query.reuAbierta(getGrup()) == null){ val2 = 1; libro.setVisible(true); Libro.setVisible(true); Moderador.setVisible(true); moderador.setVisible(true); Libro.removeAllItems(); Moderador.removeAllItems(); res = query.libros(); Libro.removeAllItems(); if (res != null){ try { do{ Libro.addItem(res.getString(1)); }while (res.next()); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } res = query.miemGrupo(getGrup()); Moderador.removeAllItems(); if (res != null){ try { do{ Moderador.addItem(res.getString(1)); }while (res.next()); } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } }else{ libro.setVisible(false); Libro.setVisible(false); Moderador.setVisible(false); moderador.setVisible(false); val2 = 0; } }else{ JOptionPane.showMessageDialog(null, "Club ingresado inexistente", "Error", JOptionPane.ERROR_MESSAGE); libro.setVisible(false); Libro.setVisible(false); } } catch (SQLException ex) { Logger.getLogger(RegistraMiembro2.class.getName()).log(Level.SEVERE, null, ex); } } }//GEN-LAST:event_IdGrupFocusLost private void LibroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LibroActionPerformed // TODO add your handling code here: }//GEN-LAST:event_LibroActionPerformed private void HoraIItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_HoraIItemStateChanged // TODO add your handling code here: if (val == 7){ if (HoraI.getSelectedItem().toString().equals("5:00 pm")){ HoraF.removeAllItems(); HoraF.addItem("6:00 pm"); HoraF.addItem("7:00 pm"); }else if (HoraI.getSelectedItem().toString().equals("6:00 pm")){ HoraF.removeAllItems(); HoraF.addItem("7:00 pm"); } }else{ if (HoraI.getSelectedItem().toString().equals("5:00 pm")){ HoraF.removeAllItems(); HoraF.addItem("6:00 pm"); HoraF.addItem("7:00 pm"); }else if (HoraI.getSelectedItem().toString().equals("6:00 pm")){ HoraF.removeAllItems(); HoraF.addItem("7:00 pm"); HoraF.addItem("8:00 pm"); }else if (HoraI.getSelectedItem().toString().equals("7:00 pm")){ HoraF.removeAllItems(); HoraF.addItem("8:00 pm"); HoraF.addItem("9:00 pm"); } } }//GEN-LAST:event_HoraIItemStateChanged private void ModeradorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModeradorActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ModeradorActionPerformed private void IdGrupActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_IdGrupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_IdGrupActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JComboBox<String> Dias; private javax.swing.JComboBox<String> HoraF; private javax.swing.JComboBox<String> HoraI; private javax.swing.JTextField IdGrup; private javax.swing.JLabel Label1; private javax.swing.JComboBox<String> Libro; private javax.swing.JComboBox<String> Moderador; private javax.swing.JButton Registrar; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel libro; private javax.swing.JLabel moderador; // End of variables declaration//GEN-END:variables }
[ "jap25o94@gmail.com" ]
jap25o94@gmail.com
906363859520810a1d89c237a0ffc1369fa8caf0
06b9dfa7b480d064ce28049d54a9ab16384d580e
/src/main/java/com/hhit/site/dao/ContentDao.java
939bcba4d7528ff3de93bef73f4dd0185e4d9e7d
[]
no_license
JOU-Underwater-vision-laboratory/saier
48ad0a769fd4d632e597a7fe2174db680433c216
928fc8dbe0ce1d490436745594ee51777c9a2649
refs/heads/master
2022-09-20T09:47:27.846727
2019-12-02T03:01:00
2019-12-02T03:01:00
225,162,578
0
1
null
2022-09-01T23:16:47
2019-12-01T13:03:26
JavaScript
UTF-8
Java
false
false
476
java
package com.hhit.site.dao; import com.hhit.site.domain.ContentDO; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Mapper; /** * 内容 * @author liujun */ @Mapper public interface ContentDao { ContentDO get(Long cid); List<ContentDO> list(Map<String, Object> map); int count(Map<String, Object> map); int save(ContentDO content); int update(ContentDO content); int remove(Long cid); int batchRemove(Long[] cids); }
[ "hjt2218@outlook.com" ]
hjt2218@outlook.com
a47404a4ebc4c18b4ac471b41bf1b7ee9b1f79a4
c61801a8551b64a708a417666899a0531e8ae45a
/my-gdx-game/src/com/me/mygdxgame/MyGdxGame.java
f72c564094c95544012d8b6864b29559d6b29f11
[]
no_license
namh13/Tarea-5
0f1ae01c3810af228949364af4025f7ed40f35b5
4bbd685a2c2cb2f241d8d5586184560b2981232a
refs/heads/master
2021-01-18T14:02:53.872553
2014-03-25T15:03:38
2014-03-25T15:03:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,218
java
package com.me.mygdxgame; import java.util.ArrayList; import com.badlogic.gdx.ApplicationListener; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL10; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture.TextureFilter; import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.InputListener; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Image; class Imagen extends Sprite { Imagen(Texture texture) { super(texture); } InputListener l; void avanzar() { setX(getX()+0.01f); if(getX()>0.5f) setX(-0.5f); } } public class MyGdxGame implements ApplicationListener { private OrthographicCamera camera; private SpriteBatch batch; private Texture texture; private Sprite sprite; private Imagen imagen; private Image i; int frame=0; Stage s; ArrayList<Sprite>sprites=new ArrayList<Sprite>(); ArrayList<Pelotita>pelotitas=new ArrayList<Pelotita>(); ArrayList<PelotitaMala>pelotitasm=new ArrayList<PelotitaMala>(); int rotacion=0; @Override public void create() { float w = Gdx.graphics.getWidth(); float h = Gdx.graphics.getHeight(); camera = new OrthographicCamera(1, h/w); batch = new SpriteBatch(); texture = new Texture(Gdx.files.internal("data/fondo1.png")); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); TextureRegion region = new TextureRegion(texture, 0, 0, 512, 275); sprite = new Sprite(region); sprite.setSize(0.9f, 0.9f * sprite.getHeight() / sprite.getWidth()); sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2); sprite.setPosition(0,0); imagen = new Imagen(texture); imagen.setPosition(-0.5f,-0.5f); imagen.setSize(1.0f, 1.0f); s=new Stage(); i=new Image(texture); s.addActor(i); Gdx.input.setInputProcessor(s); Pausa pausar = new Pausa(); s.addActor(pausar); for(int i=0; i<=10; i++) { Pelotita p = new Pelotita((int)(Math.random()*1000%w),(int)(Math.random()*1000%h)); s.addActor(p); pelotitas.add(p); } Fin adios = new Fin(); for(int e=0; e<5; e++) { PelotitaMala t = new PelotitaMala((int)(Math.random()*1000%w),(int)(Math.random()*1000%h),adios); s.addActor(t); pelotitasm.add(t); } adios.setVisible(false); s.addActor(adios); Inicio hola = new Inicio(); s.addActor(hola); } @Override public void dispose() { batch.dispose(); texture.dispose(); } @Override public void render() { sprite.setRotation(rotacion); //imagen.avanzar(); Gdx.gl.glClearColor(4.5f, 8.3f, 2.2f, 8.2f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.setProjectionMatrix(camera.combined); if(!Pausa.pausar) { s.act(); s.draw();} } @Override public void resize(int width, int height) { } @Override public void pause() { } @Override public void resume() { } }
[ "alumno@localhost.localdomain" ]
alumno@localhost.localdomain
4e99045de27e63bb245b09de6a6e3d70452ed060
4059bdc6050585149bea00acf53410ccbaaad44a
/src/main/java/de/renoth/blposition/domain/Match.java
e618d0e43f2f6477ff873040fc89d56cae1b7ef4
[]
no_license
renoth/bl-pos
f888116be016d342885f47915ac233d4e4ca8b03
b948e441d309013c6e20e083bcc26549d841ca46
refs/heads/master
2022-05-02T03:37:01.271114
2021-02-23T11:49:01
2021-02-23T11:49:01
84,964,476
0
0
null
2022-03-31T18:37:58
2017-03-14T15:20:20
Java
UTF-8
Java
false
false
3,082
java
package de.renoth.blposition.domain; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import de.renoth.blposition.domain.deserializer.TeamDeserializer; import java.io.Serializable; import java.util.List; import java.util.Map; @JsonIgnoreProperties(ignoreUnknown = true) public class Match implements Serializable { @JsonProperty("MatchID") private Long id; @JsonProperty("Team1") @JsonDeserialize(using = TeamDeserializer.class) private Team homeTeam; @JsonProperty("Team2") @JsonDeserialize(using = TeamDeserializer.class) private Team awayTeam; private int spieltag; private MatchResult result; private int homeGoal; private int awayGoal; @JsonProperty("Group") private void unpackSpieltag(Map<String, String> group) { spieltag = Integer.parseInt(group.get("GroupOrderID")); } @JsonProperty("MatchResults") private void unpackResults(List<Map<String, String>> results) { if (results.size() == 0) { result = MatchResult.UNDECIDED; homeGoal = -1; awayGoal = -1; return; } Map<String, String> finalResult = null; for (Map<String, String> result : results) { if (finalResult == null) { finalResult = result; continue; } if (Integer.parseInt(result.get("ResultOrderID")) > Integer.parseInt(finalResult.get("ResultOrderID"))) { finalResult = result; } } homeGoal = Integer.parseInt(finalResult.get("PointsTeam1")); awayGoal = Integer.parseInt(finalResult.get("PointsTeam2")); result = homeGoal > awayGoal ? MatchResult.HOME_WIN : (homeGoal < awayGoal ? MatchResult.AWAY_WIN : MatchResult.DRAW); } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Team getHomeTeam() { return homeTeam; } public void setHomeTeam(Team homeTeam) { this.homeTeam = homeTeam; } public Team getAwayTeam() { return awayTeam; } public void setAwayTeam(Team awayTeam) { this.awayTeam = awayTeam; } public int getSpieltag() { return spieltag; } public void setSpieltag(int spieltag) { this.spieltag = spieltag; } public MatchResult getResult() { return result; } public void setResult(MatchResult result) { this.result = result; } public int getHomeGoal() { return homeGoal; } public void setHomeGoal(int homeGoal) { this.homeGoal = homeGoal; } public int getAwayGoal() { return awayGoal; } public void setAwayGoal(int awayGoal) { this.awayGoal = awayGoal; } @Override public String toString() { return homeTeam.getTeamName() + " - " + awayTeam.getTeamName() + " : " + result; } }
[ "johannes.renoth@gmx.de" ]
johannes.renoth@gmx.de
40286a58e90b619d3332911b2f5a8700e6dcc88c
739bbbb74cf5c111e8cda17e48e3572d5d2d2336
/DavidZhou1st/src/arrays/Person.java
624acec0a97c2a8a8815f6b716ea92cdd78b452e
[]
no_license
dzhou7032/davidrepos
e4894ac9395800275cb414d75b9f261ed13e4ed8
0cf7c67f02e9b9cd46d02ea8d8e23056e8d6bc72
refs/heads/master
2021-08-23T16:19:54.260873
2017-12-05T16:45:42
2017-12-05T16:45:42
103,151,044
0
0
null
null
null
null
UTF-8
Java
false
false
2,759
java
package arrays; public class Person { public static final String[] FIRST_START = {"Chr", "M", "L", "Gr", "Ph", "B", "Th"}; public static final String[] FIRST_MIDDLE = {"istie", "icha", "era","eta", "ala", "ina", "ara"}; public static final String[] FIRST_END = {"", "na", "n", "r", "tian", "s", "rs", "mp", "les"}; public static final String[] LAST_START = {"Tr", "Br", "L", "Gr", "Sh", "B", "Th"}; public static final String[] LAST_MIDDLE = {"om", "o", "era","eta", "ala", "ina", "ara"}; public static final String[] LAST_END = {"", "na", "ers", "rian", "ston", "ck", "rs", "sk", "les"}; private String firstName; private String lastName; private Borough home; private Hobby hobby; private Person[] friends; private String nickname; public Person(String first, String last, Borough home) { this.firstName= first; this.lastName = last; this.home = home; this.hobby = Hobby.randomHobby(); this.nickname = createNickname(firstName); friends = new Person[3]; } public void mingle(Person[] people) { for(Person p: people) { if(p!=this){ p=betterFriend(p,friends[0]); addFriendToFirstPlace(p); } } } private Person betterFriend(Person p, Person person) { if (p == null) { return person; } if (person==null) { return p; } if (p.getClass()==this.getClass()) { return p; } if (person.getClass()==this.getClass()) { return person; } //if none these are true, just take p return p; } public void printFriends() { System.out.println("My name is "+firstName+lastName+" and these are my friends:"); for (Person f: friends) { if (f != null) System.out.println(f); } } public void addFriendToFirstPlace(Person p) { for(int i =friends.length-1; i>0;i--) { friends[i]=friends[i-1]; } friends[0]=p; } public String toString() { return "My name is "+firstName+" "+lastName+". Call me "+nickname+". I live in "+home+"."; } public static String createNickname(String name) { boolean foundVowel=false; String placeh=""; for (int i=0;i<name.length();i++) { if (name.substring(i,i+1).equals("a")||name.substring(i,i+1).equals("e")||name.substring(i,i+1).equals("i")||name.substring(i,i+1).equals("o")||name.substring(i,i+1).equals("u")) { if (foundVowel == true) { return placeh; } if (foundVowel == false) { placeh=placeh+name.substring(i,i+1); foundVowel = true; } } else { placeh=placeh+name.substring(i,i+1); } } return name; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; nickname = createNickname(firstName); } }
[ "BT_1N3_28@BT_1N3_28.bktech.local" ]
BT_1N3_28@BT_1N3_28.bktech.local
009b8d211b2c4b86004fe9ca508abcbca0fb629c
61493988859ee2869df048c26ec2840760d23e80
/dwdmlinksim/src/com/tejas/eda/spice/parse/semi/mos/MOS2ModelCard.java
ed790d2462fc41677e49960a7383cbf6324d4e0e
[]
no_license
vikramzmail/tejPlan
6f2a34aafdf7df29d3d993b4f1bc3f11cd68b84c
749644dea9b59eee413b155222a19bbb50f8cab1
refs/heads/master
2021-01-01T05:40:51.841146
2015-03-04T17:40:28
2015-03-04T17:41:11
31,670,235
2
0
null
null
null
null
UTF-8
Java
false
false
4,497
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.tejas.eda.spice.parse.semi.mos; import com.tejas.eda.spice.device.semi.mos.MOS2Instance; import com.tejas.eda.spice.device.semi.mos.MOS2ModelValues; import com.tejas.eda.spice.parse.Deck; import com.tejas.eda.spice.parse.ParserException; import static com.tejas.eda.spice.Constants.CtoK; /** * @author Kristopher T. Beck */ public class MOS2ModelCard extends MOSModelCard<MOS2Instance, MOS2ModelValues> { public MOS2ModelCard(String cardString) throws ParserException { super(cardString); } @Override public MOS2Instance createInstance() { MOS2Instance instance = new MOS2Instance(); initModelValues(instance); return instance; } @Override public void setProperty(MOS2ModelValues model, String name, String value) { if (name.equals("TNOM")) { model.setTnom(parseDouble(value) + CtoK); } else if (name.equals("VTO")) { model.setVt0(parseDouble(value)); } else if (name.equals("KP")) { model.setTransconductance(parseDouble(value)); } else if (name.equals("GAMMA")) { model.setGamma(parseDouble(value)); } else if (name.equals("PHI")) { model.setPhi(parseDouble(value)); } else if (name.equals("LAMBDA")) { model.setLambda(parseDouble(value)); } else if (name.equals("RD")) { model.setDrnResistance(parseDouble(value)); } else if (name.equals("RS")) { model.setSrcResistance(parseDouble(value)); } else if (name.equals("CBD")) { model.setCapBD(parseDouble(value)); } else if (name.equals("CBS")) { model.setCapBS(parseDouble(value)); } else if (name.equals("IS")) { model.setJctSatCur(parseDouble(value)); } else if (name.equals("PB")) { model.setBlkJctPotential(parseDouble(value)); } else if (name.equals("CGSO")) { model.setGateSrcOverlapCapFactor(parseDouble(value)); } else if (name.equals("CGDO")) { model.setGateDrnOverlapCapFactor(parseDouble(value)); } else if (name.equals("CGBO")) { model.setGateBlkOverlapCapFactor(parseDouble(value)); } else if (name.equals("CJ")) { model.setBlkCapFactor(parseDouble(value)); } else if (name.equals("MJ")) { model.setBlkJctBotGradingCoeff(parseDouble(value)); } else if (name.equals("CJSW")) { model.setSideWallCapFactor(parseDouble(value)); } else if (name.equals("MJSW")) { model.setBlkJctSideGradingCoeff(parseDouble(value)); } else if (name.equals("JS")) { model.setJctSatCurDensity(parseDouble(value)); } else if (name.equals("TOX")) { model.setOxideThickness(parseDouble(value)); } else if (name.equals("LD")) { model.setLatDiff(parseDouble(value)); } else if (name.equals("RSH")) { model.setSheetResistance(parseDouble(value)); } else if (name.equals("U0")) { model.setSurfaceMobility(parseDouble(value)); } else if (name.equals("FC")) { model.setFwdCapDepCoeff(parseDouble(value)); } else if (name.equals("NSUB")) { model.setSubstrateDoping(parseDouble(value)); } else if (name.equals("TPG")) { model.setGateType(Integer.parseInt(value)); } else if (name.equals("NSS")) { model.setSurfaceStateDensity(parseDouble(value)); } else if (name.equals("NFS")) { model.setFastSurfaceStateDensity(parseDouble(value)); } else if (name.equals("DELTA")) { model.setNarrowFactor(parseDouble(value)); } else if (name.equals("UEXP")) { model.setCritFieldExp(parseDouble(value)); } else if (name.equals("VMAX")) { model.setMaxDriftVel(parseDouble(value)); } else if (name.equals("XJ")) { model.setJunctionDepth(parseDouble(value)); } else if (name.equals("NEFF")) { model.setChannelCharge(parseDouble(value)); } else if (name.equals("UCRIT")) { model.setCritField(parseDouble(value)); } else if (name.equals("KF")) { model.setfNcoef(parseDouble(value)); } else if (name.equals("AF")) { model.setfNexp(parseDouble(value)); } } }
[ "vikrams@india.tejasnetworks.com" ]
vikrams@india.tejasnetworks.com
ef2ec63f37f227524407a51d7a5487d1bee2ee47
a0d38c1947d888882a608fcf30f831488c90812a
/niord-dk-web/src/test/java/org/niord/core/DkLightCharacterTest.java
28551301303fdeab257a8e60dff4f1099f53dbd9
[ "Apache-2.0" ]
permissive
NiordOrg/niord-dk
085c68177a7f1bc2fcc6dde297ddf4c42921f60a
bc74d239d401240d02d506ac1a8d2cafdafa5768
refs/heads/master
2023-01-14T03:26:02.801962
2023-01-11T08:45:50
2023-01-11T08:45:50
51,736,557
0
5
NOASSERTION
2023-01-11T08:45:51
2016-02-15T06:53:13
Java
UTF-8
Java
false
false
2,397
java
/* * Copyright 2017 Danish Maritime Authority. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.niord.core; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateExceptionHandler; import org.junit.Test; import org.niord.core.aton.LightCharacterParser; import org.niord.core.aton.LightCharacterService; import java.io.StringWriter; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; /** * Unit tests for the light character parser service in Danish */ public class DkLightCharacterTest { private List<String> lights = Arrays.asList( "Fl(2) 20m 10s 12M ", "Gp.L.Fl(2+1)G. 5s", "Mo(U)", "Iso G 4s", "Gp Oc(3) W 10s 15m 10M", "Alt R.W.G", "Al.Fl.Bu.Y 3s", "VQ(6)+LFl" ); LightCharacterParser parser = LightCharacterParser.getInstance(); @Test public void parseLightCharacterFormatting() throws Exception { Configuration cfg = new Configuration(Configuration.getVersion()); cfg.setLocalizedLookup(true); cfg.setClassForTemplateLoading(DkLightCharacterTest.class, "/templates/aton/"); cfg.setDefaultEncoding("UTF-8"); cfg.setLocale(Locale.US); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); Template template = cfg.getTemplate("light-character_da.ftl"); for (String l : lights) { Map<String, Object> data = new HashMap<>(); data.put("lightModel", parser.parse(l)); StringWriter result = new StringWriter(); template.process(data, result); System.out.println("*** DK " + l + "\t\t->\t\t" + LightCharacterService.trimResult(result.toString())); } } }
[ "peder@carolus.dk" ]
peder@carolus.dk
7d507aacafc7b0a5e7eab01e4ef9487f9e51d2d4
ca5ab10f4bd1cd6cde53807aff8bcc4a067a9114
/floyd/src/main/java/cps450/CodeGen.java
fb41f97bcd35e9e9b7c9c565fec20781e713fe59
[]
no_license
imora128/CpS450
93b743e129db11325c127ce9212eabb3f30f500d
377868be955c9c43abfe03d07220dee3e9fed2b0
refs/heads/master
2021-05-12T02:10:39.054054
2018-06-26T04:15:07
2018-06-26T04:15:07
117,579,298
0
0
null
null
null
null
UTF-8
Java
false
false
39,051
java
/* Name: Italo Moraes (IMORA128) Class: CpS 450 Filename: CodeGen.java Description: Contains CodeGen class that generates all the code for the program */ package cps450; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Stack; import org.antlr.v4.runtime.ParserRuleContext; import java.lang.ProcessBuilder; import cps450.FloydParser.AddMinus_ExpContext; import cps450.FloydParser.AddPlus_ExpContext; import cps450.FloydParser.AndX_ExpContext; import cps450.FloydParser.Assignment_stmtContext; import cps450.FloydParser.Call_stmtContext; import cps450.FloydParser.Class_Context; import cps450.FloydParser.ExprCont_FalseContext; import cps450.FloydParser.ExprCont_IDContext; import cps450.FloydParser.ExprCont_IDExprContext; import cps450.FloydParser.ExprCont_IntlitContext; import cps450.FloydParser.ExprCont_MEContext; import cps450.FloydParser.ExprCont_NewContext; import cps450.FloydParser.ExprCont_NullContext; import cps450.FloydParser.ExprCont_StrlitContext; import cps450.FloydParser.ExprCont_TrueContext; import cps450.FloydParser.If_stmtContext; import cps450.FloydParser.Loop_stmtContext; import cps450.FloydParser.MethodDot_ExpContext; import cps450.FloydParser.Method_declContext; import cps450.FloydParser.MultiDIV_ExpContext; import cps450.FloydParser.MultiTimes_ExpContext; import cps450.FloydParser.OrX_ExpContext; import cps450.FloydParser.RelationalEQ_ExpContext; import cps450.FloydParser.RelationalGE_ExpContext; import cps450.FloydParser.RelationalGT_ExpContext; import cps450.FloydParser.StartContext; import cps450.FloydParser.UnaryMinus_ExpContext; import cps450.FloydParser.UnaryNot_ExpContext; import cps450.FloydParser.UnaryPlus_ExpContext; import cps450.FloydParser.Var_declContext; public class CodeGen extends FloydBaseVisitor<Void> { List<TargetInstruction> instructions = new ArrayList<TargetInstruction>(); Stack<String> registers = new Stack<String>(); Option opt; int labelCounter; static int LOCAL_SCOPE = 2; MyError PRINT = new MyError(true); SymbolTable symTable; //pushing the gp registers in case I want to use them CodeGen(Option opt, int labelCounterValue) { labelCounter = labelCounterValue; registers.push("%edx"); registers.push("%ecx"); registers.push("%ebx"); registers.push("%eax"); symTable = SymbolTable.getInstance(); this.opt = opt; } /* Function Name: callFunction Description: Used to facilitate the function calls needed for all the different operator expressions. They usually have 2 params, so always adding 8 to the stack */ void callFunction(String functionName) { emit(new TargetInstruction.Builder().instruction("call").operand1(functionName).build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$8,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); } /* Function Name: println Parameters: Description: Prints a new line. (for comments) */ void println() { emit(new TargetInstruction.Builder().directive("\n").build()); } /* Function Name: emit Parameters: TargetInstruction t Description: Adds <t> to the list of instructions */ void emit(TargetInstruction t) { instructions.add(t); } /* Function Name: printInstructions Parameters: Description: For debugging purposes: prints out the instructions */ void printInstructions() { for (TargetInstruction i: instructions) { System.out.println(i); } } /* Function Name: writeToFile Parameters: boolean s Description: Creates a file and writes all the instructions to it. If s is true, then it stops at creating the .s file. If s is false, it links it with stdlib and compiles. */ void writeToFile(boolean s) { String fileName = opt.fileName.get(0); fileName = fileName.substring(0, fileName.lastIndexOf('.')); try { PrintWriter w = new PrintWriter(fileName + ".s"); for (TargetInstruction i: instructions) { w.println(i); } w.close(); } catch (IOException e) { e.printStackTrace(); } compile(fileName, s); } /* Function Name: compile Parameters: String fileName, boolean s Description: Creates a processbuilder object and then calls invokeGCC */ void compile(String fileName, boolean s) { //building the object file if (!s) { ProcessBuilder buildObject = new ProcessBuilder("gcc", "-c", fileName + ".s"); invokeGCC(buildObject, fileName + " object file"); ProcessBuilder buildExecutable = new ProcessBuilder("gcc", fileName + ".o", "stdlib.o", "-o", fileName); invokeGCC(buildExecutable, fileName + " executable"); } } /* Function Name: invokeGCC Parameters: ProcessBuilder procBuilder, String jobname Description: Invokes GCC using procbuilder and prints out errors if it fails */ void invokeGCC(ProcessBuilder procBuilder, String jobName) { int exitCode; try { Process proc = procBuilder.start(); proc.waitFor(); exitCode = proc.exitValue(); if (exitCode == 0) { } else { BufferedReader buf = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String out; while ((out = buf.readLine()) != null) { System.out.println(out); } } } catch (Exception e) { System.out.println(String.format("Error while invoking process: %s", e)); } } /* Function Name: emitComment Parameters: ParserRUleContext ctx Description: prints a conmment using the given context, used mostly for debugging purposes. */ void emitComment(ParserRuleContext ctx) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s",ctx.start.getLine(), ctx.getText())).build()); //===============DEBUGGING============================ //.stabn 68,0,%s,.line%s-main //.line%s: if (opt.g) { emit(new TargetInstruction.Builder().directive(String.format(".stabn 68,0,%s,.line%s-main", ctx.start.getLine(), ctx.start.getLine())).build()); emit(new TargetInstruction.Builder().directive(String.format(".line%s:", ctx.start.getLine())).build()); } //===============DEBUGGING============================ } /* Function Name: nullPointerCheck Description: Calls a C function that checks for null pointers. Prints an error message if the pointer is null, then exits. */ void nullPointerCheck(ParserRuleContext ctx) { emit(new TargetInstruction.Builder().comment("Checking if the object above is null").build()); emit(new TargetInstruction.Builder().comment("pushing line number").build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", ctx.start.getLine())).build()); emit(new TargetInstruction.Builder().instruction("call nullpointertest").build()); emit(new TargetInstruction.Builder().comment("Removing the line number from the top of the stack, leaving the obj reference there").build()); emit(new TargetInstruction.Builder().instruction("addl $4, %esp").build()); } /* Function Name: visitExprCont_Intlit Description: Pushes its integer value onto the stack */ @Override public Void visitExprCont_Intlit(ExprCont_IntlitContext ctx) { TargetInstruction foo = new TargetInstruction.Builder().instruction("pushl").operand1(String.format("$%s", ctx.INTEGER_LITERAL().getText())).build(); emit(foo); return null; } /* Function Name: visitExprCont_Intlit Description: Pushes the offset of the location relative to the base pointer depending on whether it's local or instance. In and out are a special case (globals) so it simply pushes their variable name. Methods are a special case, since they're used as a return in Floyd. So I push the offset to the return value space inside the stack. */ @Override public Void visitExprCont_ID(ExprCont_IDContext ctx) { String name = ctx.IDENTIFIER().getText(); Symbol sym = ctx.sym; if (sym.getDecl() instanceof VarDeclaration) { if (sym.getScope() == LOCAL_SCOPE) { VarDeclaration variable = (VarDeclaration)sym.getDecl(); int offset = variable.getOffset(); //printing comment to explain which variable is being pushed emit(new TargetInstruction.Builder().comment(String.format("pushl %s", sym.getName())).build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1(String.format("%s(%%ebp)", offset)).build()); } else { VarDeclaration lhs = (VarDeclaration)sym.getDecl(); if (name.equals("in")) { emit(new TargetInstruction.Builder().instruction("pushl _in").build()); } else if (name.equals("out")) { emit(new TargetInstruction.Builder().instruction("pushl _out").build()); } else { emit(new TargetInstruction.Builder().comment("get reference to me").build()); emit(new TargetInstruction.Builder().instruction("movl 8(%ebp), %ebx").build()); emit(new TargetInstruction.Builder().comment("push value inside of the reference").build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl %s(%%ebx)", lhs.getOffset())).build()); } } } else { //All method offsets are linked to the return value area of memory in the stack MethodDeclaration variable = (MethodDeclaration)sym.getDecl(); int offset = variable.getOffset(); emit(new TargetInstruction.Builder().comment(String.format("pushl %s", sym.getName())).build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1(String.format("%s(%%ebp)", offset)).build()); } return null; } /* Function Name: visitExprCont_True Description: True is 1 in floyd */ @Override public Void visitExprCont_True(ExprCont_TrueContext ctx) { TargetInstruction instruction = new TargetInstruction.Builder().instruction("pushl").operand1("$1").build(); emit(instruction); return null; } /* Function Name: visitExprCont_False Description: false is 0 in floyd */ @Override public Void visitExprCont_False(ExprCont_FalseContext ctx) { TargetInstruction instruction = new TargetInstruction.Builder().instruction("pushl").operand1("$0").build(); emit(instruction); return null; } /* Function Name: visitVar_decl Description: Used to set instance variables to 0 at declaration */ @Override public Void visitVar_decl(Var_declContext ctx) { //checking if it's a class obj, if so, need to go ahead and make it null (which is 0) VarDeclaration newVar = (VarDeclaration)ctx.sym.getDecl(); if (Type.getTypeForName(ctx.ty.getText()) != null) { //initializing variable to 0 (null) at declaration emit(new TargetInstruction.Builder().instruction(String.format("movl $0, %s(%%ebp)", newVar.getOffset())).build()); } return null; } /* Function Name: visitAssignment_stmt Description: Pops the value into the memory location offset that's given in the symbol that was decorated onto the node at semantic checking. */ @Override public Void visitAssignment_stmt(Assignment_stmtContext ctx) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s",ctx.start.getLine(), ctx.getText())).build()); visit(ctx.e1); Symbol sym = ctx.sym; //check if its a variable if (sym.getDecl() instanceof VarDeclaration) { VarDeclaration lhs = (VarDeclaration)sym.getDecl(); //local variables if (sym.getScope() == LOCAL_SCOPE) { emit(new TargetInstruction.Builder().comment(String.format("popl %s", sym.getName())).build()); emit(new TargetInstruction.Builder().instruction(String.format("popl %s(%%ebp)", lhs.getOffset())).build()); } else { //instance variables emit(new TargetInstruction.Builder().comment("put param value into eax").build()); emit(new TargetInstruction.Builder().instruction("popl %eax").build()); emit(new TargetInstruction.Builder().comment("get reference to me").build()); emit(new TargetInstruction.Builder().instruction("movl 8(%ebp), %ebx").build()); emit(new TargetInstruction.Builder().comment("store new value in offset inside of me").build()); emit(new TargetInstruction.Builder().instruction(String.format("movl %%eax, %s(%%ebx)", lhs.getOffset())).build()); } //check if its a function } else if (sym.getDecl() instanceof MethodDeclaration) { //i set the function offset at -4 when it is created, since that's where in the stack the ret value goes MethodDeclaration lhs = (MethodDeclaration) sym.getDecl(); emit(new TargetInstruction.Builder().comment(String.format("popl %s", sym.getName())).build()); emit(new TargetInstruction.Builder().instruction(String.format("popl %s(%%ebp)", lhs.getOffset())).build()); } println(); return null; } /* Function Name: visitAddPlus_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitAddPlus_Exp(AddPlus_ExpContext ctx) { visit(ctx.e1); visit(ctx.e2); String sourceReg = registers.pop(); String destReg = registers.pop(); TargetInstruction pop1 = new TargetInstruction.Builder(). instruction(String.format("popl %s", sourceReg)).build(); TargetInstruction pop2 = new TargetInstruction.Builder(). instruction(String.format("popl %s", destReg)).build(); emit(pop1); emit(pop2); TargetInstruction add = new TargetInstruction.Builder(). instruction("addl ").operand1(String.format("%s,", sourceReg)).operand2(destReg).build(); emit(add); TargetInstruction pushResult = new TargetInstruction.Builder(). instruction(String.format("pushl %s", destReg)).build(); emit(pushResult); registers.push(destReg); registers.push(sourceReg); return null; } /* Function Name: visitAddMinus_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitAddMinus_Exp(AddMinus_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("minus"); return null; } /* Function Name: visitMultiTimes_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitMultiTimes_Exp(MultiTimes_ExpContext ctx) { visit(ctx.e1); visit(ctx.e2); callFunction("times"); return null; } /* Function Name: visitMultiDIV_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitMultiDIV_Exp(MultiDIV_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("division"); return null; } /* Function Name: visitRelationalGT_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitRelationalGT_Exp(RelationalGT_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("greaterThan"); return null; } /* Function Name: visitUnaryMinus_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitUnaryMinus_Exp(UnaryMinus_ExpContext ctx) { visit(ctx.e1); //needs only $4 because unary only uses 1 argument emit(new TargetInstruction.Builder().instruction("call").operand1("unaryMinus").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$4,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); return null; } /* Function Name: visitRelationalGE_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitRelationalGE_Exp(RelationalGE_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("greaterEqual"); return null; } /* Function Name: visitRelationalEQ_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitRelationalEQ_Exp(RelationalEQ_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("eqTo"); return null; } /* Function Name: visitAndX_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitAndX_Exp(AndX_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("andOp"); return null; } /* Function Name: visitOrX_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitOrX_Exp(OrX_ExpContext ctx) { visit(ctx.e2); visit(ctx.e1); callFunction("orOp"); return null; } /* Function Name: visitUnaryPlus_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitUnaryPlus_Exp(UnaryPlus_ExpContext ctx) { //needs only $4 because unary only uses 1 argument visit(ctx.e1); emit(new TargetInstruction.Builder().instruction("call").operand1("unaryPlus").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$4,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); return null; } /* Function Name: visitUnaryNot_Exp Description: Visits the operands so that it pushes them onto the stack, calls the function and cleans up the stack by adding to it the number of parameters * 4 */ @Override public Void visitUnaryNot_Exp(UnaryNot_ExpContext ctx) { visit(ctx.e1); //needs only $4 because unary only uses 1 argument emit(new TargetInstruction.Builder().instruction("call").operand1("unaryNot").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$4,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); return null; } /* Function Name: visitStart Description: Very important. This is where I set up the program and visit all the classes. This spot also generates code from a dummy main function into the start function of the last defined class. */ @Override public Void visitStart(StartContext ctx) { //necessary for the program to run if (opt.fileName.get(0).equals("stdlib.floyd")) { for (int i = 0; i < ctx.class_().size(); i++) { visit(ctx.class_(i)); } opt.labelCounter = labelCounter; return null; } emit(new TargetInstruction.Builder().label(String.format(".global %s", "main")).build()); emit(new TargetInstruction.Builder().directive(String.format(".file \"%s\"", opt.fileName.get(0))).build()); /* * need to create reader/writer objects at the beginning of the program otherwise it'll fail the null pointer * when calling in/out */ //making them globals emit(new TargetInstruction.Builder().comment("Making in & out globals").build()); emit(new TargetInstruction.Builder().directive(".comm\t _in,4,4").build()); emit(new TargetInstruction.Builder().directive(".comm\t _out,4,4").build()); //going to use this to make sure the class defined class has defined a start method Class_Context lastClass = ctx.class_().get(ctx.class_().size()-1); boolean startDefined = false; //checking all the methods of the last defined class. If it has start, we're good for (int i = 0; i < lastClass.method_decl().size(); i++) { if (lastClass.method_decl().get(i).IDENTIFIER(0).getText().equals("start")) { startDefined = true; } } if (startDefined) { //Creating a main method to instantiate the main clas object and then call the start function int instanceVars = lastClass.var_decl().size(); emit(new TargetInstruction.Builder().comment("Main method. Creates obj instance of the last class and calls its start method").build()); emit(new TargetInstruction.Builder().label(String.format("main:")).build()); //instantiating in & out objects //creating their objects. 8 bytes b/c they don't have any instance vars //in obj emit(new TargetInstruction.Builder().comment("instantiating _in object").build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", 8)).build()); emit(new TargetInstruction.Builder().instruction("pushl $1").build()); emit(new TargetInstruction.Builder().instruction("call").operand1("calloc").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$8,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("movl %eax, _in").build()); //out obj emit(new TargetInstruction.Builder().comment("instantiating _out object").build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", 8)).build()); emit(new TargetInstruction.Builder().instruction("pushl $1").build()); emit(new TargetInstruction.Builder().instruction("call").operand1("calloc").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$8,").operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("movl %eax, _out").build()); //Need to create the last class object and call its start method emit(new TargetInstruction.Builder().comment("Creating last class object & calling its start method").build()); //Number of instance vars * 4 (because each var is 4 bytes) + 8 (8 extra bytes for every object instanc) emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", (instanceVars * 4) + 8)).build()); emit(new TargetInstruction.Builder().instruction("pushl $1").build()); emit(new TargetInstruction.Builder().instruction("call").operand1("calloc").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$8,").operand2("%esp").build()); //setting instance vars to 0 if (instanceVars > 0) { emit(new TargetInstruction.Builder().comment(String.format("Initializing %s instance vars to 0", instanceVars)).build()); //put 0 in each memory offset for (int i = 8; i < (instanceVars * 4) + 8; i += 4 ) { emit(new TargetInstruction.Builder().instruction(String.format("movl $0, %s(%%eax)", i)).build()); } } //pushing pointer to the class obj onto the stack emit(new TargetInstruction.Builder().instruction("pushl %eax").build()); //calling the start method String startName = String.format("%s_%s", lastClass.IDENTIFIER(0).getText(), "start"); //calling the start method emit(new TargetInstruction.Builder().instruction(String.format("call %s", startName)).build()); //when we return from the start method, the program should exit, so that code goes here emit(new TargetInstruction.Builder().comment("Calling exit because the program is finished").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("$0").build()); emit(new TargetInstruction.Builder().instruction("call").operand1("exit").build()); //visiting all the classes for (int i = 0; i < ctx.class_().size(); i++) { visit(ctx.class_(i)); } } else { String ansi_reset = "\u001B[0m"; String ansi_red = "\u001B[31m"; System.out.println(String.format("%sThe start method was not defined in the last class %s. Exiting.%s",ansi_red, lastClass.IDENTIFIER(0).getText(), ansi_reset)); System.exit(1); } return null; } /* Function Name: visitCLass Description: Visits all the methods and variable declarations to generate their code. */ @Override public Void visitClass_(Class_Context ctx) { println(); emit(new TargetInstruction.Builder().comment(String.format("******** Class Definition: %s ******** ", ctx.IDENTIFIER(0).getText())).build()); for (int i = 0; i < ctx.var_decl().size(); i++) { visit(ctx.var_decl(i)); } for(int i = 0; i < ctx.method_decl().size(); i++) { visit(ctx.method_decl(i)); } return null; } /* Function Name: visitMethod_decl Description: Prints out a function preamble (so we don't mess up the stack), makes space for the return value and local variables. */ @Override public Void visitMethod_decl(Method_declContext ctx) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s() %s", ctx.start.getLine(), ctx.IDENTIFIER(0).getText(), ctx.IS().getText())).build()); String funcName = String.format("%s_%s", ctx.className, ctx.IDENTIFIER(0).getText()); emit(new TargetInstruction.Builder().label(String.format(("%s:"), funcName)).build()); //} //FUNCTION PREAMBLE emit(new TargetInstruction.Builder().comment("Function preamble").build()); emit(new TargetInstruction.Builder().instruction("pushl %ebp").build()); emit(new TargetInstruction.Builder().instruction("movl %esp, %ebp").build()); //return value emit(new TargetInstruction.Builder().comment("Making space for return value").build()); emit(new TargetInstruction.Builder().instruction("pushl $0").build()); //locals for (int i = 0; i < ctx.params; i++) { emit(new TargetInstruction.Builder().comment(String.format("making space for %s local", ctx.params)).build()); emit(new TargetInstruction.Builder().instruction("pushl $0").build()); } //folowed by visiting the statement list to print the instructions for the content of the function visit(ctx.statement_list()); //at the end of the function, put the value inside the return value area into eax if (ctx.typ != null) { emit(new TargetInstruction.Builder().comment("Moving the value inside the return value section of the stack into eax").build()); emit(new TargetInstruction.Builder().instruction(("movl -4(%ebp), %eax")).build()); } //cleaning up the stack emit(new TargetInstruction.Builder().comment("cleaning up the stack and returnig").build()); emit(new TargetInstruction.Builder().instruction("leave").build()); emit(new TargetInstruction.Builder().instruction(("ret")).build()); emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s", ctx.stop.getLine(), "end " + ctx.IDENTIFIER(0).getText())).build()); return null; } /* Function Name: visitCall_stmt Description: Generates code for function call statements. Makes sure to use right to left calling parameter passing convention. */ @Override public Void visitCall_stmt(Call_stmtContext ctx) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s",ctx.start.getLine(), ctx.getText())).build()); //right to left int paramNum = 0; if (ctx.t2 != null) { paramNum = ctx.expression_list().expression().size(); for (int i = ctx.expression_list().expression().size() - 1; i > -1; i--) { visit(ctx.expression_list().expression().get(i)); } } //offset for LHS to pass in "this" //only if sym is not null, meaning there's an object there if (ctx.t1 != null) { if (ctx.t1.getText().equals("out")) { emit(new TargetInstruction.Builder().instruction("pushl _out").build()); //need to check if its null nullPointerCheck(ctx); } else if (ctx.t1.getText().equals("in")) { emit(new TargetInstruction.Builder().instruction("pushl _in").build()); //need to check if its null nullPointerCheck(ctx); } else { VarDeclaration test = (VarDeclaration)ctx.sym.getDecl(); //pushing "this" emit(new TargetInstruction.Builder().comment("reference to the object").build()); emit(new TargetInstruction.Builder().comment(String.format("pushl %s", test.name)).build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl %s(%%ebp)", test.getOffset())).build()); //need to check if its null nullPointerCheck(ctx); } } else { emit(new TargetInstruction.Builder().comment("reference to the object (this)").build()); emit(new TargetInstruction.Builder().instruction("pushl 8(%ebp)").build()); //need to check if its null nullPointerCheck(ctx); } //function name will be appended to the class name String functionName = "FunctionNameFailed"; if (ctx.t1 != null ) { functionName = String.format("%s_%s", ctx.t1.myType.name, ctx.IDENTIFIER().getText()); } else { functionName = String.format("%s_%s", ctx.className, ctx.IDENTIFIER().getText()); //print location } emit(new TargetInstruction.Builder().instruction("call").operand1(functionName).build()); if (paramNum > 0) { emit(new TargetInstruction.Builder().comment(String.format("Clean up parameters: %s * 4", paramNum)).build()); emit(new TargetInstruction.Builder().instruction("addl").operand1(String.format("$%s,", paramNum * 4)).operand2("%esp").build()); } //if func doesnt have t1, it has no obj that we need to pass "me" for if(ctx.t1 != null) { emit(new TargetInstruction.Builder().comment("Clean up this reference pushed on last: 4").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1(String.format("$%s,",4)).operand2("%esp").build()); } println(); return null; } /* Function Name: visitExprCont_IDExpr Description: Generates code for expression function calls */ @Override public Void visitExprCont_IDExpr(ExprCont_IDExprContext ctx) { int paramNum = 0; //C style parameter passing convention if (ctx.expression_list() != null) { paramNum = ctx.expression_list().expression().size(); for (int i = ctx.expression_list().expression().size() - 1; i > -1; i--) { visit(ctx.expression_list().expression().get(i)); } } //appends function name to the class name. String functionName = String.format("%s_%s", ctx.classType.name, ctx.IDENTIFIER().getText()); emit(new TargetInstruction.Builder().instruction("pushl 8(%ebp)").build()); //need to check if its null nullPointerCheck(ctx); emit(new TargetInstruction.Builder().instruction("call").operand1(functionName).build()); if (paramNum > 0) { emit(new TargetInstruction.Builder().instruction("addl").operand1(String.format("$%s,", paramNum * 4)).operand2("%esp").build()); } emit(new TargetInstruction.Builder().comment("cleaning up the obj ref").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1(String.format("$%s,", 4)).operand2("%esp").build()); emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); println(); return null; } /* Function Name: visitMethodDot_Exp Description: Generates code for expression function calls of the form: type/object.function */ @Override public Void visitMethodDot_Exp(MethodDot_ExpContext ctx) { int paramNum = 0; ExprCont_IDExprContext foo = null; //it SHOULD be exprcont_IDExprcontext if it ever reaches here.... if (ctx.expr_cont() instanceof ExprCont_IDExprContext) { foo = (ExprCont_IDExprContext) ctx.expr_cont(); //parameter pushing right to left if (foo.expression_list() != null) { paramNum = foo.expression_list().expression().size(); for (int i = foo.expression_list().expression().size() - 1; i > -1; i--) { visit(foo.expression_list().expression().get(i)); } } visit(ctx.e1); //visit above pushes the obj, i need to check if its null nullPointerCheck(ctx); String functionName = String.format("%s_%s", ctx.e1.myType, foo.IDENTIFIER().getText()); emit(new TargetInstruction.Builder().instruction("call").operand1(functionName).build()); if (paramNum > 0) { emit(new TargetInstruction.Builder().comment(String.format("Clean up parameters: (%s * 4) + 4 (this ptr)", paramNum)).build()); emit(new TargetInstruction.Builder().instruction("addl").operand1(String.format("$%s,", (paramNum * 4) + 4)).operand2("%esp").build()); } else { emit(new TargetInstruction.Builder().comment("Clean up THIS obj reference param").build()); emit(new TargetInstruction.Builder().instruction("addl $4, %esp").build()); } emit(new TargetInstruction.Builder().comment("Pushing the result from the called function").build()); emit(new TargetInstruction.Builder().instruction("pushl %eax").build()); } return null; } /* Function Name: visitIf_stmt Description: Generates code for if statements. */ @Override public Void visitIf_stmt(If_stmtContext ctx) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s %s %s",ctx.start.getLine(), ctx.IF().get(0).getText(),ctx.cond_expr.getText(), ctx.THEN().getText())).build()); visit(ctx.cond_expr); labelCounter = labelCounter + 2; int currentIf = labelCounter; //the result of the expression should be on top of the stack //popping it into eax emit(new TargetInstruction.Builder().instruction("popl").operand1("%eax").build()); //pushing 1 to EDX so I can compare it to the result of the expression and do the logical jumps emit(new TargetInstruction.Builder().instruction("movl").operand1("$1,").operand2("%edx").build()); //comparison emit(new TargetInstruction.Builder().instruction("cmpl").operand1("%eax,").operand2("%edx").build()); //+1 is false, + 2 is true //-2 is false, -1 is true //jump to +1 if false emit(new TargetInstruction.Builder().instruction("jne").operand1(String.format(".L%s", (currentIf - 1))).build()); //emit tru stmt list visit(ctx.truestm); //emit jmp to +2 emit(new TargetInstruction.Builder().instruction("jmp").operand1(String.format(".L%s", currentIf)).build()); //emit +1 label and then false stmtlist emit(new TargetInstruction.Builder().directive(String.format(".L%s:", (currentIf - 1))).build()); if (ctx.falsestm != null) { emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s", (ctx.falsestm.start.getLine() - 1), "Else")).build()); visit(ctx.falsestm); } //emit +2 label emit(new TargetInstruction.Builder().directive(String.format(".L%s:", currentIf)).build()); emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s %s",ctx.stop.getLine(), ctx.END().getText(), ctx.IF(0).getText())).build()); return null; } /* Function Name: visitLoop_stmt Description: Generates code for while statements. */ @Override public Void visitLoop_stmt(Loop_stmtContext ctx) { labelCounter = labelCounter + 2; int currentWhile = labelCounter; emit(new TargetInstruction.Builder().instruction("jmp").operand1(String.format(".L%s", (currentWhile - 1))).build()); emit(new TargetInstruction.Builder().directive(String.format(".L%s:", currentWhile)).build()); visit(ctx.loop_body); emit(new TargetInstruction.Builder().directive(String.format(".L%s:", (currentWhile - 1))).build()); visit(ctx.exp); emit(new TargetInstruction.Builder().instruction("pop").operand1("%eax").build()); emit(new TargetInstruction.Builder().instruction("cmpl").operand1("$0,").operand2("%eax").build()); emit(new TargetInstruction.Builder().instruction("jne").operand1(String.format(".L%s", (currentWhile))).build()); emit(new TargetInstruction.Builder().comment(String.format("Line %s: %s", ctx.stop.getLine(), "end loop")).build()); return null; } /* Function Name: visitExprCont_New Description: Generates code for new expression. Calls calloc and puts the return value (after initializing the instance variables to 0) into the LHS variable. */ @Override public Void visitExprCont_New(ExprCont_NewContext ctx) { //Allocate memory from the heap to hold the instance variables for Point //NumberOfParameters*4 + 8 reserved bytes int reserveBytes = (ctx.paramNum * 4) + 8; emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", reserveBytes)).build()); emit(new TargetInstruction.Builder().instruction("pushl $1").build()); emit(new TargetInstruction.Builder().instruction("call").operand1("calloc").build()); emit(new TargetInstruction.Builder().instruction("addl").operand1("$8,").operand2("%esp").build()); //Initialize the values of the instance variables to 0 if (ctx.paramNum > 0) { emit(new TargetInstruction.Builder().comment(String.format("Initializing %s instance vars to 0", ctx.paramNum)).build()); //put 0 in each memory offset for (int i = 8; i < (ctx.paramNum * 4) + 8; i += 4 ) { emit(new TargetInstruction.Builder().instruction(String.format("movl $0, %s(%%eax)", i)).build()); } } //Leave a reference to the memory on the top of the stack emit(new TargetInstruction.Builder().instruction("pushl").operand1("%eax").build()); return null; } /* Function Name: visitExprCont_Null Description: Null is 0 in floyd, so pushing onto the stack. */ @Override public Void visitExprCont_Null(ExprCont_NullContext ctx) { //null is 0 emit(new TargetInstruction.Builder().instruction("pushl $0").build()); return null; } /* Function Name: visitExprCont_ME Description: Me will always be the "this" section of the stack, so offset 8 from BP. */ @Override public Void visitExprCont_ME(ExprCont_MEContext ctx) { emit(new TargetInstruction.Builder().instruction("pushl 8(%ebp)").build()); return null; } /* Function Name: visitExprCont_Strlit Description: String literals will always create a label for the string and call string_fromlit which is a C function in the stdlib.c file. */ @Override public Void visitExprCont_Strlit(ExprCont_StrlitContext ctx) { //I stuck the string label counter in the SymbolTable class because it's a singleton //and I'd be running through CodeGen twice. String stringLitLabel = String.format("stringlit%s", symTable.stringLabelCounter); emit(new TargetInstruction.Builder().label(".data").build()); emit(new TargetInstruction.Builder().label(stringLitLabel + ":").build()); emit(new TargetInstruction.Builder().directive(String.format(".string %s", ctx.getText())).build()); println(); emit(new TargetInstruction.Builder().label(".text").build()); emit(new TargetInstruction.Builder().instruction(String.format("pushl $%s", stringLitLabel)).build()); emit(new TargetInstruction.Builder().instruction("call string_fromlit").build()); emit(new TargetInstruction.Builder().instruction("addl $4, %esp").build()); emit(new TargetInstruction.Builder().instruction("pushl %eax").build()); symTable.stringLabelCounter++; return null; } }
[ "imora128@students.bju.edu" ]
imora128@students.bju.edu
5374d0c4a805759e92972f741e3aa12db09ea1b6
d9f94ea8f3cc232456bf95b67952a5923debc45d
/2012-07-24/I/Main.java
0ff1d19db0a7e563c541d8391922880139481a0a
[]
no_license
ftiasch/mithril
063bdd1d71d8216d727ac7f0faf7954e86653fd6
1bf5805af01409cc21c769debc6e93e48e71a46e
refs/heads/master
2020-05-19T11:48:36.290717
2013-10-05T08:39:46
2013-10-05T08:39:46
5,078,340
7
2
null
null
null
null
UTF-8
Java
false
false
2,311
java
import java.util.*; import java.io.*; import java.math.*; public class Main implements Runnable { BigInteger solve(long p, int n) { BigInteger[] cnt = new BigInteger[n + 1]; for (int i = 0; i <= n; i++) { cnt[i] = BigInteger.valueOf(p).pow(n - i); } for (int i = n; i >= 0; i--) { for (int j = i + 1; j <= n; j++) { cnt[i] = cnt[i].subtract(cnt[j]); } } BigInteger[] sum = new BigInteger[n + 1]; Arrays.fill(sum, BigInteger.ZERO); for (int i = 0; i <= n; i++) { for (int j = 0; j <= n; j++) { int k = Math.min(n, i + j); sum[k] = sum[k].add(cnt[i].multiply(cnt[j])); } } BigInteger ret = BigInteger.ZERO; for (int i = 0; i <= n; i++) { sum[i] = sum[i].divide(cnt[i]); ret = ret.add(sum[i].multiply(sum[i]).multiply(cnt[i])); } return ret; } BigInteger solve(long n) { BigInteger all = BigInteger.valueOf(n).pow(4); BigInteger ret = BigInteger.ONE; for (long i = 2; i * i <= n; i++) { if (n % i == 0) { int cnt = 0; while (n % i == 0) { n /= i; cnt ++; } ret = ret.multiply(solve(i, cnt)); } } if (n > 1) { ret = ret.multiply(solve(n, 1)); } return all.subtract(ret); } long bruteForce(int n) { long[] cnt = new long[n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cnt[i * j % n] ++; } } long ret = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { if (i != j) { ret += cnt[i] * cnt[j]; } } return ret; } public void run() { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); System.out.println(solve(n).mod(sc.nextBigInteger())); } void debug(Object...os) { System.err.println(Arrays.deepToString(os)); } public static void main(String[] args) { new Thread(new Main()).start(); } }
[ "mithril@acm.sjtu.edu.cn" ]
mithril@acm.sjtu.edu.cn
3d296b96534d723df5cbc033b8cc8b6746e58182
d915a2ea0f85e56c77638b69604212212817ab0b
/src/main/java/br/com/matrix/idioma/config/ResourceObjectRegisteredException.java
8f8d7017f8aa34549849f34e59638d2f58811a1f
[]
no_license
lepfalt/IdiomaBackend
a9a1dedf3056ac6e6439278cd117f6337ea65c4b
2feb593a57942e4cf62655f76592d003b31da416
refs/heads/master
2020-03-30T22:08:27.169162
2020-03-27T22:40:04
2020-03-27T22:40:04
151,655,988
0
0
null
2018-10-05T01:17:02
2018-10-05T01:17:02
null
UTF-8
Java
false
false
417
java
package br.com.matrix.idioma.config; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.BAD_REQUEST) public class ResourceObjectRegisteredException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; public ResourceObjectRegisteredException(String message) { super(message); } }
[ "lepfalt@gmail.com" ]
lepfalt@gmail.com
3ac8841a51100459ace20206ef19db3b0b13a1f2
f42eea434af726a2c3c2ce1f18d30445067b56bc
/src/HihoCoder/ElurFunction1298.java
fd66526f0cc2e05dbc0b7e8498b4d58af3aa97d1
[]
no_license
peizhe/Algorithm
a4efacac785b25504c3e828c703d1fdbe64e972e
e429b9ce043055fe68cc137ade8e6350bdd7c88b
refs/heads/master
2021-01-13T14:48:51.870324
2016-12-15T10:53:22
2016-12-15T10:53:22
null
0
0
null
null
null
null
GB18030
Java
false
false
1,133
java
package HihoCoder; /** * 欧拉函数f(n):计算<=n的与n互质的数的个数 * f(x) = x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的所有素因数 * * 若m,n互质,f(m * n) = f(m) * f(n) * 特殊性质:当n为奇数时 f(2 * n) = f(n), 证明与上述类似。 * 若n为质数则f(n) = n - 1 * * @author MG * */ public class ElurFunction1298 { public static int getElur(int L,int R){ int res = Integer.MAX_VALUE; int resIndex = R; int[] values = new int[R + 1]; values[1] = 1; //公式中x*(1 - 1/p1)...中的x for(int i = 2;i <= R; i++) { values[i] = i; } for(int i = 2; i <= R; i++){ //values[i] == i : 证明i为质数 if(values[i] == i){ //后面每个都有i这个质因数 for(int j = i; j <= R; j += i){ //先做除法是防止越界 values[j] = values[j] / i * (i - 1); } } if(i >= L && values[i] < res){ res = values[i]; resIndex = i; } } return resIndex; } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "923762584@qq.com" ]
923762584@qq.com
68b45db624edc31d7444e75224398942ee77f4bd
d7159f4a42e2a56717e508f192b92dd3dff12843
/src/main/java/com/zhihui/order/partner/plateno/service/chain/BookingHelpSoap_BookingHelpSoap12_Client.java
83ff87d77a9e60c84077df9e3847a79cf8f5d2e9
[]
no_license
liangyongsheng/zhihui-order-partner-plateno
d431b8c3020a9ad01c0504cce826458b32849a96
40f95c81e67596398a4c39681945af97ba97cba2
refs/heads/master
2021-01-10T08:43:43.714565
2016-02-18T11:25:32
2016-02-18T11:25:32
52,002,050
0
0
null
null
null
null
UTF-8
Java
false
false
5,161
java
package com.zhihui.order.partner.plateno.service.chain; /** * Please modify this class to meet your needs * This class is not complete */ import java.io.File; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebService; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /** * This class was generated by Apache CXF 2.7.4 * 2016-02-16T14:43:30.795+08:00 * Generated source version: 2.7.4 * */ public final class BookingHelpSoap_BookingHelpSoap12_Client { private static final QName SERVICE_NAME = new QName("http://www.7daysinn.cn/booking", "BookingHelp"); private BookingHelpSoap_BookingHelpSoap12_Client() { } public static void main(String args[]) throws java.lang.Exception { URL wsdlURL = BookingHelp.WSDL_LOCATION; if (args.length > 0 && args[0] != null && !"".equals(args[0])) { File wsdlFile = new File(args[0]); try { if (wsdlFile.exists()) { wsdlURL = wsdlFile.toURI().toURL(); } else { wsdlURL = new URL(args[0]); } } catch (MalformedURLException e) { e.printStackTrace(); } } BookingHelp ss = new BookingHelp(wsdlURL, SERVICE_NAME); BookingHelpSoap port = ss.getBookingHelpSoap12(); { System.out.println("Invoking getHotelInfoByCity..."); java.lang.String _getHotelInfoByCity_authentication = "_getHotelInfoByCity_authentication-1353294018"; java.lang.String _getHotelInfoByCity_sCity = "_getHotelInfoByCity_sCity507078957"; javax.xml.ws.Holder<java.lang.Integer> _getHotelInfoByCity_getHotelInfoByCityResult = new javax.xml.ws.Holder<java.lang.Integer>(); javax.xml.ws.Holder<com.zhihui.order.partner.plateno.service.chain.ArrayOfCTHotelInfo> _getHotelInfoByCity_lstHotelInfo = new javax.xml.ws.Holder<com.zhihui.order.partner.plateno.service.chain.ArrayOfCTHotelInfo>(); port.getHotelInfoByCity(_getHotelInfoByCity_authentication, _getHotelInfoByCity_sCity, _getHotelInfoByCity_getHotelInfoByCityResult, _getHotelInfoByCity_lstHotelInfo); System.out.println("getHotelInfoByCity._getHotelInfoByCity_getHotelInfoByCityResult=" + _getHotelInfoByCity_getHotelInfoByCityResult.value); System.out.println("getHotelInfoByCity._getHotelInfoByCity_lstHotelInfo=" + _getHotelInfoByCity_lstHotelInfo.value); } { System.out.println("Invoking getCityArray..."); java.lang.String _getCityArray_authentication = "_getCityArray_authentication211154760"; com.zhihui.order.partner.plateno.service.chain.ArrayOfString _getCityArray_theCityArrayVal = new com.zhihui.order.partner.plateno.service.chain.ArrayOfString(); java.util.List<java.lang.String> _getCityArray_theCityArrayValString = new java.util.ArrayList<java.lang.String>(); java.lang.String _getCityArray_theCityArrayValStringVal1 = "_getCityArray_theCityArrayValStringVal744669337"; _getCityArray_theCityArrayValString.add(_getCityArray_theCityArrayValStringVal1); _getCityArray_theCityArrayVal.getString().addAll(_getCityArray_theCityArrayValString); javax.xml.ws.Holder<com.zhihui.order.partner.plateno.service.chain.ArrayOfString> _getCityArray_theCityArray = new javax.xml.ws.Holder<com.zhihui.order.partner.plateno.service.chain.ArrayOfString>(_getCityArray_theCityArrayVal); javax.xml.ws.Holder<java.lang.Integer> _getCityArray_getCityArrayResult = new javax.xml.ws.Holder<java.lang.Integer>(); port.getCityArray(_getCityArray_authentication, _getCityArray_theCityArray, _getCityArray_getCityArrayResult); System.out.println("getCityArray._getCityArray_theCityArray=" + _getCityArray_theCityArray.value); System.out.println("getCityArray._getCityArray_getCityArrayResult=" + _getCityArray_getCityArrayResult.value); } { System.out.println("Invoking getErrorExpression..."); int _getErrorExpression_nError = 984451850; java.lang.String _getErrorExpression_sErrMsgVal = "_getErrorExpression_sErrMsgVal1031659610"; javax.xml.ws.Holder<java.lang.String> _getErrorExpression_sErrMsg = new javax.xml.ws.Holder<java.lang.String>(_getErrorExpression_sErrMsgVal); javax.xml.ws.Holder<java.lang.Integer> _getErrorExpression_getErrorExpressionResult = new javax.xml.ws.Holder<java.lang.Integer>(); port.getErrorExpression(_getErrorExpression_nError, _getErrorExpression_sErrMsg, _getErrorExpression_getErrorExpressionResult); System.out.println("getErrorExpression._getErrorExpression_sErrMsg=" + _getErrorExpression_sErrMsg.value); System.out.println("getErrorExpression._getErrorExpression_getErrorExpressionResult=" + _getErrorExpression_getErrorExpressionResult.value); } System.exit(0); } }
[ "yongsheng_l@163.com" ]
yongsheng_l@163.com
241a88141b62ee150e404a74571e75f6ffd5ba9d
a0ffa812814f7afcf227c61edc11d301fcfec03e
/src/main/java/br/com/fatec/cinetech/dao/SalaDAO.java
5305add81c21616d90e5fd1403d2d2f8b1acb46d
[]
no_license
kailIII/cinetec
0459b95821d5826e4d94828e3b319f55bfb33f2f
801f52730a4e8347b08ac293097d1103d7a3746d
refs/heads/master
2021-01-21T18:15:15.229316
2014-11-05T17:38:57
2014-11-05T17:38:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
package br.com.fatec.cinetech.dao; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import br.com.fatec.cinetech.entity.Sala; import br.com.fatec.cinetech.entity.Usuario; @Service public class SalaDAO { @PersistenceContext private EntityManager manager; @Transactional public void adiciona(Sala sala) { manager.persist( sala); } @Transactional public void altera(Sala sala) { manager.merge(sala); } @Transactional public Sala buscaPorId(int id) { return manager.find(Sala.class, id); } @Transactional public void remove(Sala sala) { Sala salaRemove = buscaPorId(sala.getId_sala()); manager.remove(salaRemove); } @Transactional public List<Sala> getAll() { List<Sala> result = manager.createQuery("SELECT s FROM Sala s", Sala.class).getResultList(); return result; } }
[ "felipe.marquestech@gmail.com" ]
felipe.marquestech@gmail.com
487c00d9ceaa75c7fb6bb2eab362a4a20183fe80
95363120261ee38c64b5b3b34e3a216e72520118
/Java Design Pattern/ColaboratorDesignPatter.java
72a85dd02b17121dfa03392d05286eb8ccf84834
[]
no_license
ashu7249/projects
4bdd3424560c0b8d9b5f40bc1576805efacecea9
77fb06c41c1c72730b7f59f0e5921784478045f2
refs/heads/master
2022-11-23T20:29:38.880132
2020-07-22T12:47:43
2020-07-22T12:47:43
281,672,518
0
0
null
null
null
null
UTF-8
Java
false
false
818
java
package colaboratordesignpatter; import java.beans.Customizer; import java.time.LocalDate; import static colaboratordesignpatter.CombinatorInterface.*; /** * * @author Ashutosh Kedar */ public class ColaboratorDesignPatter { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Customer newCustomer = new Customer( "ashutosh@gmail.com", "9133683733", LocalDate.of(1999,2,15) ); Result custResult = isEmailValid() .and(isAdult()) .and(isPhoneValid()) .apply(newCustomer); System.out.println(custResult); } }
[ "noreply@github.com" ]
noreply@github.com
a956e1d8bce3deb6caff4419f4b87ea41e512950
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_3/src/b/c/h/e/Calc_1_3_12747.java
a77a78c09bb1fcdaff49a21b59a14931801e1fab
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package b.c.h.e; public class Calc_1_3_12747 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
[ "christian.halstrick@sap.com" ]
christian.halstrick@sap.com
8706fc2e638a84f5ec0e1d5a090bfa4cb5a4b343
df14909884ec25211f22cdebcc249ddb8cc76971
/src/it/caldesi/webbot/model/instruction/ForwardInstruction.java
0c5cfbfa37c77b95a0586fe9ad4ee2f4603d8856
[]
no_license
cdr89/web-bot
d7970ca0c37bcaddbad86357dfa5382c00f1af2d
12df3ba8d71d6339c582c20f4b09aff449f42247
refs/heads/master
2022-11-20T18:23:42.291223
2020-04-29T23:14:48
2020-04-29T23:14:48
129,635,880
0
0
null
2022-11-16T05:27:27
2018-04-15T17:51:24
Java
UTF-8
Java
false
false
898
java
package it.caldesi.webbot.model.instruction; import it.caldesi.webbot.context.ScriptExecutionContext; import it.caldesi.webbot.exception.GenericException; import it.caldesi.webbot.model.annotations.ArgumentType; import it.caldesi.webbot.model.annotations.ArgumentType.Type; import javafx.scene.web.WebHistory; import javafx.scene.web.WebView; @ArgumentType(type = Type.INTEGER, onlyPositive = true) public class ForwardInstruction extends PageInstruction { public static final String NAME = "forward"; public ForwardInstruction() { super(NAME); } @Override public Void execute(ScriptExecutionContext scriptExecutionContext, WebView webView) throws GenericException { final WebHistory history = webView.getEngine().getHistory(); try { int offset = Integer.parseInt(arg); history.go(offset); } catch (Exception e) { throw new GenericException(e); } return null; } }
[ "d.r.caldesi@gmail.com" ]
d.r.caldesi@gmail.com
5f288d46691d1168ecc7759ee9c2d08dc0115461
1a6e368d577e382f0556cadcd587bb52f71f1838
/app/src/main/java/com/hadimusthfa/prolog/MainActivity.java
52f5aad8de35a9fbdf4723e3c0a829875285dabc
[]
no_license
moonshadowbusinessgroup/SQLite-LogIn
70b9676f2c10cec789d29642264c9ac12e56da2f
913edacf76cd3bb5edd42c9d198d0462385505f8
refs/heads/master
2023-08-24T23:25:29.590603
2021-09-21T08:28:10
2021-09-21T08:28:10
408,742,853
0
0
null
null
null
null
UTF-8
Java
false
false
2,849
java
package com.hadimusthfa.prolog; import androidx.appcompat.app.AppCompatActivity; import androidx.cardview.widget.CardView; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import java.util.Timer; public class MainActivity extends AppCompatActivity { public static String USER_NAME = ""; EditText username, password; CardView signIn; TextView signUp, txtDont; DBHelper dbHelper; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); username = findViewById(R.id.username); password = findViewById(R.id.password); signIn = findViewById(R.id.signIn); signUp = findViewById(R.id.signUp); txtDont = findViewById(R.id.txtDont); dbHelper = new DBHelper(this); signIn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String usrnm = username.getText().toString().trim(); String pass = password.getText().toString().trim(); Boolean res = dbHelper.checkUser(usrnm, pass); if(usrnm.isEmpty()) { username.setError("User Name cannot be empty"); } else if(pass.isEmpty()) { password.setError("Password cannot be empty"); } if (res==true) { USER_NAME = usrnm; Toast.makeText(MainActivity.this, "Login successfully", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(MainActivity.this, Profile.class); startActivity(intent); finish(); } else { Toast.makeText(MainActivity.this,"Username or password is incorrect", Toast.LENGTH_SHORT).show(); } } }); signUp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SignUp.class); startActivity(intent); } }); txtDont.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, SignUp.class); startActivity(intent); } }); } }
[ "moonshadowbusinessgroup@gmail.com" ]
moonshadowbusinessgroup@gmail.com
69b1545b6bb69081c53b13675db2771ab735cbbb
08c5675ad0985859d12386ca3be0b1a84cc80a56
/src/main/java/javax/rmi/ssl/SslRMIClientSocketFactory.java
2ccbd9cff2ac6fdacf6ed6f6242258ef72e7ca27
[]
no_license
ytempest/jdk1.8-analysis
1e5ff386ed6849ea120f66ca14f1769a9603d5a7
73f029efce2b0c5eaf8fe08ee8e70136dcee14f7
refs/heads/master
2023-03-18T04:37:52.530208
2021-03-09T02:51:16
2021-03-09T02:51:16
345,863,779
0
0
null
null
null
null
UTF-8
Java
false
false
8,039
java
/* * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package javax.rmi.ssl; import java.io.IOException; import java.io.Serializable; import java.net.Socket; import java.rmi.server.RMIClientSocketFactory; import java.util.StringTokenizer; import javax.net.SocketFactory; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; /** * <p>An <code>SslRMIClientSocketFactory</code> instance is used by the RMI * runtime in order to obtain client sockets for RMI calls via SSL.</p> * * <p>This class implements <code>RMIClientSocketFactory</code> over * the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) * protocols.</p> * * <p>This class creates SSL sockets using the default * <code>SSLSocketFactory</code> (see {@link * SSLSocketFactory#getDefault}). All instances of this class are * functionally equivalent. In particular, they all share the same * truststore, and the same keystore when client authentication is * required by the server. This behavior can be modified in * subclasses by overriding the {@link #createSocket(String, int)} * method; in that case, {@link #equals(Object) equals} and {@link * #hashCode() hashCode} may also need to be overridden.</p> * * <p>If the system property * <code>javax.rmi.ssl.client.enabledCipherSuites</code> is specified, * the {@link #createSocket(String, int)} method will call {@link * SSLSocket#setEnabledCipherSuites(String[])} before returning the * socket. The value of this system property is a string that is a * comma-separated list of SSL/TLS cipher suites to enable.</p> * * <p>If the system property * <code>javax.rmi.ssl.client.enabledProtocols</code> is specified, * the {@link #createSocket(String, int)} method will call {@link * SSLSocket#setEnabledProtocols(String[])} before returning the * socket. The value of this system property is a string that is a * comma-separated list of SSL/TLS protocol versions to enable.</p> * * @see javax.net.ssl.SSLSocketFactory * @see javax.rmi.ssl.SslRMIServerSocketFactory * @since 1.5 */ public class SslRMIClientSocketFactory implements RMIClientSocketFactory, Serializable { /** * <p>Creates a new <code>SslRMIClientSocketFactory</code>.</p> */ public SslRMIClientSocketFactory() { // We don't force the initialization of the default SSLSocketFactory // at construction time - because the RMI client socket factory is // created on the server side, where that initialization is a priori // meaningless, unless both server and client run in the same JVM. // We could possibly override readObject() to force this initialization, // but it might not be a good idea to actually mix this with possible // deserialization problems. // So contrarily to what we do for the server side, the initialization // of the SSLSocketFactory will be delayed until the first time // createSocket() is called - note that the default SSLSocketFactory // might already have been initialized anyway if someone in the JVM // already called SSLSocketFactory.getDefault(). // } /** * <p>Creates an SSL socket.</p> * * <p>If the system property * <code>javax.rmi.ssl.client.enabledCipherSuites</code> is * specified, this method will call {@link * SSLSocket#setEnabledCipherSuites(String[])} before returning * the socket. The value of this system property is a string that * is a comma-separated list of SSL/TLS cipher suites to * enable.</p> * * <p>If the system property * <code>javax.rmi.ssl.client.enabledProtocols</code> is * specified, this method will call {@link * SSLSocket#setEnabledProtocols(String[])} before returning the * socket. The value of this system property is a string that is a * comma-separated list of SSL/TLS protocol versions to * enable.</p> */ public Socket createSocket(String host, int port) throws IOException { // Retrieve the SSLSocketFactory // final SocketFactory sslSocketFactory = getDefaultClientSocketFactory(); // Create the SSLSocket // final SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(host, port); // Set the SSLSocket Enabled Cipher Suites // final String enabledCipherSuites = System.getProperty("javax.rmi.ssl.client.enabledCipherSuites"); if (enabledCipherSuites != null) { StringTokenizer st = new StringTokenizer(enabledCipherSuites, ","); int tokens = st.countTokens(); String enabledCipherSuitesList[] = new String[tokens]; for (int i = 0; i < tokens; i++) { enabledCipherSuitesList[i] = st.nextToken(); } try { sslSocket.setEnabledCipherSuites(enabledCipherSuitesList); } catch (IllegalArgumentException e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } // Set the SSLSocket Enabled Protocols // final String enabledProtocols = System.getProperty("javax.rmi.ssl.client.enabledProtocols"); if (enabledProtocols != null) { StringTokenizer st = new StringTokenizer(enabledProtocols, ","); int tokens = st.countTokens(); String enabledProtocolsList[] = new String[tokens]; for (int i = 0; i < tokens; i++) { enabledProtocolsList[i] = st.nextToken(); } try { sslSocket.setEnabledProtocols(enabledProtocolsList); } catch (IllegalArgumentException e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } // Return the preconfigured SSLSocket // return sslSocket; } /** * <p>Indicates whether some other object is "equal to" this one.</p> * * <p>Because all instances of this class are functionally equivalent * (they all use the default * <code>SSLSocketFactory</code>), this method simply returns * <code>this.getClass().equals(obj.getClass())</code>.</p> * * <p>A subclass should override this method (as well * as {@link #hashCode()}) if its instances are not all * functionally equivalent.</p> */ public boolean equals(Object obj) { if (obj == null) return false; if (obj == this) return true; return this.getClass().equals(obj.getClass()); } /** * <p>Returns a hash code value for this * <code>SslRMIClientSocketFactory</code>.</p> * * @return a hash code value for this * <code>SslRMIClientSocketFactory</code>. */ public int hashCode() { return this.getClass().hashCode(); } // We use a static field because: // // SSLSocketFactory.getDefault() always returns the same object // (at least on Sun's implementation), and we want to make sure // that the Javadoc & the implementation stay in sync. // // If someone needs to have different SslRMIClientSocketFactory factories // with different underlying SSLSocketFactory objects using different key // and trust stores, he can always do so by subclassing this class and // overriding createSocket(String host, int port). // private static SocketFactory defaultSocketFactory = null; private static synchronized SocketFactory getDefaultClientSocketFactory() { if (defaultSocketFactory == null) defaultSocketFactory = SSLSocketFactory.getDefault(); return defaultSocketFactory; } private static final long serialVersionUID = -8310631444933958385L; }
[ "787491096@qq.com" ]
787491096@qq.com
0e983435d58d97790e2e9d0f57fc6808b38e2361
c6d238d00c9a084fba6e54833e37350d78728f6b
/src/main/java/br/com/covid19/model/District.java
8cae2a304d2830943ac1d55693f3deed7beca50d
[ "MIT" ]
permissive
GuilhermeGomes1929/Covid19API
6ede802dcc5c1ae20fc2ad2f9f225ca52becccdc
55ebfeaf1d336889855e96d77ceec74723714da9
refs/heads/main
2023-06-25T13:25:04.714197
2021-07-20T00:35:16
2021-07-20T00:35:16
377,904,224
0
0
MIT
2021-06-17T17:10:49
2021-06-17T17:01:32
null
UTF-8
Java
false
false
598
java
package br.com.covid19.model; import javax.persistence.*; @Entity public class District { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column private String name; public District(){} public District(Integer id, String name) { this.id = id; this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "guilherme_estudos@outlook.com" ]
guilherme_estudos@outlook.com
b14a616113dccc5d622ed364ba3ee0d2c169c233
de2a9cb0dadb4f4ad965ac9ada16c0e394f65eed
/demo/demo/src/main/java/com/example/demo/daoimpl/TeacherDaoImpl.java
dfb532e9396af93a565f81f366049a5ef0f321f7
[]
no_license
graduationdesign2020/graduationdesign
4eb792c5749763da066840dc8172ab0eec3054e0
a529b78dfc8a5aa90dc0fceb76aced4e4d9d2392
refs/heads/master
2022-12-13T04:23:17.781379
2020-09-08T09:48:05
2020-09-08T09:48:05
277,453,581
0
0
null
null
null
null
UTF-8
Java
false
false
671
java
package com.example.demo.daoimpl; import com.example.demo.dao.TeacherDao; import com.example.demo.entity.Teacher; import com.example.demo.repository.TeacherRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository public class TeacherDaoImpl implements TeacherDao { @Autowired private TeacherRepository teacherRepository; @Override public Teacher getTeacherById(String id){ return teacherRepository.getOne(id); } @Override public Teacher getTeacherByIdAndName(String id,String name){ return teacherRepository.getByIdAndName(id, name); } }
[ "riken01@sjtu.edu.cn" ]
riken01@sjtu.edu.cn
78ae598bacd6d38a7765ceaa3517094c431f3e08
54ecd26e908ce25b87581f2e33364be1681b54dc
/src/main/java/com/design/behavioralModel/template/Teacher.java
dbf08afcff36029496ade920c9a6da89749b7592
[]
no_license
Coderxf/designmodel
45f9747f5b80071fabb7d4f1aaf6d3ac43ff7a29
b0b1711d084825012e995686ed36dd1fb9bc517f
refs/heads/master
2022-12-27T12:15:52.006209
2020-07-16T16:39:38
2020-07-16T16:39:38
255,671,393
1
0
null
2020-10-13T21:11:32
2020-04-14T17:02:00
Java
UTF-8
Java
false
false
424
java
package com.design.behavioralModel.template; public class Teacher extends AbstractPerson{ @Override protected void dressUp() { System.out.println("穿工作服"); } @Override protected void eatBreakfast() { System.out.println("做早饭,照顾孩子吃早饭"); } @Override protected void takeThings() { System.out.println("带上昨晚准备的考卷"); } }
[ "gl853211@gmail.com" ]
gl853211@gmail.com
545812bde6cce2e59fc38b5dcc5741efee5f01ce
928907bf328138110c85e0124973d8a15830018f
/src/main/java/com/heitian/ssm/model/Product.java
5d3f648209db7b4245f4574c0780fa815f6924e5
[]
no_license
wannasmile/Path_palnning
01fecb56cb612a4291056ac24d9d61a9abaec847
8527788500daef85246dd98dd36c6e713bb63d41
refs/heads/master
2021-04-27T00:25:01.015956
2018-01-19T09:47:36
2018-01-19T09:47:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,739
java
package com.heitian.ssm.model; public class Product { private Long id; private String name; private String type; private Long money; private String color; private String efficiency; private Double weight; private Double weight2; private Double maoweight; private Double maoweight2; private Double sizechang; private Double sizekuan; private Double sizegao; private Double size2chang; private Long size2kuan; private Long size2gao; private Double volume; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Long getMoney() { return money; } public void setMoney(Long money) { this.money = money; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public String getEfficiency() { return efficiency; } public void setEfficiency(String efficiency) { this.efficiency = efficiency; } public Double getWeight() { return weight; } public void setWeight(Double weight) { this.weight = weight; } public Double getWeight2() { return weight2; } public void setWeight2(Double weight2) { this.weight2 = weight2; } public Double getMaoweight() { return maoweight; } public void setMaoweight(Double maoweight) { this.maoweight = maoweight; } public Double getMaoweight2() { return maoweight2; } public void setMaoweight2(Double maoweight2) { this.maoweight2 = maoweight2; } public Double getSizechang() { return sizechang; } public void setSizechang(Double sizechang) { this.sizechang = sizechang; } public Double getSizekuan() { return sizekuan; } public void setSizekuan(Double sizekuan) { this.sizekuan = sizekuan; } public Double getSizegao() { return sizegao; } public void setSizegao(Double sizegao) { this.sizegao = sizegao; } public Double getsize2chang() { return size2chang; } public void setsize2chang(Double size2chang) { this.size2chang = size2chang; } public Long getsize2kuan() { return size2kuan; } public void setsize2kuan(Long size2kuan) { this.size2kuan = size2kuan; } public Long getsize2gao() { return size2gao; } public void setsize2gao(Long size2gao) { this.size2gao = size2gao; } public Double getVolume() { return volume; } public void setVolume(Double volume) { this.volume = volume; } }
[ "noreply@github.com" ]
noreply@github.com
4fbfba3de7d95eb9cfad4ee3ca33fc824e9d6a3a
522e4a0b3de0cf9ea1b5b51593a81580e3746d53
/build/generated-sources/ap-source-output/servicios/Hidrantes_.java
9e20f130b54c51e0de145d0b330eaf4e3e7dfec7
[]
no_license
daniel92ec/hidrantesWebService
abe3c5fd97c99d7bbd1e303be76593102de9a5c5
319b69aa41270067d19bc6cd6f1e72f7d57f0f3c
refs/heads/master
2020-04-24T10:16:11.212372
2019-02-28T13:40:10
2019-02-28T13:40:10
171,888,284
0
0
null
null
null
null
UTF-8
Java
false
false
712
java
package servicios; import java.math.BigDecimal; import javax.annotation.Generated; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.StaticMetamodel; @Generated(value="EclipseLink-2.5.2.v20140319-rNA", date="2019-02-28T08:21:09") @StaticMetamodel(Hidrantes.class) public class Hidrantes_ { public static volatile SingularAttribute<Hidrantes, String> principal; public static volatile SingularAttribute<Hidrantes, BigDecimal> latitud; public static volatile SingularAttribute<Hidrantes, BigDecimal> longitud; public static volatile SingularAttribute<Hidrantes, Integer> id; public static volatile SingularAttribute<Hidrantes, String> interseccion; }
[ "shwang@bomberosquito.gob.ec" ]
shwang@bomberosquito.gob.ec
3426b6b1fcc5def37fb6a7a318873466e6f39ca2
bea2cef2df3786f22a9253e24d96b035623b44d8
/glmall-member/src/test/java/com/luoben/glmall/member/GlmallMemberApplicationTests.java
59da14ce8704c35f136cb90fb39ad920e44a20b2
[ "Apache-2.0" ]
permissive
DCSIR/gulimall
3a69f0209a525761992c0b939cd687300be54e82
401198fe148d3e7f4f271b1039abc4247dafcaa7
refs/heads/master
2022-11-08T21:47:19.879380
2020-06-30T02:54:17
2020-06-30T02:54:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
231
java
package com.luoben.glmall.member; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class GlmallMemberApplicationTests { @Test void contextLoads() { } }
[ "315523376@qq.com" ]
315523376@qq.com
f8c4fef5c75e50d340b73f5f2a99cfeb29bc8e45
9bd976ffebc68abe381b35c12e12a3124c024fec
/src/test/java/com/smartisenproject/web/rest/errors/ExceptionTranslatorTestController.java
d6b7c33c6d4d04541d53a73224656ba03439e059
[]
no_license
gramanah/SmartIsenProjectV2
48bfcecbbaa887a2d3d420b9fc1fb6f51cd58454
d1046fe278797c0993fb05eca16d4f476797bd60
refs/heads/master
2020-03-19T06:28:22.630004
2018-06-05T11:17:03
2018-06-05T11:17:03
136,023,516
0
0
null
2018-06-05T11:17:04
2018-06-04T12:42:52
Java
UTF-8
Java
false
false
2,986
java
package com.smartisenproject.web.rest.errors; import org.springframework.dao.ConcurrencyFailureException; import org.springframework.http.HttpStatus; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.support.MissingServletRequestPartException; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.HashMap; import java.util.Map; @RestController public class ExceptionTranslatorTestController { @GetMapping("/test/concurrency-failure") public void concurrencyFailure() { throw new ConcurrencyFailureException("test concurrency failure"); } @PostMapping("/test/method-argument") public void methodArgument(@Valid @RequestBody TestDTO testDTO) { } @GetMapping("/test/parameterized-error") public void parameterizedError() { throw new CustomParameterizedException("test parameterized error", "param0_value", "param1_value"); } @GetMapping("/test/parameterized-error2") public void parameterizedError2() { Map<String, Object> params = new HashMap<>(); params.put("foo", "foo_value"); params.put("bar", "bar_value"); throw new CustomParameterizedException("test parameterized error", params); } @GetMapping("/test/missing-servlet-request-part") public void missingServletRequestPartException() throws Exception { throw new MissingServletRequestPartException("missing Servlet request part"); } @GetMapping("/test/missing-servlet-request-parameter") public void missingServletRequestParameterException() throws Exception { throw new MissingServletRequestParameterException("missing Servlet request parameter", "parameter type"); } @GetMapping("/test/access-denied") public void accessdenied() { throw new AccessDeniedException("test access denied!"); } @GetMapping("/test/unauthorized") public void unauthorized() { throw new BadCredentialsException("test authentication failed!"); } @GetMapping("/test/response-status") public void exceptionWithReponseStatus() { throw new TestResponseStatusException(); } @GetMapping("/test/internal-server-error") public void internalServerError() { throw new RuntimeException(); } public static class TestDTO { @NotNull private String test; public String getTest() { return test; } public void setTest(String test) { this.test = test; } } @ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "test response status") @SuppressWarnings("serial") public static class TestResponseStatusException extends RuntimeException { } }
[ "gaetan.ramanah@isen.yncrea.fr" ]
gaetan.ramanah@isen.yncrea.fr
d5fa4b502a279be6cf414e3aa580fda88822481f
ae6aa99adff0552ea01662cfb5f890b6b8a3f1d2
/src/main/java/org/cboard/saiku/SaikuDataProvider.java
b6e94d218fd268242ef0a2a78f8be5f782ecb389
[ "Apache-2.0" ]
permissive
blackoon/cboard0.4
d3a95e34f6f9a60b8e0c169c911c50046cfe1903
55f92c100a18b2d23e8e4629d8d7ebb5d7154de5
refs/heads/master
2020-04-10T16:07:16.121140
2018-01-17T10:19:51
2018-01-17T10:19:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,175
java
package org.cboard.saiku; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.cboard.dataprovider.DataProvider; import org.cboard.dataprovider.annotation.DatasourceParameter; import org.cboard.dataprovider.annotation.ProviderName; import org.cboard.dataprovider.annotation.QueryParameter; import com.google.common.base.Joiner; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import java.util.Map; import java.util.UUID; /** * Created by yfyuan on 2016/8/15. */ @ProviderName(name = "saiku") public class SaikuDataProvider extends DataProvider { @DatasourceParameter(label = "Saiku Server (http://domain:port)", type = DatasourceParameter.Type.Input, order = 1) private String SERVERIP = "serverIp"; @DatasourceParameter(label = "User Name (for Saiku Server)", type = DatasourceParameter.Type.Input, order = 2) private String USERNAME = "username"; @DatasourceParameter(label = "Password", type = DatasourceParameter.Type.Password, order = 3) private String PASSWORD = "password"; @QueryParameter(label = "Repo Path of Report", type = QueryParameter.Type.Input) private String FILE = "file"; @Override public boolean doAggregationInDataSource() { return false; } @Override public String[][] getData() throws Exception { String serverIp = dataSource.get(SERVERIP); String username = dataSource.get(USERNAME); String password = dataSource.get(PASSWORD); String file = query.get(FILE); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> a = restTemplate.postForEntity(serverIp + "/saiku/rest/saiku/session?username={username}&password={password}", null, String.class, username, password); HttpHeaders headers = new HttpHeaders(); headers.set("Cookie", Joiner.on(";").join(a.getHeaders().get("Set-Cookie"))); String uuid = UUID.randomUUID().toString(); restTemplate.exchange(serverIp + "/saiku/rest/saiku/api/query/{id}?file={file}&formatter={formatter}&type={type}", HttpMethod.POST, new HttpEntity<>(headers), String.class, uuid, file, "flattened", "QM"); a = restTemplate.exchange(serverIp + "/saiku/rest/saiku/api/query/{id}/result/flattened", HttpMethod.GET, new HttpEntity<>(headers), String.class, uuid); JSONObject jsonObject = JSONObject.parseObject(new String(a.getBody().getBytes("ISO8859-1"), "UTF-8")); JSONArray array = jsonObject.getJSONArray("cellset"); String[] columnHeader = new String[jsonObject.getInteger("width")]; int i; for (i = 0; i < array.size(); i++) { JSONArray cols = array.getJSONArray(i); if ("ROW_HEADER".equals(cols.getJSONObject(0).get("type"))) { break; } else { for (int j = 0; j < cols.size(); j++) { String value = cols.getJSONObject(j).getString("value"); if (columnHeader[j] == null) { columnHeader[j] = value.equals("null") ? "" : value; } else { columnHeader[j] += value.equals("null") ? "" : value; } } } } String[][] result = new String[jsonObject.getInteger("height") - (i - 1)][jsonObject.getInteger("width")]; result[0] = columnHeader; String[] rowHeader = new String[jsonObject.getInteger("width")]; for (int j = i; j < array.size(); j++) { JSONArray cols = array.getJSONArray(j); for (int k = 0; k < cols.size(); k++) { if ("DATA_CELL".equals(cols.getJSONObject(k).getString("type"))) { String raw = cols.getJSONObject(k).getJSONObject("properties").getString("raw"); if (NumberUtils.isNumber(raw)) { result[j - i + 1][k] = raw; } else { result[j - i + 1][k] = "0"; } } else { String v = cols.getJSONObject(k).getString("value"); if (!"null".equals(v)) { result[j - i + 1][k] = cols.getJSONObject(k).getString("value"); rowHeader[k] = cols.getJSONObject(k).getString("value"); } else { result[j - i + 1][k] = rowHeader[k]; } } } } return result; } @Override public int resultCount(Map<String, String> dataSource, Map<String, String> query) throws Exception { return 0; } public String[][] getData(Map<String, String> dataSource, Map<String, String> query) throws Exception { String serverIp = dataSource.get(SERVERIP); String username = dataSource.get(USERNAME); String password = dataSource.get(PASSWORD); String file = query.get(FILE); RestTemplate restTemplate = new RestTemplate(); ResponseEntity<String> a = restTemplate.postForEntity(serverIp + "/saiku/rest/saiku/session?username={username}&password={password}", null, String.class, username, password); HttpHeaders headers = new HttpHeaders(); headers.set("Cookie", Joiner.on(";").join(a.getHeaders().get("Set-Cookie"))); String uuid = UUID.randomUUID().toString(); restTemplate.exchange(serverIp + "/saiku/rest/saiku/api/query/{id}?file={file}&formatter={formatter}&type={type}", HttpMethod.POST, new HttpEntity<>(headers), String.class, uuid, file, "flattened", "QM"); a = restTemplate.exchange(serverIp + "/saiku/rest/saiku/api/query/{id}/result/flattened", HttpMethod.GET, new HttpEntity<>(headers), String.class, uuid); JSONObject jsonObject = JSONObject.parseObject(new String(a.getBody().getBytes("ISO8859-1"), "UTF-8")); JSONArray array = jsonObject.getJSONArray("cellset"); String[] columnHeader = new String[jsonObject.getInteger("width")]; int i; for (i = 0; i < array.size(); i++) { JSONArray cols = array.getJSONArray(i); if ("ROW_HEADER".equals(cols.getJSONObject(0).get("type"))) { break; } else { for (int j = 0; j < cols.size(); j++) { String value = cols.getJSONObject(j).getString("value"); if (columnHeader[j] == null) { columnHeader[j] = value.equals("null") ? "" : value; } else { columnHeader[j] += value.equals("null") ? "" : value; } } } } String[][] result = new String[jsonObject.getInteger("height") - (i - 1)][jsonObject.getInteger("width")]; result[0] = columnHeader; String[] rowHeader = new String[jsonObject.getInteger("width")]; for (int j = i; j < array.size(); j++) { JSONArray cols = array.getJSONArray(j); for (int k = 0; k < cols.size(); k++) { if ("DATA_CELL".equals(cols.getJSONObject(k).getString("type"))) { String raw = cols.getJSONObject(k).getJSONObject("properties").getString("raw"); if (NumberUtils.isNumber(raw)) { result[j - i + 1][k] = raw; } else { result[j - i + 1][k] = "0"; } } else { String v = cols.getJSONObject(k).getString("value"); if (!"null".equals(v)) { result[j - i + 1][k] = cols.getJSONObject(k).getString("value"); rowHeader[k] = cols.getJSONObject(k).getString("value"); } else { result[j - i + 1][k] = rowHeader[k]; } } } } return result; } }
[ "392241868@qq.com" ]
392241868@qq.com
c34228be4761c945e702e2f90214b5be7ebd39cc
ce2813f714d83602ee9b3b237c7304446ae741da
/src/LINTCODE19/LINTCODE1857.java
b131de9401f24478ad46ff535af19ef73aad9f25
[]
no_license
tmhbatw/LINTCODEANSWER
bc54bb40a4826b0f9aa11aead4d99978a22e1ee8
7db879f075cde6e1b2fce86f6a3068e59f4e9b34
refs/heads/master
2021-12-13T16:38:05.780408
2021-10-09T16:50:59
2021-10-09T16:50:59
187,010,547
2
0
null
null
null
null
UTF-8
Java
false
false
1,293
java
package LINTCODE19; public class LINTCODE1857 { /*Description * 班上有 N 名学生。其中有些人是朋友,有些则不是。他们的友谊具有是传递性。如果已知 A 是 B 的朋友,B 是 C 的朋友,那么我们可以认为 A 也是 C 的朋友。所谓的朋友圈,是指所有朋友的集合。 * 给定一个 N * N 的矩阵 M,表示班级中学生之间的朋友关系。如果M[i][j] = 1,表示已知第 i 个和 j 个学生互为朋友关系,否则为不知道。你必须输出所有学生中的已知的朋友圈总数。 * */ public int findCircleNum(int[][] M) { int number=M.length; int[] dp=new int[number]; for(int i=0;i<dp.length;i++) dp[i]=i; int time=number; for(int i=0;i<number;i++){ for(int j=i+1;j<number;j++){ if(M[i][j]==1){ if(getType(dp,i)!=getType(dp,j)){ time--; dp[getType(dp,j)]=getType(dp,i); } } } } return time; // write your code here } private int getType(int[] dp,int index){ if(dp[index]!=index) return getType(dp,dp[index]); return index; } }
[ "1060226998@qq.com" ]
1060226998@qq.com
7be4d568671e11fe4de645363ea6244dcc085a68
025627c594ebcef00509e6fab45d7a640899ad96
/slogo/src/util/parser/AbstractParserRule.java
31e93a812757a9708fab6ba844824accead3d771
[]
no_license
michaelansel/slogo-team1-dukecs108
a1627329caa1f3deb0ff5c1fe61e39483347592e
651e0b2683617fb27b8f89a6f9627c39e8c9db50
refs/heads/master
2016-09-05T15:16:38.153741
2011-03-22T05:13:18
2011-03-22T05:13:18
38,788,078
0
0
null
null
null
null
UTF-8
Java
false
false
2,250
java
/** * */ package util.parser; import java.util.logging.Level; import java.util.logging.Logger; /** * @author Michael Ansel */ public abstract class AbstractParserRule { protected Logger logger = Logger.getLogger(AbstractParserRule.class.getName()); private IResultHandler myResultHandler = null; private AbstractParserRule myRule = null; private String myRuleName = "?"; public ParserResult evaluate (TokenManager tokenManager) throws ParserException { if (!initialized()) throw new RuntimeException("Uninitialized Rule: " + toString()); return processResult(myRule.evaluate(tokenManager)); } public AbstractParserRule getRule () { return myRule; } public boolean initialized () { return myRule != null; } public void initializeRule () { if (initialized()) return; throw new UnsupportedOperationException("Abstract implementation not overridden"); } protected void matchFailed (String message) throws MatchFailedException { if (!message.isEmpty()) message += "\n"; logger.log(Level.FINEST, "Match Failed: {0}", message); throw new MatchFailedException(message); } protected void parseError (String message) throws ParserException { if (!message.isEmpty()) message += "\n"; logger.log(Level.WARNING, "Parse Error: {0}", message); throw new ParserException(message); } protected ParserResult processResult (ParserResult result) throws ParserException { if (myResultHandler != null) return myResultHandler.handleResult(result); return result; } public void setHandler (IResultHandler handler) { myResultHandler = handler; } public void setRule (AbstractParserRule rule) { myRule = rule; } public void setRuleName (String ruleName) { myRuleName = ruleName; } @Override public String toString () { return "AbstractParserRule<" + myRuleName + ">"; } }
[ "michaelansel@users.noreply.github.com" ]
michaelansel@users.noreply.github.com
e2ed4f633e6c354e7d99d76ce489ac5425bf430a
89da9324c96b4f56bd5fd16fe0e68791d7e00a90
/HW8/src/model/College.java
b0eb6dc5e586f62294e40d0761936a845fe09bd0
[]
no_license
jacksonludwig/CSE148
8d35fa1b5ff802232cd7789a5fb3301b3ef213c9
ae2595d1c3e9951e5742113b3f0e921d92a378d6
refs/heads/master
2022-01-09T19:11:09.152046
2019-04-29T23:00:07
2019-04-29T23:00:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,785
java
package model; import java.io.Serializable; import utilities.Utilities; // TO BE FINISHED IN HW9 public class College implements Serializable { private PersonBag personBag; private ClassroomBag classroomBag; private TextbookBag textbookBag; private CourseBag courseBag; private static final int PERSON_BAG_SIZE = 2010; private static final int CLASSROOM_BAG_SIZE = 250; private static final int TEXTBOOK_BAG_SIZE = 300; private static final int COURSE_BAG_SIZE = 250; public College() { super(); this.personBag = new PersonBag(PERSON_BAG_SIZE); this.classroomBag = new ClassroomBag(CLASSROOM_BAG_SIZE); this.textbookBag = new TextbookBag(TEXTBOOK_BAG_SIZE); this.courseBag = new CourseBag(COURSE_BAG_SIZE); Utilities.load(this); } public College(PersonBag people, ClassroomBag classrooms, TextbookBag textbooks, CourseBag courses) { super(); this.personBag = people; this.classroomBag = classrooms; this.textbookBag = textbooks; this.courseBag = courses; } public PersonBag getPersonBag() { return personBag; } public ClassroomBag getClassroomBag() { return classroomBag; } public TextbookBag getTextbookBag() { return textbookBag; } public CourseBag getCourseBag() { return courseBag; } public void setPersonBag(PersonBag personBag) { this.personBag = personBag; } public void setClassroomBag(ClassroomBag classroomBag) { this.classroomBag = classroomBag; } public void setTextbookBag(TextbookBag textbookBag) { this.textbookBag = textbookBag; } public void setCourseBag(CourseBag courseBag) { this.courseBag = courseBag; } @Override public String toString() { return "person=" + personBag + ", classroomBag=" + classroomBag + ", textbookBag=" + textbookBag + ", courseBag=" + courseBag; } }
[ "ludwj61@mail.sunysuffolk.edu" ]
ludwj61@mail.sunysuffolk.edu
23814fd371a9b2d51c2f1af52eccb32d8229e100
e4bde7dfa05826779f220a68b8fec5edc49c4825
/cloud.demo.order/src/main/java/com/zhuduan/cloud/demo/order/feign/CommodityService.java
726e2dc742d5185bd1b9de428fb169a5e35005ed
[]
no_license
zhuduan/spring-cloud-demo
3890a2658719b1122636e42b74cdca7921dbf339
4664228bc87cfc9de7b1b2117f26eceefe77e2cc
refs/heads/master
2020-04-25T03:16:14.237573
2019-03-06T09:32:35
2019-03-06T09:32:35
172,469,801
0
0
null
null
null
null
UTF-8
Java
false
false
606
java
package com.zhuduan.cloud.demo.order.feign; import com.zhuduan.cloud.demo.order.feign.hystrix.CommodityServiceHystrix; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; /** * remote detail service * * @author Haifeng.Zhu * created at 2/26/19 */ @FeignClient(name = "commodity", fallback = CommodityServiceHystrix.class) public interface CommodityService { @RequestMapping(value = "/detail/{id}") public String getDetail(@PathVariable(value = "id") Long id); }
[ "Haifeng.Zhu@activenetwork.com" ]
Haifeng.Zhu@activenetwork.com
1c89458ef643dea05d8e8936953f6151da6b012d
f06a9a4845860497727c1835f4bef7a8f693d6f2
/spring-boot-demo-hwx-rabbitmq/src/main/java/com/xkcoding/mq/rabbitmq/consumer/Fanout_ReceiverA.java
171bd07efa3425161562555494a68f5ec53f20db
[ "MIT" ]
permissive
qqqqqqs128/spring-boot-demo
74b01749958dd19397d604d066b38097c5df3508
2655fba4cae7e21643eabb4de282cd77c15661db
refs/heads/master
2022-12-15T06:39:20.214466
2020-08-16T03:56:45
2020-08-16T03:56:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
476
java
package com.xkcoding.mq.rabbitmq.consumer; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; /** * @author hwx * @date 2020/4/13 */ @Component @RabbitListener(queues = "q_fanout_A") public class Fanout_ReceiverA { @RabbitHandler public void process(String hello) { System.out.println("AReceiver : " + hello + "/n"); } }
[ "hewenxiang@81cuiba.com" ]
hewenxiang@81cuiba.com
9b8618bf9cc833b94c7b781ef2895299e159d410
f5982dc7a6b337226cfb95f466c15cf278cf25a4
/mobile-webapp/src/main/java/com/iask/red_envelope/model/vo/LoginUserInfo.java
a578279ff0f67fbf879d732912a2294bbc81e8e7
[]
no_license
janforp/red-envelope-webapp
e701fd5fb5fbabfe95cccc65aa175236df7b9444
af4235f368062dac80c1131179eb9c9412389840
refs/heads/master
2021-08-07T21:23:19.330699
2017-11-09T00:59:06
2017-11-09T00:59:06
110,049,101
1
1
null
null
null
null
UTF-8
Java
false
false
983
java
package com.iask.red_envelope.model.vo; import java.io.Serializable; /** * Created by wuqiang on 16-2-22. * * @author wuqiang */ public class LoginUserInfo implements Serializable { // 用户状态,非空,默认1(有效);0:封号;1:有效; private Integer userStatus; //用户ID private Long userId; //意义等同于user_id,唯一,且一定不会发生改变,目前将会用在二维码上,意义类似与老师无忧App af_user.open_id private String afOpenId; public Integer getUserStatus() { return userStatus; } public void setUserStatus(Integer userStatus) { this.userStatus = userStatus; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getAfOpenId() { return afOpenId; } public void setAfOpenId(String afOpenId) { this.afOpenId = afOpenId; } }
[ "zcj880902" ]
zcj880902
3fac26ed76437d095a7e8238e77aa9f35c05b03f
411e9b935c3138660ff8fe91efb57aac922ecc90
/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/codesystems/Teeth.java
b9d36cbe4a234c7456f748e806750abb4fdb231a
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
pobedite/hapi-fhir
6591f9004f4bd6b59491026d4db6440e20223072
223df60c1d0ad5683b62a801bebf3b3a793e5335
refs/heads/master
2020-06-09T12:59:04.666298
2016-12-08T15:50:42
2016-12-08T15:50:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,643
java
package org.hl7.fhir.dstu3.model.codesystems; /* Copyright (c) 2011+, HL7, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of HL7 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ // Generated on Sat, Nov 5, 2016 08:41-0400 for FHIR v1.7.0 import org.hl7.fhir.exceptions.FHIRException; public enum Teeth { /** * Upper Right Tooth 1 from the central axis, permanent dentition. */ _11, /** * Upper Right Tooth 2 from the central axis, permanent dentition. */ _12, /** * Upper Right Tooth 3 from the central axis, permanent dentition. */ _13, /** * Upper Right Tooth 4 from the central axis, permanent dentition. */ _14, /** * Upper Right Tooth 5 from the central axis, permanent dentition. */ _15, /** * Upper Right Tooth 6 from the central axis, permanent dentition. */ _16, /** * Upper Right Tooth 7 from the central axis, permanent dentition. */ _17, /** * Upper Right Tooth 8 from the central axis, permanent dentition. */ _18, /** * Upper Left Tooth 1 from the central axis, permanent dentition. */ _21, /** * Upper Left Tooth 2 from the central axis, permanent dentition. */ _22, /** * Upper Left Tooth 3 from the central axis, permanent dentition. */ _23, /** * Upper Left Tooth 4 from the central axis, permanent dentition. */ _24, /** * Upper Left Tooth 5 from the central axis, permanent dentition. */ _25, /** * Upper Left Tooth 6 from the central axis, permanent dentition. */ _26, /** * Upper Left Tooth 7 from the central axis, permanent dentition. */ _27, /** * Upper Left Tooth 8 from the central axis, permanent dentition. */ _28, /** * Lower Left Tooth 1 from the central axis, permanent dentition. */ _31, /** * Lower Left Tooth 2 from the central axis, permanent dentition. */ _32, /** * Lower Left Tooth 3 from the central axis, permanent dentition. */ _33, /** * Lower Left Tooth 4 from the central axis, permanent dentition. */ _34, /** * Lower Left Tooth 5 from the central axis, permanent dentition. */ _35, /** * Lower Left Tooth 6 from the central axis, permanent dentition. */ _36, /** * Lower Left Tooth 7 from the central axis, permanent dentition. */ _37, /** * Lower Left Tooth 8 from the central axis, permanent dentition. */ _38, /** * Lower Right Tooth 1 from the central axis, permanent dentition. */ _41, /** * Lower Right Tooth 2 from the central axis, permanent dentition. */ _42, /** * Lower Right Tooth 3 from the central axis, permanent dentition. */ _43, /** * Lower Right Tooth 4 from the central axis, permanent dentition. */ _44, /** * Lower Right Tooth 5 from the central axis, permanent dentition. */ _45, /** * Lower Right Tooth 6 from the central axis, permanent dentition. */ _46, /** * Lower Right Tooth 7 from the central axis, permanent dentition. */ _47, /** * Lower Right Tooth 8 from the central axis, permanent dentition. */ _48, /** * added to help the parsers */ NULL; public static Teeth fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) return null; if ("11".equals(codeString)) return _11; if ("12".equals(codeString)) return _12; if ("13".equals(codeString)) return _13; if ("14".equals(codeString)) return _14; if ("15".equals(codeString)) return _15; if ("16".equals(codeString)) return _16; if ("17".equals(codeString)) return _17; if ("18".equals(codeString)) return _18; if ("21".equals(codeString)) return _21; if ("22".equals(codeString)) return _22; if ("23".equals(codeString)) return _23; if ("24".equals(codeString)) return _24; if ("25".equals(codeString)) return _25; if ("26".equals(codeString)) return _26; if ("27".equals(codeString)) return _27; if ("28".equals(codeString)) return _28; if ("31".equals(codeString)) return _31; if ("32".equals(codeString)) return _32; if ("33".equals(codeString)) return _33; if ("34".equals(codeString)) return _34; if ("35".equals(codeString)) return _35; if ("36".equals(codeString)) return _36; if ("37".equals(codeString)) return _37; if ("38".equals(codeString)) return _38; if ("41".equals(codeString)) return _41; if ("42".equals(codeString)) return _42; if ("43".equals(codeString)) return _43; if ("44".equals(codeString)) return _44; if ("45".equals(codeString)) return _45; if ("46".equals(codeString)) return _46; if ("47".equals(codeString)) return _47; if ("48".equals(codeString)) return _48; throw new FHIRException("Unknown Teeth code '"+codeString+"'"); } public String toCode() { switch (this) { case _11: return "11"; case _12: return "12"; case _13: return "13"; case _14: return "14"; case _15: return "15"; case _16: return "16"; case _17: return "17"; case _18: return "18"; case _21: return "21"; case _22: return "22"; case _23: return "23"; case _24: return "24"; case _25: return "25"; case _26: return "26"; case _27: return "27"; case _28: return "28"; case _31: return "31"; case _32: return "32"; case _33: return "33"; case _34: return "34"; case _35: return "35"; case _36: return "36"; case _37: return "37"; case _38: return "38"; case _41: return "41"; case _42: return "42"; case _43: return "43"; case _44: return "44"; case _45: return "45"; case _46: return "46"; case _47: return "47"; case _48: return "48"; default: return "?"; } } public String getSystem() { return "http://hl7.org/fhir/ex-fdi"; } public String getDefinition() { switch (this) { case _11: return "Upper Right Tooth 1 from the central axis, permanent dentition."; case _12: return "Upper Right Tooth 2 from the central axis, permanent dentition."; case _13: return "Upper Right Tooth 3 from the central axis, permanent dentition."; case _14: return "Upper Right Tooth 4 from the central axis, permanent dentition."; case _15: return "Upper Right Tooth 5 from the central axis, permanent dentition."; case _16: return "Upper Right Tooth 6 from the central axis, permanent dentition."; case _17: return "Upper Right Tooth 7 from the central axis, permanent dentition."; case _18: return "Upper Right Tooth 8 from the central axis, permanent dentition."; case _21: return "Upper Left Tooth 1 from the central axis, permanent dentition."; case _22: return "Upper Left Tooth 2 from the central axis, permanent dentition."; case _23: return "Upper Left Tooth 3 from the central axis, permanent dentition."; case _24: return "Upper Left Tooth 4 from the central axis, permanent dentition."; case _25: return "Upper Left Tooth 5 from the central axis, permanent dentition."; case _26: return "Upper Left Tooth 6 from the central axis, permanent dentition."; case _27: return "Upper Left Tooth 7 from the central axis, permanent dentition."; case _28: return "Upper Left Tooth 8 from the central axis, permanent dentition."; case _31: return "Lower Left Tooth 1 from the central axis, permanent dentition."; case _32: return "Lower Left Tooth 2 from the central axis, permanent dentition."; case _33: return "Lower Left Tooth 3 from the central axis, permanent dentition."; case _34: return "Lower Left Tooth 4 from the central axis, permanent dentition."; case _35: return "Lower Left Tooth 5 from the central axis, permanent dentition."; case _36: return "Lower Left Tooth 6 from the central axis, permanent dentition."; case _37: return "Lower Left Tooth 7 from the central axis, permanent dentition."; case _38: return "Lower Left Tooth 8 from the central axis, permanent dentition."; case _41: return "Lower Right Tooth 1 from the central axis, permanent dentition."; case _42: return "Lower Right Tooth 2 from the central axis, permanent dentition."; case _43: return "Lower Right Tooth 3 from the central axis, permanent dentition."; case _44: return "Lower Right Tooth 4 from the central axis, permanent dentition."; case _45: return "Lower Right Tooth 5 from the central axis, permanent dentition."; case _46: return "Lower Right Tooth 6 from the central axis, permanent dentition."; case _47: return "Lower Right Tooth 7 from the central axis, permanent dentition."; case _48: return "Lower Right Tooth 8 from the central axis, permanent dentition."; default: return "?"; } } public String getDisplay() { switch (this) { case _11: return "11"; case _12: return "12"; case _13: return "13"; case _14: return "14"; case _15: return "15"; case _16: return "16"; case _17: return "17"; case _18: return "18"; case _21: return "21"; case _22: return "22"; case _23: return "23"; case _24: return "24"; case _25: return "25"; case _26: return "26"; case _27: return "27"; case _28: return "28"; case _31: return "31"; case _32: return "32"; case _33: return "33"; case _34: return "34"; case _35: return "35"; case _36: return "36"; case _37: return "37"; case _38: return "38"; case _41: return "41"; case _42: return "42"; case _43: return "43"; case _44: return "44"; case _45: return "45"; case _46: return "46"; case _47: return "47"; case _48: return "48"; default: return "?"; } } }
[ "jamesagnew@gmail.com" ]
jamesagnew@gmail.com
e6ddd92e4a6f013b0609d9064242a8cd54dd00b6
123df2c02e93f052e8fb25c6b070e3a1280c071f
/webStudy03_Validation/src/main/java/kr/or/ddit/mvc/annotation/resolvers/ServletSpecArgumentResolver.java
62dcf67e5f7521bfa074de359d6f26006e85f0d4
[]
no_license
JeonghoonWon/JSPspring
e9840d9798aca7d6c35ac45bc7db6191fe505bbf
604fd267c4371f20ddd0e5683496ea1fb87d19d0
refs/heads/main
2023-05-30T22:58:44.342335
2021-06-29T07:46:04
2021-06-29T07:46:04
351,953,362
0
0
null
null
null
null
UTF-8
Java
false
false
1,355
java
package kr.or.ddit.mvc.annotation.resolvers; import java.io.IOException; import java.lang.reflect.Parameter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * {@link HttpServletRequest} * {@link HttpServletResponse} * {@link HttpSession} * 위의 세가지 종류의 핸들러 메소드 아규먼트를 처리할 처리자. */ public class ServletSpecArgumentResolver implements IHandlerMethodArgumentResolver { @Override public boolean isSupported(Parameter parameter) { Class<?> parameterType = parameter.getType(); boolean supported = HttpServletRequest.class.equals(parameterType) || HttpServletResponse.class.equals(parameterType) || HttpSession.class.equals(parameterType); return supported; } @Override public Object argumentResolve(Parameter parameter, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Class<?> parameterType = parameter.getType(); Object parameterValue = null; if(HttpServletRequest.class.equals(parameterType)) { parameterValue = req; }else if(HttpServletResponse.class.equals(parameterType)) { parameterValue = resp; }else { parameterValue = req.getSession(); } return parameterValue; } }
[ "expedition1205@gmail.com" ]
expedition1205@gmail.com
f18c25d3be6137384958c109de0e8361b61ab7e0
119fee04286537a6f311f88b2642aa746a3d0727
/DaggerDemo/app/src/androidTest/java/com/morgenworks/daggerdemo/ApplicationTest.java
591b988dd138b6de7efcdb16044c049fa8f2d44a
[]
no_license
IamAlchemist/AndroidStudioProjects
181e3aadab9fafcacf0eb4c2a44c5ec3eab0b43a
e3532798de194d20f13f8be121153cd579c6f92c
refs/heads/master
2020-12-25T17:23:30.282644
2016-07-29T08:19:39
2016-07-29T08:19:39
24,101,217
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package com.morgenworks.daggerdemo; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "Wizard.Lee@qq.com" ]
Wizard.Lee@qq.com
5b027b5d8260787bc221895dcfdb18b6a74fac78
916157450ba99355d70a7cfcec8ba07637ee6a53
/Test2/skymall/src/main/java/com/hxh/skymall/service/CommodityService.java
20e7100de919d1a8980e164cf960d706793c5be3
[]
no_license
Lewis-he/mall
db94964c45a91f5c3abb722ab5cb126925a32f1f
ce956639c3897fd221f2d1f2f4afcb4200dfdc4f
refs/heads/master
2022-11-26T09:08:05.822309
2021-07-13T05:32:50
2021-07-13T05:32:50
130,326,863
0
0
null
2022-11-24T06:14:47
2018-04-20T07:36:16
JavaScript
UTF-8
Java
false
false
1,769
java
package com.hxh.skymall.service; import com.hxh.skymall.dao.CommodityDao; import com.hxh.skymall.entity.Commodity; import com.hxh.skymall.uitls.KeyCreator; import com.hxh.skymall.uitls.ThreadUtil; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.File; import java.util.List; import java.util.Map; @Service public class CommodityService { @Resource public CommodityDao cd; @Transactional public void addCommodity(MultipartFile file, Map<String, Object> param) { //保存文件,开启一个线程 ThreadUtil.execute(new Runnable() { @Override public void run() { File file1 = new File("G:/", file.getOriginalFilename()); try { file.transferTo(file1); } catch (Exception e) { e.printStackTrace(); } } }); String sku = KeyCreator.getKey(); param.put("sku",sku); //保存商品 addCommodityInfo(param); param.put("imgName",file.getOriginalFilename()); param.put("imgId",KeyCreator.getKey()); //保存图片 addCommodityImg(param); } private void addCommodityImg(Map<String, Object> param) { cd.addCommodityImg(param); } private void addCommodityInfo(Map<String, Object> param) { cd.addCommodityInfo(param); } public List<Commodity> findAllCommodity() { return cd.findAllCommodity(); } public Commodity findCommodityBySku(String sku) { return cd.findCommodityBySku(sku); } }
[ "112@aa" ]
112@aa
c910f5c7ff025161bd8f46156bad1299dcf3a84a
56b3e4be9009793c1c9fcf5675036a9a461e0eea
/src/main/java/com/example/ShadowSocksShare/service/impl/IShadowCrawlerServiceImpl.java
9558f8270af06d29b2d3f352926723c93651e2ab
[ "Apache-2.0" ]
permissive
ggzzzzzzz/ShadowSocks-Share
fb8b45a095fb9f1a7367098595f89a6283e0d4f2
1812a5c6f3b54dea48a864bb38ceb626228be5e1
refs/heads/master
2021-05-05T08:35:12.999211
2018-01-26T14:00:25
2018-01-26T14:00:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,338
java
package com.example.ShadowSocksShare.service.impl; import com.example.ShadowSocksShare.domain.ShadowSocksDetailsEntity; import com.example.ShadowSocksShare.service.ShadowSocksCrawlerService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.util.Date; import java.util.HashSet; import java.util.Set; /** * iShadow * https://global.ishadowx.net/ */ @Slf4j @Service("iShadowCrawlerServiceImpl") public class IShadowCrawlerServiceImpl extends ShadowSocksCrawlerService { // 目标网站 URL private static final String TARGET_URL = "https://global.ishadowx.net/"; /** * 网页内容解析 ss 信息 */ @Override protected Set<ShadowSocksDetailsEntity> parse(Document document) { Elements ssList = document.select("div.hover-text"); Set<ShadowSocksDetailsEntity> set = new HashSet(ssList.size()); for (int i = 0; i < ssList.size(); i++) { try { Element element = ssList.get(i); // 取 h4 信息,为 ss 信息 Elements ssHtml = element.select("h4"); // log.debug(ssHtml.html()); // 如果 得到 大于 5 个(address、port、password、method、agreement、obscure),分别取相应信息 if (ssHtml.size() >= 5) { // server String server = ssHtml.get(0).select("span[id]").first().html(); Assert.hasLength(server, "server 不能为空"); int server_port = NumberUtils.toInt(ssHtml.get(1).select("span[id]").first().html()); // Assert.isNull(port, "port 不能为空"); String password = ssHtml.get(2).select("span[id]").first().html(); Assert.hasLength(password, "password 不能为空"); String method = StringUtils.substringAfter(ssHtml.get(3).text(), ":"); Assert.hasLength(method, "method 不能为空"); ShadowSocksDetailsEntity ss = null; // 最后一行 可能是 ss 或 ssr 区别是 ss 是 点击获取图片,ssr 是 协议和混淆 if (ssHtml.get(4).select("a") != null) { // ss ss = new ShadowSocksDetailsEntity(server, server_port, password, method, SS_PROTOCOL, SS_OBFS); } else { // ssr String[] ao = StringUtils.split(ssHtml.get(4).text(), " "); if (ao.length == 2) { String protocol = ao[0]; Assert.hasLength(method, "protocol 不能为空"); String obfs = ao[1]; Assert.hasLength(method, "obscure 不能为空"); ss = new ShadowSocksDetailsEntity(server, server_port, password, method, protocol, obfs); } } ss.setValid(false); ss.setValidTime(new Date()); ss.setTitle(document.title()); ss.setRemarks(TARGET_URL); ss.setGroup("ShadowSocks-Share"); // 测试网络 if (isReachable(ss)) ss.setValid(true); // 无论是否可用都入库 set.add(ss); log.debug("*************** 第 {} 条 ***************{}{}", i + 1, System.lineSeparator(), ss); // log.debug("{}", ss.getLink()); } } catch (Exception e) { log.error(e.getMessage(), e); } } return set; } /** * 目标网站 URL */ @Override protected String getTargetURL() { return TARGET_URL; } }
[ "x@x.x" ]
x@x.x
e60c3331080df854f9c894a1935e2a29fd791071
3ca53c13d2953805c00406476ceda9684887a8ad
/src/com/iwxxm/common/TinType.java
7ebec841ea2467b656345202342406ebecf5d08d
[]
no_license
yw2017051032/tac2iwxxm
ae93c12b08b7316cd59de032d4ae2e8082bc6c0b
5a08cb9ecd0833fd4435bf6db81a2b8126380ec1
refs/heads/master
2020-03-17T03:03:06.671868
2018-06-05T16:55:59
2018-06-05T17:06:03
133,217,637
3
0
null
null
null
null
GB18030
Java
false
false
8,337
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2018.04.04 时间 10:18:30 PM CST // package com.iwxxm.common; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; /** * <p>TinType complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="TinType"> * &lt;complexContent> * &lt;extension base="{http://www.opengis.net/gml/3.2}SurfaceType"> * &lt;sequence> * &lt;element name="stopLines" type="{http://www.opengis.net/gml/3.2}LineStringSegmentArrayPropertyType" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="breakLines" type="{http://www.opengis.net/gml/3.2}LineStringSegmentArrayPropertyType" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="maxLength" type="{http://www.opengis.net/gml/3.2}LengthType"/> * &lt;element name="controlPoint"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice> * &lt;element ref="{http://www.opengis.net/gml/3.2}posList"/> * &lt;group ref="{http://www.opengis.net/gml/3.2}geometricPositionGroup" maxOccurs="unbounded" minOccurs="3"/> * &lt;/choice> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "TinType", propOrder = { "stopLines", "breakLines", "maxLength", "controlPoint" }) public class TinType extends SurfaceType1 { protected List<LineStringSegmentArrayPropertyType> stopLines; protected List<LineStringSegmentArrayPropertyType> breakLines; @XmlElement(required = true) protected LengthType maxLength; @XmlElement(required = true) protected TinType.ControlPoint controlPoint; /** * Gets the value of the stopLines property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the stopLines property. * * <p> * For example, to add a new item, do as follows: * <pre> * getStopLines().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link LineStringSegmentArrayPropertyType } * * */ public List<LineStringSegmentArrayPropertyType> getStopLines() { if (stopLines == null) { stopLines = new ArrayList<LineStringSegmentArrayPropertyType>(); } return this.stopLines; } /** * Gets the value of the breakLines property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the breakLines property. * * <p> * For example, to add a new item, do as follows: * <pre> * getBreakLines().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link LineStringSegmentArrayPropertyType } * * */ public List<LineStringSegmentArrayPropertyType> getBreakLines() { if (breakLines == null) { breakLines = new ArrayList<LineStringSegmentArrayPropertyType>(); } return this.breakLines; } /** * 获取maxLength属性的值。 * * @return * possible object is * {@link LengthType } * */ public LengthType getMaxLength() { return maxLength; } /** * 设置maxLength属性的值。 * * @param value * allowed object is * {@link LengthType } * */ public void setMaxLength(LengthType value) { this.maxLength = value; } /** * 获取controlPoint属性的值。 * * @return * possible object is * {@link TinType.ControlPoint } * */ public TinType.ControlPoint getControlPoint() { return controlPoint; } /** * 设置controlPoint属性的值。 * * @param value * allowed object is * {@link TinType.ControlPoint } * */ public void setControlPoint(TinType.ControlPoint value) { this.controlPoint = value; } /** * <p>anonymous complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;choice> * &lt;element ref="{http://www.opengis.net/gml/3.2}posList"/> * &lt;group ref="{http://www.opengis.net/gml/3.2}geometricPositionGroup" maxOccurs="unbounded" minOccurs="3"/> * &lt;/choice> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "posList", "geometricPositionGroup" }) public static class ControlPoint { protected DirectPositionListType posList; @XmlElements({ @XmlElement(name = "pos", type = DirectPositionType.class), @XmlElement(name = "pointProperty", type = PointPropertyType1 .class) }) protected List<Object> geometricPositionGroup; /** * 获取posList属性的值。 * * @return * possible object is * {@link DirectPositionListType } * */ public DirectPositionListType getPosList() { return posList; } /** * 设置posList属性的值。 * * @param value * allowed object is * {@link DirectPositionListType } * */ public void setPosList(DirectPositionListType value) { this.posList = value; } /** * Gets the value of the geometricPositionGroup property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the geometricPositionGroup property. * * <p> * For example, to add a new item, do as follows: * <pre> * getGeometricPositionGroup().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link DirectPositionType } * {@link PointPropertyType1 } * * */ public List<Object> getGeometricPositionGroup() { if (geometricPositionGroup == null) { geometricPositionGroup = new ArrayList<Object>(); } return this.geometricPositionGroup; } } }
[ "852406820@qq.com" ]
852406820@qq.com
92425fec698ada509ce2f8174a866c8b66c5da2e
493a8065cf8ec4a4ccdf136170d505248ac03399
/net.sf.ictalive.coordination.wfannotation.mapping.diagram/src/net/sf/ictalive/coordination/wfannotation/mapping/diagram/edit/parts/ReplyName10EditPart.java
2f547b1a76447a8b5f8af2aa98860a896964e9f0
[]
no_license
ignasi-gomez/aliveclipse
593611b2d471ee313650faeefbed591c17beaa50
9dd2353c886f60012b4ee4fe8b678d56972dff97
refs/heads/master
2021-01-14T09:08:24.839952
2014-10-09T14:21:01
2014-10-09T14:21:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,473
java
package net.sf.ictalive.coordination.wfannotation.mapping.diagram.edit.parts; import java.util.ArrayList; import java.util.Collections; import java.util.List; import net.sf.ictalive.coordination.wfannotation.mapping.diagram.edit.policies.MappingTextSelectionEditPolicy; import net.sf.ictalive.coordination.wfannotation.mapping.diagram.part.MappingVisualIDRegistry; import net.sf.ictalive.coordination.wfannotation.mapping.diagram.providers.MappingElementTypes; import net.sf.ictalive.coordination.wfannotation.mapping.diagram.providers.MappingParserProvider; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.Label; import org.eclipse.draw2d.geometry.Point; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.RunnableWithResult; import org.eclipse.gef.AccessibleEditPart; import org.eclipse.gef.EditPolicy; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.Request; import org.eclipse.gef.commands.Command; import org.eclipse.gef.editpolicies.NonResizableEditPolicy; import org.eclipse.gef.handles.MoveHandle; import org.eclipse.gef.handles.NonResizableHandleKit; import org.eclipse.gef.requests.DirectEditRequest; import org.eclipse.gef.tools.DirectEditManager; import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.gmf.runtime.notation.FontStyle; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.viewers.ICellEditorValidator; import org.eclipse.swt.SWT; import org.eclipse.swt.accessibility.AccessibleEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.FontData; import org.eclipse.swt.graphics.Image; /** * @generated */ public class ReplyName10EditPart extends CompartmentEditPart implements ITextAwareEditPart { /** * @generated */ public static final int VISUAL_ID = 5204; /** * @generated */ private DirectEditManager manager; /** * @generated */ private IParser parser; /** * @generated */ private List parserElements; /** * @generated */ private String defaultText; /** * @generated */ public ReplyName10EditPart(View view) { super(view); } /** * @generated */ protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new MappingTextSelectionEditPolicy()); installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() { protected List createSelectionHandles() { List handles = new ArrayList(); NonResizableHandleKit.addMoveHandle( (GraphicalEditPart) getHost(), handles); ((MoveHandle) handles.get(0)).setBorder(null); return handles; } public Command getCommand(Request request) { return null; } public boolean understandsRequest(Request request) { return false; } }); } /** * @generated */ protected String getLabelTextHelper(IFigure figure) { if (figure instanceof WrappingLabel) { return ((WrappingLabel) figure).getText(); } else { return ((Label) figure).getText(); } } /** * @generated */ protected void setLabelTextHelper(IFigure figure, String text) { if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setText(text); } else { ((Label) figure).setText(text); } } /** * @generated */ protected Image getLabelIconHelper(IFigure figure) { if (figure instanceof WrappingLabel) { return ((WrappingLabel) figure).getIcon(); } else { return ((Label) figure).getIcon(); } } /** * @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setIcon(icon); } else { ((Label) figure).setIcon(icon); } } /** * @generated */ public void setLabel(WrappingLabel figure) { unregisterVisuals(); setFigure(figure); defaultText = getLabelTextHelper(figure); registerVisuals(); refreshVisuals(); } /** * @generated */ protected List getModelChildren() { return Collections.EMPTY_LIST; } /** * @generated */ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { return null; } /** * @generated */ protected EObject getParserElement() { return resolveSemanticElement(); } /** * @generated */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); if (parserElement == null) { return null; } return MappingElementTypes.getImage(parserElement.eClass()); } /** * @generated */ protected String getLabelText() { String text = null; EObject parserElement = getParserElement(); if (parserElement != null && getParser() != null) { text = getParser().getPrintString( new EObjectAdapter(parserElement), getParserOptions().intValue()); } if (text == null || text.length() == 0) { text = defaultText; } return text; } /** * @generated */ public void setLabelText(String text) { setLabelTextHelper(getFigure(), text); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); if (pdEditPolicy instanceof MappingTextSelectionEditPolicy) { ((MappingTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); if (sfEditPolicy instanceof MappingTextSelectionEditPolicy) { ((MappingTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } /** * @generated */ public String getEditText() { if (getParserElement() == null || getParser() == null) { return ""; //$NON-NLS-1$ } return getParser().getEditString( new EObjectAdapter(getParserElement()), getParserOptions().intValue()); } /** * @generated */ protected boolean isEditable() { return false; } /** * @generated */ public ICellEditorValidator getEditTextValidator() { return new ICellEditorValidator() { public String isValid(final Object value) { if (value instanceof String) { final EObject element = getParserElement(); final IParser parser = getParser(); try { IParserEditStatus valid = (IParserEditStatus) getEditingDomain() .runExclusive(new RunnableWithResult.Impl() { public void run() { setResult(parser.isValidEditString( new EObjectAdapter(element), (String) value)); } }); return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage(); } catch (InterruptedException ie) { ie.printStackTrace(); } } // shouldn't get here return null; } }; } /** * @generated */ public IContentAssistProcessor getCompletionProcessor() { if (getParserElement() == null || getParser() == null) { return null; } return getParser().getCompletionProcessor( new EObjectAdapter(getParserElement())); } /** * @generated */ public ParserOptions getParserOptions() { return ParserOptions.NONE; } /** * @generated */ public IParser getParser() { if (parser == null) { parser = MappingParserProvider .getParser( MappingElementTypes.Reply_3231, getParserElement(), MappingVisualIDRegistry .getType(net.sf.ictalive.coordination.wfannotation.mapping.diagram.edit.parts.ReplyName10EditPart.VISUAL_ID)); } return parser; } /** * @generated */ protected DirectEditManager getManager() { if (manager == null) { setManager(new TextDirectEditManager(this, TextDirectEditManager .getTextCellEditorClass(this), MappingEditPartFactory .getTextCellEditorLocator(this))); } return manager; } /** * @generated */ protected void setManager(DirectEditManager manager) { this.manager = manager; } /** * @generated */ protected void performDirectEdit() { getManager().show(); } /** * @generated */ protected void performDirectEdit(Point eventLocation) { if (getManager().getClass() == TextDirectEditManager.class) { ((TextDirectEditManager) getManager()).show(eventLocation .getSWTPoint()); } } /** * @generated */ private void performDirectEdit(char initialCharacter) { if (getManager() instanceof TextDirectEditManager) { ((TextDirectEditManager) getManager()).show(initialCharacter); } else { performDirectEdit(); } } /** * @generated */ protected void performDirectEditRequest(Request request) { final Request theRequest = request; try { getEditingDomain().runExclusive(new Runnable() { public void run() { if (isActive() && isEditable()) { if (theRequest .getExtendedData() .get( RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { Character initialChar = (Character) theRequest .getExtendedData() .get( RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); performDirectEdit(initialChar.charValue()); } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { DirectEditRequest editRequest = (DirectEditRequest) theRequest; performDirectEdit(editRequest.getLocation()); } else { performDirectEdit(); } } } }); } catch (InterruptedException e) { e.printStackTrace(); } } /** * @generated */ protected void refreshVisuals() { super.refreshVisuals(); refreshLabel(); refreshFont(); refreshFontColor(); refreshUnderline(); refreshStrikeThrough(); } /** * @generated */ protected void refreshLabel() { setLabelTextHelper(getFigure(), getLabelText()); setLabelIconHelper(getFigure(), getLabelIcon()); Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); if (pdEditPolicy instanceof MappingTextSelectionEditPolicy) { ((MappingTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); } Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); if (sfEditPolicy instanceof MappingTextSelectionEditPolicy) { ((MappingTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); } } /** * @generated */ protected void refreshUnderline() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( NotationPackage.eINSTANCE.getFontStyle()); if (style != null && getFigure() instanceof WrappingLabel) { ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); } } /** * @generated */ protected void refreshStrikeThrough() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( NotationPackage.eINSTANCE.getFontStyle()); if (style != null && getFigure() instanceof WrappingLabel) { ((WrappingLabel) getFigure()).setTextStrikeThrough(style .isStrikeThrough()); } } /** * @generated */ protected void refreshFont() { FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( NotationPackage.eINSTANCE.getFontStyle()); if (style != null) { FontData fontData = new FontData(style.getFontName(), style .getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); setFont(fontData); } } /** * @generated */ protected void setFontColor(Color color) { getFigure().setForegroundColor(color); } /** * @generated */ protected void addSemanticListeners() { if (getParser() instanceof ISemanticParser) { EObject element = resolveSemanticElement(); parserElements = ((ISemanticParser) getParser()) .getSemanticElementsBeingParsed(element); for (int i = 0; i < parserElements.size(); i++) { addListenerFilter( "SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ } } else { super.addSemanticListeners(); } } /** * @generated */ protected void removeSemanticListeners() { if (parserElements != null) { for (int i = 0; i < parserElements.size(); i++) { removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ } } else { super.removeSemanticListeners(); } } /** * @generated */ protected AccessibleEditPart getAccessibleEditPart() { if (accessibleEP == null) { accessibleEP = new AccessibleGraphicalEditPart() { public void getName(AccessibleEvent e) { e.result = getLabelTextHelper(getFigure()); } }; } return accessibleEP; } /** * @generated */ private View getFontStyleOwnerView() { return getPrimaryView(); } /** * @generated */ protected void addNotationalListeners() { super.addNotationalListeners(); addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ } /** * @generated */ protected void removeNotationalListeners() { super.removeNotationalListeners(); removeListenerFilter("PrimaryView"); //$NON-NLS-1$ } /** * @generated */ protected void handleNotificationEvent(Notification event) { Object feature = event.getFeature(); if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { Integer c = (Integer) event.getNewValue(); setFontColor(DiagramColorRegistry.getInstance().getColor(c)); } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals( feature)) { refreshUnderline(); } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough() .equals(feature)) { refreshStrikeThrough(); } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals( feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals( feature) || NotationPackage.eINSTANCE.getFontStyle_Bold() .equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals( feature)) { refreshFont(); } else { if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { refreshLabel(); } if (getParser() instanceof ISemanticParser) { ISemanticParser modelParser = (ISemanticParser) getParser(); if (modelParser.areSemanticElementsAffected(null, event)) { removeSemanticListeners(); if (resolveSemanticElement() != null) { addSemanticListeners(); } refreshLabel(); } } } super.handleNotificationEvent(event); } /** * @generated */ protected IFigure createFigure() { // Parent should assign one using setLabel() method return null; } }
[ "salvarez@lsi.upc.edu" ]
salvarez@lsi.upc.edu
dd744eeb9fea223c0792a79fbb7a6fc5f331cc15
2f323933ef03dfbf3bab72541f7c9d04249285bd
/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableModify.java
ba188f8681ed317a190f1a38c6bb14abfaec58a9
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "MIT", "OFL-1.1" ]
permissive
linkedin/linkedin-calcite
20908fc82f782f2cb7b0ea7ef072fcab70921eb8
1b04e27f1e59a5d36e327e3eeeb6686623b44d8f
refs/heads/li-1.21.0
2023-07-27T19:25:59.434361
2023-04-20T23:21:19
2023-04-20T23:21:19
237,295,167
19
20
Apache-2.0
2023-09-07T06:22:42
2020-01-30T20:04:02
Java
UTF-8
Java
false
false
4,794
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.calcite.rel.mutable; import org.apache.calcite.plan.RelOptTable; import org.apache.calcite.prepare.Prepare; import org.apache.calcite.rel.core.TableModify.Operation; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexNode; import java.util.List; import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.TableModify}. */ public class MutableTableModify extends MutableSingleRel { public final Prepare.CatalogReader catalogReader; public final RelOptTable table; public final Operation operation; public final List<String> updateColumnList; public final List<RexNode> sourceExpressionList; public final boolean flattened; private MutableTableModify(RelDataType rowType, MutableRel input, RelOptTable table, Prepare.CatalogReader catalogReader, Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) { super(MutableRelType.TABLE_MODIFY, rowType, input); this.table = table; this.catalogReader = catalogReader; this.operation = operation; this.updateColumnList = updateColumnList; this.sourceExpressionList = sourceExpressionList; this.flattened = flattened; } /** * Creates a MutableTableModify. * * @param rowType Row type * @param input Input relational expression * @param table Target table to modify * @param catalogReader Accessor to the table metadata * @param operation Modify operation (INSERT, UPDATE, DELETE) * @param updateColumnList List of column identifiers to be updated * (e.g. ident1, ident2); null if not UPDATE * @param sourceExpressionList List of value expressions to be set * (e.g. exp1, exp2); null if not UPDATE * @param flattened Whether set flattens the input row type */ public static MutableTableModify of(RelDataType rowType, MutableRel input, RelOptTable table, Prepare.CatalogReader catalogReader, Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened) { return new MutableTableModify(rowType, input, table, catalogReader, operation, updateColumnList, sourceExpressionList, flattened); } @Override public boolean equals(Object obj) { return obj == this || obj instanceof MutableTableModify && table.getQualifiedName().equals( ((MutableTableModify) obj).table.getQualifiedName()) && operation == ((MutableTableModify) obj).operation && Objects.equals(updateColumnList, ((MutableTableModify) obj).updateColumnList) && MutableRel.PAIRWISE_STRING_EQUIVALENCE.equivalent( sourceExpressionList, ((MutableTableModify) obj).sourceExpressionList) && flattened == ((MutableTableModify) obj).flattened && input.equals(((MutableTableModify) obj).input); } @Override public int hashCode() { return Objects.hash(input, table.getQualifiedName(), operation, updateColumnList, MutableRel.PAIRWISE_STRING_EQUIVALENCE.hash(sourceExpressionList), flattened); } @Override public StringBuilder digest(StringBuilder buf) { buf.append("TableModify(table: ").append(table.getQualifiedName()) .append(", operation: ").append(operation); if (updateColumnList != null) { buf.append(", updateColumnList: ").append(updateColumnList); } if (sourceExpressionList != null) { buf.append(", sourceExpressionList: ").append(sourceExpressionList); } return buf.append(", flattened: ").append(flattened).append(")"); } @Override public MutableRel clone() { return MutableTableModify.of(rowType, input.clone(), table, catalogReader, operation, updateColumnList, sourceExpressionList, flattened); } } // End MutableTableModify.java
[ "maryann.xue@gmail.com" ]
maryann.xue@gmail.com
0cec91635eda5361e8f074c95748385609db26aa
1f7a8a0a76e05d096d3bd62735bc14562f4f071a
/NeverPuk/net/yv/f.java
60a931678f88ed914ebfcd4c632b02ca143fcbda
[]
no_license
yunusborazan/NeverPuk
b6b8910175634523ebd4d21d07a4eb4605477f46
a0e58597858de2fcad3524daaea656362c20044d
refs/heads/main
2023-05-10T09:08:02.183430
2021-06-13T17:17:50
2021-06-13T17:17:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
749
java
package net.yv; import javax.annotation.concurrent.Immutable; import net.xn; import net.yv.r; @Immutable public class f { public static final f Q = new f(""); private final String G; public f(String var1) { this.G = var1; } public boolean T() { net.u.d[] var1 = r.C(); return this.G == null || this.G.isEmpty(); } public String J() { return this.G; } public void e(net.nj.f var1) { var1.b("Lock", this.G); } public static f S(net.nj.f var0) { net.u.d[] var1 = r.C(); if(var0.K("Lock", 8)) { String var2 = var0.J("Lock"); return new f(var2); } else { return Q; } } private static xn a(xn var0) { return var0; } }
[ "68544940+Lazy-Hero@users.noreply.github.com" ]
68544940+Lazy-Hero@users.noreply.github.com