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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a78958585a900c31664cddf8510182c44b3733e1 | afd8912ee5c66a64fe561f1b1f81dc0848e3acce | /src/main/java/cts/model/StudentIdentity.java | 8d9b72700090e5476774a614042fde12d957554c | [] | no_license | pcbuilderayush/hibernate | 05c3ccb5f252d971e61a09a60f5237b52cba9e11 | d2413402975031fdf72a46991f5aa7a130070ef5 | refs/heads/master | 2022-06-22T13:30:09.238706 | 2020-02-27T11:35:38 | 2020-02-27T11:35:38 | 238,181,710 | 0 | 0 | null | 2022-06-21T02:52:28 | 2020-02-04T10:40:18 | Java | UTF-8 | Java | false | false | 863 | java | package cts.model;
import java.io.Serializable;
public class StudentIdentity implements Serializable{
private static final long serialVersionUID = 1L;
private int rollNumber;
private char section;
private int clazz;
public StudentIdentity() {
}
public StudentIdentity(int rollNumber, char section, int clazz) {
super();
this.rollNumber = rollNumber;
this.section = section;
this.clazz = clazz;
}
public int getRollNumber() {
return rollNumber;
}
public void setRollNumber(int rollNumber) {
this.rollNumber = rollNumber;
}
public char getSection() {
return section;
}
public void setSection(char section) {
this.section = section;
}
public int getClazz() {
return clazz;
}
public void setClazz(int clazz) {
this.clazz = clazz;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
| [
"[email protected]"
] | |
6cf8ab3e38eec3f6b5c3dd43aa5ba852b77298bc | 918509a2ad82499571986ef439274db7c5fe8cb5 | /src/main/java/com/heimao/wuye/controller/UserController.java | d544e459f7afc835327eee0dbb4099ec59775e6e | [] | no_license | feichaochao/springboot-simple | 788ab3c15d1ff18bbf877e1ac2e52ec885ad5097 | b3761e7cc3ec38bcfc3de729eb4a906d03fab71a | refs/heads/master | 2021-07-22T05:24:20.509164 | 2017-11-01T06:44:25 | 2017-11-01T06:44:25 | 105,117,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,146 | java | package com.heimao.wuye.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.heimao.wuye.entity.UserEntity;
import com.heimao.wuye.result.ErrorInfoInterface;
import com.heimao.wuye.result.GlobalErrorInfoException;
import com.heimao.wuye.result.ResultBody;
import com.heimao.wuye.result.exception.UserErrorInfoEnum;
import com.heimao.wuye.service.UserService;
/**
*
* @author wuyeheimao
* @time 2017年9月27日 下午1:08:29
*/
@RestController
public class UserController {
private static final Logger logger = LoggerFactory.getLogger( UserController.class);
@Autowired
private UserService userService;
@RequestMapping(value="/getUsers", method=RequestMethod.GET)
public ResultBody<List<UserEntity>> getUsers() {
List<UserEntity> users=userService.getAll();
return new ResultBody<>(users);
}
@RequestMapping(value="/getUser", method=RequestMethod.GET)
public ResultBody<UserEntity> getUser(Long id) {
if(id == null){
throw new GlobalErrorInfoException(UserErrorInfoEnum.PARAMS_NO_COMPLETE);
}
UserEntity user=userService.find(id);
return new ResultBody<>(user);
}
@RequestMapping(value="/add", method=RequestMethod.POST)
public ResultBody<Long> save(UserEntity user) {
logger.info("add");
userService.insert(user);
return new ResultBody<>(user.getId());
}
@RequestMapping(value="update", method=RequestMethod.POST)
public ResultBody<Long> update(UserEntity user) {
userService.update(user);
return new ResultBody<>(user.getId());
}
@RequestMapping(value="/delete/{id}", method=RequestMethod.DELETE)
public ResultBody<Long> delete(@PathVariable("id") Long id) {
userService.delete(id);
return new ResultBody<>(id);
}
} | [
"[email protected]"
] | |
3fb81d69ea118d31679a10f626a4bdf2d46e0ce9 | 152c3182014590dece2c1d7ea1a9e8f5d3ad86c5 | /jpa.spec/src/io/github/jeddict/jpa/spec/extend/AttributeSnippetLocationType.java | abf6dd6a5f3ecd3d566a2bac1c3b65d1d91616e1 | [
"Apache-2.0"
] | permissive | hendrickhan/jeddict | 07782f6e01d173619492a97599cba13caf0f27d5 | 120738750f4f99be4288399232d7ad4d2481ff4f | refs/heads/master | 2020-03-19T00:27:37.150808 | 2018-05-14T13:48:23 | 2018-05-14T13:48:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,363 | java | /**
* Copyright 2013-2018 the original author or authors from the Jeddict project (https://jeddict.github.io/).
*
* 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.github.jeddict.jpa.spec.extend;
public enum AttributeSnippetLocationType implements SnippetLocation {
BEFORE_FIELD("Before Field"), AFTER_FIELD("After Field"),
BEFORE_METHOD("Before Method"), AFTER_METHOD("After Method"),
PRE_GETTER("Pre Getter"), GETTER("Getter"),
PRE_SETTER("Pre Setter"), SETTER("Setter"), POST_SETTER("Post Setter"),
PRE_FLUENT("Pre Fluent"), FLUENT("Fluent"),
IMPORT("Import");
private final String title;
private AttributeSnippetLocationType(String title) {
this.title = title;
}
@Override
public String getTitle() {
return title;
}
}
| [
"[email protected]"
] | |
67fdd5a768a14d3d15468a4691de14d2ee1a11d2 | f22016e5670e437bd7c1338f28aedfe7871580f9 | /axl/src/main/java/ru/cg/cda/axl/generated/XDigitDiscardInstructionMember.java | 47c1efbd3c80ad5356e8309d0f6e04c55c9d5a24 | [] | no_license | ilgiz-badamshin/cda | 4e3c75407a0b2edbb7321b83b66e4cf455157eae | 0a16d90fc9be74932ef3df682013b444d425741e | refs/heads/master | 2020-05-17T05:34:17.707445 | 2015-12-18T13:38:49 | 2015-12-18T13:38:49 | 39,076,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,495 | java |
package ru.cg.cda.axl.generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for XDigitDiscardInstructionMember complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="XDigitDiscardInstructionMember">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <element name="dialPlanTagName" type="{http://www.cisco.com/AXL/API/10.0}XFkType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "XDigitDiscardInstructionMember", propOrder = {
"dialPlanTagName"
})
public class XDigitDiscardInstructionMember {
protected XFkType dialPlanTagName;
/**
* Gets the value of the dialPlanTagName property.
*
* @return
* possible object is
* {@link XFkType }
*
*/
public XFkType getDialPlanTagName() {
return dialPlanTagName;
}
/**
* Sets the value of the dialPlanTagName property.
*
* @param value
* allowed object is
* {@link XFkType }
*
*/
public void setDialPlanTagName(XFkType value) {
this.dialPlanTagName = value;
}
}
| [
"[email protected]"
] | |
df77b3d0ec7230010fa576a115f2ffcc0a88df7a | 0d5d11017ddc651df66f7b9b755d5aeb2cc94d3c | /app/src/main/java/com/szagurskii/githubsearch/realm/modules/GitHubModule.java | dd521ebce6ce90986c745b6b884d2af0dc19c1d6 | [] | no_license | zsavely/githubsearch | e9c928f973ef48e22a198df54ba5c3bf1566cff0 | 158415c5fff809e86fbb69fba147a734cb9199ea | refs/heads/master | 2016-09-06T05:10:30.623813 | 2015-09-16T15:38:21 | 2015-09-16T15:38:21 | 42,592,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package com.szagurskii.githubsearch.realm.modules;
import io.realm.annotations.RealmModule;
/**
* @author Savelii Zagurskii
*/
@RealmModule(allClasses = true)
public class GitHubModule {
} | [
"[email protected]"
] | |
f45569c3d7d8ca649c2710789187304c8d7af9bd | d219df459b11828d5cafcb991902998b3e8d5a62 | /20201102/TestDemo07.java | 77cd243a95b4ebadb9d425c4d6c6e726018613cb | [] | no_license | xwq526/Test-succeeded | 82ea9e9eacc57044d1614b91812524508accef28 | 8e8448327dee7189d93799be26f6f4a9234c4593 | refs/heads/master | 2023-03-12T11:52:52.581641 | 2021-02-24T15:50:43 | 2021-02-24T15:50:43 | 303,995,029 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,380 | java | package test20201102;
//实现 ArraysList 类
class MyArrayList <T> {
public T[] elem;
public int usedSize;
public MyArrayList() {
this.elem = (T[]) new Object[10];
}
public int getUsedSize() {
return usedSize;
}
public void setUsedSize(int usedSize) {
this.usedSize = usedSize;
}
//尾插法
public void lastAdd(T data) {
if (this.usedSize == this.elem.length) {
System.out.println("顺序表已经满了");
return;
}
this.elem[this.usedSize++] = data;
}
//打印顺序表
public void display() {
for (int i = 0; i < usedSize; i++) {
System.out.print(this.elem[i] + " ");
}
System.out.println();
}
//在pos位置新增元素
public void add(int pos ,T data) {
if (pos < 0 || pos > this.usedSize) {
System.out.println("位置不合法");
return;
}
if (this.usedSize == elem.length) {
System.out.println("顺序表已经满了");
}
for (int i = this.usedSize-1; i >= pos; i--) {
this.elem[i+1] = this.elem[i];
}
this.elem[pos] = data;
this.usedSize++;
}
//判断是否包含某个元素
public boolean contains(T data) {
for (int i = 0; i < this.usedSize; i++) {
if (this.elem[i] == data) {
return true;
}
}
return false;
}
//查找某个元素的位置
public int search(T data) {
for (int i = 0; i < this.usedSize; i++) {
if (this.elem[i] == data) {
return i;
}
}
return -1;
}
//获得pos的位置的元素
public T getPos(int pos) throws ArrayIndexOutOfBoundsException {
if (pos < 0 || pos >this.usedSize) {
throw new ArrayIndexOutOfBoundsException("pos的位置不合法");
}
return this.elem[pos];
}
//给pos位置的元素设置为value
public void setPos(int pos , T value) {
if (pos < 0 || pos >this.usedSize) {
throw new ArrayIndexOutOfBoundsException("pos的位置不合法");
}
this.elem[pos] = value;
}
//删除第一次出现的关键字key
public void remove(T toRemove) {
int index = search(toRemove);
if (index == -1) {
System.out.println("没有这个");
return;
}
for (int i = index; i < this.usedSize-1; i++) {
this.elem[i] = this.elem[i+1];
}
this.usedSize--;
}
//获取顺序表的长度
public int size() {
return this.usedSize;
}
public void clear() {
for (int i = 0; i < this.usedSize; i++) {
elem[i] = null;
}
this.usedSize = 0;
}
}
public class TestDemo07 {
public static void main(String[] args) {
MyArrayList<Integer> list = new MyArrayList<>();
list.lastAdd(1);
list.lastAdd(2);
list.lastAdd(3);
list.lastAdd(4);
list.lastAdd(5);
list.lastAdd(6);
list.add(2,89);
// System.out.println(list.getPos(56));
list.display();
list.clear();
System.out.println("===============");
list.display();
System.out.println(list.getUsedSize());
}
}
| [
"[email protected]"
] | |
f916f81f78c4ee8a7d824ab7b1d72548b4cf694c | 7913cc2439c51f22045c8da56e90bd255d28b4e5 | /src/main/java/servlets/ExcluirAreaServlet.java | 01f4c80240fd0dcc946e4da12d16b0fa36941a17 | [] | no_license | alisoncf/academico | a7cdba933cff2fbb9501adb85cda65ce44bda746 | 6709a1065365f2c8552cacb777bbf5c76e86f723 | refs/heads/master | 2023-08-05T14:12:14.934245 | 2021-09-22T00:53:23 | 2021-09-22T00:53:23 | 400,280,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,601 | 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 servlets;
import DAO.AreaDAO;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import model.Area;
/**
*
* @author cgpre
*/
@WebServlet(urlPatterns = "/ExcluirAreaServlet")
public class ExcluirAreaServlet extends HttpServlet {
private String id;
Area area;
private String ExcluirArea() {
try {
new AreaDAO().Excluir(area);
return "Sucesso na operação. Area excluída";
} catch (Exception e) {
return "erro no banco: " + e.getMessage();
}
}
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
this.id=request.getParameter("id");
area = new Area();
area.setId( Integer.parseInt(id) );
try (PrintWriter out = response.getWriter()) {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Excluir Area</title>");
out.println("</head>");
out.println("<body>");
out.println("<form>");
out.println("<h1>Excluindo Area</h1>");
out.println("<p>" + ExcluirArea() + "</p>");
out.println("<input type=\"submit\" formaction=\"ListarAreasServlet\" value=\"voltar\">");
out.println("</form>");
out.println("</body>");
out.println("</html>");
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
1394f61037ddbb30f15dff62cd6dfb1a7e8e1f60 | 01285b3882007eaacd16ff83e7b56e085161e489 | /src/test/java/com/ds/controller/viewer/ResultControllerTest.java | b2854b0bf31a02179173196b1c7c28452ea87f15 | [] | no_license | cvrepos/quizzical | 1aaae098c10218806136da37d3e067c7821f3029 | 49ad20139927f29b225c92d71c8fe031662df5fa | refs/heads/master | 2020-06-08T10:32:22.504845 | 2012-08-20T03:40:43 | 2012-08-20T03:40:43 | 3,645,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package com.ds.controller.viewer;
import org.slim3.tester.ControllerTestCase;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
public class ResultControllerTest extends ControllerTestCase {
@Test
public void run() throws Exception {
tester.start("/viewer/result");
ResultController controller = tester.getController();
assertThat(controller, is(notNullValue()));
assertThat(tester.isRedirect(), is(false));
//assertThat(tester.getDestinationPath(), is("/viewer/result.jsp"));
}
}
| [
"[email protected]"
] | |
6ab49f27a703146d0023a0dd9fec50cd9712145a | 309f17d83a7cd35b4241122d9d06e917d0494131 | /4.5_RecyclerView/RecipesRecyclerView/app/src/androidTest/java/com/shady/recipesrecyclerview/ExampleInstrumentedTest.java | 7d4c542efc347b6b934e33c0111fee128aa21c70 | [] | no_license | imshahidmahmood/Google-Associate-Android-Developer-Practice-Unit-2-User-Experience | ed3b015181dd72f2de693ec6c9edf0e6e354d19d | 6ec9200854a90b28b9ac5627981c20d5c5c80908 | refs/heads/master | 2022-04-24T10:44:05.672931 | 2020-04-24T14:10:17 | 2020-04-24T14:10:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.shady.recipesrecyclerview;
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.shady.recipesrecyclerview", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
c8abe4ac1bb21dbc5f5b86b4bd385d21843de670 | 62ab78237ae1d80eae06e014f0ed2d690354ac8a | /EgeioWap2App/src/test/java/com/example/egeiowap2app/ExampleUnitTest.java | 82dd57eb59ed560623b374779c07cc849d8d3ba2 | [] | no_license | xybean/Wap2App | 706a9f5cd0b45696d819121ee23af634254b6a9f | 68e7accfc69869be085b1539467226fe00f00516 | refs/heads/master | 2021-01-22T08:58:54.846592 | 2017-02-14T09:33:20 | 2017-02-14T09:33:20 | 81,924,245 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package com.example.egeiowap2app;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
dd0a266c5b20a92ee4d6654cd94b5c428faa4381 | 0a8813b5eecb2e6a81b85e0c4b284225145707e5 | /Servlet_html/day15-JDBC/src/domain/account.java | a3b6cc5dccd2bd6b80f13a3885eb9fc221dc5488 | [] | no_license | zhh-3/java_study | 72dff19a58b4beb6ab56a15a860e655fc41b69a6 | 8e9d3fc4878fc037f0c087ea517a9bb520ebe584 | refs/heads/main | 2023-06-25T03:01:52.038247 | 2021-07-16T06:35:10 | 2021-07-16T06:35:10 | 386,516,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 935 | java | package domain;
public class account {
private int id;
private String name;
private int balance;
public account() {
}
public account(int id, String name, int balance) {
this.id = id;
this.name = name;
this.balance = balance;
}
@Override
public String toString() {
return "account{" +
"id=" + id +
", name='" + name + '\'' +
", balance=" + balance +
'}';
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
}
| [
"[email protected]"
] | |
831577ec7b26b143d22db170cac126a0c9ada2c1 | 4e51aedcfbe208b66d683c8e38c9beb126a87cb2 | /src/main/java/com/example/disney/controller/PersonageController.java | 43108cfd31fdf6290eecd1e8221fac51fa7af70c | [] | no_license | Metalzoafull/spring-boot-disney | 710c92654a9c80f32cef1c55832b555f8c83e411 | 07fa700f51f5e68788e769a6da2b2c9b10b2ae05 | refs/heads/main | 2023-06-19T04:13:31.979126 | 2021-07-14T02:23:10 | 2021-07-14T02:23:10 | 381,871,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,972 | java | package com.example.disney.controller;
import com.example.disney.model.Personage;
import com.example.disney.service.api.PersonageServiceAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
@Controller
public class PersonageController {
@Autowired
private PersonageServiceAPI personageServiceAPI;
@GetMapping("characters")
public String listar(Model model) {
model.addAttribute("list", personageServiceAPI.getAll());
return "characters";
}
/*@GetMapping("characters")
public String listar(@RequestParam(name = "name",defaultValue = "none") String name ,Model model) {
if(name == "none"){
model.addAttribute("list", personageServiceAPI.getAll());
}else{
model.addAttribute("list", personageServiceAPI.getAll().stream().filter(p -> p.getName().equals(name)).collect(Collectors.toList()));
}
return "characters";
}*/
@GetMapping(value = "characters", params = "name")
public String listarPorNombre(@RequestParam(name = "name",defaultValue = "none") String name ,Model model) {
model.addAttribute("list", personageServiceAPI.getAll().stream().filter(p -> p.getName().equals(name)).collect(Collectors.toList()));
return "characters";
}
@GetMapping(value = "characters", params = "age")
public String listarPorEdad(@RequestParam(name = "age")Long age, Model model){
model.addAttribute("list", personageServiceAPI.filterAge(age));
return "characters";
}
@GetMapping(value = "characters", params = "movies")
public String listarPorPeliSerie(@RequestParam(name = "movies")Long movies, Model model){
model.addAttribute("list", personageServiceAPI.filterFilmS(movies));
return "characters";
}
@GetMapping("/characters/description/{id}")
public String description(@PathVariable("id") Long id, Model model){
model.addAttribute("personage", personageServiceAPI.get(id));
return "characters/description";
}
@GetMapping("/characters/formCharact")
public String create(Model model){
model.addAttribute("personage", new Personage());
return "characters/formCharact";
}
/*@GetMapping("/characters/{age}")
public String filterAges(@PathVariable("age") int age,Model model){
model.addAttribute("list",personageServiceAPI.filterAge(age));
return "characters";
}*/
@PostMapping("characters/save")
public String save(@Validated Personage personage,Model model,@RequestParam(name = "file")MultipartFile image, RedirectAttributes flash){
if (!image.isEmpty()){
Path directorioImg = Paths.get("src//main//resources//static//img/personage");
String ruta = directorioImg.toFile().getAbsolutePath();
try {
byte[] bytes = image.getBytes();
Path rutaPrimaria = Paths.get(ruta + "//" + image.getOriginalFilename());
Files.write(rutaPrimaria, bytes);
personage.setImage(image.getOriginalFilename());
}catch (Exception e){
e.printStackTrace();
}
personageServiceAPI.save(personage);
flash.addFlashAttribute("success", "imagen subida");
}
return "redirect:/home";
}
//en el parentesis de este get mapping le digo cuando tiene que trabajar, tiene que trabajar cuando algun HTML haga una llamada a "edit" con el id de algun personaje
//cuuando esto pasa el metodo edit le dara al html un personaje, que se buscara con el metedo get y el parametro de ID que vino con el llamado al edit
//estos datos se mostraran por pantalla en en el html que estan en la carpeta "character", dicho HTML se llama formCharact
//este HTML estara encargado de modificar el personage y luego llamara al metodo "save" para guardar dichos cambios
@GetMapping("characters/edit/{id}")
public String edit(@PathVariable("id") Long id, Model model){
model.addAttribute("personage", personageServiceAPI.get(id));
return "characters/formCharact";
}
@GetMapping("characters/delete/{id}")
public String delete(@PathVariable("id") Long id, Model model) {
personageServiceAPI.delete(id);
return "redirect:/characters";
}
}
| [
"[email protected]"
] | |
2deea8bea810f2385752ce5eab2f31145da37d6a | 371534ae1ebb96477bef04f3f315f4509abd0a88 | /central-security-settlement/src/main/java/mp01/examples/messaging/kafka/centralsecuritysettlement/domain/Account.java | 8abcc19fe0cfa42ebecefe86a72298d293fa670b | [] | no_license | fgolzari/microservice-kafka-messaging | 976798c5903bc64545aec273eafb81aece65d25b | f957c241da81df05c7377d529e02b2d30a541e64 | refs/heads/master | 2020-04-28T15:11:23.394087 | 2019-02-27T12:14:09 | 2019-02-27T12:14:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package mp01.examples.messaging.kafka.centralsecuritysettlement.domain;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Account {
private int participantId;
private String ISIN;
private Double amount;
@JsonCreator
public Account(@JsonProperty("participantId") int participantId,
@JsonProperty("ISIN") String ISIN,
@JsonProperty("amount") Double amount) {
this.participantId = participantId;
this.ISIN = ISIN;
this.amount = amount;
}
public int getParticipantId() {
return participantId;
}
public void setParticipantId(int participantId) {
this.participantId = participantId;
}
public String getISIN() {
return ISIN;
}
public void setISIN(String ISIN) {
this.ISIN = ISIN;
}
public Double getAmount() {
return amount;
}
public void setAmount(Double amount) {
this.amount = amount;
}
@Override
public String toString() {
return "Account{" +
"participantId=" + participantId +
", ISIN='" + ISIN + '\'' +
", amount=" + amount +
'}';
}
}
| [
"[email protected]"
] | |
bd04cc2da631ce796d81ee3716c687b4333d1384 | 81da3beaf0a1aedab355b0647a6c8894c6520bbd | /ScreenCaptureSerivce-test/src/me/wtao/service/ScreenCaptureService.java | ff10c129051aa0cb47c97d5ebdbb1d18286c0ff8 | [] | no_license | swwangyang/wyrepository_ScreenCapture | 4c5acd3de950d6e4ad22c089a0bf770adc8e8096 | 2b8d8e898bfe7592c1767c74b8abdee92eadc104 | refs/heads/master | 2020-06-02T06:31:04.879048 | 2014-03-01T02:43:48 | 2014-03-01T02:43:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,391 | java | package me.wtao.service;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.Locale;
import me.wtao.io.ExternalStorage;
import me.wtao.lang.reflect.Reflect;
import me.wtao.utils.Logcat;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
import android.view.WindowManager;
public class ScreenCaptureService extends Service {
private static final Logcat sLogcat = new Logcat();
static {
sLogcat.setOff();
}
private Context mContext;
private Display mDisplay;
private DisplayMetrics mDisplayMetrics;
private Matrix mDisplayMatrix;
private Bitmap mScreenBitmap;
@Override
public void onCreate() {
Log.d(sLogcat.getTag(), "entry, debug mode "
+ (sLogcat.isDebuggable() ? "on" : "off")
+ ", setOn() to see more info, good luck");
mContext = this;
WindowManager manager = (WindowManager) mContext
.getSystemService(Context.WINDOW_SERVICE);
mDisplay = manager.getDefaultDisplay();
mDisplayMetrics = new DisplayMetrics();
mDisplayMatrix = new Matrix();
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
sLogcat.d("exit");
}
@Override
public IBinder onBind(Intent intent) {
return new ScreenCaptureServiceImpl();
}
private class ScreenCaptureServiceImpl extends IScreenCaptureService.Stub {
@Override
public Bitmap takeScreenCapture() throws RemoteException {
sLogcat.d("prepare...");
// Prepare to orient the screenshot correctly
// mDisplay.getRealMetrics(mDisplayMetrics); // requires API JELLY_BEAN_MR1 (level 17)
mDisplay.getMetrics(mDisplayMetrics);
float[] dims = {mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels};
float degrees = getDegreesForRotation(mDisplay.getRotation());
boolean requiresRotation = (degrees > 0);
if (requiresRotation) {
// Get the dimensions of the device in its native orientation
mDisplayMatrix.reset();
mDisplayMatrix.preRotate(-degrees);
mDisplayMatrix.mapPoints(dims);
dims[0] = Math.abs(dims[0]);
dims[1] = Math.abs(dims[1]);
}
sLogcat.d("prepare ok, screencap...");
// Take the screenshot
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
try {
Class<?> CLASS_Surface = Class.forName("android.view.Surface");
if (sLogcat.isDebuggable()) {
Reflect.log(CLASS_Surface);
}
Class<?>[] paramTypes = {int.class, int.class};
Method METHOD_screenshot = CLASS_Surface.getMethod("screenshot", paramTypes);
// it's not null, but bad bitmap :( we need android.permission.READ_FRAME_BUFFER
mScreenBitmap = (Bitmap) METHOD_screenshot.invoke(null, (int) dims[0], (int) dims[1]);
} catch (Exception e) {
sLogcat.e(e);
mScreenBitmap = null;
}
} else {
mScreenBitmap = nativeTakeScreenCapture();
}
sLogcat.d("screencap ", ((mScreenBitmap == null) ? "failed" : "ok"), ", rotate...");
if (mScreenBitmap != null) {
if (requiresRotation) {
// Rotate the screenshot to the current orientation
Bitmap ss = Bitmap.createBitmap(
mDisplayMetrics.widthPixels,
mDisplayMetrics.heightPixels,
Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(ss);
c.translate(ss.getWidth() / 2, ss.getHeight() / 2);
c.rotate(degrees);
c.translate(-dims[0] / 2, -dims[1] / 2);
c.drawBitmap(mScreenBitmap, 0, 0, null);
c.setBitmap(null);
mScreenBitmap = ss;
}
}
sLogcat.d("everything ok, done.");
if(sLogcat.isDebuggable()) {
dumpToSDCard();
}
return mScreenBitmap;
}
}
private float getDegreesForRotation(int value) {
switch (value) {
case Surface.ROTATION_90:
return 360f - 90f;
case Surface.ROTATION_180:
return 360f - 180f;
case Surface.ROTATION_270:
return 360f - 270f;
}
return 0f;
}
/**
* if {@link Logcat#isDebuggable()}, dump bitmap to sdcard for testing
*/
private void dumpToSDCard() {
if(!ExternalStorage.isExternalStorageWritable()) {
return;
}
try {
File dir = ExternalStorage.getExternalStorageDirectory("screencap");
sLogcat.d(dir.getAbsolutePath());
StringBuilder sb = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.CHINA);
Date currentDate = new Date(System.currentTimeMillis());
sb.append(sdf.format(currentDate));
sb.append(".png");
String filename = sb.toString();
sLogcat.d(filename);
FileOutputStream out = new FileOutputStream(new File(dir, filename));
// PNG which is lossless, will ignore the quality setting 85
mScreenBitmap.compress(Bitmap.CompressFormat.PNG, 85, out);
out.close();
} catch (Exception e) {
sLogcat.w(e);
}
}
private native Bitmap nativeTakeScreenCapture();
static {
System.loadLibrary("screencap");
}
}
| [
"[email protected]"
] | |
bca8be74dde064307f1621f9f34941986b7ccfd0 | ecf6afcb27ce01551e2a994c6e4eaf14e577d3e5 | /DS_WorkSpace/Stack/src/com/rakesh/stackusingll/Stack.java | ec8a7991497fba7541c47417e2ec464207835539 | [] | no_license | Artstylein/Office-Workspace | bea58e1a8eba5810b2082122ebfe2f5c45ee445e | b4ac33febe6d203a977be4b15b96fba7c8225272 | refs/heads/master | 2021-07-11T21:49:38.257419 | 2017-10-11T14:05:27 | 2017-10-11T14:05:27 | 106,285,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 107 | java | package com.rakesh.stackusingll;
public class Stack {
public static void main(String[] args) {
}
}
| [
"[email protected]"
] | |
88b3952778327deef5ee4979f0cce0f149c65170 | ccd0892ffabd303a46c2377c11fad307dba17570 | /com.pe-international.sample.repository.jpa.manual/src/com/pe_international/sample/service/CustomerRepositoryImpl.java | e74bc370dfb6502a7bcba3c6eb59cbeab3aad67a | [] | no_license | UniSiegenWiNeMe/GeminiSample | 73ecf5d5447715b02cd1cfb8776f5d3a94da086f | b124ddc7aa945ccacd8fa1733bb7998a090bb0f3 | refs/heads/master | 2020-12-26T04:26:11.225109 | 2013-07-21T11:23:16 | 2013-07-21T11:23:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,942 | java | /*******************************************************************************
* Copyright (c) 2012 PE INTERNATIONAL AG.
* All rights reserved.
*
* Contributors:
* Jan Stamer - initial API and implementation
*******************************************************************************/
package com.pe_international.sample.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import model.account.Customer;
import model.account.jpa.CustomerImpl;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.pe_international.sample.repository.CustomerRepository;
@Repository
public class CustomerRepositoryImpl implements CustomerRepository {
private EntityManager entityManager;
@PersistenceContext
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
@Transactional
public Collection<Customer> findAll() {
TypedQuery<CustomerImpl> q = entityManager.createQuery("SELECT a FROM CustomerImpl a", CustomerImpl.class);
List<CustomerImpl> results = q.getResultList();
List<Customer> as = new ArrayList<Customer>();
for (Customer a : results) {
as.add(a);
}
return as;
}
@Transactional
public void addCustomer(String lastName, String firstName, String address) {
CustomerImpl c = new CustomerImpl(lastName, firstName, address);
entityManager.persist(c);
}
@Override
public Customer createTransient() {
return new CustomerImpl();
}
@Override
@Transactional
public Customer save(Customer customer) {
CustomerImpl customerImpl = (CustomerImpl) customer;
entityManager.persist(customerImpl);
return customerImpl;
}
}
| [
"[email protected]"
] | |
a5c15a1f04ee93cdb252acc5ae9864a67d39f321 | 30cbdcd05d0b89966868515b5ff8fde56ddcb8d7 | /spring-security-jdbc-authentication-persistent-token-remember-me/src/main/com/roytuts/spring/security/jdbc/authentication/persistent/rememberme/controllers/SpringSecurityController.java | ebdd35a92cd183ec0ac4696bd48c558b66fa754a | [] | no_license | roytuts/spring-security | 491db163491e19b2da3a4b78dfe52f501c33e86a | b0661b7b08d75e8b7c952cb6cb728922f9773360 | refs/heads/master | 2023-08-03T12:27:25.253199 | 2022-11-15T13:46:17 | 2022-11-15T13:46:17 | 189,993,664 | 13 | 40 | null | 2023-07-31T21:20:57 | 2019-06-03T11:38:42 | Java | UTF-8 | Java | false | false | 1,810 | java | package com.roytuts.spring.security.jdbc.authentication.persistent.rememberme.controllers;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
@RequestMapping("/")
public class SpringSecurityController implements MessageSourceAware {
private MessageSource messageSource;
@Override
public void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}
@RequestMapping("/")
public String defaultPage(Model model) {
model.addAttribute("msg", "Welcome to Spring Security");
return "index";
}
@RequestMapping("/login")
public String loginPage(Model model, @RequestParam(value = "error", required = false) String error,
@RequestParam(value = "logout", required = false) String logout) {
if (error != null) {
model.addAttribute("error", messageSource.getMessage("login.failure.reason", null, Locale.US));
}
if (logout != null) {
model.addAttribute("msg", messageSource.getMessage("logout.msg.success", null, Locale.US));
}
return "login";
}
@RequestMapping("/logout")
public String logoutPage(Model model, HttpServletRequest request) {
request.getSession().invalidate();
return "redirect:/login?logout";
}
@RequestMapping("/admin")
public String adminPage(Model model) {
model.addAttribute("title", messageSource.getMessage("page.admin.heading", null, Locale.US));
model.addAttribute("message", messageSource.getMessage("page.admin.message", null, Locale.US));
return "admin";
}
}
| [
"[email protected]"
] | |
8c99f830cd2e2d2b8caf966b727227c1d71b87db | 7e87dec4d1abe4bf0aa3c8188f1c5a60f4df87f0 | /src/main/java/com/invillia/acme/model/constant/OrderStatus.java | e744986bc31f945e9e81b12fcf82938cbf8e141f | [] | no_license | LuanPSantos/backend-challenge | 3ed59bae4bdb422756c69a996bbcecf679961105 | 543c679e82c3ec6feebf83514530378babc03dde | refs/heads/master | 2020-04-21T04:31:54.437066 | 2019-02-08T02:35:15 | 2019-02-08T02:35:15 | 169,315,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package com.invillia.acme.model.constant;
public enum OrderStatus {
PENDING,
FINISHED,
CANCELED
}
| [
"[email protected]"
] | |
b26ce7de261b475d00d22df51c7cd9b31f551657 | ccb56c3128ac142033d6c2b708ec74787099945a | /VjezbanjeZadataka/src/Vjezbanje/zadatak7/Kupac.java | cfe79ffa498f26eca747946db6216e774db17c0a | [] | no_license | valagic/JavaVjezbanjeZadataka | ef1bd6927c7cabb0a79955d9a455e7af36839c7f | b092a4939073bdf39f25b46b558513439f20ff66 | refs/heads/main | 2023-07-26T16:15:13.810457 | 2021-09-02T19:41:25 | 2021-09-02T19:41:25 | 379,823,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package Vjezbanje.zadatak7;
public class Kupac {
private int id;
private String naziv;
private String adresa;
public Kupac() {
}
public Kupac(int id, String naziv, String adresa) {
this.id = id;
this.naziv = naziv;
this.adresa = adresa;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNaziv() {
return naziv;
}
public void setNaziv(String naziv) {
this.naziv = naziv;
}
public String getAdresa() {
return adresa;
}
public void setAdresa(String adresa) {
this.adresa = adresa;
}
@Override
public String toString() {
return this.getId() + " " + this.getNaziv() + " " +this.getAdresa();
}
}
| [
"[email protected]"
] | |
0057c012d7fbffbb6f570e77768e3a643d8a5e72 | 1940342a36f6222caf70a3032ad0f3c00cc1f241 | /src/main/java/com/auramcraft/init/AuramcraftAchievements.java | 6caba4e0a1777ed0285c2d058f0febef1a2cd930 | [] | no_license | Mazdallier/Auramcraft | bda663a3f97ca8da3a7055b0c9878ba2cfa0bb74 | f188b22881761ee9106e9b75aa0f64ff1e26a2a7 | refs/heads/master | 2020-04-06T06:45:10.268584 | 2014-12-10T07:30:24 | 2014-12-10T07:30:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package com.auramcraft.init;
import java.util.ArrayList;
import com.auramcraft.util.LogHelper;
import net.minecraft.stats.Achievement;
import net.minecraft.stats.AchievementList;
import net.minecraftforge.common.AchievementPage;
public class AuramcraftAchievements {
public static AchievementPage page;
public static Achievement auraCrystal = new Achievement("achievement.auraCrystal", "auraCrystal", 0, 0, AuramcraftItems.auraCrystal, AchievementList.diamonds);
public static Achievement elementalShards = new Achievement("achievement.elementalShards", "elementalShards", 2, 0, AuramcraftItems.earthShard, auraCrystal);
public static void init() {
// List of achievements
ArrayList<Achievement> achievements = new ArrayList<Achievement>();
// Register and add achievements
achievements.add(auraCrystal.registerStat());
achievements.add(elementalShards.registerStat());
// Make achievement page
page = new AchievementPage("Auramcraft", achievements.toArray(new Achievement[achievements.size()]));
// Register achievement page
AchievementPage.registerAchievementPage(page);
LogHelper.info("Initialized Achievements");
}
}
| [
"[email protected]"
] | |
eadbbb02730739f0c67cc42a2757c37a651df19a | 71d8155f60105af01e5f34ff373b539d55908d7d | /lectures/lecture-11/Lecture-Live B00/partD/ExamplesRegion.java | 6562977300dc941ab6a432a7c7c5bb28d55a5510 | [] | no_license | ucsd-cse11-sp21/ucsd-cse11-sp21.github.io | 7a2e355206a4758d98c34f5507c04f7183b075aa | 10e63ab427538c1e1088de47ce28ae8f3a25069c | refs/heads/main | 2023-05-15T03:10:10.610402 | 2021-06-13T21:48:25 | 2021-06-13T21:48:25 | 351,263,305 | 5 | 14 | null | null | null | null | UTF-8 | Java | false | false | 2,938 | java | import tester.*;
class Point {
int x;
int y;
Point(int x, int y) {
this.x = x;
this.y = y;
}
boolean belowLeftOf(Point other) {
return this.x <= other.x && this.y <= other.y;
}
boolean aboveRightOf(Point other) {
return this.x >= other.x && this.y >= other.y;
}
double distance(Point other) {
return Math.sqrt(Math.pow(this.x - other.x, 2) + Math.pow(this.y - other.y, 2));
}
}
interface Region { // Added an interface declaration with the shared method
boolean contains(Point p);
Region add(Region other);
Region overlap(Region other);
}
abstract class ARegion implements Region {
public Region add(Region other) {
return new UnionRegion(this, other);
}
public Region overlap(Region other) {
return new IntersectRegion(this, other);
}
}
class RectRegion extends ARegion { // Declared "implements Region" (the interface)
Point lowerLeft;
Point upperRight;
RectRegion(Point lowerLeft, Point upperRight) {
this.lowerLeft = lowerLeft;
this.upperRight = upperRight;
}
public boolean contains(Point p) {
return this.lowerLeft.belowLeftOf(p) && this.upperRight.aboveRightOf(p);
}
}
class CircRegion extends ARegion {
Point center;
int radius;
CircRegion(Point center, int radius) {
this.center = center;
this.radius = radius;
}
public boolean contains(Point p) {
return this.center.distance(p) < this.radius;
}
}
class UnionRegion extends ARegion {
Region r1;
Region r2;
UnionRegion(Region r1, Region r2) {
this.r1 = r1;
this.r2 = r2;
}
public boolean contains(Point p) {
return this.r1.contains(p) || this.r2.contains(p);
}
}
class IntersectRegion extends ARegion {
Region r1;
Region r2;
IntersectRegion(Region r1, Region r2) {
this.r1 = r1;
this.r2 = r2;
}
public boolean contains(Point p) {
return this.r1.contains(p) && this.r2.contains(p);
}
}
class SquareRegion extends ARegion {
Point center;
double sideLength;
SquareRegion(Point center, double sideLength) {
this.center = center;
this.sideLength = sideLength;
}
public boolean contains(Point p) {
int xDiff = Math.abs(p.x - this.center.x);
int yDiff = Math.abs(p.y - this.center.y);
boolean xInside = (xDiff < (this.sideLength / 2));
boolean yInside = (yDiff < (this.sideLength / 2));
return xInside && yInside;
}
}
class CircleRegion extends ARegion {
Point center;
double radius;
CircleRegion(Point center, double radius) {
this.center = center;
this.radius = radius;
}
public boolean contains(Point toCheck) {
return this.center.distance(toCheck) <= this.radius;
}
}
class ExamplesRegion {
Region circ1 = new CircleRegion(new Point(10, 5), 4.0);
Region sq = new SquareRegion(new Point(10, 1), 8.);
Region ur = this.circ1.add(this.sq);
//Region ir = new IntersectRegion(this.circ1, this.sq);
Region ir = this.circ1.overlap(this.sq);
}
| [
"[email protected]"
] | |
15b395c69726514635f92f31a503c8f5a37a4aa8 | bb771cbfbea9f2ac5f916c29bb3668bba7435e7c | /oasis-common-test/src/test/java/cn/xyz/chaos/guava/common/eventbus/subscriber/SlowProcessSubscriber.java | 0d9b31d4d296c44fd9f6763f8c44cfc9ddaf92c9 | [] | no_license | 18965050/oasis | 3184123094bd62d62d6ae9f31622635cebbd2310 | e5f1cfa32b74fe37aaf0872c497f7c8502df052d | refs/heads/master | 2021-01-20T19:39:27.032176 | 2019-03-19T06:32:50 | 2019-03-19T06:32:50 | 61,260,765 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,118 | java | package cn.xyz.chaos.guava.common.eventbus.subscriber;
import java.util.concurrent.CountDownLatch;
import cn.xyz.chaos.guava.common.eventbus.event.BuyEvent;
import cn.xyz.chaos.guava.common.eventbus.event.SellEvent;
import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.Subscribe;
/**
*
* @author lvchenggang
*
*/
public class SlowProcessSubscriber {
private CountDownLatch doneSignal;
public SlowProcessSubscriber(AsyncEventBus asyncEventBus, CountDownLatch doneSignal) {
asyncEventBus.register(this);
this.doneSignal = doneSignal;
}
@Subscribe
@AllowConcurrentEvents
public void handleEventConcurrent(BuyEvent event) {
pause(300l);
doneSignal.countDown();
}
@Subscribe
public void handleEventNonConcurrent(SellEvent event) {
pause(300l);
doneSignal.countDown();
}
private void pause(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
// Ignore
}
}
}
| [
"[email protected]"
] | |
b463f691af7e134d528d526b1e0cd52a8151b6c4 | 6b4b3a7193081b342d3f70cebbb00e9a860e02fb | /src/com/juan/Modulo/Funcion.java | 1a8b0a3cac4b5a72078c67fdeeea94de04a0105c | [] | no_license | jborrajorodriguez/PlugginNetBeans | 51a10c14fb5f3a8cfbb0efa21eaae0ce088593fa | a6c3772778958d17431887a0b55bb2cff2684070 | refs/heads/master | 2020-03-13T12:31:14.910696 | 2018-04-26T08:03:27 | 2018-04-26T08:03:27 | 131,120,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,852 | 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.juan.Modulo;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionRegistration;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle.Messages;
@ActionID(
category = "File",
id = "com.juan.Modulo.Funcion"
)
@ActionRegistration(
iconBase = "com/juan/Modulo/github.png",
displayName = "#CTL_Funcion"
)
@ActionReference(path = "Toolbars/File", position = 0)
@Messages("CTL_Funcion=Herramienta Git")
public final class Funcion implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
try {
String usuario=JOptionPane.showInputDialog("Introduce el Usuario");
JPasswordField contraseña = new JPasswordField();
JOptionPane.showConfirmDialog(null, contraseña, "Introduce la contraseña", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
GitHub github = GitHub.connectUsingPassword(usuario, new String(contraseña.getPassword()));
GHRepository builder = github.createRepository(JOptionPane.showInputDialog("Introduce el nombre del repositorio"),JOptionPane.showInputDialog("Introduce la descripcion del repositorio"), " ", true);
//JOptionPane.showMessageDialog(null, builder.getGitTransportUrl());
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
| [
"[email protected]"
] | |
85a334116e332b4313a099e8881ad7f3d40b066a | a20600b2551fe6ec2654961e2c9553bea956da74 | /DS/Labs/REST APIs with AJAX Calls/src/bookservice/Books.java | d8f7104ce92fe7f899ef985a75a84014d2b87f2c | [] | no_license | SLIITSE/Year3-Sem1 | 5a8e2b9c333441594136e7f7a4cce4463785cae6 | 240db32683941aa1b5073148d379323e62483257 | refs/heads/master | 2023-02-11T15:55:10.891954 | 2021-10-02T08:52:48 | 2021-10-02T08:52:48 | 232,631,828 | 4 | 3 | null | 2023-02-01T23:32:23 | 2020-01-08T18:32:08 | Java | UTF-8 | Java | false | false | 321 | java | package bookservice;
import java.util.ArrayList;
import java.util.List;
public class Books {
private static ArrayList<Book> books = new ArrayList<>();
static {
books.add(new Book(1, "The Outliers", 500));
books.add(new Book(2, "World Is Flat", 550));
}
public static List<Book> getBooks() {
return books;
}
} | [
"[email protected]"
] | |
2bfc410e67f7448b492543b2d0dc9b5c29822e43 | c0b174f5ef0075eee4d23b62444f3b03f4a5e0d0 | /src/main/java/com/cinema/dao/main/MainDAO.java | 090502dc7d31184cd97c6b9280bb7bb83d1aa02c | [] | no_license | kimhohyun21/SpringCinemaLab_remote | 7402aebbee961aa8046c7a75907c0f76b2039313 | c22422e8c13e78b9577711c53450f23a7602a014 | refs/heads/master | 2021-01-12T09:31:05.582124 | 2016-12-11T16:05:12 | 2016-12-11T16:05:12 | 76,177,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package com.cinema.dao.main;
import java.util.*;
import org.mybatis.spring.support.SqlSessionDaoSupport;
public class MainDAO extends SqlSessionDaoSupport{
//메인 페이지에 필요한 영화 정보 가져오기
public List<MainVO> getMovieListData(){
List<MainVO> list=getSqlSession().selectList("getMovieListData");
return list;
}
}
| [
"[email protected]"
] | |
5461cb108865f9e2c4feb06c7b0bcc3442cd8046 | e1a9e8b5af06609cc41e54363b693ce34776a29e | /src/main/java/org/yelong/core/model/collector/support/remove/single/condition/RemoveBySingleConditionModelCollectorImpl.java | 8456651acbdafacc7c09526d4d724e3a87bc16ca | [] | no_license | yelong0216/yelong-core | 4c3b32a2d8d783698cbc8a5c0491dd638ab99cf1 | 206ae0c6ec5dd3ae7e532d632866d7f4e6ba8284 | refs/heads/master | 2022-06-22T09:46:38.427834 | 2020-11-19T01:38:07 | 2020-11-19T01:38:07 | 248,439,479 | 0 | 0 | null | 2022-06-21T04:01:46 | 2020-03-19T07:37:08 | Java | UTF-8 | Java | false | false | 1,449 | java | /**
*
*/
package org.yelong.core.model.collector.support.remove.single.condition;
import org.yelong.core.jdbc.sql.condition.support.Condition;
import org.yelong.core.model.Modelable;
import org.yelong.core.model.collector.support.ProcessConfig;
import org.yelong.core.model.service.SqlModelService;
import org.yelong.core.model.sql.SqlModel;
/**
* 根据单条件删除模型收集器实现
*
* @param <M> model type
* @since 1.3
*/
public class RemoveBySingleConditionModelCollectorImpl<M extends Modelable>
extends AbstractRemoveBySingleConditionModelCollector<M> {
private final Condition condition;
public RemoveBySingleConditionModelCollectorImpl(Class<M> modelClass, final Condition condition) {
super(modelClass);
this.condition = condition;
}
@Override
protected Integer doCollect(SqlModelService modelService) {
ProcessConfig processConfig = new ProcessConfig(modelService, modelClass);
if (null != preProcess) {
preProcess.process(processConfig, condition);
}
Integer removeNum;
if (null != removeModelExecutor) {
removeNum = removeModelExecutor.remove(processConfig, condition);
} else {
SqlModel<M> sqlModel = new SqlModel<M>(modelClass).addCondition(condition);
removeNum = modelService.removeBySqlModel(modelClass, sqlModel);
}
if (null != postProcess) {
postProcess.process(processConfig, condition);
}
return removeNum;
}
}
| [
"[email protected]"
] | |
128ebe9b8524b39e7162de14661aec021789424c | e7a54639783db96016bd26a2ac7061064d0e3372 | /src/dao/TelefonoDAO.java | f23bcf7414fcbcd6ac2bc5de5dfce9083a5e3b7f | [] | no_license | PedroOrellana98/JaramilloOrellana-Pedro-Examen | 59501750e00d1470c3f93cc5561c9c244959dfe8 | 94cf97777b24b012f2f1502f733951ddb7167dfb | refs/heads/master | 2023-01-27T13:04:01.975603 | 2020-12-10T09:01:53 | 2020-12-10T09:01:53 | 319,984,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package dao;
import java.util.List;
import entidad.Telefono;
public interface TelefonoDAO extends GenericDAO<Telefono, String> {
List<Telefono> buscarCedula(String cedula);
}
| [
"[email protected]"
] | |
ae25cd98fbd779a07d5faf147bb0c5ea81897203 | 8b277524cd0d5fa38acc54ba7506aed78f4e67ae | /demo/src/main/java/com/singtel/demo/model/Rooster.java | e76f3c3d6d635c5647286b76b90e775973c63cad | [] | no_license | singhraushan/new_learning | a3ef3381d18d35d5aef6c1b8b9e442a648b75bfe | 165e9467c99021b218ec1d06c432c252f8678cca | refs/heads/master | 2022-12-24T02:28:45.034712 | 2021-12-16T16:22:59 | 2021-12-16T16:22:59 | 145,468,324 | 4 | 1 | null | 2022-12-16T04:35:20 | 2018-08-20T20:40:29 | Java | UTF-8 | Java | false | false | 416 | java | package com.singtel.demo.model;
import com.singtel.demo.util.Sound;
//It's same as chicken, only differences are it can fly and speak differently.
public class Rooster {
private String sing;
private Bird bird;
public Rooster(Sound sound){
bird = new Bird(true, true, true, sound);
}
public String getSing() {
return sing;
}
public Bird getBird() {
return bird;
}
}
| [
"[email protected]"
] | |
fe822f2838657eeb4d3fb2b9d1e9e86fdfc12e24 | 8c9beb140a7deb949eb4c21ab86502aeb4d895b1 | /LeaftapsInput.java | a664a39d87103f79e38f0feb7e098cd892b2f7bb | [] | no_license | AvinPraveen/Selenium.week2 | 2fe8b442ae7bde5f1488b0efca5c0c4bcd801bde | 6a9798fd9caee9f4da5a3eb13a7dc88ba4468c43 | refs/heads/master | 2022-12-22T10:09:55.097915 | 2020-10-02T06:31:40 | 2020-10-02T06:31:40 | 296,889,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,222 | java | package Week2.day1;
import java.util.List;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import io.github.bonigarcia.wdm.WebDriverManager;
public class LeaftapsInput {
public static void main(String[] args) {
// TODO Auto-generated method stub
// to set up the chrome the driver
WebDriverManager.chromiumdriver().setup();
//to open the chrome driver exe we have to import it
ChromeDriver driver=new ChromeDriver();
// to max the screen
driver.manage().window().maximize();
// to link the url or to enter the url
driver.get("http://leaftaps.com/opentaps/control/main");
// to enter the username
WebElement username=driver.findElementById("username");
// to enter the value of the username
username.sendKeys("demosalesmanager");
// to enter the password and its values using Id Locator
//driver.findElementById("password").sendKeys("crmsfa");
// to enter the password using Name locator and its values
driver.findElementByName("PASSWORD").sendKeys("crmsfa");
//using className Locator enter into login page
driver.findElementByClassName("decorativeSubmit").click();
//using LinkText Locator copy by inspect the href: Take only the text not link. Text is consider as value
driver.findElementByLinkText("CRM/SFA").click();
// using ParitalLinkText Loctor it use when ie will change or we won't know the text
// driver.findElementByPartialLinkText("sss").click();
driver.findElementByLinkText("Leads").click();
driver.findElementByLinkText("Create Lead").click();
WebElement source = driver.findElementById("createLeadForm_dataSourceId");
Select dropDown= new Select(source);
dropDown.selectByIndex(1);
WebElement marketingcompain = driver.findElementById("createLeadForm_marketingCampaignId");
Select dropDown1=new Select(marketingcompain);
// dropDown1.selectByVisibleText("Car and Driver");
List<WebElement> options = dropDown1.getOptions();
int size=options.size();
dropDown1.selectByIndex(size-2);
}
}
| [
"[email protected]"
] | |
39a342e48a7b6f7adbaf73dba8fd29894ba0b1c2 | c763cc980a9868ebdad3673ce77e59876be3ce95 | /ingest-service/src/main/java/com/gramcha/ingestservice/repos/AdClickTrackerRepository.java | 71ab52ceb01dc7f2a4ddb9360eadc33492beae7d | [] | no_license | thaveedu/adtech-system | fe88fe8f2878ad99cb534a1157c66157ee89ff8f | 5e4e38d7dd35c9423f141893c9338dc6b69b3198 | refs/heads/master | 2022-02-21T02:01:46.394812 | 2019-10-12T19:38:37 | 2019-10-12T19:38:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | /**
* @author gramcha
* 07-Jul-2018 4:40:20 PM
*
*/
package com.gramcha.ingestservice.repos;
import com.gramcha.entities.ClickTracker;
public interface AdClickTrackerRepository {
void save(ClickTracker clickTracker);
ClickTracker findByClickId(String clickId);
void delete(String clickId);
}
| [
"[email protected]"
] | |
f794d9f01ffd3f82dd6eca3d4057cf1b0894775e | 1c1aa21748b18abfa160f442f3b9a175c126781f | /app/src/main/java/com/led_on_off/led/LogInActivity.java | a7388e0b7d1147f0ea5c1b89e4dea2a6232fc4f7 | [] | no_license | silviu-dev/Wearable | fd70e9dfc14d624951ef64da2502dfdcb132b0b0 | 19d39fa6bf654b1c6551a2d276c91bca19d34e22 | refs/heads/master | 2023-04-26T09:32:01.194325 | 2021-05-25T08:23:37 | 2021-05-25T08:23:37 | 364,614,333 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 5,076 | java | package com.led_on_off.led;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class LogInActivity extends AppCompatActivity {
private TextView username;
private TextView password;
private Button loginButton;
private Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context=this;
setContentView(R.layout.loginlayout);
username=findViewById(R.id.UserNameTextbox);
password=findViewById(R.id.PasswordTextbox);
loginButton=findViewById(R.id.LogInButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onClick(View view) {
TextView userName=findViewById(R.id.UserNameTextbox);
TextView pw=findViewById(R.id.PasswordTextbox);
final LogInVerification verif=new LogInVerification(userName.getText().toString(),pw.getText().toString());
Thread t=new Thread(verif);
t.start();
try {
t.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
if(verif.verif==true)
{
CNP.setCnp(userName.getText().toString());
Accelerometer mysensor=new Accelerometer(context);
new Thread(mysensor).start();
BackgroudThread mainThread=new BackgroudThread(mysensor,context);
mainThread.execute();
Intent intent = new Intent(LogInActivity.this, DeviceList.class);
startActivity(intent);
}
else
{
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast toast = Toast.makeText(context, verif.err, Toast.LENGTH_SHORT);
toast.show();
}
});
}
}
});
}
}
class LogInVerification implements Runnable
{
private String userName;
private String passWord;
public boolean verif=false;
public String err="";
LogInVerification(String userName, String pw)
{
this.userName=userName;
passWord=pw;
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void run() {
try {
URL url = new URL("https://backend-ip-mediating-hedgehog-gl.cfapps.eu10.hana.ondemand.com/pacient/" + userName);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
// Do normal input or output stream reading
StringBuilder content;
try (BufferedReader in = new BufferedReader(
new InputStreamReader(connection.getInputStream()))) {
String line;
content = new StringBuilder();
System.out.println("recomandari citite: ");
line = in.readLine();
if(line==null)
{
throw new MalformedURLException();
}
else{
line=line.substring(1,line.length()-1);
String[] sp=line.split(",");
String psw=sp[11].split(":")[1];
if(passWord.compareTo(psw.substring(1,psw.length()-1))==0)
{
verif=true;
}
else
{
err="parola gresita";
}
}
} catch (IOException ioException) {
err="user inexistent";
ioException.printStackTrace();
} finally {
connection.disconnect();
}
} else {
System.out.println("nu merge");
}
} catch (ProtocolException e) {
e.printStackTrace();
} catch (MalformedURLException e){
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
} | [
"[email protected]"
] | |
fb31f8898a001a8b02cd936222dceef0b0e97602 | 0111b3bbd9d00471ebc459a907229f2da92c8bd4 | /Robotics Projects/Project2/RoboticsProject2.java | 645fe9b9278bc49dd302b3519e42f504549f5f0d | [] | no_license | tomking2077/JavaProjects | cf7f54b5eb70c991afeae951846e3d9d1d8674f2 | fa969d8e97afb06b5e0973c6e568b625af43a6e5 | refs/heads/master | 2020-08-26T16:31:31.334826 | 2019-10-23T14:22:05 | 2019-10-23T14:22:05 | 217,073,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,456 | 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 roboticsproject2;
import java.io.Console;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ColorPicker;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.scene.shape.*;
import javafx.scene.control.Label;
import javafx.scene.paint.Color;
import javafx.scene.paint.ImagePattern;
import javafx.scene.image.Image;
import javafx.scene.transform.Rotate;
import javafx.scene.text.TextAlignment;
import javafx.geometry.Point2D;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.animation.PauseTransition;
import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.util.Duration;
/**
*
* @author Zak
*/
public class RoboticsProject2 extends Application {
@Override
public void start(Stage primaryStage) {
Rectangle display = new Rectangle(10, 10, 580, 480);
display.setFill(Color.WHITE);
display.setStroke(Color.BLACK);
Rectangle control = new Rectangle(600, 30, 180, 250);
control.setFill(Color.GREY);
control.setStroke(Color.BLACK);
Label controlP = new Label("Control Panel");
controlP.setStyle("-fx-font: 26 Cambria;");
controlP.setLayoutY(40);
controlP.setLayoutX(610);
controlP.setTextFill(Color.web("#000000"));
Label license = new Label("© Zacharaih Stratton\n"
+ "Pablo Vielma Jr.\n"
+ "Shaun Fattig\n"
+ "Russell Pier\n");
license.setStyle("-fx-font: 14 Cambria;");
license.setLayoutY(430);
license.setLayoutX(668);
license.setTextFill(Color.web("#FFFFFF"));
license.setTextAlignment(TextAlignment.RIGHT);
Button btn1 = new Button();
btn1.setText("Joint 1 left");
btn1.setLayoutY(80);
btn1.setLayoutX(610);
btn1.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button btn2 = new Button();
btn2.setText("Joint 1 right");
btn2.setLayoutY(80);
btn2.setLayoutX(690);
btn2.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button btn3 = new Button();
btn3.setText("Joint 2 left");
btn3.setLayoutY(120);
btn3.setLayoutX(610);
btn3.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button btn4 = new Button();
btn4.setText("Joint 2 right");
btn4.setLayoutY(120);
btn4.setLayoutX(690);
btn4.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button btn5 = new Button();
btn5.setText("Joint 3 left");
btn5.setLayoutY(160);
btn5.setLayoutX(610);
btn5.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button btn6 = new Button();
btn6.setText("Joint 3 right");
btn6.setLayoutY(160);
btn6.setLayoutX(690);
btn6.setStyle("-fx-font: 12 Cambria; -fx-base: #000000;");
Button paint = new Button();
paint.setText("Paint");
paint.setLayoutY(200);
paint.setLayoutX(655);
paint.setStyle("-fx-font: 16 Cambria; -fx-base: #000000;");
Arc arc = new Arc();
arc.setLayoutX(290.0);
arc.setLayoutY(490.0);
arc.setRadiusX(50.0);
arc.setRadiusY(50.0);
arc.setStartAngle(0.0);
arc.setLength(180.0);
arc.setType(ArcType.ROUND);
arc.setFill(Color.GREY);
//variables to hold coordinates of Axis nodes
int axis1X = 290;
int axis1Y = 460;
int axis2X = 290;
int axis2Y = 310;
int axis3X = 400;
int axis3Y = 250;
int brushX = 450;
int brushY = 200;
//arms, dependent on coords
Line arm1 = new Line(axis1X, axis1Y, axis2X, axis2Y);
arm1.setStyle("-fx-stroke: grey; -fx-stroke-width: 20;");
arm1.setStrokeLineCap(StrokeLineCap.ROUND);
Line arm2 = new Line(arm1.getEndX(), arm1.getEndY(), axis3X, axis3Y);
arm2.setStyle("-fx-stroke: grey; -fx-stroke-width: 20;");
arm2.setStrokeLineCap(StrokeLineCap.ROUND);
Line arm3 = new Line(arm2.getEndX(), arm2.getEndY(), 450, 200);
arm3.setStyle("-fx-stroke: grey; -fx-stroke-width: 20;");
arm3.setStrokeLineCap(StrokeLineCap.ROUND);
//circles for axis's
Circle axis1 = new Circle(axis1X, axis1Y, 5);
Circle axis2 = new Circle(axis2X, axis2Y, 5);
Circle axis3 = new Circle(axis3X, axis3Y, 5);
Circle brush = new Circle(brushX, brushY, 15);
ColorPicker colorPicker = new ColorPicker();
colorPicker.setLayoutY(240);
colorPicker.setLayoutX(620);
String colorPickerStyle = colorPicker.getStyle();
colorPickerStyle = colorPickerStyle + " -fx-background-color: #000000;";
//System.out.print(colorPickerStyle);
colorPicker.setStyle(colorPickerStyle);
colorPicker.setValue(Color.BLACK);
addPressAndHoldHandler(btn1, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm1 = new Line(arm1.getStartX(),arm1.getStartY(),arm1.getEndX(),arm1.getEndY());
newArm1.getTransforms().add(new Rotate(-1,newArm1.getStartX(),newArm1.getStartY()));
Point2D startPoint1 = newArm1.localToParent(newArm1.getStartX(),newArm1.getStartY());
Point2D endPoint1 = newArm1.localToParent(newArm1.getEndX(),newArm1.getEndY());
arm1.setStartX(startPoint1.getX());
arm1.setStartY(startPoint1.getY());
arm1.setEndX(endPoint1.getX());
arm1.setEndY(endPoint1.getY());
axis2.setCenterX(endPoint1.getX());
axis2.setCenterY(endPoint1.getY());
Line newArm2 = new Line(arm2.getStartX(),arm2.getStartY(),arm2.getEndX(),arm2.getEndY());
newArm2.getTransforms().add(new Rotate(-1,newArm1.getStartX(),newArm1.getStartY()));
Point2D startPoint = newArm2.localToParent(newArm2.getStartX(),newArm2.getStartY());
Point2D endPoint = newArm2.localToParent(newArm2.getEndX(),newArm2.getEndY());
arm2.setStartX(startPoint.getX());
arm2.setStartY(startPoint.getY());
arm2.setEndX(endPoint.getX());
arm2.setEndY(endPoint.getY());
axis3.setCenterX(endPoint.getX());
axis3.setCenterY(endPoint.getY());
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(-1,newArm1.getStartX(),newArm1.getStartY()));
startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
addPressAndHoldHandler(btn2, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm1 = new Line(arm1.getStartX(),arm1.getStartY(),arm1.getEndX(),arm1.getEndY());
newArm1.getTransforms().add(new Rotate(1,newArm1.getStartX(),newArm1.getStartY()));
Point2D startPoint1 = newArm1.localToParent(newArm1.getStartX(),newArm1.getStartY());
Point2D endPoint1 = newArm1.localToParent(newArm1.getEndX(),newArm1.getEndY());
arm1.setStartX(startPoint1.getX());
arm1.setStartY(startPoint1.getY());
arm1.setEndX(endPoint1.getX());
arm1.setEndY(endPoint1.getY());
axis2.setCenterX(endPoint1.getX());
axis2.setCenterY(endPoint1.getY());
Line newArm2 = new Line(arm2.getStartX(),arm2.getStartY(),arm2.getEndX(),arm2.getEndY());
newArm2.getTransforms().add(new Rotate(1,newArm1.getStartX(),newArm1.getStartY()));
Point2D startPoint = newArm2.localToParent(newArm2.getStartX(),newArm2.getStartY());
Point2D endPoint = newArm2.localToParent(newArm2.getEndX(),newArm2.getEndY());
arm2.setStartX(startPoint.getX());
arm2.setStartY(startPoint.getY());
arm2.setEndX(endPoint.getX());
arm2.setEndY(endPoint.getY());
axis3.setCenterX(endPoint.getX());
axis3.setCenterY(endPoint.getY());
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(1,newArm1.getStartX(),newArm1.getStartY()));
startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
addPressAndHoldHandler(btn3, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm2 = new Line(arm2.getStartX(),arm2.getStartY(),arm2.getEndX(),arm2.getEndY());
newArm2.getTransforms().add(new Rotate(-1,newArm2.getStartX(),newArm2.getStartY()));
Point2D startPoint = newArm2.localToParent(newArm2.getStartX(),newArm2.getStartY());
Point2D endPoint = newArm2.localToParent(newArm2.getEndX(),newArm2.getEndY());
arm2.setStartX(startPoint.getX());
arm2.setStartY(startPoint.getY());
arm2.setEndX(endPoint.getX());
arm2.setEndY(endPoint.getY());
axis3.setCenterX(endPoint.getX());
axis3.setCenterY(endPoint.getY());
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(-1,newArm2.getStartX(),newArm2.getStartY()));
startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
addPressAndHoldHandler(btn4, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm2 = new Line(arm2.getStartX(),arm2.getStartY(),arm2.getEndX(),arm2.getEndY());
newArm2.getTransforms().add(new Rotate(1,newArm2.getStartX(),newArm2.getStartY()));
Point2D startPoint = newArm2.localToParent(newArm2.getStartX(),newArm2.getStartY());
Point2D endPoint = newArm2.localToParent(newArm2.getEndX(),newArm2.getEndY());
arm2.setStartX(startPoint.getX());
arm2.setStartY(startPoint.getY());
arm2.setEndX(endPoint.getX());
arm2.setEndY(endPoint.getY());
axis3.setCenterX(endPoint.getX());
axis3.setCenterY(endPoint.getY());
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(1,newArm2.getStartX(),newArm2.getStartY()));
startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
addPressAndHoldHandler(btn5, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(-1,newArm3.getStartX(),newArm3.getStartY()));
Point2D startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
Point2D endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
addPressAndHoldHandler(btn6, new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
Line newArm3 = new Line(arm3.getStartX(),arm3.getStartY(),arm3.getEndX(),arm3.getEndY());
newArm3.getTransforms().add(new Rotate(1,newArm3.getStartX(),newArm3.getStartY()));
Point2D startPoint = newArm3.localToParent(newArm3.getStartX(),newArm3.getStartY());
Point2D endPoint = newArm3.localToParent(newArm3.getEndX(),newArm3.getEndY());
arm3.setStartX(startPoint.getX());
arm3.setStartY(startPoint.getY());
arm3.setEndX(endPoint.getX());
arm3.setEndY(endPoint.getY());
brush.setCenterX(endPoint.getX());
brush.setCenterY(endPoint.getY());
}
});
Pane root = new Pane();
root.setStyle("-fx-background-color: #500000");
root.getChildren().add(display);
root.getChildren().add(control);
root.getChildren().add(controlP);
root.getChildren().add(license);
root.getChildren().add(btn1);
root.getChildren().add(btn2);
root.getChildren().add(btn3);
root.getChildren().add(btn4);
root.getChildren().add(btn5);
root.getChildren().add(btn6);
root.getChildren().add(paint);
root.getChildren().add(arc);
root.getChildren().add(arm1);
root.getChildren().add(arm2);
root.getChildren().add(arm3);
root.getChildren().add(axis1);
root.getChildren().add(axis2);
root.getChildren().add(axis3);
root.getChildren().add(brush);
root.getChildren().add(colorPicker);
Scene scene = new Scene(root, 800, 500);
primaryStage.setTitle("PaintBot");
primaryStage.setScene(scene);
primaryStage.show();
paint.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
Circle circle = new Circle(brush.getCenterX(), brush.getCenterY(), 15);
circle.setFill(colorPicker.getValue());
root.getChildren().add(circle);
brush.toFront();
}
});
}
private void addPressAndHoldHandler(Node node, EventHandler<MouseEvent> handler) {
class Wrapper<T> { T content ; }
Wrapper<MouseEvent> eventWrapper = new Wrapper<>();
PauseTransition holdTimer = new PauseTransition(Duration.millis(500));
holdTimer.setOnFinished(event -> {
handler.handle(eventWrapper.content);
holdTimer.setDuration(Duration.millis(15));
holdTimer.playFromStart();
});
node.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
eventWrapper.content = event ;
handler.handle(eventWrapper.content);
holdTimer.playFromStart();
});
node.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> {
holdTimer.stop();
holdTimer.setDuration(Duration.millis(500));
});
node.addEventHandler(MouseEvent.DRAG_DETECTED, event -> {
holdTimer.stop();
holdTimer.setDuration(Duration.millis(500));
});
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"[email protected]"
] | |
1e97437636219c9d583f75ba2c53b7ff874b8f4c | 6a90e85222bda21e97eb2dc93389dd2eeefeb51c | /M15/src/main/java/app/orchis/controladors/AltaPaisController.java | ef76cfb594f0a2424fb9d72d3d3227fafd12a807 | [] | no_license | fbarraza/Caesar | f5e591d697c04d3a2f10b043bcd73a15c00f063f | b8d543fd926c8aab9ce8dcbf023bd36f32fa0ba4 | refs/heads/master | 2021-04-29T22:54:32.674205 | 2018-03-10T15:17:58 | 2018-03-10T15:17:58 | 121,646,136 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,599 | 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 app.orchis.controladors;
import app.orchis.model.MasterModel;
import app.orchis.model.Pais;
import static app.orchis.utils.Alertes.advertir;
import java.net.URL;
import java.util.ArrayList;
import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TableView;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;
/**
*
* @author m15
*/
public class AltaPaisController extends MasterController implements Initializable{
@FXML private TableView<Pais> tvTipusPais;
@FXML private TableColumn<Pais, Integer> colCodi;
@FXML private TableColumn<Pais, String> colAbreviatura;
@FXML private TableColumn<Pais, String> colNom;
@FXML private TextField tfCodi;
@FXML private TextField tfAbreviatura;
@FXML private TextField tfNom;
@FXML private Button btnNou, btnGuardar, btnEliminar, btnCancelar;
private static final int FIRST = 0;
private MasterModel<Pais> helperPa;
private boolean mode_insercio = false;
@Override
public void initialize(URL location, ResourceBundle resources) {
configuraColumnes();
tvTipusPais.getSelectionModel().selectedItemProperty().addListener((ObservableValue<? extends Pais> observable, Pais oldValue, Pais newValue) -> {
if (newValue != null) {
tfCodi.setText(String.valueOf(newValue.getCodi_pais()));
tfAbreviatura.setText(newValue.getAbreviatura());
tfNom.setText(newValue.getNom());
}
});
Platform.runLater(() -> {
//Obtenim els usuaris
helperPa = new MasterModel(emf, Pais.class);
inicia();
});
tvTipusPais.requestFocus();
}
public void inicia() {
refrescaTaula(FIRST);
if (tvTipusPais.getItems().isEmpty()) {
btnNou.setDisable(false);
btnGuardar.setDisable(true);
btnEliminar.setDisable(true);
btnCancelar.setDisable(true);
} else {
btnNou.setDisable(false);
btnGuardar.setDisable(false);
btnEliminar.setDisable(false);
btnCancelar.setDisable(true);
}
}
private void configuraColumnes() {
colCodi.setCellValueFactory(new PropertyValueFactory<>("codi_pais"));
colAbreviatura.setCellValueFactory(new PropertyValueFactory<>("abreviatura"));
colNom.setCellValueFactory(new PropertyValueFactory<>("nom"));
}
private void refrescaTaula() {
tvTipusPais.getItems().removeAll();
tvTipusPais.getItems().setAll(getPaisos());
if (tvTipusPais.getItems().isEmpty()) {
tfCodi.clear();
tfNom.clear();
tfAbreviatura.clear();
btnEliminar.setDisable(true);
btnGuardar.setDisable(true);
}
}
private void refrescaTaula(int index) {
refrescaTaula();
tvTipusPais.requestFocus();
tvTipusPais.getSelectionModel().select(index);
tvTipusPais.getFocusModel().focus(index);
}
private void refrescaTaula(boolean last) {
refrescaTaula();
tvTipusPais.getSelectionModel().selectLast();
}
@FXML
private void btnNouOnAction (ActionEvent event) {
inserir();
}
@FXML
private void btnCancelarOnAction (ActionEvent event) {
cancelar();
}
@FXML
private void btnEliminarOnAction (ActionEvent event) {
eliminar();
}
@FXML
private void btnGuardarOnAction (ActionEvent event) {
guardar();
}
public void inserir() {
tfCodi.clear();
tfNom.clear();
tfAbreviatura.clear();
tfNom.requestFocus();
btnNou.setDisable(true);
btnGuardar.setDisable(false);
btnEliminar.setDisable(true);
btnCancelar.setDisable(false);
mode_insercio = true;
}
public void cancelar() {
if (!tvTipusPais.getItems().isEmpty()) {
Pais item = tvTipusPais.getSelectionModel().getSelectedItem();
tfCodi.setText(String.valueOf(item.getCodi_pais()));
tfAbreviatura.setText(item.getAbreviatura());
tfNom.setText(item.getNom());
btnNou.setDisable(false);
btnGuardar.setDisable(false);
btnEliminar.setDisable(false);
} else {
tfCodi.clear();
tfNom.clear();
btnNou.setDisable(false);
btnGuardar.setDisable(true);
btnEliminar.setDisable(true);
}
btnCancelar.setDisable(true);
mode_insercio = false;
}
public void eliminar () {
if (!tvTipusPais.getItems().isEmpty()) {
if (advertir("Està segur d'eliminar l'element?") == ButtonType.YES) {
Pais p = tvTipusPais.getSelectionModel().getSelectedItem();
if (p != null) {
int indexActual = tvTipusPais.getItems().indexOf(p);
int nouIndex = indexActual - 1;
if (indexActual == FIRST)
nouIndex = FIRST;
helperPa.eliminar(p,true);
refrescaTaula(nouIndex);
}
}
}
}
public void guardar () {
if (!tfAbreviatura.getText().isEmpty()) {
if(!tfNom.getText().isEmpty()){
boolean last = false;
int index = -1;
if (mode_insercio) {
Pais p = new Pais();
p.setCodi_pais(0);
p.setAbreviatura(tfAbreviatura.getText());
p.setNom(tfNom.getText());
helperPa.afegir(p,true);
mode_insercio = false;
last = true;
} else {
Pais p = tvTipusPais.getSelectionModel().getSelectedItem();
index = tvTipusPais.getSelectionModel().getSelectedIndex();
p.setAbreviatura(tfAbreviatura.getText());
p.setNom(tfNom.getText());
helperPa.actualitzar(p,true);
}
if (last)
refrescaTaula(last);
else
refrescaTaula(index);
btnNou.setDisable(false);
btnGuardar.setDisable(false);
btnEliminar.setDisable(false);
btnCancelar.setDisable(true);
} else {
advertir("El camp <abreviatura> és obligatori");
}
} else {
advertir("El camp <nom> és obligatori");
}
}
/**
* Obté una llista completa de tots els usuaris.
* @return
*/
private ObservableList<Pais> getPaisos() {
ArrayList<Pais> llista = (ArrayList) helperPa.getAll();
ObservableList<Pais> llistaPa = FXCollections.observableArrayList(llista);
return llistaPa;
}
}
| [
"sv@SV-MNP-XUB"
] | sv@SV-MNP-XUB |
3cb1c5c1339a4d4e70345540ec4f026bcdf4aabd | e01539ff4fa403982c991aa424dc773547abb30a | /com.ibm.jbatch.container/generated-sources/jaxb/com/ibm/jbatch/jsl/model/Fail.java | ce7420047588f4be7c015a76abf69d5f817b624d | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"CPL-1.0"
] | permissive | jGauravGupta/standards.jsr352.jbatch | 6d9aa00e8a3ddd44853570cb5086ebe189dd4932 | 90569b0004e830756d8f921419a511986b33a79c | refs/heads/master | 2022-10-08T09:20:17.941405 | 2020-05-08T21:12:17 | 2020-05-08T21:19:00 | 268,828,296 | 0 | 0 | Apache-2.0 | 2020-06-02T14:47:51 | 2020-06-02T14:47:50 | null | UTF-8 | Java | false | false | 3,382 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.04.05 at 01:05:36 PM EDT
//
package com.ibm.jbatch.jsl.model;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlType;
/**
* <p>Java class for Fail complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Fail">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attGroup ref="{https://jakarta.ee/xml/ns/jakartaee}TerminatingAttributes"/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Fail")
/**
* Modified post-XJC-gen by custom JSR352 RI build logic
*
* This custom logic adds the interface implementation :
* implements com.ibm.jbatch.container.jsl.TransitionElement
*/
public class Fail implements com.ibm.jbatch.container.jsl.TransitionElement {
@XmlAttribute(name = "on", required = true)
protected String on;
@XmlAttribute(name = "exit-status")
protected String exitStatus;
/**
* Gets the value of the on property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getOn() {
return on;
}
/**
* Sets the value of the on property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setOn(String value) {
this.on = value;
}
/**
* Gets the value of the exitStatus property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getExitStatus() {
return exitStatus;
}
/**
* Sets the value of the exitStatus property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setExitStatus(String value) {
this.exitStatus = value;
}
/**
* Copyright 2013 International Business Machines Corp.
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. 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.
*/
/*
* Appended by build tooling.
*/
public String toString() {
StringBuffer buf = new StringBuffer(40);
buf.append("Fail: on = " + on + ", exit-status = " + exitStatus);
return buf.toString();
}
} | [
"[email protected]"
] | |
40aac1be0d7e7535ab40dc272ffeec3fe2c0583f | 99194e16445ad596e0a663e4dfd9821cc2958740 | /app/src/main/java/me/fadcrepin/travelmantics/DealActivity.java | 378d9dd1bb31edd6d85d17401c52fbd704f2d0eb | [] | no_license | fadcrep/TavelMantics | cee558da43e29016c3ea654961e1f1784cb53d2c | 40a031d9718c039ac3128bfc06d0e831994590de | refs/heads/master | 2020-06-29T23:20:10.559934 | 2019-08-08T03:55:45 | 2019-08-08T03:55:45 | 200,654,125 | 0 | 0 | null | 2019-08-08T03:22:50 | 2019-08-05T12:47:28 | Java | UTF-8 | Java | false | false | 7,162 | java | package me.fadcrepin.travelmantics;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import com.squareup.picasso.Picasso;
public class DealActivity extends AppCompatActivity {
private FirebaseDatabase mFirebaseDatabase;
private DatabaseReference mDatabaseReference;
private static final int PICTURE_RESULT = 42; //the answer to everything
EditText txtTitle;
EditText txtDescription;
EditText txtPrice;
ImageView imageView;
TravelDeal deal;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deal);
mFirebaseDatabase = FirebaseUtil.mFirebaseDatabase;
mDatabaseReference = FirebaseUtil.mDatabaseReference;
txtTitle = (EditText) findViewById(R.id.txtTitle);
txtDescription = (EditText) findViewById(R.id.txtDescription);
txtPrice = (EditText) findViewById(R.id.txtPrice);
imageView = (ImageView) findViewById(R.id.image);
Intent intent = getIntent();
TravelDeal deal = (TravelDeal) intent.getSerializableExtra("Deal");
if (deal==null) {
deal = new TravelDeal();
}
this.deal = deal;
txtTitle.setText(deal.getTitle());
txtDescription.setText(deal.getDescription());
txtPrice.setText(deal.getPrice());
showImage(deal.getImageUrl());
Button btnImage = findViewById(R.id.btnImage);
btnImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(intent.createChooser(intent,
"Insert Picture"), PICTURE_RESULT);
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.save_menu:
saveDeal();
Toast.makeText(this, "Deal saved", Toast.LENGTH_LONG).show();
clean();
backToList();
return true;
case R.id.delete_menu:
deleteDeal();
backToList();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.save_menu, menu);
if (FirebaseUtil.isAdmin) {
menu.findItem(R.id.delete_menu).setVisible(true);
menu.findItem(R.id.save_menu).setVisible(true);
enableEditTexts(true);
}
else {
menu.findItem(R.id.delete_menu).setVisible(false);
menu.findItem(R.id.save_menu).setVisible(false);
enableEditTexts(false);
}
return true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICTURE_RESULT && resultCode == RESULT_OK) {
Uri imageUri = data.getData();
StorageReference ref = FirebaseUtil.mStorageRef.child(imageUri.getLastPathSegment());
ref.putFile(imageUri).addOnSuccessListener(this, new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
String url = taskSnapshot.getDownloadUrl().toString();
String pictureName = taskSnapshot.getStorage().getPath();
deal.setImageUrl(url);
deal.setImageName(pictureName);
Log.d("Url: ", url);
Log.d("Name", pictureName);
showImage(url);
}
});
}
}
private void saveDeal() {
deal.setTitle(txtTitle.getText().toString());
deal.setDescription(txtDescription.getText().toString());
deal.setPrice(txtPrice.getText().toString());
if(deal.getId()==null) {
mDatabaseReference.push().setValue(deal);
}
else {
mDatabaseReference.child(deal.getId()).setValue(deal);
}
}
private void deleteDeal() {
if (deal.getId() == null) {
Toast.makeText(this, "Please save the deal before deleting", Toast.LENGTH_SHORT).show();
return;
} else {
mDatabaseReference.child(deal.getId()).removeValue();
Log.d("image name", deal.getImageName());
if (deal.getImageName() != null && deal.getImageName().isEmpty() == false) {
StorageReference picRef = FirebaseUtil.mStorage.getReference().child(deal.getImageName());
picRef.delete().addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d("Delete Image", "Image Successfully Deleted");
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.d("Delete Image", e.getMessage());
}
});
}
Toast.makeText(this, "Deal Deleted", Toast.LENGTH_LONG).show();
}
}
private void backToList() {
finish();
}
private void clean() {
txtTitle.setText("");
txtPrice.setText("");
txtDescription.setText("");
txtTitle.requestFocus();
}
private void enableEditTexts(boolean isEnabled) {
txtTitle.setEnabled(isEnabled);
txtDescription.setEnabled(isEnabled);
txtPrice.setEnabled(isEnabled);
}
private void showImage(String url) {
if (url != null && url.isEmpty() == false) {
int width = Resources.getSystem().getDisplayMetrics().widthPixels;
Picasso.with(this)
.load(url)
.resize(width, width*2/3)
.centerCrop()
.into(imageView);
}
}
}
| [
"[email protected]"
] | |
e24e70bfe4395edc62aa7c252d5702801d95e1d3 | 1ba0b3b81d66ea93ea34b9d63e7e32bd46bce044 | /iMoney/src/cenhiang/imoney/groupManage.java | 696eb2e5992a9cea0a6f7a0087480f18b01def34 | [] | no_license | cheonhyangzhang/iMoney | c64af0b7191c440f58408fd5d1fcc505ed70224a | 268d79139228c58e588750a03b82cde2bd79df2e | refs/heads/master | 2021-01-20T12:42:12.700357 | 2013-05-19T03:38:00 | 2013-05-19T03:38:00 | null | 0 | 0 | null | null | null | null | WINDOWS-1256 | Java | false | false | 5,487 | java | package cenhiang.imoney;
import java.util.ArrayList;
import java.util.HashMap;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
public class groupManage extends ListActivity{
private Button groupManageBack= null;
private Button groupManageAdd= null;
private LinearLayout groupmanageNameBox= null;
private int maxGroupNumber= 17;
private String currentTabName = null;
private int currentGroupId = 0;
private int currentsecondGroupId = 0;
private TextView groupmanageName = null;
private int isDetail=0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.groupmanage);
groupManageBack=(Button)findViewById(R.id.groupManageBack);
groupManageAdd=(Button)findViewById(R.id.groupmanageAdd);
groupmanageName = (TextView)findViewById(R.id.groupmanageName);
groupmanageNameBox = (LinearLayout) findViewById(R.id.groupmanageNameBox);
groupManageAdd.setOnClickListener(new groupManageAddListener());
groupManageBack.setOnClickListener(new groupManageBackListener());
}
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
System.out.println("detail "+isDetail);
if (isDetail ==0){
groupmanageNameBox.setVisibility(View.GONE);
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> [] maps = new HashMap[maxGroupNumber];//
iMoneyData dbHelper = new iMoneyData(groupManage.this,"iMoneyData");
SQLiteDatabase db = dbHelper.getWritableDatabase();
Cursor cursor = db.query("expensegroup", new String[]{"name","id","inuse"}, "inuse=?", new String[]{"1"}, null, null, null);
int mapsIndex=0;
while (cursor.moveToNext()){
maps[mapsIndex] = new HashMap<String, String>();
maps[mapsIndex].put("groupName", cursor.getString(cursor.getColumnIndex("name")));
list.add(maps[mapsIndex]);
mapsIndex = mapsIndex + 1;
}
cursor.close();
SimpleAdapter listAdapter = new SimpleAdapter(this, list, R.layout.groupmanagelv, new String[]{"groupName"}, new int[]{R.id.groupName});
setListAdapter(listAdapter);
db.close();
}
//isDetail ==1
else{
groupmanageNameBox.setVisibility(View.VISIBLE);
groupmanageName.setText(currentTabName);
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> [] maps = new HashMap[maxGroupNumber];//
iMoneyData dbHelper = new iMoneyData(groupManage.this,"iMoneyData");
SQLiteDatabase db = dbHelper.getWritableDatabase();
Cursor cursor = db.query("secondgroup", new String[]{"groupid","name","inuse"}, "groupid=? and inuse=?", new String[]{""+currentGroupId,""+"1"}, null, null, null);
int mapsIndex=0;
while (cursor.moveToNext()){
maps[mapsIndex] = new HashMap<String, String>();
maps[mapsIndex].put("groupName", cursor.getString(cursor.getColumnIndex("name")));
list.add(maps[mapsIndex]);
mapsIndex = mapsIndex + 1;
}
cursor.close();
SimpleAdapter listAdapter = new SimpleAdapter(this, list, R.layout.groupmanagelv, new String[]{"groupName"}, new int[]{R.id.groupName});
setListAdapter(listAdapter);
db.close();
}
}
protected void onListItemClick(ListView l, View v, int position, long id){
super.onListItemClick(l, v, position, id);
if (isDetail == 0 ){
isDetail = 1;
iMoneyData dbHelper = new iMoneyData(groupManage.this,"iMoneyData");
SQLiteDatabase db = dbHelper.getWritableDatabase();
Cursor cursor = db.query("expensegroup", new String[]{"name","id","inuse"}, "inuse=?",new String[]{"1"}, null, null, null);
int index =0;
int found =0;
while (cursor.moveToNext()){
if (index == position){
currentGroupId=cursor.getInt(cursor.getColumnIndex("id"));
currentTabName=cursor.getString(cursor.getColumnIndex("name"));
found=1;
break;
}
else{
index++;
}
}
cursor.close();
db.close();
groupManage.this.onResume();
}
else if (isDetail == 1)
{
//nothing
}
}
class groupManageAddListener implements OnClickListener{
public void onClick(View v){
// إذ¶دتا·ٌ´َسع16¸ِ?
if (isDetail ==0){
Intent intent = new Intent();
intent.setClass(groupManage.this, newGroup.class);
groupManage.this.startActivity(intent);
}
//is Detail ==1
else{
Intent intent = new Intent();
intent.putExtra("currentGroupId", currentGroupId);
intent.setClass(groupManage.this, newSecondGroup.class);
groupManage.this.startActivity(intent);
}
}
}
class groupManageBackListener implements OnClickListener{
public void onClick(View v){
if (isDetail ==1){
isDetail =0;
groupManage.this.onResume();
}
else{
finish();
}
}
}
}
| [
"[email protected]"
] | |
e97e39633b2f85df78c892222f0aea340f4a0b29 | b42fdf441a03ffa1597155c12a8bd724964bdfce | /src/br/com/paulo/string/ReverseString.java | 09fece9d01c99fa6cb53a9020696c9d85cc5d048 | [] | no_license | paulohsl/algorithms | 6bcb900ccdaed2770310c576c26bc33f587b8385 | 15c4e4caf671c9a56b66f2e010287b30df8e32a4 | refs/heads/master | 2021-01-22T11:21:15.185337 | 2017-05-28T20:48:42 | 2017-05-28T20:48:42 | 92,685,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,029 | java | package br.com.paulo.string;
import java.util.Stack;
/**
* Created by paulohsl on 9/8/16.
*/
public class ReverseString {
public static void main(String[] args) {
String phrase = "Olha o gato ae";
System.out.println(reverseUsingStack(phrase));
}
public static String reverseString(String phrase) {
char[] charString = phrase.toCharArray();
StringBuilder sb = new StringBuilder();
for (int i = charString.length - 1; i >= 0; i--) {
sb.append(charString[i]);
}
return sb.toString();
}
static String reverseUsingStack(String sentence) {
char[] charArray = sentence.toCharArray();
Stack<Character> wordStack = new Stack<>();
for (Character ch : charArray) {
wordStack.push(ch);
}
StringBuilder sb = new StringBuilder();
while (!wordStack.empty()) {
sb.append(wordStack.peek());
wordStack.pop();
}
return sb.toString();
}
}
| [
"[email protected]"
] | |
9b562e9f3444be551001b471582ec7e4fe95e8b0 | e697161bed98bef5696695ccd0b7c63693864df4 | /PizzaProject/src/Integration/Sauce.java | 8e4f2ca64ef33db7ea90fa66c5d50527586fa79f | [] | no_license | Rjacq025/PizzaProject2 | c09517eb6eb4a1f7240a5c072d837ffbf2923ebf | 6eaa4019832be0d46d35e09712b94a795527283d | refs/heads/main | 2023-06-08T03:36:31.499160 | 2021-06-26T03:38:07 | 2021-06-26T03:38:07 | 378,526,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package Integration;
import java.util.Scanner;
public class Sauce {
public static String[] arraySauceList = {"[1] Original Tomato +20 cal | $2.00",
"[2] Ranch +30 cal | $2.50", "[3] BBQ +45 cal | $3.50", "[4] Alfredo +30 cal | $2.50",
"[5] Buffalo +15 cal | $1.50", "[6] Marinara +20 cal | $2,00"};
public static int[] arraysauceCalList = {20, 30, 45, 30, 15, 20};
public static double[] arraySaucePriceList = {2.00, 2.50, 3.50, 2.50, 1.50, 2.00};
}
| [
"[email protected]"
] | |
104818da2f47cd5c4234ceb61f418a505e109117 | 629e42efa87f5539ff8731564a9cbf89190aad4a | /unrefactorInstances/axis2-java/40/cloneInstance2.java | f880bcab48cc7ca86ea9dec5deac4afdaa46ba07 | [] | no_license | soniapku/CREC | a68d0b6b02ed4ef2b120fd0c768045424069e726 | 21d43dd760f453b148134bd526d71f00ad7d3b5e | refs/heads/master | 2020-03-23T04:28:06.058813 | 2018-08-17T13:17:08 | 2018-08-17T13:17:08 | 141,085,296 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | public boolean isComplete(){
if (WSDLConstants.MEP_URI_IN_ONLY.equals(this.axisOperation.getMessageExchangePattern())){
if(1 == this.messageContextList.size())
return true;
}else if(WSDLConstants.MEP_URI_IN_OUT.equals(this.axisOperation.getMessageExchangePattern())){
if(2 == this.messageContextList.size())
return true;
}
return false;
}
| [
"[email protected]"
] | |
773cf7bbd14b4098a3050df7976ad0f01c17863c | 50c7be4ad4a59c1265dcb1a0f2b2465c551f6232 | /order-service/src/main/java/com/example/orderservice/controller/dto/ProcessOrderRequestDTO.java | 66923c07e4538911beed694c095287f53f2adf80 | [] | no_license | kutaykoylan/ecommerce-app | 7a34b2c421f58fbd24b9041f0724622ccadca6df | e2abbc13d8a249bacd0435db4f56e9630c78f767 | refs/heads/main | 2023-05-08T06:44:19.374554 | 2021-05-25T19:51:51 | 2021-05-25T19:51:51 | 343,922,068 | 2 | 1 | null | 2021-04-25T15:26:10 | 2021-03-02T21:49:36 | Java | UTF-8 | Java | false | false | 334 | java | package com.example.orderservice.controller.dto;
import com.example.orderservice.entity.PaymentInformation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProcessOrderRequestDTO {
private PaymentInformation paymentInformation;
}
| [
"[email protected]"
] | |
9e94720445155b6ac754c6d674eb1fa700790c08 | f062adbceda4a296ee6750fcab727db733bb6a09 | /src/main/java/com/ynyes/ganzhi/entity/TdUserLevel.java | c54a05b70d32ddf02372cfe4fbf46c7a0b158b31 | [] | no_license | Max3215/ganzhi | eba03755973bd27e17dedc64a85f57f7d015f072 | 501fc19078f1df74b599cd24845991bfa748c007 | refs/heads/master | 2020-04-27T10:25:40.713008 | 2019-03-07T02:15:17 | 2019-03-07T02:15:17 | 174,253,225 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,916 | java | package com.ynyes.ganzhi.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* 用户等级
*
* 用户等级信息
*
* @author Sharon
*
*/
@Entity
public class TdUserLevel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
// 级别
@Column(unique=true)
private Long levelId;
// 等级名称
@Column
private String title;
// 需要累计消费额
@Column(scale=2)
private Double requiredConsumption;
// 优惠比例
@Column(scale=2)
private Double discountRatio;
// 是否默认
@Column
private Boolean isEnable;
// 排序号
@Column
private Long sortId;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getLevelId() {
return levelId;
}
public void setLevelId(Long levelId) {
this.levelId = levelId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Double getRequiredConsumption() {
return requiredConsumption;
}
public void setRequiredConsumption(Double requiredConsumption) {
this.requiredConsumption = requiredConsumption;
}
public Double getDiscountRatio() {
return discountRatio;
}
public void setDiscountRatio(Double discountRatio) {
this.discountRatio = discountRatio;
}
public Boolean getIsEnable() {
return isEnable;
}
public void setIsEnable(Boolean isEnable) {
this.isEnable = isEnable;
}
public Long getSortId() {
return sortId;
}
public void setSortId(Long sortId) {
this.sortId = sortId;
}
}
| [
"[email protected]"
] | |
acbae5653bc9e3c3b4f7a6c670da1419a778ca25 | 80d28a77755e03baa529966678538c87faa751f8 | /src/main/java/command/Command.java | 1177b1c4269d3717168476ec2e86d3f522dfa71d | [] | no_license | Wismut/crud_project | 33ccb37dc815103688603f338d393b8601b43ff7 | e59687c116a009e997d29d47b0f7fa36c2deb2fa | refs/heads/master | 2022-08-15T11:14:38.042051 | 2020-05-22T13:57:46 | 2020-05-22T13:57:46 | 258,201,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package command;
public enum Command {
UPDATE("u"), DELETE_BY_ID("d"), SAVE("s"), GET_BY_ID("g"), GET_ALL("a"), GET_BY_CONTENT("c");
private String shortCutLetter;
Command(String shortCutLetter) {
this.shortCutLetter = shortCutLetter;
}
public static Command getCommandByLetter(String letter) {
if (letter == null) {
return null;
}
for (Command command : values()) {
if (letter.equals(command.shortCutLetter)) {
return command;
}
}
return null;
}
}
| [
"[email protected]"
] | |
8d277e76212d2654bc0969382b80fa97d5d1ab59 | 7513020d4c34fa8ee3f485665a7ae9e5306d1b7e | /src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithCustomTypeTest.java | 9b13d031f2831b2f6ae159e5d71b7629b0995a78 | [] | no_license | dilbertside/extclassgenerator | 39e8728a061c8fbfaea50c7f872368aa6d89c99e | 22c121457e6bfbf9b73dc25731bc99651834b1a5 | refs/heads/master | 2021-01-17T08:14:14.617121 | 2014-05-31T18:07:58 | 2014-05-31T18:07:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,525 | java | /**
* Copyright 2013-2014 Ralph Schaer <[email protected]>
*
* 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 ch.rasc.extclassgenerator;
import static org.fest.assertions.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithCustomType;
public class ModelGeneratorBeanWithCustomTypeTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() {
GeneratorTestUtil.testGenerateJavascript(BeanWithCustomType.class,
"BeanWithCustomType", true, IncludeValidation.NONE, false);
}
@Test
public void testWithoutQuotes() {
GeneratorTestUtil.testWriteModel(BeanWithCustomType.class,
"BeanWithCustomType");
GeneratorTestUtil.testGenerateJavascript(BeanWithCustomType.class,
"BeanWithCustomType", false, IncludeValidation.NONE, false);
}
@Test
public void testCreateModel() {
ModelBean modelBean = ModelGenerator
.createModel(BeanWithCustomType.class);
assertThat(modelBean.getReadMethod()).isNull();
assertThat(modelBean.getCreateMethod()).isNull();
assertThat(modelBean.getUpdateMethod()).isNull();
assertThat(modelBean.getDestroyMethod()).isNull();
assertThat(modelBean.getIdProperty()).isEqualTo("id");
assertThat(modelBean.isDisablePagingParameters()).isFalse();
assertThat(modelBean.isPaging()).isFalse();
assertThat(modelBean.getMessageProperty()).isNull();
assertThat(modelBean.getRootProperty()).isNull();
assertThat(modelBean.getTotalProperty()).isNull();
assertThat(modelBean.getSuccessProperty()).isNull();
assertThat(modelBean.getName()).isEqualTo("Sch.BeanWithCustomType");
assertThat(modelBean.getFields()).hasSize(5);
assertThat(BeanWithCustomType.expectedFields).hasSize(5);
for (ModelFieldBean expectedField : BeanWithCustomType.expectedFields) {
ModelFieldBean field = modelBean.getFields().get(
expectedField.getName());
assertThat(field).isEqualsToByComparingFields(expectedField);
}
}
}
| [
"[email protected]"
] | |
9f08ce508559459bf491bf201c2c287b7d8d3d95 | 1300a6ef8446ab18cd9939a4defbe3488a6d6396 | /src/roguelike/world/Point.java | c81d76f11000c8bebdcd36492657578a99d5403b | [] | no_license | LeSingeAffame/RogueLike | aab7792a110bc4ebcdab48c836d9fc074deaa4b6 | e2cbdfd010f2f8dcfc6d8619f4818d25b33f5024 | refs/heads/master | 2021-04-06T00:58:18.029336 | 2018-03-15T11:06:51 | 2018-03-15T11:06:51 | 125,353,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package roguelike.world;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Point {
public int x;
public int y;
public int z;
public Point(int x, int y, int z){
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Point))
return false;
Point other = (Point) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
if (z != other.z)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + x;
result = prime * result + y;
result = prime * result + z;
return result;
}
public List<Point> neighbors8(){
List<Point> points = new ArrayList<Point>();
for (int ox = -1; ox < 2; ox++){
for (int oy = -1; oy < 2; oy++){
if (ox == 0 && oy == 0)
continue;
points.add(new Point(x+ox, y+oy, z));
}
}
Collections.shuffle(points);
return points;
}
} | [
"[email protected]"
] | |
38bb6fadc0617fdefcef487d4c899e3fb69064e1 | 9ada4297f71e1fed7d13c1c990748a8490878b91 | /src/main/java/com/plan/generator/app/Application.java | 449d6cab48c5aeeb33d4871fcb6b628921f56946 | [] | no_license | mareeskannanr/plan-generator | 8c8d8d6f0b447ed75ce27bc785402daa925db5ba | 152d04f85129f7529e9d56d3df19fce0037e84bd | refs/heads/master | 2020-09-22T06:08:11.901585 | 2019-12-01T09:03:12 | 2019-12-01T09:03:12 | 225,080,896 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.plan.generator.app;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"[email protected]"
] | |
e3def84b20c163dabeb1ed3d962ee0a94962bb66 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_608ecd667907988f1051555ef5c167cb70ddf450/CytobandPanel/7_608ecd667907988f1051555ef5c167cb70ddf450_CytobandPanel_t.java | 35c10d75a76895acbfb4bccdf9165862a2df909e | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,428 | java | /*
* Copyright (c) 2007-2011 by The Broad Institute of MIT and Harvard. All Rights Reserved.
*
* This software is licensed under the terms of the GNU Lesser General Public License (LGPL),
* Version 2.1 which is available at http://www.opensource.org/licenses/lgpl-2.1.php.
*
* THE SOFTWARE IS PROVIDED "AS IS." THE BROAD AND MIT MAKE NO REPRESENTATIONS OR
* WARRANTES OF ANY KIND CONCERNING THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, WHETHER
* OR NOT DISCOVERABLE. IN NO EVENT SHALL THE BROAD OR MIT, OR THEIR RESPECTIVE
* TRUSTEES, DIRECTORS, OFFICERS, EMPLOYEES, AND AFFILIATES BE LIABLE FOR ANY DAMAGES
* OF ANY KIND, INCLUDING, WITHOUT LIMITATION, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
* ECONOMIC DAMAGES OR INJURY TO PROPERTY AND LOST PROFITS, REGARDLESS OF WHETHER
* THE BROAD OR MIT SHALL BE ADVISED, SHALL HAVE OTHER REASON TO KNOW, OR IN FACT
* SHALL KNOW OF THE POSSIBILITY OF THE FOREGOING.
*/
/*
* LocationPanel.java
*
* Created on September 11, 2007, 2:29 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.broad.igv.ui.panel;
//~--- non-JDK imports --------------------------------------------------------
import org.broad.igv.Globals;
import org.broad.igv.feature.Chromosome;
import org.broad.igv.feature.Cytoband;
import org.broad.igv.renderer.CytobandRenderer;
import org.broad.igv.ui.FontManager;
import org.broad.igv.ui.WaitCursorManager;
import javax.swing.*;
import javax.swing.event.MouseInputAdapter;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.*;
import java.util.List;
/**
* @author jrobinso
*/
public class CytobandPanel extends JPanel {
private static int fontHeight = 10;
private static int bandHeight = 10;
private static String fontFamilyName = "Lucida Sans";
private boolean isDragging = false;
private double viewOrigin;
private double viewEnd;
double cytobandScale;
ReferenceFrame frame;
private Rectangle currentRegionRect;
private CytobandRenderer cytobandRenderer;
private List<Cytoband> currentCytobands;
public CytobandPanel(ReferenceFrame frame) {
this(frame, true);
}
public CytobandPanel(ReferenceFrame frame, boolean mouseable) {
this.frame = frame;
viewOrigin = frame.getOrigin();
viewEnd = frame.getEnd();
FontManager.getFont(fontHeight);
setFont(new Font(fontFamilyName, Font.BOLD, fontHeight));
if (mouseable) {
initMouseAdapter();
}
cytobandRenderer = (new CytobandRenderer());
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (frame.getChrName().equals(Globals.CHR_ALL) || getWidth() < 10) {
//Graphics g2 = g.create();
//g2.setFont(FontManager.getScalableFont(Font.ITALIC, 12));
//String text = "Whole genome view. To jump to a chromosome click on its label.";
//g2.drawString(text, 20, getHeight() - 5);
return;
}
int dataPanelWidth = frame.getWidthInPixels();
Rectangle cytoRect = new Rectangle(0, 10, dataPanelWidth, bandHeight);
Chromosome chromosome = getReferenceFrame().getChromosome();
if (chromosome == null) {
return;
}
currentCytobands = chromosome.getCytobands();
if (currentCytobands == null) {
return;
}
cytobandRenderer.draw(currentCytobands, g, cytoRect, frame);
int chromosomeLength = getReferenceFrame().getChromosomeLength();
cytobandScale = ((double) chromosomeLength) / dataPanelWidth;
// The test is true if we are zoomed in
if (getReferenceFrame().getZoom() > 0) {
double scale = getReferenceFrame().getScale();
double origin = isDragging ? viewOrigin : getReferenceFrame().getOrigin();
int start = (int) (origin / cytobandScale);
double scaledDataPanelWidth = dataPanelWidth * scale;
int span = (int) (scaledDataPanelWidth / cytobandScale);
// Draw Cytoband current region viewer
int height = (int) cytoRect.getHeight();
g.setColor(Color.RED);
int y = (int) (cytoRect.getY()) + CytobandRenderer.CYTOBAND_Y_OFFSET;
currentRegionRect = new Rectangle(start - 2, y, span + 4, height);
g.drawRect(start, y, span, height);
g.drawRect(start - 1, (y - 1), span + 2, height + 2);
g.drawRect(start - 2, (y - 2), span + 4, height + 4);
if (span < 2) {
g.drawRect(start - 2, (y - 2), span + 4, height + 4);
}
}
}
private void initMouseAdapter() {
setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
this.setToolTipText(
"<html>Click anywhere on the chromosome<br/>to center view at that location.");
MouseInputAdapter mouseAdapter = new MouseInputAdapter() {
int lastMousePressX;
public void mouseClicked(MouseEvent e) {
if(currentCytobands == null) return;
final int mouseX = e.getX();
final int clickCount = e.getClickCount();
WaitCursorManager.CursorToken token = WaitCursorManager.showWaitCursor();
try {
double newLocation = cytobandScale * mouseX;
if (clickCount > 1) {
final int newZoom = getReferenceFrame().getZoom() + 1;
getReferenceFrame().zoomTo(newZoom, newLocation);
} else {
getReferenceFrame().centerOnLocation(newLocation);
}
} finally {
WaitCursorManager.removeWaitCursor(token);
}
}
@Override
public void mousePressed(MouseEvent e) {
lastMousePressX = e.getX();
}
@Override
public void mouseReleased(MouseEvent e) {
if(currentCytobands == null) return;
if (isDragging) {
WaitCursorManager.CursorToken token = WaitCursorManager.showWaitCursor();
try {
getReferenceFrame().setOrigin(viewOrigin);
getReferenceFrame().recordHistory();
} finally {
WaitCursorManager.removeWaitCursor(token);
}
}
isDragging = false;
}
@Override
public void mouseDragged(MouseEvent e) {
if(currentCytobands == null) return;
if (!isDragging && (currentRegionRect != null && currentRegionRect.contains(e.getPoint()))) {
isDragging = true;
viewOrigin = getReferenceFrame().getOrigin();
}
int w = getWidth();
double scale = getReferenceFrame().getScale();
int x = (int) Math.max(0, Math.min(e.getX(), w * (cytobandScale - scale)));
int delta = x - lastMousePressX;
if ((delta != 0) && (cytobandScale > 0)) {
viewOrigin = Math.max(0, Math.min(viewOrigin + delta * cytobandScale, w * (cytobandScale - scale)));
repaint();
}
lastMousePressX = x;
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
};
addMouseMotionListener(mouseAdapter);
addMouseListener(mouseAdapter);
}
// TODO remove reference to IGV.theInstance
private ReferenceFrame getReferenceFrame() {
return frame;
}
}
| [
"[email protected]"
] | |
11a0b1c09b537b87ab32f8601f41095ce80fb0dd | 499648feb073eddf9a12fc5322dae7e6c8c92825 | /SGECapaPresentacion/src/sge/vista/JGenerarEnvioViewer.java | eb7043e9c32ee157904fb037d4ca381be13b359c | [] | no_license | mfarabollini/SGE | 6981a4df102417e39543aef4ed6fbf13f4b4184a | 5414622186c48d07477058c79dc2f16ef37daa58 | refs/heads/master | 2021-01-01T19:20:00.333913 | 2012-07-12T20:49:33 | 2012-07-12T20:49:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,409 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* JGenerarEnvioViewer.java
*
* Created on 26/05/2012, 20:11:17
*/
package sge.vista;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import javax.swing.Icon;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
/**
*
* @author Propietario
*/
public class JGenerarEnvioViewer extends javax.swing.JInternalFrame {
private JGenerarEnvioPresenter presenter= null;
private boolean multiplesLineas;
/** Creates new form JGenerarEnvioViewer */
public JGenerarEnvioViewer() {
initComponents();
Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
//obtenemos el tamaño de la ventana
Dimension ventana = this.getSize();
//para cntrar la ventana lo hacemos con el siguiente calculo
this.setLocation((pantalla.width - ventana.width) / 2, (pantalla.height - ventana.height) / 2);
presenter= new JGenerarEnvioPresenter(this);
this.jTable1.setModel(new LineaEnvioTableModel());
//String fecha = GregorianCalendar.getInstance().get(GregorianCalendar.DATE)+ "/" + GregorianCalendar.getInstance().get(GregorianCalendar.MONTH) + "/" + GregorianCalendar.getInstance().get(GregorianCalendar.YEAR);
SimpleDateFormat formatea = new SimpleDateFormat("dd/MM/yyyy");
this.txtFecha.setText(formatea.format(GregorianCalendar.getInstance().getTime()));
this.getTxtCodTransporte().requestFocus();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelPrincipal = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
txtCodCliente = new javax.swing.JTextField();
txtRazonSocialCli = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
txtNroFactura = new javax.swing.JTextField();
txtCantBultos = new javax.swing.JTextField();
cmdAgregar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
txtRazonSocial = new javax.swing.JTextField();
txtCodTransporte = new javax.swing.JTextField();
txtFecha = new javax.swing.JTextField();
lblFecha = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
cmdCancelar = new javax.swing.JButton();
cmdEnviar = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
setClosable(true);
setIconifiable(true);
setTitle("Generar envíos");
setName("GENENV"); // NOI18N
panelPrincipal.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jLabel2.setText("Cliente:");
txtCodCliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCodClienteActionPerformed(evt);
}
});
txtRazonSocialCli.setBackground(new java.awt.Color(255, 255, 204));
txtRazonSocialCli.setEditable(false);
jLabel3.setText("Nro. Factura:");
jLabel4.setText("Cant. bultos:");
txtNroFactura.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNroFacturaActionPerformed(evt);
}
});
txtNroFactura.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNroFacturaKeyTyped(evt);
}
});
txtCantBultos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCantBultosActionPerformed(evt);
}
});
cmdAgregar.setText("Agregar");
cmdAgregar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdAgregarActionPerformed(evt);
}
});
cmdAgregar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
cmdAgregarKeyTyped(evt);
}
});
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"Pos", "Cliente", "Nro. Factura", "Cant. bultos"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jTable1.setRowHeight(20);
jScrollPane1.setViewportView(jTable1);
txtRazonSocial.setBackground(new java.awt.Color(255, 255, 204));
txtRazonSocial.setEditable(false);
txtCodTransporte.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtCodTransporteActionPerformed(evt);
}
});
txtFecha.setMaximumSize(new java.awt.Dimension(10, 10));
txtFecha.setMinimumSize(new java.awt.Dimension(10, 10));
txtFecha.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtFechaActionPerformed(evt);
}
});
txtFecha.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtFechaKeyTyped(evt);
}
});
lblFecha.setText("Fecha:");
jLabel1.setText("Transporte:");
javax.swing.GroupLayout panelPrincipalLayout = new javax.swing.GroupLayout(panelPrincipal);
panelPrincipal.setLayout(panelPrincipalLayout);
panelPrincipalLayout.setHorizontalGroup(
panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPrincipalLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelPrincipalLayout.createSequentialGroup()
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblFecha)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(10, 10, 10)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCodTransporte, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)
.addComponent(txtCodCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 163, Short.MAX_VALUE)
.addComponent(txtCantBultos, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtNroFactura))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(cmdAgregar, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtRazonSocialCli, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtRazonSocial, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelPrincipalLayout.setVerticalGroup(
panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPrincipalLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblFecha)
.addComponent(txtFecha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtCodTransporte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtRazonSocial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)
.addComponent(txtRazonSocialCli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtNroFactura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtCantBultos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(cmdAgregar))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
cmdCancelar.setText("Cancelar");
cmdCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdCancelarActionPerformed(evt);
}
});
cmdEnviar.setText("Enviar");
cmdEnviar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cmdEnviarActionPerformed(evt);
}
});
cmdEnviar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
cmdEnviarKeyTyped(evt);
}
});
jButton3.setText("Salir");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(217, 217, 217)
.addComponent(cmdCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49)
.addComponent(cmdEnviar, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(panelPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(panelPrincipal, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cmdCancelar)
.addComponent(cmdEnviar))
.addComponent(jButton3))
.addContainerGap())
);
getAccessibleContext().setAccessibleParent(this);
pack();
}// </editor-fold>//GEN-END:initComponents
private void txtFechaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtFechaKeyTyped
char caracter = evt.getKeyChar();
if(txtFecha.getText().trim().length() > 9 ){
evt.consume(); // ignorar el evento de teclado
this.txtCodTransporte.requestFocus();
}
}
// TODO add your handling code here: char caracter = evt.getKeyChar(); if (txtFecha.getText().length() > 9) { evt.consume(); // ignorar el evento de teclado this.txtCodTransporte.requestFocus(); } }//GEN-LAST:event_txtFechaKeyTyped
private void txtCodTransporteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodTransporteActionPerformed
if(this.txtCodTransporte.getText().trim().length()>0){
this.getTxtRazonSocial().setText("");
presenter.getHandler().stateChanged(new ChangeEvent(this));
}
}
// TODO add your handling code here: this.txtRazonSocial.setText(""); presenter.getHandler().stateChanged(new ChangeEvent(this)); }//GEN-LAST:event_txtCodTransporteActionPerformed
private void txtCodClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodClienteActionPerformed
if(this.txtCodCliente.getText().trim().length()>0){
this.getTxtRazonSocialCli().setText("");
presenter.getClienteHandler().stateChanged(new ChangeEvent(this));
}
}
// TODO add your handling code here: this.txtRazonSocialCli.setText(""); presenter.getClienteHandler().stateChanged(new ChangeEvent(this)); }//GEN-LAST:event_txtCodClienteActionPerformed
private void txtNroFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNroFacturaActionPerformed
if(this.txtNroFactura.getText().trim().length()>0){
this.getTxtCantBultos().requestFocus();
}
}
// TODO add your handling code here: this.txtCantBultos.requestFocus(); }//GEN-LAST:event_txtNroFacturaActionPerformed
private void txtNroFacturaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNroFacturaKeyTyped
if(txtNroFactura.getText().length() > 12 ){
evt.consume(); // ignorar el evento de teclado
this.txtCantBultos.requestFocus();
}
}
// TODO add your handling code here: if (txtNroFactura.getText().length() > 12) { evt.consume(); // ignorar el evento de teclado this.txtCantBultos.requestFocus(); } }//GEN-LAST:event_txtNroFacturaKeyTyped
private void txtCantBultosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCantBultosActionPerformed
this.cmdAgregar.requestFocus();
}
// TODO add your handling code here: this.cmdAgregar.requestFocus(); }//GEN-LAST:event_txtCantBultosActionPerformed
private void cmdAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAgregarActionPerformed
Icon Icon = null;
if(this.jTable1.getModel().getRowCount()>0 && !this.multiplesLineas){
JOptionPane.showMessageDialog(this, "No se permiten multiples lineas para el envío", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.cmdEnviar.requestFocus();
return;
}
if(this.getTxtCodCliente().getText().trim().length()==0){
JOptionPane.showMessageDialog(this, "Debe seleccionar un cliente", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.getTxtCodCliente().requestFocus();
return;
}
if(this.getTxtNroFactura().getText().trim().length()==0 ){
JOptionPane.showMessageDialog(this, "Debe informar el n° de factura", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.getTxtNroFactura().requestFocus();
return;
}
if(this.getTxtCantBultos().getText().trim().length()==0){
JOptionPane.showMessageDialog(this, "Debe informar la cantidad de bultos", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.getTxtCantBultos().requestFocus();
return;
}
if(Integer.parseInt(this.getTxtCantBultos().getText())<=0){
JOptionPane.showMessageDialog(this, "La cantidad ingresada debe ser mayor que cero", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.getTxtCantBultos().requestFocus();
return;
}
presenter.getAgregarHandler().stateChanged(new ChangeEvent(this));
int rows = this.jTable1.getModel().getRowCount();
if(rows ==0){
return;
}
this.getTxtCodCliente().setText("");
this.getTxtRazonSocialCli().setText("");
this.getTxtNroFactura().setText("");
this.getTxtCantBultos().setText("");
if(!this.multiplesLineas){
this.cmdEnviar.requestFocus();
}else{
this.getTxtCodCliente().requestFocus();
}
}
// TODO add your handling code here: presenter.getAgregarHandler().stateChanged(new ChangeEvent(this)); this.txtCodCliente.setText(""); this.txtRazonSocialCli.setText(""); this.txtNroFactura.setText(""); this.txtCantBultos.setText(""); this.txtCodCliente.requestFocus(); }//GEN-LAST:event_cmdAgregarActionPerformed
private void cmdAgregarKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cmdAgregarKeyTyped
java.awt.event.ActionEvent evt2 = null;
this.cmdAgregarActionPerformed(evt2);
}
// TODO add your handling code here: java.awt.event.ActionEvent evt2 = null; this.cmdAgregarActionPerformed(evt2); }//GEN-LAST:event_cmdAgregarKeyTyped
private void cmdCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdCancelarActionPerformed
presenter.getCancelarHandler().stateChanged(new ChangeEvent(this));
this.getTxtCodTransporte().setText("");
this.txtRazonSocial.setText("");
this.txtCodCliente.setText("");
this.txtRazonSocialCli.setText("");
this.txtNroFactura.setText("");
this.txtCantBultos.setText("");
LineaEnvioTableModel aModel= (LineaEnvioTableModel) this.getjTable1().getModel();
aModel.limpiar();
this.getjTable1().addNotify();
this.txtCodTransporte.requestFocus();
}
// TODO add your handling code here: presenter.getCancelarHandler().stateChanged(new ChangeEvent(this)); this.getTxtCodTransporte().setText(""); this.getTxtRazonSocial().setText(""); this.getTxtCodCliente().setText(""); this.getTxtRazonSocialCli().setText(""); this.getTxtNroFactura().setText(""); this.getTxtCantBultos().setText(""); LineaEnvioTableModel aModel = (LineaEnvioTableModel) this.getjTable1().getModel(); aModel.limpiar(); this.getjTable1().addNotify(); }//GEN-LAST:event_cmdCancelarActionPerformed
private void cmdEnviarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdEnviarActionPerformed
Icon Icon = null;
if(this.txtRazonSocial.getText().trim().length()==0){
JOptionPane.showMessageDialog(this, "No há seleccionado el transporte/coomisionista, por favor hagalo", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
this.txtCodTransporte.requestFocus();
return;
}
int rows = this.jTable1.getModel().getRowCount();
if(rows ==0){
JOptionPane.showMessageDialog(this, "El envío debe tener al menos una fila", "Envios", JOptionPane.ERROR_MESSAGE, Icon);
return;
}
presenter.getEnviarHandler().stateChanged(new ChangeEvent(this));
}
// TODO add your handling code here: presenter.getEnviarHandler().stateChanged(new ChangeEvent(this)); }//GEN-LAST:event_cmdEnviarActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
this.dispose();
}
// TODO add your handling code here: System.exit(0); }//GEN-LAST:event_jButton3ActionPerformed
private void txtFechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtFechaActionPerformed
// TODO add your handling code here:
this.txtCodTransporte.requestFocus();
}//GEN-LAST:event_txtFechaActionPerformed
private void cmdEnviarKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_cmdEnviarKeyTyped
// TODO add your handling code here:
java.awt.event.ActionEvent evt2 = null;
this.cmdEnviarActionPerformed(evt2);
}//GEN-LAST:event_cmdEnviarKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cmdAgregar;
private javax.swing.JButton cmdCancelar;
private javax.swing.JButton cmdEnviar;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JLabel lblFecha;
private javax.swing.JPanel panelPrincipal;
private javax.swing.JTextField txtCantBultos;
private javax.swing.JTextField txtCodCliente;
private javax.swing.JTextField txtCodTransporte;
private javax.swing.JTextField txtFecha;
private javax.swing.JTextField txtNroFactura;
private javax.swing.JTextField txtRazonSocial;
private javax.swing.JTextField txtRazonSocialCli;
// End of variables declaration//GEN-END:variables
/**
* @return the jTable1
*/
public javax.swing.JTable getjTable1() {
return jTable1;
}
/**
* @return the txtCantBultos
*/
public javax.swing.JTextField getTxtCantBultos() {
return txtCantBultos;
}
/**
* @return the txtCodCliente
*/
public javax.swing.JTextField getTxtCodCliente() {
return txtCodCliente;
}
/**
* @return the txtCodTransporte
*/
public javax.swing.JTextField getTxtCodTransporte() {
return txtCodTransporte;
}
/**
* @return the txtFecha
*/
public javax.swing.JTextField getTxtFecha() {
return txtFecha;
}
/**
* @return the txtNroFactura
*/
public javax.swing.JTextField getTxtNroFactura() {
return txtNroFactura;
}
/**
* @return the txtRazonSocial
*/
public javax.swing.JTextField getTxtRazonSocial() {
return txtRazonSocial;
}
/**
* @return the txtRazonSocialCli
*/
public javax.swing.JTextField getTxtRazonSocialCli() {
return txtRazonSocialCli;
}
void notificarEnvio(boolean resultado) {
if(resultado){
Icon Icon = null;
JOptionPane.showMessageDialog(this, "Envio generado exitosamente", "Envios", JOptionPane.INFORMATION_MESSAGE, Icon);
this.getTxtCodTransporte().setText("");
this.getTxtRazonSocial().setText("");
this.getTxtCodCliente().setText("");
this.getTxtRazonSocialCli().setText("");
this.getTxtNroFactura().setText("");
this.getTxtCantBultos().setText("");
LineaEnvioTableModel aModel= (LineaEnvioTableModel) this.getjTable1().getModel();
aModel.limpiar();
this.getjTable1().addNotify();
this.getTxtCodTransporte().requestFocus();
}
}
void notificarException(Exception ex) {
Icon Icon = null;
JOptionPane.showMessageDialog(this, ex.toString(), "Envios", JOptionPane.ERROR_MESSAGE, Icon);
}
/**
* @return the multiplesLineas
*/
public boolean isMultiplesLineas() {
return multiplesLineas;
}
/**
* @param multiplesLineas the multiplesLineas to set
*/
public void setMultiplesLineas(boolean multiplesLineas) {
this.multiplesLineas = multiplesLineas;
}
void notificarMensaje(String mensaje, int tipoMensaje) {
Icon Icon = null;
JOptionPane.showMessageDialog(this, mensaje, "Envios", tipoMensaje, Icon);
}
}
| [
"[email protected]"
] | |
35d140f5e810ad249b95a7458c50caa93115b41a | b3742d2fa078f3d017a1d0d784d1ea01e5547d97 | /ppm-tool-fullstack/src/main/java/com/vignesh/ppmtool/domain/Backlog.java | 6fbe1df76e9ab27a534eddd559020883650c8f39 | [] | no_license | vignesh-ragavan/PPM-tool | be5d9cc91bf757a3bca8666d512911bf00d8891d | fc96d539bec02f15d99909eb88bbecbc37c761b3 | refs/heads/master | 2022-12-26T21:02:24.025858 | 2020-10-16T16:59:17 | 2020-10-16T16:59:17 | 299,874,232 | 0 | 0 | null | 2020-09-30T16:28:34 | 2020-09-30T09:43:04 | Java | UTF-8 | Java | false | false | 1,584 | java | package com.vignesh.ppmtool.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
public class Backlog {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private Integer PTSequence = 0;
private String projectIdentifier;
//OneToOne with project
@OneToOne(fetch = FetchType.EAGER)
@JoinColumn(name="project_id",nullable = false)
@JsonIgnore
private Project project;
@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER, mappedBy = "backlog", orphanRemoval = true)
private List<ProjectTask> projectTasks = new ArrayList<>();
public Backlog() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getPTSequence() {
return PTSequence;
}
public void setPTSequence(Integer PTSequence) {
this.PTSequence = PTSequence;
}
public String getProjectIdentifier() {
return projectIdentifier;
}
public void setProjectIdentifier(String projectIdentifier) {
this.projectIdentifier = projectIdentifier;
}
public Project getProject() {
return project;
}
public void setProject(Project project) {
this.project = project;
}
public List<ProjectTask> getProjectTasks() {
return projectTasks;
}
public void setProjectTasks(List<ProjectTask> projectTasks) {
this.projectTasks = projectTasks;
}
}
| [
"[email protected]"
] | |
ba1a6d27a4f01ab7e94333550c0d48c8afae2818 | e18d5df585afc0826dd1013f39ae4d8be312fa2a | /Association/attributes.java | 157d4c8814632ce7e435dea2f722cee1dca29b8e | [] | no_license | lwiskowski/dataMining | e96b5029e57f92f15e396cfbb4cb742bc81c21b3 | cf60da1597f2982e61da67401f7245014ae3f717 | refs/heads/master | 2021-01-20T17:19:50.309541 | 2016-07-10T23:40:45 | 2016-07-10T23:40:45 | 63,022,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 309 | java |
public class attributes {
String item;
String val1;
String val2;
public attributes(String[] array) {
item = array[0];
val1 = array[1];
val2 = array[2];
}
public String getItem() {
return item;
}
public String getVal1(){
return val1;
}
public String getVal2() {
return val2;
}
}
| [
"[email protected]"
] | |
6e6c7442281bef8a541beed6551c3a938f4adb9d | 6dc5efd0619dd48aba17b7f2dd33180d55c4c734 | /main/src/main/java/com/tepia/main/model/question/ProblemDetailBean.java | 68e3da532b928a225533e4b23c9184852e4a4335 | [] | no_license | smellHui/SKGJ_Android_Three | 2c9a2b3e7a7f6cd65117a1beb6daa16bfb38fc02 | 452d2ab97a6226303516a2079385a1536f4bf984 | refs/heads/master | 2020-12-02T04:15:51.268148 | 2019-12-27T10:00:22 | 2019-12-27T10:00:22 | 230,882,052 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,984 | java | package com.tepia.main.model.question;
import com.tepia.base.http.BaseResponse;
import java.io.Serializable;
import java.util.List;
/**
* 事件日志列表
* @author liying
*/
public class ProblemDetailBean extends BaseResponse{
/**
* data : {"problemId":"43a3e54c97634528b34df59b71905744","problemType":"1","problemTypeName":"巡检","reservoirId":"66fb3d579d084daf8a7d35d9d9612211","problemTitle":"2018-08-04事件上报测试","problemDescription":"2018-08-04事件上报测试","problemSource":"2","problemSourceUserId":"a623db0bdb92434ebe6553561aaf2eef","problemCofirmType":"2","problemStatus":"4","isMakePlan":"0","status":"0","createBy":"bozhou","createDate":"2018-08-04 14:23:35","updateBy":"bozhou","updateDate":"2018-08-04 14:23:35","reservoirName":"枫青水库","isVerify":"0","problemStatusName":"严重问题","iSysFileUploads":[{"fileId":"56ef954c4e4e4ca8894f273964c2bb01","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/56ef954c4e4e4ca8894f273964c2bb01.jpg"},{"fileId":"b43ef8a936334dacae31f9ff1f025998","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/b43ef8a936334dacae31f9ff1f025998.jpg"},{"fileId":"7f2cd31cc0c6433a8743d12312510903","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/7f2cd31cc0c6433a8743d12312510903.jpg"},{"fileId":"6327f5ca45af445cb23750cc4489c328","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/6327f5ca45af445cb23750cc4489c328.jpg"}],"bizProblemFlows":[{"id":"03ad024d0b464adf928c65ede00ed953","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","configOrder":3,"configOrderNm":"反馈","addTime":"2018-08-04 16:58:08","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteBeginTime":"2018-08-04 16:58:08","excuteEndTime":"2018-08-04 16:59:08","excuteDes":"反馈意见了","excuteStatus":2,"toExcuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","toExcuteUserNm":"播州区管理员"},{"id":"60519d3dcf0b4091b31785a636a0581e","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","configOrder":2,"configOrderNm":"业主审核","addTime":"2018-08-04 16:57:24","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"31ed81f394334e9a951990f04f5b2038","excuteRoleNn":"业主负责人","excuteEndTime":"2018-08-04 16:58:24","excuteStatus":2,"excuteDes":"业主来审核了"},{"id":"254a58440c014498abdfa3bba4375788","toExcuteRoleId":"31ed81f394334e9a951990f04f5b2038","toExcuteRoleNm":"业主负责人","toExcuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","toExcuteUserNm":"播州区管理员","configOrder":1,"configOrderNm":"审核事件","addTime":"2018-08-04 16:56:25","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteEndTime":"2018-08-04 16:57:25","excuteStatus":2,"excuteDes":"审核重大事件, 下一步业主审核"},{"id":"e124bcee34864640af670e93e342a5a7","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","toExcuteUserId":"","toExcuteUserNm":"","configOrder":0,"configOrderNm":"确认问题","addTime":"2018-08-04 16:55:40","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteBeginTime":"2018-08-04 16:55:40","excuteEndTime":"2018-08-04 16:56:40","excuteStatus":1}]}
*/
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean implements Serializable{
/**
* problemId : 43a3e54c97634528b34df59b71905744
* problemType : 1
* problemTypeName : 巡检
* reservoirId : 66fb3d579d084daf8a7d35d9d9612211
* problemTitle : 2018-08-04事件上报测试
* problemDescription : 2018-08-04事件上报测试
* problemSource : 2
* problemSourceUserId : a623db0bdb92434ebe6553561aaf2eef
* problemCofirmType : 2
* problemStatus : 4
* isMakePlan : 0
* status : 0
* createBy : bozhou
* createDate : 2018-08-04 14:23:35
* updateBy : bozhou
* updateDate : 2018-08-04 14:23:35
* reservoirName : 枫青水库
* isVerify : 0
* problemStatusName : 严重问题
* iSysFileUploads : [{"fileId":"56ef954c4e4e4ca8894f273964c2bb01","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/56ef954c4e4e4ca8894f273964c2bb01.jpg"},{"fileId":"b43ef8a936334dacae31f9ff1f025998","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/b43ef8a936334dacae31f9ff1f025998.jpg"},{"fileId":"7f2cd31cc0c6433a8743d12312510903","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/7f2cd31cc0c6433a8743d12312510903.jpg"},{"fileId":"6327f5ca45af445cb23750cc4489c328","bizKey":"43a3e54c97634528b34df59b71905744","filePath":"http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/6327f5ca45af445cb23750cc4489c328.jpg"}]
* bizProblemFlows : [{"id":"03ad024d0b464adf928c65ede00ed953","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","configOrder":3,"configOrderNm":"反馈","addTime":"2018-08-04 16:58:08","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteBeginTime":"2018-08-04 16:58:08","excuteEndTime":"2018-08-04 16:59:08","excuteDes":"反馈意见了"},{"id":"60519d3dcf0b4091b31785a636a0581e","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","configOrder":2,"configOrderNm":"业主审核","addTime":"2018-08-04 16:57:24","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"31ed81f394334e9a951990f04f5b2038","excuteRoleNn":"业主负责人","excuteEndTime":"2018-08-04 16:58:24","excuteStatus":2,"excuteDes":"业主来审核了"},{"id":"254a58440c014498abdfa3bba4375788","toExcuteRoleId":"31ed81f394334e9a951990f04f5b2038","toExcuteRoleNm":"业主负责人","toExcuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","toExcuteUserNm":"播州区管理员","configOrder":1,"configOrderNm":"审核事件","addTime":"2018-08-04 16:56:25","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteEndTime":"2018-08-04 16:57:25","excuteStatus":2,"excuteDes":"审核重大事件, 下一步业主审核"},{"id":"e124bcee34864640af670e93e342a5a7","toExcuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","toExcuteRoleNm":"运维中心主管","toExcuteUserId":"","toExcuteUserNm":"","configOrder":0,"configOrderNm":"确认问题","addTime":"2018-08-04 16:55:40","excuteUserId":"a4e0ea61ccf8428ba84e092af1a84dcd","excuteUserNm":"播州区管理员","excuteRoleId":"100891f9f67e4b3a9e46d6a980b146d7","excuteRoleNn":"运维中心主管","excuteBeginTime":"2018-08-04 16:55:40","excuteEndTime":"2018-08-04 16:56:40","excuteStatus":1}]
*/
private String problemId;
private String problemType;
private String problemTypeName;
private String reservoirId;
private String problemTitle;
private String problemDescription;
private String problemSource;
private String problemSourceUserId;
private String problemCofirmType;
private String problemStatus;
private String isMakePlan;
private String status;
private String createBy;
private String createDate;
private String updateBy;
private String updateDate;
private String reservoirName;
private String isVerify;
private String problemStatusName;
private String userName;
private String problemSourceUserName;
private List<ISysFileUploadsBean> iSysFileUploads;
private List<BizProblemFlowsBean> bizProblemFlows;
public String getProblemId() {
return problemId;
}
public void setProblemId(String problemId) {
this.problemId = problemId;
}
public String getProblemType() {
return problemType;
}
public void setProblemType(String problemType) {
this.problemType = problemType;
}
public String getProblemTypeName() {
return problemTypeName;
}
public void setProblemTypeName(String problemTypeName) {
this.problemTypeName = problemTypeName;
}
public String getReservoirId() {
return reservoirId;
}
public void setReservoirId(String reservoirId) {
this.reservoirId = reservoirId;
}
public String getProblemTitle() {
return problemTitle;
}
public void setProblemTitle(String problemTitle) {
this.problemTitle = problemTitle;
}
public String getProblemDescription() {
return problemDescription;
}
public void setProblemDescription(String problemDescription) {
this.problemDescription = problemDescription;
}
public String getProblemSource() {
return problemSource;
}
public void setProblemSource(String problemSource) {
this.problemSource = problemSource;
}
public String getProblemSourceUserId() {
return problemSourceUserId;
}
public void setProblemSourceUserId(String problemSourceUserId) {
this.problemSourceUserId = problemSourceUserId;
}
public String getProblemCofirmType() {
return problemCofirmType;
}
public void setProblemCofirmType(String problemCofirmType) {
this.problemCofirmType = problemCofirmType;
}
public String getProblemStatus() {
return problemStatus;
}
public void setProblemStatus(String problemStatus) {
this.problemStatus = problemStatus;
}
public String getIsMakePlan() {
return isMakePlan;
}
public void setIsMakePlan(String isMakePlan) {
this.isMakePlan = isMakePlan;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String updateDate) {
this.updateDate = updateDate;
}
public String getReservoirName() {
return reservoirName;
}
public void setReservoirName(String reservoirName) {
this.reservoirName = reservoirName;
}
public String getIsVerify() {
return isVerify;
}
public void setIsVerify(String isVerify) {
this.isVerify = isVerify;
}
public String getProblemStatusName() {
return problemStatusName;
}
public void setProblemStatusName(String problemStatusName) {
this.problemStatusName = problemStatusName;
}
public List<ISysFileUploadsBean> getISysFileUploads() {
return iSysFileUploads;
}
public void setISysFileUploads(List<ISysFileUploadsBean> iSysFileUploads) {
this.iSysFileUploads = iSysFileUploads;
}
public List<BizProblemFlowsBean> getBizProblemFlows() {
return bizProblemFlows;
}
public void setBizProblemFlows(List<BizProblemFlowsBean> bizProblemFlows) {
this.bizProblemFlows = bizProblemFlows;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getProblemSourceUserName() {
return problemSourceUserName;
}
public void setProblemSourceUserName(String problemSourceUserName) {
this.problemSourceUserName = problemSourceUserName;
}
public List<ISysFileUploadsBean> getiSysFileUploads() {
return iSysFileUploads;
}
public void setiSysFileUploads(List<ISysFileUploadsBean> iSysFileUploads) {
this.iSysFileUploads = iSysFileUploads;
}
public static class ISysFileUploadsBean {
/**
* fileId : 56ef954c4e4e4ca8894f273964c2bb01
* bizKey : 43a3e54c97634528b34df59b71905744
* filePath : http://tepia-test-2018.oss-cn-beijing.aliyuncs.com/APP/Problem/2018-08/04/56ef954c4e4e4ca8894f273964c2bb01.jpg
*/
private String fileId;
private String bizKey;
private String filePath;
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
public String getBizKey() {
return bizKey;
}
public void setBizKey(String bizKey) {
this.bizKey = bizKey;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
}
public static class BizProblemFlowsBean {
/**
* id : 03ad024d0b464adf928c65ede00ed953
* toExcuteRoleId : 100891f9f67e4b3a9e46d6a980b146d7
* toExcuteRoleNm : 运维中心主管
* configOrder : 3
* configOrderNm : 反馈
* addTime : 2018-08-04 16:58:08
* excuteUserId : a4e0ea61ccf8428ba84e092af1a84dcd
* excuteUserNm : 播州区管理员
* excuteRoleId : 100891f9f67e4b3a9e46d6a980b146d7
* excuteRoleNn : 运维中心主管
* excuteBeginTime : 2018-08-04 16:58:08
* excuteEndTime : 2018-08-04 16:59:08
* excuteDes : 反馈意见了
* excuteStatus : 2
* toExcuteUserId : a4e0ea61ccf8428ba84e092af1a84dcd
* toExcuteUserNm : 播州区管理员
*/
private String id;
private String toExcuteRoleId;
private String toExcuteRoleNm;
private int configOrder;
private String configOrderNm;
private String addTime;
private String excuteUserId;
private String excuteUserNm;
private String excuteRoleId;
private String excuteRoleNn;
private String excuteBeginTime;
private String excuteEndTime;
private String excuteDes;
private Integer excuteStatus;
private String toExcuteUserId;
private String toExcuteUserNm;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getToExcuteRoleId() {
return toExcuteRoleId;
}
public void setToExcuteRoleId(String toExcuteRoleId) {
this.toExcuteRoleId = toExcuteRoleId;
}
public String getToExcuteRoleNm() {
return toExcuteRoleNm;
}
public void setToExcuteRoleNm(String toExcuteRoleNm) {
this.toExcuteRoleNm = toExcuteRoleNm;
}
public int getConfigOrder() {
return configOrder;
}
public void setConfigOrder(int configOrder) {
this.configOrder = configOrder;
}
public String getConfigOrderNm() {
return configOrderNm;
}
public void setConfigOrderNm(String configOrderNm) {
this.configOrderNm = configOrderNm;
}
public String getAddTime() {
return addTime;
}
public void setAddTime(String addTime) {
this.addTime = addTime;
}
public String getExcuteUserId() {
return excuteUserId;
}
public void setExcuteUserId(String excuteUserId) {
this.excuteUserId = excuteUserId;
}
public String getExcuteUserNm() {
return excuteUserNm;
}
public void setExcuteUserNm(String excuteUserNm) {
this.excuteUserNm = excuteUserNm;
}
public String getExcuteRoleId() {
return excuteRoleId;
}
public void setExcuteRoleId(String excuteRoleId) {
this.excuteRoleId = excuteRoleId;
}
public String getExcuteRoleNn() {
return excuteRoleNn;
}
public void setExcuteRoleNn(String excuteRoleNn) {
this.excuteRoleNn = excuteRoleNn;
}
public String getExcuteBeginTime() {
return excuteBeginTime;
}
public void setExcuteBeginTime(String excuteBeginTime) {
this.excuteBeginTime = excuteBeginTime;
}
public String getExcuteEndTime() {
return excuteEndTime;
}
public void setExcuteEndTime(String excuteEndTime) {
this.excuteEndTime = excuteEndTime;
}
public String getExcuteDes() {
return excuteDes;
}
public void setExcuteDes(String excuteDes) {
this.excuteDes = excuteDes;
}
public Integer getExcuteStatus() {
return excuteStatus;
}
public void setExcuteStatus(int excuteStatus) {
this.excuteStatus = excuteStatus;
}
public String getToExcuteUserId() {
return toExcuteUserId;
}
public void setToExcuteUserId(String toExcuteUserId) {
this.toExcuteUserId = toExcuteUserId;
}
public String getToExcuteUserNm() {
return toExcuteUserNm;
}
public void setToExcuteUserNm(String toExcuteUserNm) {
this.toExcuteUserNm = toExcuteUserNm;
}
}
}
}
| [
"[email protected]"
] | |
a0f6ba65636607b4bb76cb8672b2cd0c8f1e196d | 5d363e56fec24e4b317fb6a36b86d3ab4174341d | /src/main/java/com/alexandre/cursomc/resources/ProdutoResource.java | 47797519105f7a672100b565cdc0fc726a9f57ec | [] | no_license | Alexandre-Azvdo/UdemyCursoSpringBoot-BackEnd | 98e9b9c2d171c0732086800836b1cf5a3223d6a2 | e7b1d886ce315b33a4314beceb72defadc916cc5 | refs/heads/master | 2021-01-01T01:43:05.601629 | 2020-03-16T14:39:26 | 2020-03-16T14:39:26 | 239,126,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,900 | java | package com.alexandre.cursomc.resources;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alexandre.cursomc.domain.Produto;
import com.alexandre.cursomc.dto.ProdutoDTO;
import com.alexandre.cursomc.resources.utils.URL;
import com.alexandre.cursomc.services.ProdutoService;
@RestController
@RequestMapping(value="/produtos")
public class ProdutoResource {
@Autowired
private ProdutoService service;
@RequestMapping(value="/{id}", method = RequestMethod.GET)
public ResponseEntity<Produto> find(@PathVariable Integer id) {
Produto obj = service.find(id);
return ResponseEntity.ok().body(obj);
}
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Page<ProdutoDTO>> findPage(
@RequestParam(value="nome", defaultValue="") String nome,
@RequestParam(value="categorias", defaultValue="") String categorias,
@RequestParam(value="page", defaultValue="0") Integer page,
@RequestParam(value="linesPerPage", defaultValue="24") Integer linesPerPage,
@RequestParam(value="orderBy", defaultValue="nome") String orderBy,
@RequestParam(value="direction", defaultValue="ASC") String direction) {
String nomeDecoded = URL.decodeParam(nome);
List<Integer> ids = URL.decodeIntList(categorias);
Page<Produto> list = service.search(nomeDecoded, ids, page, linesPerPage, orderBy, direction);
Page<ProdutoDTO> listDto = list.map(obj -> new ProdutoDTO(obj));
return ResponseEntity.ok().body(listDto);
}
}
| [
"[email protected]"
] | |
30534aef512c018590f156daf8cedf1e56871527 | bb6ebff7a7f6140903d37905c350954ff6599091 | /third_party/libaddressinput/src/java/src/com/android/i18n/addressinput/SimpleClientCacheManager.java | c8943ea9717ffba00f32fa154f9e3286687e246e | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"BSD-3-Clause"
] | permissive | PDi-Communication-Systems-Inc/lollipop_external_chromium_org | faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f | ccadf4e63dd34be157281f53fe213d09a8c66d2c | refs/heads/master | 2022-12-23T18:07:04.568931 | 2016-04-11T16:03:36 | 2016-04-11T16:03:36 | 53,677,925 | 0 | 1 | BSD-3-Clause | 2022-12-09T23:46:46 | 2016-03-11T15:49:07 | C++ | UTF-8 | Java | false | false | 1,185 | java | /*
* Copyright (C) 2010 Google Inc.
*
* 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.android.i18n.addressinput;
/**
* A simple implementation of ClientCacheManager which doesn't do any caching on its own.
*/
public class SimpleClientCacheManager implements ClientCacheManager {
// URL to get public address data.
private static final String PUBLIC_ADDRESS_SERVER = "http://i18napis.appspot.com/address";
@Override
public String get(String key) {
return "";
}
@Override
public void put(String key, String data) {
}
@Override
public String getAddressServerUrl() {
return PUBLIC_ADDRESS_SERVER;
}
}
| [
"[email protected]"
] | |
e80682d691eb115b139331a8e4e679181dc8460b | 16bf8b477125bacf5690536a247004772f583160 | /MESSpringGateWay/src/main/java/com/delta/mes/gateway/entity/APIAuthorityEntity.java | 72a8b08239d9f73ec053be9a99657448cc336020 | [] | no_license | zhuohao1986/springcloud | db67e3bfcf7f5bf76f53fbf760dcd5641fd9580a | a5f9f7f8baba7489e7fd6dd43944680ad79056ed | refs/heads/master | 2020-09-05T00:42:30.569211 | 2019-08-02T07:52:29 | 2019-08-02T07:52:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | package com.delta.mes.gateway.entity;
import com.delta.mes.annotation.DataBaseColumnSetting;
public class APIAuthorityEntity {
@DataBaseColumnSetting(columnName="api_path_name")
private String apiPath;
@DataBaseColumnSetting(columnName="auth_validate_flag")
private String validFlag;
@DataBaseColumnSetting(columnName="request_method")
private String reqMethod;
@DataBaseColumnSetting(columnName="controller")
private String controllerName;
@DataBaseColumnSetting(columnName="interval")
private Integer interval;
public String getApiPath() {
return apiPath;
}
public void setApiPath(String apiPath) {
this.apiPath = apiPath;
}
public String getValidFlag() {
return validFlag;
}
public void setValidFlag(String validFlag) {
this.validFlag = validFlag;
}
public String getReqMethod() {
return reqMethod;
}
public void setReqMethod(String reqMethod) {
this.reqMethod = reqMethod;
}
public String getControllerName() {
return controllerName;
}
public void setControllerName(String controllerName) {
this.controllerName = controllerName;
}
public Integer getInterval() {
return interval;
}
public void setInterval(Integer interval) {
this.interval = interval;
}
}
| [
"[email protected]"
] | |
004e13e29b0d5cf620711243d1d87c2a85e5e0b2 | 4ce48632ae070fd95b78bb37e77c5d39069029b2 | /app/src/main/java/com/jkuhail/groupchat/MainActivity.java | bead91e6f33430c63b55cdf98c7bf58f1e976c79 | [] | no_license | JKuhail/Real-time-chat-group | c171a7e537675bae5aebd30f0ae67c9f22b4c478 | 2b4dde5b62b9cc96b15934d01102fb514ac5b8ec | refs/heads/master | 2022-07-17T01:03:47.498552 | 2020-05-15T20:38:45 | 2020-05-15T20:38:45 | 264,280,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,024 | java | package com.jkuhail.groupchat;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.scaledrone.lib.Listener;
import com.scaledrone.lib.Room;
import com.scaledrone.lib.RoomListener;
import com.scaledrone.lib.Scaledrone;
import java.util.Random;
public class MainActivity extends AppCompatActivity implements RoomListener {
private String channelID = "spGA6s3lzZ9ZBbvO";
private String roomName = "observable-group-chat-room";
private EditText editText;
private Scaledrone scaledrone;
private MessageAdapter messageAdapter;
private ListView messagesView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// This is where we write the message
editText = findViewById(R.id.editText);
messageAdapter = new MessageAdapter(this);
messagesView = findViewById(R.id.messages_view);
messagesView.setAdapter(messageAdapter);
MemberData data = new MemberData(getRandomName(), getRandomColor());
scaledrone = new Scaledrone(channelID, data);
scaledrone.connect(new Listener() {
// Successfully connected to Scaledrone room
@Override
public void onOpen() {
System.err.println("Group chat connection open");
// Since the MainActivity itself already implement RoomListener we can pass it as a target
scaledrone.subscribe(roomName, MainActivity.this);
}
// Connecting to Scaledrone room failed
@Override
public void onOpenFailure(Exception ex) {
System.err.println(ex);
}
@Override
public void onFailure(Exception ex) {
System.err.println(ex);
}
@Override
public void onClosed(String reason) {
System.err.println(reason);
}
});
}
public void sendMessage(View view) {
String message = editText.getText().toString();
if (message.length() > 0) {
scaledrone.publish(roomName, message);
editText.getText().clear();
}
}
@Override
public void onOpen(Room room) {
System.err.println("Connected to room");
}
@Override
public void onOpenFailure(Room room, Exception ex) {
System.err.println(ex);
}
@Override
public void onMessage(Room room, com.scaledrone.lib.Message receivedMessage) {
final ObjectMapper mapper = new ObjectMapper();
try {
final MemberData data = mapper.treeToValue(receivedMessage.getMember().getClientData(), MemberData.class);
boolean belongsToCurrentUser = receivedMessage.getClientID().equals(scaledrone.getClientID());
final Message message = new Message(receivedMessage.getData().asText(), data, belongsToCurrentUser);
runOnUiThread(new Runnable() {
@Override
public void run() {
messageAdapter.add(message);
messagesView.setSelection(messagesView.getCount() - 1);
}
});
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
private String getRandomName() {
String[] adjs = {"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark", "summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter", "patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue", "billowing", "broken", "cold", "damp", "falling", "frosty", "green", "long", "late", "lingering", "bold", "little", "morning", "muddy", "old", "red", "rough", "still", "small", "sparkling", "throbbing", "shy", "wandering", "withered", "wild", "black", "young", "holy", "solitary", "fragrant", "aged", "snowy", "proud", "floral", "restless", "divine", "polished", "ancient", "purple", "lively", "nameless"};
String[] nouns = {"waterfall", "river", "breeze", "moon", "rain", "wind", "sea", "morning", "snow", "lake", "sunset", "pine", "shadow", "leaf", "dawn", "glitter", "forest", "hill", "cloud", "meadow", "sun", "glade", "bird", "brook", "butterfly", "bush", "dew", "dust", "field", "fire", "flower", "firefly", "feather", "grass", "haze", "mountain", "night", "pond", "darkness", "snowflake", "silence", "sound", "sky", "shape", "surf", "thunder", "violet", "water", "wildflower", "wave", "water", "resonance", "sun", "wood", "dream", "cherry", "tree", "fog", "frost", "voice", "paper", "frog", "smoke", "star"};
return (
adjs[(int) Math.floor(Math.random() * adjs.length)] +
"_" +
nouns[(int) Math.floor(Math.random() * nouns.length)]
);
}
private String getRandomColor() {
Random r = new Random();
StringBuffer sb = new StringBuffer("#");
while(sb.length() < 7){
sb.append(Integer.toHexString(r.nextInt()));
}
return sb.toString().substring(0, 7);
}
}
class MemberData {
private String name;
private String color;
public MemberData(String name, String color) {
this.name = name;
this.color = color;
}
// Add an empty constructor so we can later parse JSON into MemberData using Jackson
public MemberData() {
}
public String getName() {
return name;
}
public String getColor() {
return color;
}
@Override
public String toString() {
return "MemberData{" +
"name='" + name + '\'' +
", color='" + color + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
408985444e04ae7137ffd4ce7dce18b307b50fc3 | b8d64efb21fd4b3e6181eb5869d655895a75dfc6 | /src/main/java/hpe/App.java | 73bd02f68980df6a3caf69a5dd50b1db8ad7e619 | [] | no_license | premprs1/newproject | 092991dec9007bdfabadecfe6070eb377518e37a | 091436c131a927e7ab4527b5a4aa75dcd90114ed | refs/heads/master | 2021-04-29T22:12:56.751141 | 2018-03-06T23:11:34 | 2018-03-06T23:11:34 | 121,634,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | package hpe;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"[email protected]"
] | |
d1058f0f99232dd7513e550332be21f6e47c56e7 | a04c05522de846cb151f0787eef8aa4b0a85cebb | /cablePortal/src/com/cablevision/util/ValidateErrors.java | f96080f33b13f9aa140ea756f50f9abd74c5f919 | [] | no_license | Diana23/Portal-Web | 859fb5577d6c8d0c2ca3358d4dbbd56576eb9fd7 | 57a61aa5f40b6fc8e234b06cc6b76657aabbdb1a | refs/heads/master | 2016-09-16T09:58:17.363856 | 2011-12-05T19:40:47 | 2011-12-05T19:40:47 | 1,455,679 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.cablevision.util;
import org.apache.beehive.netui.util.logging.Logger;
import org.apache.struts.util.MessageResources;
import com.cablevision.portal.ErrorVitriaException;
/**
* Clase para obtener el mensaje de error dependiendo del coidigo de error en vitria
* @author Daniela G
*
*/
public class ValidateErrors{
private static final long serialVersionUID = 1L;
private static final Logger _log = Logger.getInstance( ValidateErrors.class );
public static void validateErrorResponse(Error error, MessageResources bundle) throws ErrorVitriaException{
if(containsErrors(error) && bundle != null){
_log.error("Error en Vitria: "+error.getCvErrorMessage());
String keyError = "error."+error.getCvErrorCode().replaceAll("\\n", "")+".mensaje";
String mensajeError = bundle.getMessage(keyError);
if(mensajeError== null){
mensajeError = bundle.getMessage("error.default.mensaje");
}
throw new ErrorVitriaException(mensajeError);
}
}
public static boolean containsErrors(Error error){
if(error!=null && error.getCvErrorCode()!= null && !error.getCvErrorCode().equals("")
&& !error.getCvErrorCode().equals("0")){
return true;
}
return false;
}
}
| [
"[email protected]"
] | |
f7d57634a741a67a64c736728becfb3f2a723af8 | 01ace8017bef8e96b15dcc4b67ecbdbcb3ff732d | /community-common/common-payment-service/src/main/java/com/qding/common/payment/service/impl/PosPaymentServiceImpl.java | 1b931f0c0653346d31999b73dbff1770f8bf1b40 | [] | no_license | huokedu/wx | 8c64e8175f637a3ed62434a1e1f3e14ced160268 | 9de077cc6b3415cddece0578279ffeea2b634b19 | refs/heads/master | 2020-05-21T00:34:57.066879 | 2014-07-21T05:33:03 | 2014-07-21T05:33:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,193 | java | package com.qding.common.payment.service.impl;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import org.osoa.sca.annotations.Remotable;
import com.qding.common.payment.model.PosPayment;
import com.qding.common.payment.service.PosPaymentService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.gemantic.common.exception.ServiceDaoException;
import com.gemantic.common.exception.ServiceException;
import com.gemantic.dal.dao.Dao;
import com.gemantic.dal.dao.exception.DaoException;
import com.qding.common.dao.base.service.impl.BaseDaoServiceImpl;
public class PosPaymentServiceImpl extends BaseDaoServiceImpl implements PosPaymentService {
private static final Log log = LogFactory.getLog(PosPaymentServiceImpl.class);
@Override
public Long insert(PosPayment posPayment)throws ServiceException, ServiceDaoException{
log.info(" insert data : " + posPayment);
if (posPayment == null) {
return null;
}
long currentTimeMillis = System.currentTimeMillis();
posPayment.setCreateAt(currentTimeMillis);
posPayment.setUpdateAt(currentTimeMillis);
Long result = null;
try {
result = (Long) dao.save(posPayment);
} catch (DaoException e) {
log.error(" insert wrong : " + posPayment);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" insert data success : " + result);
return result;
}
@Override
public List<PosPayment> insertList(List<PosPayment> posPaymentList)throws ServiceException, ServiceDaoException{
log.info(" insert lists : " + (posPaymentList == null ? "null" : posPaymentList.size()));
List<PosPayment> resultList = null;
if (CollectionUtils.isEmpty(posPaymentList)) {
return new ArrayList<PosPayment>();
}
long currentTimeMillis = System.currentTimeMillis();
for (PosPayment posPayment : posPaymentList) {
posPayment.setCreateAt(currentTimeMillis);
posPayment.setUpdateAt(currentTimeMillis);
}
try {
resultList = (List<PosPayment>) dao.batchSave(posPaymentList);
} catch (DaoException e) {
log.error(" insert list wrong : " + posPaymentList);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" insert lists success : " + (resultList == null ? "null" : resultList.size()));
return resultList;
}
@Override
public boolean delete(Long id)throws ServiceException, ServiceDaoException{
log.info(" delete data : " + id);
boolean result = false;
if (id == null) {
return true;
}
try {
result = dao.delete(PosPayment.class, id);
} catch (DaoException e) {
log.error(" delete wrong : " + id);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" delete data success : " + id);
return result;
}
@Override
public boolean update(PosPayment posPayment)throws ServiceException, ServiceDaoException{
log.info(" update data : " + (posPayment == null ? "null" : posPayment.getId()));
boolean result = false;
if (posPayment == null) {
return true;
}
posPayment.setUpdateAt(System.currentTimeMillis());
try {
result = dao.update(posPayment);
} catch (DaoException e) {
log.error(" update wrong : " + posPayment);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if(log.isInfoEnabled()){
log.info(" update data success : " + posPayment);
}
return result;
}
@Override
public boolean updateList(List<PosPayment> posPaymentList)throws ServiceException, ServiceDaoException{
log.info(" update lists : " + (posPaymentList == null ? "null" : posPaymentList.size()));
boolean result = false;
if (CollectionUtils.isEmpty(posPaymentList)) {
return true;
}
long currentTimeMillis = System.currentTimeMillis();
for (PosPayment posPayment : posPaymentList) {
posPayment.setUpdateAt(currentTimeMillis);
}
try {
result = dao.batchUpdate(posPaymentList);
} catch (DaoException e) {
log.error(" update list wrong : " + posPaymentList);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" update lists success : " + posPaymentList.size());
return result;
}
@Override
public PosPayment getObjectById(Long id)throws ServiceException, ServiceDaoException{
log.info(" get data : " + id);
PosPayment posPayment = null;
if (id == null) {
return posPayment;
}
try {
posPayment = (PosPayment) dao.get(PosPayment.class, id);
} catch (DaoException e) {
log.error(" get wrong : " + id);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" get data success : " + id);
return posPayment;
}
@Override
public List<PosPayment> getObjectsByIds(List<Long> ids)throws ServiceException, ServiceDaoException{
log.info(" get lists : " + (ids == null ? "null" : ids));
List<PosPayment> posPayment = null;
if (CollectionUtils.isEmpty(ids)) {
return new ArrayList<PosPayment>();
}
try {
posPayment = (List<PosPayment>) dao.getList(PosPayment.class, ids);
} catch (DaoException e) {
log.error(" get wrong : " + ids);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
log.info(" get data success : " + (posPayment == null ? "null" : posPayment.size()));
return posPayment;
}
/**
*
* @param
* @return
* @throws ServiceException
* @throws ServiceDaoException
*/
@Override
public List<Long> getPosPaymentIdsByGorderCode(String gorderCode,Integer start,Integer limit)throws ServiceException, ServiceDaoException{
if(log.isInfoEnabled()){
log.info(" get ids by gorderCode,start,limit : " + gorderCode+" , "+start+" , "+limit );
}
List<Long> idList = null;
// TODO 参数检查!
if (start == null) {
start = 0;
}
if (limit == null) {
limit = Integer.MAX_VALUE;
}
try {
idList = dao.getIdList("getPosPaymentIdsByGorderCode", new Object[] { gorderCode},start,limit, false);
} catch (DaoException e) {
log.error(" get ids wrong by gorderCode,start,limit) : " + gorderCode+" , "+start+" , "+limit );
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if(log.isInfoEnabled()){
log.info(" get ids success : " + (idList == null ? "null" : idList.size()));
}
return idList;
}
/**
*
* @param
* @return
* @throws ServiceException
* @throws ServiceDaoException
*/
@Override
public Long getPosPaymentIdByGorderCodeAndQdCode(String gorderCode,String qdCode)throws ServiceException, ServiceDaoException{
if(log.isInfoEnabled()){
log.info(" get id by gorderCode,qdCode : " + gorderCode+" , "+qdCode );
}
Long id = null;
// TODO 参数检查!
try {
id = (Long) dao.getMapping("getPosPaymentIdByGorderCodeAndQdCode", new Object[] {gorderCode,qdCode });
} catch (DaoException e) {
log.error(" get id wrong by gorderCode,qdCode : " + gorderCode+" , "+qdCode );
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if(log.isInfoEnabled()){
log.info(" get id success : " + id);
}
return id;
}
/**
*
* @param
* @return
* @throws ServiceException
* @throws ServiceDaoException
*/
@Override
public Integer countPosPaymentIdsByGorderCode(String gorderCode)throws ServiceException, ServiceDaoException{
if(log.isInfoEnabled()){
log.info(" count ids by gorderCode : " + gorderCode );
}
Integer count=null;
try {
count = dao.count("getPosPaymentIdsByGorderCode", new Object[] { gorderCode});
} catch (DaoException e) {
log.error(" count ids wrong by gorderCode) : " + gorderCode );
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if(log.isInfoEnabled()){
log.info(" count success : " + count);
}
return count;
}
@Override
public List<Long> getPosPaymentIds(Integer start, Integer limit)
throws ServiceException, ServiceDaoException {
log.info(" get ids by start,limit ================== " + start + " , " + limit);
List<Long> idList = null;
if (start == null) {
start = 0;
}
if (limit == null) {
limit = Integer.MAX_VALUE;
}
try {
idList = dao.getIdList("getPosPaymentIdsAll",new Object[] {},start, limit, false);
} catch (DaoException e) {
log.error(" get ids wrong by start,limit) : " + start + " , " + limit);
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if (log.isInfoEnabled()) {
log.info(" get ids success == : " + (idList == null ? "null" : idList.size()));
}
return idList;
}
@Override
public Integer countPosPaymentIds() throws ServiceException,
ServiceDaoException {
Integer count = 0;
try {
count = dao.count("getPosPaymentIdsAll",new Object[] {});
} catch (DaoException e) {
log.error(" count by getPosPaymentIds " ) ;
log.error(e);
e.printStackTrace();
throw new ServiceDaoException(e);
}
if (log.isInfoEnabled()) {
log.info(" count : " + count);
}
return count;
}
}
| [
"[email protected]"
] | |
1a74a15715969e807d89ff0f0c04d106dec91809 | 04d133c4ec6328ec2b7066526d2b1105e0f9e7c8 | /src/main/java/lab4_20227250_SalgadoEspinoza_modelo/usuario.java | 9283c6d8ffca7d27bb1f7dfdd5e01f7f500a36c8 | [] | no_license | dyllansalgado/lab4_20227250_SalgadoEspinoza | f5e57871ef7ad2a1ce28e01a75ebbee961bdf615 | 929960a4b2a940751b64262a5028f1690f4c7e4b | refs/heads/main | 2023-03-12T17:17:42.370961 | 2021-03-05T01:05:16 | 2021-03-05T01:05:16 | 340,175,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | java | package lab4_20227250_SalgadoEspinoza_modelo;
/**
* Una clase para representar al usuario.
* Se utiliza esta clase para representar a los usuarios.
* Los atributos de la clase es nombreUsuario, claveUsuario y reputacionUsuario.
* @author Dyllan Salgado
*/
public class usuario {
//Atributos de usuario.
String nombreUsuario;
String claveUsuario;
int reputacionUsuario;
//Constructor de la clase usuario
public usuario(String nombreUsuario, String claveUsuario) {
setClaveUsuario(claveUsuario);
setNombreUsuario(nombreUsuario);
}
//Constructor de la clase usuario
public usuario(String nombreUsuario, String claveUsuario,int rep) {
setClaveUsuario(claveUsuario);
setNombreUsuario(nombreUsuario);
this.reputacionUsuario = rep;
}
//Selectores de la clase usuario
public String getNombreUsuario() {
return nombreUsuario;
}
public String getClaveUsuario() {
return claveUsuario;
}
public int getReputacionUsuario() {
return reputacionUsuario;
}
//Modificadores de la clase usuario
public void setNombreUsuario(String nombreUsuario) {
this.nombreUsuario = nombreUsuario;
}
public void setClaveUsuario(String claveUsuario) {
this.claveUsuario = claveUsuario;
}
public void setReputacionUsuario(int reputacionUsuario) {
this.reputacionUsuario = reputacionUsuario;
}
}
| [
"[email protected]"
] | |
33c976129e1ce4aafb6cd5efcbdfcb1230bc2c10 | c7a85eb9bc747dfde2c9335a308937ce62395ad9 | /src/source/iObserver.java | 7f969f9c3bb5334362bd87d726cae84cb2c7db36 | [] | no_license | rtpatten/SOFT252CW | 4f4706a718cab47d11a351de17b3ce784ead066d | f8f549811b5a4b896433a6c76733522e409748fa | refs/heads/master | 2020-12-06T07:27:52.836644 | 2020-01-14T15:52:21 | 2020-01-14T15:52:21 | 232,389,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49 | java | package source;
public interface iObserver {
}
| [
"[email protected]"
] | |
5299f27cf9fce3b974b61151d31097d1d0f0b39d | 26b7f30c6640b8017a06786e4a2414ad8a4d71dd | /src/number_of_direct_superinterfaces/i2630.java | d85165f122b381205ed7df4cedaedf9328a56c8c | [] | no_license | vincentclee/jvm-limits | b72a2f2dcc18caa458f1e77924221d585f23316b | 2fd1c26d1f7984ea8163bc103ad14b6d72282281 | refs/heads/master | 2020-05-18T11:18:41.711400 | 2014-09-14T04:25:18 | 2014-09-14T04:25:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package number_of_direct_superinterfaces;
public interface i2630 {} | [
"[email protected]"
] | |
d42ce7229b1fac090dbbf80c913170ce29d90668 | 3c8ba661bbb4e4b93f05e9e1a03d0f6fa0930a42 | /src/net/Handler.java | 62ad2fe86caffb5f07633dc7ce26fdd8c96befe5 | [] | no_license | alifa98/Potatofy | adc949e2c60d09ea7f9b732dbd76f38b1ca07d28 | ad5d1ba46aa6d245f5dc6a852b0ca5aed3884cab | refs/heads/master | 2021-09-08T18:20:50.793860 | 2021-08-27T14:37:41 | 2021-08-27T14:37:41 | 195,443,051 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,190 | java | package net;
import java.io.*;
import java.net.Socket;
public class Handler implements Runnable {
private Socket client;
private DataInputStream in;
private DataOutputStream out;
public Handler(Socket client) {
this.client = client;
}
public void run() {
try {
out = new DataOutputStream(new BufferedOutputStream(client.getOutputStream()));
in = new DataInputStream(new BufferedInputStream(client.getInputStream()));
while (true) {
System.out.println("one handler is waiting for client request . . .");
String msg = in.readUTF();
if (msg.equals("Close")) {
System.out.println("Server Closed.");
break;
} else if (msg.equals("SendProfile")) {
sendProfile();
}
out.flush();
}
in.close();
out.close();
} catch (Exception e) {
System.out.println("Server encountered a problem ...");
}
}
private void sendProfile() {
//todo send profile name and last played song name.
}
} | [
"[email protected]"
] | |
aaeb235846da68d995d022d9b1ec7f8dc64bb37a | 68ca1f0cc7cf158a79c76e1c4d962ff5cb5dab6d | /app/src/main/java/com/example/codered/ItemClickListener.java | fc9eadd232a4399cb2a41579610fcb28c0374bf4 | [] | no_license | PranjalBarnawal/e-Stationery | 472819244f634158cbac6b4c5a38248c246daf3a | b2fbf2b5fb9b0cbe10417eecfa41290dffd094fe | refs/heads/master | 2022-02-28T07:22:12.431523 | 2019-10-03T04:25:46 | 2019-10-03T04:25:46 | 202,915,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.example.codered;
import android.view.View;
public interface ItemClickListener {
void onClick(View view,int position, boolean isLongClick);
}
| [
"[email protected]"
] | |
cc431d60c8b0fec05b3db544cf840ee9c3410be5 | d2895d6978688bca7b96e05874913fd87ab14c43 | /app/src/androidTest/java/com/test/scrubdemo/ApplicationTest.java | a48725aec9ce9fae9da84472d8237b19adf747c7 | [] | no_license | sauravrp/scrubdemomanual | e83ceec7c8bf9e85b5f360a2197f2a774b1806c1 | 83325e9db07edb5123fdbec33666a4989c16036e | refs/heads/master | 2021-01-17T10:22:35.992507 | 2016-03-04T22:06:29 | 2016-03-04T22:06:29 | 31,473,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 353 | java | package com.test.scrubdemo;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application>
{
public ApplicationTest()
{
super(Application.class);
}
} | [
"[email protected]"
] | |
08b2687d0b8a6a8a6b5e2bea901eaeb06a75c600 | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/Closure-114/com.google.javascript.jscomp.NameAnalyzer/BBC-F0-opt-100/16/com/google/javascript/jscomp/NameAnalyzer_ESTest.java | 4cd33199c26d1c37eaa43f4205bda66b737208f4 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 11,569 | java | /*
* This file was automatically generated by EvoSuite
* Thu Oct 21 18:43:56 GMT 2021
*/
package com.google.javascript.jscomp;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import com.google.javascript.jscomp.AbstractCompiler;
import com.google.javascript.jscomp.Compiler;
import com.google.javascript.jscomp.NameAnalyzer;
import com.google.javascript.jscomp.Normalize;
import com.google.javascript.rhino.Node;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class NameAnalyzer_ESTest extends NameAnalyzer_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
nameAnalyzer0.removeUnreferenced();
}
@Test(timeout = 4000)
public void test01() throws Throwable {
NameAnalyzer nameAnalyzer0 = new NameAnalyzer((AbstractCompiler) null, false);
// Undeclared exception!
// try {
nameAnalyzer0.process((Node) null, (Node) null);
// fail("Expecting exception: NullPointerException");
// } catch(NullPointerException e) {
// //
// // no message in exception (getMessage() returned null)
// //
// verifyException("com.google.javascript.jscomp.NodeTraversal", e);
// }
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "OVERALL STATS<ul>");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test03() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "extern");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test04() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "window");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
compiler0.parseTestCode("HIDDEN");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test06() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("p");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("xIDEN");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("msg.unterminated.comment");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test09() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "com.googlf.javascript.rhino.head.Context");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("1nM");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test11() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("FnM");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test12() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
compiler0.parseTestCode("FnM");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test13() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
compiler0.parseTestCode("FALSE");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test14() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, false);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "S=otring");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
Node node0 = Node.newString("S=tin");
Node node1 = new Node(86, node0, node0, node0, node0, 16, 42);
nameAnalyzer0.process(node0, node1);
assertEquals(42, Node.SIDE_EFFECT_FLAGS);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
// Undeclared exception!
// try {
Normalize.parseAndNormalizeTestCode(compiler0, "S=+tring");
// // fail("Expecting exception: IllegalArgumentException");
// Unstable assertion
// } catch(IllegalArgumentException e) {
// //
// // Multiple entries with same key: author=NOT_IMPLEMENTED and author=AUTHOR
// //
// verifyException("com.google.common.collect.ImmutableMap", e);
// }
}
@Test(timeout = 4000)
public void test17() throws Throwable {
Compiler compiler0 = new Compiler();
NameAnalyzer nameAnalyzer0 = new NameAnalyzer(compiler0, true);
String string0 = nameAnalyzer0.getHtmlReport();
assertEquals("<html><body><style type=\"text/css\">body, td, p {font-family: Arial; font-size: 83%} ul {margin-top:2px; margin-left:0px; padding-left:1em;} li {margin-top:3px; margin-left:24px; padding-left:0px;padding-bottom: 4px}</style>OVERALL STATS<ul><li>Total Names: 0</li>\n<li>Total Classes: 0</li>\n<li>Total Static Functions: 0</li>\n<li>Referenced Names: 0</li>\n<li>Referenced Classes: 0</li>\n<li>Referenced Functions: 0</li>\n</ul>ALL NAMES<ul>\n</ul></body></html>", string0);
}
}
| [
"[email protected]"
] | |
a3b4b6b8c0988cb8aaf086bf7d2b8019614d9683 | 154a885ad39ece031e5224f99b2f8a3082fcb000 | /Sample/src/sam_17.java | aa80e687655165acf8ea828851cfb9e260d327a2 | [] | no_license | moonhwan123/moonhwan | 1b1e2fbc5589ac24d0806029465cdc232f5b9b29 | 84aa4dd9ca1a2f373d91ccbabce154f05c45c3c6 | refs/heads/master | 2021-07-05T04:46:46.814625 | 2021-04-01T09:21:19 | 2021-04-01T09:21:19 | 228,724,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 271 | java |
public class sam_17 {
public static void main(String[] args) {
for(int i = 1; i <= 5; i++) {
for(int k = 1; k < 6-i; k++) {
System.out.print(" ");
}
for(int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
| [
"[email protected]"
] | |
e3f49950217bb3042a47e53c908cd2e6b823ccc5 | 5acb94983f5f757200608965f83a79515c4524e0 | /src/core/tools/TMXViewer.java | 93e2b1d8c76462075bb398d41039782ea53fe611 | [] | no_license | PontusWirsching/MinersOfAragos | 4da4b19f41b291af5daadb88e8733094d6bef476 | 0bb5759379ff7b6c03af8aa3ca872fedeeb284e0 | refs/heads/master | 2021-01-21T06:55:38.610882 | 2015-01-06T14:17:56 | 2015-01-06T14:17:56 | 24,244,904 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 5,787 | java | package core.tools;
/*
* Copyright 2010, Thorbjørn Lindeijer <[email protected]>
*
* This file is part of tmxviewer-java.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE 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 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.
*/
import tiled.core.Map;
import tiled.core.MapLayer;
import tiled.core.TileLayer;
import tiled.io.TMXMapReader;
import tiled.view.MapRenderer;
import tiled.view.OrthogonalRenderer;
import javax.swing.*;
import java.awt.*;
/**
* An example showing how to use libtiled-java to do a simple TMX viewer.
*/
public class TMXViewer
{
public static void main(String[] arguments) {
String fileToOpen = null;
for (String arg : arguments) {
if ("-?".equals(arg) || "-help".equals(arg)) {
printHelpMessage();
return;
} else if (arg.startsWith("-")) {
System.out.println("Unknown option: " + arg);
printHelpMessage();
return;
} else if (fileToOpen == null) {
fileToOpen = arg;
}
}
if (fileToOpen == null) {
printHelpMessage();
return;
}
Map map;
try {
TMXMapReader mapReader = new TMXMapReader();
map = mapReader.readMap(fileToOpen);
} catch (Exception e) {
System.out.println("Error while reading the map:\n" + e.getMessage());
return;
}
System.out.println(map.toString() + " loaded");
JScrollPane scrollPane = new JScrollPane(new MapView(map));
scrollPane.setBorder(null);
scrollPane.setPreferredSize(new Dimension(800, 600));
JFrame appFrame = new JFrame("TMX Viewer");
appFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
appFrame.setContentPane(scrollPane);
appFrame.pack();
appFrame.setVisible(true);
}
private static void printHelpMessage() {
System.out.println("Java TMX Viewer\n" +
"\n" +
"When a parameter is given, it can either be a file name or an \n" +
"option starting with '-'. These options are available:\n" +
"\n" +
"-?\n" +
"-help\n" +
"\tDisplays this help message\n");
}
}
@SuppressWarnings("serial")
class MapView extends JPanel implements Scrollable
{
private Map map;
private MapRenderer renderer;
public MapView(Map map) {
this.map = map;
renderer = createRenderer(map);
setPreferredSize(renderer.getMapSize());
setOpaque(true);
}
public void paintComponent(Graphics g) {
final Graphics2D g2d = (Graphics2D) g.create();
final Rectangle clip = g2d.getClipBounds();
// Draw a gray background
g2d.setPaint(new Color(100, 100, 100));
g2d.fill(clip);
// Draw each tile map layer
for (MapLayer layer : map) {
if (layer instanceof TileLayer) {
renderer.paintTileLayer(g2d, (TileLayer) layer);
}
}
}
private static MapRenderer createRenderer(Map map) {
switch (map.getOrientation()) {
case Map.ORIENTATION_ORTHOGONAL:
return new OrthogonalRenderer(map);
default:
return null;
}
}
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}
public int getScrollableUnitIncrement(Rectangle visibleRect,
int orientation, int direction) {
if (orientation == SwingConstants.HORIZONTAL)
return map.getTileWidth();
else
return map.getTileHeight();
}
public int getScrollableBlockIncrement(Rectangle visibleRect,
int orientation, int direction) {
if (orientation == SwingConstants.HORIZONTAL) {
final int tileWidth = map.getTileWidth();
return (visibleRect.width / tileWidth - 1) * tileWidth;
} else {
final int tileHeight = map.getTileHeight();
return (visibleRect.height / tileHeight - 1) * tileHeight;
}
}
public boolean getScrollableTracksViewportWidth() {
return false;
}
public boolean getScrollableTracksViewportHeight() {
return false;
}
} | [
"[email protected]"
] | |
94f8989f086c131b8366b36e7ef1760d8690b8c2 | 3c939e176560c7a1190aa0c52ea7d6a476b04be6 | /src/main/java/coding/net/common/XSSApi.java | 2893f8b58aceb274afb5e5bb56efca05d5d2578d | [] | no_license | belieberll/coding.net | 06af57ce8bdfc85959c695a7c18474f075b105b3 | 62e5d428a87587fe96d1b54a7aca22a2a12d4744 | refs/heads/master | 2021-08-30T21:51:14.754427 | 2017-12-19T15:06:16 | 2017-12-19T15:06:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,568 | java | package coding.net.common;
import org.apache.commons.codec.binary.Base64;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/**
* @author lanwen (Merkushev Kirill)
*/
@Restricted(NoExternalUse.class)
public final class XSSApi {
private static final Logger LOG = LoggerFactory.getLogger(XSSApi.class);
private XSSApi() {
}
/**
* Method to filter invalid url for XSS. This url can be inserted to href safely
*
* @param urlString unsafe url
*
* @return safe url
*/
public static String asValidHref(String urlString) {
try {
return new URL(urlString).toExternalForm();
} catch (MalformedURLException e) {
LOG.debug("Malformed url - {}, empty string will be returned", urlString);
return "";
}
}
public static String load(String urlString, String userName,String password,boolean post,String crumbField,String crumbToken) throws IOException {
URL url = new URL(urlString);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
if (post){
connection.setRequestMethod("POST");
}
if (null != userName && !"".equals(userName)) {
connection.setRequestProperty("Authorization", "Basic " + Base64.encodeBase64String((userName + ":" + password).getBytes("UTF-8")));
}
if(null != crumbField && null != crumbToken){
connection.setRequestProperty(crumbField,crumbToken);
}
if (300 < connection.getResponseCode()) {
throw new IOException(urlString + " remote build fail, wrong response code " + connection.getResponseCode());
}
return readFullyAsString(connection);
}
public static String readFullyAsString(HttpURLConnection connection) throws IOException {
return readFully(connection.getInputStream()).toString("UTF-8");
}
private static ByteArrayOutputStream readFully(InputStream inputStream) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length = 0;
while ((length = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, length);
}
return baos;
}
}
| [
"[email protected]"
] | |
aa4f10a449a9d61c5677c87cce51a1fc924141e8 | 58e3c1bf56c72bdad3a1b98e959a2e3ecfafb452 | /Task6_CodeFromHabrExceptions/src/exceptions_article_first_part/App30.java | 07b572eedee78170a19cd16f1139bec875ddb415 | [] | no_license | artemstukalenko/Java.Homework | a8a54dbf3fe3fc288110c279fc9355eb7369c78d | e36073374cf723dfdf8827b2d1751773dc546b44 | refs/heads/main | 2023-06-27T16:39:34.632850 | 2021-07-25T08:22:33 | 2021-07-25T08:22:33 | 382,001,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,481 | java | package exceptions_article_first_part;
public class App30 {
public static void main(String[] args) {
System.err.println("#1.in");
f(); // создаем фрейм, помещаем в стек, передаем в него управление
System.err.println("#1.out"); // вернулись и работаем
}
public static void f() {
System.err.println(". #2.in");
try {
g(); // создаем фрейм, помещаем в стек, передаем в него управление
} catch (Error e) { // "перехватили" "летящее" исключение
System.err.println(". #2.CATCH"); // и работаем
}
System.err.println(". #2.out"); // работаем дальше
}
public static void g() {
System.err.println(". . #3.in");
h(); // создаем фрейм, помещаем в стек, передаем в него управление
System.err.println(". . #3.out"); // ПРОПУСТИЛИ!
}
public static void h() {
System.err.println(". . . #4.in");
if (true) {
System.err.println(". . . #4.THROW");
throw new Error(); // выходим со всей пачки фреймов ("раскрутка стека") по 'throw'
}
System.err.println(". . . #4.out"); // ПРОПУСТИЛИ!
}
}
| [
"[email protected]"
] | |
6e0d7038ddae6bb2df01da168d970f5e60588cc3 | 215718e171bcdea833da7aee7fd94334f49dab35 | /oauth2-sso/auth-server/src/main/java/com/harry/authserver/UserController.java | 08af4b491f7369053094bef019aa72545ce1fab5 | [] | no_license | ArthasZongjun/oauth2 | 4e37a076e18393cb66d95e4621fb9ee84d771c75 | 62386e417c1a0853ba55c9d460daaf3f68f8a9ff | refs/heads/master | 2023-07-09T02:42:05.710064 | 2021-08-08T07:43:45 | 2021-08-08T07:43:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 459 | java | package com.harry.authserver;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.security.Principal;
/**
* @author harry
* @email: [email protected]
* @des: 获取登录用户资源
* @createTime:
*/
@RestController
public class UserController {
@GetMapping("/user")
public Principal getCurrentUser(Principal principal) {
return principal;
}
}
| [
"[email protected]"
] | |
8087021086325796a5c746edc608a56be01130dc | 2a662cfdf91e0cded6b9d272cbcea8a2d4377d4c | /Matrix Client/src/main/java/com/jagex/Class170.java | 3c554de512d9ff49fa860bedfd669872866f967d | [] | no_license | primnoprotogen/718_RS_Build | 38293df71eb08d0cc64bce5e19cc64b46172463a | 84ddd7138d8ea7dede51814e62868696932ec303 | refs/heads/master | 2023-04-04T04:21:25.263022 | 2021-04-20T22:17:11 | 2021-04-20T22:17:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,424 | java | package com.jagex;/* Class170 - Decompiled by JODE
* Visit http://jode.sourceforge.net/
*/
public final class Class170 {
int anInt1737;
Object anObject1738;
Class170(Object object, int i) {
((Class170) this).anObject1738 = object;
((Class170) this).anInt1737 = i * 533229453;
}
static void method1808(int i) {
try {
if (Class436.aClass298_Sub37_Sub5_5472 != null) {
Class436.aClass298_Sub37_Sub5_5472 = null;
Class227.method2112(805710735 * Class461.anInt5681,
Class501.anInt6119 * -1370784315,
Class420.anInt5345 * 2054409059, Class389.anInt4166
* -1855216229, (byte) 2);
}
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.z(").append(')').toString());
}
}
static final void method1809(Class403 class403, int i) {
try {
Class390 class390 = (((Class403) class403).aBoolean5261 ? ((Class403) class403).aClass390_5247
: ((Class403) class403).aClass390_5246);
IComponentDefinition class105 = ((Class390) class390).aClass105_4168;
((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 += -391880689) * 681479919 - 1)] = class105.spriteId * 1411971043;
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.pb(").append(')').toString());
}
}
static final void method1810(Class403 class403, byte i) {
try {
((Class403) class403).anInt5239 -= -783761378;
int i_0_ = (((Class403) class403).anIntArray5244[((Class403) class403).anInt5239 * 681479919]);
int i_1_ = (((Class403) class403).anIntArray5244[1 + ((Class403) class403).anInt5239 * 681479919]);
((Class403) class403).aClass177_5243.anIntArray1789[i_0_] = i_1_;
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.adx(").append(')').toString());
}
}
public static void method1811(int i, Class243 class243, int i_2_, int i_3_,
int i_4_, boolean bool, Class97 class97, byte i_5_) {
try {
if (i > 0) {
Class79.anInt734 = -1262101671;
Class79.aClass243_744 = class243;
Class79.anInt745 = i_2_ * -407545223;
Class79.anInt746 = i_3_ * -956029523;
Class79.aClass298_Sub19_Sub1_748 = null;
Class79.anInt739 = i_4_ * -2102749749;
Class8.aBoolean114 = bool;
Class298_Sub24_Sub1.anInt9276 = (Class79.aClass298_Sub19_Sub1_737
.method2953((byte) -72)
/ i * 771950311);
if (-1503744809 * Class298_Sub24_Sub1.anInt9276 < 1)
Class298_Sub24_Sub1.anInt9276 = 771950311;
Class313.aClass97_3300 = class97;
} else {
if (class97 != null)
class97.method1037(1056339184);
Class477.method6096(class243, i_2_, i_3_, i_4_, bool,
-1991321667);
}
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.n(").append(')').toString());
}
}
static final void method1812(IComponentDefinition[] class105s, int i, byte i_6_) {
try {
for (int i_7_ = 0; i_7_ < class105s.length; i_7_++) {
IComponentDefinition class105 = class105s[i_7_];
if (null == class105) {
if (i_6_ <= 1)
break;
} else {
if (-1215239439 * class105.type == 0) {
if (null != class105.itemSlots)
method1812(class105.itemSlots, i,
(byte) 26);
Interface class298_sub51 = ((Interface) (client.OPEN_INTERFACES
.get((long) (class105.idHash * -440872681))));
if (class298_sub51 != null)
Class82_Sub10.method903(
(class298_sub51.interfaceId * -1617025021),
i, -837806860);
}
if (i == 0 && null != class105.anObjectArray1275) {
Class298_Sub46 class298_sub46 = new Class298_Sub46();
class298_sub46.aClass105_7525 = class105;
class298_sub46.anObjectArray7530 = class105.anObjectArray1275;
Class444.method5889(class298_sub46, (byte) -11);
}
if (1 == i && class105.anObjectArray1250 != null) {
if (class105.anInt1154 * -1309843523 >= 0) {
IComponentDefinition class105_8_ = Class50.getIComponentDefinitions(
(class105.idHash * -440872681),
(byte) -12);
if (class105_8_ == null
|| class105_8_.aClass105Array1292 == null
|| (-1309843523 * class105.anInt1154 >= class105_8_.aClass105Array1292.length))
continue;
if ((class105_8_.aClass105Array1292[-1309843523
* class105.anInt1154]) != class105) {
if (i_6_ <= 1) {
/* empty */
}
continue;
}
}
Class298_Sub46 class298_sub46 = new Class298_Sub46();
class298_sub46.aClass105_7525 = class105;
class298_sub46.anObjectArray7530 = class105.anObjectArray1250;
Class444.method5889(class298_sub46, (byte) 34);
}
}
}
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.lj(").append(')').toString());
}
}
static final void method1813(Class403 class403, byte i) {
try {
int i_9_ = (((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 -= -391880689) * 681479919)]);
if (-1 != i_9_)
Class119.method1300(i_9_, 2038530463);
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.anj(").append(')').toString());
}
}
static boolean method1814(Interface19 interface19,
Class298_Sub50 class298_sub50, byte i) {
try {
return (interface19 != null && interface19.method239(
class298_sub50, client.anInterface16Array8688,
client.anInt8687 * -1625219821, Class372.aClass323_4052,
-622376364));
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.i(").append(')').toString());
}
}
static final void method1815(Class403 class403, byte i) {
try {
int i_10_ = (((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 -= -391880689) * 681479919)]);
((Class403) class403).anIntArray5244[((((Class403) class403).anInt5239 += -391880689) * 681479919 - 1)] = Class82_Sub5
.method882(i_10_, false, (byte) 63);
} catch (RuntimeException runtimeexception) {
throw Class346.method4175(runtimeexception, new StringBuilder()
.append("ha.ui(").append(')').toString());
}
}
}
| [
"[email protected]"
] | |
d779932b7252baabd902429505be3b070afb2592 | f8040ab86b346b6700ea397b906a7d6c23463fdb | /src/main/java/com/unisk/ccq/nowcoder/JumpFloor.java | 5ef36c973f4454cfe95492d91242c2df73ad7980 | [] | no_license | ccqccq44/ccq | d12b8276ecad48c479982a08c084bd1170de169c | 4e2a49bade5d2e6ac3cf0559c8e5e1175971e88f | refs/heads/master | 2020-06-11T10:44:02.060159 | 2016-12-06T02:04:18 | 2016-12-06T02:04:18 | 75,684,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package com.unisk.ccq.nowcoder;
public class JumpFloor {
public static void main(String[] args) {
System.out.println(jumpFloor(30));
}
public static int jumpFloor(int target){
if(target == 1 || target == 2) {
return target;
}
int jumpSum = 0;// 当前台阶的跳法总数
int jumpSumBackStep1 = 2;// 当前台阶后退一阶的台阶的跳法总数(初始值当前台阶是第3阶)
int jumpSumBackStep2 = 1;// 当前台阶后退二阶的台阶的跳法总数(初始值当前台阶是第3阶)
for(int i = 3; i <= target; i++) {
jumpSum= jumpSumBackStep1 + jumpSumBackStep2;
jumpSumBackStep2 = jumpSumBackStep1;// 后退一阶在下一次迭代变为后退两阶
jumpSumBackStep1 = jumpSum; // 当前台阶在下一次迭代变为后退一阶
}
return jumpSum;
}
}
| [
"[email protected]"
] | |
19c1d30b4e88ebf5d2df4c5b57c927883db9ddee | ebfd6f6ef748d0f895ee9d5688b800ecfe42b2f5 | /app/src/main/java/appzaliczenie/financemanager/DatabaseOperations.java | 00ed90d6ecd798200626ffb1e0d6846231dc0419 | [] | no_license | margwokrdzis/Finance-Manager | af5ddacaab23d98ddf2fe536bc5a3ce24b64c66f | 3e9fc67eaa64bab094b306821c28963159a68d3c | refs/heads/master | 2021-01-21T10:25:31.072299 | 2017-05-30T22:06:37 | 2017-05-30T22:06:37 | 91,689,176 | 0 | 1 | null | 2017-05-29T18:52:56 | 2017-05-18T12:10:14 | Java | UTF-8 | Java | false | false | 3,312 | java | package appzaliczenie.financemanager;
public interface DatabaseOperations {
String LOGIN = "login";
String CREATE_ACCOUNT = "createAccount";
String CREATE_COMPANY = "createCompany";
String CREATE_CLIENT = "createClient";
String UPDATE_COMPANY_DATA = "changeCompany";
String ADD_OUTGOING = "addOutgoing";
String ADD_INCOME = "addIncome";
String DELETE_CLIENT = "deleteClient";
String ACCOUNT_CREATED = "accountCreated";
String LOGIN_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/login.php";
String CREATE_ACCOUNT_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/createAccount.php";
String CREATE_COMPANY_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/createCompany.php";
String CREATE_CLIENT_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/createClient.php";
String GET_CLIENT_LIST_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getClientList.php";
String UPDATE_COMPANY_DATA_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/changeCompany.php";
String ADD_OUTGOING_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/addOutgoing.php";
String ADD_INCOME_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/addIncome.php";
String DELETE_CLIENT_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/deleteClient.php";
String GET_COMPANY_ID_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getCompanyID.php";
String GET_INCOME_LIST_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getIncomes.php";
String GET_OUTGOINGS_LIST_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getOutgoings.php";
String GET_COMPANY_INFO_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getCompanyInfo.php";
String GET_CLIENT_INFO_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getClientInfo.php";
String GET_SUM_INCOME_SERVICE = "http://v-ie.uek.krakow.pl/~s174753/finance/getMonthlyStatistics.php";
String SUCCESS_TAG = "success";
String ID_COMPANY_TAG = "id_company";
String INCOMING_TAG = "incomings";
String OUTGOING_TAG = "outgoings";
String ID_INCOMING_TAG = "id_incomings";
String ID_OUTGOINGS_TAG = "id_outgoings";
String TAG_NAME = "name";
String TAG_DATE = "date";
String TAG_AMMOUNT = "ammount";
//company info
String TAG_COMPANY = "company";
String TAG_COMPANY_NAME = "companyName";
String TAG_COMPANY_EMAIL = "companyEmail";
String TAG_COMPANY_PHONE_NUMBER = "companyPhoneNumber";
String TAG_COMPANY_NIP = "companyNIP";
String TAG_COMPANY_CITY = "companyCity";
String TAG_COMPANY_POSTAL_CODE = "companyPostalCode";
String TAG_COMPANY_STREET = "street";
String TAG_COMPANY_BUILDING_NUMBER = "building_number";
String TAG_COMPANY_DOOR_NUMBER = "door_number";
//client tags
String TAG_CLIENT = "client";
String TAG_ID_CLIENT = "id_client";
String TAG_EMAIL = "mail";
String TAG_PHONE_NUMBER = "phone_number";
String TAG_NIP = "nip";
String TAG_CITY = "city";
String TAG_POSTAL_CODE = "postal_code";
String TAG_STREET = "street";
String TAG_BUILDING_NUMBER = "building_number";
String TAG_DOOR_NUMBER = "door_number";
//sum tag
String TAG_SUMMARY = "monthly";
String TAG_YEAR = "year";
String TAG_MONTH = "month";
}
| [
"[email protected]"
] | |
5496d27b7bfa87267b0756fd2a3d4a612b1caee6 | 6b004623061684d9351db27c471fff40d5d161b2 | /src/hangman/server/handlers/ServerHandler.java | d5d78688219167d3326f945ceef15f00ec7c63ef | [] | no_license | damencs/socket-hangman | ec8bb76cea2ab169cfe28d202d626904a55c952b | b8d454d11811b7c2a3777d648d6829b6deeec78a | refs/heads/main | 2023-04-12T14:43:22.708131 | 2021-05-05T01:06:20 | 2021-05-05T01:06:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 581 | java | /*
Names:
- Damen DeBerry
- Christopher Lyons
- Logan Moore
Class: Parallel and Distributed Computing
Assignment: Choose the project topic which uses at least one of any distributed computing techniques.
*/
package server.handlers;
import java.io.IOException;
public class ServerHandler
{
FileHandler read = new FileHandler();
public String getWord()
{
String word = null;
try
{
word = read.readFile();
}
catch (IOException x)
{
}
return word;
}
} | [
"[email protected]"
] | |
fb83ae313d8456476ec63c0c999511dd43315aa8 | 8eb5163ceb2c1415935a0e9587bf612b164a6a48 | /src/main/java/com/lab2/cbse/MovieLister.java | 87d9ac5c7b4821ada7a6c588f351a2195b7a3fee | [] | no_license | dariusclop/springboot-learning | 3fc5ffd187c95436e2f5fa5a97a468cb7f1f7d90 | 2a21c8dc4379551bc3189a24dd9c1c643c4afad0 | refs/heads/master | 2023-01-11T19:03:00.695723 | 2020-11-08T13:17:45 | 2020-11-08T13:17:45 | 310,943,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.lab2.cbse;
import java.util.Iterator;
import java.util.List;
public class MovieLister {
private MovieFinder finder;
public void setFinder(MovieFinder finder) {
this.finder = finder;
}
public Movie[] moviesDirectedBy(String arg) {
List<Movie> allMovies = finder.findAll();
for (Iterator<Movie> it = allMovies.iterator(); it.hasNext();) {
Movie movie = (Movie) it.next();
if (!movie.getDirector().equals(arg)) it.remove();}
return (Movie[]) allMovies.toArray(new Movie[allMovies.size()]);
}
}
| [
"[email protected]"
] | |
2191a1ac2de457db4ba11120779a98103f33791e | 2bf4f4426925220574def1824f8fbdd29cd6e4bf | /src/main/java/org/datastructure/java/recurrsion/returnPermutationsOfAString/Runner.java | ade90197ea04587a8a33c23117f7baad9b51365d | [] | no_license | sauravsavarn/data-structure-java | 3bfa2484824f1391a1293b6f771d7b0bb7276eaa | 81aa41e1c172b5cff807a266b9903f34981f47e7 | refs/heads/master | 2023-08-24T06:12:24.959809 | 2021-10-18T08:39:04 | 2021-10-18T08:39:04 | 385,473,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package org.datastructure.java.recurrsion.returnPermutationsOfAString;
import java.util.Scanner;
public class Runner {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String input = s.nextLine();
String output[] = Solution.permutationOfString(input);
for(int i = 0; i < output.length; i++) {
System.out.println(output[i]);
}
}
}
| [
"[email protected]"
] | |
b0da5cd330f883da08f586a0e39b1ccf0a170851 | 39fcf98fdfa966f5498ee483f438363490b32b22 | /Trees/FindAncestorsBST.java | 45f957659753f4196e01e707bd519a4928dd1909 | [] | no_license | kumarchandan/Codein | 7ef52bae8d532269f7a844f9088df629e6162126 | b9b7597e3f4eb441fbb4a2fbf7e72abd5fb59bb7 | refs/heads/master | 2023-06-07T09:59:51.044932 | 2021-07-03T12:48:03 | 2021-07-03T12:48:03 | 357,952,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,743 | java | package Trees;
/**
* Find Ancestors of a Given Node in a Binary Tree
*
* Given the root to a Binary Search Tree and a node value "k", write a function
* to find the ancestor of that node.
*
*
*/
/**
* Runtime: O(h) : where h is height of the tree
* O(n) : worst case - skewed tree
*/
public class FindAncestorsBST {
public static String findAncestors(Node root, int k) {
String result = "";
Node tempNode = root;
while (tempNode != null && tempNode.getData() != k) {
result = result + tempNode.getData() + ","; // These are Ancestors
if (k == tempNode.getData()) {
return result;
}
if (k < tempNode.getData()) {
tempNode = tempNode.getLeftChild();
} else {
tempNode = tempNode.getRightChild();
}
}
if (tempNode == null) { // If tempNode is null, element wasn't found
return "";
} else {
return result;
}
}
public static void main(String[] args) {
BinarySearchTree tree = new BinarySearchTree();
/* Construct a binary tree like this
6
/ \
4 9
/ \ | \
2 5 8 12
/ \
10 14
*/
tree.insert(6);
tree.insert(4);
tree.insert(9);
tree.insert(2);
tree.insert(5);
tree.insert(8);
tree.insert(8);
tree.insert(12);
tree.insert(10);
tree.insert(14);
int key = 10;
System.out.print(key + " --> ");
System.out.print(findAncestors(tree.getRoot(), key)); // 10 --> 6,9,12,
System.out.println();
key = 5;
System.out.print(key + " --> ");
System.out.print(findAncestors(tree.getRoot(), key)); // 5 --> 6,4
}
}
| [
"[email protected]"
] | |
24321ef58cd0aaf5eb11649f098244f92496c23a | 1d4ddeba3ddad4a36063e69d20ec655399497b72 | /JavaAyo/src-nutz/org/nutz/dao/impl/sql/NutPojoMaker.java | 2cec3e221b734a327088ef6b052b45cc7cbaf786 | [
"Apache-2.0"
] | permissive | cowthan/JavaWeb | 9d09b27de3518f7229a5a2c14c9d6634ce6eff0b | 6431f9c11608a99b16e46f0fd112872ef825656b | refs/heads/master | 2022-12-25T02:37:54.841615 | 2019-06-27T14:12:15 | 2019-06-27T14:12:15 | 112,908,445 | 0 | 0 | Apache-2.0 | 2022-12-16T00:44:25 | 2017-12-03T07:22:09 | Java | UTF-8 | Java | false | false | 2,646 | java | package org.nutz.dao.impl.sql;
import org.nutz.dao.entity.Entity;
import org.nutz.dao.jdbc.JdbcExpert;
import org.nutz.dao.sql.Pojo;
import org.nutz.dao.sql.PojoMaker;
import org.nutz.dao.sql.SqlType;
import org.nutz.dao.util.Pojos;
public class NutPojoMaker implements PojoMaker {
private JdbcExpert expert;
public NutPojoMaker(JdbcExpert expert) {
this.expert = expert;
}
public Pojo makePojo(SqlType type) {
Pojo pojo = expert.createPojo(type);
return pojo;
}
public Pojo makeInsert(Entity<?> en) {
Pojo pojo = Pojos.pojo(expert, en, SqlType.INSERT);
pojo.setEntity(en);
pojo.append(Pojos.Items.entityTableName());
pojo.append(Pojos.Items.insertFields());
pojo.append(Pojos.Items.insertValues());
return pojo;
}
public Pojo makeUpdate(Entity<?> en, Object refer) {
Pojo pojo = Pojos.pojo(expert, en, SqlType.UPDATE);
pojo.setEntity(en);
pojo.append(Pojos.Items.entityTableName());
pojo.append(Pojos.Items.updateFields(refer));
return pojo;
}
public Pojo makeQuery(Entity<?> en) {
Pojo pojo = Pojos.pojo(expert, en, SqlType.SELECT);
pojo.setEntity(en);
pojo.append(Pojos.Items.queryEntityFields());
pojo.append(Pojos.Items.wrap("FROM"));
pojo.append(Pojos.Items.entityViewName());
return pojo;
}
public Pojo makeQuery(String tableName) {
String[] ss = tableName.split(":");
// String idFieldName = ss.length > 1 ? ss[1] : "*";//按id字段来统计,比较快
Pojo pojo = makePojo(SqlType.SELECT);
// pojo.append(Pojos.Items.wrap(idFieldName));//与org.nutz.dao.test.normal.QueryTest.query_records_pager()冲突
pojo.append(Pojos.Items.wrap("*"));
pojo.append(Pojos.Items.wrap("FROM"));
pojo.append(Pojos.Items.wrap(ss[0]));
return pojo;
}
public Pojo makeDelete(Entity<?> en) {
Pojo pojo = Pojos.pojo(expert, en, SqlType.DELETE);
pojo.setEntity(en);
pojo.append(Pojos.Items.wrap("FROM"));
pojo.append(Pojos.Items.entityTableName());
return pojo;
}
public Pojo makeDelete(String tableName) {
Pojo pojo = makePojo(SqlType.DELETE);
pojo.append(Pojos.Items.wrap("FROM"));
pojo.append(Pojos.Items.wrap(tableName));
return pojo;
}
public Pojo makeFunc(String tableName, String funcName, String colName) {
Pojo pojo = makePojo(SqlType.SELECT);
pojo.append(Pojos.Items.wrapf("%s(%s) FROM %s", funcName, colName, tableName));
return pojo;
}
}
| [
"[email protected]"
] | |
8e5e7a57d5d64869c79f94958e44bfa6efa2f0af | d280800ca4ec277f7f2cdabc459853a46bf87a7c | /spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/embedded/EmbeddedMongoAutoConfiguration.java | 2a038ba399d693d677df7a381221fab546000506 | [
"Apache-2.0"
] | permissive | qqqqqcjq/spring-boot-2.1.x | e5ca46d93eeb6a5d17ed97a0b565f6f5ed814dbb | 238ffa349a961d292d859e6cc2360ad53b29dfd0 | refs/heads/master | 2023-03-12T12:50:11.619493 | 2021-03-01T05:32:52 | 2021-03-01T05:32:52 | 343,275,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,190 | java | /*
* Copyright 2012-2019 the original author or authors.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.mongo.embedded;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.Command;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.DownloadConfigBuilder;
import de.flapdoodle.embed.mongo.config.ExtractedArtifactStoreBuilder;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.config.RuntimeConfigBuilder;
import de.flapdoodle.embed.mongo.config.Storage;
import de.flapdoodle.embed.mongo.distribution.Feature;
import de.flapdoodle.embed.mongo.distribution.IFeatureAwareVersion;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.mongo.distribution.Versions;
import de.flapdoodle.embed.process.config.IRuntimeConfig;
import de.flapdoodle.embed.process.config.io.ProcessOutput;
import de.flapdoodle.embed.process.distribution.GenericVersion;
import de.flapdoodle.embed.process.io.Processors;
import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.io.progress.Slf4jProgressListener;
import de.flapdoodle.embed.process.runtime.Network;
import de.flapdoodle.embed.process.store.ArtifactStoreBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.data.mongo.MongoClientDependsOnBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.data.mongo.ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.data.mongodb.core.MongoClientFactoryBean;
import org.springframework.data.mongodb.core.ReactiveMongoClientFactoryBean;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Embedded Mongo.
*
* @author Henryk Konsek
* @author Andy Wilkinson
* @author Yogesh Lonkar
* @author Mark Paluch
* @author Issam El-atif
* @since 1.3.0
*/
@Configuration
@EnableConfigurationProperties({ MongoProperties.class, EmbeddedMongoProperties.class })
@AutoConfigureBefore(MongoAutoConfiguration.class)
@ConditionalOnClass({ MongoClient.class, MongodStarter.class })
public class EmbeddedMongoAutoConfiguration {
private static final byte[] IP4_LOOPBACK_ADDRESS = { 127, 0, 0, 1 };
private static final byte[] IP6_LOOPBACK_ADDRESS = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
private final MongoProperties properties;
private final EmbeddedMongoProperties embeddedProperties;
private final ApplicationContext context;
private final IRuntimeConfig runtimeConfig;
public EmbeddedMongoAutoConfiguration(MongoProperties properties, EmbeddedMongoProperties embeddedProperties,
ApplicationContext context, IRuntimeConfig runtimeConfig) {
this.properties = properties;
this.embeddedProperties = embeddedProperties;
this.context = context;
this.runtimeConfig = runtimeConfig;
}
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public MongodExecutable embeddedMongoServer(IMongodConfig mongodConfig) throws IOException {
Integer configuredPort = this.properties.getPort();
if (configuredPort == null || configuredPort == 0) {
setEmbeddedPort(mongodConfig.net().getPort());
}
MongodStarter mongodStarter = getMongodStarter(this.runtimeConfig);
return mongodStarter.prepare(mongodConfig);
}
private MongodStarter getMongodStarter(IRuntimeConfig runtimeConfig) {
if (runtimeConfig == null) {
return MongodStarter.getDefaultInstance();
}
return MongodStarter.getInstance(runtimeConfig);
}
@Bean
@ConditionalOnMissingBean
public IMongodConfig embeddedMongoConfiguration() throws IOException {
MongodConfigBuilder builder = new MongodConfigBuilder().version(determineVersion());
EmbeddedMongoProperties.Storage storage = this.embeddedProperties.getStorage();
if (storage != null) {
String databaseDir = storage.getDatabaseDir();
String replSetName = storage.getReplSetName();
int oplogSize = (storage.getOplogSize() != null) ? (int) storage.getOplogSize().toMegabytes() : 0;
builder.replication(new Storage(databaseDir, replSetName, oplogSize));
}
Integer configuredPort = this.properties.getPort();
if (configuredPort != null && configuredPort > 0) {
builder.net(new Net(getHost().getHostAddress(), configuredPort, Network.localhostIsIPv6()));
}
else {
builder.net(new Net(getHost().getHostAddress(), Network.getFreeServerPort(getHost()),
Network.localhostIsIPv6()));
}
return builder.build();
}
private IFeatureAwareVersion determineVersion() {
if (this.embeddedProperties.getFeatures() == null) {
for (Version version : Version.values()) {
if (version.asInDownloadPath().equals(this.embeddedProperties.getVersion())) {
return version;
}
}
return Versions.withFeatures(new GenericVersion(this.embeddedProperties.getVersion()));
}
return Versions.withFeatures(new GenericVersion(this.embeddedProperties.getVersion()),
this.embeddedProperties.getFeatures().toArray(new Feature[0]));
}
private InetAddress getHost() throws UnknownHostException {
if (this.properties.getHost() == null) {
return InetAddress.getByAddress(Network.localhostIsIPv6() ? IP6_LOOPBACK_ADDRESS : IP4_LOOPBACK_ADDRESS);
}
return InetAddress.getByName(this.properties.getHost());
}
private void setEmbeddedPort(int port) {
setPortProperty(this.context, port);
}
private void setPortProperty(ApplicationContext currentContext, int port) {
if (currentContext instanceof ConfigurableApplicationContext) {
MutablePropertySources sources = ((ConfigurableApplicationContext) currentContext).getEnvironment()
.getPropertySources();
getMongoPorts(sources).put("local.mongo.port", port);
}
if (currentContext.getParent() != null) {
setPortProperty(currentContext.getParent(), port);
}
}
@SuppressWarnings("unchecked")
private Map<String, Object> getMongoPorts(MutablePropertySources sources) {
PropertySource<?> propertySource = sources.get("mongo.ports");
if (propertySource == null) {
propertySource = new MapPropertySource("mongo.ports", new HashMap<>());
sources.addFirst(propertySource);
}
return (Map<String, Object>) propertySource.getSource();
}
@Configuration
@ConditionalOnClass(Logger.class)
@ConditionalOnMissingBean(IRuntimeConfig.class)
static class RuntimeConfigConfiguration {
@Bean
public IRuntimeConfig embeddedMongoRuntimeConfig() {
Logger logger = LoggerFactory.getLogger(getClass().getPackage().getName() + ".EmbeddedMongo");
ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.INFO),
Processors.logTo(logger, Slf4jLevel.ERROR),
Processors.named("[console>]", Processors.logTo(logger, Slf4jLevel.DEBUG)));
return new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).processOutput(processOutput)
.artifactStore(getArtifactStore(logger)).daemonProcess(false).build();
}
private ArtifactStoreBuilder getArtifactStore(Logger logger) {
return new ExtractedArtifactStoreBuilder().defaults(Command.MongoD).download(new DownloadConfigBuilder()
.defaultsForCommand(Command.MongoD).progressListener(new Slf4jProgressListener(logger)).build());
}
}
/**
* Additional configuration to ensure that {@link MongoClient} beans depend on any
* {@link MongodExecutable} beans.
*/
@Configuration
@ConditionalOnClass({ MongoClient.class, MongoClientFactoryBean.class })
protected static class EmbeddedMongoDependencyConfiguration extends MongoClientDependsOnBeanFactoryPostProcessor {
EmbeddedMongoDependencyConfiguration() {
super(MongodExecutable.class);
}
}
/**
* Additional configuration to ensure that
* {@link com.mongodb.reactivestreams.client.MongoClient} beans depend on any
* {@link MongodExecutable} beans.
*/
@Configuration
@ConditionalOnClass({ com.mongodb.reactivestreams.client.MongoClient.class, ReactiveMongoClientFactoryBean.class })
protected static class EmbeddedReactiveMongoDependencyConfiguration
extends ReactiveStreamsMongoClientDependsOnBeanFactoryPostProcessor {
EmbeddedReactiveMongoDependencyConfiguration() {
super(MongodExecutable.class);
}
}
}
| [
"[email protected]"
] | |
bd1da3211e81de5fd1c6dcdd039e039f34090832 | 59ab73e5527f52aa8d48722a01fbb9079a9c37eb | /src/main/java/com/tfjybj/framework/mybatis/interceptor/SqlMonitorInterceptor.java | 21e9341e098b7096880b44ec107cc736cabfd8df | [] | no_license | muxiaqiu/itoo-framwork | ff16c27051c6d19d76109edc774dd05dfb6b03c3 | a87b53967761a191f462501516d8d3df9b6ca7ba | refs/heads/master | 2022-07-01T12:29:14.421847 | 2020-01-18T08:30:10 | 2020-01-18T08:30:10 | 234,257,263 | 0 | 0 | null | 2022-06-17T02:53:06 | 2020-01-16T07:07:16 | Java | UTF-8 | Java | false | false | 8,124 | java | package com.tfjybj.framework.mybatis.interceptor;
import com.tfjybj.framework.auth.util.TraceUtil;
import com.tfjybj.framework.auth.util.evn.StackTraceUtil;
import com.tfjybj.framework.json.JsonHelper;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ParameterMapping;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.TypeHandlerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.text.DateFormat;
import java.util.*;
/**
* Created by will on 24/05/2017.
*/
@Intercepts({
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}),
@Signature(type = Executor.class,
method = "query",
args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class,
CacheKey.class, BoundSql.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class})
})
public class SqlMonitorInterceptor implements Interceptor {
private static final Logger logger = LoggerFactory.getLogger(SqlMonitorInterceptor.class);
private ThreadLocal<Long> beginTime = new ThreadLocal<>();
private static String getParameterValue(Object obj) {
String value = null;
if (obj instanceof String) {
value = "'" + obj.toString() + "'";
} else if (obj instanceof Date) {
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.CHINA);
value = "'" + formatter.format(new Date()) + "'";
} else {
if (obj != null) {
value = obj.toString();
} else {
value = "";
}
}
return value;
}
@Override
public Object intercept(Invocation invocation) throws Throwable {
Object result = "";
beginTime.set(System.currentTimeMillis());
try {
result = invocation.proceed();
} catch (Exception e) {
doAfterInvocation(invocation, null, e);
throw e;
}
doAfterInvocation(invocation, result, null);
return result;
}
@Override
public Object plugin(Object target) {
return Plugin.wrap(target, this); //mybatis提供的包装工具类
}
@Override
public void setProperties(Properties properties) {
}
private void doAfterInvocation(Invocation invocation, Object result, Exception ex) {
long elapsed = System.currentTimeMillis() - beginTime.get();
try {
Object[] arguments = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) arguments[0];
String sqlId = mappedStatement.getId();
Object parameter = null;
if (arguments.length > 1) {
parameter = arguments[1];
}
BoundSql boundSql = mappedStatement.getBoundSql(parameter);
Object paramObject = boundSql.getParameterObject();
Configuration configuration = mappedStatement.getConfiguration();
// String sql = boundSql.getSql().toLowerCase(Locale.CHINA).replaceAll("[\\s]+", " ");
String real = showSql(configuration, boundSql);
StringBuilder logInfo = new StringBuilder();
logInfo.setLength(0);
logInfo.append("〖SQL〗 " + String.format("%6d ms", elapsed));
logInfo.append("【 " + real + " 】");
Map<String, Object> monitorMap = new HashMap<>();
monitorMap.put("method", sqlId);
monitorMap.put("commandType", mappedStatement.getSqlCommandType());
//monitorMap.put("sql", sql);
// monitorMap.put("real", real);
// if (paramObject instanceof Map) {
// monitorMap.put("param", MapUtil.camelToUnderline((Map) paramObject));
// } else if (paramObject instanceof List) {
// monitorMap.put("param", MapUtil.camelToUnderline((List) paramObject));
// } else {
// monitorMap.put("param", paramObject);
// }
monitorMap.put("elapsed", elapsed);
if (ex == null) {
monitorMap.put("status", 1);
//monitorMap.put("result", result);
} else {
monitorMap.put("status", 0);
monitorMap.put("error", ((InvocationTargetException) ex).getCause().getMessage());
}
Map traceInfoMap = TraceUtil.getTraceInfo();
if (traceInfoMap != null) {
monitorMap.put("trace_info".intern(), JsonHelper.toJson(traceInfoMap));
}
// 非现网环境,日志需要限制,否则日志量太大,运维支持力度不够
/*boolean hasLog = EnvManager.LogDebugMode;
if (elapsed >= 100) {
hasLog = true;
}
if (mappedStatement.getSqlCommandType() != SqlCommandType.SELECT) {
hasLog = true;
}
if (hasLog) {
LogCollectManager.common(monitorMap, logInfo.toString(), "sql");
}*/
} catch (Exception e) {
logger.error(StackTraceUtil.getStackTraceEx(e));
}
}
private String getSqlId(Object[] arguments) {
MappedStatement mappedStatement = (MappedStatement) arguments[0];
return mappedStatement.getId();
}
private String getSqlStatement(Object[] arguments) {
MappedStatement mappedStatement = (MappedStatement) arguments[0];
Object parameter = null;
if (arguments.length > 1) {
parameter = arguments[1];
}
String sqlId = mappedStatement.getId();
BoundSql boundSql = mappedStatement.getBoundSql(parameter);
Configuration configuration = mappedStatement.getConfiguration();
String sql = showSql(configuration, boundSql);
StringBuilder str = new StringBuilder(100);
str.append(sqlId);
str.append(":");
str.append(sql);
// str.append(":");
return str.toString();
}
public String showSql(Configuration configuration, BoundSql boundSql) {
Object parameterObject = boundSql.getParameterObject();
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
String sql = boundSql.getSql().replaceAll("[\\s]+", " ");
if (parameterMappings.size() > 0 && parameterObject != null) {
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
if (typeHandlerRegistry.hasTypeHandler(parameterObject.getClass())) {
sql = sql.replaceFirst("\\?", getParameterValue(parameterObject));
} else {
MetaObject metaObject = configuration.newMetaObject(parameterObject);
for (ParameterMapping parameterMapping : parameterMappings) {
String propertyName = parameterMapping.getProperty();
if (metaObject.hasGetter(propertyName)) {
Object obj = metaObject.getValue(propertyName);
sql = sql.replaceFirst("\\?", getParameterValue(obj));
} else if (boundSql.hasAdditionalParameter(propertyName)) {
Object obj = boundSql.getAdditionalParameter(propertyName);
sql = sql.replaceFirst("\\?", getParameterValue(obj));
}
}
}
}
return sql;
}
}
| [
"[email protected]"
] | |
b318900b643b89d963a9e4ac12f6ad63b4232551 | fa51687f6aa32d57a9f5f4efc6dcfda2806f244d | /jdk8-src/src/main/java/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java | c7aef85d6c94eede7c88c63235cda2c43f4fcb24 | [] | no_license | yida-lxw/jdk8 | 44bad6ccd2d81099bea11433c8f2a0fc2e589eaa | 9f69e5f33eb5ab32e385301b210db1e49e919aac | refs/heads/master | 2022-12-29T23:56:32.001512 | 2020-04-27T04:14:10 | 2020-04-27T04:14:10 | 258,988,898 | 0 | 1 | null | 2020-10-13T21:32:05 | 2020-04-26T09:21:22 | Java | UTF-8 | Java | false | false | 53,609 | java | /*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 1999-2005 The Apache Software Foundation.
*
* 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.sun.org.apache.xml.internal.serialize;
import com.sun.org.apache.xerces.internal.dom.AbortException;
import com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl;
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl;
import com.sun.org.apache.xerces.internal.dom.DOMLocatorImpl;
import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
import com.sun.org.apache.xerces.internal.dom.DOMNormalizer;
import com.sun.org.apache.xerces.internal.dom.DOMStringListImpl;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
import com.sun.org.apache.xerces.internal.util.DOMUtil;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XML11Char;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import org.w3c.dom.Attr;
import org.w3c.dom.Comment;
import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMError;
import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.DOMException;
import org.w3c.dom.DOMStringList;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.ls.LSException;
import org.w3c.dom.ls.LSOutput;
import org.w3c.dom.ls.LSSerializer;
import org.w3c.dom.ls.LSSerializerFilter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.StringTokenizer;
import java.util.Vector;
/**
* EXPERIMENTAL: Implemenatation of DOM Level 3 org.w3c.ls.LSSerializer by delegating serialization
* calls to <CODE>XMLSerializer</CODE>.
* LSSerializer provides an API for serializing (writing) a DOM document out in an
* XML document. The XML data is written to an output stream.
* During serialization of XML data, namespace fixup is done when possible as
* defined in DOM Level 3 Core, Appendix B.
*
* @author Elena Litani, IBM
* @author Gopal Sharma, Sun Microsystems
* @author Arun Yadav, Sun Microsystems
* @author Sunitha Reddy, Sun Microsystems
* @version $Id: DOMSerializerImpl.java,v 1.11 2010-11-01 04:40:36 joehw Exp $
*/
public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
// TODO: When DOM Level 3 goes to REC replace method calls using
// reflection for: getXmlEncoding, getInputEncoding and getXmlEncoding
// with regular static calls on the Document object.
// data
// serializer
private XMLSerializer serializer;
// XML 1.1 serializer
private XML11Serializer xml11Serializer;
//Recognized parameters
private DOMStringList fRecognizedParameters;
/**
* REVISIT: Currently we handle 3 different configurations, would be nice just have one configuration
* that has different recognized parameters depending if it is used in Core/LS.
*/
protected short features = 0;
protected final static short NAMESPACES = 0x1 << 0;
protected final static short WELLFORMED = 0x1 << 1;
protected final static short ENTITIES = 0x1 << 2;
protected final static short CDATA = 0x1 << 3;
protected final static short SPLITCDATA = 0x1 << 4;
protected final static short COMMENTS = 0x1 << 5;
protected final static short DISCARDDEFAULT = 0x1 << 6;
protected final static short INFOSET = 0x1 << 7;
protected final static short XMLDECL = 0x1 << 8;
protected final static short NSDECL = 0x1 << 9;
protected final static short DOM_ELEMENT_CONTENT_WHITESPACE = 0x1 << 10;
protected final static short FORMAT_PRETTY_PRINT = 0x1 << 11;
// well-formness checking
private DOMErrorHandler fErrorHandler = null;
private final DOMErrorImpl fError = new DOMErrorImpl();
private final DOMLocatorImpl fLocator = new DOMLocatorImpl();
/**
* Constructs a new LSSerializer.
* The constructor turns on the namespace support in <code>XMLSerializer</code> and
* initializes the following fields: fNSBinder, fLocalNSBinder, fSymbolTable,
* fEmptySymbol, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter, fFeatures.
*/
public DOMSerializerImpl() {
// set default features
features |= NAMESPACES;
features |= ENTITIES;
features |= COMMENTS;
features |= CDATA;
features |= SPLITCDATA;
features |= WELLFORMED;
features |= NSDECL;
features |= DOM_ELEMENT_CONTENT_WHITESPACE;
features |= DISCARDDEFAULT;
features |= XMLDECL;
serializer = new XMLSerializer();
initSerializer(serializer);
}
//
// LSSerializer methods
//
public DOMConfiguration getDomConfig() {
return this;
}
/**
* DOM L3-EXPERIMENTAL:
* Setter for boolean and object parameters
*/
public void setParameter(String name, Object value) throws DOMException {
if (value instanceof Boolean) {
boolean state = ((Boolean) value).booleanValue();
if (name.equalsIgnoreCase(Constants.DOM_INFOSET)) {
if (state) {
features &= ~ENTITIES;
features &= ~CDATA;
features |= NAMESPACES;
features |= NSDECL;
features |= WELLFORMED;
features |= COMMENTS;
}
// false does not have any effect
} else if (name.equalsIgnoreCase(Constants.DOM_XMLDECL)) {
features =
(short) (state ? features | XMLDECL : features & ~XMLDECL);
} else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)) {
features =
(short) (state
? features | NAMESPACES
: features & ~NAMESPACES);
serializer.fNamespaces = state;
} else if (name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)) {
features =
(short) (state
? features | SPLITCDATA
: features & ~SPLITCDATA);
} else if (name.equalsIgnoreCase(Constants.DOM_DISCARD_DEFAULT_CONTENT)) {
features =
(short) (state
? features | DISCARDDEFAULT
: features & ~DISCARDDEFAULT);
} else if (name.equalsIgnoreCase(Constants.DOM_WELLFORMED)) {
features =
(short) (state
? features | WELLFORMED
: features & ~WELLFORMED);
} else if (name.equalsIgnoreCase(Constants.DOM_ENTITIES)) {
features =
(short) (state
? features | ENTITIES
: features & ~ENTITIES);
} else if (name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS)) {
features =
(short) (state
? features | CDATA
: features & ~CDATA);
} else if (name.equalsIgnoreCase(Constants.DOM_COMMENTS)) {
features =
(short) (state
? features | COMMENTS
: features & ~COMMENTS);
} else if (name.equalsIgnoreCase(Constants.DOM_FORMAT_PRETTY_PRINT)) {
features =
(short) (state
? features | FORMAT_PRETTY_PRINT
: features & ~FORMAT_PRETTY_PRINT);
} else if (name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE)
|| name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION)
|| name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION)) {
// || name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)) {
// true is not supported
if (state) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_SUPPORTED",
new Object[]{name});
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
}
} else if (
name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) {
//namespace-declaration has effect only if namespaces is true
features =
(short) (state
? features | NSDECL
: features & ~NSDECL);
serializer.fNamespacePrefixes = state;
} else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE)
|| name.equalsIgnoreCase(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
// false is not supported
if (!state) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_SUPPORTED",
new Object[]{name});
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
}
} else {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_FOUND",
new Object[]{name});
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
}
} else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER)) {
if (value == null || value instanceof DOMErrorHandler) {
fErrorHandler = (DOMErrorHandler) value;
} else {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"TYPE_MISMATCH_ERR",
new Object[]{name});
throw new DOMException(DOMException.TYPE_MISMATCH_ERR, msg);
}
} else if (
name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)
|| name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)
|| name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)
|| name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)
&& value != null) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_SUPPORTED",
new Object[]{name});
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
} else {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_FOUND",
new Object[]{name});
throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
}
}
/**
* DOM L3-EXPERIMENTAL:
* Check if parameter can be set
*/
public boolean canSetParameter(String name, Object state) {
if (state == null) {
return true;
}
if (state instanceof Boolean) {
boolean value = ((Boolean) state).booleanValue();
if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)
|| name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)
|| name.equalsIgnoreCase(Constants.DOM_DISCARD_DEFAULT_CONTENT)
|| name.equalsIgnoreCase(Constants.DOM_XMLDECL)
|| name.equalsIgnoreCase(Constants.DOM_WELLFORMED)
|| name.equalsIgnoreCase(Constants.DOM_INFOSET)
|| name.equalsIgnoreCase(Constants.DOM_ENTITIES)
|| name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS)
|| name.equalsIgnoreCase(Constants.DOM_COMMENTS)
|| name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)
|| name.equalsIgnoreCase(Constants.DOM_FORMAT_PRETTY_PRINT)) {
// both values supported
return true;
} else if (name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE)
|| name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION)
|| name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION)) {
// || name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)) {
// true is not supported
return !value;
} else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE)
|| name.equalsIgnoreCase(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
// false is not supported
return value;
}
} else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER) &&
state == null || state instanceof DOMErrorHandler) {
return true;
}
return false;
}
/**
* DOM Level 3 Core CR - Experimental.
* <p>
* The list of the parameters supported by this
* <code>DOMConfiguration</code> object and for which at least one value
* can be set by the application. Note that this list can also contain
* parameter names defined outside this specification.
*/
public DOMStringList getParameterNames() {
if (fRecognizedParameters == null) {
Vector parameters = new Vector();
//Add DOM recognized parameters
//REVISIT: Would have been nice to have a list of
//recognized parameters.
parameters.add(Constants.DOM_NAMESPACES);
parameters.add(Constants.DOM_SPLIT_CDATA);
parameters.add(Constants.DOM_DISCARD_DEFAULT_CONTENT);
parameters.add(Constants.DOM_XMLDECL);
parameters.add(Constants.DOM_CANONICAL_FORM);
parameters.add(Constants.DOM_VALIDATE_IF_SCHEMA);
parameters.add(Constants.DOM_VALIDATE);
parameters.add(Constants.DOM_CHECK_CHAR_NORMALIZATION);
parameters.add(Constants.DOM_DATATYPE_NORMALIZATION);
parameters.add(Constants.DOM_FORMAT_PRETTY_PRINT);
//parameters.add(Constants.DOM_NORMALIZE_CHARACTERS);
parameters.add(Constants.DOM_WELLFORMED);
parameters.add(Constants.DOM_INFOSET);
parameters.add(Constants.DOM_NAMESPACE_DECLARATIONS);
parameters.add(Constants.DOM_ELEMENT_CONTENT_WHITESPACE);
parameters.add(Constants.DOM_ENTITIES);
parameters.add(Constants.DOM_CDATA_SECTIONS);
parameters.add(Constants.DOM_COMMENTS);
parameters.add(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS);
parameters.add(Constants.DOM_ERROR_HANDLER);
//parameters.add(Constants.DOM_SCHEMA_LOCATION);
//parameters.add(Constants.DOM_SCHEMA_TYPE);
//Add recognized xerces features and properties
fRecognizedParameters = new DOMStringListImpl(parameters);
}
return fRecognizedParameters;
}
/**
* DOM L3-EXPERIMENTAL:
* Getter for boolean and object parameters
*/
public Object getParameter(String name) throws DOMException {
if (name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)) {
return null;
} else if (name.equalsIgnoreCase(Constants.DOM_COMMENTS)) {
return ((features & COMMENTS) != 0) ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)) {
return (features & NAMESPACES) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_XMLDECL)) {
return (features & XMLDECL) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS)) {
return (features & CDATA) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_ENTITIES)) {
return (features & ENTITIES) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)) {
return (features & SPLITCDATA) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_WELLFORMED)) {
return (features & WELLFORMED) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) {
return (features & NSDECL) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_FORMAT_PRETTY_PRINT)) {
return (features & FORMAT_PRETTY_PRINT) != 0 ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) ||
name.equalsIgnoreCase(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
return Boolean.TRUE;
} else if (name.equalsIgnoreCase(Constants.DOM_DISCARD_DEFAULT_CONTENT)) {
return ((features & DISCARDDEFAULT) != 0) ? Boolean.TRUE : Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_INFOSET)) {
if ((features & ENTITIES) == 0 &&
(features & CDATA) == 0 &&
(features & NAMESPACES) != 0 &&
(features & NSDECL) != 0 &&
(features & WELLFORMED) != 0 &&
(features & COMMENTS) != 0) {
return Boolean.TRUE;
}
return Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE)
|| name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION)) {
return Boolean.FALSE;
} else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER)) {
return fErrorHandler;
} else if (
name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)
|| name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)
|| name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_SUPPORTED",
new Object[]{name});
throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
} else {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"FEATURE_NOT_FOUND",
new Object[]{name});
throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
}
}
/**
* DOM L3 EXPERIMENTAL:
* Serialize the specified node as described above in the description of
* <code>LSSerializer</code>. The result of serializing the node is
* returned as a string. Writing a Document or Entity node produces a
* serialized form that is well formed XML. Writing other node types
* produces a fragment of text in a form that is not fully defined by
* this document, but that should be useful to a human for debugging or
* diagnostic purposes.
*
* @param wnode The node to be written.
* @return Returns the serialized data
* @throws DOMException DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a
* <code>DOMString</code>.
* @throws LSException SERIALIZE_ERR: Unable to serialize the node. DOM applications should
* attach a <code>DOMErrorHandler</code> using the parameter
* "<i>error-handler</i>" to get details on error.
*/
public String writeToString(Node wnode) throws DOMException, LSException {
// determine which serializer to use:
Document doc = (wnode.getNodeType() == Node.DOCUMENT_NODE) ? (Document) wnode : wnode.getOwnerDocument();
Method getVersion = null;
XMLSerializer ser = null;
String ver = null;
// this should run under JDK 1.1.8...
try {
getVersion = doc.getClass().getMethod("getXmlVersion", new Class[]{});
if (getVersion != null) {
ver = (String) getVersion.invoke(doc, (Object[]) null);
}
} catch (Exception e) {
// no way to test the version...
// ignore the exception
}
if (ver != null && ver.equals("1.1")) {
if (xml11Serializer == null) {
xml11Serializer = new XML11Serializer();
initSerializer(xml11Serializer);
}
// copy setting from "main" serializer to XML 1.1 serializer
copySettings(serializer, xml11Serializer);
ser = xml11Serializer;
} else {
ser = serializer;
}
StringWriter destination = new StringWriter();
try {
prepareForSerialization(ser, wnode);
ser._format.setEncoding("UTF-16");
ser.setOutputCharStream(destination);
if (wnode.getNodeType() == Node.DOCUMENT_NODE) {
ser.serialize((Document) wnode);
} else if (wnode.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) {
ser.serialize((DocumentFragment) wnode);
} else if (wnode.getNodeType() == Node.ELEMENT_NODE) {
ser.serialize((Element) wnode);
} else if (wnode.getNodeType() == Node.TEXT_NODE ||
wnode.getNodeType() == Node.COMMENT_NODE ||
wnode.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
wnode.getNodeType() == Node.CDATA_SECTION_NODE ||
wnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
ser.serialize(wnode);
} else {
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"unable-to-serialize-node", null);
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fType = "unable-to-serialize-node";
error.fMessage = msg;
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw new LSException(LSException.SERIALIZE_ERR, msg);
}
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
} catch (AbortException e) {
return null;
} catch (RuntimeException e) {
throw (LSException) new LSException(LSException.SERIALIZE_ERR, e.toString()).initCause(e);
} catch (IOException ioe) {
// REVISIT: A generic IOException doesn't provide enough information
// to determine that the serialized document is too large to fit
// into a string. This could have thrown for some other reason. -- mrglavas
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"STRING_TOO_LONG",
new Object[]{ioe.getMessage()});
throw (DOMException) new DOMException(DOMException.DOMSTRING_SIZE_ERR, msg).initCause(ioe);
}
return destination.toString();
}
/**
* DOM L3 EXPERIMENTAL:
* The end-of-line sequence of characters to be used in the XML being
* written out. The only permitted values are these:
* <dl>
* <dt><code>null</code></dt>
* <dd>
* Use a default end-of-line sequence. DOM implementations should choose
* the default to match the usual convention for text files in the
* environment being used. Implementations must choose a default
* sequence that matches one of those allowed by 2.11 "End-of-Line
* Handling". </dd>
* <dt>CR</dt>
* <dd>The carriage-return character (#xD).</dd>
* <dt>CR-LF</dt>
* <dd> The
* carriage-return and line-feed characters (#xD #xA). </dd>
* <dt>LF</dt>
* <dd> The line-feed
* character (#xA). </dd>
* </dl>
* <br>The default value for this attribute is <code>null</code>.
*/
public void setNewLine(String newLine) {
serializer._format.setLineSeparator(newLine);
}
/**
* DOM L3 EXPERIMENTAL:
* The end-of-line sequence of characters to be used in the XML being
* written out. The only permitted values are these:
* <dl>
* <dt><code>null</code></dt>
* <dd>
* Use a default end-of-line sequence. DOM implementations should choose
* the default to match the usual convention for text files in the
* environment being used. Implementations must choose a default
* sequence that matches one of those allowed by 2.11 "End-of-Line
* Handling". </dd>
* <dt>CR</dt>
* <dd>The carriage-return character (#xD).</dd>
* <dt>CR-LF</dt>
* <dd> The
* carriage-return and line-feed characters (#xD #xA). </dd>
* <dt>LF</dt>
* <dd> The line-feed
* character (#xA). </dd>
* </dl>
* <br>The default value for this attribute is <code>null</code>.
*/
public String getNewLine() {
return serializer._format.getLineSeparator();
}
/**
* When the application provides a filter, the serializer will call out
* to the filter before serializing each Node. Attribute nodes are never
* passed to the filter. The filter implementation can choose to remove
* the node from the stream or to terminate the serialization early.
*/
public LSSerializerFilter getFilter() {
return serializer.fDOMFilter;
}
/**
* When the application provides a filter, the serializer will call out
* to the filter before serializing each Node. Attribute nodes are never
* passed to the filter. The filter implementation can choose to remove
* the node from the stream or to terminate the serialization early.
*/
public void setFilter(LSSerializerFilter filter) {
serializer.fDOMFilter = filter;
}
// this initializes a newly-created serializer
private void initSerializer(XMLSerializer ser) {
ser.fNSBinder = new NamespaceSupport();
ser.fLocalNSBinder = new NamespaceSupport();
ser.fSymbolTable = new SymbolTable();
}
// copies all settings that could have been modified
// by calls to LSSerializer methods from one serializer to another.
// IMPORTANT: if new methods are implemented or more settings of
// the serializer are made alterable, this must be
// reflected in this method!
private void copySettings(XMLSerializer src, XMLSerializer dest) {
dest.fDOMErrorHandler = fErrorHandler;
dest._format.setEncoding(src._format.getEncoding());
dest._format.setLineSeparator(src._format.getLineSeparator());
dest.fDOMFilter = src.fDOMFilter;
}//copysettings
/**
* Serialize the specified node as described above in the general
* description of the <code>LSSerializer</code> interface. The output
* is written to the supplied <code>LSOutput</code>.
* <br> When writing to a <code>LSOutput</code>, the encoding is found by
* looking at the encoding information that is reachable through the
* <code>LSOutput</code> and the item to be written (or its owner
* document) in this order:
* <ol>
* <li> <code>LSOutput.encoding</code>,
* </li>
* <li>
* <code>Document.actualEncoding</code>,
* </li>
* <li>
* <code>Document.xmlEncoding</code>.
* </li>
* </ol>
* <br> If no encoding is reachable through the above properties, a
* default encoding of "UTF-8" will be used.
* <br> If the specified encoding is not supported an
* "unsupported-encoding" error is raised.
* <br> If no output is specified in the <code>LSOutput</code>, a
* "no-output-specified" error is raised.
*
* @param node The node to serialize.
* @param destination The destination for the serialized DOM.
* @return Returns <code>true</code> if <code>node</code> was
* successfully serialized and <code>false</code> in case the node
* couldn't be serialized.
*/
public boolean write(Node node, LSOutput destination) throws LSException {
if (node == null)
return false;
Method getVersion = null;
XMLSerializer ser = null;
String ver = null;
Document fDocument = (node.getNodeType() == Node.DOCUMENT_NODE)
? (Document) node
: node.getOwnerDocument();
// this should run under JDK 1.1.8...
try {
getVersion = fDocument.getClass().getMethod("getXmlVersion", new Class[]{});
if (getVersion != null) {
ver = (String) getVersion.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
//no way to test the version...
//ignore the exception
}
//determine which serializer to use:
if (ver != null && ver.equals("1.1")) {
if (xml11Serializer == null) {
xml11Serializer = new XML11Serializer();
initSerializer(xml11Serializer);
}
//copy setting from "main" serializer to XML 1.1 serializer
copySettings(serializer, xml11Serializer);
ser = xml11Serializer;
} else {
ser = serializer;
}
String encoding = null;
if ((encoding = destination.getEncoding()) == null) {
try {
Method getEncoding =
fDocument.getClass().getMethod("getInputEncoding", new Class[]{});
if (getEncoding != null) {
encoding = (String) getEncoding.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
// ignore the exception
}
if (encoding == null) {
try {
Method getEncoding =
fDocument.getClass().getMethod("getXmlEncoding", new Class[]{});
if (getEncoding != null) {
encoding = (String) getEncoding.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
// ignore the exception
}
if (encoding == null) {
encoding = "UTF-8";
}
}
}
try {
prepareForSerialization(ser, node);
ser._format.setEncoding(encoding);
OutputStream outputStream = destination.getByteStream();
Writer writer = destination.getCharacterStream();
String uri = destination.getSystemId();
if (writer == null) {
if (outputStream == null) {
if (uri == null) {
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"no-output-specified", null);
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fType = "no-output-specified";
error.fMessage = msg;
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw new LSException(LSException.SERIALIZE_ERR, msg);
} else {
// URI was specified. Handle relative URIs.
String expanded = XMLEntityManager.expandSystemId(uri, null, true);
URL url = new URL(expanded != null ? expanded : uri);
OutputStream out = null;
String protocol = url.getProtocol();
String host = url.getHost();
// Use FileOutputStream if this URI is for a local file.
if (protocol.equals("file")
&& (host == null || host.length() == 0 || host.equals("localhost"))) {
out = new FileOutputStream(getPathWithoutEscapes(url.getFile()));
}
// Try to write to some other kind of URI. Some protocols
// won't support this, though HTTP should work.
else {
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false); // Enable tunneling.
if (urlCon instanceof HttpURLConnection) {
// The DOM L3 LS CR says if we are writing to an HTTP URI
// it is to be done with an HTTP PUT.
HttpURLConnection httpCon = (HttpURLConnection) urlCon;
httpCon.setRequestMethod("PUT");
}
out = urlCon.getOutputStream();
}
ser.setOutputByteStream(out);
}
} else {
// byte stream was specified
ser.setOutputByteStream(outputStream);
}
} else {
// character stream is specified
ser.setOutputCharStream(writer);
}
if (node.getNodeType() == Node.DOCUMENT_NODE)
ser.serialize((Document) node);
else if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)
ser.serialize((DocumentFragment) node);
else if (node.getNodeType() == Node.ELEMENT_NODE)
ser.serialize((Element) node);
else if (node.getNodeType() == Node.TEXT_NODE ||
node.getNodeType() == Node.COMMENT_NODE ||
node.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
node.getNodeType() == Node.CDATA_SECTION_NODE ||
node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
ser.serialize(node);
} else
return false;
} catch (UnsupportedEncodingException ue) {
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = ue;
error.fType = "unsupported-encoding";
error.fMessage = ue.getMessage();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw new LSException(LSException.SERIALIZE_ERR,
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.SERIALIZER_DOMAIN,
"unsupported-encoding", null));
//return false;
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
} catch (AbortException e) {
return false;
} catch (RuntimeException e) {
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
} catch (Exception e) {
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = e;
error.fMessage = e.getMessage();
error.fSeverity = DOMError.SEVERITY_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
}
return true;
} //write
/**
* Serialize the specified node as described above in the general
* description of the <code>LSSerializer</code> interface. The output
* is written to the supplied URI.
* <br> When writing to a URI, the encoding is found by looking at the
* encoding information that is reachable through the item to be written
* (or its owner document) in this order:
* <ol>
* <li>
* <code>Document.inputEncoding</code>,
* </li>
* <li>
* <code>Document.xmlEncoding</code>.
* </li>
* </ol>
* <br> If no encoding is reachable through the above properties, a
* default encoding of "UTF-8" will be used.
* <br> If the specified encoding is not supported an
* "unsupported-encoding" error is raised.
*
* @param node The node to serialize.
* @param URI The URI to write to.
* @return Returns <code>true</code> if <code>node</code> was
* successfully serialized and <code>false</code> in case the node
* couldn't be serialized.
*/
public boolean writeToURI(Node node, String URI) throws LSException {
if (node == null) {
return false;
}
Method getXmlVersion = null;
XMLSerializer ser = null;
String ver = null;
String encoding = null;
Document fDocument = (node.getNodeType() == Node.DOCUMENT_NODE)
? (Document) node
: node.getOwnerDocument();
// this should run under JDK 1.1.8...
try {
getXmlVersion =
fDocument.getClass().getMethod("getXmlVersion", new Class[]{});
if (getXmlVersion != null) {
ver = (String) getXmlVersion.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
// no way to test the version...
// ignore the exception
}
if (ver != null && ver.equals("1.1")) {
if (xml11Serializer == null) {
xml11Serializer = new XML11Serializer();
initSerializer(xml11Serializer);
}
// copy setting from "main" serializer to XML 1.1 serializer
copySettings(serializer, xml11Serializer);
ser = xml11Serializer;
} else {
ser = serializer;
}
try {
Method getEncoding =
fDocument.getClass().getMethod("getInputEncoding", new Class[]{});
if (getEncoding != null) {
encoding = (String) getEncoding.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
// ignore the exception
}
if (encoding == null) {
try {
Method getEncoding =
fDocument.getClass().getMethod("getXmlEncoding", new Class[]{});
if (getEncoding != null) {
encoding = (String) getEncoding.invoke(fDocument, (Object[]) null);
}
} catch (Exception e) {
// ignore the exception
}
if (encoding == null) {
encoding = "UTF-8";
}
}
try {
prepareForSerialization(ser, node);
ser._format.setEncoding(encoding);
// URI was specified. Handle relative URIs.
String expanded = XMLEntityManager.expandSystemId(URI, null, true);
URL url = new URL(expanded != null ? expanded : URI);
OutputStream out = null;
String protocol = url.getProtocol();
String host = url.getHost();
// Use FileOutputStream if this URI is for a local file.
if (protocol.equals("file")
&& (host == null || host.length() == 0 || host.equals("localhost"))) {
out = new FileOutputStream(getPathWithoutEscapes(url.getFile()));
}
// Try to write to some other kind of URI. Some protocols
// won't support this, though HTTP should work.
else {
URLConnection urlCon = url.openConnection();
urlCon.setDoInput(false);
urlCon.setDoOutput(true);
urlCon.setUseCaches(false); // Enable tunneling.
if (urlCon instanceof HttpURLConnection) {
// The DOM L3 LS CR says if we are writing to an HTTP URI
// it is to be done with an HTTP PUT.
HttpURLConnection httpCon = (HttpURLConnection) urlCon;
httpCon.setRequestMethod("PUT");
}
out = urlCon.getOutputStream();
}
ser.setOutputByteStream(out);
if (node.getNodeType() == Node.DOCUMENT_NODE)
ser.serialize((Document) node);
else if (node.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)
ser.serialize((DocumentFragment) node);
else if (node.getNodeType() == Node.ELEMENT_NODE)
ser.serialize((Element) node);
else if (node.getNodeType() == Node.TEXT_NODE ||
node.getNodeType() == Node.COMMENT_NODE ||
node.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
node.getNodeType() == Node.CDATA_SECTION_NODE ||
node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
ser.serialize(node);
} else
return false;
} catch (LSException lse) {
// Rethrow LSException.
throw lse;
} catch (AbortException e) {
return false;
} catch (RuntimeException e) {
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
} catch (Exception e) {
if (ser.fDOMErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = e;
error.fMessage = e.getMessage();
error.fSeverity = DOMError.SEVERITY_ERROR;
ser.fDOMErrorHandler.handleError(error);
}
throw (LSException) DOMUtil.createLSException(LSException.SERIALIZE_ERR, e).fillInStackTrace();
}
return true;
} //writeURI
//
// Private methods
//
private void prepareForSerialization(XMLSerializer ser, Node node) {
ser.reset();
ser.features = features;
ser.fDOMErrorHandler = fErrorHandler;
ser.fNamespaces = (features & NAMESPACES) != 0;
ser.fNamespacePrefixes = (features & NSDECL) != 0;
ser._format.setOmitComments((features & COMMENTS) == 0);
ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);
ser._format.setIndenting((features & FORMAT_PRETTY_PRINT) != 0);
if ((features & WELLFORMED) != 0) {
// REVISIT: this is inefficient implementation of well-formness. Instead, we should check
// well-formness as we serialize the tree
Node next, root;
root = node;
Method versionChanged;
boolean verifyNames = true;
Document document = (node.getNodeType() == Node.DOCUMENT_NODE)
? (Document) node
: node.getOwnerDocument();
try {
versionChanged = document.getClass().getMethod("isXMLVersionChanged()", new Class[]{});
if (versionChanged != null) {
verifyNames = ((Boolean) versionChanged.invoke(document, (Object[]) null)).booleanValue();
}
} catch (Exception e) {
//no way to test the version...
//ignore the exception
}
if (node.getFirstChild() != null) {
while (node != null) {
verify(node, verifyNames, false);
// Move down to first child
next = node.getFirstChild();
// No child nodes, so walk tree
while (next == null) {
// Move to sibling if possible.
next = node.getNextSibling();
if (next == null) {
node = node.getParentNode();
if (root == node) {
next = null;
break;
}
next = node.getNextSibling();
}
}
node = next;
}
} else {
verify(node, verifyNames, false);
}
}
}
private void verify(Node node, boolean verifyNames, boolean xml11Version) {
int type = node.getNodeType();
fLocator.fRelatedNode = node;
boolean wellformed;
switch (type) {
case Node.DOCUMENT_NODE: {
break;
}
case Node.DOCUMENT_TYPE_NODE: {
break;
}
case Node.ELEMENT_NODE: {
if (verifyNames) {
if ((features & NAMESPACES) != 0) {
wellformed = CoreDocumentImpl.isValidQName(node.getPrefix(), node.getLocalName(), xml11Version);
} else {
wellformed = CoreDocumentImpl.isXMLName(node.getNodeName(), xml11Version);
}
if (!wellformed) {
if (!wellformed) {
if (fErrorHandler != null) {
String msg = DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"wf-invalid-character-in-node-name",
new Object[]{"Element", node.getNodeName()});
DOMNormalizer.reportDOMError(fErrorHandler, fError, fLocator, msg, DOMError.SEVERITY_FATAL_ERROR,
"wf-invalid-character-in-node-name");
}
}
}
}
NamedNodeMap attributes = (node.hasAttributes()) ? node.getAttributes() : null;
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); ++i) {
Attr attr = (Attr) attributes.item(i);
fLocator.fRelatedNode = attr;
DOMNormalizer.isAttrValueWF(fErrorHandler, fError, fLocator,
attributes, attr, attr.getValue(), xml11Version);
if (verifyNames) {
wellformed = CoreDocumentImpl.isXMLName(attr.getNodeName(), xml11Version);
if (!wellformed) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"wf-invalid-character-in-node-name",
new Object[]{"Attr", node.getNodeName()});
DOMNormalizer.reportDOMError(fErrorHandler, fError, fLocator, msg, DOMError.SEVERITY_FATAL_ERROR,
"wf-invalid-character-in-node-name");
}
}
}
}
break;
}
case Node.COMMENT_NODE: {
// only verify well-formness if comments included in the tree
if ((features & COMMENTS) != 0)
DOMNormalizer.isCommentWF(fErrorHandler, fError, fLocator, ((Comment) node).getData(), xml11Version);
break;
}
case Node.ENTITY_REFERENCE_NODE: {
// only if entity is preserved in the tree
if (verifyNames && (features & ENTITIES) != 0) {
CoreDocumentImpl.isXMLName(node.getNodeName(), xml11Version);
}
break;
}
case Node.CDATA_SECTION_NODE: {
// verify content
DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, node.getNodeValue(), xml11Version);
// the ]]> string will be checked during serialization
break;
}
case Node.TEXT_NODE: {
DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, node.getNodeValue(), xml11Version);
break;
}
case Node.PROCESSING_INSTRUCTION_NODE: {
ProcessingInstruction pinode = (ProcessingInstruction) node;
String target = pinode.getTarget();
if (verifyNames) {
if (xml11Version) {
wellformed = XML11Char.isXML11ValidName(target);
} else {
wellformed = XMLChar.isValidName(target);
}
if (!wellformed) {
String msg =
DOMMessageFormatter.formatMessage(
DOMMessageFormatter.DOM_DOMAIN,
"wf-invalid-character-in-node-name",
new Object[]{"Element", node.getNodeName()});
DOMNormalizer.reportDOMError(
fErrorHandler,
fError,
fLocator,
msg,
DOMError.SEVERITY_FATAL_ERROR,
"wf-invalid-character-in-node-name");
}
}
DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, pinode.getData(), xml11Version);
break;
}
}
}
private String getPathWithoutEscapes(String origPath) {
if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) {
// Locate the escape characters
StringTokenizer tokenizer = new StringTokenizer(origPath, "%");
StringBuffer result = new StringBuffer(origPath.length());
int size = tokenizer.countTokens();
result.append(tokenizer.nextToken());
for (int i = 1; i < size; ++i) {
String token = tokenizer.nextToken();
// Decode the 2 digit hexadecimal number following % in '%nn'
result.append((char) Integer.valueOf(token.substring(0, 2), 16).intValue());
result.append(token.substring(2));
}
return result.toString();
}
return origPath;
}
}//DOMSerializerImpl
| [
"[email protected]"
] | |
4a29ec3303b09577b146e8a350bad5404a8d4d17 | 28d91b1169dc8ed0bd1584e1312da1b162889943 | /app/src/androidTest/java/ypx/com/demoshare/ExampleInstrumentedTest.java | 6f6d9a24f50e930b922c29ce7ce33cfa6439732d | [] | no_license | dark7510/AndroidStudioProjects | c9ddce7f53aabedd686e4d943e5e98e4b7b771ae | 444266d31c4bd2ebca3ae4e641bbbc5cd6d5a002 | refs/heads/master | 2021-01-20T03:52:58.523605 | 2017-04-27T12:52:02 | 2017-04-27T12:52:02 | 89,596,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package ypx.com.demoshare;
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.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("ypx.com.demoshare", appContext.getPackageName());
}
}
| [
"dark pei"
] | dark pei |
7a74ce9b53a9bfee0c74dfc4013ec4732e47bc8d | d3419ceaa95c3f112b4e17447bdd3d2b5ddef6a9 | /src/main/java/org/phantomapi/nms/FakeEquipment.java | b07ff1264dd14273e29f18571189e253592befd9 | [
"WTFPL"
] | permissive | DiyarSavda/Phantom | 97f1185da2409b68a959512fdfb6126ddd276044 | f2f293692d1d7790d0dfb018f689f46f6bb7ff52 | refs/heads/master | 2021-01-01T17:15:04.167721 | 2017-07-22T13:37:57 | 2017-07-22T13:37:57 | 98,033,512 | 0 | 0 | null | 2017-07-22T13:37:00 | 2017-07-22T13:37:00 | null | UTF-8 | Java | false | false | 8,300 | java | package org.phantomapi.nms;
import static com.comphenix.protocol.PacketType.Play.Server.ENTITY_EQUIPMENT;
import static com.comphenix.protocol.PacketType.Play.Server.NAMED_ENTITY_SPAWN;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.events.PacketListener;
import com.google.common.base.Preconditions;
import com.google.common.collect.MapMaker;
/**
* Modify player equipment.
*
* @author Kristian
*/
public abstract class FakeEquipment
{
/**
* Represents an equipment slot.
*
* @author Kristian
*/
public enum EquipmentSlot
{
HELD(0),
BOOTS(1),
LEGGINGS(2),
CHESTPLATE(3),
HELMET(4);
private int id;
private EquipmentSlot(int id)
{
this.id = id;
}
/**
* Retrieve the entity's equipment in the current slot.
*
* @param entity
* - the entity.
* @return The equipment.
*/
@SuppressWarnings("deprecation")
public ItemStack getEquipment(LivingEntity entity)
{
switch(this)
{
case HELD:
return entity.getEquipment().getItemInHand();
case BOOTS:
return entity.getEquipment().getBoots();
case LEGGINGS:
return entity.getEquipment().getLeggings();
case CHESTPLATE:
return entity.getEquipment().getChestplate();
case HELMET:
return entity.getEquipment().getHelmet();
default:
throw new IllegalArgumentException("Unknown slot: " + this);
}
}
/**
* Determine if the entity has an equipment in the current slot.
*
* @param entity
* - the entity.
* @return TRUE if it is empty, FALSE otherwise.
*/
public boolean isEmpty(LivingEntity entity)
{
ItemStack stack = getEquipment(entity);
return stack != null && stack.getType() == Material.AIR;
}
/**
* Retrieve the underlying equipment slot ID.
*
* @return The ID.
*/
public int getId()
{
return id;
}
/**
* Find the corresponding equipment slot.
*
* @param id
* - the slot ID.
* @return The equipment slot.
*/
public static EquipmentSlot fromId(int id)
{
for(EquipmentSlot slot : values())
{
if(slot.getId() == id)
{
return slot;
}
}
throw new IllegalArgumentException("Cannot find slot id: " + id);
}
}
/**
* Represents an equipment event.
*
* @author Kristian
*/
public static class EquipmentSendingEvent
{
private Player client;
private LivingEntity visibleEntity;
private EquipmentSlot slot;
private ItemStack equipment;
private EquipmentSendingEvent(Player client, LivingEntity visibleEntity, EquipmentSlot slot, ItemStack equipment)
{
this.client = client;
this.visibleEntity = visibleEntity;
this.slot = slot;
this.equipment = equipment;
}
/**
* Retrieve the client that is observing the entity.
*
* @return The observing client.
*/
public Player getClient()
{
return client;
}
/**
* Retrieve the entity whose armor or held item we are updating.
*
* @return The visible entity.
*/
public LivingEntity getVisibleEntity()
{
return visibleEntity;
}
/**
* Retrieve the equipment that we are
*
* @return
*/
public ItemStack getEquipment()
{
return equipment;
}
/**
* Set the equipment we will send to the player.
*
* @param equipment
* - the equipment, or NULL to sent air.
*/
public void setEquipment(ItemStack equipment)
{
this.equipment = equipment;
}
/**
* Retrieve the slot of this equipment.
*
* @return The slot.
*/
public EquipmentSlot getSlot()
{
return slot;
}
/**
* Set the slot of this equipment.
*
* @param slot
* - the slot.
*/
public void setSlot(EquipmentSlot slot)
{
this.slot = Preconditions.checkNotNull(slot, "slot cannot be NULL");
}
}
private Map<Object, EquipmentSlot> processedPackets = new MapMaker().weakKeys().makeMap();
private Plugin plugin;
private ProtocolManager manager;
private PacketListener listener;
public FakeEquipment(Plugin plugin)
{
this.plugin = plugin;
manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(listener = new PacketAdapter(plugin, ENTITY_EQUIPMENT, NAMED_ENTITY_SPAWN)
{
@Override
public void onPacketSending(PacketEvent event)
{
try
{
PacketContainer packet = event.getPacket();
PacketType type = event.getPacketType();
LivingEntity visibleEntity = (LivingEntity) packet.getEntityModifier(event).read(0);
Player observingPlayer = event.getPlayer();
if(ENTITY_EQUIPMENT.equals(type))
{
EquipmentSlot slot = EquipmentSlot.fromId(packet.getIntegers().read(1));
ItemStack equipment = packet.getItemModifier().read(0);
EquipmentSendingEvent sendingEvent = new EquipmentSendingEvent(observingPlayer, visibleEntity, slot, equipment);
EquipmentSlot previous = processedPackets.get(packet.getHandle());
if(previous != null)
{
packet = event.getPacket().deepClone();
sendingEvent.setSlot(previous);
sendingEvent.setEquipment(previous.getEquipment(visibleEntity).clone());
}
if(onEquipmentSending(sendingEvent))
{
processedPackets.put(packet.getHandle(), previous != null ? previous : slot);
}
if(slot != sendingEvent.getSlot())
{
packet.getIntegers().write(1, slot.getId());
}
if(equipment != sendingEvent.getEquipment())
{
packet.getItemModifier().write(0, sendingEvent.getEquipment());
}
}
else if(NAMED_ENTITY_SPAWN.equals(type))
{
onEntitySpawn(observingPlayer, visibleEntity);
}
else
{
throw new IllegalArgumentException("Unknown packet type:" + type);
}
}
catch(Exception e)
{
}
}
});
}
/**
* Invoked when a living entity has been spawned on the given client.
*
* @param client
* - the client.
* @param visibleEntity
* - the visibleEntity.
*/
protected void onEntitySpawn(Player client, LivingEntity visibleEntity)
{
}
/**
* Invoked when the equipment or held item of an living entity is sent to a
* client.
* <p>
* This can be fully modified. Please return TRUE if you do, though.
*
* @param equipmentEvent
* - the equipment event.
* @return TRUE if the equipment was modified, FALSE otherwise.
*/
protected abstract boolean onEquipmentSending(EquipmentSendingEvent equipmentEvent);
/**
* Update the given slot.
*
* @param observer
* - the observing client.
* @param entity
* - the visible entity that will be updated.
* @param slot
* - the equipment slot to update.
*/
public void updateSlot(final Player client, LivingEntity visibleEntity, EquipmentSlot slot)
{
if(listener == null)
{
throw new IllegalStateException("FakeEquipment has closed.");
}
final PacketContainer equipmentPacket = new PacketContainer(ENTITY_EQUIPMENT);
equipmentPacket.getIntegers().write(0, visibleEntity.getEntityId()).write(1, slot.getId());
equipmentPacket.getItemModifier().write(0, slot.getEquipment(visibleEntity));
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
{
@Override
public void run()
{
try
{
ProtocolLibrary.getProtocolManager().sendServerPacket(client, equipmentPacket);
}
catch(InvocationTargetException e)
{
throw new RuntimeException("Unable to update slot.", e);
}
}
});
}
/**
* Close the current equipment modifier.
*/
public void close()
{
if(listener != null)
{
manager.removePacketListener(listener);
listener = null;
}
}
}
| [
"[email protected]"
] | |
f80a42ea8d51747f8e0f211de23a5fd67b29d9f6 | e5f262b89b272ef7c24edb74d165c9b8ec8f20e4 | /SSOJ Solutions/nye18p1.java | 6634ddc0495639ed44ca8799ab35799bf958e7c1 | [] | no_license | magicalsoup/Competitive-Programming-Solutions-Library | 289b9b891589cb773da0295274246b18e1334fd7 | edcc6928e74c82edd8546aefb118bacc15efe10e | refs/heads/master | 2023-01-13T19:52:30.773734 | 2022-12-27T21:13:30 | 2022-12-27T21:13:30 | 134,091,852 | 37 | 18 | null | 2018-05-20T14:34:53 | 2018-05-19T19:26:33 | Java | UTF-8 | Java | false | false | 275 | java | import java.util.*;
public class nye18p1 {
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n-- > 0) {
if(sc.nextInt() > 20) System.out.println("yes");
else System.out.println("no");
}
sc.close();
}
}
| [
"[email protected]"
] | |
5343bbb2039015122252cf64677d01f492a04c68 | 201e5acfc85f594e38938f3ea0376227fa589b03 | /app/src/main/java/com/desafios/testdagger/MainActivity.java | 7b9e7c55c642b9dcb2b25dd9e08e32ce6f0e0701 | [] | no_license | ktacarrasco/Desafio-TestDagger | dadb9b3d5312e35248519bebcbe15e53d43585cb | 5000a269e8c0df3d9c27d2ce81b27226f962dc4f | refs/heads/master | 2021-02-26T06:15:35.396498 | 2020-03-07T01:15:19 | 2020-03-07T01:15:19 | 245,501,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,492 | java | package com.desafios.testdagger;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.desafios.testdagger.model.Clase;
import com.desafios.testdagger.model.Conceptos;
import com.desafios.testdagger.model.Conclusion;
import com.desafios.testdagger.model.Curso;
public class MainActivity extends AppCompatActivity {
private Clase clase;
private TextView text;
private Button btnClean;
private Button btnMostrar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnClean = findViewById(R.id.btnClean);
btnMostrar = findViewById(R.id.btnEraser);
text = findViewById(R.id.textFrase);
IAppComponent component = DaggerIAppComponent.create();
clase = component.getClase();
clase.lineaClase();
btnMostrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show();
}
});
btnClean.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
clear();
}
});
}
private void show() {
text.setText(clase.lineaClase());
}
private void clear() {
text.setText("");
}
}
| [
"[email protected]"
] | |
1d3601a1d11d28139b79788452cc03c81a75c03c | 2f57f84dc6da5c2bafc0449990399b985ecd04c3 | /src/com/sise/util/DBHelper.java | c1b6bf3ee174097d0c2d6bf88ef85626a1957327 | [] | no_license | mavericks07/JokeCilent | 600a4db367861d4857235ffda632fccf76ffc122 | b26cec092157516721e1ed8b67b4a0e754388281 | refs/heads/master | 2021-01-19T01:18:21.718814 | 2016-06-06T13:33:17 | 2016-06-06T13:33:17 | 60,530,461 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,074 | java | package com.sise.util;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class DBHelper extends SQLiteOpenHelper {
private final static String DB_NAME ="test.db";//数据库名
private final static int VERSION = 1;//版本号
public DBHelper(Context context, String name, CursorFactory factory,
int version) {
super(context, name, factory, version);
}
public DBHelper(Context context){
this(context, DB_NAME, null, VERSION);
}
//版本变更时
public DBHelper(Context cxt,int version) {
this(cxt,DB_NAME,null,version);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table joke(id varchar(30) primary key, title varchar(20), content varchar(2000))";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase arg0, int arg1, int arg2) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
7c4e876c395b676eec898da9ef7ba6bd933d7eaa | b7e40a85d420ec8536dd5a0c6538d5646deda7c5 | /CodeevalMedium/src/ValidParenthesis.java | d0266be45a2a9c59033baca25885c41d6fd18599 | [] | no_license | sarvesh7n7/PracticeCodes | 72b424ff4a18107935303ec2b4f4b4c31d295eb2 | fe84c77b358633dab06ba282e0e57658be2e280a | refs/heads/master | 2021-01-22T22:44:10.702367 | 2014-07-15T04:16:32 | 2014-07-15T04:16:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Stack;
public class ValidParenthesis {
public static void main(String args[]){
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("input.txt"));
String line = null;
while((line = br.readLine()) != null)
{
Stack<Character> myStack = new Stack<Character>();
boolean isValid = true;
for(int i=0; i<line.length(); i++)
{
char brace = line.charAt(i);
char popedBrace = 0;
switch(brace){
case '(': myStack.push('(');
break;
case '{': myStack.push('{');
break;
case '[': myStack.push('[');
break;
case ')':
{
if(myStack.empty())
{
isValid = false;
break;
}
popedBrace = myStack.pop();
if(popedBrace != '(')
isValid = false;
break;
}
case '}':
{
if(myStack.empty())
{
isValid = false;
break;
}
popedBrace = myStack.pop();
if(popedBrace != '{')
isValid = false;
break;
}
case ']':
{
if(myStack.empty())
{
isValid = false;
break;
}
popedBrace = myStack.pop();
if(popedBrace != '[')
isValid = false;
break;
}
}
if(!isValid)
break;
}
if(!isValid || !myStack.empty())
System.out.println("False");
else
System.out.println("True");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
try {
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"sarvesh@sarvesh-Lenovo-IdeaPad-Y580"
] | sarvesh@sarvesh-Lenovo-IdeaPad-Y580 |
6e14f98e019ee57d7ba5385cb31ed7e44f024696 | 7766d61d50f874f6709109b35370b6956b3692b0 | /src/main/resources/com/lionscreed/djavac/test/Vehicle.java | 3293cb983a8a5ab02f1932af2359774e9fe3a962 | [] | no_license | gkrulz/com.piranha.master | 70a2f40aeaede9804a4b3415589754f9a8fd1669 | 37f738eb7ff730d859683049256b4ca43c81723d | refs/heads/master | 2021-03-24T13:52:05.900596 | 2016-04-15T10:37:01 | 2016-04-15T10:37:01 | 42,125,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package com.lionscreed.djavac.test;
import java.lang.*;
/**
* Created by Padmaka on 8/27/2015.
*/
public abstract class Vehicle {
protected String model;
protected String make;
protected String bodyType;
public abstract String getModel();
public abstract String getMake();
public abstract String getBodyType();
}
| [
"[email protected]"
] | |
6c530991cde131909acc69895d31abd6d8ece6e9 | dcd1ddb4ac91607e9af5d643ea3d7aeb96e03148 | /src/main/java/md/tekkwill/exceptions/ProductUpdateUnknownPropertyException.java | a667eb18a1def95c9c6ac420f28c4cb21a5fea05 | [] | no_license | Alex123-prog-gif/productmanager.mvn | 7dd8778a6914ee373992ed5a636a10c3ed13ae9f | 643385cba82cbda8f1388662cbb855cc90c8bea1 | refs/heads/master | 2023-06-06T21:13:34.563163 | 2021-06-23T14:03:37 | 2021-06-23T14:03:37 | 379,622,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | package md.tekkwill.exceptions;
public class ProductUpdateUnknownPropertyException extends ProductManagementException {
public ProductUpdateUnknownPropertyException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
3fa18230abae70c1daec4beef166360ebbadd3b4 | bd968e1a02a0bfd9307f564f3e15fcb7f2638b58 | /app/src/main/java/com/example/hackathon2020/MainActivity.java | 34d5e9435ac8006fd2e7ce6c68410748ee6a9d7c | [] | no_license | Choonky/qrscanner | 997a744e41c90fd80a56bc91a75fea68d108a41e | 88e103695ba85ed3a475ab431f7acd2a445259a9 | refs/heads/main | 2023-01-19T22:03:09.552158 | 2020-11-29T03:29:20 | 2020-11-29T03:29:20 | 316,486,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,183 | java | package com.example.hackathon2020;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
ImageView image_scan, image_list, image_account, image_about;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Scan Class
image_scan = (ImageView) findViewById(R.id.scan);
image_scan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mainIntent = new Intent(getApplicationContext(),
Scanner.class);
startActivity(mainIntent);
finish();
}
});
//List Class
image_list = (ImageView) findViewById(R.id.image_list);
image_list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mainIntent = new Intent(getApplicationContext(),
List.class);
startActivity(mainIntent);
finish();
}
});
//Account Class
image_account = (ImageView) findViewById(R.id.account);
image_account.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mainIntent = new Intent(getApplicationContext(),
Account.class);
startActivity(mainIntent);
finish();
}
});
//About Class
image_about = (ImageView) findViewById(R.id.about);
image_about.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mainIntent = new Intent(getApplicationContext(),
About.class);
startActivity(mainIntent);
finish();
}
});
}
} | [
"[email protected]"
] | |
277ac1578e29bc5e5aec1931ebc4bb4e669a16fa | 07fca3e0211e4949846d2cae8e2d046e7db0a8ad | /app/src/main/java/com/skyworth/simplegank/App.java | a30aeb9747f18fa4c03505a79c6abec3d103069a | [] | no_license | tonycheng93/SimpleGankMVP | 81ec781cb268a06d56b679a427d4b8db422b411e | f14f17005a6020f683327124480ae904b9291d5f | refs/heads/master | 2021-01-12T14:20:36.874453 | 2016-10-08T11:34:11 | 2016-10-08T11:34:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.skyworth.simplegank;
import android.app.Application;
import com.skyworth.simplegank.network.RequestQueueManager;
/**
* Created by Sky000 on 2016/9/30.
*/
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
RequestQueueManager.init(this);
}
}
| [
"[email protected]"
] | |
e1ec627398bd94185d1242cfe4a6340d06657457 | 5573bf135c92373bc10e4a044de1804d466f7468 | /src/main/java/com/grape/supermarket/dao/InventoryDao.java | c093c451cfc003abeab077606b5a384e40d6837d | [] | no_license | 2660075057/supermarket | 14e16bda6b883b94240eedb6b7ad57456dd4f13b | 6dd17c0245a0f8d9abac702cebdb1304eaee5e17 | refs/heads/master | 2020-03-25T01:23:24.023424 | 2018-08-02T03:20:25 | 2018-08-02T03:20:25 | 143,235,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | package com.grape.supermarket.dao;
import java.util.List;
import com.grape.supermarket.entity.db.InventoryEntity;
import com.grape.supermarket.entity.param.InventoryParam;
public interface InventoryDao {
/**
* 根据主键删除数据库的记录
*
* @param inventoryId
*/
int deleteByPrimaryKey(Integer inventoryId);
/**
* 插入数据库记录
*
* @param record
*/
int insert(InventoryEntity record);
/**
*
* @param record
*/
int insertSelective(InventoryEntity record);
/**
* 根据主键获取一条数据库记录
*
* @param inventoryId
*/
InventoryEntity selectByPrimaryKey(Integer inventoryId);
/**
*
* @param record
*/
int updateByPrimaryKeySelective(InventoryEntity record);
/**
* 根据主键来更新数据库记录
*
* @param record
*/
int updateByPrimaryKey(InventoryEntity record);
/**
* 分页查询盘点记录
* author huanghuang
* 2017年10月18日 下午4:47:28
* @param param
* @return
*/
List<InventoryEntity> selectByParam(InventoryParam param);
/**
* 查询盘点总记录数
* author huanghuang
* 2017年10月18日 下午4:47:48
* @param param
* @return
*/
int countByParam(InventoryParam param);
} | [
"[email protected]"
] | |
61858631798afbe7a6494b9d36b4155019ce0123 | 406a62598c991f78fb6cadea9e191d5269940926 | /springboot/springboot-email/src/test/java/com/zy/cn/email/SpringbootEmailApplicationTest.java | 7f853146e1cb2531e43294b2b1bdf86a01172336 | [] | no_license | 13849141963/application | e0de5ca02fb6ad6aaff125cb26db78ccaa8a5778 | 39471a4ac97a3ec9b7be19d2b04f17c77fac0305 | refs/heads/master | 2022-12-22T21:39:39.561349 | 2019-12-30T12:32:26 | 2019-12-30T12:32:26 | 223,348,129 | 1 | 0 | null | 2022-12-16T08:45:25 | 2019-11-22T07:30:24 | JavaScript | UTF-8 | Java | false | false | 2,767 | java | package com.zy.cn.email;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = SpringbootEmailApplication.class)
public class SpringbootEmailApplicationTest {
/***
* 测试通过使用时直接修改application.properties中的邮箱相关参数
*/
@Autowired
MailService mailService;
@Autowired
TemplateEngine templateEngine;
@Test
public void sendEasy() {
mailService.sendSimpleMail("[email protected]", "简单文本邮件", "这是我的第一封邮件,哈哈...");
}
/**
* HTML邮件发送
*
* @throws Exception
*/
@Test
public void sendHtmlMailTest() throws Exception {
String content = "<html>\n" +
"<body>\n" +
"<h1 style=\"color: red\"> hello world , 这是一封HTML邮件</h1>" +
"</body>\n" +
"</html>";
mailService.sendHtmlMail("[email protected]", "Html邮件发送", content);
}
/**
* 发送副本邮件
*
* @throws Exception
*/
@Test
public void sendAttachmentMailTest() throws Exception {
String filepath = "/Users/apple/Documents/阿里巴巴Java开发手册1.4.0.pdf";
mailService.sendAttachmentMail("[email protected]", "发送副本", "这是一篇带附件的邮件", filepath);
}
/**
* 发送图片邮件
*
* @throws Exception
*/
@Test
public void sendImageMailTest() throws Exception {
//发送多个图片的话可以定义多个 rscId,定义多个img标签
String filePath = "/Users/apple/Documents/2.png";
String rscId = "ligh001";
String content = "<html><body> 这是有图片的邮件: <img src=\'cid:" + rscId + "\'> </img></body></html>";
mailService.sendImageMail("[email protected]", "这是一个带图片的邮件", content, filePath, rscId);
}
/**
* 发送邮件模板
*
* @throws Exception
*/
@Test
public void sendTemplateEmailTest() throws Exception {
Context context = new Context();
context.setVariable("id", "006");
String emailContent = templateEngine.process("templates", context);
mailService.sendHtmlMail("[email protected]", "这是一个模板文件", emailContent);
}
} | [
"[email protected]"
] | |
14465085bebb4a49ccd87d0b1c4b3758737ca4d9 | 3092cdefaf28f8fda8a74bb9608afd43415dbc74 | /src/com/entertailion/java/fling/DragHereIcon.java | a9ab50404fbdd4a016ab80a8582968de23e5caee | [] | no_license | fjlycjp/Fling | 7bcfba9ef2b2cbbd60e6f8414ff6c03f32412522 | e008cc1cee6c339a24627ec7e00cc5be46f916ee | refs/heads/master | 2020-12-25T05:03:28.632872 | 2013-08-23T02:07:11 | 2013-08-23T02:07:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,302 | java | /*
* Copyright 2013 ENTERTAILION LLC
*
* 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.entertailion.java.fling;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.RoundRectangle2D;
import java.io.IOException;
import java.util.Properties;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
/*
* UI for drag-and-drop
*
* http://stackoverflow.com/questions/10751001/java-application-with-fancy-drag-drop
*/
public class DragHereIcon implements Icon {
private static final String LOG_TAG = "DragHereIcon";
private int size = 80;
private float a = 4f;
private float b = 8f;
private int r = 16;
private int f = size / 4;
private Font font = new Font("Monospace", Font.PLAIN, size / 2);
private FontRenderContext frc = new FontRenderContext(null, true, true);
private Shape s = new TextLayout("\u21E9", font, frc).getOutline(null);
private Color linec = Color.GRAY;
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.translate(x, y);
g2.setStroke(new BasicStroke(a));
g2.setPaint(linec);
g2.draw(new RoundRectangle2D.Float(a, a, size - 2 * a - 1, size - 2 * a
- 1, r, r));
// draw bounding box
g2.setStroke(new BasicStroke(b));
g2.setColor(UIManager.getColor("Panel.background"));
g2.drawLine(1 * f, 0 * f, 1 * f, 4 * f);
g2.drawLine(2 * f, 0 * f, 2 * f, 4 * f);
g2.drawLine(3 * f, 0 * f, 3 * f, 4 * f);
g2.drawLine(0 * f, 1 * f, 4 * f, 1 * f);
g2.drawLine(0 * f, 2 * f, 4 * f, 2 * f);
g2.drawLine(0 * f, 3 * f, 4 * f, 3 * f);
// draw arrow
g2.setPaint(linec);
Rectangle2D b = s.getBounds();
Point2D.Double p = new Point2D.Double(b.getX() + b.getWidth() / 2d,
b.getY() + b.getHeight() / 2d);
AffineTransform toCenterAT = AffineTransform.getTranslateInstance(size
/ 2d - p.getX(), size / 2d - p.getY());
g2.fill(toCenterAT.createTransformedShape(s));
g2.translate(-x, -y);
g2.dispose();
}
@Override
public int getIconWidth() {
return size;
}
@Override
public int getIconHeight() {
return size;
}
/**
* Display a custom icon with file drag-and-drop support
*
* @param flingFrame
* the parent frame
* @return
*/
public static JComponent makeUI(final FlingFrame flingFrame) {
JLabel label = new JLabel(new DragHereIcon());
label.setText("<html>Drag <b>Media</b> Here");
label.setVerticalTextPosition(SwingConstants.BOTTOM);
label.setHorizontalTextPosition(SwingConstants.CENTER);
label.setForeground(Color.GRAY);
label.setFont(new Font("Monospace", Font.PLAIN, 24));
JPanel p = new JPanel();
p.add(label);
p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
new FileDrop(p, new FileDrop.Listener() {
public void filesDropped(java.io.File[] files) {
if (files != null && files.length > 0) {
try {
String file = files[0].getCanonicalPath();
Log.d(LOG_TAG, file);
Properties systemProperties = System.getProperties();
systemProperties.setProperty(
EmbeddedServer.CURRENT_FILE, file);
flingFrame.sendMediaUrl(file);
} catch (IOException e) {
}
}
} // end filesDropped
}); // end FileDrop.Listener
return p;
}
} | [
"[email protected]"
] | |
17a2a9c7f52ff5b92e3494b98ea4ace36b182357 | c9cc3551d4f20f289e25cf87a3546f8d99407107 | /WanAndroid/wanandroid_base/src/main/java/com/chinalwb/wanandroid_base/services/navigation/NavigationViewService.java | 0c3dcb7d56832d49bb4b0e69844bc17bccd303e2 | [
"Apache-2.0"
] | permissive | chinalwb/modularized_wan_android | 1c8352e9d9293d999431349e27bd522a8ff9f9e5 | 9bf3f48ee7a8521fb8d2acf2b596b7488da64066 | refs/heads/master | 2020-04-12T19:42:28.849957 | 2019-01-16T10:04:38 | 2019-01-16T10:04:38 | 162,716,107 | 17 | 2 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | package com.chinalwb.wanandroid_base.services.navigation;
import java.util.ArrayList;
import java.util.List;
public class NavigationViewService {
private NavigationViewService() {
// Private Inner Constructor
}
public static NavigationViewService getInstance() {
return Inner.navigationViewService;
}
private static class Inner {
private static NavigationViewService navigationViewService = new NavigationViewService();
}
private List<NavigationViewItem> navigationViewItemList = new ArrayList<>();
public List<NavigationViewItem> getNavigationViewItemList() {
return navigationViewItemList;
}
}
| [
"[email protected]"
] | |
0c0ffd4b165f1b941686dc5a9b318d58db451f3f | 0f2f0da97d5ad4ca897390f53f7056953cd677f2 | /src/FormLK.java | 792d77d91b319e14d8ecee154f65bb80afa6864c | [] | no_license | liorkatzdev/TrainerXP | 769d5963fa54d320fbf148f01b8de782d7ca76ea | b0d29e03db68eabe45cfffd1884d489268978a76 | refs/heads/master | 2020-09-07T05:27:48.936875 | 2019-11-09T16:23:59 | 2019-11-09T16:23:59 | 220,669,448 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,387 | java | import java.awt.*;
import java.awt.event.*;
import java.util.Enumeration;
import javax.swing.*;
public class FormLK extends JFrame implements ActionListener,FocusListener
{
String Days[]={"2", "3","4","6"};
JPanel PnlMain,
PnlUper,
PnlMid,
PnlLow,
PnlQs,
PnlQ1,
PnlQ2,
PnlQ3,
PnlQ4,
PnlNext;
JLabel LblFullName,
LblID,
LblAge,
LblGender,
LblHigh,
LblWeight,
LblPass,
LblQ1,
LblQ2,
LblQ3,
LblQ4;
JTextField TxtFullName,
TxtID,
TxtAge,
TxtHigh,
TxtWeight;
JPasswordField PassTxt;
JRadioButton BttMale,
BttFemale,
BttGain,
BttLose,
BttHoreandmore,
BttLessthenhoure,
BttHigh,
BttRegular;
ButtonGroup GrpButt,
GrpButt2,
GrpButt3,
GrpButt4;
JButton NextButt;
JComboBox ComboDays;
public FormLK(String s)
{
super(s);
PnlMain=new JPanel(new GridLayout(0,1));
PnlUper=new JPanel(new GridLayout(0,2));
PnlMid=new JPanel();
PnlMid.setLayout(new FlowLayout() );
PnlLow=new JPanel(new GridLayout(0,2));
PnlQs=new JPanel(new GridLayout(4,0));
PnlQ1=new JPanel(new FlowLayout());
PnlQ2=new JPanel(new FlowLayout());
PnlQ3=new JPanel(new FlowLayout());
PnlQ4=new JPanel(new FlowLayout());
PnlNext=new JPanel(new FlowLayout());
//////////////////////////////////////////////////////
//------------Uper Pannel ---------
LblFullName=new JLabel("E-mail(used as User Name):", SwingConstants.RIGHT);
TxtFullName=new JTextField(20);
PnlUper.add(LblFullName);
PnlUper.add(TxtFullName);
TxtFullName.addFocusListener(this);
LblID=new JLabel("ID:", SwingConstants.RIGHT);
TxtID=new JTextField(10);
PnlUper.add(LblID);
PnlUper.add(TxtID);
TxtID.addFocusListener(this);
LblAge=new JLabel("Age:", SwingConstants.RIGHT);
TxtAge=new JTextField(10);
PnlUper.add(LblAge);
PnlUper.add(TxtAge);
TxtAge.addFocusListener(this);
//////////////////////////////////////////////////////
//------------Mid Pannel ---------
LblGender=new JLabel("Gender:");
BttMale=new JRadioButton("Male");
BttFemale=new JRadioButton("Female");
PnlMid.add(LblGender);
//PnlMid.add(Box.createRigidArea(new Dimension(10, 0)));
PnlMid.add(BttMale);
//PnlMid.add(Box.createRigidArea(new Dimension(10, 0)));
PnlMid.add(BttFemale);
GrpButt= new ButtonGroup();
GrpButt.add(BttMale);
GrpButt.add(BttFemale);
//////////////////////////////////////////////////////
//------------Low Pannel ---------
LblHigh=new JLabel("High(cm):", SwingConstants.RIGHT);
TxtHigh=new JTextField(10);
PnlLow.add(LblHigh);
PnlLow.add(TxtHigh);
LblWeight=new JLabel("Weight(kg):", SwingConstants.RIGHT);
TxtWeight=new JTextField(10);
LblWeight.setPreferredSize((new Dimension(10, 0)));
PnlLow.add(LblWeight);
PnlLow.add(TxtWeight);
LblPass=new JLabel("Password", SwingConstants.RIGHT);
PassTxt=new JPasswordField(10);
PnlLow.add(LblPass);
PnlLow.add(PassTxt);
//////////////////////////////////////////////////////
//------------Q's Pannel ---------
//------------Q1 Pannel ---------
LblQ1=new JLabel("Do you want to gain weight or lose weight?");
BttGain= new JRadioButton("Gain");
BttLose= new JRadioButton("Lose");
PnlQ1.add(LblQ1);
PnlQ1.add(BttGain);
PnlQ1.add(BttLose);
GrpButt2= new ButtonGroup();
GrpButt2.add(BttGain);
GrpButt2.add(BttLose);
//------------Q2 Pannel ---------
LblQ2=new JLabel("How many days a week can you allocate for traning?");
ComboDays=new JComboBox(Days);
PnlQ2.add(LblQ2);
PnlQ2.add(ComboDays);
//------------Q3 Pannel ---------
LblQ3=new JLabel("Would u like to do cardio?");
BttHoreandmore=new JRadioButton("Yes");
BttLessthenhoure=new JRadioButton("No");
PnlQ3.add(LblQ3);
PnlQ3.add(BttHoreandmore);
PnlQ3.add(BttLessthenhoure);
GrpButt3= new ButtonGroup();
GrpButt3.add(BttHoreandmore);
GrpButt3.add(BttLessthenhoure);
//////////////////////////////////////////////////////
//------------Button Pannel ---------
NextButt=new JButton("NEXT>>>");
PnlNext.add(NextButt);
NextButt.addActionListener(this);
//////////////////////////////////////////////////////
PnlMain.add(PnlUper);
PnlMain.add(PnlMid);
PnlMain.add(PnlLow);
PnlMain.add(PnlNext);
PnlQs.add(PnlQ1);
PnlQs.add(PnlQ2);
PnlQs.add(PnlQ3);
setContentPane(PnlMain);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setSize(400,300);
setVisible(true);
}
String getSelectedButtonText(ButtonGroup buttonGroup) {
for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();)
{
AbstractButton button = buttons.nextElement();
if (button.isSelected()) {
return button.getText();
}
}
return null;
}
public static void main(String args[])
{
FormLK obj=new FormLK("Register");
}
@Override
public void actionPerformed(ActionEvent e)
{
if((e.getActionCommand().equals("NEXT>>>")&&InputChecks.InputCheckID(TxtID.getText())&&InputChecks.InputCheckAge(TxtAge.getText())&&InputChecks.InputCheckRadio(BttMale,BttFemale)&&InputChecks.InputCheckHigh(TxtHigh.getText())&&InputChecks.WeightInputCheck(TxtWeight.getText())))
{
PnlMain.removeAll();
NextButt.setText("-Submit-");
PnlMain.add(PnlQs);
PnlQs.add(NextButt);
validate();
}
else{
if(InputChecks.InputCheckID(TxtID.getText())==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "ID must contain 9 digits", "ID Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
if(InputChecks.InputCheckAge(TxtAge.getText())==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "invalid Age ", "Age Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
if(InputChecks.InputCheckRadio(BttMale,BttFemale)==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "Chose Gender ", "Gender Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
if(InputChecks.InputCheckHigh(TxtHigh.getText())==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "invalid High ", "High Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
if(InputChecks.WeightInputCheck(TxtWeight.getText())==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "invalid Weight ", "Weight Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
else
{
if((e.getActionCommand().equals("-Submit-"))&&InputChecks.InputCheckRadio(BttGain,BttLose)&&InputChecks.InputCheckRadio(BttHoreandmore,BttLessthenhoure))
{
int selection;
String[] options;
options=new String[2];
options[0]="Yes";
options[1]="No";
selection=JOptionPane.showOptionDialog(null, "Do you have any health issues?", "Before we start...", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, "No");
System.out.println(options[selection]);
UserLK User=new UserLK(TxtFullName.getText(),
TxtID.getText(),
Integer.parseInt(TxtAge.getText()),
getSelectedButtonText(GrpButt),
Integer.parseInt(TxtHigh.getText()),
Double.parseDouble(TxtWeight.getText()),
new String(PassTxt.getPassword()),
getSelectedButtonText(GrpButt2),
Integer.parseInt(Days[ComboDays.getSelectedIndex()]),
getSelectedButtonText(GrpButt3),
options[selection]);
SQLquerys.Connect();
SQLquerys.InsertNewUser(User);
SQLquerys.ProgramChosen(Integer.parseInt(Days[ComboDays.getSelectedIndex()]),TxtID.getText());
SQLquerys.DisConnect();
}
else{
if(InputChecks.InputCheckRadio(BttGain,BttLose)==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "Choose if u would like to Gain or Lose Weight ", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
if(InputChecks.InputCheckRadio(BttHoreandmore,BttLessthenhoure)==false)
{
Object[] options = { "OK" };
JOptionPane.showOptionDialog(null, "Choose if u would like to do cardio or not ", "Error",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
}
}
}
}
}
private void DisConnect() {
// TODO Auto-generated method stub
}
private void Connect() {
// TODO Auto-generated method stub
}
public void focusGained(FocusEvent e) {
if(e.getSource()==TxtFullName)
TxtFullName.setToolTipText("enter Email");
}
public void focusLost(FocusEvent e) {
// displayMessage("Focus lost", e);
}
}
| [
"[email protected]"
] | |
150e92eac1161790ffd7f97a9c68b6863cf8227b | 079e517c109b359ec8dff9ea3955a1d235289222 | /S3TransferUtilitySample/src/com/amazonaws/demo/s3transferutility/WiFiScanActivity.java | 32d9b4e45f1e76cd91dfec9f1f0053d2152db02d | [] | no_license | bms117/Senior_Design_Project | db91d470c53dcdbf8e8835bfa1f605e50df30ef5 | 1e573cc56ae7872e20947fb6087ed36b8572a3ec | refs/heads/master | 2021-05-10T14:16:46.082831 | 2018-04-14T14:59:15 | 2018-04-14T14:59:15 | 118,511,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,101 | java | //package com.amazonaws.demo.s3transferutility;
//
///**
// * Created by brian on 4/2/18.
// */
//
//
//
//import java.util.List;
//
//import android.app.Activity;
//import android.content.BroadcastReceiver;
//import android.content.Context;
//import android.content.Intent;
//import android.content.IntentFilter;
//import android.net.wifi.ScanResult;
//import android.net.wifi.WifiManager;
//import android.os.Bundle;
//import android.view.Menu;
//import android.view.MenuItem;
//import android.widget.TextView;
//import android.widget.Toast;
//
//public class WiFiScanActivity extends Activity {
// TextView mainText;
// WifiManager mainWifi;
// WifiReceiver receiverWifi;
// List<ScanResult> wifiList;
// StringBuilder sb = new StringBuilder();
//
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
// mainText = (TextView) findViewById(R.id.tv1);
// mainWifi = (WifiManager) this.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
// if (mainWifi.isWifiEnabled() == false)
// {
// // If wifi disabled then enable it
// Toast.makeText(getApplicationContext(), "wifi is disabled..making it enabled",
// Toast.LENGTH_LONG).show();
//
// mainWifi.setWifiEnabled(true);
// }
// receiverWifi = new WifiReceiver();
// registerReceiver(receiverWifi, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
// mainWifi.startScan();
// mainText.setText("Starting Scan...");
// }
//
// public boolean onCreateOptionsMenu(Menu menu) {
// menu.add(0, 0, 0, "Refresh");class WifiReceiver extends BroadcastReceiver {
//
// // This method call when number of wifi connections changed
// public void onReceive(Context c, Intent intent) {
//
// sb = new StringBuilder();
// wifiList = mainWifi.getScanResults();
// sb.append("\n Number Of Wifi connections :"+wifiList.size()+"\n\n");
//
// for(int i = 0; i < wifiList.size(); i++){
//
// sb.append(new Integer(i+1).toString() + ". ");
// sb.append((wifiList.get(i)).toString());
// sb.append("\n\n");
// }
//
// mainText.setText(sb);
// }
//
// }
// return super.onCreateOptionsMenu(menu);
// }
//
// public boolean onMenuItemSelected(int featureId, MenuItem item) {
// mainWifi.startScan();
// mainText.setText("Starting Scan");
// return super.onMenuItemSelected(featureId, item);
// }
//
// protected void onPause() {
// unregisterReceiver(receiverWifi);
// super.onPause();
// }
//
// protected void onResume() {
// registerReceiver(receiverWifi, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
// super.onResume();
// }
//
// // Broadcast receiver class called its receive method
// // when number of wifi connections changed
//
//
//}
| [
"[email protected]"
] | |
4fcad2a35f8aa2e23e2bf7268794a05063451f31 | 06b2cdc5c4c57d0830dbcdfadc4ea5f14ac5ee8a | /Chapter7/exercise_chap07/src/java/beans/Bb.java | ffcc87675117fa39361617890c52d254e3752cc1 | [] | no_license | kateytoon/r3a103netbeans | be611743f8bbd21e75d3974f64124b9e73dc2691 | 5bec4acd9810b621fbb25b317272a83eba475b10 | refs/heads/master | 2020-09-14T23:27:30.330059 | 2019-11-22T02:59:06 | 2019-11-22T02:59:06 | 223,292,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 995 | java | package beans;
import java.io.Serializable;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import util.BookUtil;
@Named
@SessionScoped
public class Bb implements Serializable {
private List<Book> books; // MeiboオブジェクトのList
{ // 初期化ブロック
// ユーティリティを使って、本のリストを作成する
// データはresourcesフォルダのdataにある
books = BookUtil.getList("/resources/data/Book.csv");
}
public String next() {
// 実際にはここでデータベースなどに保存する
return null;
}
public String edit(Book book) {
book.setEditable(book.isEditable());
return null;
}
// セッターとゲッター
public List<Book> getBooks() {
return books;
}
public void setBooks(List<Book> books) {
this.books = books;
}
}
| [
"[email protected]"
] | |
fb65543eb8b32856869ee801368b48eb5f66b591 | 238c0fc258434ca29ec70bdc71bfe3e34671251a | /src/main/java/com/zaghir/excelPoi/service/ExcelPoiService.java | 3a361f941abe689cb06b2aa8c9160876a219ce76 | [] | no_license | zaghir/excel-with-poi | e1b39cefc115b422bf128c0ef51bea6fa0b3bf5a | 6c9b1f8fbb3360b54a20276c9db0fbf9bb447e3d | refs/heads/master | 2021-01-25T14:57:17.175542 | 2018-03-04T00:23:03 | 2018-03-04T00:23:03 | 123,740,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,248 | java | package com.zaghir.excelPoi.service;
import java.io.File;
import java.io.FileOutputStream;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.WorkbookUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.zaghir.excelPoi.entities.Commande;
import com.zaghir.excelPoi.entities.DetailCommande;
public class ExcelPoiService implements IExcelPoiService{
private ICommandeService commandeService = new CommandeService();
private Logger logger = LoggerFactory.getLogger(this.getClass());
public void generateCommandeInExcel() {
List<Commande> commandes = commandeService.retrieveCommandes();
File file = new File("d:/generateCommandeInExcel.xls");
Workbook workbook = new HSSFWorkbook();
Sheet sheet1 = workbook.createSheet("Feuille-1");
Sheet sheet2 = workbook.createSheet(WorkbookUtil.createSafeSheetName("Feuille-@-2"));
Row row0 = sheet2.createRow(0);
Cell cell00 = row0.createCell(0);
cell00.setCellValue("Id Commande");
CellStyle cellStyleHeader =workbook.createCellStyle();
cellStyleHeader.setBorderBottom(BorderStyle.THIN );
cellStyleHeader.setBorderTop(BorderStyle.THIN );
cellStyleHeader.setBorderLeft(BorderStyle.THIN );
cellStyleHeader.setBorderRight(BorderStyle.THIN );
cellStyleHeader.setFillForegroundColor((short) 22); // IndexedColors.LIGHT_ORANGE.getIndex()
cellStyleHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND );
cellStyleHeader.setAlignment(HorizontalAlignment.LEFT);
Font fontHeader = workbook.createFont();
fontHeader.setBold(true);
fontHeader.setFontName("Arial");
fontHeader.setFontHeightInPoints((short)10);
cellStyleHeader.setFont(fontHeader);
CellStyle cellStylePaire =workbook.createCellStyle();
CellStyle cellStyleImpaire =workbook.createCellStyle();
Font fontBody = workbook.createFont();
fontBody.setBold(false);
fontBody.setItalic(false);
fontBody.setFontName("Arial");
fontBody.setFontHeightInPoints((short)10);
cellStylePaire.setBorderBottom(BorderStyle.THIN );
cellStylePaire.setBorderTop(BorderStyle.THIN );
cellStylePaire.setBorderLeft(BorderStyle.THIN );
cellStylePaire.setBorderRight(BorderStyle.THIN );
cellStylePaire.setFillForegroundColor((short)42); // IndexedColors.ORANGE.getIndex()
cellStylePaire.setFillPattern(FillPatternType.SOLID_FOREGROUND );
cellStylePaire.setAlignment(HorizontalAlignment.LEFT);
cellStylePaire.setFont(fontBody);
cellStyleImpaire.setBorderBottom(BorderStyle.THIN );
cellStyleImpaire.setBorderTop(BorderStyle.THIN );
cellStyleImpaire.setBorderLeft(BorderStyle.THIN );
cellStyleImpaire.setBorderRight(BorderStyle.THIN );
cellStyleImpaire.setFillForegroundColor(IndexedColors.WHITE.getIndex());
cellStyleImpaire.setFillPattern(FillPatternType.SOLID_FOREGROUND );
cellStyleImpaire.setAlignment(HorizontalAlignment.LEFT);
cellStyleImpaire.setFont(fontBody);
/*
* Entete de fichier
*/
Row rowHeader = sheet1.createRow(0);
rowHeader.createCell(0).setCellValue("id_Produit");
rowHeader.getCell(0).setCellStyle(cellStyleHeader);
rowHeader.createCell(1).setCellValue("Nom_Produit");
rowHeader.getCell(1).setCellStyle(cellStyleHeader);
rowHeader.createCell(2).setCellValue("Prix_Unitaire");
rowHeader.getCell(2).setCellStyle(cellStyleHeader);
rowHeader.createCell(3).setCellValue("Quantite");
rowHeader.getCell(3).setCellStyle(cellStyleHeader);
rowHeader.createCell(4).setCellValue("Montant");
rowHeader.getCell(4).setCellStyle(cellStyleHeader);
int indexRow = 0;
int quantites = 0;
double montants =0.0;
for (Commande commande : commandes) {
List<DetailCommande> detailCommandes = commande.getDetailCommand();
for(DetailCommande detail: detailCommandes){
indexRow++;
quantites += detail.getQuantite();
montants += detail.getMontant() ;
CellStyle cellStyle;
if(indexRow % 2> 0){
cellStyle = cellStylePaire ;
}else{
cellStyle = cellStyleImpaire;
}
Row row = sheet1.createRow(indexRow);
row.createCell(0).setCellValue(detail.getProduit().getIdProduit());
row.getCell(0).setCellStyle(cellStyle);
row.createCell(1).setCellValue(detail.getProduit().getNomProduit());
row.getCell(1).setCellStyle(cellStyle);
row.createCell(2).setCellValue(detail.getProduit().getPrixUnitaire());
row.getCell(2).setCellStyle(cellStyle);
row.createCell(3).setCellValue(detail.getQuantite());
row.getCell(3).setCellStyle(cellStyle);
row.createCell(4).setCellValue(detail.getMontant());
row.getCell(4).setCellStyle(cellStyle);
}
}
Row rowFooter = sheet1.createRow(indexRow+1);
rowFooter.createCell(2).setCellValue("Montant de la commande");
rowFooter.createCell(3).setCellValue(quantites);
rowFooter.createCell(4).setCellValue(montants);
/**
* pour savoir la liste des codes couleurs
*/
/*
for(int i =0 ; i< 250; i++){
Row rowTestColor = sheet1.createRow(indexRow+i+1);
CellStyle cellStyleTestColor =workbook.createCellStyle();
cellStyleTestColor.setBorderBottom(BorderStyle.THIN );
cellStyleTestColor.setBorderTop(BorderStyle.THIN );
cellStyleTestColor.setBorderLeft(BorderStyle.THIN );
cellStyleTestColor.setBorderRight(BorderStyle.THIN );
cellStyleTestColor.setFillForegroundColor((short)i);
cellStyleTestColor.setFillPattern(FillPatternType.SOLID_FOREGROUND );
rowTestColor.createCell(0).setCellValue("la couleur ="+ i);
rowTestColor.getCell(0).setCellStyle(cellStyleTestColor);
}*/
try {
FileOutputStream outputStream = new FileOutputStream(file);
workbook.write(outputStream);
outputStream.close();
} catch (Exception e) {
logger.info("probleme de generation de fichier excel --> {} ", e.getMessage());
}
}
}
| [
"[email protected]"
] | |
966dea74810dabffe49de18a48d3a4b4406589b2 | 624707f35227630a6fd16a486cb0cd996e358f73 | /module2/src/case_study/services/Service.java | 2b7baad3ccca5e93fcf62f4277fc7dca79abe446 | [] | no_license | NguyenQuang0504/A0721i1-NguyenVanQuang-Module2 | 2a23f99a701d98b7758a4c96b2ea50a95548f90f | d28703ac27c838f8d6369e075a50f6816e64bf94 | refs/heads/main | 2023-09-03T12:55:29.256439 | 2021-11-24T15:12:11 | 2021-11-24T15:12:11 | 411,650,544 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package case_study.services;
import java.util.Objects;
public interface Service {
void add();
void display();
void edit();
}
| [
"[email protected]"
] | |
9195d6eec91d2a90d7b75fe960c5b29e72f91753 | 2ffbb68353b512610cd153b558b25be5782d7278 | /src/main/java/Main.java | 66f4fdad4294110c4a651ef82b970f5d07a40789 | [] | no_license | RomanStoyko/PrjTwo | 58ca4d260784eeba01b809dce2647d20211a20d1 | 02a5b6b47fe60ae447638badb49955ee43fc1738 | refs/heads/master | 2021-09-01T06:33:14.260116 | 2017-12-25T10:55:21 | 2017-12-25T10:55:21 | 115,327,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | import controller.Controller;
public class Main {
public static void main(String[] args) {
Controller controller = new Controller();
controller.doWork();
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.