blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 132 | path stringlengths 2 382 | src_encoding stringclasses 34
values | length_bytes int64 9 3.8M | score float64 1.5 4.94 | int_score int64 2 5 | detected_licenses listlengths 0 142 | license_type stringclasses 2
values | text stringlengths 9 3.8M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
e9e79c6019df8ec893ee607616a2e8884d4415f7 | Java | qiuchili/ggnn_graph_classification | /program_data/JavaProgramData/80/182.java | UTF-8 | 4,923 | 2.5625 | 3 | [
"MIT"
] | permissive | //====================================================================================================
//The Free Edition of C++ to Java Converter limits conversion output to 100 lines per snippet.
//To purchase the Premium Edition, visit our website:
//https://www.tangiblesoftwaresolutions.com/order/order-cplus-to-java.html
//====================================================================================================
package <missing>;
public class GlobalMembers
{
public static int Main()
{
int sy;
int sm;
int sd;
int ey;
int em;
int ed;
int a;
int b;
int p;
int q;
a = 0,b = 0;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
sy = Integer.parseInt(tempVar);
}
String tempVar2 = ConsoleInput.scanfRead(" ");
if (tempVar2 != null)
{
sm = Integer.parseInt(tempVar2);
}
String tempVar3 = ConsoleInput.scanfRead(" ");
if (tempVar3 != null)
{
sd = Integer.parseInt(tempVar3);
}
String tempVar4 = ConsoleInput.scanfRead();
if (tempVar4 != null)
{
ey = Integer.parseInt(tempVar4);
}
String tempVar5 = ConsoleInput.scanfRead(" ");
if (tempVar5 != null)
{
em = Integer.parseInt(tempVar5);
}
String tempVar6 = ConsoleInput.scanfRead(" ");
if (tempVar6 != null)
{
ed = Integer.parseInt(tempVar6);
}
for (p = 0;p < sy;p++)
{
if ((p % 4 == 0 && p % 100 != 0) || (p % 400 == 0))
{
a = a + 366;
}
else
{
a = a + 365;
}
}
while (p == sy)
{
if ((sy % 4 == 0 && sy % 100 != 0) || (sy % 400 == 0))
{
if (sm == 1)
{
a = a + sd;
}
else if (sm == 2)
{
a = a + 31 + sd;
}
else if (sm == 3)
{
a = a + 31 + 29 + sd;
}
else if (sm == 4)
{
a = a + 31 + 29 + 31 + sd;
}
else if (sm == 5)
{
a = a + 31 + 29 + 31 + 30 + sd;
}
else if (sm == 6)
{
a = a + 31 + 29 + 31 + 30 + 31 + sd;
}
else if (sm == 7)
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + sd;
}
else if (sm == 8)
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + 31 + sd;
}
else if (sm == 9)
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + sd;
}
else if (sm == 10)
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + sd;
}
else if (sm == 11)
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + sd;
}
else
{
a = a + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + sd;
}
}
else
{
if (sm == 1)
{
a = a + sd;
}
else if (sm == 2)
{
a = a + 31 + sd;
}
else if (sm == 3)
{
a = a + 31 + 28 + sd;
}
else if (sm == 4)
{
a = a + 31 + 28 + 31 + sd;
}
else if (sm == 5)
{
a = a + 31 + 28 + 31 + 30 + sd;
}
else if (sm == 6)
{
a = a + 31 + 28 + 31 + 30 + 31 + sd;
}
else if (sm == 7)
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + sd;
}
else if (sm == 8)
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + 31 + sd;
}
else if (sm == 9)
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + sd;
}
else if (sm == 10)
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + sd;
}
else if (sm == 11)
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + sd;
}
else
{
a = a + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + sd;
}
}
break;
}
for (q = 0;q < ey;q++)
{
if ((q % 4 == 0 && q % 100 != 0) || (q % 400 == 0))
{
b = b + 366;
}
else
{
b = b + 365;
}
}
while (q == ey)
{
if ((ey % 4 == 0 && ey % 100 != 0) || (ey % 400 == 0))
{
if (em == 1)
{
b = b + ed;
}
else if (em == 2)
{
b = b + 31 + ed;
}
//====================================================================================================
//End of the allowed output for the Free Edition of C++ to Java Converter.
//To purchase the Premium Edition, visit our website:
//https://www.tangiblesoftwaresolutions.com/order/order-cplus-to-java.html
//====================================================================================================
| true |
97c17eedaf00872719dc7454a448c6ffad69ac5c | Java | andew-Forche/2020Projects | /ForcheGuessWho/Chewbacca.java | UTF-8 | 271 | 2.796875 | 3 | [] | no_license | public class Chewbacca extends Smuggler implements Pilot{
public Chewbacca(){
super("Chewbacca","Light Side","Rebel, Resistance",true);
}
public boolean pilot(){
return true;
}
public String wookie(){
return "wookie";
}
} | true |
24490ea17581556c5f2c4e45617985a6756d10e9 | Java | dansel55/Matricula_Documental | /src/main/java/ec/edu/espe/distribuidas/Sist_Matricula_Doc/dao/AsignaturaRepository.java | UTF-8 | 1,266 | 1.726563 | 2 | [] | no_license | /*
* Copyright (c) 2021 Usuario.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Usuario - initial API and implementation and/or initial documentation
*/
package ec.edu.espe.distribuidas.Sist_Matricula_Doc.dao;
import ec.edu.espe.distribuidas.Sist_Matricula_Doc.model.Asignatura;
import java.util.List;
import java.util.Optional;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
*
* @author Usuario
*/
public interface AsignaturaRepository extends MongoRepository<Asignatura, Integer> {
/*List<Asignatura> findByNombreOrderByNombre(String nombre);
List<Asignatura> findByCreditosGreaterThan(Integer creditos);
List<Asignatura> findByEstadoOrderByNombre(String estado);
List<Asignatura> findByPeriodoId(Integer codigoPeriodo);
List<Prerequisitos> findByPrerequisitosEstado(String estado);*/
Optional<Asignatura> findByNombre(String nombre);
List<Asignatura> findByDepartamento(String departamento);
Optional<Asignatura> findByCodigo(String codigo);
}
| true |
78ae07cab3e6b51067ae6b5e56bd12de0ed8dfa7 | Java | RomanMorozov88/Managing_users_and_roles | /src/main/java/morozov/ru/services/validateservice/ValidateService.java | UTF-8 | 3,776 | 2.75 | 3 | [] | no_license | package morozov.ru.services.validateservice;
import morozov.ru.models.Role;
import morozov.ru.models.createupdateanswers.NegativeAnswer;
import morozov.ru.models.users.UserWithRoles;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Проверка входящих данных.
*/
@Component
public class ValidateService {
private static final String PASSWORD_PATTERN = "(.*[0-9]+.*[A-Z]+.*)|(.*[A-Z]+.*[0-9]+.*)";
private static final String EMPTY_NAME = "Empty name";
private static final String EMPTY_LOGIN = "Empty login";
private static final String EMPTY_PASSWORD = "Empty password";
private static final String WRONG_PASSWORD = "Wrong password format";
private static final String WRONG_ROLES = "Wrong role or roles";
private List<Role> existingRoles = new ArrayList<>();
public ValidateService() {
}
public List<Role> getExistingRoles() {
return existingRoles;
}
public void setExistingRoles(List<Role> existingRoles) {
this.existingRoles = existingRoles;
}
/**
* Основная проверка всех полей.
*
* @param user
* @return
*/
public NegativeAnswer validateFields(UserWithRoles user) {
NegativeAnswer result = new NegativeAnswer();
boolean flag = true;
if (user.getName() == null || user.getName().equals("")) {
result.setErrorMessage(EMPTY_NAME);
flag = false;
}
if (user.getLogin() == null || user.getLogin().equals("")) {
result.setErrorMessage(EMPTY_LOGIN);
flag = false;
}
if (user.getPassword() == null || user.getPassword().equals("")) {
result.setErrorMessage(EMPTY_PASSWORD);
flag = false;
} else if (!checkPassword(user.getPassword())) {
result.setErrorMessage(WRONG_PASSWORD);
flag = false;
}
if (
user.getRoles() != null
&& user.getRoles().size() > 0
&& !checkRoles(user.getRoles())
) {
result.setErrorMessage(WRONG_ROLES);
flag = false;
}
result.setSuccess(flag);
return result;
}
/**
* Проверяет строку на соответствие шаблону.
*
* @param password
* @return
*/
private boolean checkPassword(String password) {
boolean result = false;
Pattern pattern = Pattern.compile(PASSWORD_PATTERN);
Matcher matcher = pattern.matcher(password);
String buffer = null;
while (matcher.find()) {
buffer = matcher.group();
}
if (buffer != null) {
result = true;
}
return result;
}
/**
* Проверка корректности ролей.
* Подразумевается, что на входе будет только id роли.
*
* @param roles
* @return
*/
private boolean checkRoles(Set<Role> roles) {
return roles.stream().allMatch(x -> {
boolean result = false;
for (Role r : this.existingRoles) {
result = r.getId() == x.getId();
if (result) {
break;
}
}
return result;
});
}
public boolean checkRoles(Role role) {
boolean result = false;
for (Role r : existingRoles) {
result = role.getName().equals(r.getName());
if (result) {
break;
}
}
return result;
}
} | true |
da7af4e235b5c966bb49d2fed8f9368e550ef539 | Java | admindxh/test7oa | /src/com/oa/manager/crm/client/bean/Info.java | UTF-8 | 8,831 | 1.875 | 2 | [] | no_license | package com.oa.manager.crm.client.bean;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
* Info entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "crm_client_info")
public class Info implements java.io.Serializable {
// Fields
private String id;
// 客户名称
private String clName;
// 客户编号
private String clNo;
// 客户类别
private String clCategory;
// 客户类型
private String clType;
// 客户来源
private String clSource;
// 客户等级
private String clGrade;
// 客户状态
private String clStatus;
// 客户阶段
private String clStaje;
// 客户关系
private String clRelation;
// 负责人
private String clStaff;
// 备注
private String clRemark;
// 所属行业
private String clIndustry;
// 行业描述
private String clDescribe;
// 公司地址
private String clAddress;
// emali
private String clEmail;
// 电话
private String clPhone;
// 手机号码
private String clPhoneNumeber;
// 传真
private String clFax;
// 邮编
private String clZip;
// 旺旺
private String clWangwang;
// QQ/MSN
private String clQq;
// 网址
private String clWebsite;
// 收货地址
private String clReceipt;
// 开户银行
private String clBank;
// 开户人
private String clPeople;
// 银行账号
private String clNumber;
// 创建人
private String clCreate;
// 创建时间
private Timestamp clCreateTime;
// 最后修改人
private String clUptade;
// 最后修改时间
private Timestamp clUpdateTime;
// Constructors
/** default constructor */
public Info() {
}
/** full constructor */
public Info(String clName, String clNo,String clCategory, String clType, String clSource,
String clGrade, String clStatus, String clStaje, String clRelation,
String clStaff, String clRemark, String clIndustry,
String clDescribe, String clAddress, String clEmail,
String clPhone, String clPhoneNumeber, String clFax, String clZip,
String clWangwang, String clQq, String clWebsite, String clReceipt,
String clBank, String clPeople, String clNumber, String clCreate,
Timestamp clCreateTime, String clUptade, Timestamp clUpdateTime) {
this.clName = clName;
this.clNo = clNo;
this.clCategory=clCategory;
this.clType = clType;
this.clSource = clSource;
this.clGrade = clGrade;
this.clStatus = clStatus;
this.clStaje = clStaje;
this.clRelation = clRelation;
this.clStaff = clStaff;
this.clRemark = clRemark;
this.clIndustry = clIndustry;
this.clDescribe = clDescribe;
this.clAddress = clAddress;
this.clEmail = clEmail;
this.clPhone = clPhone;
this.clPhoneNumeber = clPhoneNumeber;
this.clFax = clFax;
this.clZip = clZip;
this.clWangwang = clWangwang;
this.clQq = clQq;
this.clWebsite = clWebsite;
this.clReceipt = clReceipt;
this.clBank = clBank;
this.clPeople = clPeople;
this.clNumber = clNumber;
this.clCreate = clCreate;
this.clCreateTime = clCreateTime;
this.clUptade = clUptade;
this.clUpdateTime = clUpdateTime;
}
// Property accessors
@GenericGenerator(name = "generator", strategy = "uuid.hex")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "id", unique = true, nullable = false, length = 32)
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
@Column(name = "cl_name", length = 50)
public String getClName() {
return this.clName;
}
public void setClName(String clName) {
this.clName = clName;
}
@Column(name = "cl_no", length = 50)
public String getClNo() {
return this.clNo;
}
public void setClNo(String clNo) {
this.clNo = clNo;
}
@Column(name = "cl_category", length = 32)
public String getClCategory() {
return this.clCategory;
}
public void setClCategory(String clCategory) {
this.clCategory = clCategory;
}
@Column(name = "cl_type", length = 32)
public String getClType() {
return this.clType;
}
public void setClType(String clType) {
this.clType = clType;
}
@Column(name = "cl_source", length = 32)
public String getClSource() {
return this.clSource;
}
public void setClSource(String clSource) {
this.clSource = clSource;
}
@Column(name = "cl_grade", length = 32)
public String getClGrade() {
return this.clGrade;
}
public void setClGrade(String clGrade) {
this.clGrade = clGrade;
}
@Column(name = "cl_status", length = 32)
public String getClStatus() {
return this.clStatus;
}
public void setClStatus(String clStatus) {
this.clStatus = clStatus;
}
@Column(name = "cl_staje", length = 32)
public String getClStaje() {
return this.clStaje;
}
public void setClStaje(String clStaje) {
this.clStaje = clStaje;
}
@Column(name = "cl_relation", length = 32)
public String getClRelation() {
return this.clRelation;
}
public void setClRelation(String clRelation) {
this.clRelation = clRelation;
}
@Column(name = "cl_staff", length = 32)
public String getClStaff() {
return this.clStaff;
}
public void setClStaff(String clStaff) {
this.clStaff = clStaff;
}
@Column(name = "cl_remark", length = 5000)
public String getClRemark() {
return this.clRemark;
}
public void setClRemark(String clRemark) {
this.clRemark = clRemark;
}
@Column(name = "cl_industry", length = 32)
public String getClIndustry() {
return this.clIndustry;
}
public void setClIndustry(String clIndustry) {
this.clIndustry = clIndustry;
}
@Column(name = "cl_describe", length = 5000)
public String getClDescribe() {
return this.clDescribe;
}
public void setClDescribe(String clDescribe) {
this.clDescribe = clDescribe;
}
@Column(name = "cl_address", length = 100)
public String getClAddress() {
return this.clAddress;
}
public void setClAddress(String clAddress) {
this.clAddress = clAddress;
}
@Column(name = "cl_email", length = 50)
public String getClEmail() {
return this.clEmail;
}
public void setClEmail(String clEmail) {
this.clEmail = clEmail;
}
@Column(name = "cl_phone", length = 50)
public String getClPhone() {
return this.clPhone;
}
public void setClPhone(String clPhone) {
this.clPhone = clPhone;
}
@Column(name = "cl_phoneNumeber", length = 50)
public String getClPhoneNumeber() {
return this.clPhoneNumeber;
}
public void setClPhoneNumeber(String clPhoneNumeber) {
this.clPhoneNumeber = clPhoneNumeber;
}
@Column(name = "cl_fax", length = 50)
public String getClFax() {
return this.clFax;
}
public void setClFax(String clFax) {
this.clFax = clFax;
}
@Column(name = "cl_zip", length = 50)
public String getClZip() {
return this.clZip;
}
public void setClZip(String clZip) {
this.clZip = clZip;
}
@Column(name = "cl_wangwang", length = 50)
public String getClWangwang() {
return this.clWangwang;
}
public void setClWangwang(String clWangwang) {
this.clWangwang = clWangwang;
}
@Column(name = "cl_qq", length = 50)
public String getClQq() {
return this.clQq;
}
public void setClQq(String clQq) {
this.clQq = clQq;
}
@Column(name = "cl_website", length = 50)
public String getClWebsite() {
return this.clWebsite;
}
public void setClWebsite(String clWebsite) {
this.clWebsite = clWebsite;
}
@Column(name = "cl_receipt", length = 100)
public String getClReceipt() {
return this.clReceipt;
}
public void setClReceipt(String clReceipt) {
this.clReceipt = clReceipt;
}
@Column(name = "cl_bank", length = 100)
public String getClBank() {
return this.clBank;
}
public void setClBank(String clBank) {
this.clBank = clBank;
}
@Column(name = "cl_people", length = 50)
public String getClPeople() {
return this.clPeople;
}
public void setClPeople(String clPeople) {
this.clPeople = clPeople;
}
@Column(name = "cl_number", length = 50)
public String getClNumber() {
return this.clNumber;
}
public void setClNumber(String clNumber) {
this.clNumber = clNumber;
}
@Column(name = "cl_create", length = 32)
public String getClCreate() {
return this.clCreate;
}
public void setClCreate(String clCreate) {
this.clCreate = clCreate;
}
@Column(name = "cl_createTime", length = 19)
public Timestamp getClCreateTime() {
return this.clCreateTime;
}
public void setClCreateTime(Timestamp clCreateTime) {
this.clCreateTime = clCreateTime;
}
@Column(name = "cl_uptade", length = 32)
public String getClUptade() {
return this.clUptade;
}
public void setClUptade(String clUptade) {
this.clUptade = clUptade;
}
@Column(name = "cl_updateTime", length = 19)
public Timestamp getClUpdateTime() {
return this.clUpdateTime;
}
public void setClUpdateTime(Timestamp clUpdateTime) {
this.clUpdateTime = clUpdateTime;
}
} | true |
be08393855c9a0e27d1fb500607aaaa89cc2eb31 | Java | kanwhile/Project54IT | /app/src/main/java/com/projects/mypillapp/Model/EventModel.java | UTF-8 | 436 | 1.664063 | 2 | [] | no_license | package com.projects.mypillapp.Model;
/**
* Created by นนทรักษ์ on 29/10/2558.
*/
public class EventModel {
public int id = -1;
public String name_event;
public String location;
public String name_docter;
public String detail_event;
public int hour;
public int minute;
public int day;
public int month;
public int year;
public String img_event;
public int id_doctor;
}
| true |
99fdfc8e86450912fe2e7354ca361de55c96c64f | Java | ajodochus/joomlaPageFactory | /src/test/java/pages/AuthorLogoutPage.java | UTF-8 | 409 | 1.585938 | 2 | [] | no_license | package pages;
import org.apache.log4j.Logger;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import utils.BasePage;
public class AuthorLogoutPage extends BasePage {
final static Logger logger = Logger.getLogger(AuthorLogoutPage.class);
@FindBy(how = How.ID, using = "txt_logout")
private WebElement tf_username;
}
| true |
cc0062999a75fe6e6d9b6ee0de65981828d673cc | Java | jimibue/cs1410 | /src/assign7/StringListTester.java | UTF-8 | 3,330 | 3.671875 | 4 | [] | no_license | package assign7;
/**
* This class test the StringList class
* @author James Yeates
*
*/
public class StringListTester {
public static void main(String[] args) {
StringList sList = new StringList();
if(sList.size() != 0)
System.out.println(getLine()+ " sList.size() != 0, sList.size() equals should equal 0 but equals " +sList.size() );
for(int i = sList.size(); i<10; i++)
sList.insert("Yo", i);
if( ! (sList.contains("Yo")))
System.out.println(getLine() + " (sList.contains(\"Yo\")) should be true but is " +(sList.contains("Yo")));
if (sList.contains("Yo0"))
System.out.println(getLine() + " (sList.contains(\"Yo0\")) should be false but is " +(sList.contains("Yo0")));
if (sList.size() != 10)
System.out.println(getLine() + " sList.size() != 10, sList.size() equals " +sList.size() );
sList.remove("Yo");
if( (sList.contains("Yo")))
System.out.println(getLine() + " (sList.contains(\"Yo\")) should be true but is " +(sList.contains("Yo")));
///////////L1 testing///////
StringList l1 = new StringList();
try{
l1.insert(null,0);
System.out.println(getLine() +" Exception should have been caught");
}catch(IllegalArgumentException e){}
try{
l1.insert("zero", 1);
System.out.println(getLine() + " Excaption should have been caught");
}catch (IndexOutOfBoundsException e){}
try{
l1.insert("zero", -1);
System.out.println(getLine() + " Excaption should have been caught");
}catch (IndexOutOfBoundsException e){}
for( int i = 0; i < 7; i++){
l1.insert("yo", 0);
}
String s1 = "\"yo, yo, yo, yo, yo, yo, yo\"";
String s2 = "\"zero, one, two, three, four, five, six, seven, yo, yo, yo, yo, yo, yo, yo\"";
String s3 = "\"one, two, three, four, five, six, seven, yo, yo, yo, yo, yo, yo, yo\"";
String s4 = "\"one, two, three, four, five, six, seven, yo, yo, yo, yo, yo, yo, yo, !!\"";
String s5 = "\"one, two, three, four, five, six, seven, yo, yo, yo, yo, yo, yo, yo\"";
if ( ! (l1.toString().equals(s1)))
System.out.println(getLine() + " l1.to String should equal " + s1 + " equals " + l1.toString());
l1.insert("one", 0);
l1.insert("zero", 0);
l1.insert("two", 2);
l1.insert("three", 3);
l1.insert("four", 4);
l1.insert("five", 5);
l1.insert("six", 6);
l1.insert("seven", 7);
if ( ! (l1.toString().equals(s2)))
System.out.println(getLine() + " l1.to String should equal " + s2 + " equals " + l1.toString());
l1.remove("zero");
if ( ! (l1.toString().equals(s3)))
System.out.println(getLine() + " l1.to String should equal " + s3 + " equals " + l1.toString());
try{
l1.insert("!!", 15);
System.out.println(getLine() + " Should have thrown exception");
}catch(IndexOutOfBoundsException e){}
l1.insert( "!!", 14);
if ( ! (l1.toString().equals(s4)))
System.out.println(getLine() + " l1.to String should equal " + s4 + " equals " + l1.toString());
l1.remove("!!");
if ( ! (l1.toString().equals(s5)))
System.out.println(getLine() + " l1.to String should equal " + s5 + " equals " + l1.toString());
System.out.println("Testing done.");
}
public static String getLine() {
return " Failed at line: " +Thread.currentThread().getStackTrace()[2].getLineNumber();
}
}
| true |
32d2064df4ba4a34155e307554d0e59233ff9307 | Java | jitchow/WebaleChess | /GameManagement.java | UTF-8 | 4,309 | 3.21875 | 3 | [] | no_license | import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.Image;
import java.awt.event.*;
import java.text.*;
import java.io.*;
//This class is used to save, load and delete games from files
public class GameManagement
{
//This is the file location of all the saved games
private String fileLocation = "Saved Games/";
//Done by Lim Yixen and Wong Jit Chow
//This method is used to get all the saved games and reformat it to be shown
//Called from GameController
public String[] getSavedGamesList()
{
//Open folder location of all the saved games
File savedGames = new File(fileLocation);
//Add all the files in the folder into an array
String [] savedGamesList = savedGames.list();
//Rename the filename properly for display
for (int i=0; i<savedGamesList.length; i++)
{
savedGamesList[i] = savedGamesList[i].substring(0, savedGamesList[i].length() - 4);
StringBuffer str = new StringBuffer(savedGamesList[i]);
str.delete(14, 17);
str.insert(2,'/');
str.insert(5,'/');
str.insert(10,' ');
str.insert(13,':');
str.insert(16,':');
savedGamesList[i] = "Game on " + str.toString();
}
return savedGamesList;
}
//Done by Wong Jit Chow
//This method is used to delete a selected saved game from file
public void deleteSavedGame(String fileName)//fileName in display state
{
//Change back to original filename
fileName = fileName.replace("Game on ","");
fileName = fileName.replace("/","");
fileName = fileName.replace(" ","");
fileName = fileName.replace(":","");
//Delete file
File file = new File(fileLocation + fileName + ".txt");
file.delete();
}
//Done by Lim Yixen
//This method is used to save all the game details into a text file and return the fileName
//Called from GameController for the "Save" button in menubar
public String saveGame(ArrayList<String> gameDetails,boolean changedPlusTri,int player0Moves,int player1Moves,String currentColour)
{
//Save four game settings into the gameDetails ArrayList
gameDetails.add(0,Boolean.toString(changedPlusTri));
gameDetails.add(1,Integer.toString(player0Moves));
gameDetails.add(2,Integer.toString(player1Moves));
gameDetails.add(3,currentColour);
Date date = new Date();//Get current time for fileName
SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyHHmmss");
String fileName = sdf.format(date);
//Store all game details into text file
try
{
File file = new File(fileLocation + fileName + ".txt");
file.createNewFile();
//Write data into file
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
for (int i=0; i<gameDetails.size(); i++)
writer.write(gameDetails.get(i) + " ");
writer.close();
}
catch(IOException e)
{e.printStackTrace();}
return fileName;
}
//Done by Wong Jit Chow
//This method reads the content of the text file and stores them into an ArrayList
//Called from GameController when previewing a chess board or when loading a saved game
public ArrayList<String> getLoadGameInfo(String fileName)//fileName in display state
{
//Change back to original filename
fileName = fileName.replace("Game on ","");
fileName = fileName.replace("/","");
fileName = fileName.replace(" ","");
fileName = fileName.replace(":","");
//Save data from file into ArrayList
ArrayList<String> gameInfo = new ArrayList <> ();
try
{
File file = new File(fileLocation + fileName + ".txt");
Scanner s = new Scanner(file);
while(s.hasNext())
{gameInfo.add(s.next());}
s.close();
}
catch(Exception e)
{System.out.println("Saved game not exist!");}
return gameInfo;
}
} | true |
ba7280425d6bafd0a8962943696fb13ac46aedb4 | Java | Krith-10/Java-Programs | /JDBC/DatabaseDemo.java | UTF-8 | 3,677 | 3.109375 | 3 | [] | no_license | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.*;
public class DatabaseDemo {
public static void retrieveAll(String url, String uname, String pwd) throws Exception {
//To retrieve all data from the MySQL
String query = "SELECT * "
+ "FROM student ";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,uname,pwd);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
String userData = "";
while(rs.next()) {
userData = rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3)+" "+rs.getFloat(4)+" "+rs.getString(5);
System.out.println(userData);
}
st.close();
con.close();
}
public static void insertSingleData(String url, String uname, String pwd) throws Exception {
//Inserting a single line data
String query = "INSERT INTO student VALUES (11, 'Kk', 'K', 8.55, 'Bangalore')";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,uname,pwd);
Statement st = con.createStatement();
int rs = st.executeUpdate(query);
System.out.println("Row/Row(s) affected:"+rs);
st.close();
con.close();
}
public static void userInput(String url, String uname, String pwd) throws Exception {
//Entering data from the user
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,uname,pwd);
PreparedStatement statement = con.prepareStatement("INSERT INTO student VALUES (?,?,?,?,?)");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number of entries to be done: ");
int n = Integer.parseInt(br.readLine());
for(int i=0;i<n;i++) {
System.out.println("Enter the roll no: ");
int rno = Integer.parseInt(br.readLine());
System.out.println("Enter the last name: ");
String lname = br.readLine();
System.out.println("Enter the first name: ");
String fname = br.readLine();
System.out.println("Enter GPA: ");
float gpa = Float.parseFloat(br.readLine());
System.out.println("Enter city: ");
String city = br.readLine();
statement.setInt(1,rno);
statement.setString(2, lname);
statement.setString(3, fname);
statement.setFloat(4, gpa);
statement.setString(5, city);
int updts = statement.executeUpdate();
System.out.println("No of rows affected: "+updts);
statement.close();
con.close();
}
}
public static void getMetaData (String url, String uname, String pwd) throws Exception {
//The metadata of the table
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,uname,pwd);
PreparedStatement ps=con.prepareStatement("select * from student");
ResultSet rs=ps.executeQuery();
ResultSetMetaData rsmd=rs.getMetaData();
int totalColumn = rsmd.getColumnCount();
System.out.println("Total number of coulumns in table: "+totalColumn);
for(int i=1;i<=totalColumn;i++) {
System.out.println("Name of "+i+" column: "+rsmd.getColumnName(i));
System.out.println("Type of "+i+" column: "+rsmd.getColumnTypeName(i));
}
ps.close();
con.close();
}
public static void main (String[] args) throws Exception {
String url="jdbc:mysql://localhost:3306/Persons?characterEncoding=latin1";
String uname=""; //your user name
String pwd=""; //your password
//Select the static method required to perform operation
DatabaseDemo.getMetaData(url, uname, pwd);
}
} | true |
988b92be8f3ef26ebb28d8a4e0af347351914aab | Java | keramist/zmailserver | /ZmailServer/src/java/org/zmail/cs/account/accesscontrol/PresetRight.java | UTF-8 | 1,815 | 1.757813 | 2 | [
"MIT"
] | permissive | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2009, 2010, 2011, 2012 VMware, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package org.zmail.cs.account.accesscontrol;
import java.util.HashSet;
import java.util.Set;
import org.zmail.common.service.ServiceException;
public class PresetRight extends AdminRight {
PresetRight(String name) {
super(name, RightType.preset);
}
@Override
public boolean isPresetRight() {
return true;
}
//
// TODO: disguise group target as dl for R_checkRightGrp right
//
@Override
Set<TargetType> getGrantableTargetTypes() {
Set<TargetType> targetTypes = new HashSet<TargetType>();
for (TargetType targetType : mTargetType.inheritFrom()) {
targetTypes.add(targetType);
}
return targetTypes;
}
@Override
boolean grantableOnTargetType(TargetType targetType) {
return targetType.isInheritedBy(mTargetType);
}
@Override
boolean overlaps(Right other) throws ServiceException {
if (other.isPresetRight())
return this==other;
else if (other.isAttrRight())
return false;
else if (other.isComboRight())
return ((ComboRight)other).containsPresetRight(this);
else
throw ServiceException.FAILURE("internal error", null);
}
}
| true |
05c825e2d3c4f1b006501b4f13aa48d506cda842 | Java | SkippyNor/nvdb-api-client | /src/main/java/no/vegvesen/nvdbapi/client/clients/RoadObjectClient.java | UTF-8 | 11,412 | 1.78125 | 2 | [
"BSD-2-Clause"
] | permissive | /*
* Copyright (c) 2015-2017, Statens vegvesen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package no.vegvesen.nvdbapi.client.clients;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import no.vegvesen.nvdbapi.client.clients.util.JerseyHelper;
import no.vegvesen.nvdbapi.client.gson.ChangesParser;
import no.vegvesen.nvdbapi.client.gson.RoadObjectParser;
import no.vegvesen.nvdbapi.client.model.Change;
import no.vegvesen.nvdbapi.client.model.Page;
import no.vegvesen.nvdbapi.client.model.datakatalog.DataType;
import no.vegvesen.nvdbapi.client.model.datakatalog.Datakatalog;
import no.vegvesen.nvdbapi.client.model.roadobjects.Attribute;
import no.vegvesen.nvdbapi.client.model.roadobjects.RoadObject;
import no.vegvesen.nvdbapi.client.model.roadobjects.Statistics;
import no.vegvesen.nvdbapi.client.util.ArgUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriBuilder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import static no.vegvesen.nvdbapi.client.clients.RoadObjectRequestBuilder.convert;
public class RoadObjectClient extends AbstractJerseyClient {
private static final Logger logger = LoggerFactory.getLogger(RoadObjectClient.class);
private final Datakatalog datakatalog;
protected RoadObjectClient(String baseUrl, Client client, Datakatalog datakatalog) {
super(baseUrl, client);
this.datakatalog = datakatalog;
}
public Datakatalog getDatakatalog() {
return datakatalog;
}
public Attribute getAttribute(int featureTypeId, long featureId, int attributeTypeId) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d/%d/egenskaper/%d", featureTypeId, featureId, attributeTypeId));
logger.debug("Invoking {}", path);
WebTarget target = getClient().target(path);
JsonElement e = JerseyHelper.execute(target);
return RoadObjectParser.parseAttribute(datakatalog.getDataTypeMap(), e.getAsJsonObject());
}
public Stream<Attribute> getAttributes(int featureTypeId, Stream<Long> featureIds, int attributeTypeId) {
return featureIds.map(id -> getAttribute(featureTypeId, id, attributeTypeId));
}
public Statistics getStats(int featureTypeId, RoadObjectRequest request) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d/statistikk", featureTypeId));
applyRequestParameters(path, convert(request));
logger.debug("Invoking {}", path);
WebTarget target = getClient().target(path);
JsonElement e = JerseyHelper.execute(target);
return RoadObjectParser.parseStatistics(e.getAsJsonObject());
}
public RoadObjectsResult getRoadObjects(int featureTypeId) {
return getRoadObjects(featureTypeId, RoadObjectRequest.DEFAULT);
}
/**
* This method can be used when you desire complete control of which query parameters is sent to the API
* @param featureTypeId Get object with feature type id
* @param queryParameters raw query parameters
* @return {@code RoadObjectsResult} for query
*/
public RoadObjectsResult getRoadObjects(int featureTypeId, MultivaluedMap<String, String> queryParameters) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d", featureTypeId));
applyRequestParameters(path, queryParameters);
WebTarget target = getClient().target(path);
return new RoadObjectsResult(target, extractPage(queryParameters), datakatalog);
}
public RoadObjectsResult getRoadObjects(int featureTypeId, RoadObjectRequest request) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d", featureTypeId));
applyRequestParameters(path, convert(request));
WebTarget target = getClient().target(path);
return new RoadObjectsResult(target, Optional.ofNullable(request.getPage()), datakatalog);
}
public AsyncRoadObjectsResult getRoadObjectsAsync(int featureTypeId, MultivaluedMap<String, String> queryParameters) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d", featureTypeId));
applyRequestParameters(path, queryParameters);
WebTarget target = getClient().target(path);
return new AsyncRoadObjectsResult(target, extractPage(queryParameters).orElse(Page.defaults()), datakatalog);
}
public AsyncRoadObjectsResult getRoadObjectsAsync(int featureTypeId, RoadObjectRequest request) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d", featureTypeId));
applyRequestParameters(path, convert(request));
WebTarget target = getClient().target(path);
return new AsyncRoadObjectsResult(target, request.getPage(), datakatalog);
}
private Optional<Page> extractPage(MultivaluedMap<String, String> params) {
if (params.containsKey("antall")) {
return Optional.of(Page.count(Integer.parseInt(params.getFirst("antall"))));
}
return Optional.empty();
}
public RoadObject getRoadObject(int featureTypeId, long featureId) {
return getRoadObject(featureTypeId, featureId, RoadObjectRequest.DEFAULT);
}
public RoadObject getRoadObject(int featureTypeId, long featureId, RoadObjectRequest request) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d/%d", featureTypeId, featureId));
logger.debug("Invoking {}", path);
applyRequestParameters(path, convert(request));
WebTarget target = getClient().target(path);
JsonObject obj = JerseyHelper.execute(target).getAsJsonObject();
return RoadObjectParser.parse(datakatalog.getDataTypeMap(), obj);
}
public ChangesResult getChanges(int typeId, LocalDate from, Page page, Change.Type type) {
return getChanges(typeId, from.atStartOfDay(), page, type);
}
public ChangesResult getChanges(int typeId, LocalDateTime from, Page page, Change.Type type) {
Objects.requireNonNull(from, "Missing from argument!");
UriBuilder path = start()
.path(String.format("/vegobjekter/%d/endringer", typeId))
.queryParam("etter", ArgUtil.date(from))
.queryParam("type", type.getArgValue());
WebTarget target = getClient().target(path);
return new ChangesResult(datakatalog.getDataTypeMap(), typeId, target, Optional.ofNullable(page));
}
private static void applyRequestParameters(UriBuilder path, MultivaluedMap<String, String> params) {
params.forEach((k, values) -> path.queryParam(k, (Object[]) values.toArray(new String[0])));
}
public List<Attribute> getAttributes(int featureTypeId, long featureId) {
UriBuilder path = start()
.path(String.format("/vegobjekter/%d/%d/egenskaper", featureTypeId, featureId));
logger.debug("Invoking {}", path);
WebTarget target = getClient().target(path);
JsonArray array = JerseyHelper.execute(target).getAsJsonArray();
return StreamSupport.stream(array.spliterator(), false)
.map(JsonElement::getAsJsonObject)
.map(o -> RoadObjectParser.parseAttribute(datakatalog.getDataTypeMap(), o))
.collect(Collectors.toList());
}
public enum Include {
MINIMUM("minimum"),
METADATA("metadata"),
ATTRIBUTES("egenskaper"),
ASSOCIATIONS("relasjoner"),
LOCATION("lokasjon"),
ROAD_SEGMENTS("vegsegmenter"),
GEOMETRI("geometri"),
ALL("alle");
private final String value;
Include(String value) {
this.value = value;
}
public static Set<Include> all() {
return EnumSet.complementOf(EnumSet.of(Include.MINIMUM, Include.ALL));
}
public static Set<Include> not(Include... without) {
return all().stream()
.filter(v -> !Arrays.asList(without).contains(v))
.collect(Collectors.toSet());
}
public String stringValue() {
return value;
}
}
public enum IncludeGeometry {
ATTRIBUTE("egenskap"),
LOCATION("lokasjon"),
DERIVED("utledet"),
NONE("ingen");
private final String value;
IncludeGeometry(String stringValue) {
this.value = stringValue;
}
public String stringValue() {
return value;
}
public static Set<IncludeGeometry> all() {
return EnumSet.of(ATTRIBUTE, LOCATION, DERIVED);
}
}
public static class RoadObjectsResult extends GenericResultSet<RoadObject> {
public RoadObjectsResult(WebTarget baseTarget,
Optional<Page> currentPage,
Datakatalog datakatalog) {
super(baseTarget, currentPage, o -> RoadObjectParser.parse(datakatalog.getDataTypeMap(), o));
}
}
public static class AsyncRoadObjectsResult extends AsyncResult<RoadObject> {
public AsyncRoadObjectsResult(WebTarget baseTarget,
Page currentPage,
Datakatalog datakatalog) {
super(baseTarget, currentPage, o -> RoadObjectParser.parse(datakatalog.getDataTypeMap(), o));
}
}
public static class ChangesResult extends GenericResultSet<Change> {
public ChangesResult(Map<Integer, DataType> dataTypes,
int typeId,
WebTarget baseTarget,
Optional<Page> currentPage) {
super(baseTarget, currentPage, obj -> ChangesParser.parse(dataTypes, obj, typeId));
}
}
}
| true |
c8d041a9e0c777311ddfd6b253b35470a7377da5 | Java | cutipiee/projects | /basicPrograms/src/com/java/threads/FileSearch.java | UTF-8 | 1,233 | 3.546875 | 4 | [] | no_license | package com.java.threads;
import java.io.File;
public class FileSearch implements Runnable{
private String initPath, fileName;
public FileSearch(String initPath, String fileName) {
this.initPath=initPath;
this.fileName=fileName;
}
@Override
public void run() {
File file=new File(initPath);
if(file.isDirectory()) {
try {
directoryProcess(file);
}catch(InterruptedException e) {
System.out.printf("s%:Search has been interruped",Thread.currentThread().getName());
}}
}
private void directoryProcess(File file)throws InterruptedException {
File list[]=file.listFiles();
if(list!=null) {
for(int i=0;i<list.length;i++) {
if(list[i].isDirectory()) {
directoryProcess(list[i]);
}else {
fileProcess(list[i]);
}
}
}
if(Thread.interrupted()) {
throw new InterruptedException();
}
}
private void fileProcess(File file) throws InterruptedException {
if(file.getName().equals(fileName)) {
System.out.printf("%s,%s\n", Thread.currentThread().getName(),file.getAbsolutePath());
}
if(Thread.interrupted()) {
throw new InterruptedException();
}
}
}
| true |
5dbc46bcfe65e8e432ceacdb5795841f7532f682 | Java | TheEricLam/LamE_APCS_Spring2k17 | /TextExcel/src/textExcel/TextCell.java | UTF-8 | 483 | 2.859375 | 3 | [] | no_license | package textExcel;
public class TextCell implements Cell {
private String values;
public TextCell(String strValue){
values = strValue;
}
public TextCell(){
}
@Override
public String abbreviatedCellText() {
// TODO Auto-generated method stub
return " ";
}
@Override
public String fullCellText() {
// TODO Auto-generated method stub
return values;
}
public String getCellValue(Location location){
return abbreviatedCellText();
}
}
| true |
95f3247002367967623de2db390bbfe423a824cc | Java | xinjieyanlearner/estore | /src/main/java/com/briup/app/estore/service/impl/LineService.java | UTF-8 | 923 | 1.953125 | 2 | [] | no_license | package com.briup.app.estore.service.impl;
import org.apache.ibatis.session.SqlSession;
import com.briup.app.estore.bean.Orderline;
import com.briup.app.estore.mapper.CustomerMapper;
import com.briup.app.estore.mapper.OrderlineMapper;
import com.briup.app.estore.service.ILineService;
import com.briup.app.estore.util.MyBatisSqlSessionFactory;
public class LineService implements ILineService {
@Override
public void soveOrderLine(Orderline orderLine) {
SqlSession sqlSession = MyBatisSqlSessionFactory.openSession();
OrderlineMapper orderlineMapper = sqlSession.getMapper(OrderlineMapper.class);
orderlineMapper.insert(orderLine);
sqlSession.commit();
}
@Override
public void deleFk(Integer fk) {
SqlSession sqlSession = MyBatisSqlSessionFactory.openSession();
OrderlineMapper orderlineMapper = sqlSession.getMapper(OrderlineMapper.class);
orderlineMapper.deleFk(fk);
sqlSession.commit();
}
}
| true |
66aae496b80e1afb3ac5eafbc463b0ee7585247f | Java | zneb97/DSA-17 | /search-engine/day02/src/WikiSearch.java | UTF-8 | 4,928 | 3.03125 | 3 | [] | no_license | import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
import redis.clients.jedis.Jedis;
public class WikiSearch {
// map from URLs that contain the term(s) to relevance score
private Map<String, Integer> map;
private Index index;
public WikiSearch(Map<String, Integer> map) {
this.map = map;
}
public Integer getRelevance(String url) {
if(map.get(url)==null){
return 0;
}
return map.get(url);
}
// Prints the contents in order of term frequency.
private void print() {
List<Entry<String, Integer>> entries = sort();
for (Entry<String, Integer> entry: entries) {
System.out.println(entry);
}
}
// Computes the union of two search results.
public WikiSearch or(WikiSearch that) {
for(String url : that.map.keySet()){
map.put(url, that.getRelevance(url)+this.getRelevance(url));
}
return this;
}
// Computes the intersection of two search results.
public WikiSearch and(WikiSearch that) {
Map<String, Integer> andResult = new HashMap<>();
for(String url : that.map.keySet()){
if((map.containsKey(url))){
andResult.put(url, that.getRelevance(url)+this.getRelevance(url));
}
}
return new WikiSearch(andResult);
}
// Computes the intersection of two search results.
public WikiSearch minus(WikiSearch that) {
for(String url : that.map.keySet()){
if((map.containsKey(url))){
map.remove(url);
}
}
return this;
}
// Computes the relevance of a search with multiple terms.
protected int totalRelevance(Integer rel1, Integer rel2){
return rel1+rel2;
}
// Sort the results by relevance.
public List<Entry<String, Integer>> sort() {
List<Entry<String, Integer>> sorted = new LinkedList(map.entrySet());
Collections.sort(sorted, new Comparator() {
public int compare(Object entry1, Object entry2) {
return ((Comparable) ((Map.Entry) (entry1)).getValue())
.compareTo(((Map.Entry) (entry2)).getValue());
}
});
return sorted;
}
// Performs a search and makes a WikiSearch object.
public static WikiSearch search(String term, Index index) {
// TODO: Use the index to get a map from URL to count
// Fix this
Map<String, Integer> map = index.get(term);
// Store the map locally in the WikiSearch
return new WikiSearch(map);
}
public static WikiSearch TfIdf(String[] terms){
Index index = new Index();
WikiSearch total = search(terms[0],index);
double[] termPages = new double[(terms.length)];
termPages[0] = total.map.size();
for(int i = 1; i < terms.length;i++){
WikiSearch cPage = search(terms[i],index);
total = total.or(cPage);
termPages[i] = (double)(cPage.map.size());
}
double tot = (double)(total.map.size());
WikiSearch finalMap = new WikiSearch(new HashMap<String, Integer>());
for(int i = 0; i < terms.length;i++){
WikiSearch cPage = search(terms[i],index);
for(String key : cPage.map.keySet()){
cPage.map.put(key, (int)(cPage.getRelevance(key) * Math.log(tot/(1+termPages[i]))));
}
finalMap = finalMap.or(cPage);
}
return finalMap;
}
// TODO: Choose an extension and add your methods here
public static void main(String[] args) throws IOException {
// make a Index
Jedis jedis = JedisMaker.make();
Index index = new Index(); // You might need to change this, depending on how your constructor works.
// search for the first term
// String term1 = "java";
// System.out.println("Query: " + term1);
// WikiSearch search1 = search(term1, index);
// search1.print();
//
// // search for the second term
// String term2 = "programming";
// System.out.println("Query: " + term2);
// WikiSearch search2 = search(term2, index);
// search2.print();
//
// // compute the intersection of the searches
// System.out.println("Query: " + term2 + " MINUS " + term1);
// WikiSearch intersection = search2.minus(search1);
// intersection.print();
//
// System.out.println("Query: " + term2 + " OR " + term1);
// intersection = search2.or(search1);
// intersection.print();
//
// System.out.println("Break");
// TfIdf(new String[]{term1, term2}).print();
System.out.println(jedis.hgetAll("the"));
System.out.println("Break:-----------------");
System.out.println(jedis.hgetAll("java"));
}
} | true |
937b59adbc50a8e27caaad9ce2b4e9ac96b7718c | Java | hxfirefox/hangman | /src/test/java/HangmanGameTest.java | UTF-8 | 2,700 | 2.71875 | 3 | [] | no_license | import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Created by hx on 16-1-22.
*/
public class HangmanGameTest {
private HangmanGame hangmanGame;
@Before
public void setUp() throws Exception {
hangmanGame = new HangmanGame();
}
@Test
public void should_new_game() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
// then
assertThat(hangmanGame.chance(), is(12));
assertThat(hangmanGame.used(), is("AEIOU"));
assertThat(hangmanGame.display(), is("_A___A_"));
}
@Test
public void should_match_when_try_with_correct_letter() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
boolean matched = hangmanGame.tryWith('H');
// then
assertThat(matched, is(true));
assertThat(hangmanGame.chance(), is(12));
assertThat(hangmanGame.used(), is("AEIOUH"));
assertThat(hangmanGame.display(), is("HA___A_"));
}
@Test
public void should_mismatch_when_try_with_incorrect_letter() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
boolean matched = hangmanGame.tryWith('S');
// then
assertThat(matched, is(false));
assertThat(hangmanGame.chance(), is(11));
assertThat(hangmanGame.used(), is("AEIOUS"));
assertThat(hangmanGame.display(), is("_A___A_"));
}
@Test
public void should_game_win_when_all_match_before_chance_expired() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
hangmanGame.tryWith('H');
hangmanGame.tryWith('N');
hangmanGame.tryWith('G');
hangmanGame.tryWith('M');
// then
assertThat(hangmanGame.chance() > 0, is(true));
assertThat(hangmanGame.display(), is("HANGMAN"));
assertThat(hangmanGame.result(), is("Game Win"));
}
@Test
public void should_game_over_after_chance_expired() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
for (int i = 0; i < 12; i++) {
hangmanGame.tryWith('S');
}
// then
assertThat(hangmanGame.chance() == 0, is(true));
assertThat(hangmanGame.used(), is("AEIOUSSSSSSSSSSSS"));
assertThat(hangmanGame.result(), is("Game Over"));
}
@Test
public void should_give_answer() throws Exception {
// given
hangmanGame.game("HANGMAN");
// when
// then
assertThat(hangmanGame.answer(), is("HANGMAN"));
}
}
| true |
79cc6897fea29375f034f8d000e64201cdf70f53 | Java | bcdev/calvalus2 | /calvalus-wps-impl/src/test/java/com/bc/calvalus/wps/cmd/CommandLineWrapperTest.java | UTF-8 | 1,500 | 2.421875 | 2 | [] | no_license | package com.bc.calvalus.wps.cmd;
/**
* @author hans
*/
public class CommandLineWrapperTest {
// @Ignore
// @Test
// public void canExecute() throws Exception {
// CommandLineWrapper cmd = new CommandLineWrapper();
//// String workingDirectoryPath = "C:\\Projects\\calvalus\\calvalus-wps-impl\\src";
// String workingDirectoryPath = ".";
// CommandLineResultHandler resultHandler = cmd.executeAsync(workingDirectoryPath, "cd", "3");
// resultHandler.waitFor(1);
// if(resultHandler.hasResult()){
// Exception exception = resultHandler.getException();
// System.out.println("exception.getMessage() = " + exception.getMessage());
// throw exception;
// } else{
// System.out.println("Timed out and killed.");
// }
//// System.out.println(cmd.executeAsync(workingDirectoryPath, "cmd", "cd", "src", "&&", "dir"));
//// System.out.println(cmd.executeAsync(workingDirectoryPath, "java", "-version"));
//// System.out.println(cmd.executeAsync(workingDirectoryPath, "bash", "test.sh"));
//// System.out.println(cmd.executeAsync("cmd", "dir"));
// }
//
// @Ignore
// @Test
// public void canExecuteSync() throws Exception {
// CommandLineWrapper cmd = new CommandLineWrapper();
// String workingDirectoryPath = ".";
// String result = cmd.executeSync(1000, workingDirectoryPath, "which");
// System.out.println(result);
// }
} | true |
4b60486c64c2165f566e026da45aaac5d5e02726 | Java | MakamuEvans/MyNote | /app/src/main/java/layout/NotesFragment.java | UTF-8 | 11,812 | 1.78125 | 2 | [] | no_license | package layout;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import com.elm.mycheck.login.AddNote;
import com.elm.mycheck.login.R;
import com.elm.mycheck.login.adapter.NotesAdapter;
import com.elm.mycheck.login.model.Category;
import com.elm.mycheck.login.model.Note;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.orm.query.Condition;
import com.orm.query.Select;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link NotesFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link NotesFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class NotesFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public List<Note> notes = new ArrayList<>();
private RecyclerView recyclerView;
public NotesAdapter notesAdapter;
public NotesFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment NotesFragment.
*/
// TODO: Rename and change types and number of parameters
public static NotesFragment newInstance(String param1, String param2) {
NotesFragment fragment = new NotesFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
private UploadReceiver receiver;
private SyncReceiver syncReceiver;
private DeleteReceiver deleteReceiver;
private AdView adView;
private Spinner spinner;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_notes2, container, false);
adView = (AdView) view.findViewById(R.id.NotesadView);
adView.setVisibility(View.GONE);
AdRequest adRequest = new AdRequest.Builder()
//.addTestDevice("EA28AA409AA1C2A25750D1B354BDD8A9")
.build();
adView.loadAd(adRequest);
adView.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
super.onAdLoaded();
adView.setVisibility(View.VISIBLE);
}
@Override
public void onAdFailedToLoad(int i) {
super.onAdFailedToLoad(i);
adView.setVisibility(View.GONE);
}
});
//register broadcast receiver
IntentFilter filter = new IntentFilter(AddNote.ACTION_RESP);
//filter.addCategory(Intent.CATEGORY_DEFAULT);
receiver = new UploadReceiver();
getActivity().registerReceiver(receiver, filter);
IntentFilter intentFilter = new IntentFilter(SyncReceiver.SYNC_ACTION);
syncReceiver = new SyncReceiver();
getActivity().registerReceiver(syncReceiver, intentFilter);
IntentFilter intentFilter1 = new IntentFilter(DeleteReceiver.SYNC_ACTION);
deleteReceiver = new DeleteReceiver();
getActivity().registerReceiver(deleteReceiver, intentFilter1);
recyclerView = (RecyclerView) view.findViewById(R.id.notes_recycler);
notes = Select.from(Note.class)
.where(Condition.prop("deleteflag").eq(0))
.orderBy("Id DESC")
.list();
notesAdapter = new NotesAdapter(notes, getActivity().getApplicationContext());
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(notesAdapter);
notesAdapter.swapAll(notes);
final List<String> categories = new ArrayList<>();
List<Category> data = new ArrayList<>();
data = Select.from(Category.class)
.orderBy("title DESC")
.list();
categories.add("-All Notes-");
categories.add("Favourites");
for (Category category : data) {
categories.add(category.getTitle());
}
spinner = (Spinner) view.findViewById(R.id.fullSpinner);
spinner.setAdapter(new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_dropdown_item, categories));
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
String selected = categories.get(i);
if (selected.equals("-All Notes-")) {
notes = Select.from(Note.class)
.where(Condition.prop("deleteflag").eq(0))
.orderBy("Id DESC")
.list();
} else if (selected.equals("Favourites")) {
notes = Select.from(Note.class)
.where(Condition.prop("favourite").eq(1))
.orderBy("Id DESC")
.list();
} else {
Category category = Select.from(Category.class)
.where(Condition.prop("title").eq(selected))
.first();
notes = Select.from(Note.class)
.where(Condition.prop("deleteflag").eq(0))
.where(Condition.prop("category").eq(category.getId()))
.orderBy("Id DESC")
.list();
// notesAdapter = new NotesAdapter(notes, getActivity().getApplicationContext());
}
if (notesAdapter != null) {
notesAdapter.swapAll(notes);
}
//recyclerView.setAdapter(notesAdapter);
//recyclerView.swapAdapter(notesAdapter, false);
/* NotesAdapter notesAdapter = null;
notesAdapter.swapAll(notes);*/
//recyclerView.notify();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
return view;
//return inflater.inflate(R.layout.fragment_notes2, container, false);
}
@Override
public void onDestroy() {
if (receiver != null)
getActivity().unregisterReceiver(receiver);
if (syncReceiver != null)
getActivity().unregisterReceiver(syncReceiver);
if (deleteReceiver != null)
getActivity().unregisterReceiver(deleteReceiver);
super.onDestroy();
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
/* @Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}*/
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
@Override
public void onResume() {
super.onResume();
}
/**
* redraw the recycler -view --all of it
*/
public void addNew(Note note) {
if (notesAdapter != null) {
notesAdapter.newData(note, null);
recyclerView.smoothScrollToPosition(0);
}
}
public void update(Note note) {
if (notesAdapter != null) {
notesAdapter.updateItem(note);
}
}
public void deleteNote(Note note) {
if (notesAdapter != null) {
notesAdapter.deleteNote(note);
}
}
/**
* receive broadcasts
*/
public class UploadReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.e("vane", "vane");
Bundle bundle = intent.getExtras();
String newNote = bundle.getString("note");
Gson gson = new Gson();
Type type = new TypeToken<Note>() {
}.getType();
Note note = gson.fromJson(newNote, type);
addNew(note);
}
}
public class SyncReceiver extends BroadcastReceiver {
public static final String SYNC_ACTION = "sync_action";
@Override
public void onReceive(Context context, Intent intent) {
Log.e("received_sync", "yes");
Bundle bundle = intent.getExtras();
String newNote = bundle.getString("note");
Gson gson = new Gson();
Type type = new TypeToken<Note>() {
}.getType();
Note note = gson.fromJson(newNote, type);
update(note);
}
}
public class DeleteReceiver extends BroadcastReceiver {
public static final String SYNC_ACTION = "delete_action";
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
String newNote = bundle.getString("note");
Gson gson = new Gson();
Type type = new TypeToken<Note>() {
}.getType();
Note note = gson.fromJson(newNote, type);
deleteNote(note);
}
}
}
| true |
b5280499592bf70b346c23902d27a3ee79dd3a84 | Java | renclav/SampleAppFragmentless | /app/src/main/java/com/touchnote/renclav/touchnotesampleapp/data/Clue.java | UTF-8 | 3,717 | 2.609375 | 3 | [] | no_license | package com.touchnote.renclav.touchnotesampleapp.data;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Renclav on 2016/11/04.
*/
public class Clue implements Parcelable {
private String id;
private String description;
private String date;
private List<String> tags = new ArrayList<String>();
private String title;
private String image;
//NOTE: This kind of logic should exist in model-view
private int morphStep = 0;
private Clue() {
//Leave empty for Moshi
}
protected Clue(Parcel in) {
id = in.readString();
description = in.readString();
date = in.readString();
tags = new ArrayList<>();
if (in.readByte() == 0x01) {
in.readList(tags, String.class.getClassLoader());
}
title = in.readString();
image = in.readString();
morphStep = in.readInt();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(description);
dest.writeString(date);
if (tags == null) {
dest.writeByte((byte) (0x00));
} else {
dest.writeByte((byte) (0x01));
dest.writeList(tags);
}
dest.writeString(title);
dest.writeString(image);
dest.writeInt(morphStep);
}
@SuppressWarnings("unused")
public static final Parcelable.Creator<Clue> CREATOR = new Parcelable.Creator<Clue>() {
@Override
public Clue createFromParcel(Parcel in) {
return new Clue(in);
}
@Override
public Clue[] newArray(int size) {
return new Clue[size];
}
};
@Override
public int describeContents() {
return 0;
}
public void copyFrom(Clue clue)
{
this.id = clue.id;
this.description = clue.description;
this.date = clue.date;
this.tags = new ArrayList<>();
if(clue.tags != null)
{
this.tags.addAll(clue.tags);
}
this.title = clue.title;
this.image = clue.image;
}
/**
* @return The id
*/
public String getId() {
return id;
}
/**
* @param id The id
*/
public void setId(String id) {
this.id = id;
}
/**
* @return The description
*/
public String getDescription() {
return description;
}
/**
* @param description The description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return The date
*/
public String getDate() {
return date;
}
/**
* @param date The date
*/
public void setDate(String date) {
this.date = date;
}
/**
* @return The tags
*/
public List<String> getTags() {
return tags;
}
/**
* @param tags The tags
*/
public void setTags(List<String> tags) {
this.tags = tags;
}
/**
* @return The title
*/
public String getTitle() {
return title;
}
/**
* @param title The title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* @return The image
*/
public String getImage() {
return image;
}
/**
* @param image The image
*/
public void setImage(String image) {
this.image = image;
}
public int getMorphStep() {
return morphStep;
}
public void setMorphStep(int morphStep) {
this.morphStep = morphStep;
}
}
| true |
cb7e89a841eb81a958d8716ae5e81bb9424ee190 | Java | a124001/DataStrucutres | /src/mathematics/LCMTest.java | UTF-8 | 507 | 2.390625 | 2 | [] | no_license | package mathematics;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class LCMTest {
@Test
void test() {
LCM lcm = new LCM();
assertEquals(lcm.getLCMNaive(4, 6), 12);
assertEquals(lcm.getLCMNaive(12, 15), 60);
assertEquals(lcm.getLCMNaive(2, 8), 8);
assertEquals(lcm.getLCMNaive(3, 7), 21);
assertEquals(lcm.getLCM(4, 6), 12);
assertEquals(lcm.getLCM(12, 15), 60);
assertEquals(lcm.getLCM(2, 8), 8);
assertEquals(lcm.getLCM(3, 7), 21);
}
}
| true |
176ea1e5b414f16d234313cf518c15a0b5d69cff | Java | batfish/batfish | /projects/batfish-common-protocol/src/main/java/org/batfish/specifier/ReferenceAddressGroupIpSpaceSpecifier.java | UTF-8 | 2,643 | 2.390625 | 2 | [
"Apache-2.0"
] | permissive | package org.batfish.specifier;
import static com.google.common.base.MoreObjects.firstNonNull;
import com.google.common.base.MoreObjects;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.stream.Collectors;
import org.batfish.datamodel.AclIpSpace;
import org.batfish.datamodel.EmptyIpSpace;
import org.batfish.datamodel.IpSpace;
import org.batfish.datamodel.IpWildcard;
import org.batfish.referencelibrary.AddressGroup;
/**
* An {@link IpSpaceAssignmentSpecifier} that looks up an {@link AddressGroup} in a {@link
* org.batfish.referencelibrary.ReferenceBook}.
*/
public final class ReferenceAddressGroupIpSpaceSpecifier implements IpSpaceSpecifier {
private final String _addressGroupName;
private final String _bookName;
public ReferenceAddressGroupIpSpaceSpecifier(String addressGroupName, String bookName) {
_addressGroupName = addressGroupName;
_bookName = bookName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ReferenceAddressGroupIpSpaceSpecifier)) {
return false;
}
ReferenceAddressGroupIpSpaceSpecifier other = (ReferenceAddressGroupIpSpaceSpecifier) o;
return Objects.equals(_addressGroupName, other._addressGroupName)
&& Objects.equals(_bookName, other._bookName);
}
@Override
public int hashCode() {
return Objects.hash(_addressGroupName, _bookName);
}
@Override
public IpSpace resolve(SpecifierContext ctxt) {
return computeIpSpace(_addressGroupName, _bookName, ctxt);
}
/**
* Computes the IpSpace in the address group. Returns {@link EmptyIpSpace} if the addressgroup is
* empty.
*
* @throws NoSuchElementException if {@code bookName} does not exist or if {@code
* addressGroupName} or one of its descendants do not exist in the Reference Book.
*/
public static IpSpace computeIpSpace(
String addressGroupName, String bookName, SpecifierContext ctxt) {
return firstNonNull(
AclIpSpace.union(
ctxt
.getReferenceBook(bookName)
.orElseThrow(
() -> new NoSuchElementException("ReferenceBook '" + bookName + "' not found"))
.getAddressesRecursive(addressGroupName)
.stream()
.map(IpWildcard::toIpSpace)
.collect(Collectors.toList())),
EmptyIpSpace.INSTANCE);
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("addressGroup", _addressGroupName)
.add("referenceBook", _bookName)
.toString();
}
}
| true |
7407ee7d2f8f6a2a0f6957d3184d9435ab27877d | Java | baraabilal/cmps252_hw4.2 | /src/cmps252/HW4_2/UnitTesting/record_3207.java | UTF-8 | 2,436 | 2.71875 | 3 | [
"MIT"
] | permissive | package cmps252.HW4_2.UnitTesting;
import static org.junit.jupiter.api.Assertions.*;
import java.io.FileNotFoundException;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import cmps252.HW4_2.Customer;
import cmps252.HW4_2.FileParser;
@Tag("22")
class Record_3207 {
private static List<Customer> customers;
@BeforeAll
public static void init() throws FileNotFoundException {
customers = FileParser.getCustomers(Configuration.CSV_File);
}
@Test
@DisplayName("Record 3207: FirstName is Dydre")
void FirstNameOfRecord3207() {
assertEquals("Dydre", customers.get(3206).getFirstName());
}
@Test
@DisplayName("Record 3207: LastName is Rastegar")
void LastNameOfRecord3207() {
assertEquals("Rastegar", customers.get(3206).getLastName());
}
@Test
@DisplayName("Record 3207: Company is J G Stewart Contractors Inc")
void CompanyOfRecord3207() {
assertEquals("J G Stewart Contractors Inc", customers.get(3206).getCompany());
}
@Test
@DisplayName("Record 3207: Address is 66 High St")
void AddressOfRecord3207() {
assertEquals("66 High St", customers.get(3206).getAddress());
}
@Test
@DisplayName("Record 3207: City is Mount Holly")
void CityOfRecord3207() {
assertEquals("Mount Holly", customers.get(3206).getCity());
}
@Test
@DisplayName("Record 3207: County is Burlington")
void CountyOfRecord3207() {
assertEquals("Burlington", customers.get(3206).getCounty());
}
@Test
@DisplayName("Record 3207: State is NJ")
void StateOfRecord3207() {
assertEquals("NJ", customers.get(3206).getState());
}
@Test
@DisplayName("Record 3207: ZIP is 8060")
void ZIPOfRecord3207() {
assertEquals("8060", customers.get(3206).getZIP());
}
@Test
@DisplayName("Record 3207: Phone is 609-267-6167")
void PhoneOfRecord3207() {
assertEquals("609-267-6167", customers.get(3206).getPhone());
}
@Test
@DisplayName("Record 3207: Fax is 609-267-0628")
void FaxOfRecord3207() {
assertEquals("609-267-0628", customers.get(3206).getFax());
}
@Test
@DisplayName("Record 3207: Email is dydre@rastegar.com")
void EmailOfRecord3207() {
assertEquals("dydre@rastegar.com", customers.get(3206).getEmail());
}
@Test
@DisplayName("Record 3207: Web is http://www.dydrerastegar.com")
void WebOfRecord3207() {
assertEquals("http://www.dydrerastegar.com", customers.get(3206).getWeb());
}
}
| true |
fb68ab6b754564ee94cafc81f72251709463861a | Java | Thegixe/Evaluacion3 | /Evaluacion3JavaMedico/src/java/modelos/Atencion.java | UTF-8 | 3,853 | 2.53125 | 3 | [] | no_license | /*
* 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 modelos;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
/**
*
* @author TheGixe
*/
public class Atencion {
private String idAtencion;
private Paciente paciente;
private Medico medico;
private String fecha;
private String hora;
private String diagnostico;
private String receta;
private Conexion conexion;
public Atencion() throws ClassNotFoundException, SQLException {
conexion = new Conexion();
paciente = new Paciente();
medico = new Medico();
}
public Atencion(String idAtencion, Paciente paciente, Medico medico, String fecha, String hora, String diagnostico, String receta) throws ClassNotFoundException, SQLException {
this.idAtencion = idAtencion;
this.paciente = paciente;
this.medico = medico;
this.fecha = fecha;
this.hora = hora;
this.diagnostico = diagnostico;
this.receta = receta;
conexion = new Conexion();
}
public String getIdAtencion() {
return idAtencion;
}
public void setIdAtencion(String idAtencion) {
this.idAtencion = idAtencion;
}
public Paciente getPaciente() {
return paciente;
}
public void setPaciente(Paciente paciente) {
this.paciente = paciente;
}
public Medico getMedico() {
return medico;
}
public void setMedico(Medico medico) {
this.medico = medico;
}
public String getFecha() {
return fecha;
}
public void setFecha(String fecha) {
this.fecha = fecha;
}
public String getHora() {
return hora;
}
public void setHora(String hora) {
this.hora = hora;
}
public String getDiagnostico() {
return diagnostico;
}
public void setDiagnostico(String diagnostico) {
this.diagnostico = diagnostico;
}
public String getReceta() {
return receta;
}
public void setReceta(String receta) {
this.receta = receta;
}
public String registrar() throws SQLException{
if(validarAtencion()){
return "Id ya existe";
}else{
String sentencia = "insert into atencion values('"+idAtencion+"','"+paciente.getUsuario()+"','"+medico.getUsuario()+"','"+fecha+"','"+hora+"','"+diagnostico+"','"+receta+"')";
if(conexion.ejecutarSQL(sentencia)==1){
return "Atencion registrada";
}else{
return "No se pudo registrar la atencion";
}
}
}
public boolean validarAtencion() throws SQLException{
String sentencia = "select * from atencion where idAtencion='"+idAtencion+"'";
ResultSet rs = conexion.consultarSQL(sentencia);
return rs.next();
}
public ArrayList<Atencion> obtenerAtencionesXIdMedico(String idMedico) throws SQLException, ClassNotFoundException{
String sentencia = "select * from atencion where idMedico='"+idMedico+"'";
ArrayList<Atencion> atenciones = new ArrayList();
ResultSet rs = conexion.consultarSQL(sentencia);
while(rs.next()){
atenciones.add(new Atencion(rs.getString("idAtencion"),paciente.obtenerPaciente(rs.getString("idPaciente")),medico.obtenerMedico(rs.getString("idMedico")),rs.getString("fecha"),
rs.getString("hora"),rs.getString("diagnostico"),rs.getString("receta")));
}
return atenciones;
}
}
| true |
a4068120a14c7137910303063307d0578e708767 | Java | amercier/selenese-maven-plugin | /src/main/java/com/github/amercier/selenium/selenese/document/TestCaseDocument.java | UTF-8 | 3,124 | 2.59375 | 3 | [] | no_license | package com.github.amercier.selenium.selenese.document;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.github.amercier.selenium.exceptions.InvalidSeleneseCommandException;
import com.github.amercier.selenium.exceptions.UnknownSeleneseCommandException;
import com.github.amercier.selenium.selenese.Action;
import com.github.amercier.selenium.selenese.SeleneseCommand;
import com.github.amercier.selenium.selenese.SeleneseTestCase;
import com.github.amercier.selenium.selenese.log.DefaultLog;
import com.github.amercier.selenium.selenese.log.Log;
public class TestCaseDocument extends AbstractTestDocument {
/**
* Create a Test Case document
*
* @param sourceFile The XML test suite file
* @param log The log
* @throws SAXException
* @throws IOException
*/
public TestCaseDocument(File sourceFile, Log log) throws SAXException, IOException {
super(sourceFile, log);
}
/**
* Create a Test Case document, with a default Selenese Log
*
* @param sourceFile The XML test suite file
* @throws SAXException
* @throws IOException
*/
public TestCaseDocument(File sourceFile) throws SAXException, IOException {
this(sourceFile, new DefaultLog());
}
/**
* Get the test case from the document
*
* @return Returns the test case
* @throws InvalidSeleneseCommandException
* @throws DOMException
* @throws UnknownSeleneseCommandException
* @throws InvalidSeleneseCommandNameException
* @throws SAXException
* @throws IOException
*/
public SeleneseTestCase getTestCase() throws DOMException, UnknownSeleneseCommandException, InvalidSeleneseCommandException {
NodeList tableRows = document.getElementsByTagName("tr");
// Create the test case object
SeleneseTestCase test = new SeleneseTestCase(sourceFile.getName().replaceAll("\\.html$", ""));
// Add the commands
getLog().debug("Found " + (tableRows.getLength() - 1) + " commands");
for (int i = 1; i < tableRows.getLength(); i++) {
Element tableRow = (Element) tableRows.item(i);
NodeList rowCells = tableRow.getElementsByTagName("td");
String actionName = rowCells.item(0).getTextContent();
// Arguments
List<String> arguments = new LinkedList<String>();
for (int j = 1; j < rowCells.getLength(); j++) {
if(!rowCells.item(j).getTextContent().trim().equals("")) {
arguments.add(rowCells.item(j).getTextContent());
}
}
// Create the command
Action action = null;
try {
action = Action.valueOf(actionName);
}
catch(IllegalArgumentException e) {
throw new UnknownSeleneseCommandException(actionName);
}
SeleneseCommand command = new SeleneseCommand(action, arguments.toArray(new String[0]));
getLog().debug("Found " + command);
// Add the command to the test case
test.addCommand(command);
}
return test;
}
}
| true |
b9c34b74b4d56f2d9523b899240773d8bad1fbdd | Java | zohrearani/Text-processing | /semantic /src/main/java/ir/mitrc/corpus/api/Term.java | UTF-8 | 409 | 2.5625 | 3 | [] | no_license | package ir.mitrc.corpus.api;
public class Term {
String lemma="";
String pos="";
int frequency=0;
public Term(String lemma,String pos,int frequency){
this.lemma=lemma;
this.pos=pos;
this.frequency=frequency;
}
public String getLemma(){
return this.lemma;
}
public String getPos(){
return this.pos;
}
public int getFrequency(){
return this.frequency;
}
}
| true |
aeb3a5bd17c0c2279d86b6f586413232509ef077 | Java | ezio341/Java-Socket | /src/practicum/PortScanner.java | UTF-8 | 1,869 | 2.953125 | 3 | [] | no_license | /*
* 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 practicum;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Arga
*/
public class PortScanner {
public static void main(String[] args) throws InterruptedException, ExecutionException {
//host
String ip = "localhost";
//time out ben gak buang waktu
int timeout = 1;
ExecutorService ex = Executors.newFixedThreadPool(10);
List<Integer> list = new ArrayList<>();
for(int i = 1; i <= 65535 ; i++){
final int port = i;
ex.submit(new Runnable() {
@Override
public void run() {
Socket socket = new Socket();
try {
socket.connect(new InetSocketAddress(ip, port), timeout);
if(socket.isConnected()){
list.add(port);
System.out.println(port);
}
socket.close();
} catch (IOException ex1) {
}
}
}).get();
}
ex.shutdown();
System.out.println("Scan port on host : "+ip);
System.out.println("total port : "+list.size());
System.out.println("port list : ");
for(int i : list){
System.out.println(i);
}
}
}
| true |
ae386567f7dfe4ac2db24014bc44ce0238dc0939 | Java | PrathyushaLakshmi10/Dxc_hyd_2020 | /Dxc first/src/com/dxc/studentfee/Admin.java | UTF-8 | 1,843 | 2.71875 | 3 | [] | no_license | package com.dxc.studentfee;
import java.io.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement ;
public class Admin
{
public void addaccountant(BufferedReader ObjBufferedReader,Connection connection)
{
try
{
System.out.println("Enter the details of the accountant");
System.out.println("Enter the id num of the accountant:");
int id=Integer.parseInt(ObjBufferedReader.readLine());
System.out.println("Enter the name of the accountant");
String name=ObjBufferedReader.readLine();
System.out.println("Enter the password of the accountant");
String password=ObjBufferedReader.readLine();
System.out.println("Enter the email of the accountant");
String email=ObjBufferedReader.readLine();
System.out.println("Enter the phone number of the accountant");
String phone=ObjBufferedReader.readLine();
PreparedStatement stmtInsert =connection.prepareStatement("insert into accountant values(?,?,?,?,?)");
stmtInsert.setInt(1,id);
stmtInsert.setString(2,name);
stmtInsert.setString(3,password);
stmtInsert.setString(4,email);
stmtInsert.setString(5,phone);
System.out.println(stmtInsert.executeUpdate()+"records inserted");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void viewaccountant(BufferedReader ObjBufferedReader,Connection connection)
{
try
{
Statement Objstmt =connection.createStatement();
ResultSet Objrs = Objstmt.executeQuery("select * from accountant");
while (Objrs.next())
System.out.println(Objrs.getInt(1) + ", " + Objrs.getString(2) + ", " + Objrs.getString(3) + ", " + Objrs.getString(4)
+ ", " + Objrs.getString(5));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
| true |
b4c22be819199c22b84a104b02f7a0d30b9fab07 | Java | pydawan/marmitas | /src/main/java/br/com/saborgoiano/marmitas/controller/AutenticacaoController.java | UTF-8 | 719 | 1.929688 | 2 | [
"Apache-2.0"
] | permissive | package br.com.saborgoiano.marmitas.controller;
import javax.inject.Inject;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
/**
* @author thiago-amm
* @version v1.0.0 22/08/2018
* @since v1.0.0
*/
@Controller
public class AutenticacaoController {
@Inject
Result result;
@Get("/login")
public void form() {
}
@Post("/logout")
@Get("/logout")
public void logout() {
Subject subject = SecurityUtils.getSubject();
subject.logout();
result.redirectTo(this).form();
}
}
| true |
2a4e5cba5de2d6cfc67fb2601042549972a92103 | Java | paragmahajan29/Book-Shop-simulation | /src/Movie.java | UTF-8 | 3,078 | 3.5625 | 4 | [] | no_license |
/**
* Movie class defines each movies information.
*
* @author Parag Mahajan
* @version 1.1 14 Sept 2014
*/
public class Movie extends Media
{
// instance variables
private String director;
private String producer;
private String fileType;
//constructer of movie
public Movie(String title, String director, String producer, String fileType, int available, double price)
{
// initialise instance variables
super(title, available, price);
this.director = director;
this.producer = producer;
this.fileType = fileType;
}
/**
* This method returns title of movie.
*
* @param nothing
* @return nothing
*/
public String getTitle()
{
return title;
}
/**
* This method returns director of movie.
*
* @param nothing
* @return nothing
*/
public String getDirector()
{
return director;
}
/**
* This method returns price of movie.
*
* @param nothing
* @return nothing
*/
public double getPrice()
{
return price;
}
/**
* This method returns number of available movie.
*
* @param nothing
* @return nothing
*/
public int getAvailable()
{
return available;
}
/**
* This method returns filetype of movie.
*
* @param nothing
* @return nothing
*/
public String getFileType()
{
return fileType;
}
/**
* This method returns producer of movie.
*
* @param nothing
* @return nothing
*/
public String getProducer()
{
return producer;
}
/**
* This method returns number of sold copies movie.
*
* @param nothing
* @return nothing
*/
public int getSold()
{
return sold;
}
/**
* This method sales movies and saves data and returns true if it is successful
* otherwise returns false
*
* @param int
* @return boolean
*/
public boolean sellCopies(int noOfCopies)
{
boolean sold = false;
if(noOfCopies <= available)
{
available -= noOfCopies;
this.sold += noOfCopies;
double totalAmount = 0.0;
sold = true;
return sold;
}else{
return sold;
}
}
/**
* This method updates rating of movies
*
* @param nothing
* @return nothing
*/
public void updateRating(int newRating)
{
r.updateRating(newRating);
}
/**
* This method returns information about movie.
*
* @param nothing
* @return nothing
*/
public String toString()
{
return "'"+ title+"' Director: " + director+ ", Producer: " + producer + ", Price: "+ price + ", Available: " +available+ ", Sold: "+ sold + " Rating: "+r.getAvarageRating();
}
}
| true |
cf02978f8f3e33c54f286046fc01618e30ba1d5c | Java | developer-os/whh | /src/main/java/com/whh/patterns/observer/Subject.java | UTF-8 | 229 | 2.53125 | 3 | [] | no_license | package com.whh.patterns.observer;
/**
*
* @desc:
*/
public interface Subject {
public void registerObserver(Observer observer) ;
public void removeObserver(Observer observer) ;
public void notifyObserver();
}
| true |
7688de41e4580c8af7766f374b77edd04dc72a1b | Java | pescuma/swt-paperclips | /net.sf.paperclips.tests/src/net/sf/paperclips/SimplePageDecorationTest.java | UTF-8 | 730 | 2.03125 | 2 | [] | no_license | /*
* Copyright (c) 2007 Matthew Hall and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Matthew Hall - initial API and implementation
*/
package net.sf.paperclips;
import junit.framework.TestCase;
public class SimplePageDecorationTest extends TestCase {
public void testEquals() {
Object obj = new SimplePageDecoration(new PrintStub(0));
assertEquals(obj, new SimplePageDecoration(new PrintStub(0)));
assertFalse(obj.equals(new SimplePageDecoration(new PrintStub(1))));
}
}
| true |
ba6976b2638c7c8bdf4ce0aaaedd0a233544a837 | Java | vrakoto/Android-medecin | /app/src/main/java/com/example/sio/android_medecin/MedAdapter.java | UTF-8 | 1,298 | 2.4375 | 2 | [] | no_license | package com.example.sio.android_medecin;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import modele.Med;
public class MedAdapter extends BaseAdapter {
private List<Med> lesMeds;
private Context c;
MedAdapter(List data, Context c) {
lesMeds = data;
this.c = c;
}
public int getCount() {
return lesMeds.size();
}
public Object getItem(int i) {
return lesMeds.get(i);
}
public long getItemId(int i) {
return i;
}
public View getView(int i, View v, ViewGroup vg) {
//création de la vue en analysant le xml lignemed
LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.lignemed, null);
TextView nom = (TextView) v.findViewById(R.id.nom);
TextView prenom = (TextView) v.findViewById(R.id.prenom);
TextView tel = (TextView) v.findViewById(R.id.tel);
Med leMed = lesMeds.get(i);
nom.setText(leMed.getNom());
prenom.setText(leMed.getPrenom());
tel.setText(leMed.getTel());
return v;
}
}
| true |
2be7fa7b62ff7da6e3b9e6db11133dfd0c26b55d | Java | voghoei/DawgTrades | /src/java/edu/uga/dawgtrades/persistence/impl/MembershipIterator.java | UTF-8 | 2,214 | 2.75 | 3 | [] | no_license | package edu.uga.dawgtrades.persistence.impl;
import java.sql.ResultSet;
import java.util.Date;
import java.util.Iterator;
import java.util.NoSuchElementException;
import edu.uga.dawgtrades.DTException;
import edu.uga.dawgtrades.model.Membership;
import edu.uga.dawgtrades.model.ObjectModel;
public class MembershipIterator implements Iterator<Membership> {
private ResultSet rs = null;
private ObjectModel objectModel = null;
private boolean more = false;
public MembershipIterator(ResultSet rs, ObjectModel objectModel)
throws DTException {
this.rs = rs;
this.objectModel = objectModel;
try {
more = rs.next();
} catch (Exception e) { // just in case...
throw new DTException("MembershipIterator: Cannot create Membership iterator; root cause: " + e);
}
}
public boolean hasNext() {
return more;
}
public Membership next() {
long id;
Date date;
double price;
Membership membership = null;
if (more) {
try {
id = rs.getLong(1);
price = rs.getDouble(2);
java.sql.Timestamp timestamp = rs.getTimestamp(3);
if(timestamp == null) {
throw new DTException("AuctionIterator: Failed to retrieve expiration from DB.");
}
date = new java.util.Date(timestamp.getTime());
more = rs.next();
} catch (Exception e) { // just in case...
throw new NoSuchElementException("MembershipIterator: No next Membership object; root cause: " + e);
}
try {
membership = objectModel.createMembership(price, date);
membership.setId(id);
} catch (Exception ce) {
// safe to ignore: we explicitly set the persistent id of the founder Person object above!
}
return membership;
} else {
throw new NoSuchElementException("PersonIterator: No next Membership object");
}
}
public void remove() {
throw new UnsupportedOperationException();
}
};
| true |
0ef83774fa9595d9bdb4b48423ee8534940bb7d5 | Java | zhangxiaoxu132113/hadoop-mapreduce | /src/main/java/com/water/hadoop/mapreduce/demo02_wordCount_hbase/MyMapper.java | UTF-8 | 1,168 | 2.578125 | 3 | [] | no_license | package com.water.hadoop.mapreduce.demo02_wordCount_hbase;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
import java.util.StringTokenizer;
/**
* Created by zhangmiaojie on 2017/3/14.
*/
public class MyMapper extends TableMapper<Text, IntWritable> {
private static IntWritable one = new IntWritable(1);
private static Text word = new Text();
@Override
protected void map(ImmutableBytesWritable key, Result value, Mapper.Context context) throws IOException, InterruptedException {
//表里面只有一个列族,所以我就直接获取每一行的值
String words = Bytes.toString(value.list().get(0).getValue());
StringTokenizer st = new StringTokenizer(words);
while (st.hasMoreTokens()) {
String s = st.nextToken();
word.set(s);
context.write(word, one);
}
}
}
| true |
73fa7114fdf8276e3d94ee62e634f4a2f0d308b7 | Java | Hopding/MERP | /rpi-code/src/main/java/com/hopding/merp/rpi/ClientConnection.java | UTF-8 | 4,278 | 3.390625 | 3 | [
"MIT"
] | permissive | package com.hopding.merp.rpi;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
/**
* Represents the current Client connection. Information can be received from the client
* using this Class.
* <p>
* This class implements the singleton design pattern. To obtain an instance,
* you must call {@link #getClientConnection()}.
* <p>
* To establish a connection with the client, you must call {@link #waitForClientConnect()}.
* <p>
* In order to respond to input as it is received, it is necessary to specify an {@link InputHandler}
* using the {@link #setInputHandler(InputHandler)} method.
*/
public class ClientConnection {
//////////////////////////////////// Singleton Design Pattern Setup: ///////////////////////////////////////////////////
/**
* Singleton instance
*/
private static ClientConnection singleton;
/**
* Private constructor to enforce Singleton Design Pattern.
*/
private ClientConnection() {}
/**
* Returns the singleton instance of {@code ClientConnection}.
* @return the static instance of {@code ClientConnection}.
*/
public static ClientConnection getClientConnection() {
if(singleton == null)
singleton = new ClientConnection();
return singleton;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private InputHandler inputHandler;
private Thread onInputThread;
private boolean connected;
private ServerSocket serverSocket;
private Socket clientSocket;
/**
* Blocks until a client has connected, or throws an IOException if the wait times out.
* <p>
* If a client does connect, then a thread is launched whose job it is to listen for input from the client. Whenever
* a line of input is received, the {@link InputHandler#onInputLine(String)} method of the {@link InputHandler}
* (specified by {@link #setInputHandler(InputHandler)}) will be called, and given the line of input.
*
* @throws IOException thrown if a timeout occurs before a client connects.
*/
public void waitForClientConnect() throws IOException {
serverSocket = new ServerSocket(12345);
clientSocket = serverSocket.accept();
PrintWriter outStream = new PrintWriter(clientSocket.getOutputStream());
BufferedReader inStream = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
connected = true;
onInputThread = new Thread(
() -> {
String input;
while (connected) {
try {
if (inputHandler != null && (input = inStream.readLine()) != null) {
System.out.println("Received input: " + input);
inputHandler.onInputLine(input);
}
Thread.sleep(50);
} catch(IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
);
onInputThread.setName("onInputThread");
onInputThread.start();
}
/**
* Sets the {@link InputHandler} to be used when input is received.
*
* @param inputHandler the {@link InputHandler} to be used when input is received.
*/
public void setInputHandler(InputHandler inputHandler) {
this.inputHandler = inputHandler;
}
/**
* Disconnects from the client.
*/
public void disconnect() {
connected = false;
try {
clientSocket.close();
serverSocket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Returns a boolean indicating whether or not we are currently connected to a client.
*
* @return true if connected, false if not
*/
public boolean isConnectedToClient() {
return connected;
}
}
| true |
d02335c24b886fd3c4b5ad3e64a50eb076f25e12 | Java | rmetzger/flink | /flink-python/src/main/java/org/apache/flink/table/runtime/arrow/readers/ArrowFieldReader.java | UTF-8 | 1,684 | 2.265625 | 2 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"OFL-1.1",
"MIT",
"BSD-3-Clause",
"ISC"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.table.runtime.arrow.readers;
import org.apache.flink.annotation.Internal;
import org.apache.flink.util.Preconditions;
import org.apache.arrow.vector.ValueVector;
/**
* Base class for arrow field reader.
*
* @param <OUT> Type of the row to write.
*/
@Internal
public abstract class ArrowFieldReader<OUT> {
/** Container which is used to store the sequence of values of a column to read. */
private final ValueVector valueVector;
public ArrowFieldReader(ValueVector valueVector) {
this.valueVector = Preconditions.checkNotNull(valueVector);
}
/** Returns the underlying container which stores the sequence of values of a column to read. */
public ValueVector getValueVector() {
return valueVector;
}
/** Sets the field value as the specified value. */
public abstract OUT read(int index);
}
| true |
75d1c915e521bed9e5ba4985e5e1683125df637b | Java | i3mainz/spring-netatmo | /social/src/main/java/org/springframework/social/netatmo/api/PublicWeatherParameter.java | UTF-8 | 1,561 | 2.265625 | 2 | [] | no_license | /**
*
*/
package org.springframework.social.netatmo.api;
import java.util.List;
/**
* @author Nikolai Bock
*
*/
public class PublicWeatherParameter {
private double latSW;
private double lonSW;
private double latNE;
private double lonNE;
private List<String> requiredData;
private Boolean filter;
public PublicWeatherParameter(double lonSW, double latSW, double lonNE,
double latNE) {
this.latSW = latSW;
this.lonSW = lonSW;
this.latNE = latNE;
this.lonNE = lonNE;
}
/**
* @param requiredData
* @return
*/
public PublicWeatherParameter requiredData(List<String> requiredData) {
this.requiredData = requiredData;
return this;
}
/**
* @param filter
* @return
*/
public PublicWeatherParameter filter(Boolean filter) {
this.filter = filter;
return this;
}
/**
* @return the latSW
*/
public double getLatSW() {
return latSW;
}
/**
* @return the lonSW
*/
public double getLonSW() {
return lonSW;
}
/**
* @return the latNE
*/
public double getLatNE() {
return latNE;
}
/**
* @return the lonNE
*/
public double getLonNE() {
return lonNE;
}
/**
* @return the required_data
*/
public List<String> getRequiredData() {
return requiredData;
}
/**
* @return the filter
*/
public Boolean getFilter() {
return filter;
}
}
| true |
9c600781481a8759c72c4e93bb48def0e337a970 | Java | iantal/AndroidPermissions | /apks/apks_from_phone/data_app_com_monefy_app_lite-2/source/a/a/a/g.java | UTF-8 | 104 | 1.734375 | 2 | [
"Apache-2.0"
] | permissive | package a.a.a;
public abstract interface g<T, TResult>
{
public abstract TResult select(T paramT);
}
| true |
dfaa424a0f90ce6526e12a6012d2deac0f4231c9 | Java | happyjianguo/pay-1 | /Common/FO/fo-jar/fo-intra-web/src/main/java/com/pay/fo/controller/channel/mode/FoModeController.java | UTF-8 | 4,640 | 2.140625 | 2 | [] | no_license | /**
* File: FoModeController.java
* Description:
* Copyright 2010 -2010 pay Corporation. All rights reserved.
* 2010-10-28 Sunsea.Li Changes
*
*/
package com.pay.fo.controller.channel.mode;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import com.pay.fo.controller.channel.AbstractChannelController;
import com.pay.fundout.channel.dto.mode.FundoutModeDTO;
import com.pay.fundout.channel.service.mode.FoModeService;
import com.pay.inf.comm.PageUtils;
import com.pay.inf.dao.Page;
import com.pay.poss.security.util.SessionUserHolderUtil;
/**出款方式管理控制器
* @author Sunsea.Li
*
*/
public class FoModeController extends AbstractChannelController {
private FoModeService foModeService;
public void setFoModeService(FoModeService foModeService) {
this.foModeService = foModeService;
}
/**
* 新增出款方式初始化页面
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView index(HttpServletRequest request , HttpServletResponse response) throws ServletException{
String viewName = urlMap.get("addFoMode");
return new ModelAndView(viewName).addObject("statusList", super.channelStatus);
}
/**
* 新增出款方式动作
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView addFoMode(HttpServletRequest request , HttpServletResponse response) throws ServletException{
String viewName = urlMap.get("addFoMode");
FundoutModeDTO dto = new FundoutModeDTO();
bind(request, dto, "dto", null);
if(log.isDebugEnabled()){
log.debug("dto:"+dto);
}
dto.setOperator(SessionUserHolderUtil.getLoginId());
try{
Map<String,Object> model = foModeService.createFoMode(dto);
model.put("info", "添加成功,对应的出款方式名称是:【"+dto.getCode()+"="+dto.getName()+"】");
model.put("statusList", super.channelStatus);
return new ModelAndView(viewName,model);
}catch (Exception e) {
log.error(e.getMessage(), e);
return new ModelAndView(viewName).addObject("info","添加失败,对应的出款方式已存在是:"+dto.getName()).addObject("statusList", super.channelStatus);
}
}
/**
* 出款方式查询初始化页面
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView initSearch(HttpServletRequest request , HttpServletResponse response) throws ServletException{
String viewName = urlMap.get("searchModeInit");
return new ModelAndView(viewName).addObject("statusList", super.channelStatus);
}
/**
* 出款方式分页列表
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView search(HttpServletRequest request , HttpServletResponse response) throws ServletException{
String viewName = urlMap.get("searchModeList");
FundoutModeDTO dto = new FundoutModeDTO();
bind(request, dto, "dto", null);
Page<FundoutModeDTO> page = PageUtils.getPage(request);
Map<String,Object> model = foModeService.queryFoModeInfo(page, dto);
model.put("statusList", super.channelStatus);
return new ModelAndView(viewName,model);
}
/**
* init修改出款方式信息
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView initModify(HttpServletRequest request , HttpServletResponse response) throws ServletException{
ModelAndView modelAndView = new ModelAndView();
FundoutModeDTO fundoutBusinessDTO = foModeService.queryFoModeInfoById(Long.valueOf(request.getParameter("modeId")));
modelAndView.addObject("statusList", super.channelStatus);
modelAndView.addObject("dto", fundoutBusinessDTO);
modelAndView.setViewName(urlMap.get("modify"));
return modelAndView;
}
/**
* execute修改出款方式信息
* @param request
* @param response
* @return
* @throws ServletException
*/
public ModelAndView modifyFundoutModeInfo(HttpServletRequest request , HttpServletResponse response) throws ServletException{
FundoutModeDTO dto = new FundoutModeDTO();
bind(request, dto, "", null);
if(log.isInfoEnabled()){
log.info("dto :"+dto);
}
dto.setOperator(SessionUserHolderUtil.getLoginId());
foModeService.updateFoModeInfo(dto);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("statusList", super.channelStatus);
modelAndView.addObject("dto", dto);
modelAndView.setViewName(urlMap.get("searchModeInit"));
return modelAndView;
}
}
| true |
cef647ba74a809649f53b411d1e7c3bbd0174885 | Java | hayworks/currency-exchange-app | /src/test/java/com/searchmetrics/currencyexchange/controller/CurrencyRatesControllerTest.java | UTF-8 | 2,590 | 2.328125 | 2 | [] | no_license | package com.searchmetrics.currencyexchange.controller;
import com.searchmetrics.currencyexchange.exception.DateValidationException;
import com.searchmetrics.currencyexchange.facade.CurrencyRateFacade;
import com.searchmetrics.currencyexchange.model.CurrencyRate;
import com.searchmetrics.currencyexchange.model.dto.CurrencyRateHistoryRequest;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
@RunWith(MockitoJUnitRunner.class)
public class CurrencyRatesControllerTest {
@InjectMocks
private CurrencyRatesController currencyRatesController;
@Mock
private CurrencyRateFacade currencyRateFacade;
@Test
public void should_get_current_rate_successfully() {
//given
when(currencyRateFacade.getCurrentRate()).thenReturn(new CurrencyRate(new BigDecimal(1.1)));
//when
CurrencyRate currencyRate = currencyRatesController.getCurrentCurrencyRate();
//then
verify(currencyRateFacade).getCurrentRate();
assertNotNull(currencyRate);
assertEquals(new BigDecimal(1.1), currencyRate.getRate());
}
@Test
public void should_get_currency_history_successfully() {
//given
List<CurrencyRate> currencyRateHistoryList = new ArrayList<CurrencyRate>(){{
add(new CurrencyRate(new BigDecimal(1.2)));
}};
when(currencyRateFacade.getCurrencyRateHistory(any(Date.class), any(Date.class))).thenReturn(currencyRateHistoryList);
//when
currencyRateHistoryList = currencyRatesController.getCurrencyRateHistory(new CurrencyRateHistoryRequest(new Date(System.currentTimeMillis()-100000), new Date()));
//then
verify(currencyRateFacade).getCurrencyRateHistory(any(Date.class), any(Date.class));
assertNotNull(currencyRateHistoryList);
assertEquals(currencyRateHistoryList.size(), 1);
}
@Test(expected = DateValidationException.class)
public void should_throw_exception_on_getting_currency_log_history_when_start_date_is_later_then_end_date() {
//given
CurrencyRateHistoryRequest currencyRateHistoryRequest = new CurrencyRateHistoryRequest(new Date(System.currentTimeMillis()+100000), new Date());
//when
currencyRatesController.getCurrencyRateHistory(currencyRateHistoryRequest);
}
}
| true |
75fd4298aa665ed9922a736be733c8d4994fd1f7 | Java | namtruong244/shop-management | /src/main/java/com/shopmanagement/entity/BaseEntity.java | UTF-8 | 319 | 1.875 | 2 | [] | no_license | package com.shopmanagement.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public abstract class BaseEntity implements Serializable {
protected String id;
protected int deleteFlg = 0;
protected Date createAt = new Date();
protected Date updateAt = new Date();
}
| true |
74816f92815560ae77e385cd94de600b6aed2af7 | Java | motthoangnhove/Branch | /adcsaleagrotech2020/ADCSaleAgrotechFinal/app/src/main/java/com/adcvn/adcsaleagrotech/common/ToJsonString.java | UTF-8 | 1,683 | 2.5625 | 3 | [] | no_license | package com.adcvn.adcsaleagrotech.common;
import java.lang.reflect.Method;
import java.math.BigDecimal;
public class ToJsonString {
// list order to string json
public static String getJSONList(java.util.List<Object> list, String classObject, String segNum, String productCode, String quantity, String unitPrice, String unitPriceAfterTax, String vatRate) {
try {
Object[] args={};
Class cl = Class.forName(classObject);
Method getSegNum = cl.getMethod(segNum,null);
Method getProductCode = cl.getMethod(productCode, null);
Method getQuantity = cl.getMethod(quantity, null);
Method getUnitPrice = cl.getMethod(unitPrice,null);
Method getUnitPriceAfterTax = cl.getMethod(unitPriceAfterTax, null);
Method getVATRate = cl.getMethod(vatRate, null);
String json="[";
for (int i = 0; i < list.size(); i++) {
Object o = list.get(i);
if(i>0){
json+=",";
}
json+="{\"SeqNum\":\""+getSegNum.invoke(o,args)+"\",\"ProductCode\":\""+getProductCode.invoke(o,args)+"\",\"Quantity\":\""+getQuantity.invoke(o,args)+"\",\"UnitPrice\":\""+getUnitPrice.invoke(o,args)+"\",\"UnitPriceAfterTax\":\""+new BigDecimal(String.valueOf(getUnitPriceAfterTax.invoke(o,args))).toBigInteger()+"\",\"VATRate\":\""+getVATRate.invoke(o,args)+"\"}";
}
json+="]";
return json;
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
return "[]";
}
}
| true |
391777588473d7d00155153809e4abb983864fac | Java | FRCTeam4069/FTC2020 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/tutorials/BasicTankDrive.java | UTF-8 | 1,554 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | package org.firstinspires.ftc.teamcode.tutorials;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
@Disabled
@TeleOp
public class BasicTankDrive extends OpMode {
DcMotor leftMotor;
DcMotor rightMotor;
@Override
public void init() {
// int wholeNum = 123; // 654, 1, 0, -87541
// double pi = 3.1415926;
// boolean isRoboticsGreat = true;
String initMessage = "Initialized";
telemetry.addData("Status", initMessage); // Status: Initialized
leftMotor = hardwareMap.get(DcMotor.class, "leftMotor");
rightMotor = hardwareMap.get(DcMotor.class, "rightMotor");
leftMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
rightMotor.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
leftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
}
@Override
public void loop() {
double leftPower = -gamepad1.left_stick_y;
double rightPower = -gamepad1.right_stick_y;
double avgPower = (leftPower + rightPower) / 2;
boolean isFast = avgPower > 0.75;
if(isFast) {
telemetry.addData("Speed of Robot", avgPower);
}
else {
telemetry.addData("Robot is fast?", false);
}
leftMotor.setPower(leftPower);
rightMotor.setPower(rightPower);
}
}
| true |
0f31733fc1ecc5fa36db879db600439fb7359329 | Java | elaghs/jkind | /jkind/src/jkind/engines/pdr/Lustre2Term.java | UTF-8 | 7,509 | 2.140625 | 2 | [
"BSD-3-Clause"
] | permissive | package jkind.engines.pdr;
import java.util.ArrayList;
import java.util.List;
import de.uni_freiburg.informatik.ultimate.logic.Script;
import de.uni_freiburg.informatik.ultimate.logic.Term;
import jkind.lustre.ArrayAccessExpr;
import jkind.lustre.ArrayExpr;
import jkind.lustre.ArrayUpdateExpr;
import jkind.lustre.BinaryExpr;
import jkind.lustre.BoolExpr;
import jkind.lustre.CastExpr;
import jkind.lustre.CondactExpr;
import jkind.lustre.EnumType;
import jkind.lustre.Equation;
import jkind.lustre.Expr;
import jkind.lustre.FunctionCallExpr;
import jkind.lustre.IdExpr;
import jkind.lustre.IfThenElseExpr;
import jkind.lustre.IntExpr;
import jkind.lustre.NamedType;
import jkind.lustre.Node;
import jkind.lustre.NodeCallExpr;
import jkind.lustre.RealExpr;
import jkind.lustre.RecordAccessExpr;
import jkind.lustre.RecordExpr;
import jkind.lustre.RecordUpdateExpr;
import jkind.lustre.SubrangeIntType;
import jkind.lustre.TupleExpr;
import jkind.lustre.Type;
import jkind.lustre.UnaryExpr;
import jkind.lustre.VarDecl;
import jkind.lustre.visitors.ExprVisitor;
import jkind.solvers.smtinterpol.ScriptUser;
import jkind.util.SexpUtil;
import jkind.util.Util;
public class Lustre2Term extends ScriptUser implements ExprVisitor<Term> {
public static final String INIT = "%init";
public static final String ASSERTIONS = "%assertions";
private final Node node;
private boolean pre = false;
public Lustre2Term(Script script, Node node) {
super(script);
this.node = node;
}
public Term getInit() {
return term(INIT);
}
public Term getAssertions() {
return term(ASSERTIONS);
}
public List<VarDecl> getVariables() {
List<VarDecl> variables = new ArrayList<>();
for (VarDecl vd : Util.getVarDecls(node)) {
variables.add(encode(vd));
}
variables.add(new VarDecl(INIT, NamedType.BOOL));
variables.add(new VarDecl(ASSERTIONS, NamedType.BOOL));
return variables;
}
public static String encode(String name) {
return "$" + name;
}
private VarDecl encode(VarDecl vd) {
return new VarDecl(encode(vd.id), vd.type);
}
public static String decode(String encoded) {
if (encoded.startsWith("$")) {
return encoded.substring(1);
} else {
throw new IllegalArgumentException("Not an encoded name: " + encoded);
}
}
public Term getTransition() {
List<Term> conjuncts = new ArrayList<>();
for (Equation eq : node.equations) {
Term body = eq.expr.accept(this);
Term head = eq.lhs.get(0).accept(this);
conjuncts.add(term("=", head, body));
}
List<Term> assertions = new ArrayList<>();
for (Expr assertion : node.assertions) {
assertions.add(assertion.accept(this));
}
assertions.add(or(term(INIT), term(ASSERTIONS)));
conjuncts.add(term("=", term(prime(ASSERTIONS)), and(assertions)));
// Type constraints need to be included during interpolation, so we
// include them in the transition relation
for (VarDecl vd : Util.getVarDecls(node)) {
Term baseConstraint = typeConstraint(encode(vd.id), vd.type);
if (baseConstraint != null) {
conjuncts.add(baseConstraint);
}
Term primeConstraint = typeConstraint(encode(prime(vd.id)), vd.type);
if (primeConstraint != null) {
conjuncts.add(primeConstraint);
}
}
conjuncts.add(not(term(prime(INIT))));
return and(conjuncts);
}
public Term encodeProperty(String property) {
return or(term(encode(property)), not(term(ASSERTIONS)), term(INIT));
}
private String prime(String str) {
return str + "'";
}
@Override
public Term visit(ArrayAccessExpr e) {
throw new IllegalArgumentException("Arrays must be flattened before translation to Term");
}
@Override
public Term visit(ArrayExpr e) {
throw new IllegalArgumentException("Arrays must be flattened before translation to Term");
}
@Override
public Term visit(ArrayUpdateExpr e) {
throw new IllegalArgumentException("Arrays must be flattened before translation to Term");
}
@Override
public Term visit(BinaryExpr e) {
Term left = e.left.accept(this);
Term right = e.right.accept(this);
switch (e.op) {
case NOTEQUAL:
case XOR:
return not(term("=", left, right));
case ARROW:
if (pre) {
throw new IllegalArgumentException("Arrows cannot be nested under pre during translation to Term");
}
return ite(term(INIT), left, right);
default:
return term(e.op.toString(), left, right);
}
}
@Override
public Term visit(BoolExpr e) {
return term(Boolean.toString(e.value));
}
@Override
public Term visit(CastExpr e) {
if (e.type == NamedType.REAL) {
return term("to_real", e.expr.accept(this));
} else if (e.type == NamedType.INT) {
return term("to_int", e.expr.accept(this));
} else {
throw new IllegalArgumentException();
}
}
@Override
public Term visit(CondactExpr e) {
throw new IllegalArgumentException("Condacts must be removed before translation to Term");
}
@Override
public Term visit(FunctionCallExpr e) {
Term[] params = new Term[e.args.size()];
for (int i = 0; i < e.args.size(); i++) {
params[i] = e.args.get(i).accept(this);
}
return term(SexpUtil.encodeFunction(e.function), params);
}
@Override
public Term visit(IdExpr e) {
String id = encode(e.id);
return pre ? term(id) : term(prime(id));
}
@Override
public Term visit(IfThenElseExpr e) {
return ite(e.cond.accept(this), e.thenExpr.accept(this), e.elseExpr.accept(this));
}
@Override
public Term visit(IntExpr e) {
return numeral(e.value);
}
@Override
public Term visit(NodeCallExpr e) {
throw new IllegalArgumentException("Node calls must be inlined before translation to Term");
}
@Override
public Term visit(RealExpr e) {
return decimal(e.value);
}
@Override
public Term visit(RecordAccessExpr e) {
throw new IllegalArgumentException("Records must be flattened before translation to Term");
}
@Override
public Term visit(RecordExpr e) {
throw new IllegalArgumentException("Records must be flattened before translation to Term");
}
@Override
public Term visit(RecordUpdateExpr e) {
throw new IllegalArgumentException("Records must be flattened before translation to Term");
}
@Override
public Term visit(TupleExpr e) {
throw new IllegalArgumentException("Tuples must be flattened before translation to Term");
}
@Override
public Term visit(UnaryExpr e) {
switch (e.op) {
case PRE:
if (pre) {
throw new IllegalArgumentException("Nested pres must be removed before translation to Term");
}
pre = true;
Term expr = e.expr.accept(this);
pre = false;
return expr;
case NEGATIVE:
return term("-", e.expr.accept(this));
case NOT:
return not(e.expr.accept(this));
default:
throw new IllegalArgumentException("Unhandled unary operator: " + e.op);
}
}
private Term typeConstraint(String id, Type type) {
if (type instanceof SubrangeIntType) {
return subrangeConstraint(id, (SubrangeIntType) type);
} else if (type instanceof EnumType) {
return enumConstraint(id, (EnumType) type);
} else {
return null;
}
}
private Term subrangeConstraint(String id, SubrangeIntType subrange) {
return boundConstraint(id, numeral(subrange.low), numeral(subrange.high));
}
private Term enumConstraint(String id, EnumType et) {
return boundConstraint(id, numeral(0), numeral(et.values.size() - 1));
}
private Term boundConstraint(String id, Term low, Term high) {
return and(lessEqual(low, term(id)), lessEqual(term(id), high));
}
private Term lessEqual(Term left, Term right) {
return term("<=", left, right);
}
}
| true |
2951397fc16a1f0bfb4ce7bdf25a4418fb9535cf | Java | morrisbrandon2493/moca-language-server | /src/main/java/com/github/mrglassdanny/mocalanguageserver/util/lsp/PositionUtils.java | UTF-8 | 3,923 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | package com.github.mrglassdanny.mocalanguageserver.util.lsp;
import java.util.Comparator;
import java.util.regex.Pattern;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.Range;
public class PositionUtils {
public static final Comparator<Position> COMPARATOR = (Position p1, Position p2) -> {
if (p1.getLine() != p2.getLine()) {
return p1.getLine() - p2.getLine();
}
return p1.getCharacter() - p2.getCharacter();
};
public static boolean isValid(Position position) {
return (position.getLine() >= 0 && position.getCharacter() >= 0);
}
public static boolean isOffsetValid(String string, int offset) {
return offset >= 0 && offset <= string.length();
}
public static int getOffset(String string, Position position) {
if (!isValid(position)) {
return -1;
}
int line = position.getLine();
int character = position.getCharacter();
int currentIndex = 0;
int stringLength = string.length();
if (line > 0) {
int readLines = 0;
while (currentIndex < stringLength) {
char currentChar = string.charAt(currentIndex);
if (currentChar == -1) {
return -1;
}
currentIndex++;
if (currentChar == '\n') {
readLines++;
if (readLines == line) {
break;
}
}
}
}
return currentIndex + character;
}
public static Position getPosition(String string, int offset) {
if (!isOffsetValid(string, offset)) {
return null;
}
int lineNum = 0;
int curCharIndex = 0;
for (int i = 0; i < offset; i++) {
char curChar = string.charAt(i);
if (curChar == '\n') {
lineNum++;
curCharIndex = 0;
} else {
curCharIndex++;
}
}
return new Position(lineNum, curCharIndex);
}
public static char getCharacterAtPosition(String string, Position position) {
if (!isValid(position)) {
return '0';
}
int offset = getOffset(string, position);
if (offset > string.length() - 1) {
return '0';
} else {
return string.charAt(offset);
}
}
public static Range getWordRangeAtPosition(String string, Position position, String regexStr) {
if (!isValid(position)) {
return null;
}
int curCharNum = PositionUtils.getOffset(string, position);
int left = curCharNum - 1, right = curCharNum;
while (left >= 0 && Pattern.matches(regexStr, Character.toString(string.charAt(left)))) {
left--;
}
while (right < string.length() && Pattern.matches(regexStr, Character.toString(string.charAt(right)))) {
right++;
}
int lineNum = position.getLine();
return new Range(new Position(lineNum, left), new Position(lineNum, right));
}
public static String getWordAtPosition(String string, Position position, String regexStr) {
if (!isValid(position)) {
return null;
}
int curCharNum = PositionUtils.getOffset(string, position);
int left = curCharNum - 1, right = curCharNum;
String word = "";
String charStr;
while (left >= 0 && Pattern.matches(regexStr, charStr = Character.toString(string.charAt(left)))) {
word = charStr + word;
left--;
}
while (right < string.length()
&& Pattern.matches(regexStr, charStr = Character.toString(string.charAt(right)))) {
word += charStr;
right++;
}
return word;
}
} | true |
0cd1831e75454ed83b351b8508160eecc2244150 | Java | jiyulongxu/jbone | /jbone-cms/jbone-cms-portal/src/main/java/cn/jbone/cms/portal/WebConfig.java | UTF-8 | 907 | 1.914063 | 2 | [
"Apache-2.0"
] | permissive | package cn.jbone.cms.portal;
import cn.jbone.cms.portal.intercepter.CommonInterceptor;
import cn.jbone.cms.portal.ui.JboneDialect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private CommonInterceptor commonInterceptor;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(commonInterceptor);
}
// @Bean
// public JboneDialect jboneDialect(){
// return new JboneDialect();
// }
}
| true |
c444918bbf0fdb1463fc403a9ced010cc555f75d | Java | boanergepro/pago-movil-banco-venezuela-unofficial | /app/src/main/java/com/boanergepro/pagomovil/resources/Bank.java | UTF-8 | 1,248 | 2.296875 | 2 | [] | no_license | package com.boanergepro.pagomovil.resources;
/**
* Created by boanergepro on 18/04/18.
*/
public class Bank {
public static final String[] bancos = {
"BANCO DE VENEZUELA (BDV)",
"BFC Banco Fondo Común",
"Mercantil",
"Provincial",
"Banesco",
"Mi Banco",
"Bancamiga",
"BNC Nacional de Crédito",
"Banfanb",
"Banco Occidental de Descuento (BOD)",
"Venezolano de Crédito",
"100% Banco",
"Banco Del Sur",
"Bicentenario del Pueblo",
"Banco del Tesoro",
"Banco Caroní",
"Banplus",
"Bancaribe",
"Banco Exterior",
"Banco Agrícola de Venezuela",
};
public static final String[] codes = {
"0102",
"0151",
"0105",
"0108",
"0134",
"0169",
"0172",
"0191",
"0177",
"0116",
"0104",
"0156",
"0157",
"0175",
"0163",
"0128",
"0174",
"0114",
"0115",
"0166",
};
}
| true |
4a418e56b845dd5322251d751477c6de488f9c02 | Java | soloyes/geekbrains | /JavaLevel2/geekbrains_day6/src/ru/geekbrains/server/Server.java | UTF-8 | 1,135 | 2.9375 | 3 | [] | no_license | package ru.geekbrains.server;
import ru.geekbrains.CrossMonitor;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class Server {
private Socket socket;
private ServerSocket serverSocket;
public Server() {
try {
serverSocket = new ServerSocket(8888);
System.out.println("Server started!");
socket = serverSocket.accept();
System.out.println("Incoming connection! From " + socket.getInetAddress());
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
DataInputStream in = new DataInputStream(socket.getInputStream());
new CrossMonitor(in).start();
String s = "";
for (;!s.equals("exit");) {
System.out.print("Server: ");
s = reader.readLine();
out.writeUTF("Message from Server: " + s);
out.flush();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
| true |
3e90eee66b623ed38cb7e29d2cc6abd1bb117e6f | Java | mehmetozanguven/Programming-Fundemantals | /Homework 5/src/main/EstateAgentApp.java | UTF-8 | 375 | 1.835938 | 2 | [] | no_license | package main;
import java.io.FileNotFoundException;
import domain.*;
import fileAccessLayer.*;
import presentation.*;
public class EstateAgentApp {
public static void main(String[] args) throws FileNotFoundException{
EstateAgent estateAgent = new EstateAgent();
SwingPresentation s1 = new SwingPresentation(estateAgent,estateAgent.getDal());
}
}
| true |
be4171e3b226cff7780a881120bec19674e7ed27 | Java | duttpatel/Library-System-java-console | /src/View/Author.java | UTF-8 | 1,079 | 3.078125 | 3 | [] | no_license | package View;
public class Author {
private String authorId;
private String authorName;
private String authorDescription;
private static int authorCount = 101;
public Author(String authorName, String authorDescription) {
super();
this.authorId = autoIncrementId();
this.authorName = authorName;
this.authorDescription = authorDescription;
}
public String autoIncrementId(){
String tempAuthorCount = "A" + authorCount;
authorCount += 1;
return tempAuthorCount;
}
public String getAuthorId() {
return authorId;
}
public void setAuthorId(String authorId) {
this.authorId = authorId;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getAuthorDescription() {
return authorDescription;
}
public void setAuthorDescription(String authorDescription) {
this.authorDescription = authorDescription;
}
public String toString(){
return this.authorId + " " + this.authorName + " " + this.authorDescription;
}
}
| true |
21f7241dbfd54c6e4e9cde8012668e859d542453 | Java | atharvaspatkar/smartparkingsystem | /android/app/src/main/java/com/example/dell/intelligentparkingsystem/MainActivity.java | UTF-8 | 1,204 | 2.046875 | 2 | [] | no_license | package com.example.dell.intelligentparkingsystem;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button user = (Button)findViewById(R.id.user);
user.setOnClickListener(
new Button.OnClickListener()
{
@Override
public void onClick(View v) {
Intent newInt = new Intent(v.getContext(),user_login.class);
startActivity(newInt);
}
}
);
final Button admin = (Button)findViewById(R.id.button7);
admin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this,admin_login.class));
}
});
}
}
| true |
f97b0d64d5b3fc9157ecc8a70868cbe197f19e7e | Java | apache/nifi | /nifi-commons/nifi-security-utils/src/test/java/org/apache/nifi/security/util/crypto/CipherUtilityTest.java | UTF-8 | 14,120 | 1.976563 | 2 | [
"CC0-1.0",
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.nifi.security.util.crypto;
import org.apache.nifi.security.util.EncryptionMethod;
import org.apache.nifi.security.util.KeyDerivationFunction;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.security.Security;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class CipherUtilityTest {
private static final Pattern KEY_LENGTH_PATTERN = Pattern.compile("([\\d]+)BIT");
// TripleDES must precede DES for automatic grouping precedence
private static final List<String> CIPHERS = Arrays.asList("AES", "TRIPLEDES", "DES", "RC2", "RC4", "RC5", "TWOFISH");
private static final List<String> SYMMETRIC_ALGORITHMS = Arrays.stream(EncryptionMethod.values())
.map(it -> it.getAlgorithm())
.filter(algorithm -> algorithm.startsWith("PBE") || algorithm.startsWith("AES"))
.collect(Collectors.toList());
private static final Map<String, List<String>> ALGORITHMS_MAPPED_BY_CIPHER = SYMMETRIC_ALGORITHMS
.stream()
.collect(Collectors.groupingBy(algorithm -> CIPHERS.stream().filter(cipher -> algorithm.contains(cipher)).findFirst().get()));
// Manually mapped as of 03/21/21 1.13.0
private static final Map<Integer, List<String>> ALGORITHMS_MAPPED_BY_KEY_LENGTH = new HashMap<>();
static {
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(40, Arrays.asList("PBEWITHSHAAND40BITRC2-CBC",
"PBEWITHSHAAND40BITRC4"));
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(64, Arrays.asList("PBEWITHMD5ANDDES",
"PBEWITHSHA1ANDDES"));
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(112, Arrays.asList("PBEWITHSHAAND2-KEYTRIPLEDES-CBC",
"PBEWITHSHAAND3-KEYTRIPLEDES-CBC"));
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(128, Arrays.asList("PBEWITHMD5AND128BITAES-CBC-OPENSSL",
"PBEWITHMD5ANDRC2",
"PBEWITHSHA1ANDRC2",
"PBEWITHSHA256AND128BITAES-CBC-BC",
"PBEWITHSHAAND128BITAES-CBC-BC",
"PBEWITHSHAAND128BITRC2-CBC",
"PBEWITHSHAAND128BITRC4",
"PBEWITHSHAANDTWOFISH-CBC",
"AES/CBC/NoPadding",
"AES/CBC/PKCS7Padding",
"AES/CTR/NoPadding",
"AES/GCM/NoPadding"));
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(192, Arrays.asList("PBEWITHMD5AND192BITAES-CBC-OPENSSL",
"PBEWITHSHA256AND192BITAES-CBC-BC",
"PBEWITHSHAAND192BITAES-CBC-BC",
"AES/CBC/NoPadding",
"AES/CBC/PKCS7Padding",
"AES/CTR/NoPadding",
"AES/GCM/NoPadding"));
ALGORITHMS_MAPPED_BY_KEY_LENGTH.put(256, Arrays.asList("PBEWITHMD5AND256BITAES-CBC-OPENSSL",
"PBEWITHSHA256AND256BITAES-CBC-BC",
"PBEWITHSHAAND256BITAES-CBC-BC",
"AES/CBC/NoPadding",
"AES/CBC/PKCS7Padding",
"AES/CTR/NoPadding",
"AES/GCM/NoPadding"));
}
@BeforeAll
static void setUpOnce() {
Security.addProvider(new BouncyCastleProvider());
// Fix because TRIPLEDES -> DESede
final List<String> tripleDESAlgorithms = ALGORITHMS_MAPPED_BY_CIPHER.remove("TRIPLEDES");
ALGORITHMS_MAPPED_BY_CIPHER.put("DESede", tripleDESAlgorithms);
}
@Test
void testShouldParseCipherFromAlgorithm() {
// Arrange
final Map<String, List<String>> EXPECTED_ALGORITHMS = ALGORITHMS_MAPPED_BY_CIPHER;
// Act
for (final String algorithm: SYMMETRIC_ALGORITHMS) {
String cipher = CipherUtility.parseCipherFromAlgorithm(algorithm);
// Assert
assertTrue(EXPECTED_ALGORITHMS.get(cipher).contains(algorithm));
}
}
@Test
void testShouldParseKeyLengthFromAlgorithm() {
// Arrange
final Map<Integer, List<String>> EXPECTED_ALGORITHMS = ALGORITHMS_MAPPED_BY_KEY_LENGTH;
// Act
for (final String algorithm: SYMMETRIC_ALGORITHMS) {
int keyLength = CipherUtility.parseKeyLengthFromAlgorithm(algorithm);
// Assert
assertTrue(EXPECTED_ALGORITHMS.get(keyLength).contains(algorithm));
}
}
@Test
void testShouldDetermineValidKeyLength() {
// Arrange
// Act
for (final Map.Entry<Integer, List<String>> entry : ALGORITHMS_MAPPED_BY_KEY_LENGTH.entrySet()) {
final int keyLength = entry.getKey();
final List<String> algorithms = entry.getValue();
for (final String algorithm : algorithms) {
// Assert
assertTrue(CipherUtility.isValidKeyLength(keyLength, CipherUtility.parseCipherFromAlgorithm(algorithm)));
}
}
}
@Test
void testShouldDetermineInvalidKeyLength() {
// Arrange
// Act
for (final Map.Entry<Integer, List<String>> entry : ALGORITHMS_MAPPED_BY_KEY_LENGTH.entrySet()) {
final int keyLength = entry.getKey();
final List<String> algorithms = entry.getValue();
for (final String algorithm : algorithms) {
final List<Integer> invalidKeyLengths = new ArrayList<>(Arrays.asList(-1, 0, 1));
final Matcher matcher = Pattern.compile("RC\\d").matcher(algorithm);
if (matcher.find()) {
invalidKeyLengths.add(39);
invalidKeyLengths.add(2049);
} else {
invalidKeyLengths.add(keyLength + 1);
}
// Assert
invalidKeyLengths.forEach(invalidKeyLength -> assertFalse(CipherUtility.isValidKeyLength(invalidKeyLength, CipherUtility.parseCipherFromAlgorithm(algorithm))));
}
}
}
@Test
void testShouldDetermineValidKeyLengthForAlgorithm() {
// Arrange
// Act
for (final Map.Entry<Integer, List<String>> entry : ALGORITHMS_MAPPED_BY_KEY_LENGTH.entrySet()) {
final int keyLength = entry.getKey();
final List<String> algorithms = entry.getValue();
for (final String algorithm : algorithms) {
// Assert
assertTrue(CipherUtility.isValidKeyLengthForAlgorithm(keyLength, algorithm));
}
}
}
@Test
void testShouldDetermineInvalidKeyLengthForAlgorithm() {
// Arrange
// Act
for (final Map.Entry<Integer, List<String>> entry : ALGORITHMS_MAPPED_BY_KEY_LENGTH.entrySet()) {
final int keyLength = entry.getKey();
final List<String> algorithms = entry.getValue();
for (final String algorithm : algorithms) {
final List<Integer> invalidKeyLengths = new ArrayList<>(Arrays.asList(-1, 0, 1));
final Matcher matcher = Pattern.compile("RC\\d").matcher(algorithm);
if (matcher.find()) {
invalidKeyLengths.add(39);
invalidKeyLengths.add(2049);
} else {
invalidKeyLengths.add(keyLength + 1);
}
// Assert
invalidKeyLengths.forEach(invalidKeyLength -> assertFalse(CipherUtility.isValidKeyLengthForAlgorithm(invalidKeyLength, algorithm)));
}
}
// Extra hard-coded checks
String algorithm = "PBEWITHSHA256AND256BITAES-CBC-BC";
int invalidKeyLength = 192;
assertFalse(CipherUtility.isValidKeyLengthForAlgorithm(invalidKeyLength, algorithm));
}
@Test
void testShouldGetValidKeyLengthsForAlgorithm() {
// Arrange
final List<Integer> rcKeyLengths = IntStream.rangeClosed(40, 2048)
.boxed().collect(Collectors.toList());
final Map<String, List<Integer>> CIPHER_KEY_SIZES = new HashMap<>();
CIPHER_KEY_SIZES.put("AES", Arrays.asList(128, 192, 256));
CIPHER_KEY_SIZES.put("DES", Arrays.asList(56, 64));
CIPHER_KEY_SIZES.put("DESede", Arrays.asList(56, 64, 112, 128, 168, 192));
CIPHER_KEY_SIZES.put("RC2", rcKeyLengths);
CIPHER_KEY_SIZES.put("RC4", rcKeyLengths);
CIPHER_KEY_SIZES.put("RC5", rcKeyLengths);
CIPHER_KEY_SIZES.put("TWOFISH", Arrays.asList(128, 192, 256));
final List<String> SINGLE_KEY_SIZE_ALGORITHMS = Arrays.stream(EncryptionMethod.values())
.map(encryptionMethod -> encryptionMethod.getAlgorithm())
.filter(algorithm -> parseActualKeyLengthFromAlgorithm(algorithm) != -1)
.collect(Collectors.toList());
final List<String> MULTIPLE_KEY_SIZE_ALGORITHMS = Arrays.stream(EncryptionMethod.values())
.map(encryptionMethod -> encryptionMethod.getAlgorithm())
.filter(algorithm -> !algorithm.contains("PGP"))
.collect(Collectors.toList());
MULTIPLE_KEY_SIZE_ALGORITHMS.removeAll(SINGLE_KEY_SIZE_ALGORITHMS);
// Act
for (final String algorithm : SINGLE_KEY_SIZE_ALGORITHMS) {
final List<Integer> EXPECTED_KEY_SIZES = Arrays.asList(CipherUtility.parseKeyLengthFromAlgorithm(algorithm));
final List<Integer> validKeySizes = CipherUtility.getValidKeyLengthsForAlgorithm(algorithm);
// Assert
assertEquals(EXPECTED_KEY_SIZES, validKeySizes);
}
// Act
for (final String algorithm : MULTIPLE_KEY_SIZE_ALGORITHMS) {
final String cipher = CipherUtility.parseCipherFromAlgorithm(algorithm);
final List<Integer> EXPECTED_KEY_SIZES = CIPHER_KEY_SIZES.get(cipher);
final List<Integer> validKeySizes = CipherUtility.getValidKeyLengthsForAlgorithm(algorithm);
// Assert
assertEquals(EXPECTED_KEY_SIZES, validKeySizes);
}
}
@Test
void testShouldFindSequence() {
// Arrange
byte[] license = ("Licensed to the Apache Software Foundation (ASF) under one or more " +
"contributor license agreements. See the NOTICE file distributed with " +
"this work for additional information regarding copyright ownership. " +
"The ASF licenses this file to You under the Apache License, Version 2.0 " +
"(the \"License\"); you may not use this file except in compliance with " +
"the License. You may obtain a copy of the License at ".getBytes()).getBytes();
byte[] apache = "Apache".getBytes();
byte[] software = "Software".getBytes();
byte[] asf = "ASF".getBytes();
byte[] kafka = "Kafka".getBytes();
// Act
int apacheIndex = CipherUtility.findSequence(license, apache);
int softwareIndex = CipherUtility.findSequence(license, software);
int asfIndex = CipherUtility.findSequence(license, asf);
int kafkaIndex = CipherUtility.findSequence(license, kafka);
// Assert
assertEquals(16, apacheIndex);
assertEquals(23, softwareIndex);
assertEquals(44, asfIndex);
assertEquals(-1, kafkaIndex);
}
@Test
void testShouldExtractRawSalt() {
// Arrange
final byte[] PLAIN_SALT = new byte[16];
Arrays.fill(PLAIN_SALT, (byte) 0xab);
String ARGON2_SALT = Argon2CipherProvider.formSalt(PLAIN_SALT, 8, 1, 1);
String BCRYPT_SALT = BcryptCipherProvider.formatSaltForBcrypt(PLAIN_SALT, 10);
String SCRYPT_SALT = ScryptCipherProvider.formatSaltForScrypt(PLAIN_SALT, 10, 1, 1);
// Act
final Map<Object, byte[]> results = Arrays.stream(KeyDerivationFunction.values())
.filter(kdf -> !kdf.isStrongKDF())
.collect(Collectors.toMap(Function.identity(), kdf -> CipherUtility.extractRawSalt(PLAIN_SALT, kdf)));
results.put(KeyDerivationFunction.ARGON2, CipherUtility.extractRawSalt(ARGON2_SALT.getBytes(), KeyDerivationFunction.ARGON2));
results.put(KeyDerivationFunction.BCRYPT, CipherUtility.extractRawSalt(BCRYPT_SALT.getBytes(), KeyDerivationFunction.BCRYPT));
results.put(KeyDerivationFunction.SCRYPT, CipherUtility.extractRawSalt(SCRYPT_SALT.getBytes(), KeyDerivationFunction.SCRYPT));
results.put(KeyDerivationFunction.PBKDF2, CipherUtility.extractRawSalt(PLAIN_SALT, KeyDerivationFunction.PBKDF2));
// Assert
results.values().forEach(v -> assertArrayEquals(PLAIN_SALT, v));
}
private static int parseActualKeyLengthFromAlgorithm(final String algorithm) {
Matcher matcher = KEY_LENGTH_PATTERN.matcher(algorithm);
if (matcher.find()) {
return Integer.parseInt(matcher.group(1));
} else {
return -1;
}
}
}
| true |
21a92b4594e91bf60730d735dda7d6d6c62a2890 | Java | yxzandra/EvaTaxi | /app/src/main/java/com/ismcenter/evataxiapp/Adaptador/MontoPorServicioAdapter.java | UTF-8 | 2,053 | 2.34375 | 2 | [] | no_license | package com.ismcenter.evataxiapp.Adaptador;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.ismcenter.evataxiapp.Modelos.Response.ResponseHistoryAcceptService;
import com.ismcenter.evataxiapp.R;
import java.util.ArrayList;
/**
* Created by Desarrollo on 28/7/2016.
*/
public class MontoPorServicioAdapter extends RecyclerView.Adapter<MontoPorServicioAdapter.ViewHolder> {
private ArrayList<ResponseHistoryAcceptService> arrayList;
public MontoPorServicioAdapter(ArrayList<ResponseHistoryAcceptService> arrayList) {
this.arrayList = arrayList;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.card_view_monto_por_servicio,parent,false));
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Log.e("arraylist", arrayList.toString());
holder.idServicio.setText(arrayList.get(position).getPerson_nombre());
holder.fecha.setText(arrayList.get(position).getSer_fecha());
holder.monto.setText( String.valueOf(arrayList.get(position).getSer_id()));
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
TextView idServicio, fecha, monto;
public ViewHolder(View itemView) {
super(itemView);
idServicio = (TextView)itemView.findViewById(R.id.textRespuestaIdServicio);
fecha = (TextView)itemView.findViewById(R.id.textRespuestaFecha);
monto = (TextView)itemView.findViewById(R.id.textResultadoMonto);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
System.out.println("Clicked");
}
}
}
| true |
adbd4f1b93520bd3499df4c64fdf342f58b982ea | Java | DMalonas/ArrayManipulations | /ArrayRotations/src/RotateMethods.java | UTF-8 | 142 | 1.960938 | 2 | [] | no_license |
public interface RotateMethods {
int[] rotateLeftXpositions(int[] arr, int pos);
int[] rotateRightXpositions(int[] arr, int pos);
}
| true |
7df3f9c50c8ff3b054f659e16f6f7d4181976846 | Java | Anany-Gupta/DSA_codes | /CodeForces/800-1000/BeautifulMartrix.java | UTF-8 | 533 | 3 | 3 | [] | no_license | import java.util.Scanner;
public class BeautifulMartrix {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int m[][] = new int[5][5];
int a=0;
int b=0;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
m[i][j]=sc.nextInt();
if(m[i][j]==1){
a=i;b=j;
}
}
}
int answer = Math.abs(a-2)+Math.abs(b-2);
System.out.println(answer);
}
} | true |
691dc92246487913e450f437e909c2bc9c485146 | Java | pili-engineering/PLDroidShortVideo | /ShortVideoUIDemo/app/src/main/java/com/qiniu/shortvideo/app/utils/GlideImageLoader.java | UTF-8 | 411 | 2.046875 | 2 | [
"Apache-2.0"
] | permissive | package com.qiniu.shortvideo.app.utils;
import android.content.Context;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.youth.banner.loader.ImageLoader;
public class GlideImageLoader extends ImageLoader {
@Override
public void displayImage(Context context, Object path, ImageView imageView) {
Glide.with(context).load(path).centerCrop().into(imageView);
}
}
| true |
93600d75f0ee37dcc55ac390aa78436f4ab82329 | Java | GiamoE/DiscordBot | /src/main/java/emily/command/administrative/BanCommand.java | UTF-8 | 1,654 | 2.109375 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2017 github.com/kaaz
*
* 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 emily.command.administrative;
import emily.command.administrative.modactions.AbstractModActionCommand;
import emily.db.model.OModerationCase;
import emily.main.DiscordBot;
import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Member;
public class BanCommand extends AbstractModActionCommand {
@Override
public String getDescription() {
return "bans a member from your guild";
}
@Override
public String getCommand() {
return "ban";
}
@Override
public String[] getAliases() {
return new String[0];
}
@Override
protected OModerationCase.PunishType getPunishType() {
return OModerationCase.PunishType.BAN;
}
@Override
protected Permission getRequiredPermission() {
return Permission.BAN_MEMBERS;
}
@Override
protected boolean punish(DiscordBot bot, Guild guild, Member member) {
bot.queue.add(guild.getController().ban(member, 7));
return true;
}
} | true |
f6737f9a2d8e718e012215ad02330e4a42feeba8 | Java | eexxyyq/task-solutions | /src/test/java/ru/eexxyyq/solutions/tasks/week2/Task8Test.java | UTF-8 | 534 | 2.203125 | 2 | [
"MIT"
] | permissive | package ru.eexxyyq.solutions.tasks.week2;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class Task8Test {
@Test
void solution() {
assertEquals(0, Task8.solution(new int[][]{}));
assertEquals(0, Task8.solution(new int[][]{{0}}));
assertEquals(1, Task8.solution(new int[][]{{1}}));
assertEquals(3, Task8.solution(new int[][]{
{1,1,0,1},
{1,0,0,1},
{0,0,0,1},
{1,1,0,1}
}));
}
} | true |
e55109b9cbe3f4d439d26bfccbfc3696d2d1626c | Java | JacobGonzales116/Demo1 | /src/main/java/javafx/Demo1.java | UTF-8 | 742 | 2.65625 | 3 | [] | no_license | package javafx;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.net.URL;
public class Demo1 extends Application {
public static void main(String[] args){
// maybe do other startup here
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
//load the scene and plug it into the stage
URL viewURL = this.getClass().getResource("/Demo1.fxml");
FXMLLoader loader = new FXMLLoader(viewURL);
Parent rootNode = loader.load();
stage.setScene(new Scene(rootNode));
stage.setTitle("JavaFX Demo 1");
stage.show();
}
}
| true |
9c4599e4c8afbb2ee5f96af4791e1ac7b905c17d | Java | mateuslima2/LAB5_PARTE1_MATEUS_DE_LIMA_OLIVEIRA | /src/models/CenarioWithBonus.java | UTF-8 | 2,047 | 3.25 | 3 | [] | no_license | package models;
public class CenarioWithBonus extends Cenario {
private int bonus;
public CenarioWithBonus(String descricao, int bonus) {
super(descricao);
if(bonus == 0)
throw new IllegalArgumentException("Erro no cadastro de cenario: Bonus invalido");
this.bonus = bonus;
}
/**
*soma valores de apostas campeas
* @returns soma dos valores de apostas campeas
*/
public int ocorreArracadacao() {
int soma = 0;
for (Aposta ap : apostas)
if(ap.getPrevisao().getClass().equals("VAI ACONTECER"))
soma += ap.getValor();
return soma+bonus;
}
/**
*soma valores de apostas campeas
* @returns soma dos valores de apostas campeas
*/
public int nOcorreArrecadacao() {
int soma = 0;
for (Aposta ap : apostas)
if(ap.getPrevisao().getClass().equals("N VAI ACONTECER"))
soma += ap.getValor();
return soma+bonus;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((apostas == null) ? 0 : apostas.hashCode());
result = prime * result + ((descricao == null) ? 0 : descricao.hashCode());
result = prime * result + ((estado == null) ? 0 : estado.hashCode());
return result;
}
/**
* Retorna true se o objeto for igual ou false se for falso.
*@param obj outro objeto cenario
* @returns boolean
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cenario other = (Cenario) obj;
if (descricao == null) {
if (other.descricao != null)
return false;
} else if (!descricao.equals(other.descricao))
return false;
if (estado == null) {
if (other.estado != null)
return false;
} else if (!estado.equals(other.estado))
return false;
return true;
}
/**
* Retorna a String que representa um cenario.
* @returns a representação em String de um cenario.
*/
@Override
public String toString() {
return " - " + descricao +" - "+ estado+" - R$ " + this.bonus + ",00";
}
}
| true |
f4558449e4f052a4052a7f47db7d37161773ebfc | Java | gaganadeeputs/CorporateHealthPro | /src/main/java/org/gagan/sap/messanger/model/AssesmentQuestionChoiceDTO.java | UTF-8 | 643 | 2.234375 | 2 | [] | no_license | package org.gagan.sap.messanger.model;
public class AssesmentQuestionChoiceDTO {
private int id;
private String value;
private String type;
public AssesmentQuestionChoiceDTO() {
}
public AssesmentQuestionChoiceDTO(int id, String value, String type) {
super();
this.id = id;
this.value = value;
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
| true |
7cf3162a2cddf31164e80dda45f796172b19585f | Java | IT-CAMP4/2021.04.25-ioc | /src/main/java/pl/camp/it/App.java | UTF-8 | 552 | 1.867188 | 2 | [] | no_license | package pl.camp.it;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import pl.camp.it.configuration.AppConfiguration;
import pl.camp.it.configuration.AppConfiguration2;
import pl.camp.it.gui.GUI;
public class App {
public static void main(String[] args) {
ApplicationContext context = new AnnotationConfigApplicationContext(AppConfiguration.class);
GUI gui = context.getBean(GUI.class);
gui.login();
gui.register();
}
}
| true |
e62ee6ca9054a9934d41655a614ed76ebf320842 | Java | nscharrenberg/DOG-Sanctuary | /auth/src/main/java/com/nscharrenberg/dogsanctuary/auth/AuthApplication.java | UTF-8 | 1,523 | 2.328125 | 2 | [
"MIT"
] | permissive | package com.nscharrenberg.dogsanctuary.auth;
import com.nscharrenberg.dogsanctuary.auth.model.AppUser;
import com.nscharrenberg.dogsanctuary.auth.repositories.UserRepository;
import com.nscharrenberg.dogsanctuary.auth.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.dao.DataIntegrityViolationException;
import javax.annotation.PostConstruct;
@SpringBootApplication
@EnableDiscoveryClient
public class AuthApplication {
@Autowired
private UserRepository userRepository;
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class, args);
}
@EventListener
public void seed(ContextRefreshedEvent event) {
try {
createAdmin("admin", "admin@admin.com", "password", "Admin User");
} catch (DataIntegrityViolationException e) {
System.out.println("Error whiel seeding Admin - Probably already exists");
}
}
private AppUser createAdmin(String username, String email, String password, String name) {
AppUser user = new AppUser();
user.setUsername(username);
user.setPassword(password);
user.setEmail(email);
user.setName(name);
user.setRole("ADMIN");
return userRepository.save(user);
}
}
| true |
5def38ba71078b0a5653adf50e54ab14fef20af1 | Java | rupashrimohan/Inheritance-concepts--Java | /InheritanceConcept/src/example/two/superkeyword/SuperClass.java | UTF-8 | 257 | 2.25 | 2 | [] | no_license | package example.two.superkeyword;
public class SuperClass {
public static void main(String[] args) {
// TODO Auto-generated method stub
Two example=new Two();
{
example.valueOfx();
example.printxvalue();
example.valueofy();
}
}
}
| true |
6d1d706a9994da8d14d39e5acf3661d04bc0b6ef | Java | jnlycklama/mustela | /app/src/main/java/com/example/jnlycklama/mustela/MainActivity.java | UTF-8 | 4,525 | 2.1875 | 2 | [] | no_license | package com.example.jnlycklama.mustela;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.*;
import com.microsoft.windowsazure.mobileservices.*;
import com.microsoft.windowsazure.mobileservices.http.ServiceFilterResponse;
import com.microsoft.windowsazure.mobileservices.table.TableOperationCallback;
import java.io.File;
import java.io.FileInputStream;
import java.net.MalformedURLException;
public class MainActivity extends AppCompatActivity {
//public static EditText mEdit;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
*/
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
/*public static String getText(){
return mEdit.getText().toString();
}*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void onClickGoButton(View v) {
// Go! Button Click
//mEdit = (EditText)findViewById(R.id.usernameField);
InputMethodManager inputManager = (InputMethodManager)
getSystemService(this.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
Intent intent = new Intent(this, LoginCreateActivity.class);
startActivity(intent);
//Button button=(Button) v;
//setContentView(R.layout.activity_picture);
}
// Define the connection-string with your values
public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;" +
"AccountName=mustelastorage" +
"AccountKey=55447dcd-af8e-4d0b-af2f-ca3d50c0826c";
public void rileyFunction() {
try
{
// Retrieve storage account from connection-string.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
// Create the blob client.
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
// Get a reference to a container.
// The container name must be lower case
CloudBlobContainer container = blobClient.getContainerReference("images");
// Create the container if it does not exist.
container.createIfNotExists();
// Define the path to a local file.
final String filePath = "C:\\myimages\\myimage.jpg";
// Create or overwrite the "myimage.jpg" blob with contents from a local file.
CloudBlockBlob blob = container.getBlockBlobReference("myimage.jpg");
File source = new File(filePath);
blob.upload(new FileInputStream(source), source.length());
}
catch (Exception e)
{
// Output the stack trace.
e.printStackTrace();
}
}
}
| true |
b594b1163024fe50822d689e136bbbc804743e41 | Java | SergRocket/LearnOOP | /src/main/java/Bird_Pigeon.java | UTF-8 | 244 | 2.921875 | 3 | [] | no_license | public class Bird_Pigeon extends Bird {
public static void main (String[] args){
Bird_Pigeon bP = new Bird_Pigeon();
bP.Sign();
}
public void Sign(){
System.out.print("Голуб курликає");
}
}
| true |
4fd5c0821dbd7db7a8b7b058cd7c794ee0f90aa9 | Java | killvxk/graphicsfuzz | /reducer/src/main/java/com/graphicsfuzz/reducer/reductionopportunities/GlobalDeclarationReductionOpportunity.java | UTF-8 | 1,662 | 2.046875 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | /*
* Copyright 2018 The GraphicsFuzz Project 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 com.graphicsfuzz.reducer.reductionopportunities;
import com.graphicsfuzz.common.ast.IParentMap;
import com.graphicsfuzz.common.ast.TranslationUnit;
import com.graphicsfuzz.common.ast.decl.VariableDeclInfo;
import com.graphicsfuzz.common.ast.decl.VariablesDeclaration;
import com.graphicsfuzz.common.ast.visitors.VisitationDepth;
class GlobalDeclarationReductionOpportunity extends DeclarationReductionOpportunity {
GlobalDeclarationReductionOpportunity(VariableDeclInfo variableDeclInfo, IParentMap parentMap,
VisitationDepth depth) {
super(variableDeclInfo, parentMap, depth);
}
@Override
void removeVariablesDeclaration(VariablesDeclaration node) {
TranslationUnit tu = (TranslationUnit) parentMap.getParent(node);
for (int i = 0; i < tu.getTopLevelDeclarations().size(); i++) {
if (tu.getTopLevelDeclarations().get(i) == node) {
tu.removeTopLevelDeclaration(i);
return;
}
}
assert false; // Should not get here, since we should find and remove the declaration
}
}
| true |
fe472d2ed452446b355da6780ce550b3c0e9ed8a | Java | AttiaRoi/MyNotes | /app/src/main/java/roiattia/com/mynotes/database/DateTimeTypeConverter.java | UTF-8 | 535 | 2.359375 | 2 | [] | no_license | package roiattia.com.mynotes.database;
import android.arch.persistence.room.TypeConverter;
import org.joda.time.LocalDate;
import org.joda.time.LocalDateTime;
public class DateTimeTypeConverter {
@TypeConverter
public static LocalDateTime toLocalDateTime(Long timeStamp){
return timeStamp == null ? null : new LocalDateTime(timeStamp);
}
@TypeConverter
public static Long toTimeStamp(LocalDateTime localDateTime){
return localDateTime == null ? null : localDateTime.toDate().getTime();
}
}
| true |
c2d8d215111edc917cda746996b1a74866d34f0f | Java | betterdevstomorrow/tdd | /tdd-example/src/test/java/SubDateTest.java | UTF-8 | 943 | 2.609375 | 3 | [] | no_license | import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class SubDateTest {
private SubDate subDate;
@Before
public void init() {
subDate = new SubDate();
}
@Test
public void testGetYearDay() {
assertThat(subDate.getYearDay(1), is(0));
assertThat(subDate.getYearDay(2), is(365));
assertThat(subDate.getYearDay(5), is(365+365+365+366));
}
@Test(expected = RuntimeException.class)
public void testGetYearDayWithInvalidYear() {
subDate.getYearDay(-1);
}
@Test
public void testLeapYear() {
assertThat(subDate.isLeapYear(0), is(true));
assertThat(subDate.isLeapYear(1), is(false));
assertThat(subDate.isLeapYear(4), is(true));
assertThat(subDate.isLeapYear(1200), is(true));
assertThat(subDate.isLeapYear(700), is(false));
}
}
| true |
c5fb375b3ffcd4931fdeb877d6e1ba22e03249ea | Java | Padepokan79/BootCampG7 | /Ryan/07052018/Exercise4/Drill/PrintingChoicesEscapes.java | UTF-8 | 668 | 3.703125 | 4 | [] | no_license | public class PrintingChoicesEscapes {
public static void main(String[] args) {
// Latihan ini menunjukan cara keluar dari komen dan rangkaian (Seperti berikut)!
System.out.print("Learn\tJava\n\tthe\nHard\tWay\n\n\tLearn Java the \"Hard\" Way!\nHeloo\nJello\by\nHard to belive, eh?\nSurprised? /* abade */ Or what did you expect?\n\\//-=-\\//\n\\\\ \\\\\\ \\\\\\\\\nI hope you understand \"escape sequences\" now.\n");
// System.out.frimp( "Learn Java the Hard Way");
//Baris ini untuk menampilkan Hello
//baris ini untuk menampilkan jelly.
/* The quick brown fox jumped over a lazy dog.
Quick wafting zephyrs vex bold Jim. */
// and comments.
}
} | true |
a4433040480825314764a15bf3270685c6d41878 | Java | Grandexing/leetcode-java | /src/Caculator1.java | UTF-8 | 6,355 | 3.359375 | 3 | [] | no_license | import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;
public class Caculator1 {
public static void main(String[] args) {
List<Object> postfix = infixToPostfix("3+(2-5)*6/3");
for (Object p:postfix
) {
System.out.print(p);
}
System.out.println(calculate1("(6+6)*6"));
}
static int calculate1(String s) {
return evaluatePostfix1(infixToPostfix1(s));
}
static int evaluatePostfix1(List<Object> postfix) {
Stack<Integer> numbers = new Stack<>();
int left;
int right;
for (Object o : postfix) {
if (o instanceof Character) {
char c = (Character) o;
right = numbers.pop();
left = numbers.pop();
switch (c) {
case '+':
numbers.push(left + right);
break;
case '-':
numbers.push(left - right);
break;
case '*':
numbers.push(left * right);
break;
case '/':
numbers.push(left / right);
break;
default:
break;
}
} else {
numbers.push((Integer) o);
}
}
return numbers.pop();
}
static List<Object> infixToPostfix1(String s) {
Stack<Character> operators = new Stack<>();
List<Object> postfix = new LinkedList<>();
int number = 0;
boolean hasNumber = false;
for (char c : s.toCharArray()) {
if (Character.isDigit(c)) {
number = number * 10 + c - '0';
hasNumber = true;
} else {
if (hasNumber) {
postfix.add(number);
}
number = 0;
hasNumber = false;
if (c == ' ' || c == '\t') {
continue;
}
if (c == '(') {
operators.push(c);
} else if (c == ')') {
while (operators.peek() != '(') {
// pop operator
postfix.add(operators.pop());
}
// pop (
operators.pop();
} else {
// operator
while (!operators.isEmpty() && rank(c) <= rank(operators.peek())) {
postfix.add(operators.pop());
}
operators.push(c);
}
}
}
if (hasNumber) {
postfix.add(number);
}
while (!operators.isEmpty()) {
postfix.add(operators.pop());
}
return postfix;
}
static int rank(char op){
// the bigger the number, the higher the rank
switch(op){
case '+':return 1;
case '-':return 1;
case '*':return 2;
case '/':return 2;
default :return 0; // '('
}
}
static int evaluatePostfix(List<Object> postfix) {
Stack<Integer> operands = new Stack<Integer>();
int a = 0, b = 0;
for (Object s : postfix) {
if(s instanceof Character){
char c = (Character) s;
b = operands.pop();
a = operands.pop();
switch (c) {
case '+': operands.push(a + b); break;
case '-': operands.push(a - b); break;
case '*': operands.push(a * b); break;
default : operands.push(a / b);
}
}else { // instanceof Integer
operands.push((Integer)s);
}
}
return operands.pop();
}
public static int calculate(String s) {
return evaluatePostfix(infixToPostfix(s));
}
static List<Object> infixToPostfix(String s) {
Stack<Character> operators = new Stack<Character>();
List<Object> postfix = new LinkedList<Object>();
int numberBuffer = 0;
boolean bufferingOperand = false;
for (char c : s.toCharArray()) {
if (c >= '0' && c <= '9') {
numberBuffer = numberBuffer * 10 + c - '0';
bufferingOperand = true;
} else {
if(bufferingOperand)
postfix.add(numberBuffer);
numberBuffer = 0;
bufferingOperand = false;
if (c == ' '|| c == '\t')
continue;
if (c == '(') {
operators.push('(');
} else if (c == ')') {
while (operators.peek() != '(')
postfix.add(operators.pop());
operators.pop(); // popping "("
} else { // operator
while (!operators.isEmpty() && rank(c) <= rank(operators.peek()))
postfix.add(operators.pop());
operators.push(c);
}
}
}
if (bufferingOperand)
postfix.add(numberBuffer);
while (!operators.isEmpty())
postfix.add(operators.pop());
return postfix;
}
public static int simpleCalculate(String s) {
int sum = 0;
int cur = 0;
int prd = 1;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (Character.isDigit(c)) {
cur = cur * 10 + c - '0';
} else if (c == '+') {
sum += prd * cur;
cur = 0;
prd = 1;
} else if (c == '-') {
sum += prd * cur;
cur = 0;
prd = -1;
} else if (c == '*') {
prd *= cur;
cur = 0;
}
}
return sum + prd * cur;
}
//
// private static int preOrder(char left, char right) {
// if (left == '+' || left == '-') {
// if (right == '*' || right == '/')
// }
// }
}
| true |
0e2f4017f2cc376a58473f3409603cd446de2595 | Java | vuminhquanvanthanh/nopbaiproject | /MINF15_VUMINHQUAN_Automata/src/presentation/Vertex.java | UTF-8 | 2,605 | 3 | 3 | [] | no_license | package presentation;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import automata.CoordinateState;
/**
* @author VuMinhQuan
*
*/
public class Vertex {
private Point2D position;
private CoordinateState info;
private VertexType typeVertex; // init, end, normal,...
public Point2D getPostion() {
return position;
}
public void setPostion(Point2D postion) {
this.position = postion;
}
public CoordinateState getInfo() {
this.info.setCoordinate(this.position);
return info;
}
public void setInfo(CoordinateState info) {
this.info = info;
}
private CoordinateState setInfo(VertexType tVertex) {
CoordinateState t = new CoordinateState("", false, false); // mac dinh
// la normal
// t.setCoordinate(coordinate)
if (tVertex == VertexType.INIT) {
t.setInit(true);
} else {
if (tVertex == VertexType.END) {
t.setEnd(true);
} else {
if (tVertex == VertexType.INIT_AND_END) {
t.setInit(true);
t.setEnd(true);
}
}
}
return t;
}
public VertexType getTypeVertex() {
return typeVertex;
}
public void setTypeVertex(VertexType typeVertex) {
this.typeVertex = typeVertex;
}
public Vertex(Point2D position) {
super();
this.position = position;
this.typeVertex = VertexType.NORMAL;
this.info = setInfo(typeVertex);
}
public Vertex(Point2D position, VertexType typev) {
super();
this.position = position;
this.typeVertex = typev;
this.info = setInfo(typeVertex);
}
public Vertex(CoordinateState infoState) {
this.position = infoState.getCoordinate();
this.typeVertex = VertexType.NORMAL;
if (infoState.isEnd() && infoState.isInit())
this.typeVertex = VertexType.INIT_AND_END;
else {
if (infoState.isInit())
this.typeVertex = VertexType.INIT;
else {
if (infoState.isEnd())
this.typeVertex = VertexType.END;
}
}
this.info = infoState;
}
public void drawVertex(Graphics g, Color color) {
Draw.drawVertex((Graphics2D) g, position, typeVertex, info.getLabel(), color);
}
public boolean checkInVertex(Point2D p) {
if (position.getX() - Draw.SIZE / 2 <= p.getX() && p.getX() <= position.getX() + Draw.SIZE / 2
&& position.getY() - Draw.SIZE / 2 <= p.getY() && p.getY() <= position.getY() + Draw.SIZE / 2)
return true;
return false;
}
@Override
public String toString() {
System.out.println("Position: " + position.toString());
info.toString();
return "";
}
}
| true |
a43a785e960d5385c2d5dc14578b65e3953535f7 | Java | jorgeluis1245/proyectoAppFinal | /TEACHINGLINExddd/app/src/main/java/com/material/lineteachin3/Profesor.java | UTF-8 | 1,475 | 1.976563 | 2 | [] | no_license | package com.material.lineteachin3;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
public class Profesor extends Fragment {
private RecyclerView recyclerViewProfesor;
private RecyclerViewAdaptador AdaptadorProfesor;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_profesor, container, false);
return v;
/* recyclerViewProfesor = (RecyclerView)v.findViewById(R.id.recyclerProfesor);
recyclerViewProfesor.setLayoutManager(new LinearLayoutManager(getActivity()));
AdaptadorProfesor = new RecyclerViewAdaptador(obtner_profesores());
recyclerViewProfesor.setAdapter(AdaptadorProfesor);*/
}
public void llamar_lista(View view){
try{
Intent mg = new Intent(getActivity(),Mostrarlista.class);
getActivity().startActivity(mg);
}catch (Exception a){
}
}
}
| true |
a92c3ff0ec2387c864626bb89a83d134f91d2710 | Java | NCIP/cagrid2 | /cagrid-gts/cagrid-gts-service-tools/src/main/java/org/cagrid/gts/service/tools/CreateHostCertificate.java | UTF-8 | 3,745 | 2.390625 | 2 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | package org.cagrid.gts.service.tools;
import java.io.File;
import java.security.GeneralSecurityException;
import java.security.KeyPair;
import java.security.PrivateKey;
import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.bouncycastle.asn1.x509.X509Name;
import org.bouncycastle.jce.PKCS10CertificationRequest;
import org.cagrid.gaards.pki.CertUtil;
import org.cagrid.gaards.pki.KeyUtil;
import com.ibm.wsdl.util.IOUtils;
/**
* @author <A href="mailto:langella@bmi.osu.edu">Stephen Langella </A>
* @author <A href="mailto:oster@bmi.osu.edu">Scott Oster </A>
* @author <A href="mailto:hastings@bmi.osu.edu">Shannon Hastings </A>
* @version $Id: ArgumentManagerTable.java,v 1.2 2004/10/15 16:35:16 langella
* Exp $
*/
public class CreateHostCertificate {
public static void main(String[] args) {
try {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
String cert = org.cagrid.core.commandline.IOUtils.readLine("Please enter the location of the CA's certificate", true);
String key = org.cagrid.core.commandline.IOUtils.readLine("Please enter the location of the CA's private key", true);
String cn = org.cagrid.core.commandline.IOUtils.readLine("Please enter the hostname of the host you are requesting a certificate for", true);
String syears = org.cagrid.core.commandline.IOUtils.readLine("Please enter the number of years the host certificate will be valid for", true);
int years = Integer.valueOf(syears);
PrivateKey cakey = KeyUtil.loadPrivateKey(new File(key), null);
X509Certificate cacert = CertUtil.loadCertificate("BC", new File(cert));
KeyPair pair = KeyUtil.generateRSAKeyPair1024("BC");
String rootSub = cacert.getSubjectDN().toString();
int index = rootSub.lastIndexOf(",");
String subject = rootSub.substring(0, index) + ",CN=" + cn;
GregorianCalendar date = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
Date start = new Date(date.getTimeInMillis());
Date end = null;
date.add(Calendar.YEAR, years);
Date d = new Date(date.getTimeInMillis());
if (cacert.getNotAfter().before(d)) {
throw new GeneralSecurityException("Cannot create a certificate that expires after issuing certificate.");
}
end = d;
X509Certificate userCert = CertUtil.generateCertificate("BC", new X509Name(subject), start, end, pair.getPublic(), cacert, cakey, CertUtil.SHA2_SIGNATURE_ALGORITHM, null);
System.out.println("Successfully created the host certificate:");
System.out.println(userCert.getSubjectDN().toString());
System.out.println("Host certificate issued by:");
System.out.println(cacert.getSubjectDN().toString());
System.out.println("Host certificate valid till:");
System.out.println(userCert.getNotAfter());
String certOut = org.cagrid.core.commandline.IOUtils.readLine("Please enter a location/filename to write the certificate to", true);
String keyOut = org.cagrid.core.commandline.IOUtils.readLine("Please enter a location/filename to write the private key to", true);
KeyUtil.writePrivateKey(pair.getPrivate(), new File(keyOut));
CertUtil.writeCertificate(userCert, new File(certOut));
System.out.println("Host private key written to:");
System.out.println(keyOut);
System.out.println("Host certificate written to:");
System.out.println(certOut);
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
} | true |
d71faf91d725e52e34e84b434fbca7cbf7d12f21 | Java | Tyf0n/CS_Coursework | /CS334-Programming_Languages/hw8/EditCommand.java | UTF-8 | 875 | 3.328125 | 3 | [] | no_license | /*
* Nathaniel Lim CS334 HW8
*/
/**
* An abstract super class of all Edit Commands on Buffers. This
* class simply specifies the interface to all commands and stores the
* target buffer of the command.
*/
public abstract class EditCommand {
/** buffer to operate on */
protected Buffer target;
/**
* The constructor just initializes the instance variable to be
* the buffer on which to operate. You must call this constructor
* from inside your subclass constructors.
*/
public EditCommand(Buffer target) {
this.target = target;
}
/** Perform the command on the target buffer */
public abstract void execute();
/** Undo the command on the target buffer */
public abstract void undo();
/** Print out what this command represents */
public abstract String toString();
}
| true |
6e3e5049b44823104d071e567a9231bcfb7c5405 | Java | Ashishkvs/springboot_crud_mysql_scheduler_mail | /src/main/java/com/imagegrafia/service/EmailService.java | UTF-8 | 534 | 2.046875 | 2 | [] | no_license | package com.imagegrafia.service;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.imagegrafia.model.EmailTemplate;
import com.imagegrafia.repository.EmailRepository;
@Service
public class EmailService {
@Autowired
private EmailRepository emailRepository;
public Optional<EmailTemplate> getEmailTemplate(int id) {
return emailRepository.findById(id);
}
/**
* from info@abc.com to all with this particualr template
*/
}
| true |
1122fa1cc84e00c923d42aabe54cfa8d15aea321 | Java | alexwang66/hands-on-spring-cloud | /jparest-service/src/main/java/com/handson/treinamento/jparest/repositories/AccountRepository.java | UTF-8 | 322 | 1.890625 | 2 | [] | no_license | package com.handson.treinamento.jparest.repositories;
import com.handson.treinamento.jparest.entities.model.AccountModel;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AccountRepository extends JpaRepository<AccountModel, Long> {
AccountModel findByNumber(Integer numerAccount);
}
| true |
43f3c8a27ff24fe0c78a13faa847788fbca92e2a | Java | heenasalim/Advanced_Java | /karishma112/core/Struts/akash/Employee_Project/src/Change.java | UTF-8 | 4,772 | 2.5625 | 3 | [] | no_license | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Change extends JFrame implements ActionListener{
JLabel l0,l1,l2,l3,l4;
JTextField t1,t2,t3,t4;
JButton b1,b2,b3;
Connection con;
Statement st;
ResultSet rs;
public Change()
{
Panel p=new Panel();
p.setLayout(null);
l0=new JLabel("Change Password");
l0.setFont(new Font("Comic Sans MS",Font.BOLD,23));
l0.setForeground(Color.BLUE);
Font f=new Font("Arial",Font.BOLD,13);
l1=new JLabel("Enter username");
l1.setFont(f);
l2=new JLabel("Enter old password");
l2.setFont(f);
l3=new JLabel("Enter new password");
l3.setFont(f);
l4=new JLabel("Conform new password");
l4.setFont(f);
t1=new JTextField(10);
t2=new JTextField(10);
t3=new JTextField(10);
t4=new JTextField(10);
b1=new JButton("Change ");
b2=new JButton("Reset");
b3=new JButton("Cancel");
l0.setBounds(40,10,205,40);
l1.setBounds(10,80,190,20);
l2.setBounds(10,110,190,20);
l3.setBounds(10,140,190,20);
l4.setBounds(10,170,190,20);
t1.setBounds(170,80,90,20);
t2.setBounds(170,110,90,20);
t3.setBounds(170,140,90,20);
t4.setBounds(170,170,90,20);
b1.setBounds(5,220,80,20);
b2.setBounds(95,220,80,20);
b3.setBounds(185,220,80,20);
p.add(l0);
p.add(l1);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(t1);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(b1);
p.add(b2);
p.add(b3);
add(p);
p.setBackground(Color.LIGHT_GRAY);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
setVisible(true);
setSize(280,300);
setTitle("Changing_Password");
setLocation(400,150);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver");
con=DriverManager.getConnection("jdbc:oracle:thin:@oracle-server:1521:orcl","java","java");
System.out.println("Connection!");
st=con.createStatement();
}catch(Exception e){e.printStackTrace();}
}
public static void main(String[] args) {
Change c=new Change();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==b1)
{
boolean flag=true;
boolean flag2=true;
String sun="",sps="",scps="",sops="";
sun=t1.getText();
sops=t2.getText();
sps=t3.getText();
scps=t4.getText();
try{
rs=st.executeQuery("select * from logak where un='"+sun+"' ");
while(rs.next())
{
flag=false;
}
rs=st.executeQuery("select pass from logak where un='"+sun+"' ");
while(rs.next())
{
String temp=rs.getString(1);
if(temp.equals(sops)==false)
{
flag2=false;
}
}
}catch(Exception e1){e1.printStackTrace();}
if(sun.equals("") && sops.equals("") && sps.equals("") && scps.equals(""))
{
JOptionPane.showMessageDialog(this, "Please fill all fields", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(sun.equals(""))
{
JOptionPane.showMessageDialog(this, "Please enter username", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(sops.equals(""))
{
JOptionPane.showMessageDialog(this, "Please enter old password", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(sps.equals(""))
{
JOptionPane.showMessageDialog(this, "Please enter new password", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(scps.equals(""))
{
JOptionPane.showMessageDialog(this, "Please enter conform password", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(sps.equals(scps)==false)
{
JOptionPane.showMessageDialog(this, "New password and conform password does not matched", "Change Password", JOptionPane.ERROR_MESSAGE);
t4.setText("");
}
else if(flag==true)
{
JOptionPane.showMessageDialog(this, "Username not found", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else if(flag2==false)
{
JOptionPane.showMessageDialog(this, "Password not matched", "Change Password", JOptionPane.WARNING_MESSAGE);
}
else
{
try{
int i=st.executeUpdate("update logak set pass='"+sps+"' where un='"+sun+"' ");
}catch(Exception e3){e3.printStackTrace();}
JOptionPane.showMessageDialog(this, "Password changed succesfully...", "Change Password", JOptionPane.INFORMATION_MESSAGE);
}
}
else if(e.getSource()==b2)
{
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
}
else if(e.getSource()==b3)
{
// try
// {
// con.close();
// st.close();
// rs.close();
// }catch(Exception e5){e5.printStackTrace();}
dispose();
new Login();
}
}
}
| true |
9189aa01c70dbbb72a0238efb83f0a1fb8a67a02 | Java | urazovm/GoCook-O2O | /O2O/src/com/m6/model/biz/CLoginInfo.java | UTF-8 | 983 | 2.203125 | 2 | [] | no_license | package com.m6.model.biz;
import org.json.JSONException;
import org.json.JSONObject;
import com.m6.model.base.BaseData;
import com.m6.util.SecurityUtils;
public class CLoginInfo extends BaseData {
private String account;
private String password;
public CLoginInfo(String account, String password) {
this.account = account;
this.password = password;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String getJsonData() {
try {
JSONObject postJsonObject = new JSONObject();
postJsonObject.put("Account", account);
postJsonObject.put("Password", SecurityUtils.trimLineFeed(SecurityUtils.encryptMode(password)));
return postJsonObject.toString();
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}
| true |
486f2629b35f721378896c82f0e4e0e1d9a71525 | Java | DISA20072007/email | /src/main/java/ru/kkb/isimple/dao/EmailTopicDao.java | UTF-8 | 1,600 | 2.265625 | 2 | [] | no_license | package ru.kkb.isimple.dao;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import ru.kkb.isimple.entities.Email;
import ru.kkb.isimple.entities.EmailTopic;
import javax.persistence.EntityManager;
import java.util.List;
/**
* @author denis.fedorov
*/
@Repository
@Transactional
public class EmailTopicDao {
@Autowired
private SessionFactory sessionFactory;
public EmailTopicDao() { }
public List<EmailTopic> getMailTopics() {
String query = "SELECT topic FROM EmailTopic topic ORDER BY id";
Session session = sessionFactory.getCurrentSession();
Query<EmailTopic> topics = session.createQuery(query, EmailTopic.class);
return topics.getResultList();
}
public EmailTopic getMailTopic(int topicId) {
Session session = sessionFactory.getCurrentSession();
return session.get(EmailTopic.class, topicId);
}
public void setTopic(int id, String name) {
EmailTopic emailTopic = new EmailTopic(id, name);
Session session = sessionFactory.getCurrentSession();
session.saveOrUpdate(emailTopic);
}
public void deleteTopic(int id) {
Session session = sessionFactory.getCurrentSession();
EmailTopic emailTopic = session.find(EmailTopic.class, id);
if (emailTopic != null) {
session.remove(emailTopic);
}
}
}
| true |
7728ab816ba93cc104dc0126d56bd3fc8664741e | Java | JaehongLee111/SimplisafeProject | /main/java/com/example/gui/StatusPage.java | UTF-8 | 1,452 | 2.34375 | 2 | [] | no_license | package com.example.gui;
import android.content.Intent;
import android.graphics.Color;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class StatusPage extends AppCompatActivity {
private TextView status;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
status = findViewById(R.id.status);
}
public void onMenuClick(View view){
Intent tent = new Intent(this, NavigationMenuActivity.class);
startActivity(tent);
}
public void onRadioButtonClicked(View view){
boolean check = ((RadioButton) view).isChecked();
switch (view.getId()) {
case R.id.radio_off:
if (check){
status.setText("Off");
status.setTextColor(Color.LTGRAY);
} break;
case R.id.radio_away:
if (check){
status.setText("Away");
status.setTextColor(0xEB6D49);
} break;
case R.id.radio_home:
if (check){
status.setText("Home");
status.setTextColor(0x62A247);
} break;
}
}
} | true |
d22ef3af17845f790f6655bd40f0043da8c872a0 | Java | cckmit/QcAndroid | /staff/src/main/java/cn/qingchengfit/staffkit/views/wardrobe/choose/ChooseRegionFragment.java | UTF-8 | 6,471 | 1.539063 | 2 | [] | no_license | package cn.qingchengfit.staffkit.views.wardrobe.choose;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import cn.qingchengfit.RxBus;
import cn.qingchengfit.di.model.GymWrapper;
import cn.qingchengfit.di.model.LoginStatus;
import cn.qingchengfit.items.ListAddItem;
import cn.qingchengfit.model.responese.LockerRegion;
import cn.qingchengfit.model.responese.LockerRegions;
import cn.qingchengfit.network.ResponseConstant;
import cn.qingchengfit.network.response.QcDataResponse;
import cn.qingchengfit.staffkit.App;
import cn.qingchengfit.staffkit.R;
import cn.qingchengfit.staffkit.constant.StaffRespository;
import cn.qingchengfit.staffkit.views.adapter.CommonFlexAdapter;
import cn.qingchengfit.staffkit.views.custom.DividerItemDecoration;
import cn.qingchengfit.staffkit.views.wardrobe.add.DistrictAddFragment;
import cn.qingchengfit.utils.ToastUtils;
import cn.qingchengfit.views.fragments.BaseFragment;
import eu.davidea.flexibleadapter.FlexibleAdapter;
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager;
import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.schedulers.Schedulers;
/**
* power by
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
* MM.: .:' `::: .:`MMMMMMMMMMM|`MMM'|MMMMMMMMMMM': .:' `::: .:'.MM
* MMMM. : `MMMMMMMMMM :*' MMMMMMMMMM' : .MMMM
* MMMMM. :: . `MMMMMMMM' :: `MMMMMMMM' . :: . .MMMMM
* MMMMMM. : :: ::' : :: ::' : :: ::' :: ::' : :: ::.MMMMMM
* MMMMMMM ;:: ;:: ;:: ;:: ;:: MMMMMMM
* MMMMMMM .:' `::: .:' `::: .:' `::: .:' `::: .:' `::MMMMMMM
* MMMMMM' : : : : : `MMMMMM
* MMMMM'______::____ :: . :: . :: ___._::____`MMMMM
* MMMMMMMMMMMMMMMMMMM`---._ :: ::' : :: ::' _.--::MMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMM::. :: .--MMMMMMMMMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM-. ;::-MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. .:' .M:F_P:MMMMMMMMMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM. .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\ /MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
* MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMVMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
* Created by Paper on 16/9/1.
*/
public class ChooseRegionFragment extends BaseFragment implements FlexibleAdapter.OnItemClickListener {
RecyclerView rv;
@Inject StaffRespository restRepository;
@Inject LoginStatus loginStatus;
@Inject GymWrapper gymWrapper;
Toolbar toolbar;
TextView toolbarTitile;
private CommonFlexAdapter mAdapter;
private List<AbstractFlexibleItem> mDatas = new ArrayList<>();
public static ChooseRegionFragment newInstance() {
Bundle args = new Bundle();
ChooseRegionFragment fragment = new ChooseRegionFragment();
fragment.setArguments(args);
return fragment;
}
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_district_list, container, false);
rv = (RecyclerView) view.findViewById(R.id.rv);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbarTitile = (TextView) view.findViewById(R.id.toolbar_title);
initToolbar(toolbar);
rv.setHasFixedSize(true);
rv.setLayoutManager(new SmoothScrollLinearLayoutManager(getContext()));
rv.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.VERTICAL));
RxRegiste(restRepository.getStaffAllApi()
.qcGetAllRegion(App.staffId, gymWrapper.getParams())
.onBackpressureBuffer()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<QcDataResponse<LockerRegions>>() {
@Override public void call(QcDataResponse<LockerRegions> qcResponseLocerRegion) {
if (ResponseConstant.checkSuccess(qcResponseLocerRegion)) {
onDistricList(qcResponseLocerRegion.data.locker_regions);
} else {
hideLoading();
ToastUtils.show(qcResponseLocerRegion.getMsg());
}
}
}, new Action1<Throwable>() {
@Override public void call(Throwable throwable) {
hideLoading();
}
}));
return view;
}
@Override public void initToolbar(@NonNull Toolbar toolbar) {
super.initToolbar(toolbar);
toolbarTitile.setText("选择区域");
}
public void onDistricList(List<LockerRegion> regions) {
mDatas.clear();
if (regions == null) {
} else {
for (int i = 0; i < regions.size(); i++) {
mDatas.add(new SimpleChooseItemItem(regions.get(i)));
}
}
mDatas.add(new ListAddItem("添加新区域"));
mAdapter = new CommonFlexAdapter(mDatas, this);
rv.setAdapter(mAdapter);
}
@Override public String getFragmentName() {
return ChooseRegionFragment.class.getName();
}
@Override public void onDestroyView() {
super.onDestroyView();
}
@Override public boolean onItemClick(int position) {
if (mAdapter.getItem(position) instanceof SimpleChooseItemItem) {//选择区域
getActivity().onBackPressed();
RxBus.getBus().post(((SimpleChooseItemItem) mAdapter.getItem(position)).getLockerRegion());
} else if (mAdapter.getItem(position) instanceof ListAddItem) {//增加区域
getFragmentManager().beginTransaction()
.replace(mCallbackActivity.getFragId(), new DistrictAddFragment())
.addToBackStack(getFragmentName())
.commit();
}
return true;
}
}
| true |
f190709301b4963ca4946943500be02378511582 | Java | gdromard/dromardcommon | /dromard.common.web/trunk/src/main/java/net/dromard/web/mock/test/MockServletContext.java | UTF-8 | 7,284 | 2.46875 | 2 | [] | no_license | /**
* File : TestTagServletContext.java 12 juin 07
*/
package net.dromard.web.mock.test;
import java.io.File;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Set;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
/**
* This is a mock implementation of ServletContext class.
* It is design to be used for unit tests.
* <br>
* @author Gabriel Dromard
*/
public class MockServletContext implements ServletContext {
private String rootPath;
public MockServletContext(final String root) {
this.rootPath = root;
}
/**
* This implementation concat 'web/' with the given resource and return its absolute path.
* @param resource The resource on which to get informations
* @return The resource real path.
* @see javax.servlet.ServletContext#getRealPath(java.lang.String)
*/
public final String getRealPath(final String resource) {
try {
return new File(rootPath + resource).getAbsolutePath();
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getAttribute(java.lang.String)
*/
public final Object getAttribute(final String argument) {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getAttributeNames()
*/
public final Enumeration getAttributeNames() {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getContext(java.lang.String)
*/
public final ServletContext getContext(final String argument) {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getInitParameter(java.lang.String)
*/
public final String getInitParameter(final String argument) {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getInitParameterNames()
*/
public final Enumeration getInitParameterNames() {
return null;
}
/**
* Empty implementation.
* @return 0
* @see javax.servlet.ServletContext#getMajorVersion()
*/
public final int getMajorVersion() {
return 0;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getMimeType(java.lang.String)
*/
public final String getMimeType(final String argument) {
return null;
}
/**
* Empty implementation.
* @return 0
* @see javax.servlet.ServletContext#getMinorVersion()
*/
public final int getMinorVersion() {
return 0;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getNamedDispatcher(java.lang.String)
*/
public final RequestDispatcher getNamedDispatcher(final String argument) {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getRequestDispatcher(java.lang.String)
*/
public final RequestDispatcher getRequestDispatcher(final String argument) {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getResource(java.lang.String)
* @throws MalformedURLException {@link javax.servlet.ServletContext#getResource(java.lang.String)}
*/
public final URL getResource(final String argument) throws MalformedURLException {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getResourceAsStream(java.lang.String)
*/
public final InputStream getResourceAsStream(final String argument) {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getResourcePaths(java.lang.String)
*/
public final Set getResourcePaths(final String argument) {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getServerInfo()
*/
public final String getServerInfo() {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @return null
* @see javax.servlet.ServletContext#getServlet(java.lang.String)
* @throws ServletException {@link javax.servlet.ServletContext#getServlet(java.lang.String)}
*/
public final Servlet getServlet(final String argument) throws ServletException {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getServletContextName()
*/
public final String getServletContextName() {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getServletNames()
*/
public final Enumeration getServletNames() {
return null;
}
/**
* Empty implementation.
* @return null
* @see javax.servlet.ServletContext#getServlets()
*/
public final Enumeration getServlets() {
return null;
}
/**
* Empty implementation.
* @param argument argument
* @see javax.servlet.ServletContext#log(java.lang.String)
*/
public final void log(final String argument) {
}
/**
* Empty implementation.
* @param argument argument
* @param argument1 argument1
* @see javax.servlet.ServletContext#log(java.lang.Exception, java.lang.String)
*/
public final void log(final Exception argument, final String argument1) {
}
/**
* Empty implementation.
* @param argument argument
* @param argument1 argument1
* @see javax.servlet.ServletContext#log(java.lang.String, java.lang.Throwable)
*/
public final void log(final String argument, final Throwable argument1) {
}
/**
* Empty implementation.
* @param argument argument
* @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
*/
public final void removeAttribute(final String argument) {
}
/**
* Empty implementation.
* @param argument argument
* @param argument1 argument1
* @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
*/
public final void setAttribute(final String argument, final Object argument1) {
}
}
| true |
72d57af0c58c117189a21b9a9a1f774302e8b42e | Java | chongtianfeiyu/JavaStudyProject | /JavaStudyProject/src/com/manzhizhen/spring/aop/JobLogHandler.java | UTF-8 | 698 | 2.734375 | 3 | [] | no_license | /**
*
*/
package com.manzhizhen.spring.aop;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* 日志服务类
* 代表横切逻辑,需要加入到JobService的doJob方法前后
* @author Manzhizhen
*
*/
public class JobLogHandler implements InvocationHandler{
private Object target; // 被代理的目标类
public JobLogHandler(Object target) {
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
LogService.printLogBefore(method); // 横切逻辑
Object object = method.invoke(target, args);
LogService.printLogAfter(method); // 横切逻辑
return object;
}
}
| true |
d07a46ef3455094dc3903ec1ed39d51847873f1e | Java | Deoxynum/InceptionSerius | /app/src/main/java/com/example/sebastianlimaco/inceptionserius/JavaModelling/Video/FeedVideo.java | UTF-8 | 1,840 | 1.96875 | 2 | [] | no_license | package com.example.sebastianlimaco.inceptionserius.JavaModelling.Video;
import com.example.sebastianlimaco.inceptionserius.JavaModelling.Video.SubTreeFeedVideo.Items;
import com.example.sebastianlimaco.inceptionserius.JavaModelling.Video.SubTreeFeedVideo.PageInfo;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class FeedVideo {
@SerializedName("kind")
@Expose
private String kind;
@SerializedName("etag")
@Expose
private String etag;
//@SerializedName("nextPageToken")
//@Expose
//private String nextPageToken;
//@SerializedName("regionCode")
//@Expose
//private String regionCode;
@SerializedName("pageInfo")
@Expose
private PageInfo pageInfo;
@SerializedName("items")
@Expose
private ArrayList<Items> items;
//kind": "youtube#searchListResponse",
//"etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/rAFrEdyR2Fmf8ASi4_rNda6FN2U\"",
//"nextPageToken": "CAoQAA",
//"regionCode": "CH",
//"pageInfo": {
// "totalResults": 276553,
// "resultsPerPage": 10},
//"items": [...]
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getEtag() {
return etag;
}
public void setEtag(String etag) {
this.etag = etag;
}
public ArrayList<Items> getItems() {
return items;
}
public void setItems(ArrayList<Items> items) {
this.items = items;
}
@Override
public String toString() {
return "FeedVideo{" +
"kind='" + kind + '\'' +
", etag='" + etag + '\'' +
", pageInfo=" + pageInfo +
", items=" + items +
'}';
}
} | true |
f78a187b45008cba85e1d5a1bc1253b90a631e36 | Java | googleapis/google-api-java-client-services | /clients/google-api-services-contentwarehouse/v1/2.0.0/com/google/api/services/contentwarehouse/v1/model/RegistrationInfo.java | UTF-8 | 3,804 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.contentwarehouse.v1.model;
/**
* Domain registration information for the document. NEXT ID TO USE: 3
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Document AI Warehouse API. For a detailed explanation
* see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class RegistrationInfo extends com.google.api.client.json.GenericJson {
/**
* This is the number of days since January 1st 1995 that this domain was last created. This
* should always fit in 15 bits.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Integer createdDate;
/**
* This is the number of days since January 1st 1995 that this domain last expired. This should
* always fit in 15 bits. Jan 1st 1995 was chosen by the history project as a special epoch date.
* Both the registrationinfo dates and the linkage dates are measured in days since this epoch.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Integer expiredDate;
/**
* This is the number of days since January 1st 1995 that this domain was last created. This
* should always fit in 15 bits.
* @return value or {@code null} for none
*/
public java.lang.Integer getCreatedDate() {
return createdDate;
}
/**
* This is the number of days since January 1st 1995 that this domain was last created. This
* should always fit in 15 bits.
* @param createdDate createdDate or {@code null} for none
*/
public RegistrationInfo setCreatedDate(java.lang.Integer createdDate) {
this.createdDate = createdDate;
return this;
}
/**
* This is the number of days since January 1st 1995 that this domain last expired. This should
* always fit in 15 bits. Jan 1st 1995 was chosen by the history project as a special epoch date.
* Both the registrationinfo dates and the linkage dates are measured in days since this epoch.
* @return value or {@code null} for none
*/
public java.lang.Integer getExpiredDate() {
return expiredDate;
}
/**
* This is the number of days since January 1st 1995 that this domain last expired. This should
* always fit in 15 bits. Jan 1st 1995 was chosen by the history project as a special epoch date.
* Both the registrationinfo dates and the linkage dates are measured in days since this epoch.
* @param expiredDate expiredDate or {@code null} for none
*/
public RegistrationInfo setExpiredDate(java.lang.Integer expiredDate) {
this.expiredDate = expiredDate;
return this;
}
@Override
public RegistrationInfo set(String fieldName, Object value) {
return (RegistrationInfo) super.set(fieldName, value);
}
@Override
public RegistrationInfo clone() {
return (RegistrationInfo) super.clone();
}
}
| true |
d396291eff8e926e96cc5ee37439c89569b8b7c0 | Java | tanoss/test | /src/main/java/ec/com/informega/prueba/dao/implement/SecuenciaImplement.java | UTF-8 | 1,239 | 1.929688 | 2 | [] | no_license | package ec.com.informega.prueba.dao.implement;
import ec.com.informega.prueba.dao.SecuencialRepository;
import ec.com.informega.prueba.model.Secuencial;
import ec.com.informega.prueba.service.SecuencialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
@Service
@Transactional
public class SecuenciaImplement implements SecuencialService {
@Autowired
private SecuencialRepository secue;
@Override
public Secuencial getSecuencial(Long id) {
return null;
}
@Override
public List<Secuencial> getAllSecuencial() {
return null;
}
@Override
public String saveSecuencial(Secuencial secuencial) {
return null;
}
@Override
public String editSecuencial(Secuencial secuencial) {
return null;
}
@Override
public String deleteSecuencial(Long id) {
return null;
}
@Override
public Secuencial findSecuencial(Long id) {
return null;
}
@Override
public Secuencial findSecuencialbyId(Long id) {
return null;
}
}
| true |
c064c40d545373d1202e3d0f9d75580ff0cf33ce | Java | jgmatu/PL | /Compilador/src/com/urjc/master/semv/cup/parser.java | WINDOWS-1250 | 71,098 | 1.820313 | 2 | [] | no_license |
//----------------------------------------------------
// The following code was generated by CUP v0.11b 20160615 (GIT 4ac7450)
//----------------------------------------------------
package com.urjc.master.semv.cup;
import java_cup.runtime.Symbol;
import com.urjc.master.semv.types.Type;
import com.urjc.master.semv.ambito.Ambito;
import com.urjc.master.semv.commands.Command;
import com.urjc.master.semv.commands.Function;
import com.urjc.master.semv.commands.Variable;
import com.urjc.master.semv.enums.EnumType;
import com.urjc.master.semv.list.Lid;
import com.urjc.master.semv.list.ListParams;
import com.urjc.master.semv.types.TupleTypes;
import com.urjc.master.semv.includes.File;
import com.urjc.master.semv.includes.Include;
import com.urjc.master.semv.commands.Parametro;
import com.urjc.master.semv.operadores.Operador;
import java_cup.runtime.XMLElement;
/** CUP v0.11b 20160615 (GIT 4ac7450) generated parser.
*/
@SuppressWarnings({"rawtypes"})
public class parser extends java_cup.runtime.lr_parser {
public final Class getSymbolContainer() {
return sym.class;
}
/** Default constructor. */
@Deprecated
public parser() {super();}
/** Constructor which sets the default scanner. */
@Deprecated
public parser(java_cup.runtime.Scanner s) {super(s);}
/** Constructor which sets the default scanner. */
public parser(java_cup.runtime.Scanner s, java_cup.runtime.SymbolFactory sf) {super(s,sf);}
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\104\000\002\004\005\000\002\002\004\000\002\004" +
"\004\000\002\004\004\000\002\004\003\000\002\002\004" +
"\000\002\002\003\000\002\003\005\000\002\005\004\000" +
"\002\026\002\000\002\017\010\000\002\027\002\000\002" +
"\017\010\000\002\016\006\000\002\016\004\000\002\016" +
"\002\000\002\006\005\000\002\007\004\000\002\007\003" +
"\000\002\030\002\000\002\010\006\000\002\010\006\000" +
"\002\010\007\000\002\010\005\000\002\031\002\000\002" +
"\010\012\000\002\032\002\000\002\025\005\000\002\025" +
"\002\000\002\033\002\000\002\010\020\000\002\034\002" +
"\000\002\010\010\000\002\035\002\000\002\010\011\000" +
"\002\036\002\000\002\010\004\000\002\010\003\000\002" +
"\015\003\000\002\015\005\000\002\015\002\000\002\011" +
"\005\000\002\011\005\000\002\011\003\000\002\012\005" +
"\000\002\012\005\000\002\012\003\000\002\013\006\000" +
"\002\037\002\000\002\013\006\000\002\013\003\000\002" +
"\013\003\000\002\013\003\000\002\014\003\000\002\014" +
"\003\000\002\014\003\000\002\020\005\000\002\020\003" +
"\000\002\021\005\000\002\021\003\000\002\022\003\000" +
"\002\022\004\000\002\023\005\000\002\024\003\000\002" +
"\024\003\000\002\024\003\000\002\024\003\000\002\024" +
"\003" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\206\000\012\041\006\045\011\046\010\047\014\001" +
"\002\000\004\002\210\001\002\000\014\002\ufffd\041\006" +
"\045\011\046\010\047\014\001\002\000\004\042\205\001" +
"\002\000\012\041\006\045\ufffb\046\ufffb\047\ufffb\001\002" +
"\000\006\014\uffcb\050\uffcb\001\002\000\006\014\uffcc\050" +
"\uffcc\001\002\000\004\050\020\001\002\000\010\045\011" +
"\046\010\047\014\001\002\000\006\014\uffca\050\uffca\001" +
"\002\000\014\002\uffff\041\006\045\011\046\010\047\014" +
"\001\002\000\004\002\001\001\002\000\014\002\ufff9\041" +
"\ufff9\045\ufff9\046\ufff9\047\ufff9\001\002\000\004\005\021" +
"\001\002\000\014\006\ufff2\013\ufff2\045\023\046\010\047" +
"\014\001\002\000\006\006\ufff8\013\176\001\002\000\006" +
"\006\ufff6\050\uffcc\001\002\000\004\050\025\001\002\000" +
"\006\006\ufff3\013\ufff3\001\002\000\004\006\027\001\002" +
"\000\004\007\030\001\002\000\030\004\042\007\uffde\014" +
"\035\022\032\025\033\026\043\027\041\045\011\046\010" +
"\047\014\050\034\001\002\000\014\002\ufff5\041\ufff5\045" +
"\ufff5\046\ufff5\047\ufff5\001\002\000\004\005\164\001\002" +
"\000\004\005\147\001\002\000\006\005\141\015\140\001" +
"\002\000\032\004\uffdc\007\uffdc\010\uffdc\014\uffdc\022\uffdc" +
"\025\uffdc\026\uffdc\027\uffdc\045\uffdc\046\uffdc\047\uffdc\050" +
"\uffdc\001\002\000\032\004\042\007\uffde\010\137\014\035" +
"\022\032\025\033\026\043\027\041\045\011\046\010\047" +
"\014\050\034\001\002\000\032\004\uffef\007\uffef\010\uffef" +
"\014\uffef\022\uffef\025\uffef\026\uffef\027\uffef\045\uffef\046" +
"\uffef\047\uffef\050\uffef\001\002\000\006\014\uffd9\050\117" +
"\001\002\000\004\007\uffe0\001\002\000\012\011\057\043" +
"\052\044\047\050\051\001\002\000\004\005\046\001\002" +
"\000\004\007\030\001\002\000\032\004\uffdd\007\uffdd\010" +
"\uffdd\014\uffdd\022\uffdd\025\uffdd\026\uffdd\027\uffdd\045\uffdd" +
"\046\uffdd\047\uffdd\050\uffdd\001\002\000\014\011\057\031" +
"\061\043\052\044\047\050\051\001\002\000\036\006\uffcd" +
"\012\uffcd\014\uffcd\016\uffcd\017\uffcd\020\uffcd\021\uffcd\032" +
"\uffcd\033\uffcd\034\uffcd\035\uffcd\036\uffcd\037\uffcd\040\uffcd" +
"\001\002\000\012\006\uffc6\014\uffc6\032\uffc6\033\uffc6\001" +
"\002\000\040\005\115\006\uffcf\012\uffcf\014\uffcf\016\uffcf" +
"\017\uffcf\020\uffcf\021\uffcf\032\uffcf\033\uffcf\034\uffcf\035" +
"\uffcf\036\uffcf\037\uffcf\040\uffcf\001\002\000\036\006\uffce" +
"\012\uffce\014\uffce\016\uffce\017\uffce\020\uffce\021\uffce\032" +
"\uffce\033\uffce\034\uffce\035\uffce\036\uffce\037\uffce\040\uffce" +
"\001\002\000\036\006\uffd3\012\uffd3\014\uffd3\016\uffd3\017" +
"\uffd3\020\uffd3\021\uffd3\032\uffd3\033\uffd3\034\uffd3\035\uffd3" +
"\036\uffd3\037\uffd3\040\uffd3\001\002\000\012\006\uffc5\014" +
"\uffc5\032\uffc5\033\uffc5\001\002\000\012\006\uffc8\014\uffc8" +
"\032\070\033\uffc8\001\002\000\036\006\uffd6\012\uffd6\014" +
"\uffd6\016\uffd6\017\uffd6\020\104\021\105\032\uffd6\033\uffd6" +
"\034\uffd6\035\uffd6\036\uffd6\037\uffd6\040\uffd6\001\002\000" +
"\012\011\057\043\052\044\047\050\051\001\002\000\020" +
"\016\100\017\075\034\076\035\073\036\101\037\077\040" +
"\102\001\002\000\012\011\057\043\052\044\047\050\051" +
"\001\002\000\006\006\064\033\063\001\002\000\014\011" +
"\057\031\061\043\052\044\047\050\051\001\002\000\004" +
"\007\uffe2\001\002\000\004\007\030\001\002\000\032\004" +
"\uffe1\007\uffe1\010\uffe1\014\uffe1\022\uffe1\025\uffe1\026\uffe1" +
"\027\uffe1\045\uffe1\046\uffe1\047\uffe1\050\uffe1\001\002\000" +
"\012\006\uffc9\014\uffc9\032\070\033\uffc9\001\002\000\014" +
"\011\057\031\061\043\052\044\047\050\051\001\002\000" +
"\012\006\uffc7\014\uffc7\032\uffc7\033\uffc7\001\002\000\012" +
"\006\uffc4\014\uffc4\032\uffc4\033\uffc4\001\002\000\012\011" +
"\uffc1\043\uffc1\044\uffc1\050\uffc1\001\002\000\012\011\057" +
"\043\052\044\047\050\051\001\002\000\012\011\057\043" +
"\052\044\047\050\051\001\002\000\012\011\uffc2\043\uffc2" +
"\044\uffc2\050\uffc2\001\002\000\012\011\uffbe\043\uffbe\044" +
"\uffbe\050\uffbe\001\002\000\012\011\057\043\052\044\047" +
"\050\051\001\002\000\012\011\uffc0\043\uffc0\044\uffc0\050" +
"\uffc0\001\002\000\012\011\uffbf\043\uffbf\044\uffbf\050\uffbf" +
"\001\002\000\036\006\uffd8\012\uffd8\014\uffd8\016\uffd8\017" +
"\uffd8\020\104\021\105\032\uffd8\033\uffd8\034\uffd8\035\uffd8" +
"\036\uffd8\037\uffd8\040\uffd8\001\002\000\012\011\057\043" +
"\052\044\047\050\051\001\002\000\012\011\057\043\052" +
"\044\047\050\051\001\002\000\036\006\uffd4\012\uffd4\014" +
"\uffd4\016\uffd4\017\uffd4\020\uffd4\021\uffd4\032\uffd4\033\uffd4" +
"\034\uffd4\035\uffd4\036\uffd4\037\uffd4\040\uffd4\001\002\000" +
"\036\006\uffd5\012\uffd5\014\uffd5\016\uffd5\017\uffd5\020\uffd5" +
"\021\uffd5\032\uffd5\033\uffd5\034\uffd5\035\uffd5\036\uffd5\037" +
"\uffd5\040\uffd5\001\002\000\036\006\uffd7\012\uffd7\014\uffd7" +
"\016\uffd7\017\uffd7\020\104\021\105\032\uffd7\033\uffd7\034" +
"\uffd7\035\uffd7\036\uffd7\037\uffd7\040\uffd7\001\002\000\016" +
"\006\uffc3\014\uffc3\016\100\017\075\032\uffc3\033\uffc3\001" +
"\002\000\010\012\uffd1\016\100\017\075\001\002\000\004" +
"\012\114\001\002\000\036\006\uffd0\012\uffd0\014\uffd0\016" +
"\uffd0\017\uffd0\020\uffd0\021\uffd0\032\uffd0\033\uffd0\034\uffd0" +
"\035\uffd0\036\uffd0\037\uffd0\040\uffd0\001\002\000\006\006" +
"\uffd9\050\117\001\002\000\004\006\122\001\002\000\010" +
"\006\uffdb\013\120\014\uffdb\001\002\000\010\006\uffd9\014" +
"\uffd9\050\117\001\002\000\006\006\uffda\014\uffda\001\002" +
"\000\036\006\uffd2\012\uffd2\014\uffd2\016\uffd2\017\uffd2\020" +
"\uffd2\021\uffd2\032\uffd2\033\uffd2\034\uffd2\035\uffd2\036\uffd2" +
"\037\uffd2\040\uffd2\001\002\000\010\014\124\016\100\017" +
"\075\001\002\000\032\004\uffea\007\uffea\010\uffea\014\uffea" +
"\022\uffea\025\uffea\026\uffea\027\uffea\045\uffea\046\uffea\047" +
"\uffea\050\uffea\001\002\000\004\007\030\001\002\000\004" +
"\030\127\001\002\000\004\005\130\001\002\000\014\011" +
"\057\031\061\043\052\044\047\050\051\001\002\000\006" +
"\006\132\033\063\001\002\000\032\004\uffdf\007\uffdf\010" +
"\uffdf\014\uffdf\022\uffdf\025\uffdf\026\uffdf\027\uffdf\045\uffdf" +
"\046\uffdf\047\uffdf\050\uffdf\001\002\000\004\014\uffee\001" +
"\002\000\004\014\135\001\002\000\032\004\uffed\007\uffed" +
"\010\uffed\014\uffed\022\uffed\025\uffed\026\uffed\027\uffed\045" +
"\uffed\046\uffed\047\uffed\050\uffed\001\002\000\032\004\ufff0" +
"\007\ufff0\010\ufff0\014\ufff0\022\ufff0\025\ufff0\026\ufff0\027" +
"\ufff0\045\ufff0\046\ufff0\047\ufff0\050\ufff0\001\002\000\042" +
"\002\ufff1\004\ufff1\007\ufff1\010\ufff1\014\ufff1\022\ufff1\024" +
"\ufff1\025\ufff1\026\ufff1\027\ufff1\030\ufff1\041\ufff1\045\ufff1" +
"\046\ufff1\047\ufff1\050\ufff1\001\002\000\012\011\057\043" +
"\052\044\047\050\051\001\002\000\006\006\uffd9\050\117" +
"\001\002\000\004\006\143\001\002\000\004\014\144\001" +
"\002\000\032\004\uffeb\007\uffeb\010\uffeb\014\uffeb\022\uffeb" +
"\025\uffeb\026\uffeb\027\uffeb\045\uffeb\046\uffeb\047\uffeb\050" +
"\uffeb\001\002\000\010\014\146\016\100\017\075\001\002" +
"\000\032\004\uffec\007\uffec\010\uffec\014\uffec\022\uffec\025" +
"\uffec\026\uffec\027\uffec\045\uffec\046\uffec\047\uffec\050\uffec" +
"\001\002\000\004\050\150\001\002\000\004\015\151\001" +
"\002\000\012\011\057\043\052\044\047\050\051\001\002" +
"\000\010\014\153\016\100\017\075\001\002\000\014\011" +
"\057\031\061\043\052\044\047\050\051\001\002\000\006" +
"\014\155\033\063\001\002\000\004\050\156\001\002\000" +
"\004\015\157\001\002\000\012\011\057\043\052\044\047" +
"\050\051\001\002\000\010\006\161\016\100\017\075\001" +
"\002\000\004\007\uffe4\001\002\000\004\007\030\001\002" +
"\000\032\004\uffe3\007\uffe3\010\uffe3\014\uffe3\022\uffe3\025" +
"\uffe3\026\uffe3\027\uffe3\045\uffe3\046\uffe3\047\uffe3\050\uffe3" +
"\001\002\000\014\011\057\031\061\043\052\044\047\050" +
"\051\001\002\000\006\006\166\033\063\001\002\000\004" +
"\023\167\001\002\000\004\007\uffe9\001\002\000\004\007" +
"\030\001\002\000\034\004\uffe5\007\uffe5\010\uffe5\014\uffe5" +
"\022\uffe5\024\172\025\uffe5\026\uffe5\027\uffe5\045\uffe5\046" +
"\uffe5\047\uffe5\050\uffe5\001\002\000\004\007\uffe7\001\002" +
"\000\032\004\uffe8\007\uffe8\010\uffe8\014\uffe8\022\uffe8\025" +
"\uffe8\026\uffe8\027\uffe8\045\uffe8\046\uffe8\047\uffe8\050\uffe8" +
"\001\002\000\004\007\030\001\002\000\032\004\uffe6\007" +
"\uffe6\010\uffe6\014\uffe6\022\uffe6\025\uffe6\026\uffe6\027\uffe6" +
"\045\uffe6\046\uffe6\047\uffe6\050\uffe6\001\002\000\010\045" +
"\011\046\010\047\014\001\002\000\004\006\200\001\002" +
"\000\004\007\030\001\002\000\014\002\ufff7\041\ufff7\045" +
"\ufff7\046\ufff7\047\ufff7\001\002\000\004\050\203\001\002" +
"\000\006\006\ufff4\013\ufff4\001\002\000\010\045\ufffc\046" +
"\ufffc\047\ufffc\001\002\000\004\014\206\001\002\000\012" +
"\041\ufffa\045\ufffa\046\ufffa\047\ufffa\001\002\000\004\002" +
"\ufffe\001\002\000\004\002\000\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\206\000\014\002\012\003\006\004\003\005\004\014" +
"\011\001\001\000\002\001\001\000\014\002\012\003\006" +
"\004\206\005\004\014\011\001\001\000\002\001\001\000" +
"\006\002\203\003\006\001\001\000\002\001\001\000\002" +
"\001\001\000\004\017\016\001\001\000\006\005\014\014" +
"\011\001\001\000\002\001\001\000\014\002\012\003\006" +
"\004\015\005\004\014\011\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\006\014\023\016\021" +
"\001\001\000\004\026\176\001\001\000\004\027\025\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\004\006\030\001\001\000\012\007\035\010\036\014" +
"\037\036\043\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\010\010\135\014\037\036\043\001\001\000\002\001\001" +
"\000\004\015\132\001\001\000\004\035\124\001\001\000" +
"\010\011\122\012\055\013\052\001\001\000\002\001\001" +
"\000\004\006\044\001\001\000\002\001\001\000\020\011" +
"\057\012\055\013\052\020\061\021\054\022\047\023\053" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\010\011\111\012" +
"\055\013\052\001\001\000\004\024\073\001\001\000\012" +
"\011\057\012\055\013\052\023\071\001\001\000\002\001" +
"\001\000\016\011\057\012\055\013\052\021\066\022\047" +
"\023\053\001\001\000\004\034\064\001\001\000\004\006" +
"\065\001\001\000\002\001\001\000\002\001\001\000\014" +
"\011\057\012\055\013\052\022\070\023\053\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\010" +
"\011\110\012\055\013\052\001\001\000\006\012\107\013" +
"\052\001\001\000\002\001\001\000\002\001\001\000\006" +
"\012\102\013\052\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\004\013\106\001\001\000\004" +
"\013\105\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\004\037\112\001\001" +
"\000\002\001\001\000\002\001\001\000\004\015\115\001" +
"\001\000\002\001\001\000\002\001\001\000\004\015\120" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\004\006\125\001\001\000\002" +
"\001\001\000\002\001\001\000\020\011\057\012\055\013" +
"\052\020\130\021\054\022\047\023\053\001\001\000\002" +
"\001\001\000\002\001\001\000\004\030\133\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\010\011\144\012\055\013\052\001\001\000" +
"\004\015\141\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\010\011\151\012\055" +
"\013\052\001\001\000\002\001\001\000\020\011\057\012" +
"\055\013\052\020\153\021\054\022\047\023\053\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\010\011\157\012\055\013\052\001\001\000\002\001\001" +
"\000\004\033\161\001\001\000\004\006\162\001\001\000" +
"\002\001\001\000\020\011\057\012\055\013\052\020\164" +
"\021\054\022\047\023\053\001\001\000\002\001\001\000" +
"\002\001\001\000\004\031\167\001\001\000\004\006\170" +
"\001\001\000\004\025\172\001\001\000\004\032\173\001" +
"\001\000\002\001\001\000\004\006\174\001\001\000\002" +
"\001\001\000\004\014\201\001\001\000\002\001\001\000" +
"\004\006\200\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001" });
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
private Ambito root;
private Ambito actual;
/* Es un metodo que el cual se llama automaticamente al haber un error en la gramatica,
con el que informamos de la linea y la columna en el que se encuentra dicho error.*/
@Override
public void syntax_error(Symbol s) {
int l = s.left + 1;
int c = s.right + 1;
report_error("El String: '" + s.value + "' ha producido un error en la linea " + l + ", columna " + c + ".\n", null);
}
/** Cup generated class to encapsulate user supplied action code.*/
@SuppressWarnings({"rawtypes", "unchecked", "unused"})
class CUP$parser$actions {
private Ambito root = new Ambito();
private Ambito actual = this.root;
private Function function = null;
private void idNotExist(String id, int line) {
System.out.println("Line: " + line + " El identificador \"" + id + "\" no existe.");
}
private Type getTypeOperation(Operador op, Type type1, Type type2, int line) {
Type type = new Type();
if (type1.isError() || type2.isError()) {
return type;
}
if (type1.equals(type2)) {
type = type1;
} else {
System.err.println("Line: " + line + " Incompatible types " + type1.toString() + " " + op.toString() + " " + type2.toString());
}
return type;
}
private Type getTypeCallFunction(String id, Lid lid, int line) {
Function func = null;
Command cmd = null;
Type type = new Type();
cmd = this.actual.buscar(id);
if (cmd == null && !(cmd instanceof Function)) {
System.err.println("Line:" + line + " La funcion \"" + id + "\" no existe");
} else {
func = (Function) cmd;
type = cmd.getTipo();
}
if (func != null && !type.isError()) {
TupleTypes idTypes_1 = func.getListParamsTypes();
TupleTypes idTypes_2 = this.actual.buscaIdsType(lid);
boolean success = idTypes_1.compare(idTypes_2);
if (!success) {
func.usage(idTypes_1, idTypes_2, line);
type.setError();
}
}
return type;
}
private Type getAssignType(String id, Type exp, int line) {
Command cmd = this.actual.buscar(id);
Type type = new Type();
if (cmd != null && !exp.isError()) {
Operador op = new Operador("=");
type = getTypeOperation(op, cmd.tipo(), exp, line);
} else if (cmd == null) {
idNotExist(id, line);
}
return type;
}
private final parser parser;
/** Constructor */
CUP$parser$actions(parser parser) {
this.parser = parser;
}
/** Method 0 with the actual generated action code for actions 0 to 300. */
public final java_cup.runtime.Symbol CUP$parser$do_action_part00000000(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // PROGRAM ::= INCLUDE PART PROGRAM
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("PROGRAM",2, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= PROGRAM EOF
{
Object RESULT =null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // PROGRAM ::= INCLUDE PART
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("PROGRAM",2, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // PROGRAM ::= PART PROGRAM
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("PROGRAM",2, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // PROGRAM ::= PART
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("PROGRAM",2, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // INCLUDE ::= FILE INCLUDE
{
Include RESULT =null;
int fileleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int fileright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
File file = (File)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
Include include = new Include(file);
include.include(this.root);
CUP$parser$result = parser.getSymbolFactory().newSymbol("INCLUDE",0, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // INCLUDE ::= FILE
{
Include RESULT =null;
int fileleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int fileright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
File file = (File)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Include include = new Include(file);
include.include(this.root);
CUP$parser$result = parser.getSymbolFactory().newSymbol("INCLUDE",0, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // FILE ::= include hfile semicolon
{
File RESULT =null;
int fileleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int fileright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
String file = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = new File(file);
CUP$parser$result = parser.getSymbolFactory().newSymbol("FILE",1, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // PART ::= TYPE RESTPART
{
Object RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int commandleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int commandright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Command command = (Command)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
if (function != null) {
function.insertarTipo(type);
function.checkReturnType(type, typeleft + 1);
}
this.actual = this.root;
function = null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("PART",3, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // NT$0 ::=
{
Command RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int listleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int listright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
ListParams list = (ListParams)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
function = this.root.insertarFuncion(idLexema);
if (function != null) {
this.actual = function.getAmbito();
function.insertarParametros(list, listleft + 1);
}
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$0",20, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // RESTPART ::= tid l_par LISTPARAM NT$0 r_par BLQ
{
Command RESULT =null;
// propagate RESULT from NT$0
RESULT = (Command) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value;
int listleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int listright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
ListParams list = (ListParams)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int typesleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typesright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
TupleTypes types = (TupleTypes)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
if (function != null) {
function.insertReturnTypes(types);
}
CUP$parser$result = parser.getSymbolFactory().newSymbol("RESTPART",13, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // NT$1 ::=
{
Command RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
function = this.root.insertarFuncion(idLexema);
if (function != null) {
this.actual = function.getAmbito();
}
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$1",21, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // RESTPART ::= tid l_par tvoid NT$1 r_par BLQ
{
Command RESULT =null;
// propagate RESULT from NT$1
RESULT = (Command) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value;
int typesleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typesright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
TupleTypes types = (TupleTypes)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
if (function != null) {
function.insertReturnTypes(types);
}
CUP$parser$result = parser.getSymbolFactory().newSymbol("RESTPART",13, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // LISTPARAM ::= LISTPARAM comma TYPE tid
{
ListParams RESULT =null;
int listparamsleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int listparamsright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
ListParams listparams = (ListParams)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int idright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
listparams.insertar(new Parametro(id, type));
RESULT = listparams;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LISTPARAM",12, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // LISTPARAM ::= TYPE tid
{
ListParams RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int idright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
ListParams listparams = new ListParams();
listparams.insertar(new Parametro(id, type));
RESULT = listparams;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LISTPARAM",12, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // LISTPARAM ::=
{
ListParams RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LISTPARAM",12, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 16: // BLQ ::= l_brace SENTLIST r_brace
{
TupleTypes RESULT =null;
int typesleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typesright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
TupleTypes types = (TupleTypes)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
if (this.actual.getFather() != null) {
this.actual = this.actual.getFather();
} else {
this.actual = this.root;
}
RESULT = types;
CUP$parser$result = parser.getSymbolFactory().newSymbol("BLQ",4, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 17: // SENTLIST ::= SENTLIST SENT
{
TupleTypes RESULT =null;
int typesleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typesright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
TupleTypes types = (TupleTypes)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
types.insert(type);
RESULT = types;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENTLIST",5, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 18: // SENTLIST ::= SENT
{
TupleTypes RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
TupleTypes types = new TupleTypes();
types.insert(type);
RESULT = types;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENTLIST",5, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // NT$2 ::=
{
Type RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int lidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int lidright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Lid lid = (Lid)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
for(String id : lid.getList()) {
this.actual.insertaIdVariable(new Variable(id, type));
}
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$2",22, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // SENT ::= TYPE LID NT$2 semicolon
{
Type RESULT =null;
// propagate RESULT from NT$2
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int lidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int lidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Lid lid = (Lid)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 21: // SENT ::= tid assig EXP semicolon
{
Type RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int typeExpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeExpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type typeExp = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = getAssignType(idLexema, typeExp, idLexemaleft + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 22: // SENT ::= tid l_par LID r_par semicolon
{
Type RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value;
int lidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int lidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Lid lid = (Lid)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
Type type = new Type();
if (!getTypeCallFunction(idLexema, lid, lidleft + 1).isError()) {
type.setVoid();
}
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 23: // SENT ::= treturn EXP semicolon
{
Type RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
type.setReturn();
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 24: // NT$3 ::=
{
Type RESULT =null;
this.actual = new Ambito(this.actual);
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$3",23, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 25: // SENT ::= tif l_par LCOND r_par tthen NT$3 BLQ IF2
{
Type RESULT =null;
// propagate RESULT from NT$3
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 26: // NT$4 ::=
{
Object RESULT =null;
this.actual = new Ambito(this.actual);
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$4",24, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 27: // IF2 ::= telse NT$4 BLQ
{
Object RESULT =null;
// propagate RESULT from NT$4
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("IF2",19, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 28: // IF2 ::=
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("IF2",19, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 29: // NT$5 ::=
{
Type RESULT =null;
int idLexema1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-9)).left;
int idLexema1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-9)).right;
String idLexema1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-9)).value;
int exp1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)).left;
int exp1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)).right;
Type exp1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-7)).value;
int idLexema2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int idLexema2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
String idLexema2 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int exp2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int exp2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Type exp2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
Type type1 = getAssignType(idLexema1, exp1, idLexema1left + 1);
Type type2 = getAssignType(idLexema2, exp2, idLexema2left + 1);
if (type1.isError() || type2.isError()) {
RESULT = new Type();
}
RESULT = type1; // El tipo del for lo damos como el de la variable de incializacin...
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$5",25, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 30: // SENT ::= tfor l_par tid assig EXP semicolon LCOND semicolon tid assig EXP r_par NT$5 BLQ
{
Type RESULT =null;
// propagate RESULT from NT$5
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int idLexema1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-11)).left;
int idLexema1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-11)).right;
String idLexema1 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-11)).value;
int exp1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-9)).left;
int exp1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-9)).right;
Type exp1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-9)).value;
int idLexema2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left;
int idLexema2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right;
String idLexema2 = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value;
int exp2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int exp2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
Type exp2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-13)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 31: // NT$6 ::=
{
Type RESULT =null;
this.actual = new Ambito(this.actual);
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$6",26, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 32: // SENT ::= twhile l_par LCOND r_par NT$6 BLQ
{
Type RESULT =null;
// propagate RESULT from NT$6
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 33: // NT$7 ::=
{
Type RESULT =null;
this.actual = new Ambito(this.actual);
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$7",27, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 34: // SENT ::= tdo NT$7 BLQ tuntil l_par LCOND r_par
{
Type RESULT =null;
// propagate RESULT from NT$7
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 35: // NT$8 ::=
{
Type RESULT =null;
this.actual = new Ambito(this.actual);
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$8",28, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 36: // SENT ::= NT$8 BLQ
{
Type RESULT =null;
// propagate RESULT from NT$8
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 37: // SENT ::= semicolon
{
Type RESULT =null;
;
CUP$parser$result = parser.getSymbolFactory().newSymbol("SENT",6, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 38: // LID ::= tid
{
Lid RESULT =null;
int idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int idright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Lid lid = new Lid();
lid.add(id);
RESULT = lid;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LID",11, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 39: // LID ::= tid comma LID
{
Lid RESULT =null;
int idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
String id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int lidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int lidright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Lid lid = (Lid)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
lid.add(id);
RESULT = lid;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LID",11, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 40: // LID ::=
{
Lid RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LID",11, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 41: // EXP ::= EXP add EXPT
{
Type RESULT =null;
int type1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int type1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int type2left = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int type2right = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Operador op = new Operador(" + ");
RESULT = getTypeOperation(op, type1, type2, type1left + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXP",7, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 42: // EXP ::= EXP sub EXPT
{
Type RESULT =null;
int type1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int type1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int type2left = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int type2right = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Operador op = new Operador(" - ");
RESULT = getTypeOperation(op, type1, type2, type1left + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXP",7, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 43: // EXP ::= EXPT
{
Type RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXP",7, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 44: // EXPT ::= EXPT mul FACTOR
{
Type RESULT =null;
int type1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int type1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int type2left = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int type2right = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Operador op = new Operador(" x ");
RESULT = getTypeOperation(op, type1, type2, type1left + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXPT",8, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 45: // EXPT ::= EXPT div FACTOR
{
Type RESULT =null;
int type1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int type1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int type2left = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int type2right = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Operador op = new Operador(" / ");
RESULT = getTypeOperation(op, type1, type2, type1left + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXPT",8, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 46: // EXPT ::= FACTOR
{
Type RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("EXPT",8, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 47: // FACTOR ::= tid l_par LID r_par
{
Type RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int lidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int lidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Lid lid = (Lid)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = getTypeCallFunction(idLexema, lid, lidleft + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("FACTOR",9, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 48: // NT$9 ::=
{
Type RESULT =null;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("NT$9",29, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 49: // FACTOR ::= l_bracket EXP NT$9 r_bracket
{
Type RESULT =null;
// propagate RESULT from NT$9
RESULT = (Type) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int typeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int typeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = parser.getSymbolFactory().newSymbol("FACTOR",9, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 50: // FACTOR ::= tid
{
Type RESULT =null;
int idLexemaleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int idLexemaright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String idLexema = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
Type type = new Type();
Command cmd = this.actual.buscar(idLexema);
if (cmd == null) {
idNotExist(idLexema, (idLexemaleft + 1));
} else {
type = cmd.tipo();
}
RESULT = type;
CUP$parser$result = parser.getSymbolFactory().newSymbol("FACTOR",9, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 51: // FACTOR ::= constint
{
Type RESULT =null;
int vleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int vright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Object v = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = new Type(EnumType.INT, vleft);
CUP$parser$result = parser.getSymbolFactory().newSymbol("FACTOR",9, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 52: // FACTOR ::= constfloat
{
Type RESULT =null;
int vleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int vright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Object v = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = new Type(EnumType.FLOAT, vleft);
CUP$parser$result = parser.getSymbolFactory().newSymbol("FACTOR",9, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 53: // TYPE ::= tvoid
{
Type RESULT =null;
int vleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int vright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String v = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = new Type(EnumType.VOID, vleft);
CUP$parser$result = parser.getSymbolFactory().newSymbol("TYPE",10, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 54: // TYPE ::= tint
{
Type RESULT =null;
int ileft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int iright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String i = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = new Type(EnumType.INT, ileft);
CUP$parser$result = parser.getSymbolFactory().newSymbol("TYPE",10, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 55: // TYPE ::= tfloat
{
Type RESULT =null;
int fleft = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int fright = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
String f = (String)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = new Type(EnumType.FLOAT, fleft);
CUP$parser$result = parser.getSymbolFactory().newSymbol("TYPE",10, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 56: // LCOND ::= LCOND tor LCONDT
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCOND",14, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 57: // LCOND ::= LCONDT
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCOND",14, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 58: // LCONDT ::= LCONDT tand LCONDF
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCONDT",15, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 59: // LCONDT ::= LCONDF
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCONDT",15, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 60: // LCONDF ::= COND
{
Object RESULT =null;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCONDF",16, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 61: // LCONDF ::= tnot COND
{
Object RESULT =null;
;
CUP$parser$result = parser.getSymbolFactory().newSymbol("LCONDF",16, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 62: // COND ::= EXP OPR EXP
{
Object RESULT =null;
int type1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int type1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Type type1 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int opleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int opright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Operador op = (Operador)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int type2left = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).left;
int type2right = ((java_cup.runtime.Symbol)CUP$parser$stack.peek()).right;
Type type2 = (Type)((java_cup.runtime.Symbol) CUP$parser$stack.peek()).value;
RESULT = getTypeOperation(op, type1, type2, type1left + 1);
CUP$parser$result = parser.getSymbolFactory().newSymbol("COND",17, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 63: // OPR ::= equals
{
Operador RESULT =null;
RESULT = new Operador(" == ");
CUP$parser$result = parser.getSymbolFactory().newSymbol("OPR",18, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 64: // OPR ::= less
{
Operador RESULT =null;
RESULT = new Operador(" < ");
CUP$parser$result = parser.getSymbolFactory().newSymbol("OPR",18, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 65: // OPR ::= greater
{
Operador RESULT =null;
RESULT = new Operador(" > ");
CUP$parser$result = parser.getSymbolFactory().newSymbol("OPR",18, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 66: // OPR ::= greaterequal
{
Operador RESULT =null;
RESULT = new Operador(" >= ");
CUP$parser$result = parser.getSymbolFactory().newSymbol("OPR",18, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 67: // OPR ::= lessequal
{
Operador RESULT =null;
RESULT = new Operador(" <= ");
CUP$parser$result = parser.getSymbolFactory().newSymbol("OPR",18, ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), ((java_cup.runtime.Symbol)CUP$parser$stack.peek()), RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number "+CUP$parser$act_num+"found in internal parse table");
}
} /* end of method */
/** Method splitting the generated action code into several parts. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
return CUP$parser$do_action_part00000000(
CUP$parser$act_num,
CUP$parser$parser,
CUP$parser$stack,
CUP$parser$top);
}
}
}
| true |
808f01449501c88d72f7fd3c1857aa0e2b2cbce5 | Java | ralphbrodriguez/jworld-engine | /src/com/chrisali/openglworld/entities/Player.java | UTF-8 | 2,476 | 2.890625 | 3 | [] | no_license | package com.chrisali.openglworld.entities;
import org.lwjgl.input.Keyboard;
import org.lwjgl.util.vector.Vector3f;
import com.chrisali.openglworld.models.TexturedModel;
import com.chrisali.openglworld.renderengine.DisplayManager;
import com.chrisali.openglworld.terrain.Terrain;
public class Player extends Entity {
private static final float RUN_SPEED = 20;
private static final float TURN_SPEED = 160;
private static final float GRAVITY = -50;
private static final float JUMP_POWER = 30;
private float currentSpeed = 0;
private float currentVerticalSpeed = 0;
private float currentTurnSpeed = 0;
private boolean isAirborne = false;
public Player(TexturedModel model, Vector3f position, float rotX, float rotY, float rotZ, float scale) {
super(model, position, rotX, rotY, rotZ, scale);
}
public void move(Terrain[][] terrainArray) {
checkInputs();
super.increaseRotation(0, currentTurnSpeed * DisplayManager.getFrameTimeSeconds(), 0);
float distance = currentSpeed * DisplayManager.getFrameTimeSeconds();
float dx = distance * (float)Math.sin(Math.toRadians(super.getRotY()));
float dz = distance * (float)Math.cos(Math.toRadians(super.getRotY()));
super.increasePosition(dx, 0, dz);
currentVerticalSpeed += GRAVITY * DisplayManager.getFrameTimeSeconds();
super.increasePosition(0, currentVerticalSpeed * DisplayManager.getFrameTimeSeconds(), 0);
Terrain terrain = Terrain.getCurrentTerrain(terrainArray, super.getPosition().x, super.getPosition().z);
float terrainHeight = terrain.getTerrainHeight(super.getPosition().x, super.getPosition().z);
if (super.getPosition().y < terrainHeight) {
currentVerticalSpeed = 0;
isAirborne = false;
super.getPosition().y = terrainHeight;
}
}
private void jump() {
if(!isAirborne) {
this.currentVerticalSpeed = JUMP_POWER;
isAirborne = true;
}
}
private void checkInputs() {
if(Keyboard.isKeyDown(Keyboard.KEY_W)) {
this.currentSpeed = RUN_SPEED;
} else if(Keyboard.isKeyDown(Keyboard.KEY_S)) {
this.currentSpeed = -RUN_SPEED;
} else {
this.currentSpeed = 0;
}
if(Keyboard.isKeyDown(Keyboard.KEY_A)) {
this.currentTurnSpeed = TURN_SPEED;
} else if(Keyboard.isKeyDown(Keyboard.KEY_D)) {
this.currentTurnSpeed = -TURN_SPEED;
} else {
this.currentTurnSpeed = 0;
}
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE))
jump();
}
}
| true |
d93f3c25dfe5666f425bf8fe2843e73a4ea077af | Java | Cog-EduardM/java-homework | /src/com/example/homework/week5/Week5Homework.java | UTF-8 | 4,807 | 3.859375 | 4 | [] | no_license | package com.example.homework.week5;
import com.example.homework.Runnable;
import com.example.utils.HomeworkUtils;
public class Week5Homework extends HomeworkUtils implements Runnable {
public void runHomework() {
this.printHomeworkHeading(5);
this.printExerciseHeading("Quick Test");
runScriptedScenario();
this.printExerciseHeading("Random Scenario");
runRandomizedScenario();
this.printExerciseHeading("100 Random Scenarios");
runGames(100);
}
/**
* runs {@link #runRandomizedScenario()} the specified number of times and prints the final score.
*
* @param iterations The number of games to be run.
*/
private void runGames(int iterations) {
int alienScore = 0, humanScore = 0;
for (int i = 0; i < iterations; i++) {
System.out.println("\n\nGAME " + (i+1));
System.out.println("--------");
int[] result = runRandomizedScenario();
alienScore += result[0];
humanScore += result[1];
}
System.out.println("\nScore after " + iterations + " games: Aliens " + alienScore + "-" + humanScore + " Humans.");
}
/**
* Method implements homework requirements:
* <hr></hr>
*
* <strong>1.</strong> Create two objects: {@link Human} and {@link Alien}
* <p></p>
* <strong>2.</strong> Alien bites human 1 time.
* Print human health and alien energy before and after this operation
* <p></p>
* <strong>3.</strong> Human shoots an alien 2 times.
* Print alien health and human ammo before and after this operation
*/
private void runScriptedScenario() {
//1
Human h1 = new Human();
Alien a1 = new Alien();
//2
this.printExerciseHeading("2. Alien bites Human once");
System.out.println("Before - Human h1 health: " + h1.getHealth() + ", Alien a1 energy: " + a1.getEnergy());
a1.biteHuman(h1);
System.out.println("After - Human h1 health: " + h1.getHealth() + ", Alien a1 energy: " + a1.getEnergy());
//3
this.printExerciseHeading("3. Human shoots Alien twice");
System.out.println("Before - Alien a1 health: " + a1.getHealth() + ", Human h1 ammo: " + h1.getAmmo());
h1.shootAlien(a1);
System.out.println("After 1 shot - Alien a1 health: " + a1.getHealth() + ", Human h1 ammo: " + h1.getAmmo());
h1.shootAlien(a1);
System.out.println("After 2 shots - Alien a1 health: " + a1.getHealth() + ", Human h1 ammo: " + h1.getAmmo());
}
/**
* Method creates one {@link Human} and one {@link Alien},
* then runs the game until one of the Characters is dead.
* <p></p>
* Each turn, it'll randomly decide which character attacks.
*
* @return a string of two integers: first is Aliens's score, the second is Human's score
*/
private int[] runRandomizedScenario() {
Human h2 = new Human();
Alien a2 = new Alien();
int turnNo = 0;
while (opponentsAreAlive(a2, h2) && opponentsCanAttack(a2, h2)) {
System.out.println("\nTurn " + ++turnNo);
System.out.println("Before attack - Human h2 (" + h2.getInfo() + ") Alien a2 (" + a2.getInfo() + ")");
boolean humanTurn = this.generateRandomNumberInRange(0,1) == 1;
if (humanTurn) {
System.out.println(" ...Human h2 shoots Alien a2.");
h2.shootAlien(a2);
} else {
System.out.println(" ...Alien a2 bites Human h2.");
a2.biteHuman(h2);
}
System.out.println("After attack - Human h2 (" + h2.getInfo() + ") Alien a2 (" + a2.getInfo() + ")");
}
if(h2.isDead()) {
System.out.println("\nTurn " + turnNo + ": Human h2 died; Alien a2 wins. Game Over.");
return new int[] {1, 0};
}
if(a2.isDead()) {
System.out.println("\nTurn " + turnNo + ": Alien a2 died. Human h2 wins. Game Over.");
return new int[] {0, 1};
}
return new int[] {0,0};
}
/**
*
* @param a {@link Alien} player to be checked
* @param h {@link Human} player to be checked
* @return <strong>true</strong> - if both players are alive
*/
private static boolean opponentsAreAlive(Alien a, Human h) {
return !a.isDead() && !h.isDead();
}
/**
*
* @param a {@link Alien} player to be checked
* @param h {@link Human} player to be checked
* @return <strong>true</strong> - if at least one player can attack
*/
private static boolean opponentsCanAttack(Alien a, Human h) {
return a.getEnergy() > 0 || h.getAmmo() > 0;
}
}
| true |
d073ef1c49dd134197bf076d9610beb56e4cce87 | Java | CodeMechanix/JUnit-TestCase | /src/main/java/com/rashed/testcaseproject/model/Office.java | UTF-8 | 718 | 1.898438 | 2 | [] | no_license | package com.rashed.testcaseproject.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import lombok.experimental.Accessors;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "offices")
@JsonInclude(JsonInclude.Include.NON_NULL)
@Getter
@Setter
@NoArgsConstructor
@RequiredArgsConstructor
@Accessors(chain = true)
public class Office extends AbstractEntityStringId<Office> implements Serializable {
private static final long serialVersionUID = 31664096368957957L;
@NonNull
String name;
String layer;
String division;
String ministry;
String address;
}
| true |
30be02180b916814ac44377f6d452a54962ffcfb | Java | op1995/OOP-Ex3-Pacman | /src/gameClient/Robot.java | UTF-8 | 3,470 | 2.921875 | 3 | [] | no_license | package gameClient;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;
import dataStructure.*;
import utils.Point3D;
public class Robot extends Thread{
private int id;
private double value; // Gained value of acquired fruits.
private int src; //current node (location)
private int dest; //current final node to get to
private double speed;
private Point3D position; // based on pos.
private boolean isEating;
public ArrayList<node_data> PathToFruit;
public boolean addedAnotherFruitToMyPath = false;
/**
* A constructor.
* @param Json A JSON String that represents the robot.
*/
public Robot(String Json) {
try {
JSONObject g = new JSONObject(Json);
this.id = g.getJSONObject("Robot").getInt("id");
String pos = g.getJSONObject("Robot").getString("pos");
this.position = new Point3D(pos);
this.value = g.getJSONObject("Robot").getDouble("value");
this.src = g.getJSONObject("Robot").getInt("src");
this.dest = g.getJSONObject("Robot").getInt("dest");
this.speed = g.getJSONObject("Robot").getDouble("speed");
this.isEating = false;
this.PathToFruit = new ArrayList<node_data>();
} catch (Exception e) {System.out.println(e);}
}
/**
* A getter for the ID of this Robot.
* @return ID of this Robot.
*/
public int getID() {
return this.id;
}
/**
* A setter for the source node id of this Robot.
* @param src id of the source node.
*/
public void setSrc(int src) {
this.src = src;
}
/**
* A getter for the source node id of this Robot.
* @return id of the source node.
*/
public int getSrc() {
return this.src;
}
/**
* A setter for the destination node of this Robot.
* @param dest The key of the destination node of this Robot.
*/
public void setDest(int dest) {
this.dest = dest;
}
/**
* A getter for the key of the destination node of this Robot.
* @return key of the destination node of this Robot.
*/
public int getDest() {
return this.dest;
}
/**
* A setter for the speed of this robot.
* @param speed The speed of this robot.
*/
public void setSpeed(double speed) {
this.speed = speed;
}
/**
* A getter for the speed of this robot.
* @return The speed of this robot.
*/
public double getSpeed() {
return this.speed;
}
/**
* A setter for the Position of this robot.
* @param pos The Position of this robot.
*/
public void setPos(Point3D pos) {
this.position = new Point3D(pos.x(), pos.y(), pos.z());
}
/**
* A getter for the Position of this robot.
* @return Position of this robot.
*/
public Point3D getPos() {
return this.position;
}
/**
* A setter for the value of this robot.
* @param value The value of this robot.
*/
public void setValue(double value) {
this.value = value;
}
/**
* A getter for the value of this robot.
* @return value of this robot.
*/
public double getValue() {
return this.value;
}
public void setisEating(boolean is) {
this.isEating = is;
}
public boolean getisEating() {
return this.isEating;
}
/**
* A getter for the Path to fruit.
* @return PathToFruit.
*/
public ArrayList<node_data> getPathToFruit(){
return PathToFruit;
}
/**
* A setter for the Path To Fruit.
* @param PathToFruit the path to the nearest fruit.
*/
public void setPathToFruit(ArrayList<node_data> path) {
this.PathToFruit = path;
}
}
| true |
8644a021d50b3e30f6c0c8807183bfbadb8bb84a | Java | Bokseunghyun/Java_spring | /spring_source/simplebook_mybatis2/src/main/java/com/spring/mapper/BookMapper.java | UTF-8 | 383 | 1.8125 | 2 | [] | no_license | package com.spring.mapper;
import java.util.List;
import com.spring.domain.BookVO;
public interface BookMapper {
public int insertBook(BookVO vo);
public int updateBook(BookVO vo);
public int deleteBook(String code);
public List<BookVO> getBookList();
public BookVO getBook(String code);
public List<BookVO> getBookSearchList
(String criteria,String keyword);
}
| true |
0c1fa5e6daff1fb86ba73f0adca5e88eec0b3c6b | Java | caohuutruong/1821085750 | /1821085750/bai8.java | UTF-8 | 419 | 2.671875 | 3 | [] | no_license | package baitaptet;
import java.util.Scanner;
public class bai8 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int n, tong=0;
Scanner scanner= new Scanner (System.in);
System.out.println("Nhap vao so nguyen: ");
while (true) {
n=scanner.nextInt();
tong=tong+n;
if(tong>100) {
break;
}
}
System.out.println("Tong la= " + tong);
}
}
| true |
0c885b28297481d93034a983b88b9f3af469d9cd | Java | tlf-AF233/spring-security-jwt-demo | /src/main/java/com/af/security/exception/UserUnableException.java | UTF-8 | 304 | 2.046875 | 2 | [] | no_license | package com.af.security.exception;
import com.af.security.enums.ErrorCode;
/**
* 用户不可用异常
* @author AF
* @date 2021/5/14 14:00
*/
public class UserUnableException extends BaseException {
public UserUnableException(Object data) {
super(ErrorCode.USER_UNABLE, data);
}
}
| true |
d669ebb605399ba4f6ef3fac0aadd83d102f22ff | Java | Avinash-Bhat/Blink-sample | /app/src/main/java/com/sample/blinkid/BroadcastingImageListener.java | UTF-8 | 2,268 | 2.15625 | 2 | [
"MIT"
] | permissive | package com.sample.blinkid;
import com.microblink.image.Image;
import com.microblink.image.ImageListener;
import com.microblink.image.ImageType;
import android.content.Intent;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.content.LocalBroadcastManager;
import static com.microblink.image.ImageType.DEWARPED;
import static com.microblink.image.ImageType.SUCCESSFUL_SCAN;
class BroadcastingImageListener implements ImageListener {
private final BlinkApplication application = BlinkApplication.getApplication();
private final boolean onlyDewraped;
private final int bitmapKey;
BroadcastingImageListener(boolean onlyDewraped, int bitmapKey) {
this.onlyDewraped = onlyDewraped;
this.bitmapKey = bitmapKey;
}
private BroadcastingImageListener(Parcel parcel) {
onlyDewraped = (parcel.readInt() == 1);
bitmapKey = parcel.readInt();
}
@Override
public void onImageAvailable(Image image) {
ImageType imageType = onlyDewraped ? DEWARPED : SUCCESSFUL_SCAN;
if (image.getImageType() == imageType) {
sendBroadcast(image.clone());
}
}
private void sendBroadcast(Image image) {
//todo do this on bg thread
try {
application.setDetectedImage(bitmapKey, image.convertToBitmap());
Intent intent = new Intent(BlinkApplication.ACTION_IMAGE_DETECTED);
LocalBroadcastManager.getInstance(application).sendBroadcast(intent);
} finally {
image.dispose();
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(onlyDewraped ? 1 : 0);
parcel.writeInt(bitmapKey);
}
public static final Parcelable.Creator<BroadcastingImageListener> CREATOR
= new Creator<BroadcastingImageListener>() {
@Override
public BroadcastingImageListener createFromParcel(Parcel parcel) {
return new BroadcastingImageListener(parcel);
}
@Override
public BroadcastingImageListener[] newArray(int size) {
return new BroadcastingImageListener[size];
}
};
}
| true |
9cf4adc85ec64ce35cecd73547271a0ce07a5196 | Java | iOperator/FueliFinTS | /src/main/java/net/petafuel/fuelifints/protocol/fints3/segments/deg/Bezugsnachricht.java | UTF-8 | 1,648 | 2.328125 | 2 | [
"Apache-2.0"
] | permissive | package net.petafuel.fuelifints.protocol.fints3.segments.deg;
import net.petafuel.fuelifints.protocol.fints3.segments.Element;
import net.petafuel.fuelifints.protocol.fints3.segments.ElementDescription;
import net.petafuel.fuelifints.protocol.fints3.validator.validators.id;
import net.petafuel.fuelifints.protocol.fints3.validator.validators.num;
/**
* Bezugsnachricht
* Eindeutige Referenz für Kundennachrichten. Die eindeutige Referenzierung
* erfolgt anhand der Dialog-ID und der Nachrichtennummer der Kundennach-
* richt. Falls auf eine Dialoginitialisierungsnachricht des Kunden referenziert
* werden soll, ist nicht die vom Kunden übermittelte Dialog-ID (0), sondern die
* vom Kreditinstitut neu vergebene Dialog-ID einzustellen.
* Es darf nur auf Nachrichten des dialogführenden Benutzers referenziert
* werden. Eine explizite Angabe der Benutzerkennung als Referenzierungs-
* kriterium ist nicht erforderlich, da diese bereits im Signaturkopf spezifiziert
* wurde.
*/
public class Bezugsnachricht extends DatenElementGruppe {
@Element(
description = {@ElementDescription(number = 1, length = 0)})
@id
private String dialog_id;
@Element(
description = {@ElementDescription(number = 2, length = -4)})
@num
private Integer nachrichtenummern;
public Bezugsnachricht(byte[] degString) {
super(degString);
}
@Override
public String toString() {
return "Bezugsnachricht{" +
"dialog_id='" + dialog_id + '\'' +
", nachrichtenummern=" + nachrichtenummern +
'}';
}
}
| true |
32c1c98d981654fb89442680d8571964ba19693c | Java | SingularityZed/AppleZed | /everything/zed-common/src/main/java/com/zed/common/validate/ValidationUtils.java | UTF-8 | 1,803 | 2.46875 | 2 | [] | no_license | package com.zed.common.validate;
import com.zed.common.constant.StatusCode;
import lombok.extern.slf4j.Slf4j;
/**
* 校验工具状态码
*
* @author zed
*/
@Slf4j
public class ValidationUtils {
/**
* 将校验字段的注解类型对应上状态码
*
* @param validateType
* @return
*/
public static Integer validateType(String validateType) {
Integer code;
switch (validateType) {
case "Null":
code = StatusCode.VERIFY_410004.getValue();
break;
case "NotNull":
case "NotBlank":
case "NotEmpty":
code = StatusCode.VERIFY_410003.getValue();
break;
case "AssertTrue":
case "AssertFalse":
code = StatusCode.VERIFY_410009.getValue();
break;
case "Min":
case "Max":
case "DecimalMin":
case "DecimalMax":
case "Size":
case "Digits":
case "Range":
code = StatusCode.VERIFY_410007.getValue();
break;
case "Past":
case "Future":
code = StatusCode.VERIFY_410010.getValue();
break;
case "Pattern":
code = StatusCode.VERIFY_410005.getValue();
break;
case "Email":
code = StatusCode.VERIFY_410011.getValue();
break;
case "Length":
code = StatusCode.VERIFY_410006.getValue();
break;
default:
code = StatusCode.VERIFY_410000.getValue();
}
// log.info( "校验信息是:" + validateType + "返回码是:" + code );
return code;
}
}
| true |
b7d29a38e48a2c4e4d0340f54dbfcc4044ba0a0f | Java | PablooHenrique/VanRemessa | /src/main/java/br/com/netsuprema/dominio/parametros/Parametros.java | UTF-8 | 3,061 | 2.21875 | 2 | [] | no_license | package br.com.netsuprema.dominio.parametros;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import br.com.netsuprema.dominio.enuns.FormatoRemessa;
@Entity(name = "parametros")
public class Parametros {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String login;
private String senha;
private String email;
@Enumerated(EnumType.STRING)
private FormatoRemessa formatoRemessa;
@OneToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "cooperativa")
private Cooperativa cooperativa;
private FormatoRetornoLiquidacao formatoRetornoLiquidacao;
private String diretorioRetornos;
@Column(nullable = true, columnDefinition = "boolean default false")
private boolean utilizaSeparadorArquivoPorPastasCedentes;
public String gerarMD5Senha(String senha) throws NoSuchAlgorithmException, UnsupportedEncodingException{
MessageDigest algorithm = MessageDigest.getInstance("MD5");
byte messageDigest[] = algorithm.digest(senha.getBytes("UTF-8"));
StringBuilder hexString = new StringBuilder();
for (byte b : messageDigest) {
hexString.append(String.format("%02x", 0xFF & b));
}
return hexString.toString();
}
public Cooperativa getCooperativa() {
return cooperativa;
}
public void setCooperativa(Cooperativa cooperativa) {
this.cooperativa = cooperativa;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public FormatoRemessa getFormatoRemessa() {
return formatoRemessa;
}
public void setFormatoRemessa(FormatoRemessa formatoRemessa) {
this.formatoRemessa = formatoRemessa;
}
public FormatoRetornoLiquidacao getFormatoRetornoLiquidacao() {
return formatoRetornoLiquidacao;
}
public void setFormatoRetornoLiquidacao(FormatoRetornoLiquidacao formatoRetornoLiquidacao) {
this.formatoRetornoLiquidacao = formatoRetornoLiquidacao;
}
public String getDiretorioRetornos() {
return diretorioRetornos;
}
public void setDiretorioRetornos(String diretorioRetornos) {
this.diretorioRetornos = diretorioRetornos;
}
public boolean isUtilizaSeparadorArquivoPorPastasCedentes() {
return utilizaSeparadorArquivoPorPastasCedentes;
}
public void setUtilizaSeparadorArquivoPorPastasCedentes(boolean utilizaSeparadorArquivoPorPastasCedentes) {
this.utilizaSeparadorArquivoPorPastasCedentes = utilizaSeparadorArquivoPorPastasCedentes;
}
}
| true |