blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
b9ba5236ff24070f29c113c3b51a43913521066e
29b44914aab18c441cf13c0b0d57743ea86d5c2a
/summer-report/src/main/java/net/myspring/report/modules/future/dto/ProductMonthPriceDetailDto.java
acaa0b57622be1a08f278ef4294d198cec17036e
[]
no_license
Joker2333/dlsmonastery
3ff1c6cab50d8c863fcaff994eedca614da7ea86
73900401016968bb74806df2100af4fbb2c532ca
refs/heads/master
2020-07-02T23:53:08.394593
2017-08-19T09:20:41
2017-08-19T09:20:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package net.myspring.report.modules.future.dto; import net.myspring.common.dto.DataDto; import java.math.BigDecimal; public class ProductMonthPriceDetailDto extends DataDto{ private BigDecimal price2; private BigDecimal price3; private BigDecimal baokaPrice; private String productTypeId; private String productMonthPriceId; public BigDecimal getPrice2() { return price2; } public void setPrice2(BigDecimal price2) { this.price2 = price2; } public BigDecimal getPrice3() { return price3; } public void setPrice3(BigDecimal price3) { this.price3 = price3; } public BigDecimal getBaokaPrice() { return baokaPrice; } public void setBaokaPrice(BigDecimal baokaPrice) { this.baokaPrice = baokaPrice; } public String getProductTypeId() { return productTypeId; } public void setProductTypeId(String productTypeId) { this.productTypeId = productTypeId; } public String getProductMonthPriceId() { return productMonthPriceId; } public void setProductMonthPriceId(String productMonthPriceId) { this.productMonthPriceId = productMonthPriceId; } }
[ "wangzm@12456" ]
wangzm@12456
beeaa80d5e42e4ea8be8fc473a10d973c6f27644
fe2645e9f55fc64b58aef2a06905b054bbbb7fe6
/src/main/java/tutorial/springdata/controller/AddressController.java
8825383d0373540dbca653b3875e783046d997cf
[]
no_license
dineshbabu/SpringDataJpaBootGradleMySQLFlywaySwaggerEntityRelationships
38294f18d31482348b2c3bd83ef2604c620edcc5
ea800cff769a7dc9cd23c2175d80d8e1297ea8b3
refs/heads/master
2020-03-23T03:11:37.769134
2018-07-15T11:12:42
2018-07-15T11:12:42
141,015,402
0
1
null
null
null
null
UTF-8
Java
false
false
914
java
package tutorial.springdata.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import tutorial.springdata.entities.onetomany.Address; import tutorial.springdata.service.AddressService; /** * Created by dineshbabu on 27/06/2017. */ @RequestMapping(path = "/address") @RestController public class AddressController { @Autowired private AddressService addressService; @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public Address createAddress(@RequestBody Address address){ return addressService.createAddress(address); } }
032505b218089c9a71f2316246494598b818c7a7
1728dbc0c7d09d6eae6473ad4ba4ff020090f148
/day08_File/src/org/bigjava/servlet/UploadServlet.java
38286b7b0dc58fd866e9cea6cee40b7fc44d4c5c
[]
no_license
hualong-hu/JavaWeb
d0cb681b4181e3b3f2bc96dd6a4aad8134c971d7
4a5ad3e404898d7ae93ac3e6d1c0924c2da15ded
refs/heads/master
2023-01-22T13:08:18.750139
2020-12-06T05:27:59
2020-12-06T05:27:59
318,958,678
0
0
null
null
null
null
UTF-8
Java
false
false
2,626
java
package org.bigjava.servlet; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.util.List; /** * @ProjectName: JavaWeb * @ClassName: UploadServlet * @Description: TODO * @Author: 洛笙 * @Date: 2020-06-03 10:40 * @Version v1.0 */ public class UploadServlet extends HttpServlet { /** * 用于处理上传数据 * @data: 2020-06-03-10:43 * @User: 洛笙 * @method: doPost * @params: [req, resp] * @return: void * @Description: 描述 */ @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { //1.判断上传的数据是否为多段数据(只有多段的数据才是文件上传) if (ServletFileUpload.isMultipartContent(req)){ //创建FileItemFactory工厂实现类 FileItemFactory fileItemFactory = new DiskFileItemFactory(); //创建用于解析上传数据的工具类ServletFileUpload类 ServletFileUpload servletFileUpload = new ServletFileUpload(fileItemFactory); //解析上传的数据,得到每一个表单项FileItem List<FileItem> list = servletFileUpload.parseRequest(req); //循环判断,每一个表单项是普通类型,还是上传的文件 for (FileItem fileItem : list){ if (fileItem.isFormField()){ //普通表单项 System.out.println("表单项的name属性值:"+fileItem.getFieldName()); //参数utf-8解决乱码问题 System.out.println("表单项的value属性值:"+fileItem.getString("UTF-8")); }else { //上传的文件 System.out.println("表单项的name属性值:"+fileItem.getFieldName()); System.out.println("上传的文件名:"+ fileItem.getName()); fileItem.write(new File("d:\\"+fileItem.getName())); } } } } catch (Exception e) { e.printStackTrace(); } } }
8f0322e5c930f2a035f1bb2de956cc93ed0894f7
646a50af9130798b52b0dd1313249708dba92819
/src/main/java/html/SecurityAnalyzer.java
3099c0e86568ae3165b876990eba728c065d74dd
[]
no_license
ReggieYang/VulnerabilitySearch
53a27fc6008efbf551df2ae3de991308f2d0523a
d67fd37d401832f8462346271b311f609ee176e0
refs/heads/master
2020-04-07T11:02:23.462145
2018-12-08T04:08:17
2018-12-08T04:08:17
158,310,333
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package html; import java.util.ArrayList; import java.util.List; public class SecurityAnalyzer { public List<String> getAllVersion(String html, String id) { List<String> result = new ArrayList<>(); String[] arr = html.split("\n"); boolean foundSearchWord = false; for (int i = 0; i < arr.length; i++) { if(!foundSearchWord && arr[i].contains("Description")){ foundSearchWord = true; result.add(arr[i]); } } return result; } }
a4c5fe35b6987f1444b2b8fd39080eeb85b139ec
02570607edea101396ff231025498056ece3df31
/app/src/main/java/com/walton/filebrowser/adapter/UsbItemAdapter.java
8e91f6663a222053b8244b5c1aeaa80f10b7c3bb
[]
no_license
SKToukir/FileBrowser-TV
978048f6d172224522d57b06a2282b2f9fd922ea
25b6d2f19bd76d7933f143744d1b01a40958f2ef
refs/heads/master
2023-03-05T15:12:25.861913
2021-02-18T04:41:21
2021-02-18T04:41:21
334,580,130
5
0
null
null
null
null
UTF-8
Java
false
false
9,200
java
package com.walton.filebrowser.adapter; import android.annotation.SuppressLint; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.walton.filebrowser.R; import com.walton.filebrowser.business.data.BaseData; import com.walton.filebrowser.util.StorageSpaceCount; import com.walton.filebrowser.util.USB; import java.util.ArrayList; import java.util.List; public class UsbItemAdapter extends BaseAdapter { private static final String TAG = "UsbItemAdapter"; private List<BaseData> list = new ArrayList<>(); private LayoutInflater mInflater; private int[] pockets_image = {R.drawable.sys_pocket_one, R.drawable.sys_pocket_four, R.drawable.sys_pocket_three};//,R.drawable.sys_pocket_four}; private int[] pockets_round_image = {R.drawable.circle_back_one, R.drawable.circle_back_four, R.drawable.circle_back_three};//,R.drawable.circle_back_four}; private Context mContext; private int pocketIndex; public UsbItemAdapter(List<BaseData> list, Context mContext) { this.list = list; this.mContext = mContext; mInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return list.size(); } @Override public Object getItem(int position) { return list.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { UsbViewHolder viewHolder = null; if (convertView == null) { convertView = mInflater.inflate(R.layout.usb_item, parent, false); convertView.setTag(new UsbViewHolder(convertView)); } viewHolder = (UsbViewHolder) convertView.getTag(); bindViewData(position, viewHolder); return convertView; } private void bindViewData(int position, UsbViewHolder viewHolder) { BaseData usb = list.get(position); Log.d(TAG, "bindViewData: USB name " + usb.getName()); if (position % pockets_image.length == 0) { viewHolder.rlItemHolder.setBackgroundResource(pockets_image[0]); // viewHolder.rlItemHolder.post(new Runnable() { // @Override // public void run() { // viewHolder.rlItemHolder.setBackgroundResource(pockets_image[0]); // } // }); viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[0]); // viewHolder.rlPocketRound.post(new Runnable() { // @Override // public void run() { // viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[0]); // } // }); } else if (position % pockets_image.length == 1) { viewHolder.rlItemHolder.setBackgroundResource(pockets_image[1]); // viewHolder.rlItemHolder.post(new Runnable() { // @Override // public void run() { // viewHolder.rlItemHolder.setBackgroundResource(pockets_image[1]); // } // }); viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[1]); // viewHolder.rlPocketRound.post(new Runnable() { // @Override // public void run() { // viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[1]); // } // }); } else if (position % pockets_image.length == 2) { viewHolder.rlItemHolder.setBackgroundResource(pockets_image[2]); // viewHolder.rlItemHolder.post(new Runnable() { // @Override // public void run() { // viewHolder.rlItemHolder.setBackgroundResource(pockets_image[2]); // } // }); viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[2]); // viewHolder.rlPocketRound.post(new Runnable() { // @Override // public void run() { // viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[2]); // } // }); } else if (position % pockets_image.length == 3) { viewHolder.rlItemHolder.setBackgroundResource(pockets_image[3]); // viewHolder.rlItemHolder.post(new Runnable() { // @Override // public void run() { // viewHolder.rlItemHolder.setBackgroundResource(pockets_image[3]); // } // }); viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[3]); // viewHolder.rlPocketRound.post(new Runnable() { // @Override // public void run() { // viewHolder.rlPocketRound.setBackgroundResource(pockets_round_image[3]); // } // }); } Log.d(TAG, "bindViewData: Position:" + position); if (position == 0) { viewHolder.txt_storage_name.setText("Local Storage"); // viewHolder.txt_storage_name.post(new Runnable() { // @Override // public void run() { // viewHolder.txt_storage_name.setText("Local Storage"); // } // }); viewHolder.imgUsbDisk.setImageResource(R.drawable.system_storage); viewHolder.imgUsbDisk.setScaleType(ImageView.ScaleType.FIT_CENTER); // viewHolder.imgUsbDisk.post(new Runnable() { // @Override // public void run() { // viewHolder.imgUsbDisk.setImageResource(R.drawable.system_storage); // viewHolder.imgUsbDisk.setScaleType(ImageView.ScaleType.FIT_CENTER); // } // }); } else { viewHolder.txt_storage_name.setText(usb.getName()); Log.d(TAG, "run: What the hell is hapenning " + usb.getName()); // viewHolder.txt_storage_name.post(new Runnable() { // @Override // public void run() { // viewHolder.txt_storage_name.setText(usb.getName()); // Log.d(TAG, "run: What the hell is hapenning "+usb.getName()); // } // }); viewHolder.imgUsbDisk.setImageResource(R.drawable.usb); viewHolder.imgUsbDisk.setScaleType(ImageView.ScaleType.FIT_CENTER); // viewHolder.imgUsbDisk.post(new Runnable() { // @Override // public void run() { // viewHolder.imgUsbDisk.setImageResource(R.drawable.usb); // viewHolder.imgUsbDisk.setScaleType(ImageView.ScaleType.FIT_CENTER); // } // }); } if (Integer.parseInt(usb.getStorageUses()) > 85){ viewHolder.pbarSystem.setProgressDrawable(mContext.getResources().getDrawable(R.drawable.progressbar_low_space)); }else { viewHolder.pbarSystem.setProgressDrawable(mContext.getResources().getDrawable(R.drawable.progress_bar_horizontal)); } viewHolder.pbarSystem.setSecondaryProgress(100); viewHolder.pbarSystem.setProgress(Integer.parseInt(usb.getStorageUses())); // viewHolder.pbarSystem.post(new Runnable() { // @Override // public void run() { // viewHolder.pbarSystem.setSecondaryProgress(100); // viewHolder.pbarSystem.setProgress(Integer.parseInt(usb.getStorageUses())); // } // }); viewHolder.txtSystemStorageSizeAvilable.setText(usb.getStorageFree() + " free of " + usb.getStorageTotal()); // viewHolder.txtSystemStorageSizeAvilable.post(new Runnable() { // @SuppressLint("SetTextI18n") // @Override // public void run() { // viewHolder.txtSystemStorageSizeAvilable.setText(usb.getStorageFree() + " free of " + usb.getStorageTotal()); // } // }); } class UsbViewHolder { private ImageView imgUsbDisk; private ProgressBar pbarSystem; private RelativeLayout rlSysPocket, rlItemHolder, rlPocketRound; private TextView txt_storage_name, txtSystemStorageSizeAvilable; public UsbViewHolder(View view) { imgUsbDisk = view.findViewById(R.id.imgUsbDisk); pbarSystem = view.findViewById(R.id.pbarSystem); rlSysPocket = view.findViewById(R.id.rlSysPocket); rlItemHolder = view.findViewById(R.id.rlItemHolder); rlPocketRound = view.findViewById(R.id.rlPocketRound); txt_storage_name = view.findViewById(R.id.txt_storage_name); txtSystemStorageSizeAvilable = view.findViewById(R.id.txtSystemStorageSizeAvilable); } } }
548dcbb691f64c2afc37d3621cc850806ed72876
0917a6cefcc3c3d6766080e58e83cd027522d0a8
/src/main/java/socket/TCPEchoClient.java
28aac640b9e3421f035d9c0af7e9dee0ff518a2e
[]
no_license
lyk4411/untitled1_intellij
19bb583c8e631c4fab5826573fe30a61dff9d2d4
7a3e9ff784faa03c04a40cfdc0ba53af3344bb09
refs/heads/master
2022-12-22T13:58:32.218291
2020-01-22T08:58:04
2020-01-22T08:58:04
62,300,156
0
0
null
2022-12-16T03:16:30
2016-06-30T09:56:05
Java
UTF-8
Java
false
false
1,686
java
package socket; /** * Created by lyk on 2016/7/8. */ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.SocketException; public class TCPEchoClient { public static void main(String[] args) throws IOException { if ((args.length < 2) || (args.length > 3)) // Test for correct # of args throw new IllegalArgumentException("Parameter(s): <Server> <Word> [<Port>]"); String server = args[0]; // Server name or IP address // Convert argument String to bytes using the default character encoding byte[] data = args[1].getBytes(); int servPort = (args.length == 3) ? Integer.parseInt(args[2]) : 7; // Create socket that is connected to server on specified port Socket socket = new Socket(server, servPort); System.out.println("Connected to server...sending echo string"); InputStream in = socket.getInputStream(); OutputStream out = socket.getOutputStream(); out.write(data); // Send the encoded string to the server // Receive the same string back from the server int totalBytesRcvd = 0; // Total bytes received so far int bytesRcvd; // Bytes received in last read while (totalBytesRcvd < data.length) { if ((bytesRcvd = in.read(data, totalBytesRcvd, data.length - totalBytesRcvd)) == -1) throw new SocketException("Connection closed prematurely"); totalBytesRcvd += bytesRcvd; } // data array is full System.out.println("Received: " + new String(data)); socket.close(); // Close the socket and its streams } }
fcbfb9b1a459b742c919f2ce88ad067b40ec45bc
b65df13009525f3a32dcbd760aeaa32479af2c7d
/TheRecipe/src/main/java/com/increpas/therecipe/util/BlankChange.java
f8ac93a1f84c4704a09beeb7c07bf093cb390dc5
[]
no_license
Increpas19gi-Team3/TheRecipe
860de770eaee6f81f951a43186cf6f93dac866bc
26dc79354dc6545e4154c54938c09fa22932a194
refs/heads/master
2021-08-30T14:02:31.989408
2017-12-18T07:50:51
2017-12-18T07:50:51
111,801,199
1
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.increpas.therecipe.util; /** * Blank 값 처리하는 클래스 * @author 손가연 * */ public class BlankChange { /** * "" 데이터가 들어오면 "0" 값으로 돌려보내기 * @param data * @return data == "" → "0" / * data != "" → data */ public static String doStringZero(String data){ if(data.equals("")) return "0"; else return data; } /** * "" 데이터가 들어오면 0 값으로 돌려보내기 * @param data * @return data == "" → 0 / * data != "" → Integer.parseInt(data) */ public static int doIntegerZero(String data){ if(data.equals("")) return 0; else return Integer.parseInt(data); } /** * "" 데이터가 들어오면 number 값으로 돌려보내기 * @param data * @return data == "" → number / * data != "" → data */ public static String doStringNumber(String data, String number){ if(data.equals("")) return number; else return data; } /** * "" 데이터가 들어오면 0 값으로 돌려보내기 * @param data * @return data == "" → number / * data != "" → Integer.parseInt(data) */ public static int doIntegerNumber(String data, int number){ if(data.equals("")) return number; else return Integer.parseInt(data); } }
370a42d1155f7d4e22d6a3885ca3da523de7e766
f2444e57d834bee559dcea6b335701ccb92693f4
/src/main/java/Objects/Wall.java
18ad5fe06b8a31b79c2e7b21ffcac1ab56c624fd
[]
no_license
MYIIIKET/NeuralNetwork
d6c5b7cdfc05aec1b9467bfaf8d16581e22276c8
c623461e719109cdd19d4c61ac7873c0be682ba2
refs/heads/master
2021-01-02T22:55:18.605223
2017-08-21T07:22:23
2017-08-21T07:22:23
99,423,154
0
0
null
null
null
null
UTF-8
Java
false
false
485
java
package Objects; import java.awt.*; public class Wall extends Element { private int width; private int height; public Wall(int x, int y, int width, int height) { this.width = width; this.height = height; setLayout(null); setBounds(x, y, width, height); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.fillRect(0, 0, width, height); } }
517cee0267b8b32c7e9bc99ab8e163ad12fa0d57
2adf0d1b5e9413a566f8069c7346d0c3e0736266
/Day 9/Address Book System/src/Sample.java
c372ded22c32125bd096639a92a705f58fdd97ff
[]
no_license
sajan19/Fellowship_BridgeLabz
71b5c55c1f59c27058d73c142d476629f66ba37e
479c43f47c5b78f474de9f0d647438db71c5e458
refs/heads/master
2023-07-27T05:41:49.688322
2021-09-04T06:57:22
2021-09-04T06:57:22
396,930,624
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
import java.util.Scanner; public class Sample { String firstName; String lastName; public static void ContactBook(){ System.out.println("Address Book Details: "); Scanner sc = new Scanner(System.in); System.out.println("Enter First Name"); String firstName = sc.next(); // System.out.println("First Name: "+ firstName); System.out.println("Enter Last Name"); String lastName = sc.next(); System.out.println("First Name: "+ firstName +","+" Last Name: "+ lastName); } // class Demo extends AddressBookSystem{ public static void newContact(){ boolean bravo = false; System.out.println("Want to Enter New Contact Details?"); Scanner c = new Scanner(System.in); bravo=c.nextBoolean(); if (bravo) { System.out.println("Enter New Contact Details "); ContactBook(); } else{ System.out.println("Have a Good Day!"); } } public static void main(String[] args) { ContactBook(); newContact(); // AddressBookSystem hell = new demo(); // hell.newContact(); } }
b0239a1d8067f4131eff56526f03c8ef88fc2a58
5c339eb80a332250dfde68fd7d47ee93033e89a2
/Sous vide app/ÅrsProjektVol3/src/main/java/dk/kea/model/configFiles/Security.java
138a5c5090eeccc155852fcd0c57cc07dd7202ec
[]
no_license
xerfgydt/2.-og-3.-semester-kode
04a139a07e7f3c1f7ef512d610f5b3cf89abe053
e139636555cef027ffa750d34cc397dfd8002d3e
refs/heads/master
2020-03-22T09:17:30.323012
2018-07-05T10:08:42
2018-07-05T10:08:42
139,827,417
0
0
null
null
null
null
UTF-8
Java
false
false
1,965
java
package dk.kea.model.configFiles; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import dk.kea.model.entities.User; @Configuration @EnableWebSecurity public class Security extends WebSecurityConfigurerAdapter { User u = new User(); @Autowired //her definere vi hvem der skal identificeres og hvilken rolle de skal have public void configureGlobalSecurity(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser(u.getName()).password(u.getPassword()) .roles(u.getRole()); } @Override protected void configure(HttpSecurity http) throws Exception //Throws smider answaret videre til den der kalder metoden { http.authorizeRequests() // her difineres login url .antMatchers("/login").permitAll() // her defineres hvilke html sites der IKKE må tilgås uden et login og den rigtige rolle .antMatchers("/*oste*/**","/*mad*/**","/*homepage*/**").access("hasRole('USER')").and() // HVIS DU IKKE HAR DEN RIGTIGE ROLLE BLIVER MAN SENDT TIL .formlogin() .formLogin() //Start siden efter login .defaultSuccessUrl("/homepage.html").and().exceptionHandling() .accessDeniedPage("/access-denied"); } }
9547a699b7db428d07174be4e6d05afb12503614
5832134be6eea906cfc2f364dcdd1837634a67ba
/trunk/spikes/mikes-workspace/de.berlios.rcpviewer.gui/src/de/berlios/rcpviewer/gui/GuiPlugin.java
bcc18cbecd85c239e87221a7ecf0a2b3656edf0d
[]
no_license
BackupTheBerlios/rcpviewer-svn
61c0ea77a3c2e3639656338623f61cb02135112c
eb63faba1c5e9c812a99df389acf2ec31ec60745
refs/heads/master
2020-06-04T07:12:21.899064
2006-02-28T22:34:19
2006-02-28T22:34:19
40,805,658
0
0
null
null
null
null
UTF-8
Java
false
false
5,208
java
package de.berlios.rcpviewer.gui; import java.text.DateFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.apache.log4j.Logger; import org.apache.log4j.net.SocketAppender; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.ecore.ETypedElement; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.packageadmin.PackageAdmin; import de.berlios.rcpviewer.domain.runtime.IDomainBootstrap; import de.berlios.rcpviewer.gui.fieldbuilders.FieldBuilderFactory; import de.berlios.rcpviewer.gui.fieldbuilders.IFieldBuilder; import de.berlios.rcpviewer.gui.jobs.DomainBootstrapJob; import de.berlios.rcpviewer.gui.jobs.ObjectStoreBootstrapJob; import de.berlios.rcpviewer.gui.jobs.SessionBootstrapJob; import de.berlios.rcpviewer.persistence.IObjectStore; /** * The main plugin class for base GUI functionality. */ public class GuiPlugin extends AbstractUIPlugin { /** * Common formatting for all dates. */ public static final DateFormat DATE_FORMATTER = DateFormat.getDateInstance(DateFormat.SHORT); // the shared instance. private static GuiPlugin __plugin = null; // fields private FieldBuilderFactory _fieldBuilderFactory = null; private UniversalLabelProvider _universalLabelProvider = null; private PackageAdmin _packageAdmin = null; /* static methods */ /** * Returns the shared instance. */ public static GuiPlugin getDefault() { return __plugin; } /** * Returns the string from the plugin's resource bundle, * or the key value if not found. * <br>Note that this implementation is <b>not</b> the default given * by the plugin creation wizard but instead accesses resources * via the Plugin's OSGI bundle. */ public static String getResourceString(String key) { ResourceBundle bundle = Platform.getResourceBundle( getDefault().getBundle() ); try { return (bundle != null) ? bundle.getString(key) : key; } catch (MissingResourceException e) { return key; } } /* lifecycle methods */ /** * The constructor. */ public GuiPlugin() { super(); __plugin = this; } /** * Initialises the domain and gui factories - any errors cause a * <code>CoreException</code> to be thrown and the bundle will not be started. * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) * @see org.eclipse.core.runtime.CoreException */ @Override public void start(BundleContext context) throws Exception { super.start(context); SocketAppender socketAppender = new SocketAppender("localhost", 4445); //$NON-NLS-1$ socketAppender.setLocationInfo(true); Logger.getRootLogger().addAppender(socketAppender); // Logger.getLogger(GuiPlugin.class).info( "Logging started" ); //$NON-NLS-1$ // domain initialisation IDomainBootstrap bootstrap = DomainBootstrapFactory.createBootstrap(); DomainBootstrapJob domainJob = new DomainBootstrapJob( bootstrap ); domainJob.schedule(); // object store initialisation IObjectStore store = ObjectStoreFactory.createObjectStore(); ObjectStoreBootstrapJob storeJob = new ObjectStoreBootstrapJob( store ); storeJob.schedule(); // session initialisation (default domain & store for now ) SessionBootstrapJob sessionJob = new SessionBootstrapJob( store ); sessionJob.schedule(); // instantiate fields _fieldBuilderFactory = new FieldBuilderFactory(); _universalLabelProvider = new UniversalLabelProvider(); ServiceReference ref = context.getServiceReference( PackageAdmin.class.getName()); _packageAdmin = (PackageAdmin)context.getService( ref ); // effectively running jobs synchronously waitForJob( domainJob ); waitForJob( sessionJob ); } /** * Clears all references * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { super.stop(context); __plugin = null; } /* public accessors */ /** * Accessor to field builders * @param element * @return field builder */ public IFieldBuilder getFieldBuilder( ETypedElement element ) { return _fieldBuilderFactory.getFieldBuilder( element ); } /** * Accessor to universal label providers * @return Returns the label provider */ public ILabelProvider getLabelProvider() { return _universalLabelProvider; } /** * Accessor to platform utility class. * @return */ public PackageAdmin getPackageAdmin() { assert _packageAdmin != null; return _packageAdmin; } /* private methods */ // as it says private void waitForJob( Job job ) throws InterruptedException, CoreException { assert job != null; job.join(); if ( !job.getResult().isOK() ) { getLog().log( job.getResult() ); throw new CoreException( job.getResult() ); } } }
[ "dkhaywood@20aa5975-49f2-0310-8bfd-f14d13945a73" ]
dkhaywood@20aa5975-49f2-0310-8bfd-f14d13945a73
d42f94c629cc7885898616e225ea4e7418620423
5c2dcd99caac9e3af9e259f1d2150ec1971aaf1f
/app/src/main/java/id/diaz/com/sourcewebviewer/MainActivity.java
a98030f6f1821ae3d8b725086d69583226b77842
[]
no_license
diazaulia/SourceCodeWebViewer
37c11b2dcf42715ba5758923c2aeea075cc6d231
4d583478e172ad59075ca195cc792a8a7d5019d5
refs/heads/master
2021-07-16T22:10:51.348016
2017-10-22T16:18:44
2017-10-22T16:18:44
107,865,091
0
0
null
null
null
null
UTF-8
Java
false
false
2,385
java
package id.diaz.com.sourcewebviewer; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.method.ScrollingMovementMethod; import android.view.View; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { private String[] spinnerValue; getSourceTask c1; static TextView showSource; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.spinnerValue = new String[]{ "http://", "https://" }; Spinner prot = (Spinner) findViewById(R.id.spinner1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, spinnerValue); prot.setAdapter(adapter); showSource = (TextView) findViewById(R.id.showSource); showSource.setMovementMethod(new ScrollingMovementMethod()); } public Boolean isOnline() { try { Process p1 = java.lang.Runtime.getRuntime().exec("ping -c 1 www.google.com"); int returnVal = p1.waitFor(); boolean reachable = (returnVal==0); return true; } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; } public void eksekusibos(View view) { Spinner protokol = (Spinner) findViewById(R.id.spinner1); String protokols = protokol.getSelectedItem().toString(); EditText addressnyaom = (EditText) findViewById(R.id.address); String iniaddressnya = addressnyaom.getText().toString(); if(isOnline() == true) { c1 = new getSourceTask(this); c1.execute(protokols+""+iniaddressnya); } else { Toast.makeText(this, "Internet Tidak Terkoneksi", Toast.LENGTH_LONG).show(); } //c1 = new getSourceTask(this); //c1.execute(protokols+""+iniaddressnya); } }
9a96cb5db8f8702919f671b309137a9099c61c40
2bf15be3d6d83e4fb4bad9868e60e79261353b54
/SourceCode/Server/Quiz_App/src/model/notification/Notification_Body.java
f0e36c1732fe0653351cf9c5ef5073149b9facde
[]
no_license
OpticWafare/Quiz_App
23746e243780fb6c0ceeb7ffd51d344d58332500
1c2c2124bf615dfe2600c16c1b152b3aef3d1cb5
refs/heads/master
2020-04-24T14:28:00.210006
2019-03-27T07:13:47
2019-03-27T07:13:47
172,021,746
0
0
null
null
null
null
ISO-8859-1
Java
false
false
587
java
package model.notification; /** * Für Android Push Notifications * Repräsentiert die Daten, die in der * Notification angezeigt werden sollen * (Titel und Inhalt) * */ public class Notification_Body { /** Titeltext der Notification */ private String title; /** Inhalt der Notification */ private String body; /** * Konstruktor * @param title Titeltext der Notification * @param body Inhalt der Notification */ public Notification_Body(String title, String body) { this.title = title; this.body = body; } }
[ "eller.martin29mail.com" ]
eller.martin29mail.com
928f51e6712e648bc85b2bde752c85809bc0c2d9
fc90d25de2b2de1fe88316bf6d0028b57b820f05
/src/com/skilldistillery/jets/entity/Cessna172Skyhawk.java
35365cbd447150c88324053b32090fa08b09ddfc
[]
no_license
CWRiddle/Jets
9bb45e881329dfb67a4eb523ecbecab0bdbb48f5
ff55a86b7d25de1d1d869421abf0430713ab23c0
refs/heads/main
2023-05-06T23:58:42.358172
2021-06-01T14:25:40
2021-06-01T14:25:40
372,670,604
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package com.skilldistillery.jets.entity; public class Cessna172Skyhawk extends CivilianAircraft { public Cessna172Skyhawk(){ super("Cessna 172 Skyhawk", 583, 3452.338, 90000000.00); } public Cessna172Skyhawk(String name, int speed, double range, double price) { super(name, speed, range, price); } @Override public void loadCargo() { System.out.println("Loaded [blank] pounds of cargo into the Cessna 172 Skyhawk."); } @Override public void loadPassengers() { System.out.println("Loaded [blank] passengers in the Cessna 172 Skyhawk."); } }
fa39ef1bed7de9433c7ccf2d39c0a3b696420a33
88efa77e6da0b36dd85525251e9502023ea5a7a4
/src/main/java/com/andrei/accela/codingexercise/service/AddressService.java
6883cee26064fcf603db1bceae17f02b88046757
[]
no_license
abalzan/codingexercise
7faaf7f3d73f1392452850c48d93564256cb4db6
855692c5f5beed980a851f89552eb7d29f7968ad
refs/heads/master
2023-03-07T22:22:50.507241
2021-02-20T14:19:51
2021-02-20T14:19:51
340,667,957
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.andrei.accela.codingexercise.service; import com.andrei.accela.codingexercise.dto.AddressDto; import com.andrei.accela.codingexercise.dto.PersonDto; import com.andrei.accela.codingexercise.model.Address; import com.andrei.accela.codingexercise.model.Person; import java.util.List; import java.util.Set; import java.util.UUID; public interface AddressService { List<AddressDto> getAllAddresses(); PersonDto save(UUID personId, AddressDto addressDto); void saveAddressList(Person person, Set<AddressDto> addressDto); Address getAddressById(UUID id); AddressDto update(UUID addressId, AddressDto addressDto); void delete(UUID personId, UUID addressId); Set<Address>getAllPersonAddresses(Person person); }
d8fccc2a5781053593654af09293aae36ccaf8a7
5f8c256f5085bc053dd01a0ea75122ec43c090d1
/src/main/java/com/zongb/sm/entity/OcParameter.java
a5476263c21d00f7081410890c4d448a19111bca
[]
no_license
heichong/sm
b4ffeb11805d5e817e81086cf33ecc6717f2fb5b
1aebec032d9fadebea8f2ecd949ad14bbbd19e15
refs/heads/master
2016-09-10T14:03:59.844231
2014-01-04T07:28:47
2014-01-04T07:28:47
13,403,067
0
1
null
null
null
null
UTF-8
Java
false
false
4,481
java
package com.zongb.sm.entity; import java.util.HashMap; import java.util.Map; public class OcParameter { private String urlPath ; private int languageEn ; private int languageCn ; private String imageDataPath ;//opencart的image的全路径<br/>路径截止到data文件夹 private String productTypeCode ;//您为当前商品自定义的编码 private int productSeqStart = 1 ;//商品序列的初始值 private int brandId ;//商品所属的品牌id<br/>参考[商品->链接->品牌] private int minNumDiff ;//商品描述的默认tag标签 private float productPriceTime ;//商品价格与实际价格的倍数 private String desItemType ;//商品描述的Item Type private String descTags ;//商品描述的默认tag标签 private String [] categorys ;//所属目录id private String style ;//其他描述html private String braceletType ;//其他描述html private String otherHtml ;//其他描述html private Integer storeId = 0 ;//商店id private Boolean isDownloadImage = false ;//是否下载产品图片 private Boolean onlyGetCurrentPage = false ;//是否只抽取当前页面的产品 /** * 常用计量单位名称与opencart系统中计量单位id的对应关系 */ public static Map<String,Integer> unitMap = null ; static{ unitMap = new HashMap<String,Integer>() ; unitMap.put("CM",1) ;//厘米 unitMap.put("MM",2) ;//毫米 unitMap.put("G",2) ;//克 unitMap.put("克",2) ;//克 unitMap.put("KG",1) ;//千克 unitMap.put("千克",1) ;//千克 } public Boolean getOnlyGetCurrentPage() { return onlyGetCurrentPage; } public void setOnlyGetCurrentPage(Boolean onlyGetCurrentPage) { this.onlyGetCurrentPage = onlyGetCurrentPage; } public Boolean getIsDownloadImage() { return isDownloadImage; } public void setIsDownloadImage(Boolean isDownloadImage) { this.isDownloadImage = isDownloadImage; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getBraceletType() { return braceletType; } public void setBraceletType(String braceletType) { this.braceletType = braceletType; } public static Map<String, Integer> getUnitMap() { return unitMap; } public static void setUnitMap(Map<String, Integer> unitMap) { OcParameter.unitMap = unitMap; } public Integer getStoreId() { return storeId; } public void setStoreId(Integer storeId) { this.storeId = storeId; } public String getOtherHtml() { return otherHtml; } public void setOtherHtml(String otherHtml) { this.otherHtml = otherHtml; } public String getUrlPath() { return urlPath; } public void setUrlPath(String urlPath) { this.urlPath = urlPath; } public int getLanguageEn() { return languageEn; } public void setLanguageEn(int languageEn) { this.languageEn = languageEn; } public int getLanguageCn() { return languageCn; } public void setLanguageCn(int languageCn) { this.languageCn = languageCn; } public String getImageDataPath() { return imageDataPath; } public void setImageDataPath(String imageDataPath) { this.imageDataPath = imageDataPath; } public String getProductTypeCode() { return productTypeCode; } public void setProductTypeCode(String productTypeCode) { this.productTypeCode = productTypeCode; } public int getProductSeqStart() { return productSeqStart; } public void setProductSeqStart(int productSeqStart) { this.productSeqStart = productSeqStart; } public int getBrandId() { return brandId; } public void setBrandId(int brandId) { this.brandId = brandId; } public int getMinNumDiff() { return minNumDiff; } public void setMinNumDiff(int minNumDiff) { this.minNumDiff = minNumDiff; } public float getProductPriceTime() { return productPriceTime; } public void setProductPriceTime(float productPriceTime) { this.productPriceTime = productPriceTime; } public String getDesItemType() { return desItemType; } public void setDesItemType(String desItemType) { this.desItemType = desItemType; } public String getDescTags() { return descTags; } public void setDescTags(String descTags) { this.descTags = descTags; } public String[] getCategorys() { return categorys; } public void setCategorys(String[] categorys) { this.categorys = categorys; } }
ec9ca01d82fc5dda6b1a872b0e908af0f9a2f09a
24b545967adf26e2079661e3c4bb334dea5d597d
/app/src/main/java/com/yangy/wechatrecyclerview/util/UrlUtils.java
1255ab05f3b489e8b38edbcc36918464c08ff78a
[]
no_license
qiushanyueyy/WeChatRecyclerView
8ba3ce3f1276ba4300409ce905c237efc878b65f
883f6f0415ba567a5d61442d629e361df361ba2d
refs/heads/master
2021-01-20T14:24:02.556421
2017-07-26T07:18:19
2017-07-26T07:18:19
90,605,782
1
0
null
null
null
null
UTF-8
Java
false
false
3,499
java
package com.yangy.wechatrecyclerview.util; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.TextUtils; import android.view.View; import com.yangy.wechatrecyclerview.WebViewActivity; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 检索文本中的url和手机号码 * Created by yangy on 2017/05/12 */ public class UrlUtils { public static SpannableStringBuilder formatUrlString(String contentStr) { SpannableStringBuilder sp; if (!TextUtils.isEmpty(contentStr)) { sp = new SpannableStringBuilder(contentStr); try { //处理url匹配 Pattern urlPattern = Pattern.compile("(http|https|ftp|svn)://([a-zA-Z0-9]+[/?.?])" + "+[a-zA-Z0-9]*\\??([a-zA-Z0-9]*=[a-zA-Z0-9]*&?)*"); Matcher urlMatcher = urlPattern.matcher(contentStr); while (urlMatcher.find()) { final String url = urlMatcher.group(); if (!TextUtils.isEmpty(url)) { sp.setSpan(new SpannableClickable() { @Override public void onClick(View widget) { Context context = widget.getContext(); /**打开手机自带的浏览器显示*/ // Uri uri = Uri.parse(url); // Intent intent = new Intent(Intent.ACTION_VIEW, uri); // intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); // context.startActivity(intent); /**使用自定义的WebView显示*/ Intent intent = new Intent(context, WebViewActivity.class); intent.putExtra("url", url); context.startActivity(intent); } }, urlMatcher.start(), urlMatcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } //处理电话匹配 Pattern phonePattern = Pattern.compile("[1][34578][0-9]{9}"); Matcher phoneMatcher = phonePattern.matcher(contentStr); while (phoneMatcher.find()) { final String phone = phoneMatcher.group(); if (!TextUtils.isEmpty(phone)) { sp.setSpan(new SpannableClickable() { @Override public void onClick(View widget) { Context context = widget.getContext(); //用intent启动拨打电话 Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } }, phoneMatcher.start(), phoneMatcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } } catch (Exception e) { e.printStackTrace(); } } else { sp = new SpannableStringBuilder(); } return sp; } }
e9c94dc789a6d589ebee0b53a93b3329be1d2c13
5e4af3eb976ec9abaf6b9c9bc9b4d6ab38b5cb0d
/salvo2/src/main/java/com/codeoftheweb/salvo/models/Player.java
574544f4d029db4177e841114c98f2a7c912a157
[]
no_license
MJ-25/Salvo2
9c1be0070efc7b8f33e08a5c9c8bc1351cb6b285
90256f01bdd7e23fb15c93f166a0ac035fdf1496
refs/heads/master
2020-08-06T15:55:41.671323
2019-10-07T19:05:26
2019-10-07T19:05:26
213,065,698
0
0
null
null
null
null
UTF-8
Java
false
false
3,024
java
package com.codeoftheweb.salvo.models; import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; @Entity public class Player { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "native") @GenericGenerator(name = "native", strategy = "native") private long id; private String userName; @OneToMany(mappedBy = "player", fetch = FetchType.EAGER) Set<GamePlayer> gamePlayers; @OneToMany(mappedBy = "player", fetch = FetchType.EAGER) Set<Score> scores; private String password; public Player() { } public Player(String userName, String password) { this.userName = userName; this.password = password; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public Set<GamePlayer> getGamePlayers() { return gamePlayers; } public long getId() { return id; } public void setGamePlayers(Set<GamePlayer> gamePlayers) { this.gamePlayers = gamePlayers; } public Set<Score> getScores() { return scores; } public void setScores(Set<Score> scores) { this.scores = scores; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Map<String, Object> makePlayerDetail() { Map<String, Object> dto = new LinkedHashMap<>(); dto.put("Id", this.getId()); dto.put("email", this.getUserName()); return dto; } public Map<String,Object> makePlayerScoreDTO() { Map<String, Object> dto = new LinkedHashMap<>(); dto.put("id", this.getId()); dto.put("email", this.getUserName()); dto.put("score", mapaDeScores2()); return dto; } public Map <String, Object> mapaDeScores2() { Map<String, Object> dto = new LinkedHashMap<>(); dto.put("won",this.getWins()); dto.put("tied",this.getTies()); dto.put("lost",this.getLoses()); dto.put("total",this.getTotal()); dto.put("gamesPlayed",this.getGamesPlayed()); return dto; } public long getWins(){ return this.getScores().stream() .filter(score -> score.getScore() == 1) .count(); } public long getTies(){ return this.getScores().stream() .filter(score -> score.getScore() == 0.5) .count(); } public long getLoses(){ return this.getScores().stream() .filter(score -> score.getScore() == 0) .count(); } public double getTotal(){ return this.getWins() + getTies()*0.5; } public long getGamesPlayed(){ return this.getWins() + this.getTies() + this.getLoses(); } }
de23eac94c1f29d6d64efe36ac1364942636e9f7
805c02a6968c5b88cca6e0c9e7af7a88e8e3ead9
/src/protocol/Chat.java
dbf29a4185a9642c06c5efba941663c8e31341aa
[]
no_license
ZolaBaksa/javachat
ca291d10a5a0dd0052c856065c31492093279e1c
2de7ac8255d8c57d8e788a086077948824ae5254
refs/heads/main
2023-01-29T03:27:44.563082
2020-12-03T02:35:37
2020-12-03T02:35:37
318,051,534
0
0
null
null
null
null
UHC
Java
false
false
174
java
package protocol; //public final static 생략가능 public interface Chat { String ALL = "ALL"; //전체 String MSG = "MSG"; //귓속말 String ID = "ID"; //아이디 }
849d23416bbbec63669b74618e48fe4908955966
b6eb0ecadbb70ed005d687268a0d40e89d4df73e
/feilong-lib/feilong-lib-ognl/src/main/java/com/feilong/lib/javassist/tools/reflect/Metalevel.java
689e9e2b757f28ccd800a82312b482042b8d3876
[ "Apache-2.0" ]
permissive
ifeilong/feilong
b175d02849585c7b12ed0e9864f307ed1a26e89f
a0d4efeabc29503b97caf0c300afe956a5caeb9f
refs/heads/master
2023-08-18T13:08:46.724616
2023-08-14T04:30:34
2023-08-14T04:30:34
252,767,655
97
28
Apache-2.0
2023-04-17T17:47:44
2020-04-03T15:14:35
Java
UTF-8
Java
false
false
1,268
java
/* * Javassist, a Java-bytecode translator toolkit. * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved. * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. Alternatively, the contents of this file may be used under * the terms of the GNU Lesser General Public License Version 2.1 or later, * or the Apache License Version 2.0. * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. */ package com.feilong.lib.javassist.tools.reflect; /** * An interface to access a metaobject and a class metaobject. * This interface is implicitly implemented by the reflective * class. */ public interface Metalevel{ /** * Obtains the class metaobject associated with this object. */ ClassMetaobject _getClass(); /** * Obtains the metaobject associated with this object. */ Metaobject _getMetaobject(); /** * Changes the metaobject associated with this object. */ void _setMetaobject(Metaobject m); }
084fc0aa425eda88cda618d703114a77d4ef78d5
2d9bd0fc6fd3e788b0cff0d17bc6d74c55d51671
/Sprint17_repush/referentiel/referentiel-business/src/main/java/dz/gov/mesrs/sii/referentiel/business/model/dto/RefFiliereLmdDto.java
f6b05ce54992457c2d671af2f038e8141643683b
[]
no_license
kkezzar/code2
952de18642d118d9dae9b10acc3b15ef7cfd709e
ee7bd0908ac7826074d26e214ef07c594e8a9706
refs/heads/master
2016-09-06T04:17:06.896511
2015-03-10T13:41:04
2015-03-10T13:41:04
31,958,723
1
1
null
null
null
null
UTF-8
Java
false
false
13,369
java
package dz.gov.mesrs.sii.referentiel.business.model.dto; import java.io.Serializable; import java.util.Date; import javax.xml.bind.annotation.XmlRootElement; /** * @author BELBRIK Oualid on : 21 avr. 2014 10:06:12 */ @XmlRootElement(name = "RefFiliereLmdDto") public class RefFiliereLmdDto implements Serializable{ /** * serialVersionUID * @author BELBRIK Oualid on : 16 sept. 2014 17:16:44 */ private static final long serialVersionUID = 1L; private Integer id; private String identifiant; private String lcFiliereArabe; private String lcFiliere; private String llFiliereArabe; private String llFiliere; private String descriptionFiliereArabe; private String descriptionFiliere; private Boolean isPremiereInscription; //private Nomenclature niveauRecrutement; private Integer niveauRecrutementId; private String niveauRecrutementLibelleLongFr; private String niveauRecrutementLibelleLongAr; private String niveauRecrutementLibelleCourtFr; private String niveauRecrutementLibelleCourtAr; private String niveauRecrutementCode; /*** Current Situation **/ private Date dateSituation; private String llSituationAr; private String llSituationFr; /***** Domaine ******/ private String identifiantDomaine; private Integer idDomaine; private String lcDomaine; private String lcDomaineArabe; private String llDomaine; private String llDomaineArabe; /** * [RefFiliereLmdDto.id] Getter * @author MAKERRI Sofiane on : 8 mai 2014 11:56:09 * @return the id */ public Integer getId() { return id; } /** * [RefFiliereLmdDto.id] Setter * @author MAKERRI Sofiane on : 8 mai 2014 11:56:09 * @param id the id to set */ public void setId(Integer id) { this.id = id; } /** * [RefFiliereLmdDto.identifiant] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the identifiant */ public String getIdentifiant() { return identifiant; } /** * [RefFiliereLmdDto.identifiant] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param identifiant the identifiant to set */ public void setIdentifiant(String identifiant) { this.identifiant = identifiant; } /** * [RefFiliereLmdDto.lcFiliereArabe] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the lcFiliereArabe */ public String getLcFiliereArabe() { return lcFiliereArabe; } /** * [RefFiliereLmdDto.lcFiliereArabe] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param lcFiliereArabe the lcFiliereArabe to set */ public void setLcFiliereArabe(String lcFiliereArabe) { this.lcFiliereArabe = lcFiliereArabe; } /** * [RefFiliereLmdDto.lcFiliere] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the lcFiliere */ public String getLcFiliere() { return lcFiliere; } /** * [RefFiliereLmdDto.lcFiliere] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param lcFiliere the lcFiliere to set */ public void setLcFiliere(String lcFiliere) { this.lcFiliere = lcFiliere; } /** * [RefFiliereLmdDto.llFiliereArabe] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llFiliereArabe */ public String getLlFiliereArabe() { return llFiliereArabe; } /** * [RefFiliereLmdDto.llFiliereArabe] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llFiliereArabe the llFiliereArabe to set */ public void setLlFiliereArabe(String llFiliereArabe) { this.llFiliereArabe = llFiliereArabe; } /** * [RefFiliereLmdDto.llFiliere] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llFiliere */ public String getLlFiliere() { return llFiliere; } /** * [RefFiliereLmdDto.llFiliere] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llFiliere the llFiliere to set */ public void setLlFiliere(String llFiliere) { this.llFiliere = llFiliere; } /** * [RefFiliereLmdDto.descriptionFiliereArabe] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the descriptionFiliereArabe */ public String getDescriptionFiliereArabe() { return descriptionFiliereArabe; } /** * [RefFiliereLmdDto.descriptionFiliereArabe] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param descriptionFiliereArabe the descriptionFiliereArabe to set */ public void setDescriptionFiliereArabe(String descriptionFiliereArabe) { this.descriptionFiliereArabe = descriptionFiliereArabe; } /** * [RefFiliereLmdDto.descriptionFiliere] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the descriptionFiliere */ public String getDescriptionFiliere() { return descriptionFiliere; } /** * [RefFiliereLmdDto.descriptionFiliere] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param descriptionFiliere the descriptionFiliere to set */ public void setDescriptionFiliere(String descriptionFiliere) { this.descriptionFiliere = descriptionFiliere; } /** * [RefFiliereLmdDto.dateSituation] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the dateSituation */ public Date getDateSituation() { return dateSituation; } /** * [RefFiliereLmdDto.dateSituation] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param dateSituation the dateSituation to set */ public void setDateSituation(Date dateSituation) { this.dateSituation = dateSituation; } /** * [RefFiliereLmdDto.llSituationAr] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llSituationAr */ public String getLlSituationAr() { return llSituationAr; } /** * [RefFiliereLmdDto.llSituationAr] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llSituationAr the llSituationAr to set */ public void setLlSituationAr(String llSituationAr) { this.llSituationAr = llSituationAr; } /** * [RefFiliereLmdDto.llSituationFr] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llSituationFr */ public String getLlSituationFr() { return llSituationFr; } /** * [RefFiliereLmdDto.llSituationFr] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llSituationFr the llSituationFr to set */ public void setLlSituationFr(String llSituationFr) { this.llSituationFr = llSituationFr; } /** /** * [RefFiliereLmdDto.identifiantDomaine] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the identifiantDomaine */ public String getIdentifiantDomaine() { return identifiantDomaine; } /** * [RefFiliereLmdDto.identifiantDomaine] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param identifiantDomaine the identifiantDomaine to set */ public void setIdentifiantDomaine(String identifiantDomaine) { this.identifiantDomaine = identifiantDomaine; } /** * [RefFiliereLmdDto.lcDomaine] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the lcDomaine */ public String getLcDomaine() { return lcDomaine; } /** * [RefFiliereLmdDto.lcDomaine] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param lcDomaine the lcDomaine to set */ public void setLcDomaine(String lcDomaine) { this.lcDomaine = lcDomaine; } /** * [RefFiliereLmdDto.lcDomaineArabe] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the lcDomaineArabe */ public String getLcDomaineArabe() { return lcDomaineArabe; } /** * [RefFiliereLmdDto.lcDomaineArabe] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param lcDomaineArabe the lcDomaineArabe to set */ public void setLcDomaineArabe(String lcDomaineArabe) { this.lcDomaineArabe = lcDomaineArabe; } /** * [RefFiliereLmdDto.llDomaine] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llDomaine */ public String getLlDomaine() { return llDomaine; } /** * [RefFiliereLmdDto.llDomaine] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llDomaine the llDomaine to set */ public void setLlDomaine(String llDomaine) { this.llDomaine = llDomaine; } /** * [RefFiliereLmdDto.llDomaineArabe] Getter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @return the llDomaineArabe */ public String getLlDomaineArabe() { return llDomaineArabe; } /** * [RefFiliereLmdDto.llDomaineArabe] Setter * @author BELBRIK Oualid on : 21 avr. 2014 11:56:38 * @param llDomaineArabe the llDomaineArabe to set */ public void setLlDomaineArabe(String llDomaineArabe) { this.llDomaineArabe = llDomaineArabe; } /** * [RefFiliereLmdDto.idDomaine] Getter * @author MAKERRI Sofiane on : 15 mai 2014 17:19:28 * @return the idDomaine */ public Integer getIdDomaine() { return idDomaine; } /** * [RefFiliereLmdDto.idDomaine] Setter * @author MAKERRI Sofiane on : 15 mai 2014 17:19:28 * @param idDomaine the idDomaine to set */ public void setIdDomaine(Integer idDomaine) { this.idDomaine = idDomaine; } /** * [RefFiliereLmdDto.isPremiereInscription] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the isPremiereInscription */ public Boolean getIsPremiereInscription() { return isPremiereInscription; } /** * [RefFiliereLmdDto.isPremiereInscription] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param isPremiereInscription the isPremiereInscription to set */ public void setIsPremiereInscription(Boolean isPremiereInscription) { this.isPremiereInscription = isPremiereInscription; } /** * [RefFiliereLmdDto.niveauRecrutementId] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementId */ public Integer getNiveauRecrutementId() { return niveauRecrutementId; } /** * [RefFiliereLmdDto.niveauRecrutementId] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementId the niveauRecrutementId to set */ public void setNiveauRecrutementId(Integer niveauRecrutementId) { this.niveauRecrutementId = niveauRecrutementId; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleLongFr] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementLibelleLongFr */ public String getNiveauRecrutementLibelleLongFr() { return niveauRecrutementLibelleLongFr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleLongFr] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementLibelleLongFr the niveauRecrutementLibelleLongFr to set */ public void setNiveauRecrutementLibelleLongFr( String niveauRecrutementLibelleLongFr) { this.niveauRecrutementLibelleLongFr = niveauRecrutementLibelleLongFr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleLongAr] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementLibelleLongAr */ public String getNiveauRecrutementLibelleLongAr() { return niveauRecrutementLibelleLongAr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleLongAr] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementLibelleLongAr the niveauRecrutementLibelleLongAr to set */ public void setNiveauRecrutementLibelleLongAr( String niveauRecrutementLibelleLongAr) { this.niveauRecrutementLibelleLongAr = niveauRecrutementLibelleLongAr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleCourtFr] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementLibelleCourtFr */ public String getNiveauRecrutementLibelleCourtFr() { return niveauRecrutementLibelleCourtFr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleCourtFr] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementLibelleCourtFr the niveauRecrutementLibelleCourtFr to set */ public void setNiveauRecrutementLibelleCourtFr( String niveauRecrutementLibelleCourtFr) { this.niveauRecrutementLibelleCourtFr = niveauRecrutementLibelleCourtFr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleCourtAr] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementLibelleCourtAr */ public String getNiveauRecrutementLibelleCourtAr() { return niveauRecrutementLibelleCourtAr; } /** * [RefFiliereLmdDto.niveauRecrutementLibelleCourtAr] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementLibelleCourtAr the niveauRecrutementLibelleCourtAr to set */ public void setNiveauRecrutementLibelleCourtAr( String niveauRecrutementLibelleCourtAr) { this.niveauRecrutementLibelleCourtAr = niveauRecrutementLibelleCourtAr; } /** * [RefFiliereLmdDto.niveauRecrutementCode] Getter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @return the niveauRecrutementCode */ public String getNiveauRecrutementCode() { return niveauRecrutementCode; } /** * [RefFiliereLmdDto.niveauRecrutementCode] Setter * @author BELBRIK Oualid on : 16 sept. 2014 17:16:33 * @param niveauRecrutementCode the niveauRecrutementCode to set */ public void setNiveauRecrutementCode(String niveauRecrutementCode) { this.niveauRecrutementCode = niveauRecrutementCode; } }
[ "root@lhalid-pc" ]
root@lhalid-pc
e4b8d03b1f6653db691c55e6c7ebf1565a83969b
fb14cf2d843987adfaa7e34d67b65ce8dd280ca8
/Hello/src/main/java/com/helloworld/main/Client.java
f1f3885c67ca6dc7bea96c0ae847991bfafa4a4b
[]
no_license
sumanreddy99/java
48e0ef7d665d7300b0094a47d9d9476d9e003705
19569b68f3f0996ff3cd42d196f80b6c0b0c261a
refs/heads/master
2022-12-16T09:15:04.285561
2020-06-30T11:26:25
2020-06-30T11:26:25
189,870,293
0
0
null
null
null
null
UTF-8
Java
false
false
573
java
package com.helloworld.main; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.helloworld.Hellodomain.Hello; public class Client { public static void main(String[] args) { // TODO Auto-generated method stub //Resource resource=new ClassPathResource("spring.xml"); ApplicationContext applicationContext=new ClassPathXmlApplicationContext("resources/applicationContext.xml"); Object o=applicationContext.getBean("hello"); Hello h=(Hello)o; h.hello(); } }
4522733fbca8753faba32fe7d6428f6e9a579262
aa6997aba1475b414c1688c9acb482ebf06511d9
/src/org/omg/IOP/CodecPackage/FormatMismatchHelper.java
db10dc22168f7179e0d372b45e4093dcb43c2963
[]
no_license
yueny/JDKSource1.8
eefb5bc88b80ae065db4bc63ac4697bd83f1383e
b88b99265ecf7a98777dd23bccaaff8846baaa98
refs/heads/master
2021-06-28T00:47:52.426412
2020-12-17T13:34:40
2020-12-17T13:34:40
196,523,101
4
2
null
null
null
null
UTF-8
Java
false
false
2,233
java
package org.omg.IOP.CodecPackage; /** * org/omg/IOP/CodecPackage/FormatMismatchHelper.java . Generated by the IDL-to-Java compiler * (portable), version "3.2" from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u60/4407/corba/src/share/classes/org/omg/PortableInterceptor/IOP.idl * Tuesday, August 4, 2015 11:07:53 AM PDT */ abstract public class FormatMismatchHelper { private static String _id = "IDL:omg.org/IOP/Codec/FormatMismatch:1.0"; public static void insert(org.omg.CORBA.Any a, org.omg.IOP.CodecPackage.FormatMismatch that) { org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); a.type(type()); write(out, that); a.read_value(out.create_input_stream(), type()); } public static org.omg.IOP.CodecPackage.FormatMismatch extract(org.omg.CORBA.Any a) { return read(a.create_input_stream()); } private static org.omg.CORBA.TypeCode __typeCode = null; private static boolean __active = false; synchronized public static org.omg.CORBA.TypeCode type() { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc(_id); } __active = true; org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[0]; org.omg.CORBA.TypeCode _tcOf_members0 = null; __typeCode = org.omg.CORBA.ORB.init() .create_exception_tc(org.omg.IOP.CodecPackage.FormatMismatchHelper.id(), "FormatMismatch", _members0); __active = false; } } } return __typeCode; } public static String id() { return _id; } public static org.omg.IOP.CodecPackage.FormatMismatch read( org.omg.CORBA.portable.InputStream istream) { org.omg.IOP.CodecPackage.FormatMismatch value = new org.omg.IOP.CodecPackage.FormatMismatch(); // read and discard the repository ID istream.read_string(); return value; } public static void write(org.omg.CORBA.portable.OutputStream ostream, org.omg.IOP.CodecPackage.FormatMismatch value) { // write the repository ID ostream.write_string(id()); } }
eb758a810ae3eafb05e61d7c75b50f80b62c65cd
979b9f90f551d2551baaa78379aba616dde85d34
/src/Ejercicios_asociaciones_triangulo/prueba.java
1f5420601728f62988332bf47471160702dff687
[]
no_license
jgarnicaa/animacionC
c2b1d576771e78fa751c95c6509aa19aaf1284dd
da0b56c87e5e6cedaf89f40e8d7651da98f6d607
refs/heads/master
2020-06-05T21:21:20.955370
2019-06-18T13:51:44
2019-06-18T13:51:44
192,549,627
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Ejercicios_asociaciones_triangulo; import java.util.*; /** * * @author usuario */ public class prueba { public static void main(String[]arg){ color f = new color(10,10,30); color c = new color(20,20,10); vertices v1 = new vertices(10,10); vertices v2= new vertices (20,30); vertices v3 = new vertices (0, 5); triangulo t= new triangulo(v1,v2,v3,c,f); double area=t.calcularArea(); System.out.println(area); } }
693f93d99cb98e0cf4f17abf7e72fa6569779238
1fbf1205f0435a5f8ecde1fa4cf9852013959177
/src/main/java/com/jw/shop/service/UserServiceImpl.java
42861bba90ebd78b871447e20cfa4b26883c36a3
[ "Apache-2.0" ]
permissive
JWwwwww/shop
4bb783ea03fc5203c2bb23e7a778f72e0a6ec994
ae624fbd8ed413f9a5dc0f334e98a5cc7833793b
refs/heads/master
2020-03-28T01:35:24.244853
2018-09-11T06:43:03
2018-09-11T06:43:03
147,515,676
1
0
null
null
null
null
UTF-8
Java
false
false
2,058
java
package com.jw.shop.service; import java.util.List; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestBody; import com.jw.shop.mapper.OrderMapper; import com.jw.shop.mapper.ProductMapper; import com.jw.shop.mapper.UserMapper; @Service public class UserServiceImpl implements UserService { @Autowired UserMapper umapper; @Autowired ProductMapper pmapper; @Autowired OrderMapper omapper; @Override public User login(int id, String password) { User user = umapper.query(id, password); return user; } @Override public void register(User user) { umapper.add(user); } @Override public List<Product> all() { List<Product> list = pmapper.all(); return list; } @Override public void oadd(Order order) { omapper.oadd(order); } @Override public void oupdata(Order order) { omapper.oupdata(order); } @Override public Order oquery(Order order) { Order order2 = omapper.oquery(order); return order2; } @Override public List<OrderInfo> oall(OrderInfo info) { List<OrderInfo> list = omapper.oall(info); return list; } @Override public void delete(OrderInfo info) { omapper.delete(info); } @Override public List<User> alluser() { List<User> list = umapper.alluser(); return list; } @Override public void ud(User user) { umapper.ud(user); } @Override public void pd(Product product) { pmapper.pd(product); } @Override public void uxg(User user) { umapper.uxg(user); } @Override public void pxg(Product product) { pmapper.pxg(product); } @Override public void padd(Product product) { pmapper.padd(product); } @Override public void tj(Order order) { omapper.tj(order); } @Override public List<Product> ser(String pname) { List<Product> list = pmapper.ser(pname); return list; } @Override public Product pslt(OrderInfo orderInfo) { Product product = omapper.pslt(orderInfo); return product; } }
2a602cf395c4fbef22a49ea9ce0806e18c829f83
601a0ac3c62bd3c7a727ff73437d7234aa422596
/src/main/java/com/virsec/webservices/rest/TestPolicyGeneration.java
f2bbc680c17b1f1e86c2fb74caedebfe276cacaa
[]
no_license
sm2226/TestPolicyGeneration
949cca99411c6e6597e99592c15179f6b3d4ae97
1feb9a9bf777bb60a9c0ff3e3e90fc268557200d
refs/heads/master
2020-03-25T00:40:17.542166
2018-08-01T21:22:21
2018-08-01T21:22:21
143,198,417
0
0
null
null
null
null
UTF-8
Java
false
false
14,950
java
package com.virsec.webservices.rest; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.List; import java.util.UUID; import javax.ws.rs.FormParam; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; @Path("/xml") public class TestPolicyGeneration { @POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces("application/xml") public String createMessage(@FormParam("policyID") String policyID, @FormParam("policyName") String policyName, @FormParam("policy_desc") String policy_desc, @FormParam("vstig_version") String vstig_version, @FormParam("severity") String severity, @FormParam("platform_id") String platform_id, @FormParam("crud_id") List<String> crud_id, @FormParam("policy_operand") List<String> policy_operand, @FormParam("process_operands") List<String> process_operands, @FormParam("PO_value") List<String> PO_value, @FormParam("procSelect") String procSelect, @FormParam("procValue") String procValue, @FormParam("procCond") List<String> procCond, @FormParam("procCondValue") List<String> procCondValue, @FormParam("procPA") String procPA, @FormParam("PAproc_operands") List<String> PAproc_operands, @FormParam("PAPO_value") List<String> PAPO_value, @FormParam("PAprocSelect") String PAprocSelect, @FormParam("PAprocValue") String PAprocValue, @FormParam("PAprocCond") List<String> PAprocCond, @FormParam("PAprocCondValue") List<String> PAprocCondValue, @FormParam("registry_operands") List<String> registry_operands, @FormParam("RO_value") List<String> RO_value, @FormParam("regSelect") String regSelect, @FormParam("regValue") String regValue, @FormParam("regCond") List<String> regCond, @FormParam("regCondValue") List<String> regCondValue, @FormParam("regPA") String regPA, @FormParam("PAreg_operands") List<String> PAreg_operands, @FormParam("PARO_value") List<String> PARO_value, @FormParam("PAregSelect") String PAregSelect, @FormParam("PAregValue") String PAregValue, @FormParam("PAregCond") List<String> PAregCond, @FormParam("PAregCondValue") List<String> PAregCondValue, @FormParam("file_operands") List<String> file_operands, @FormParam("FO_value") List<String> FO_value, @FormParam("fileSelect") String fileSelect, @FormParam("fileValue") String fileValue, @FormParam("fileCond") List<String> fileCond, @FormParam("fileCondValue") List<String> fileCondValue, @FormParam("filePA") String filePA, @FormParam("PAfile_operands") List<String> PAfile_operands, @FormParam("PAFO_value") List<String> PAFO_value, @FormParam("PAfileSelect") String PAfileSelect, @FormParam("PAfileValue") String PAfileValue, @FormParam("PAfileCond") List<String> PAfileCond, @FormParam("PAfileCondValue") List<String> PAfileCondValue) { Document document = DocumentHelper.createDocument(); Element root = document.addElement( "policy" ) .addAttribute("Policy_id", policyID); Element PolicyNameElement = root.addElement("policy_name"); PolicyNameElement.addText(policyName); Element PolicyDescElement = root.addElement("policy_desc"); PolicyDescElement.addText(policy_desc); Element vSTIGPriorityElement = root.addElement( "Severity" ); vSTIGPriorityElement.addText(severity); Element vSTIGVersionElement = root.addElement( "vSTIGVersion" ); vSTIGVersionElement.addText(vstig_version); Element platformIDElement = root.addElement( "platformID" ); platformIDElement.addText(platform_id); Element crudElement = root.addElement("crudOperations"); for(int j=0; j<crud_id.size(); j++) { crudElement.addElement("CRUDOperation") .addText(crud_id.get(j)); } for(int k=0; k<policy_operand.size();k++) { if(policy_operand.get(k).equals("process")) { Element PORuleElement = root.addElement("Rule"); Element processOperandsElement = PORuleElement.addElement("ProcessOperands"); for(int a=0; a<process_operands.size(); a++) { Element processOperandElement = processOperandsElement.addElement("ProcessOperand"); processOperandElement.addElement("OperandType") .addText(process_operands.get(a)); processOperandElement.addElement("OperandValue") .addText(PO_value.get(a)); } Element procActionOnOperandsElement = PORuleElement.addElement("TaskOnOperands"); procActionOnOperandsElement.addElement("Task") .addText(procSelect); procActionOnOperandsElement.addElement("TaskVariable") .addText(procValue); Element procCondElements = PORuleElement.addElement("ConditionElements"); for(int a=0; a<procCond.size(); a++) { Element procCondElement = procCondElements.addElement("ConditionElement"); procCondElement.addElement("Condition") .addText(procCond.get(a)); procCondElement.addElement("ConditionValue") .addText(procCondValue.get(a)); } Element procProtectionActionElement = root.addElement("ProtectionAction"); procProtectionActionElement.addElement("Action") .addText(procPA); Element PAProcOperandsElement = procProtectionActionElement.addElement("ProcessOperands"); for(int a=0; a<PAproc_operands.size(); a++) { Element PAProcOperandElement = PAProcOperandsElement.addElement("ProcessOperand"); PAProcOperandElement.addElement("OperandType") .addText(PAproc_operands.get(a)); PAProcOperandElement.addElement("OperandValue") .addText(PAPO_value.get(a)); } Element PAProcActionOnOperandsElement = procProtectionActionElement.addElement("TaskOnOperands"); PAProcActionOnOperandsElement.addElement("Task") .addText(PAprocSelect); if(PAprocValue != null) { PAProcActionOnOperandsElement.addElement("TaskVariable") .addText(PAprocValue); } Element PAProcCondElements = procProtectionActionElement.addElement("ConditionElements"); for(int a=0; a<PAprocCond.size(); a++) { Element PAProcCondElement = PAProcCondElements.addElement("ConditionElement"); PAProcCondElement.addElement("Condition") .addText(PAprocCond.get(a)); PAProcCondElement.addElement("ConditionValue") .addText(PAprocCondValue.get(a)); } } else if(policy_operand.get(k).equals("registry")) { Element RORuleElement = root.addElement("Rule"); Element regOperandsElement = RORuleElement.addElement("RegistryOperands"); //int b=flogicalOp.size(); for(int a=0; a<registry_operands.size(); a++) { Element regOperandElement = regOperandsElement.addElement("RegistryOperand"); regOperandElement.addElement("OperandType") .addText(registry_operands.get(a)); regOperandElement.addElement("OperandValue") .addText(RO_value.get(a)); } Element regActionOnOperandsElement = RORuleElement.addElement("TaskOnOperands"); regActionOnOperandsElement.addElement("Task") .addText(regSelect); regActionOnOperandsElement.addElement("TaskVariable") .addText(regValue); Element regCondElements = RORuleElement.addElement("ConditionElements"); for(int a=0; a<regCond.size(); a++) { Element regCondElement = regCondElements.addElement("ConditionElement"); regCondElement.addElement("Condition") .addText(regCond.get(a)); regCondElement.addElement("ConditionValue") .addText(regCondValue.get(a)); } Element regProtectionActionElement = root.addElement("ProtectionAction"); regProtectionActionElement.addElement("Action") .addText(regPA); Element PARegOperandsElement = regProtectionActionElement.addElement("RegistryOperands"); //int b=flogicalOp.size(); for(int a=0; a<PAreg_operands.size(); a++) { Element PARegOperandElement = PARegOperandsElement.addElement("RegistryOperand"); PARegOperandElement.addElement("OperandType") .addText(PAreg_operands.get(a)); PARegOperandElement.addElement("OperandValue") .addText(PARO_value.get(a)); } Element PARegActionOnOperandsElement = regProtectionActionElement.addElement("TaskOnOperands"); PARegActionOnOperandsElement.addElement("Task") .addText(PAregSelect); PARegActionOnOperandsElement.addElement("TaskVariable") .addText(PAregValue); Element PARegCondElements = regProtectionActionElement.addElement("ConditionElements"); for(int a=0; a<PAregCond.size(); a++) { Element PARegCondElement = PARegCondElements.addElement("ConditionElement"); PARegCondElement.addElement("Condition") .addText(PAregCond.get(a)); PARegCondElement.addElement("ConditionValue") .addText(PAregCondValue.get(a)); } } else { Element FORuleElement = root.addElement("Rule"); Element fileOperandsElement = FORuleElement.addElement("FileOperands"); //int b=flogicalOp.size(); for(int a=0; a<file_operands.size(); a++) { Element fileOperandElement = fileOperandsElement.addElement("FileOperand"); fileOperandElement.addElement("OperandType") .addText(file_operands.get(a)); fileOperandElement.addElement("OperandValue") .addText(FO_value.get(a)); } Element actionOnOperandsElement = FORuleElement.addElement("TaskOnOperands"); actionOnOperandsElement.addElement("Task") .addText(fileSelect); actionOnOperandsElement.addElement("TaskVariable") .addText(fileValue); Element fileCondElements = FORuleElement.addElement("ConditionElements"); for(int a=0; a<fileCond.size(); a++) { Element fileCondElement = fileCondElements.addElement("ConditionElement"); fileCondElement.addElement("Condition") .addText(fileCond.get(a)); fileCondElement.addElement("ConditionValue") .addText(fileCondValue.get(a)); } Element ProtectionActionElement = root.addElement("ProtectionAction"); ProtectionActionElement.addElement("Action") .addText(filePA); Element PAfileOperandsElement = ProtectionActionElement.addElement("FileOperands"); //int b=flogicalOp.size(); for(int a=0; a<PAfile_operands.size(); a++) { Element PAfileOperandElement = PAfileOperandsElement.addElement("FileOperand"); PAfileOperandElement.addElement("OperandType") .addText(PAfile_operands.get(a)); PAfileOperandElement.addElement("OperandValue") .addText(PAFO_value.get(a)); } Element PAactionOnOperandsElement = ProtectionActionElement.addElement("TaskOnOperands"); PAactionOnOperandsElement.addElement("Task") .addText(PAfileSelect); if(PAfileValue != null) { PAactionOnOperandsElement.addElement("TaskVariable") .addText(PAfileValue); } Element PAfileCondElements = ProtectionActionElement.addElement("ConditionElements"); for(int a=0; a<PAfileCond.size(); a++) { Element PAfileCondElement = PAfileCondElements.addElement("ConditionElement"); PAfileCondElement.addElement("Condition") .addText(PAfileCond.get(a)); PAfileCondElement.addElement("ConditionValue") .addText(PAfileCondValue.get(a)); } } } String text = document.asXML(); System.out.println("This is my XML: " +text); return text; } }
62a0e73999197a1acfc42b5dd27795b46a0c9d61
7731416ca9afff3e69141d5d0087c193ca3e7180
/src/CAL_Runtime/src/org/openquark/cal/internal/runtime/lecc/RTCAF.java
fe11d33548efb71bdfeb31e8445efbe33f6935d2
[]
no_license
rdwebster/Open-Quark
288d38f823e21ec2e338adb2d05f3e05b027f603
86397b53eea2518851b4995edae2aa687f8d8812
refs/heads/master
2021-01-20T15:50:03.540743
2014-07-23T18:11:37
2014-07-23T18:11:37
481,429
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
/* * Copyright (c) 2007 BUSINESS OBJECTS SOFTWARE LIMITED * 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 Business Objects 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 OWNER 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. */ /* * RTCAF * Created: July 29th, 2003 11:24:48 AM * By: RCypher */ package org.openquark.cal.internal.runtime.lecc; /** * @author Raymond Cypher * * This class is the base class for constant applicative forms (CAFs). * A CAF is a zero arity function that will return the same value each time * it is reduced. Currently CAFs are zero arity non-foreign CAL functions. */ public abstract class RTCAF extends RTSupercombinator { // At this point in time RTCAF is primarily a place holder. // It allows the generated code to differentiate between // constant applicative forms and general supercombinators. // This is mostly used to make freeing cached results easier. // I also allows a location for future functionality that is // specific to CAFs and not applicable to zero arity functions // in general. }
ea19b44840348aeb0521bb9fa16b03190bd7a38f
33120f4aae69393f9e10ff2394e795ec2ca7ee75
/yiboweb-boot/src/main/java/cn/yibo/boot/common/annotation/IgnoredLog.java
cec139395e4bed85d127dc6786cda4bed823ac44
[]
no_license
Wyiwan/yibo-mqces-common
9fd4df60b770cbdcd4e8ef5aa01ebe10d1ee8c4b
e37bd20eb12ce2c8459a1e0352d8658193e13a38
refs/heads/master
2022-06-22T14:14:38.546461
2019-11-15T09:07:35
2019-11-15T09:07:35
221,885,308
0
0
null
2022-06-17T02:37:54
2019-11-15T09:02:30
Java
UTF-8
Java
false
false
1,252
java
/* {***************************************************************************** { 广州医博-基础框架 v1.0 { 版权信息 (c) 2018-2020 广州医博信息技术有限公司. 保留所有权利. { 创建人: 高云 { 审查人: { 模块:日志记录模块 { 功能描述: { { --------------------------------------------------------------------------- { 维护历史: { 日期 维护人 维护类型 { --------------------------------------------------------------------------- { 2019-01-11 高云 新建 { { --------------------------------------------------------------------------- { 注:本模块代码为底层基础框架封装的系统模块 {***************************************************************************** */ package cn.yibo.boot.common.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * 忽略日志记录注解 * @author 高云 * @since 2019-01-11 * @version v1.0 */ @Target({ ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface IgnoredLog { boolean ignore() default true; }
bbe45ac84bdc390b76ee9e99326de7cb503a576f
6632563ded5b150ce4571a3047489406a67b628d
/server/src/main/java/nu/aron/peerjuke/server/Dirlist.java
7f5ca690e90be58295eacdcd93e9a2d7cd8c12a2
[ "Apache-2.0" ]
permissive
andreasaronsson/peerjuke
f8427b38ed9fae8ee2dc33e3aeadd35aacce40a2
e39960580aa4ca5d005ba8b7aef3eb8df6227b6b
refs/heads/master
2021-07-06T18:19:46.412906
2020-10-13T05:25:33
2020-10-15T15:55:35
34,893,992
0
0
Apache-2.0
2020-10-15T15:56:18
2015-05-01T07:48:18
Java
UTF-8
Java
false
false
534
java
package nu.aron.peerjuke.server; import static java.util.stream.Collectors.toList; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Collections; import java.util.List; class Dirlist { List<String> dirList(String path) { try { return Files.list(Paths.get(path.replaceAll("%2F", "/"))).map(p -> p.toString()).collect(toList()); } catch (IOException e) { e.printStackTrace(); return Collections.emptyList(); } } }
fd4b861d71a236d283d1d28419c7d9fdaace0f8e
e27b2bb15db66e98bee2ce0e8ca6b1e0c5656d23
/Decompiler/src/nb/decompiler/action/compile/CompileViewListener.java
5035ac7829d7497b934834ba104ab93b616de003
[]
no_license
acedamace/jd-netbeans
6924210f62cf53802de73b15847a2d6c413f09ec
d5f5bd5e9048f9ebed837704b3d733e84e7270ae
refs/heads/master
2022-05-06T09:58:12.214091
2012-12-09T21:33:20
2012-12-09T21:33:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
942
java
package nb.decompiler.action.compile; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import org.openide.awt.ActionID; import org.openide.awt.ActionReference; import org.openide.awt.ActionRegistration; import org.openide.loaders.DataObject; import org.openide.util.NbBundle.Messages; @ActionID( category = "Source", id = "nb.decompiler.action.compile.CompileViewListener") @ActionRegistration( iconBase = "nb/decompiler/action/compile/jd-src.png", displayName = "#CTL_CompileViewListener") @ActionReference(path = "Toolbars/Build", position = -120) @Messages("CTL_CompileViewListener=Compile View") public final class CompileViewListener implements ActionListener { private final DataObject context; public CompileViewListener(DataObject context) { this.context = context; } @Override public void actionPerformed(ActionEvent e) { // TODO implement action body } }
4e7d80bee254b7dba12f25baabfccce083eb5f13
2834bf025b9d5a92c828f09dbf15b3d2991fa04a
/finalproject/src/main/java/com/finalproject/domain/Company.java
873b2e42494b903b8dfb7aefb9831a54151b13dc
[ "MIT" ]
permissive
bricedjilo/CS4125_database_models
475053f85d0e0a3e71f9ea6af063542c03feb9a8
de68fd0bafddf70324bb02c0930a1bcbc91a509e
refs/heads/master
2021-01-10T12:52:32.563412
2015-12-01T18:24:29
2015-12-01T18:24:29
43,833,402
1
0
null
2015-12-01T18:24:30
2015-10-07T17:38:38
Java
UTF-8
Java
false
false
1,023
java
package com.finalproject.domain; public class Company { private int compId; private String name; private String primarySector; private String website; public Company(String name, String primarySector, String website) { this.name = name; this.primarySector = primarySector; this.website = website; } public Company() { } public int getCompId() { return compId; } public void setCompId(int compId) { this.compId = compId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPrimarySector() { return primarySector; } public void setPrimarySector(String primarySector) { this.primarySector = primarySector; } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website; } @Override public String toString() { return "Company [compId=" + compId + ", name=" + name + ", primarySector=" + primarySector + ", website=" + website + "]"; } }
4a2fe048bd7efd8a1dc1457b44eb7203bc90c8d4
24e4becb0ebbe69b3080ab0bedea0bf760c78d6a
/src/com/javarush/test/level06/lesson11/bonus03/Solution.java
77a70733e7d3657b09a5bb41424d54c994729b2c
[]
no_license
MMauz/JavaRushHomeWork
7831c305c7cfdfb36cf72d3dcfcd883a9412305c
be20a9e68906e121196c8bdef6e776f4a25d23a6
refs/heads/master
2020-04-06T03:38:35.304068
2016-08-08T11:48:35
2016-08-08T11:48:35
64,384,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,021
java
package com.javarush.test.level06.lesson11.bonus03; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; /* Задача по алгоритмам Задача: Написать программу, которая вводит с клавиатуры 5 чисел и выводит их в возрастающем порядке. Пример ввода: 3 2 15 6 17 Пример вывода: 2 3 6 15 17 */ public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); ArrayList<Integer> list = new ArrayList<Integer>(); //напишите тут ваш код for (int i = 0; i < 5; i++){ int x = Integer.parseInt(reader.readLine()); list.add(x); } Collections.sort(list); for (int i = 0; i < 5; i++) System.out.println(list.get(i)); } }
e6d15ce615ce0aa7209fa9a12d03036eea2cb7eb
caad3f7cfe5aff4155a7cb9d6629c5f4c00100dd
/SRV_CONF_DynamicConf/src/main/java/com/telefonica/gal/dynamicconf/unica/bu/dto/RoutingKey_UNICA_BU.java
cc8d1ac50e893847039c072814c5357d99c20451
[]
no_license
AlfonsoMartinezBern/00230056-gal-plus
b670c58c041dbb9e9c4742422468ca1234b1d55a
06707df547231fcaaeb05d17153a5052f14a48d2
refs/heads/main
2023-07-12T01:56:22.310541
2021-07-24T16:27:22
2021-07-24T16:27:22
389,085,588
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package com.telefonica.gal.dynamicconf.unica.bu.dto; public class RoutingKey_UNICA_BU { private String instanceID; private String platformID; private String operation; public RoutingKey_UNICA_BU(String instanceID, String platformID, String operation) { this.instanceID = instanceID; this.platformID = platformID; this.operation = operation; } public String getInstanceID() { return instanceID; } public void setInstanceID(String instanceID) { this.instanceID = instanceID; } public String getPlatformID() { return platformID; } public void setPlatformID(String platformID) { this.platformID = platformID; } public String getOperation() { return operation; } public void setOperation(String operation) { this.operation = operation; } @Override public String toString() { return "RoutingKey_UNICA_BU{" + "instanceID='" + instanceID + '\'' + ", platformID='" + platformID + '\'' + ", operation='" + operation + '\'' + '}'; } }
ead2ed6bd9fe6f5893af31c3c86380e4a672ced1
4e3751b8b44069fd3ac6e42d7a3629ce12f076df
/IA/src/datamining/Database.java
2c8b397b2a8a66d8910bb5f261e4491569b7b153
[]
no_license
Nikkunemufr/Java
6ab307bc3bd604e41b5a1749681c133bcedc0723
c4b5326b527723c5bdcd09370ecb3860ea8e7b75
refs/heads/master
2023-01-02T19:28:39.149706
2020-10-22T08:29:42
2020-10-22T08:29:42
112,723,867
0
0
null
null
null
null
UTF-8
Java
false
false
3,042
java
package datamining; import representations.Variable; import java.util.*; /** * @author Vincent DEMENEZES, Alexis MORTELIER, Alexandre LELOUTRE */ public class Database { private List<Variable> listVariable; private List<Map<Variable, String>> listTransactions; /** * Constructeur instanciant une database * * @param listVariable liste des variables appartenant a la database * @param listTransactions liste des transactions appartenant a la database */ public Database(List<Variable> listVariable, List<Map<Variable, String>> listTransactions) { this.listVariable = listVariable; this.listTransactions = listTransactions; } /** * Transforme une database non booléenne en une database booléenne * * @return database transformé en database booléenne */ public BooleanDatabase toBooleanDatabase() { List<Variable> listVariableBoolean = new ArrayList<>(); List<Map<Variable, String>> listTransactionsBoolean = new ArrayList<>(); HashSet<String> bool = new HashSet<>(); bool.add("0"); bool.add("1"); // Transformation des variables non boolean en variable boolean for (Variable var : listVariable) { for (String value : var.getDomaine()) { listVariableBoolean.add(new Variable(var.getNom() + "_" + value, bool)); } } // Transformation des transactions non boolean en transactions boolean for (Map<Variable, String> transaction : listTransactions) { Map<Variable, String> mapTransactionBoolean = new HashMap<>(); // Initialisation de toute les variables boolean for (Variable var : listVariableBoolean) { mapTransactionBoolean.put(var, "0"); } // Pour chaque variable étant dans une transaction on passe sa valeur à vrai for (Map.Entry mapEntry : transaction.entrySet()) { Variable key = (Variable) mapEntry.getKey(); for (Variable var : listVariableBoolean) { if (var.getNom().equals(key.getNom() + "_" + transaction.get(key))) { mapTransactionBoolean.put(var, "1"); } } } // Ajout de la transaction boolean a la liste de toute les transactions boolean listTransactionsBoolean.add(mapTransactionBoolean); } return new BooleanDatabase(listVariableBoolean, listTransactionsBoolean); } /** * Methode permettant d'acceder à la liste des variables passé au constructeur * * @return liste des variables */ public List<Variable> getListVariable() { return listVariable; } /** * Methode permettant d'acceder à la liste des transactions passé au constructeur * * @return liste des transactions */ public List<Map<Variable, String>> getListTransactions() { return listTransactions; } }
d68742e8263d019d9e87233500dc1c3500c31b7a
faf4e97b109f5c173596650848d18978a220929b
/app/src/main/java/ais/co/th/readsecret/MainActivity.java
e281bb4c72d367c24af7a949908804a3d4f44d4c
[]
no_license
casanovapick/ReadSecret
0a807154ada002261b506ab53daf99684532dfee
e3bbb5c86ef24d39e46bafbd1a623b5686098773
refs/heads/master
2020-05-31T08:30:19.145851
2015-03-18T07:58:37
2015-03-18T07:58:37
32,298,251
0
1
null
2015-03-18T08:24:38
2015-03-16T03:08:04
Java
UTF-8
Java
false
false
2,446
java
package ais.co.th.readsecret; import android.content.ComponentName; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceManager; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends ActionBarActivity { Button btnGET; TextView txtSecret; Button btnOut; SharedPreferences prefs; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); prefs = PreferenceManager.getDefaultSharedPreferences(this); btnGET = (Button) findViewById(R.id.btn_get); btnOut = (Button) findViewById(R.id.btn_logout); txtSecret = (TextView) findViewById(R.id.txt_secret); btnGET.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(); intent.setComponent(new ComponentName("ais.co.th.writesecret", "ais.co.th.writesecret.ConfirmActivity")); startActivityForResult(intent,200); } }); btnOut.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { prefs.edit().putString("Secret","").apply(); finish(); } }); if(prefs.getString("Secret","").matches("")){ btnOut.setVisibility(View.GONE); btnGET.setVisibility(View.VISIBLE); }else{ txtSecret.setText("Login with "+prefs.getString("Secret","")); btnGET.setVisibility(View.GONE); btnOut.setVisibility(View.VISIBLE); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (200 == requestCode) { if (resultCode == RESULT_OK) { txtSecret.setText("Login with "+data.getStringExtra("Secret")); prefs.edit().putString("Secret", data.getStringExtra("Secret")).apply(); btnGET.setVisibility(View.GONE); btnOut.setVisibility(View.VISIBLE); } } } }
c5d25c0c45efcbb1238d1b26c9f1ae99570d4d20
6fe54233321a486eafd5ea8721e5f22d68e1d972
/LapTrinhMang/D7HN_2/src/Cau1/Rmi_Interface.java
569f5560c0d5c0a8041b7c8f8c499debe1975fbf
[]
no_license
z3r0k3n/codebasic
2df5e8c4e58db7a572c0c2fc7ba34c07bc5ce6d9
a30286f696c37e6d377781d6f9c5d728b623140c
refs/heads/master
2020-04-14T07:22:06.539430
2019-05-15T23:17:38
2019-05-15T23:17:38
163,710,112
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Cau1; import java.rmi.Remote; import java.rmi.RemoteException; /** * * @author Zero Ken */ public interface Rmi_Interface extends Remote{ public String tamgiac (int a,int b,int c) throws RemoteException; }
0e709fdba531cb4c722bce81c2083f59453c606e
9370a7675dc89cf8b840c53840fef9a73f251eb5
/Spring Rest/LearnToday-RESTAPI/src/main/java/com/cognizant/LearnTodayRESTAPI/dao/impl/CourseDaoImpl.java
ec8f96db5f5d92ef911b4a521b5bad71bbf46141
[]
no_license
jagadeeshbusayavalasa/Stage-3-894141
b68a4fdef927e04dbca844718c8df415714a56d2
67108aac913c13b4d011205ce13eb6074c302c80
refs/heads/main
2023-04-03T23:23:09.678594
2021-04-04T17:42:28
2021-04-04T17:42:28
351,977,775
0
0
null
null
null
null
UTF-8
Java
false
false
1,357
java
package com.cognizant.LearnTodayRESTAPI.dao.impl; import java.util.List; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.stereotype.Repository; import com.cognizant.LearnTodayRESTAPI.dao.CourseDao; import com.cognizant.LearnTodayRESTAPI.model.Course; import com.cognizant.LearnTodayRESTAPI.rowmapper.CourseRowMapper; @Repository public class CourseDaoImpl implements CourseDao{ public DataSource dataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/rest"); dataSource.setUsername("root"); dataSource.setPassword("Root@54"); return dataSource; } JdbcTemplate template = new JdbcTemplate(dataSource()); @Override public List<Course> getAllCourses() { String sql = "select * from course"; CourseRowMapper crm = new CourseRowMapper(); List<Course> courses = template.query(sql, crm); return courses; } @Override public List<Course> getCourseById(int courseId) { String sql = "select * from course where courseId=?"; CourseRowMapper crm = new CourseRowMapper(); return template.query(sql, crm, courseId); } }
6273271c73caee3f0b0243bc7735fa6d3d237c85
2568c6b060a0c3f788868b95949d8365e34dfaff
/src/test/java/AutomationPractice/Martin/SignUpLogin.java
4fa09725ff11cfd0f57845e081b0933f4ad1dbca
[]
no_license
tjurkovsky/SeleniumProject
239a441e245e64bd38a778ff18f78f88daa19a99
3fb7d54249f3edac24fc1b4f0d295874c0b65781
refs/heads/master
2021-05-04T05:53:47.187442
2016-10-16T17:35:42
2016-10-16T17:35:42
71,076,150
0
0
null
2016-10-16T20:44:43
2016-10-16T20:44:43
null
UTF-8
Java
false
false
6,506
java
package AutomationPractice.Martin; /** * Created by Jerry on 16.10.2016. */ import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; import org.junit.*; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.Select; public class SignUpLogin { private static ChromeDriver driver; WebElement element; @BeforeClass public static void openBrowser() { driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } @Before public void goToHomePage(){ driver.get("http://automationpractice.com/index.php"); try{ element = driver.findElement(By.className("logout")); if (element != null){ element.click(); } } catch (Exception e){ } } @Test public void invalidEmailFormatLogin(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email")).sendKeys("random.com"); driver.findElement(By.id("passwd")).click(); try { element = driver.findElement(By.xpath("//div[@class='form-group form-error']")); } catch (Exception e){ } Assert.assertNotNull("Error of wrong email format has not been shown!",element); } //checks if error shows up if wrong email format is provided @Test public void validEmailFormatLogin(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email")).sendKeys("[email protected]"); driver.findElement(By.id("passwd")).click(); try { element = driver.findElement(By.xpath("//div[@class='form-group form-ok']")); } catch (Exception e){ } Assert.assertNotNull("Ok sign has not been shown up!",element); } //checks if OK sign shows up if right email format is provided @Test public void invalidLoginData(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email")).sendKeys("[email protected]"); driver.findElement(By.id("passwd")).sendKeys("random"); driver.findElement(By.id("passwd")).submit(); try { element = driver.findElement(By.xpath("//div[@class='alert alert-danger']")); } catch (Exception e){ } Assert.assertNotNull("No error has been shown up,after non existing user tried to login!",element); } //checks if error shows up,after non existing user tries to login @Test public void validLoginData(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email")).sendKeys("[email protected]"); driver.findElement(By.id("passwd")).sendKeys("kiklop"); driver.findElement(By.id("SubmitLogin")).click(); try { element = element.findElement(By.className("logout")); } catch (Exception e){ } Assert.assertNotNull("User has not been signed up,even with correct login data!",element); } // checks if login works. Tries to login with correct login data @Test public void invalidEmailFormatSignUp(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email_create")).sendKeys("random.com"); driver.findElement(By.id("email_create")).submit(); try { element = driver.findElement(By.id("create_account_error")); } catch (Exception e){ } Assert.assertNotNull("Error of wrong email format has not been shown!",element); } //checks if error shows up if wrong email format is provided @Test public void validEmailFormatSignUp(){ driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email_create")).sendKeys("[email protected]"); driver.findElement(By.id("email_create")).submit(); try { element = driver.findElement(By.id("customer_firstname")); } catch (Exception e){ } Assert.assertNotNull("Even though,right email has been provided,error has been shown!",element); } //checks if OK sign shows up if right email format is provided @Test public void signUp(){ Random rand = new Random(); int value = rand.nextInt(100000); driver.findElement(By.linkText("Sign in")).click(); driver.findElement(By.id("email_create")).sendKeys("woodburn"+value+"@seznam.cz"); driver.findElement(By.id("email_create")).submit(); try{ driver.findElement(By.id("id_gender1")).click(); driver.findElement(By.id("customer_firstname")).sendKeys("Jerry"); driver.findElement(By.id("customer_lastname")).sendKeys("Woodburn"); driver.findElement(By.id("passwd")).sendKeys("kiklop"); Select selectDays = new Select(driver.findElement(By.xpath("//select[@id='days']"))); selectDays.selectByValue("25"); Select selectMonths = new Select(driver.findElement(By.xpath("//select[@id='months']"))); selectMonths.selectByValue("8"); Select selectYears = new Select(driver.findElement(By.xpath("//select[@id='years']"))); selectYears.selectByValue("1994"); driver.findElement(By.id("newsletter")).click(); driver.findElement(By.id("optin")).click(); driver.findElement(By.id("address1")).sendKeys("Jablonova 100"); driver.findElement(By.id("city")).sendKeys("Brno"); Select selectState = new Select(driver.findElement(By.xpath("//select[@name='id_state']"))); selectState.selectByValue("8"); driver.findElement(By.id("postcode")).sendKeys("85496"); driver.findElement(By.id("phone")).sendKeys("854965785"); driver.findElement(By.id("submitAccount")).click(); element = driver.findElement(By.className("info-account")); } catch (Exception e){ } Assert.assertEquals("user has not beed succesfuly signed up!",element.getAttribute("innerText"),"Welcome to your account. Here you can manage all of your personal information and orders."); } //tries to create a new client @AfterClass public static void goBackAgain(){ driver.quit(); } }
754cc6194ae6721da0e3923255ccb58ab7158f91
87b28aa75b499cf8930d0340ee0e0091e33185e3
/objectify_simple/src/objectify_simple/OfyHelper.java
573c9aba58c4a963249ca2d1b26f708f5a9bd339
[]
no_license
learn9/objectify_trial
28a06aa1deba66468b67647b1aa3c040af6701a7
ec9e6875a83a46f72c0585e07cfaadb344e89aa0
refs/heads/master
2021-01-10T09:16:04.807839
2015-12-09T14:10:19
2015-12-09T14:10:19
47,623,004
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
package objectify_simple; import com.googlecode.objectify.Objectify; import com.googlecode.objectify.ObjectifyFactory; import com.googlecode.objectify.ObjectifyService; import javax.servlet.ServletContextListener; import javax.servlet.ServletContextEvent; /** * OfyHelper, a ServletContextListener, is setup in web.xml to run before a JSP is run. This is * required to let JSP's access Ofy. **/ public class OfyHelper implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { // This will be invoked as part of a warmup request, or the first user request if no warmup // request. ObjectifyService.register(Car.class); } public void contextDestroyed(ServletContextEvent event) { // App Engine does not currently invoke this method. } }
0e09bcba9f5bf159df5889bbe43c65cb6d4aab37
e33e76e2ac73c7646a2757cdb51874ee1cd586d6
/app/src/main/java/qfpay/wxshop/listener/MaijiaxiuUploadListener.java
36cb60fa718c19b9affb03b8611a9a2a75f279bc
[]
no_license
dengjiaping/mmwd
9f55239125a25ade7482c4b71dfeb23985becd9c
e10020be640572e51f5a18a2ba21c32d3bc87f56
refs/heads/master
2021-07-14T17:06:55.528125
2017-10-18T11:10:25
2017-10-18T11:10:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
509
java
package qfpay.wxshop.listener; import java.io.Serializable; import qfpay.wxshop.data.beans.BuyerResponseWrapper.BuyerShowBean; public interface MaijiaxiuUploadListener extends Serializable{ // 上传进度 void onUpload(int progress); // 上传成功 void onSuccess(boolean add, int index, BuyerShowBean bean); // 上传失败 void onUploadFaild(); // 上传初始化progress void onInitProgress(int count, BuyerShowBean bean, boolean isWb, boolean isTwb, boolean isQzone, boolean isEdit); }
6239e2dec540bff77e7fe7de389139467fc5967d
1bea62b4579f1b1de3482cc0326f683cc1436458
/ql/src/java/org/apache/hadoop/hive/ql/udf/esri/ST_AsJson.java
6ae59857432f5d210695dc4137a8f41002a09852
[ "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Python-2.0", "BSD-2-Clause" ]
permissive
apache/hive
f23dd565389b2c7988d0bbc665315234e54ed62c
c93276ab1771cbab7da93049daba48cc5213192e
refs/heads/master
2023-09-04T10:37:39.942068
2023-09-03T11:20:28
2023-09-03T11:20:28
206,444
5,152
4,688
Apache-2.0
2023-09-14T19:36:42
2009-05-21T02:31:01
Java
UTF-8
Java
false
false
2,928
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.hadoop.hive.ql.udf.esri; import com.esri.core.geometry.Geometry; import com.esri.core.geometry.GeometryEngine; import com.esri.core.geometry.ogc.OGCGeometry; import org.apache.hadoop.hive.ql.exec.Description; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Description(name = "ST_AsJSON", value = "_FUNC_(ST_Geometry) - return JSON representation of ST_Geometry\n", extended = "Example:\n" + " SELECT _FUNC_(ST_Point(1.0, 2.0)) from onerow; -- {\"x\":1.0,\"y\":2.0}\n" + " SELECT _FUNC_(ST_SetSRID(ST_Point(1, 1), 4326)) from onerow; -- {\"x\":1.0,\"y\":1.0,\"spatialReference\":{\"wkid\":4326}}") //@HivePdkUnitTests( // cases = { // @HivePdkUnitTest( // query = "select ST_AsJSON(ST_Point(1, 2)), ST_AsJSON(ST_SetSRID(ST_Point(1, 1), 4326)) from onerow", // result = "{\"x\":1.0,\"y\":2.0} {\"x\":1.0,\"y\":1.0,\"spatialReference\":{\"wkid\":4326}}" // ), // @HivePdkUnitTest( // query = "SELECT ST_AsJSON(ST_MultiLineString(array(1, 1, 2, 2, 3, 3), array(10, 10, 11, 11, 12, 12))) from onerow", // result = "{\"paths\":[[[1.0,1.0],[2.0,2.0],[3.0,3.0]],[[10.0,10.0],[11.0,11.0],[12.0,12.0]]]}" // ), // @HivePdkUnitTest( // query = "SELECT ST_AsJSON(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)), ST_AsJSON(ST_Polygon(1, 1)) from onerow", // result = "{\"rings\":[[[1.0,1.0],[1.0,4.0],[4.0,4.0],[4.0,1.0],[1.0,1.0]]]} NULL" // ) // } // ) public class ST_AsJson extends ST_Geometry { static final Logger LOG = LoggerFactory.getLogger(ST_AsJson.class.getName()); public Text evaluate(BytesWritable geomref) { if (geomref == null || geomref.getLength() == 0) { LogUtils.Log_ArgumentsNull(LOG); return null; } OGCGeometry ogcGeometry = GeometryUtils.geometryFromEsriShape(geomref); if (ogcGeometry == null) { LogUtils.Log_ArgumentsNull(LOG); return null; } Geometry esriGeom = ogcGeometry.getEsriGeometry(); int wkid = GeometryUtils.getWKID(geomref); return new Text(GeometryEngine.geometryToJson(wkid, esriGeom)); } }
79ee000b1cb81eeec2081bfccd933861fa938509
807c05324f4ab03af5339435a96ef77586b2ca2f
/src/main/java/net/exathunk/jereal/base/functional/ResFunc3.java
b0a46624628b735e65182720df55d69d14570fd3
[]
no_license
ejconlon/jerial
fd03b3dd6d09b753cbd3cc3311d6fd8dbedc3cf6
031154160b5c388c2dc6024cafb771001fb488cc
refs/heads/master
2021-01-02T08:31:53.674801
2012-11-14T01:50:15
2012-11-14T01:50:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
162
java
package net.exathunk.jereal.base.functional; /** * charolastra 10/28/12 12:06 AM */ public interface ResFunc3<A, B, C, Z> { Z runResFunc(A a, B b, C c); }
70dd36b49f7d685994befbfa6c9de7d6c9c462d7
623ef934bf74b4ab4c51feef9e1405f69208ea34
/src/model/EstUnFilm.java
f1a578ea458f711aa2fc4eb2c2f69fd57c6ddd3a
[]
no_license
AndriyParkho/Klex_BDD
5281b657d247f9d30b112801e4ffee0495ddd61c
7bade220036c87556e836b22dacca0c6b00389c7
refs/heads/master
2023-03-01T22:25:11.895736
2020-12-11T17:08:42
2020-12-11T17:08:42
339,063,623
0
0
null
null
null
null
UTF-8
Java
false
false
1,004
java
package model; import java.sql.Date; public class EstUnFilm { private long idFichier; private String titreFilm; private Date anneeSortie; public EstUnFilm(long idFichier, String titreFilm, Date anneeSortie) { this.idFichier = idFichier; this.titreFilm = titreFilm; this.anneeSortie = anneeSortie; } public long getIdFichier() { return idFichier; } public void setIdFichier(long idFichier) { this.idFichier = idFichier; } public String getTitreFilm() { return titreFilm; } public void setTitreFilm(String titreFilm) { this.titreFilm = titreFilm; } public Date getAnneeSortie() { return anneeSortie; } public void setAnneeSortie(Date anneeSortie) { this.anneeSortie = anneeSortie; } @Override public String toString() { return "EstUnFilm [anneeSortie=" + anneeSortie + ", idFichier=" + idFichier + ", titreFilm=" + titreFilm + "]"; } }
9a8444cb80300f8031ff3bad5f8baac4eed7245a
ae444bc7e74e7555921543301b9668b0279761c4
/Student_Test_System/src/Student/Student_login.java
e67a794f260b700f60e619d793f05d97b6b191df
[]
no_license
SaifUrRehman21/Student_Test_System
b4f3b0014006066c78147556786519357e1a2068
a5fe3194bc2fe868f95783175cda293c550793fa
refs/heads/master
2020-04-19T09:16:41.574778
2019-01-29T08:17:42
2019-01-29T08:17:42
168,105,187
0
0
null
null
null
null
UTF-8
Java
false
false
5,417
java
package Student; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.border.BevelBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.SoftBevelBorder; import TestSystem.Admin_SignUp; import TestSystem.Admin_login; import TestSystem.Admin_panel; import TestSystem.Select_Panel; public class Student_login extends JFrame { private JPanel contentPane; private JTextField textField; private JPasswordField passwordField; private JLabel lblClickHere; private JLabel lblForgetPassword; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Student_login frame = new Student_login(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Student_login() { setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 518, 538); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); textField = new JTextField(); textField.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); textField.setFont(new Font("Tahoma", Font.PLAIN, 15)); textField.setBounds(140, 156, 273, 29); contentPane.add(textField); textField.setColumns(10); passwordField = new JPasswordField(); passwordField.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); passwordField.setFont(new Font("Tahoma", Font.PLAIN, 15)); passwordField.setBounds(140, 218, 273, 29); contentPane.add(passwordField); JButton btnCreateAccount = new JButton(""); btnCreateAccount.setIcon(new ImageIcon(Select_Panel.class.getResource("/Images/CreateAccount_Button.jpg"))); btnCreateAccount.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Admin_login a=new Admin_login(); a.setVisible(false); Admin_SignUp b=new Admin_SignUp(); b.setVisible(true); } }); btnCreateAccount.setBounds(48, 360, 427, 70); contentPane.add(btnCreateAccount); JButton btnLogin = new JButton(""); btnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { { String user=textField.getText(); String pass=passwordField.getText(); if (user.isEmpty() ||pass.isEmpty()) { JOptionPane.showConfirmDialog(null, "Username & Password must not be empty."); } else { try { Class.forName("com.mysql.jdbc.Driver"); String URL="jdbc:mysql://localhost/studenttestsystem"; Connection con=DriverManager.getConnection(URL,"root",""); Statement st=con.createStatement(); PreparedStatement pst = con.prepareStatement("select * from Student_Signup where Username=? and Password=?"); pst.setString(1, user); pst.setString(2, pass); ResultSet rs = pst.executeQuery(); if (rs.next()) { JOptionPane.showConfirmDialog(null, "Login Successfull"); textField.setText(""); passwordField.setText(""); Student_login a=new Student_login(); a.setVisible(false); Start_Test b=new Start_Test(); b.setVisible(true); } else { JOptionPane.showConfirmDialog(null, "Login Unsuccessfull"); textField.setText(""); passwordField.setText(""); } } catch(Exception e) { System.out.println(e); } } } } }); btnLogin.setIcon(new ImageIcon(Select_Panel.class.getResource("/Images/Login_Button.jpg"))); btnLogin.setBounds(48, 279, 427, 70); contentPane.add(btnLogin); lblClickHere = new JLabel("Click Here"); lblClickHere.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent arg0) { JOptionPane.showConfirmDialog(null, "Successfully! Remember your password and Try again"); } }); lblClickHere.setForeground(new Color(0, 0, 255)); lblClickHere.setFont(new Font("Tahoma", Font.PLAIN, 13)); lblClickHere.setBounds(282, 430, 93, 38); contentPane.add(lblClickHere); lblForgetPassword = new JLabel("Forget Password?"); lblForgetPassword.setFont(new Font("Tahoma", Font.PLAIN, 13)); lblForgetPassword.setBounds(180, 430, 102, 38); contentPane.add(lblForgetPassword); JLabel label = new JLabel(""); label.setBackground(Color.YELLOW); label.setIcon(new ImageIcon(Student_login.class.getResource("/Images/Student_login.jpg"))); label.setBounds(0, 0, 514, 514); contentPane.add(label); } }
9258f1ee3968922761e10316becb7a2aad2812d9
f05be3e1c41a903eab2340ad11bd3cf54271897d
/src/main/java/com/money/controller/api/MonyMAPController.java
e54340b9a89676bb02e568df4e45f6eb785c5a40
[]
no_license
ali-mahdavi/mMap
c80b893190a8eaaf88f38b8994b9e5d3f35bf305
16102b65d491d2b7abba7a7589cd10374e7c9845
refs/heads/master
2020-04-05T13:15:35.320679
2018-11-09T17:20:03
2018-11-09T17:20:03
155,550,103
0
0
null
null
null
null
UTF-8
Java
false
false
1,904
java
package com.money.controller.api; import com.money.service.UserService; import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; /** * Created by a.mahdavi on 10/31/2018. */ @RestController @RequestMapping("/api") public class MonyMAPController { private Logger logger= org.slf4j.LoggerFactory.getLogger(MonyMAPController.class); @Autowired UserService userService; /* @RequestMapping(value = "/list",method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public <T> ResponseEntity<T> getList(@RequestParam("type") int type) { logger.debug("Provider has received request to get person with id: " + type); try{ ArrayList<ListOfItems> list= monyMapService.getListTitle(type); return new ResponseEntity<T>((T) list,HttpStatus.OK); } catch (Exception exp) { logger.error(exp.toString()); return new ResponseEntity<T>((T) exp.getMessage(),HttpStatus.NOT_FOUND); } }*/ // @RequestMapping(value = "/user",method = RequestMethod.GET) // @ResponseStatus(HttpStatus.OK) // public <T> ResponseEntity<T> getPerson() { // // try{ // // return new ResponseEntity<T>((T) userService.listPerson(),HttpStatus.OK); // } // catch (Exception exp) // { // logger.error(exp.toString()); // return new ResponseEntity<T>((T) exp.getMessage(),HttpStatus.NOT_FOUND); // } // // } }
49d8d3aba4bf2d44c6735862a28e35083ee1c9a9
c10b91aa00852b138f3ca7d79cf2d2d0577ab9e0
/Client/SocketClient/gen/acer/com/socketclient/R.java
38f7db163dab97a85796ee4be410c3fb2e401ec7
[]
no_license
weihsiang-lin/Smart-Lock
df5fdaf37a1d6b667d7c4941c26319132fbb9c24
0006b6802920e24979b35a1bf72c371a571663f7
refs/heads/master
2020-05-30T00:15:58.166639
2014-02-25T06:31:00
2014-02-25T06:31:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,592
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package acer.com.socketclient; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f050000; public static final int activity_vertical_margin=0x7f050001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f090001; public static final int textView1=0x7f090000; } public static final class layout { public static final int socketclient=0x7f030000; } public static final class menu { public static final int socket_client=0x7f080000; } public static final class string { public static final int action_settings=0x7f060001; public static final int app_name=0x7f060000; public static final int hello_world=0x7f060002; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f070000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f070001; } public static final class xml { public static final int nfc_tech_filter=0x7f040000; } }
5a26a49b99670c2033ff77b830d060153c939b38
260a3dc0eee02ee175c19d7b6aaebb258819decc
/study/lose/src/com/ssh/lose/dao/impl/LetterDAOImpl.java
928431b5b8fa88c022e3a17aac18fd1be6841b41
[]
no_license
nkkadmin/study
9d811b6efe0ca8c11829c20da9ed15a68bdb7089
98a094901574e30c5bf500622c712bba90a7265e
refs/heads/master
2020-04-05T14:38:58.506005
2017-11-08T10:11:02
2017-11-08T10:11:02
94,728,536
0
1
null
null
null
null
UTF-8
Java
false
false
243
java
package com.ssh.lose.dao.impl; import org.springframework.stereotype.Repository; import com.ssh.lose.dao.LetterDAO; import com.ssh.lose.po.Letter; @Repository public class LetterDAOImpl extends BaseDAOImpl<Letter> implements LetterDAO { }
07029af2b72deeb106115025118a93bf48852e0c
7c9e49474a29f7e79955f721945dcda22ec03099
/Dynamo/src/net/dynamo/Dao/UAVMapDAO.java
230b695bc857ba026e07192a7a9afbc4899ec43b
[]
no_license
CS698/Dynamo
0ee17d791be6261a203adf7cf7c1fafe0d270213
b1a9bdb0e7101517f3baf24975dc354a9f0ccc1d
refs/heads/master
2021-01-17T07:04:14.793684
2016-05-23T21:42:07
2016-05-23T21:42:07
51,626,422
0
1
null
null
null
null
UTF-8
Java
false
false
158
java
package net.dynamo.Dao; import java.util.List; import java.util.Map; public interface UAVMapDAO { public abstract Map uavToMap(int counter); }
a50901eaadc107893af3e7a7baeaf34f86c38a48
cf70b04f98fb450687ef7ef44f7b869d63ae5a22
/FileManagementAssistant/app/src/main/java/com/example/administrator/filemanagementassistant/util/ScrollAwareFABBehavior.java
c7e37104e3eb0c9001555b6e8c94a02dfbfff500
[ "Apache-2.0" ]
permissive
haibowen/MyGraduationProject
91e1f8bbcbb0d7a8d850d8b9aed40123e8c42886
53962dd3e4b61fff91672b81a6c2636b3fefad8e
refs/heads/master
2021-06-22T04:32:51.831750
2020-12-27T02:25:45
2020-12-27T02:25:45
159,469,172
4
0
null
null
null
null
UTF-8
Java
false
false
2,320
java
package com.example.administrator.filemanagementassistant.util; import android.content.Context; import android.support.design.widget.CoordinatorLayout; import android.support.v4.view.ViewCompat; import android.support.v4.view.animation.FastOutSlowInInterpolator; import android.util.AttributeSet; import android.view.View; import android.view.animation.LinearInterpolator; import com.getbase.floatingactionbutton.FloatingActionsMenu; public class ScrollAwareFABBehavior extends CoordinatorLayout.Behavior<FloatingActionsMenu> { private static final android.view.animation.Interpolator INTERPOLATOR = new FastOutSlowInInterpolator(); private boolean mIsAnimatingOut = false; public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { super(); } @Override public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionsMenu child, View directTargetChild, View target, int nestedScrollAxes) { //处理垂直方向上的滚动事件 return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes); } @Override public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionsMenu child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); if (dyConsumed > 0) { // 向下滑动 //如果是展开的话就先收回去 if (child.isExpanded()) { child.collapse(); } animateOut(child); } else if (dyConsumed < 0) { // 向上滑动 animateIn(child); } } private void animateOut(final FloatingActionsMenu button) { CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) button.getLayoutParams(); int bottomMargin = layoutParams.bottomMargin; button.animate().translationY(button.getHeight() + bottomMargin).setInterpolator(new LinearInterpolator()).start(); } private void animateIn(FloatingActionsMenu button) { button.animate().translationY(0).setInterpolator(new LinearInterpolator()).start(); } }
53d450b0885235261dfd3ec56065c54474f03aac
6377712f58b113de13a36bbdfaeda8747b463798
/app/src/main/java/com/ysh/testopengl/ShaderUtils.java
a95d3cbd0156bd6bc69214d344b02aed3020b403
[]
no_license
SHLURENJIA/OpenGLTestPractice
a6c65267f724012c9580a9848114a308a9748a24
6c2b05bd7e1e13ef3cdc5b7144862d0df12d9843
refs/heads/master
2020-04-24T14:12:38.018064
2019-03-01T01:39:57
2019-03-01T01:39:57
172,012,700
0
0
null
null
null
null
UTF-8
Java
false
false
4,450
java
package com.ysh.testopengl; import android.content.res.Resources; import android.opengl.GLES20; import android.util.Log; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; /** * 作者:create by @author{ YSH } on 2019/2/21 * 描述:着色器辅助工具类 * 修改备注: */ public class ShaderUtils { /** * 创建着色器程序 * * @param vertexShader * @param fragmentShader * @return */ public static int createProgram(String vertexShader, String fragmentShader) { //加载顶点着色器 int vertexShaderId = loadShader(GLES20.GL_VERTEX_SHADER, vertexShader); if (vertexShaderId == 0) { return 0; } //加载片元着色器 int fragShaderId = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader); if (fragShaderId == 0) { return 0; } //创建着色器程序 int program = GLES20.glCreateProgram(); //在程序中加入顶点着色器和片元着色器 if (program != 0) { //加入顶点着色器 GLES20.glAttachShader(program, vertexShaderId); checkGlError("glAttachShader"); //加入片元着色器 GLES20.glAttachShader(program, fragShaderId); checkGlError("glAttachShader"); //链接程序 GLES20.glLinkProgram(program); //存放成功的程序 int[] linkStatus = new int[1]; //获取program链接情况 GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); if (linkStatus[0] != GLES20.GL_TRUE) { //链接失败,删除程序 Log.e("ES20_ERROR", "Could not link program: "); Log.e("ES20_ERROR", GLES20.glGetProgramInfoLog(program)); GLES20.glDeleteProgram(program); return 0; } } return program; } /** * 加载着色器,编译着色器 * * @param type 着色器类型 GLES20.GL_VERTEX_SHADER GLES20.GL_FRAGMENT_SHADER * @param shaderString 着色器程序内容文本字符串 * @return 着色器程序id */ private static int loadShader(int type, String shaderString) { //创建着色器对象 int shaderid = GLES20.glCreateShader(type); if (shaderid != 0) {//创建成功 //加载着色器代码到着色器对象 GLES20.glShaderSource(shaderid, shaderString); //编译着色器 GLES20.glCompileShader(shaderid); //存放编译成功Shader数量数组 int[] compileStatus = new int[1]; //获取shader编译情况 GLES20.glGetShaderiv(shaderid, GLES20.GL_COMPILE_STATUS, compileStatus, 0); if (compileStatus[0] == 0) { //编译失败,显示日志并删除该对象 Log.e("GLES20", "Could not compile shader " + type + ":"); Log.e("GLES20", GLES20.glGetShaderInfoLog(shaderid)); GLES20.glDeleteShader(shaderid); return 0; } } return shaderid; } /** * 从 assets 资源文件夹中读取着色器内容 * * @param fname 着色器文件名称 * @param r * @return 着色器内容 */ public static String loadFromAssetsFile(String fname, Resources r) { String result = null; try { InputStream in = r.getAssets().open(fname); int ch = 0; ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((ch = in.read()) != -1) { baos.write(ch); } byte[] buff = baos.toByteArray(); baos.close(); in.close(); result = new String(buff, "UTF-8"); result.replaceAll("\\r\\n", "\n"); } catch (IOException e) { e.printStackTrace(); } return result; } /** * 检查每一步操作是否有错误方法 * * @param op */ public static void checkGlError(String op) { int error; while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { Log.e("ES20_ERROR", op + ": glError " + error); throw new RuntimeException(op + ": glError " + error); } } }
db23bd677e6858b0b80fef88c2c498de8cf54185
c509aaa82416276aa100ff1c1f45b871fc7144cc
/command/src/main/java/v2/Main.java
57cf445798ae3c935156c4ceeba81a85a007ca9f
[]
no_license
risiblefish/gof23
e42b1bff3baac4ef049c9b57f725d7ebe014a80f
e654285f9cfe7594695ee6eb45c5c1d1305ff279
refs/heads/master
2023-01-12T00:41:05.134917
2020-11-12T08:16:33
2020-11-12T08:16:33
308,046,348
0
0
null
null
null
null
UTF-8
Java
false
false
2,915
java
package v2; import java.util.ArrayList; import java.util.List; /** * v1 问题: 如何实现一连串的undo? * * v2 : 使用cor * * 下面的实现是一次性做完所有do和undo, 】 * 如果要更灵活, 可以将所有command放到一个链表里, * 每次执行新的command,实际的操作是(先将command加到链表里,再执行command的doit) * 每次执行undo,实际操作是(从链表中取出最后一个command,执行该command的undo),然后将这个command移出链表 * * @author Sean Yu * @date 2020/11/2 11:38 */ public class Main { public static void main(String[] args) { Content c = new Content(); Chain chain = new Chain().add(new InsertCommand(c)).add(new CopyCommand(c)).add(new DeleteCommand(c)); chain.doit(chain); chain.undo(chain); } } abstract class Command { Content c; public abstract void doit(Chain chain); public abstract void undo(Chain chain); } class Content { String msg = "hello from sean"; } class InsertCommand extends Command { String strToInsert = "InsertStr"; public InsertCommand(Content c) { this.c = c; } @Override public void doit(Chain chain) { c.msg = c.msg + strToInsert; System.out.println(c.msg); chain.doit(chain); } @Override public void undo(Chain chain) { c.msg = c.msg.substring(0, c.msg.length() - strToInsert.length()); System.out.println(c.msg); chain.undo(chain); } } class DeleteCommand extends Command { String deleted; public DeleteCommand(Content c) { this.c = c; } @Override public void doit(Chain chain) { deleted = c.msg.substring(0, 5); c.msg = c.msg.substring(5, c.msg.length()); System.out.println(c.msg); chain.doit(chain); } @Override public void undo(Chain chain) { c.msg = deleted + c.msg; System.out.println(c.msg); chain.undo(chain); } } class CopyCommand extends Command { public CopyCommand(Content c) { this.c = c; } @Override public void doit(Chain chain) { c.msg = c.msg + c.msg; System.out.println(c.msg); chain.doit(chain); } @Override public void undo(Chain chain) { c.msg = c.msg.substring(0, c.msg.length() / 2); System.out.println(c.msg); chain.undo(chain); } } class Chain { List<Command> commands = new ArrayList<>(); int index = 0; public Chain add(Command c) { commands.add(c); return this; } public void doit(Chain chain) { if (index == commands.size()) { return; } commands.get(index++).doit(chain); } public void undo(Chain chain) { if (index == 0) { return; } commands.get(--index).undo(chain); } }
41e8501150d02cc23e0e73c71f7ab711d9446b2e
e9604b8d885383682ab37375f586c9759b443e63
/src/main/java/com/jessica/mc/domain/Cliente.java
b054c7cb34744cbc39d3ea99cb60ff32aa3f43f2
[]
no_license
jlzimmerhansl/cursomc
3c7c9573e0a4801c87ad6fbceef66eae8e2d9db6
982b28c1943d847d19e6a58da3cd475e2646f927
refs/heads/master
2023-03-25T17:22:36.743646
2021-02-23T19:05:08
2021-02-23T19:05:08
335,032,450
0
0
null
null
null
null
UTF-8
Java
false
false
2,901
java
package com.jessica.mc.domain; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.persistence.CollectionTable; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import com.fasterxml.jackson.annotation.JsonIgnore; import com.jessica.mc.domain.enums.TipoCliente; @Entity public class Cliente implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nome; private String email; private String cpfOuCnpj; private Integer tipo; @OneToMany(mappedBy = "cliente") private List<Endereco> enderecos = new ArrayList<>(); @ElementCollection @CollectionTable(name="TELEFONE") private Set<String> telefones = new HashSet<>(); @JsonIgnore @OneToMany(mappedBy = "cliente") private List<Pedido> pedidos = new ArrayList<>(); public Cliente() {} public Cliente(Integer id, String nome, String email, String cpfOuCnpj, TipoCliente tipo) { super(); this.id = id; this.nome = nome; this.email = email; this.cpfOuCnpj = cpfOuCnpj; this.tipo = tipo.getCode(); } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCpfOuCnpj() { return cpfOuCnpj; } public void setCpfOuCnpj(String cpfOuCnpj) { this.cpfOuCnpj = cpfOuCnpj; } public TipoCliente getTipo() { return TipoCliente.toEnum(tipo); } public void setTipo(TipoCliente tipo) { this.tipo = tipo.getCode(); } public List<Endereco> getEnderecos() { return enderecos; } public void setEnderecos(List<Endereco> enderecos) { this.enderecos = enderecos; } public Set<String> getTelefones() { return telefones; } public void setTelefones(Set<String> telefones) { this.telefones = telefones; } public List<Pedido> getPedidos() { return pedidos; } public void setPedidos(List<Pedido> pedidos) { this.pedidos = pedidos; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Cliente other = (Cliente) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
2ce6d7b560be7bd595d096089beb62f07b75f716
3507b514f50835fea377235419575aa76a13411c
/src/main/java/com/sschudakov/gui/Perspective.java
9c0889be83ca0676312c6ce92bac8932ccfa5a13
[]
no_license
SChudakov/OOPLab
303a8d7f7bb7af0c7d9a30c2e5aa8284602a40b1
180fba6f056658c25b6e3fb75e1f69f4e57595f8
refs/heads/master
2021-09-16T07:17:45.207665
2018-06-18T12:06:20
2018-06-18T12:06:20
105,442,980
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
package com.sschudakov.gui; /** * Created by Semen Chudakov on 20.09.2017. */ public enum Perspective { FileManager(), FileRedactor(); Perspective(){ } }
c7ffe18852c36b1b3d0f3cfb81281ae11486c2eb
e5ca704cfff43c93974f7c99961eb24305d609c9
/catmos_gui/workspace/CapabilityOverTime.editor/src/CapOverTime/presentation/CapOverTimeActionBarContributor.java
2a4dc6f36ff3e74992500f98bfaa8cde9c294425
[]
no_license
Frankablu/CATMOS
f4369bbdf41b9cfc30aa98a295935df07a21a224
8c8b33cc2f0297fd5ffe184b76fb954eac3c81ed
refs/heads/master
2021-01-19T00:25:50.447735
2015-01-15T04:23:52
2015-01-15T04:23:52
21,400,436
2
0
null
null
null
null
UTF-8
Java
false
false
14,898
java
/** * <copyright> * </copyright> * * $Id$ */ package CapOverTime.presentation; import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.common.ui.viewer.IViewerProvider; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.domain.IEditingDomainProvider; import org.eclipse.emf.edit.ui.action.ControlAction; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; import org.eclipse.emf.edit.ui.action.LoadResourceAction; import org.eclipse.emf.edit.ui.action.ValidateAction; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IContributionManager; import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.SubContributionItem; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PartInitException; /** * This is the action bar contributor for the CapOverTime model editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class CapOverTimeActionBarContributor extends EditingDomainActionBarContributor implements ISelectionChangedListener { /** * This keeps track of the active editor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IEditorPart activeEditorPart; /** * This keeps track of the current selection provider. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ISelectionProvider selectionProvider; /** * This action opens the Properties view. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IAction showPropertiesViewAction = new Action(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { @Override public void run() { try { getPage().showView("org.eclipse.ui.views.PropertySheet"); } catch (PartInitException exception) { CapOverTimeEditorPlugin.INSTANCE.log(exception); } } }; /** * This action refreshes the viewer of the current editor if the editor * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IAction refreshViewerAction = new Action(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { @Override public boolean isEnabled() { return activeEditorPart instanceof IViewerProvider; } @Override public void run() { if (activeEditorPart instanceof IViewerProvider) { Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); if (viewer != null) { viewer.refresh(); } } } }; /** * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor * generated for the current selection by the item provider. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<IAction> createChildActions; /** * This is the menu manager into which menu contribution items should be added for CreateChild actions. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IMenuManager createChildMenuManager; /** * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor * generated for the current selection by the item provider. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<IAction> createSiblingActions; /** * This is the menu manager into which menu contribution items should be added for CreateSibling actions. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IMenuManager createSiblingMenuManager; /** * This creates an instance of the contributor. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public CapOverTimeActionBarContributor() { super(ADDITIONS_LAST_STYLE); loadResourceAction = new LoadResourceAction(); validateAction = new ValidateAction(); controlAction = new ControlAction(); } /** * This adds Separators for editor additions to the tool bar. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void contributeToToolBar(IToolBarManager toolBarManager) { toolBarManager.add(new Separator("capovertime-settings")); toolBarManager.add(new Separator("capovertime-additions")); } /** * This adds to the menu bar a menu and some separators for editor additions, * as well as the sub-menus for object creation items. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void contributeToMenu(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_CapOverTimeEditor_menu"), "CapOverTimeMenuID"); menuManager.insertAfter("additions", submenuManager); submenuManager.add(new Separator("settings")); submenuManager.add(new Separator("actions")); submenuManager.add(new Separator("additions")); submenuManager.add(new Separator("additions-end")); // Prepare for CreateChild item addition or removal. // createChildMenuManager = new MenuManager(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); submenuManager.insertBefore("additions", createChildMenuManager); // Prepare for CreateSibling item addition or removal. // createSiblingMenuManager = new MenuManager(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); submenuManager.insertBefore("additions", createSiblingMenuManager); // Force an update because Eclipse hides empty menus now. // submenuManager.addMenuListener (new IMenuListener() { public void menuAboutToShow(IMenuManager menuManager) { menuManager.updateAll(true); } }); addGlobalActions(submenuManager); } /** * When the active editor changes, this remembers the change and registers with it as a selection provider. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setActiveEditor(IEditorPart part) { super.setActiveEditor(part); activeEditorPart = part; // Switch to the new selection provider. // if (selectionProvider != null) { selectionProvider.removeSelectionChangedListener(this); } if (part == null) { selectionProvider = null; } else { selectionProvider = part.getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); // Fake a selection changed event to update the menus. // if (selectionProvider.getSelection() != null) { selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); } } } /** * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings * that can be added to the selected object and updating the menus accordingly. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void selectionChanged(SelectionChangedEvent event) { // Remove any menu items for old selection. // if (createChildMenuManager != null) { depopulateManager(createChildMenuManager, createChildActions); } if (createSiblingMenuManager != null) { depopulateManager(createSiblingMenuManager, createSiblingActions); } // Query the new selection for appropriate new child/sibling descriptors // Collection<?> newChildDescriptors = null; Collection<?> newSiblingDescriptors = null; ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) { Object object = ((IStructuredSelection)selection).getFirstElement(); EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain(); newChildDescriptors = domain.getNewChildDescriptors(object, null); newSiblingDescriptors = domain.getNewChildDescriptors(null, object); } // Generate actions for selection; populate and redraw the menus. // createChildActions = generateCreateChildActions(newChildDescriptors, selection); createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); if (createChildMenuManager != null) { populateManager(createChildMenuManager, createChildActions, null); createChildMenuManager.update(true); } if (createSiblingMenuManager != null) { populateManager(createSiblingMenuManager, createSiblingActions, null); createSiblingMenuManager.update(true); } } /** * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, * and returns the collection of these actions. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); } } return actions; } /** * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, * and returns the collection of these actions. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); } } return actions; } /** * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, * by inserting them before the specified contribution item <code>contributionID</code>. * If <code>contributionID</code> is <code>null</code>, they are simply added. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { if (actions != null) { for (IAction action : actions) { if (contributionID != null) { manager.insertBefore(contributionID, action); } else { manager.add(action); } } } } /** * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { if (actions != null) { IContributionItem[] items = manager.getItems(); for (int i = 0; i < items.length; i++) { // Look into SubContributionItems // IContributionItem contributionItem = items[i]; while (contributionItem instanceof SubContributionItem) { contributionItem = ((SubContributionItem)contributionItem).getInnerItem(); } // Delete the ActionContributionItems with matching action. // if (contributionItem instanceof ActionContributionItem) { IAction action = ((ActionContributionItem)contributionItem).getAction(); if (actions.contains(action)) { manager.remove(contributionItem); } } } } } /** * This populates the pop-up menu before it appears. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void menuAboutToShow(IMenuManager menuManager) { super.menuAboutToShow(menuManager); MenuManager submenuManager = null; submenuManager = new MenuManager(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); populateManager(submenuManager, createChildActions, null); menuManager.insertBefore("edit", submenuManager); submenuManager = new MenuManager(CapOverTimeEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); populateManager(submenuManager, createSiblingActions, null); menuManager.insertBefore("edit", submenuManager); } /** * This inserts global actions before the "additions-end" separator. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void addGlobalActions(IMenuManager menuManager) { menuManager.insertAfter("additions-end", new Separator("ui-actions")); menuManager.insertAfter("ui-actions", showPropertiesViewAction); refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); menuManager.insertAfter("ui-actions", refreshViewerAction); super.addGlobalActions(menuManager); } /** * This ensures that a delete action will clean up all references to deleted objects. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean removeAllReferencesOnDelete() { return true; } }
b9725c132c4d2cc36f9a1e77c9ce381319cc6180
9bc0387b1c85cb678495b5279c666154a37db19b
/src/controller/base/AdminController.java
2f48dcac31749ec7cc6ef1ea6c7f3a3002536e23
[]
no_license
kang9067/part
750b1d8c561f00866138e1e774f9556b367bc906
b79cf281da78cf21bf765f98d7bb22a75110a539
refs/heads/master
2020-07-29T11:56:10.917664
2016-11-24T07:12:52
2016-11-24T07:12:52
73,669,090
0
0
null
null
null
null
UTF-8
Java
false
false
699
java
package controller.base; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; public class AdminController extends BaseController{ @Override protected ModelAndView createView(String path, ModelMap modelMap) { return super.createView("/admin/"+path, modelMap); } protected ModelAndView createView(String path){ return super.createView("/admin/"+path, modelMap); } @RequestMapping("{html}.html") public ModelAndView html(@PathVariable("html") String html){ return this.createView(html,null); } }
4a0e49a680061f8de5dab216da04e9e444c47f4c
f6ef0182d1ad5290ad9c2b07d182c1f2f1ae31af
/src/main/java/pl/zut/gui/TableObject.java
510e52d6ba4d2c2720628241ddb3719335179f9f
[]
no_license
Piotr-Retman/OptimizationFX
22529ac547dbb670148c5e5d3cb7bb9b9a480453
384417179823909e139129196bd30705f626c26f
refs/heads/master
2021-01-18T21:43:17.980822
2016-05-20T11:30:13
2016-05-20T11:30:13
55,133,050
0
0
null
null
null
null
UTF-8
Java
false
false
930
java
package pl.zut.gui; /** * Obiekt tablicowy do GUI */ public class TableObject { public TableObject(String order, String makeOrderTime, String deadlineOrderTime) { this.order = order; this.makeOrderTime = makeOrderTime; this.deadlineOrderTime = deadlineOrderTime; } private String order; private String makeOrderTime; private String deadlineOrderTime; public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } public String getMakeOrderTime() { return makeOrderTime; } public void setMakeOrderTime(String makeOrderTime) { this.makeOrderTime = makeOrderTime; } public String getDeadlineOrderTime() { return deadlineOrderTime; } public void setDeadlineOrderTime(String deadlineOrderTime) { this.deadlineOrderTime = deadlineOrderTime; } }
cbaae30b7d6f99122b46e53107c82e8c1b7c510a
1ac08035abcbe559bc5d6362557b91e3db44b783
/rabbitmq-springcloudstream-producer/src/main/java/com/ziyin/rabbitmq/springcloudstream/producer/RabbitmqSpringcloudstreamProducerApplication.java
f3ee4241f1f144a8491a71fd9274885eb7b1765e
[]
no_license
ziyinjava/rabbitmq
4eeb2999769d8691d11e1497d8f879e10b9891bf
2f92870896f27ff1ad72c6432916a337ab4bcbe1
refs/heads/master
2022-06-24T01:55:26.709840
2019-09-21T06:25:14
2019-09-21T06:25:14
209,936,100
0
0
null
2022-06-17T02:32:25
2019-09-21T06:23:56
Java
UTF-8
Java
false
false
392
java
package com.ziyin.rabbitmq.springcloudstream.producer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RabbitmqSpringcloudstreamProducerApplication { public static void main(String[] args) { SpringApplication.run(RabbitmqSpringcloudstreamProducerApplication.class, args); } }
7b149ab5b1462c62498cc854e43756693f23d1ee
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_43_buggy/mutated/919/HtmlTreeBuilderState.java
8d2e4e8cde795a040dd5f40f373787bae165dd1b
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
68,259
java
package org.jsoup.parser; import org.jsoup.helper.DescendableLinkedList; import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; import java.util.Iterator; import java.util.LinkedList; /** * The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states. */ enum HtmlTreeBuilderState { Initial { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { // todo: parse error check on expected doctypes // todo: quirk state check on doctype ids Token.Doctype d = t.asDoctype(); DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri()); tb.getDocument().appendChild(doctype); if (d.isForceQuirks()) tb.getDocument().quirksMode(Document.QuirksMode.quirks); tb.transition(BeforeHtml); } else { // todo: check not iframe srcdoc tb.transition(BeforeHtml); return tb.process(t); // re-process token } return true; } }, BeforeHtml { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); return false; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (isWhitespace(t)) { return true; // ignore whitespace } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { tb.insert(t.asStartTag()); tb.transition(BeforeHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { return anythingElse(t, tb); } else if (t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.insert("html"); tb.transition(BeforeHead); return tb.process(t); } }, BeforeHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return true; } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return InBody.process(t, tb); // does not transition } else if (t.isStartTag() && t.asStartTag().name().equals("head")) { Element head = tb.insert(t.asStartTag()); tb.setHeadElement(head); tb.transition(InHead); } else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) { tb.process(new Token.StartTag("head")); return tb.process(t); } else if (t.isEndTag()) { tb.error(this); return false; } else { tb.process(new Token.StartTag("head")); return tb.process(t); } return true; } }, InHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return InBody.process(t, tb); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) { Element el = tb.insertEmpty(start); // jsoup special: update base the frist time it is seen if (name.equals("base") && el.hasAttr("href")) tb.maybeSetBaseUri(el); } else if (name.equals("meta")) { Element meta = tb.insertEmpty(start); // todo: charset switches } else if (name.equals("title")) { handleRcData(start, tb); } else if (StringUtil.in(name, "noframes", "style")) { handleRawtext(start, tb); } else if (name.equals("noscript")) { // else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript) tb.insert(start); tb.transition(InHeadNoscript); } else if (name.equals("script")) { // skips some script rules as won't execute them tb.insert(start); tb.tokeniser.transition(TokeniserState.ScriptData); tb.markInsertionMode(); tb.transition(Text); } else if (name.equals("head")) { tb.error(this); return false; } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("head")) { tb.pop(); tb.transition(AfterHead); } else if (StringUtil.in(name, "body", "html", "br")) { return anythingElse(t, tb); } else { tb.error(this); return false; } break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { tb.process(new Token.EndTag("head")); return tb.process(t); } }, InHeadNoscript { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) { tb.pop(); tb.transition(InHead); } else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "basefont", "bgsound", "link", "meta", "noframes", "style"))) { return tb.process(t, InHead); } else if (t.isEndTag() && t.asEndTag().name().equals("br")) { return anythingElse(t, tb); } else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) { tb.error(this); return false; } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); tb.process(new Token.EndTag("noscript")); return tb.process(t); } }, AfterHead { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { return tb.process(t, InBody); } else if (name.equals("body")) { tb.insert(startTag); tb.framesetOk(false); tb.transition(InBody); } else if (name.equals("frameset")) { tb.insert(startTag); tb.transition(InFrameset); } else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) { tb.error(this); Element head = tb.getHeadElement(); tb.push(head); tb.process(t, InHead); tb.removeFromStack(head); } else if (name.equals("head")) { tb.error(this); return false; } else { anythingElse(t, tb); } } else if (t.isEndTag()) { if (StringUtil.in(t.asEndTag().name(), "body", "html")) { anythingElse(t, tb); } else { tb.error(this); return false; } } else { anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.process(new Token.StartTag("body")); tb.framesetOk(true); return tb.process(t); } }, InBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: { Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { // todo confirm that check tb.error(this); return false; } else tb.process(new org.jsoup.parser.Token.StartTag("form")); if (isWhitespace(c)) { tb.reconstructFormattingElements(); tb.insert(c); } else { tb.reconstructFormattingElements(); tb.insert(c); tb.framesetOk(false); } break; } case Comment: { tb.insert(t.asComment()); break; } case Doctype: { tb.error(this); return false; } case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) { tb.error(this); // merge attributes onto real html Element html = tb.getStack().getFirst(); for (Attribute attribute : startTag.getAttributes()) { if (!html.hasAttr(attribute.getKey())) html.attributes().put(attribute); } } else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) { return tb.process(t, InHead); } else if (name.equals("body")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else { tb.framesetOk(false); Element body = stack.get(1); for (Attribute attribute : startTag.getAttributes()) { if (!body.hasAttr(attribute.getKey())) body.attributes().put(attribute); } } } else if (name.equals("frameset")) { tb.error(this); LinkedList<Element> stack = tb.getStack(); if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) { // only in fragment case return false; // ignore } else if (!tb.framesetOk()) { return false; // ignore frameset } else { Element second = stack.get(1); if (second.parent() != null) second.remove(); // pop up to html element while (stack.size() > 1) stack.removeLast(); tb.insert(startTag); tb.transition(InFrameset); } } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol", "p", "section", "summary", "ul")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) { tb.error(this); tb.pop(); } tb.insert(startTag); } else if (StringUtil.in(name, "pre", "listing")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); // todo: ignore LF if next token tb.framesetOk(false); } else if (name.equals("form")) { if (tb.getFormElement() != null) { tb.error(this); return false; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } Element form = tb.insert(startTag); tb.setFormElement(form); } else if (name.equals("li")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (el.nodeName().equals("li")) { tb.process(new Token.EndTag("li")); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (StringUtil.in(name, "dd", "dt")) { tb.framesetOk(false); LinkedList<Element> stack = tb.getStack(); for (int i = stack.size() - 1; i > 0; i--) { Element el = stack.get(i); if (StringUtil.in(el.nodeName(), "dd", "dt")) { tb.process(new Token.EndTag(el.nodeName())); break; } if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p")) break; } if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); } else if (name.equals("plaintext")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out } else if (name.equals("button")) { if (tb.inButtonScope("button")) { // close and reprocess tb.error(this); tb.process(new Token.EndTag("button")); tb.process(startTag); } else { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); } } else if (name.equals("a")) { if (tb.getActiveFormattingElement("a") != null) { tb.error(this); tb.process(new Token.EndTag("a")); // still on stack? Element remainingA = tb.getFromStack("a"); if (remainingA != null) { tb.removeFromActiveFormattingElements(remainingA); tb.removeFromStack(remainingA); } } tb.reconstructFormattingElements(); Element a = tb.insert(startTag); tb.pushActiveFormattingElements(a); } else if (StringUtil.in(name, "b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) { tb.reconstructFormattingElements(); Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (name.equals("nobr")) { tb.reconstructFormattingElements(); if (tb.inScope("nobr")) { tb.error(this); tb.process(new Token.EndTag("nobr")); tb.reconstructFormattingElements(); } Element el = tb.insert(startTag); tb.pushActiveFormattingElements(el); } else if (StringUtil.in(name, "applet", "marquee", "object")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.insertMarkerToFormattingElements(); tb.framesetOk(false); } else if (name.equals("table")) { if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insert(startTag); tb.framesetOk(false); tb.transition(InTable); } else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) { tb.reconstructFormattingElements(); tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("input")) { tb.reconstructFormattingElements(); Element el = tb.insertEmpty(startTag); if (!el.attr("type").equalsIgnoreCase("hidden")) tb.framesetOk(false); } else if (StringUtil.in(name, "param", "source", "track")) { tb.insertEmpty(startTag); } else if (name.equals("hr")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.insertEmpty(startTag); tb.framesetOk(false); } else if (name.equals("image")) { // we're not supposed to ask. startTag.name("img"); return tb.process(startTag); } else if (name.equals("isindex")) { // how much do we care about the early 90s? tb.error(this); if (tb.getFormElement() != null) return false; tb.tokeniser.acknowledgeSelfClosingFlag(); tb.process(new Token.StartTag("form")); if (startTag.attributes.hasKey("action")) { Element form = tb.getFormElement(); form.attr("action", startTag.attributes.get("action")); } tb.process(new Token.StartTag("hr")); tb.process(new Token.StartTag("label")); // hope you like english. String prompt = startTag.attributes.hasKey("prompt") ? startTag.attributes.get("prompt") : "This is a searchable index. Enter search keywords: "; tb.process(new Token.Character(prompt)); // input Attributes inputAttribs = new Attributes(); for (Attribute attr : startTag.attributes) { if (!StringUtil.in(attr.getKey(), "name", "action", "prompt")) inputAttribs.put(attr); } inputAttribs.put("name", "isindex"); tb.process(new Token.StartTag("input", inputAttribs)); tb.process(new Token.EndTag("label")); tb.process(new Token.StartTag("hr")); tb.process(new Token.EndTag("form")); } else if (name.equals("textarea")) { tb.insert(startTag); // todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.framesetOk(false); tb.transition(Text); } else if (name.equals("xmp")) { if (tb.inButtonScope("p")) { tb.process(new Token.EndTag("p")); } tb.reconstructFormattingElements(); tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("iframe")) { tb.framesetOk(false); handleRawtext(startTag, tb); } else if (name.equals("noembed")) { // also handle noscript if script enabled handleRawtext(startTag, tb); } else if (name.equals("select")) { tb.reconstructFormattingElements(); tb.insert(startTag); tb.framesetOk(false); HtmlTreeBuilderState state = tb.state(); if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell)) tb.transition(InSelectInTable); else tb.transition(InSelect); } else if (StringUtil.in("optgroup", "option")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); tb.reconstructFormattingElements(); tb.insert(startTag); } else if (StringUtil.in("rp", "rt")) { if (tb.inScope("ruby")) { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("ruby")) { tb.error(this); tb.popStackToBefore("ruby"); // i.e. close up to but not include name } tb.insert(startTag); } } else if (name.equals("math")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (name.equals("svg")) { tb.reconstructFormattingElements(); // todo: handle A start tag whose tag name is "svg" (xlink, svg) tb.insert(startTag); tb.tokeniser.acknowledgeSelfClosingFlag(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { tb.reconstructFormattingElements(); tb.insert(startTag); } break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("body")) { if (!tb.inScope("body")) { tb.error(this); return false; } else { // todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html tb.transition(AfterBody); } } else if (name.equals("html")) { boolean notIgnored = tb.process(new Token.EndTag("body")); if (notIgnored) return tb.process(endTag); } else if (StringUtil.in(name, "address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu", "nav", "ol", "pre", "section", "summary", "ul")) { // todo: refactor these lookups if (!tb.inScope(name)) { // nothing to close tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("form")) { Element currentForm = tb.getFormElement(); tb.setFormElement(null); if (currentForm == null || !tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); // remove currentForm from stack. will shift anything under up. tb.removeFromStack(currentForm); } } else if (name.equals("p")) { if (!tb.inButtonScope(name)) { tb.error(this); tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p> return tb.process(endTag); } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (name.equals("li")) { if (!tb.inListItemScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "dd", "dt")) { if (!tb.inScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); } } else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) { if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) { tb.error(this); return false; } else { tb.generateImpliedEndTags(name); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6"); } } else if (name.equals("sarcasm")) { // *sigh* return anyOtherEndTag(t, tb); } else if (StringUtil.in(name, "a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) { // Adoption Agency Algorithm. OUTER: for (int i = 0; i < 8; i++) { Element formatEl = tb.getActiveFormattingElement(name); if (formatEl == null) return anyOtherEndTag(t, tb); else if (!tb.onStack(formatEl)) { tb.error(this); tb.removeFromActiveFormattingElements(formatEl); return true; } else if (!tb.inScope(formatEl.nodeName())) { tb.error(this); return false; } else if (tb.currentElement() != formatEl) tb.error(this); Element furthestBlock = null; Element commonAncestor = null; boolean seenFormattingElement = false; LinkedList<Element> stack = tb.getStack(); for (int si = 0; si < stack.size(); si++) { Element el = stack.get(si); if (el == formatEl) { commonAncestor = stack.get(si - 1); seenFormattingElement = true; } else if (seenFormattingElement && tb.isSpecial(el)) { furthestBlock = el; break; } } if (furthestBlock == null) { tb.popStackToClose(formatEl.nodeName()); tb.removeFromActiveFormattingElements(formatEl); return true; } // todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list. // does that mean: int pos of format el in list? Element node = furthestBlock; Element lastNode = furthestBlock; INNER: for (int j = 0; j < 3; j++) { if (tb.onStack(node)) node = tb.aboveOnStack(node); if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check tb.removeFromStack(node); continue INNER; } else if (node == formatEl) break INNER; Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri()); tb.replaceActiveFormattingElement(node, replacement); tb.replaceOnStack(node, replacement); node = replacement; if (lastNode == furthestBlock) { // todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements. // not getting how this bookmark both straddles the element above, but is inbetween here... } if (lastNode.parent() != null) lastNode.remove(); node.appendChild(lastNode); lastNode = node; } if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { if (lastNode.parent() != null) lastNode.remove(); tb.insertInFosterParent(lastNode); } else { if (lastNode.parent() != null) lastNode.remove(); commonAncestor.appendChild(lastNode); } Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri()); Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]); for (Node childNode : childNodes) { adopter.appendChild(childNode); // append will reparent. thus the clone to avvoid concurrent mod. } furthestBlock.appendChild(adopter); tb.removeFromActiveFormattingElements(formatEl); // todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark. tb.removeFromStack(formatEl); tb.insertOnStackAfter(furthestBlock, adopter); } } else if (StringUtil.in(name, "applet", "marquee", "object")) { if (!tb.inScope("name")) { if (!tb.inScope(name)) { tb.error(this); return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); } } else if (name.equals("br")) { tb.error(this); tb.process(new Token.StartTag("br")); return false; } else { return anyOtherEndTag(t, tb); } break; case EOF: // todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html // stop parsing break; } return true; } boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) { String name = t.asEndTag().name(); DescendableLinkedList<Element> stack = tb.getStack(); Iterator<Element> it = stack.descendingIterator(); while (it.hasNext()) { Element node = it.next(); if (node.nodeName().equals(name)) { tb.generateImpliedEndTags(name); if (!name.equals(tb.currentElement().nodeName())) tb.error(this); tb.popStackToClose(name); break; } else { if (tb.isSpecial(node)) { tb.error(this); return false; } } } return true; } }, Text { // in script, style etc. normally treated as data tags boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.insert(t.asCharacter()); } else if (t.isEOF()) { tb.error(this); // if current node is script: already started tb.pop(); tb.transition(tb.originalState()); return tb.process(t); } else if (t.isEndTag()) { // if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts tb.pop(); tb.transition(tb.originalState()); } return true; } }, InTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isCharacter()) { tb.newPendingTableCharacters(); tb.markInsertionMode(); tb.transition(InTableText); return tb.process(t); } else if (t.isComment()) { tb.insert(t.asComment()); return true; } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("caption")) { tb.clearStackToTableContext(); tb.insertMarkerToFormattingElements(); tb.insert(startTag); tb.transition(InCaption); } else if (name.equals("colgroup")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InColumnGroup); } else if (name.equals("col")) { tb.process(new Token.StartTag("colgroup")); return tb.process(t); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { tb.clearStackToTableContext(); tb.insert(startTag); tb.transition(InTableBody); } else if (StringUtil.in(name, "td", "th", "tr")) { tb.process(new Token.StartTag("tbody")); return tb.process(t); } else if (name.equals("table")) { tb.error(this); boolean processed = tb.process(new Token.EndTag("table")); if (processed) // only ignored if in fragment return tb.process(t); } else if (StringUtil.in(name, "style", "script")) { return tb.process(t, InHead); } else if (name.equals("input")) { if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) { return anythingElse(t, tb); } else { tb.insertEmpty(startTag); } } else if (name.equals("form")) { tb.error(this); if (tb.getFormElement() != null) return false; else { Element form = tb.insertEmpty(startTag); tb.setFormElement(form); } } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("table")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.popStackToClose("table"); } tb.resetInsertionMode(); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else if (t.isEOF()) { if (tb.currentElement().nodeName().equals("html")) tb.error(this); return true; // stops parsing } return anythingElse(t, tb); } boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); boolean processed = true; if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); processed = tb.process(t, InBody); tb.setFosterInserts(false); } else { processed = tb.process(t, InBody); } return processed; } }, InTableText { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.getPendingTableCharacters().add(c); } break; default: if (tb.getPendingTableCharacters().size() > 0) { for (Token.Character character : tb.getPendingTableCharacters()) { if (!isWhitespace(character)) { // InTable anything else section: tb.error(this); if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) { tb.setFosterInserts(true); tb.process(character, InBody); tb.setFosterInserts(false); } else { tb.process(character, InBody); } } else tb.insert(character); } tb.newPendingTableCharacters(); } tb.transition(tb.originalState()); return tb.process(t); } return true; } }, InCaption { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag() && t.asEndTag().name().equals("caption")) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals("caption")) tb.error(this); tb.popStackToClose("caption"); tb.clearFormattingElementsToLastMarker(); tb.transition(InTable); } } else if (( t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") || t.isEndTag() && t.asEndTag().name().equals("table")) ) { tb.error(this); boolean processed = tb.process(new Token.EndTag("caption")); if (processed) return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) { tb.error(this); return false; } else { return tb.process(t, InBody); } return true; } }, InColumnGroup { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); return true; } switch (t.type) { case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); break; case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("html")) return tb.process(t, InBody); else if (name.equals("col")) tb.insertEmpty(startTag); else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (name.equals("colgroup")) { if (tb.currentElement().nodeName().equals("html")) { // frag case tb.error(this); return false; } else { tb.pop(); tb.transition(InTable); } } else return anythingElse(t, tb); break; case EOF: if (tb.currentElement().nodeName().equals("html")) return true; // stop parsing; frag case else return anythingElse(t, tb); default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("colgroup")); if (processed) // only ignored in frag case return tb.process(t); return true; } }, InTableBody { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case StartTag: Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (name.equals("tr")) { tb.clearStackToTableBodyContext(); tb.insert(startTag); tb.transition(InRow); } else if (StringUtil.in(name, "th", "td")) { tb.error(this); tb.process(new Token.StartTag("tr")); return tb.process(startTag); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) { return exitTableBody(t, tb); } else return anythingElse(t, tb); break; case EndTag: Token.EndTag endTag = t.asEndTag(); name = endTag.name(); if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } else { tb.clearStackToTableBodyContext(); tb.pop(); tb.transition(InTable); } } else if (name.equals("table")) { return exitTableBody(t, tb); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) { tb.error(this); return false; } else return anythingElse(t, tb); break; default: return anythingElse(t, tb); } return true; } private boolean exitTableBody(Token t, HtmlTreeBuilder tb) { if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) { // frag case tb.error(this); return false; } tb.clearStackToTableBodyContext(); tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead return tb.process(t); } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } }, InRow { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag()) { Token.StartTag startTag = t.asStartTag(); String name = startTag.name(); if (StringUtil.in(name, "th", "td")) { tb.clearStackToTableRowContext(); tb.insert(startTag); tb.transition(InCell); tb.insertMarkerToFormattingElements(); } else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) { return handleMissingTr(t, tb); } else { return anythingElse(t, tb); } } else if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (name.equals("tr")) { if (!tb.inTableScope(name)) { tb.error(this); // frag return false; } tb.clearStackToTableRowContext(); tb.pop(); // tr tb.transition(InTableBody); } else if (name.equals("table")) { return handleMissingTr(t, tb); } else if (StringUtil.in(name, "tbody", "tfoot", "thead")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } tb.process(new Token.EndTag("tr")); return tb.process(t); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) { tb.error(this); return false; } else { return anythingElse(t, tb); } } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InTable); } private boolean handleMissingTr(Token t, TreeBuilder tb) { boolean processed = tb.process(new Token.EndTag("tr")); if (processed) return tb.process(t); else return false; } }, InCell { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isEndTag()) { Token.EndTag endTag = t.asEndTag(); String name = endTag.name(); if (StringUtil.in(name, "td", "th")) { if (!tb.inTableScope(name)) { tb.error(this); tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag return false; } tb.generateImpliedEndTags(); if (!tb.currentElement().nodeName().equals(name)) tb.error(this); tb.popStackToClose(name); tb.clearFormattingElementsToLastMarker(); tb.transition(InRow); } else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) { tb.error(this); return false; } else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) { if (!tb.inTableScope(name)) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } } else if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) { if (!(tb.inTableScope("td") || tb.inTableScope("th"))) { tb.error(this); return false; } closeCell(tb); return tb.process(t); } else { return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { return tb.process(t, InBody); } private void closeCell(HtmlTreeBuilder tb) { if (tb.inTableScope("td")) tb.process(new Token.EndTag("td")); else tb.process(new Token.EndTag("th")); // only here if th or td in scope } }, InSelect { boolean process(Token t, HtmlTreeBuilder tb) { switch (t.type) { case Character: Token.Character c = t.asCharacter(); if (c.getData().equals(nullString)) { tb.error(this); return false; } else { tb.insert(c); } break; case Comment: tb.insert(t.asComment()); break; case Doctype: tb.error(this); return false; case StartTag: Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) return tb.process(start, InBody); else if (name.equals("option")) { tb.process(new Token.EndTag("option")); tb.insert(start); } else if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option")) tb.process(new Token.EndTag("option")); else if (tb.currentElement().nodeName().equals("optgroup")) tb.process(new Token.EndTag("optgroup")); tb.insert(start); } else if (name.equals("select")) { tb.error(this); return tb.process(new Token.EndTag("select")); } else if (StringUtil.in(name, "input", "keygen", "textarea")) { tb.error(this); if (!tb.inSelectScope("select")) return false; // frag tb.process(new Token.EndTag("select")); return tb.process(start); } else if (name.equals("script")) { return tb.process(t, InHead); } else { return anythingElse(t, tb); } break; case EndTag: Token.EndTag end = t.asEndTag(); name = end.name(); if (name.equals("optgroup")) { if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup")) tb.process(new Token.EndTag("option")); if (tb.currentElement().nodeName().equals("optgroup")) tb.pop(); else tb.error(this); } else if (name.equals("option")) { if (tb.currentElement().nodeName().equals("option")) tb.pop(); else tb.error(this); } else if (name.equals("select")) { if (!tb.inSelectScope(name)) { tb.error(this); return false; } else { tb.popStackToClose(name); tb.resetInsertionMode(); } } else return anythingElse(t, tb); break; case EOF: if (!tb.currentElement().nodeName().equals("html")) tb.error(this); break; default: return anythingElse(t, tb); } return true; } private boolean anythingElse(Token t, HtmlTreeBuilder tb) { tb.error(this); return false; } }, InSelectInTable { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); tb.process(new Token.EndTag("select")); return tb.process(t); } else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) { tb.error(this); if (tb.inTableScope(t.asEndTag().name())) { tb.process(new Token.EndTag("select")); return (tb.process(t)); } else return false; } else { return tb.process(t, InSelect); } } }, AfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { return tb.process(t, InBody); } else if (t.isComment()) { tb.insert(t.asComment()); // into html node } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { if (tb.isFragmentParsing()) { tb.error(this); return false; } else { tb.transition(AfterAfterBody); } } else if (t.isEOF()) { // chillax! we're done } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, InFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag()) { Token.StartTag start = t.asStartTag(); String name = start.name(); if (name.equals("html")) { return tb.process(start, InBody); } else if (name.equals("frameset")) { tb.insert(start); } else if (name.equals("frame")) { tb.insertEmpty(start); } else if (name.equals("noframes")) { return tb.process(start, InHead); } else { tb.error(this); return false; } } else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) { if (tb.currentElement().nodeName().equals("html")) { // frag tb.error(this); return false; } else { tb.pop(); if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) { tb.transition(AfterFrameset); } } } else if (t.isEOF()) { if (!tb.currentElement().nodeName().equals("html")) { tb.error(this); return true; } } else { tb.error(this); return false; } return true; } }, AfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (isWhitespace(t)) { tb.insert(t.asCharacter()); } else if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype()) { tb.error(this); return false; } else if (t.isStartTag() && t.asStartTag().name().equals("html")) { return tb.process(t, InBody); } else if (t.isEndTag() && t.asEndTag().name().equals("html")) { tb.transition(AfterAfterFrameset); } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else if (t.isEOF()) { // cool your heels, we're complete } else { tb.error(this); return false; } return true; } }, AfterAfterBody { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else { tb.error(this); tb.transition(InBody); return tb.process(t); } return true; } }, AfterAfterFrameset { boolean process(Token t, HtmlTreeBuilder tb) { if (t.isComment()) { tb.insert(t.asComment()); } else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) { return tb.process(t, InBody); } else if (t.isEOF()) { // nice work chuck } else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) { return tb.process(t, InHead); } else { tb.error(this); return false; } return true; } }, ForeignContent { boolean process(Token t, HtmlTreeBuilder tb) { return true; // todo: implement. Also; how do we get here? } }; private static String nullString = String.valueOf('\u0000'); abstract boolean process(Token t, HtmlTreeBuilder tb); private static boolean isWhitespace(Token t) { if (t.isCharacter()) { String data = t.asCharacter().getData(); // todo: this checks more than spec - "\t", "\n", "\f", "\r", " " for (int i = 0; i < data.length(); i++) { char c = data.charAt(i); if (!StringUtil.isWhitespace(c)) return false; } return true; } return false; } private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rcdata); tb.markInsertionMode(); tb.transition(Text); } private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) { tb.insert(startTag); tb.tokeniser.transition(TokeniserState.Rawtext); tb.markInsertionMode(); tb.transition(Text); } }
51b88d8525e95e1713c57302f810698667b0faa9
8ec2cbabd6125ceeb00e0c6192c3ce84477bdde6
/com.alcatel.as.utils/src/alcatel/tess/hometop/gateways/utils/NxTimerDurationException.java
b0db727f9c59428686c5ab568b3ccdb165bf5a7c
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
nokia/osgi-microfeatures
2cc2b007454ec82212237e012290425114eb55e6
50120f20cf929a966364550ca5829ef348d82670
refs/heads/main
2023-08-28T12:13:52.381483
2021-11-12T20:51:05
2021-11-12T20:51:05
378,852,173
1
1
null
null
null
null
UTF-8
Java
false
false
510
java
// Copyright 2000-2021 Nokia // // Licensed under the Apache License 2.0 // SPDX-License-Identifier: Apache-2.0 // package alcatel.tess.hometop.gateways.utils; /** Exception thrown when a timer duration is out of range */ public class NxTimerDurationException extends Exception { /** Constructor without message. */ public NxTimerDurationException() { super(); } /** Constructor with user message. */ public NxTimerDurationException(String message) { super(message); } }
053ce7cc476953aa45fcb55cd1fc92f10a0ee76a
6b3bfb61415ee7f521623f7b54bcd00b98c68d8c
/src/main/java/info/zznet/znms/base/rrd/exception/RrdExistsException.java
a62e3bad30080800fff041a91fb35eb892707694
[]
no_license
15000854736/znms
b1ddef89b26f9e90cf3052d6d52200e82ad50773
75e098cdd63291d0dd32ee76d0ecb8283abd0594
refs/heads/master
2021-08-22T22:50:10.884942
2017-12-01T14:07:04
2017-12-01T14:07:04
103,738,575
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package info.zznet.znms.base.rrd.exception; public class RrdExistsException extends Exception { /** * */ private static final long serialVersionUID = 1378485549104047673L; public RrdExistsException(){ super(); } public RrdExistsException(String msg){ super(msg); } }
2c3ad1d724c0c76deee772b66242c41d831fac85
251603bf9844702d724ee10584e7bdba88e0a9b2
/app/src/main/java/com/example/mysecondapp/MainActivity.java
83c1d074749f94e64cc727a81662ca38015c8e8a
[]
no_license
VanCleef76/AndroidHomeWork1
3785b332e7a55eb0aff86a7ddc6303292f32a5be
a4763dc95e108d6521e20631f703950d41a59028
refs/heads/master
2023-04-19T15:50:44.563242
2021-04-26T18:04:52
2021-04-26T18:04:52
361,851,025
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.example.mysecondapp; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
54526b7593381a41d16e16b74dea2288a070805f
ea2e35711386d34e1bdfef8a15e71fa734281f6e
/src/main/java/chap03/Smaple01.java
b32cf0e3d10de0065fc24f58b14e0c0f906a786c
[]
no_license
SHINDONGDONG/JavaRemind
d86cbed8568d40141597b5d6e1374c7264494c85
01515944cf0cc3f93fa9c340cd4d8146ef2f4f80
refs/heads/master
2023-01-27T11:41:36.018061
2020-12-10T22:26:54
2020-12-10T22:26:54
316,898,671
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package chap03; public class Smaple01 { /** * @param args * alt+shift + j가 주석 입니다. */ public static void main(String[] args) { System.out.println("1234"); System.out.println("1234"); System.out.println("1234"); System.out.println("1234"); System.out.println("1234"); System.out.println("1234"); } }
ab7c3423c3dbe502b5f7461656317c07cce6a647
fc49733b483e25105ed1a30c99641e4d4b8de065
/gomall-product/src/main/java/cn/jinterest/product/controller/SpuCommentController.java
0c22b1eb954b46db8b0c92f006c54c78e7dc526e
[]
no_license
Jaredhi/GoMall
a1c8da9b0305992d94264828d05c430686f5d765
5f6ec50f799023c9390559681812b5d862a0c702
refs/heads/master
2023-04-16T08:50:33.796354
2021-04-30T05:22:52
2021-04-30T05:22:52
308,263,952
0
0
null
null
null
null
UTF-8
Java
false
false
2,234
java
package cn.jinterest.product.controller; import java.util.Arrays; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; 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.RestController; import cn.jinterest.product.entity.SpuCommentEntity; import cn.jinterest.product.service.SpuCommentService; import cn.jinterest.common.utils.PageUtils; import cn.jinterest.common.utils.R; /** * 商品评价 * * @author JInterest * @email [email protected] * @date 2020-10-29 21:09:50 */ @RestController @RequestMapping("product/spucomment") public class SpuCommentController { @Autowired private SpuCommentService spuCommentService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("product:spucomment:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = spuCommentService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("product:spucomment:info") public R info(@PathVariable("id") Long id){ SpuCommentEntity spuComment = spuCommentService.getById(id); return R.ok().put("spuComment", spuComment); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("product:spucomment:save") public R save(@RequestBody SpuCommentEntity spuComment){ spuCommentService.save(spuComment); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("product:spucomment:update") public R update(@RequestBody SpuCommentEntity spuComment){ spuCommentService.updateById(spuComment); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("product:spucomment:delete") public R delete(@RequestBody Long[] ids){ spuCommentService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
25c8df438193c1833b4500bd462d079d83690f70
302c4b0f382629b8fb898546c62bc82dd6288edf
/src/main/java/com/suzhoukeleqi/entity/ProductListItem.java
3b304f8ddf3edc66781759daf86199813a426fef
[ "MIT" ]
permissive
499636235/Szkeleqi
7ee613d1aa8319ee517d86b316eb065543236689
920259ea7bbd666b87dc171b47581d261cd6850b
refs/heads/master
2023-05-15T06:08:53.504072
2021-06-05T16:51:29
2021-06-05T16:51:29
290,834,419
0
0
null
null
null
null
UTF-8
Java
false
false
327
java
package com.suzhoukeleqi.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class ProductListItem { private Integer listIndex; private Integer productId; private String productName; private String picturePath; }
d66dfc3de9a833b52dd25ffcaf1f22e7c1c0e4b8
da049f1efd756eaac6f40a4f6a9c4bdca7e16a06
/KoobeeCenter/KoobeeCenter_music_logo_new_name8.0/src/com/koobee/koobeecenter/utils/CTelephoneInfo.java
672c65bec57c3f1d1d7617eea601ba06f53804f3
[]
no_license
evilhawk00/AppGroup
c22e693320039f4dc7b384976a513f94be5bccbe
a22714c1e6b9f5c157bebb2c5dbc96b854ba949a
refs/heads/master
2022-01-11T18:04:27.481162
2018-04-19T03:02:26
2018-04-19T03:02:26
420,370,518
1
0
null
null
null
null
UTF-8
Java
false
false
10,494
java
package com.koobee.koobeecenter.utils; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import android.content.Context; import android.telephony.PhoneNumberUtils; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.text.TextUtils; public class CTelephoneInfo { private static final String TAG = CTelephoneInfo.class.getSimpleName(); private String imeiSIM1;// IMEI private String imeiSIM2;// IMEI private String iNumeric1;// sim1 code number private String iNumeric2;// sim2 code number private boolean isSIM1Ready;// sim1 private boolean isSIM2Ready;// sim2 private String iDataConnected1 = "0";// sim1 0 no, 1 connecting, 2 // connected, 3 suspended. private String iDataConnected2 = "0";// sim2 private static CTelephoneInfo CTelephoneInfo; private static Context mContext; private static SubscriptionManager mSubscriptionManager; private CTelephoneInfo() { } public synchronized static CTelephoneInfo getInstance(Context context) { if (CTelephoneInfo == null) { CTelephoneInfo = new CTelephoneInfo(); } mContext = context; // mSubscriptionManager = SubscriptionManager.from(mContext); return CTelephoneInfo; } public String getImeiSIM1() { return imeiSIM1; } public String getImeiSIM2() { return imeiSIM2; } public boolean isSIM1Ready() { return isSIM1Ready; } public boolean isSIM2Ready() { return isSIM2Ready; } public boolean isDualSim() { return imeiSIM2 != null; } // public boolean isDataConnected1() { // if (TextUtils.equals(iDataConnected1, "2") // || TextUtils.equals(iDataConnected1, "1")) // return true; // else // return false; // } // // public boolean isDataConnected2() { // if (TextUtils.equals(iDataConnected2, "2") // || TextUtils.equals(iDataConnected2, "1")) // return true; // else // return false; // } public String getINumeric1() { return iNumeric1; } public String getINumeric2() { return iNumeric2; } public String getINumeric() { if (imeiSIM2 != null) { if (iNumeric1 != null && iNumeric1.length() > 1) return iNumeric1; if (iNumeric2 != null && iNumeric2.length() > 1) return iNumeric2; } return iNumeric1; } public void setCTelephoneInfo() { TelephonyManager telephonyManager = ((TelephonyManager) mContext .getSystemService(Context.TELEPHONY_SERVICE)); CTelephoneInfo.imeiSIM1 = telephonyManager.getDeviceId(); ; CTelephoneInfo.imeiSIM2 = null; try { CTelephoneInfo.imeiSIM1 = getOperatorBySlot(mContext, "getDeviceIdGemini", 0); CTelephoneInfo.imeiSIM2 = getOperatorBySlot(mContext, "getDeviceIdGemini", 1); // CTelephoneInfo.iNumeric1 = getOperatorBySlot(mContext, // "getSimOperatorGemini", 0); // CTelephoneInfo.iNumeric2 = getOperatorBySlot(mContext, // "getSimOperatorGemini", 1); // CTelephoneInfo.iDataConnected1 = getOperatorBySlot(mContext, // "getDataStateGemini", 0); // CTelephoneInfo.iDataConnected2 = getOperatorBySlot(mContext, // "getDataStateGemini", 1); } catch (GeminiMethodNotFoundException e) { e.printStackTrace(); try { CTelephoneInfo.imeiSIM1 = getOperatorBySlot(mContext, "getDeviceId", 0); CTelephoneInfo.imeiSIM2 = getOperatorBySlot(mContext, "getDeviceId", 1); // CTelephoneInfo.iNumeric1 = getOperatorBySlot(mContext, // "getSimOperator", 0); // CTelephoneInfo.iNumeric2 = getOperatorBySlot(mContext, // "getSimOperator", 1); // CTelephoneInfo.iDataConnected1 = getOperatorBySlot(mContext, // "getDataState", 0); // CTelephoneInfo.iDataConnected2 = getOperatorBySlot(mContext, // "getDataState", 1); } catch (GeminiMethodNotFoundException e1) { // Call here for next manufacturer's predicted method name if // you wish e1.printStackTrace(); } } // CTelephoneInfo.isSIM1Ready = telephonyManager.getSimState() == // TelephonyManager.SIM_STATE_READY; // CTelephoneInfo.isSIM2Ready = false; // // try { // CTelephoneInfo.isSIM1Ready = getSIMStateBySlot(mContext, // "getSimStateGemini", 0); // CTelephoneInfo.isSIM2Ready = getSIMStateBySlot(mContext, // "getSimStateGemini", 1); // } catch (GeminiMethodNotFoundException e) { // e.printStackTrace(); // try { // CTelephoneInfo.isSIM1Ready = getSIMStateBySlot(mContext, // "getSimState", 0); // CTelephoneInfo.isSIM2Ready = getSIMStateBySlot(mContext, // "getSimState", 1); // } catch (GeminiMethodNotFoundException e1) { // // Call here for next manufacturer's predicted method name if // // you wish // e1.printStackTrace(); // } // } // mSlotId = extras.getInt(SimSettings.EXTRA_SLOT_ID, -1); } private static String getOperatorBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException { String inumeric = null; TelephonyManager telephony = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); try { Class<?> telephonyClass = Class.forName(telephony.getClass() .getName()); Class<?>[] parameter = new Class[1]; parameter[0] = int.class; Method getSimID = telephonyClass.getMethod(predictedMethodName, parameter); Object[] obParameter = new Object[1]; obParameter[0] = slotID; Object ob_phone = getSimID.invoke(telephony, obParameter); if (ob_phone != null) { inumeric = ob_phone.toString(); } } catch (Exception e) { e.printStackTrace(); throw new GeminiMethodNotFoundException(predictedMethodName); } return inumeric; } private static SubscriptionInfo mSubInfoRecord; public static String getPhonenumber(Context context){ /* // TelephonyManager manager = (TelephonyManager)context. getSystemService(Context.TELEPHONY_SERVICE); Class clazz = manager.getClass(); try { Method getPhoneNumber=clazz.getDeclaredMethod("getLine1NumberForSubscriber",int.class); Object yy= getPhoneNumber.invoke(manager, 1); // te=te+ yy.toString(); te=te+ (String) getPhoneNumber.invoke(manager, 0); te=te+(String) getPhoneNumber.invoke(manager, 1); } catch (NoSuchMethodException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } TelephonyManager telephony = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); String te1 = telephony.getLine1Number();// return te; */ String number=""; mSubscriptionManager = SubscriptionManager.from(mContext); mSubInfoRecord = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(0); if(mSubInfoRecord==null){ mSubInfoRecord = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(1); if(mSubInfoRecord==null){ return number; }else{ TelephonyManager tm = (TelephonyManager) mContext.getSystemService( Context.TELEPHONY_SERVICE); // TextView numberView = (TextView)mDialogLayout.findViewById(R.id.number); String rawNumber = tm.getLine1NumberForSubscriber( mSubInfoRecord.getSubscriptionId()); if (TextUtils.isEmpty(rawNumber)) { // numberView.setText(res.getString(com.android.internal.R.string.unknownName)); } else { number= PhoneNumberUtils.formatNumber(rawNumber); // number="+86 13027911580"; number=number.substring(number.length()-11,number.length()); // numberView.setText(PhoneNumberUtils.formatNumber(rawNumber)); } } }else{ TelephonyManager tm = (TelephonyManager) mContext.getSystemService( Context.TELEPHONY_SERVICE); // TextView numberView = (TextView)mDialogLayout.findViewById(R.id.number); String rawNumber = tm.getLine1NumberForSubscriber( mSubInfoRecord.getSubscriptionId()); if (TextUtils.isEmpty(rawNumber)) { // numberView.setText(res.getString(com.android.internal.R.string.unknownName)); } else { number= PhoneNumberUtils.formatNumber(rawNumber); // a=a.Substring(a.Length-2,2); number="+86 13027911580"; number=number.substring(number.length()-11,number.length()); // numberView.setText(PhoneNumberUtils.formatNumber(rawNumber)); } } return number; } private static boolean getSIMStateBySlot(Context context, String predictedMethodName, int slotID) throws GeminiMethodNotFoundException { boolean isReady = false; TelephonyManager telephony = (TelephonyManager) context .getSystemService(Context.TELEPHONY_SERVICE); String te1 = telephony.getLine1Number();// String te2=telephony.getLine1NumberForSubscriber(0); try { Class<?> telephonyClass = Class.forName(telephony.getClass() .getName()); Class<?>[] parameter = new Class[1]; parameter[0] = int.class; Method getSimStateGemini = telephonyClass.getMethod( predictedMethodName, parameter); Object[] obParameter = new Object[1]; obParameter[0] = slotID; Object ob_phone = getSimStateGemini.invoke(telephony, obParameter); if (ob_phone != null) { int simState = Integer.parseInt(ob_phone.toString()); if (simState == TelephonyManager.SIM_STATE_READY) { isReady = true; } } } catch (Exception e) { e.printStackTrace(); throw new GeminiMethodNotFoundException(predictedMethodName); } return isReady; } private static class GeminiMethodNotFoundException extends Exception { /** * */ private static final long serialVersionUID = -3241033488141442594L; public GeminiMethodNotFoundException(String info) { super(info); } } /** * * getSerialNumber * * @return result is same to Build.SERIAL */ public static String getSerialNumber() { String serial = null; try { Class<?> c = Class.forName("android.os.SystemProperties"); Method get = c.getMethod("get", String.class); serial = (String) get.invoke(c, "ro.serialno"); } catch (Exception e) { e.printStackTrace(); } return serial; } }
93fe2b463b538bf5cb9c4922b261a61424196393
8b277524cd0d5fa38acc54ba7506aed78f4e67ae
/Kaushik_Hibernate/src/main/java/com/rau/hibernate/model/TwoLegsAnimal.java
3315b5a7c1e693a3c3339897b58167573116af94
[]
no_license
singhraushan/new_learning
a3ef3381d18d35d5aef6c1b8b9e442a648b75bfe
165e9467c99021b218ec1d06c432c252f8678cca
refs/heads/master
2022-12-24T02:28:45.034712
2021-12-16T16:22:59
2021-12-16T16:22:59
145,468,324
4
1
null
2022-12-16T04:35:20
2018-08-20T20:40:29
Java
UTF-8
Java
false
false
864
java
/** * */ package com.rau.hibernate.model; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; /** * @author Raushan kumar * */ @Entity @DiscriminatorValue("TWO_LEGS_ANIMAL")// not mandatory, just for specific value in Discriminator column public class TwoLegsAnimal extends Animal { private boolean haveTail; private String colour; /** * @return the haveTail */ public boolean isHaveTail() { return haveTail; } /** * @param haveTail * the haveTail to set */ public void setHaveTail(boolean haveTail) { this.haveTail = haveTail; } /** * @return the colour */ public String getColour() { return colour; } /** * @param colour * the colour to set */ public void setColour(String colour) { this.colour = colour; } }
402d8b1532864f272708f5eb8046973fdc1b082d
90969b9b6fc14d4c54a34bfc178312d0a550044e
/app/src/test/java/com/theonedayapps/tapnswitch/ExampleUnitTest.java
21c0bca7686ac985ccee8ab448102b92d387d1c7
[]
no_license
Atharva1449/Tap-n-Switch
572b057243a5348deeb3093bf83cfd029ec6ac76
fe33a54d6f88fa6a5a001824da6f99eed221b139
refs/heads/main
2023-02-06T02:29:01.727702
2020-12-24T10:51:25
2020-12-24T10:51:25
303,718,958
1
0
null
null
null
null
UTF-8
Java
false
false
389
java
package com.theonedayapps.tapnswitch; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
89345cd646dd4950202fa325f4adbfb11f2c30f4
94f6f2a555e02a8439515418073034ef737e7311
/app/src/main/java/com/codewithdj/heal_player/MusicAdapter.java
1bf112b843520b0022add35f51c871ddcd6d3ca2
[]
no_license
YudhishSharma/Music_Player_App
14789bf8972fc47e862584a595d944344024ff1f
5f95aeec7b25d943874eb182d259d7cb327b37c8
refs/heads/master
2023-03-16T06:50:24.072785
2021-02-24T09:57:28
2021-02-24T09:57:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,215
java
package com.codewithdj.heal_player; import android.content.Context; import android.content.Intent; import android.media.MediaMetadataRetriever; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import java.util.ArrayList; public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.MyViewHolder> { private Context mContext; static ArrayList<MusicFiles> mFiles; MusicAdapter(Context mContext , ArrayList<MusicFiles> mFiles) { this.mFiles = mFiles; this.mContext = mContext; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(mContext).inflate(R.layout.music_items , parent , false); return new MyViewHolder(view); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, final int position) { holder.file_name.setText(mFiles.get(position).getTitle()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(mContext , PlayerActivity.class); intent.putExtra("position" , position ); mContext.startActivity(intent); } }); } @Override public int getItemCount() { return mFiles.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { TextView file_name; ImageView album_art; public MyViewHolder(View itemView) { super(itemView); file_name = itemView.findViewById(R.id.music_file_name); album_art = itemView.findViewById(R.id.music_img); } } void updateList(ArrayList<MusicFiles> musicFilesArrayList) { mFiles = new ArrayList<>(); mFiles.addAll(musicFilesArrayList); notifyDataSetChanged(); } }
ca43d22dfb4cd2100e11a9a593a49e45d25f316d
1b493bea3ed615287aab1e9b5edc3ecdf88a87b4
/Facility.java
f7380e17277e2ae3b86704a9ebe79eb7524971c7
[]
no_license
ABC-001/test01
d1ba13c3e6f2b3ca0f668447b81d532cc73a79ea
1b3c84c59f47ea336e04a6b5b780fc5a5a897a47
refs/heads/main
2023-04-24T17:42:39.661971
2021-04-24T17:34:22
2021-04-24T17:34:22
361,225,474
0
0
null
null
null
null
UTF-8
Java
false
false
3,309
java
import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Facility { private String name; private String address; private int zipcode; private int year; private int month; private int day; private int score; private char grade; public Facility(String name, String address, int zipcode, String date, int score, char grade) throws DateFormatException { try { splitDate(date); } catch(DateFormatException ex) { throw ex; //rethrow the exception. } this.name = name; this.address = address; this.zipcode = zipcode; this.score = score; this.grade = grade; } private void splitDate(String date) throws DateFormatException { if (isValidDate(date)) { //!!!!!STUDENT CODE GOES HERE, FINISH THIS IF STATEMENT //Fill in the code to correctly split the date into year, month, day. } else { throw new DateFormatException("Date format not correct for date " + date + ". Correct format is: YYYY-MM-DD"); } } private boolean isValidDate(String date) { //Dates are in the format YYYY-MM-DD (year, month, day with hyphens in between). //NOTE: Single digit numbers for month and day should have a leading 0 (so 1 is 01, 2 is 02 and so on...) //NOTE: The following is a regular expression which can be used to validate the date format. It will check // the date has the correct number of characters, that the numbers are in the correct ranges, and // the hypens are in the correct positions. Regular Expressions are a very powerful concept to learn. // This is a very advanced topic. If you are interested in learning about this, google "regular expressions" and read about them. final String DATE_REGEX = "^\\d{4}\\-(0[1-9]|1[012])\\-(0[1-9]|[12][0-9]|3[01])$"; return date.matches(DATE_REGEX); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public int getZipcode() { return zipcode; } public void setZipcode(int zipcode) { this.zipcode = zipcode; } public int getYear() { return year; } public void setYear(int year) { this.year = year; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } public char getGrade() { return grade; } public void setGrade(char grade) { this.grade = grade; } public String toString() { StringBuilder sb = new StringBuilder(); String date = String.format("%d-%02d-%02d", year, month, day); sb.append("Facility Name:\t\t" + this.name + "\n"); sb.append("Address:\t\t" + this.address + "\n"); sb.append("\t\t\tLos Angeles, CA " + this.zipcode + "\n"); sb.append("Date of Inspection:\t" + date + "\n"); sb.append("Score:\t\t\t" + this.score + "\n"); sb.append("Grade: \t\t\t" + this.grade + "\n"); return sb.toString(); } }
dff915ddf5cfc9eab9a74020f855cad780302c2b
592eb3c39bbd5550c5406abdfd45f49c24e6fd6c
/autoweb/src/main/java/com/surveygen/struts/action/SurveyGenLoginViewAction.java
3efb7771bfbf5c5e24831bf3dcd817e8aa497d06
[]
no_license
passionblue/autoweb
f77dc89098d59fddc48a40a81f2f2cf27cd08cfb
8ea27a5b83f02f4f0b66740b22179bea4d73709e
refs/heads/master
2021-01-17T20:33:28.634291
2016-06-17T01:38:45
2016-06-17T01:38:45
60,968,206
0
0
null
null
null
null
UTF-8
Java
false
false
1,613
java
/* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.surveygen.struts.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.jtrend.struts.core.DefaultViewManager; import com.jtrend.struts.core.LoginViewAction; import com.jtrend.struts.core.ViewAction; import com.surveygen.app.SurveyGenAppInitiator; import com.surveygen.app.SurveyGenViewManager; import com.surveygen.db.User; import com.surveygen.ds.UserDS; import com.surveygen.struts.form.LoginForm; /** * MyEclipse Struts * Creation date: 07-14-2007 * * XDoclet definition: * @struts.action path="/loginFormSubmit" name="loginForm" input="/jsp/form/login.jsp" scope="request" validate="true" * @struts.action-forward name="default" path="/jsp/layout/layout.jsp" */ public class SurveyGenLoginViewAction extends LoginViewAction { /* public void initApp() { try { m_logger.debug("SurveyGenCoreAction.initApp()"); SurveyGenAppInitiator.init(); } catch (Exception e) { m_logger.error(e); } //m_viewManager = SurveyGenViewManager.getInstance(); m_viewManager = DefaultViewManager.getInstance(); } */ private static Logger m_logger = Logger.getLogger(SurveyGenLoginViewAction.class); }
[ "joshua@joshua-dell" ]
joshua@joshua-dell
f7e606a9ba779f933b5f0b3452593c1409673a87
0df3b7512ca516ebe2e79091689623afaed61c20
/test/helloworldmvc/model/BDModelImplementationTest.java
75f4acdb12305558ad85a29eafdd27b48c7950e6
[]
no_license
UnaiUrti/Reto0DIN
bb3da9fc184c0b0eb9658d01d910236f334533ba
0e311a8c2c02ec2cd4e93816c025942f9d133e10
refs/heads/master
2023-08-18T14:51:42.242362
2021-09-30T07:24:08
2021-09-30T07:24:08
407,517,606
0
0
null
null
null
null
UTF-8
Java
false
false
697
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package helloworldmvc.model; import org.junit.Test; import static org.junit.Assert.*; /** * * @author UnaiUrtiaga,AdrianFranco */ public class BDModelImplementationTest { /** * This is the test class which tests if the database implementation * works right */ @Test public void testGetGreeting() { Model model = new FileModelImplementation(); String greet = "HELLO WORLD!"; assertEquals(greet, model.getGreeting()); } }
97d56aa8e53ac09ee0013a15b351dfd1c879bbdd
bdaf69d1be66cf0593907c4b10645d57ceabbc16
/src/main/java/com/javaex/vo/GalleryVo.java
8c7e54411d43de1197dc47923eb31522ad9bcdfa
[]
no_license
Maroban/mysite5
94867565152f7dc623156c20413f8cfe94064974
7e1f052f1ede750cfd31da92c9e9cb3939f7402c
refs/heads/master
2023-07-01T11:40:33.866091
2021-08-12T13:48:34
2021-08-12T13:48:34
389,928,139
0
0
null
null
null
null
UTF-8
Java
false
false
2,579
java
package com.javaex.vo; import org.springframework.web.multipart.MultipartFile; public class GalleryVo { // 필드 private int no; private int user_no; private String content; private String filePath; private String orgName; private String saveName; private long fileSize; private MultipartFile imgFile; private String name; // 생성자 public GalleryVo() { } public GalleryVo(int user_no, String content, String filePath, String orgName, String saveName, long fileSize) { this.user_no = user_no; this.content = content; this.filePath = filePath; this.orgName = orgName; this.saveName = saveName; this.fileSize = fileSize; } public GalleryVo(int no, int user_no, String content, String filePath, String orgName, String saveName, long fileSize) { this.no = no; this.user_no = user_no; this.content = content; this.filePath = filePath; this.orgName = orgName; this.saveName = saveName; this.fileSize = fileSize; } // 메소드 - GS public int getNo() { return no; } public String getName() { return name; } public void setName(String name) { this.name = name; } public MultipartFile getImgFile() { return imgFile; } public void setImgFile(MultipartFile imgFile) { this.imgFile = imgFile; } public void setNo(int no) { this.no = no; } public int getUser_no() { return user_no; } public void setUser_no(int user_no) { this.user_no = user_no; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getFilePath() { return filePath; } public void setFilePath(String filePath) { this.filePath = filePath; } public String getOrgName() { return orgName; } public void setOrgName(String orgName) { this.orgName = orgName; } public String getSaveName() { return saveName; } public void setSaveName(String saveName) { this.saveName = saveName; } public long getFileSize() { return fileSize; } public void setFileSize(long fileSize) { this.fileSize = fileSize; } // 메소드 - 일반 @Override public String toString() { return "GalleryVo [no=" + no + ", user_no=" + user_no + ", content=" + content + ", filePath=" + filePath + ", orgName=" + orgName + ", saveName=" + saveName + ", fileSize=" + fileSize + "]"; } }
fd738d895d3a817fb05d7511976c823e818412fb
1d62ea55f6d8e32f538b60e22fb4273e62f770c4
/src/ThreadStudy/TreadPoolTest.java
39a01fbedd6347adb5f8b7a431f931fbb93f5593
[]
no_license
Anapplewj/Learn_java
0797ad01221c6bfe26af2ba8e75f3483d6bfcaf9
c6c3bc42f00559cbd8a13800221fa28318e3ee34
refs/heads/master
2023-06-29T19:01:33.300267
2021-08-07T13:12:45
2021-08-07T13:12:45
317,239,720
0
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
package ThreadStudy; import java.util.concurrent.*; public class TreadPoolTest { private Object NullPointerException; public static void main(String[] args) { ThreadPoolExecutor pool=new ThreadPoolExecutor( 4, 10, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r); } }, new ThreadPoolExecutor.CallerRunsPolicy() // new ThreadPoolExecutor.AbortPolicy() // new ThreadPoolExecutor.DiscardPolicy() // new ThreadPoolExecutor.DiscardOldestPolicy() ); pool.execute(new Runnable() { @Override public void run() { System.out.println(1); } }); ExecutorService single=Executors.newSingleThreadExecutor(); ExecutorService fixed=Executors.newFixedThreadPool(4); ExecutorService catched=Executors.newCachedThreadPool(); ScheduledExecutorService scheduled=Executors.newScheduledThreadPool(4); } }
676ea57b95fbfa8a32e2b8a8e9b2b4205d7ad14f
9cc774ed55147d9bfe12f5127640114a6682a0c0
/Tank Game/project_intResources/MultiplayersTankGame/MapLoader.java
ed08b625e1c0e901e8d003afc7ed4672d7b15a4f
[]
no_license
ShanKwanCho/CSC_413_SP18
eb31257c75a4fb5f154c2f143f0710a7657e67f3
7aca2d15b8bcf012f67d38e7f916aebed3ff59b1
refs/heads/master
2020-03-23T17:09:02.710498
2018-07-21T21:44:05
2018-07-21T21:44:05
141,845,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,286
java
import java.io.*; import java.util.List; import java.util.ArrayList; import java.net.*; public class MapLoader { // MapLoader is a singleton class! private static final MapLoader mapLoader = new MapLoader(); private BufferedReader br = null; private static final int SIZE = 40; int lineNumber = 0; int columnNumber = 0; List<Location> wallMap = new ArrayList<Location>(); public void read() { URL url = MapLoader.class.getResource("Resources/wallMap"); try { br = new BufferedReader(new InputStreamReader(url.openStream())); // BufferedReader should read from URL while (true) { String line = br.readLine(); if (line == null) { break; } char [] charArray = line.toCharArray(); for (int i = 0; i < SIZE; i++) { if (charArray[i] == 'P') { wallMap.add(new Location(i, lineNumber, "Wall")); } else if (charArray[i] == 'D') { wallMap.add(new Location(i, lineNumber, "DestructableWall")); } } lineNumber++; } } catch (Exception e) { e.printStackTrace(); } finally { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } public List<Location> getWallMap() { return wallMap; } public static MapLoader getInstance() { return mapLoader; } }
c423056b39bdd820758bc69eaf2713e7afdb8ed6
4fca4e3208e09ddaaf12c044c1edc9f98ffa2a8b
/app/src/main/java/com/taniaticona/servicios/clinicadental/ItemDetailActivity.java
1522ca9a122e29879eaa8662ed3da68782f6a1dd
[]
no_license
JackieTC/AppBasico
53b46b28e2c0963ca678b22f161f2af0f89e6af2
f5427ce5fd99232520b7f294548b8fb93316c859
refs/heads/master
2021-01-10T16:27:10.800427
2016-01-12T06:20:10
2016-01-12T06:20:10
49,477,180
0
0
null
null
null
null
UTF-8
Java
false
false
3,564
java
package com.taniaticona.servicios.clinicadental; import android.support.v7.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.text.TextUtils; import android.view.View; import android.support.v4.app.NavUtils; import android.view.MenuItem; import android.widget.TextView; /** * An activity representing a single Item detail screen. This * activity is only used on handset devices. On tablet-size devices, * item details are presented side-by-side with a list of items * in a {@link ItemListActivity}. * <p/> * This activity is mostly just a 'shell' activity containing nothing * more than a {@link ItemDetailFragment}. */ public class ItemDetailActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //agregue setContentView(R.layout.activity_item_detail); Toolbar toolbar = (Toolbar) findViewById(R.id.detail_toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "consultas al correo: [email protected]", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); // Show the Up button in the action bar. getSupportActionBar().setDisplayHomeAsUpEnabled(true); // savedInstanceState is non-null when there is fragment state // saved from previous configurations of this activity // (e.g. when rotating the screen from portrait to landscape). // In this case, the fragment will automatically be re-added // to its container so we don't need to manually add it. // For more information, see the Fragments API guide at: // // http://developer.android.com/guide/components/fragments.html // if (savedInstanceState == null) { // Create the detail fragment and add it to the activity // using a fragment transaction. Bundle arguments = new Bundle(); arguments.putString(ItemDetailFragment.ARG_ITEM_ID, getIntent().getStringExtra(ItemDetailFragment.ARG_ITEM_ID)); ItemDetailFragment fragment = new ItemDetailFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction() .add(R.id.item_detail_container, fragment) .commit(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == android.R.id.home) { // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpTo(this, new Intent(this, ItemListActivity.class)); return true; } return super.onOptionsItemSelected(item); } }
ba7197dd7aa60571855d02151b649f7cfad110c8
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-tnb/src/main/java/com/amazonaws/services/tnb/model/transform/DeleteSolFunctionPackageRequestMarshaller.java
b5abc7a8502d2014aee5fa5107c7c1c8fd2219ff
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,085
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.tnb.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.tnb.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * DeleteSolFunctionPackageRequestMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DeleteSolFunctionPackageRequestMarshaller { private static final MarshallingInfo<String> VNFPKGID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PATH) .marshallLocationName("vnfPkgId").build(); private static final DeleteSolFunctionPackageRequestMarshaller instance = new DeleteSolFunctionPackageRequestMarshaller(); public static DeleteSolFunctionPackageRequestMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(DeleteSolFunctionPackageRequest deleteSolFunctionPackageRequest, ProtocolMarshaller protocolMarshaller) { if (deleteSolFunctionPackageRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteSolFunctionPackageRequest.getVnfPkgId(), VNFPKGID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
34c96aeda8212677a0e9f87cc06652d535265c89
441f1c20f324c1b8af552a858ca7b6ce0556e826
/spring-data-requery/src/main/java/org/springframework/data/requery/repository/query/ParameterMetadataProvider.java
83525f70136b1e4ed0babd1a72188e73cdc3992c
[ "Apache-2.0" ]
permissive
monkyeg/spring-data-requery
b795942322e19ff4cd61c26f51bb4e83486a807a
066bb2d054814003d2b4874e549f31cd26a7ca82
refs/heads/master
2020-04-03T13:55:52.435051
2018-10-12T17:38:19
2018-10-12T17:38:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,962
java
/* * Copyright 2018 Coupang Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.data.requery.repository.query; import io.requery.query.Expression; import io.requery.query.FieldExpression; import io.requery.query.NamedExpression; import lombok.extern.slf4j.Slf4j; import org.springframework.data.repository.query.Parameter; import org.springframework.data.repository.query.Parameters; import org.springframework.data.repository.query.ParametersParameterAccessor; import org.springframework.data.repository.query.parser.Part; import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ObjectUtils; import javax.persistence.criteria.ParameterExpression; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.function.Supplier; /** * Helper class to allow easy creation of {@link ParameterMetadata}s. * * @author debop * @since 18. 6. 14 */ @Slf4j public class ParameterMetadataProvider { private final Iterator<? extends Parameter> parameters; private final List<ParameterMetadata<?>> expressions; private final @Nullable Iterator<Object> bindableParameterValues; public ParameterMetadataProvider(ParametersParameterAccessor accessor) { this(accessor.iterator(), accessor.getParameters()); } public ParameterMetadataProvider(Parameters<?, ?> parameters) { this(null, parameters); } public ParameterMetadataProvider(@Nullable Iterator<Object> bindableParameterValues, Parameters<?, ?> parameters) { Assert.notNull(parameters, "Parameters must not be null!"); this.parameters = parameters.getBindableParameters().iterator(); this.expressions = new ArrayList<>(); this.bindableParameterValues = bindableParameterValues; } public List<ParameterMetadata<?>> getExpressions() { return Collections.unmodifiableList(expressions); } @SuppressWarnings("unchecked") public <T> ParameterMetadata<T> next(Part part) { Assert.isTrue(parameters.hasNext(), "No parameter available for part. part=" + part); Parameter parameter = parameters.next(); return (ParameterMetadata<T>) next(part, parameter.getType(), parameter); } @SuppressWarnings("unchecked") public <T> ParameterMetadata<T> next(Part part, Class<T> type) { Parameter parameter = parameters.next(); Class<?> typeToUse = ClassUtils.isAssignable(type, parameter.getType()) ? parameter.getType() : type; return (ParameterMetadata<T>) next(part, typeToUse, parameter); } private <T> ParameterMetadata<T> next(Part part, Class<T> type, Parameter parameter) { log.debug("get next parameter ... part={}, type={}, parameter={}", part, type, parameter); Assert.notNull(type, "Type must not be null!"); /* * We treat Expression types as Object vales since the real value to be bound as a parameter is determined at query time. */ Class<T> reifiedType = Expression.class.equals(type) ? (Class<T>) Object.class : type; Supplier<String> name = () -> parameter.getName() .orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named")); NamedExpression<T> expression = parameter.isExplicitlyNamed() ? NamedExpression.of(name.get(), reifiedType) : NamedExpression.of(String.valueOf(parameter.getIndex()), reifiedType); Object value = bindableParameterValues == null ? ParameterMetadata.PLACEHOLDER : bindableParameterValues.next(); ParameterMetadata metadata = new ParameterMetadata(expression, part.getType(), value); expressions.add(metadata); return metadata; } @Slf4j static class ParameterMetadata<T> { static final Object PLACEHOLDER = new Object(); private final FieldExpression<T> expression; private final Part.Type type; private final Object value; /** * Creates a new {@link ParameterMetadata}. */ public ParameterMetadata(FieldExpression<T> expression, Part.Type type, @Nullable Object value) { this.expression = expression; this.type = value == null && Part.Type.SIMPLE_PROPERTY.equals(type) ? Part.Type.IS_NULL : type; this.value = value; } /** * Returns the {@link ParameterExpression}. * * @return the expression */ public FieldExpression<T> getExpression() { return expression; } public Object getValue() { return value; } /** * Returns whether the parameter shall be considered an {@literal IS NULL} parameter. */ public boolean isIsNullParameter() { return Part.Type.IS_NULL.equals(type); } /** * Prepares the object before it's actually bound to the {@link javax.persistence.Query;}. * * @param value must not be {@literal null}. */ @Nullable public Object prepare(Object value) { Assert.notNull(value, "Value must not be null!"); Class<? extends T> expressionType = expression.getClassType(); log.debug("Prepare value... type={}, value={}, expressionType={}", type, value, expressionType); if (String.class.equals(expressionType)) { switch (type) { case STARTING_WITH: return String.format("%s%%", value.toString()); case ENDING_WITH: return String.format("%%%s", value.toString()); case CONTAINING: case NOT_CONTAINING: return String.format("%%%s%%", value.toString()); default: return value; } } return value; // return Collection.class.isAssignableFrom(expressionType) // // ? persistenceProvider.potentiallyConvertEmptyCollection(toCollection(value)) // // : value; } /** * Returns the given argument as {@link Collection} which means it will return it as is if it's a * {@link Collections}, turn an array into an {@link ArrayList} or simply wrap any other value into a single element * {@link Collections}. * * @param value the value to be converted to a {@link Collection}. * @return the object itself as a {@link Collection} or a {@link Collection} constructed from the value. */ @Nullable private static Collection<?> toCollection(@Nullable Object value) { if (value == null) { return null; } if (value instanceof Collection) { return (Collection<?>) value; } if (ObjectUtils.isArray(value)) { return Arrays.asList(ObjectUtils.toObjectArray(value)); } return Collections.singleton(value); } } }
a324ec305bbc2045613e38d1ddb70fd34a328db7
308fd86b83256ba55d1183257be483fee8378e55
/src/javaapplication1/ArraylistExample2.java
9db84c4dbaac8f2e6914a5787f02f90c2713529b
[]
no_license
Navpreet76/java_review
dbf8bce344aefc35c314112b924b9571a77217e8
925e5b5a773c737e2c5ccb9e0d03a7742ef08ac0
refs/heads/master
2021-04-27T08:06:31.026889
2018-02-23T16:42:18
2018-02-23T16:42:18
122,646,848
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package javaapplication1; import java.util.*; public class ArraylistExample2 { public static void main(String[] args) { ArrayList<String>list = new ArrayList<String>();//Create Array list list.add("Nick");//Adding objects to array list list.add("Navpreet"); list.add("Michelle"); list.add("Clive"); list.add("Nancy"); //Traversing through the list with Iterator Iterator itr = list.iterator(); while(itr.hasNext()) { System.out.println(itr.next()); } } }
c79496c2e5ae43a7a007e20e7067bac74e932521
bbad69822950e11b5ba9638f3d7493a16aeeaaba
/src/main/java/com/mxdl/service/NewsTypeService.java
08be1bf3d84255b7bc1ce9d33bf5829388d5687a
[]
no_license
mxdldev/spring-boot-security-oauth2-flycloud
609295df52e60bfcee1d94d6c43107e2dbc24955
369400e3d330509bc4095256817d09f3abe77dc7
refs/heads/master
2021-04-16T20:39:54.883819
2020-03-23T09:22:40
2020-03-23T09:22:40
249,383,540
0
0
null
null
null
null
UTF-8
Java
false
false
736
java
package com.mxdl.service; import com.mxdl.dao.NewsTypeDao; import com.mxdl.model.NewsType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * Description: <BlogService><br> * Author:    mxdl<br> * Date:     2019/2/19<br> * Version:   V1.0.0<br> * Update:     <br> */ @Service public class NewsTypeService { @Autowired NewsTypeDao newsTypeDao; public NewsType saveNewsType(NewsType newstype) { return newsTypeDao.save(newstype); } public void deleteBlog(long id) { newsTypeDao.delete(id); } public List<NewsType> findListNewsType(){ return newsTypeDao.findAll(); } }
6d112c548fc1559e2bb1c24511cc4ec51bbab390
70d5c4d4cccca08672a92cc485cb22a55257c75a
/151-Reverse-Words-in-a-String/solution.java
54ce587317eafa9954b825ec79d1a611c5f8453a
[]
no_license
always414/leetcode
097001a318aaf7fae14e13a8b8790dd4ff52cdb8
ec23770f2ad926337fd7553621e11ed147d44b2a
refs/heads/master
2020-04-06T07:07:58.297239
2016-08-31T04:44:39
2016-08-31T04:44:39
60,560,541
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
import java.util.Arrays; public class Solution { public String reverseWords(String s) { String[] beforeReverse = s.split("\\s+"); StringBuilder sb = new StringBuilder(); for (int i = beforeReverse.length - 1; i >= 0; i--) { if (beforeReverse[i].length() > 0) { if (i != beforeReverse.length-1) { sb.append(" "); } sb.append(beforeReverse[i]); } } return sb.toString(); } }
6cf7c6459e64674fb56636405db713d51085a8f0
428c519a007c4bb0a9881dd4aa02e1ccf75161c2
/ArrayList.java
59d4e4fa2f8530c801ce3a13b5a878913d6c7b02
[]
no_license
usfcs245201908/cs-245-practice-assignment-07-HunterMRocha
6159a027f10360976f17da336e545f8197008e48
ad9b84cf0e3d5244691208c5a00d6566af934a15
refs/heads/master
2020-08-16T06:24:24.844412
2019-10-18T01:37:55
2019-10-18T01:37:55
215,467,502
0
0
null
null
null
null
UTF-8
Java
false
false
1,297
java
import java.util.Arrays; public class ArrayList <T> implements List<T>{ private T[] a; private int size; public ArrayList(){ a = (T[]) new Object[10]; size = 0; } public void add(Object item){ if(size == a.length){ growArray(); } a[size++] = (T) item; } public void add(int pos, Object item) throws IndexOutOfBoundsException{ if(pos < 0 || pos>size){ throw new IndexOutOfBoundsException("does not work"); } if(size == a.length){ growArray(); } for(int i =size; i >pos; i--){ a[i] = a[i-1]; } a[pos] = (T) item; size++; } public T get(int pos)throws IndexOutOfBoundsException{ if(pos<0||pos>=size){ throw new IndexOutOfBoundsException("does not work"); } return a[pos]; } public T remove(int pos)throws IndexOutOfBoundsException{ if(pos<0 || pos>=size){ throw new IndexOutOfBoundsException("does not work"); } T item = a[pos]; for(int i =pos; i<size-1; i++){ a[i] = a[i+1]; } size--; return item; } public int size(){ return size; } public void growArray(){ int len = a.length; T[] new_array = (T[]) new Object[len*2]; for(int i = 0; i < a.length; i++){ new_array[i] = a[i]; } a = new_array; } }
2a1a77f6ec4bf238ad29c4b6abc0ad5021c61f01
995f73d30450a6dce6bc7145d89344b4ad6e0622
/MATE-20_EMUI_11.0.0/src/main/java/com/android/server/wifi/hwcoex/HiCoexChrImpl.java
68cf69f5b3f1dabefd717f53a7fdac85afff29be
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,834
java
package com.android.server.wifi.hwcoex; import android.content.Context; import android.os.Bundle; import com.android.server.wifi.HwWifiCHRService; import com.android.server.wifi.HwWifiCHRServiceImpl; public class HiCoexChrImpl { private static final int EID_NR_STATE_INFO = 909009120; private static final int EID_NR_STATISTIC_INFO = 909009121; private static final int MILLISECOND_UNIT = 1000; private static final int MIN_TRIGGER_INTERVAL = 1000; private static final String TAG = "HiCoexChrImpl"; private static HiCoexChrImpl mHiCoexChrImpl; private int mApBand = -1; private int mApChannelCnt = 0; private int mApChannelOptimizationCnt = 0; private int mCellBw = 0; private int mCellFreq = 0; private Context mContext; private HwWifiCHRService mHwWifiCHRService; private int mNrPriority = 0; private int mNrState = 0; private int mNrTxBlockTime = 0; private int mNrTxTotalTime = 0; private int mP2pChannelCnt = 0; private int mP2pChannelOptimizationCnt = 0; private int mWifiAct = 0; private int mWifiPriorSceneId = 0; private int mWifiPriorTime = 0; private int mWifiPriorTotalTime = 0; private HiCoexChrImpl(Context context) { this.mContext = context; this.mHwWifiCHRService = HwWifiCHRServiceImpl.getInstance(); } public static void createHiCoexChrImpl(Context context) { if (mHiCoexChrImpl == null) { mHiCoexChrImpl = new HiCoexChrImpl(context); } } public static HiCoexChrImpl getInstance() { return mHiCoexChrImpl; } public void setNrState(int nrState) { this.mNrState = nrState; } public void setNrPriority(int nrPriority) { this.mNrPriority = nrPriority; } public void setCellFreq(int cellFreq) { this.mCellFreq = cellFreq; } public void setCellBw(int cellBw) { this.mCellBw = cellBw; } public void setWifiAct(int wifiAct) { this.mWifiAct = wifiAct; } public void setWifiPriorSceneId(int wifiPriorSceneId) { this.mWifiPriorSceneId = wifiPriorSceneId; } public void setApBand(int apBand) { this.mApBand = apBand; } public void updateCoexPriority(int time, int priority, int wifiScene, boolean isNrNetwork) { HiCoexUtils.logD(TAG, "updateCoexPriority:" + time + ",priority:" + priority + ",wifiScene:" + wifiScene + ",isNrNetwork:" + isNrNetwork); boolean needUpload = true; if (priority == 1) { this.mNrTxTotalTime += time; this.mWifiPriorTotalTime += time; } else if (priority == 0) { this.mWifiPriorTime += time; this.mWifiPriorTotalTime += time; this.mWifiPriorSceneId = wifiScene; } else if (priority != 2) { needUpload = false; } else if (isNrNetwork) { this.mWifiPriorTotalTime += time; } else { needUpload = false; } if (needUpload && time > 1000) { uploadHiCoexStatisticChr(); } } public void updateApChannelOptimization(int apBand, boolean isOptimized) { int i = this.mApBand; if (i == apBand || i == -1) { HiCoexUtils.logD(TAG, "updateApChannelOptimization: band:" + apBand + ", isOptimized:" + isOptimized); this.mApChannelCnt = this.mApChannelCnt + 1; if (isOptimized) { this.mApChannelOptimizationCnt++; } uploadHiCoexStatisticChr(); } } public void updateP2pChannelOptimization(boolean isOptimized) { this.mP2pChannelCnt++; if (isOptimized) { this.mP2pChannelOptimizationCnt++; } uploadHiCoexStatisticChr(); } public void updateApChannelOptimizationCnt() { this.mApChannelOptimizationCnt++; } public void updateApChannelCnt() { this.mApChannelCnt++; } public void updateP2pChannelOptimizationCnt() { this.mP2pChannelOptimizationCnt++; } public void updateP2pChannelCnt() { this.mP2pChannelCnt++; } public void updateWifiPriorTime(int wifiPriorTime) { this.mWifiPriorTime += wifiPriorTime; } public void updateWifiPriorTotalTime(int nrTime) { this.mWifiPriorTotalTime += nrTime; } public void updateNrTxBlockTime(int blockTime) { this.mNrTxBlockTime += blockTime; } public void updateNrRxTotalTime(int txTotalTime) { this.mNrTxTotalTime += txTotalTime; } public void uploadHiCoexNrStateChr() { if (this.mHwWifiCHRService != null) { HiCoexUtils.logD(TAG, "upload HiCoex NR State CHR"); this.mHwWifiCHRService.uploadDFTEvent((int) EID_NR_STATE_INFO, buildHiCoexNrStateChrBundle()); resetNrStateParameters(); } } public void uploadHiCoexStatisticChr() { if (this.mHwWifiCHRService != null) { HiCoexUtils.logD(TAG, "upload HiCoex Statistic CHR"); this.mHwWifiCHRService.uploadDFTEvent((int) EID_NR_STATISTIC_INFO, buildHiCoexStatisticChrBundle()); resetStatisticParameters(); } } private void resetNrStateParameters() { this.mNrState = 0; this.mNrPriority = 0; this.mCellFreq = 0; this.mCellBw = 0; this.mWifiAct = 0; } private void resetStatisticParameters() { this.mApChannelOptimizationCnt = 0; this.mApChannelCnt = 0; this.mP2pChannelOptimizationCnt = 0; this.mP2pChannelCnt = 0; this.mWifiPriorTime = 0; this.mWifiPriorTotalTime = 0; this.mWifiPriorSceneId = 0; this.mNrTxBlockTime = 0; this.mNrTxTotalTime = 0; } private Bundle buildHiCoexNrStateChrBundle() { Bundle data = new Bundle(); data.putInt("nrState", this.mNrState); data.putInt("nrPriority", this.mNrPriority); data.putInt("cellFreq", this.mCellFreq); data.putInt("cellBW", this.mCellBw); data.putInt("wifiAct", this.mWifiAct); return data; } private Bundle buildHiCoexStatisticChrBundle() { Bundle data = new Bundle(); data.putInt("apChanOpCnt", this.mApChannelOptimizationCnt); data.putInt("apChanCnt", this.mApChannelCnt); data.putInt("p2pChanOpCnt", this.mP2pChannelOptimizationCnt); data.putInt("p2pChanCnt", this.mP2pChannelCnt); data.putInt("wifiProrTime", this.mWifiPriorTime / 1000); data.putInt("wifiProrTotalTime", this.mWifiPriorTotalTime / 1000); data.putInt("wifiProrSce1", this.mWifiPriorSceneId); data.putInt("nrTxBlockTime", this.mNrTxBlockTime / 1000); data.putInt("nrTxTotalTime", this.mNrTxTotalTime / 1000); return data; } }
fec80466f2a39e65f5c2ff103d21cbbaae113060
f1144a202eda18f693b5cb005d763b5ec2d45bb3
/br.com.agilbits.swt.extension/src/br/com/agilbits/swt/extension/zoom/FitToWidthZoom.java
77d2fc6784a7495ce1fb89c698ff7f2a60d3c935
[]
no_license
agilbits/eclipse_editor_widget
9d28f442587e38e14db27f43be957c3155895c2d
08c674a98a5da88517aecb08a23dd1e9d1ab2aa3
refs/heads/master
2016-09-01T22:12:40.669124
2011-10-28T03:32:44
2011-10-28T03:32:44
2,662,813
1
1
null
null
null
null
UTF-8
Java
false
false
812
java
package br.com.agilbits.swt.extension.zoom; import org.eclipse.swt.custom.ExtendedStyledText; public class FitToWidthZoom implements ZoomOption { public static final Float CODE = -2f; public double getScalingFactor(ExtendedStyledText styledText) { double fullWidth = styledText.getPageWidth() + 2 * ExtendedStyledText.EXTERNAL_PAGE_MARGIN; return styledText.getClientArea().width / fullWidth; } @Override public int hashCode() { return 13; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; return true; } public Float getZoomCode() { return CODE; } }
2c0836d489a697621e1ff085bd1f41b76b04d039
56cd784b8e6ddab76ea98a4946f609e9f5e8f720
/app/src/main/java/com/bingley/materialdesign/utils/newj/LogUtils.java
903e41bac99ee51852c8800250bb0ce9a70870f8
[]
no_license
bingely/materialDesign
02fbc701e6517e17c82e4acfec18a4ffc9fcac74
ff59c071b6f6d4c3fb8b3ceef45aad521b1fe83f
refs/heads/master
2021-01-13T14:40:07.248334
2017-06-21T09:32:58
2017-06-21T09:32:58
76,615,010
0
0
null
null
null
null
UTF-8
Java
false
false
18,878
java
package com.bingley.materialdesign.utils.newj; import android.os.Environment; import android.support.annotation.IntDef; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Formatter; import java.util.Locale; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.zip.DataFormatException; import java.util.zip.Deflater; import java.util.zip.Inflater; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; /** * <pre> * author: Blankj * blog : http://blankj.com * time : 2016/09/21 * desc : Log相关工具类 * </pre> */ public final class LogUtils { public static final int V = Log.VERBOSE; public static final int D = Log.DEBUG; public static final int I = Log.INFO; public static final int W = Log.WARN; public static final int E = Log.ERROR; public static final int A = Log.ASSERT; @IntDef({V, D, I, W, E, A}) @Retention(RetentionPolicy.SOURCE) private @interface TYPE { } private static final char[] T = new char[]{'V', 'D', 'I', 'W', 'E', 'A'}; private static final int FILE = 0x10; private static final int JSON = 0x20; private static final int XML = 0x30; private static ExecutorService executor; private static String defaultDir;// log默认存储目录 private static String dir; // log存储目录 private static boolean sLogSwitch = true; // log总开关,默认开 private static boolean sLog2ConsoleSwitch = true; // logcat是否打印,默认打印 private static String sGlobalTag = null; // log标签 private static boolean sTagIsSpace = true; // log标签是否为空白 private static boolean sLogHeadSwitch = true; // log头部开关,默认开 private static boolean sLog2FileSwitch = false;// log写入文件开关,默认关 private static boolean sLogBorderSwitch = true; // log边框开关,默认开 private static int sConsoleFilter = V; // log控制台过滤器 private static int sFileFilter = V; // log文件过滤器 private static final String FILE_SEP = System.getProperty("file.separator"); private static final String LINE_SEP = System.getProperty("line.separator"); private static final String TOP_BORDER = "╔═══════════════════════════════════════════════════════════════════════════════════════════════════"; private static final String LEFT_BORDER = "║ "; private static final String BOTTOM_BORDER = "╚═══════════════════════════════════════════════════════════════════════════════════════════════════"; private static final int MAX_LEN = 4000; private static final Format FORMAT = new SimpleDateFormat("MM-dd HH:mm:ss.SSS ", Locale.getDefault()); private static final String NULL_TIPS = "Log with null object."; private static final String NULL = "null"; private static final String ARGS = "args"; private LogUtils() { throw new UnsupportedOperationException("u can't instantiate me..."); } public static class Builder { public Builder() { if (defaultDir != null) return; if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && Utils.getContext().getExternalCacheDir() != null) defaultDir = Utils.getContext().getExternalCacheDir() + FILE_SEP + "log" + FILE_SEP; else { defaultDir = Utils.getContext().getCacheDir() + FILE_SEP + "log" + FILE_SEP; } } public Builder setLogSwitch(boolean logSwitch) { LogUtils.sLogSwitch = logSwitch; return this; } public Builder setConsoleSwitch(boolean consoleSwitch) { LogUtils.sLog2ConsoleSwitch = consoleSwitch; return this; } public Builder setGlobalTag(final String tag) { if (isSpace(tag)) { LogUtils.sGlobalTag = ""; sTagIsSpace = true; } else { LogUtils.sGlobalTag = tag; sTagIsSpace = false; } return this; } public Builder setLogHeadSwitch(boolean logHeadSwitch) { LogUtils.sLogHeadSwitch = logHeadSwitch; return this; } public Builder setLog2FileSwitch(boolean log2FileSwitch) { LogUtils.sLog2FileSwitch = log2FileSwitch; return this; } public Builder setDir(final String dir) { if (isSpace(dir)) { LogUtils.dir = null; } else { LogUtils.dir = dir.endsWith(FILE_SEP) ? dir : dir + FILE_SEP; } return this; } public Builder setDir(final File dir) { LogUtils.dir = dir == null ? null : dir.getAbsolutePath() + FILE_SEP; return this; } public Builder setBorderSwitch(boolean borderSwitch) { LogUtils.sLogBorderSwitch = borderSwitch; return this; } public Builder setConsoleFilter(@TYPE int consoleFilter) { LogUtils.sConsoleFilter = consoleFilter; return this; } public Builder setFileFilter(@TYPE int fileFilter) { LogUtils.sFileFilter = fileFilter; return this; } @Override public String toString() { return "switch: " + sLogSwitch + LINE_SEP + "console: " + sLog2ConsoleSwitch + LINE_SEP + "tag: " + (sTagIsSpace ? "null" : sGlobalTag) + LINE_SEP + "head: " + sLogHeadSwitch + LINE_SEP + "file: " + sLog2FileSwitch + LINE_SEP + "dir: " + (dir == null ? defaultDir : dir) + LINE_SEP + "border: " + sLogBorderSwitch + LINE_SEP + "consoleFilter: " + T[sConsoleFilter - V] + LINE_SEP + "fileFilter: " + T[sFileFilter - V]; } } public static void v(Object contents) { log(V, sGlobalTag, contents); } public static void v(String tag, Object... contents) { log(V, tag, contents); } public static void d(Object contents) { log(D, sGlobalTag, contents); } public static void d(String tag, Object... contents) { log(D, tag, contents); } public static void i(Object contents) { log(I, sGlobalTag, contents); } public static void i(String tag, Object... contents) { log(I, tag, contents); } public static void w(Object contents) { log(W, sGlobalTag, contents); } public static void w(String tag, Object... contents) { log(W, tag, contents); } public static void e(Object contents) { log(E, sGlobalTag, contents); } public static void e(String tag, Object... contents) { log(E, tag, contents); } public static void a(Object contents) { log(A, sGlobalTag, contents); } public static void a(String tag, Object... contents) { log(A, tag, contents); } public static void file(Object contents) { log(FILE | D, sGlobalTag, contents); } public static void file(@TYPE int type, Object contents) { log(FILE | type, sGlobalTag, contents); } public static void file(String tag, Object contents) { log(FILE | D, tag, contents); } public static void file(@TYPE int type, String tag, Object contents) { log(FILE | type, tag, contents); } public static void json(String contents) { log(JSON | D, sGlobalTag, contents); } public static void json(@TYPE int type, String contents) { log(JSON | type, sGlobalTag, contents); } public static void json(String tag, String contents) { log(JSON | D, tag, contents); } public static void json(@TYPE int type, String tag, String contents) { log(JSON | type, tag, contents); } public static void xml(String contents) { log(XML | D, sGlobalTag, contents); } public static void xml(@TYPE int type, String contents) { log(XML | type, sGlobalTag, contents); } public static void xml(String tag, String contents) { log(XML | D, tag, contents); } public static void xml(@TYPE int type, String tag, String contents) { log(XML | type, tag, contents); } private static void log(final int type, String tag, final Object... contents) { if (!sLogSwitch || (!sLog2ConsoleSwitch && !sLog2FileSwitch)) return; int type_low = type & 0x0f, type_high = type & 0xf0; if (type_low < sConsoleFilter && type_low < sFileFilter) return; final String[] tagAndHead = processTagAndHead(tag); String body = processBody(type_high, contents); if (sLog2ConsoleSwitch && type_low >= sConsoleFilter) { print2Console(type_low, tagAndHead[0], tagAndHead[1] + body); } if (sLog2FileSwitch || type_high == FILE) { if (type_low >= sFileFilter) print2File(type_low, tagAndHead[0], tagAndHead[2] + body); } } private static String[] processTagAndHead(String tag) { if (!sTagIsSpace && !sLogHeadSwitch) { tag = sGlobalTag; } else { StackTraceElement targetElement = new Throwable().getStackTrace()[3]; String className = targetElement.getClassName(); String[] classNameInfo = className.split("\\."); if (classNameInfo.length > 0) { className = classNameInfo[classNameInfo.length - 1]; } if (className.contains("$")) { className = className.split("\\$")[0]; } if (sTagIsSpace) { tag = isSpace(tag) ? className : tag; } if (sLogHeadSwitch) { String head = new Formatter() .format("%s, %s(%s.java:%d)", Thread.currentThread().getName(), targetElement.getMethodName(), className, targetElement.getLineNumber()) .toString(); return new String[]{tag, head + LINE_SEP, " [" + head + "]: "}; } } return new String[]{tag, "", ": "}; } private static String processBody(int type, Object... contents) { String body = NULL_TIPS; if (contents != null) { if (contents.length == 1) { Object object = contents[0]; body = object == null ? NULL : object.toString(); if (type == JSON) { body = formatJson(body); } else if (type == XML) { body = formatXml(body); } } else { StringBuilder sb = new StringBuilder(); for (int i = 0, len = contents.length; i < len; ++i) { Object content = contents[i]; sb.append(ARGS) .append("[") .append(i) .append("]") .append(" = ") .append(content == null ? NULL : content.toString()) .append(LINE_SEP); } body = sb.toString(); } } return body; } private static String formatJson(String json) { try { if (json.startsWith("{")) { json = new JSONObject(json).toString(4); } else if (json.startsWith("[")) { json = new JSONArray(json).toString(4); } } catch (JSONException e) { e.printStackTrace(); } return json; } private static String formatXml(String xml) { try { Source xmlInput = new StreamSource(new StringReader(xml)); StreamResult xmlOutput = new StreamResult(new StringWriter()); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.transform(xmlInput, xmlOutput); xml = xmlOutput.getWriter().toString().replaceFirst(">", ">" + LINE_SEP); } catch (Exception e) { e.printStackTrace(); } return xml; } private static void print2Console(final int type, String tag, String msg) { if (sLogBorderSwitch) { print(type, tag, TOP_BORDER); msg = addLeftBorder(msg); } int len = msg.length(); int countOfSub = len / MAX_LEN; if (countOfSub > 0) { print(type, tag, msg.substring(0, MAX_LEN)); String sub; int index = MAX_LEN; for (int i = 1; i < countOfSub; i++) { sub = msg.substring(index, index + MAX_LEN); print(type, tag, sLogBorderSwitch ? LEFT_BORDER + sub : sub); index += MAX_LEN; } sub = msg.substring(index, len); print(type, tag, sLogBorderSwitch ? LEFT_BORDER + sub : sub); } else { print(type, tag, msg); } if (sLogBorderSwitch) print(type, tag, BOTTOM_BORDER); } private static void print(final int type, final String tag, String msg) { Log.println(type, tag, msg); } private static String addLeftBorder(String msg) { if (!sLogBorderSwitch) return msg; StringBuilder sb = new StringBuilder(); String[] lines = msg.split(LINE_SEP); for (String line : lines) { sb.append(LEFT_BORDER).append(line).append(LINE_SEP); } return sb.toString(); } private static void print2File(final int type, final String tag, final String msg) { Date now = new Date(System.currentTimeMillis()); String format = FORMAT.format(now); String date = format.substring(0, 5); String time = format.substring(6); final String fullPath = (dir == null ? defaultDir : dir) + date + ".txt"; if (!createOrExistsFile(fullPath)) { Log.e(tag, "log to " + fullPath + " failed!"); return; } StringBuilder sb = new StringBuilder(); sb.append(time) .append(T[type - V]) .append("/") .append(tag) .append(msg) .append(LINE_SEP); final String content = sb.toString(); if (executor == null) { executor = Executors.newSingleThreadExecutor(); } executor.execute(new Runnable() { @Override public void run() { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(fullPath, true)); bw.write(content); Log.d(tag, "log to " + fullPath + " success!"); } catch (IOException e) { e.printStackTrace(); Log.e(tag, "log to " + fullPath + " failed!"); } finally { try { if (bw != null) { bw.close(); } } catch (IOException e) { e.printStackTrace(); } } } }); } private static boolean createOrExistsFile(String filePath) { File file = new File(filePath); if (file.exists()) return file.isFile(); if (!createOrExistsDir(file.getParentFile())) return false; try { return file.createNewFile(); } catch (IOException e) { e.printStackTrace(); return false; } } private static boolean createOrExistsDir(File file) { return file != null && (file.exists() ? file.isDirectory() : file.mkdirs()); } private static boolean isSpace(String s) { if (s == null) return true; for (int i = 0, len = s.length(); i < len; ++i) { if (!Character.isWhitespace(s.charAt(i))) { return false; } } return true; } public static byte[] compress(byte input[]) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Deflater compressor = new Deflater(1); try { compressor.setInput(input); compressor.finish(); final byte[] buf = new byte[2048]; while (!compressor.finished()) { int count = compressor.deflate(buf); bos.write(buf, 0, count); } } finally { compressor.end(); } return bos.toByteArray(); } public static byte[] uncompress(byte[] input) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Inflater decompressor = new Inflater(); try { decompressor.setInput(input); final byte[] buf = new byte[2048]; while (!decompressor.finished()) { int count = 0; try { count = decompressor.inflate(buf); } catch (DataFormatException e) { e.printStackTrace(); } bos.write(buf, 0, count); } } finally { decompressor.end(); } return bos.toByteArray(); } }
88afe512ed19aa4cf4d0f65e152c0c34ac8e5718
790d1435fdb9de7b1b728a2dd5677d96fa3a2df9
/src/ver05/MenuItem.java
23ded28535fc365f42077d836fdd9d3452e65492
[]
no_license
Dukere/JavaProj01
ac0f427dc337a00e3ab7d41a0cd105537d7f392f
892783e56e4adf7aa5979f0166133b8065c9f2be
refs/heads/master
2022-04-11T07:58:36.664337
2020-03-30T09:42:09
2020-03-30T09:42:09
250,215,911
0
0
null
null
null
null
UTF-8
Java
false
false
117
java
package ver05; interface MenuItem { String INPUT = "1", SEARCH = "2", DELETE = "3", SHOW = "4", EXIT = "5"; }
[ "Kosmo_21@DESKTOP-KULH7LN" ]
Kosmo_21@DESKTOP-KULH7LN
ff1e03d90d244772a76cd70cb371ef108b94e538
ef55582db965dd6bd6c5862d4705f345a6059046
/demo/ExtJsWebBase/src/main/java/cn/tj/baseextweb/fw/interceptor/CheckUserSessionState.java
0404ca7b23313f281972e740f24f584159fa2ff7
[]
no_license
xinghen91/demo
d6a75a56674ddd7f877299d4b3a0ce862f8c0c69
1ca5f7196423b7957b505dfd5573b37173379aa8
refs/heads/master
2021-05-29T09:28:19.814211
2015-08-13T06:29:48
2015-08-13T06:30:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package cn.tj.baseextweb.fw.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; public class CheckUserSessionState extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // String path = request.getServletPath(); // if (path.matches(Const.INTERCEPTOR_PATH) && !path.matches(Const.NO_INTERCEPTOR_PATH)) { // // HttpSession session = request.getSession(); // User user = (User) session.getAttribute(Const.USER_KEY); // if (user != null) { // return true; // } else { // response.sendRedirect(request.getContextPath() + "/timeout.jsp"); // return false; // } // } else { return true; // } } }
[ "Administrator@PC-20141215FBVZ" ]
Administrator@PC-20141215FBVZ
cbb547abc7b32cb4265013a594333ee454ad4ad9
b5355ca5426f1eb1c6a3eb7eee71eb9e21c65943
/app/src/main/java/com/example/android/bakingapp/ui/RecipeIngredientListAdapter.java
f37b4e62d1c87c9309fe919291e6dc99ddb48551
[]
no_license
Teldot/BakingApp
f831acf6b871dc7c265a24bb0320b076c23219d7
252bf1845459724fa880c713e90d23c00e6158fb
refs/heads/master
2021-05-08T15:48:58.696981
2018-03-19T03:39:22
2018-03-19T03:39:22
120,127,078
0
0
null
null
null
null
UTF-8
Java
false
false
2,546
java
package com.example.android.bakingapp.ui; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.example.android.bakingapp.R; import com.example.android.bakingapp.data.entities.Ingredient; /** * Created by Mauricio Torres * on 04/02/2018. */ public class RecipeIngredientListAdapter extends RecyclerView.Adapter<RecipeIngredientListAdapter.RecipeIngredientLisAdapterViewHolder> { private final Context mContext; private Ingredient[] ingredientsData; public RecipeIngredientListAdapter(Context context) { mContext = context; } @Override public RecipeIngredientLisAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(mContext); View view = inflater.inflate(R.layout.recipe_ingredient_list_item, parent, false); return new RecipeIngredientLisAdapterViewHolder(view); } @Override public void onBindViewHolder(RecipeIngredientLisAdapterViewHolder holder, int position) { if (getIngredientsData() == null) return; Ingredient ingredient = getIngredientsData()[position]; holder.tv_ingred_name.setText(ingredient.Ingredient); holder.tv_ingred_qty.setText(String.valueOf(ingredient.Quantity)); holder.tv_ingred_measure.setText(ingredient.Measure); } @Override public int getItemCount() { if (ingredientsData == null) return 0; else return ingredientsData.length; } private Ingredient[] getIngredientsData() { return ingredientsData; } public void swapData(Ingredient[] ingredients) { if (ingredients == null || ingredients.length == 0) { ingredientsData = null; this.notifyDataSetChanged(); return; } ingredientsData = ingredients; this.notifyDataSetChanged(); } public class RecipeIngredientLisAdapterViewHolder extends RecyclerView.ViewHolder { public final TextView tv_ingred_name, tv_ingred_qty, tv_ingred_measure; public RecipeIngredientLisAdapterViewHolder(View itemView) { super(itemView); tv_ingred_name = itemView.findViewById(R.id.tv_ingredient_name); tv_ingred_qty = itemView.findViewById(R.id.tv_ingredient_qty); tv_ingred_measure = itemView.findViewById(R.id.tv_ingredient_measure); } } }
58e2278a748c7f3c3409dbbc5a8cc72e5642e1d5
70e56a2d9e76bebdfafe400b000c1ebf6b45a329
/app/src/main/java/com/example/binding/butterknife/ButterKnifeActivity.java
a3803b652e95a03c74a189698a1fc76d6876593d
[]
no_license
AntonioVitiello/DataBindingExample
0f7412272c3a781216330461a8a969b73422cb2f
0175902855c84aa81893fac8558eb74eea4e6a25
refs/heads/master
2021-05-02T03:28:16.418630
2018-04-02T18:28:27
2018-04-02T18:28:27
120,896,874
0
0
null
null
null
null
UTF-8
Java
false
false
1,751
java
package com.example.binding.butterknife; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.EditText; import com.example.binding.R; import com.example.binding.newschool.DataBindingActivity; import com.example.binding.newschool.Movie; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class ButterKnifeActivity extends AppCompatActivity { @BindView(R.id.et1) EditText et1; @BindView(R.id.et2) EditText et2; @BindView(R.id.et3) EditText et3; @BindView(R.id.et4) EditText et4; @BindView(R.id.et5) EditText et5; @BindView(R.id.et6) EditText et6; @BindView(R.id.et7) EditText et7; @BindView(R.id.et8) EditText et8; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_butter_knife); // ButterKnife INITIALIZATION! ButterKnife.bind(this); initializeView(); } private void initializeView(){ Movie movie = new Movie.Builder() .name("This is ButterKnifeActivity") .posterUrl("insert movie poster url") .posterUrl2("insert 2nd movie poster url") .trailerURL("insert movie trailer url") .build(); et1.setHint(movie.getName()); et2.setHint(movie.getPosterUrl()); et3.setHint(movie.getPosterUrl2()); et4.setHint(movie.getTrailerURL()); } @OnClick(R.id.startNewDataBinding) public void startNewDataBinding(View view) { Intent intent = new Intent(this, DataBindingActivity.class); startActivity(intent); } }
e74650f5c31d979fff7742dbc8383788b287375a
6fa9eda692cf4fe6d48f2d40600db59c20803577
/platform-db/src/main/java/com/softicar/platform/db/sql/expressions/numeric/ISqlDoubleExpression0.java
13777195e63c24abbdbd79e592180c6f80f62b70
[ "MIT" ]
permissive
softicar/platform
a5cbfcfe0e6097feae7f42d3058e716836c9f592
a6dad805156fc230a47eb7406959f29c59f2d1c2
refs/heads/main
2023-09-01T12:16:01.370646
2023-08-29T08:50:46
2023-08-29T08:50:46
408,834,598
4
2
MIT
2023-08-08T12:40:04
2021-09-21T13:38:04
Java
UTF-8
Java
false
false
11,666
java
package com.softicar.platform.db.sql.expressions.numeric; import com.softicar.platform.db.sql.expressions.ISqlExpression; import com.softicar.platform.db.sql.expressions.ISqlExpression0; import com.softicar.platform.db.sql.expressions.ISqlExpression1; import com.softicar.platform.db.sql.expressions.ISqlExpression2; import com.softicar.platform.db.sql.expressions.ISqlExpression3; import com.softicar.platform.db.sql.expressions.ISqlExpression4; import com.softicar.platform.db.sql.expressions.bool.ISqlBooleanExpression0; import com.softicar.platform.db.sql.expressions.bool.ISqlBooleanExpression1; import com.softicar.platform.db.sql.expressions.bool.ISqlBooleanExpression2; import com.softicar.platform.db.sql.expressions.bool.ISqlBooleanExpression3; import com.softicar.platform.db.sql.expressions.bool.ISqlBooleanExpression4; import com.softicar.platform.db.sql.expressions.bool.SqlBooleanExpression1; import com.softicar.platform.db.sql.expressions.bool.SqlBooleanExpression2; import com.softicar.platform.db.sql.expressions.bool.SqlBooleanExpression3; import com.softicar.platform.db.sql.expressions.bool.SqlBooleanExpression4; import com.softicar.platform.db.sql.expressions.string.ISqlStringExpression0; import com.softicar.platform.db.sql.expressions.string.SqlStringExpression0; import com.softicar.platform.db.sql.operations.SqlOperations; import com.softicar.platform.db.sql.type.SqlValueTypes; public interface ISqlDoubleExpression0 extends ISqlExpression0<Double>, ISqlDoubleExpression<ISqlDoubleExpression0, ISqlBooleanExpression0, ISqlLongExpression0> { @Override default ISqlDoubleExpression0 wrap(ISqlExpression<Double> expression) { return new SqlDoubleExpression0(expression); } @Override default ISqlLongExpression0 wrapLong(ISqlExpression<Long> expression) { return new SqlLongExpression0(expression); } // -------------------------------- CASTS -------------------------------- // default ISqlStringExpression0 castToString() { return new SqlStringExpression0(SqlOperations.CAST_CHAR.create(SqlValueTypes.STRING, this)); } default ISqlFloatExpression0 castToFloat() { return new SqlFloatExpression0(SqlOperations.NOP.create(SqlValueTypes.FLOAT, this)); } default ISqlBigDecimalExpression0 castToBigDecimal() { return new SqlBigDecimalExpression0(SqlOperations.NOP.create(SqlValueTypes.BIG_DECIMAL, this)); } // -------------------------------- OPERATIONS 1 -------------------------------- // default <S0> ISqlBooleanExpression1<S0> isEqual(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlBooleanExpression1<S0> isNotEqual(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_NOT_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlBooleanExpression1<S0> isLess(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_LESS.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlBooleanExpression1<S0> isLessEqual(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_LESS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlBooleanExpression1<S0> isGreater(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_GREATER.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlBooleanExpression1<S0> isGreaterEqual(ISqlExpression1<Double, S0> other) { return new SqlBooleanExpression1<>(SqlOperations.IS_GREATER_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0> ISqlDoubleExpression1<S0> plus(ISqlExpression1<Double, S0> other) { return new SqlDoubleExpression1<>(SqlOperations.PLUS.create(this, other)); } default <S0> ISqlDoubleExpression1<S0> minus(ISqlExpression1<Double, S0> other) { return new SqlDoubleExpression1<>(SqlOperations.MINUS.create(this, other)); } default <S0> ISqlDoubleExpression1<S0> times(ISqlExpression1<Double, S0> other) { return new SqlDoubleExpression1<>(SqlOperations.TIMES.create(this, other)); } default <S0> ISqlDoubleExpression1<S0> modulo(ISqlExpression1<Double, S0> other) { return new SqlDoubleExpression1<>(SqlOperations.MODULO.create(this, other)); } default <S0> ISqlDoubleExpression1<S0> divided(ISqlExpression1<Double, S0> other) { return new SqlDoubleExpression1<>(SqlOperations.DECIMAL_DIVIDED.create(this, other)); } // -------------------------------- OPERATIONS 2 -------------------------------- // default <S0, S1> ISqlBooleanExpression2<S0, S1> isEqual(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlBooleanExpression2<S0, S1> isNotEqual(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_NOT_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlBooleanExpression2<S0, S1> isLess(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_LESS.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlBooleanExpression2<S0, S1> isLessEqual(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_LESS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlBooleanExpression2<S0, S1> isGreater(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_GREATER.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlBooleanExpression2<S0, S1> isGreaterEqual(ISqlExpression2<Double, S0, S1> other) { return new SqlBooleanExpression2<>(SqlOperations.IS_GREATER_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1> ISqlDoubleExpression2<S0, S1> plus(ISqlExpression2<Double, S0, S1> other) { return new SqlDoubleExpression2<>(SqlOperations.PLUS.create(this, other)); } default <S0, S1> ISqlDoubleExpression2<S0, S1> minus(ISqlExpression2<Double, S0, S1> other) { return new SqlDoubleExpression2<>(SqlOperations.MINUS.create(this, other)); } default <S0, S1> ISqlDoubleExpression2<S0, S1> times(ISqlExpression2<Double, S0, S1> other) { return new SqlDoubleExpression2<>(SqlOperations.TIMES.create(this, other)); } default <S0, S1> ISqlDoubleExpression2<S0, S1> modulo(ISqlExpression2<Double, S0, S1> other) { return new SqlDoubleExpression2<>(SqlOperations.MODULO.create(this, other)); } default <S0, S1> ISqlDoubleExpression2<S0, S1> divided(ISqlExpression2<Double, S0, S1> other) { return new SqlDoubleExpression2<>(SqlOperations.DECIMAL_DIVIDED.create(this, other)); } // -------------------------------- OPERATIONS 3 -------------------------------- // default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isEqual(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isNotEqual(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_NOT_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isLess(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_LESS.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isLessEqual(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_LESS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isGreater(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_GREATER.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlBooleanExpression3<S0, S1, S2> isGreaterEqual(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlBooleanExpression3<>(SqlOperations.IS_GREATER_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2> ISqlDoubleExpression3<S0, S1, S2> plus(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlDoubleExpression3<>(SqlOperations.PLUS.create(this, other)); } default <S0, S1, S2> ISqlDoubleExpression3<S0, S1, S2> minus(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlDoubleExpression3<>(SqlOperations.MINUS.create(this, other)); } default <S0, S1, S2> ISqlDoubleExpression3<S0, S1, S2> times(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlDoubleExpression3<>(SqlOperations.TIMES.create(this, other)); } default <S0, S1, S2> ISqlDoubleExpression3<S0, S1, S2> modulo(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlDoubleExpression3<>(SqlOperations.MODULO.create(this, other)); } default <S0, S1, S2> ISqlDoubleExpression3<S0, S1, S2> divided(ISqlExpression3<Double, S0, S1, S2> other) { return new SqlDoubleExpression3<>(SqlOperations.DECIMAL_DIVIDED.create(this, other)); } // -------------------------------- OPERATIONS 4 -------------------------------- // default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isEqual(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isNotEqual(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_NOT_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isLess(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_LESS.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isLessEqual(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_LESS_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isGreater(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_GREATER.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlBooleanExpression4<S0, S1, S2, S3> isGreaterEqual(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlBooleanExpression4<>(SqlOperations.IS_GREATER_EQUAL.create(SqlValueTypes.BOOLEAN, this, other)); } default <S0, S1, S2, S3> ISqlDoubleExpression4<S0, S1, S2, S3> plus(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlDoubleExpression4<>(SqlOperations.PLUS.create(this, other)); } default <S0, S1, S2, S3> ISqlDoubleExpression4<S0, S1, S2, S3> minus(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlDoubleExpression4<>(SqlOperations.MINUS.create(this, other)); } default <S0, S1, S2, S3> ISqlDoubleExpression4<S0, S1, S2, S3> times(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlDoubleExpression4<>(SqlOperations.TIMES.create(this, other)); } default <S0, S1, S2, S3> ISqlDoubleExpression4<S0, S1, S2, S3> modulo(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlDoubleExpression4<>(SqlOperations.MODULO.create(this, other)); } default <S0, S1, S2, S3> ISqlDoubleExpression4<S0, S1, S2, S3> divided(ISqlExpression4<Double, S0, S1, S2, S3> other) { return new SqlDoubleExpression4<>(SqlOperations.DECIMAL_DIVIDED.create(this, other)); } }
be2767f716072a931d1fa3e87eec0e1a63cce2e5
6bb18a7945eb2b4a7f83ebc291bcf6d39c279737
/java-training/lessons/projects/stages-0/user-platform/user-web/src/main/java/com/jizhi/geektime/function/ThrowableFunction.java
eb069d679e40dbb917a713bb02fec155a6e28aef
[]
no_license
liveForExperience/geektime-java-traning
62e79db9e1d0557f7317f8a8b3034d915c83e034
2e2200e940f388ac487ff19724f8a3dee2928b2b
refs/heads/master
2023-03-18T14:21:44.446260
2021-03-10T00:27:14
2021-03-10T00:27:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.jizhi.geektime.function; /** * 能抛出异常的函数接口 * @author jizhi7 * @since 1.0 **/ @FunctionalInterface public interface ThrowableFunction<T, R> { /** * 该函数,消费参数,返回数据 * @param t 进入函数的参数 * @return 函数返回的数据 * @throws Throwable 函数抛出的异常 */ R apply(T t) throws Throwable; }
bdc2930693673d2ef6e1a0d358af89d65f369d0c
f34f28f65152a55e45988a5903c18807c938c395
/back-spring/gate/src/main/java/com/gate/planner/gate/dao/course/CourseMemoRepository.java
030cbe93e3e00b619af309f659d1637a0898c73c
[]
no_license
sssu4gate/back-springboot
d8901038f3728361b49173b00eb05b65376adf39
919855532930574d7dd95a19bc1a51e1918b5721
refs/heads/master
2023-04-04T08:09:53.374625
2021-04-09T12:37:58
2021-04-09T12:37:58
293,478,763
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.gate.planner.gate.dao.course; import com.gate.planner.gate.model.entity.course.memo.CourseMemo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface CourseMemoRepository extends JpaRepository<CourseMemo, Long> { }
863a8ed7d82cd0fe422f3534ae82d009fb3f45aa
372453ffbe9eb42364abf84a95654b1e18695ff3
/microservice2/src/main/java/com/wiproevents/services/springdata/UserPreferenceSpecification.java
ad2563b47cf95c73e7aa5f1d142b0aa8e5a918ad
[]
no_license
kinfkong/tc-attendee
ac7c033003ee9cda81418e774ac8163b38695631
8986055cf932a26b1c66373da9f57707c91dd3fc
refs/heads/master
2021-05-01T22:01:00.376276
2018-02-18T04:12:35
2018-02-18T04:12:35
120,983,934
0
0
null
null
null
null
UTF-8
Java
false
false
738
java
package com.wiproevents.services.springdata; import com.microsoft.azure.spring.data.documentdb.core.query.Query; import com.wiproevents.entities.criteria.BaseSearchCriteria; import com.wiproevents.entities.UserPreference; import com.wiproevents.utils.springdata.extensions.DocumentDbSpecification; import lombok.AllArgsConstructor; import java.util.Map; /** * The specification used to query User by criteria. */ @AllArgsConstructor public class UserPreferenceSpecification implements DocumentDbSpecification<UserPreference> { /** * The criteria. Final. */ private final BaseSearchCriteria criteria; @Override public Query toQuery(Query query, Map<String, Object> values) { return query; } }
e3f03417e62a76473382b8199c50afaa2e181cfb
5957ec44eb2529d8fa7bef9c71577484d814181c
/android/support/v4/os/ResultReceiver.java
002eb55807c643c3882ff1ce0004e5ba721ef558
[]
no_license
icancode23/7teachers
78c0367dce6ddc44a0e4dc52dbb5d915f69d8ef8
59c57762eb6c40253b84866150405f083a4e6731
refs/heads/master
2021-09-03T02:08:58.562005
2018-01-04T19:35:43
2018-01-04T19:35:43
116,299,766
0
0
null
null
null
null
UTF-8
Java
false
false
2,927
java
package android.support.v4.os; import android.os.Bundle; import android.os.Handler; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import android.os.RemoteException; import android.support.annotation.RestrictTo; import android.support.annotation.RestrictTo.Scope; import android.support.v4.os.IResultReceiver.Stub; @RestrictTo({Scope.LIBRARY_GROUP}) public class ResultReceiver implements Parcelable { public static final Creator<ResultReceiver> CREATOR = new C01121(); final Handler mHandler; final boolean mLocal; IResultReceiver mReceiver; static class C01121 implements Creator<ResultReceiver> { C01121() { } public ResultReceiver createFromParcel(Parcel in) { return new ResultReceiver(in); } public ResultReceiver[] newArray(int size) { return new ResultReceiver[size]; } } class MyRunnable implements Runnable { final int mResultCode; final Bundle mResultData; MyRunnable(int resultCode, Bundle resultData) { this.mResultCode = resultCode; this.mResultData = resultData; } public void run() { ResultReceiver.this.onReceiveResult(this.mResultCode, this.mResultData); } } class MyResultReceiver extends Stub { MyResultReceiver() { } public void send(int resultCode, Bundle resultData) { if (ResultReceiver.this.mHandler != null) { ResultReceiver.this.mHandler.post(new MyRunnable(resultCode, resultData)); } else { ResultReceiver.this.onReceiveResult(resultCode, resultData); } } } public ResultReceiver(Handler handler) { this.mLocal = true; this.mHandler = handler; } public void send(int resultCode, Bundle resultData) { if (this.mLocal) { if (this.mHandler != null) { this.mHandler.post(new MyRunnable(resultCode, resultData)); } else { onReceiveResult(resultCode, resultData); } } else if (this.mReceiver != null) { try { this.mReceiver.send(resultCode, resultData); } catch (RemoteException e) { } } } protected void onReceiveResult(int resultCode, Bundle resultData) { } public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { synchronized (this) { if (this.mReceiver == null) { this.mReceiver = new MyResultReceiver(); } out.writeStrongBinder(this.mReceiver.asBinder()); } } ResultReceiver(Parcel in) { this.mLocal = false; this.mHandler = null; this.mReceiver = Stub.asInterface(in.readStrongBinder()); } }
7725d1f8518d71702769a33a7d8f5686cd78577d
5c8b89691490ec7fc747ce2a11645e06f521625c
/benchmark_ui/src/main/java/com/zealp/benchmark_ui/module/me/iwf/photopicker/widget/TouchImageView.java
0a4f48febee9278bc6639a6cc7bca7945583936d
[]
no_license
ZealP/Android_BenchmarkUI
d08286bee1e743a6dd90502bcb9a7e9d74468b5e
096afd4a7a2f73a24b1f1451aea5850b5ade74b3
refs/heads/master
2021-07-20T00:37:47.372118
2021-07-15T09:17:15
2021-07-15T09:17:15
170,269,487
1
0
null
null
null
null
UTF-8
Java
false
false
42,844
java
/* * TouchImageView.java * By: Michael Ortiz * Updated By: Patrick Lackemacher * Updated By: Babay88 * Updated By: @ipsilondev * Updated By: hank-cp * Updated By: singpolyma * ------------------- * Extends Android ImageView to include pinch zooming, panning, fling and double tap zoom. */ package com.zealp.benchmark_ui.module.me.iwf.photopicker.widget; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.util.Log; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import android.view.animation.AccelerateDecelerateInterpolator; import android.widget.ImageView; import android.widget.OverScroller; import android.widget.Scroller; public class TouchImageView extends ImageView { private static final String DEBUG = "DEBUG"; // // SuperMin and SuperMax multipliers. Determine how much the image can be // zoomed below or above the zoom boundaries, before animating back to the // min/max zoom boundary. // private static final float SUPER_MIN_MULTIPLIER = .75f; private static final float SUPER_MAX_MULTIPLIER = 1.25f; // // Scale of image ranges from minScale to maxScale, where minScale == 1 // when the image is stretched to fit view. // private float normalizedScale; // // Matrix applied to image. MSCALE_X and MSCALE_Y should always be equal. // MTRANS_X and MTRANS_Y are the other values used. prevMatrix is the matrix // saved prior to the screen rotating. // private Matrix matrix, prevMatrix; private enum State {NONE, DRAG, ZOOM, FLING, ANIMATE_ZOOM} ; private State state; private float minScale; private float maxScale; private float superMinScale; private float superMaxScale; private float[] m; private Context context; private Fling fling; private ScaleType mScaleType; private boolean imageRenderedAtLeastOnce; private boolean onDrawReady; private ZoomVariables delayedZoomVariables; // // Size of view and previous view size (ie before rotation) // private int viewWidth, viewHeight, prevViewWidth, prevViewHeight; // // Size of image when it is stretched to fit view. Before and After rotation. // private float matchViewWidth, matchViewHeight, prevMatchViewWidth, prevMatchViewHeight; private ScaleGestureDetector mScaleDetector; private GestureDetector mGestureDetector; private GestureDetector.OnDoubleTapListener doubleTapListener = null; private OnTouchListener userTouchListener = null; private OnTouchImageViewListener touchImageViewListener = null; public TouchImageView(Context context) { super(context); sharedConstructing(context); } public TouchImageView(Context context, AttributeSet attrs) { super(context, attrs); sharedConstructing(context); } public TouchImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); sharedConstructing(context); } private void sharedConstructing(Context context) { super.setClickable(true); this.context = context; mScaleDetector = new ScaleGestureDetector(context, new ScaleListener()); mGestureDetector = new GestureDetector(context, new GestureListener()); matrix = new Matrix(); prevMatrix = new Matrix(); m = new float[9]; normalizedScale = 1; if (mScaleType == null) { mScaleType = ScaleType.FIT_CENTER; } minScale = 1; maxScale = 3; superMinScale = SUPER_MIN_MULTIPLIER * minScale; superMaxScale = SUPER_MAX_MULTIPLIER * maxScale; setImageMatrix(matrix); setScaleType(ScaleType.MATRIX); setState(State.NONE); onDrawReady = false; super.setOnTouchListener(new PrivateOnTouchListener()); } @Override public void setOnTouchListener(OnTouchListener l) { userTouchListener = l; } public void setOnTouchImageViewListener(OnTouchImageViewListener l) { touchImageViewListener = l; } public void setOnDoubleTapListener(GestureDetector.OnDoubleTapListener l) { doubleTapListener = l; } @Override public void setImageResource(int resId) { super.setImageResource(resId); savePreviousImageValues(); fitImageToView(); } @Override public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); savePreviousImageValues(); fitImageToView(); } @Override public void setImageDrawable(Drawable drawable) { super.setImageDrawable(drawable); savePreviousImageValues(); fitImageToView(); } @Override public void setImageURI(Uri uri) { super.setImageURI(uri); savePreviousImageValues(); fitImageToView(); } @Override public void setScaleType(ScaleType type) { if (type == ScaleType.FIT_START || type == ScaleType.FIT_END) { throw new UnsupportedOperationException( "TouchImageView does not support FIT_START or FIT_END"); } if (type == ScaleType.MATRIX) { super.setScaleType(ScaleType.MATRIX); } else { mScaleType = type; if (onDrawReady) { // // If the image is already rendered, scaleType has been called programmatically // and the TouchImageView should be updated with the new scaleType. // setZoom(this); } } } @Override public ScaleType getScaleType() { return mScaleType; } /** * Returns false if image is in initial, unzoomed state. False, otherwise. * * @return true if image is zoomed */ public boolean isZoomed() { return normalizedScale != 1; } /** * Return a Rect representing the zoomed image. * * @return rect representing zoomed image */ public RectF getZoomedRect() { if (mScaleType == ScaleType.FIT_XY) { throw new UnsupportedOperationException("getZoomedRect() not supported with FIT_XY"); } PointF topLeft = transformCoordTouchToBitmap(0, 0, true); PointF bottomRight = transformCoordTouchToBitmap(viewWidth, viewHeight, true); float w = getDrawable().getIntrinsicWidth(); float h = getDrawable().getIntrinsicHeight(); return new RectF(topLeft.x / w, topLeft.y / h, bottomRight.x / w, bottomRight.y / h); } /** * Save the current matrix and view dimensions * in the prevMatrix and prevView variables. */ private void savePreviousImageValues() { if (matrix != null && viewHeight != 0 && viewWidth != 0) { matrix.getValues(m); prevMatrix.setValues(m); prevMatchViewHeight = matchViewHeight; prevMatchViewWidth = matchViewWidth; prevViewHeight = viewHeight; prevViewWidth = viewWidth; } } @Override public Parcelable onSaveInstanceState() { Bundle bundle = new Bundle(); bundle.putParcelable("instanceState", super.onSaveInstanceState()); bundle.putFloat("saveScale", normalizedScale); bundle.putFloat("matchViewHeight", matchViewHeight); bundle.putFloat("matchViewWidth", matchViewWidth); bundle.putInt("viewWidth", viewWidth); bundle.putInt("viewHeight", viewHeight); matrix.getValues(m); bundle.putFloatArray("matrix", m); bundle.putBoolean("imageRendered", imageRenderedAtLeastOnce); return bundle; } @Override public void onRestoreInstanceState(Parcelable state) { if (state instanceof Bundle) { Bundle bundle = (Bundle) state; normalizedScale = bundle.getFloat("saveScale"); m = bundle.getFloatArray("matrix"); prevMatrix.setValues(m); prevMatchViewHeight = bundle.getFloat("matchViewHeight"); prevMatchViewWidth = bundle.getFloat("matchViewWidth"); prevViewHeight = bundle.getInt("viewHeight"); prevViewWidth = bundle.getInt("viewWidth"); imageRenderedAtLeastOnce = bundle.getBoolean("imageRendered"); super.onRestoreInstanceState(bundle.getParcelable("instanceState")); return; } super.onRestoreInstanceState(state); } @Override protected void onDraw(Canvas canvas) { onDrawReady = true; imageRenderedAtLeastOnce = true; if (delayedZoomVariables != null) { setZoom(delayedZoomVariables.scale, delayedZoomVariables.focusX, delayedZoomVariables.focusY, delayedZoomVariables.scaleType); delayedZoomVariables = null; } super.onDraw(canvas); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); savePreviousImageValues(); } /** * Get the max zoom multiplier. * * @return max zoom multiplier. */ public float getMaxZoom() { return maxScale; } /** * Set the max zoom multiplier. Default value: 3. * * @param max max zoom multiplier. */ public void setMaxZoom(float max) { maxScale = max; superMaxScale = SUPER_MAX_MULTIPLIER * maxScale; } /** * Get the min zoom multiplier. * * @return min zoom multiplier. */ public float getMinZoom() { return minScale; } /** * Get the current zoom. This is the zoom relative to the initial * scale, not the original resource. * * @return current zoom multiplier. */ public float getCurrentZoom() { return normalizedScale; } /** * Set the min zoom multiplier. Default value: 1. * * @param min min zoom multiplier. */ public void setMinZoom(float min) { minScale = min; superMinScale = SUPER_MIN_MULTIPLIER * minScale; } /** * Reset zoom and translation to initial state. */ public void resetZoom() { normalizedScale = 1; fitImageToView(); } /** * Set zoom to the specified scale. Image will be centered by default. */ public void setZoom(float scale) { setZoom(scale, 0.5f, 0.5f); } /** * Set zoom to the specified scale. Image will be centered around the point * (focusX, focusY). These floats range from 0 to 1 and denote the focus point * as a fraction from the left and top of the view. For example, the top left * corner of the image would be (0, 0). And the bottom right corner would be (1, 1). * * @param scale * @param focusX * @param focusY */ public void setZoom(float scale, float focusX, float focusY) { setZoom(scale, focusX, focusY, mScaleType); } /** * Set zoom to the specified scale. Image will be centered around the point * (focusX, focusY). These floats range from 0 to 1 and denote the focus point * as a fraction from the left and top of the view. For example, the top left * corner of the image would be (0, 0). And the bottom right corner would be (1, 1). * * @param scale * @param focusX * @param focusY * @param scaleType */ public void setZoom(float scale, float focusX, float focusY, ScaleType scaleType) { // // setZoom can be called before the image is on the screen, but at this point, // image and view sizes have not yet been calculated in onMeasure. Thus, we should // delay calling setZoom until the view has been measured. // if (!onDrawReady) { delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType); return; } if (scaleType != mScaleType) { setScaleType(scaleType); } resetZoom(); scaleImage(scale, viewWidth / 2, viewHeight / 2, true); matrix.getValues(m); m[Matrix.MTRANS_X] = -((focusX * getImageWidth()) - (viewWidth * 0.5f)); m[Matrix.MTRANS_Y] = -((focusY * getImageHeight()) - (viewHeight * 0.5f)); matrix.setValues(m); fixTrans(); setImageMatrix(matrix); } /** * Set zoom parameters equal to another TouchImageView. Including scale, position, * and ScaleType. * * @param img TouchImageView */ public void setZoom(TouchImageView img) { PointF center = img.getScrollPosition(); setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType()); } /** * Return the point at the center of the zoomed image. The PointF coordinates range * in value between 0 and 1 and the focus point is denoted as a fraction from the left * and top of the view. For example, the top left corner of the image would be (0, 0). * And the bottom right corner would be (1, 1). * * @return PointF representing the scroll position of the zoomed image. */ public PointF getScrollPosition() { Drawable drawable = getDrawable(); if (drawable == null) { return null; } int drawableWidth = drawable.getIntrinsicWidth(); int drawableHeight = drawable.getIntrinsicHeight(); PointF point = transformCoordTouchToBitmap(viewWidth / 2, viewHeight / 2, true); point.x /= drawableWidth; point.y /= drawableHeight; return point; } /** * Set the focus point of the zoomed image. The focus points are denoted as a fraction from the * left and top of the view. The focus points can range in value between 0 and 1. * * @param focusX X * @param focusY Y */ public void setScrollPosition(float focusX, float focusY) { setZoom(normalizedScale, focusX, focusY); } /** * Performs boundary checking and fixes the image matrix if it * is out of bounds. */ private void fixTrans() { matrix.getValues(m); float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; float fixTransX = getFixTrans(transX, viewWidth, getImageWidth()); float fixTransY = getFixTrans(transY, viewHeight, getImageHeight()); if (fixTransX != 0 || fixTransY != 0) { matrix.postTranslate(fixTransX, fixTransY); } } /** * When transitioning from zooming from focus to zoom from center (or vice versa) * the image can become unaligned within the view. This is apparent when zooming * quickly. When the content size is less than the view size, the content will often * be centered incorrectly within the view. fixScaleTrans first calls fixTrans() and * then makes sure the image is centered correctly within the view. */ private void fixScaleTrans() { fixTrans(); matrix.getValues(m); if (getImageWidth() < viewWidth) { m[Matrix.MTRANS_X] = (viewWidth - getImageWidth()) / 2; } if (getImageHeight() < viewHeight) { m[Matrix.MTRANS_Y] = (viewHeight - getImageHeight()) / 2; } matrix.setValues(m); } private float getFixTrans(float trans, float viewSize, float contentSize) { float minTrans, maxTrans; if (contentSize <= viewSize) { minTrans = 0; maxTrans = viewSize - contentSize; } else { minTrans = viewSize - contentSize; maxTrans = 0; } if (trans < minTrans) return -trans + minTrans; if (trans > maxTrans) return -trans + maxTrans; return 0; } private float getFixDragTrans(float delta, float viewSize, float contentSize) { if (contentSize <= viewSize) { return 0; } return delta; } private float getImageWidth() { return matchViewWidth * normalizedScale; } private float getImageHeight() { return matchViewHeight * normalizedScale; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { Drawable drawable = getDrawable(); if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) { setMeasuredDimension(0, 0); return; } int drawableWidth = drawable.getIntrinsicWidth(); int drawableHeight = drawable.getIntrinsicHeight(); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); viewWidth = setViewSize(widthMode, widthSize, drawableWidth); viewHeight = setViewSize(heightMode, heightSize, drawableHeight); // // Set view dimensions // setMeasuredDimension(viewWidth, viewHeight); // // Fit content within view // fitImageToView(); } /** * If the normalizedScale is equal to 1, then the image is made to fit the screen. Otherwise, * it is made to fit the screen according to the dimensions of the previous image matrix. This * allows the image to maintain its zoom after rotation. */ private void fitImageToView() { Drawable drawable = getDrawable(); if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) { return; } if (matrix == null || prevMatrix == null) { return; } int drawableWidth = drawable.getIntrinsicWidth(); int drawableHeight = drawable.getIntrinsicHeight(); // // Scale image for view // float scaleX = (float) viewWidth / drawableWidth; float scaleY = (float) viewHeight / drawableHeight; switch (mScaleType) { case CENTER: scaleX = scaleY = 1; break; case CENTER_CROP: scaleX = scaleY = Math.max(scaleX, scaleY); break; case CENTER_INSIDE: scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY)); case FIT_CENTER: scaleX = scaleY = Math.min(scaleX, scaleY); break; case FIT_XY: break; default: // // FIT_START and FIT_END not supported // throw new UnsupportedOperationException( "TouchImageView does not support FIT_START or FIT_END"); } // // Center the image // float redundantXSpace = viewWidth - (scaleX * drawableWidth); float redundantYSpace = viewHeight - (scaleY * drawableHeight); matchViewWidth = viewWidth - redundantXSpace; matchViewHeight = viewHeight - redundantYSpace; if (!isZoomed() && !imageRenderedAtLeastOnce) { // // Stretch and center image to fit view // matrix.setScale(scaleX, scaleY); matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2); normalizedScale = 1; } else { // // These values should never be 0 or we will set viewWidth and viewHeight // to NaN in translateMatrixAfterRotate. To avoid this, call savePreviousImageValues // to set them equal to the current values. // if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) { savePreviousImageValues(); } prevMatrix.getValues(m); // // Rescale Matrix after rotation // m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale; m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale; // // TransX and TransY from previous matrix // float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; // // Width // float prevActualWidth = prevMatchViewWidth * normalizedScale; float actualWidth = getImageWidth(); translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth); // // Height // float prevActualHeight = prevMatchViewHeight * normalizedScale; float actualHeight = getImageHeight(); translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight); // // Set the matrix to the adjusted scale and translate values. // matrix.setValues(m); } fixTrans(); setImageMatrix(matrix); } /** * Set view dimensions based on layout params */ private int setViewSize(int mode, int size, int drawableWidth) { int viewSize; switch (mode) { case MeasureSpec.EXACTLY: viewSize = size; break; case MeasureSpec.AT_MOST: viewSize = Math.min(drawableWidth, size); break; case MeasureSpec.UNSPECIFIED: viewSize = drawableWidth; break; default: viewSize = size; break; } return viewSize; } /** * After rotating, the matrix needs to be translated. This function finds the area of image * which was previously centered and adjusts translations so that is again the center, * post-rotation. * * @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y * @param trans the value of trans in that axis before the rotation * @param prevImageSize the width/height of the image before the rotation * @param imageSize width/height of the image after rotation * @param prevViewSize width/height of view before rotation * @param viewSize width/height of view after rotation * @param drawableSize width/height of drawable */ private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize, float imageSize, int prevViewSize, int viewSize, int drawableSize) { if (imageSize < viewSize) { // // The width/height of image is less than the view's width/height. Center it. // m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f; } else if (trans > 0) { // // The image is larger than the view, but was not before rotation. Center it. // m[axis] = -((imageSize - viewSize) * 0.5f); } else { // // Find the area of the image which was previously centered in the view. Determine its distance // from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage // to calculate the trans in the new view width/height. // float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize; m[axis] = -((percentage * imageSize) - (viewSize * 0.5f)); } } private void setState(State state) { this.state = state; } public boolean canScrollHorizontallyFroyo(int direction) { return canScrollHorizontally(direction); } @Override public boolean canScrollHorizontally(int direction) { matrix.getValues(m); float x = m[Matrix.MTRANS_X]; if (getImageWidth() < viewWidth) { return false; } else if (x >= -1 && direction < 0) { return false; } else if (Math.abs(x) + viewWidth + 1 >= getImageWidth() && direction > 0) { return false; } return true; } /** * Gesture Listener detects a single click or long click and passes that on * to the view's listener. * * @author Ortiz */ private class GestureListener extends GestureDetector.SimpleOnGestureListener { @Override public boolean onSingleTapConfirmed(MotionEvent e) { if (doubleTapListener != null) { return doubleTapListener.onSingleTapConfirmed(e); } return performClick(); } @Override public void onLongPress(MotionEvent e) { performLongClick(); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (fling != null) { // // If a previous fling is still active, it should be cancelled so that two flings // are not run simultaenously. // fling.cancelFling(); } fling = new Fling((int) velocityX, (int) velocityY); compatPostOnAnimation(fling); return super.onFling(e1, e2, velocityX, velocityY); } @Override public boolean onDoubleTap(MotionEvent e) { boolean consumed = false; if (doubleTapListener != null) { consumed = doubleTapListener.onDoubleTap(e); } if (state == State.NONE) { float targetZoom = (normalizedScale == minScale) ? maxScale : minScale; DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, e.getX(), e.getY(), false); compatPostOnAnimation(doubleTap); consumed = true; } return consumed; } @Override public boolean onDoubleTapEvent(MotionEvent e) { if (doubleTapListener != null) { return doubleTapListener.onDoubleTapEvent(e); } return false; } } public interface OnTouchImageViewListener { public void onMove(); } /** * Responsible for all touch events. Handles the heavy lifting of drag and also sends * touch events to Scale Detector and Gesture Detector. * * @author Ortiz */ private class PrivateOnTouchListener implements OnTouchListener { // // Remember last point position for dragging // private PointF last = new PointF(); @Override public boolean onTouch(View v, MotionEvent event) { mScaleDetector.onTouchEvent(event); mGestureDetector.onTouchEvent(event); PointF curr = new PointF(event.getX(), event.getY()); if (state == State.NONE || state == State.DRAG || state == State.FLING) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: last.set(curr); if (fling != null) fling.cancelFling(); setState(State.DRAG); break; case MotionEvent.ACTION_MOVE: if (state == State.DRAG) { float deltaX = curr.x - last.x; float deltaY = curr.y - last.y; float fixTransX = getFixDragTrans(deltaX, viewWidth, getImageWidth()); float fixTransY = getFixDragTrans(deltaY, viewHeight, getImageHeight()); matrix.postTranslate(fixTransX, fixTransY); fixTrans(); last.set(curr.x, curr.y); } break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: setState(State.NONE); break; } } setImageMatrix(matrix); // // User-defined OnTouchListener // if (userTouchListener != null) { userTouchListener.onTouch(v, event); } // // OnTouchImageViewListener is set: TouchImageView dragged by user. // if (touchImageViewListener != null) { touchImageViewListener.onMove(); } // // indicate event was handled // return true; } } /** * ScaleListener detects user two finger scaling and scales image. * * @author Ortiz */ private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { @Override public boolean onScaleBegin(ScaleGestureDetector detector) { setState(State.ZOOM); return true; } @Override public boolean onScale(ScaleGestureDetector detector) { scaleImage(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY(), true); // // OnTouchImageViewListener is set: TouchImageView pinch zoomed by user. // if (touchImageViewListener != null) { touchImageViewListener.onMove(); } return true; } @Override public void onScaleEnd(ScaleGestureDetector detector) { super.onScaleEnd(detector); setState(State.NONE); boolean animateToZoomBoundary = false; float targetZoom = normalizedScale; if (normalizedScale > maxScale) { targetZoom = maxScale; animateToZoomBoundary = true; } else if (normalizedScale < minScale) { targetZoom = minScale; animateToZoomBoundary = true; } if (animateToZoomBoundary) { DoubleTapZoom doubleTap = new DoubleTapZoom(targetZoom, viewWidth / 2, viewHeight / 2, true); compatPostOnAnimation(doubleTap); } } } private void scaleImage(double deltaScale, float focusX, float focusY, boolean stretchImageToSuper) { float lowerScale, upperScale; if (stretchImageToSuper) { lowerScale = superMinScale; upperScale = superMaxScale; } else { lowerScale = minScale; upperScale = maxScale; } float origScale = normalizedScale; normalizedScale *= deltaScale; if (normalizedScale > upperScale) { normalizedScale = upperScale; deltaScale = upperScale / origScale; } else if (normalizedScale < lowerScale) { normalizedScale = lowerScale; deltaScale = lowerScale / origScale; } matrix.postScale((float) deltaScale, (float) deltaScale, focusX, focusY); fixScaleTrans(); } /** * DoubleTapZoom calls a series of runnables which apply * an animated zoom in/out graphic to the image. * * @author Ortiz */ private class DoubleTapZoom implements Runnable { private long startTime; private static final float ZOOM_TIME = 500; private float startZoom, targetZoom; private float bitmapX, bitmapY; private boolean stretchImageToSuper; private AccelerateDecelerateInterpolator interpolator = new AccelerateDecelerateInterpolator(); private PointF startTouch; private PointF endTouch; DoubleTapZoom(float targetZoom, float focusX, float focusY, boolean stretchImageToSuper) { setState(State.ANIMATE_ZOOM); startTime = System.currentTimeMillis(); this.startZoom = normalizedScale; this.targetZoom = targetZoom; this.stretchImageToSuper = stretchImageToSuper; PointF bitmapPoint = transformCoordTouchToBitmap(focusX, focusY, false); this.bitmapX = bitmapPoint.x; this.bitmapY = bitmapPoint.y; // // Used for translating image during scaling // startTouch = transformCoordBitmapToTouch(bitmapX, bitmapY); endTouch = new PointF(viewWidth / 2, viewHeight / 2); } @Override public void run() { float t = interpolate(); double deltaScale = calculateDeltaScale(t); scaleImage(deltaScale, bitmapX, bitmapY, stretchImageToSuper); translateImageToCenterTouchPosition(t); fixScaleTrans(); setImageMatrix(matrix); // // OnTouchImageViewListener is set: double tap runnable updates listener // with every frame. // if (touchImageViewListener != null) { touchImageViewListener.onMove(); } if (t < 1f) { // // We haven't finished zooming // compatPostOnAnimation(this); } else { // // Finished zooming // setState(State.NONE); } } /** * Interpolate between where the image should start and end in order to translate * the image so that the point that is touched is what ends up centered at the end * of the zoom. */ private void translateImageToCenterTouchPosition(float t) { float targetX = startTouch.x + t * (endTouch.x - startTouch.x); float targetY = startTouch.y + t * (endTouch.y - startTouch.y); PointF curr = transformCoordBitmapToTouch(bitmapX, bitmapY); matrix.postTranslate(targetX - curr.x, targetY - curr.y); } /** * Use interpolator to get t */ private float interpolate() { long currTime = System.currentTimeMillis(); float elapsed = (currTime - startTime) / ZOOM_TIME; elapsed = Math.min(1f, elapsed); return interpolator.getInterpolation(elapsed); } /** * Interpolate the current targeted zoom and get the delta * from the current zoom. */ private double calculateDeltaScale(float t) { double zoom = startZoom + t * (targetZoom - startZoom); return zoom / normalizedScale; } } /** * This function will transform the coordinates in the touch event to the coordinate * system of the drawable that the imageview contain * * @param x x-coordinate of touch event * @param y y-coordinate of touch event * @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip * return value * to the bounds of the bitmap size. * @return Coordinates of the point touched, in the coordinate system of the original drawable. */ private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; float finalX = ((x - transX) * origW) / getImageWidth(); float finalY = ((y - transY) * origH) / getImageHeight(); if (clipToBitmap) { finalX = Math.min(Math.max(finalX, 0), origW); finalY = Math.min(Math.max(finalY, 0), origH); } return new PointF(finalX, finalY); } /** * Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the * drawable's coordinate system to the view's coordinate system. * * @param bx x-coordinate in original bitmap coordinate system * @param by y-coordinate in original bitmap coordinate system * @return Coordinates of the point in the view's coordinate system. */ private PointF transformCoordBitmapToTouch(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX, finalY); } /** * Fling launches sequential runnables which apply * the fling graphic to the image. The values for the translation * are interpolated by the Scroller. * * @author Ortiz */ private class Fling implements Runnable { CompatScroller scroller; int currX, currY; Fling(int velocityX, int velocityY) { setState(State.FLING); scroller = new CompatScroller(context); matrix.getValues(m); int startX = (int) m[Matrix.MTRANS_X]; int startY = (int) m[Matrix.MTRANS_Y]; int minX, maxX, minY, maxY; if (getImageWidth() > viewWidth) { minX = viewWidth - (int) getImageWidth(); maxX = 0; } else { minX = maxX = startX; } if (getImageHeight() > viewHeight) { minY = viewHeight - (int) getImageHeight(); maxY = 0; } else { minY = maxY = startY; } scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX, maxX, minY, maxY); currX = startX; currY = startY; } public void cancelFling() { if (scroller != null) { setState(State.NONE); scroller.forceFinished(true); } } @Override public void run() { // // OnTouchImageViewListener is set: TouchImageView listener has been flung by user. // Listener runnable updated with each frame of fling animation. // if (touchImageViewListener != null) { touchImageViewListener.onMove(); } if (scroller.isFinished()) { scroller = null; return; } if (scroller.computeScrollOffset()) { int newX = scroller.getCurrX(); int newY = scroller.getCurrY(); int transX = newX - currX; int transY = newY - currY; currX = newX; currY = newY; matrix.postTranslate(transX, transY); fixTrans(); setImageMatrix(matrix); compatPostOnAnimation(this); } } } @TargetApi(VERSION_CODES.GINGERBREAD) private class CompatScroller { Scroller scroller; OverScroller overScroller; boolean isPreGingerbread; public CompatScroller(Context context) { if (VERSION.SDK_INT < VERSION_CODES.GINGERBREAD) { isPreGingerbread = true; scroller = new Scroller(context); } else { isPreGingerbread = false; overScroller = new OverScroller(context); } } public void fling(int startX, int startY, int velocityX, int velocityY, int minX, int maxX, int minY, int maxY) { if (isPreGingerbread) { scroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY); } else { overScroller.fling(startX, startY, velocityX, velocityY, minX, maxX, minY, maxY); } } public void forceFinished(boolean finished) { if (isPreGingerbread) { scroller.forceFinished(finished); } else { overScroller.forceFinished(finished); } } public boolean isFinished() { if (isPreGingerbread) { return scroller.isFinished(); } else { return overScroller.isFinished(); } } public boolean computeScrollOffset() { if (isPreGingerbread) { return scroller.computeScrollOffset(); } else { overScroller.computeScrollOffset(); return overScroller.computeScrollOffset(); } } public int getCurrX() { if (isPreGingerbread) { return scroller.getCurrX(); } else { return overScroller.getCurrX(); } } public int getCurrY() { if (isPreGingerbread) { return scroller.getCurrY(); } else { return overScroller.getCurrY(); } } } @TargetApi(VERSION_CODES.JELLY_BEAN) private void compatPostOnAnimation(Runnable runnable) { if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) { postOnAnimation(runnable); } else { postDelayed(runnable, 1000 / 60); } } private class ZoomVariables { public float scale; public float focusX; public float focusY; public ScaleType scaleType; public ZoomVariables(float scale, float focusX, float focusY, ScaleType scaleType) { this.scale = scale; this.focusX = focusX; this.focusY = focusY; this.scaleType = scaleType; } } private void printMatrixInfo() { float[] n = new float[9]; matrix.getValues(n); Log.d(DEBUG, "Scale: " + n[Matrix.MSCALE_X] + " TransX: " + n[Matrix.MTRANS_X] + " TransY: " + n[Matrix.MTRANS_Y]); } }
1b0b0e38f9bc18d6732285d2499b68468bd2bc19
80419f33ff8c977032b514f65e09e9d3e6cdb6df
/src/main/java/co/cpl/service/impl/BussinessManagerImpl.java
f8f6c9503add8b8e92d0fe633b7229b78f967e62
[]
no_license
otonielmax/cpl-incidence-be-api
7a91dbdb0033c759504c93b9245db429b68da83d
d3b417e0d740b1b2ba33cb9d5a10f0634a987e63
refs/heads/master
2020-04-02T14:26:19.683296
2019-02-08T16:27:03
2019-02-08T16:27:03
154,524,621
0
0
null
null
null
null
UTF-8
Java
false
false
7,147
java
/****************************************************************** * * This code is for the Complaints service project. * * * © 2018, Complaints Management All rights reserved. * * ******************************************************************/ package co.cpl.service.impl; import co.cpl.data.IncidenceImageRepository; import co.cpl.domain.Incidence; import co.cpl.domain.IncidenceImage; import co.cpl.domain.Users; import co.cpl.dto.IncidenceDto; import co.cpl.dto.IncidenceImageDto; import co.cpl.dto.UsersDto; import co.cpl.service.BusinessManager; import co.cpl.data.IncidenceRepository; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; import java.util.LinkedList; import java.util.List; import java.util.Optional; /*** * Implementation for business manager module * * @author jmunoz * */ @Component public class BussinessManagerImpl implements BusinessManager{ //private IncidenceRepository IncidenceRepository; private static IncidenceRepository incidenceRepository; private static IncidenceImageRepository incidenceImageRepository; public BussinessManagerImpl() { incidenceRepository = new IncidenceRepository(); incidenceImageRepository = new IncidenceImageRepository(); } @Override public IncidenceDto findIncidenceById(String Id) { Optional<Incidence> users = incidenceRepository.findIncidenceById(Id); if (!users.isPresent()) {throw new HttpClientErrorException(HttpStatus.NOT_FOUND); } //TODO: Replace this code for mapper approach IncidenceDto response = new IncidenceDto(); response.setId(users.get().getId()); response.setTitle(users.get().getTitle()); response.setDescription(users.get().getDescription()); response.setDateDevice(users.get().getDate_device()); response.setDateUser(users.get().getDate_user()); response.setPlaca(users.get().getPlaca()); response.setStatus(users.get().getStatus()); response.setType(users.get().getType()); response.setCreateDate(users.get().getCreatedAt()); response.setUpdateDate(users.get().getUpdatedAt()); response.setDirectionGpsLat(users.get().getDirectionGpsLat()); response.setDirectionGpsLng(users.get().getDirectionGpsLng()); response.setDirectionUserLat(users.get().getDirectionUserLat()); response.setDirectionUserLng(users.get().getDirectionUserLng()); return response; } @Override public List<IncidenceDto> findIncidenceByIdUser(String id) { List<Incidence> users = incidenceRepository.findIncidenceByIdUser(id); List<IncidenceDto> response = new LinkedList<>(); if(users.isEmpty()) { return response; } for (Incidence user: users) { IncidenceDto userDto = new IncidenceDto(); userDto.setId(user.getId()); userDto.setTitle(user.getTitle()); userDto.setDescription(user.getDescription()); userDto.setPlaca(user.getPlaca()); userDto.setDateDevice(user.getDate_device()); userDto.setDateUser(user.getDate_user()); userDto.setDirectionGps(user.getDirection_gps()); userDto.setStatus(user.getStatus()); userDto.setType(user.getType()); userDto.setDirectionUser(user.getDirection_user()); userDto.setCreateDate(user.getCreatedAt()); userDto.setUpdateDate(user.getUpdatedAt()); userDto.setDirectionGpsLat(user.getDirectionGpsLat()); userDto.setDirectionGpsLng(user.getDirectionGpsLng()); userDto.setDirectionUserLat(user.getDirectionUserLat()); userDto.setDirectionUserLng(user.getDirectionUserLng()); response.add(userDto); } return response; } @Override public String getLastIdIncidence() { List<Incidence> users = incidenceRepository.getLastIdIncidence(); if(users.isEmpty()) { return null; } return users.get(0).getId(); } @Override public List<IncidenceDto> getIncidences(int limit, int offset) { List<Incidence> users = incidenceRepository.getIncidences(limit, offset); List<IncidenceDto> response = new LinkedList<>(); if(users.isEmpty()) { return response; } for (Incidence user: users) { IncidenceDto userDto = new IncidenceDto(); userDto.setId(user.getId()); userDto.setTitle(user.getTitle()); userDto.setDescription(user.getDescription()); userDto.setPlaca(user.getPlaca()); userDto.setDateDevice(user.getDate_device()); userDto.setDateUser(user.getDate_user()); userDto.setDirectionGps(user.getDirection_gps()); userDto.setStatus(user.getStatus()); userDto.setType(user.getType()); userDto.setDirectionUser(user.getDirection_user()); userDto.setCreateDate(user.getCreatedAt()); userDto.setUpdateDate(user.getUpdatedAt()); userDto.setDirectionGpsLat(user.getDirectionGpsLat()); userDto.setDirectionGpsLng(user.getDirectionGpsLng()); userDto.setDirectionUserLat(user.getDirectionUserLat()); userDto.setDirectionUserLng(user.getDirectionUserLng()); response.add(userDto); } return response; } @Override public Boolean createIncidence(IncidenceDto usersDto) { return incidenceRepository.createIncidence(usersDto); } @Override public Boolean createIncidenceImage(IncidenceImageDto dto) { return incidenceImageRepository.createIncidenceImage(dto); } @Override public List<IncidenceImageDto> getIncidencesImageByIdIncidence(String id) { List<IncidenceImage> users = incidenceImageRepository.getIncidenceImageByIdIncidence(id); List<IncidenceImageDto> response = new LinkedList<>(); if(users.isEmpty()) { return response; } for (IncidenceImage user: users) { IncidenceImageDto userDto = new IncidenceImageDto(); userDto.setId(user.getId()); userDto.setUrl(user.getUrl()); userDto.setUrlDisplay(user.getUrlDisplay()); userDto.setIdIncidence(user.getId_incidence()); userDto.setCreateDate(user.getCreatedAt()); userDto.setUpdateDate(user.getUpdatedAt()); response.add(userDto); } return response; } @Override public Boolean updateIncidence(IncidenceDto usersDto) { return incidenceRepository.updateIncicence(usersDto); } @Override public void deleteIncidence(String userId) { Optional<Incidence> currentUser = incidenceRepository.findIncidenceById(userId); if (!currentUser.isPresent()) { throw new HttpClientErrorException(HttpStatus.NOT_FOUND); } incidenceRepository.deleteIncidence(userId); } }
2b67fe979e6442398212164f0d51a57febe8a498
532a194cf436aa95fa785959bf832cd5d62ccaa5
/SchoolCalendarProject/SchoolCalendar/src/main/java/com/finalproject/schoolcalendar/activities/AddSubjectActivity.java
431c88ae3a281defc2397f6397c89231ac119658
[]
no_license
fanni-p/School-Calendar-Android
d715240240e29b192669b106b73546b7ce0a3d7f
2ce64dd2fcb3bd6f1c6f9cec91011bfd438caf0b
refs/heads/master
2016-09-06T02:48:11.453865
2013-11-17T19:42:29
2013-11-17T19:42:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,027
java
package com.finalproject.schoolcalendar.activities; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import com.finalproject.schoolcalendar.R; import com.finalproject.schoolcalendar.data.DataPersister; import com.finalproject.schoolcalendar.data.HttpResponseHelper; import com.finalproject.schoolcalendar.enums.ColorEnum; import com.finalproject.schoolcalendar.helpers.ColorConverter; import com.finalproject.schoolcalendar.helpers.SessionManager; import com.finalproject.schoolcalendar.models.SubjectModel; import java.util.HashMap; /** * Created by Fani on 11/17/13. */ public class AddSubjectActivity extends Activity { private static final String LAST_ACTIVITY = "LastActivity"; private Handler mHandler; private ColorEnum mColor; private String mTeacher; private String mSubjectName; private String mAccessToken; private int mCurrentSelection; private SubjectModel mSubjectModel; private HandlerThread mHandledThread; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_subject); this.mColor = null; this.mTeacher = null; this.mSubjectName = null; SessionManager sessionManager = new SessionManager(getApplicationContext()); HashMap<String, String> user = sessionManager.getUserDetails(); this.mAccessToken = user.get(SessionManager.KEY_ACCESSTOKEN); this.mHandledThread = new HandlerThread("AddSubjectServiceThread"); this.mHandledThread.start(); Looper looper = this.mHandledThread.getLooper(); if (looper != null) { this.mHandler = new Handler(looper); } this.setupCreateButton(); this.setupSpinner(); } @Override protected void onPause() { super.onPause(); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } @Override protected void onDestroy() { super.onDestroy(); this.mHandledThread.quit(); this.mHandledThread = null; } private void setupCreateButton() { Button loginButton = (Button) this.findViewById(R.id.add_subject_createbutton); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AddSubjectActivity.this.handleCreateButtonCommand(); } }); } private void setupSpinner() { final Spinner spinner = (Spinner) findViewById(R.id.add_subject_color_spinner); spinner.setAdapter(new ArrayAdapter<ColorEnum> (this, android.R.layout.simple_spinner_item, ColorEnum.values())); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (AddSubjectActivity.this.mCurrentSelection != position) { ColorEnum selection = (ColorEnum) spinner.getItemAtPosition(position); if (selection != null) { String convertedColor = ColorConverter.ParseColor(selection.name()); int color = Color.parseColor(convertedColor); spinner.setBackgroundColor(color); } AddSubjectActivity.this.mCurrentSelection = position; } } @Override public void onNothingSelected(AdapterView<?> parent) { return; } }); } private void handleCreateButtonCommand() { final String accessToken = this.mAccessToken; final SubjectModel subjectModel = this.createSubjectModel(); if (subjectModel != null) { this.mHandler.post(new Runnable() { @Override public void run() { HttpResponseHelper response = DataPersister.AddNewSubject(subjectModel, accessToken); AddSubjectActivity.this.handleAddSubjectResponse(response); } }); } } private void handleAddSubjectResponse(HttpResponseHelper response) { if (response.isStatusOk()) { Class<?> activityClass; SharedPreferences preferences = getSharedPreferences(LAST_ACTIVITY, MODE_PRIVATE); try { activityClass = Class.forName(preferences.getString(LAST_ACTIVITY, AllSubjectsActivity.class.getName())); } catch (ClassNotFoundException e) { activityClass = AllSubjectsActivity.class; } Intent intent = new Intent(this, activityClass); this.startActivity(intent); finish(); } } private SubjectModel createSubjectModel() { EditText subjectNameBox = (EditText) this.findViewById(R.id.add_subject_new_subjectname); EditText teacherBox = (EditText) this.findViewById(R.id.add_subject_new_teacher); Spinner colorBox = (Spinner) this.findViewById(R.id.add_subject_color_spinner); this.mSubjectName = subjectNameBox.getText().toString(); this.mTeacher = teacherBox.getText().toString(); this.mColor = (ColorEnum) colorBox.getSelectedItem(); String color = null; if (this.mColor != null) { color = this.mColor.name(); } if (this.mSubjectName != null) { this.mSubjectModel = new SubjectModel(this.mSubjectName, this.mTeacher, color); } return this.mSubjectModel; } }
3fc22c4427087c6d237fdbcc527ecafef8e5cafa
0e3898dbcb55563c96d11f93c06e8e2a3b8b545f
/Model/src/com/pq/tracs/model/dao/ContractGuaranteeViewImpl.java
6d3664fba4d92ff5e55c13fd3aefb3c961b77631
[]
no_license
AALIYAR/PQ-TRACS
a811913cbcbe015d85c48a76447d1e01186b2f27
79a98fcb21007675d7fb083ebf21d074990f40ff
refs/heads/master
2020-04-02T10:42:16.724392
2018-10-23T13:46:16
2018-10-23T13:46:16
154,350,815
0
0
null
null
null
null
UTF-8
Java
false
false
545
java
package com.pq.tracs.model.dao; // --------------------------------------------------------------------- // --- File generated by Oracle ADF Business Components Design Time. // --- Custom code may be added to this class. // --- Warning: Do not modify method signatures of generated methods. // --------------------------------------------------------------------- public class ContractGuaranteeViewImpl extends TracsView { /**This is the default constructor (do not remove) */ public ContractGuaranteeViewImpl() { } }
682554caa57d1e5ef9ab96cfb5dd00f32fc4e899
045996666aa740c66af6bd61c56400c41949729f
/board/src/main/java/me/minseok/board/domain/Board.java
0883d8d6cd9ddd64d406c381a5916a54aca706b8
[]
no_license
cms5380/board_comment_check
b953c27f95a59a19157cb83090ba8fe59c9f8c16
a6823e3c0cba467f38d39ecb9f83fc7489f742fc
refs/heads/main
2023-06-05T12:15:42.066177
2021-06-28T07:24:17
2021-06-28T07:24:17
355,918,913
0
0
null
null
null
null
UTF-8
Java
false
false
475
java
package me.minseok.board.domain; import lombok.Data; import java.time.LocalDateTime; @Data public class Board extends Common{ /** 번호 (PK) */ private Long id; /** 제목 */ private String title; /** 내용 */ private String content; /** 작성자 */ private String writer; /** 조회 수 */ private int viewCnt; /** 공지 여부 */ private Boolean noticeYn; /** 비밀 여부 */ private Boolean secretYn; }
175210db9d6963ea5f5badce9ba3984ad685787f
99d7cca239deefcbd24d308f407d25fdea9c5860
/src/main/java/Modelo/VentaDAO.java
d703b23a3d3df0b3050cd0cd9c84e4d3c9becb33
[]
no_license
napenar/SistemaDeVentas
563540c810f44f7cfd260044e4180d87deea4f45
62a54d83f276b3cfe8d477f76b82c9855b391dbe
refs/heads/master
2023-08-16T11:46:17.314702
2021-10-14T13:15:58
2021-10-14T13:15:58
416,044,328
0
0
null
null
null
null
UTF-8
Java
false
false
2,897
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Modelo; import config.Conexion; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; /** * * @author NORVEY */ public class VentaDAO { Connection con; Conexion cn = new Conexion(); PreparedStatement ps; ResultSet rs; int r; public String GenerarSerie() { String numeroserie = ""; String sql = "select max(idventas) from ventas"; try { con = cn.Conexion(); ps = con.prepareStatement(sql); rs = ps.executeQuery(); while (rs.next()) { numeroserie = rs.getString(1); } ps.close(); cn.getCon().close(); } catch (Exception e) { System.out.println("Error en VentaDAO generarserie " + e); } return numeroserie; } public String idVentas(){ String idventas = ""; String sql = "select max(idventas) from ventas"; try { con = cn.Conexion(); ps = con.prepareStatement(sql); rs = ps.executeQuery(); while (rs.next()) { idventas = rs.getString(1); } ps.close(); cn.getCon().close(); } catch (Exception e) { System.out.println("Error en VentaDAO idVentas " + e); } return idventas; } public int guardarVenta(Venta ve){ String sql = "insert into ventas(idcliente,idempleado,numeroserie,fechaventas,monto,estado) values(?,?,?,?,?,?)"; try { con = cn.Conexion(); ps = con.prepareStatement(sql); ps.setInt(1, ve.getIdcliente()); ps.setInt(2, ve.getIdempleado()); ps.setString(3, ve.getNumserie()); ps.setDate(4, Date.valueOf(ve.getFecha())); ps.setDouble(5, ve.getPrecio()); ps.setString(6, ve.getEstado()); r=ps.executeUpdate(); ps.close(); cn.getCon().close(); } catch (Exception e) { System.out.println("Error en VentaDAO guardarventa " + e); } return r; } public int guardarDetalventas(Venta venta){ String sql = "insert into detalle_ventas(idventas,idproducto,cantidad,precioventa) values(?,?,?,?)"; try { con=cn.Conexion(); ps=con.prepareStatement(sql); ps.setInt(1, venta.getId()); ps.setInt(2, venta.getIdproducto()); ps.setInt(3, venta.getCantidad()); ps.setDouble(4, venta.getPrecio()); r = ps.executeUpdate(); } catch (Exception e) { } return r; } }
ab15edffb25f7645eca3e267eb3ecce33c4e2b9e
3d3f24531a0bf7f181eb7a8e0f77d57c7a3c3dbe
/submission/project/ReceiverApp/java/edu/osu/urban_security/security_receiver_app/UsersAdapter.java
f41202c78a53b8ad1a2a28856e9872a0069ba05b
[]
no_license
NickSkiljan/UrbanSecurity
5d378486fb6af7eeeac59693d4b515de66dbcdff
7aa4b7d44dbe1884a044df9cf510fb34da245193
refs/heads/master
2021-04-27T12:26:30.441891
2018-04-20T01:35:31
2018-04-20T01:35:31
122,419,046
1
1
null
2018-04-11T03:38:37
2018-02-22T02:08:30
Java
UTF-8
Java
false
false
2,490
java
package edu.osu.urban_security.security_receiver_app; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; /** * Authors: Nick, Sunny, Maxwell * Adapter for our recycler view that allows us to populate the recycler view with decrypted * sos-user's personal information */ public class UsersAdapter extends ArrayAdapter<User> { public UsersAdapter(Context context, ArrayList<User> users) { super(context, 0, users); } @Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position User user = getItem(position); // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.activity_main, parent, false); } // Lookup view for data population TextView tvName = (TextView) convertView.findViewById(R.id.tvName); TextView tvLatitude = (TextView) convertView.findViewById(R.id.tvLatitude); TextView tvLongitude = (TextView) convertView.findViewById(R.id.tvLongitude); TextView tvAltitude = (TextView) convertView.findViewById(R.id.tvAltitude); AES aes = new AES(); String username = "default"; String latitude = "default"; String longitude = "default"; String altitude = "default"; try { SecretKey key = new SecretKeySpec(AES.AESSecretKeyInBytes, 0, AES.AESSecretKeyInBytes.length, "AES"); username = AES.decryptString(key, user.name); latitude = AES.decryptString(key, user.latitude); longitude = AES.decryptString(key, user.longitude); altitude = AES.decryptString(key, user.altitude); } catch (Exception e) { e.printStackTrace(); } // Populate the data into the template view using the data object tvName.setText(username); tvLatitude.setText("Lat: " + latitude); tvLongitude.setText("Long: " + longitude); tvAltitude.setText("Alt: " + altitude); // Return the completed view to render on screen return convertView; } }