id
stringlengths
36
36
text
stringlengths
1
1.25M
3efd2981-b6ef-49d9-83a1-ccb6791ca7ee
public String getLastName() { return lastName; }
8f324e1a-4560-457d-ac40-3d7d90400461
public void setLastName(String lastName) { this.lastName = lastName; }
60fa1861-359f-46ba-b137-2e1939c9206b
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); result = prime * result + ((groups == null) ? 0 : groups.has...
d63cc03e-8968-414c-a4ae-5cad4e835b09
@Override public boolean equals(Object obj) { if ( this == obj ) return true; if ( obj == null ) return false; if ( getClass() != obj.getClass() ) return false; UserInfo other = (UserInfo) obj; if ( email == null ) { if ( other....
1d61ea1f-442f-49b6-b3dd-58458b550377
@Override public String toString() { return "UserInfo [id=" + id + ", login=" + login + ", email=" + email + ", password=" + password + ", firstName=" + firstName + ", lastName=" + lastName + ", groups=" + groups + "]"; }
b538260b-f49c-4e16-b719-5d608b7ab612
public Set<UserInfo> getUserInfos() { return userInfos; }
9b6d88b4-6c18-4df2-a445-a6d411deb12d
public void setUserInfos(Set<UserInfo> userInfos) { this.userInfos = userInfos; }
58a2d40a-e7fa-4257-bb0b-fc7f35d5a47c
public int getId() { return id; }
8844f591-3ffa-48eb-bf62-d489e43cc951
public void setId(int id) { this.id = id; }
74dc4c78-3557-427d-baa9-66b2e45e6fa0
public String getName() { return name; }
c5f41535-65a6-4d0e-afbf-6d5bbda6cff9
public void setName(String name) { this.name = name; }
6b3e55fd-06bb-4b3e-bfee-73747981b401
public Set<Permission> getPermissions() { return permissions; }
0bc7e1ec-d401-47e0-9bb7-c7b65e88a1b7
public void setPermissions(Set<Permission> permissions) { this.permissions = permissions; }
7344cae3-9e84-49e8-9690-d55599abe2bd
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((permissions == null) ? 0 : permissions.hashCode()); result = prime * res...
dbc7eed3-c411-4ca8-8701-f97f95f045c0
@Override public boolean equals(Object obj) { if ( this == obj ) return true; if ( obj == null ) return false; if ( getClass() != obj.getClass() ) return false; Group other = (Group) obj; if ( id != other.id ) return false; ...
8bdbd5f8-92ef-40da-b8a4-25d8b3dfb21f
@Override public String toString() { return "Group [id=" + id + ", name=" + name + ", permissions=" + permissions + ", userInfos=" + userInfos + "]"; }
80b8731a-b402-4f71-b51e-71c8c47b9bf9
@RequestMapping("/buy") public String buy(){ System.out.println( "buy something " + new Date() ); System.out.println( "buy something " + new Date() ); return "buy"; }
5aa2bd5a-6843-4b58-b958-18989ebbb8cd
public HttpServletRequest getContext() { return requestHolder.get() ; }
a7956d29-7355-46ef-9027-dcd6c932c1e0
public void setContext(HttpServletRequest context) { requestHolder.set( context ); }
f6edc9e8-505d-47d3-8cb7-eeceecff5b14
public String getUserIPAddress(HttpServletRequest request) { return request.getRemoteAddr(); }
4394b57c-3725-4b6a-a84a-079155d21142
@Override protected void setCookie(String[] tokens, int maxAge, HttpServletRequest request, HttpServletResponse response) { // append the IP adddress to the cookie String[] tokensWithIPAddress = Arrays.copyOf( tokens, tokens.length + 1 ); tokensWithIPAddress[tokensWithIPAddress.length - 1] =...
ca255e3b-91aa-4e70-87ea-8b41cf2c5ac7
@Override protected String makeTokenSignature(long tokenExpiryTime, String username, String password) { return DigestUtils .md5DigestAsHex( (username + ":" + tokenExpiryTime + ":" + password + ":" + getKey() + ":" + getUserIPAddress( getContext() )) .getBytes() ); ...
843f41d0-97ef-4d3d-967d-74e18bc6ec37
@Override protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) { try { setContext( request ); // take off the last token String ipAddressToken = cookieTokens[cookieTokens.length - 1]; ...
03370a46-fa2c-4d7b-87bc-278182e54194
@Override public void onLoginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication successfulAuthentication) { setContext( request ); super.onLoginSuccess( request, response, successfulAuthentication ); setContext( null ); }
bb4064cb-408e-45b1-bc07-196728b15494
@RequestMapping(value="/sayHi",method=RequestMethod.GET) public String sayHi(){ System.out.println( "hello " ); System.out.println( " your are my person !! "); return "index"; }
415bc9bf-0b2f-40f9-b6d8-9f5367f0178b
@RequestMapping(value="/goodBye",method=RequestMethod.GET) public String goodBye(){ System.out.println( "goodBye " ); System.out.println( " your are my person, goodBye !! "); return "logout"; }
e3f8412c-96e5-40c5-b078-f581c4428c1d
@RequestMapping(value="/welcome",method=RequestMethod.GET) public String welcome(){ System.out.println( "welcome " ); System.out.println( " your are my person, welcome !! "); return "welcome"; }
aafffbbe-8a10-4544-b321-5edd546f67cc
@Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return super.loadUserByUsername( username ); }
d99ab103-304b-4886-99a1-283e7897aaf5
@Override protected String getAuthoritiesByUsernameQuery() { return super.getAuthoritiesByUsernameQuery(); }
149dceb8-3c04-474e-a0da-58988285d483
public MyCallableClass(int flag){ this.flag = flag; }
655cb50e-e834-4d2b-9a69-ac3e851a295e
public String call() throws Exception{ if (this.flag == 0){ // 如果flag的值为0,则立即返回 return "flag = 0"; } if (this.flag == 1){ // 如果flag的值为1,做一个无限循环 try { w...
d4d871aa-2b4b-426c-b2d5-9f824871d07f
public static void main(String[] args) { // 定义3个Callable类型的任务 MyCallableClass task1 = new MyCallableClass(0); MyCallableClass task2 = new MyCallableClass(1); MyCallableClass task3 = new MyCallableClass(2); // 创建一个执行任务的服务 ...
11345204-47fa-4767-9755-60633c696b0f
public static void main(String[] args) { String str = "0123456789"; System.out.println( str.substring( 0, 2 )); System.out.println( str.substring( 2, 4 )); }
d035a235-48c3-4f30-a2ff-88a98d45f02d
public static void main(String[] args) { // 核心应用类 HttpClient httpClient = new DefaultHttpClient(); // HTTP请求 HttpUriRequest request = new HttpPost( "http://narutolby.iteye.com/blog/1518464" ); // 打印请求信息 System.out.println( request.getRequestLine() ); try { ...
2f339126-a849-4caf-b63b-df2658557770
public JavaFxParser(Reader reader, MainWindow mainWindow, Stage primaryStage) { this.mainWindow = mainWindow; this.reader = new BufferedReader(reader); this.imagePanel = mainWindow.getImagePanel(); this.label = mainWindow.getLabel(); this.primaryStage = primaryStage; }
b662169a-7b0a-4699-9103-5befc71a0a23
public void parse() { String currentLine = ""; try { String line = reader.readLine(); while (line != null) { currentLine = line; parseLine(line); line = reader.readLine(); } label.setText("Drawing Complete"); } catch (IOException e) { label.setText("IO Exception"); } catch (ParseExc...
25ed45e7-5ef2-4048-b4a4-f7cac9cbe98b
public void singleStepParse() { String parsedLine = ""; try { String line = reader.readLine(); parsedLine = line; if (line != null) { parseLine(line); label.setText("Parsed line: \n" + line); } else { label.setText("Drawing Complete"); } } catch (IOException e) { label.setText("IO Ex...
cbc0783a-7ddd-4d40-8ec3-9e1c52910e41
private void parseLine(String line) throws ParseException { if (line.length() < 2) return; String command = line.substring(0, 2); // Graphic Commands if (command.equals("DL")) { drawLine(line.substring(2, line.length())); return; } if (command.equals("DR")) { drawRect(line.substring(2, line.len...
3b2661d5-2f88-4785-bb2a-43af7db4184b
public void turtlePenDown(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); if (getInteger(tokenizer) == 1) { imagePanel.turtlePenDown(true); } else { imagePanel.turtlePenDown(false); } }
cdf53e57-0cee-4aef-9d6f-7c146bf76ce6
public void turtleForward(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); imagePanel.turtleForward(getInteger(tokenizer)); }
e2e1379a-b107-4b80-81c1-fcfff39a81b5
public void turtleTurnRight(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); imagePanel.turtleTurnRight(getInteger(tokenizer)); }
f7b8e4f6-9043-4cb8-bc12-50200ef66dea
public void turtleTurnLeft(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); imagePanel.turtleTurnLeft(getInteger(tokenizer)); }
fb17edec-fe96-44b1-a746-827539f48db0
public void turtleMode(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); if (getInteger(tokenizer) == 1) { imagePanel.turtleMode(true); } else { imagePanel.turtleMode(false); } }
c0e6e889-229f-4652-9c58-d13a3d084704
public void drawPolygon(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); imagePanel.drawPolygon(getCoordinates(tokenizer)); }
7e166b7f-ca3f-4bf7-af3d-7642b85fa0f4
public void fillPolygon(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); imagePanel.fillPolygon(getCoordinates(tokenizer)); }
b7032d17-d2a4-4751-bcab-473b68be9853
public void setDimension(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); int x = 0; int y = 0; x = getInteger(tokenizer); y = getInteger(tokenizer); mainWindow.setDimension(x, y); primaryStage.setHeight(y * 1.3); primaryStage.setWidth(x); }
1fa1b7e0-86f9-4143-927b-1522e3d82210
public void drawLine(String args) throws ParseException { int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; StringTokenizer tokenizer = new StringTokenizer(args); x1 = getInteger(tokenizer); y1 = getInteger(tokenizer); x2 = getInteger(tokenizer); y2 = getInteger(tokenizer); imagePanel.drawLine(x1, y...
7c585774-3725-4b5d-a288-5a2400a7df38
public void drawRect(String args) throws ParseException { int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; StringTokenizer tokenizer = new StringTokenizer(args); x1 = getInteger(tokenizer); y1 = getInteger(tokenizer); x2 = getInteger(tokenizer); y2 = getInteger(tokenizer); imagePanel.drawRect(x1, y...
2f009cb4-418d-41a2-aa7e-ce27086ceead
public void fillRect(String args) throws ParseException { int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; StringTokenizer tokenizer = new StringTokenizer(args); x1 = getInteger(tokenizer); y1 = getInteger(tokenizer); x2 = getInteger(tokenizer); y2 = getInteger(tokenizer); imagePanel.fillRect(x1, y...
229dc8ba-ab9f-42e5-848c-37966a5fc11e
public void drawArc(String args) throws ParseException { int centerX = 0; int centerY = 0; int radiusX = 0; int radiusY = 0; int startAngle = 0; int length = 0; StringTokenizer tokenizer = new StringTokenizer(args); centerX = getInteger(tokenizer); centerY = getInteger(tokenizer); radiusX = getInte...
ef19f6f3-4e90-4285-8d07-aad56df1a47d
public void drawOval(String args) throws ParseException { int centerX = 0; int centerY = 0; int radiusX = 0; int radiusY = 0; StringTokenizer tokenizer = new StringTokenizer(args); centerX = getInteger(tokenizer); centerY = getInteger(tokenizer); radiusX = getInteger(tokenizer); radiusY = getInteger...
f641c03b-e2c5-4ae2-b31b-483ffabdcbdb
public void drawString(String args) throws ParseException { int x = 0; int y = 0; String s = ""; StringTokenizer tokenizer = new StringTokenizer(args); x = getInteger(tokenizer); y = getInteger(tokenizer); s = s.concat(getStrings(tokenizer)); imagePanel.drawString(x, y, s); }
9f355815-4ae8-4033-9cef-a7cbf061e5e6
public void drawImage(String args) throws ParseException { int x = 0; int y = 0; int width = 0; int height = 0; String fileName = ""; StringTokenizer tokenizer = new StringTokenizer(args); x = getInteger(tokenizer); y = getInteger(tokenizer); width = getInteger(tokenizer); height = getInteger(tok...
0a9afcd7-09d0-4e32-84c7-fd97c77b281b
public void setColour(String colourName) throws ParseException { imagePanel.setColor(getColor(colourName)); return; }
7a4bf2e6-cadd-4076-8d2a-258aa3bbaa9a
public void setGradient(String args) throws ParseException { StringTokenizer tokenizer = new StringTokenizer(args); List<Color> colours = new ArrayList<Color>(); while (tokenizer.hasMoreElements()) { colours.add(getColor(getString(tokenizer))); } imagePanel.setGradient(colours); }
d929af8b-8928-408a-85e1-c757c24dea30
public int getInteger(StringTokenizer tokenizer) throws ParseException { if (tokenizer.hasMoreElements()) { return Integer.parseInt(tokenizer.nextToken()); } else { label.setText("Missing Integer value"); throw new ParseException("Missing Integer value"); } }
e6e74ecd-ce90-4bf1-955c-849890524d7e
public String getString(StringTokenizer tokenizer) throws ParseException { String s = ""; if (tokenizer.hasMoreElements()) { s = tokenizer.nextToken(); return s; } else { throw new ParseException("Missing String value"); } }
b62a8ac7-4e04-4a06-b2ad-6b5227d0ba42
public String getStrings(StringTokenizer tokenizer) throws ParseException { String s = ""; if (tokenizer.hasMoreElements()) { while (tokenizer.hasMoreElements()) { s = s.concat(" " + getString(tokenizer)); } return s; } else { throw new ParseException("Missing String value"); } }
f9a24e1c-f248-4a43-bd02-2a76728aabb0
public Color getColor(String colourName) throws ParseException { if (colourName.equals("black")) { return Color.BLACK; } if (colourName.equals("blue")) { return Color.BLUE; } if (colourName.equals("cyan")) { return Color.CYAN; } if (colourName.equals("darkgrey")) { return Color.DARKGREY; } ...
cd246eb3-eb88-4e09-936c-e73ece6ec3fe
public double[] getCoordinates(StringTokenizer tokenizer) throws ParseException { List<Double> coordinates = new ArrayList<Double>(); while (tokenizer.hasMoreElements()) { coordinates.add((double) getInteger(tokenizer)); } // Throw exception if missing coordinate. if (coordinates.size() % 2 == 0) { ...
a32b49ef-1113-4c55-a522-d65471c8abb1
public ParseException() { super("Exception during parsing"); }
7991b705-eaef-46fe-b9bc-277a7f6dff0a
public ParseException(String message) { super(message); }
ba2daa49-5d40-4a30-909b-59d61aac4b0e
public ParseException(Label label, String message) { super(message); label.setText(message); }
7696099e-179b-4a06-9e73-ceb020b1ed04
public Turtle(double x, double y) { turtle = new Polygon(new double[] { 0, 0, -6, -4, -4, 0, -6, 4 }); turtle.setFill(Color.BLACK); getChildren().add(turtle); // turtle.getTransforms().add(new Translate(x, y)); turtle.setTranslateX(x); turtle.setTranslateY(y); // Set its initial coordinates and angle...
54e9a100-4b30-4c83-97c8-2207b1b8c07c
public void forward(double pixel) { double oldx = getX(); double oldy = getY(); x += pixel * Math.cos(Math.toRadians(angle)); y += pixel * Math.sin(Math.toRadians(angle)); // for pen up/down if (penDown) { Line l = new Line(oldx, oldy, x, y); getChildren().add(l); } turtle.setTranslateX(x); ...
a02f0123-ae8b-45c6-84aa-6ea1594785c3
public void turnLeft(double dAngle) { angle -= dAngle; Rotate r = new Rotate(-dAngle); turtle.getTransforms().add(r); }
7cf41f96-8512-4ebc-9a5f-b323b83ce3d9
public void turnRight(double dAngle) { angle += dAngle; Rotate r = new Rotate(dAngle); turtle.getTransforms().add(r); }
edb7d4bf-580e-4897-bfa7-915c5617ce51
public void setPenDown(boolean down) { penDown = down; }
99372d15-391e-4d05-befc-9e8edca45239
public double getY() { return y; }
e681f756-952a-4539-941b-b7d695b24952
public void setY(double y) { this.y = y; }
ccdad24e-e330-4321-84c2-f7b33ee1157d
public double getX() { return x; }
a6316d8e-2933-427e-baa7-db7afa52bb58
public void setX(double x) { this.x = x; }
fece87c0-6545-414d-8995-1f722e86eb5c
private void init(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root); primaryStage.setResizable(true); primaryStage.setScene(scene); primaryStage.setTitle("Draw App"); final MainWindow mainWindow = new MainWindow(); root.getChildren().add(mainWindow); Reader reader; if (T...
58f2de55-08be-4924-9777-da22791563ba
@Override public void handle(ActionEvent arg0) { parser.singleStepParse(); }
cf2a2f08-c3ea-47af-b3a4-dbf6b36a9f77
@Override public void handle(ActionEvent arg0) { parser.parse(); }
ce588e3b-7bf1-4b9f-ae7a-0a46f89e41a1
@Override public void handle(ActionEvent arg0) { int width = (int) mainWindow.getImagePanel().getWidth(); int height = (int) mainWindow.getImagePanel() .getHeight(); WritableImage writableImage = new WritableImage(width, height); Image image = mainWindow.getImagePanel().sn...
14cd1fb9-fac1-43f3-ac8f-c099346671f5
public static void main(String[] args) { launch(); }
203dfa61-3149-4286-a341-7ae82cd26a5a
@Override public void start(Stage primaryStage) throws Exception { init(primaryStage); primaryStage.show(); }
1a91a1e4-beea-443d-ae08-59f1b5706b2e
public MainWindow() { this(DEFAULT_WIDTH, DEFAULT_HEIGHT); }
bc091f15-38eb-4cdb-ae14-e29ee98df101
public MainWindow(double width, double height) { imagePanel = new ImagePanel(width, height); ScrollPane sp = new ScrollPane(); sp.setPrefSize(width / 2, height / 2); label = new Label(); sp.setContent(label); label.setPrefSize(width, height / 2); buttonBox = new HBox(); buttonBox.getChildren().add( ...
8bf57fd0-8c26-4f77-8177-d347106b8df5
@Override public void handle(ActionEvent arg0) { Platform.exit(); }
466d03b1-d14b-4f56-8d6f-a041895ff446
private void buildGUI() { getChildren().add(imagePanel); label.setStyle("-fx-padding: 10px; -fx-border-color: grey; -fx-background-color: white;"); label.setAlignment(Pos.TOP_LEFT); getChildren().add(label); buttonBox.setAlignment(Pos.CENTER); buttonBox.setStyle("-fx-background-color: white;"); getChil...
7d8ab1b3-b6df-4822-a711-3b0aa38385b0
public ImagePanel getImagePanel() { return imagePanel; }
b9e4c8ec-eac6-4c9e-9af9-a3e6e84547d1
public Label getLabel() { return label; }
eb31fab6-fc69-4f10-965a-5686175ee0a1
public Button getNextStepButton() { return nextStep; }
9284f8f7-adb5-49a8-a80c-ca0b0dc72d5e
public Button getCompleteButton() { return complete; }
a5b038ce-c6ec-4c03-a8ff-77e7432972a4
public Button getSnapshotButton() { return snapshot; }
640d25f3-5273-4ba7-8a2e-7430ca196d0f
public void setDimension(double width, double height) { imagePanel.setDimension(width, height); label.setPrefSize(width, height / 2); }
13ef8848-e0b2-4390-ba2a-9c932549d231
public ImagePanel(double height, double width) { currentColor = DEFAULT_COLOR; setPrefSize(height, width); setMaxSize(height, width); getChildren().add(root); }
89159293-c192-4128-9f27-76ea03e4e6de
public void drawLine(double x1, double y1, double x2, double y2) { Line line = new Line(x1, y1, x2, y2); line.setStroke(currentColor); root.getChildren().add(line); }
5318f2e2-75f8-4d39-95c2-d31261341fcd
public void drawRect(double x1, double y1, double x2, double y2) { Rectangle rect = new Rectangle(x1, y1, x2, y2); rect.setFill(null); rect.setStroke(currentColor); root.getChildren().add(rect); }
79ec1e9e-dd31-4b6c-bdd5-07e81fa7f43d
public void fillRect(double x1, double y1, double x2, double y2) { Rectangle rect = new Rectangle(x1, y1, x2, y2); rect.setFill(currentColor); rect.setStroke(currentColor); root.getChildren().add(rect); }
993096e1-a11c-4c1d-8a19-6ddf5b8ebd8d
public void drawArc(double centerX, double centerY, double radiusX, double radiusY, double startAngle, double length) { Arc arc = new Arc(centerX, centerY, radiusX, radiusY, startAngle, length); arc.setFill(null); arc.setStroke(currentColor); root.getChildren().add(arc); }
b7a40817-899e-47d0-8f21-8ae54ab575b9
public void drawOval(double centerX, double centerY, double radiusX, double radiusY) { Ellipse oval = new Ellipse(centerX, centerY, radiusX, radiusY); oval.setFill(null); oval.setStroke(currentColor); root.getChildren().add(oval); }
c3a2d5d5-be5d-4687-8714-1998d54f0c4d
public void drawString(double centerX, double centerY, String s) { Text text = new Text(centerX, centerY, s); text.setFill(currentColor); text.setStroke(currentColor); root.getChildren().add(text); }
e6d12cae-72be-4877-8089-279bf8518db8
public void drawImage(double x, double y, double width, double height, String fileName) { File file = new File(fileName); ImageView image = new ImageView(file.toURI().toString()); image.setX(x); image.setY(y); image.setFitWidth(width); image.setFitHeight(height); root.getChildren().add(image); }
325407f6-8ad4-4af2-824e-b728b8e356da
public void setColor(Color color) { currentColor = color; }
4f635e32-cacd-4ff0-9d9e-1f0aa4e338e2
public void setGradient(List<Color> colours) { Stop[] stops = new Stop[colours.size()]; double proportion = (double) 1 / colours.size(); System.out.println("Proportion: " + proportion); for (int i = 0; i < colours.size(); i++) { if (i != 0) { stops[i] = new Stop((i + 1) * proportion, colours.get(i)); ...
373b2536-7836-402c-8b3f-3832fb1d43a3
public void setDimension(double width, double height) { setPrefSize(width, height); }
771f3d7b-c986-4337-b213-99ce17d1bf39
public void drawPolygon(double[] coordinates) { Polygon polygon = new Polygon(coordinates); polygon.setFill(null); polygon.setStroke(currentColor); root.getChildren().add(polygon); }