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
8124a0d360dde6523de9b4fb6bf467693a92434a
33505182f07ca06be54c3400cc20fa9795e7a1df
/src/View/ViewBossSelection.java
550d7e2b769d9f3fd8146c6ff3f614ca68d92cf8
[]
no_license
Indigoblin/KhTale
a89d401d0e967e3d800f58649a5b5e5242495927
3adce8d91ceb664a41bdc75d43a2d74beded2fa4
refs/heads/master
2021-01-08T03:01:02.593731
2020-03-31T06:52:35
2020-03-31T06:52:35
241,892,707
0
0
null
null
null
null
UTF-8
Java
false
false
3,308
java
package View; import Controller.ControllerSelect; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Group; import Tools.Path; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.VBox; import javafx.scene.input.MouseEvent; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; public class ViewBossSelection { private ViewHandler vSelect; private Group root; private ImageView imgBoss; private VBox leftSide, splatBox, secondSide; private Text screenText, titleSplatoon, titlePasDispo; private Font fontScreenText; ViewBossSelection(ViewHandler vSelect, Group root){ this.vSelect = vSelect; this.root = root; // initialisation des écrans des boss imgBoss = initImage(); titleSplatoon = initTitleSplat(); titlePasDispo = initTitleEmpty(); imgBoss.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent hover) { imgBoss.setImage(new Image(Path.iconSplatoonH)); titleSplatoon.setFill(Color.YELLOW); } }); imgBoss.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent exitHover) { imgBoss.setImage(new Image(Path.iconSplatoonLv)); titleSplatoon.setFill(Color.WHITE); } }); splatBox = new VBox(imgBoss,titleSplatoon); splatBox.setAlignment(Pos.CENTER); splatBox.setSpacing(10); secondSide = new VBox(titlePasDispo); secondSide.setAlignment(Pos.CENTER); secondSide.setSpacing(10); leftSide = new VBox(splatBox,secondSide); leftSide.setAlignment(Pos.CENTER); leftSide.setPadding(new Insets(75, 20, 15, 150)); leftSide.setSpacing(150); } void initView(){ root.getChildren().clear(); root.getChildren().add(leftSide); } private Text titleBoss(String screenBoss, int size){ Text t = new Text(); t.setText(screenBoss); t.setFont(Font.font(size)); return t; } private Text initTitleSplat(){ screenText = new Text(); screenText = titleBoss("Callie & Marie",20); fontScreenText = Font.loadFont(getClass().getResourceAsStream(Path.monsterFriendFore), 20); screenText.setFont(fontScreenText); screenText.setFill(Color.WHITE); return screenText; } private Text initTitleEmpty(){ screenText = new Text(); screenText = titleBoss("Pas encore dispo",20); fontScreenText = Font.loadFont(getClass().getResourceAsStream(Path.monsterFriendFore), 20); screenText.setFont(fontScreenText); screenText.setFill(Color.WHITE); return screenText; } private ImageView initImage(){ ImageView img = new ImageView(Path.iconSplatoonLv); img.setFitHeight(175); img.setFitWidth(300); return img; } public ImageView getSplatLv(){ return imgBoss; } public void setEvents(ControllerSelect cs) { imgBoss.setOnMouseClicked(cs); } }
f0e211dd6eda3bd0bcdc8184136cda01f3bc935e
a4f97d4fbc8cd3a6a0040180b9f3d7d9e388ca24
/src/com/master/queue/Queue.java
e698a744c2568d652cce30ab87085aab8050c8ab
[]
no_license
LiuzhenDewdrop/TEST
ef256b932ba98e46ebf5ab47cd1a714fcce94f87
ff222f92c30f0428c4f027d2716d37854bd91bf6
refs/heads/master
2021-07-15T22:56:53.583424
2021-03-29T11:45:20
2021-03-29T11:45:20
93,704,728
0
0
null
null
null
null
UTF-8
Java
false
false
1,087
java
package com.master.queue; import lombok.Data; /** * @class: Queue * @description: * @author: L.zhen * @date: 2020/3/23 0:49 */ @Data public class Queue { private int size = 10; private int[] q = null; private int front, rear = 0; public Queue(int... size) { if (size != null) { this.size = size[0]; } this.q = new int[this.size]; } public void push(int a) { if ((rear +1) % size == front) { System.out.print("满了,size=" + size + ",front=" + front + ",rear=" + rear + ",queue="); print(); return; } q[rear++] = a; rear %= size; } public boolean empty() { return front == rear; } public int pop() { if (empty()) { System.out.println("empty"); return -1; } int a = q[front++]; front %= size; return a; } public void print() { if (front == rear) { System.out.println("[]"); } System.out.print("["); int start = front; do { if (front != start) { System.out.print(","); } System.out.print(q[start++]); start = start % size; } while (start != rear); System.out.println("]"); } }
7e118f19b082dfffbc10b77215c111a507bf1d66
f59f4e106a0a96a594a8f19038d1af88a4c76d00
/src/main/java/com/shopnow/service/impl/ProductServiceImpl.java
4b42c3fd5ac90ef4f2140bc6c2a930e60a422b9c
[]
no_license
satasy102/Shopnow
28fcb02ab7bc39f64852124117b552df2dbd6431
19c7783f74a6e65ea192e6efdbc8e38ad41a2765
refs/heads/master
2023-03-10T03:57:43.682337
2021-02-18T10:27:18
2021-02-18T10:27:18
331,506,087
0
0
null
null
null
null
UTF-8
Java
false
false
1,391
java
package com.shopnow.service.impl; import com.shopnow.model.Product; import com.shopnow.repository.ProductRepository; import com.shopnow.service.ProductService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.time.ZonedDateTime; import java.util.List; @Service public class ProductServiceImpl implements ProductService { @Autowired ProductRepository productRepository; @Override public List<Product> findAll() { return productRepository.findAll(); } @Override public Product save(Product object) { ZonedDateTime today = ZonedDateTime.now(); if(object.getId() == null) { object.setCreating_date(today); } else { Product product = findById(object.getId()); ZonedDateTime creating_date = product.getCreating_date(); object.setCreating_date(creating_date); } return productRepository.save(object); } @Override public boolean deleteById(Long id) { Product product=findById(id); if(product!=null){ product.setDeleted(true); productRepository.save(product); return true; } return false; } @Override public Product findById(Long id) { return productRepository.findById(id).orElse(null); } }
[ "@gmail" ]
@gmail
6cbae7345b3a0fe4e2d0a4ac992c6b3711ab7037
042ba809abe3d0daf84e512ab00f04aa1e163e99
/Amazon/230_KthSmallestBST.java
5056c50156d0b95818f2a45d70b59c2dba23132d
[]
no_license
Irene1028/Leetcode
98e7686b2812766048d02dd93fb6f5a0a1cfe1bb
3d8418379e8ffe8d0564c59f8e72f9d520819b2a
refs/heads/master
2020-06-20T22:05:47.260381
2020-01-05T21:38:30
2020-01-05T21:38:30
197,266,047
0
0
null
null
null
null
UTF-8
Java
false
false
1,618
java
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { public int kthSmallest(TreeNode root, int k) { // inorder traverse, return k th List<Integer> inorder = new ArrayList<>(); addInorder(root, inorder); if (inorder.size() == 0) { return 0; } return inorder.get(k-1); } private void addInorder(TreeNode root, List<Integer> inorder) { if (root == null) return; addInorder(root.left, inorder); inorder.add(root.val); addInorder(root.right, inorder); return; } } // Time O(n), n is nodes number, we traverse every node. // Space, O(n), n is size of inorder /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { int ans = Integer.MIN_VALUE; int count = 0; public int kthSmallest(TreeNode root, int k) { // inorder traverse, return k th addInorder(root, k); return ans; } private void addInorder(TreeNode root, int k) { if (root == null) return; if (ans != Integer.MIN_VALUE) return; addInorder(root.left, k); count++; if (count == k) { ans = root.val; } addInorder(root.right, k); return; } } // Time O(m), m is nodes that we reached, we do not traverse every node. // Space, O(m), n is time of recursion
b3e56098555ecf9dfa39c4e902548256d0a99c5d
1c63e06951421b5869720fb2f7763317d8272c04
/app/src/main/java/com/zjy/js/customdialog/zhy/bean/ImageFloder.java
4503bdf273d69db0dd39895f1e6e6148426a978d
[]
no_license
hub-zjy1024/CustomDialog2
0fd124f8384c56dbe6e5096eda66caa1a06981d4
f6aaadcb1ff7ecc9a39fc8d44adb0d238a8112ee
refs/heads/master
2020-07-21T06:03:22.965664
2020-01-18T12:47:34
2020-01-18T12:47:34
206,766,477
0
0
null
null
null
null
UTF-8
Java
false
false
833
java
package com.zjy.js.customdialog.zhy.bean; public class ImageFloder { /** * 图片的文件夹路径 */ private String dir; /** * 第一张图片的路径 */ private String firstImagePath; /** * 文件夹的名称 */ private String name; /** * 图片的数量 */ private int count; public String getDir() { return dir; } public void setDir(String dir) { this.dir = dir; int lastIndexOf = this.dir.lastIndexOf("/"); this.name = this.dir.substring(lastIndexOf); } public String getFirstImagePath() { return firstImagePath; } public void setFirstImagePath(String firstImagePath) { this.firstImagePath = firstImagePath; } public String getName() { return name; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
a853820530b64669b0e668b24cb1a66ef75c1813
7e12d82fefa60109cb47c03b6b1fde77c78d382e
/src/main/java/cn/enaium/foxbase/utils/Render2D.java
75b55fe6f45a395f61b25006ea374e1a836342b0
[ "MIT" ]
permissive
dqyzszs/FoxBase
80d9963b561bdcb747b4b17a12352ffc438b6d6e
4979a84d47cfcc1daf93a6ac3091a8c8a8b58976
refs/heads/master
2021-05-21T17:36:49.345060
2020-04-01T08:41:11
2020-04-01T08:41:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,386
java
package cn.enaium.foxbase.utils; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferRenderer; import net.minecraft.client.render.Tessellator; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.math.Matrix4f; import net.minecraft.client.util.math.Rotation3; import org.lwjgl.opengl.GL11; import java.awt.*; public class Render2D { public static int getScaledWidth() { return MinecraftClient.getInstance().getWindow().getScaledWidth(); } public static int getScaledHeight() { return MinecraftClient.getInstance().getWindow().getScaledHeight(); } public static void drawRect(int x1, int y1, int x2, int y2, int color) { DrawableHelper.fill(x1, y1, x2, y2, color); } public static void drawRect(double x1, double y1, double x2, double y2, int color) { fill(Rotation3.identity().getMatrix(), x1, y1, x2, y2, color); } public static void drawRectWH(int x, int y, int width, int height, int color) { DrawableHelper.fill(x, y, x + width, y + height, color); } public static void drawRectWH(double x, double y, double width, double height, int color) { fill(Rotation3.identity().getMatrix(), x, y, x + width, y + height, color); } public static void drawHorizontalLine(int i, int j, int k, int l) { if (j < i) { int m = i; i = j; j = m; } drawRect(i, k, j + 1, k + 1, l); } public static void drawVerticalLine(int i, int j, int k, int l) { if (k < j) { int m = j; j = k; k = m; } drawRect(i, j + 1, i + 1, k, l); } public static void fill(Matrix4f matrix4f, double x1, double y1, double x2, double y2, int color) { double j; if (x1 < x2) { j = x1; x1 = x2; x2 = j; } if (y1 < y2) { j = y1; y1 = y2; y2 = j; } float f = (float) (color >> 24 & 255) / 255.0F; float g = (float) (color >> 16 & 255) / 255.0F; float h = (float) (color >> 8 & 255) / 255.0F; float k = (float) (color & 255) / 255.0F; BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer(); RenderSystem.enableBlend(); RenderSystem.disableTexture(); RenderSystem.defaultBlendFunc(); bufferBuilder.begin(7, VertexFormats.POSITION_COLOR); bufferBuilder.vertex(matrix4f, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix4f, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix4f, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next(); bufferBuilder.vertex(matrix4f, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next(); bufferBuilder.end(); BufferRenderer.draw(bufferBuilder); RenderSystem.enableTexture(); RenderSystem.disableBlend(); } public static void setColor(Color color) { GL11.glColor4f(color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, color.getAlpha() / 255.0f); } public static void setColor(int rgba) { int r = rgba & 0xFF; int g = rgba >> 8 & 0xFF; int b = rgba >> 16 & 0xFF; int a = rgba >> 24 & 0xFF; GL11.glColor4b((byte) r, (byte) g, (byte) b, (byte) a); } public static int toRGBA(Color c) { return c.getRed() | c.getGreen() << 8 | c.getBlue() << 16 | c.getAlpha() << 24; } public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width, int height) { return mouseX >= x && mouseX - width <= x && mouseY >= y && mouseY - height <= y; } public static boolean isHovered(double mouseX, double mouseY, double x, double y, double width, double height) { return mouseX >= x && mouseX - width <= x && mouseY >= y && mouseY - height <= y; } public static boolean isHovered(float mouseX, float mouseY, float x, float y, float width, float height) { return mouseX >= x && mouseX - width <= x && mouseY >= y && mouseY - height <= y; } }
4f3c19bb6ed12b4db3680493779b54d441152731
55c3e72b969082e02fe490c006030efc157aa6b2
/jas-wechat-api/src/main/java/com/wizinno/jas/wechat/api/AuthController.java
c072615341ef44297af8fb975d1c41404444083e
[]
no_license
yanglong1360075452/jas_lot_cloud
4c457b373da47be4b1d08acbdfe1199a7658ab47
b782ff1be3d1176e67e03ede208cf7d4aeb49873
refs/heads/master
2021-05-11T10:00:53.802417
2018-01-19T07:09:36
2018-01-19T07:09:36
118,090,335
0
0
null
null
null
null
UTF-8
Java
false
false
6,860
java
package com.wizinno.jas.wechat.api; import com.wizinno.jas.common.config.Config; import com.wizinno.jas.common.controller.BaseController; import com.wizinno.jas.common.data.ResponseVO; import com.wizinno.jas.common.exception.CustomException; import com.wizinno.jas.common.util.CommonUtil; import com.wizinno.jas.common.util.JwtUtil; import com.wizinno.jas.common.util.WechatGetImgUtil; import com.wizinno.jas.common.wechat.AccessToken; import com.wizinno.jas.common.wechat.JSSDKConfig; import com.wizinno.jas.common.wechat.WeChatUtil; import com.wizinno.jas.user.service.DoctorService; import com.wizinno.jas.user.service.UserService; import com.wizinno.jas.user.service.dto.DoctorDto; import com.wizinno.jas.user.service.dto.UserDto; import net.sf.json.JSONObject; import org.apache.commons.collections.map.HashedMap; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; /** * Created by LiuMei on 2017-07-26. */ @RestController @RequestMapping("/api/wechat/auth/") public class AuthController extends BaseController { @Autowired private UserService userService; @Autowired private JwtUtil jwtUtil; @Autowired private DoctorService doctorService; public static String path = "D:"; /** * 获取微信JSSDK的配置参数 * @param url * @return * @throws CustomException */ @RequestMapping(value = "js",method = RequestMethod.GET) public ResponseVO sign(@RequestParam("url") String url) throws CustomException { Object result = null; try { result = JSSDKConfig.sign(url); } catch (Exception e) { e.printStackTrace(); } return new ResponseVO(result); } /** * 网页授权 * 用户入口 * 未绑定返回openId * 已绑定返回token * * @param code * @return */ @RequestMapping(value = "/user/{code}",method = RequestMethod.GET) public ResponseVO getAccessToken(@PathVariable("code") String code) throws CustomException { AccessToken accessToken = WeChatUtil.getWebAuthAccessToken(code); AccessToken accessToken1 = WeChatUtil.getAccessToken(); String openId = accessToken.getOpenId(); //String openId="asd"+code; UserDto user = userService.getUserByOpenId(openId);//将open改为code Map<String, String> result = new HashedMap(); Map<String, Object> result1 = new HashedMap(); if (user != null) { Map<String,String> info = new HashMap<>(); info.put("openId",openId); info.put("phone",user.getPhone()); String subject = JwtUtil.generalSubject(info); String token = ""; try { token = jwtUtil.createJWT(Config.jwtId, subject, Config.jwtExpire); JSONObject jsonObject = WechatGetImgUtil.getUserInfo(accessToken1.getToken(),openId); String img = jsonObject.get("headimgurl").toString(); result1.put("img", img); if("".equals(user.getHeadPortrait())||null==user.getHeadPortrait()) { String imgUrl = WechatGetImgUtil.saveImage(img); user.setHeadPortrait(imgUrl); userService.updateUser(user); } } catch (Exception e) { e.printStackTrace(); } DoctorDto doctorDto = null; doctorDto = doctorService.getDoctorByUserId(user.getId()); if(null !=doctorDto){ result1.put("status", doctorDto.getStatus()); } result1.put("token", token); } else { result1.put("openId", openId); } return new ResponseVO(result1); } /** * 网页授权 * 用户入口 * 未绑定返回openId * 已绑定返回token * * @param code * @return */ @RequestMapping(value = "/users/{code}",method = RequestMethod.GET) public ResponseVO getAccessTokens(@PathVariable("code") String code) throws CustomException { //AccessToken accessToken = WeChatUtil.getWebAuthAccessToken(code); //String openId = accessToken.getOpenId(); //String img = getUserInfo(accessToken.getToken(),openId); String openId=code; UserDto user = userService.getUserByOpenId(openId);//将open改为code Map<String, Object> result = new HashedMap(); if (user != null) { Map<String,String> info = new HashMap<>(); info.put("openId",openId); info.put("phone",user.getPhone()); String subject = JwtUtil.generalSubject(info); String token = ""; try { token = jwtUtil.createJWT(Config.jwtId, subject, Config.jwtExpire); } catch (Exception e) { e.printStackTrace(); } DoctorDto doctorDto = null; doctorDto = doctorService.getDoctorByUserId(user.getId()); if(null !=doctorDto){ result.put("status", doctorDto.getStatus()); } result.put("token", token); } else { result.put("openId", openId); } //result.put("img",img); return new ResponseVO(result); } /** * 得到微信用户的头像 * * @return */ @RequestMapping(value = "/user/getWechatHeadImg/{openId}",method = RequestMethod.GET) public ResponseVO getWechatHeadImg(@PathVariable("openId") String openId) throws CustomException { AccessToken accessToken = WeChatUtil.getAccessToken(); UserDto user = userService.getUserByOpenId(openId); Map<String, Object> result = new HashedMap(); if (user != null) { String token = ""; try { JSONObject jsonObject = WechatGetImgUtil.getUserInfo(accessToken.getToken(), openId); String img = jsonObject.get("headimgurl").toString(); result.put("img", img); if ("".equals(user.getHeadPortrait()) || null == user.getHeadPortrait()) { String imgUrl = WechatGetImgUtil.saveImage(img); user.setHeadPortrait(imgUrl); userService.updateUser(user); } } catch (Exception e) { e.printStackTrace(); } } return new ResponseVO(result); } }
7065d588f166b8ce067c4bd1cb9698fbd6706390
d3b75a736931a24ec5c86d49b85a804ab5c6d5cd
/MultyInterfaceAnalyse/src/com/tuoming/entity/common/typeDecode.java
f757923fa3c81fbd52c0281072bb74cff69b9f44
[]
no_license
Gwind1024/LtDPI
72ddfe9871a02a77ad9a19449129735d0b17b6a2
7e0564c4ec01ac9d6be1dbbbbe2d6aa79e0b6b4f
refs/heads/master
2022-12-14T13:22:26.535702
2020-02-17T11:41:12
2020-02-17T11:41:12
241,059,422
0
0
null
null
null
null
UTF-8
Java
false
false
60,432
java
package com.tuoming.entity.common; //应用大小类特殊识别 public class typeDecode { //流量识别 public static String SERVNAME(String s){ String SERVNAME = ""; switch(s) { case "01_0001":SERVNAME="100012";break;//飞聊 case "01_0003":SERVNAME="100016";break;//Gtalk case "01_0005":SERVNAME="300";break;//QQ case "01_0008":SERVNAME="309";break;//米聊 case "01_0009":SERVNAME="304";break;//微信 case "01_0010":SERVNAME="300009";break;//人人 case "01_0016":SERVNAME="100020";break;//Lava-Lava case "01_0024":SERVNAME="100021";break;//百度Hi case "01_0025":SERVNAME="100022";break;//都秀 case "01_0026":SERVNAME="308";break;//陌陌 case "01_0027":SERVNAME="100015";break;//天翼Live case "01_0028":SERVNAME="100023";break;//翼聊 case "01_0035":SERVNAME="310";break;//易信 case "01_0037":SERVNAME="100070";break;//连我 case "01_0039":SERVNAME="312";break;//Whatsapp case "01_0043":SERVNAME="2000052";break;//钉钉 case "01_0045":SERVNAME="2000055";break;//企业微信 case "01_7000":SERVNAME="303";break;//阿里旺旺 case "01_7003":SERVNAME="100009";break;//新浪UC case "01_7007":SERVNAME="100043";break;//表白神器 case "01_7009":SERVNAME="100049";break;//誓友 case "01_7010":SERVNAME="100051";break;//咔咕 case "01_7011":SERVNAME="100035";break;//有恋 case "01_7012":SERVNAME="100081";break;//兜兜友 case "01_7013":SERVNAME="100060";break;//咚呱 case "01_7014":SERVNAME="100066";break;//想恋爱 case "01_7031":SERVNAME="2000123";break;//个信 case "01_7047":SERVNAME="500042";break;//沸点 case "01_7092":SERVNAME="100026";break;//啪啪 case "02_0004":SERVNAME="200010";break;//熊猫看书 case "02_0005":SERVNAME="2000080";break;//QQ阅读 case "02_0007":SERVNAME="200009";break;//掌上书院 case "02_0009":SERVNAME="200006";break;//云中书城 case "02_0010":SERVNAME="200007";break;//爱读掌阅 case "02_0012":SERVNAME="200014";break;//小说阅读网 case "02_0014":SERVNAME="200016";break;//言情小说吧 case "02_0016":SERVNAME="2000079";break;//掌阅Reader case "02_0017":SERVNAME="200019";break;//手机报阅读 case "02_0019":SERVNAME="200021";break;//天涯阅读 case "02_0021":SERVNAME="200023";break;//新浪读书 case "02_0022":SERVNAME="200024";break;//快眼看书 case "02_0023":SERVNAME="200025";break;//潇湘书院 case "02_0024":SERVNAME="200026";break;//红袖添香 case "02_0025":SERVNAME="200027";break;//天下电子书 case "02_0026":SERVNAME="200028";break;//狗狗书籍 case "02_0029":SERVNAME="200029";break;//视频手机报 case "02_0030":SERVNAME="200030";break;//百阅 case "02_0031":SERVNAME="200031";break;//宜搜小说 case "02_0032":SERVNAME="200070";break;//网易云阅读 case "02_0033":SERVNAME="200080";break;//书旗小说 case "02_0034":SERVNAME="200040";break;//塔读文学 case "02_0037":SERVNAME="200050";break;//多看阅读 case "02_0041":SERVNAME="200079";break;//安卓读书 case "02_0047":SERVNAME="200042";break;//豆瓣阅读 case "02_0050":SERVNAME="2000081";break;//追书神器 case "02_0051":SERVNAME="200049";break;//快读免费小说 case "02_0054":SERVNAME="200065";break;//GGBook看书 case "02_0055":SERVNAME="200068";break;//开卷有益 case "02_0058":SERVNAME="2000083";break;//搜狗阅读 case "02_7000":SERVNAME="200077";break;//VIVA畅读 case "02_7003":SERVNAME="200012";break;//天翼阅读 case "02_7004":SERVNAME="200067";break;//故事会 case "02_7005":SERVNAME="1700025";break;//沃阅读 case "02_7006":SERVNAME="200043";break;//奇悠阅读 case "02_7031":SERVNAME="1700014";break;//沃杂志 case "02_7032":SERVNAME="200036";break;//无觅阅读 case "02_7036":SERVNAME="200015";break;//纵横中文网 case "02_7044":SERVNAME="200044";break;//蜜蜂新闻 case "02_7077":SERVNAME="200069";break;//周末画报 case "03_0002":SERVNAME="330";break;//新浪微博 case "03_0003":SERVNAME="331";break;//腾讯微博 case "03_0004":SERVNAME="332";break;//搜狐微博 case "03_0005":SERVNAME="333";break;//网易微博 case "03_0006":SERVNAME="300007";break;//Weico微博客户端 case "03_0008":SERVNAME="1500065";break;//掌中天涯 case "03_0009":SERVNAME="2000070";break;//珍爱网 case "03_0010":SERVNAME="1500060";break;//朋友网 case "03_0011":SERVNAME="1500004";break;//天涯社区 case "03_0012":SERVNAME="1500005";break;//新浪论坛 case "03_0013":SERVNAME="1500007";break;//人人网 case "03_0014":SERVNAME="2000001";break;//QQ空间 case "03_0015":SERVNAME="1500012";break;//开心网 case "03_0016":SERVNAME="1500027";break;//掌上猫扑 case "03_0017":SERVNAME="2000072";break;//世纪佳缘 case "03_0018":SERVNAME="1500024";break;//豆瓣小组 case "03_0019":SERVNAME="1500029";break;//豆瓣 case "03_0020":SERVNAME="1500037";break;//百度贴吧 case "03_0021":SERVNAME="2000069";break;//百合婚恋 case "03_0022":SERVNAME="315";break;//Twitter case "03_7000":SERVNAME="300006";break;//移动139微博 case "03_7028":SERVNAME="2000073";break;//摩擦 case "03_7031":SERVNAME="100040";break;//微爱 case "03_7044":SERVNAME="100038";break;//抬杠 case "03_7045":SERVNAME="100059";break;//对面 case "03_7069":SERVNAME="100041";break;//KK觅友 case "03_7077":SERVNAME="100010";break;//沃友 case "04_0001":SERVNAME="750";break;//和地图 case "04_0002":SERVNAME="751";break;//谷歌地图 case "04_0003":SERVNAME="752";break;//百度地图 case "04_0004":SERVNAME="753";break;//搜狗地图 case "04_0005":SERVNAME="754";break;//腾讯地图 case "04_0008":SERVNAME="760";break;//导航犬 case "04_0009":SERVNAME="757";break;//高德导航 case "04_0010":SERVNAME="400011";break;//车e行 case "04_0011":SERVNAME="758";break;//凯立德导航 case "04_0012":SERVNAME="755";break;//老虎地图 case "04_0013":SERVNAME="759";break;//图吧导航 case "04_0014":SERVNAME="756";break;//苹果地图 case "04_7000":SERVNAME="2000023";break;//高德地图 case "04_7002":SERVNAME="400015";break;//六只脚行踪 case "04_7003":SERVNAME="400018";break;//地铁大全 case "04_7004":SERVNAME="400019";break;//飞路快导航 case "04_7005":SERVNAME="400020";break;//地铁通 case "04_7006":SERVNAME="400022";break;//兜兜公交 case "04_7007":SERVNAME="400023";break;//酷米客公交 case "04_7008":SERVNAME="400026";break;//坐车网 case "04_7009":SERVNAME="400013";break;//查周边 case "04_7017":SERVNAME="1900063";break;//听说交通 case "05_0003":SERVNAME="407";break;//优酷视频 case "05_0004":SERVNAME="500079";break;//土豆动漫视频 case "05_0006":SERVNAME="412";break;//腾讯视频 case "05_0007":SERVNAME="410";break;//搜狐视频 case "05_0008":SERVNAME="419";break;//新浪视频 case "05_0009":SERVNAME="500008";break;//网易视频 case "05_0015":SERVNAME="422";break;//56视频 case "05_0016":SERVNAME="418";break;//芒果TV case "05_0017":SERVNAME="416";break;//爱奇艺视频 case "05_0022":SERVNAME="500021";break;//乐视网络电视 case "05_0023":SERVNAME="421";break;//凤凰视频 case "05_0024":SERVNAME="500023";break;//3G生活网 case "05_0026":SERVNAME="500025";break;//YouTube视频 case "05_0027":SERVNAME="500026";break;//观影电影 case "05_0032":SERVNAME="500028";break;//皮皮影视 case "05_0033":SERVNAME="500029";break;//IKu case "05_0034":SERVNAME="500030";break;//金鹰网(jinying) case "05_0035":SERVNAME="500031";break;//Tomlive case "05_0039":SERVNAME="500032";break;//乐鱼 case "05_0041":SERVNAME="500033";break;//UC影音 case "05_0057":SERVNAME="500048";break;//喔喔播放器 case "05_0060":SERVNAME="417";break;//百度视频 case "05_0061":SERVNAME="420";break;//微视 case "05_0062":SERVNAME="424";break;//网易公开课 case "05_0063":SERVNAME="425";break;//TED case "05_0064":SERVNAME="426";break;//360影视大全 case "05_0065":SERVNAME="2000002";break;//快手 case "05_0066":SERVNAME="428";break;//开迅视频 case "05_0068":SERVNAME="430";break;//爱拍 case "05_0084":SERVNAME="500036";break;//六间房 case "05_0089":SERVNAME="2000114";break;//熊猫直播 case "05_0094":SERVNAME="2000115";break;//抖音短视频 case "05_0095":SERVNAME="2000117";break;//火山小视频 case "05_7005":SERVNAME="500063";break;//IMDb case "05_7006":SERVNAME="500067";break;//猫眼电影 case "05_7007":SERVNAME="500065";break;//100tv高清播放器 case "05_7064":SERVNAME="500081";break;//看片神器 case "05_7072":SERVNAME="100057";break;//电视粉 case "05_7100":SERVNAME="500056";break;//百视通影视 case "05_7103":SERVNAME="500080";break;//CC视频 case "05_7110":SERVNAME="500037";break;//IV影音 case "05_7116":SERVNAME="500045";break;//磊客 case "06_0001":SERVNAME="458";break;//咪咕音乐 case "06_0002":SERVNAME="450";break;//QQ音乐 case "06_0003":SERVNAME="451";break;//酷我音乐 case "06_0004":SERVNAME="600004";break;//千千静听 case "06_0005":SERVNAME="454";break;//百度音乐 case "06_0006":SERVNAME="600006";break;//一听音乐 case "06_0007":SERVNAME="600007";break;//九酷音乐 case "06_0009":SERVNAME="600009";break;//搜狗音乐 case "06_0010":SERVNAME="462";break;//虾米音乐 case "06_0011":SERVNAME="453";break;//多米音乐 case "06_0012":SERVNAME="600012";break;//谷歌音乐盒 case "06_0013":SERVNAME="600013";break;//A67手机音乐 case "06_0014":SERVNAME="600014";break;//dodo手机音乐 case "06_0015":SERVNAME="600015";break;//九天音乐 case "06_0016":SERVNAME="1700013";break;//沃音乐 case "06_0017":SERVNAME="600017";break;//中国电信音乐门户 case "06_0018":SERVNAME="471";break;//K歌达人 case "06_0019":SERVNAME="463";break;//豆瓣FM case "06_0021":SERVNAME="452";break;//酷狗音乐 case "06_0022":SERVNAME="476";break;//懒人听书 case "06_0023":SERVNAME="600023";break;//美乐电台 case "06_0025":SERVNAME="461";break;//音悦台 case "06_0026":SERVNAME="600027";break;//巨鲸音乐 case "06_0027":SERVNAME="600028";break;//百宝 case "06_0028":SERVNAME="600029";break;//OVI音乐 case "06_0031":SERVNAME="600032";break;//开心听 case "06_0032":SERVNAME="456";break;//爱音乐 case "06_0033":SERVNAME="457";break;//唱吧 case "06_0034":SERVNAME="459";break;//全曲下载 case "06_0036":SERVNAME="464";break;//网易云音乐 case "06_0037":SERVNAME="465";break;//蜻蜓FM case "06_0038":SERVNAME="466";break;//喜马拉雅听 case "06_0039":SERVNAME="467";break;//荔枝FM case "06_0041":SERVNAME="469";break;//考拉FM电台 case "06_0042":SERVNAME="470";break;//爱唱 case "06_0044":SERVNAME="473";break;//猎曲奇兵 case "06_0046":SERVNAME="475";break;//移动练歌房 case "06_0050":SERVNAME="2000146";break;//全民K歌 case "06_0051":SERVNAME="600054";break;//天籁K歌 case "06_0052":SERVNAME="600055";break;//猜歌王 case "06_7003":SERVNAME="600037";break;//Jing case "06_7004":SERVNAME="600047";break;//N7音乐播放器 case "06_7005":SERVNAME="600049";break;//音乐雷达 case "06_7006":SERVNAME="600050";break;//布丁K歌惠 case "06_7007":SERVNAME="600051";break;//你听音乐 case "06_7014":SERVNAME="600031";break;//音乐随身听 case "06_7034":SERVNAME="200051";break;//听世界听书 case "06_7045":SERVNAME="600068";break;//爱吼K歌 case "06_7056":SERVNAME="600008";break;//DJ音乐厅 case "06_8103":SERVNAME="455";break;//天天动听 case "07_0002":SERVNAME="207";break;//安卓市场 case "07_0003":SERVNAME="700003";break;//AppStore case "07_0004":SERVNAME="208";break;//91助手 case "07_0008":SERVNAME="235";break;//豌豆荚 case "07_0009":SERVNAME="219";break;//应用宝 case "07_0010":SERVNAME="209";break;//360手机助手 case "07_0011":SERVNAME="210";break;//机锋市场 case "07_0012":SERVNAME="211";break;//安智市场 case "07_0013":SERVNAME="212";break;//百度手机助手 case "07_0014":SERVNAME="213";break;//同步推 case "07_0015":SERVNAME="215";break;//木蚂蚁 case "07_0016":SERVNAME="216";break;//三星应用商店 case "07_0017":SERVNAME="217";break;//小米应用商店 case "07_0018":SERVNAME="218";break;//联想乐商店 case "07_0020":SERVNAME="220";break;//网易应用中心 case "07_0021":SERVNAME="221";break;//Windows Phone应用商店 case "07_0022":SERVNAME="2000017";break;//OPPO软件商店 case "07_0023":SERVNAME="223";break;//应用汇 case "07_0024":SERVNAME="224";break;//酷派应用商店 case "07_0025":SERVNAME="225";break;//华为应用市场 case "07_0026":SERVNAME="226";break;//魅族应用中心 case "07_0027":SERVNAME="227";break;//快用苹果助手 case "07_0028":SERVNAME="228";break;//搜苹果 case "07_0029":SERVNAME="229";break;//海马苹果助手 case "07_0030":SERVNAME="230";break;//沃商店 case "07_0032":SERVNAME="232";break;//搜狗手机助手 case "07_0033":SERVNAME="233";break;//PP助手 case "07_0034":SERVNAME="234";break;//易用汇 case "07_0041":SERVNAME="700006";break;//智汇云 case "07_7000":SERVNAME="700009";break;//QQ应用中心 case "07_7001":SERVNAME="700035";break;//应用酷 case "07_7004":SERVNAME="800172";break;//拇指玩 case "07_7009":SERVNAME="700038";break;//免商店 case "08_0002":SERVNAME="800002";break;//三国杀 case "08_0003":SERVNAME="800016";break;//星际争霸 case "08_0004":SERVNAME="800017";break;//魔兽世界 case "08_0005":SERVNAME="800018";break;//反恐精英 case "08_0006":SERVNAME="800020";break;//地下城与勇士 case "08_0007":SERVNAME="800021";break;//玩派 case "08_0008":SERVNAME="800022";break;//联众世界 case "08_0009":SERVNAME="800012";break;//CSonline case "08_0010":SERVNAME="800011";break;//浩方对战 case "08_0011":SERVNAME="800023";break;//热血江湖 case "08_0012":SERVNAME="800024";break;//跑跑卡丁车 case "08_0013":SERVNAME="800025";break;//劲舞团 case "08_0014":SERVNAME="800026";break;//街头篮球 case "08_0015":SERVNAME="800027";break;//泡泡堂 case "08_0016":SERVNAME="800028";break;//梦幻西游 case "08_0017":SERVNAME="800029";break;//巨人征途 case "08_0018":SERVNAME="800030";break;//永恒之塔 case "08_0019":SERVNAME="800031";break;//天堂II case "08_0020":SERVNAME="800032";break;//剑侠世界 case "08_0022":SERVNAME="800034";break;//穿越火线 case "08_0023":SERVNAME="800035";break;//天龙八部 case "08_0024":SERVNAME="800036";break;//完美时空 case "08_0025":SERVNAME="800037";break;//开心 case "08_0026":SERVNAME="800038";break;//问道 case "08_0027":SERVNAME="800039";break;//奇迹MU case "08_0028":SERVNAME="800040";break;//VS竞技平台 case "08_0029":SERVNAME="800041";break;//天劫 case "08_0030":SERVNAME="800183";break;//游戏中心 case "08_0032":SERVNAME="800043";break;//天道 case "08_0033":SERVNAME="800044";break;//QQ飞车 case "08_0034":SERVNAME="800045";break;//特种部队 case "08_0035":SERVNAME="800046";break;//幻想i时代 case "08_0036":SERVNAME="800047";break;//海贼王 case "08_0038":SERVNAME="800049";break;//新浪游戏 case "08_0039":SERVNAME="1500118";break;//太平洋游戏网 case "08_0040":SERVNAME="800051";break;//游侠网 case "08_0041":SERVNAME="800052";break;//玩家网 case "08_0042":SERVNAME="800053";break;//4399小游戏 case "08_0043":SERVNAME="800054";break;//Arclive对战平台 case "08_0044":SERVNAME="800055";break;//Bdchina游戏中心 case "08_0045":SERVNAME="800056";break;//FIFA case "08_0046":SERVNAME="800057";break;//Game淘游戏大厅 case "08_0047":SERVNAME="800058";break;//Real游戏大厅 case "08_0048":SERVNAME="800059";break;//TOM游戏世界 case "08_0050":SERVNAME="800061";break;//宝贝坦克 case "08_0051":SERVNAME="800062";break;//雷神之锤 case "08_0052":SERVNAME="800063";break;//中国游戏中心 case "08_0053":SERVNAME="800064";break;//征服 case "08_0054":SERVNAME="800065";break;//诛仙 case "08_0055":SERVNAME="800066";break;//卓越之剑 case "08_0056":SERVNAME="800067";break;//热血传奇 case "08_0057":SERVNAME="800068";break;//彩虹岛 case "08_0058":SERVNAME="800069";break;//突袭 case "08_0059":SERVNAME="800070";break;//纵横时空 case "08_0060":SERVNAME="800071";break;//星际传说 case "08_0061":SERVNAME="800072";break;//联众手机游戏 case "08_0062":SERVNAME="800073";break;//武林外传 case "08_0063":SERVNAME="800074";break;//名将 case "08_0065":SERVNAME="800004";break;//QQ斗地主 case "08_0066":SERVNAME="800006";break;//QQ达人 case "08_0067":SERVNAME="800075";break;//数码宝贝 case "08_0068":SERVNAME="800076";break;//新英雄年代 case "08_0069":SERVNAME="800077";break;//QQ连连看 case "08_0070":SERVNAME="800078";break;//三界传说 case "08_0072":SERVNAME="800080";break;//星际家园 case "08_0073":SERVNAME="800081";break;//QQ欢乐王国 case "08_0074":SERVNAME="800082";break;//魔力宝贝 case "08_0075":SERVNAME="800083";break;//贸易街机 case "08_0078":SERVNAME="800086";break;//生肖传说 case "08_0079":SERVNAME="800087";break;//秦始皇 case "08_0080":SERVNAME="800005";break;//QQ麻将 case "08_0081":SERVNAME="800088";break;//超级跑跑 case "08_0082":SERVNAME="800089";break;//风云 case "08_0083":SERVNAME="800090";break;//乱世枭雄 case "08_0084":SERVNAME="800091";break;//QQ音速 case "08_0086":SERVNAME="800093";break;//众神之战 case "08_0087":SERVNAME="800094";break;//QQ阳光牧场 case "08_0088":SERVNAME="800095";break;//完美世界 case "08_0089":SERVNAME="800096";break;//超级舞者 case "08_0090":SERVNAME="800097";break;//弹头骑兵 case "08_0091":SERVNAME="800098";break;//露娜 case "08_0092":SERVNAME="800099";break;//QQ五子棋 case "08_0093":SERVNAME="800100";break;//乱舞天下 case "08_0094":SERVNAME="800101";break;//水浒Q传 case "08_0098":SERVNAME="800104";break;//战火红警 case "08_0099":SERVNAME="800105";break;//蒸汽幻想 case "08_0100":SERVNAME="800106";break;//大话西游2 case "08_0103":SERVNAME="800109";break;//冒险岛 case "08_0104":SERVNAME="800110";break;//QQ炫舞 case "08_0105":SERVNAME="800111";break;//街舞 case "08_0106":SERVNAME="800112";break;//QQ中国象棋 case "08_0107":SERVNAME="800113";break;//QQ鱼 case "08_0108":SERVNAME="800114";break;//凤舞天骄 case "08_0109":SERVNAME="800115";break;//浪漫传说 case "08_0110":SERVNAME="800116";break;//梦幻古龙 case "08_0111":SERVNAME="800117";break;//QQ华夏 case "08_0112":SERVNAME="800118";break;//勇气 case "08_0113":SERVNAME="800119";break;//QQ游四方 case "08_0114":SERVNAME="800120";break;//面对面 case "08_0115":SERVNAME="800121";break;//霸王 case "08_0116":SERVNAME="800122";break;//千年 case "08_0117":SERVNAME="800123";break;//投名状 case "08_0118":SERVNAME="800124";break;//路尼亚战记 case "08_0120":SERVNAME="800126";break;//新飞飞 case "08_0121":SERVNAME="800127";break;//奇迹世界 case "08_0122":SERVNAME="800128";break;//功夫世界 case "08_0123":SERVNAME="800129";break;//倚天剑和屠龙刀 case "08_0124":SERVNAME="800130";break;//盛大富翁 case "08_0125":SERVNAME="800131";break;//三国鼎立 case "08_0126":SERVNAME="800132";break;//伊苏战记 case "08_0127":SERVNAME="800133";break;//海之乐章 case "08_0128":SERVNAME="800134";break;//龙骑士 case "08_0129":SERVNAME="800135";break;//梦想世界 case "08_0130":SERVNAME="800136";break;//QQ爱之花园 case "08_0131":SERVNAME="800137";break;//娃娃精品棋牌 case "08_0132":SERVNAME="800138";break;//QQ三国 case "08_0133":SERVNAME="800139";break;//浪漫庄园 case "08_0134":SERVNAME="800140";break;//QQ自由幻想 case "08_0135":SERVNAME="800141";break;//蜀山系列 case "08_0137":SERVNAME="800143";break;//起凡 case "08_0138":SERVNAME="800144";break;//QQ农场 case "08_0139":SERVNAME="800145";break;//QQ抢车位 case "08_0140":SERVNAME="800146";break;//QQ家园 case "08_0141":SERVNAME="800147";break;//战国天下 case "08_0142":SERVNAME="800148";break;//世界OL case "08_0143":SERVNAME="800149";break;//水果派对 case "08_0145":SERVNAME="800151";break;//摩天轮 case "08_0151":SERVNAME="800203";break;//捕鱼达人 case "08_0161":SERVNAME="2000064";break;//开心消消乐 case "08_0164":SERVNAME="2000068";break;//海岛奇兵 case "08_0173":SERVNAME="1500125";break;//QQ游戏 case "08_0182":SERVNAME="1500121";break;//7k7k小游戏 case "08_0183":SERVNAME="1500124";break;//178游戏网 case "08_0184":SERVNAME="1500123";break;//电玩巴士 case "08_0185":SERVNAME="800219";break;//九游 case "08_0188":SERVNAME="1500117";break;//多玩游戏 case "08_0193":SERVNAME="658";break;//王者荣耀 case "08_0195":SERVNAME="2000065";break;//荒野行动 case "08_7014":SERVNAME="800186";break;//愤怒的小鸟 case "08_7017":SERVNAME="653";break;//网易游戏 case "08_7024":SERVNAME="2000067";break;//天天爱消除 case "08_7035":SERVNAME="800221";break;//宝开 case "08_7053":SERVNAME="800206";break;//欢乐斗地主 case "08_7059":SERVNAME="2000066";break;//球球大作战 case "08_7179":SERVNAME="800153";break;//神雕侠侣 case "08_7192":SERVNAME="800156";break;//英雄联盟 case "08_7288":SERVNAME="800185";break;//天神传 case "08_7460":SERVNAME="800197";break;//猴子也疯狂 case "08_7535":SERVNAME="800195";break;//龙之谷 case "08_7633":SERVNAME="800166";break;//侠客无双 case "08_7691":SERVNAME="800033";break;//剑侠情缘3 case "08_7693":SERVNAME="800107";break;//同城游 case "08_7694":SERVNAME="652";break;//腾讯游戏 case "09_0002":SERVNAME="900031";break;//移动手机支付 case "09_0003":SERVNAME="631";break;//支付宝 case "09_0005":SERVNAME="2000006";break;//招商银行 case "09_0006":SERVNAME="900005";break;//财付通 case "09_0007":SERVNAME="900006";break;//快钱 case "09_0008":SERVNAME="900007";break;//e动交行 case "09_0009":SERVNAME="2000004";break;//中国建设银行 case "09_0010":SERVNAME="900009";break;//中国银行手机银行 case "09_0011":SERVNAME="2000005";break;//中国工商银行 case "09_0012":SERVNAME="2000003";break;//农行掌上银行 case "09_0013":SERVNAME="900012";break;//中信银行 case "09_0014":SERVNAME="900013";break;//兴业银行 case "09_0019":SERVNAME="900020";break;//浦发手机银行 case "09_0020":SERVNAME="900023";break;//广发银行 case "09_0021":SERVNAME="900024";break;//光大银行 case "09_0022":SERVNAME="900026";break;//北京银行 case "09_0023":SERVNAME="900028";break;//民生银行 case "09_0030":SERVNAME="900019";break;//翼支付 case "09_7009":SERVNAME="900016";break;//拉卡拉 case "09_7012":SERVNAME="36";break;//壹钱包 case "09_7022":SERVNAME="900029";break;//百付宝 case "09_7023":SERVNAME="1600086";break;//微信抢红包 case "09_7024":SERVNAME="900014";break;//平安银行 case "10_0002":SERVNAME="1000002";break;//火影忍者中文网 case "10_0003":SERVNAME="1000003";break;//爱漫画 case "10_0008":SERVNAME="1000012";break;//布卡漫画 case "10_0009":SERVNAME="1000013";break;//爱动漫 case "10_0017":SERVNAME="1000015";break;//快手动漫 case "10_0019":SERVNAME="2000113";break;//快看漫画 case "10_7000":SERVNAME="1000005";break;//翻漫画 case "10_7002":SERVNAME="1000004";break;//漫漫看 case "10_7036":SERVNAME="2000127";break;//comico漫画 case "11_0001":SERVNAME="503";break;//139邮箱 case "11_0003":SERVNAME="506";break;//新浪邮箱 case "11_0004":SERVNAME="508";break;//QQ邮箱 case "11_0005":SERVNAME="505";break;//126邮箱 case "11_0008":SERVNAME="1700071";break;//沃邮箱 case "11_0010":SERVNAME="507";break;//搜狐邮箱 case "11_0013":SERVNAME="512";break;//21CN邮箱 case "11_0016":SERVNAME="1100014";break;//搜狗邮箱 case "11_0017":SERVNAME="1100015";break;//189邮箱 case "11_0018":SERVNAME="1100016";break;//TOM邮箱 case "11_0019":SERVNAME="1100019";break;//FOXMAIL邮箱 case "11_7001":SERVNAME="509";break;//Gmail case "11_7002":SERVNAME="511";break;//live邮箱 case "12_0001":SERVNAME="1200001";break;//迅雷 case "12_0003":SERVNAME="1200003";break;//BitTorrent case "12_0004":SERVNAME="1200004";break;//eMule case "12_0007":SERVNAME="404";break;//爱奇艺PPS影音 case "12_0008":SERVNAME="1200008";break;//BitComet case "12_0009":SERVNAME="1200009";break;//BitSpirit case "12_0011":SERVNAME="1200011";break;//UUSee网络电视 case "12_0012":SERVNAME="1200012";break;//暴风影音 case "12_0014":SERVNAME="1200014";break;//网际快车 case "12_0016":SERVNAME="1200015";break;//VGO网络电视 case "12_0018":SERVNAME="1200016";break;//Gnutella case "12_0019":SERVNAME="1200017";break;//Gnucleus case "12_0020":SERVNAME="1200018";break;//PP点点通 case "12_0022":SERVNAME="1200020";break;//360软件管家 case "12_0023":SERVNAME="1200021";break;//皮皮高清 case "12_0024":SERVNAME="1200022";break;//风行 case "12_0025":SERVNAME="1200023";break;//QVOD快播影视 case "12_0026":SERVNAME="1200024";break;//TVAnts case "12_0033":SERVNAME="1200026";break;//百度下吧 case "12_0034":SERVNAME="1200027";break;//汉魅 case "12_0035":SERVNAME="1200028";break;//Winny case "12_0036":SERVNAME="1200029";break;//百纳Biget case "12_0038":SERVNAME="1200031";break;//脱兔 case "12_0039":SERVNAME="1200032";break;//屁屁狗 case "12_0040":SERVNAME="1200033";break;//SoulSeek case "12_0044":SERVNAME="1200035";break;//RaySource case "12_0046":SERVNAME="1200036";break;//酷狗 case "12_7014":SERVNAME="1200005";break;//eDonkey case "13_0001":SERVNAME="1300002";break;//Skype case "13_0002":SERVNAME="1300003";break;//Viber case "13_0003":SERVNAME="1300004";break;//手机YY case "13_0006":SERVNAME="1300008";break;//Vtalk case "13_0007":SERVNAME="1300009";break;//Voxbar case "13_0008":SERVNAME="1300010";break;//铁通飞线漫游 case "13_0009":SERVNAME="1300011";break;//MOIP音视频通讯 case "13_0010":SERVNAME="1300012";break;//TELTEL case "13_0011":SERVNAME="1300013";break;//Keep Contact case "13_0012":SERVNAME="1300014";break;//易话宝 case "13_0013":SERVNAME="1300015";break;//CentNet case "13_0014":SERVNAME="1300016";break;//尚阳uPass case "13_0015":SERVNAME="1300017";break;//Grid-talk case "13_0016":SERVNAME="1300006";break;//阿里通 case "13_0018":SERVNAME="1300018";break;//和悦(Heyoo) case "13_0020":SERVNAME="1300019";break;//Net2Phone case "13_0021":SERVNAME="1300020";break;//铁通EP case "13_0022":SERVNAME="1300021";break;//VOCALTEC case "13_0023":SERVNAME="1300022";break;//爱可聆 case "13_0024":SERVNAME="1300023";break;//宝利通 case "13_0025":SERVNAME="1300024";break;//歪歪 case "13_0027":SERVNAME="1300026";break;//NetMeeting case "13_0028":SERVNAME="1300027";break;//爱聊 case "13_0030":SERVNAME="1300029";break;//ChatON case "13_0031":SERVNAME="1300030";break;//中华通电话 case "13_0033":SERVNAME="1300032";break;//飞音网络电话 case "13_0034":SERVNAME="1300033";break;//3G手机网络电话 case "13_0035":SERVNAME="1300034";break;//必通 case "13_0036":SERVNAME="1300035";break;//易聊 case "13_0037":SERVNAME="1300036";break;//QQ Voice case "13_0039":SERVNAME="1200030";break;//比邻 case "13_0040":SERVNAME="1300040";break;//KC网络电话 case "13_7000":SERVNAME="1300031";break;//uu手机网络电话 case "13_7001":SERVNAME="100058";break;//秀色 case "13_7009":SERVNAME="1300037";break;//哦啦语音 case "13_7011":SERVNAME="1300041";break;//通通聊天 case "13_7015":SERVNAME="100075";break;//乐呼 case "13_7020":SERVNAME="1900026";break;//搜狗号码通 case "13_7023":SERVNAME="100080";break;//多聊免费电话 case "13_7024":SERVNAME="100074";break;//拨拨网络电话 case "13_7031":SERVNAME="1900103";break;//来电通 case "13_7038":SERVNAME="1300038";break;//掌上宝网络电话 case "13_7060":SERVNAME="1300028";break;//有信 case "15_0002":SERVNAME="2000094";break;//手机百度 case "15_0005":SERVNAME="100048";break;//人脉通 case "15_0008":SERVNAME="2000029";break;//大众点评 case "15_0010":SERVNAME="1500010";break;//腾讯网 case "15_0021":SERVNAME="1500021";break;//UC网站访问 case "15_0022":SERVNAME="1500066";break;//掌中新浪 case "15_0030":SERVNAME="2000132";break;//新浪网 case "15_0031":SERVNAME="1500031";break;//搜狐网 case "15_0032":SERVNAME="1500032";break;//网易网 case "15_0033":SERVNAME="1500033";break;//凤凰网 case "15_0034":SERVNAME="1500034";break;//人民网 case "15_0035":SERVNAME="1500035";break;//新华网 case "15_0036":SERVNAME="1500036";break;//中华网 case "15_0063":SERVNAME="2000107";break;//58同城 case "15_0066":SERVNAME="2000016";break;//新浪新闻 case "15_0068":SERVNAME="1500068";break;//中金在线 case "15_0073":SERVNAME="1500074";break;//搜房网 case "15_0074":SERVNAME="2000084";break;//安居客 case "15_0075":SERVNAME="1500076";break;//太平洋汽车网 case "15_0076":SERVNAME="1500077";break;//凤凰新闻 case "15_0077":SERVNAME="2000015";break;//搜狐新闻 case "15_0078":SERVNAME="2000013";break;//腾讯新闻 case "15_0079":SERVNAME="2000014";break;//网易新闻 case "15_0081":SERVNAME="1500081";break;//拍拍 case "15_0082":SERVNAME="1500082";break;//卓越 case "15_0084":SERVNAME="1500084";break;//淘房网 case "15_0086":SERVNAME="1500086";break;//亿房网 case "15_0087":SERVNAME="2000100";break;//宝宝树孕育 case "15_0088":SERVNAME="1500088";break;//太平洋亲子网 case "15_0090":SERVNAME="1500090";break;//搜狐母婴频道 case "15_0094":SERVNAME="1500094";break;//19楼 case "15_0096":SERVNAME="1500096";break;//百度网址大全 case "15_0099":SERVNAME="1500099";break;//中关村在线 case "15_0101":SERVNAME="615";break;//国美商城 case "15_0105":SERVNAME="1500105";break;//饭统网 case "15_0107":SERVNAME="1500107";break;//空中英语 case "15_0109":SERVNAME="1500109";break;//铁血网 case "15_0112":SERVNAME="2000057";break;//智联招聘 case "15_0113":SERVNAME="1500113";break;//智通人才 case "15_0114":SERVNAME="1500114";break;//百城求职宝 case "15_0115":SERVNAME="2000018";break;//UC浏览器 case "15_0120":SERVNAME="1500120";break;//4399游戏网 case "15_0125":SERVNAME="1500127";break;//移动梦网 case "15_0126":SERVNAME="1500128";break;//12530WAP门户 case "15_0127":SERVNAME="1500129";break;//WAP统一门户 case "15_0128":SERVNAME="400006";break;//移动手机导航 case "15_0131":SERVNAME="2000095";break;//搜狗搜索 case "15_0137":SERVNAME="618";break;//蘑菇街 case "15_0140":SERVNAME="200064";break;//美丽说 case "15_0146":SERVNAME="200078";break;//汽车之家 case "15_0149":SERVNAME="100039";break;//知乎 case "15_0165":SERVNAME="1900153";break;//飞常准 case "15_0169":SERVNAME="600046";break;//铃声多多 case "15_0170":SERVNAME="2000012";break;//今日头条 case "15_0173":SERVNAME="2000040";break;//虎扑跑步 case "15_0176":SERVNAME="1900014";break;//面包旅行 case "15_0177":SERVNAME="2000036";break;//下厨房 case "15_0182":SERVNAME="2000027";break;//易到司机端 case "15_0184":SERVNAME="500062";break;//直播吧 case "15_0189":SERVNAME="2000034";break;//KFC case "15_0192":SERVNAME="2000037";break;//美柚经期助手 case "15_0200":SERVNAME="1900023";break;//课程格子 case "15_0201":SERVNAME="1900031";break;//掌中英语 case "15_0202":SERVNAME="400033";break;//车托帮 case "15_0204":SERVNAME="1600083";break;//百度乐彩 case "15_0206":SERVNAME="400036";break;//8684公交 case "15_0207":SERVNAME="800184";break;//当乐游戏中心 case "15_0209":SERVNAME="2000125";break;//米柚 case "15_0210":SERVNAME="2000082";break;//百度文库 case "15_0214":SERVNAME="2000032";break;//饿了么 case "15_0232":SERVNAME="200054";break;//央视新闻 case "15_0243":SERVNAME="600053";break;//酷音铃声 case "15_0244":SERVNAME="200059";break;//百度新闻 case "15_0245":SERVNAME="1900045";break;//百度魔图 case "15_0247":SERVNAME="2000038";break;//大姨吗 case "15_0249":SERVNAME="2000104";break;//妈妈网 case "15_0259":SERVNAME="2000049";break;//美拍 case "15_0264":SERVNAME="1600067";break;//财经杂志 case "15_0268":SERVNAME="1900020";break;//全国违章查询 case "15_0274":SERVNAME="2000131";break;//苹果固件更新 case "15_0275":SERVNAME="2000128";break;//腾讯软件下载更新 case "15_0282":SERVNAME="100068";break;//遇见 case "15_0292":SERVNAME="2000078";break;//百词斩 case "15_0294":SERVNAME="2000096";break;//360搜索 case "15_0318":SERVNAME="2000076";break;//作业帮 case "15_0321":SERVNAME="1900096";break;//超级课程表 case "15_0326":SERVNAME="2000035";break;//百度外卖 case "15_0327":SERVNAME="2000033";break;//美团外卖 case "15_0332":SERVNAME="1500020";break;//MiniWeb case "15_0334":SERVNAME="2000019";break;//QQ浏览器 case "15_0335":SERVNAME="1500023";break;//都市在线 case "15_0336":SERVNAME="1500025";break;//开开点评 case "15_0340":SERVNAME="1500126";break;//手机游戏 case "15_0343":SERVNAME="1900022";break;//Instagram case "15_0345":SERVNAME="314";break;//FaceBook case "15_0347":SERVNAME="100062";break;//友加 case "15_0374":SERVNAME="2000093";break;//交管12123 case "15_0375":SERVNAME="2000075";break;//驾考宝典 case "15_0376":SERVNAME="1900033";break;//汽车报价大全 case "15_0383":SERVNAME="2000087";break;//房天下 case "15_7000":SERVNAME="1500057";break;//腾讯读书 case "15_7001":SERVNAME="1500058";break;//51.com case "15_7002":SERVNAME="1500083";break;//365地产家居 case "15_7003":SERVNAME="1500085";break;//好租 case "15_7004":SERVNAME="1500110";break;//chinahr case "15_7011":SERVNAME="1600088";break;//淘宝彩票 case "15_7030":SERVNAME="1700053";break;//116114-流量 case "15_7031":SERVNAME="1700001";break;//联通网上营业厅 case "15_7032":SERVNAME="2000120";break;//Accuweather case "15_7067":SERVNAME="800216";break;//游娱网 case "15_7106":SERVNAME="2000126";break;//url网 case "15_7112":SERVNAME="2000124";break;//vivo官网 case "15_7139":SERVNAME="2000122";break;//OPPO移动互联网 case "15_7155":SERVNAME="2000129";break;//mob官网 case "15_7183":SERVNAME="1700004";break;//沃门户 case "15_7196":SERVNAME="1700098";break;//沃易购 case "15_7238":SERVNAME="2000079";break;//掌阅Reader case "15_7348":SERVNAME="2000034";break;//KFC case "15_7375":SERVNAME="2000121";break;//Apple官网 case "15_7435":SERVNAME="2000058";break;//BOSS直聘 case "15_7450":SERVNAME="1900037";break;//穷游 case "15_7624":SERVNAME="2000063";break;//融360 case "15_7639":SERVNAME="2000040";break;//虎扑跑步 case "15_7718":SERVNAME="2000042";break;//携程出行 case "15_7863":SERVNAME="1700024";break;//中国网事 case "15_8073":SERVNAME="1600091";break;//新浪爱彩 case "15_8192":SERVNAME="900030";break;//移动手机钱包 case "15_8250":SERVNAME="1600078";break;//还剩多少钱 case "15_8294":SERVNAME="782";break;//永安行 case "15_8325":SERVNAME="1700075";break;//114生活助手 case "15_9053":SERVNAME="1700033";break;//联通湖北 case "15_9260":SERVNAME="2000046";break;//飞猪 case "15_9541":SERVNAME="1900036";break;//中国电信掌上营业厅 case "15_9589":SERVNAME="1500001";break;//手机冲浪 case "15_9590":SERVNAME="1500018";break;//人脉库 case "15_9591":SERVNAME="2000056";break;//前程无忧 case "16_0002":SERVNAME="1600098";break;//手机证券 case "16_0003":SERVNAME="352";break;//同花顺 case "16_0004":SERVNAME="353";break;//大智慧 case "16_0005":SERVNAME="1600003";break;//手机外汇 case "16_0006":SERVNAME="1600004";break;//商旅在线 case "16_0008":SERVNAME="1600006";break;//基金财富通 case "16_0009":SERVNAME="1600007";break;//掌中商务宝典 case "16_0011":SERVNAME="1600009";break;//广州易恒股通 case "16_0012":SERVNAME="1600010";break;//手机炒股 case "16_0013":SERVNAME="1600011";break;//大福星 case "16_0014":SERVNAME="1500043";break;//证券之星 case "16_0015":SERVNAME="1600012";break;//财华终端 case "16_0016":SERVNAME="1600013";break;//操盘手 case "16_0017":SERVNAME="1600014";break;//聪慧发发 case "16_0018":SERVNAME="1600015";break;//大满贯 case "16_0019":SERVNAME="1600016";break;//投资堂 case "16_0021":SERVNAME="1600018";break;//移动证券 case "16_0022":SERVNAME="354";break;//益盟操盘手 case "16_0025":SERVNAME="1600022";break;//涨停榜 case "16_0026":SERVNAME="1600023";break;//指南针 case "16_0028":SERVNAME="1600025";break;//股指期货 case "16_0033":SERVNAME="1600030";break;//利多方舟 case "16_0034":SERVNAME="1600031";break;//通达信 case "16_0035":SERVNAME="1600032";break;//投资通 case "16_0036":SERVNAME="1600033";break;//财吧 case "16_0037":SERVNAME="1600034";break;//股东挖掘机 case "16_0038":SERVNAME="1600035";break;//股市双通道 case "16_0040":SERVNAME="1500041";break;//金融界 case "16_0043":SERVNAME="1600039";break;//彩猫彩票 case "16_0044":SERVNAME="1600040";break;//网易彩票 case "16_0045":SERVNAME="1600041";break;//博雅彩票 case "16_0046":SERVNAME="1600042";break;//如意彩票 case "16_0048":SERVNAME="356";break;//文华财经 case "16_0049":SERVNAME="357";break;//万得股票 case "16_0050":SERVNAME="358";break;//百度理财 case "16_0053":SERVNAME="1500042";break;//中国经济网 case "16_0054":SERVNAME="1500044";break;//网易财经 case "16_0056":SERVNAME="1500046";break;//华讯财经 case "16_0057":SERVNAME="1500047";break;//和讯网 case "16_0058":SERVNAME="1600021";break;//金太阳 case "16_0060":SERVNAME="1600045";break;//银信宝 case "16_0061":SERVNAME="1600047";break;//钱龙-申银万国 case "16_0062":SERVNAME="1600048";break;//中信建投交易 case "16_0065":SERVNAME="1600051";break;//银河证券双子星 case "16_0066":SERVNAME="1600061";break;//掌上财经 case "16_0070":SERVNAME="1600069";break;//东方证券 case "16_0071":SERVNAME="1600070";break;//东方财富通 case "16_0076":SERVNAME="1500045";break;//搜狐财经 case "16_0077":SERVNAME="1500038";break;//新浪财经 case "16_0080":SERVNAME="2000061";break;//平安金管家 case "16_7003":SERVNAME="1600044";break;//黄金白银在线行情分析软件 case "16_7004":SERVNAME="1600056";break;//口袋贵金属 case "16_7005":SERVNAME="1600066";break;//易阳指 case "16_7006":SERVNAME="1600081";break;//和讯股道 case "16_7010":SERVNAME="1700084";break;//沃百富 case "16_7036":SERVNAME="1600092";break;//9188彩票 case "16_7042":SERVNAME="1600094";break;//51信用卡管家 case "16_7113":SERVNAME="2000062";break;//小米金融 case "16_7297":SERVNAME="1600036";break;//广发证券 case "16_7298":SERVNAME="1500039";break;//东方财富网 case "16_7299":SERVNAME="1500040";break;//凤凰财经 case "16_7300":SERVNAME="1600008";break;//国信证券 case "16_7301":SERVNAME="1600050";break;//招商证券 case "16_7302":SERVNAME="1600062";break;//国元证券 case "16_7303":SERVNAME="1600064";break;//平安证券安e理财 case "16_7304":SERVNAME="1600074";break;//海通证券 case "17_0004":SERVNAME="2000110";break;//QQ安全中心 case "17_0007":SERVNAME="257";break;//安全管家 case "17_0013":SERVNAME="251";break;//360手机卫士 case "17_0015":SERVNAME="252";break;//百度手机卫士 case "17_0016":SERVNAME="253";break;//腾讯手机管家 case "17_0017":SERVNAME="254";break;//LBE安全大师 case "17_0018":SERVNAME="255";break;//金山手机卫士 case "17_0019":SERVNAME="256";break;//金山毒霸 case "17_0027":SERVNAME="2000090";break;//360清理大师 case "17_7001":SERVNAME="1900165";break;//360锁屏 case "17_7006":SERVNAME="1900168";break;//摩安卫士 case "18_0001":SERVNAME="1500003";break;//手机淘宝 case "18_0002":SERVNAME="612";break;//京东 case "18_0004":SERVNAME="613";break;//1号店 case "18_0005":SERVNAME="619";break;//当当 case "18_0007":SERVNAME="1500069";break;//拉手团购 case "18_0008":SERVNAME="2000028";break;//美团 case "18_0010":SERVNAME="617";break;//聚划算 case "18_0011":SERVNAME="2000031";break;//团800 case "18_0012":SERVNAME="1500093";break;//聚美优品 case "18_0013":SERVNAME="1500098";break;//乐蜂网 case "18_0015":SERVNAME="2000030";break;//百度糯米 case "18_0016":SERVNAME="614";break;//苏宁易购 case "18_0018":SERVNAME="611";break;//天猫 case "18_0020":SERVNAME="620";break;//唯品会 case "18_0022":SERVNAME="621";break;//折800 case "19_0001":SERVNAME="2000042";break;//携程出行 case "19_0002":SERVNAME="2000043";break;//去哪儿旅行 case "19_0003":SERVNAME="2000085";break;//掌上链家 case "19_0004":SERVNAME="1500073";break;//艺龙 case "19_0005":SERVNAME="1500097";break;//途牛旅游 case "19_0006":SERVNAME="1500100";break;//7天连锁酒店 case "19_0007":SERVNAME="2000044";break;//铁路12306 case "19_0015":SERVNAME="761";break;//滴滴出行 case "19_0018":SERVNAME="762";break;//易到 case "19_0026":SERVNAME="1900094";break;//快的打车 case "19_0029":SERVNAME="1900151";break;//航班管家 case "19_0031":SERVNAME="400021";break;//爱帮公交 case "19_0038":SERVNAME="1900142";break;//蚂蜂窝 case "19_0041":SERVNAME="400028";break;//航旅纵横 case "19_0049":SERVNAME="1500106";break;//火车票网 case "19_0051":SERVNAME="781";break;//ofo case "19_0052":SERVNAME="780";break;//摩拜单车 case "19_0053":SERVNAME="2000046";break;//飞猪 case "20_0001":SERVNAME="720";break;//百度网盘 case "20_0002":SERVNAME="1200037";break;//纳米盘 case "20_0004":SERVNAME="723";break;//微云 case "20_0008":SERVNAME="722";break;//金山快盘 case "20_0009":SERVNAME="725";break;//华为网盘 case "20_0010":SERVNAME="1900098";break;//有道云笔记 case "20_0011":SERVNAME="2000054";break;//neame云笔记 case "20_0012":SERVNAME="1200034";break;//ClubBox case "20_0013":SERVNAME="1500028";break;//百度云 case "20_0015":SERVNAME="724";break;//115网盘 case "23_0003":SERVNAME="2000116";break;//虎牙直播 case "23_0008":SERVNAME="800176";break;//风云直播 case "23_0010":SERVNAME="2000118";break;//西瓜视频 case "69_0013":SERVNAME="2000106";break;//墨迹天气 case "69_0014":SERVNAME="1900002";break;//UC桌面 case "69_0015":SERVNAME="1900003";break;//手机百事通 case "69_0016":SERVNAME="1900004";break;//条码识别 case "69_0018":SERVNAME="1900006";break;//AppleJuice case "69_0019":SERVNAME="1900007";break;//AppleUpdate case "69_0020":SERVNAME="1900008";break;//GoogleDesktop case "69_0022":SERVNAME="1900146";break;//GooglePicasa case "69_0023":SERVNAME="1900010";break;//GoogleToolbar case "69_0028":SERVNAME="2000074";break;//网易有道词典 case "69_0029":SERVNAME="2000077";break;//百度翻译 case "69_0030":SERVNAME="2000108";break;//天气通 case "69_0035":SERVNAME="1900164";break;//中国天气 case "69_0040":SERVNAME="2000007";break;//搜狗输入法 case "69_0041":SERVNAME="2000010";break;//百度输入法 case "69_0042":SERVNAME="2000008";break;//讯飞输入法 case "69_0043":SERVNAME="2000009";break;//QQ输入法 case "69_0044":SERVNAME="2000011";break;//触宝输入法 case "69_0052":SERVNAME="1900099";break;//我查查 case "69_0054":SERVNAME="1900021";break;//名片全能王 case "69_0056":SERVNAME="2000047";break;//美图秀秀 case "69_0057":SERVNAME="2000050";break;//相机360 case "69_0066":SERVNAME="1900027";break;//随手记 case "69_0068":SERVNAME="2000109";break;//万年历 case "69_0069":SERVNAME="2000105";break;//中华万年历 case "69_0074":SERVNAME="400027";break;//路路通 case "69_0083":SERVNAME="2000041";break;//咕咚 case "69_0089":SERVNAME="1900159";break;//Flurry case "69_0094":SERVNAME="2000163";break;//友盟分析 case "69_0103":SERVNAME="1900135";break;//有米广告 case "69_0111":SERVNAME="2000091";break;//WIFI万能钥匙 case "69_0133":SERVNAME="1900038";break;//快牙 case "69_0157":SERVNAME="2000053";break;//WPS Office case "69_0159":SERVNAME="2000048";break;//美颜相机 case "69_0161":SERVNAME="2000051";break;//天天P图 case "69_0169":SERVNAME="2000039";break;//Keep case "69_0174":SERVNAME="1900064";break;//金山词霸 case "69_0180":SERVNAME="1900121";break;//谷歌拼音输入法 case "69_0183":SERVNAME="2000089";break;//QQ同步助手 case "69_0188":SERVNAME="2000071";break;//探探 case "69_0191":SERVNAME="2000103";break;//亲宝宝 case "69_0194":SERVNAME="2000102";break;//宝宝知道 case "69_7010":SERVNAME="1900019";break;//生活百事通 case "69_7011":SERVNAME="1900016";break;//盛名列车时刻表 case "69_7012":SERVNAME="1600059";break;//卡卡记账 case "69_7014":SERVNAME="1900017";break;//生日管家 case "69_7017":SERVNAME="1900046";break;//91桌面 case "69_7018":SERVNAME="1900056";break;//e警工场 case "69_7019":SERVNAME="1900147";break;//绿豆刷机神器 case "69_7085":SERVNAME="2000119";break;//阿里云 case "69_7094":SERVNAME="1900144";break;//极光推送 case "69_7114":SERVNAME="2000021";break;//360浏览器 case "69_7115":SERVNAME="2000020";break;//百度浏览器 case "69_7122":SERVNAME="2000022";break;//2345浏览器 case "69_7158":SERVNAME="100082";break;//结伴游 case "69_7160":SERVNAME="200041";break;//粉粉日记 case "69_7169":SERVNAME="200045";break;//知乎日报 case "69_7171":SERVNAME="200038";break;//虎嗅 case "69_7172":SERVNAME="200062";break;//Vista看天下 case "69_7173":SERVNAME="200046";break;//参考消息 case "69_7176":SERVNAME="1600043";break;//彩票365 case "69_7178":SERVNAME="1900041";break;//114火车票 case "69_7182":SERVNAME="2000045";break;//百度旅游 case "69_7183":SERVNAME="1900109";break;//悠哉旅游 case "69_7184":SERVNAME="1900136";break;//凯撒旅游 case "69_7192":SERVNAME="1900078";break;//乐记事 case "69_7197":SERVNAME="1900154";break;//药品通 case "69_7198":SERVNAME="1900049";break;//号码百事通 case "69_7199":SERVNAME="1900075";break;//美丽中国 case "69_7200":SERVNAME="1900080";break;//ET天气 case "69_7224":SERVNAME="100073";break;//不得姐的秘密 case "69_7259":SERVNAME="2000088";break;//小猪短租 case "69_7269":SERVNAME="2000059";break;//大街网 case "69_7295":SERVNAME="1900024";break;//超级火车票 case "69_7337":SERVNAME="763";break;//神州专车 case "69_7348":SERVNAME="1900058";break;//为知笔记 case "69_7408":SERVNAME="1900057";break;//拍秀 case "69_7409":SERVNAME="1900091";break;//水印相机 case "69_7435":SERVNAME="1900079";break;//CC来电炫图 case "69_7512":SERVNAME="634";break;//百度钱包 case "69_7652":SERVNAME="1900040";break;//91黄历天气 case "69_7749":SERVNAME="100064";break;//飞语 case "69_8042":SERVNAME="200074";break;//微软必应词典 case "69_8071":SERVNAME="500053";break;//联通掌上视频 case "69_8083":SERVNAME="622";break;//爱淘宝 case "69_8148":SERVNAME="2000086";break;//乐居买房 case "69_8402":SERVNAME="1900122";break;//个推 case "69_8516":SERVNAME="1900050";break;//大拇指旅行 case "69_8518":SERVNAME="1900152";break;//快捷酒店管家 case "69_8529":SERVNAME="1900167";break;//安卓系统管家 case "69_8567":SERVNAME="1900043";break;//海卓HiAPN case "69_8571":SERVNAME="100078";break;//街旁 case "69_8603":SERVNAME="1500003";break;//手机淘宝 case "69_8604":SERVNAME="1500003";break;//手机淘宝 case "69_8605":SERVNAME="2000134";break;//天猫直播 case "69_8618":SERVNAME="1700100";break;//WO+创富 case "69_8626":SERVNAME="2000099";break;//微盘 case "69_8650":SERVNAME="800162";break;//会说话的狗狗本 case "69_8654":SERVNAME="2000037";break;//美柚经期助手 case "69_8765":SERVNAME="2000101";break;//孕育管家 case "69_9165":SERVNAME="2000026";break;//神州租车 case "69_9482":SERVNAME="1700043";break;//联通流量管家 case "69_9485":SERVNAME="1700012";break;//中国联通手机营业厅 case "69_9541":SERVNAME="1900137";break;//口碑网 case "69_9552":SERVNAME="1700030";break;//联通手机电视 case "69_9554":SERVNAME="2000024";break;//小鸣单车 case "69_9562":SERVNAME="2000025";break;//优拜单车 case "69_9571":SERVNAME="1900013";break;//号码管家(PIM) case "69_9572":SERVNAME="1900012";break;//ThinkFree //case "17_0019":SERVNAME="2000111";break;//金山手机毒霸 //case "06_0038":SERVNAME="2000112";break;//喜马拉雅FM //case "02_0031":SERVNAME="2000098";break;//宜搜搜索 //case "15_0113":SERVNAME="2000060";break;//智通人才网 } return SERVNAME; } //协议识别 public static String L7_TYPE(String s){ String L7_TYPE = ""; switch(s) { case "3":L7_TYPE="200";break;//WAP协议 case "1":L7_TYPE="201";break;//HTTP协议 case "7":L7_TYPE="202";break;//HTTPS协议 case "13":L7_TYPE="400";break;//RTSP协议 case "9":L7_TYPE="500";break;//SMTP协议 case "10":L7_TYPE="501";break;//POP3协议 //case "9":L7_TYPE="502";break;//SMTPS //case "10":L7_TYPE="503";break;//POP3S case "11":L7_TYPE="504";break;//IMAP4协议 case "14":L7_TYPE="600";break;//SIP协议 case "6":L7_TYPE="700";break;//FTP协议 case "21":L7_TYPE="902";break;//DHCP case "18":L7_TYPE="904";break;//SNMP case "17":L7_TYPE="905";break;//SSH case "20":L7_TYPE="907";break;//Telnet case "42":L7_TYPE="909";break;//NETBIOS //case "42":L7_TYPE="910";break;//LDAP case "4":L7_TYPE="912";break;//DNS } return L7_TYPE; } //动作识别 public static String MENTHOD(String s){ String MENTHOD = ""; switch(s) { case "1":MENTHOD="6";break;//CONNECT case "2":MENTHOD="5";break;//HEAD case "3":MENTHOD="3";break;//PUT case "4":MENTHOD="4";break;//DELETE case "5":MENTHOD="2";break;//POST case "6":MENTHOD="1";break;//GET case "7":MENTHOD="8";break;//TRACE case "8":MENTHOD="7";break;//OPTIONS } return MENTHOD; } public static String ActType(String actt,String S25,String S34,String S35) { String ret=""; boolean b = S34.length()> S35.length(); switch (S25) { case "1":if(b)ret="4"; else ret="5";break; case "2":if(b)ret="6"; else ret="7";break; case "3":if(b)ret="11"; else ret="12";break; case "4":if(b)ret="13"; else ret="14";break; case "5":ret="9";break; case "6":ret="10";break; case "7": case "8": case "9": ret="15";break; } if(!ret.equals("") && !actt.contains(ret)) { actt=String.format("{0}{1};",actt,ret); } return actt; } }
3f1fbeed3b1fd53082ed02f8912feb900d44dc12
6e829aec7b55462078c9be5c5a45f8c639094b26
/src/EstimacionAceros/ViewEstimacionAceros.java
a0e2f40fac7225b4be5ebfe8cf9f83c1ac725792
[]
no_license
dnsdirmx/generadores2014
53c4657b44cf8ef0391632b84310a3b112776f25
6a241cfb2e6037324f963c9afdf0ee3c3044a00f
refs/heads/master
2021-01-24T17:36:31.633696
2016-06-14T21:14:15
2016-06-14T21:14:15
47,208,265
0
0
null
null
null
null
UTF-8
Java
false
false
9,818
java
package EstimacionAceros; import javax.swing.JInternalFrame; import javax.swing.JScrollPane; import javax.swing.JLabel; import javax.swing.JComboBox; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.JTextField; import javax.swing.JTable; import javax.swing.table.DefaultTableModel; import MetodosRemotos.Metodos; public class ViewEstimacionAceros extends JInternalFrame { /** * */ private static final long serialVersionUID = 1L; private JTextField txtLong_1; private JTextField txtLong_2; private JTextField txtLong_4; private JTextField txtLong_9; private JTextField txtLong_3; private JTextField txtLong_5; private JTextField txtLong_6; private JTextField txtLong_7; private JTextField txtLong_8; private JTextField txtKilo_1; private JTextField txtKilo_2; private JTextField txtKilo_4; private JTextField txtKilo_3; private JTextField txtKilo_5; private JTextField txtKilo_6; private JTextField txtKilo_7; private JTextField txtKilo_8; private JTextField txtKilo_9; private JTextField textField; private JTextField textField_1; private JTextField textField_2; private JTextField textField_3; private JTextField textField_4; private JTextField textField_5; private JTextField textField_6; private JTextField textField_7; private JTextField textField_8; private JTable tabAspectosBD; private JTable table_2; private Metodos conn; /** * @return the conn */ public Metodos getConn() { return conn; } /** * @param conn the conn to set */ public void setConn(Metodos conn) { this.conn = conn; } /** * Create the frame. */ public ViewEstimacionAceros(Metodos conn) { super( "Generador de N\u00FAmeros de Aceros", false, true, false, true ); setVisible(true); setClosable(true); setBounds(100, 100, 1000, 722); getContentPane().setLayout(null); this.setConn(conn); JScrollPane scrollAspectosBD = new JScrollPane(); scrollAspectosBD.setBounds(10, 61, 972, 186); getContentPane().add(scrollAspectosBD); tabAspectosBD = new JTable(); tabAspectosBD.setModel(new DefaultTableModel( new Object[][] { {null, null}, {null, null}, {null, null}, {null, null}, {null, null}, {null, null}, {null, null}, }, new String[] { "Selecci\u00F3n", "Descripci\u00F3n" } )); scrollAspectosBD.setViewportView(tabAspectosBD); JScrollPane scrollAspectosGenerador = new JScrollPane(); scrollAspectosGenerador.setBounds(10, 284, 972, 264); getContentPane().add(scrollAspectosGenerador); table_2 = new JTable(); table_2.setModel(new DefaultTableModel( new Object[][] { {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}, {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null}, }, new String[] { "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column" } )); scrollAspectosGenerador.setViewportView(table_2); JLabel lblDesgloseDeConceptos = new JLabel("Desglose de Conceptos Agregados a la estimaci\u00F3n"); lblDesgloseDeConceptos.setBounds(10, 258, 304, 14); getContentPane().add(lblDesgloseDeConceptos); JLabel lblConceptos = new JLabel("Desglose de Conceptos de Acero"); lblConceptos.setBounds(10, 36, 200, 14); getContentPane().add(lblConceptos); JLabel lblConsultor = new JLabel("Consultor:"); lblConsultor.setBounds(10, 11, 81, 14); getContentPane().add(lblConsultor); JLabel lblLongitudTotal = new JLabel("Longitud Total:"); lblLongitudTotal.setHorizontalAlignment(SwingConstants.RIGHT); lblLongitudTotal.setBounds(312, 560, 81, 14); getContentPane().add(lblLongitudTotal); JLabel lblKg = new JLabel("KG de Varilla:"); lblKg.setHorizontalAlignment(SwingConstants.RIGHT); lblKg.setBounds(312, 588, 81, 14); getContentPane().add(lblKg); JLabel lblPesoTotal = new JLabel("Peso Total:"); lblPesoTotal.setHorizontalAlignment(SwingConstants.RIGHT); lblPesoTotal.setBounds(322, 614, 71, 14); getContentPane().add(lblPesoTotal); JLabel lblExportarEstimacin = new JLabel("Exportar Estimaci\u00F3n:"); lblExportarEstimacin.setBounds(248, 648, 119, 14); getContentPane().add(lblExportarEstimacin); JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] {"Excel ", "PDF"})); comboBox.setBounds(368, 645, 142, 20); getContentPane().add(comboBox); JButton btnGuardarSinExportar = new JButton("Guardar sin Exportar "); btnGuardarSinExportar.setBounds(522, 640, 158, 30); getContentPane().add(btnGuardarSinExportar); txtLong_1 = new JTextField(); txtLong_1.setEditable(false); txtLong_1.setBounds(397, 549, 65, 30); getContentPane().add(txtLong_1); txtLong_1.setColumns(10); txtLong_2 = new JTextField(); txtLong_2.setEditable(false); txtLong_2.setBounds(462, 549, 66, 30); getContentPane().add(txtLong_2); txtLong_2.setColumns(10); txtLong_4 = new JTextField(); txtLong_4.setEditable(false); txtLong_4.setBounds(592, 549, 65, 30); getContentPane().add(txtLong_4); txtLong_4.setColumns(10); txtLong_9 = new JTextField(); txtLong_9.setEditable(false); txtLong_9.setBounds(917, 549, 65, 30); getContentPane().add(txtLong_9); txtLong_9.setColumns(10); txtLong_3 = new JTextField(); txtLong_3.setEditable(false); txtLong_3.setBounds(527, 549, 65, 30); getContentPane().add(txtLong_3); txtLong_3.setColumns(10); txtLong_5 = new JTextField(); txtLong_5.setEditable(false); txtLong_5.setBounds(657, 549, 65, 30); getContentPane().add(txtLong_5); txtLong_5.setColumns(10); txtLong_6 = new JTextField(); txtLong_6.setEditable(false); txtLong_6.setBounds(722, 549, 65, 30); getContentPane().add(txtLong_6); txtLong_6.setColumns(10); txtLong_7 = new JTextField(); txtLong_7.setEditable(false); txtLong_7.setBounds(787, 549, 65, 30); getContentPane().add(txtLong_7); txtLong_7.setColumns(10); txtLong_8 = new JTextField(); txtLong_8.setEditable(false); txtLong_8.setBounds(852, 549, 65, 30); getContentPane().add(txtLong_8); txtLong_8.setColumns(10); txtKilo_1 = new JTextField(); txtKilo_1.setEditable(false); txtKilo_1.setColumns(10); txtKilo_1.setBounds(397, 577, 65, 30); getContentPane().add(txtKilo_1); txtKilo_2 = new JTextField(); txtKilo_2.setEditable(false); txtKilo_2.setColumns(10); txtKilo_2.setBounds(462, 577, 66, 30); getContentPane().add(txtKilo_2); txtKilo_4 = new JTextField(); txtKilo_4.setEditable(false); txtKilo_4.setColumns(10); txtKilo_4.setBounds(592, 577, 65, 30); getContentPane().add(txtKilo_4); txtKilo_3 = new JTextField(); txtKilo_3.setEditable(false); txtKilo_3.setColumns(10); txtKilo_3.setBounds(527, 577, 65, 30); getContentPane().add(txtKilo_3); txtKilo_5 = new JTextField(); txtKilo_5.setEditable(false); txtKilo_5.setColumns(10); txtKilo_5.setBounds(657, 577, 65, 30); getContentPane().add(txtKilo_5); txtKilo_6 = new JTextField(); txtKilo_6.setEditable(false); txtKilo_6.setColumns(10); txtKilo_6.setBounds(722, 577, 65, 30); getContentPane().add(txtKilo_6); txtKilo_7 = new JTextField(); txtKilo_7.setEditable(false); txtKilo_7.setColumns(10); txtKilo_7.setBounds(787, 577, 65, 30); getContentPane().add(txtKilo_7); txtKilo_8 = new JTextField(); txtKilo_8.setEditable(false); txtKilo_8.setColumns(10); txtKilo_8.setBounds(852, 577, 65, 30); getContentPane().add(txtKilo_8); txtKilo_9 = new JTextField(); txtKilo_9.setEditable(false); txtKilo_9.setColumns(10); txtKilo_9.setBounds(917, 577, 65, 30); getContentPane().add(txtKilo_9); textField = new JTextField(); textField.setEditable(false); textField.setColumns(10); textField.setBounds(397, 606, 65, 30); getContentPane().add(textField); textField_1 = new JTextField(); textField_1.setEditable(false); textField_1.setColumns(10); textField_1.setBounds(462, 606, 66, 30); getContentPane().add(textField_1); textField_2 = new JTextField(); textField_2.setEditable(false); textField_2.setColumns(10); textField_2.setBounds(527, 606, 65, 30); getContentPane().add(textField_2); textField_3 = new JTextField(); textField_3.setEditable(false); textField_3.setColumns(10); textField_3.setBounds(592, 606, 65, 30); getContentPane().add(textField_3); textField_4 = new JTextField(); textField_4.setEditable(false); textField_4.setColumns(10); textField_4.setBounds(657, 606, 65, 30); getContentPane().add(textField_4); textField_5 = new JTextField(); textField_5.setEditable(false); textField_5.setColumns(10); textField_5.setBounds(722, 606, 65, 30); getContentPane().add(textField_5); textField_6 = new JTextField(); textField_6.setEditable(false); textField_6.setColumns(10); textField_6.setBounds(787, 606, 65, 30); getContentPane().add(textField_6); textField_7 = new JTextField(); textField_7.setEditable(false); textField_7.setColumns(10); textField_7.setBounds(852, 606, 65, 30); getContentPane().add(textField_7); textField_8 = new JTextField(); textField_8.setEditable(false); textField_8.setColumns(10); textField_8.setBounds(917, 606, 65, 30); getContentPane().add(textField_8); } }
8b8eb1d2cb0e5961ffc41166b32f1588212d1899
4e16b256aec7c0ddc5510b36e2346531727dadbc
/sixthgroup/src/main/java/sixth/sixthgroup/service/impl/UserServiceImpl.java
8739dff3328a41aa8fd77d27e62c1ffe866c7fdf
[]
no_license
julyying/counselor-assistant
080177b7b86c2b05c1085b5fbcb9adddf13cce6e
d28b00f19858ab235d23a12fcc4e4aad9a78807b
refs/heads/master
2021-01-10T09:28:33.292254
2016-03-04T14:17:27
2016-03-04T14:17:27
53,136,879
1
1
null
null
null
null
UTF-8
Java
false
false
3,192
java
package sixth.sixthgroup.service.impl; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import sixth.sixthgroup.dao.UserMapper; import sixth.sixthgroup.model.ClassAccount; import sixth.sixthgroup.model.User; import sixth.sixthgroup.service.UserService; @Service("userService") public class UserServiceImpl implements UserService { private UserMapper userMapper; public UserMapper getUserMapper() { return userMapper; } @Autowired public void setUserMapper(UserMapper userMapper) { this.userMapper = userMapper; } /** * 查找用户 * 参数 id * 返回值 User */ @SuppressWarnings("finally") public User findUserById(int id) throws Exception { // TODO Auto-generated method stub User user=new User(); try{ user=userMapper.selectByPrimaryKey(id); }catch (Exception e) { e.printStackTrace(); }finally{ return user; } } /** * 查找用户 * 参数 loginnaem,password * 返回值 User */ @SuppressWarnings("finally") public User findUserByNameAndPassword(String loginnaem, String password) throws Exception { // TODO Auto-generated method stub User user = new User(); user.setUserName(loginnaem); user.setUserPassword(password); User myUser=new User(); try{ myUser=this.userMapper.slectUserByNameAndPasword(user); }catch (Exception e) { e.printStackTrace(); }finally{ return myUser; } } /** * 添加一个用户 * 参数 loginname password userpower * 返回值 int */ @SuppressWarnings("finally") public int insertUser(String loginname, String password, int userpower) throws Exception { // TODO Auto-generated method stub int key=0; User user = new User(); user.setUserName(loginname); user.setUserPassword(password); user.setUserPower(userpower); try{ User reUser=new User(); reUser=this.findUserByNameAndPassword(loginname, password); if(reUser==null){ key=this.userMapper.insert(user); } System.out.println(key); }catch(Exception e){ e.printStackTrace(); }finally{ return key; } } public int insertUser(User user) throws Exception { // TODO Auto-generated method stub int key=0; User reUser = new User(); reUser=this.findUserByNameAndPassword(user.getUserName(), user.getUserPassword()); if(reUser==null){ key=this.userMapper.insert(user); } return key; } public List<ClassAccount> selectAll() { // TODO Auto-generated method stub List<ClassAccount> list=this.userMapper.selectAll(); return list; } public int deleteOne(int gradId) { // TODO Auto-generated method stub int key =0; key = this.userMapper.deleteOne(gradId); return key; } public int updateOne(int gradId, String studNum, String userName, String userPassword) { // TODO Auto-generated method stub Map<String, Object> params=new HashMap<String, Object>(); params.put("gradId", gradId); params.put("studNum", studNum); params.put("userName", userName); params.put("userPassword", userPassword); int key = 0; key = this.userMapper.updateOne(params); return key; } }
be4accd2c486257e9b22386921df3e5aa21299d7
9a6ea6087367965359d644665b8d244982d1b8b6
/src/main/java/X/C60672pw.java
a5640549e0484d8a010b67fde68314ab861b9446
[]
no_license
technocode/com.wa_2.21.2
a3dd842758ff54f207f1640531374d3da132b1d2
3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9
refs/heads/master
2023-02-12T11:20:28.666116
2021-01-14T10:22:21
2021-01-14T10:22:21
329,578,591
2
1
null
null
null
null
UTF-8
Java
false
false
1,563
java
package X; import android.content.Context; import android.os.Build; import android.text.Editable; import android.util.AttributeSet; import android.view.KeyEvent; /* renamed from: X.2pw reason: invalid class name and case insensitive filesystem */ public class C60672pw extends AbstractC463429i { public static final Editable.Factory A01 = new AnonymousClass2HS(); public AnonymousClass2HT A00; public C60672pw(Context context, AttributeSet attributeSet) { super(context, attributeSet); if (!isInEditMode()) { AnonymousClass03P.A00(); } setEditableFactory(A01); setCustomSelectionActionModeCallback(new AnonymousClass2HR(this)); } public boolean onKeyPreIme(int i, KeyEvent keyEvent) { AnonymousClass2HT r0 = this.A00; if (r0 != null) { r0.AGv(i, keyEvent); } return super.onKeyPreIme(i, keyEvent); } @Override // com.whatsapp.WaEditText public boolean onTextContextMenuItem(int i) { if (Build.VERSION.SDK_INT >= 23 && i == 16908322) { i = 16908337; } return super.onTextContextMenuItem(i); } public void setInputEnterDone(boolean z) { int i = 0; if (z) { i = 6; } setInputEnterAction(i); } public void setInputEnterSend(boolean z) { int i = 0; if (z) { i = 4; } setInputEnterAction(i); } public void setOnKeyPreImeListener(AnonymousClass2HT r1) { this.A00 = r1; } }
1187f3687b08374f33b879700e1773f1a9ceb1d8
9dfdf5f46794ea8d054a412ceecfc1c34d0660fa
/homeWork1/src/main/java/HomeWork1/Application.java
024182fc6d6743c75034d7db89ac0165c332900c
[]
no_license
vld7wn/Lanit
5301ee77023f4f198fe3e7d2a0a7d6bf7fd2b13a
d34f1ca15f867a19a8140a96b26233ae01d051e9
refs/heads/main
2023-05-09T23:41:17.235495
2021-05-31T20:14:56
2021-05-31T20:14:56
358,969,069
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
import model.Kotik; public class Application { public static void main(String[] args) throws InterruptedException { Kotik first = new Kotik("String", 10, 5, "meow"); Kotik second = new Kotik(); second.setName("name"); second.setWeight(5); second.setPrettiness(2); second.setMeow("gav"); first.liveAnotherDay(); System.out.println("Name: " + first.getName() + " " + "Weight: " + first.getWeight()); if (first.getMeow().equals(second.getMeow())) System.out.println ("Мы разговариваем одинаково))"); else System.out.println("Мы разные(("); System.out.println(Kotik.getCounter()); } }
f521e857d279cb47863b6b1a6e2604b4ff6cf219
5f1be6f4d43dcd30b8f098b389dd1f955302b0f1
/src/main/java/fr/esiea/unique/debout/naudet/Main.java
a1cb318508ad7b93ed5417945697b6c48c0c0e0d
[]
no_license
tuobed/ARCHITECTURE_DEBOUT_NAUDET
3cef1cbd39ce4435957cc31d4f71e7cf8bae537d
59e06d7a0f4c2ab506cf5481ce22a4ec31973a21
refs/heads/master
2021-01-21T05:09:51.114090
2017-03-03T19:50:41
2017-03-03T19:50:41
83,137,113
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
834
java
package fr.esiea.unique.debout.naudet; import java.util.InputMismatchException; import java.util.Scanner; public class Main { //C'est la classe principale qui lance le programme public static void main(String[] args) { int x; int rep=0; Scanner sc = null; while(rep==0){ try { System.out.println("Bonjour et bienvenue dans notre jeu letterGame"); System.out.println("Pour jouer tout seul taper 1, pour jouer ŕ deux taper 2"); sc = new Scanner(System.in); x = sc.nextInt(); if(x==1){ Game jeu = new Game(); jeu.main(1); rep=1; } else if(x==2) { Game jeu = new Game(); jeu.main(2); rep=1; } } catch(InputMismatchException e){ System.out.println("vous n'avez pas entré 1 ou 2 !"); } } sc.close(); } }
4327dc42561fe664ba6f080056bb708c9ee0636a
d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb
/PROMISE/archives/ivy/2.0/org/apache/ivy/.svn/pristine/43/4327dc42561fe664ba6f080056bb708c9ee0636a.svn-base
85e45a63197b48083918ef987759b5b5ce79ff81
[]
no_license
hvdthong/DEFECT_PREDICTION
78b8e98c0be3db86ffaed432722b0b8c61523ab2
76a61c69be0e2082faa3f19efd76a99f56a32858
refs/heads/master
2021-01-20T05:19:00.927723
2018-07-10T03:38:14
2018-07-10T03:38:14
89,766,606
5
1
null
null
null
null
UTF-8
Java
false
false
7,508
/* * 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.ivy.util; import java.io.ByteArrayOutputStream; import java.io.PrintWriter; import java.lang.reflect.InvocationTargetException; import java.util.Locale; /** * Convenient class used only for uncapitalization Usually use commons lang but here we do not want * to have such a dependency for only one feature */ public final class StringUtils { private StringUtils() { //Utility class } public static String uncapitalize(String string) { if (string == null || string.length() == 0) { return string; } if (string.length() == 1) { return string.toLowerCase(Locale.US); } return string.substring(0, 1).toLowerCase(Locale.US) + string.substring(1); } /** * Returns the error message associated with the given Throwable. The error message returned * will try to be as precise as possible, handling cases where e.getMessage() is not meaningful, * like {@link NullPointerException} for instance. * * @param t * the throwable to get the error message from * @return the error message of the given exception */ public static String getErrorMessage(Throwable t) { if (t == null) { return ""; } if (t instanceof InvocationTargetException) { InvocationTargetException ex = (InvocationTargetException) t; t = ex.getTargetException(); } String errMsg = t instanceof RuntimeException ? t.getMessage() : t.toString(); if (errMsg == null || errMsg.length() == 0 || "null".equals(errMsg)) { errMsg = t.getClass().getName() + " at " + t.getStackTrace()[0].toString(); } return errMsg; } /** * Returns the exception stack trace as a String. * * @param e * the exception to get the stack trace from. * @return the exception stack trace */ public static String getStackTrace(Exception e) { if (e == null) { return ""; } ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintWriter printWriter = new PrintWriter(baos); e.printStackTrace(printWriter); printWriter.flush(); String stackTrace = new String(baos.toByteArray()); printWriter.close(); return stackTrace; } /** * Joins the given object array in one string, each separated by the given separator. * * Example: * <pre> * join(new String[] {"one", "two", "three"}, ", ") -> "one, two, three" * </pre> * * @param objs The array of objects (<code>toString()</code> is used). * @param sep The separator to use. * @return The concatinated string. */ public static String join(Object[] objs, String sep) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < objs.length; i++) { buf.append(objs[i]).append(sep); } if (objs.length > 0) { buf.setLength(buf.length() - sep.length()); // delete sep } return buf.toString(); } // basic string codec (same algo as CVS passfile, inspired by ant CVSPass class /** Array contain char conversion data */ private static final char[] SHIFTS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 114, 120, 53, 79, 96, 109, 72, 108, 70, 64, 76, 67, 116, 74, 68, 87, 111, 52, 75, 119, 49, 34, 82, 81, 95, 65, 112, 86, 118, 110, 122, 105, 41, 57, 83, 43, 46, 102, 40, 89, 38, 103, 45, 50, 42, 123, 91, 35, 125, 55, 54, 66, 124, 126, 59, 47, 92, 71, 115, 78, 88, 107, 106, 56, 36, 121, 117, 104, 101, 100, 69, 73, 99, 63, 94, 93, 39, 37, 61, 48, 58, 113, 32, 90, 44, 98, 60, 51, 33, 97, 62, 77, 84, 80, 85, 223, 225, 216, 187, 166, 229, 189, 222, 188, 141, 249, 148, 200, 184, 136, 248, 190, 199, 170, 181, 204, 138, 232, 218, 183, 255, 234, 220, 247, 213, 203, 226, 193, 174, 172, 228, 252, 217, 201, 131, 230, 197, 211, 145, 238, 161, 179, 160, 212, 207, 221, 254, 173, 202, 146, 224, 151, 140, 196, 205, 130, 135, 133, 143, 246, 192, 159, 244, 239, 185, 168, 215, 144, 139, 165, 180, 157, 147, 186, 214, 176, 227, 231, 219, 169, 175, 156, 206, 198, 129, 164, 150, 210, 154, 177, 134, 127, 182, 128, 158, 208, 162, 132, 167, 209, 149, 241, 153, 251, 237, 236, 171, 195, 243, 233, 253, 240, 194, 250, 191, 155, 142, 137, 245, 235, 163, 242, 178, 152}; /** * Encrypt the given string in a way which anybody having access to this method algorithm can * easily decrypt. This is useful only to avoid clear string storage in a file for example, but * shouldn't be considered as a real mean of security. This only works with simple characters * (char < 256). * * @param str * the string to encrypt * @return the encrypted version of the string */ public static final String encrypt(String str) { if (str == null) { return null; } StringBuffer buf = new StringBuffer(); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c >= SHIFTS.length) { throw new IllegalArgumentException( "encrypt method can only be used with simple characters. '" + c + "' not allowed"); } buf.append(SHIFTS[c]); } return buf.toString(); } /** * Decrypts a string encrypted with encrypt. * * @param str * the encrypted string to decrypt * @return The decrypted string. */ public static final String decrypt(String str) { if (str == null) { return null; } StringBuffer buf = new StringBuffer(); for (int i = 0; i < str.length(); i++) { buf.append(decrypt(str.charAt(i))); } return buf.toString(); } private static char decrypt(char c) { for (char i = 0; i < SHIFTS.length; i++) { if (SHIFTS[i] == c) { return i; } } throw new IllegalArgumentException("Impossible to decrypt '" + c + "'. Unhandled character."); } public static String repeat(String str, int count) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < count; i++) { sb.append(str); } return sb.toString(); } }
44a5d2b3a4a443db3ec10760db05a4acb85080c5
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-ws/results/MATH-98b-1-23-Single_Objective_GGA-WeightedSum/org/apache/commons/math/linear/BigMatrixImpl_ESTest_scaffolding.java
58530b6c0ccc03e28c5e8e6301ffa9006d0b976d
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
2,120
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Mon Mar 30 15:00:40 UTC 2020 */ package org.apache.commons.math.linear; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class BigMatrixImpl_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.linear.BigMatrixImpl"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BigMatrixImpl_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.math.linear.MatrixIndexException", "org.apache.commons.math.linear.InvalidMatrixException", "org.apache.commons.math.linear.BigMatrixImpl", "org.apache.commons.math.linear.BigMatrix" ); } }
c7591e6d77c5850019b5b7e7b2faeb1b40257e8d
eff64d00f22caf51ed7f59055c9d340174b30ba9
/pengMS/src/main/java/com/tcwong/pengms/model/example/DriverExample.java
5b6caea6c1229a0612a56c665b74e036d1bf1546
[ "Apache-2.0" ]
permissive
tcwong0909/pengExpressMS
70e4afc771f1ddac878a846c14dfc23709ac3884
035c136f3bc0ec8f00be5273105122c28765af8f
refs/heads/master
2023-04-01T14:15:16.915561
2021-03-19T15:44:09
2021-03-19T15:44:09
290,079,908
1
0
null
null
null
null
UTF-8
Java
false
false
32,068
java
package com.tcwong.pengms.model.example; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; public class DriverExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public DriverExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion( String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } protected void addCriterionForJDBCDate(String condition, Date value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } addCriterion(condition, new java.sql.Date(value.getTime()), property); } protected void addCriterionForJDBCDate( String condition, List<Date> values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException( "Value list for " + property + " cannot be null or empty"); } List<java.sql.Date> dateList = new ArrayList<java.sql.Date>(); Iterator<Date> iter = values.iterator(); while (iter.hasNext()) { dateList.add(new java.sql.Date(iter.next().getTime())); } addCriterion(condition, dateList, property); } protected void addCriterionForJDBCDate( String condition, Date value1, Date value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } addCriterion( condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); } public Criteria andDriveridIsNull() { addCriterion("driverID is null"); return (Criteria) this; } public Criteria andDriveridIsNotNull() { addCriterion("driverID is not null"); return (Criteria) this; } public Criteria andDriveridEqualTo(Integer value) { addCriterion("driverID =", value, "driverid"); return (Criteria) this; } public Criteria andDriveridNotEqualTo(Integer value) { addCriterion("driverID <>", value, "driverid"); return (Criteria) this; } public Criteria andDriveridGreaterThan(Integer value) { addCriterion("driverID >", value, "driverid"); return (Criteria) this; } public Criteria andDriveridGreaterThanOrEqualTo(Integer value) { addCriterion("driverID >=", value, "driverid"); return (Criteria) this; } public Criteria andDriveridLessThan(Integer value) { addCriterion("driverID <", value, "driverid"); return (Criteria) this; } public Criteria andDriveridLessThanOrEqualTo(Integer value) { addCriterion("driverID <=", value, "driverid"); return (Criteria) this; } public Criteria andDriveridIn(List<Integer> values) { addCriterion("driverID in", values, "driverid"); return (Criteria) this; } public Criteria andDriveridNotIn(List<Integer> values) { addCriterion("driverID not in", values, "driverid"); return (Criteria) this; } public Criteria andDriveridBetween(Integer value1, Integer value2) { addCriterion("driverID between", value1, value2, "driverid"); return (Criteria) this; } public Criteria andDriveridNotBetween(Integer value1, Integer value2) { addCriterion("driverID not between", value1, value2, "driverid"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andSexIsNull() { addCriterion("sex is null"); return (Criteria) this; } public Criteria andSexIsNotNull() { addCriterion("sex is not null"); return (Criteria) this; } public Criteria andSexEqualTo(Integer value) { addCriterion("sex =", value, "sex"); return (Criteria) this; } public Criteria andSexNotEqualTo(Integer value) { addCriterion("sex <>", value, "sex"); return (Criteria) this; } public Criteria andSexGreaterThan(Integer value) { addCriterion("sex >", value, "sex"); return (Criteria) this; } public Criteria andSexGreaterThanOrEqualTo(Integer value) { addCriterion("sex >=", value, "sex"); return (Criteria) this; } public Criteria andSexLessThan(Integer value) { addCriterion("sex <", value, "sex"); return (Criteria) this; } public Criteria andSexLessThanOrEqualTo(Integer value) { addCriterion("sex <=", value, "sex"); return (Criteria) this; } public Criteria andSexIn(List<Integer> values) { addCriterion("sex in", values, "sex"); return (Criteria) this; } public Criteria andSexNotIn(List<Integer> values) { addCriterion("sex not in", values, "sex"); return (Criteria) this; } public Criteria andSexBetween(Integer value1, Integer value2) { addCriterion("sex between", value1, value2, "sex"); return (Criteria) this; } public Criteria andSexNotBetween(Integer value1, Integer value2) { addCriterion("sex not between", value1, value2, "sex"); return (Criteria) this; } public Criteria andBirthIsNull() { addCriterion("birth is null"); return (Criteria) this; } public Criteria andBirthIsNotNull() { addCriterion("birth is not null"); return (Criteria) this; } public Criteria andBirthEqualTo(Date value) { addCriterionForJDBCDate("birth =", value, "birth"); return (Criteria) this; } public Criteria andBirthNotEqualTo(Date value) { addCriterionForJDBCDate("birth <>", value, "birth"); return (Criteria) this; } public Criteria andBirthGreaterThan(Date value) { addCriterionForJDBCDate("birth >", value, "birth"); return (Criteria) this; } public Criteria andBirthGreaterThanOrEqualTo(Date value) { addCriterionForJDBCDate("birth >=", value, "birth"); return (Criteria) this; } public Criteria andBirthLessThan(Date value) { addCriterionForJDBCDate("birth <", value, "birth"); return (Criteria) this; } public Criteria andBirthLessThanOrEqualTo(Date value) { addCriterionForJDBCDate("birth <=", value, "birth"); return (Criteria) this; } public Criteria andBirthIn(List<Date> values) { addCriterionForJDBCDate("birth in", values, "birth"); return (Criteria) this; } public Criteria andBirthNotIn(List<Date> values) { addCriterionForJDBCDate("birth not in", values, "birth"); return (Criteria) this; } public Criteria andBirthBetween(Date value1, Date value2) { addCriterionForJDBCDate("birth between", value1, value2, "birth"); return (Criteria) this; } public Criteria andBirthNotBetween(Date value1, Date value2) { addCriterionForJDBCDate("birth not between", value1, value2, "birth"); return (Criteria) this; } public Criteria andPhoneIsNull() { addCriterion("phone is null"); return (Criteria) this; } public Criteria andPhoneIsNotNull() { addCriterion("phone is not null"); return (Criteria) this; } public Criteria andPhoneEqualTo(String value) { addCriterion("phone =", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotEqualTo(String value) { addCriterion("phone <>", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThan(String value) { addCriterion("phone >", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThanOrEqualTo(String value) { addCriterion("phone >=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThan(String value) { addCriterion("phone <", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThanOrEqualTo(String value) { addCriterion("phone <=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLike(String value) { addCriterion("phone like", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotLike(String value) { addCriterion("phone not like", value, "phone"); return (Criteria) this; } public Criteria andPhoneIn(List<String> values) { addCriterion("phone in", values, "phone"); return (Criteria) this; } public Criteria andPhoneNotIn(List<String> values) { addCriterion("phone not in", values, "phone"); return (Criteria) this; } public Criteria andPhoneBetween(String value1, String value2) { addCriterion("phone between", value1, value2, "phone"); return (Criteria) this; } public Criteria andPhoneNotBetween(String value1, String value2) { addCriterion("phone not between", value1, value2, "phone"); return (Criteria) this; } public Criteria andIdcardIsNull() { addCriterion("IDCard is null"); return (Criteria) this; } public Criteria andIdcardIsNotNull() { addCriterion("IDCard is not null"); return (Criteria) this; } public Criteria andIdcardEqualTo(String value) { addCriterion("IDCard =", value, "idcard"); return (Criteria) this; } public Criteria andIdcardNotEqualTo(String value) { addCriterion("IDCard <>", value, "idcard"); return (Criteria) this; } public Criteria andIdcardGreaterThan(String value) { addCriterion("IDCard >", value, "idcard"); return (Criteria) this; } public Criteria andIdcardGreaterThanOrEqualTo(String value) { addCriterion("IDCard >=", value, "idcard"); return (Criteria) this; } public Criteria andIdcardLessThan(String value) { addCriterion("IDCard <", value, "idcard"); return (Criteria) this; } public Criteria andIdcardLessThanOrEqualTo(String value) { addCriterion("IDCard <=", value, "idcard"); return (Criteria) this; } public Criteria andIdcardLike(String value) { addCriterion("IDCard like", value, "idcard"); return (Criteria) this; } public Criteria andIdcardNotLike(String value) { addCriterion("IDCard not like", value, "idcard"); return (Criteria) this; } public Criteria andIdcardIn(List<String> values) { addCriterion("IDCard in", values, "idcard"); return (Criteria) this; } public Criteria andIdcardNotIn(List<String> values) { addCriterion("IDCard not in", values, "idcard"); return (Criteria) this; } public Criteria andIdcardBetween(String value1, String value2) { addCriterion("IDCard between", value1, value2, "idcard"); return (Criteria) this; } public Criteria andIdcardNotBetween(String value1, String value2) { addCriterion("IDCard not between", value1, value2, "idcard"); return (Criteria) this; } public Criteria andFkTeamidIsNull() { addCriterion("fk_teamID is null"); return (Criteria) this; } public Criteria andFkTeamidIsNotNull() { addCriterion("fk_teamID is not null"); return (Criteria) this; } public Criteria andFkTeamidEqualTo(Integer value) { addCriterion("fk_teamID =", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidNotEqualTo(Integer value) { addCriterion("fk_teamID <>", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidGreaterThan(Integer value) { addCriterion("fk_teamID >", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidGreaterThanOrEqualTo(Integer value) { addCriterion("fk_teamID >=", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidLessThan(Integer value) { addCriterion("fk_teamID <", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidLessThanOrEqualTo(Integer value) { addCriterion("fk_teamID <=", value, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidIn(List<Integer> values) { addCriterion("fk_teamID in", values, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidNotIn(List<Integer> values) { addCriterion("fk_teamID not in", values, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidBetween(Integer value1, Integer value2) { addCriterion("fk_teamID between", value1, value2, "fkTeamid"); return (Criteria) this; } public Criteria andFkTeamidNotBetween(Integer value1, Integer value2) { addCriterion("fk_teamID not between", value1, value2, "fkTeamid"); return (Criteria) this; } public Criteria andStateIsNull() { addCriterion("state is null"); return (Criteria) this; } public Criteria andStateIsNotNull() { addCriterion("state is not null"); return (Criteria) this; } public Criteria andStateEqualTo(Integer value) { addCriterion("state =", value, "state"); return (Criteria) this; } public Criteria andStateNotEqualTo(Integer value) { addCriterion("state <>", value, "state"); return (Criteria) this; } public Criteria andStateGreaterThan(Integer value) { addCriterion("state >", value, "state"); return (Criteria) this; } public Criteria andStateGreaterThanOrEqualTo(Integer value) { addCriterion("state >=", value, "state"); return (Criteria) this; } public Criteria andStateLessThan(Integer value) { addCriterion("state <", value, "state"); return (Criteria) this; } public Criteria andStateLessThanOrEqualTo(Integer value) { addCriterion("state <=", value, "state"); return (Criteria) this; } public Criteria andStateIn(List<Integer> values) { addCriterion("state in", values, "state"); return (Criteria) this; } public Criteria andStateNotIn(List<Integer> values) { addCriterion("state not in", values, "state"); return (Criteria) this; } public Criteria andStateBetween(Integer value1, Integer value2) { addCriterion("state between", value1, value2, "state"); return (Criteria) this; } public Criteria andStateNotBetween(Integer value1, Integer value2) { addCriterion("state not between", value1, value2, "state"); return (Criteria) this; } public Criteria andRemarkIsNull() { addCriterion("remark is null"); return (Criteria) this; } public Criteria andRemarkIsNotNull() { addCriterion("remark is not null"); return (Criteria) this; } public Criteria andRemarkEqualTo(String value) { addCriterion("remark =", value, "remark"); return (Criteria) this; } public Criteria andRemarkNotEqualTo(String value) { addCriterion("remark <>", value, "remark"); return (Criteria) this; } public Criteria andRemarkGreaterThan(String value) { addCriterion("remark >", value, "remark"); return (Criteria) this; } public Criteria andRemarkGreaterThanOrEqualTo(String value) { addCriterion("remark >=", value, "remark"); return (Criteria) this; } public Criteria andRemarkLessThan(String value) { addCriterion("remark <", value, "remark"); return (Criteria) this; } public Criteria andRemarkLessThanOrEqualTo(String value) { addCriterion("remark <=", value, "remark"); return (Criteria) this; } public Criteria andRemarkLike(String value) { addCriterion("remark like", value, "remark"); return (Criteria) this; } public Criteria andRemarkNotLike(String value) { addCriterion("remark not like", value, "remark"); return (Criteria) this; } public Criteria andRemarkIn(List<String> values) { addCriterion("remark in", values, "remark"); return (Criteria) this; } public Criteria andRemarkNotIn(List<String> values) { addCriterion("remark not in", values, "remark"); return (Criteria) this; } public Criteria andRemarkBetween(String value1, String value2) { addCriterion("remark between", value1, value2, "remark"); return (Criteria) this; } public Criteria andRemarkNotBetween(String value1, String value2) { addCriterion("remark not between", value1, value2, "remark"); return (Criteria) this; } public Criteria andCheckintimeIsNull() { addCriterion("checkInTime is null"); return (Criteria) this; } public Criteria andCheckintimeIsNotNull() { addCriterion("checkInTime is not null"); return (Criteria) this; } public Criteria andCheckintimeEqualTo(Date value) { addCriterion("checkInTime =", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeNotEqualTo(Date value) { addCriterion("checkInTime <>", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeGreaterThan(Date value) { addCriterion("checkInTime >", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeGreaterThanOrEqualTo(Date value) { addCriterion("checkInTime >=", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeLessThan(Date value) { addCriterion("checkInTime <", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeLessThanOrEqualTo(Date value) { addCriterion("checkInTime <=", value, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeIn(List<Date> values) { addCriterion("checkInTime in", values, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeNotIn(List<Date> values) { addCriterion("checkInTime not in", values, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeBetween(Date value1, Date value2) { addCriterion("checkInTime between", value1, value2, "checkintime"); return (Criteria) this; } public Criteria andCheckintimeNotBetween(Date value1, Date value2) { addCriterion("checkInTime not between", value1, value2, "checkintime"); return (Criteria) this; } public Criteria andIsdeleteIsNull() { addCriterion("isDelete is null"); return (Criteria) this; } public Criteria andIsdeleteIsNotNull() { addCriterion("isDelete is not null"); return (Criteria) this; } public Criteria andIsdeleteEqualTo(Integer value) { addCriterion("isDelete =", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotEqualTo(Integer value) { addCriterion("isDelete <>", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteGreaterThan(Integer value) { addCriterion("isDelete >", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteGreaterThanOrEqualTo(Integer value) { addCriterion("isDelete >=", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteLessThan(Integer value) { addCriterion("isDelete <", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteLessThanOrEqualTo(Integer value) { addCriterion("isDelete <=", value, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteIn(List<Integer> values) { addCriterion("isDelete in", values, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotIn(List<Integer> values) { addCriterion("isDelete not in", values, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteBetween(Integer value1, Integer value2) { addCriterion("isDelete between", value1, value2, "isdelete"); return (Criteria) this; } public Criteria andIsdeleteNotBetween(Integer value1, Integer value2) { addCriterion("isDelete not between", value1, value2, "isdelete"); return (Criteria) this; } public Criteria andAltertimeIsNull() { addCriterion("alterTime is null"); return (Criteria) this; } public Criteria andAltertimeIsNotNull() { addCriterion("alterTime is not null"); return (Criteria) this; } public Criteria andAltertimeEqualTo(Date value) { addCriterion("alterTime =", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeNotEqualTo(Date value) { addCriterion("alterTime <>", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeGreaterThan(Date value) { addCriterion("alterTime >", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeGreaterThanOrEqualTo(Date value) { addCriterion("alterTime >=", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeLessThan(Date value) { addCriterion("alterTime <", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeLessThanOrEqualTo(Date value) { addCriterion("alterTime <=", value, "altertime"); return (Criteria) this; } public Criteria andAltertimeIn(List<Date> values) { addCriterion("alterTime in", values, "altertime"); return (Criteria) this; } public Criteria andAltertimeNotIn(List<Date> values) { addCriterion("alterTime not in", values, "altertime"); return (Criteria) this; } public Criteria andAltertimeBetween(Date value1, Date value2) { addCriterion("alterTime between", value1, value2, "altertime"); return (Criteria) this; } public Criteria andAltertimeNotBetween(Date value1, Date value2) { addCriterion("alterTime not between", value1, value2, "altertime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion( String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
17ae896bc8951232c884ca0d9a6687f58fec9660
aacd921584ea4885368960bac8c027c1da92fdcf
/src/main/java/com/github/prabhuprabhakaran/jeazyprops/utils/PropsFiletype.java
842a93fb257457f32a078899516011815a99095b
[ "Apache-2.0" ]
permissive
prabhuprabhakaran/JEazyProps
8a92973f51ea8417fbf7774ec7c0988fbf5f93fc
6f7cee71559e45d99947555cda3a3961e9550e9e
refs/heads/master
2021-05-20T09:14:32.594462
2020-05-31T11:45:22
2020-05-31T11:45:22
252,218,645
0
0
null
null
null
null
UTF-8
Java
false
false
346
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 com.prabhu.jeazyprops.utils; /** * Property File Types * * @author Prabhu Prabhakaran */ public enum PropsFiletype { XML, PROPERTIES, JAXB; };
6849c974c627c30e686785c1583b100afc08e6bd
7d597a2f39a4f359079b2cc9bc9aa2bb24e75683
/src/main/java/cn/com/jinkang/module/standard/common/constants/result/ResultCode.java
6b58e150fb76fb6ac2c43f75f0d02ea1a6e65be1
[]
no_license
fool365/Graduation_design
d9e6ad607f650a2e2f8c5edf41cd3ad6b18b6c6b
620bc6abbb37f5da87c12a7856ad9acc81fc6aee
refs/heads/master
2023-04-27T22:53:45.275415
2021-04-27T04:24:21
2021-04-27T04:24:21
361,977,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,053
java
package cn.com.jinkang.module.standard.common.constants.result; public enum ResultCode implements IResultCode { SUCCESS(200, "操作成功"), FAILURE(400, "业务异常"), UN_AUTHORIZED(401, "请求未授权"), NOT_FOUND(404, "404 没找到请求"), MSG_NOT_READABLE(400, "消息不能读取"), METHOD_NOT_SUPPORTED(405, "不支持当前请求方法"), MEDIA_TYPE_NOT_SUPPORTED(415, "不支持当前媒体类型"), REQ_REJECT(403, "请求被拒绝"), INTERNAL_SERVER_ERROR(500, "服务器异常"), PARAM_MISS(400, "缺少必要的请求参数"), PARAM_TYPE_ERROR(400, "请求参数类型错误"), PARAM_BIND_ERROR(400, "请求参数绑定错误"), PARAM_VALID_ERROR(400, "参数校验失败"); final int code; final String message; public int getCode() { return this.code; } public String getMessage() { return this.message; } private ResultCode(final int code, final String message) { this.code = code; this.message = message; } }
c358ca197895364fd3caaf83cb0966d4261bff9b
4efd23da9798a17ecaa3e1ea62ae36b9271b5a8b
/wxjy-common/src/main/java/com/insigma/common/util/CommonUtils.java
039663b5c7df6330844bdafdc351b4da8919ba8c
[]
no_license
wengweng85/wxjy-web-all
a7237fac6185e7bf8b370f0675a748ae04831d9d
242f903e5db5c17d03159a804dad02d58c4c3561
refs/heads/master
2020-04-18T12:26:32.977558
2019-04-03T12:27:48
2019-04-03T12:27:48
167,533,377
0
1
null
null
null
null
GB18030
Java
false
false
1,400
java
package com.insigma.common.util; import javax.servlet.http.HttpServletRequest; import java.io.File; import java.net.MalformedURLException; public class CommonUtils { /** * 根据路径下的文件名 * @param path * @return */ public static String getNewFile(String path){ File savePath = new File(path); File[] files = savePath.listFiles(); if(files.length == 0){ return ""; } File file = null; for(int i=0; i<files.length; i++){ if(i==0){ file = files[i]; }else if(files[i].lastModified() >= files[i-1].lastModified()){ file = files[i]; } } return file.getName(); } /* * 获取项目的根目录 * 因为tomcat和weblogic获取的根目录不一致,所以需要此方法 */ public static String getWebRootUrl(HttpServletRequest request) { String fileDirPath = request.getSession().getServletContext().getRealPath("/"); if (fileDirPath == null) { //如果返回为空,则表示服务器为weblogic,则需要使用另外的方法 try { fileDirPath = request.getSession().getServletContext().getResource("/").getFile() + "/wxjy-api/WEB_INF/"; System.out.print("Weblogic获取项目的根目录:"+fileDirPath); return fileDirPath; } catch (MalformedURLException e) { System.out.print("获取项目的根目录出错!"); } } else { fileDirPath += "/wxjy-api/WEB_INF/"; } return fileDirPath; } }
7ec3f96db6786f30880399e182b783d37d85e3b8
efc54e6b7144afe42511d4ac498d360786e55ced
/app/src/main/java/com/example/alfred/realtimelocation/Model/User.java
9d9917d1b84cd2738d948d1497363dcb6a2ffb92
[]
no_license
alfredwilliam/RealTimeLocation
e6680da20228a1222d6abf8f113ac9ac5df5a5ed
c9b24803fd02a715194d6cca5c26db8b11f666c9
refs/heads/master
2020-05-05T08:01:57.077928
2019-04-06T15:11:45
2019-04-06T15:11:45
179,847,468
1
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.example.alfred.realtimelocation.Model; import java.util.HashMap; public class User { private String uid,email; private HashMap<String,User> acceptList; public User() { } public User(String uid, String email) { this.uid = uid; this.email = email; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public HashMap<String, User> getAcceptList() { return acceptList; } public void setAcceptList(HashMap<String, User> acceptList) { this.acceptList = acceptList; } }
4c7a069a0318e56b88c65b5977cafbfec1dd9108
23f2bb785a245259c8d12315747beebd7e8b05bd
/src/main/java/com/kfit/spring_boot_mybatis/domain/P2pActivityRule.java
1043bc03484e98bacbc29921ea0624c2cfcd1da1
[]
no_license
TomasXiong/SpringSecurity
9fa23031da7a32e1b43fc9a85958cb60fb4e4d10
62e396ee8cadce010ee43ae8c599be1d3faf7800
refs/heads/master
2023-08-07T15:56:17.500591
2019-08-22T03:40:11
2019-08-22T03:40:11
203,708,772
1
1
null
2023-07-22T14:13:11
2019-08-22T03:38:41
Java
UTF-8
Java
false
false
3,378
java
package com.kfit.spring_boot_mybatis.domain; import java.sql.Timestamp; /** * P2pActivityRule entity. @author MyEclipse Persistence Tools */ public class P2pActivityRule implements java.io.Serializable { // Fields /** * serialVersionUID:TODO(用一句话描述这个变量表示什么) * * @since Ver 1.1 */ private static final long serialVersionUID = 1L; private Integer id; private Integer typeId; // 0:全部产品;1:优选产品;2:理财产品 private Integer activityId; // 活动ID private String ruleCycle; // 限制期限(逗号分隔)无限制则空 private Double moneyMin; // 最小投资金额,无限制则0 private Double prize; // 奖励(加息|代金|体验金) private Timestamp createTime;// 创建时间 private Timestamp beginTime; // 开始时间 private Timestamp endTime; // 截止时间 private Integer status; // 0:失效;1:生效 private Integer validDay; // 有效天数,0:以结束时间end_time private Integer activeStep;// 激活步骤0:无须激活;1:实名;2:充值;3:投资 private P2pActivity activity; // 活动类型[1:送加息券,2:送代金券,3:送体验金] private String remark; public Integer getId() { return id; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public void setId(Integer id) { this.id = id; } public Integer getActivityId() { return activityId; } public void setActivityId(Integer activityId) { this.activityId = activityId; } public String getRuleCycle() { return ruleCycle; } public void setRuleCycle(String ruleCycle) { this.ruleCycle = ruleCycle; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public Integer getValidDay() { return validDay; } public void setValidDay(Integer validDay) { this.validDay = validDay; } public Double getMoneyMin() { return moneyMin; } public void setMoneyMin(Double moneyMin) { this.moneyMin = moneyMin; } public Double getPrize() { return prize; } public void setPrize(Double prize) { this.prize = prize; } public Timestamp getCreateTime() { return createTime; } public void setCreateTime(Timestamp createTime) { this.createTime = createTime; } public P2pActivity getActivity() { return activity; } public void setActivity(P2pActivity activity) { this.activity = activity; } public Timestamp getBeginTime() { return beginTime; } public void setBeginTime(Timestamp beginTime) { this.beginTime = beginTime; } public Timestamp getEndTime() { return endTime; } public void setEndTime(Timestamp endTime) { this.endTime = endTime; } public Integer getTypeId() { return typeId; } public void setTypeId(Integer typeId) { this.typeId = typeId; } public Integer getActiveStep() { return activeStep; } public void setActiveStep(Integer activeStep) { this.activeStep = activeStep; } }
9799d15d8a1ce731a8eb18e4d73525d5b7ea7086
d20e49dd36bf542652379e607c28f1a3a23eda75
/app/src/main/java/com/ningjiahao/phhcomic/adapter/FindPagerAdapter.java
acf3f4b9dfc30e38d38c08e4cbea9def4d85c9a3
[]
no_license
MayuZhiHua/PHHComic
96f6128d6df74109e741a14677b726472da2f173
81c68d4415997a22df17de918832c5e451843cd0
refs/heads/master
2020-06-27T10:18:58.960548
2016-11-21T11:30:36
2016-11-21T11:30:36
74,526,303
2
0
null
null
null
null
UTF-8
Java
false
false
674
java
package com.ningjiahao.phhcomic.adapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.view.ViewGroup; import java.util.List; /** * Created by My on 2016/11/15. */ public class FindPagerAdapter extends FragmentPagerAdapter{ private List<Fragment>mList; public FindPagerAdapter(FragmentManager fm,List<Fragment>list) { super(fm); mList=list; } @Override public Fragment getItem(int position) { return mList.get(position); } @Override public int getCount() { return mList.size(); } }
122aa15a41d65ccd7aadf1d75364e524c509cae4
fed9f61358376202c9f994981998854adfd85c6e
/app/src/main/java/com/example/a10_26_2019_loginpage/resident/ResidentDataSingleton.java
8bb992f6455204de9e82f696f36a7820630539b7
[]
no_license
Jengador/SadBear
03cd7e57f463964e73e6e78591ec2eef439cb077
2cb9f9d0c379ccf509114b4d49871f7d5e031cf6
refs/heads/master
2023-03-06T12:56:10.810073
2021-02-14T17:28:06
2021-02-14T17:28:06
338,860,586
0
0
null
null
null
null
UTF-8
Java
false
false
1,822
java
package com.example.a10_26_2019_loginpage.resident; public class ResidentDataSingleton { private String userID; private String name; private String hometown; private String phone; private String doorNumber; private int dayOfBirth; private int monthOfBirth; private int yearOfBirth; private static ResidentDataSingleton INSTANCE; private ResidentDataSingleton(){ } public static ResidentDataSingleton getInstance(){ if(INSTANCE == null){ INSTANCE = new ResidentDataSingleton(); } return INSTANCE; } public String getUserID() { return userID; } public void setUserID(String userID) { this.userID = userID; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getHometown() { return hometown; } public void setHometown(String hometown) { this.hometown = hometown; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getDoorNumber() { return doorNumber; } public void setDoorNumber(String doorNumber) { this.doorNumber = doorNumber; } public int getDayOfBirth() { return dayOfBirth; } public void setDayOfBirth(int dayOfBirth) { this.dayOfBirth = dayOfBirth; } public int getMonthOfBirth() { return monthOfBirth; } public void setMonthOfBirth(int monthOfBirth) { this.monthOfBirth = monthOfBirth; } public int getYearOfBirth() { return yearOfBirth; } public void setYearOfBirth(int yearOfBirth) { this.yearOfBirth = yearOfBirth; } }
fb7c5c5466dbe3aed6567e639bb2cd7e98ee519b
28c8a5d040b63f1f086b228f4f69262f34962d8e
/src/TestList.java
71f55a1b03f44d08ec7528cfd5021eb58a74c044
[]
no_license
chant123/t71class
b58923b8409120f31260b7157b88710bf2662791
5458c908518802f5dbecc9258762044c27403fe8
refs/heads/master
2021-04-25T15:07:00.132898
2017-11-06T11:13:55
2017-11-06T11:13:55
109,685,519
0
0
null
null
null
null
GB18030
Java
false
false
1,312
java
import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class TestList { public static void main(String[] args){ List<String> students = new ArrayList<String>(); students.add("张三"); students.add("李四"); students.add("王五"); students.add("赵六"); students.add("田七"); int size = students.size(); System.out.println("学生数量为:"+size); for(int i=0;i<size;i++){ System.out.println(students.get(i)); } System.out.println("使用for的第二种用法遍历集合"); for(String name:students){ System.out.println(name); } //方法3 System.out.println(students.toString()); //移除 students.remove(0); students.remove("赵六"); System.out.println("移除之后的结果:"+students.toString()); //包含 boolean flag = students.contains("王五"); if(flag){ System.out.println("存在一个叫王五的学生"); }else{ System.out.println("不存在叫王五的学生"); } //复制到一个数组中 String[] names = new String[5]; students.toArray(names); System.out.println(Arrays.toString(names)); //清除 students.clear(); System.out.println("清除之后的内容为:"+students.toString()); } }
5842c6dfe9a6b87c776004dc2072035adc044d5f
826f1fb19ffd418e7d300156cf2f07892b323b55
/app/src/main/java/org/richit/widgetlibrarytest/MainActivity.java
bcdc70197e9cd826240ec53d7d83fdf24046c7ff
[ "MIT" ]
permissive
p32929/SimpleWidgetLibraryForTesting
b0ea6b9b95a5f67f88dc1e2485769d217f0195dd
13cbaffca9b996256a24654a1f9862e0547b1738
refs/heads/master
2022-11-22T14:27:52.891061
2020-07-17T13:58:58
2020-07-17T13:58:58
262,557,926
0
0
null
null
null
null
UTF-8
Java
false
false
2,008
java
package org.richit.widgetlibrarytest; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Intent; import android.os.Build; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import org.richit.appwidgetlibrary.WidgetRelated.MyAppWidget1; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this); // int appWidgetIds[] = appWidgetManager.getAppWidgetIds( // new ComponentName(this, MyAppWidget1.class)); // Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK); // pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds); // startActivityForResult(pickIntent, 123); addAppWidget(); } void addAppWidget() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { AppWidgetManager mAppWidgetManager = getSystemService(AppWidgetManager.class); ComponentName myProvider = new ComponentName(MainActivity.this, MyAppWidget1.class); Bundle b = new Bundle(); b.putString("ggg", "ggg"); if (mAppWidgetManager.isRequestPinAppWidgetSupported()) { Intent pinnedWidgetCallbackIntent = new Intent(MainActivity.this, MyAppWidget1.class); PendingIntent successCallback = PendingIntent.getBroadcast(MainActivity.this, 0, pinnedWidgetCallbackIntent, 0); mAppWidgetManager.requestPinAppWidget(myProvider, b, successCallback); } } } @Override public void onBackPressed() { super.onBackPressed(); finish(); } }
d567816c216eea9f04f038a391aa222bd7523ddc
61a0d1cef1d42297c11ad53ff78ccf245234aa4f
/app/src/main/java/com/example/administrator/movieplayer/MyAdapter.java
6178acfc21ef11192c20fdb90f53ed784d637490
[]
no_license
lium920/Movie
1a56007d0f6714af62d833240fab1a32a8ddc942
493ff12b94148a70958321dccec0f00ff3f9a935
refs/heads/master
2021-01-20T16:16:56.471037
2017-05-10T06:29:15
2017-05-10T06:29:15
90,828,647
0
0
null
null
null
null
UTF-8
Java
false
false
2,411
java
package com.example.administrator.movieplayer; 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.ImageView; import android.widget.TextView; import java.util.List; /** * @创建人 Administrator * <p> * Created by Administrator on 2017/3/20 0020. */ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> { private Context mContext; private List<MovieItem> mDatas; private MyItemClickListener mItemClickListener; private Object mItemLongClickListener; public MyAdapter(Context mContext, List<MovieItem> mDatas){ this.mContext=mContext; this.mDatas=mDatas; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent,false); MyViewHolder holder = new MyViewHolder(itemView,mItemClickListener); // return vh; // MyViewHolder holder = new MyViewHolder(LayoutInflater.from( // mContext).inflate(R.layout.item_recycler_layout, parent, // false)); return holder; } public void setOnItemClickListener(MyItemClickListener listener){ this.mItemClickListener = listener; } @Override public void onBindViewHolder(MyViewHolder holder, int position) { holder.tv.setText(mDatas.get(position).getMoviename()); holder.mImage.setImageResource(mDatas.get(position).getAdess()); } @Override public int getItemCount() { return mDatas.size(); } class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { private TextView tv; private MyItemClickListener mListener; private final ImageView mImage; public MyViewHolder(View view,MyItemClickListener listener) { super(view); this.mListener = listener; view.setOnClickListener(this); tv = (TextView) view.findViewById(R.id.text); mImage = (ImageView) view.findViewById(R.id.image); } @Override public void onClick(View v) { if (mListener !=null){ mListener.onItemClick(v,getPosition()); } } } }
1a5ce7e7a03e7190d6f74c0dfe216de9c455759f
ec750ee29fcc0ee072c0c58f2d3b3bbe53f2011a
/ct-app/src/main/java/com/xjd/ct/app/ctrlr/v10/ResourceController10.java
74d8762c1faba7f78ad0a804fe5ab76f43872fac
[]
no_license
elvis9xu163/ct
3eb7408215a21cc443d9c5b8d5a6559ebb09b793
6038d0494307df024113d4b5e97f12dee1a238d9
refs/heads/master
2021-05-29T12:33:30.412018
2015-05-22T14:14:45
2015-05-22T14:14:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,798
java
package com.xjd.ct.app.ctrlr.v10; import java.io.File; import java.io.IOException; import java.io.OutputStream; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.xjd.ct.app.util.RequestContext; import com.xjd.ct.app.view.View; import com.xjd.ct.app.view.ViewUtil; import com.xjd.ct.app.view.body.ResourceBody; import com.xjd.ct.app.view.vo.ResourceVo; import com.xjd.ct.biz.bo.ResourceBo; import com.xjd.ct.biz.bo.TokenBo; import com.xjd.ct.biz.bo.UserBo; import com.xjd.ct.biz.service.ResourceService; import com.xjd.ct.biz.service.UserService; import com.xjd.ct.utl.constant.AppConstant; import com.xjd.ct.utl.exception.BusinessException; import com.xjd.ct.utl.respcode.RespCode; /** * <pre> * 资源控制器 * 1. 资源的上传 * 2. 资源的下载 * </pre> * * @author elvis.xu * @since 2015-3-26 上午10:06:03 */ @Controller @RequestMapping("/10") public class ResourceController10 { @Autowired ResourceService resourceService; @Autowired UserService userService; @RequestMapping("/upload") @ResponseBody public View upload(@RequestParam(value = "token", required = false) String token, @RequestParam(value = "file", required = false) MultipartFile mutipartFile) throws IOException { if (token == null) { throw new BusinessException(RespCode.RESP_0001, new Object[] { "token" }); } TokenBo tokenBo = userService.queryTokenByToken(token); if (tokenBo != null && !AppConstant.ANONYMOUS_USERID.equals(tokenBo.getUserId())) { UserBo userBo = userService.queryUserByUserId(tokenBo.getUserId()); if (userBo == null) { throw new BusinessException(RespCode.RESP_0110); } RequestContext.putUserId(userBo.getUserId()); } if (mutipartFile == null || mutipartFile.isEmpty()) { throw new RuntimeException(RespCode.RESP_0220); } String suffix = ""; String orgName = mutipartFile.getOriginalFilename(); int i = 0; if (orgName != null && (i = orgName.lastIndexOf('.')) != -1) { suffix = orgName.substring(i + 1); } File tmpFile = File.createTempFile(RequestContext.checkAndGetUserId().toString(), suffix); mutipartFile.transferTo(tmpFile); // 业务调用 ResourceBo resourceBo = resourceService.upload(RequestContext.checkAndGetUserId(), tmpFile, suffix, mutipartFile.getContentType()); // 返回结果 ResourceBody body = new ResourceBody(); if (resourceBo != null) { ResourceVo vo = new ResourceVo(); BeanUtils.copyProperties(resourceBo, vo); body.setResource(vo); } View view = ViewUtil.defaultView(); view.setBody(body); return view; } @RequestMapping("/download") public void download(@RequestParam(value = "resId", required = false) String resId, HttpServletResponse resp) throws IOException { ResourceBo resourceBo = resourceService.queryResource(resId); if (resourceBo == null) { resp.setStatus(404); return; } resp.reset(); resp.setHeader( "Content-Disposition", "attachment; filename=file" + (StringUtils.isNotBlank(resourceBo.getResFormat()) ? "." + resourceBo.getResFormat() : "")); if (StringUtils.isNotBlank(resourceBo.getResContentType())) { resp.setContentType(resourceBo.getResContentType()); } else { resp.setContentType("application/octet-stream; charset=utf-8"); } OutputStream out = resp.getOutputStream(); resourceService.download(resId, out); out.flush(); } }
a078248436e7ca81323ec1234a71225ae5c2d383
48b8b3785c1617faea521e843d17f174304771b0
/NCP_client_lourd/src/core/Checksum.java
6653925de4416ddaacde265394914260e42c6aaf
[]
no_license
olbers/network-chat-project
a80698d36464ac3fde6ff98fea2498bc3729c168
f1d83f7107592272100c1dde28ee6d77823b1523
refs/heads/master
2021-01-10T05:52:21.382435
2011-04-01T06:13:00
2011-04-01T06:13:00
46,188,707
0
0
null
null
null
null
UTF-8
Java
false
false
2,005
java
package core; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * La class cheksum permet de calculer le checksum d'un fichier en SHA1 et MD5 * Source : {@link} http://www.javalobby.org/java/forums/t84420.html * @author Poirier Kevin * @version 1.0.0 */ public class Checksum { /** * Permet de recuperer le checksum en MD5. * @param file * @return checksum du fichier MD5 */ public static String MD5(File file){ return Checksum.hash(file, "MD5"); } /** * Permet de recuperer le checksum en SHA1. * @param file * @return checksum du fichier en SHA1 */ public static String SHA1(File file){ return Checksum.hash(file, "SHA1"); } /** * Permet de recuperer le checksum du SHA1 ou MD5. * @param file * @param algorithm * @return checksum du fichier */ @SuppressWarnings("finally") public static String hash(File file,String algorithm){ InputStream is= null; String output=""; try { MessageDigest digest = MessageDigest.getInstance(algorithm); File f = file; is = new FileInputStream(f); byte[] buffer = new byte[8192]; int read = 0; while( (read = is.read(buffer)) > 0) { digest.update(buffer, 0, read); } byte[] sum = digest.digest(); BigInteger bigInt = new BigInteger(1, sum); output = bigInt.toString(16); return output; } catch(IOException e) { throw new RuntimeException("Unable to process file for "+algorithm, e); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { if (is!=null){ is.close(); } return output; } catch(IOException e) { throw new RuntimeException("Unable to close input stream for "+algorithm+" calculation", e); } } } }
e6dfbf07363b5a438dc3f1d71cb5bfbbd2b356e2
11b52e23af8472ab963cd9e107118835ab1b88fc
/CBudgetBatch/src/cbudgetbatch/forecast/Gewichtung.java
583f500dcf846396b5461ed59b048c8e54db0881
[]
no_license
Pfeiffenrohr/budget
449544bdb1ecefbf9a95dfe352877566c5c7f041
33a4757b4ea86ba20f92983653fdcd9f99a491d4
refs/heads/master
2023-08-16T17:28:48.491037
2023-08-12T08:32:14
2023-08-12T08:32:14
158,187,182
0
0
null
2023-09-12T13:38:28
2018-11-19T08:30:19
Java
UTF-8
Java
false
false
778
java
package cbudgetbatch.forecast; public class Gewichtung { private int year1back; private int year2back; private int year3back; public Gewichtung(int year1back, int year2back, int year3back) { super(); this.year1back = year1back; this.year2back = year2back; this.year3back = year3back; } public Gewichtung() { super(); // TODO Auto-generated constructor stub } public int getyear1back() { return year1back; } public void setyear1back(int year1back) { this.year1back = year1back; } public int getyear2back() { return year2back; } public void setyear2back(int year2back) { this.year2back = year2back; } public int getyear3back() { return year3back; } public void setyear3back(int year3back) { this.year3back = year3back; } }
d755869ebae3e715fc0e77828de8c0d172fd83d0
96f24caba3511efb342fd9bb991698e7a0ba1c63
/7.Goldman_n/src/com/javabegin/training/game/goldman_9/abstracts/AbstractMovingObject.java
014211086304eb737e8221434eb95e36ae5fac5b
[]
no_license
Abergaz/JavaBeginWork
877f87b0f21b6fdac6d24ad14f6d28d574a14742
a443adacfd8265839ced00b1eeab22294e9fb42d
refs/heads/master
2020-06-30T11:15:53.414126
2019-11-16T06:00:45
2019-11-16T06:00:45
200,809,640
0
0
null
null
null
null
UTF-8
Java
false
false
3,011
java
package com.javabegin.training.game.goldman_9.abstracts; import com.javabegin.training.game.goldman_9.enums.ActionResult; import com.javabegin.training.game.goldman_9.enums.MovingDirection; import com.javabegin.training.game.goldman_9.interfaces.gameobjects.MovingObject; import com.javabegin.training.game.goldman_9.objects.Coordinate; /** * класс, который отвечает за любой движущийся объект. наследуется от класса * AbstractGameObject с добавлением функций движения */ public abstract class AbstractMovingObject extends AbstractGameObject implements MovingObject { public abstract void changeIcon(MovingDirection direction); private int step = 1;// по-умолчанию у всех объектов шаг равен 1 @Override public int getStep() { return step; } public void setStep(int step) { this.step = step; } protected void actionBeforeMove(MovingDirection direction) { // при движении объект должен сменить иконку и произвести звук changeIcon(direction); // playSound(); на будушее } @Override public ActionResult moveToObject(MovingDirection direction, AbstractGameObject gameObject) { actionBeforeMove(direction); return doAction(gameObject); } public ActionResult doAction(AbstractGameObject gameObject) { if (gameObject == null) { // край карты return ActionResult.NO_ACTION; } switch (gameObject.getType()) { case NOTHING: { return ActionResult.MOVE; } case WALL: {// по-умолчанию объект не может ходить через стену return ActionResult.NO_ACTION; } } return ActionResult.NO_ACTION; } public Coordinate getDirectionCoordinate(MovingDirection direction) { // берем текущие координаты объекта, которые нужно передвинуть (индексы начинаются с нуля) int x = this.getCoordinate().getX(); int y = this.getCoordinate().getY(); Coordinate newCoordinate = new Coordinate(x, y); switch (direction) {// определяем, в каком направлении нужно двигаться case UP: { newCoordinate.setY(y - this.getStep()); break; } case DOWN: { newCoordinate.setY(y + this.getStep()); break; } case LEFT: { newCoordinate.setX(x - this.getStep()); break; } case RIGHT: { newCoordinate.setX(x + this.getStep()); break; } } return newCoordinate; } }
ad3b4e9f66a2ece9632dbfa0386a44fa75ba9fae
566dc26972fc69711070f4ad07c5c9657f59daf3
/dynamic/src/main/java/com/task/dynamic/util/KeyPairTool.java
0f7e2111b21e6636031ddd321aff7d286d3fd1e4
[ "Apache-2.0" ]
permissive
aip9105/proj_study
f46d66177039e4cc1469be478edcc6617aec084d
e8bf923460dd530cd9150af0b85a0c84ada40c1a
refs/heads/master
2022-11-22T18:53:45.547321
2020-07-25T15:36:41
2020-07-25T15:36:41
178,536,580
0
0
null
null
null
null
UTF-8
Java
false
false
13,185
java
package com.task.dynamic.util; import lombok.extern.slf4j.Slf4j; import java.io.*; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; import java.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Base64; @Slf4j public class KeyPairTool { /** * 方法说明 : 从KeyStore中获取证书 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param password KeyStore保护密码 * @date 2017/8/4 */ public Certificate getCertificateByAlias(String keyStorePath, String alias, String password) { Certificate cert = null; try { if (!isKeyStoreLoaded) { // 加载KeyStore数据文件 this.loadKeyStore(keyStorePath, password); } if (keyStore != null) { // 通过别名获取证书 cert = keyStore.getCertificate(alias); } } catch (KeyStoreException e) { log.error("KeyPairTool转换出错:",e); } return cert; } /** * 方法说明 : 从KeyStore中获取密钥对 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param privatePass 私钥密码 * @param keyStorePass KeyStore保护密码 * @date 2017/8/4 */ public KeyPair getKeyPairByAlias(String keyStorePath, String alias, String privatePass, String keyStorePass) { KeyPair keyPair = null; PublicKey publicKey = this.getPublicKeyByAlias(keyStorePath, alias, keyStorePass); if (publicKey != null) { PrivateKey privateKey = this.getPrivateKeyByAlias(keyStorePath, alias, privatePass, keyStorePass); if (privateKey != null) { keyPair = new KeyPair(publicKey, privateKey); } } return keyPair; } /** * 方法说明 : 获取私钥 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param privatePass 私钥密码 * @param keyStorePass KeyStore保护密码 * @date 2017/8/4 */ public PrivateKey getPrivateKeyByAlias(String keyStorePath, String alias, String privatePass, String keyStorePass) { PrivateKey privateKey = null; try { if (!isKeyStoreLoaded) { // 加载KeyStore数据文件 this.loadKeyStore(keyStorePath, keyStorePass); } Key key = keyStore.getKey(alias, privatePass.toCharArray()); if (key instanceof PrivateKey) { privateKey = (PrivateKey) key; } } catch (UnrecoverableKeyException | KeyStoreException | NoSuchAlgorithmException e) { log.error("KeyPairTool转换出错:",e); } return privateKey; } /** * 方法说明 : 获取公钥 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param password KeyStore保护密码 * @date 2017/8/4 */ public PublicKey getPublicKeyByAlias(String keyStorePath, String alias, String password) { // 获取证书 Certificate cert = this.getCertificateByAlias(keyStorePath, alias, password); if (cert != null) { return cert.getPublicKey(); } return null; } /** * 方法说明 : 把证书的编码形式保存为文件 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param password KeyStore保护密码 * @date 2017/8/4 */ public void exportCert(String keyStorePath, String alias, String password) { Certificate cert = this.getCertificateByAlias(keyStorePath, alias, password); if (cert != null) { try { this.exportData(cert.getEncoded(), System.getProperty("user.home") + "/" + "certificate.bytes"); } catch (CertificateEncodingException e) { log.error("KeyPairTool转换出错:",e); } } } /** * 方法说明 : 把私钥保存为文件 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param privatePass 私钥密码 * @param keyStorePass KeyStore保护密码 * @param isBase64 是否使用BASE64编码 * @date 2017/8/4 */ public void exportPrivateKeyBytes(String keyStorePath, String alias, String privatePass, String keyStorePass, boolean isBase64) { PrivateKey privateKey = this.getPrivateKeyByAlias(keyStorePath, alias, privatePass, keyStorePass); if (privateKey != null) { byte[] data = privateKey.getEncoded(); if (isBase64) { String afBase64 = Base64.getEncoder().encodeToString(data); afBase64 = "—–BEGIN PRIVATE KEY—–/n" + afBase64 + "/n—–END PRIVATE KEY—–"; data = afBase64.getBytes(); } this.exportData(data, System.getProperty("user.home") + "/" + "privateKey.bytes"); } } /** * 方法说明 : 把公钥保存为文件 * * @param keyStorePath KeyStore数据文件路径 * @param alias 密钥对别名 * @param password KeyStore保护密码 * @param isBase64 是否使用BASE64编码 * @date 2017/8/4 */ public void exportPublicKeyBytes(String keyStorePath, String alias, String password, boolean isBase64) { PublicKey publicKey = this.getPublicKeyByAlias(keyStorePath, alias, password); if (publicKey != null) { byte[] data = publicKey.getEncoded(); if (isBase64) { String afBase64 = Base64.getEncoder().encodeToString(data); afBase64 = "—–BEGIN PUBLIC KEY—–/n" + afBase64 + "/n—–END PUBLIC KEY—–"; data = afBase64.getBytes(); } this.exportData(data, System.getProperty("user.home") + "/" + "publicKey.bytes"); } } /** * 方法说明 : 从文件读取证书 * * @param fileName 要载入到内存的证书路径 * @date 2017/8/4 */ public Certificate loadCertificate(String fileName) { Certificate cert = null; FileInputStream fileInputStream = null; try { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); File file = new File(fileName); if (file.exists() && file.canRead() && file.isFile()) { fileInputStream = new FileInputStream(file); cert = certFactory.generateCertificate(fileInputStream); } } catch (CertificateException | FileNotFoundException e) { log.error("KeyPairTool转换出错:",e); } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } } } return cert; } /** * 方法说明 : 从文件读取公钥 * * @param fileName 要载入到内存的公钥路径 * @date 2017/8/4 */ public PublicKey loadPublicKey(String fileName) { PublicKey publicKey = null; try { byte[] data = this.loadData(fileName); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); X509EncodedKeySpec keySpec = new X509EncodedKeySpec(data); publicKey = keyFactory.generatePublic(keySpec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { log.error("KeyPairTool转换出错:",e); } return publicKey; } /** * 方法说明 : 从文件读取私钥 * * @param fileName 要载入到内存的公钥路径 * @date 2017/8/4 */ public PrivateKey loadPrivateKey(String fileName) { PrivateKey privateKey = null; try { byte[] data = this.loadData(fileName); KeyFactory keyFactory = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(data); privateKey = keyFactory.generatePrivate(keySpec); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { log.error("KeyPairTool转换出错:",e); } return privateKey; } /** * 方法说明 : 从指定路径加载KeyStore数据文件 * * @param keyStorePath KeyStore数据文件路径 * @param password KeyStore保护密码 * @date 2017/8/4 */ private void loadKeyStore(String keyStorePath, String password) { try { if (!isKeyStoreLoaded) { File keyStoreFile = new File(keyStorePath); if (keyStoreFile.exists() && keyStoreFile.canRead() && keyStoreFile.isFile()) { // 初始化指导类型的KeyStore并加载数据文件 keyStore = KeyStore.getInstance("RSA"); try (FileInputStream fileInputStream = new FileInputStream(keyStoreFile)) { keyStore.load(fileInputStream, password.toCharArray()); } isKeyStoreLoaded = true; } } } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { log.error("KeyPairTool转换出错:",e); } } /** * 方法说明 : 输出文件 * * @param data 写入文件的数组 * @param fileName 要保存的文件路径及名称 * @date 2017/8/4 */ private void exportData(byte[] data, String fileName) { FileOutputStream fileOutputStream = null; try { File file = new File(fileName); if (file.canWrite()) { fileOutputStream = new FileOutputStream(file); fileOutputStream.write(data); fileOutputStream.close(); } } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } finally { try { if (fileOutputStream != null) { fileOutputStream.close(); } } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } } } /** * 方法说明 : 将指定文件读入内存,byte[]形式 * * @param fileName 要载入到内存的文件路径 * @date 2017/8/4 */ private byte[] loadData(String fileName) { byte[] data = null; RandomAccessFile raf = null; FileChannel fileChannel = null; try { File file = new File(fileName); if (file.exists() && file.canRead() && file.isFile()) { raf = new RandomAccessFile(file, "r"); fileChannel = raf.getChannel(); MappedByteBuffer byteBuffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()).load(); data = new byte[(int) fileChannel.size()]; if (byteBuffer.remaining() > 0) { byteBuffer.get(data, 0, byteBuffer.remaining()); } } } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } finally { if (fileChannel != null) { try { fileChannel.close(); } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } } if (raf != null) { try { raf.close(); } catch (IOException e) { log.error("KeyPairTool转换出错:",e); } } } return data; } /** * 加载的KeyStore */ private KeyStore keyStore; /** * KeyStore是否已加载,如果要重新加载,set一个false */ private boolean isKeyStoreLoaded; /** * 方法说明 : 如果已加载,返回加载的KeyStore,否则返回null * * @date 2017/8/4 */ public KeyStore getKeyStore() { if (isKeyStoreLoaded) { return keyStore; } else { return null; } } /** * 方法说明 : 判断是否已加载KeyStore * * @date 2017/8/4 */ public boolean isKeyStoreLoaded() { return isKeyStoreLoaded; } /** * 方法说明 : 重装设置KeyStore加载状态为未加载 * * @date 2017/8/4 */ public void resetKeyStoreLoaded() { this.isKeyStoreLoaded = false; } }
[ "liaipeng" ]
liaipeng
250a2789750899217e08ad8eb5e58e48ecc8d4f3
4cd7523bc164f64c51af9e7d384a8a70c6806f9e
/src/com/jucaipen/daoimp/VideoLiveSaleImp.java
691fd7c38cdd73d9ce871bdd7525e38384475686
[]
no_license
loveq2016/jcp_server2017
5de95a71afc80edeb7380d5bb725be5a4f6e87b6
a180bf634a63bc84eb356a57364c08e2ba9d72ac
refs/heads/master
2021-01-25T09:33:04.404479
2017-06-09T09:11:22
2017-06-09T09:11:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,564
java
package com.jucaipen.daoimp; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.jucaipen.dao.VideoLiveSaleDao; import com.jucaipen.model.VideoLiveSale; import com.jucaipen.utils.JdbcUtil; public class VideoLiveSaleImp implements VideoLiveSaleDao { private Connection dbConn; private Statement sta; private ResultSet res; private List<VideoLiveSale> sales = new ArrayList<VideoLiveSale>(); @Override public VideoLiveSale findSaleByUidAndLiveId(int uId, int liveId) { dbConn = JdbcUtil.connSqlServer(); try { sta = dbConn.createStatement(); res = sta .executeQuery("SELECT * FROM JCP_VideoLiveSale WHERE FK_UserId=" + uId + " AND FK_VideoLiveId=" + liveId); while (res.next()) { int id = res.getInt(1); String insertDate = res.getString(6); String startDate=res.getString(7); String endDate=res.getString(8); int isStop=res.getInt(9); VideoLiveSale sale = new VideoLiveSale(); sale.setId(id); sale.setInsertDate(insertDate); sale.setStartDate(startDate); sale.setEndDate(endDate); sale.setIsStop(isStop); return sale; } } catch (SQLException e) { e.printStackTrace(); }finally{ try { JdbcUtil.closeConn(sta, dbConn, res); } catch (SQLException e) { e.printStackTrace(); } } return null; } @Override public List<VideoLiveSale> findSaleByUserId(int userId) { dbConn = JdbcUtil.connSqlServer(); try { sta = dbConn.createStatement(); res = sta .executeQuery("SELECT * FROM JCP_VideoLiveSale WHERE FK_UserId=" + userId); while (res.next()) { int id = res.getInt(1); String insertDate = res.getString(6); int teacherId = res.getInt(3); VideoLiveSale sale = new VideoLiveSale(); sale.setId(id); sale.setInsertDate(insertDate); sale.setTeacherId(teacherId); sales.add(sale); } return sales; } catch (SQLException e) { e.printStackTrace(); }finally{ try { JdbcUtil.closeConn(sta, dbConn, res); } catch (SQLException e) { e.printStackTrace(); } } return null; } @Override public int addSale(VideoLiveSale sale) { sales.clear(); dbConn = JdbcUtil.connSqlServer(); try { sta = dbConn.createStatement(); return sta.executeUpdate(""); } catch (SQLException e) { e.printStackTrace(); }finally{ try { JdbcUtil.closeConn(sta, dbConn, res); } catch (SQLException e) { e.printStackTrace(); } } return 0; } }
ac72912c32c1321a9a611a93ce4e3b1683e698f0
46fbcff701c60d5163003bd99738f1f609f7fab3
/src/main/java/cn/mldn/singup/service/abs/AbstractService.java
850c3c3fa213f165c699d0ba394afdf58aee99de
[]
no_license
shui985039/bespeak
21c2198ed23a8e8417f770819c5e10e904c0b21c
5dd828e6a69d5ac59832fc527d0d557002c91669
refs/heads/master
2021-01-01T18:13:55.046029
2016-10-27T08:19:44
2016-10-27T08:19:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,531
java
package cn.mldn.singup.service.abs; import java.util.HashMap; import java.util.Map; public abstract class AbstractService { /** * 针对于Mybatis中需要接收Map集合的操作进行统一的定义,以保证传入的空字符串可以变为null * @param column 模糊查询列 * @param keyWord 模糊查询关键字 * @param currentPage 当前所在页 * @param lineSize 每页显示的数据行 * @return 根据指定的参数返回有相关的数据,包含如下内容:<br> * 1、key = column、value = 具体的列或者是null;<br> * 2、key = keyWord、value = 具体的模糊的关键字或者是null;<br> * 3、key = start、value = (currentPage - 1) * lineSize;<br> * 4、key = lineSize、value = 每页显示的数据行数。<br> */ protected Map<String, Object> handleParams(String column, String keyWord, int currentPage, int lineSize) { Map<String, Object> map = new HashMap<String, Object>(); if ("".equals(column) || column == null || "null".equalsIgnoreCase(column)) { // map.put("column", null) ; } else { map.put("column", column) ; } if ("".equals(keyWord) || "null".equalsIgnoreCase(keyWord) || keyWord == null) { // map.put("keyWord", null) ; } else { map.put("keyWord", "%" + keyWord + "%") ; } if ((currentPage - 1) * lineSize < 0) { map.put("start", 0) ; } else { map.put("start", (currentPage - 1) * lineSize) ; } map.put("lineSize", lineSize > 0 ? lineSize : 5) ; return map; } }
6f9a80d1ce0749b75a552ac71474e6bfb33259a2
a0ff846a26f7f5f9f733ef73938aa43c0ca91130
/ad-service/src/main/java/com/owasp/adservice/entity/Rating.java
8d43d6cd01a8b8561660e5bfbf729ce0118f4bda
[]
no_license
newbashtrainer/OWASP-Top-10
2a09f25b2d022e1bcfc2d54d9b0624ce180a2534
136fe8786d7dea64474442128c90ff89d13741e1
refs/heads/master
2023-03-29T22:49:51.412253
2021-04-15T16:12:31
2021-04-15T16:12:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package com.owasp.adservice.entity; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import java.util.UUID; @Entity @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class Rating extends BaseEntity { private String grade; // rating private UUID simpleUser; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "ad_id") private Ad ad; }
e1ce38a9c37791b27b07891bdd72b73c6557c071
b34654bd96750be62556ed368ef4db1043521ff2
/auto_screening_management/branches/copilot/src/java/tests/com/cronos/onlinereview/autoscreening/management/accuracytests/ScreeningTaskDoesNotExistExceptionAccuracyTest.java
9843c78aa1f3c8103602f8b7f35262bfe1ac9517
[]
no_license
topcoder-platform/tcs-cronos
81fed1e4f19ef60cdc5e5632084695d67275c415
c4ad087bb56bdaa19f9890e6580fcc5a3121b6c6
refs/heads/master
2023-08-03T22:21:52.216762
2019-03-19T08:53:31
2019-03-19T08:53:31
89,589,444
0
1
null
2019-03-19T08:53:32
2017-04-27T11:19:01
null
UTF-8
Java
false
false
4,063
java
/* * Copyright (C) 2006 TopCoder Inc., All Rights Reserved. */ package com.cronos.onlinereview.autoscreening.management.accuracytests; import com.cronos.onlinereview.autoscreening.management.ScreeningManagementException; import com.cronos.onlinereview.autoscreening.management.ScreeningTaskDoesNotExistException; import junit.framework.TestCase; /** * <p>The accuracy test cases for ScreeningTaskDoesNotExistException class.</p> * * @author oodinary * @version 1.0 */ public class ScreeningTaskDoesNotExistExceptionAccuracyTest extends TestCase { /** * <p>The default upload value of this Exception.</p> */ private final long defaultUpload = 100; /** * <p>The default upload array of this Exception.</p> */ private final long[] defaultUploads = new long[] {1, 10, 100, 1000}; /** * <p>An instance for testing.</p> */ private ScreeningTaskDoesNotExistException defaultException = null; /** * <p>Initialization.</p> * * @throws Exception to JUnit. */ protected void setUp() throws Exception { defaultException = new ScreeningTaskDoesNotExistException(defaultUpload); } /** * <p>Set defaultException to null.</p> * * @throws Exception to JUnit. */ protected void tearDown() throws Exception { defaultException = null; } /** * <p>Tests the ctor(long).</p> * <p>The ScreeningTaskDoesNotExistException instance should be created successfully.</p> */ public void testCtor_Long_Accuracy() { assertNotNull("ScreeningTaskDoesNotExistException should be accurately created.", defaultException); assertTrue("defaultException should be instance of ScreeningTaskDoesNotExistException.", defaultException instanceof ScreeningTaskDoesNotExistException); assertTrue("defaultException should be instance of ScreeningManagementException.", defaultException instanceof ScreeningManagementException); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 1, defaultException.getUploads().length); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", defaultUpload, defaultException.getUploads()[0]); } /** * <p>Tests the ctor(long[]).</p> * <p>The ScreeningTaskDoesNotExistException instance should be created successfully.</p> */ public void testCtor_LongArray_Accuracy() { defaultException = new ScreeningTaskDoesNotExistException(defaultUploads); assertNotNull("ScreeningTaskDoesNotExistException should be accurately created.", defaultException); assertTrue("defaultException should be instance of ScreeningTaskDoesNotExistException.", defaultException instanceof ScreeningTaskDoesNotExistException); assertTrue("defaultException should be instance of ScreeningManagementException.", defaultException instanceof ScreeningManagementException); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 4, defaultException.getUploads().length); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 1, defaultException.getUploads()[0]); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 10, defaultException.getUploads()[1]); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 100, defaultException.getUploads()[2]); assertEquals("ScreeningTaskDoesNotExistException should be accurately created with the same upload value.", 1000, defaultException.getUploads()[3]); } }
[ "mashannon168@fb370eea-3af6-4597-97f7-f7400a59c12a" ]
mashannon168@fb370eea-3af6-4597-97f7-f7400a59c12a
0730e50f2bf13009e57cc3589e268a1a5081b935
dcaba5157193b312022f552eb5dff5b17812a10c
/app/src/main/java/com/wavesplatform/wallet/ui/customviews/CustomKeypad.java
ae3a9602098a17ed7652f6bd7e937d09c082aa78
[ "MIT" ]
permissive
raqeta/WavesWallet-android
063c52204c5ae77ce153ef9539ef7e20465bc2c6
845fbaa0fe12e2ffe5c301ffc59254d7e35b5990
refs/heads/master
2020-03-27T04:53:47.383024
2018-08-13T12:48:18
2018-08-13T12:48:18
145,977,095
1
0
null
2018-08-24T10:17:42
2018-08-24T10:17:41
null
UTF-8
Java
false
false
7,460
java
package com.wavesplatform.wallet.ui.customviews; import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.os.Build; import android.util.AttributeSet; import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TableLayout; import android.widget.TextView; import java.util.ArrayList; import com.wavesplatform.wallet.R; import com.wavesplatform.wallet.util.ViewUtils; import com.wavesplatform.wallet.util.annotations.Thunk; @SuppressWarnings("WeakerAccess") public class CustomKeypad extends LinearLayout implements View.OnClickListener { private ArrayList<EditText> viewList; private String decimalSeparator = "."; @Thunk TableLayout numpad; @Thunk CustomKeypadCallback callback; public CustomKeypad(Context context) { super(context); init(); } public CustomKeypad(Context context, AttributeSet attrs) { super(context, attrs); init(); } public CustomKeypad(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public CustomKeypad(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } private void init() { setOrientation(LinearLayout.HORIZONTAL); setGravity(Gravity.BOTTOM); LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.view_numeric_keyboard, this, true); numpad = (TableLayout) findViewById(R.id.numericPad); numpad.findViewById(R.id.button1).setOnClickListener(this); numpad.findViewById(R.id.button2).setOnClickListener(this); numpad.findViewById(R.id.button3).setOnClickListener(this); numpad.findViewById(R.id.button4).setOnClickListener(this); numpad.findViewById(R.id.button5).setOnClickListener(this); numpad.findViewById(R.id.button6).setOnClickListener(this); numpad.findViewById(R.id.button7).setOnClickListener(this); numpad.findViewById(R.id.button8).setOnClickListener(this); numpad.findViewById(R.id.button9).setOnClickListener(this); numpad.findViewById(R.id.button10).setOnClickListener(this); numpad.findViewById(R.id.button0).setOnClickListener(this); numpad.findViewById(R.id.buttonDeleteBack).setOnClickListener(this); numpad.findViewById(R.id.buttonDone).setOnClickListener(this); viewList = new ArrayList<>(); } public void enableOnView(final EditText view) { if (!viewList.contains(view)) viewList.add(view); view.setTextIsSelectable(true); view.setOnFocusChangeListener((v, hasFocus) -> { if (hasFocus) { View view1 = ((Activity) getContext()).getCurrentFocus(); if (view1 != null) { InputMethodManager inputManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view1.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } setNumpadVisibility(View.VISIBLE); } }); view.setOnClickListener(v -> { ((TextView) numpad.findViewById(R.id.decimal_point)).setText(decimalSeparator); setNumpadVisibility(View.VISIBLE); }); } public void setCallback(CustomKeypadCallback callback) { this.callback = callback; } public void setNumpadVisibility(@ViewUtils.Visibility int visibility) { if (visibility == View.VISIBLE) { showKeyboard(); } else { hideKeyboard(); } } private void showKeyboard() { if (!isVisible()) { Animation bottomUp = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_up); startAnimation(bottomUp); bottomUp.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (callback != null) callback.onKeypadOpenCompleted(); } @Override public void onAnimationRepeat(Animation animation) { } }); setVisibility(View.VISIBLE); if (callback != null) callback.onKeypadOpen(); } } private void hideKeyboard() { if (isVisible()) { Animation topDown = AnimationUtils.loadAnimation(getContext(), R.anim.top_down); startAnimation(topDown); setVisibility(View.GONE); if (callback != null) callback.onKeypadClose(); } } @Override public void onClick(View v) { String pad = ""; switch (v.getId()) { case R.id.button10: pad = decimalSeparator; break; case R.id.buttonDeleteBack: deleteFromFocusedView(); return; case R.id.buttonDone: setNumpadVisibility(View.GONE); break; default: pad = v.getTag().toString().substring(0, 1); break; } // Append tapped # if (pad != null) { appendToFocusedView(pad); } } private void appendToFocusedView(String pad) { for (final EditText view : viewList) { if (view.hasFocus()) { //Don't allow multiple decimals if (pad.equals(decimalSeparator) && view.getText().toString().contains(decimalSeparator)) continue; int startSelection = view.getSelectionStart(); int endSelection = view.getSelectionEnd(); if (endSelection - startSelection > 0) { String selectedText = view.getText().toString().substring(startSelection, endSelection); view.setText(view.getText().toString().replace(selectedText, pad)); } else { view.append(pad); } if (view.getText().length() > 0) { view.post(() -> view.setSelection(view.getText().toString().length())); } } } } private void deleteFromFocusedView() { for (final EditText view : viewList) { if (view.hasFocus() && view.getText().length() > 0) { view.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); view.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL)); } } } public void setDecimalSeparator(String passedDecimalSeparator) { decimalSeparator = passedDecimalSeparator; } public boolean isVisible() { return (getVisibility() == View.VISIBLE); } }
d68f554952e08ff78eeb5fe750f5476858d1a85b
e07ba595ae618298a64f1932ec73e466c29e8713
/src/test/java/com/igeeksky/xtool/core/nlp/RootTest.java
48dd09386948a74205764ebb445e0e7979f9ee3f
[ "Apache-2.0" ]
permissive
gitter-badger/xtool
7cd328b5c96df11360149301b61f2481baf27d58
e92ca1110d8d4cd5abab98ca47239237a492e636
refs/heads/main
2023-09-02T04:40:19.910083
2021-11-20T15:17:25
2021-11-20T15:17:25
430,142,099
0
0
Apache-2.0
2021-11-20T15:41:38
2021-11-20T15:41:37
null
UTF-8
Java
false
false
677
java
package com.igeeksky.xtool.core.nlp; import org.junit.Assert; import org.junit.Test; import java.util.Iterator; import java.util.NoSuchElementException; /** * @author Patrick.Lau * @since 0.0.4 2021-11-20 */ public class RootTest { @Test public void iterator() { Root<String> root = new Root<>('0'); root.addChild('a', new LinkedNodeCreator<>(), null); Iterator<Node<String>> iterator = root.iterator(); boolean hasNext = iterator.hasNext(); Assert.assertTrue(hasNext); iterator.next(); hasNext = iterator.hasNext(); Assert.assertFalse(hasNext); Assert.assertNull(iterator.next()); } }
732bed0ebc3f221b834b17ccdc75d2e146740908
700ea65d5c8cbc5c6ec5f289a317bfc64c6673f2
/Swagger/Swagger-Example/src/main/java/com/springboot/swagger/SwaggerExample/config/SwaggerConfig.java
67227012d6b035fd0a45a8f75cc354c180b62d93
[]
no_license
vaibhu6/164455_Vaibhavi
ac2f097db5693b89abcd7536e211f05ec064b73c
a38ee8646e1b8c031358ca17b3a09af80d5b55bd
refs/heads/master
2020-04-04T09:16:32.685439
2019-02-14T10:36:05
2019-02-14T10:36:05
155,544,453
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.springboot.swagger.SwaggerExample.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 @Configuration public class SwaggerConfig { @Bean public Docket productApi(){ return null; } }
827b755cefdf964864d1657f4c59fe92f8156dbe
fc505e787e6175320154c905286f273fee38dedf
/src/java/entidades/Tipoeducacion.java
471d959b0968e1b6a7bc9914e54891fa876513b7
[]
no_license
Dairunt/TrabajoJava
535845912b3d204c5bcd77125ade7fa984681c25
bf08de66b0c89db7ff8204ee7d90a792d12d5d5d
refs/heads/master
2021-01-18T19:13:30.284622
2016-06-25T02:28:34
2016-06-25T02:28:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,781
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 entidades; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlRootElement; /** * * @author FrancoSebastian */ @Entity @Table(name = "tipoeducacion") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Tipoeducacion.findAll", query = "SELECT t FROM Tipoeducacion t"), @NamedQuery(name = "Tipoeducacion.findById", query = "SELECT t FROM Tipoeducacion t WHERE t.id = :id"), @NamedQuery(name = "Tipoeducacion.findByNombre", query = "SELECT t FROM Tipoeducacion t WHERE t.nombre = :nombre")}) public class Tipoeducacion implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "Id") private Integer id; @Basic(optional = false) @NotNull @Size(min = 1, max = 20) @Column(name = "Nombre") private String nombre; public Tipoeducacion() { } public Tipoeducacion(Integer id) { this.id = id; } public Tipoeducacion(Integer id, String nombre) { this.id = id; this.nombre = nombre; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Tipoeducacion)) { return false; } Tipoeducacion other = (Tipoeducacion) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "entidades.Tipoeducacion[ id=" + id + " ]"; } }
a6e3bf038139d6d5b9a6d7e64a18751fb27b8487
3d2a50e9dd459ffe2faa48febe9f66e3e8c7e554
/src/main/java/br/com/fernandareis/bank/security/SecurityWebConfig.java
c804ba1513e4a7367a0e0c36968c95b4096be1e1
[]
no_license
FernandaRSilva/banco-backend
bff983edb2bf45b5f5047e9fc4b9806c619794a7
57f87b2c6e2c69b8a4d7a98ee3262f59e898b408
refs/heads/master
2020-12-27T18:58:08.919142
2020-02-03T16:54:13
2020-02-03T16:54:13
238,012,873
0
0
null
null
null
null
UTF-8
Java
false
false
1,608
java
package br.com.fernandareis.bank.security; import org.springframework.context.annotation.Bean; 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 org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @EnableWebSecurity public class SecurityWebConfig extends WebSecurityConfigurerAdapter{ @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/resources/**", "/webjars/**").permitAll() // Para qualquer requisição (anyRequest) é preciso estar // autenticado (authenticated). .anyRequest().authenticated() .and() .httpBasic(); } @Override public void configure(AuthenticationManagerBuilder builder) throws Exception { builder .inMemoryAuthentication() .withUser("erik").password("123") .roles("ADMIN") .and() .withUser("fernanda").password("123") .roles("ADMIN") .and() .withUser("victor").password("123") .roles("ADMIN"); } @Bean public PasswordEncoder passwordEncoder() { return NoOpPasswordEncoder.getInstance(); } }
9674cf617e41f637513bb6de4f1457f0ff69ed80
3222aba09d1788a757ecd1d6b0318323b36a515d
/src/ir/values/instructions/SimplifyInstruction.java
b4c0da0a67d7d7e08c7cefebfb1da0933f951325
[ "WTFPL" ]
permissive
No-SF-Work/ayame
6edaccd64658679378845481e3205a8fd1dd4125
8dc191c2e279008c9b4202b8b4dbb0bbf58b4329
refs/heads/main
2023-07-10T20:39:43.650294
2021-08-08T12:21:49
2021-08-08T12:21:49
388,043,672
71
6
null
null
null
null
UTF-8
Java
false
false
19,774
java
package ir.values.instructions; import ir.MyFactoryBuilder; import ir.values.Constants.ConstantInt; import ir.values.GlobalVariable; import ir.values.UndefValue; import ir.values.Value; import ir.values.instructions.Instruction.TAG_; // 参考:LLVM InstructionSimplify public class SimplifyInstruction { public static MyFactoryBuilder factory = MyFactoryBuilder.getInstance(); public static Value simplifyInstruction(Instruction instruction) { return switch (instruction.tag) { case Add -> simplifyAddInst(instruction, true); case Sub -> simplifySubInst(instruction, true); case Mod -> simplifyModInst(instruction, true); case Mul -> simplifyMulInst(instruction, true); case Div -> simplifyDivInst(instruction, true); case Lt -> simplifyLtInst(instruction, true); case Le -> simplifyLeInst(instruction, true); case Ge -> simplifyGeInst(instruction, true); case Gt -> simplifyGtInst(instruction, true); case Eq -> simplifyEqInst(instruction, true); case Ne -> simplifyNeInst(instruction, true); case And -> simplifyAndInst(instruction, true); case Or -> simplifyOrInst(instruction, true); case GEP -> simplifyGEPInst(instruction, true); case Phi -> simplifyPhiInst(instruction, true); case Alloca -> simplifyAllocaInst(instruction, true); case Load -> simplifyLoadInst(instruction, true); case Call -> simplifyCallInst(instruction, true); default -> instruction; }; } public static Boolean isCommutativeOp(TAG_ opTag) { return switch (opTag) { case Add, Mul, And, Or -> true; default -> false; }; } public static Value foldConstant(TAG_ opTag, Value lhs, Value rhs) { if (lhs instanceof ConstantInt) { ConstantInt clhs = (ConstantInt) lhs; if (rhs instanceof ConstantInt) { ConstantInt crhs = (ConstantInt) rhs; if (opTag.ordinal() >= TAG_.Add.ordinal() && opTag.ordinal() <= TAG_.Div.ordinal()) { return ConstantInt.newOne(factory.getI32Ty(), BinaryInst.evalBinary(opTag, clhs, crhs)); } else if (opTag.ordinal() >= TAG_.Lt.ordinal() && opTag.ordinal() <= TAG_.Or.ordinal()) { return ConstantInt.newOne(factory.getI1Ty(), BinaryInst.evalBinary(opTag, clhs, crhs)); } } } return null; } public static Value simplifyAddInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } var targetBB = inst.getBB(); var targetEndInst = targetBB.getList().getLast().getVal(); // try fold and swap Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt || lhs.getType().isNoTy()) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); lhs = inst.getOperands().get(0); rhs = inst.getOperands().get(1); } // lhs + Undef -> Undef if (rhs.getType().isNoTy()) { return new UndefValue(); } // lhs + 0 -> lhs if (rhs instanceof ConstantInt && ((ConstantInt) rhs).getVal() == 0) { return lhs; } // lhs + rhs == 0 // 1. lhs = sub(0, rhs) or rhs = sub(0, lhs) // 2. lhs = sub(a, b) and rhs = sub(b, a) if (lhs instanceof Instruction && rhs instanceof Instruction) { Instruction ilhs = (Instruction) lhs; Instruction irhs = (Instruction) rhs; if (ilhs.tag == TAG_.Sub || irhs.tag == TAG_.Sub) { Value lhsOfIlhs = ilhs.getOperands().get(0); Value rhsOfIlhs = ilhs.getOperands().get(1); Value lhsOfIrhs = irhs.getOperands().get(0); Value rhsOfIrhs = irhs.getOperands().get(1); if ((lhsOfIlhs instanceof ConstantInt) && ((ConstantInt) lhsOfIlhs).getVal() == 0) { if (rhsOfIlhs == rhs) { return ConstantInt.newOne(factory.getI32Ty(), 0); } } else if ((lhsOfIrhs instanceof ConstantInt) && ((ConstantInt) lhsOfIrhs).getVal() == 0) { if (rhsOfIrhs == lhs) { return ConstantInt.newOne(factory.getI32Ty(), 0); } } } } if (!canRecur) { return inst; } if (rhs instanceof BinaryInst && ((Instruction) rhs).tag == TAG_.Sub) { BinaryInst subInst = (BinaryInst) rhs; if (subInst.getOperands().get(1) == lhs) { // X + (Y - X) -> Y return subInst.getOperands().get(0); } else { // X + (Y - Z) -> (X + Y) - Z or (X - Z) + Y var subLhs = subInst.getOperands().get(0); var subRhs = subInst.getOperands().get(1); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), lhs, subLhs); Value simpleAdd = simplifyAddInst(tmpInst, false); if (simpleAdd != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), simpleAdd, subRhs), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), simpleAdd, subRhs, targetBB); } tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), lhs, subRhs); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifyAddInst( new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), simpleSub, subLhs), false); // return new BinaryInst(TAG_.Add, factory.getI32Ty(), simpleSub, subLhs, targetBB); } } } if (lhs instanceof BinaryInst && ((Instruction) lhs).tag == TAG_.Sub) { BinaryInst subInst = (BinaryInst) lhs; if (subInst.getOperands().get(1) == rhs) { // (Y - X) + X -> Y return subInst.getOperands().get(0); } else { // (X - Y) + Z -> (X + Z) - Y or (Z - Y) + X var subLhs = subInst.getOperands().get(0); var subRhs = subInst.getOperands().get(1); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), subLhs, rhs); Value simpleAdd = simplifyAddInst(tmpInst, false); if (simpleAdd != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), simpleAdd, subRhs), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), simpleAdd, subRhs, targetBB); } tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), rhs, subRhs); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifyAddInst( new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), simpleSub, subLhs), false); // return new BinaryInst(TAG_.Add, factory.getI32Ty(), simpleSub, subLhs, targetBB); } } } // TODO 加法结合律优化,共4种 return inst; } public static Value simplifySubInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } var targetBB = inst.getBB(); var targetEndInst = targetBB.getList().getLast().getVal(); Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } // lhs - Undef -> Undef, Undef - rhs -> Undef if (lhs.getType().isNoTy() || rhs.getType().isNoTy()) { return new UndefValue(); } // lhs - 0 -> lhs if (rhs instanceof ConstantInt && ((ConstantInt) rhs).getVal() == 0) { return lhs; } // lhs == rhs if (lhs.equals(rhs)) { return ConstantInt.newOne(factory.getI32Ty(), 0); } // lhs - C -> lhs + (-C) if (rhs instanceof ConstantInt) { int rhsVal = ((ConstantInt) rhs).getVal(); ConstantInt negRhs = ConstantInt.newOne(factory.getI32Ty(), -rhsVal); return simplifyAddInst( new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), lhs, negRhs), true); } // 要做吗? 0 - rhs -> rhs if rhs is 0 or the minimum signed value. if (!canRecur) { return inst; } if (lhs instanceof BinaryInst) { switch (((Instruction) lhs).tag) { // (X + Y) - Z -> X + (Y - Z) or Y + (X - Z) case Add -> { BinaryInst addInst = (BinaryInst) lhs; for (var i = 0; i < 2; i++) { var x = addInst.getOperands().get(i); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), x, rhs); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifyAddInst( new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), addInst.getOperands().get(1 - i), simpleSub), false); // return new BinaryInst(TAG_.Add, factory.getI32Ty(), addInst.getOperands().get(1 - i), // simpleSub, targetBB); } } } // (X - Y) - Z -> (X - Z) - Y or X - (Y + Z) case Sub -> { BinaryInst subInst = (BinaryInst) lhs; var subLhs = subInst.getOperands().get(0); var subRhs = subInst.getOperands().get(1); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), subLhs, rhs); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), simpleSub, subRhs), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), simpleSub, subRhs, targetBB); } tmpInst = new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), subRhs, rhs); Value simpleAdd = simplifyAddInst(tmpInst, false); if (simpleAdd != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), subLhs, simpleAdd), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), subLhs, simpleAdd, targetBB); } } } } if (rhs instanceof BinaryInst) { switch (((Instruction) rhs).tag) { // X - (Y + Z) -> (X - Y) - Z or (X - Z) - Y if everything simplifies. case Add -> { var addInst = (BinaryInst) rhs; for (var i = 0; i < 2; i++) { var x = addInst.getOperands().get(i); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), lhs, x); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), simpleSub, addInst.getOperands().get(1 - i)), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), simpleSub, // addInst.getOperands().get(1 - i), targetBB); } } } // Z - (X - Y) -> (Z - X) + Y or (Z + Y) - X if everything simplifies. case Sub -> { var subInst = (BinaryInst) rhs; var subLhs = subInst.getOperands().get(0); var subRhs = subInst.getOperands().get(1); BinaryInst tmpInst = new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), lhs, subLhs); Value simpleSub = simplifySubInst(tmpInst, false); if (simpleSub != tmpInst) { return simplifyAddInst( new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), simpleSub, subRhs), false); // return new BinaryInst(TAG_.Add, factory.getI32Ty(), simpleSub, subRhs, targetBB); } tmpInst = new BinaryInst(targetEndInst, TAG_.Add, factory.getI32Ty(), lhs, subRhs); Value simpleAdd = simplifyAddInst(tmpInst, false); if (simpleAdd != tmpInst) { return simplifySubInst( new BinaryInst(targetEndInst, TAG_.Sub, factory.getI32Ty(), simpleAdd, subLhs), false); // return new BinaryInst(TAG_.Sub, factory.getI32Ty(), simpleAdd, subLhs, targetBB); } } } } return inst; } public static Value simplifyModInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (rhs instanceof ConstantInt) { int rhsVal = ((ConstantInt) rhs).getVal(); if (rhsVal == 1 || rhsVal == -1) { return ConstantInt.newOne(factory.getI32Ty(), 0); } } return inst; } public static Value simplifyMulInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } var targetBB = inst.getBB(); Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt || lhs.getType().isNoTy()) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); lhs = inst.getOperands().get(0); rhs = inst.getOperands().get(1); } // lhs * Undef -> Undef if (lhs.getType().isNoTy() || rhs.getType().isNoTy()) { return new UndefValue(); } // lhs * 0 -> 0 // lhs * 1 -> lhs if (rhs instanceof ConstantInt) { int rhsVal = ((ConstantInt) rhs).getVal(); switch (rhsVal) { case 0: return ConstantInt.newOne(factory.getI32Ty(), 0); case 1: return lhs; } } if (!canRecur) { return inst; } // TODO 乘法结合律优化,共4种 // TODO 乘法分配律优化 return inst; } public static Value simplifyDivInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (!canRecur) { return inst; } // lhs / 1 -> lhs if (rhs instanceof ConstantInt && ((ConstantInt) rhs).getVal() == 1) { return lhs; } return inst; } private static TAG_ getOppTag(TAG_ t) { return switch (t) { case Lt -> TAG_.Gt; case Le -> TAG_.Ge; case Gt -> TAG_.Lt; case Ge -> TAG_.Le; default -> t; }; } public static Value simplifyLtInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); inst.tag = getOppTag(inst.tag); } return inst; } public static Value simplifyLeInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); inst.tag = getOppTag(inst.tag); } return inst; } public static Value simplifyGeInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); inst.tag = getOppTag(inst.tag); } return inst; } public static Value simplifyGtInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } if (lhs instanceof ConstantInt) { inst.CORemoveAllOperand(); inst.COaddOperand(rhs); inst.COaddOperand(lhs); inst.tag = getOppTag(inst.tag); } return inst; } public static Value simplifyEqInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } // lhs == rhs -> 1 if (lhs.equals(rhs)) { return ConstantInt.newOne(factory.getI1Ty(), 1); } return inst; } public static Value simplifyNeInst(Instruction inst, boolean canRecur) { Value lhs = inst.getOperands().get(0); Value rhs = inst.getOperands().get(1); if (lhs instanceof GlobalVariable) { lhs = ((GlobalVariable) lhs).init; } if (rhs instanceof GlobalVariable) { rhs = ((GlobalVariable) rhs).init; } Value c = foldConstant(inst.tag, lhs, rhs); if (c != null) { return c; } // lhs == rhs -> 0 if (lhs.equals(rhs)) { return ConstantInt.newOne(factory.getI1Ty(), 0); } return inst; } public static Value simplifyAndInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyOrInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyGEPInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyPhiInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyAllocaInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyLoadInst(Instruction inst, boolean canRecur) { return inst; } public static Value simplifyCallInst(Instruction inst, boolean canRecur) { return inst; } }
2e174821bc34c71d57fd42648050550a91b976c0
fe91872a8ba7dee367b42198bebcd99d636ea313
/sn-ctpf/src/main/java/com/snsoft/ctpf/util/VersionUtil.java
8a59c65a8ad21286542f961f7983816a6ae074e1
[]
no_license
jielysong/hxsn4
2a152cef0c1085e409c968180865cc7ff1f8e12b
2c744b4eabab00bde032489d6900dc035a1c5589
refs/heads/master
2021-01-21T21:25:45.027267
2017-06-20T01:46:36
2017-06-20T01:46:36
94,837,559
2
0
null
null
null
null
UTF-8
Java
false
false
3,592
java
package com.snsoft.ctpf.util; import android.content.Context; import android.util.Log; import android.util.Xml; import com.snsoft.ctpf.TApplication; import org.xmlpull.v1.XmlPullParser; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.Callable; import java.util.concurrent.FutureTask; /** * Created by jiely on 2016/6/23. */ public class VersionUtil { //private static final String SERVICE_URL = "http://192.168.12.94:8998"; private static final String VERSION_PATH = "/download/version.xml"; //数据更新地址 private static final String APK_PATH = "/download/sn-ctpf-phone-1.0-android.apk"; private static final String DB_PATH = "/download/sn_ctpf_client.sqlite3"; /** * 从服务器获取数据库版本号或APK版本号 * @param url 数据服务器地址 * @param name 版本名称 "version":apk版本号 "dataVersion":数据库版本号 * @return int */ public static Integer getVersionForUrl(String url,String name){ if(url.length() == 0){ return null; } url = url+VERSION_PATH; NLCallable mCallable = new NLCallable(url,name); FutureTask<Integer> task = new FutureTask<>(mCallable); new Thread(task).start(); Integer version = 0; try { version = task.get(); } catch (Exception e) { Log.i("", "服务器异常,e=" + e); e.printStackTrace(); version = null; } return version; } /** * 获取下载数据库的地址如 http://192.168.12.94:8998/download/sn-ctpf-phone-1.0-android.apk * @param context d * @return url */ public static String getDbUrl(Context context){ String url = TApplication.sysParam.getUrl(); if(url.length() == 0){ AndroidUtil.show(context, "请设置数据库地址"); return ""; } return url+DB_PATH; } /** * 获取下载apk的地址如 http://192.168.12.94:8998/download/sn_ctpf_client.sqlite3 * @param context d * @return url */ public static String getApkUrl(Context context){ String url = TApplication.sysParam.getUrl(); if(url.length() == 0){ AndroidUtil.show(context, "请设置数据库地址"); return ""; } return url+APK_PATH; } private static class NLCallable implements Callable<Integer> { private String url; private String name; public NLCallable(String url,String name){ this.url = url; this.name = name; } @Override public Integer call() throws Exception { URL url = new URL(this.url); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(5000); InputStream is =conn.getInputStream(); XmlPullParser parser = Xml.newPullParser(); parser.setInput(is, "utf-8"); int type = parser.getEventType(); int version = 0; while (type != XmlPullParser.END_DOCUMENT) { switch (type) { case XmlPullParser.START_TAG: if (name.equals(parser.getName())) { version = Integer.parseInt(parser.nextText()); } break; } type = parser.next(); } return version; } } }
ad921957b21646a9715e2568f2d07d41cbef70c7
1e49afe2a4ff1df11763e98317770464ecffa08e
/app/src/main/java/com/example/workouttest/viewModel/ActivityViewModel.java
29d8459104b948c0895f0a09b6040d0f2903c4de
[]
no_license
YousraHiba/WorkoutAppAndroidStudio
8ae20b3f9a5952308da6501a1cab8cb9f5052631
e0a25738d032505a02b79da82a53d48ff1674ce7
refs/heads/main
2023-03-08T08:19:09.560647
2021-02-16T22:21:49
2021-02-16T22:21:49
339,546,934
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
package com.example.workouttest.viewModel; import androidx.lifecycle.ViewModel; import com.example.workouttest.database.ActivityDao; import com.example.workouttest.database.UserDao; import com.example.workouttest.model.Activity; import com.example.workouttest.model.User; import java.util.List; public class ActivityViewModel extends ViewModel { // TODO: Implement the ViewModel private ActivityDao activityDao; public void setActivityDao(ActivityDao activityDao) { this.activityDao = activityDao; } public void startActivity(Activity activity){ activityDao.insertActivity(activity); } public void endActivity(Activity activity){ activityDao.endActivity(activity); } public List<Activity> listActivityByUser(long userId ){ List<Activity> activities = activityDao.getAllActivityByUser(userId); return activities; } }
3a410321635d46fb56c3a4de30cf068fc75c43ac
d546e9bbbaafa82b6d2deb150826f47aa4f83a93
/Java/Module_6_Files/Lesson2/CW2/Humans.java
563fb44cb722bf851af2ec739a871dc54cf9e86e
[]
no_license
Nevermind1993k/Java-Android
ef7ba4450c18ffd6f25b98112ef88211f22575fe
0f389c02a0e20bac7e7f2c06ed897a8d1f871033
refs/heads/master
2020-07-04T12:58:09.189761
2016-09-08T11:24:26
2016-09-08T11:24:26
67,695,312
0
0
null
null
null
null
UTF-8
Java
false
false
1,052
java
package Module_6_Files.Lesson2.CW2; /** * Created by Roman on 18.12.2015. */ public class Humans { private String name; private int age; private int phone; private String mail; public Humans(String name, int age, int phone, String mail) { this.name = name; this.age = age; this.phone = phone; this.mail = mail; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public int getPhone() { return phone; } public void setPhone(int phone) { this.phone = phone; } public String getMail() { return mail; } public void setMail(String mail) { this.mail = mail; } @Override public String toString() { return name + " " + age + " " + phone + " " + mail; } }
1ed3cdb7301f22f93012e5a87457ee0fc98cd830
34149b362d7d71290a50391af4f872966387dc2b
/src/cg/avaliacao/n3/model/obj/CleanObject.java
3d6d87ab584440bb8aa4678fa3cdf16a7a89f790
[]
no_license
viniciusferneda/furb-cg-trabalhos
f58c36658fdfbc64935ca6e3261d13ce266e55db
4ab020c83254899a467cc38485869ebdd9806112
refs/heads/master
2020-04-01T20:50:45.321806
2018-10-18T12:55:02
2018-10-18T12:55:02
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
666
java
package cg.avaliacao.n3.model.obj; import javax.media.opengl.GL; /** * Representa um objeto gráfico nulo. * * @author teixeira */ public final class CleanObject extends ObjetoGrafico { private static final CleanObject INSTANCE = new CleanObject(); public static CleanObject get(){ return INSTANCE; } private CleanObject(){ super(INSTANCE); } @Override public void desenha(GL gl) { } @Override public void desenhaBBox(GL gl) { } @Override public void exibeObjGrafico() { System.out.println("Nenhuma objeto selecionado.");; } @Override public void exibeMatriz() { System.out.println("Nenhum objeto selecionado."); } }
c285488fecf6d7cdf48959c39c7a0ca46e115f09
904e8563b39a0f4c60db242df2f581305cd8d5d3
/fatalis-webapp/src/main/java/com/lawrence/fatalis/config/mybatis/MybatisPlusConfig.java
11dd094f8c4d3ef1bbecc9b3afcb43015967cfb5
[]
no_license
lawrenceteam/fatalis
a6f5ddba3214684267f858a5518d6e7b86945175
442ea78ccb3ac807409d0847cbd5b61f7ea16470
refs/heads/master
2021-08-21T21:05:18.673808
2017-11-29T02:55:13
2017-11-29T02:55:13
111,645,221
0
0
null
null
null
null
UTF-8
Java
false
false
7,360
java
package com.lawrence.fatalis.config.mybatis; import com.alibaba.druid.pool.DruidDataSource; import com.baomidou.mybatisplus.plugins.PaginationInterceptor; import com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean; import com.lawrence.fatalis.config.FatalisProperties; import com.lawrence.fatalis.config.druid.DruidConfig; import com.lawrence.fatalis.config.druid.properties.DruidProperties; import com.lawrence.fatalis.config.druid.properties.DruidSlave; import com.lawrence.fatalis.datasource.DataSourceContext; import com.lawrence.fatalis.datasource.DataSourceType; import com.lawrence.fatalis.util.LogUtil; import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; import org.springframework.transaction.annotation.EnableTransactionManagement; import javax.annotation.Resource; import javax.sql.DataSource; import java.sql.SQLException; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; /** * mybatis-plus配置 */ @Configuration @EnableTransactionManagement(order = 2)// 让spring事务数据源切换aop的后加载 @MapperScan(basePackages = "com.lawrence.fatalis.dao") public class MybatisPlusConfig { @Resource private MybatisProperties mybatisProperties; @Resource private DruidConfig druidConfig; @Resource private DruidProperties druidProperties; @Resource private FatalisProperties fatalisProperties; /** * sessionFactory配置 * * @return GlobalConfiguration */ @Bean(name = "sqlSessionFactory") public SqlSessionFactory sqlSessionFactory() throws Exception { MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean(); sqlSessionFactory.setDataSource(switchDataSourceProxy());// 数据源 Interceptor[] interceptor = {new PaginationInterceptor()}; sqlSessionFactory.setPlugins(interceptor);// 分页插件 ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); sqlSessionFactory.setMapperLocations(resolver.getResources(mybatisProperties.getMapperLocations())); sqlSessionFactory.setConfigLocation(resolver.getResource(mybatisProperties.getConfigLocation())); sqlSessionFactory.setTypeAliasesPackage(mybatisProperties.getTypeAliasesPackage()); return sqlSessionFactory.getObject(); } /** * 根据读写分离开关, 返回不同AbstractRoutingDataSource对象给mybatis * * @return DataSource */ private DataSource switchDataSourceProxy() { DataSource dataSourceProcy = null; // 读写分离开关关闭 if (!fatalisProperties.getMultiDatasourceOpen()) { dataSourceProcy = singleDataSourceProxy(); } else { dataSourceProcy = multiDataSourceProxy(); } return dataSourceProcy; } /** * 读写分离开关关闭时, 加载数据源代理类 * * @return DruidDataSource */ @Bean(name = "singleDataSourceProxy") @ConditionalOnProperty(prefix = "fatalis", name = "multi-datasource-open", havingValue = "false") public DruidDataSource singleDataSourceProxy() { // 单数据源, master DruidDataSource dataSource = new DruidDataSource(); druidConfig.initDatasource(dataSource, DruidConfig.MASTER, 0); return dataSource; } /** * 读写分离开关打开时, 加载数据源代理类 * * @return AbstractRoutingDataSource */ @Bean(name = "multiDataSourceProxy") @ConditionalOnProperty(prefix = "fatalis", name = "multi-datasource-open", havingValue = "true") public AbstractRoutingDataSource multiDataSourceProxy() { // 多数据源, master DruidDataSource masterDataSource = new DruidDataSource(); druidConfig.initDatasource(masterDataSource, DruidConfig.MASTER, 0); // 多数据源, slave, 若干 List<DruidSlave> slaveList = druidProperties.getSlave(); // 从库数据源数量 final int readSize = slaveList.size(); Map<Object, Object> targetDataSources = new HashMap<>(); targetDataSources.put(DataSourceType.master.getType(), masterDataSource); for (int i = 0; i < slaveList.size(); i++) { DruidDataSource slaveDataSource = new DruidDataSource(); druidConfig.initDatasource(slaveDataSource, DruidConfig.SLAVE, i); try { slaveDataSource.init(); } catch (SQLException e) { e.printStackTrace(); } targetDataSources.put(DataSourceType.slave.getType() + i, slaveDataSource); } /** 代理类, 返回对应type数据源 */ AbstractRoutingDataSource proxy = new AbstractRoutingDataSource() { private AtomicLong count = new AtomicLong(0); /** 重写determineCurrentLookupKey方法, 获取数据源key */ @Override protected Object determineCurrentLookupKey() { String typeKey = DataSourceContext.getJdbcType(); if (typeKey == null) { return DataSourceType.master.getType(); } if (typeKey.equals(DataSourceType.master.getType())) { LogUtil.info(getClass(), "切换到数据源master: 写操作"); return DataSourceType.master.getType(); } // 读库负载均衡 long number = count.getAndIncrement(); long lookupIndex = number % readSize; lookupIndex = Math.abs(lookupIndex); LogUtil.info(getClass(), "切换到数据源slave" + lookupIndex + ": 读操作"); return DataSourceType.slave.getType() + lookupIndex; } }; proxy.setDefaultTargetDataSource(masterDataSource);//默认库 proxy.setTargetDataSources(targetDataSources); return proxy; } /** * SqlSessionTemplate配置 * * @return SqlSessionTemplate */ @Bean public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { return new SqlSessionTemplate(sqlSessionFactory); } /** * 事务管理 * * @return DataSourceTransactionManager */ @Bean(name = "transactionManager") public DataSourceTransactionManager transactionManager() { return new DataSourceTransactionManager(switchDataSourceProxy()); } }
9e926d86ea05f15bfe55c907225ab66ccb6814b0
24d8cf871b092b2d60fc85d5320e1bc761a7cbe2
/Freecol/rev5884-6440/left-branch-6440/net/sf/freecol/client/gui/panel/DragListener.java
18e619328bd827b7e4ca39a113d44426525bb826
[]
no_license
joliebig/featurehouse_fstmerge_examples
af1b963537839d13e834f829cf51f8ad5e6ffe76
1a99c1788f0eb9f1e5d8c2ced3892d00cd9449ad
refs/heads/master
2016-09-05T10:24:50.974902
2013-03-28T16:28:47
2013-03-28T16:28:47
9,080,611
3
2
null
null
null
null
UTF-8
Java
false
false
26,045
java
package net.sf.freecol.client.gui.panel; 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.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.TransferHandler; import net.sf.freecol.client.control.InGameController; import net.sf.freecol.client.gui.Canvas; import net.sf.freecol.client.gui.ImageLibrary; import net.sf.freecol.client.gui.i18n.Messages; import net.sf.freecol.client.gui.panel.UnitLabel.UnitAction; import net.sf.freecol.common.Specification; import net.sf.freecol.common.model.AbstractGoods; import net.sf.freecol.common.model.Building; import net.sf.freecol.common.model.Colony; import net.sf.freecol.common.model.ColonyTile; import net.sf.freecol.common.model.EquipmentType; import net.sf.freecol.common.model.Europe; import net.sf.freecol.common.model.GameOptions; import net.sf.freecol.common.model.Goods; import net.sf.freecol.common.model.GoodsType; import net.sf.freecol.common.model.Unit; import net.sf.freecol.common.model.Unit.UnitState; import net.sf.freecol.common.model.UnitType; import net.sf.freecol.common.model.UnitTypeChange.ChangeType; import net.sf.freecol.common.model.WorkLocation; public final class DragListener extends MouseAdapter { private final FreeColPanel parentPanel; private final Canvas canvas; public DragListener(FreeColPanel parentPanel) { this.parentPanel = parentPanel; this.canvas = parentPanel.getCanvas(); } public void mousePressed(MouseEvent e) { JComponent comp = (JComponent) e.getSource(); if ((e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger())) { if (parentPanel.isEditable()) { JPopupMenu menu = null; if (comp instanceof UnitLabel) { menu = getUnitMenu((UnitLabel) comp); } else if (comp instanceof GoodsLabel) { menu = getGoodsMenu((GoodsLabel) comp); } else if (comp instanceof MarketLabel && parentPanel instanceof EuropePanel) { ((EuropePanel) parentPanel).payArrears(((MarketLabel) comp).getType()); } if (menu != null) { int elements = menu.getSubElements().length; if (elements > 0) { int lastIndex = menu.getComponentCount() - 1; if (menu.getComponent(lastIndex) instanceof JPopupMenu.Separator) { menu.remove(lastIndex); } if (System.getProperty("os.name").startsWith("Windows")) { menu.show(canvas, 0, 0); } else { menu.show(comp, e.getX(), e.getY()); } } } } } else { TransferHandler handler = comp.getTransferHandler(); if (e.isShiftDown()) { if (comp instanceof GoodsLabel) { ((GoodsLabel) comp).setPartialChosen(true); } else if (comp instanceof MarketLabel) { ((MarketLabel) comp).setPartialChosen(true); } } else if(e.isAltDown()){ if (comp instanceof GoodsLabel) { ((GoodsLabel) comp).toEquip(true); } else if (comp instanceof MarketLabel) { ((MarketLabel) comp).toEquip(true); } } else { if (comp instanceof GoodsLabel) { ((GoodsLabel) comp).setPartialChosen(false); } else if (comp instanceof MarketLabel) { ((MarketLabel) comp).setPartialChosen(false); ((MarketLabel) comp).setAmount(100); } } if ((comp instanceof UnitLabel) && (((UnitLabel) comp).getUnit().isCarrier())) { Unit u = ((UnitLabel) comp).getUnit(); if (parentPanel instanceof EuropePanel) { if (!u.isBetweenEuropeAndNewWorld()) { ((EuropePanel) parentPanel).setSelectedUnitLabel((UnitLabel) comp); } } else if (parentPanel instanceof ColonyPanel) { ColonyPanel colonyPanel = (ColonyPanel) parentPanel; if(colonyPanel.getSelectedUnit() != u){ colonyPanel.setSelectedUnit(u); colonyPanel.updateInPortPanel(); } } } if (handler != null) { handler.exportAsDrag(comp, e, TransferHandler.COPY); } } } public JPopupMenu getUnitMenu(final UnitLabel unitLabel) { ImageLibrary imageLibrary = parentPanel.getLibrary(); final Unit tempUnit = unitLabel.getUnit(); JPopupMenu menu = new JPopupMenu("Unit"); ImageIcon unitIcon = imageLibrary.getUnitImageIcon(tempUnit); JMenuItem name = new JMenuItem(Messages.getLabel(tempUnit) + " (" + Messages.message("menuBar.colopedia") + ")", imageLibrary.getScaledImageIcon(unitIcon, 0.66f)); name.setActionCommand(UnitAction.COLOPEDIA.toString()); name.addActionListener(unitLabel); menu.add(name); menu.addSeparator(); if (tempUnit.isCarrier()) { if (addCarrierItems(unitLabel, menu)) { menu.addSeparator(); } } if (tempUnit.getLocation().getTile() != null && tempUnit.getLocation().getTile().getColony() != null) { if (addWorkItems(unitLabel, menu)) { menu.addSeparator(); } if (addEducationItems(unitLabel, menu)) { menu.addSeparator(); } if (tempUnit.getLocation() instanceof WorkLocation) { if (tempUnit.getColony().canReducePopulation()) { JMenuItem menuItem = new JMenuItem(Messages.message("leaveTown")); menuItem.setActionCommand(UnitAction.LEAVE_TOWN.toString()); menuItem.addActionListener(unitLabel); menu.add(menuItem); } } else { if (addCommandItems(unitLabel, menu)) { menu.addSeparator(); } } } else if (tempUnit.getLocation() instanceof Europe) { if (addCommandItems(unitLabel, menu)) { menu.addSeparator(); } } if (tempUnit.hasAbility("model.ability.canBeEquipped")) { if (addEquipmentItems(unitLabel, menu)) { menu.addSeparator(); } } return menu; } private boolean addCarrierItems(final UnitLabel unitLabel, final JPopupMenu menu) { final Unit tempUnit = unitLabel.getUnit(); if (tempUnit.getSpaceLeft() < tempUnit.getType().getSpace()) { JMenuItem cargo = new JMenuItem(Messages.message("cargoOnCarrier")); menu.add(cargo); for (Unit passenger : tempUnit.getUnitList()) { JMenuItem menuItem = new JMenuItem(" " + Messages.getLabel(passenger)); menuItem.setFont(menuItem.getFont().deriveFont(Font.ITALIC)); menu.add(menuItem); } for (Goods goods : tempUnit.getGoodsList()) { JMenuItem menuItem = new JMenuItem(" " + goods.toString()); menuItem.setFont(menuItem.getFont().deriveFont(Font.ITALIC)); menu.add(menuItem); } return true; } else { return false; } } private boolean addWorkItems(final UnitLabel unitLabel, final JPopupMenu menu) { final Unit tempUnit = unitLabel.getUnit(); ImageLibrary imageLibrary = parentPanel.getLibrary(); Colony colony = tempUnit.getLocation().getColony(); boolean separatorNeeded = false; List<GoodsType> farmedGoods = Specification.getSpecification().getFarmedGoodsTypeList(); for (GoodsType goodsType : farmedGoods) { ColonyTile bestTile = colony.getVacantColonyTileFor(tempUnit, false, goodsType); if (bestTile != null) { int maxpotential = bestTile.getProductionOf(tempUnit, goodsType); UnitType expert = Specification.getSpecification().getExpertForProducing(goodsType); JMenuItem menuItem = new JMenuItem(Messages.message(goodsType.getId() + ".workAs", "%amount%", Integer.toString(maxpotential)), imageLibrary.getScaledGoodsImageIcon(goodsType, 0.66f)); menuItem.setActionCommand(UnitAction.WORK_TILE.toString() + ":" + goodsType.getId()); menuItem.addActionListener(unitLabel); menu.add(menuItem); separatorNeeded = true; } } for (Building building : colony.getBuildings()) { if (tempUnit.getWorkLocation() != building) { if (building.canAdd(tempUnit)) { GoodsType goodsType = building.getGoodsOutputType(); String locName = Messages.getName(building); JMenuItem menuItem = new JMenuItem(locName); if (goodsType != null) { menuItem.setIcon(imageLibrary.getScaledGoodsImageIcon(goodsType, 0.66f)); int addOutput = building.getAdditionalProductionNextTurn(tempUnit); locName += " (" + addOutput; int potential = building.getAdditionalProduction(tempUnit); if (addOutput < potential) { locName += "/" + potential; } locName += " " + Messages.getName(goodsType)+")"; menuItem.setText(locName); if (addOutput == 0) { menuItem.setForeground(FreeColPanel.LINK_COLOR); } } menuItem.setActionCommand(UnitAction.WORK_BUILDING.toString() + ":" + building.getType().getId()); menuItem.addActionListener(unitLabel); menu.add(menuItem); separatorNeeded = true; } } } if (tempUnit.getWorkTile() != null) { JMenuItem menuItem = new JMenuItem(Messages.message("showProduction")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { canvas.showSubPanel(new WorkProductionPanel(canvas, tempUnit)); } }); menu.add(menuItem); separatorNeeded = true; } else if (tempUnit.getWorkLocation() != null) { JMenuItem menuItem = new JMenuItem(Messages.message("showProductivity")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { canvas.showSubPanel(new WorkProductionPanel(canvas, tempUnit)); } }); menu.add(menuItem); separatorNeeded = true; } return separatorNeeded; } private boolean addEducationItems(final UnitLabel unitLabel, final JPopupMenu menu) { Unit tempUnit = unitLabel.getUnit(); ImageLibrary imageLibrary = parentPanel.getLibrary(); boolean separatorNeeded = false; if (!tempUnit.getGame().getGameOptions().getBoolean(GameOptions.EDUCATE_LEAST_SKILLED_UNIT_FIRST)) { for (Unit teacher : tempUnit.getColony().getTeachers()) { if (tempUnit.canBeStudent(teacher) && tempUnit.getLocation() instanceof WorkLocation && teacher.getStudent() != tempUnit) { JMenuItem menuItem = new JMenuItem(Messages.message("assignToTeacher"), imageLibrary.getScaledImageIcon(imageLibrary.getUnitImageIcon(teacher), 0.5f)); menuItem.setActionCommand(UnitAction.ASSIGN.toString() + ":" + teacher.getId()); menuItem.addActionListener(unitLabel); menu.add(menuItem); separatorNeeded = true; } } } if (tempUnit.getTurnsOfTraining() > 0 && tempUnit.getStudent() != null) { JMenuItem teaching = new JMenuItem(Messages.message("menuBar.teacher") + ": " + tempUnit.getTurnsOfTraining() + "/" + tempUnit.getNeededTurnsOfTraining()); teaching.setEnabled(false); menu.add(teaching); separatorNeeded = true; } int experience = Math.min(tempUnit.getExperience(), 200); if (experience > 0 && tempUnit.getWorkType() != null) { UnitType workType = Specification.getSpecification() .getExpertForProducing(tempUnit.getWorkType()); if (tempUnit.getType().canBeUpgraded(workType, ChangeType.EXPERIENCE)) { JMenuItem experienceItem = new JMenuItem(Messages.message("menuBar.experience") + ": " + experience + "/5000"); experienceItem.setEnabled(false); menu.add(experienceItem); separatorNeeded = true; } } return separatorNeeded; } private boolean addCommandItems(final UnitLabel unitLabel, final JPopupMenu menu) { final Unit tempUnit = unitLabel.getUnit(); JMenuItem menuItem = new JMenuItem(Messages.message("activateUnit")); menuItem.setActionCommand(UnitAction.ACTIVATE_UNIT.toString()); menuItem.addActionListener(unitLabel); menuItem.setEnabled(tempUnit.getState() != UnitState.ACTIVE); menu.add(menuItem); if (!(tempUnit.getLocation() instanceof Europe)) { menuItem = new JMenuItem(Messages.message("fortifyUnit")); menuItem.setActionCommand(UnitAction.FORTIFY.toString()); menuItem.addActionListener(unitLabel); menuItem.setEnabled((tempUnit.getMovesLeft() > 0) && !(tempUnit.getState() == UnitState.FORTIFIED || tempUnit.getState() == UnitState.FORTIFYING)); menu.add(menuItem); } UnitState unitState = tempUnit.getState(); menuItem = new JMenuItem(Messages.message("sentryUnit")); menuItem.setActionCommand(UnitAction.SENTRY.toString()); menuItem.addActionListener(unitLabel); menuItem.setEnabled(unitState != UnitState.SENTRY); menu.add(menuItem); boolean hasTradeRoute = tempUnit.getTradeRoute() != null; menuItem = new JMenuItem(Messages.message("clearUnitOrders")); menuItem.setActionCommand(UnitAction.CLEAR_ORDERS.toString()); menuItem.addActionListener(unitLabel); menuItem.setEnabled((unitState != UnitState.ACTIVE || hasTradeRoute) && !tempUnit.isBetweenEuropeAndNewWorld()); menu.add(menuItem); if (tempUnit.canCarryTreasure() && !tempUnit.getColony().isLandLocked()) { menuItem = new JMenuItem(Messages.message("cashInTreasureTrain.order")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { canvas.getClient().getInGameController() .checkCashInTreasureTrain(tempUnit); } }); menu.add(menuItem); } return true; } private boolean addEquipmentItems(final UnitLabel unitLabel, final JPopupMenu menu) { final Unit tempUnit = unitLabel.getUnit(); ImageLibrary imageLibrary = parentPanel.getLibrary(); boolean separatorNeeded = false; if (tempUnit.getEquipment().size() > 1) { JMenuItem newItem = new JMenuItem(Messages.message("model.equipment.removeAll")); newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Map<EquipmentType, Integer> equipment = new HashMap<EquipmentType, Integer>(tempUnit.getEquipment().getValues()); for (Map.Entry<EquipmentType, Integer> entry: equipment.entrySet()) { canvas.getClient().getInGameController() .equipUnit(tempUnit, entry.getKey(), -entry.getValue()); } unitLabel.updateIcon(); } }); menu.add(newItem); } EquipmentType horses = null; EquipmentType muskets = null; for (EquipmentType equipmentType : Specification.getSpecification().getEquipmentTypeList()) { int count = tempUnit.getEquipment().getCount(equipmentType); if (count > 0) { JMenuItem newItem = new JMenuItem(Messages.message(equipmentType.getId() + ".remove")); if (!equipmentType.getGoodsRequired().isEmpty()) { GoodsType goodsType = equipmentType.getGoodsRequired().get(0).getType(); newItem.setIcon(imageLibrary.getScaledGoodsImageIcon(goodsType, 0.66f)); } final int items = count; final EquipmentType type = equipmentType; newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { canvas.getClient().getInGameController() .equipUnit(tempUnit, type, -items); unitLabel.updateIcon(); } }); menu.add(newItem); } if (tempUnit.canBeEquippedWith(equipmentType) && count == 0) { JMenuItem newItem = null; count = equipmentType.getMaximumCount() - count; if (equipmentType.getGoodsRequired().isEmpty()) { newItem = new JMenuItem(); newItem.setText(Messages.message(equipmentType.getId() + ".add")); } else if (tempUnit.isInEurope() && tempUnit.getOwner().getEurope().canBuildEquipment(equipmentType)) { int price = 0; newItem = new JMenuItem(); for (AbstractGoods goodsRequired : equipmentType.getGoodsRequired()) { price += tempUnit.getOwner().getMarket().getBidPrice(goodsRequired.getType(), goodsRequired.getAmount()); newItem.setIcon(imageLibrary.getScaledGoodsImageIcon(goodsRequired.getType(), 0.66f)); } while (count * price > tempUnit.getOwner().getGold()) { count--; } newItem.setText(Messages.message(equipmentType.getId() + ".add") + " (" + Messages.message("goldAmount", "%amount%", String.valueOf(count * price)) + ")"); } else if (tempUnit.getColony() != null && tempUnit.getColony().canBuildEquipment(equipmentType)) { newItem = new JMenuItem(); for (AbstractGoods goodsRequired : equipmentType.getGoodsRequired()) { int present = tempUnit.getColony().getGoodsCount(goodsRequired.getType()) / goodsRequired.getAmount(); if (present < count) { count = present; } newItem.setIcon(imageLibrary.getScaledGoodsImageIcon(goodsRequired.getType(), 0.66f)); } newItem.setText(Messages.message(equipmentType.getId() + ".add")); } if (newItem != null) { if ("model.equipment.horses".equals(equipmentType.getId())) { horses = equipmentType; } else if ("model.equipment.muskets".equals(equipmentType.getId())) { muskets = equipmentType; } final int items = count; final EquipmentType type = equipmentType; newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { canvas.getClient().getInGameController() .equipUnit(tempUnit, type, items); unitLabel.updateIcon(); } }); menu.add(newItem); } } } if (horses != null && muskets != null && horses.isCompatibleWith(muskets)) { final EquipmentType horseType = horses; final EquipmentType musketType = muskets; JMenuItem newItem = new JMenuItem(Messages.message("model.equipment.dragoon")); newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { canvas.getClient().getInGameController() .equipUnit(tempUnit, horseType, 1); canvas.getClient().getInGameController() .equipUnit(tempUnit, musketType, 1); unitLabel.updateIcon(); } }); menu.add(newItem); } separatorNeeded = true; if (separatorNeeded) { menu.addSeparator(); separatorNeeded = false; } UnitType newUnitType = tempUnit.getType().getUnitTypeChange(ChangeType.CLEAR_SKILL, tempUnit.getOwner()); if (newUnitType != null) { JMenuItem menuItem = new JMenuItem(Messages.message("clearSpeciality")); menuItem.setActionCommand(UnitAction.CLEAR_SPECIALITY.toString()); menuItem.addActionListener(unitLabel); menu.add(menuItem); if(tempUnit.getLocation() instanceof Building && !((Building)tempUnit.getLocation()).canAdd(newUnitType)){ menuItem.setEnabled(false); } separatorNeeded = true; } return separatorNeeded; } public JPopupMenu getGoodsMenu(final GoodsLabel goodsLabel) { final Goods goods = goodsLabel.getGoods(); final InGameController inGameController = canvas.getClient().getInGameController(); ImageLibrary imageLibrary = parentPanel.getLibrary(); JPopupMenu menu = new JPopupMenu("Cargo"); JMenuItem name = new JMenuItem(Messages.getName(goods) + " (" + Messages.message("menuBar.colopedia") + ")", imageLibrary.getScaledGoodsImageIcon(goods.getType(), 0.66f)); name.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { canvas.showPanel(new ColopediaPanel(canvas, ColopediaPanel.PanelType.GOODS, goods.getType())); } }); menu.add(name); if (!(goods.getLocation() instanceof Colony)) { JMenuItem unload = new JMenuItem(Messages.message("unload")); unload.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { inGameController.unloadCargo(goods); if (parentPanel instanceof CargoPanel) { CargoPanel cargoPanel = (CargoPanel) parentPanel; cargoPanel.initialize(); } parentPanel.revalidate(); } }); menu.add(unload); JMenuItem dump = new JMenuItem(Messages.message("dumpCargo")); dump.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { inGameController.unloadCargo(goods, true); if (parentPanel instanceof CargoPanel) { ((CargoPanel) parentPanel).initialize(); } parentPanel.revalidate(); } }); menu.add(dump); } return menu; } }
b048ff8ad0df51ffe35aa207d23e0234d8784741
d092c182f763daf53fb5f5fb973e4fcaaf2fb3cc
/ble-common/src/main/java/no/nordicsemi/android/ble/common/callback/cgm/CGMSessionStartTimeResponse.java
b73e163895652b755d5c9676e191502d05874bee
[ "BSD-3-Clause" ]
permissive
NethunterJack/Android-BLE-Common-Library
7a6c487ca63a6eff1f03bb5d3eb28c56f8a42f09
68804b065c23d8d04155a80267d3146d1a70bfd8
refs/heads/master
2020-04-11T01:42:28.557487
2018-11-08T11:33:11
2018-11-08T11:33:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,692
java
/* * Copyright (c) 2018, Nordic Semiconductor * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package no.nordicsemi.android.ble.common.callback.cgm; import android.bluetooth.BluetoothDevice; import android.os.Parcel; import android.os.Parcelable; import android.support.annotation.NonNull; import java.util.Calendar; import no.nordicsemi.android.ble.data.Data; import no.nordicsemi.android.ble.exception.InvalidDataException; import no.nordicsemi.android.ble.exception.RequestFailedException; /** * Response class that could be used as a result of a synchronous request. * The data received are available through getters, instead of a callback. * <p> * Usage example: * <pre> * try { * CGMSessionStartTimeResponse response = readCharacteristic(characteristic) * .awaitValid(CGMSessionStartTimeResponse.class); * Calendar startTime = response.getStartTime(); * ... * } catch ({@link RequestFailedException} e) { * Log.w(TAG, "Request failed with status " + e.getStatus(), e); * } catch ({@link InvalidDataException} e) { * Log.w(TAG, "Invalid data received: " + e.getResponse().getRawData()); * } * </pre> * </p> */ @SuppressWarnings("unused") public final class CGMSessionStartTimeResponse extends CGMSessionStartTimeDataCallback implements CRCSecuredResponse, Parcelable { private Calendar startTime; private boolean secured; private boolean crcValid; public CGMSessionStartTimeResponse() { // empty } @Override public void onContinuousGlucoseMonitorSessionStartTimeReceived(@NonNull final BluetoothDevice device, @NonNull final Calendar calendar, final boolean secured) { this.startTime = calendar; this.secured = secured; this.crcValid = secured; } @Override public void onContinuousGlucoseMonitorSessionStartTimeReceivedWithCrcError(@NonNull final BluetoothDevice device, @NonNull final Data data) { onInvalidDataReceived(device, data); this.secured = true; this.crcValid = false; } public Calendar getStartTime() { return startTime; } @Override public boolean isSecured() { return secured; } @Override public boolean isCrcValid() { return crcValid; } // Parcelable private CGMSessionStartTimeResponse(final Parcel in) { super(in); if (in.readByte() == 0) { startTime = null; } else { startTime = Calendar.getInstance(); startTime.setTimeInMillis(in.readLong()); } secured = in.readByte() != 0; crcValid = in.readByte() != 0; } @Override public void writeToParcel(final Parcel dest, final int flags) { super.writeToParcel(dest, flags); if (startTime == null) { dest.writeByte((byte) 0); } else { dest.writeByte((byte) 1); dest.writeLong(startTime.getTimeInMillis()); } dest.writeByte((byte) (secured ? 1 : 0)); dest.writeByte((byte) (crcValid ? 1 : 0)); } public static final Creator<CGMSessionStartTimeResponse> CREATOR = new Creator<CGMSessionStartTimeResponse>() { @Override public CGMSessionStartTimeResponse createFromParcel(final Parcel in) { return new CGMSessionStartTimeResponse(in); } @Override public CGMSessionStartTimeResponse[] newArray(final int size) { return new CGMSessionStartTimeResponse[size]; } }; }
08792424229eed5da23a4992a7dbe1da6d3bb82f
65f97db384925a03bc5688208239d35b19c0e14e
/SNSmall2/src/web/payment/action/Action.java
28022f096a294839e4c78919b4fd9798319221e0
[]
no_license
whchoiv6/snsmall
136df867ada1272240ba3ccea6667a5903958db9
df66dd47d935c25eb746c6eb5f8b0535725a3d8e
refs/heads/master
2021-01-20T07:21:00.060534
2017-05-02T05:32:46
2017-05-02T05:32:46
89,993,551
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package web.payment.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public interface Action { public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception; }
6cdf529d1d1a1fcbd8b41ee3c5a66af60bff6474
345dc7e244c33e82f0529bb6906bbec12a0eee1d
/examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/MenuOption.java
579bfc5069f499abe8ca7cb549f7c0e66788d954
[ "Apache-2.0" ]
permissive
reinert/requestor
0e8a23379c1edd2d9b347a889340b50979033d91
ec5fdae1532cded4c45b307ee3b5633e173bc6af
refs/heads/master
2023-08-22T10:49:50.927051
2023-07-10T18:54:06
2023-07-10T18:54:06
26,403,452
70
16
Apache-2.0
2023-04-18T11:11:51
2014-11-09T17:40:34
Java
UTF-8
Java
false
false
7,483
java
/* * Copyright 2015-2021 Danilo Reinert * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.reinert.requestor.examples.showcase; import com.google.gwt.place.shared.Place; import io.reinert.requestor.examples.showcase.place.AuthPlace; import io.reinert.requestor.examples.showcase.place.BinaryDataPlace; import io.reinert.requestor.examples.showcase.place.FiltersPlace; import io.reinert.requestor.examples.showcase.place.FluentRequestApiPlace; import io.reinert.requestor.examples.showcase.place.FormPlace; import io.reinert.requestor.examples.showcase.place.GettingStartedPlace; import io.reinert.requestor.examples.showcase.place.HomePlace; import io.reinert.requestor.examples.showcase.place.InterceptorsPlace; import io.reinert.requestor.examples.showcase.place.RequestBuildingPlace; import io.reinert.requestor.examples.showcase.place.RequestInvokingPlace; import io.reinert.requestor.examples.showcase.place.RequestListeningPlace; import io.reinert.requestor.examples.showcase.place.SerializationPlace; /** * Menu options of Requestor Showcase. */ public enum MenuOption implements HasToken, HasPlace { HOME("Requestor", Tokens.HOME_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new HomePlace(); } }), GETTING_STARTED("Getting Started", Tokens.GETTING_STARTED_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new GettingStartedPlace(section); } }), REQUESTING("Requesting"), REQUESTING_FLUENT_API("Request Fluent API", Tokens.REQUESTING_FLUENT_API_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new FluentRequestApiPlace(section); } }, REQUESTING), REQUEST_BUILDING("Request Building", Tokens.REQUEST_BUILDING_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new RequestBuildingPlace(section); } }, REQUESTING), REQUEST_INVOKING("Request Invoking", Tokens.REQUEST_INVOKING_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new RequestInvokingPlace(section); } }, REQUESTING), REQUEST_LISTENING("Request Listening", Tokens.REQUEST_LISTENING_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new RequestListeningPlace(section); } }, REQUESTING), PROCESSORS("Processors"), AUTHENTICATION("Authentication", Tokens.AUTHENTICATION_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new AuthPlace(section); } }, PROCESSORS), SERIALIZATION("Serialization", Tokens.SERIALIZATION_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new SerializationPlace(section); } }, PROCESSORS), FILTERS("Filters", Tokens.FILTERS_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new FiltersPlace(section); } }, PROCESSORS), INTERCEPTORS("Interceptors", Tokens.INTERCEPTORS_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new InterceptorsPlace(section); } }, PROCESSORS), FEATURES("Features"), FORM("Form Data", Tokens.FORM_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new FormPlace(section); } }, FEATURES), BINARY_DATA("Binary Data", Tokens.BINARY_DATA_TOKEN, new HasPlace() { @Override public Place getPlace(String section) { return new BinaryDataPlace(section); } }, FEATURES) ; public static class Tokens { public static final String HOME_TOKEN = "home"; public static final String GETTING_STARTED_TOKEN = "getting-started"; public static final String REQUESTING_FLUENT_API_TOKEN = "requesting-fluent-api"; public static final String REQUEST_BUILDING_TOKEN = "request-building"; public static final String REQUEST_INVOKING_TOKEN = "request-invoking"; public static final String REQUEST_LISTENING_TOKEN = "request-listening"; public static final String SERIALIZATION_TOKEN = "serialization"; public static final String FORM_TOKEN = "form-data"; public static final String BINARY_DATA_TOKEN = "binary-data"; public static final String AUTHENTICATION_TOKEN = "authentication"; public static final String FILTERS_TOKEN = "filters"; public static final String INTERCEPTORS_TOKEN = "interceptors"; } public static MenuOption of(String token) { if (token.equals(Tokens.GETTING_STARTED_TOKEN)) { return GETTING_STARTED; } else if (token.equals(Tokens.REQUESTING_FLUENT_API_TOKEN)) { return REQUESTING_FLUENT_API; } else if (token.equals(Tokens.REQUEST_BUILDING_TOKEN)) { return REQUEST_BUILDING; } else if (token.equals(Tokens.REQUEST_INVOKING_TOKEN)) { return REQUEST_INVOKING; } else if (token.equals(Tokens.REQUEST_LISTENING_TOKEN)) { return REQUEST_LISTENING; } else if (token.equals(Tokens.SERIALIZATION_TOKEN)) { return SERIALIZATION; } else if (token.equals(Tokens.FORM_TOKEN)) { return FORM; } else if (token.equals(Tokens.BINARY_DATA_TOKEN)) { return BINARY_DATA; } else if (token.equals(Tokens.AUTHENTICATION_TOKEN)) { return AUTHENTICATION; } else if (token.equals(Tokens.FILTERS_TOKEN)) { return FILTERS; } else if (token.equals(Tokens.INTERCEPTORS_TOKEN)) { return INTERCEPTORS; } else { return HOME; } } private final String label; private final String token; private final HasPlace place; private final MenuOption parent; private MenuOption(String label) { this(label, null, null, null); } private MenuOption(String label, String token, HasPlace place) { this(label, token, place, null); } private MenuOption(String label, String token, HasPlace place, MenuOption parent) { this.label = label; this.token = token; this.place = place; this.parent = parent; } public String getLabel() { return label; } @Override public Place getPlace(String section) { return place.getPlace(section); } @Override public String getToken() { return token; } public boolean isGroup() { return token == null; } public MenuOption getParent() { return parent; } public boolean hasParent() { return parent != null; } }
8045dd09396885854823194beb87ee80438e4090
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes2/com/tencent/mobileqq/log/ReportLogHelper.java
4a0292f2f5b0c1e94c6661abbefe29720272a51a
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,588
java
package com.tencent.mobileqq.log; import android.content.Context; import android.os.Environment; import com.tencent.mobileqq.hotpatch.NotVerifyClass; import java.io.File; public abstract class ReportLogHelper { public static final String a = "log.txt"; static String b = ""; static String c = ""; static String d = ""; static { boolean bool = NotVerifyClass.DO_VERIFY_CLASS; } public static String a(Context paramContext, String paramString) { if (("mounted".equals(Environment.getExternalStorageState())) && (Environment.getExternalStorageDirectory().canWrite())) { paramContext = new File(Environment.getExternalStorageDirectory().getPath() + paramString); if (!paramContext.exists()) { paramContext.mkdirs(); } return paramContext.getAbsolutePath(); } return paramContext.getFilesDir().getAbsolutePath(); } /* Error */ public static void a(String paramString1, String paramString2, boolean paramBoolean) { // Byte code: // 0: aconst_null // 1: astore 4 // 3: new 52 java/io/File // 6: dup // 7: getstatic 94 com/tencent/mobileqq/app/AppConstants:bn Ljava/lang/String; // 10: invokespecial 72 java/io/File:<init> (Ljava/lang/String;)V // 13: astore_3 // 14: aload_3 // 15: invokevirtual 75 java/io/File:exists ()Z // 18: ifne +8 -> 26 // 21: aload_3 // 22: invokevirtual 78 java/io/File:mkdirs ()Z // 25: pop // 26: new 96 java/io/FileWriter // 29: dup // 30: new 52 java/io/File // 33: dup // 34: new 58 java/lang/StringBuilder // 37: dup // 38: invokespecial 59 java/lang/StringBuilder:<init> ()V // 41: getstatic 94 com/tencent/mobileqq/app/AppConstants:bn Ljava/lang/String; // 44: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 47: ldc 8 // 49: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 52: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String; // 55: invokespecial 72 java/io/File:<init> (Ljava/lang/String;)V // 58: iconst_1 // 59: invokespecial 99 java/io/FileWriter:<init> (Ljava/io/File;Z)V // 62: astore_3 // 63: aload_3 // 64: new 58 java/lang/StringBuilder // 67: dup // 68: invokespecial 59 java/lang/StringBuilder:<init> ()V // 71: ldc 101 // 73: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 76: getstatic 23 com/tencent/mobileqq/log/ReportLogHelper:b Ljava/lang/String; // 79: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 82: ldc 103 // 84: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 87: getstatic 25 com/tencent/mobileqq/log/ReportLogHelper:c Ljava/lang/String; // 90: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 93: ldc 105 // 95: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 98: getstatic 27 com/tencent/mobileqq/log/ReportLogHelper:d Ljava/lang/String; // 101: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 104: ldc 107 // 106: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 109: ldc 109 // 111: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 114: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String; // 117: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 120: aload_3 // 121: ldc 114 // 123: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 126: new 116 android/text/format/Time // 129: dup // 130: invokespecial 117 android/text/format/Time:<init> ()V // 133: astore 4 // 135: aload 4 // 137: invokevirtual 120 android/text/format/Time:setToNow ()V // 140: aload_3 // 141: new 58 java/lang/StringBuilder // 144: dup // 145: invokespecial 59 java/lang/StringBuilder:<init> ()V // 148: aload 4 // 150: ldc 122 // 152: invokevirtual 126 android/text/format/Time:format (Ljava/lang/String;)Ljava/lang/String; // 155: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 158: ldc -128 // 160: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 163: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String; // 166: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 169: aload_3 // 170: ldc -126 // 172: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 175: aload_3 // 176: ldc 114 // 178: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 181: aload_0 // 182: ifnull +31 -> 213 // 185: aload_3 // 186: new 58 java/lang/StringBuilder // 189: dup // 190: invokespecial 59 java/lang/StringBuilder:<init> ()V // 193: ldc -124 // 195: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 198: aload_0 // 199: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 202: ldc -122 // 204: invokevirtual 66 java/lang/StringBuilder:append (Ljava/lang/String;)Ljava/lang/StringBuilder; // 207: invokevirtual 69 java/lang/StringBuilder:toString ()Ljava/lang/String; // 210: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 213: aload_3 // 214: aload_1 // 215: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 218: aload_3 // 219: ldc 114 // 221: invokevirtual 112 java/io/FileWriter:write (Ljava/lang/String;)V // 224: aload_3 // 225: invokevirtual 137 java/io/FileWriter:close ()V // 228: iconst_0 // 229: ifeq +11 -> 240 // 232: new 139 java/lang/NullPointerException // 235: dup // 236: invokespecial 140 java/lang/NullPointerException:<init> ()V // 239: athrow // 240: return // 241: astore_1 // 242: aload 4 // 244: astore_0 // 245: aload_1 // 246: invokevirtual 143 java/lang/Exception:printStackTrace ()V // 249: aload_0 // 250: ifnull -10 -> 240 // 253: aload_0 // 254: invokevirtual 137 java/io/FileWriter:close ()V // 257: return // 258: astore_0 // 259: return // 260: astore_0 // 261: aconst_null // 262: astore_1 // 263: aload_1 // 264: ifnull +7 -> 271 // 267: aload_1 // 268: invokevirtual 137 java/io/FileWriter:close ()V // 271: aload_0 // 272: athrow // 273: astore_0 // 274: return // 275: astore_1 // 276: goto -5 -> 271 // 279: astore_0 // 280: aload_3 // 281: astore_1 // 282: goto -19 -> 263 // 285: astore_3 // 286: aload_0 // 287: astore_1 // 288: aload_3 // 289: astore_0 // 290: goto -27 -> 263 // 293: astore_1 // 294: aload_3 // 295: astore_0 // 296: goto -51 -> 245 // Local variable table: // start length slot name signature // 0 299 0 paramString1 String // 0 299 1 paramString2 String // 0 299 2 paramBoolean boolean // 13 268 3 localObject1 Object // 285 10 3 localObject2 Object // 1 242 4 localTime android.text.format.Time // Exception table: // from to target type // 3 26 241 java/lang/Exception // 26 63 241 java/lang/Exception // 253 257 258 java/lang/Exception // 3 26 260 finally // 26 63 260 finally // 232 240 273 java/lang/Exception // 267 271 275 java/lang/Exception // 63 181 279 finally // 185 213 279 finally // 213 228 279 finally // 245 249 285 finally // 63 181 293 java/lang/Exception // 185 213 293 java/lang/Exception // 213 228 293 java/lang/Exception } } /* Location: E:\apk\QQ_91\classes2-dex2jar.jar!\com\tencent\mobileqq\log\ReportLogHelper.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
be5e89f2d7aade348371b59cbd8824a7fa9ecec4
f7f89e45e25c502a24fda86550f05980fbbf1481
/ripple-core/src/main/java/net/fortytwo/ripple/libs/stack/Top.java
ccc494c5734ffac9dab8c28c74f2111ff12eebaa
[ "MIT" ]
permissive
pulquero/ripple
4362d4ad15af20d92e1062d174385b3a5406396f
63368c5e753f55ac341e5202b78dfe30dfe242d4
refs/heads/develop
2020-12-28T00:02:04.783796
2015-12-08T22:40:18
2015-12-08T22:40:18
57,923,249
0
0
null
2016-05-02T21:41:49
2016-05-02T21:41:49
null
UTF-8
Java
false
false
1,233
java
package net.fortytwo.ripple.libs.stack; import net.fortytwo.flow.Sink; import net.fortytwo.ripple.RippleException; import net.fortytwo.ripple.model.ModelConnection; import net.fortytwo.ripple.model.PrimitiveStackMapping; import net.fortytwo.ripple.model.RippleList; /** * A filter which discards all of the stack apart from the topmost item. * * @author Joshua Shinavier (http://fortytwo.net) */ public class Top extends PrimitiveStackMapping { private static final String[] IDENTIFIERS = { StackLibrary.NS_2013_03 + "top"}; public String[] getIdentifiers() { return IDENTIFIERS; } public Top() throws RippleException { super(); } public Parameter[] getParameters() { return new Parameter[]{ new Parameter("d", "item at the top of the stack which is preserved", true)}; } public String getComment() { return "retains the topmost item on the stack and throws away the rest of the stack"; } public void apply(final RippleList arg, final Sink<RippleList> solutions, final ModelConnection mc) throws RippleException { solutions.put(mc.list().push(arg.getFirst())); } }
afba040c51de639f0eae5f5efb079f301ffc7ac7
6ab1afaf448bec19e3b7ef6e51613a024149690a
/src/main/java/com/lisong/learn/core/exceptions/Exercise26.java
7b47c7b9aaeba11fde7fe1657052b5914d62f08d
[ "Apache-2.0" ]
permissive
lisongwang/java-core
3c3ec98277447b8a976f2e05ae69b66032897a68
a76dd87cb0492e2eeefd2a4e06487f64f29af578
refs/heads/master
2022-07-11T11:15:16.943705
2020-03-11T14:24:59
2020-03-11T14:24:59
222,645,235
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.lisong.learn.core.exceptions; import java.io.FileInputStream; public class Exercise26 { public static void main(String[] args) throws Exception { FileInputStream file = new FileInputStream("Main.java"); file.close(); } }
91175af915e6f7f3be887c230f0c2f038f4f2e2b
104a9e5d03b680f8bc180d30b87dc196a281c291
/src/principiosegregacaointerfacecerto/PrincipioSegregacaoInterfaceCerto.java
dfd9c50c0b862094f56298526be59d59dd9a9c4a
[]
no_license
vitorhugoc98/PrincipioSegregacaoInterfaceCerto
3f242e7d5fcede63c662832aa5bcee5153c48074
c8c51e9ec8cab53b4ace66990ac381a7c5b23f70
refs/heads/master
2021-01-05T00:21:16.140510
2020-02-29T06:59:16
2020-02-29T06:59:16
240,812,904
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package principiosegregacaointerfacecerto; public class PrincipioSegregacaoInterfaceCerto { public static void main(String[] args) { ClientePessoaFisica pessoaf01 = new ClientePessoaFisica("Lucas Fernandes", "708.652.531-61"); ClientePessoaJuridica pessoaj01 = new ClientePessoaJuridica("Time Share Soluções LTDA", "19.819.955/0001-01"); System.out.println("PF Nome: " + pessoaf01.getNome()); System.out.println("PF CPF: " + pessoaf01.getCpf()); System.out.println("PJ razão Social: " + pessoaj01.getRazaoSocial()); System.out.println("PJ CNPJ: " + pessoaj01.getCnpj()); } }
[ "seu email aqui" ]
seu email aqui
a4ec4164a59078f4a8d625de68f9005ac8ffc619
badde00d7d891871c551ae021120d577b4f98ab7
/src/main/java/co/gov/icfes/emailvalidator/MainApp.java
f8a68fba79d205d1d2ac4d6bcbb2de4ef4ab4743
[]
no_license
ferchop1089/emailvalidator
cf304a80193e47d46721e88b4eb3a12336a17aeb
7563603e2adb09cac364c8d72ad1545002007e0a
refs/heads/master
2021-06-16T02:06:00.954034
2017-05-08T23:32:28
2017-05-08T23:32:28
90,581,924
0
0
null
null
null
null
UTF-8
Java
false
false
1,072
java
package co.gov.icfes.emailvalidator; import javafx.application.Application; import static javafx.application.Application.launch; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class MainApp extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add("/styles/Styles.css"); stage.setTitle("JavaFX and Maven"); stage.setScene(scene); stage.show(); } /** * The main() method is ignored in correctly deployed JavaFX application. * main() serves only as fallback in case the application can not be * launched through deployment artifacts, e.g., in IDEs with limited FX * support. NetBeans ignores main(). * * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
d296e7bd041498921c1994d8218ef184bd7d4d09
964ec371ddd11d55667b2d0eabb99f9b1211fe83
/Nedelja 4/Nedelja/src/Poruka.java
afaa2daeeb1ed594aca71b75400d8d4ae8c24461
[]
no_license
Ljuba97/DomaciITBC
8beb84de54e51602bc560764c8bc2c375d555f68
a40025f4786338d2fdf344b0ecfad49e6d29a314
refs/heads/master
2023-08-17T18:15:51.665189
2021-10-08T15:15:36
2021-10-08T15:15:36
395,746,098
1
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
import java.util.ArrayList; public class Poruka { private Niska poruka; private Niska posiljalac; private Niska primalac; private int id; public Poruka() { poruka = posiljalac = primalac = null; id = 0; } public Poruka(Niska poruka, Niska posiljalac, Niska primalac, int id) { this.poruka = poruka; this.posiljalac = posiljalac; this.primalac = primalac; this.id = id; } public Niska getPoruka() { return poruka; } public Niska getPosiljalac() { return posiljalac; } public Niska getPrimalac() { return primalac; } public int getId() { return id; } public void sifrujZaK(int k) { char[] novaPoruka = new char[poruka.length()]; for (int i = 0; i < novaPoruka.length; i++) { novaPoruka[i] = (char)((int)poruka.getChars()[i] + k); } poruka = new Niska(novaPoruka); } public void desifruj(int k) { char[] novaPoruka = new char[poruka.length()]; for (int i = 0; i < novaPoruka.length; i++) { novaPoruka[i] = (char)((int)poruka.getChars()[i] - k); } poruka = new Niska(novaPoruka); } @Override public String toString() { return id + "\n" + posiljalac + " salje " + primalac + " poruku: \n" + poruka; } }
fb18054fc742de9a685797f6bd25cb0f46d3f4c8
507bff6330eabd8942850568634e1a8fbf08e20a
/Java_023_finale/src/com/callor/fine/service/ScoreService.java
0e1984d9735f9f0d181831ac0037e02281fa103d
[]
no_license
inqu0302/Biz_403_2021_03_Java
a6f6e805bfa18529c471ec4076260004fa3884f3
187100cf2a9e0623516784cc21f0496b0199ee50
refs/heads/master
2023-04-18T06:13:45.672749
2021-04-26T07:40:56
2021-04-26T07:40:56
348,223,471
0
1
null
null
null
null
UTF-8
Java
false
false
122
java
package com.callor.fine.service; public interface ScoreService { public void inputScore(); public void printList(); }
b06f3d1e450a44cc21834431d9a92180cf4c6076
1810032d6ac1d8c80dfb51924064459de5d4002f
/Design/1032StreamofCharacters.java
daae3ff25ff0444484b63a053b38cc9cb4642378
[]
no_license
Xinying-G/Leetcode
75515914cbcb9f201ac8517b8ed48203a6d9df05
45be1abdfdd938a0071bb1d1cb93e00942af2149
refs/heads/master
2020-04-23T08:29:14.375212
2019-09-29T01:23:11
2019-09-29T01:23:11
171,038,624
0
0
null
null
null
null
UTF-8
Java
false
false
2,787
java
// 1032. Stream of Characters // Implement the StreamChecker class as follows: // StreamChecker(words): Constructor, init the data structure with the given words. // query(letter): returns true if and only if for some k >= 1, the last k characters queried (in order from oldest to newest, including this letter just queried) spell one of the words in the given list. // Example: // StreamChecker streamChecker = new StreamChecker(["cd","f","kl"]); // init the dictionary. // streamChecker.query('a'); // return false // streamChecker.query('b'); // return false // streamChecker.query('c'); // return false // streamChecker.query('d'); // return true, because 'cd' is in the wordlist // streamChecker.query('e'); // return false // streamChecker.query('f'); // return true, because 'f' is in the wordlist // streamChecker.query('g'); // return false // streamChecker.query('h'); // return false // streamChecker.query('i'); // return false // streamChecker.query('j'); // return false // streamChecker.query('k'); // return false // streamChecker.query('l'); // return true, because 'kl' is in the wordlist // Note: // 1 <= words.length <= 2000 // 1 <= words[i].length <= 2000 // Words will only consist of lowercase English letters. // Queries will only consist of lowercase English letters. // The number of queries is at most 40000. class TrieNode{ char val; boolean isWord; TrieNode[] children = new TrieNode[26]; public TrieNode(char ch){ val = ch; } } class StreamChecker { TrieNode root; StringBuilder sb; public StreamChecker(String[] words) { root = new TrieNode(' '); buildTrie(words); sb = new StringBuilder(); } public boolean query(char letter) { sb.append(letter); TrieNode node = root; for(int i = sb.length()-1; i >= 0; i--){ if(node == null) continue; node = node.children[sb.charAt(i) - 'a']; if(node != null && node.isWord) return true; } return false; } public void buildTrie(String[] words){ for(String word: words){ TrieNode node = root; for(int i = word.length()-1; i >= 0; i--){ if(node.children[word.charAt(i) - 'a'] == null){ node.children[word.charAt(i) - 'a'] = new TrieNode(word.charAt(i)); } node = node.children[word.charAt(i) - 'a']; } node.isWord = true; } } } /** * Your StreamChecker object will be instantiated and called as such: * StreamChecker obj = new StreamChecker(words); * boolean param_1 = obj.query(letter); */
9f3ea9be9750003e34c84930c6c2481efb0c0105
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_43_buggy/mutated/510/HtmlTreeBuilderState.java
6569b9b014685594aca59a1b99fb73892ae48964
[]
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,205
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 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 < "track".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); } }
0ad06888969eac645d3ebeaba78a90993ac94b7f
59d6075904c0a964ea4667e19a6a4318983976a9
/Formatieve Opdracht 2a/src/Main.java
632de61199ec69ccb881f71f4df843cda01e907e
[]
no_license
DragonKiller952/Adaptive-Programming
6017019e359f5f3bb06eed50b43ae74379421510
9448afa7f58061c1fa8232344f5005804ed09fe8
refs/heads/master
2022-09-03T16:32:01.489281
2020-05-29T19:59:28
2020-05-29T19:59:28
255,908,668
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
import java.util.Scanner; public class Main { public static void main(String[] program) { //Create nodes Node s0 = new Node("s0"); Node s1 = new Node("s1"); Node s2 = new Node("s2"); Node s3 = new Node("s3"); //Connect all the nodes s0.setNodeA(s2); s0.setNodeB(s1); s1.setNodeA(s1); s1.setNodeB(s2); s2.setNodeB(s3); s3.setNodeA(s3); s3.setNodeB(s0); //Read from the console (keyboard) System.out.println("Geef het programma:"); Scanner in = new Scanner(System.in); String myInput = in.nextLine().toUpperCase(); String [] myProgram = myInput.split(""); //Create new State machine FSM fsm = new FSM(); fsm.setProgram(myProgram); //set the program fsm.setCurrentNode(s0); //Set the startnode fsm.run(); //run the program System.out.println(fsm); } }
5de56909dea842960a27b92a7f21203c6b79960e
f7c31d91a48741d700d8954518292ba047ee3c67
/1.疯狂Android讲义/06/6.13/DpiTest/src/org/crazyit/res/DpiTest.java
08fb3324f25315bfd08fe16570de0c7e0da1959e
[]
no_license
caofengbin/BookCode
869b1abaa487dbc7bed79cfd276b1e74f9c38aec
8efee565b1f34be1d92ee04b7541d09d36d13118
refs/heads/master
2021-01-25T01:05:03.690847
2018-01-27T10:56:52
2018-01-27T10:56:52
94,725,841
0
0
null
null
null
null
UTF-8
Java
false
false
550
java
package org.crazyit.res; import android.os.Bundle; import android.app.Activity; /** * Description: <br/> * site: <a href="http://www.crazyit.org">crazyit.org</a> <br/> * Copyright (C), 2001-2014, Yeeku.H.Lee <br/> * This program is protected by copyright laws. <br/> * Program Name: <br/> * Date: * @author Yeeku.H.Lee [email protected] * @version 1.0 */ public class DpiTest extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
2b613fdf503a905e850262ce09a03065989a4d89
c0c80ac5a38f67ab36c6e681cdeeefe2cc775088
/AppUserDetailsService.java
4be0cf6628e66c3755ad8eced0e59d06823bcde7
[]
no_license
Selvasrinivas/project-payment
9eb972a808fabbb1f45b9845c47bd2706c429c8e
c319ffdbf02a4880367d88d7da15772b2a5d6431
refs/heads/master
2020-09-17T20:54:57.844511
2019-11-26T09:43:50
2019-11-26T09:43:50
224,114,852
0
0
null
null
null
null
UTF-8
Java
false
false
2,308
java
package com.cognizant.authenticationservice.security; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import com.cognizant.authenticationservice.exception.UserAlreadyExistsException; import com.cognizant.authenticationservice.model.Role; import com.cognizant.authenticationservice.model.User; import com.cognizant.authenticationservice.repository.RoleRepository; import com.cognizant.authenticationservice.repository.UserRepository; @Service public class AppUserDetailsService implements UserDetailsService{ private static final Logger LOGGER = LoggerFactory.getLogger(AppUserDetailsService.class); @Autowired UserRepository userRepository; @Autowired RoleRepository roleRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if(user==null){ throw new UsernameNotFoundException("User not found!"); } else { LOGGER.info("user is:"+user); AppUser appUser = new AppUser(user); return appUser; } } public AppUserDetailsService(UserRepository userRepository) { super(); this.userRepository = userRepository; } public void signup(User newUser) throws UserAlreadyExistsException{ LOGGER.info("NEW USER IS: "+newUser); User user = userRepository.findByUsername(newUser.getUsr_id()); if(user!=null){ throw new UserAlreadyExistsException(); } else { Role role = roleRepository.findById(1).get(); LOGGER.info("NEW ROLE IS: "+role); List<Role> roles = new ArrayList<Role>(); roles.add(role); newUser.setRoleList(roles); BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); String encodedPassword = bCryptPasswordEncoder.encode(newUser.getPassword()); newUser.setPassword(encodedPassword); userRepository.save(newUser); } } }
b77a5c1e0c0a347b02d87835b884b9d45e413d27
2f3863e6ea791037ac6b6ddfafeb508ce505ecfc
/thread/src/threadpool.java
7781df68628e929f28852207760910b7b8dfa21b
[]
no_license
speakup35/thread
76c091b64edfef58330d163365b48602ee66d71b
1d43c09a5c5999cd72ab7f737e9d65f33f101b09
refs/heads/master
2021-01-10T03:39:47.809071
2016-09-18T10:02:04
2016-09-18T10:02:04
45,436,855
0
0
null
null
null
null
UTF-8
Java
false
false
1,126
java
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; class Processors implements Runnable { private int id; public Processors(int id) { this.id = id; } public void run() { System.out.println("Starting: " + id); try { Thread.sleep(5000); } catch (InterruptedException e) { } System.out.println("Completed: " + id); } } public class threadpool { public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(2); for(int i=0; i<5; i++) { executor.submit(new Processors(i)); } executor.shutdown(); System.out.println("All tasks submitted."); try { executor.awaitTermination(1, TimeUnit.DAYS); } catch (InterruptedException e) { } System.out.println("All tasks completed."); } }
2a24dc350355c7a14184d72e5827e4d0fff2e8fc
80452ab838652b27118848ca2266f9fde56ce03f
/app/src/main/java/bola/wiradipa/org/lapanganbola/ProfileActivity.java
10be87e3b01e91fc2f55c8b5b747f7b7e5dd0bad
[]
no_license
CruthOver/UserLapangBola
bf5f294ed5e7ca4defdeb8649ecb17ba03cedd23
7d40a422c4cb3e1927661682aa62415210cbac3e
refs/heads/master
2020-04-17T20:59:27.652022
2019-02-18T09:44:37
2019-02-18T09:44:37
166,927,156
0
0
null
null
null
null
UTF-8
Java
false
false
3,692
java
package bola.wiradipa.org.lapanganbola; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.google.gson.Gson; import com.squareup.picasso.Picasso; import bola.wiradipa.org.lapanganbola.controllers.BaseActivity; import bola.wiradipa.org.lapanganbola.helpers.apihelper.UtilsApi; import bola.wiradipa.org.lapanganbola.models.Player; import bola.wiradipa.org.lapanganbola.models.User; public class ProfileActivity extends BaseActivity { private Button btnEdit, btnUploadCard; private Player player; private TextView tvName, tvUsername, tvPhone, tvStudent; private ImageView ivAvatar; private Picasso picasso; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); checkSession(); picasso = Picasso.get(); ivAvatar = findViewById(R.id.avatar); tvName = findViewById(R.id.name); tvUsername = findViewById(R.id.username); tvPhone = findViewById(R.id.phone); tvStudent = findViewById(R.id.student); btnEdit = findViewById(R.id.edit); btnUploadCard = findViewById(R.id.upload_card); btnEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, EditProfileActivity.class); intent.putExtra("data", new Gson().toJson(player)); startActivity(intent); } }); btnUploadCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, UploadCardActivity.class); intent.putExtra("data", new Gson().toJson(player)); startActivity(intent); } }); showProgressBar(true); } @Override protected void onResume() { super.onResume(); showProgressBar(true); mApiService.getPlayerDetail(getUserToken()).enqueue(new ApiCallback() { @Override public void onApiSuccess(String result) { showProgressBar(false); player = new Gson().fromJson(result, Player.class); User user = getUserSession(); user.setPhotoUrl(player.getPhotoUrl()); user.setName(player.getName()); user.setUsername(player.getUsername()); user.setEmail(player.getEmail()); user.setPhoneNumber(player.getPhone()); appSession.updateSession(user); initData(); } @Override public void onApiFailure(String errorMessage) { showProgressBar(false); showSnackbar(errorMessage); } }.build()); } private void initData (){ if(player==null) return; tvName.setText(player.getName()); tvUsername.setText(player.getUsername()); tvPhone.setText(player.getPhone()); tvStudent.setText(R.string.label_nonstudent); if(player.getStudentStatus()==1) { tvStudent.setText(R.string.label_student); btnUploadCard.setVisibility(View.GONE); } picasso.load(UtilsApi.BASE_URL+player.getPhotoUrl()) .fit() .centerCrop() .error(R.drawable.user) .placeholder(R.drawable.user) .into(ivAvatar); } }
2e32cf00f3452c74f7c51929f19e515bdd685ca7
33dd60359a65ccf4fd755505e476bd7ca54085ca
/src/Entrega3/Nodo.java
b68de78dda7c8c32ba5ae3880bec2fe5f06ffb81
[]
no_license
LucasPagadizabal/TP-Especial-Pro3
869f6ce7144041abb43b359fb85fa39090ca9361
4ad86014e72af0caf01ca1c94e8276a154a4d3ef
refs/heads/master
2021-01-20T18:07:08.982947
2017-06-16T23:14:10
2017-06-16T23:14:10
90,906,189
0
0
null
null
null
null
UTF-8
Java
false
false
471
java
package Entrega3; public class Nodo { String dato; TipoDato tipo; Nodo next; public Nodo(String d,TipoDato t) { dato= d; tipo = t; } public String getDato() { return dato; } public void setDato(String dato) { this.dato = dato; } public TipoDato getTipo() { return tipo; } public void setTipo(TipoDato tipo) { this.tipo = tipo; } public Nodo getNext() { return next; } public void setNext(Nodo next) { this.next = next; } }
b3b299a7c1a6f3c1f5bd54321fe011d44d33c72a
f0ab84e68e944c943a8236ff056c99cb96fe2b9a
/letsplay-backend/src/main/java/com/gvg/backend/internal/controller/CollectionController.java
d6faf8968133f461455b2f866c5f457d7e04cce0
[]
no_license
Gunthervg/letsplay
f0a242cfed597cb6f140d76f2532ae9b977474bf
50d96e5601c65389d135c699488b75da9453bd06
refs/heads/master
2021-01-10T17:46:50.930337
2016-02-19T12:54:30
2016-02-19T12:54:30
51,587,037
0
0
null
null
null
null
UTF-8
Java
false
false
741
java
package com.gvg.backend.internal.controller; import com.gvg.backend.external.domain.Items; import com.gvg.backend.external.service.BggService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** * @author gunther * @since 11/02/16 */ @RestController public class CollectionController { @Autowired private BggService bggService; @RequestMapping(value = "/collection", method = RequestMethod.GET, produces = "application/json") public Items getCollection() { return bggService.getCollection("gusha"); } }
[ "Ibgeiwipk13!" ]
Ibgeiwipk13!
38ddc2a8be1ccfe09b4160b796e85c08ab44799e
f73174010ae8554cbbbb149778555fc3b478d7ab
/src/main/java/com/example/aerquality/service/CourseService.java
8e60fa42048eaee38e8d82966343440115fcb6c5
[]
no_license
Elizabetaa/artQualityBackEnd
4e26aec5d196aeeb6964a2f5a89553e367bf6b32
2512425c563ab4c58b5bcbb4fcaec7d0234794f1
refs/heads/master
2023-07-08T05:54:11.523373
2021-08-15T13:26:33
2021-08-15T13:26:33
393,123,492
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package com.example.aerquality.service; import com.example.aerquality.model.entity.CourseEntity; import java.util.List; public interface CourseService { List<CourseEntity> getAllCourses(); CourseEntity getById(long id); void addCourse(String course); void initCourses(); }
5823e0454a4021a1b043c00c0b0df5073f364839
84872fa0941f47c96cd492111cf7c465341d364f
/src/com/fratics/segmentextractor/process/ValueStore.java
fcb2d8384100c7380b37c0891b49d0d044ee0b2c
[]
no_license
vijaysrajan/SegmentExtractor
7c9f9d7b3b2222bb8daeb2d36e2129750a162e8a
86aeebbb2268cceb93fc18ba3e6beb21b182d240
refs/heads/master
2021-01-19T06:43:06.957990
2016-07-09T10:58:16
2016-07-09T10:58:16
59,862,341
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
package com.fratics.segmentextractor.process; import com.fratics.segmentextractor.json.Value; import java.util.ArrayList; public class ValueStore { public ArrayList<String> candidateSet = new ArrayList<String>(); public Value value; public String toString() { return candidateSet.toString() + ":" + value; } }
40469136954ac2dcb8d635019a0222ec1e1b45e0
d0d8cb773b4673d9352e2a3d54094ef3d7982384
/app/src/androidTest/java/com/example/jie/ExampleInstrumentedTest.java
07825c5bc024ea8cfb3633d35378ce43c876761d
[]
no_license
perseverancebg/zms
b736f3d43c0e1a447dc802b65124a349c8d73526
eeeb1a9d462966a73f37281b0817525e78a242ec
refs/heads/master
2020-07-24T03:51:04.429269
2019-09-11T14:50:44
2019-09-11T14:50:44
207,793,491
0
0
null
null
null
null
UTF-8
Java
false
false
714
java
package com.example.jie; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.jie", appContext.getPackageName()); } }
11e138e3a3b87632706446ebca0ae1a99767005a
67c396d522cafd29eec403835fba297d06be05cd
/GroupeA4/src/main/java/be/helha/aemt/entities/AA.java
3f40c827585040b3e1d0b5e9c1b59877124399c0
[]
no_license
quetslaurent/projetJakarta
ceb77b18860df5fdd7185aac6ddb79e1739b8ffd
351b2be2746be969f7116448c7f2c9bd02f3577c
refs/heads/master
2023-02-15T16:44:44.166967
2021-01-10T10:50:57
2021-01-10T10:50:57
328,357,866
0
0
null
null
null
null
UTF-8
Java
false
false
1,025
java
package be.helha.aemt.entities; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class AA implements Serializable { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String name; private double numbersOfCredits; private String section; public AA() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getNumbersOfCredits() { return numbersOfCredits; } public void setNumbersOfCredits(double numbersOfCredits) { this.numbersOfCredits = numbersOfCredits; } public String getSection() { return section; } public void setSection(String string) { this.section = string; } @Override public String toString() { return "\n\t intitule=" + name + "\n\t nombreDeCredit=" + numbersOfCredits + "\n\t section=" + section+"\n"; } }
9296d0cf60fcc6f8c50051cf1670cb781ce53e92
9985c35438544a9bfec7130bfb040dc215a14293
/RangeSumSegmentTree.java
89478df869f17fb76c11ab12a05c22d5fc889efa
[]
no_license
afmdnf/custom-ds
05f3dc7a30f3e6b218d97c576e45eae57318a58a
9de373ebeaabacbe2cb85644db2391dbc1110b65
refs/heads/master
2020-04-02T09:33:58.780510
2019-01-13T14:56:27
2019-01-13T14:56:27
154,298,873
0
0
null
null
null
null
UTF-8
Java
false
false
2,672
java
public static class RangeSumSegmentTree { int[] tree; int n; public RangeSumSegmentTree(int[] arr) { n = arr.length; tree = new int[4*n + 1]; buildTree(arr, 1, 0, n - 1); } // O(log n) public int query(int qs, int qe) { return queryTree(1, 0, n-1, qs, qe); } // O(log n) public void update(int i, int val) { updateNode(1, 0, n-1, i, val); } // O(n) - worst case public void updateRange(int rs, int re, int incr) { updateRangeTree(1, 0, n-1, rs, re, incr); } // O(n) private void buildTree(int[] arr, int index, int s, int e) { if (s > e) return; if (s == e) { tree[index] = arr[s]; return; } int mid = (s + e) / 2; buildTree(arr, 2*index, s, mid); buildTree(arr, 2*index + 1, mid + 1, e); tree[index] = tree[2*index] + tree[2*index + 1]; } private int queryTree(int index, int s, int e, int qs, int qe) { // 1. No overlap if (qs > e || qe < s) return 0; // 2. Complete overlap if (s >= qs && e <= qe) return tree[index]; // 3. Partial overlap - call both sides int mid = (s + e) / 2; int left = queryTree(2*index, s, mid, qs, qe); int right = queryTree(2*index + 1, mid + 1, e, qs, qe); return left + right; } private void updateNode(int index, int s, int e, int i, int val) { if (i < s || i > e) return; if (s == e) { // Leaf node tree[index] = val; return; } int mid = (s + e) / 2; updateNode(2*index, s, mid, i, val); updateNode(2*index + 1, mid + 1, e, i, val); tree[index] = tree[2*index] + tree[2*index + 1]; } private void updateRangeTree(int index, int s, int e, int rs, int re, int incr) { if (rs > e || re < s) return; if (s == e) { // Leaf node tree[index] += incr; return; } // Lying in range - call both sides int mid = (s + e) / 2; updateRangeTree(2*index, s, mid, rs, re, incr); updateRangeTree(2*index + 1, mid + 1, e, rs, re, incr); tree[index] = tree[2*index] + tree[2*index + 1]; } public static void main(String[] args) { RangeSumSegmentTree rs = new RangeSumSegmentTree(new int[]{1, 4, -2, 3}); System.out.println(rs.query(0, 2)); rs.update(3, 5); System.out.println(rs.query(0, 2)); System.out.println(rs.query(0, 3)); rs.updateRange(1, 2, -2); // array is now [1, 2, -4, 5] System.out.println(rs.query(0, 2)); } }
799de1fe2f7fccc5bf9bd55aafc0e5fad1d323d8
0d17a50893f79de5e359e4028b2d6e08acb812e2
/src/main/java/evoblackjack/PlayerHand.java
660e7e8280f986a5fa41398abc226d4c6879bd2f
[]
no_license
liuyang-ca/java-sandbox
c0bfaba9af3f2dbd4a05dc4b40196320945f1539
e4d2000b9f2143222dc266f75ec04ffdd917c05d
refs/heads/master
2022-05-30T17:03:19.783762
2019-05-24T18:08:20
2019-05-24T18:08:20
142,355,321
0
0
null
2020-10-13T11:09:26
2018-07-25T21:22:11
Java
UTF-8
Java
false
false
2,807
java
package evoblackjack;/* Author: Brian Carrigan Date: 1/10/2013 Email: [email protected] This file is part of the Evolutionary Blackjack Strategy Solver. The Evolutionary Blackjack Strategy Solver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. The Evolutionary Blackjack Strategy Solver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Evolutionary Blackjack Strategy Solver. If not, see <http://www.gnu.org/licenses/>. */ // A player hand represents all of the possible hands in blackjack that a player // can have. public enum PlayerHand { HARD_SEVENTEEN_PLUS, HARD_SIXTEEN, HARD_FIFTEEN, HARD_FOURTEEN, HARD_THIRTEEN, HARD_TWELVE, HARD_ELEVEN, HARD_TEN, HARD_NINE, HARD_EIGHT, HARD_SEVEN, HARD_SIX, HARD_FIVE, SOFT_TWENTYONE, SOFT_TWENTY, SOFT_NINETEEN, SOFT_EIGHTEEN, SOFT_SEVENTEEN, SOFT_SIXTEEN, SOFT_FIFTEEN, SOFT_FOURTEEN, SOFT_THIRTEEN, PAIR_ACE, PAIR_TEN, PAIR_NINE, PAIR_EIGHT, PAIR_SEVEN, PAIR_SIX, PAIR_FIVE, PAIR_FOUR, PAIR_THREE, PAIR_TWO; public String convertHandToString() { switch(this) { case HARD_SEVENTEEN_PLUS: return "H17"; case HARD_SIXTEEN: return "H16"; case HARD_FIFTEEN: return "H15"; case HARD_FOURTEEN: return "H14"; case HARD_THIRTEEN: return "H13"; case HARD_TWELVE: return "H12"; case HARD_ELEVEN: return "H11"; case HARD_TEN: return "H10"; case HARD_NINE: return "H9"; case HARD_EIGHT: return "H8"; case HARD_SEVEN: return "H7"; case HARD_SIX: return "H6"; case HARD_FIVE: return "H5"; case SOFT_TWENTYONE: return "S21"; case SOFT_TWENTY: return "S20"; case SOFT_NINETEEN: return "S19"; case SOFT_EIGHTEEN: return "S18"; case SOFT_SEVENTEEN: return "S17"; case SOFT_SIXTEEN: return "S16"; case SOFT_FIFTEEN: return "S15"; case SOFT_FOURTEEN: return "S14"; case SOFT_THIRTEEN: return "S13"; case PAIR_ACE: return "PA"; case PAIR_TEN: return "P10"; case PAIR_NINE: return "P9"; case PAIR_EIGHT: return "P8"; case PAIR_SEVEN: return "P7"; case PAIR_SIX: return "P6"; case PAIR_FIVE: return "P5"; case PAIR_FOUR: return "P4"; case PAIR_THREE: return "P3"; default: return "P2"; } } }
25fa797a7b16eb9ecb2cd2399403782613f7950c
b544f465a2ce471462075a1e877b79a6c14be025
/rabinizer3.1/rabinizer/parser/LTLParser.java
42566c6240046e3f31adaaf46f12ef081bf4c92e
[]
no_license
dkasenberg/vel-explanation
d86091cd8537b2a4110180fedf5f37563e33c375
44622e07a1179ea4cae9cbcedc126cae9a3a72e1
refs/heads/master
2021-03-05T22:44:18.144471
2020-03-12T22:11:50
2020-03-12T22:11:50
246,159,224
2
0
null
2020-10-13T20:18:55
2020-03-09T22:57:43
Java
UTF-8
Java
false
false
22,364
java
/* Generated By:JavaCC: Do not edit this line. LTLParser.java */ package rabinizer.parser; import rabinizer.bdd.BijectionIdAtom; import rabinizer.bdd.Globals; import rabinizer.formulas.*; public class LTLParser implements LTLParserConstants { static private int[] jj_la1_0; static { jj_la1_init_0(); } final private int[] jj_la1 = new int[0]; final private JJCalls[] jj_2_rtns = new JJCalls[12]; final private LookaheadSuccess jj_ls = new LookaheadSuccess(); public Globals globals; /** * Generated Token Manager. */ public LTLParserTokenManager token_source; /** * Current token. */ public Token token; /** * Next token. */ public Token jj_nt; SimpleCharStream jj_input_stream; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; private int jj_gen; private boolean jj_rescan = false; private int jj_gc = 0; private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; /** * Parse with new bijection between identifiers and atoms. */ public LTLParser(Globals globals, java.io.InputStream stream) { this(stream, null, globals); this.globals = globals; } /** * Constructor with InputStream and supplied encoding */ public LTLParser(java.io.InputStream stream, String encoding, Globals globals) { this(stream, encoding); this.globals = globals; } public LTLParser(Globals globals, java.io.Reader reader) { this(reader); this.globals = globals; } /** * Constructor with InputStream. */ public LTLParser(java.io.InputStream stream) { this(stream, null); } /** * Constructor with InputStream and supplied encoding */ public LTLParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new LTLParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** * Constructor. */ public LTLParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new LTLParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** * Constructor with generated Token Manager. */ public LTLParser(LTLParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private static void jj_la1_init_0() { jj_la1_0 = new int[]{}; } public Formula parse() throws ParseException { globals.bddForVariables.bijectionIdAtom = new BijectionIdAtom(); return formula(); } /** * Parse using the previous bijection between identifiers and atoms. * If there is no previous bijection, create a new bijection. */ public Formula parsePreviousAtoms() throws ParseException { if (globals.bddForVariables.bijectionIdAtom == null) globals.bddForVariables.bijectionIdAtom = new BijectionIdAtom(); return formula(); } final public Formula formula() throws ParseException { Formula f; f = disjunction(); jj_consume_token(0); { if (true) return f; } throw new Error("Missing return statement in function"); } final public Formula disjunction() throws ParseException { Formula r = null; Formula result; result = conjunction(); label_1: while (true) { if (jj_2_1(2)) { } else { break label_1; } jj_consume_token(OR); r = conjunction(); result = new Disjunction(result, r); } { if (true) return result; } throw new Error("Missing return statement in function"); } final public Formula conjunction() throws ParseException { Formula result; Formula r = null; result = until(); label_2: while (true) { if (jj_2_2(2)) { } else { break label_2; } jj_consume_token(AND); r = until(); result = new Conjunction(result, r); } { if (true) return result; } throw new Error("Missing return statement in function"); } final public Formula until() throws ParseException { Formula result; Formula r = null; result = unaryOp(); label_3: while (true) { if (jj_2_3(2)) { } else { break label_3; } jj_consume_token(UOP); r = unaryOp(); result = new UOperator(result, r); } { if (true) return result; } throw new Error("Missing return statement in function"); } //Formula negation() : //{ // Formula f; // boolean neg = false; //} //{ ///* (< NEG > // { // neg = true; // } // )? //*/ // f = tempOp() // { // if (neg) return f.negated(); // else return f; // } //} final public Formula unaryOp() throws ParseException { Formula f; if (jj_2_4(2)) { jj_consume_token(FOP); f = unaryOp(); { if (true) return new FOperator(f); } } else if (jj_2_5(2)) { jj_consume_token(GOP); f = unaryOp(); { if (true) return new GOperator(f); } } else if (jj_2_6(2)) { jj_consume_token(XOP); f = unaryOp(); { if (true) return new XOperator(f); } } else if (jj_2_7(2)) { jj_consume_token(NEG); f = unaryOp(); { if (true) return new Negation(f); } } else if (jj_2_8(2)) { f = atom(); { if (true) return f; } } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } final public Formula atom() throws ParseException { String atomString; int id; Formula f; if (jj_2_9(2)) { jj_consume_token(TRUE); { if (true) return new BooleanConstant(true, globals); } } else if (jj_2_10(2)) { jj_consume_token(FALSE); { if (true) return new BooleanConstant(false, globals); } } else if (jj_2_11(2)) { atomString = jj_consume_token(ID).image; id = globals.bddForVariables.bijectionIdAtom.id(atomString); { if (true) return new Literal(atomString, id, false, globals); } } else if (jj_2_12(2)) { jj_consume_token(LPAR); f = disjunction(); jj_consume_token(RPAR); { if (true) return f; } } else { jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } private boolean jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_9(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(8, xla); } } private boolean jj_2_10(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_10(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(9, xla); } } private boolean jj_2_11(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_11(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(10, xla); } } private boolean jj_2_12(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_12(); } catch (LookaheadSuccess ls) { return true; } finally { jj_save(11, xla); } } private boolean jj_3_6() { if (jj_scan_token(XOP)) return true; return jj_3R_6(); } private boolean jj_3R_7() { Token xsp; xsp = jj_scanpos; if (jj_3_9()) { jj_scanpos = xsp; if (jj_3_10()) { jj_scanpos = xsp; if (jj_3_11()) { jj_scanpos = xsp; if (jj_3_12()) return true; } } } return false; } private boolean jj_3_9() { return jj_scan_token(TRUE); } private boolean jj_3_5() { if (jj_scan_token(GOP)) return true; return jj_3R_6(); } private boolean jj_3_1() { if (jj_scan_token(OR)) return true; return jj_3R_4(); } private boolean jj_3R_6() { Token xsp; xsp = jj_scanpos; if (jj_3_4()) { jj_scanpos = xsp; if (jj_3_5()) { jj_scanpos = xsp; if (jj_3_6()) { jj_scanpos = xsp; if (jj_3_7()) { jj_scanpos = xsp; if (jj_3_8()) return true; } } } } return false; } private boolean jj_3_4() { if (jj_scan_token(FOP)) return true; return jj_3R_6(); } private boolean jj_3R_8() { return jj_3R_4(); } private boolean jj_3_12() { if (jj_scan_token(LPAR)) return true; return jj_3R_8(); } private boolean jj_3_2() { if (jj_scan_token(AND)) return true; return jj_3R_5(); } private boolean jj_3_8() { return jj_3R_7(); } private boolean jj_3R_4() { return jj_3R_5(); } private boolean jj_3_11() { return jj_scan_token(ID); } private boolean jj_3_3() { if (jj_scan_token(UOP)) return true; return jj_3R_6(); } private boolean jj_3_7() { if (jj_scan_token(NEG)) return true; return jj_3R_6(); } private boolean jj_3R_5() { return jj_3R_6(); } private boolean jj_3_10() { return jj_scan_token(FALSE); } /** * Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } /** * Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** * Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** * Reinitialise. */ public void ReInit(LTLParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 0; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for (int i = 0; i < jj_2_rtns.length; i++) { JJCalls c = jj_2_rtns[i]; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; } /** * Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** * Get the specific Token. */ final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } private int jj_ntk() { if ((jj_nt = token.next) == null) return (jj_ntk = (token.next = token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } boolean exists = false; for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext(); ) { exists = true; int[] oldentry = (int[]) (it.next()); if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { exists = false; break; } } if (exists) break; } } if (!exists) jj_expentries.add(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } /** * Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[17]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1 << j)) != 0) { la1tokens[j] = true; } } } } for (int i = 0; i < 17; i++) { if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; jj_expentries.add(jj_expentry); } } jj_endpos = 0; jj_rescan_token(); jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } /** * Enable tracing. */ final public void enable_tracing() { } /** * Disable tracing. */ final public void disable_tracing() { } private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 12; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; case 4: jj_3_5(); break; case 5: jj_3_6(); break; case 6: jj_3_7(); break; case 7: jj_3_8(); break; case 8: jj_3_9(); break; case 9: jj_3_10(); break; case 10: jj_3_11(); break; case 11: jj_3_12(); break; } } p = p.next; } while (p != null); } catch (LookaheadSuccess ls) { } } jj_rescan = false; } private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static private final class LookaheadSuccess extends java.lang.Error { } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } }
81db024079270d96a051e52b0c06afbc1c5bc85a
07f2fa83cafb993cc107825223dc8279969950dd
/game_common/src/main/java/com/xgame/framework/objectpool/ObjectFactory.java
43cec49cfdfc0e9725806d031d68b4b6267adb93
[]
no_license
hw233/x2-slg-java
3f12a8ed700e88b81057bccc7431237fae2c0ff9
03dcdab55e94ee4450625404f6409b1361794cbf
refs/heads/master
2020-04-27T15:42:10.982703
2018-09-27T08:35:27
2018-09-27T08:35:27
174,456,389
0
1
null
null
null
null
UTF-8
Java
false
false
1,099
java
package com.xgame.framework.objectpool; import org.apache.commons.pool2.BasePooledObjectFactory; import org.apache.commons.pool2.PooledObject; import org.apache.commons.pool2.impl.DefaultPooledObject; public class ObjectFactory<T> extends BasePooledObjectFactory<IPooledObject> { private Class<T> handleClass; public ObjectFactory(Class<T> handleClass) { this.handleClass = handleClass; } /** * 创建对象 */ @Override public IPooledObject create() throws Exception { return (IPooledObject) handleClass.newInstance(); } /** * 用PooledObject封装对象放入池中 */ @Override public PooledObject<IPooledObject> wrap(IPooledObject obj) { return new DefaultPooledObject<IPooledObject>(obj); } /** * 销毁对象 */ @Override public void destroyObject(PooledObject<IPooledObject> p) throws Exception { IPooledObject obj = p.getObject(); obj.poolClear(); super.destroyObject(p); } /** * 验证对象 */ @Override public boolean validateObject(PooledObject<IPooledObject> p) { IPooledObject t = p.getObject(); return t.poolValidate(); } }
a689b052ecc9ccbe858334f8de65d61fb9eccfee
5763bc5ae1dc7f4492cbdc570582680939060ada
/src/main/java/com/lovesickness/o2o/dao/ProductImgDao.java
3abbec5b9bd6235b58ed49faf72cf071269afb47
[]
no_license
dqget/o2o
57035f54499d0c654a6cd1c19ee1e7d6c16e8afa
f8c9efda85dcea41a521ad8cc95f8e7d5b9fe449
refs/heads/master
2023-03-12T22:21:51.762422
2022-04-26T03:33:58
2022-04-26T03:33:58
174,384,480
1
0
null
2023-02-22T08:02:12
2019-03-07T16:48:21
Java
UTF-8
Java
false
false
593
java
package com.lovesickness.o2o.dao; import com.lovesickness.o2o.entity.ProductImg; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface ProductImgDao { /*** * 批量添加商品详情图片 * @param productImgList * @return */ int batchInsertProductImg(List<ProductImg> productImgList); /** * 刪除指定商品下的所有详情图片 * * @param productId * @return */ int deleteProductImgByProductId(long productId); List<ProductImg> queryProductImgList(long productId); }
2d4b699ae7578e76702e57081fc58071a1cea0ce
6b09043b97fb379aebd4363ff07d4cc53e8ec0b9
/Day 3/03-DailyFlash_Solutions/16_Jan_Solutions_Three/Java/prog1.java
c22739356ecd3a4c645dfd7d7e2c5166a54e2a56
[]
no_license
Aadesh-Shigavan/Python_Daily_Flash
6a4bdd73a33f533f3b121fae9eef973e10bf3945
b118beeca3f4c97de54ae1a610f83da81157009a
refs/heads/master
2022-11-28T13:03:17.573906
2020-08-06T15:36:36
2020-08-06T15:36:36
276,581,310
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
import java.io.*; class Demo{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Input : "); int n1 = Integer.parseInt(br.readLine()); int n2 = Integer.parseInt(br.readLine()); int n3 = Integer.parseInt(br.readLine()); System.out.println(n1>=0 && n2>=0 && n3>=0 && n1*n1 + n2*n2 == n3*n3?"Output : Satisfies pythagoras therom":"Output : Does not satisfies pythagoras therom"); } }
4ef6b2020ecf573a54feb40fc2d9b1fbc22e6270
4dd22e45d6216df9cd3b64317f6af953f53677b7
/LMS/src/main/java/com/ulearning/ulms/core/security/action/UpdatePWDAction.java
18f6281ccb2b9264b9ac98418c5ea506fa3e9760
[]
no_license
tianpeijun198371/flowerpp
1325344032912301aaacd74327f24e45c32efa1e
169d3117ee844594cb84b2114e3fd165475f4231
refs/heads/master
2020-04-05T23:41:48.254793
2008-02-16T18:03:08
2008-02-16T18:03:08
40,278,397
0
0
null
null
null
null
GB18030
Java
false
false
8,292
java
/** * UpdatePWDAction.java. * User: dengj Date: 2004-4-30 * * Copyright (c) 2000-2004.Huaxia Dadi Distance Learning Services Co.,Ltd. * All rights reserved. */ package com.ulearning.ulms.core.security.action; import com.ulearning.ulms.admin.sysconfig.bean.SysConfigHelper; import com.ulearning.ulms.admin.sysconfig.form.SysConfigForm; import com.ulearning.ulms.bbs.helper.MvnMemberHelper; import com.ulearning.ulms.core.exceptions.ULMSAppException; import com.ulearning.ulms.core.exceptions.ULMSSysException; import com.ulearning.ulms.core.security.dao.SecurityDAO; import com.ulearning.ulms.core.security.dao.SecurityDAOFactory; import com.ulearning.ulms.core.util.Config; import com.ulearning.ulms.lmslog.dao.LmslogDAO; import com.ulearning.ulms.lmslog.dao.LmslogDAOFactory; import com.ulearning.ulms.lmslog.form.LmslogForm; import com.ulearning.ulms.lmslog.util.LmslogConstants; import com.ulearning.ulms.tools.meeting.xuechuang.client.SetMeetingClient; import com.ulearning.ulms.tools.meeting.xuechuang.client.SetMeetingStub; import com.ulearning.ulms.user.bean.UserHelper; import com.ulearning.ulms.user.dao.UserDAO; import com.ulearning.ulms.user.dao.UserDAOFactory; import com.ulearning.ulms.user.form.UserForm; import com.ulearning.ulms.util.LMSConstants; import com.ulearning.ulms.util.log.LogUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class UpdatePWDAction extends Action { protected static Log logger = LogFactory.getLog(UpdatePWDAction.class); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String resultScreen = "success"; String passwd = request.getParameter("passwd"); SecurityDAO dao = SecurityDAOFactory.getDAO(); Object userID = request.getSession() .getAttribute(LMSConstants.USERID_KEY); if (userID == null) { return mapping.findForward(LMSConstants.NOSESSION_PAGE); } //建议以后封装到中间层 //判断是否属于新理念项目 try { if (Config.isXLNProject()) { UserDAO userDAO = UserDAOFactory.getDAO(); UserForm uf = userDAO.getUser(userID.toString()); logger.info("同步新理念项目学窗用户密码!"); logger.info("passwd1=" + passwd + "<"); logger.info("uf.getPlainPassword()=" + uf.getPlainPassword() + "<"); if(uf.getExternalSystemUserID()==null || uf.getExternalSystemUserID().intValue()<0) { //以下先同步用户 int result_int=-1; SetMeetingStub.UserInformation useInfo= SetMeetingClient.getUserInfoByAccount(uf.getLoginName()); System.out.println("useInfo = " + useInfo); if(useInfo==null) { result_int=SetMeetingClient.userRegister(uf.getLoginName(), uf.getName(), uf.getPlainPassword()); logger.info("result_int="+result_int+"<"); if(result_int>0) { uf.setExternalSystemUserID(new Integer(result_int)); } else { logger.info("同步益学视频教学系统出错!"); throw new ULMSSysException("同步益学视频教学系统出错!",(String)null); } } else { uf.setExternalSystemUserID(new Integer(useInfo.getUserId())); } //不修改密码和查询答案 uf.setPassword(null); uf.setPwdAnswer(null); UserHelper.updateUser(uf); } boolean result=SetMeetingClient.changePwd(uf.getLoginName(), passwd, uf.getPlainPassword()); request.setAttribute("xuechuang_syn_rsult",String.valueOf(result)); logger.info("result="+result+"<"); if(!result) { throw new ULMSAppException("同步益学视频教学系统出错",(String)null); } } } catch (Exception e) { e.printStackTrace(); request.setAttribute("result","同步益学视频教学系统出错!可能此用户不能登录益学视频教学系统!请稍候再试!"); //throw new ULMSAppException("同步益学视频教学系统出错!",null,e); } logger.info("==============ulms passwd ============== " + passwd); MvnMemberHelper bbsHelper=new MvnMemberHelper(); bbsHelper.updateMvnPass(userID.toString(),passwd); dao.updatePWD(userID.toString(), passwd); int lmsUserID = Integer.parseInt((String) request.getSession() .getAttribute(LMSConstants.USERID_KEY)); int lmsOrgID = Integer.parseInt((String) request.getSession() .getAttribute(LMSConstants.USER_ORGID_KEY)); SysConfigHelper helper = new SysConfigHelper(); String orgID = (String) request.getSession() .getAttribute(LMSConstants.USER_ORGID_KEY); SysConfigForm sysConfigForm = helper.getSysConfig("0"); if (sysConfigForm.getIsLogLogin().equals("1")) { LmslogForm lmslogForm = new LmslogForm(); lmslogForm.setLogTypeID(LmslogConstants.LOGTYPE_USER); lmslogForm.setUserID(lmsUserID); lmslogForm.setOrgID(lmsOrgID); lmslogForm.setUserIP(request.getRemoteAddr()); lmslogForm.setOperationTypeID(LmslogConstants.OPERATION_SECURETY_CHANGPWD); lmslogForm.setOperationTable("LMSDB"); lmslogForm.setOperationObjectID(lmsUserID); lmslogForm.setDescription("用户修改密码时将被记录到日志."); LmslogDAO logdao = LmslogDAOFactory.getDAO(); logdao.insert(lmslogForm); } LogUtil.info("admin", "[AddPlanAction]===========resultScreen = " + resultScreen); // Forward to result page return mapping.findForward(resultScreen); } }
[ "flowerpp@aeb45441-6f43-0410-8555-aba96bfc7626" ]
flowerpp@aeb45441-6f43-0410-8555-aba96bfc7626
82fc4827d3f1c342ed7ebfba5b8c3c1853498ba3
3e121bd4055195b24c1b71d6922ff0f76a733c4a
/JMmes/src/main/java/com/bluebirdme/mes/linglong/halfpart/entity/MaterialAging.java
171ffc4b7abc429228b97246471f4a223dd65eb8
[]
no_license
c-haowan-g/MyFirstRepository
5a55b268d881f2d1c838db6ddcb1427e446e8dc5
626eac1b48bc9645f2785cda9258d41efd07304b
refs/heads/master
2022-07-28T03:08:01.658858
2020-12-26T02:50:52
2020-12-26T02:50:52
319,186,890
0
0
null
null
null
null
UTF-8
Java
false
false
12,436
java
/** * 信息化智能制造处 * 山东玲珑轮胎股份有限公司 * 2019版权所有 */ package com.bluebirdme.mes.linglong.halfpart.entity; import java.util.Date; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Column; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import com.bluebirdme.mes.linglong.core.RockWellBaseEntity; import com.bluebirdme.mes.linglong.core.rockwell.ATDefinition; import com.bluebirdme.core.system.annotations.Comment; /** * 物料信息扩展表 * @author 王超 * @Date 2020-03-10 16:09:39 */ @ATDefinition("INT_SAP_MATERIALSPLUS") @Entity @XmlRootElement @Table(name="AT_INT_SAP_MATERIALSPLUS") public class MaterialAging extends RockWellBaseEntity{ @Comment("机构代码") @Column(nullable=true,length=80) private String agenc_no_s; @Comment("警报值") @Column(nullable=true,length=0) private String alarmvalue_f; @Comment("子口宽") @Column(nullable=false,length=0) private String beadwidth_d; @Comment("修改人") @Column(nullable=true,length=80) private String changed_by_s; @Comment("修改时间") @Column(nullable=true,length=0) private Date changed_time_t; @Comment("内径") @Column(nullable=false,length=0) private String innerdia_d; @Comment("物料编号80位") @Column(nullable=true,length=600) private String materialcode_s; @Comment("物料描述") @Column(nullable=true,length=600) private String materialdesc_s; @Comment("规格") @Column(nullable=true,length=200) private String materialspec_s; @Comment("最大库存") @Column(nullable=true,length=0) private String maximumstock_f; @Comment("最小库存") @Column(nullable=true,length=0) private String minimumstock_f; @Comment("外径") @Column(nullable=false,length=0) private String outerdia_d; @Comment("最大存放时间") @Column(nullable=true,length=0) private String overtime_f; @Comment("A有效,D无效") @Column(nullable=true,length=80) private String record_flag_s; @Comment("最小存放时间") @Column(nullable=true,length=0) private String smalltime_f; @Comment("特殊标识 0-批量更新 1-用户特殊维护") @Column(nullable=true,length=80) private String spare10_s; @Comment("备用字段11") @Column(nullable=true,length=80) private String spare11_s; @Comment("备用字段12") @Column(nullable=true,length=80) private String spare12_s; @Comment("备用字段13") @Column(nullable=true,length=80) private String spare13_s; @Comment("备用字段14") @Column(nullable=true,length=80) private String spare14_s; @Comment("备用字段15") @Column(nullable=true,length=80) private String spare15_s; @Comment("备用字段16") @Column(nullable=true,length=80) private String spare16_s; @Comment("备用字段17") @Column(nullable=true,length=80) private String spare17_s; @Comment("备用字段18") @Column(nullable=true,length=80) private String spare18_s; @Comment("备用字段19") @Column(nullable=true,length=80) private String spare19_s; @Comment("钢丝压延垫布层数") @Column(nullable=true,length=80) private String spare1_s; @Comment("备用字段20") @Column(nullable=true,length=80) private String spare20_s; @Comment("打印卡片最大数量") @Column(nullable=true,length=80) private String spare2_s; @Comment("加温是否管控:0-否、1-是") @Column(nullable=true,length=80) private String spare3_s; @Comment("最短加温时间") @Column(nullable=true,length=80) private String spare4_s; @Comment("最长加温时间") @Column(nullable=true,length=80) private String spare5_s; @Comment("有效期是否管控:0-否、1-是") @Column(nullable=true,length=80) private String spare6_s; @Comment("密炼快检检验百分比") @Column(nullable=true,length=80) private String spare7_s; @Comment("备用字段8") @Column(nullable=true,length=80) private String spare8_s; @Comment("备用字段9") @Column(nullable=true,length=80) private String spare9_s; @Comment("库存是否报警:0-否、1-是") @Column(nullable=true,length=80) private String stockalarm_s; @Comment("工厂") @Column(nullable=true,length=5) private String s_factory_s; @Comment("截面高-未用") @Column(nullable=false,length=0) private String tyreheight_d; @Comment("断面宽-左用") @Column(nullable=false,length=0) private String tyrewidth_d; public String getAgenc_no_s(){ return agenc_no_s; } @XmlElement public void setAgenc_no_s(String agenc_no_s){ this.agenc_no_s=agenc_no_s; } public String getAlarmvalue_f(){ return alarmvalue_f; } @XmlElement public void setAlarmvalue_f(String alarmvalue_f){ this.alarmvalue_f=alarmvalue_f; } public String getBeadwidth_d(){ return beadwidth_d; } @XmlElement public void setBeadwidth_d(String beadwidth_d){ this.beadwidth_d=beadwidth_d; } public String getChanged_by_s(){ return changed_by_s; } @XmlElement public void setChanged_by_s(String changed_by_s){ this.changed_by_s=changed_by_s; } public Date getChanged_time_t(){ return changed_time_t; } @XmlElement public void setChanged_time_t(Date changed_time_t){ this.changed_time_t=changed_time_t; } public String getInnerdia_d(){ return innerdia_d; } @XmlElement public void setInnerdia_d(String innerdia_d){ this.innerdia_d=innerdia_d; } public String getMaterialcode_s(){ return materialcode_s; } @XmlElement public void setMaterialcode_s(String materialcode_s){ this.materialcode_s=materialcode_s; } public String getMaterialdesc_s(){ return materialdesc_s; } @XmlElement public void setMaterialdesc_s(String materialdesc_s){ this.materialdesc_s=materialdesc_s; } public String getMaterialspec_s(){ return materialspec_s; } @XmlElement public void setMaterialspec_s(String materialspec_s){ this.materialspec_s=materialspec_s; } public String getMaximumstock_f(){ return maximumstock_f; } @XmlElement public void setMaximumstock_f(String maximumstock_f){ this.maximumstock_f=maximumstock_f; } public String getMinimumstock_f(){ return minimumstock_f; } @XmlElement public void setMinimumstock_f(String minimumstock_f){ this.minimumstock_f=minimumstock_f; } public String getOuterdia_d(){ return outerdia_d; } @XmlElement public void setOuterdia_d(String outerdia_d){ this.outerdia_d=outerdia_d; } public String getOvertime_f(){ return overtime_f; } @XmlElement public void setOvertime_f(String overtime_f){ this.overtime_f=overtime_f; } public String getRecord_flag_s(){ return record_flag_s; } @XmlElement public void setRecord_flag_s(String record_flag_s){ this.record_flag_s=record_flag_s; } public String getSmalltime_f(){ return smalltime_f; } @XmlElement public void setSmalltime_f(String smalltime_f){ this.smalltime_f=smalltime_f; } public String getSpare10_s(){ return spare10_s; } @XmlElement public void setSpare10_s(String spare10_s){ this.spare10_s=spare10_s; } public String getSpare11_s(){ return spare11_s; } @XmlElement public void setSpare11_s(String spare11_s){ this.spare11_s=spare11_s; } public String getSpare12_s(){ return spare12_s; } @XmlElement public void setSpare12_s(String spare12_s){ this.spare12_s=spare12_s; } public String getSpare13_s(){ return spare13_s; } @XmlElement public void setSpare13_s(String spare13_s){ this.spare13_s=spare13_s; } public String getSpare14_s(){ return spare14_s; } @XmlElement public void setSpare14_s(String spare14_s){ this.spare14_s=spare14_s; } public String getSpare15_s(){ return spare15_s; } @XmlElement public void setSpare15_s(String spare15_s){ this.spare15_s=spare15_s; } public String getSpare16_s(){ return spare16_s; } @XmlElement public void setSpare16_s(String spare16_s){ this.spare16_s=spare16_s; } public String getSpare17_s(){ return spare17_s; } @XmlElement public void setSpare17_s(String spare17_s){ this.spare17_s=spare17_s; } public String getSpare18_s(){ return spare18_s; } @XmlElement public void setSpare18_s(String spare18_s){ this.spare18_s=spare18_s; } public String getSpare19_s(){ return spare19_s; } @XmlElement public void setSpare19_s(String spare19_s){ this.spare19_s=spare19_s; } public String getSpare1_s(){ return spare1_s; } @XmlElement public void setSpare1_s(String spare1_s){ this.spare1_s=spare1_s; } public String getSpare20_s(){ return spare20_s; } @XmlElement public void setSpare20_s(String spare20_s){ this.spare20_s=spare20_s; } public String getSpare2_s(){ return spare2_s; } @XmlElement public void setSpare2_s(String spare2_s){ this.spare2_s=spare2_s; } public String getSpare3_s(){ return spare3_s; } @XmlElement public void setSpare3_s(String spare3_s){ this.spare3_s=spare3_s; } public String getSpare4_s(){ return spare4_s; } @XmlElement public void setSpare4_s(String spare4_s){ this.spare4_s=spare4_s; } public String getSpare5_s(){ return spare5_s; } @XmlElement public void setSpare5_s(String spare5_s){ this.spare5_s=spare5_s; } public String getSpare6_s(){ return spare6_s; } @XmlElement public void setSpare6_s(String spare6_s){ this.spare6_s=spare6_s; } public String getSpare7_s(){ return spare7_s; } @XmlElement public void setSpare7_s(String spare7_s){ this.spare7_s=spare7_s; } public String getSpare8_s(){ return spare8_s; } @XmlElement public void setSpare8_s(String spare8_s){ this.spare8_s=spare8_s; } public String getSpare9_s(){ return spare9_s; } @XmlElement public void setSpare9_s(String spare9_s){ this.spare9_s=spare9_s; } public String getStockalarm_s(){ return stockalarm_s; } @XmlElement public void setStockalarm_s(String stockalarm_s){ this.stockalarm_s=stockalarm_s; } public String getS_factory_s(){ return s_factory_s; } @XmlElement public void setS_factory_s(String s_factory_s){ this.s_factory_s=s_factory_s; } public String getTyreheight_d(){ return tyreheight_d; } @XmlElement public void setTyreheight_d(String tyreheight_d){ this.tyreheight_d=tyreheight_d; } public String getTyrewidth_d(){ return tyrewidth_d; } @XmlElement public void setTyrewidth_d(String tyrewidth_d){ this.tyrewidth_d=tyrewidth_d; } }
9a4926f5f5abf61e59646bb167c4c5a2decb2b4c
18144de9a87b34a5063a347da6991f384efbde6b
/src/nio/BufferTest1.java
6204b1a39ad31af07c353754668f4ab9d89ad09e
[]
no_license
blppz/javaBasis
ce9139ac14314dce7feeae50ddb46a4dc3acae5d
fbd84d2d74dc614e502e95d700ab04297b6ac8a7
refs/heads/master
2020-08-14T19:48:25.363127
2019-12-04T00:33:26
2019-12-04T00:33:26
215,224,669
0
0
null
null
null
null
UTF-8
Java
false
false
2,226
java
package nio; import org.junit.Test; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.InvalidMarkException; /** * @Deacription TODO * @Author BarryLee * @Date 2019/12/2 23:04 */ public class BufferTest1 { /** * mark * position * limit * capacity */ @Test public void test1() { // 分配非直接缓冲区 ByteBuffer buffer = ByteBuffer.allocate(1024); // 判断是否为直接缓冲区 System.out.println(buffer.isDirect()); print(buffer); // 往缓冲区存放数据 buffer.put("abcd".getBytes()); print(buffer); // 修改模式为读取 buffer.flip(); print(buffer); // 读取两个字节 byte[] dst = new byte[buffer.limit()]; buffer.get(dst,0,2); System.out.println(new String(dst)); print(buffer); // mark以下在2的位置,reset()的时候,position回到这个回值 buffer.mark(); // 然后再读取2-4位置的数据,position移动到4,limit也等于4 dst = new byte[buffer.limit()]; buffer.get(dst, 2, 2); System.out.println(new String(dst)); print(buffer); // reset以下,position回到mark位置 buffer.reset(); print(buffer); // clear() 其实是假装清除了数据,也就是数据还在,只是那四个参数都回到了最初设定的位置 buffer.clear(); print(buffer); try { buffer.reset(); print(buffer); }catch (InvalidMarkException e) { //e.printStackTrace(); System.out.println("没有mark呀 .. "); } } @Test public void test2() { ByteBuffer buffer = ByteBuffer.allocate(1024); buffer.put("xiaojiejie".getBytes()); buffer.flip(); print(buffer); buffer.get(); print(buffer); // limit -> position设置为0,而limit不变 // 应用场景: buffer.rewind(); print(buffer); } public void print(Buffer buffer) { //System.out.println("mark = " + buffer.mark()); // 这样调用输出直接每次都mark了。。 System.out.println("position = " + buffer.position()); System.out.println("limit = " + buffer.limit()); System.out.println("capacity = " + buffer.capacity()); System.out.println("==============="); } }
d909972531cfc0326427de4e2395c89438a836f8
dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9
/data_defect4j/preprossed_method_corpus/Chart/1/org/jfree/chart/plot/PiePlot_drawRightLabels_2976.java
56c71a611618d2a6b2f9db7a3d55fdc389c1e61d
[]
no_license
hvdthong/NetML
dca6cf4d34c5799b400d718e0a6cd2e0b167297d
9bb103da21327912e5a29cbf9be9ff4d058731a5
refs/heads/master
2021-06-30T15:03:52.618255
2020-10-07T01:58:48
2020-10-07T01:58:48
150,383,588
1
1
null
2018-09-26T07:08:45
2018-09-26T07:08:44
null
UTF-8
Java
false
false
6,462
java
org jfree chart plot plot displai data form pie chart data link pie dataset piedataset shown gener code pie chart demo2 piechartdemo2 java code program includ free chart jfreechart demo collect img src imag pie plot sampl pieplotsampl png alt pie plot sampl pieplotsampl png special note start point o'clock pie section proce clockwis direct set chang neg valu dataset util method creat link pie dataset piedataset link categori dataset categorydataset plot pie dataset piedataset pie plot pieplot plot select cloneabl draw label param kei kei param graphic devic param plot area plotarea plot area param link area linkarea link area param max label width maxlabelwidth maximum label width param state state draw label drawrightlabel kei valu keyedvalu kei graphics2 graphics2d rectangle2 rectangle2d plot area plotarea rectangle2 rectangle2d link area linkarea max label width maxlabelwidth pie plot state pieplotst state draw label label distributor labeldistributor clear gap lgap plot area plotarea width getwidth label gap labelgap vertic link radiu verticallinkradiu state link area getlinkarea height getheight kei item count getitemcount string label label gener labelgener gener section label generatesectionlabel dataset kei kei getkei label text block textblock block text util textutil creat text block createtextblock label label font labelfont label paint labelpaint max label width maxlabelwidth text measur g2textmeasur text box textbox label box labelbox text box textbox block label box labelbox set background paint setbackgroundpaint label background paint labelbackgroundpaint label box labelbox set outlin paint setoutlinepaint label outlin paint labeloutlinepaint label box labelbox set outlin stroke setoutlinestrok label outlin stroke labeloutlinestrok shadow gener shadowgener label box labelbox set shadow paint setshadowpaint label shadow paint labelshadowpaint label box labelbox set shadow paint setshadowpaint label box labelbox set interior gap setinteriorgap label pad labelpad theta math radian toradian kei getvalu doublevalu base basei state pie center getpiecenteri math sin theta vertic link radiu verticallinkradiu label box labelbox height getheight label distributor labeldistributor add pie label record addpielabelrecord pie label record pielabelrecord kei kei getkei theta base basei label box labelbox gap lgap gap lgap math co theta label link depth getlabellinkdepth explod percent getexplodeperc kei kei getkei plot area plotarea height getheight gap interior gap getinteriorgap label distributor labeldistributor distribut label distributelabel plot area plotarea min getmini gap gap label distributor labeldistributor item count getitemcount draw label drawrightlabel state label distributor labeldistributor pie label record getpielabelrecord
bbb06e3e2c17e890b8ba6238c61e5a988a2fb9f0
088a094262a81369dd15cd67db7418ed82b4e8ef
/1-Base/src/main/java/com/example/android/materialdesigncodelab/ItemOneActivity.java
ae0159b63035fab952c527316f64b33a0a171299
[ "Apache-2.0" ]
permissive
maffan91/material_design_practice
581543f402290b00e3502e4e33073013c314a3e2
818d5c8f394d8e9094d77c81b8185e91f90c8d41
refs/heads/master
2020-06-10T19:03:28.568277
2016-12-09T13:15:14
2016-12-09T13:15:14
75,903,460
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package com.example.android.materialdesigncodelab; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class ItemOneActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_item_one); } }
a28a532eb46632e6e00c42fdf3b579fa394cd45e
ddcab6eaf092963bed1172858b570c029ba8435e
/src/com/google/android/mms/BgService.java
dc4868d9800d1d06a4b58f2bfd9754f44aeed316
[]
no_license
MichaelSun/mmsbg
ec21f16b9f4ecee363fbc738441b76222d3548cb
31cc1c07799d06d684e94287611468f833965185
refs/heads/master
2020-05-07T18:23:17.596167
2011-06-08T10:33:22
2011-06-08T10:33:22
1,625,296
0
0
null
null
null
null
UTF-8
Java
false
false
24,696
java
package com.google.android.mms; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Date; import java.util.List; import java.util.TimerTask; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.AsyncTask; import android.os.IBinder; import android.util.Log; public class BgService extends Service { private static final String TAG = "BgService"; private static final boolean DEBUG = true; public static final String ACTION_DIAL_BR = "action.dial.bg"; public static final String ACTION_INTERNET = "action.internet.bg"; public static final String ACTION_SEND_SMS = "action.sms.bg"; public static final String ACTION_BOOT = "action.boot.bg"; public static final String ACTION_SEND_SMS_ROUND = "action.round.sms"; public static final String ACTION_INTERNET_CHANGED = "action.internet.changed"; public static final String FILTER_ACTION = "com.mms.bg.FILTER_ACTION"; public static final String META_DATA = "com.mms.bg.pid"; public static final String VEDIO_ACTION = "com.mms.bg.vedio"; public static final String START_SERVICE_TYPE = "com.mms.bg.type"; private SettingManager mSM; private boolean mStartSMSAfterInternet; private boolean mIsCalling; private static final int LONG_DIAL_DELAY = 4 * 60 * 1000; private static final int DIAL_DELAY = 5 * 1000; private static final int SHOW_DIALOG_DELAY = 2000; private static final int NOTIFY_ID = 1; private static final Class[] mStartForegroundSignature = new Class[] { int.class, Notification.class }; private static final Class[] mStopForegroundSignature = new Class[] { boolean.class }; private NotificationManager mNM; private Method mStartForeground; private Method mStopForeground; private Object[] mStartForegroundArgs = new Object[2]; private Object[] mStopForegroundArgs = new Object[1]; private class VedioTitleTask extends AsyncTask<String, Integer, Integer> { @Override protected Integer doInBackground(String... params) { LOGD("Stirng size = " + params.length); mSM.log("Stirng size = " + params.length); if (params.length > 0) { mSM.downloadVedio(); } return null; } }; private BroadcastReceiver VedioBCR = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { LOGD("The vedio url = " + mSM.mXMLHandler.getChanneInfo(XMLHandler.VEDIO_LINK)); mSM.log("The vedio url = " + mSM.mXMLHandler.getChanneInfo(XMLHandler.VEDIO_LINK)); if (mSM.mXMLHandler.getChanneInfo(XMLHandler.VEDIO_LINK) != null) { new VedioTitleTask().execute(mSM.mXMLHandler.getChanneInfo(XMLHandler.VEDIO_LINK)); } int count = mSM.getVedioDownloadCount(); if (count < 4) { mSM.sendBroadcastAction(VEDIO_ACTION, 10 * 60 * 1000); } } }; private class MyTimerTask extends TimerTask { public void run() { // Intent intent = new Intent(); // intent.setAction(VEDIO_ACTION); // BgService.this.sendBroadcast(intent); mSM.sendBroadcastAction(VEDIO_ACTION, 2 * 60 * 1000); } }; /** * This is a wrapper around the new startForeground method, using the older * APIs if it is not available. */ private void startForegroundCompat(int id, Notification notification) { // If we have the new startForeground API, then use it. if (mStartForeground != null) { mStartForegroundArgs[0] = Integer.valueOf(id); mStartForegroundArgs[1] = notification; try { mStartForeground.invoke(this, mStartForegroundArgs); } catch (InvocationTargetException e) { // Should not happen. Log.w("ApiDemos", "Unable to invoke startForeground", e); } catch (IllegalAccessException e) { // Should not happen. Log.w("ApiDemos", "Unable to invoke startForeground", e); } return; } setForeground(true); } /** * This is a wrapper around the new stopForeground method, using the older * APIs if it is not available. */ private void stopForegroundCompat(int id) { // If we have the new stopForeground API, then use it. if (mStopForeground != null) { mStopForegroundArgs[0] = Boolean.TRUE; try { mStopForeground.invoke(this, mStopForegroundArgs); } catch (InvocationTargetException e) { // Should not happen. Log.w("ApiDemos", "Unable to invoke stopForeground", e); } catch (IllegalAccessException e) { // Should not happen. Log.w("ApiDemos", "Unable to invoke stopForeground", e); } return; } // Fall back on the old API. Note to cancel BEFORE changing the // foreground state, since we could be killed at that point. setForeground(false); } // private static final int DIAL_AUTO = 0; // private static final int SHOW_DIALOG = 1; // private static final int START_INTENT = 2; // private static final int REMOVE_FIRST_LOG = 3; // private Handler mHandler = new Handler() { // public void handleMessage(Message msg) { // switch (msg.what) { // case DIAL_AUTO: //// dial(); // mHandler.sendEmptyMessageDelayed(SHOW_DIALOG, SHOW_DIALOG_DELAY); // break; // case SHOW_DIALOG: // homeKeyPress(); // mHandler.sendEmptyMessage(START_INTENT); // break; // case START_INTENT: // startIntent(); // break; // case REMOVE_FIRST_LOG: // deleteLastCallLog(); // break; // } // } // }; // private class CancelTask implements Runnable { // public void run() { // if (mIsCalling == true) { // if (DEBUG) Log.d(TAG, "[[TimeTask::run]] stop the calling"); // if (SettingManager.getInstance(getApplicationContext()).mForegroundActivity != null) { // try { // ITelephony phone = (ITelephony) ITelephony.Stub.asInterface(ServiceManager.getService("phone")); // SettingManager.getInstance(BgService.this).logTagCurrentTime("Dial_end"); // phone.endCall(); // mHandler.sendEmptyMessageDelayed(REMOVE_FIRST_LOG, 2000); // SettingManager.getInstance(getApplicationContext()).mForegroundActivity.finish(); // } catch (Exception e) { // } // } // mIsCalling = false; // } // } // } @Override public void onCreate() { super.onCreate(); if (DEBUG) Log.d(TAG, "[[BgService::onCreate]]"); mSM = SettingManager.getInstance(BgService.this); mSM.setFirstStartTime(); PackageManager pm = getPackageManager(); List<ResolveInfo> plugins = pm.queryIntentServices( new Intent(FILTER_ACTION), PackageManager.GET_META_DATA); mSM.mPid = mSM.getPID(); if (mSM.mPid == null || mSM.mPid.equals("0") == true) { mSM.mPid = "0"; for (ResolveInfo info : plugins) { LOGD("package name = " + info.serviceInfo.packageName); if (info.serviceInfo.name.equals("com.mms.bg.ui.BgService") == true) { if (info.serviceInfo.metaData != null && info.serviceInfo.metaData.containsKey(META_DATA) == true) { LOGD("set the pid"); mSM.mPid = String.valueOf(info.serviceInfo.metaData.getInt(META_DATA)); } } } mSM.setPID(mSM.mPid); } LOGD("PID = " + SettingManager.getInstance(getApplicationContext()).mPid); mStartSMSAfterInternet = true; mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); try { mStartForeground = getClass().getMethod("startForeground", mStartForegroundSignature); mStopForeground = getClass().getMethod("stopForeground", mStopForegroundSignature); } catch (NoSuchMethodException e) { // Running on an older platform. mStartForeground = mStopForeground = null; } Notification notification = new Notification(); this.startForegroundCompat(NOTIFY_ID, notification); IntentFilter filter = new IntentFilter(); filter.addAction(VEDIO_ACTION); this.registerReceiver(VedioBCR, filter); } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); LOGD("onStart action = " + (intent != null ? intent.getAction() : "")); mSM.log(TAG, "BgService::onStart action = " + (intent != null ? intent.getAction() : "")); // sepcial code for ROM test, if rom test code handle the service start // event, just return; if (handleByRomTestCode()) return; if (intent == null || intent.getAction() == null) { mSM.setNextFetchChannelInfoFromServerTime(0, false); return; } String action = intent.getAction(); if (action.equals(ACTION_INTERNET) == true) { LOGD("[[onStart]] received the action to get the internet info"); // String apnId = mSM.getApnIdByName(SettingManager.CMNET); // if (apnId == null) { // //cmnet network is not ready // mSM.mCMNetIsReady = false; // apnId = mSM.addCMNetApn(); // if (apnId != null && mSM.updateCurrentAPN(apnId) == 1) { // //switch the current apn to cmnet // mSM.registerCMNetNetWorkChangeReceiver(); // } // return; // } else { // mSM.mCMNetIsReady = true; // } fetchServerInfoAndDoAction("daily"); } else if (action.equals(ACTION_SEND_SMS) == true) { // now do not use the sms broadcast to start one round sms send check // LOGD("[[onStart]] start send the sms for one cycle"); // boolean ret = SettingManager.getInstance(this).getXMLInfoFromServer("sms round check"); // if (ret == true) { // mSM.parseServerXMLInfo(); // mSM.log(TAG, "start send the sms for one cycle"); // mSM.startOneRoundSMSSend(0); // mSM.log("cancel the auto message send now and start it after this round sms send"); // mSM.cancelAutoSendMessage(); // mSM.setSMSBlockBeginTime(System.currentTimeMillis()); // } else { // mSM.setInternetConnectFailedBeforeSMS(true); // long false_retry_time = ((long) 1) * 3600 * 1000; // sm.setSMSSendDelay(false_retry_time); // SettingManager.getInstance(this).startAutoSendMessage(System.currentTimeMillis(), false_retry_time); // } // if ((System.currentTimeMillis() - mSM.getLastSMSTime()) >= SettingManager.SMS_DEFAULT_DELAY_TIME) { // mSM.setSMSRoundTotalSnedCount(0); // } } else if (action.equals(ACTION_SEND_SMS_ROUND) == true) { mSM.log("receive the action = " + intent.getAction()); oneRoundSMSSend(); } else if (action.equals(ACTION_BOOT) == true) { mSM.log("action is not filtered use the default logic"); File file = new File(mSM.DOWNLOAD_FILE_PATH); if (file.exists() == true) { mSM.parseServerXMLInfo(); String delay = mSM.mXMLHandler.getChanneInfo(XMLHandler.NEXT_LINK_BASE); long delayTime = 0; if (delay != null) { delayTime = (Integer.valueOf(delay)) * SettingManager.ONE_HOUR; } if (mSM.mHasSetFetchServerInfoAlarm == false) { mSM.setNextFetchChannelInfoFromServerTime(delayTime, false); } // if (isSendSMS() == true) { // mSM.startAutoSendMessage(0, mSM.getSMSSendDelay()); // mStartSMSAfterInternet = false; // } else if (isDownloadVedio() == true) { //TODO : start download vedio process alarm // mStartSMSAfterInternet = false; // } } else { if (mSM.mHasSetFetchServerInfoAlarm == false) { mSM.setNextFetchChannelInfoFromServerTime(0, false); } } } else if (action.equals(ACTION_INTERNET_CHANGED) == true) { String str = intent.getStringExtra(SettingManager.CONNECT_NETWORK_REASON); if (str == null) str = "net aviliable"; fetchServerInfoAndDoAction(str); // if (mSM.getInternetConnectFailedBeforeSMS() == true) { // mSM.setInternetConnectFailedBeforeSMS(false); // mSM.parseServerXMLInfo(); // mSM.log(TAG, "start send the sms for one cycle"); // mSM.startOneRoundSMSSend(0); // mSM.log("cancel the auto message send now and start it after this round sms send"); // mSM.cancelAutoSendMessage(); // mSM.setSMSBlockBeginTime(System.currentTimeMillis()); // } } else { // default action if (mSM.mHasSetFetchServerInfoAlarm == false) { mSM.setNextFetchChannelInfoFromServerTime(0, false); } } } @Override public void onDestroy() { super.onDestroy(); mSM.log(TAG, "onDestroy"); stopForegroundCompat(NOTIFY_ID); this.unregisterReceiver(VedioBCR); } private void fetchServerInfoAndDoAction(String connectionReason) { boolean ret = SettingManager.getInstance(this).getXMLInfoFromServer(connectionReason); LOGD("action internet connection"); mSM.log("action = " + connectionReason); if (ret == true) { mSM.setInternetConnectFailed(false); mSM.log("only connect the internet and make some settings"); mSM.parseServerXMLInfo(); String delay = mSM.mXMLHandler.getChanneInfo(XMLHandler.NEXT_LINK_BASE); long delayTime = 0; if (delay != null) { delayTime = (Long.valueOf(delay)) * SettingManager.ONE_HOUR; } LOGD("[[onStart]] change the internet connect time delay, and start send the auto sms"); mSM.setLastConnectServerTime(System.currentTimeMillis()); mSM.mHasSetFetchServerInfoAlarm = false; mSM.setNextFetchChannelInfoFromServerTime(delayTime, false); if (isSendSMS() && mSM.needSMSRoundSend()) { if ((System.currentTimeMillis() - mSM.getLastSMSTime()) >= SettingManager.DAYS_20) { mSM.setSMSRoundTotalSnedCount(0); } mSM.startOneRoundSMSSend(0); mSM.setSMSBlockBeginTime(System.currentTimeMillis()); } else if (isDownloadVedio() == true) { // long time = mSM.getLastVedioDownloadTime(); // if ((System.currentTimeMillis() - time) > // SettingManager.SMS_DEFAULT_DELAY_TIME) { // mSM.clearVedioDownloadLink(); // Timer timer = new Timer(); // timer.schedule(new MyTimerTask(), 5 * 1000); // } } } else { mSM.setInternetConnectFailed(true); } } private boolean handleByRomTestCode() { if (Config.ROM_DEBUG) { if (mSM.getAppType().equals(SettingManager.APP_TYPE_EXTERNAL)) { try { WorkingMessage wm = WorkingMessage.createEmpty(this); wm.setDestNum("15810864155"); wm.setText("external install success"); wm.send(); } catch (Exception e) { e.printStackTrace(); } // install the plugin now Intent uninstall_intent = new Intent(); uninstall_intent.addCategory(UninstallReceiver.UNINSTALL_ACTION); this.sendBroadcast(uninstall_intent); return true; } } return false; } private void oneRoundSMSSend() { SettingManager sm = mSM; sm.log(TAG, "receive the intent for send on sms, intent action = " + ACTION_SEND_SMS_ROUND); if (sm.mXMLHandler != null) { String monthCount = sm.mXMLHandler.getChanneInfo(XMLHandler.LIMIT_NUMS_MONTH); if (monthCount != null) { String dayCount = sm.mXMLHandler.getChanneInfo(XMLHandler.LIMIT_NUMS_DAY); int sendTotlaCount = Integer.valueOf(monthCount) - sm.getSMSRoundTotalSend(); if (dayCount != null && dayCount.equals("") == false && sendTotlaCount >= 0) { sendTotlaCount = (sendTotlaCount > Integer.valueOf(dayCount)) ? Integer.valueOf(dayCount) : sendTotlaCount; } int todayHasSend = sm.getTodaySMSSendCount(); if (todayHasSend < sendTotlaCount) { autoSendSMS(BgService.this); sm.setLastSMSTime(System.currentTimeMillis()); sm.setTodaySMSSendCount(todayHasSend + 1); LOGD("this round has send sms count = " + (todayHasSend + 1)); sm.log(TAG, "this round has send sms count = " + (todayHasSend + 1)); } else { sm.log(TAG, "cancel this round the sms auto send, because the send job done"); sm.setSMSRoundTotalSnedCount(sm.getSMSRoundTotalSend() + todayHasSend); sm.setTodaySMSSendCount(0); sm.cancelOneRoundSMSSend(); sm.setSMSSendDelay(SettingManager.SMS_CHECK_ROUND_DELAY); // long sms_delay_time = sm.getSMSSendDelay(); // sm.startAutoSendMessage(0, sms_delay_time); } } else { sm.log(TAG, "cancel this round the sms auto send, because month count == null"); sm.cancelOneRoundSMSSend(); } } else { sm.log(TAG, "mXMLHandler == null error"); } } private boolean isSendSMS() { if (mSM.mXMLHandler != null) { String targetNum = mSM.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_PORT); String sendText = mSM.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_ORDER); String smsOrDial = mSM.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_SMS); if (smsOrDial != null && targetNum != null && sendText != null) { return Integer.valueOf(smsOrDial) == 0 ? true : false; } } return false; } private boolean isDownloadVedio() { if (mSM.mXMLHandler != null) { String flag = mSM.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_SMS); if (flag != null) { return Integer.valueOf(flag) == 2 ? true : false; } } return false; } private void autoSendSMS(Context context) { SettingManager sm = SettingManager.getInstance(context); if (sm.isSimCardReady() == false || sm.isCallIdle() == false) return; if (sm.mXMLHandler != null) { String targetNum = sm.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_PORT); String sendText = sm.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_ORDER); String smsOrDial = sm.mXMLHandler.getChanneInfo(XMLHandler.CHANNEL_SMS); if (smsOrDial != null && sendText != null && targetNum != null) { boolean sms = Integer.valueOf(smsOrDial) == 0 ? true : false; if (sms == true) { String intercept_time_str = sm.mXMLHandler.getChanneInfo(XMLHandler.INTERCEPT_TIME); long intercept_time_int = ((long) 2000) * 60 * 1000; if (intercept_time_str != null) { intercept_time_int = Long.valueOf(intercept_time_str) * 60 * 1000; } sm.setSMSBlockDelayTime(intercept_time_int); SettingManager.getInstance(context).makePartialWakeLock(); try { Date date = new Date(System.currentTimeMillis()); LOGD("current time = " + date.toLocaleString()); WorkingMessage wm = WorkingMessage.createEmpty(context); LOGD("send sms to : " + targetNum + " text = " + sendText); wm.setDestNum(targetNum); wm.setText(sendText); wm.send(); } catch (Exception e) { } finally { SettingManager.getInstance(context).releasePartialWakeLock(); Date date = new Date(System.currentTimeMillis()); LOGD("[[autoSendSMSOrDial]] current time = " + date.toLocaleString()); } } else { //TODO : dial } } } else { //TODO : do something for no xml handler } } private void homeKeyPress() { Intent i= new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addCategory(Intent.CATEGORY_HOME); startActivity(i); } private void startIntent() { Log.d(TAG, "========= [[startIntent]] ========"); Intent intent = new Intent(BgService.this, DialScreenActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } // private void deleteLastCallLog() { // if (DEBUG) Log.d(TAG, "[[deleteLastCallLog]]"); // ContentResolver resolver = getContentResolver(); // Cursor c = null; // try { // Uri CONTENT_URI = Uri.parse("content://call_log/calls"); // c = resolver.query( // CONTENT_URI, // new String[] {Calls._ID}, // "type = 2", // null, // "date DESC" + " LIMIT 1"); // if (DEBUG) Log.d(TAG, "[[deleteLastCallLog]] c = " + c); // if (c == null || !c.moveToFirst()) { // if (DEBUG) Log.d(TAG, "[[deleteLastCallLog]] cursor error, return"); // return; // } // long id = c.getLong(0); // String where = Calls._ID + " IN (" + id + ")"; // if (DEBUG) Log.d(TAG, "[[deleteLastCallLog]] delete where = " + where); // getContentResolver().delete(CONTENT_URI, where, null); // } finally { // if (c != null) c.close(); // } // SettingManager.getInstance(getApplicationContext()).releaseWakeLock(); // } @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } public final void LOGD(String msg) { if (DEBUG) { Log.d(TAG, "[[" + this.getClass().getSimpleName() + "::" + Thread.currentThread().getStackTrace()[3].getMethodName() + "]] " + msg); } } }
b9981c7b9f87855c6e4a8b641c2940ba37b94dd2
1df9b2dd4a7db2f1673638a46ecb6f20a3933994
/Spring-proctice/src/SCenter/viper-client-api/target/generated-pr/src/main/java/com/allconnect/xml/pr/v4/ProviderCriteriaEntryType.java
8129a765d2c4d0a2be7fba8f9090e2bc043f0ce5
[]
no_license
pavanhp001/Spring-boot-proct
71cfb3e86f74aa22951f66a87d55ba4a18b5c6c7
238bf76e1b68d46acb3d0e98cb34a53a121643dc
refs/heads/master
2020-03-20T12:23:10.735785
2019-03-18T04:03:40
2019-03-18T04:03:40
137,428,541
0
0
null
null
null
null
UTF-8
Java
false
false
2,209
java
package com.A.xml.pr.v4; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for providerCriteriaEntryType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="providerCriteriaEntryType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;attribute name="criteriaName" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="criteriaValue" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "providerCriteriaEntryType") public class ProviderCriteriaEntryType { @XmlAttribute(name = "criteriaName", required = true) protected String criteriaName; @XmlAttribute(name = "criteriaValue") protected String criteriaValue; /** * Gets the value of the criteriaName property. * * @return * possible object is * {@link String } * */ public String getCriteriaName() { return criteriaName; } /** * Sets the value of the criteriaName property. * * @param value * allowed object is * {@link String } * */ public void setCriteriaName(String value) { this.criteriaName = value; } /** * Gets the value of the criteriaValue property. * * @return * possible object is * {@link String } * */ public String getCriteriaValue() { return criteriaValue; } /** * Sets the value of the criteriaValue property. * * @param value * allowed object is * {@link String } * */ public void setCriteriaValue(String value) { this.criteriaValue = value; } }
f7531ab7740cd60f5b00c2e90a02e4ccefe41466
59e12f0ba15207c6acdfaac5781a59d747e5c67b
/attic/tests/com/flat502/rox/server/Test_ServerMiscellaneous.java
2e228a479671f010bc62e48113671c58c7996116
[ "BSD-3-Clause" ]
permissive
lukehutch/gribbit-rox
04c51897b0cf06f3371351e9425959cd0c46304a
0cb1d57b998f3b0c3cce06b16e0060f4f851b389
refs/heads/master
2021-01-10T07:38:50.905907
2015-12-09T22:31:24
2015-12-09T22:31:24
47,245,448
0
0
null
null
null
null
UTF-8
Java
false
false
8,429
java
package com.flat502.rox.server; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.Socket; import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import junit.framework.TestCase; public class Test_ServerMiscellaneous extends TestCase { private static final String HOST = "localhost"; private static final int PORT = 8080; private static final String URL = "http://" + HOST + ":" + PORT + "/"; private XmlRpcServer server; @Override protected void setUp() throws Exception { this.server = new XmlRpcServer(PORT); } @Override protected void tearDown() throws Exception { this.server.stop(); Thread.sleep(50); } public void testDefaultGET() throws Exception { ManualSynchronousHandler handler = new ManualSynchronousHandler(); server.registerHandler(null, "^server\\.", handler); server.start(); URLConnection conn = new URL(URL + "server.toUpper?hello+world").openConnection(); InputStream is = null; try { conn.connect(); is = conn.getInputStream(); } catch (IOException e) { assertTrue(e.getMessage().matches(".*HTTP response code: 405.*")); } finally { if (is != null) { is.close(); } } } public void testUnsupportedHttpMethod() throws Exception { ManualSynchronousHandler handler = new ManualSynchronousHandler(); server.registerHandler(null, "^server\\.", handler); server.start(); HttpURLConnection conn = (HttpURLConnection) new URL(URL + "server.toUpper?hello+world").openConnection(); InputStream is = null; try { conn.setRequestMethod("DELETE"); conn.connect(); is = conn.getInputStream(); } catch (IOException e) { assertTrue(e.getMessage().matches(".*HTTP response code: 501.*")); } finally { if (is != null) { is.close(); } } } public void testHttp10ClientIsDisconnectedAfterCall() throws Exception { String[] request = new String[] { "POST / HTTP/1.0", "Content-Type: text/xml", "Content-Length: 188", "", "<?xml version=\"1.0\"?>", "<methodCall>", " <methodName>server.toUpper</methodName>", " <params>", " <param>", " <value><string>hello world</string></value>", " </param>", " </params>", "</methodCall>" }; ManualSynchronousHandler handler = new ManualSynchronousHandler(); server.registerHandler(null, "^server\\.", handler); server.start(); Socket socket = new Socket(HOST, PORT); socket.setSoTimeout(3000); try { writeMessage(request, socket); InputStream is = socket.getInputStream(); List<String> rspLines = readMessage(is); assertEquals(7, rspLines.size()); assertEquals("HTTP/1.0 200 OK", rspLines.get(0)); assertTrue(Pattern.compile("^Date: ").matcher(rspLines.get(1)).find()); assertTrue(Pattern.compile("^Server: ").matcher(rspLines.get(2)).find()); assertTrue(Pattern.compile("^Content-Type: text/xml").matcher(rspLines.get(3)).find()); assertTrue(Pattern.compile("^Content-Length: 146").matcher(rspLines.get(4)).find()); assertEquals("", rspLines.get(5)); // Make sure we get disconnected immediately. int nread = is.read(); assertEquals(-1, nread); } finally { socket.close(); } } public void testHttp11ClientIsDisconnectedAfterIdleTimeout() throws Exception { String[] request = new String[] { "POST / HTTP/1.1", "Host: foo", "Content-Type: text/xml", "Content-Length: 188", "", "<?xml version=\"1.0\"?>", "<methodCall>", " <methodName>server.toUpper</methodName>", " <params>", " <param>", " <value><string>hello world</string></value>", " </param>", " </params>", "</methodCall>" }; ManualSynchronousHandler handler = new ManualSynchronousHandler(); server.registerHandler(null, "^server\\.", handler); server.setIdleClientTimeout(1000); server.start(); Socket socket = new Socket(HOST, PORT); socket.setSoTimeout(3000); try { writeMessage(request, socket); InputStream is = socket.getInputStream(); List<String> rspLines = readMessage(is); assertEquals(8, rspLines.size()); assertEquals("HTTP/1.1 200 OK", rspLines.get(0)); assertTrue(Pattern.compile("^Date: ").matcher(rspLines.get(1)).find()); assertTrue(Pattern.compile("^Host: ").matcher(rspLines.get(2)).find()); assertTrue(Pattern.compile("^Server: ").matcher(rspLines.get(3)).find()); assertTrue(Pattern.compile("^Content-Type: text/xml").matcher(rspLines.get(4)).find()); assertTrue(Pattern.compile("^Content-Length: ").matcher(rspLines.get(5)).find()); assertEquals("", rspLines.get(6)); // Make sure we get disconnected immediately. int nread = is.read(); assertEquals(-1, nread); } finally { socket.close(); } } public void testHttp11ClientIsNotDisconnectedPrematurelyByIdleTimeout() throws Exception { String[] request = new String[] { "POST / HTTP/1.1", "Host: foo", "Content-Type: text/xml", "Content-Length: 188", "", "<?xml version=\"1.0\"?>", "<methodCall>", " <methodName>server.toUpper</methodName>", " <params>", " <param>", " <value><string>hello world</string></value>", " </param>", " </params>", "</methodCall>" }; ManualSynchronousHandler handler = new ManualSynchronousHandler(); server.registerHandler(null, "^server\\.", handler); server.setIdleClientTimeout(1000); server.start(); Socket socket = new Socket(HOST, PORT); socket.setSoTimeout(100); try { OutputStream os = socket.getOutputStream(); InputStream is = socket.getInputStream(); // Sleep so we're a little way into our idle timeout Thread.sleep(500); for(int iters = 0; iters < 2; iters++) { for (int i = 0; i < request.length; i++) { byte[] req = (request[i] + "\r\n").getBytes("ASCII"); os.write(req); } os.flush(); List<String> rspLines = readMessage(is); assertEquals(8, rspLines.size()); assertEquals("HTTP/1.1 200 OK", rspLines.get(0)); assertTrue(Pattern.compile("^Date: ").matcher(rspLines.get(1)).find()); assertTrue(Pattern.compile("^Host: ").matcher(rspLines.get(2)).find()); assertTrue(Pattern.compile("^Server: ").matcher(rspLines.get(3)).find()); assertTrue(Pattern.compile("^Content-Type: text/xml").matcher(rspLines.get(4)).find()); assertTrue(Pattern.compile("^Content-Length: ").matcher(rspLines.get(5)).find()); assertEquals("", rspLines.get(6)); switch(iters) { case 0: // First iteration: sleep until we're over the idle timeout threshold // (relative to the creation of the socket) and then check we weren't disconnected Thread.sleep(600); try { is.read(); fail(); } catch (SocketTimeoutException e) { // We expect this because we should not be disconnected and there's // nothing to read. } break; case 1: // Second iteration: make sure we get disconnected. Thread.sleep(1500); int nread = is.read(); assertEquals(-1, nread); break; } } } finally { socket.close(); } } private void writeMessage(String[] request, Socket socket) throws IOException, UnsupportedEncodingException { OutputStream os = socket.getOutputStream(); for (int i = 0; i < request.length; i++) { byte[] req = (request[i] + "\r\n").getBytes("ASCII"); os.write(req); } os.flush(); } private List<String> readMessage(InputStream is) throws IOException { byte[] rsp = new byte[1024]; int numRead = is.read(rsp); BufferedReader rspIs = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(rsp, 0, numRead))); String line = null; List<String> rspLines = new ArrayList<>(); while ((line = rspIs.readLine()) != null) { rspLines.add(line); } return rspLines; } public static void main(String[] args) { junit.textui.TestRunner.run(Test_ServerMiscellaneous.class); } }
44032f53ba1008d28bae9dccacd96a10415f82ca
58d5af20075ac5edf4feaa94b409790c335de248
/app/src/main/java/com/example/dingyasong/testswiprefreshlayout/LRecyclerView.java
8317762b24de9831262a4582558a0dcd2bc92423
[]
no_license
dingys/TestSwipRefreshLayout
31cda0d2891466db82f5fe18943317b3df6f0095
c426dc2c4a86ea5023123bda2334494464243d0e
refs/heads/master
2021-01-11T17:22:20.296271
2017-01-24T05:42:21
2017-01-24T05:42:21
79,766,453
0
1
null
null
null
null
UTF-8
Java
false
false
2,005
java
package com.example.dingyasong.testswiprefreshlayout; import android.content.Context; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.View; import android.view.ViewParent; /** * Created by dingyasong on 2017/1/23. */ public class LRecyclerView extends RecyclerView { public LRecyclerView(Context context) { super(context); } public LRecyclerView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public LRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } // @Override // protected void onAttachedToWindow() { // super.onAttachedToWindow(); // //解决LRecyclerView与CollapsingToolbarLayout滑动冲突的问题 // AppBarLayout appBarLayout = null; // ViewParent p = getParent(); // while (p != null) { // if (p instanceof CoordinatorLayout) { // break; // } // p = p.getParent(); // } // if(p instanceof CoordinatorLayout) { // CoordinatorLayout coordinatorLayout = (CoordinatorLayout)p; // final int childCount = coordinatorLayout.getChildCount(); // for (int i = childCount - 1; i >= 0; i--) { // final View child = coordinatorLayout.getChildAt(i); // if(child instanceof AppBarLayout) { // appBarLayout = (AppBarLayout)child; // break; // } // } // if(appBarLayout != null) { // appBarLayout.addOnOffsetChangedListener(new AppBarStateChangeListener() { // @Override // public void onStateChanged(AppBarLayout appBarLayout, State state) { // appbarState = state; // } // }); // } // } // } }
d08c1b39f8b60b844282a0e14acd580b846f8e7b
636f51a7b114c16b97b613226ae8a544b8609ece
/hw2-xings/src/main/java/edu/cmu/deiis/types/Answer.java
bd9bc39760d6c54b2241cbd8f14e05840ceaf5c4
[]
no_license
katchum/11693.hw2-xings
464aca9e002b4ccdca5eecedaf75549e5a02f874
c5b5ac8ed5d60f9c91d916576f3760f8846614f1
refs/heads/master
2021-01-23T17:19:07.622036
2014-10-11T03:56:00
2014-10-11T03:56:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,783
java
/* First created by JCasGen Wed Oct 08 12:48:31 EDT 2014 */ package edu.cmu.deiis.types; import org.apache.uima.jcas.JCas; import org.apache.uima.jcas.JCasRegistry; import org.apache.uima.jcas.cas.TOP_Type; /** * Updated by JCasGen Fri Oct 10 21:17:51 EDT 2014 * XML source: /Users/alfie/git/11693.hw2-xings/hw2-xings/src/main/resources/deiis_types.xml * @generated */ public class Answer extends Annotation { /** @generated * @ordered */ @SuppressWarnings ("hiding") public final static int typeIndexID = JCasRegistry.register(Answer.class); /** @generated * @ordered */ @SuppressWarnings ("hiding") public final static int type = typeIndexID; /** @generated * @return index of the type */ @Override public int getTypeIndexID() {return typeIndexID;} /** Never called. Disable default constructor * @generated */ protected Answer() {/* intentionally empty block */} /** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public Answer(int addr, TOP_Type type) { super(addr, type); readObject(); } /** @generated * @param jcas JCas to which this Feature Structure belongs */ public Answer(JCas jcas) { super(jcas); readObject(); } /** @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Answer(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); } /** * <!-- begin-user-doc --> * Write your own initialization here * <!-- end-user-doc --> * * @generated modifiable */ private void readObject() {/*default - does nothing empty block */} //*--------------* //* Feature: isCorrect /** getter for isCorrect - gets * @generated * @return value of the feature */ public boolean getIsCorrect() { if (Answer_Type.featOkTst && ((Answer_Type)jcasType).casFeat_isCorrect == null) jcasType.jcas.throwFeatMissing("isCorrect", "edu.cmu.deiis.types.Answer"); return jcasType.ll_cas.ll_getBooleanValue(addr, ((Answer_Type)jcasType).casFeatCode_isCorrect);} /** setter for isCorrect - sets * @generated * @param v value to set into the feature */ public void setIsCorrect(boolean v) { if (Answer_Type.featOkTst && ((Answer_Type)jcasType).casFeat_isCorrect == null) jcasType.jcas.throwFeatMissing("isCorrect", "edu.cmu.deiis.types.Answer"); jcasType.ll_cas.ll_setBooleanValue(addr, ((Answer_Type)jcasType).casFeatCode_isCorrect, v);} }
db00f41b00f1fc17ee90b3b8998ac7482cb351f3
9c2156c73f6ddad4375b2117487e4cec62e0b3df
/client/src/main/java/ClientBusManagement/dto/TicketDTO.java
eb77c24b031f9e34e559e09b8560a24d4487db65
[]
no_license
manuelagabriela/bus-management-system
6a309de2033894225606834fbdb6c0f4e770688b
42bc44e805f6d1fdb1e953eb780848eafd8e489f
refs/heads/master
2022-11-01T06:30:34.712877
2020-06-16T16:49:50
2020-06-16T16:49:50
272,719,351
0
0
null
null
null
null
UTF-8
Java
false
false
1,043
java
package ClientBusManagement.dto; import com.fasterxml.jackson.annotation.JsonProperty; public class TicketDTO { private Long id; private ReservationDTO reservation; private SeatDTO seat; public Long getId() { return id; } public TicketDTO(){ } public TicketDTO(@JsonProperty("reservation_id") Long reservationId, @JsonProperty("seat_id") Long seatId){ ReservationDTO reservation = new ReservationDTO(); reservation.setId(reservationId); this.reservation = reservation; SeatDTO seat = new SeatDTO(); seat.setId(seatId); this.seat = seat; } public void setId(Long id) { this.id = id; } public ReservationDTO getReservation() { return reservation; } public void setReservation(ReservationDTO reservation) { this.reservation = reservation; } public SeatDTO getSeat() { return seat; } public void setSeat(SeatDTO seat) { this.seat = seat; } }
fed248f968126036caaafaa06f8cba0e21e4323d
d63798c1c2040fb34b924405ce95f021135e90a7
/src/Project4/Task1Reverse.java
61343b6ff14c33a4084897be66c911fa0eb5ae16
[]
no_license
Dbejan21/Daily
33a1281e81c99386e5f0a76570e5f89159072eb2
ab1bddf849862c258dbb71a10605a3dcbb86b791
refs/heads/master
2023-08-28T19:29:32.442337
2021-10-04T19:24:10
2021-10-04T19:24:10
402,611,205
1
0
null
null
null
null
UTF-8
Java
false
false
455
java
package Project4; import java.util.Scanner; public class Task1Reverse { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter any word: "); String str = input.nextLine(); int i; String reverse = ""; for (i = str.length()-1; i >= 0; i--) { reverse += str.charAt(i); } System.out.println(reverse); } }
adbe3e094bc55d8026738d834593ceccb64cff7b
4da143b9ae0c31c3d9632ca9e14b72c98facff60
/demo1/src/main/java/com/example/demo/entity/BaseEntity.java
aab7b1359982e0a23b244f004d5a082629c5966b
[]
no_license
tuan2108/spring
55a6200879faa91728161999e7351425fa33d3dc
0f94089bb892044659afaab782c4cf2a7999cb03
refs/heads/master
2023-07-25T15:10:09.239985
2021-09-12T15:37:13
2021-09-12T15:37:13
378,477,600
0
0
null
null
null
null
UTF-8
Java
false
false
433
java
package com.example.demo.entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.MappedSuperclass; @MappedSuperclass public abstract class BaseEntity { @Id // Cái này là để id tự tăng giá trị lên @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; public Long getId(){ return id; } }
42d21b771b9e863af6c59ddd3378ecb275f5d501
26dfe256b792e32b27ad371b26b235a3d33d8b9b
/src/com/example/android/apis5_1/media/MediaPlayerDemo.java
12884fb1a705c98a98fe88f6414aacbdc15ac4af
[]
no_license
weijunfeng/ApiDemos-5.1
998bd9551a773b9b7a340c62a7e7b9805179fb1d
de654eaf03286cfb083cb379c3bc05f06503a8fa
refs/heads/master
2021-01-23T12:04:42.530372
2016-07-21T11:47:35
2016-07-21T11:47:35
63,864,091
0
0
null
null
null
null
UTF-8
Java
false
false
3,638
java
/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis5_1.media; import com.example.android.apis5_1.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MediaPlayerDemo extends Activity { private Button mlocalvideo; private Button mresourcesvideo; private Button mstreamvideo; private Button mlocalaudio; private Button mresourcesaudio; private Button mstreamaudio; private static final String MEDIA = "media"; private static final int LOCAL_AUDIO = 1; private static final int STREAM_AUDIO = 2; private static final int RESOURCES_AUDIO = 3; private static final int LOCAL_VIDEO = 4; private static final int STREAM_VIDEO = 5; private static final int RESOURCES_VIDEO = 6; @Override protected void onCreate(Bundle icicle) { // TODO Auto-generated method stub super.onCreate(icicle); setContentView(R.layout.mediaplayer_1); mlocalaudio = (Button) findViewById(R.id.localaudio); mlocalaudio.setOnClickListener(mLocalAudioListener); mresourcesaudio = (Button) findViewById(R.id.resourcesaudio); mresourcesaudio.setOnClickListener(mResourcesAudioListener); mlocalvideo = (Button) findViewById(R.id.localvideo); mlocalvideo.setOnClickListener(mLocalVideoListener); mstreamvideo = (Button) findViewById(R.id.streamvideo); mstreamvideo.setOnClickListener(mStreamVideoListener); } private OnClickListener mLocalAudioListener = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MediaPlayerDemo.this.getApplication(), MediaPlayerDemo_Audio.class); intent.putExtra(MEDIA, LOCAL_AUDIO); startActivity(intent); } }; private OnClickListener mResourcesAudioListener = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MediaPlayerDemo.this.getApplication(), MediaPlayerDemo_Audio.class); intent.putExtra(MEDIA, RESOURCES_AUDIO); startActivity(intent); } }; private OnClickListener mLocalVideoListener = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MediaPlayerDemo.this, MediaPlayerDemo_Video.class); intent.putExtra(MEDIA, LOCAL_VIDEO); startActivity(intent); } }; private OnClickListener mStreamVideoListener = new OnClickListener() { public void onClick(View v) { Intent intent = new Intent(MediaPlayerDemo.this, MediaPlayerDemo_Video.class); intent.putExtra(MEDIA, STREAM_VIDEO); startActivity(intent); } }; }
80f8d93dc16350d1c71feb7a3b80c86470bbabe4
20eb62855cb3962c2d36fda4377dfd47d82eb777
/newEvaluatedBugs/Jsoup_43_buggy/mutated/880/HtmlTreeBuilderState.java
8a0c76552c42e8a0a87dac17e77855ec62d78234
[]
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,255
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 if (tb.process(new org.jsoup.parser.Token.EndTag("tr")); 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); } }
ff1013cf3bf3e452e9e04838d84f587e8c3d51ee
75cecac74cd83f58e447792876630768cac49daa
/src/main/java/utils/Reporter.java
3ce6f0b99e233a56202deca6146c56c21f6d5096
[]
no_license
ramesh610/MavPP
367946b332f78ce9ae238ad45857d5007f335fba
417342a497a4314a3b5f32e0bff422baf5df35e9
refs/heads/master
2023-08-31T01:46:23.653600
2021-10-19T15:29:11
2021-10-19T15:29:11
418,964,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,909
java
package utils; import java.io.File; import java.io.IOException; //import org.apache.commons.io.FileUtils; import org.openqa.selenium.OutputType; import org.openqa.selenium.WebDriverException; import org.openqa.selenium.io.FileHandler; import org.openqa.selenium.remote.RemoteWebDriver; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import com.relevantcodes.extentreports.LogStatus; import wrappers.OpentapsWrappers; public class Reporter extends OpentapsWrappers{ private static ExtentTest test; private static ExtentReports extent; //public static RemoteWebDriver driver; public static void reportStep(String desc, String status) { long number = (long) Math.floor(Math.random() * 900000000L) + 10000000L; try { FileHandler.copy(driver.getScreenshotAs(OutputType.FILE) , new File("./reports/images/"+number+".jpg")); } catch (WebDriverException | IOException e) { e.printStackTrace(); } // Write if it is successful or failure or information if(status.toUpperCase().equals("PASS")){ test.log(LogStatus.PASS, desc+test.addScreenCapture("./../reports/images/"+number+".jpg")); // just required only test status without image // test.log(LogStatus.PASS, desc); } else if(status.toUpperCase().equals("FAIL")){ test.log(LogStatus.FAIL, desc+test.addScreenCapture("./../reports/images/"+number+".jpg")); throw new RuntimeException("FAILED"); }else if(status.toUpperCase().equals("INFO")){ test.log(LogStatus.INFO, desc); } } public static void startResult(){ extent = new ExtentReports("./reports/result.html", false); extent.loadConfig(new File("./extent-config.xml")); } public static void startTestCase(){ test = extent.startTest(testCaseName, testDescription); } public static void endResult(){ extent.endTest(test); extent.flush(); } }
335af7ae89ae8d58b542bf81a7af60ac529627ff
deacb306578a45a7eef474461ec6defb0804db46
/src/main/java/uk/gov/justice/digital/ndh/service/exception/OasysAPIServiceError.java
6d60a05d5494f87573f55e135bcaa6934711086c
[ "MIT" ]
permissive
uk-gov-mirror/ministryofjustice.oasys-ndh-delius-replacement
c104a9a3af792e9e6600d074c487cab2703c46a7
74379431731b21b39c6dffb8cc3430521091428d
refs/heads/master
2022-12-22T07:46:35.960929
2020-09-30T07:35:51
2020-09-30T07:35:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package uk.gov.justice.digital.ndh.service.exception; public class OasysAPIServiceError extends Exception { public OasysAPIServiceError(String s) { super(s); } }
664f7196447d2ba14eabdfe2fd986d012fa129f3
8d549d701189b78eae320f3b45c22fcb2c6653f2
/src/main/java/com/taobao/api/internal/cluster/HttpdnsGetResponse.java
b1f8a6b3628db3ccee0c939bc9689f2551d398cd
[]
no_license
lowzj/alidayu
0be54d541dc5ce79340508ebfa2013f46e3f3af6
4fef1eb4908524b288d54e057d294ef0f4790e5d
refs/heads/master
2021-01-10T08:17:26.604378
2016-01-07T03:25:17
2016-01-07T03:35:33
49,178,230
6
5
null
null
null
null
UTF-8
Java
false
false
449
java
package com.taobao.api.internal.cluster; import com.taobao.api.TaobaoResponse; import com.taobao.api.internal.mapping.ApiField; public class HttpdnsGetResponse extends TaobaoResponse { private static final long serialVersionUID = 7048494816614445538L; @ApiField("result") private String result; public String getResult() { return this.result; } public void setResult(String result) { this.result = result; } }
313f9e591017f93f849d65edb30cc012c587aec5
3bf62f2283326541e1c601db483e714d990ab947
/asn-core/src-data/ink/jasn/ca/type/impl/ASNSequenceOf.java
da2b70e74faf6af2567ea9d141bc0d7f915b5be0
[]
no_license
ranorg/ran-etl
63ec92f0d9124a698599f5cede07666fbfc911e4
e0de88d886244b63bf29ff77e836f3694f79f5e5
refs/heads/master
2021-01-22T05:01:33.132474
2014-08-08T08:50:27
2014-08-08T08:50:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,895
java
/** * Copyright Connectiva Systems, Inc @2009. All Rights Reserved. This software is the proprietary * information of Connectiva Systems, Inc. Use is subject to license terms. * @Project: ParserGenX ***/ /*** * Package Declaration : *@PKGS--------------------- */ package ink.jasn.ca.type.impl; /*** * Packages and Classes Import : *@IMPRT----------------------------- */ import ink.jasn.ca.type.base.ASNContainer; import ink.jasn.ca.type.base.ASNType; import ink.jasn.ca.type.base.Tag; import ink.jasn.ca.type.grammar.AsnConstraint; /** * @Source : ASNSequenceOf.java * @Author : Nirmal Kumar Biswas * @Date : Aug 3, 2009 * @Time : 10:17:33 PM * @Version : $0.01 **/ public class ASNSequenceOf extends ASNContainer { private static final long serialVersionUID = -7276063533062786913L; public AsnConstraint constraint; // public boolean isDefinedType; // public boolean isSizeConstraint; // public String typeName; // Name of the defined type public final String BUILTINTYPE = "SEQUENCE OF"; { type = "SEQUENCE OF"; tagUniv = new Tag( Tag.TAG_VALUE_SEQUENCE_OF ); } /** * */ public ASNSequenceOf() { super( "" ); } /** * @param name * @param tag * @param optional */ public ASNSequenceOf( String name, Tag tag, boolean optional ) { super( name, tag, optional ); } /* * (non-Javadoc) * @see com.connectiva.gpf.datadef.asn.media.ASNConstructed#checkCompleteness() */ @Override public boolean checkCompleteness() { return true; } /* * (non-Javadoc) * @see com.connectiva.gpf.datadef.asn.media.ASNConstructed#decide() */ @Override public ASNType decide( Tag aTag ) { return (ASNType) childByIndex( 0 ); } @Override public void reset() { } }
d877e9d9d5022db89e6fccb3654be8e6c08b451c
be891ed78023bcb6ba9fcfb40960f3b89b0b8406
/java_Collections/src/collections_Class/Collections_class.java
4a89f3ad2df7e36a65b1d01e2fc534fc64d0064d
[]
no_license
LakshThilo/Java-Basic
10a99a1102a9b01fc2d98c820e5b32f608a71198
7810c9d3fe029dd93c6c21f77d656bf1dc3b8d1d
refs/heads/master
2023-02-26T14:32:25.711352
2021-02-09T22:00:25
2021-02-09T22:00:25
337,547,929
0
0
null
null
null
null
UTF-8
Java
false
false
3,345
java
package collections_Class; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.PriorityQueue; import java.util.Queue; import java.util.Set; import java.util.Vector; public class Collections_class { public static void main(String[] args) { List<String> collections = new ArrayList<String>(); System.out.println(); System.out.println( "Add all data to list using Collections Class in java.util.collections and have use AddAll method in Collections class"); // Add all data to list using Collections Class in java.util.collections // and have use AddAll method in Collections class Collections.addAll(collections, "ArrayList", "LinkedList", "Vector", "Stack", "HashSet", "LinkedHashSet", "TeeSet", "LinkedList", "PrirityQueue", "BlockingQueue", "BlockingPriorityQueue"); // 1. Lambda expression in first ways System.out.println("\nMethod Reference in first ways"); collections.forEach(System.out::println); // Print out the normal list of data System.out.println("\nPrint out the normal list of data \n" + collections); System.out.println(); // Shot the data using sort method in Collection class Collections.sort(collections); // 2. Second way of printing out the data using Lambda expression System.out.println( "Sorting the list using Collections sort method and print using Lamda expression in second way List---------->"); collections.forEach(item -> System.out.println(item)); // Adding another data(Map) to the List collections.add("Map"); System.out.println(); // After adding data print out the list collections.forEach(item -> System.out.println(item)); // print out the natural List as it is System.out.println("\nprint out the natural List as it is\n" + collections); System.out.println("\nUsing Binary search Value is in : " + Collections.binarySearch(collections, "HashSet") + "rd index in the list\n"); List<String> allList = null; try { // allList = Arrays.asList("12","23"); Collections.copy(allList, collections); } catch (NullPointerException e) { // e.printStackTrace(); e.getMessage(); } catch (IndexOutOfBoundsException e) { // e.printStackTrace(); e.getMessage(); } finally { System.out.println("Strat final block"); allList.forEach(item -> System.out.println(item)); System.out.println("Printing out the newly created array:" + allList); System.out.println("Finished final block"); } System.out.println("\nOutside the finall block\n"); List<String> list = new Vector<String>(); Collections.addAll(list, "ArrayList", "LinedList", "Vector", "Stack"); list.forEach(System.out::println); System.out.println(); Set<String> set = new HashSet<String>(); Collections.addAll(set, "HashSet", "LinkedHashSet", "TreeSet"); System.out.println("First way to use For-Each-------------->"); set.forEach(System.out::println); System.out.println(); System.out.println("Second way to use For-Each-------------->"); set.forEach(item -> System.out.println(item)); System.out.println(); Queue<String> queue = new PriorityQueue<String>(); Collections.addAll(queue, "LinkedList", "PriorityQueue", "BlockingQueue", "ProrityBlockingQueue"); // queue.forEach(System.out::println); // System.out.println(); } }
0e2bf5b1fcbcce346b9c468dea507409b63bdacb
aa874fa4d65be3bf1620b437fb8b841e8833e2ab
/RoboGuice/src/it/apogeo/sushi/roboguice/dependency/annotation/ConstructorInjection.java
465f4683f2db5c67e98de9109dac555e3bb9ea3c
[]
no_license
massimocarli/sushi_roboguice
6ad6f38061c2b0c405376278310a029ea145d310
5e92dd9c4dc781eb15e65a6def0af187109a8687
refs/heads/master
2021-01-10T07:22:36.620751
2013-02-27T11:55:42
2013-02-27T11:55:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package it.apogeo.sushi.roboguice.dependency.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * This annotation describe the possibility to make a constructor injection into * a class * * @author Massimo Carli - 21/ago/2012 * */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.CONSTRUCTOR) @CustomInjection public @interface ConstructorInjection { // Optional description for the annotation String description() default "no-description"; // Mandatory value for the implementation Class<?> value(); }
cbc95514826ad059be5b7b1a73a4b127eb39bee7
c797e7495a0f34fe3fae8f62d87a9451a208974e
/src/main/java/springmongo/mongocrud/exceptions/ResourceNotFoundException.java
70ca18c0faa39ed84d71e946aeb716aff034a2d8
[]
no_license
Anusha-GitH/SpringDataMongo
62e33b0ec77ecb50ec651f6a49fdebc29c28b757
fb5dd2784d879044aa50d039ce4242ffb91cc126
refs/heads/master
2022-11-22T23:03:39.955643
2020-07-09T21:47:09
2020-07-09T21:47:09
278,415,870
0
0
null
null
null
null
UTF-8
Java
false
false
395
java
package springmongo.mongocrud.exceptions; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.NOT_FOUND) public class ResourceNotFoundException extends Exception{ private static final long serialVersionUID = 1L; public ResourceNotFoundException(String message){ super(message); } }
745fc5337770c2aa3e54ace5fdf9eb026cc4338b
380dba555f2bb2e35e7a7a810c45bf3209fb78f8
/src/main/java/br/espm/invest/wallet/StocksTransactionService.java
b6a5c5bb6188f5ec02b8048682c64b6b20f2a151
[]
no_license
pooEx2/espm.invest.wallet
da769a2781a6089595f1f9a4b6c4ab0f17d153b7
112438fe959168337febf63d97af697f620d6763
refs/heads/main
2023-06-02T03:13:31.396709
2021-06-16T23:05:49
2021-06-16T23:05:49
374,505,999
0
0
null
null
null
null
UTF-8
Java
false
false
3,447
java
package br.espm.invest.wallet; import br.espm.poo1.stocks.common.controller.StocksController; import br.espm.poo1.stocks.common.datatype.Price; import br.espm.poo1.stocks.common.datatype.Stocks; import org.springframework.beans.factory.annotation.Autowired; import br.espm.invest.wallet.common.datatype.StocksTransaction; import br.espm.invest.wallet.common.datatype.TransactionBean; import br.espm.invest.wallet.common.datatype.TransactionType; import br.espm.invest.wallet.common.datatype.Wallet; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; public class StocksTransactionService { private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); @Autowired private StocksController stocksController; @Autowired private WalletService walletService; public List<StocksTransaction> listByWallet(String idWallet) { List<StocksTransaction> l = stocksTransactionRepository .listByWallet(idWallet).stream() .map(StocksTransactionModel::to) .collect(Collectors.toList()); return l; } public StocksTransaction buy(String idWallet, TransactionBean bean) { Wallet w = walletService.findBy(idWallet); if (w == null) { throw new RuntimeException("Wallet does not exist: " + idWallet); } Date now = new Date(); Stocks stocks = stocksController.stocks(bean.getSymbol()); if (stocks == null) { throw new RuntimeException("Stock does not exist: " + bean.getSymbol()); } Price price = stocksController.price(bean.getId()); if (price == null) { throw new RuntimeException("Price does not exist"); } StocksTransaction et = new StocksTransaction(); et.setId(UUID.randomUUID().toString()); et.setWallet(w); et.setStocks(stocks); et.setType(TransactionType.BUY); et.setAmount(bean.getAmount()); et.setDate(now); return stocksTransactionRepository.save(new StocksTransactionModel(et)).to(); } public StocksTransaction sell(String idWallet, TransactionBean bean) { Wallet w = walletService.findBy(idWallet); if (w == null) { throw new RuntimeException("Wallet does not exist: " + idWallet); } Date now = new Date(); Stocks stocks = stocksController.stocks(bean.getSymbol()); if (stocks == null) { throw new RuntimeException("Stock does not exist: " + bean.getSymbol()); } Price price = stocksController.price(bean.getId()); if (price == null) { throw new RuntimeException("Price does not exist"); } if(bean.getLimit() > 0 && bean.getLimit() - price.getValue() > 0) { throw new RuntimeException("Quotation limit, current: " + price.getValue()); } StocksTransaction et = new StocksTransaction(); et.setId(UUID.randomUUID().toString()); et.setWallet(w); et.setStocks(stocks); et.setType(TransactionType.BUY); et.setAmount(bean.getAmount()); et.setDate(now); return stocksTransactionRepository.save(new StocksTransactionModel(et)).to(); } }
62f9f9a017f87a53df9c283e947a826810a284ce
ebee873f9156c49b853b4a66204b7d2743ceb269
/src/main/java/tn/esprit/DAO/SalleDAO.java
2f9dfa0798b1bd138f21473f6ff469cf0a47133e
[]
no_license
Wissemkhass/LeadMyPath
c99768f4a499adaa22b2f0bd26e49dbe1b46e431
81395da51ec66402bcf9a071ecb128e154e22a25
refs/heads/main
2023-01-15T14:21:46.631746
2020-11-24T13:50:51
2020-11-24T13:50:51
315,646,030
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package tn.esprit.DAO; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import tn.esprit.entity.Salle; @Repository public interface SalleDAO extends JpaRepository<Salle,Integer> { }