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
b0735768c59451c3fa0f102f6baa8becf6f000ab
Java
gzacharski/AGH-Teoria-wspolbieznosci
/lab6/zad/IMyList.java
UTF-8
187
2.59375
3
[]
no_license
package lab6; public interface IMyList { boolean add(Object object); boolean contains(Object object); boolean remove(Object object); void print(); boolean isEmpty(); int size(); }
true
a24270abac2b545db73f5dfc69f230494cb1da8d
Java
Trivy/GestionBilicence
/GestionBilicence/src/gestionBilicence/dao/postgreSqlDao/PostgreSQLFactory.java
UTF-8
2,246
2.6875
3
[]
no_license
package gestionBilicence.dao.postgreSqlDao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import javax.swing.JOptionPane; import org.postgresql.util.PSQLException; import gestionBilicence.dao.Dao; import gestionBilicence.dao.abstractDao.AbstractDaoFactory; import gestionBilicence.dao.abstractDao.AbstractExamsDao; import gestionBilicence.dao.abstractDao.AbstractMarkDao; import gestionBilicence.dao.abstractDao.AbstractStudentDao; import gestionBilicence.edition.Semester; public class PostgreSQLFactory extends AbstractDaoFactory { /* * Create a connection to a PostgreSQL database */ private static Connection conn; public PostgreSQLFactory(String[] infoConn) { try { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://"+infoConn[2]+"/"+infoConn[3]; String user = infoConn[0]; String passwd = infoConn[1]; conn = DriverManager.getConnection(url, user, passwd); // commits automatiques ou pas conn.setAutoCommit(true); JOptionPane jop = new JOptionPane(); jop.showMessageDialog(null,"PostgreSQLFactory -- Connection up and running!","PostgreSQLFactory", JOptionPane.INFORMATION_MESSAGE); } catch (ClassNotFoundException e) { JOptionPane jop = new JOptionPane(); jop.showMessageDialog(null,e.getMessage(),"PostgreSQLFactory -- ClassNotFoundException", JOptionPane.INFORMATION_MESSAGE); } catch (PSQLException e){ JOptionPane jop = new JOptionPane(); jop.showMessageDialog(null , "Wrong password?", "PostGreSQLFactory -- PSQLException", JOptionPane.ERROR_MESSAGE ); e.printStackTrace(); } catch (SQLException e){ JOptionPane jop = new JOptionPane(); jop.showMessageDialog(null,e.getMessage(),"PostgreSQLFactory -- SQLException", JOptionPane.INFORMATION_MESSAGE); } } @Override public AbstractStudentDao getStudentDao() { return new PostgreSQLStudentDao(conn); } @Override public AbstractExamsDao getExamsDao() { return new PostgreSQLExamDao(conn); } @Override public Dao<Semester> getSemesterDao() { return new PostgreSQLSemesterDao(conn); } @Override public AbstractMarkDao getMarkDao() { return new PostgreSQLMarkDao(conn); } }
true
fad54539133595bf106bf5a887a2b8a7d2bd526c
Java
xaviramirezcom/superliga-rest
/src/main/java/core/application/imp/UserService.java
UTF-8
1,689
2.453125
2
[]
no_license
package core.application.imp; import core.application.contract.IUserService; import core.application.exception.BadRequestException; import core.application.exception.InternalServerErrorException; import core.application.exception.NotFoundException; import core.domain.exception.DomainModelNotLoadedException; import core.domain.contract.IUserRepository; import core.domain.model.User; import core.infrastructure.exception.UnexpectedPersistenceException; import org.apache.commons.beanutils.BeanUtils; import security.application.dto.UserDTO; import javax.inject.Inject; import java.lang.reflect.InvocationTargetException; /** * Created by xavier on 1/24/15. */ public class UserService implements IUserService { @Inject protected IUserRepository userRepository; @Override public UserDTO getByUsername(String username) throws BadRequestException, InternalServerErrorException, NotFoundException { if (username != null && username.length() >0) { try { User user = userRepository.findActiveByUsername(username); UserDTO userDTO = new UserDTO(); BeanUtils.copyProperties(userDTO, user); return userDTO; } catch (UnexpectedPersistenceException | InvocationTargetException | IllegalAccessException e) { e.printStackTrace(); throw new InternalServerErrorException(); } catch (DomainModelNotLoadedException e) { e.printStackTrace(); throw new NotFoundException("El usuario no ha sido encontrado"); } } throw new BadRequestException("Nombre de usuario inválido"); } }
true
976e560775575bce77a0031062c2b8244c539e59
Java
jgcastillo/Workflow_Machine
/WorkFlowSchool/src/edu/school/entities/State.java
UTF-8
5,037
2.09375
2
[]
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 edu.school.entities; import java.io.Serializable; import java.util.Collection; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; /** * * @author jgcastillo */ @Entity @Table(name = "state") @XmlRootElement @NamedQueries({ @NamedQuery(name = "State.findAll", query = "SELECT s FROM State s") , @NamedQuery(name = "State.findById", query = "SELECT s FROM State s WHERE s.id = :id") , @NamedQuery(name = "State.findByName", query = "SELECT s FROM State s WHERE s.name = :name") , @NamedQuery(name = "State.findByStateType", query = "SELECT s FROM State s WHERE s.stateType = :stateType")}) public class State implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") private Integer id; @Column(name = "name") private String name; @Lob @Column(name = "description") private String description; @Column(name = "state_type") private String stateType; @OneToMany(cascade = CascadeType.ALL, mappedBy = "currentStateId") private Collection<Request> requestCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "stateId") private Collection<StateActivity> stateActivityCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "currentStateId") private Collection<Transition> transitionCollection; @OneToMany(cascade = CascadeType.ALL, mappedBy = "nextStateId") private Collection<Transition> transitionCollection1; @JoinColumn(name = "process_id", referencedColumnName = "id") @ManyToOne(optional = false) private Process processId; public State() { } public State(Integer id) { this.id = id; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getStateType() { return stateType; } public void setStateType(String stateType) { this.stateType = stateType; } @XmlTransient public Collection<Request> getRequestCollection() { return requestCollection; } public void setRequestCollection(Collection<Request> requestCollection) { this.requestCollection = requestCollection; } @XmlTransient public Collection<StateActivity> getStateActivityCollection() { return stateActivityCollection; } public void setStateActivityCollection(Collection<StateActivity> stateActivityCollection) { this.stateActivityCollection = stateActivityCollection; } @XmlTransient public Collection<Transition> getTransitionCollection() { return transitionCollection; } public void setTransitionCollection(Collection<Transition> transitionCollection) { this.transitionCollection = transitionCollection; } @XmlTransient public Collection<Transition> getTransitionCollection1() { return transitionCollection1; } public void setTransitionCollection1(Collection<Transition> transitionCollection1) { this.transitionCollection1 = transitionCollection1; } public Process getProcessId() { return processId; } public void setProcessId(Process processId) { this.processId = processId; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof State)) { return false; } State other = (State) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "edu.school.entities.State[ id=" + id + " ]"; } }
true
ceb0d11ce4807c81c2f6d32588ee718702822369
Java
xerus-github/ogolem
/src/org/ogolem/adaptive/AdaptiveAmberFF.java
UTF-8
21,212
1.898438
2
[]
no_license
/** Copyright (c) 2011-2014, J. M. Dieterich 2015-2016, J. M. Dieterich and B. Hartke All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software of the ogolem.org project developed by J. M. Dieterich and B. Hartke (Christian-Albrechts-University Kiel, Germany) and contributors. * Neither the name of the ogolem.org project, the University of Kiel nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ''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 AUTHOR(S) 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 org.ogolem.adaptive; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.ogolem.core.BondInfo; import org.ogolem.core.CartesianCoordinates; import org.ogolem.core.Gradient; import org.ogolem.core.Topology; import org.ogolem.helpers.Tuple; import org.ogolem.helpers.Tuple3D; import org.ogolem.io.InputPrimitives; import org.ogolem.math.AcosLookup; import org.ogolem.math.CosLookup; import org.ogolem.math.SinLookup; /** * An adaptivable AMBER-style force field. Please note that this FF ONLY * guarantees to work with one system at a time! * @author Johannes Dieterich * @version 2016-02-24 */ public class AdaptiveAmberFF extends AbstractAdaptiveBackend { private static final long serialVersionUID = (long) 20150727; private static final boolean DEBUG = false; private final AdaptiveInteractionTerm[] terms; private final AdaptiveParameters params; private final List<int[]> contr13; private final List<int[]> contr14; private final boolean useCaches; private final boolean useShifter; private ArrayList<Topology> topoCache; private final AmberMath math; private double[][] xyz; // used as an object cache when in backend mode. public AdaptiveAmberFF(boolean bIsInAdaptive, AdaptiveParameters parameters, boolean useCaching, int whichAcos, int whichCos, int whichSin, boolean useTotalEnergyShifter) throws Exception{ this.useCaches = useCaching; this.useShifter = useTotalEnergyShifter; this.terms = (useShifter) ? new AdaptiveInteractionTerm[5] : new AdaptiveInteractionTerm[4]; // add individual terms if(useShifter){ final AdaptiveInteractionTerm shift = new AdaptiveTotalEnergyShifter(true); terms[4] = shift; } this.math = new AmberMath(whichAcos, whichCos, whichSin); if(!useCaching) terms[0] = new AdaptiveBondedHarmonicTerm(true,20.0,useCaching); else terms[0] = new AdaptiveCachedBondTerm(true,20.0); terms[1] = new AdaptiveAmberAngleTerm(true, useCaching, math); terms[2] = new AdaptiveAmberDihedralTerm(true, useCaching, math); terms[3] = new AdaptiveAmberLJTerm(true,20.0,0.8,0.5, 1/1.2, useCaching); // parameters if(!bIsInAdaptive){ if(parameters != null){ params = parameters; } else { System.out.println("INFO: Performance penalty encountered, by " + "needing to read the parameters in again and again. Consider changing. :-)"); final String sFile = "adaptive-amberff.param"; String[] saData = null; try { saData = Input.ReadFile(sFile); } catch (Exception e) { System.err.println("ERROR: Couldn't read parameter file in: " + e.toString()); throw e; } params = new AdaptiveParameters(saData, 0); } } else { // we simply do not need them params = null; topoCache = new ArrayList<>(); } // create topology: read and parse aux files, might throw various exceptions final String[] contrib13 = InputPrimitives.readFileIn("amberff-list13.aux"); final String[] contrib14 = InputPrimitives.readFileIn("amberff-list14.aux"); this.contr13 = new ArrayList<>(contrib13.length); this.contr14 = new ArrayList<>(contrib14.length); // 1-3 contributions for(final String s : contrib13){ final String[] sa = s.trim().split("\\s+"); final int[] ia = new int[3]; for(int i = 0; i < 3; i++){ ia[i] = Integer.parseInt(sa[i]); } // add contr13.add(ia); } // 1-4 contributions for(final String s : contrib14){ if(s.contains("null")) break; final String[] sa = s.trim().split("\\s+"); final int[] ia = new int[4]; for(int i = 0; i < 4; i++){ ia[i] = Integer.parseInt(sa[i]); } // add contr14.add(ia); } } private AdaptiveAmberFF(final AdaptiveAmberFF orig){ this.math = orig.math.clone(); this.useCaches = orig.useCaches; this.useShifter = orig.useShifter; this.terms = new AdaptiveInteractionTerm[orig.terms.length]; int c = 0; for(AdaptiveInteractionTerm term : orig.terms){ terms[c] = term.clone(); c++; } // initialize the electrostatic // parameters if(orig.params != null )this.params = new AdaptiveParameters(orig.params); else{ this.params = null; this.topoCache = new ArrayList<>(); orig.topoCache.forEach((topo) -> { this.topoCache.add(new Topology(topo)); }); } // 1-3 and 1-4 contributions, not allowed to be null this.contr13 = new ArrayList<>(orig.contr13); this.contr14 = new ArrayList<>(orig.contr14); } @Override public AdaptiveAmberFF clone(){ return new AdaptiveAmberFF(this); } @Override public String getMethodID(){ return "Adaptive Amber FF"; } @Override public void gradientCalculation(long lID, int iIteration, double[] xyz1D, String[] saAtomTypes, short[] atomNos, int[] atsPerMol, double[] energyparts, int iNoOfAtoms, float[] faCharges, short[] iaSpins, final BondInfo bonds, final Gradient gradient){ if(xyz == null || !useCaches) xyz = new double[3][iNoOfAtoms]; System.arraycopy(xyz1D, 0, xyz[0], 0, iNoOfAtoms); System.arraycopy(xyz1D, iNoOfAtoms, xyz[1], 0, iNoOfAtoms); System.arraycopy(xyz1D, iNoOfAtoms * 2, xyz[2], 0, iNoOfAtoms); // then the topology final Topology topology = new Topology(saAtomTypes, xyz, bonds, faCharges, iaSpins, atomNos, contr13, contr14, true); // now compute all contributions final ArrayList<Gradient> gradContrib = new ArrayList<>(); double energy = 0.0; for (final AdaptiveInteractionTerm term : terms) { final Gradient grad = term.partialCartesianGradient(topology, params); energy += grad.getTotalEnergy(); gradContrib.add(grad); } // add the gradient up final int[] dims = {3,iNoOfAtoms}; final Gradient gradientTmp = new Gradient(gradContrib, dims); gradient.setTotalEnergy(energy); if(DEBUG){ // numerical gradient to check Gradient numGrad = NumericalGradients.numericalGradient(lID, iIteration, xyz1D, saAtomTypes, atomNos, atsPerMol, energyparts, iNoOfAtoms, faCharges, iaSpins, bonds, this); } gradient.copyDataIn(gradientTmp); } @Override public double energyCalculation(long lID, int iIteration, double[] xyz1D, String[] saAtomTypes, short[] atomNos, int[] atsPerMol, double[] energyparts, int iNoOfAtoms, float[] faCharges, short[] iaSpins, final BondInfo bonds){ if(xyz == null || !useCaches) xyz = new double[3][iNoOfAtoms]; System.arraycopy(xyz1D, 0, xyz[0], 0, iNoOfAtoms); System.arraycopy(xyz1D, iNoOfAtoms, xyz[1], 0, iNoOfAtoms); System.arraycopy(xyz1D, iNoOfAtoms * 2, xyz[2], 0, iNoOfAtoms); // the topology final Topology topology = new Topology(saAtomTypes, xyz, bonds, faCharges, iaSpins, atomNos, contr13, contr14, false); // now all interaction terms double energy = 0.0; for (final AdaptiveInteractionTerm term : terms) { energy += term.partialInteraction(topology, params); } return energy; } @Override public double energyOfStructWithParams(final CartesianCoordinates cartes, final AdaptiveParameters params, final int geomID, final BondInfo bonds){ Topology topology; if(topoCache.size() < geomID+1){ // first the topology topology = new Topology(cartes.getAllAtomTypes(), cartes.getAllXYZCoord(), bonds, cartes.getAllCharges(), cartes.getAllSpins(), cartes.getAllAtomNumbers(), contr13, contr14, false); topoCache.add(topology); } else{ topology = topoCache.get(geomID); } // now all interaction terms double energy = 0.0; for (final AdaptiveInteractionTerm term : terms) { final double e = term.partialInteraction(topology, params); energy += e; } return energy; } @Override public double gradientOfStructWithParams(final CartesianCoordinates cartes, final AdaptiveParameters params, final int geomID, final BondInfo bonds, final double[] grad){ Topology topology; if(topoCache.size() < geomID+1){ // first the topology topology = new Topology(cartes.getAllAtomTypes(), cartes.getAllXYZCoord(), bonds, cartes.getAllCharges(), cartes.getAllSpins(), cartes.getAllAtomNumbers(), contr13, contr14, false); topoCache.add(topology); } else{ topology = topoCache.get(geomID); } // now all interaction terms double e = 0.0; for (final AdaptiveInteractionTerm term : terms) { e += term.partialParamGradient(topology, params, grad); } if(DEBUG){ final double[] num = new double[grad.length]; final double numE = NumericalGradients.calculateParamGrad(cartes, params, this, geomID, bonds, num); assert(Math.abs(numE-e)< 1e-8); final double[] analy = grad; for(int i = 0; i < num.length; i++){ if(Math.abs(num[i]-analy[i]) >= 1e-6){ System.out.println("DEBUG: Difference in param grad at pos " + i + " num: " + num[i] + " analytical: " + analy[i]); } } } return e; } @Override public double[][] minMaxBordersForParams(final AdaptiveParameters params){ ArrayList<double[][]> borders = new ArrayList<>(); for(AdaptiveInteractionTerm term : terms){ double[][] daBorders = term.bordersForMyParams(params); if(daBorders != null) borders.add(daBorders); } // copy around double[][] daBorders = new double[2][params.getNumberOfParamters()]; int iOffset = 0; for(double[][] daPartBorders : borders){ int iLength = daPartBorders[0].length; System.arraycopy(daPartBorders[0], 0, daBorders[0], iOffset, iLength); System.arraycopy(daPartBorders[1], 0, daBorders[1], iOffset, iLength); iOffset += iLength; } return daBorders; } /** * Please note a couple of special issues with this particular implementation * 1. The used FF terms assume all structures to be of the same system. * 2. The used reference is the first structure. * 3. Bonds are once assigned here based on a blow factor of 1.3 and the first reference structure. * 4. Use with care. A custom parameter stub might be the better idea in most cases! * @param refCartes * @param sMethod * @return An intial parameter stub. */ @Override public AdaptiveParameters createInitialParameterStub(final ArrayList<CartesianCoordinates> refCartes, final String sMethod){ int iParamSum = 0; ArrayList<Tuple<String,Integer>> paramsPerKey = new ArrayList<>(); final CartesianCoordinates refCart = refCartes.get(0); final BondInfo refBonds = org.ogolem.core.CoordTranslation.checkForBonds(refCart, 1.3); final Topology topology = new Topology(refCart.getAllAtomTypes(),refCart.getAllXYZCoord(), refBonds, refCart.getAllCharges(), refCart.getAllSpins(), refCart.getAllAtomNumbers(), contr13, contr14); final ArrayList<Topology> tops = new ArrayList<>(); tops.add(topology); for(AdaptiveInteractionTerm term : terms){ Tuple3D<String[],int[],Integer> tupel = term.requiredParams(refCartes, tops, sMethod); String[] saKeys = tupel.getObject1(); int[] iaParamsKey = tupel.getObject2(); for(int i = 0; i < saKeys.length; i++){ Tuple<String,Integer> tup = new Tuple<>(saKeys[i],iaParamsKey[i]); paramsPerKey.add(tup); } iParamSum += tupel.getObject3(); } String[] saKeys = new String[paramsPerKey.size()]; int[] iaParamsPerKey = new int[paramsPerKey.size()]; for(int i = 0; i < saKeys.length; i++){ Tuple<String, Integer> tupel = paramsPerKey.get(i); saKeys[i] = tupel.getObject1(); iaParamsPerKey[i] = tupel.getObject2(); } final AdaptiveParameters paramStub = new AdaptiveParameters(iParamSum, -1, saKeys, iaParamsPerKey, sMethod); return paramStub; } public static class AmberMath implements Serializable, Cloneable { private static final long serialVersionUID = (long) 20111124; private final int wAcos; private final int wCos; private final int wSin; private final AcosLookup acosLook; private final CosLookup cosLook; private final SinLookup sinLook; public AmberMath(final int whichAcos, final int whichCos, final int whichSin){ switch(whichAcos){ case 0: acosLook = null; wAcos = 0; break; case 1: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[0]); wAcos = 1; break; case 2: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[1]); wAcos = 1; break; case 3: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[2]); wAcos = 1; break; case 4: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[3]); wAcos = 1; break; case 5: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[4]); wAcos = 1; break; case 11: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[0]); wAcos = 2; break; case 12: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[1]); wAcos = 2; break; case 13: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[2]); wAcos = 2; break; case 14: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[3]); wAcos = 2; break; case 15: acosLook = new AcosLookup(AcosLookup.POSSIBLE_SIZES[4]); wAcos = 2; break; case 20: acosLook = null; wAcos = 3; break; default: acosLook = null; wAcos = 0; break; } switch(whichCos){ case 0: cosLook = null; wCos = 0; break; case 1: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[0]); wCos = 1; break; case 2: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[1]); wCos = 1; break; case 3: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[2]); wCos = 1; break; case 4: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[3]); wCos = 1; break; case 5: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[4]); wCos = 1; break; case 11: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[0]); wCos = 2; break; case 12: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[1]); wCos = 2; break; case 13: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[2]); wCos = 2; break; case 14: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[3]); wCos = 2; break; case 15: cosLook = new CosLookup(CosLookup.POSSIBLE_SIZES[4]); wCos = 2; break; case 20: cosLook = null; wCos = 3; break; default: cosLook = null; wCos = 0; break; } switch(whichSin){ case 0: sinLook = null; wSin = 0; break; case 1: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[0]); wSin = 1; break; case 2: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[1]); wSin = 1; break; case 3: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[2]); wSin = 1; break; case 4: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[3]); wSin = 1; break; case 5: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[4]); wSin = 1; break; case 11: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[0]); wSin = 2; break; case 12: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[1]); wSin = 2; break; case 13: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[2]); wSin = 2; break; case 14: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[3]); wSin = 2; break; case 15: sinLook = new SinLookup(SinLookup.POSSIBLE_SIZES[4]); wSin = 2; break; case 20: sinLook = null; wSin = 3; break; default: sinLook = null; wSin = 0; break; } System.out.println(" " + wSin + " " + wCos + " " + wAcos); } AmberMath(final AmberMath orig){ this.wAcos = orig.wAcos; this.wCos = orig.wCos; this.wSin = orig.wSin; if(orig.acosLook != null) this.acosLook = orig.acosLook.clone(); else this.acosLook = null; if(orig.cosLook != null) this.cosLook = orig.cosLook.clone(); else this.cosLook = null; if(orig.sinLook != null) this.sinLook = orig.sinLook.clone(); else this.sinLook = null; } @Override public AmberMath clone(){ return new AmberMath(this); } final double acos(final double x){ switch(wAcos){ case 0: return Math.acos(x); case 1: return acosLook.acosInter(x); case 2: return acosLook.acosNonInter(x); case 3: return org.apache.commons.math3.util.FastMath.acos(x); default: return Math.acos(x); } } final double cos(final double x){ switch(wCos){ case 0: return Math.cos(x); case 1: return cosLook.cosInter(x); case 2: return cosLook.cosNonInter(x); case 3: return org.apache.commons.math3.util.FastMath.cos(x); default: return Math.cos(x); } } final double sin(final double x){ switch(wSin){ case 0: return Math.sin(x); case 1: return sinLook.sinInter(x); case 2: return sinLook.sinNonInter(x); case 3: return org.apache.commons.math3.util.FastMath.sin(x); default: return Math.sin(x); } } } }
true
0cc08b109a8e033d14de5bb471b2864bf98d248f
Java
anoordover/cyclops
/cyclops-streams/src/main/java/com/aol/cyclops/comprehensions/donotation/Doable.java
UTF-8
562
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "MIT" ]
permissive
package com.aol.cyclops.comprehensions.donotation; import java.util.function.Function; import java.util.function.Supplier; import com.aol.cyclops.comprehensions.donotation.UntypedDo.DoComp2; public interface Doable<T> { default Object getValue(){ return this; } default DoComp2 doWithThisAnd(Function<T,?> f){ return UntypedDo.add(getValue()).with(f); } default DoComp2 doWithThisAndThat(Object o){ return UntypedDo.add(getValue()).add(o); } default DoComp2 doWithThisAndThat(Supplier o){ return UntypedDo.add(getValue()).add(o); } }
true
5b7b549e23d1ab7c7cd3f8ac984309e3166f4b22
Java
inuxkr/mina-spring
/core/src/org/apache/mina/springrpc/MinaServiceExporter.java
UTF-8
2,369
1.84375
2
[]
no_license
/* * Copyright 2008-2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.mina.springrpc; import org.apache.mina.core.service.IoAcceptor; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.remoting.support.RemoteInvocationBasedExporter; import org.springframework.remoting.support.RemoteInvocationResult; import org.springframework.util.Assert; /** * * @author politics wang * @since 2008-11-25 * */ public class MinaServiceExporter extends RemoteInvocationBasedExporter implements InitializingBean, DisposableBean { private IoAcceptor acceptor; @Override public void afterPropertiesSet() throws Exception { prepare(); } private void prepare() throws Exception { Assert.notNull(acceptor, "acceptor requried"); ReturnAddressAwareRemoteInvocationHandler invocationHandler = new MinaRemoteInvocationHandler(); acceptor.setHandler(new MinaServerHandler(invocationHandler)); acceptor.bind(); } private class MinaRemoteInvocationHandler implements ReturnAddressAwareRemoteInvocationHandler { @Override public ReturnAddressAwareRemoteInvocationResult invoke(ReturnAddressAwareRemoteInvocation invocation) { RemoteInvocationResult result = invokeAndCreateResult(invocation, getService()); if (result.hasException()) { return new ReturnAddressAwareRemoteInvocationResult(invocation.getReturnAddress(), result.getException()); } return new ReturnAddressAwareRemoteInvocationResult(invocation.getReturnAddress(), result.getValue()); } } @Override public void destroy() throws Exception { acceptor.unbind(); } public void setIoAcceptor(IoAcceptor ioAcceptor) { this.acceptor = ioAcceptor; } }
true
e58b76a7847043c95063ae4b0c9ee587d466e315
Java
blueoceandevops/oauth2-with-spring-security
/client-jwt/src/main/java/com/example/clientjwt/web/controller/TodoController.java
UTF-8
1,636
2.125
2
[]
no_license
package com.example.clientjwt.web.controller; import com.example.clientjwt.service.TodoService; import com.example.clientjwt.service.dto.Todo; import com.example.clientjwt.web.form.TodoForm; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @Controller public class TodoController { private static final Logger logger = LoggerFactory.getLogger(TodoController.class); private final TodoService todoService; public TodoController(TodoService todoService) { this.todoService = todoService; } @GetMapping("/") public String index(Model model, Authentication authentication) { logger.debug("{}", authentication); List<Todo> todoList = todoService.findAll(); model.addAttribute("todoList", todoList); return "index"; } @PostMapping("/add") public String add(TodoForm todoForm) { Todo todo = todoForm.convertToDto(); todoService.save(todo); return "redirect:/"; } @PostMapping("/update") public String update(@RequestParam Integer id) { todoService.updateDoneById(id); return "redirect:/"; } @PostMapping("/delete") public String delete(@RequestParam Integer id) { todoService.deleteById(id); return "redirect:/"; } }
true
ac5817eccb34c18d9c27c2039546f029dd9e5f4c
Java
msamkov/itnight-api-rest-grpc
/catalogue/src/main/java/epam/itnight/catalogue/repo/ProductRepo.java
UTF-8
394
1.914063
2
[]
no_license
package epam.itnight.catalogue.repo; import epam.itnight.catalogue.domain.Product; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import org.springframework.stereotype.Repository; import reactor.core.publisher.Flux; @Repository public interface ProductRepo extends ReactiveMongoRepository<Product, String> { Flux<Product> findAllByCategory(String category); }
true
950d7f5e29eca59c70617410f64f13df6da141c0
Java
hua-1/hauting_ssm
/src/main/java/cn/hua/service/UserDaoImpl.java
UTF-8
593
2.203125
2
[]
no_license
package cn.hua.service; import cn.hua.dao.UserDao; import cn.hua.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UserDaoImpl implements UserDao { @Autowired private UserDao userDao; @Override public int insertByUser(User user) { int i = userDao.insertByUser(user); return i; } @Override public List<User> seachByUserName(User user) { List<User> users = userDao.seachByUserName(user); return users; } }
true
836c4b75e7b55b3c400ea3ae115ea925cc251487
Java
Kuan-Wei-Kuo/MyChart
/mychartlib/src/main/java/com/kuo/mychartlib/model/Viewport.java
UTF-8
1,357
2.828125
3
[ "Apache-2.0" ]
permissive
package com.kuo.mychartlib.model; import android.graphics.RectF; /* * Created by Kuo on 2016/3/16. */ public class Viewport extends RectF { private float minHeight, minWidth, maxHeight, maxWidth; public Viewport(float left, float top, float right, float bottom) { set(left, top, right, bottom); } @Override public void set(float left, float top, float right, float bottom) { super.set(left, top, right, bottom); } @Override public void set(RectF src) { super.set(src); } public void setMinHeight(float minHeight) { this.minHeight = minHeight; } public void setMinWidth(float minWidth) { this.minWidth = minWidth; } public void setMaxWidth(float maxWidth) { this.maxWidth = maxWidth; } public void setMaxHeight(float maxHeight) { this.maxHeight = maxHeight; } public float getMaxHeight() { return maxHeight; } public float getMaxWidth() { return maxWidth; } public float getMinHeight() { return minHeight; } public float getMinWidth() { return minWidth; } public boolean contains(float x, float y) { return left < right && top < bottom // check for empty first && x >= left && x <= right && y >= top && y <= bottom; } }
true
38d2f504da83c531834d01f666bade4462398aa6
Java
scireum/server-sass
/src/test/java/org/serversass/SassTest.java
UTF-8
3,303
2.3125
2
[ "MIT" ]
permissive
package org.serversass; import org.junit.Assert; import org.junit.Test; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringWriter; /** * Tests the SASS to CSS compiler */ public class SassTest { @Test public void testVariables() { compare("variables.scss", "variables.css"); } @Test public void testEscape() { compare("escape.scss", "escape.css"); } @Test public void testNesting() { compare("nesting.scss", "nesting.css"); } @Test public void testImport() { compare("import.scss", "import.css"); } @Test public void testMixin() { compare("mixin.scss", "mixin.css"); } @Test public void testExtends() { compare("extends.scss", "extends.css"); } @Test public void testOperators() { compare("operators.scss", "operators.css"); } @Test public void testSelectors() { compare("selectors.scss", "selectors.css"); } @Test public void testFonts() { compare("fonts.scss", "fonts.css"); } @Test public void testColors() { compare("colors.scss", "colors.css"); } @Test public void testMedia() { compare("media.scss", "media.css"); } @Test public void testKeyframes() { compare("keyframes.scss", "keyframes.css"); } @Test public void testCssVariables() { compare("css-variables.scss", "css-variables.css"); } @Test public void testGridAreas() { compare("grid.scss", "grid.css"); } @Test public void testNotSelector() { compare("not.scss", "not.css"); } private void compare(String scssFile, String cssFile) { try { Generator gen = new Generator() { @Override public void warn(String message) { System.err.println(message); } }; gen.importStylesheet(scssFile); gen.compile(); StringWriter writer = new StringWriter(); InputStreamReader reader = new InputStreamReader(getClass().getResourceAsStream("/" + cssFile)); char[] buf = new char[8192]; while (true) { int length = reader.read(buf); if (length < 0) { break; } writer.write(buf, 0, length); } reader.close(); String expected = writer.toString(); StringWriter out = new StringWriter(); Output output = new Output(out, false); gen.generate(output); String result = out.toString(); String[] expectedLines = expected.split("\\r?\\n"); String[] resultLines = result.split("\\r?\\n"); for (int i = 0; i < expectedLines.length; i++) { String exp = expectedLines[i]; String res = resultLines.length > i ? resultLines[i] : ""; if (!exp.equals(res)) { Assert.fail(String.format("%s - Line %d: '%s' vs '%s'", scssFile, i + 1, exp, res)); } } } catch (IOException e) { Assert.fail(e.getMessage()); } } }
true
032c821f4f003b0f20454b569d42a8d56a050f07
Java
yuanhaiyue/AssessmentPractice
/demoEnd/src/main/java/com/yuan/demo/controller/UserController.java
UTF-8
1,102
2.09375
2
[]
no_license
package com.yuan.demo.controller; import com.yuan.demo.entity.User; import com.yuan.demo.repository.UserRepository; import com.yuan.demo.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/user") public class UserController { @Autowired UserService userService; @GetMapping("/select") public List<User> select(){ return userService.selectUser(); } @GetMapping("/delete") public void delete(Integer id){ userService.deleteUser(id); } @PostMapping("/save") public String save(User user){ return userService.saveUser(user); } @PostMapping("/selectNamePassword") public User select(String name,String password){ return userService.selectUserNamePassword(name, password); } }
true
8dea363fb457235588c08eb7ce5628b9eb9a9ed2
Java
Padorax/algo
/CC150/Stack.java
UTF-8
162
2.671875
3
[]
no_license
/** Stack ADT*/ public interface Stack<E>{ public void clear(); public void push(E data); public E pop(); public E topValue(); public int size(); }
true
716145d510b44583a82c8ada49f25195a76a1e5d
Java
yutinglu15/ForumDemo
/Lab5Reddit/app/src/main/java/com/example/lab5reddit/Message.java
UTF-8
565
2.875
3
[]
no_license
package com.example.lab5reddit; public class Message { String text; int score; public Message(){ this.text = ""; this.score = 0; } public Message(String text, int score) { this.text = text; this.score = score; } public String getText() { return text; } public int getScore() { return score; } public void setText(String text) { this.text = text; } public void setScore(int score) { this.score = score; } }
true
08986464b4efc25678f4aa39b4bd61431570aa36
Java
ggmoura/treinar
/turma_6256/codigo-fonte/estudo/src/gilberto/excecao/Venda.java
UTF-8
204
1.945313
2
[]
no_license
package gilberto.excecao; public class Venda { public Venda(){ } public void adicionarProduto() throws ProdutoNaoDisponivelException{ throw new ProdutoNaoDisponivelException(); } }
true
4dbf200e19ab0d8196737775888f433eb11cfe67
Java
thistehneisen/cifra
/src/apk/b/d/d.java
UTF-8
12,110
2.140625
2
[]
no_license
package b.d; import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.Set; /* compiled from: ArraySet */ public final class d<E> implements Collection<E>, Set<E> { /* renamed from: a reason: collision with root package name */ private static final int[] f2264a = new int[0]; /* renamed from: b reason: collision with root package name */ private static final Object[] f2265b = new Object[0]; /* renamed from: c reason: collision with root package name */ private static Object[] f2266c; /* renamed from: d reason: collision with root package name */ private static int f2267d; /* renamed from: e reason: collision with root package name */ private static Object[] f2268e; /* renamed from: f reason: collision with root package name */ private static int f2269f; /* renamed from: g reason: collision with root package name */ private int[] f2270g; /* renamed from: h reason: collision with root package name */ Object[] f2271h; /* renamed from: i reason: collision with root package name */ int f2272i; /* renamed from: j reason: collision with root package name */ private h<E, E> f2273j; public d() { this(0); } private int a(Object obj, int i2) { int i3 = this.f2272i; if (i3 == 0) { return -1; } int a2 = e.a(this.f2270g, i3, i2); if (a2 < 0 || obj.equals(this.f2271h[a2])) { return a2; } int i4 = a2 + 1; while (i4 < i3 && this.f2270g[i4] == i2) { if (obj.equals(this.f2271h[i4])) { return i4; } i4++; } int i5 = a2 - 1; while (i5 >= 0 && this.f2270g[i5] == i2) { if (obj.equals(this.f2271h[i5])) { return i5; } i5--; } return ~i4; } private h<E, E> e() { if (this.f2273j == null) { this.f2273j = new c(this); } return this.f2273j; } private int f() { int i2 = this.f2272i; if (i2 == 0) { return -1; } int a2 = e.a(this.f2270g, i2, 0); if (a2 < 0 || this.f2271h[a2] == null) { return a2; } int i3 = a2 + 1; while (i3 < i2 && this.f2270g[i3] == 0) { if (this.f2271h[i3] == null) { return i3; } i3++; } int i4 = a2 - 1; while (i4 >= 0 && this.f2270g[i4] == 0) { if (this.f2271h[i4] == null) { return i4; } i4--; } return ~i3; } private void h(int i2) { if (i2 == 8) { synchronized (d.class) { if (f2268e != null) { Object[] objArr = f2268e; this.f2271h = objArr; f2268e = (Object[]) objArr[0]; this.f2270g = (int[]) objArr[1]; objArr[1] = null; objArr[0] = null; f2269f--; return; } } } else if (i2 == 4) { synchronized (d.class) { if (f2266c != null) { Object[] objArr2 = f2266c; this.f2271h = objArr2; f2266c = (Object[]) objArr2[0]; this.f2270g = (int[]) objArr2[1]; objArr2[1] = null; objArr2[0] = null; f2267d--; return; } } } this.f2270g = new int[i2]; this.f2271h = new Object[i2]; } public boolean add(E e2) { int i2; int i3; if (e2 == null) { i3 = f(); i2 = 0; } else { int hashCode = e2.hashCode(); i2 = hashCode; i3 = a(e2, hashCode); } if (i3 >= 0) { return false; } int i4 = ~i3; int i5 = this.f2272i; if (i5 >= this.f2270g.length) { int i6 = 4; if (i5 >= 8) { i6 = (i5 >> 1) + i5; } else if (i5 >= 4) { i6 = 8; } int[] iArr = this.f2270g; Object[] objArr = this.f2271h; h(i6); int[] iArr2 = this.f2270g; if (iArr2.length > 0) { System.arraycopy(iArr, 0, iArr2, 0, iArr.length); System.arraycopy(objArr, 0, this.f2271h, 0, objArr.length); } a(iArr, objArr, this.f2272i); } int i7 = this.f2272i; if (i4 < i7) { int[] iArr3 = this.f2270g; int i8 = i4 + 1; System.arraycopy(iArr3, i4, iArr3, i8, i7 - i4); Object[] objArr2 = this.f2271h; System.arraycopy(objArr2, i4, objArr2, i8, this.f2272i - i4); } this.f2270g[i4] = i2; this.f2271h[i4] = e2; this.f2272i++; return true; } public boolean addAll(Collection<? extends E> collection) { a(this.f2272i + collection.size()); boolean z = false; for (Object add : collection) { z |= add(add); } return z; } public void clear() { int i2 = this.f2272i; if (i2 != 0) { a(this.f2270g, this.f2271h, i2); this.f2270g = f2264a; this.f2271h = f2265b; this.f2272i = 0; } } public boolean contains(Object obj) { return indexOf(obj) >= 0; } public boolean containsAll(Collection<?> collection) { for (Object contains : collection) { if (!contains(contains)) { return false; } } return true; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Set) { Set set = (Set) obj; if (size() != set.size()) { return false; } int i2 = 0; while (i2 < this.f2272i) { try { if (!set.contains(g(i2))) { return false; } i2++; } catch (ClassCastException | NullPointerException unused) { } } return true; } return false; } public E g(int i2) { return this.f2271h[i2]; } public int hashCode() { int[] iArr = this.f2270g; int i2 = 0; for (int i3 = 0; i3 < this.f2272i; i3++) { i2 += iArr[i3]; } return i2; } public int indexOf(Object obj) { return obj == null ? f() : a(obj, obj.hashCode()); } public boolean isEmpty() { return this.f2272i <= 0; } public Iterator<E> iterator() { return e().e().iterator(); } public boolean remove(Object obj) { int indexOf = indexOf(obj); if (indexOf < 0) { return false; } f(indexOf); return true; } public boolean removeAll(Collection<?> collection) { boolean z = false; for (Object remove : collection) { z |= remove(remove); } return z; } public boolean retainAll(Collection<?> collection) { boolean z = false; for (int i2 = this.f2272i - 1; i2 >= 0; i2--) { if (!collection.contains(this.f2271h[i2])) { f(i2); z = true; } } return z; } public int size() { return this.f2272i; } public Object[] toArray() { int i2 = this.f2272i; Object[] objArr = new Object[i2]; System.arraycopy(this.f2271h, 0, objArr, 0, i2); return objArr; } public String toString() { if (isEmpty()) { return "{}"; } StringBuilder sb = new StringBuilder(this.f2272i * 14); sb.append('{'); for (int i2 = 0; i2 < this.f2272i; i2++) { if (i2 > 0) { sb.append(", "); } Object g2 = g(i2); if (g2 != this) { sb.append(g2); } else { sb.append("(this Set)"); } } sb.append('}'); return sb.toString(); } public d(int i2) { if (i2 == 0) { this.f2270g = f2264a; this.f2271h = f2265b; } else { h(i2); } this.f2272i = 0; } public <T> T[] toArray(T[] tArr) { if (tArr.length < this.f2272i) { tArr = (Object[]) Array.newInstance(tArr.getClass().getComponentType(), this.f2272i); } System.arraycopy(this.f2271h, 0, tArr, 0, this.f2272i); int length = tArr.length; int i2 = this.f2272i; if (length > i2) { tArr[i2] = null; } return tArr; } private static void a(int[] iArr, Object[] objArr, int i2) { if (iArr.length == 8) { synchronized (d.class) { if (f2269f < 10) { objArr[0] = f2268e; objArr[1] = iArr; for (int i3 = i2 - 1; i3 >= 2; i3--) { objArr[i3] = null; } f2268e = objArr; f2269f++; } } } else if (iArr.length == 4) { synchronized (d.class) { if (f2267d < 10) { objArr[0] = f2266c; objArr[1] = iArr; for (int i4 = i2 - 1; i4 >= 2; i4--) { objArr[i4] = null; } f2266c = objArr; f2267d++; } } } } public E f(int i2) { E[] eArr = this.f2271h; E e2 = eArr[i2]; int i3 = this.f2272i; if (i3 <= 1) { a(this.f2270g, eArr, i3); this.f2270g = f2264a; this.f2271h = f2265b; this.f2272i = 0; } else { int[] iArr = this.f2270g; int i4 = 8; if (iArr.length <= 8 || i3 >= iArr.length / 3) { this.f2272i--; int i5 = this.f2272i; if (i2 < i5) { int[] iArr2 = this.f2270g; int i6 = i2 + 1; System.arraycopy(iArr2, i6, iArr2, i2, i5 - i2); Object[] objArr = this.f2271h; System.arraycopy(objArr, i6, objArr, i2, this.f2272i - i2); } this.f2271h[this.f2272i] = null; } else { if (i3 > 8) { i4 = i3 + (i3 >> 1); } int[] iArr3 = this.f2270g; Object[] objArr2 = this.f2271h; h(i4); this.f2272i--; if (i2 > 0) { System.arraycopy(iArr3, 0, this.f2270g, 0, i2); System.arraycopy(objArr2, 0, this.f2271h, 0, i2); } int i7 = this.f2272i; if (i2 < i7) { int i8 = i2 + 1; System.arraycopy(iArr3, i8, this.f2270g, i2, i7 - i2); System.arraycopy(objArr2, i8, this.f2271h, i2, this.f2272i - i2); } } } return e2; } public void a(int i2) { int[] iArr = this.f2270g; if (iArr.length < i2) { Object[] objArr = this.f2271h; h(i2); int i3 = this.f2272i; if (i3 > 0) { System.arraycopy(iArr, 0, this.f2270g, 0, i3); System.arraycopy(objArr, 0, this.f2271h, 0, this.f2272i); } a(iArr, objArr, this.f2272i); } } }
true
d4d66ecd111d60be07017d1d8b5aaf44644d1f92
Java
exetreme/MOB403Lab1bai1
/app/src/main/java/com/example/bai11/MainActivity.java
UTF-8
1,900
2.15625
2
[]
no_license
package com.example.bai11; import androidx.appcompat.app.AppCompatActivity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import java.io.IOException; import java.net.URL; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button btnload; private TextView tvload; private ImageView imload; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnload= findViewById(R.id.button); tvload =findViewById(R.id.textView); imload =findViewById(R.id.imageView); btnload.setOnClickListener(this); } @Override public void onClick(View v) { final Thread thread = new Thread(new Runnable() { @Override public void run() { final Bitmap bitmap= loadIMG("https://images.theconversation.com/files/177834/original/file-20170712-14488-19lw3sc.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=926&fit=clip"); imload.post(new Runnable() { @Override public void run() { tvload.setText("thanh cong"); imload.setImageBitmap(bitmap); } }); } }); thread.start(); } //ham load anh tu mang private Bitmap loadIMG(String link){ URL url; Bitmap bitmap=null; try { url = new URL(link); bitmap= BitmapFactory.decodeStream(url.openConnection().getInputStream()); }catch (IOException e) { e.printStackTrace(); } return bitmap; } }
true
16df8b20dd1b191c64ab4f2efad14fcbfe340eb8
Java
vvasabi/com.bradchen.faces.rest
/src/main/java/com/bradchen/faces/rest/FacesResourceFactory.java
UTF-8
1,194
2.3125
2
[]
no_license
package com.bradchen.faces.rest; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; import org.jboss.resteasy.spi.InjectorFactory; import org.jboss.resteasy.spi.ResourceFactory; /** * JSF implementation for the ResourceFactory. This class essentially does not * do much -- it just wraps around a bean instance into the ResourceFactory * interface. * * @author Brad Chen */ public final class FacesResourceFactory implements ResourceFactory { private final Object bean; /** * Creates a FacesResourceFactory with the bean instance specified. * * @param bean bean instance */ public FacesResourceFactory(Object bean) { this.bean = bean; } @Override public Object createResource(HttpRequest request, HttpResponse response, InjectorFactory factory) { return bean; } @Override public Class<?> getScannableClass() { return bean.getClass(); } @Override public void registered(InjectorFactory factory) { // not implemented } @Override public void requestFinished(HttpRequest request, HttpResponse response, Object resource) { // not implemented } @Override public void unregistered() { // not implemented } }
true
49880e85440679d072e6aa05dd571ed102c04d95
Java
valentintintin/RandSode
/app/src/main/java/lpsmin/randsode/models/database/Episode.java
UTF-8
2,781
2.40625
2
[]
no_license
package lpsmin.randsode.models.database; import com.raizlabs.android.dbflow.annotation.Column; import com.raizlabs.android.dbflow.annotation.PrimaryKey; import com.raizlabs.android.dbflow.annotation.Table; import com.raizlabs.android.dbflow.structure.BaseModel; import java.io.Serializable; @Table(database = AppDatabase.class) public class Episode extends BaseModel implements Serializable { @PrimaryKey private int id; @Column(name = "serie_id") private int serieId; @Column private String name; @Column private String air_date; @Column private int season_number; @Column private int episode_number; @Column private String still_path; @Column private float vote_average; @Column(defaultValue = "0") private int vote_count; @Column(defaultValue = "Date('now')") private long date_added; @Column private boolean watched; private String overview; public Episode() { super(); } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getSerieId() { return serieId; } public void setSerieId(int serieId) { this.serieId = serieId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSeason_number() { return season_number; } public void setSeason_number(int season_number) { this.season_number = season_number; } public int getEpisode_number() { return episode_number; } public void setEpisode_number(int episode_number) { this.episode_number = episode_number; } public String getStill_path() { return still_path; } public void setStill_path(String still_path) { this.still_path = still_path; } public float getVote_average() { return vote_average; } public void setVote_average(float vote_average) { this.vote_average = vote_average; } public int getVote_count() { return vote_count; } public void setVote_count(int vote_count) { this.vote_count = vote_count; } public long getDate_added() { return date_added; } public void setDate_added(long date_added) { this.date_added = date_added; } public boolean isWatched() { return watched; } public void setWatched(boolean watched) { this.watched = watched; } public String getAir_date() { return air_date; } public void setAir_date(String air_date) { this.air_date = air_date; } public String getOverview() { return overview; } }
true
894889ebe3ab0be7ee7f6bfa7b815f022a6911f5
Java
primarystudent/start
/start/src/main/java/wenlong/concurrent/CountDownLatchDemo.java
UTF-8
1,016
3.296875
3
[]
no_license
package wenlong.concurrent; import java.util.concurrent.CountDownLatch; public class CountDownLatchDemo { public static void main(String[] args) { try { demo(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void demo(int n) throws InterruptedException{ final CountDownLatch start = new CountDownLatch(1); final CountDownLatch end = new CountDownLatch(n); for(int i=0;i<n;i++){ Thread t = new Thread(){ public void run(){ try { start.await(); System.out.println("await end"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ end.countDown(); } } }; t.start(); } long startT = System.currentTimeMillis(); System.out.println(startT); start.countDown(); end.await(); long endt = System.currentTimeMillis(); System.out.println(endt-startT); } }
true
9754f4101bb367a280ea82c6814ce9f048741334
Java
nagashree-angadi/CompetativeCoding
/Coding Patterns/Breadth First Search/MinimumBinaryTreeDepth.java
UTF-8
1,607
4.21875
4
[]
no_license
/* * Minimum Depth of a Binary Tree (easy) * Find the minimum depth of a binary tree. * The minimum depth is the number of nodes along the shortest path from the root node to the nearest leaf node. * */ import java.util.*; class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } }; class MinimumBinaryTreeDepth { public static int findDepth(TreeNode root) { if (root == null) return 0; Queue<TreeNode> queue = new LinkedList<>(); queue.add(root); int res = 0; while (!queue.isEmpty()) { res++; int levelSize = queue.size(); for (int i = 0; i < levelSize; i++) { TreeNode curr = queue.poll(); if (curr.left == null && curr.right == null) return res; if (curr.left != null) queue.add(curr.left); if (curr.right != null) queue.add(curr.right); } } return res; } public static void main(String[] args) { TreeNode root = new TreeNode(12); root.left = new TreeNode(7); root.right = new TreeNode(1); root.right.left = new TreeNode(10); root.right.right = new TreeNode(5); System.out.println("Tree Minimum Depth: " + MinimumBinaryTreeDepth.findDepth(root)); root.left.left = new TreeNode(9); root.right.left.left = new TreeNode(11); System.out.println("Tree Minimum Depth: " + MinimumBinaryTreeDepth.findDepth(root)); } }
true
9511eabfa2112b333f633e63bb074b917eeebe8e
Java
dipu011995/SPRINGWS
/DAOProj103-CallbackInterface-RowCallBackHandler-for-BunchOfRecord/src/main/java/com/pk/test/CallbackInterfaceTest.java
UTF-8
989
2.5
2
[]
no_license
package com.pk.test; import java.util.ArrayList; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.dao.DataAccessException; import com.pk.dto.EmployeeDTO; import com.pk.service.EmployeeService; public class CallbackInterfaceTest { public static void main(String[] args) { ApplicationContext ctx = null; EmployeeDTO dto = null; EmployeeService service = null; List<EmployeeDTO> listDTO = null; //create ApplicationContext container ctx = new ClassPathXmlApplicationContext("com/pk/cfgs/applicationContext.xml"); service = ctx.getBean("empService", EmployeeService.class); try { listDTO = new ArrayList<EmployeeDTO>(); //invoke method listDTO = service.fetchEmployeeDetailsByJob("CLERK", "SALESMAN", "MANAGER"); System.out.println(listDTO); } catch (Exception e) { e.printStackTrace(); } }//main() }//class
true
170cff3b7005faf1fff797b34e0e52d03167a831
Java
WestRyanK/Ticket-To-Ride
/app/src/main/java/byu/codemonkeys/tickettoride/networking/ClientCommunicator.java
UTF-8
10,509
2.421875
2
[]
no_license
package byu.codemonkeys.tickettoride.networking; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import byu.codemonkeys.tickettoride.shared.Serializer; import byu.codemonkeys.tickettoride.shared.commands.*; import byu.codemonkeys.tickettoride.shared.results.*; import byu.codemonkeys.tickettoride.utils.HistoryDeserializer; public class ClientCommunicator { private static ClientCommunicator instance; private Serializer serializer; private String host; private int port; private static final int TIMEOUT = 10000; private static final String DEFAULT_HOST = "10.24.221.215"; // "192.168.1.3"; // "104.155.184.125"; private static final int DEFAULT_PORT = 8080; private ClientCommunicator() { host = DEFAULT_HOST; port = DEFAULT_PORT; serializer = new Serializer(); } /** * Returns the single ClientCommunicator instance. * * @return the ClientCommunicator instance. */ public static ClientCommunicator getInstance() { if (instance == null) { instance = new ClientCommunicator(); } return instance; } public void changeConfiguration(String host, int port) { this.host = host; this.port = port; } public LoginResult sendLogin(LoginCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.LOGIN), request), LoginResult.class); } catch (IOException e) { e.printStackTrace(); return new LoginResult(e.getMessage()); } } public Result sendLogout(LogoutCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.LOGOUT), request), Result.class); } catch (IOException e) { e.printStackTrace(); return new Result(e.getMessage()); } } public LoginResult sendRegister(RegisterCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.REGISTER), request), LoginResult.class); } catch (IOException e) { e.printStackTrace(); return new LoginResult(e.getMessage()); } } public PendingGameResult sendCreateGame(CreateGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.CREATE_GAME), request), PendingGameResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGameResult(e.getMessage()); } } public PendingGameResult sendJoinPendingGame(JoinPendingGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.JOIN_PENDING_GAME), request), PendingGameResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGameResult(e.getMessage()); } } public JoinExistingGameResult sendJoinExistingGame(JoinExistingGameCommandData request) { try { String json = getString(getURL(CommandType.JOIN_EXISTING_GAME), request); return HistoryDeserializer.deserializeObject(json, JoinExistingGameResult.class); } catch (IOException e) { e.printStackTrace(); return new JoinExistingGameResult(e.getMessage()); } } public PendingGamesResult sendLeavePendingGame(LeavePendingGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.LEAVE_PENDING_GAME), request), PendingGamesResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGamesResult(e.getMessage()); } } public PendingGamesResult sendCancelGame(CancelGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.CANCEL_GAME), request), PendingGamesResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGamesResult(e.getMessage()); } } public PendingGamesResult sendGetPendingGames(GetPendingGamesCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.GET_PENDING_GAMES), request), PendingGamesResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGamesResult(e.getMessage()); } } public ExistingGamesResult sendGetExistingGames(GetExistingGamesCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.GET_EXISTING_GAMES), request), ExistingGamesResult.class); } catch (IOException e) { e.printStackTrace(); return new ExistingGamesResult(e.getMessage()); } } public PendingGameResult sendGetPendingGame(GetPendingGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.GET_PENDING_GAME), request), PendingGameResult.class); } catch (IOException e) { e.printStackTrace(); return new PendingGameResult(e.getMessage()); } } public StartGameResult sendStartGame(StartGameCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.START_GAME), request), StartGameResult.class); } catch (IOException e) { e.printStackTrace(); return new StartGameResult(e.getMessage()); } } public HistoryResult sendUpdateHistory(UpdateHistoryCommandData request) { try { String json = getString(getURL(CommandType.UPDATE_HISTORY), request); return HistoryDeserializer.deserializeHistoryResult(json); } catch (IOException e) { e.printStackTrace(); return new HistoryResult(e.getMessage()); } } public DestinationCardResult sendDrawDestinationCards(DrawDestinationCardsCommandData request) { try { String string = getString(getURL(CommandType.DRAW_DESTINATION_CARDS), request); return serializer.deserialize(string, DestinationCardResult.class); } catch (IOException e) { e.printStackTrace(); return new DestinationCardResult(e.getMessage()); } } public DestinationCardResult sendChooseInitialDestinationCards(ChooseDestinationCardsCommandData request) { try { String string = getString(getURL(CommandType.CHOOSE_DESTINATION_CARDS), request); DestinationCardResult result = serializer.deserialize(string, DestinationCardResult.class); return result; } catch (IOException e) { e.printStackTrace(); return new DestinationCardResult(e.getMessage()); } } public Result sendSendMessage(SendMessageCommandData request) { try { return serializer.deserialize(getString(getURL(CommandType.SEND_MESSAGE), request), Result.class); } catch (IOException e) { e.printStackTrace(); return new Result(e.getMessage()); } } public DrawFaceUpTrainCardResult sendDrawFaceUpTrainCard(DrawFaceUpTrainCardCommandData request) { try { String string = getString(getURL(CommandType.DRAW_FACEUP_TRAIN_CARD), request); DrawFaceUpTrainCardResult result = serializer.deserialize(string, DrawFaceUpTrainCardResult.class); return result; } catch (IOException e) { e.printStackTrace(); return new DrawFaceUpTrainCardResult(e.getMessage()); } } public DrawDeckTrainCardResult sendDrawDeckTrainCard(DrawDeckTrainCardCommandData request) { try { String string = getString(getURL(CommandType.DRAW_DECK_TRAIN_CARD), request); DrawDeckTrainCardResult result = serializer.deserialize(string, DrawDeckTrainCardResult.class); return result; } catch (IOException e) { e.printStackTrace(); return new DrawDeckTrainCardResult(e.getMessage()); } } public ClaimRouteResult sendClaimRoute(ClaimRouteCommandData request) { try { String string = getString(getURL(request.getCommandType()), request); ClaimRouteResult result = serializer.deserialize(string, ClaimRouteResult.class); return result; } catch (IOException e) { e.printStackTrace(); return new ClaimRouteResult(e.getMessage()); } } /** * Constructs a full HTTP URL String to the specified path. * * @param path a valid HTTP path. * @return the constructed String. */ private String getURL(String path) { return String.format("http://%s:%d/%s", host, port, path); } /** * Sends the specified request to the specified URL and returns the response as a String. * * @param url a full HTTP URL. * @param request the Object that will be sent as the request body. * @return a String representation of the response. * @throws IOException */ private String getString(String url, Object request) throws IOException { byte[] bytes = getBytes(url, request); return new String(bytes); } /** * Sends the specified request to the specified URL and returns the reponse. * * @param url a full HTTP URL. * @param request the Object that will be sent as the request body. * @return the response. * @throws IOException */ private byte[] getBytes(String url, Object request) throws IOException { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); // TODO: Dynamically set these values. connection.setDoOutput(true); connection.setRequestMethod("GET"); connection.setConnectTimeout(TIMEOUT); try { OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(serializer.serialize(request)); writer.close(); // TODO: We should probably move this reading login into a utility class ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream in = connection.getInputStream(); int bytesRead = 0; byte[] buffer = new byte[1024]; while ((bytesRead = in.read(buffer)) > 0) { out.write(buffer, 0, bytesRead); } out.close(); return out.toByteArray(); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); throw e; // return serializer.serialize(Result.failed(e.getMessage())).getBytes(); } finally { connection.disconnect(); } } public String getHost() { return host; } public int getPort() { return port; } public static boolean isValidHost(String hostString) { return (hostString != null && !hostString.isEmpty()); } public static final int MIN_PORT_NUMBER = 0; public static final int MAX_PORT_NUMBER = 65535; public static boolean isValidPort(int portNumber) { return (portNumber >= MIN_PORT_NUMBER && portNumber <= MAX_PORT_NUMBER); } public static boolean isValidPort(String portString) { try { int portNumber = Integer.parseInt(portString); return isValidPort(portNumber); } catch (NumberFormatException e) { return false; } } }
true
f87195fc44adf054edf3dcf85bb18b739205b407
Java
dragonxu/street_light_yancheng
/resource/src/main/java/com/exc/street/light/resource/entity/electricity/CanControlObject.java
UTF-8
1,325
1.789063
2
[]
no_license
package com.exc.street.light.resource.entity.electricity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * 控制对象表 * * @author Linshiwen * @date 2018/5/28 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @TableName("can_control_object") public class CanControlObject extends Model<CanScene> { private static final long serialVersionUID = 3621507195776660484L; @TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(name = "id", value = "id,自增") private Integer id; @ApiModelProperty(name = "tagId", value = "控制对象编码") private Integer tagId; @ApiModelProperty(name = "tagType", value = "控制对象类型") private Integer tagType; @ApiModelProperty(name = "tagValue", value = "控制值") private Double tagValue; @ApiModelProperty(name = "time", value = "延时时长或者定时时长") private Integer time = 0; @ApiModelProperty(name = "sid", value = "sid") private Integer sid; }
true
bd939c7057fda2eb894418398c149b3fe4796f8b
Java
wendrewshay/ZookeeperCluster
/src/main/java/com/xwq/zk/recipes/lock/LockListener.java
UTF-8
366
2.296875
2
[]
no_license
package com.xwq.zk.recipes.lock; /** * @ClassName: LockListener * @Description: 锁的获取和释放监听回调 * @author: XiaWenQiang * @date: 2017年7月21日 上午10:03:33 * */ public interface LockListener { /** * 获取锁回调 */ public void lockAcquired(); /** * 释放锁回调 */ public void lockReleased(); }
true
b675117e8fb54135ac3cdc1ccd634cb6497888ec
Java
moon-watcher/really-old-stuff
/other/Svg2Lrv/src/Viewer.java
UTF-8
5,316
2.234375
2
[ "Apache-2.0" ]
permissive
/* * This source code file is part of the "Open SVG Viewer" project. * Copyright (C) 2002 PT Inova��o * Copyright (C) 2003 Miguel Castro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ import net.sourceforge.opensvgviewer.Scene; import javax.xml.parsers.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.w3c.dom.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Viewer extends Frame { /* command line starter */ public static void main(String args[]) { new Viewer(); } /* class constructor */ public Viewer() { toolBar = new ToolBar(this); scene = new Scene(); canvas = new OsvCanvas(this); setVisible(false); setResizable(true); WindowAdapter window = new WindowAdapter() { public void windowClosing(WindowEvent evt) { exit(0); } public void windowResized(WindowEvent evt) { System.out.println("resized"); } public void windowIconified(WindowEvent e) { System.out.println("iconified"); } public void windowDeiconified(WindowEvent e) { System.out.println("deiconified"); } }; addWindowListener(window); setTitle(appTitle); setLayout(layout); // gfxEngine.setLocation(new Point(100,0)); add(canvas, BorderLayout.CENTER); // computador de mao // appWidth=250; // canvas 240 + 10 (frame border) // appHeight=350; // canvas 320 + 30 (frame border) appWidth = 200; appHeight = 320; setSize(appWidth, appHeight); // setLocation(10,30); appCenterX = (int) (appWidth / 2); appCenterY = (int) (appHeight / 2); // everything's done! ready to show it setVisible(true); // sleeping one second ... give some time to frame setVisible // try { Thread.sleep(1000); } catch (Exception e) { } // the canvas can only be initializated if the Frame is visible canvas.init(); canvas.reset(); } public Scene getScene() { return scene; } public ToolBar getToolBar() { return toolBar; } /** ****************************************** */ /** ACTIONS ********************************* */ /** ****************************************** */ public void closeAction() { exit(0); } public void loadFileAction() { loader = new FileDialog(this, "Browse", FileDialog.LOAD); loader.setDirectory("../examples"); loader.setFile("*.svg"); // mostrar o fileDialog e esperar pelo resultado loader.show(); // ok! o utilizador escolheu um ficheiro filename = loader.getFile(); path = loader.getDirectory(); if (filename != null) { docBuilderFactory = DocumentBuilderFactory.newInstance(); try { db = docBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException pce) { System.out .println("Viewer.ERRO: Cannot create new Document Builder"); } try { doc = db.parse(new File(path + filename)); setTitle(appTitle + "[" + filename + "]"); scene.reset(); Parser.parse(doc, scene); canvas.reset(); canvas.draw(); } catch (SAXException se) { System.out.println("Viewer.ERRO: " + se.getMessage()); System.exit(1); } catch (IOException ioe) { System.out.println("Viewer.ERRO: " + ioe.getMessage()); System.exit(1); } } } public void moveAction() { canvas.setState(canvas.MOVE); } public void zoomAction() { canvas.setState(canvas.ZOOM); } public void rotateAction() { canvas.setState(canvas.ROTATE); } public boolean keyDown(Event e, int keyb) { if (keyb == Event.UP) { scene.translate(0.0f, -40.0f); canvas.draw(); } else if (keyb == Event.DOWN) { scene.translate(0.0f, 40.0f); canvas.draw(); } else if (keyb == Event.LEFT) { scene.translate(-40.0f, 0.0f); canvas.draw(); } else if (keyb == Event.RIGHT) { scene.translate(40.0f, 0.0f); canvas.draw(); } return true; } public void mousePressed(MouseEvent evt) { requestFocus(); } private void exit(int e) { System.exit(e); } private final static String appTitle = "Open Gnu Viewer for Svg"; private static Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); private static int appWidth = screen.width; private static int appHeight = screen.height; private static int appCenterX = (int) (appWidth / 2); private static int appCenterY = (int) (appHeight / 2); private static ToolBar toolBar; private static Scene scene; private static OsvCanvas canvas; private static BorderLayout layout = new BorderLayout(); private static FileDialog loader; private static String filename = ""; private static String path; private static Document doc; private static DocumentBuilder db; private static DocumentBuilderFactory docBuilderFactory; }
true
6a0bd01f2c0610c6d5a468b7aa1f28a74a4059f9
Java
sfdcxc/Blog
/code/lanqiaoTrain/src/com/darcy/lanqiao2013/_03振兴中华.java
UTF-8
424
3.15625
3
[]
no_license
package com.darcy.lanqiao2013; public class _03振兴中华 { public static void main(String[] args) { //重复 //变化 //边界 int ans = dfs(0, 0); System.out.println(ans); } private static int dfs(int x, int y) { if(x == 3 || y == 4){ return 1; } return dfs(x + 1, y) + dfs(x, y + 1); //两种走法的路线数相加 } }
true
30f5b97687ac7fb11384719e59b8a0474bbe9fd6
Java
PUCRS-Poli-ES-ALAV/8-algoritmos-gulosos-problemas-do-escal-de-intervalos-feliperoll-e-cristian-cotrena
/Main.java
UTF-8
644
2.9375
3
[]
no_license
import java.util.Arrays; public class Main { public static int[] guloso(int[] s, int[] f, int n) { int[] x = new int[n]; int i = 0; f[0] = 0; for (int k = 0; k < n; k++) { if (s[k] > f[i]) { x[k] = 1; i = k; } } return x; } public static void main(String[] args) { int[] s = { 5, 5, 6, 6, 7, 8, 8, 8, 9, 9, 10 }; int[] f = {2, 3, 4, 5, 6, 7, 9, 10, 12, 14, 16}; int n = s.length; System.out.println(Arrays.toString(guloso(s, f, n))); } }
true
e061b097ed53047a9e278280b365fe8f2cf9e436
Java
tofiquek/E-Commerce
/src/main/java/com/bacancy/ecommerce/controller/CategoryController.java
UTF-8
2,093
2.21875
2
[]
no_license
package com.bacancy.ecommerce.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.bacancy.ecommerce.dto.CategoryDto; import com.bacancy.ecommerce.dto.UserDto; import com.bacancy.ecommerce.service.CategoryService; @RestController @RequestMapping("/categories") public class CategoryController { @Autowired private CategoryService categoryService; @GetMapping public ResponseEntity<List<CategoryDto>> findAllCategories(){ List<CategoryDto> categories = categoryService.allCategory(); return new ResponseEntity(categories, HttpStatus.OK); } @GetMapping("/{id}") public ResponseEntity<CategoryDto> findCategory(@PathVariable(name = "id") Long id) { return new ResponseEntity( categoryService.getCategoryById(id),HttpStatus.OK); } @PostMapping("/{userId}") public ResponseEntity<UserDto> saveCategory(@PathVariable(name = "userId") Long userId,@RequestBody CategoryDto categoryDto) { return new ResponseEntity(categoryService.addCategory(userId, categoryDto), HttpStatus.OK) ; } @PutMapping("/{userId}") public ResponseEntity<UserDto> updateCategory(@PathVariable(name = "userId") Long userId,@RequestBody CategoryDto categoryDto) { return new ResponseEntity(categoryService.updateCategory(userId, categoryDto), HttpStatus.OK) ; } @DeleteMapping("/{id}") public ResponseEntity deleteCategory(@PathVariable(name="id") Long id) { categoryService.deleteCategory(id); return new ResponseEntity(HttpStatus.OK); } }
true
ae1e66ca6097d1f13ca886252b198edfaac1f49f
Java
thanniaB/catapi-android
/app/src/main/java/org/otfusion/votecats/ui/activities/MainActivity.java
UTF-8
2,012
2.171875
2
[ "Apache-2.0" ]
permissive
package org.otfusion.votecats.ui.activities; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; import com.squareup.otto.Bus; import com.squareup.otto.Subscribe; import org.otfusion.votecats.R; import org.otfusion.votecats.common.model.Cat; import org.otfusion.votecats.providers.CatLoadedEvent; import org.otfusion.votecats.service.CatServiceImpl; import javax.inject.Inject; public class MainActivity extends CatActivity { @Inject CatServiceImpl _catService; @Inject Bus _bus; private Button _loadCatButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); loadUIElements(); _bus.register(this); } // TODO inject ui elements private void loadUIElements() { _loadCatButton = (Button) findViewById(R.id.load_cat_button); _loadCatButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { _catService.getCatFromApi(); _loadCatButton.setEnabled(false); } }); } @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; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Subscribe public void handleCatLoadedEvent(CatLoadedEvent catLoadedEvent) { Cat cat = catLoadedEvent.getCat(); Toast.makeText(this, cat.getImageUrl(), Toast.LENGTH_LONG).show(); _loadCatButton.setEnabled(true); } }
true
3cdea0f230d6d094afc647792529b631a928dc06
Java
shakwer1230/order-archetype
/order-common/src/main/java/com/microsoft/order/common/tools/log/logback/LogbackExEncoder.java
UTF-8
494
1.765625
2
[]
no_license
package com.microsoft.order.common.tools.log.logback;//package com.fang.order.common.tools.log.logback; // //import ch.qos.logback.classic.encoder.PatternLayoutEncoder; // //import static ch.qos.logback.classic.PatternLayout.defaultConverterMap; // ///** // * @author: 陈偲 // * @date: 2017/11/29 19:19 // * @version: 1.0 // */ //public class LogbackExEncoder extends PatternLayoutEncoder { // // static{ // defaultConverterMap.put("ip",IpLogConfig.class.getName()); // } // //}
true
381b40f5767c4606771c3c60da9de4059d4ee68a
Java
checketts/promregator
/src/main/java/org/cloudfoundry/promregator/auth/OAuth2XSUAAEnricher.java
UTF-8
6,228
2.28125
2
[ "Apache-2.0" ]
permissive
package org.cloudfoundry.promregator.auth; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Base64; import java.util.List; import org.apache.http.Consts; import org.apache.http.NameValuePair; import org.apache.http.ParseException; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.cloudfoundry.promregator.config.OAuth2XSUAAAuthenticationConfiguration; import com.google.gson.Gson; import com.google.json.JsonSanitizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class OAuth2XSUAAEnricher implements AuthenticationEnricher { private static final Logger log = LoggerFactory.getLogger(OAuth2XSUAAEnricher.class); static final CloseableHttpClient httpclient = HttpClients.createDefault(); private final OAuth2XSUAAAuthenticationConfiguration config; public OAuth2XSUAAEnricher(OAuth2XSUAAAuthenticationConfiguration config) { super(); this.config = config; } @Override public void enrichWithAuthentication(HttpGet httpget) { final RequestConfig requestConfig = httpget.getConfig(); final String jwt = getBufferedJWT(requestConfig); if (jwt == null) { log.error("Unable to enrich request with JWT"); return; } httpget.setHeader("Authorization", String.format("Bearer %s", jwt)); } private String bufferedJwt = null; private Instant validUntil = null; private synchronized String getBufferedJWT(RequestConfig config) { if (this.bufferedJwt == null || Instant.now().isAfter(this.validUntil)) { // JWT is not available or expired this.bufferedJwt = getJWT(config); } return bufferedJwt; } private String getJWT(RequestConfig config) { log.info("Fetching new JWT token"); String url = String.format("%s?grant_type=client_credentials", this.config.getTokenServiceURL()); if (this.config.getScopes() != null) { // see also https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ try { url += String.format("&scope=%s", URLEncoder.encode(this.config.getScopes(), StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { log.error("Error while adding scope information to request URL", e); return null; } } HttpPost httpPost = new HttpPost(url); httpPost.setConfig(config); if (this.config.getClient_id().contains(":")) { log.error("Security: jwtClient_id contains colon"); return null; } if (this.config.getClient_secret().contains(":")) { log.error("Security: jwtClient_id contains colon"); return null; } String b64encoding = String.format("%s:%s", this.config.getClient_id(), this.config.getClient_secret()); byte[] encodedBytes = b64encoding.getBytes(StandardCharsets.UTF_8); String encoding = Base64.getEncoder().encodeToString(encodedBytes); httpPost.setHeader("Authorization", String.format("Basic %s", encoding)); httpPost.setHeader("Content-Type", "application/json"); /* closing the connection afterwards is important! * Background: httpclient will otherwise try to keep the connection open. * We won't be calling often anyway, so the server would be drained from resources. * Moreover, if the server has gone away in the meantime, the next attempt to * call would fail with a recv error when reading from the socket. */ httpPost.setHeader("Connection", "close"); List<NameValuePair> form = new ArrayList<>(); form.add(new BasicNameValuePair("response_type", "token")); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(form, Consts.UTF_8); httpPost.setEntity(formEntity); CloseableHttpResponse response = null; String json = null; try { try { response = httpclient.execute(httpPost); } catch (ClientProtocolException e) { log.error("Unable to read from the token server", e); return null; } catch (IOException e) { log.error("IO Exception while reading from the token server", e); return null; } if (response.getStatusLine().getStatusCode() != 200) { log.error(String.format("Server did not respond with ok while fetching JWT from token server; status code provided: %d", response.getStatusLine().getStatusCode())); return null; } try { json = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); } catch (ParseException e) { log.error("GSON parser exception on JWT response from token server", e); return null; } catch (IOException e) { log.error("IO Exception while running GSON parser", e); return null; } } finally { if (response != null) { try { response.close(); } catch (IOException e) { log.info("Unable to properly close JWT-retrieval connection", e); } } } if (json == null) { log.warn("Null-JSON detected on OAuth response"); return null; } Gson gson = new Gson(); TokenResponse oAuthResponse = gson.fromJson(JsonSanitizer.sanitize(json), TokenResponse.class); String jwt = oAuthResponse.getAccessToken(); log.info(String.format("JWT token retrieved: %s...", jwt.substring(0, Math.min(jwt.length() / 2, 30)))); int timeOutForUs = Math.max(oAuthResponse.getExpiresIn() - 30, oAuthResponse.getExpiresIn() / 2); this.validUntil = Instant.now().plus(timeOutForUs, ChronoUnit.SECONDS); log.info(String.format("JWT is valid until %s", this.validUntil.toString())); return jwt; } private static class TokenResponse { private String access_token; private int expires_in; public String getAccessToken() { return access_token; } public int getExpiresIn() { return expires_in; } } }
true
ef142f40338626ca6d8d0dfbb6d086c420da56ee
Java
ColinParrott/Songle
/app/src/main/java/colinparrott/com/songle/storage/UserPrefsManager.java
UTF-8
5,582
2.921875
3
[]
no_license
package colinparrott.com.songle.storage; import android.content.Context; import android.content.SharedPreferences; import android.util.Log; import com.google.gson.Gson; import java.lang.reflect.Type; import java.util.HashSet; import java.util.Set; /** * This class is for reading and writing data about the user's progression in the game * such as the list of songs they've guessed */ public class UserPrefsManager { /** * SharedPreferences object used to read/write data */ private SharedPreferences sharedPrefs; /** * Context which called for access */ private Context context; /** * Key used for storing list of completed songs */ private static final String COMPLETED_SONGS_KEY = "completed_songs"; /** * Key used for checking in-progress state */ private static final String GAME_IN_PROGRESS_KEY = "in_progress"; /** * The key used for storing all data */ private static final String USER_DETAILS_KEY = "userDetails"; /** * Debugging tag */ private static final String TAG = "UserPrefsManager"; public UserPrefsManager(Context context) { this.context = context; this.sharedPrefs = context.getSharedPreferences(USER_DETAILS_KEY, Context.MODE_PRIVATE); } /** * Adds song to list of completed songs in local storage via SharedPreferences * @param number Number of completed song */ public void addCompletedSong(int number) { Set<String> completedSongSet = sharedPrefs.getStringSet(COMPLETED_SONGS_KEY, null); // Adds song new to set (creates set if there wasn't one before) if(completedSongSet != null) { completedSongSet.add(String.valueOf(number)); } else { completedSongSet = new HashSet<>(); completedSongSet.add(String.valueOf(number)); } // Store updated set into storage SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putStringSet(COMPLETED_SONGS_KEY, completedSongSet); editor.clear(); editor.commit(); // Debugging ************ System.out.println("Added song " + number + " to completed list"); System.out.println("Completed list: "); Set<String> test = sharedPrefs.getStringSet(COMPLETED_SONGS_KEY, null); if(test != null) for(String s : test) { System.out.println(s); } else { System.out.println("[ERROR] SHARED PREFS 'completed_songs' NULL WHEN IT SHOULD NOT BE"); } // ********************** } /** * Gets list of completed song numbers from storage * @return List of song numbers user has completed, null if user has completed none */ public int[] getCompletedNumbersInt() { Set<String> completedSongSet = sharedPrefs.getStringSet(COMPLETED_SONGS_KEY, null); if(completedSongSet != null) { int[] ints = new int[completedSongSet.size()]; String[] songArray = completedSongSet.toArray(new String[completedSongSet.size()]); for (int i = 0; i < songArray.length; i++) { ints[i] = Integer.parseInt(songArray[i]); } return ints; } // If "completed_songs" key is not in storage, return empty array as // this means user has not completed a song return new int[] {}; } /** * Gets the completed numbers in their stored format a Set of Strings * @return Set of completed numbers as strings */ public Set<String> getCompletedNumbersString() { return sharedPrefs.getStringSet(COMPLETED_SONGS_KEY, null); } /** * Sets the last game in-progress value * @param inProgress is a game in-progress */ public void setGameInProgress(boolean inProgress) { Log.d(TAG, "SET GAME IN PROGRESS: " + inProgress); SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putBoolean(GAME_IN_PROGRESS_KEY, inProgress); editor.commit(); } /** * Save an object in storage as a string through serialization (GSON library) * @param key Key to store object in * @param obj The actual object to store * @param t The type of the object */ public void saveObject(String key, Object obj, Type t) { Gson gson = new Gson(); String json = gson.toJson(obj, t); SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putString(key, json); editor.commit(); Log.d(TAG, "Successfully saved: " + key); } /** * Retrieve an object from storage via deserialization * @param key Key of object to retrieve * @param t Type to return object in * @param <T> Type to return object in * @return Object from storage */ public <T> T retrieveObject(String key, Type t) { Gson gson = new Gson(); if(sharedPrefs.contains(key)) { String json = sharedPrefs.getString(key, null); return gson.fromJson(json, t); } else { Log.w(TAG, key + " NOT CONTAINED IN SHARED PREFS"); return null; } } /** * Gets the last game in-progress value * @return True if game was in-progress; false otherwise */ public boolean isGameInProgress() { return sharedPrefs.getBoolean(GAME_IN_PROGRESS_KEY, false); } }
true
9987509fcc997bf8bb5fffe1816a73be7ac9ede7
Java
rkausch/opensphere-desktop
/open-sphere-base/core/src/main/java/com/bitsys/common/http/ssl/KeyStoreUtils.java
UTF-8
11,762
2.609375
3
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
package com.bitsys.common.http.ssl; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.LinkedHashSet; import java.util.Set; import org.apache.commons.lang3.StringUtils; import com.bitsys.common.http.util.UrlUtils; /** * <code>KeyStoreUtils</code> provides utilities for loading Java key stores. */ public final class KeyStoreUtils { /** The Java system property name for the key store path. */ public static final String KEY_STORE = "javax.net.ssl.keyStore"; /** The Java system property name for the key store password. */ public static final String KEY_STORE_PASSWORD = "javax.net.ssl.keyStorePassword"; /** The Java system property name for the key store type. */ public static final String KEY_STORE_TYPE = "javax.net.ssl.keyStoreType"; /** The Java system property name for the trust store path. */ public static final String TRUST_STORE = "javax.net.ssl.trustStore"; /** The Java system property name for the trust store password. */ public static final String TRUST_STORE_PASSWORD = "javax.net.ssl.trustStorePassword"; /** The Java system property name for the trust store type. */ public static final String TRUST_STORE_TYPE = "javax.net.ssl.trustStoreType"; /** The Java KeyStore type. */ public static final String JKS = "JKS"; /** The PKCS#12 type. */ public static final String PKCS12 = "PKCS12"; /** * Prevents the constructions of a <code>KeyStoreUtils</code>. */ private KeyStoreUtils() { } /** * Loads the system default key store. This method uses the values from * <code>javax.net.ssl.keyStore</code>, * <code>javax.net.ssl.keyStorePassword</code> and, optionally, * <code>javax.net.ssl.keyStoreType</code> to load the key store. * * @return the key store or <code>null</code> if * <code>javax.net.ssl.keyStore</code> is not set. * @throws KeyStoreException if unable to create a key store using the value * from <code>javax.net.ssl.keyStoreType</code>. * @throws NoSuchAlgorithmException if the algorithm used to check the * integrity of the key store cannot be found. * @throws CertificateException if any of the certificates in the key store * could not be loaded. * @throws IOException if any I/O error occurs while opening or reading the * key store. */ public static KeyStore getSystemKeyStore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { return loadKeyStore(getSystemKeyStorePath(), System.getProperty(KEY_STORE_PASSWORD, ""), System.getProperty(KEY_STORE_TYPE, KeyStore.getDefaultType())); } /** * Returns the system key store path. * * @return the system key store path or <code>null</code> if not set. */ public static String getSystemKeyStorePath() { return System.getProperty(KEY_STORE); } /** * Returns the system key store password. * * @return the system key store password or <code>null</code> if not set. */ public static char[] getSystemKeyStorePassword() { final String password = System.getProperty(KEY_STORE_PASSWORD); return password == null ? null : password.toCharArray(); } /** * Loads the system default trust store. This method uses the values from * <code>javax.net.ssl.trustStore</code>, * <code>javax.net.ssl.trustStorePassword</code> and, optionally, * <code>javax.net.ssl.trustStoreType</code> to load the trust store. * * @return the trust store or <code>null</code> if * <code>javax.net.ssl.trustStore</code> is not set. * @throws KeyStoreException if unable to create a key store using the value * from <code>javax.net.ssl.trustStoreType</code>. * @throws NoSuchAlgorithmException if the algorithm used to check the * integrity of the trust store cannot be found. * @throws CertificateException if any of the certificates in the trust * store could not be loaded. * @throws IOException if any I/O error occurs while opening or reading the * trust store. */ public static KeyStore getSystemTrustStore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { return loadKeyStore(getSystemTrustStorePath(), System.getProperty(TRUST_STORE_PASSWORD, ""), System.getProperty(TRUST_STORE_TYPE, KeyStore.getDefaultType())); } /** * Returns the system key store path. * * @return the system key store path or <code>null</code> if not set. */ public static String getSystemTrustStorePath() { return System.getProperty(TRUST_STORE); } /** * Returns the system trust store password. * * @return the system trust store password or <code>null</code> if it is not * set. */ public static char[] getSystemTrustStorePassword() { final String password = System.getProperty(TRUST_STORE_PASSWORD); return password == null ? null : password.toCharArray(); } /** * Loads a Java KeyStore. * * @param keyStorePath the key store path. * @param password the key store password. * @param typeHint the hint for the key store type or <code>null</code>. * @return the key store. * @throws KeyStoreException if unable to create a key store using any type. * @throws NoSuchAlgorithmException if the algorithm used to check the * integrity of the key store cannot be found. * @throws CertificateException if any of the certificates in the key store * could not be loaded. * @throws IOException if any I/O error occurs while opening or reading the * key store. If the password is incorrect, the cause will be an * <code>UnrecoverableKeyException</code> or an * <code>ArithmeticException</code>. */ private static KeyStore loadKeyStore(final String keyStorePath, final String password, final String typeHint) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore keyStore = null; // If the trust store is defined. if (StringUtils.isNotBlank(keyStorePath)) { keyStore = loadKeyStore(keyStorePath, password.toCharArray(), typeHint); } return keyStore; } /** * Loads a Java KeyStore. * * @param keyStorePath the key store path. * @param password the key store password. * @param typeHint the hint for the key store type or <code>null</code>. * @return the key store. * @throws KeyStoreException if unable to create a key store using any type. * @throws NoSuchAlgorithmException if the algorithm used to check the * integrity of the key store cannot be found. * @throws CertificateException if any of the certificates in the key store * could not be loaded. * @throws IOException if any I/O error occurs while opening or reading the * key store. If the password is incorrect, the cause will be an * <code>UnrecoverableKeyException</code> or an * <code>ArithmeticException</code>. */ public static KeyStore loadKeyStore(final String keyStorePath, final char[] password, final String typeHint) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { return loadKeyStore(UrlUtils.toUrl(keyStorePath), password, typeHint); } /** * Loads the key store. * * @param keyStoreUrl the key store URL. * @param password the key store password. * @param typeHint the hint for the key store type or <code>null</code>. * @return the key store. * @throws KeyStoreException if unable to create a key store using any type. * @throws NoSuchAlgorithmException if the algorithm used to check the * integrity of the key store cannot be found. * @throws CertificateException if any of the certificates in the key store * could not be loaded. * @throws IOException if any I/O error occurs while opening or reading the * key store. If the password is incorrect, the cause will be an * <code>UnrecoverableKeyException</code> or an * <code>ArithmeticException</code>. */ public static KeyStore loadKeyStore(final URL keyStoreUrl, final char[] password, final String typeHint) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { if (keyStoreUrl == null) { throw new IllegalArgumentException("The key store URL is null"); } if (password == null) { throw new IllegalArgumentException("The key store password is null"); } Exception firstException = null; KeyStore keyStore = null; // Attempt to process each of the supported key store types. for (final String type : getSupportedKeyStoreTypes(typeHint)) { try (InputStream inputStream = keyStoreUrl.openStream()) { final KeyStore tmpKeyStore = KeyStore.getInstance(type); tmpKeyStore.load(inputStream, password); keyStore = tmpKeyStore; break; } catch (final KeyStoreException e) { // The provider key store type was invalid. Try the next one. if (firstException == null) { firstException = e; } } catch (final IOException e) { // If the IOException's cause is an UnrecoverableKeyException or // an // ArithmeticException, then the password is incorrect so just // throw // the exception. if (e.getCause() instanceof UnrecoverableKeyException || e.getCause() instanceof ArithmeticException) { throw e; } if (firstException == null) { firstException = e; } } } // If the key store was not loaded, throw the first inhibited // exception. if (keyStore == null) { if (firstException instanceof KeyStoreException) { throw (KeyStoreException)firstException; } throw new IOException(firstException); } return keyStore; } /** * Returns the set of supported key store types using the given type hint. * If the hint is specified, it will be the first type in the set. * * @param typeHint an optional key store type. * @return the set of supported key store types. */ public static Set<String> getSupportedKeyStoreTypes(final String typeHint) { final Set<String> types = new LinkedHashSet<>(); if (typeHint != null) { types.add(typeHint.toUpperCase()); } types.add(KeyStore.getDefaultType().toUpperCase()); types.add(JKS); types.add(PKCS12); return types; } }
true
9ece321eb044ba18a8aba38b971c3f4524bdbcb3
Java
ao-libre/finisterra
/design/src/design/editors/AnimationEditor.java
UTF-8
3,879
2.421875
2
[]
no_license
package design.editors; import com.badlogic.gdx.Screen; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.*; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import design.editors.fields.FieldEditor; import design.editors.fields.FieldProvider; import design.editors.fields.FloatEditor; import design.editors.fields.IntegerEditor; import design.screens.ScreenManager; import design.screens.views.View; import model.textures.AOAnimation; import org.jetbrains.annotations.NotNull; import java.util.Arrays; import static launcher.DesignCenter.SKIN; public class AnimationEditor extends Dialog { private AOAnimation animation; public AnimationEditor(AOAnimation animation) { super("Animation Editor", SKIN); this.animation = animation; addTable(); button("Cancel", false); button("OK", animation); } @NotNull public static Table getTable(AOAnimation animation, FieldEditor.FieldListener listener) { Table table = new Table(SKIN); table.defaults().growX().uniform(); createContent(animation, listener, table); return table; } public static void createContent(AOAnimation animation, FieldEditor.FieldListener listener, Table table) { table.add(IntegerEditor.create("ID", id -> { animation.setId(id); // TODO refactor: search all items that use this animation to change it }, animation::getId, listener)).expandX().row(); table.add(FloatEditor.simple("Speed", animation::setSpeed, animation::getSpeed, listener)).row(); int[] frames = animation.getFrames(); for (int i = 0; i < frames.length; i++) { Table frameTable = new Table(); int finalI = i; Actor actor = IntegerEditor.create("Frame-" + i, FieldProvider.IMAGE, integer -> frames[finalI] = integer, () -> frames[finalI], listener); Button removeFrame = new Button(SKIN, "delete"); removeFrame.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { table.clear(); int[] newFrames = new int[frames.length - 1]; for (int j = 0; j < frames.length; j++) { if (j != finalI) { int index = j < finalI ? j : j - 1; newFrames[index] = frames[j]; } } animation.setFrames(newFrames); createContent(animation, listener, table); Screen current = ScreenManager.getInstance().getCurrent(); ((View) current).getItemView().setState(View.State.MODIFIED); } }); frameTable.add(actor).growX(); frameTable.add(removeFrame); table.add(frameTable).row(); } Button addFrame = new TextButton("Frame", SKIN, "new"); addFrame.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { table.clear(); animation.setFrames(Arrays.copyOf(frames, frames.length + 1)); animation.getFrames()[animation.getFrames().length - 1] = 0; createContent(animation, listener, table); Screen current = ScreenManager.getInstance().getCurrent(); ((View) current).getItemView().setState(View.State.MODIFIED); } }); table.add(addFrame).fill(false, false).left(); } private void addTable() { getContentTable().add(new ScrollPane(getTable(animation, () -> { }))).prefHeight(300).prefWidth(300); } }
true
970d63da1854c2bd5234a1f7149224ddd85954de
Java
xdewx/android
/CoolWeather/app/src/main/java/cn/wdywae/coolweather/db/County.java
UTF-8
843
2.109375
2
[]
no_license
package cn.wdywae.coolweather.db; import org.litepal.crud.DataSupport; /** * Created by hasee on 2017/7/29. */ public class County extends DataSupport { private int id; private String name; private String id_weather; private int id_city; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId_weather() { return id_weather; } public void setId_weather(String id_weather) { this.id_weather = id_weather; } public int getId_city() { return id_city; } public void setId_city(int id_city) { this.id_city = id_city; } }
true
6db739ed3b5e4261bfa83bd5f4c0632a383a73d6
Java
brianstorti/dojos-codeit
/LookAndSay/src/tests/LookAndSayTest.java
IBM852
2,285
2.875
3
[]
no_license
package tests; import main.FormatterInFull; import main.LookAndSay; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class LookAndSayTest { private LookAndSay lookAndSay; @Before public void before(){ lookAndSay = new LookAndSay(); } @Test public void testEntradaMaisSimples() { Assert.assertEquals("11", lookAndSay.evaluate("1")); } @Test public void testDoisDigitosIguais() { Assert.assertEquals("21", lookAndSay.evaluate("11")); } @Test public void testDoisDigitosDiferentes() { Assert.assertEquals("1112", lookAndSay.evaluate("12")); } @Test public void testTresDigitosRepetindo() { Assert.assertEquals("111211", lookAndSay.evaluate("121")); } @Test public void testNumeroSimplesComSaidaPorExtenso() { lookAndSay = new LookAndSay(new FormatterInFull()); Assert.assertEquals("um 1", lookAndSay.evaluate("1")); } @Test public void testDoisDigitosComSaidaPorExtenso() { lookAndSay = new LookAndSay(new FormatterInFull()); Assert.assertEquals("um 1 um 2", lookAndSay.evaluate("12")); } @Test public void testTresDigitosRepetidosComSaidaPorExtenso() { lookAndSay = new LookAndSay(new FormatterInFull()); Assert.assertEquals("trs 1", lookAndSay.evaluate("111")); } @Test public void testDoisDigitosRepetidosEUmNaoSaidaPorExtenso() { lookAndSay = new LookAndSay(new FormatterInFull()); Assert.assertEquals("um 1 um 2 um 1", lookAndSay.evaluate("121")); } @Test public void tetstNumeroComplexoSaidaPorExtenso() { lookAndSay = new LookAndSay(new FormatterInFull()); Assert.assertEquals("dois 1 cinco 7 um 8 um 7", lookAndSay.evaluate("117777787")); } @Test public void testSomatorioDigitosElemento() { Assert.assertEquals(new Long(2), lookAndSay.sum("11")); } @Test public void testSomatorioDigitosDaQuadragesimaSequencia() { Assert.assertEquals(new Long(139088), lookAndSay.sumFortySequence("1")); } @Test public void testSomatorioDigitosDaQuadragesimaSequenciaCom2() { Long resultOf2 = new Long(161739); Assert.assertEquals(resultOf2, lookAndSay.sumFortySequence("2")); Assert.assertEquals(new Long(resultOf2 + 1L), lookAndSay.sumFortySequence("3")); Assert.assertEquals(new Long(resultOf2 + 7L), lookAndSay.sumFortySequence("9")); } }
true
49e13e44adcdfb09717427693e85d8a3718501fb
Java
Avik1914/Competitive-Programming
/string-to-integer-atoi/string-to-integer-atoi.java
UTF-8
806
3.109375
3
[]
no_license
class Solution { public int myAtoi(String s) { int len=s.length(); char[] arr=s.toCharArray(); int itr=0; while(itr<len && arr[itr]==' ') itr++; if(itr==len) return 0; int sign=1; if(arr[itr]=='-' || arr[itr]=='+'){ sign=arr[itr]=='-'?-1:1; itr++; } int val=0; while(itr<len && Character.isDigit(arr[itr])){ if(val>Integer.MAX_VALUE/10 || (val==Integer.MAX_VALUE/10 && arr[itr]>'7')){ if(sign==1) return Integer.MAX_VALUE; return Integer.MIN_VALUE; } // System.out.println(val); val=val*10+arr[itr++]-'0'; } return val*sign; } }
true
14b6648db5b592acae08a380c3ba54f1d3953e7e
Java
Neha814/HeadsUp
/app/src/main/java/com/headsup/ForgetPassword.java
UTF-8
4,624
2.40625
2
[]
no_license
package com.headsup; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; import org.apache.http.message.BasicNameValuePair; import java.util.ArrayList; import java.util.HashMap; import Functions.Constants; import Functions.Functions; import utils.NetConnection; import utils.StringUtils; import utils.TransparentProgressDialog; /** * Created by sandeep on 30/10/15. */ public class ForgetPassword extends Activity implements View.OnClickListener { EditText email; TextView done_text; ImageView done_img; boolean isConnected ; TransparentProgressDialog db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.forget_password); inIt(); } private void inIt() { email = (EditText) findViewById(R.id.email); done_img = (ImageView) findViewById(R.id.done_img); done_text = (TextView) findViewById(R.id.done_text); done_text.setOnClickListener(this); done_img.setOnClickListener(this); isConnected = NetConnection.checkInternetConnectionn(getApplicationContext()); } @Override public void onClick(View view) { if(view==done_img || view==done_text){ String email_text = email.getText().toString(); if(email_text.trim().length()<1){ email.setError("Please enter email address"); } else if(!(StringUtils.verify(email_text))){ email.setError("Please enter valid email address."); } else { if (isConnected) { new ForgetPasswordAPI(email_text).execute(new Void[0]); } else { StringUtils.showDialog(Constants.No_INTERNET, ForgetPassword.this); } } } } public class ForgetPasswordAPI extends AsyncTask<Void, Void, Void> { Functions function = new Functions(); HashMap result = new HashMap(); ArrayList localArrayList = new ArrayList(); String eMAIL; public ForgetPasswordAPI(String email ) { this.eMAIL = email; } protected Void doInBackground(Void... paramVarArgs) { // http://phphosting.osvin.net/SalonApp/API/forget-password.php?email=osvinandroid@gmail.com&username=push try { localArrayList.add(new BasicNameValuePair("email", this.eMAIL)); result = function.forgetPassword(localArrayList); } catch (Exception localException) { } return null; } protected void onPostExecute(Void paramVoid) { db.dismiss(); try { if(result.get("Response").equals("true")){ String msg = (String)result.get("Message"); showMessageDialog(msg); } else { } } catch (Exception ae) { ae.printStackTrace(); StringUtils.showDialog(Constants.ERROR_MSG, ForgetPassword.this); } } protected void onPreExecute() { super.onPreExecute(); db = new TransparentProgressDialog(ForgetPassword.this, R.drawable.loader_two); db.show(); } } public void showMessageDialog(String msg) { try { AlertDialog alertDialog = new AlertDialog.Builder( ForgetPassword.this).create(); // Setting Dialog Title alertDialog.setTitle("Alert !"); // Setting Dialog Message alertDialog.setMessage(msg); // Setting Icon to Dialog // alertDialog.setIcon(R.drawable.browse); // Setting OK Button alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // Write your code here to execute after dialog closed dialog.cancel(); finish(); } }); // Showing Alert Message alertDialog.show(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
true
8bc0954a81fa2ccb97af79bebf419e940400b951
Java
xoxleidu/broadband
/src/main/java/com/zjts/broadband/job/controller/CustomerController.java
UTF-8
4,020
2.140625
2
[]
no_license
package com.zjts.broadband.job.controller; import com.baomidou.mybatisplus.plugins.Page; import com.zjts.broadband.common.constant.CodeEnum; import com.zjts.broadband.common.controller.BaseController; import com.zjts.broadband.common.model.APIResponse; import com.zjts.broadband.common.model.req.job.customer.ReqCustomerAdd; import com.zjts.broadband.common.model.req.job.customer.ReqCustomerDelete; import com.zjts.broadband.common.model.req.job.customer.ReqCustomerQuery; import com.zjts.broadband.common.model.req.job.customer.ReqCustomerUpdate; import com.zjts.broadband.job.model.CustomerMessage; import io.swagger.annotations.Api; import com.zjts.broadband.job.service.CustomerService; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @Api(tags = "客户管理") @RestController @RequestMapping("customer") public class CustomerController extends BaseController { @Autowired private CustomerService customerService; @ApiOperation(value = "客户添加接口") @RequestMapping(value = "customerMessage/add", method = RequestMethod.POST) public APIResponse addUser(@RequestBody @Validated ReqCustomerAdd reqCustomerAdd, BindingResult bindingResult, HttpServletRequest request, HttpServletResponse response) { if (bindingResult.hasErrors()) return parameterVerification(bindingResult); try { return customerService.add(reqCustomerAdd); } catch (Exception e) { e.printStackTrace(); return APIResponse.error(CodeEnum.ERROR); } } @ApiOperation(value = "客户修改接口") @RequestMapping(value = "customerMessage/update", method = RequestMethod.POST) public APIResponse update(@RequestBody @Validated ReqCustomerUpdate reqCustomerUpdate, BindingResult bindingResult, HttpServletRequest request, HttpServletResponse response) { if (bindingResult.hasErrors()) return parameterVerification(bindingResult); try { return customerService.update(reqCustomerUpdate); } catch (Exception e) { e.printStackTrace(); return APIResponse.error(CodeEnum.ERROR,"修改失败"); } } @ApiOperation(value = "客户删除接口") @RequestMapping(value = "customerMessage/delete", method = RequestMethod.POST) public APIResponse delete(@RequestBody @Validated ReqCustomerDelete reqCustomerDelete, BindingResult bindingResult, HttpServletRequest request, HttpServletResponse response) { if (bindingResult.hasErrors()) return parameterVerification(bindingResult); try { return customerService.delete(reqCustomerDelete); } catch (Exception e) { e.printStackTrace(); return APIResponse.error(CodeEnum.ERROR,"删除失败"); } } @ApiOperation(value = "综合查询") @RequestMapping(value = "customerMessage/queryAllCustomer",method = RequestMethod.POST) public APIResponse selectAll(@RequestBody @Validated ReqCustomerQuery reqCustomerQuery, BindingResult bindingResult, HttpServletRequest request, HttpServletResponse response) throws Exception { if (bindingResult.hasErrors()) return parameterVerification(bindingResult); try { Page<CustomerMessage> page = new Page(reqCustomerQuery.getCurrentPage(),reqCustomerQuery.getPageSize()); return customerService.query(page,reqCustomerQuery); }catch (Exception e){ return APIResponse.error(CodeEnum.ERROR,"查询失败"); } } }
true
64caabe7f72a399d496ceeca8579bbc442b917a7
Java
venkatasaranu/training
/Training Samples/frameworks-project-samples/Hibernane _SOAP_Project/HibernateQueryApiDemos/src/com/veritis/query/clients/NamedQueries.java
UTF-8
2,411
2.734375
3
[]
no_license
package com.veritis.query.clients; import java.util.Iterator; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import com.veritis.hibernate.query.api.Product; import com.veritis.hibernate.query.api.Supplier; public class NamedQueries { public static void main(String[] args) { SessionFactory factory=new Configuration().configure().buildSessionFactory(); Session session=factory.openSession(); // Perform HQL Query with named query { System.out.println("\n---Performing HQL query with named query..."); Query query = session.getNamedQuery("HQLpricing"); query.setParameter("price",new Double(400)); List results = query.list(); displayObjectList(results,"Price"); } } public static void displayProductsList(List list){ Iterator iter = list.iterator(); if (!iter.hasNext()){ System.out.println("No products to display."); return; } while (iter.hasNext()){ Product product = (Product) iter.next(); String msg = product.getSupplier().getName() + "\t"; msg += product.getName() + "\t"; msg += product.getPrice() + "\t"; msg += product.getDescription(); System.out.println(msg); } } static public void displaySupplierList(List list) { Iterator iter = list.iterator(); if (!iter.hasNext()) { System.out.println("No suppliers to display."); return; } while (iter.hasNext()) { Supplier supplier = (Supplier) iter.next(); String msg = supplier.getName(); System.out.println(msg); } } static public void displayObjectList(List list,String name) { Iterator iter = list.iterator(); if (!iter.hasNext()) { System.out.println("No objects to display."); return; } System.out.println("List of "+name); while (iter.hasNext()) { // System.out.println("New object"); Object obj = (Object) iter.next(); System.out.println(obj); } } }
true
869057f787de40103475d28f3e02a534b4f89566
Java
goggalor1954/CISC3150-Fall15
/HW1/Question4/PrintNum.java
UTF-8
500
3.46875
3
[]
no_license
//James Roesemann //Cisc3150 HW1 Question4 import java.util.*; import java.io.*; public class PrintNum{ // I'm not quite sure what was wanted here. If the point of this exersise was to print the whoile file or just the individual tokenns, so I went with the most literal interpretation. void go(){ Scanner readNum = new Scanner(System.in); while(readNum.hasNext()){ System.out.println(readNum.next()); } } public static void main(String[] args){ PrintNum Go = new PrintNum(); Go.go(); } }
true
12ac02f95951774904e9439e715394d57b715e1d
Java
liushaoshuaii/mingrui-shop-parent
/mingrui-shop-service-api/mingrui-shop-service-api-xxx/src/main/java/com/baidu/shop/service/BrandService.java
UTF-8
1,406
1.828125
2
[]
no_license
package com.baidu.shop.service; import com.alibaba.fastjson.JSONObject; import com.baidu.shop.base.Result; import com.baidu.shop.dto.BrandDTO; import com.baidu.shop.entity.BrandEntity; import com.baidu.shop.group.MingruiOperation; import com.github.pagehelper.PageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @Api(tags="品牌接口 ") public interface BrandService { @GetMapping(value="brand/list") @ApiOperation(value = "查询品牌列表") Result<PageInfo<BrandEntity>>getBrandInfo(BrandDTO brandDTO); @PostMapping(value="brand/save") @ApiOperation(value="新增品牌") Result<JSONObject>saveBrand(@Validated({MingruiOperation.Add.class})@RequestBody BrandDTO brandDTO); @PutMapping(value="brand/save") @ApiOperation(value="修改品牌") Result<JSONObject>editBrand(@Validated({MingruiOperation.Update.class})@RequestBody BrandDTO brandDTO); @DeleteMapping(value="brand/delete") @ApiOperation(value="删除品牌") Result<JSONObject>deleteBrand(Integer id); @ApiOperation(value="通过分类id查询品牌") @GetMapping(value="brand/getBrandInfoCategoryById") Result<List<BrandEntity>>getBrandInfoCategoryById(Integer cid); }
true
7e80557f646f1ebc86a7ed6bd685f09a3946f8ee
Java
jaro1989/Day4ProjectMentuz
/src/by/javatr/task3/util/ItemInterface.java
UTF-8
110
2.203125
2
[]
no_license
package by.javatr.task3.util; public interface ItemInterface { int getWeight(); String getColor(); }
true
acb93a16abcd91f7088873ec0dc730ce44cb4216
Java
ZuofeiGithub/java_web_maozhanggui
/src/main/java/com/huiketong/catshopkeeper/api/service/FaceSearchService.java
UTF-8
1,089
2.109375
2
[]
no_license
package com.huiketong.catshopkeeper.api.service; import com.huiketong.catshopkeeper.util.GsonUtils; import com.huiketong.catshopkeeper.util.HttpUtil; import java.util.HashMap; import java.util.Map; /** * @Author: 左飞 * @Date: 2019/2/14 15:53 * @Version 1.0 */ public class FaceSearchService { public static String search(String group_id,String image,String accessToken) { // 请求url String url = "https://aip.baidubce.com/rest/2.0/face/v3/search"; try { Map<String, Object> map = new HashMap<>(); map.put("image", image); map.put("liveness_control", "NORMAL"); map.put("group_id_list", group_id); map.put("image_type", "BASE64"); map.put("quality_control", "LOW"); String param = GsonUtils.toJson(map); String result = HttpUtil.post(url, accessToken, "application/json", param); System.out.println(result); return result; } catch (Exception e) { e.printStackTrace(); } return null; } }
true
619bfde7e8ddd53e8036dfa066b8159b39b3aec7
Java
farooh/HW1
/HW 1/src/main/java/datastructures/concrete/DoubleLinkedList.java
UTF-8
10,551
3.78125
4
[]
no_license
package datastructures.concrete; import datastructures.interfaces.IList; import misc.exceptions.EmptyContainerException; import misc.exceptions.NotYetImplementedException; import java.util.Iterator; import java.util.NoSuchElementException; /** * Note: For more info on the expected behavior of your methods, see * the source code for IList. */ public class DoubleLinkedList<T> implements IList<T> { // You may not rename these fields or change their types. // We will be inspecting these in our private tests. // You also may not add any additional fields. private Node<T> front; private Node<T> back; private int size; public DoubleLinkedList() { this.front = null; this.back = null; this.size = 0; } // Adds an element to the end of the the list @Override public void add(T item) { if (size == 0) { front = new Node<T>(item); back = front; front.prev = null; back.next = null; } else { back.next = new Node<T>(item); back.next.prev = back; back = back.next; } size++; } // Removes an element from the end of the list and returns it's data @Override public T remove() { if (size == 0) { throw new EmptyContainerException(); } T result = back.data; if (size == 1) { back = null; front = null; } else { back = back.prev; back.next = null; } size --; return result; } // Finds the element at the given index and returns it's data @Override public T get(int index) { checkBounds(index, 1); // If in the first half, start at front if (index < size/2) { Node<T> curr = front; int currIndex = 0; while (currIndex != index) { curr = curr.next; currIndex++; } return curr.data; // Else start from the back. } else { Node<T> curr = back; int currIndex = size-1; while (currIndex != index) { curr = curr.prev; currIndex--; } return curr.data; } } //Finds the element at the given index and modifies it's data to the given data //If no element exists at that index, it creates a new element with the given data @Override public void set(int index, T item) { checkBounds(index, 1); Node<T> node = new Node<>(item); // If there is 1 or no nodes in the list if (size == 0 || size == 1) { front = node; back = front; // Sets front if there are more than 1 element in the list } else if (index == 0) { node.next = front.next; front.next.prev = node; front = node; // Sets back if there are more than 1 element in the list } else if (index == size - 1) { node.prev = back.prev; back.prev.next = node; back = node; // Sets any other index } else { // If in the first half, start at front if (index < size/2) { Node<T> curr = front; int currIndex = 0; while (currIndex != index) { curr = curr.next; currIndex++; } node.next = curr.next; curr.next.prev = node; node.prev = curr.prev; curr.prev.next = node; // Else start from the back. } else { Node<T> curr = back; int currIndex = size-1; while (currIndex != index) { curr = curr.prev; currIndex--; } node.next = curr.next; curr.next.prev = node; node.prev = curr.prev; curr.prev.next = node; } } } // Inserts an element with the given data at the given index @Override public void insert(int index, T item) { checkBounds(index, 2); // If list is empty or index is after the last element, // call the add method if (size == 0 | index == size) { add(item); } else { Node<T> node = new Node<>(item); // Add to front of the list if (index == 0) { node.next = this.front; front.prev = node; front = node; size++; // If any other index in the list // If in the first half, start at front } else if (index <= size / 2) { Node<T> curr = front.next; int currIndex = 1; while (currIndex != index) { curr = curr.next; currIndex++; } Node<T> previous = curr.prev; node.prev = previous; node.next = curr; previous.next = node; curr.prev = node; size++; // Else start from the back. } else { Node<T> curr = back; int currIndex = size-1; while (currIndex != index) { curr = curr.prev; currIndex--; } Node<T> previous = curr.prev; node.prev = previous; node.next = curr; previous.next = node; curr.prev = node; size++; } } } // Deletes an element at the given index and returns it's data // Shifts all remaining elements in the list forward @Override public T delete(int index) { checkBounds(index, 1); T result = null; // If index is the last element in the list, call remove if (index == size - 1) { return remove(); // If index is the front of the list } else if (index == 0) { result = front.data; front.next.prev = null; front = front.next; // If index is anywhere else in the list } else { // If in the first half, start at front if (index < size / 2) { Node<T> curr = front.next; int currIndex = 1; while (currIndex != index) { curr = curr.next; currIndex++; } result = curr.data; curr.prev.next = curr.next; curr.next.prev = curr.prev; curr.next = null; curr.prev = null; // Else start from the back. } else { Node<T> curr = back.prev; int currIndex = size -2; while (currIndex != index) { curr = curr.prev; currIndex--; } result = curr.data; curr.prev.next = curr.next; curr.next.prev = curr.prev; curr.next = null; curr.prev = null; } } size --; return result; } // Returns the first index of an element with the given data in the list @Override public int indexOf(T item) { int index = 0; Node<T> curr = this.front; while (curr != null) { // Allows for null to be searched if (item == null & curr.data == item) { return index; } else if (curr.data.equals(item)) { return index; } curr = curr.next; index++; } // If an element with that data is not found, returns -1 return -1; } // Returns the size of the list @Override public int size() { return size; } // Checks the data for the given data and returns true if it // is found in the list @Override public boolean contains(T other) { Node<T> curr = this.front; while (curr != null) { // Allows for null to be searched if (other == null & curr.data == other) { return true; } else if (curr.data.equals(other)) { return true; } curr = curr.next; } // If an element with that data is not found, returns false return false; } // Private helper method that checks for the given index private void checkBounds(int index, int type) { // Checks if given index is within list if (type == 1) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(); } // Checks if give index is within list or the index after // the list ends } else { if (index < 0 || index >= size +1 ) { throw new IndexOutOfBoundsException(); } } } @Override public Iterator<T> iterator() { // Note: we have provided a part of the implementation of // an iterator for you. You should complete the methods stubs // in the DoubleLinkedListIterator inner class at the bottom // of this file. You do not need to change this method. return new DoubleLinkedListIterator<>(this.front); } private static class Node<E> { // You may not change the fields in this node or add any new fields. public final E data; public Node<E> prev; public Node<E> next; public Node(Node<E> prev, E data, Node<E> next) { this.data = data; this.prev = prev; this.next = next; } public Node(E data) { this(null, data, null); } // Feel free to add additional constructors or methods to this class. } private static class DoubleLinkedListIterator<T> implements Iterator<T> { // You should not need to change this field, or add any new fields. private Node<T> current; public DoubleLinkedListIterator(Node<T> current) { // You do not need to make any changes to this constructor. this.current = current; } /** * Returns 'true' if the iterator still has elements to look at; * returns 'false' otherwise. */ public boolean hasNext() { if (current != null) { return true; } else { return false; } } /** * Returns the next item in the iteration and internally updates the * iterator to advance one element forward. * * @throws NoSuchElementException if we have reached the end of the iteration and * there are no more elements to look at. */ public T next() { if (!hasNext()) { throw new NoSuchElementException(); } T currData = current.data; current = current.next; return currData; } } }
true
381c4b9bb7b9a7e313888693067b3fb2d9df3d52
Java
unica-open/siacbilapp
/src/test/java/it/csi/siac/siacbilapp/frontend/webservice/client/bil/CronoprogrammaServiceTest.java
UTF-8
1,356
2.0625
2
[]
no_license
/* *SPDX-FileCopyrightText: Copyright 2020 | CSI Piemonte *SPDX-License-Identifier: EUPL-1.2 */ package it.csi.siac.siacbilapp.frontend.webservice.client.bil; import java.util.Date; import it.csi.siac.siacbilapp.frontend.webservice.client.BaseProxyServiceTest; import it.csi.siac.siacbilser.frontend.webservice.ProgettoService; import it.csi.siac.siacbilser.frontend.webservice.msg.RicercaDettaglioCronoprogramma; import it.csi.siac.siacbilser.frontend.webservice.msg.RicercaDettaglioCronoprogrammaResponse; import it.csi.siac.siacbilser.model.Cronoprogramma; /** * Classe di test per i serviz&icirc; del Cronoprogramma. * * @author Marchino Alessandro * */ public class CronoprogrammaServiceTest extends BaseProxyServiceTest<ProgettoService> { @Override protected String getEndpoint() { return "http://dev-www.ruparpiemonte.it/siacbilser/ProgettoService"; } /** * Test di ricerca dettaglio */ public void ricercaDettaglioCronoprogramma() { RicercaDettaglioCronoprogramma req = new RicercaDettaglioCronoprogramma(); req.setDataOra(new Date()); req.setRichiedente(getRichiedenteTest()); Cronoprogramma cronoprogramma = new Cronoprogramma(); cronoprogramma.setUid(41); req.setCronoprogramma(cronoprogramma); RicercaDettaglioCronoprogrammaResponse res = service.ricercaDettaglioCronoprogramma(req); assertNotNull(res); } }
true
e8ea87326c63c5344b1f0f667756caab991cba43
Java
FriedrichMykola/MyPortfolio
/Business/app/src/main/java/com/example/business/friedrich/kuzan/business/ui/business/design_fragment/dialog_fragment/UpdateTextDialogFragmentPresenter.java
UTF-8
2,080
2.0625
2
[]
no_license
package com.example.business.friedrich.kuzan.business.ui.business.design_fragment.dialog_fragment; import android.content.res.Resources; import com.arellomobile.mvp.InjectViewState; import com.arellomobile.mvp.MvpPresenter; import com.example.business.friedrich.kuzan.business.R; import com.example.business.friedrich.kuzan.business.application.MyApp; import com.example.business.friedrich.kuzan.business.model.business.Business; import com.example.business.friedrich.kuzan.business.model.wraps_for_eventbus.EBLetterSize; import org.greenrobot.eventbus.EventBus; import javax.inject.Inject; import javax.inject.Singleton; @InjectViewState public class UpdateTextDialogFragmentPresenter extends MvpPresenter<IUpdateTextDialogFragmentView> { @Inject @Singleton Business mBusiness; public UpdateTextDialogFragmentPresenter() { MyApp.mComponent.Inject(this); } public void updateData(String newName, String size) { EventBus.getDefault().post(new EBLetterSize(newName, getSizeLetter(Integer.valueOf(size)))); } private int getSizeLetter(int ss) { /*code is hidden*/ return 0; } public int getSelectedItem() { switch (mBusiness.getmDesign().getmSizeText()) { case 4: { return 0; } case 7: { return 1; } case 9: { return 2; } case 11: { return 3; } case 13: { return 4; } case 15: { return 5; } case 17: { return 6; } case 19: { return 7; } case 21: { return 8; } case 23: { return 9; } case 25: { return 10; } case 27: { return 11; } default: { return 12; } } } }
true
5ac0bc63a196bbf99353cefd2c6b941f1cc00e4f
Java
Messiless/old-code
/io/src/com/imooc/Try1.java
GB18030
516
2.796875
3
[]
no_license
package com.imooc; import java.io.*; public class Try1 { /*һļиɷݣ * һֳɼֱͬļ * */ public static void main(String[] args) throws IOException{ FileInputStream k1= new FileInputStream("e:\\l1.jpeg"); FileOutputStream k2=null; byte[] kk=new byte[1024*1024]; int sd=0; int count=1; while((sd=k1.read(kk))!=-1){ k2=new FileOutputStream("e:\\"+(count++)+".part"); k2.write(kk,0,sd); k2.close(); } k1.close(); } }
true
d348d555568570ca09dee6203aa3736f21d9929b
Java
Rozzzen/Concurrency2
/src/CPU.java
UTF-8
1,683
3.265625
3
[]
no_license
public class CPU extends Thread{ private final static long EXECUTION_TIME; private CPUProcess process; private static CPUQueue[] cpuQueues; private boolean run = true; static { EXECUTION_TIME = (long)(Math.random() * 500 + 700); } public void stopThread() { run = false; } public CPU(CPUQueue[] cpuQueues) { CPU.cpuQueues = cpuQueues; } public synchronized void requireProcess() { if(cpuQueues[0].isEmplty() && cpuQueues[1].isEmplty()) return; if(cpuQueues[0].getSize() > cpuQueues[1].getSize()) setProcess(cpuQueues[0].remove()); else setProcess(cpuQueues[1].remove()); } public synchronized void setProcess(CPUProcess process) { this.process = process; } public boolean isBusy() { return process == null; } @Override public void run() { System.out.println("CPU: " + this + " started with execution time: " + EXECUTION_TIME); while (!Thread.interrupted() && run) { try { if (process != null) { System.out.println(this + " started processing of:" + process); Thread.sleep(EXECUTION_TIME); System.out.println(this + " finished processing of:" + process); setProcess(null); } else { requireProcess(); } } catch (InterruptedException ignored) { System.out.println("An unexpected error occured"); return; } } System.out.println("CPU: " + this + " has been terminated"); } }
true
eb384ca293bf3743bfe59e08d6ef5237033f2d85
Java
awaisdilber/android
/app/src/main/java/com/cto247/directoryapp/network/IAPIService.java
UTF-8
423
1.851563
2
[]
no_license
package com.cto247.directoryapp.network; import com.cto247.directoryapp.models.ContactsData; import com.cto247.directoryapp.models.Employee; import java.util.List; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.Path; import retrofit2.http.Query; /** * Created by Sam on 10/7/2017. */ public interface IAPIService { @GET("/api/employee") Call<List<Employee>> getContactInfoCall(); }
true
a2a4a5d052524c909dd9ceea2edf62a2b5e3bcc7
Java
JetBrains/MPS
/plugins/mps-kotlin/languages/kotlin.javaRefs/source_gen/jetbrains/mps/kotlin/javaRefs/behavior/JavaSignatures.java
UTF-8
11,662
1.625
2
[ "LicenseRef-scancode-free-unknown", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
package jetbrains.mps.kotlin.javaRefs.behavior; /*Generated by MPS */ import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.kotlin.scopes.signed.TopLevelVisibility; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import java.util.Objects; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SModelOperations; import jetbrains.mps.kotlin.behavior.IKotlinRoot__BehaviorDescriptor; import jetbrains.mps.kotlin.api.members.SignatureCollector; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.kotlin.api.members.SignatureBuilder; import jetbrains.mps.kotlin.signatures.PropertySignature; import jetbrains.mps.baseLanguage.closures.runtime.YieldingIterator; import jetbrains.mps.kotlin.signatures.AccessorKind; import jetbrains.mps.kotlin.api.members.SignatureAttributeKey; import jetbrains.mps.kotlin.signatures.FunctionSignature; import jetbrains.mps.kotlin.baseLanguage.toKotlin.JavaDefaultConstructorDeclaration; import jetbrains.mps.kotlin.api.members.TypeExpander; import jetbrains.mps.internal.collections.runtime.ListSequence; import jetbrains.mps.kotlin.baseLanguage.toKotlin.JavaMethodDeclaration; import jetbrains.mps.kotlin.baseLanguage.toKotlin.JavaVariableHelper; import org.jetbrains.mps.openapi.language.SConcept; import jetbrains.mps.kotlin.signatures.MemberSignature; import org.jetbrains.mps.openapi.language.SInterfaceConcept; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.language.SContainmentLink; import org.jetbrains.mps.openapi.language.SProperty; public class JavaSignatures { public static boolean isAllowedVisibility(SNode visible, SNode contextNode) { // Package private from kotlin point of view is both package private AND internal if (isForbiddenPackagePrivate(visible, contextNode)) { return false; } // Other visibilities can be added properly return TopLevelVisibility.visibleTo(visible, convertVisibility(null, visible), contextNode); } public static boolean isForbiddenPackagePrivate(SNode visible, SNode contextNode) { return SNodeOperations.isInstanceOf(visible, CONCEPTS.IVisible$zu) && (SLinkOperations.getTarget(SNodeOperations.cast(visible, CONCEPTS.IVisible$zu), LINKS.visibility$Yyua) == null) && !(Objects.equals(SModelOperations.getModelName(SNodeOperations.getModel(visible)), IKotlinRoot__BehaviorDescriptor.getPackageName_id74Z9X$ygjTm.invoke(SNodeOperations.getNodeAncestor(contextNode, CONCEPTS.IKotlinRoot$xV, false, false)))); } public static void declareField(SignatureCollector collector, SNode field) { declareField(collector, field, SPropertyOperations.getBoolean(field, PROPS.isFinal$gvTP)); } public static void declareField(SignatureCollector collector, final SNode field, final boolean isFinal) { if (field == null) { return; } SignatureBuilder.create(field, PropertySignature.class).withSignatures((_node) -> { return (Iterable<PropertySignature>) () -> { return new YieldingIterator<PropertySignature>() { private int __CP__ = 0; protected boolean moveToNext() { __loop__: do { __switch__: switch (this.__CP__) { case -1: assert false : "Internal error"; return false; case 3: if (!(isFinal)) { this.__CP__ = 4; break; } this.__CP__ = 1; break; case 2: this.__CP__ = 3; this.yield(new PropertySignature(SPropertyOperations.getString(field, PROPS.name$MnvL), AccessorKind.GETTER)); return true; case 5: this.__CP__ = 1; this.yield(new PropertySignature(SPropertyOperations.getString(field, PROPS.name$MnvL), AccessorKind.SETTER)); return true; case 0: this.__CP__ = 2; break; case 4: this.__CP__ = 5; break; default: break __loop__; } } while (true); return false; } }; }; }).withAttribute(SignatureAttributeKey.VISIBILITY, JavaSignatures::convertVisibility).declareTo(collector); } public static void declareConstructor(SignatureCollector collector, final SNode method) { SignatureBuilder.create(method, FunctionSignature.class).withSignature((_node) -> new FunctionSignature(new JavaDefaultConstructorDeclaration(method), (TypeExpander) null)).declareTo(collector); } public static void declareMethod(final SignatureCollector collector, final SNode method) { int paramCount = ListSequence.fromList(SLinkOperations.getChildren(method, LINKS.parameter$5xBj)).count(); SignatureBuilder.create(method, FunctionSignature.class).withSignature((_node) -> new FunctionSignature(new JavaMethodDeclaration(method), collector)).withAttribute(SignatureAttributeKey.VISIBILITY, JavaSignatures::convertVisibility).declareTo(collector); // Method accessed as properties final boolean hasGetter = paramCount == 0 && SPropertyOperations.getString(method, PROPS.name$MnvL).startsWith("get") && !(SNodeOperations.isInstanceOf(SLinkOperations.getTarget(method, LINKS.returnType$5xoi), CONCEPTS.VoidType$BF)); final boolean hasSetter = paramCount == 1 && SPropertyOperations.getString(method, PROPS.name$MnvL).startsWith("set") && SNodeOperations.isInstanceOf(SLinkOperations.getTarget(method, LINKS.returnType$5xoi), CONCEPTS.VoidType$BF); // Declare method once as accessor if (hasGetter || hasSetter) { SignatureBuilder.create(method, PropertySignature.class).withSignatures((_node) -> { return (Iterable<PropertySignature>) () -> { return new YieldingIterator<PropertySignature>() { private int __CP__ = 0; protected boolean moveToNext() { __loop__: do { __switch__: switch (this.__CP__) { case -1: assert false : "Internal error"; return false; case 2: if (hasGetter) { this.__CP__ = 3; break; } this.__CP__ = 4; break; case 4: if (hasSetter) { this.__CP__ = 6; break; } this.__CP__ = 1; break; case 5: this.__CP__ = 4; this.yield(new PropertySignature(JavaVariableHelper.accessorNameOf(method), AccessorKind.GETTER)); return true; case 7: this.__CP__ = 1; this.yield(new PropertySignature(JavaVariableHelper.accessorNameOf(method), AccessorKind.SETTER)); return true; case 0: this.__CP__ = 2; break; case 3: this.__CP__ = 5; break; case 6: this.__CP__ = 7; break; default: break __loop__; } } while (true); return false; } }; }; }).withAttribute(SignatureAttributeKey.VISIBILITY, JavaSignatures::convertVisibility).declareTo(collector); } } private static SConcept convertVisibility(MemberSignature ignoredSignature, SNode node) { return convertVisibility(node); } public static SConcept convertVisibility(SNode node) { { final SNode visible = node; if (SNodeOperations.isInstanceOf(visible, CONCEPTS.IVisible$zu)) { SNode visibility = SLinkOperations.getTarget(visible, LINKS.visibility$Yyua); if (SNodeOperations.isInstanceOf(visibility, CONCEPTS.PrivateVisibility$l0)) { return CONCEPTS.PrivateVisibility$WS; } if (SNodeOperations.isInstanceOf(visibility, CONCEPTS.ProtectedVisibility$hr)) { return CONCEPTS.ProtectedVisibility$XQ; } // Once isForbiddenPackagePrivate is already checked, package becomes internal if ((visibility == null)) { return CONCEPTS.InternalVisibility$Xn; } } } // not applicable (not IVisible) or public or unknown return CONCEPTS.PublicVisibility$Me; } private static final class CONCEPTS { /*package*/ static final SInterfaceConcept IVisible$zu = MetaAdapterFactory.getInterfaceConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, "jetbrains.mps.baseLanguage.structure.IVisible"); /*package*/ static final SInterfaceConcept IKotlinRoot$xV = MetaAdapterFactory.getInterfaceConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x713f27d92240e539L, "jetbrains.mps.kotlin.structure.IKotlinRoot"); /*package*/ static final SConcept VoidType$BF = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc6bf96dL, "jetbrains.mps.baseLanguage.structure.VoidType"); /*package*/ static final SConcept PrivateVisibility$WS = MetaAdapterFactory.getConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x28bef6d7551af396L, "jetbrains.mps.kotlin.structure.PrivateVisibility"); /*package*/ static final SConcept PrivateVisibility$l0 = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10af9586f0cL, "jetbrains.mps.baseLanguage.structure.PrivateVisibility"); /*package*/ static final SConcept ProtectedVisibility$XQ = MetaAdapterFactory.getConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x28bef6d7551af398L, "jetbrains.mps.kotlin.structure.ProtectedVisibility"); /*package*/ static final SConcept ProtectedVisibility$hr = MetaAdapterFactory.getConcept(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x10af958b686L, "jetbrains.mps.baseLanguage.structure.ProtectedVisibility"); /*package*/ static final SConcept InternalVisibility$Xn = MetaAdapterFactory.getConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x28bef6d7551af397L, "jetbrains.mps.kotlin.structure.InternalVisibility"); /*package*/ static final SConcept PublicVisibility$Me = MetaAdapterFactory.getConcept(0x6b3888c1980244d8L, 0x8baff8e6c33ed689L, 0x28bef6d7551af395L, "jetbrains.mps.kotlin.structure.PublicVisibility"); } private static final class LINKS { /*package*/ static final SContainmentLink visibility$Yyua = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0x112670d273fL, 0x112670d886aL, "visibility"); /*package*/ static final SContainmentLink parameter$5xBj = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, 0xf8cc56b1feL, "parameter"); /*package*/ static final SContainmentLink returnType$5xoi = MetaAdapterFactory.getContainmentLink(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8cc56b1fcL, 0xf8cc56b1fdL, "returnType"); } private static final class PROPS { /*package*/ static final SProperty isFinal$gvTP = MetaAdapterFactory.getProperty(0xf3061a5392264cc5L, 0xa443f952ceaf5816L, 0xf8c37a7f6eL, 0x111f9e9f00cL, "isFinal"); /*package*/ static final SProperty name$MnvL = MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"); } }
true
bfa3694c2998fdc57aaaf19735b0b5111b4a3df2
Java
jufeng98/java-master
/spring-test/src/main/java/org/javamaster/spring/test/config/VerifyEnvApplicationContextInitializer.java
UTF-8
1,165
2.546875
3
[ "Apache-2.0" ]
permissive
package org.javamaster.spring.test.config; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import java.util.HashSet; import java.util.Set; /** * @author yudong * @date 2021/5/15 */ @SuppressWarnings("NullableProblems") public class VerifyEnvApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { private static final Set<String> ALLOW_ENV_SET = new HashSet<>(); static { ALLOW_ENV_SET.add("dev"); ALLOW_ENV_SET.add("test"); ALLOW_ENV_SET.add("prd"); } @Override public void initialize(ConfigurableApplicationContext applicationContext) { // 校验环境配置 String env = System.getProperty("env"); if (env == null || "".equals(env)) { throw new IllegalStateException("环境属性未设置,请加上-Denv参数指定环境配置"); } if (!ALLOW_ENV_SET.contains(env)) { throw new IllegalStateException("环境属性设置错误,只允许" + ALLOW_ENV_SET + "中的值,当前设置为:" + env); } } }
true
c368339fadcd144cbca034f6eb9a9ae0f79936c0
Java
erickkaiquesilva/projectSchedule
/agendaDeObjetivos-erick/agendaDeObjetivos/agendaDeObjetivos/src/main/java/br/com/ericksilva/agendaDeObjetivos/controller/LoginController.java
UTF-8
294
1.625
2
[]
no_license
package br.com.ericksilva.agendaDeObjetivos.controller; import org.springframework.http.ResponseEntity; public class LoginController { public ResponseEntity<String> validarLogin(Credenciais credenciais) { // TODO Auto-generated method stub return ResponseEntity.ok("Sucesso"); } }
true
4fbc351755a3efce9281cd21a18ffa6a0716cc3f
Java
lxh674685799/posCash
/src/main/java/com/soft/core/util/StringUtil.java
UTF-8
18,501
2.5625
3
[]
no_license
package com.soft.core.util; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Type; import java.security.MessageDigest; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class StringUtil { public static String escape(String src) { StringBuffer tmp = new StringBuffer(); tmp.ensureCapacity(src.length() * 6); for (int i = 0; i < src.length(); ++i) { char j = src.charAt(i); if ((Character.isDigit(j)) || (Character.isLowerCase(j)) || (Character.isUpperCase(j))) { tmp.append(j); } else if (j < 'Ā') { tmp.append("%"); if (j < '\020') tmp.append("0"); tmp.append(Integer.toString(j, 16)); } else { tmp.append("%u"); tmp.append(Integer.toString(j, 16)); } } return tmp.toString(); } public static String replaceVariable(String template, Map<String, String> map) throws Exception { Pattern regex = Pattern.compile("\\{(.*?)\\}"); Matcher regexMatcher = regex.matcher(template); while (regexMatcher.find()) { String key = regexMatcher.group(1); String toReplace = regexMatcher.group(0); String value = (String) map.get(key); if (value != null) template = template.replace(toReplace, value); else { throw new Exception(new StringBuilder().append("没有找到[") .append(key).append("]对应的变量值,请检查表变量配置!").toString()); } } return template; } public static String unescape(String src) { StringBuffer tmp = new StringBuffer(); tmp.ensureCapacity(src.length()); int lastPos = 0; int pos = 0; while (lastPos < src.length()) { pos = src.indexOf("%", lastPos); if (pos == lastPos) { if (src.charAt(pos + 1) == 'u') { char ch = (char) Integer.parseInt( src.substring(pos + 2, pos + 6), 16); tmp.append(ch); lastPos = pos + 6; } char ch = (char) Integer.parseInt( src.substring(pos + 1, pos + 3), 16); tmp.append(ch); lastPos = pos + 3; } if (pos == -1) { tmp.append(src.substring(lastPos)); lastPos = src.length(); } tmp.append(src.substring(lastPos, pos)); lastPos = pos; } return tmp.toString(); } public static boolean isExist(String content, String begin, String end) { String tmp = content.toLowerCase(); begin = begin.toLowerCase(); end = end.toLowerCase(); int beginIndex = tmp.indexOf(begin); int endIndex = tmp.indexOf(end); return (beginIndex != -1) && (endIndex != -1) && (beginIndex < endIndex); } public static String trimPrefix(String toTrim, String trimStr) { while (toTrim.startsWith(trimStr)) { toTrim = toTrim.substring(trimStr.length()); } return toTrim; } public static String trimSufffix(String toTrim, String trimStr) { while (toTrim.endsWith(trimStr)) { toTrim = toTrim.substring(0, toTrim.length() - trimStr.length()); } return toTrim; } public static String trim(String toTrim, String trimStr) { return trimSufffix(trimPrefix(toTrim, trimStr), trimStr); } public static String escapeHtml(String content) { return StringEscapeUtils.escapeHtml(content); } public static String unescapeHtml(String content) { return StringEscapeUtils.unescapeHtml(content); } public static boolean isEmpty(String str) { if (str == null) { return true; } return str.trim().equals(""); } public static boolean isNotEmpty(String str) { return !isEmpty(str); } public static String replaceVariable(String template, String repaceStr) { Pattern regex = Pattern.compile("\\{(.*?)\\}"); Matcher regexMatcher = regex.matcher(template); if (regexMatcher.find()) { String toReplace = regexMatcher.group(0); template = template.replace(toReplace, repaceStr); } return template; } public static String subString(String str, int len) { int strLen = str.length(); if (strLen < len) return str; char[] chars = str.toCharArray(); int cnLen = len * 2; String tmp = ""; int iLen = 0; for (int i = 0; i < chars.length; ++i) { int iChar = chars[i]; if (iChar <= 128) iLen += 1; else iLen += 2; if (iLen >= cnLen) break; tmp = new StringBuilder().append(tmp) .append(String.valueOf(chars[i])).toString(); } return tmp; } public static boolean isNumberic(String s) { if (StringUtils.isEmpty(s)) return false; boolean rtn = validByRegex("^[-+]{0,1}\\d*\\.{0,1}\\d+$", s); if (rtn) return true; return validByRegex("^0[x|X][\\da-eA-E]+$", s); } public static boolean isInteger(String s) { boolean rtn = validByRegex("^[-+]{0,1}\\d*$", s); return rtn; } public static boolean isEmail(String s) { boolean rtn = validByRegex( "(\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*)*", s); return rtn; } public static boolean isMobile(String s) { boolean rtn = validByRegex( "^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\\d{8})$", s); return rtn; } public static boolean isPhone(String s) { boolean rtn = validByRegex( "(0[0-9]{2,3}\\-)?([2-9][0-9]{6,7})+(\\-[0-9]{1,4})?", s); return rtn; } public static boolean isZip(String s) { boolean rtn = validByRegex("^[0-9]{6}$", s); return rtn; } public static boolean isQq(String s) { boolean rtn = validByRegex("^[1-9]\\d{4,9}$", s); return rtn; } public static boolean isIp(String s) { boolean rtn = validByRegex( "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$", s); return rtn; } public static boolean isChinese(String s) { boolean rtn = validByRegex("^[一-龥]+$", s); return rtn; } public static boolean isChrNum(String s) { boolean rtn = validByRegex("^([a-zA-Z0-9]+)$", s); return rtn; } public static boolean isUrl(String url) { return validByRegex( "(http://|https://)?([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?", url); } public static boolean validByRegex(String regex, String input) { Pattern p = Pattern.compile(regex, 2); Matcher regexMatcher = p.matcher(input); return regexMatcher.find(); } public static boolean isNumeric(String str) { for (int i = str.length(); --i >= 0;) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } public static String makeFirstLetterUpperCase(String newStr) { if (newStr.length() == 0) { return newStr; } char[] oneChar = new char[1]; oneChar[0] = newStr.charAt(0); String firstChar = new String(oneChar); return new StringBuilder().append(firstChar.toUpperCase()) .append(newStr.substring(1)).toString(); } public static String makeFirstLetterLowerCase(String newStr) { if (newStr.length() == 0) { return newStr; } char[] oneChar = new char[1]; oneChar[0] = newStr.charAt(0); String firstChar = new String(oneChar); return new StringBuilder().append(firstChar.toLowerCase()) .append(newStr.substring(1)).toString(); } public static String formatParamMsg(String message, Object[] args) { for (int i = 0; i < args.length; ++i) { message = message.replace(new StringBuilder().append("{").append(i) .append("}").toString(), args[i].toString()); } return message; } public static String formatParamMsg(String message, Map params) { if (params == null) return message; Iterator keyIts = params.keySet().iterator(); while (keyIts.hasNext()) { String key = (String) keyIts.next(); Object val = params.get(key); if (val != null) { message = message.replace(new StringBuilder().append("${") .append(key).append("}").toString(), val.toString()); } } return message; } public static StringBuilder formatMsg(CharSequence msgWithFormat, boolean autoQuote, Object[] args) { int argsLen = args.length; boolean markFound = false; StringBuilder sb = new StringBuilder(msgWithFormat); if (argsLen > 0) { for (int i = 0; i < argsLen; ++i) { String flag = new StringBuilder().append("%").append(i + 1) .toString(); int idx = sb.indexOf(flag); while (idx >= 0) { markFound = true; sb.replace(idx, idx + 2, toString(args[i], autoQuote)); idx = sb.indexOf(flag); } } if (args[(argsLen - 1)] instanceof Throwable) { StringWriter sw = new StringWriter(); ((Throwable) args[(argsLen - 1)]) .printStackTrace(new PrintWriter(sw)); sb.append("\n").append(sw.toString()); } else if ((argsLen == 1) && (!markFound)) { sb.append(args[(argsLen - 1)].toString()); } } return sb; } public static StringBuilder formatMsg(String msgWithFormat, Object[] args) { return formatMsg(new StringBuilder(msgWithFormat), true, args); } public static String toString(Object obj, boolean autoQuote) { StringBuilder sb = new StringBuilder(); if (obj == null) { sb.append("NULL"); } else if (obj instanceof Object[]) { for (int i = 0; i < ((Object[]) (Object[]) obj).length; ++i) { sb.append(((Object[]) (Object[]) obj)[i]).append(", "); } if (sb.length() > 0) sb.delete(sb.length() - 2, sb.length()); } else { sb.append(obj.toString()); } if ((autoQuote) && (sb.length() > 0) && (((sb.charAt(0) != '[') || (sb.charAt(sb.length() - 1) != ']'))) && (((sb.charAt(0) != '{') || (sb.charAt(sb.length() - 1) != '}')))) { sb.insert(0, "[").append("]"); } return sb.toString(); } public static String returnSpace(String str) { String space = ""; if (!str.isEmpty()) { String[] path = str.split("\\."); for (int i = 0; i < path.length - 1; ++i) { space = new StringBuilder().append(space) .append("&nbsp;&emsp;").toString(); } } return space; } public static synchronized String encryptSha256(String inputStr) { try { MessageDigest md = MessageDigest.getInstance("SHA-256"); byte[] digest = md.digest(inputStr.getBytes("UTF-8")); return new String(Base64.encodeBase64(digest)); } catch (Exception e) { } return null; } public static synchronized String encryptMd5(String inputStr) { try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(inputStr.getBytes()); byte[] digest = md.digest(); StringBuffer sb = new StringBuffer(); for (byte b : digest) { sb.append(Integer.toHexString(b & 0xFF)); } return sb.toString(); } catch (Exception e) { } return null; } public static String getArrayAsString(List<String> arr) { if ((arr == null) || (arr.size() == 0)) return ""; StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.size(); ++i) { if (i > 0) sb.append(","); sb.append((String) arr.get(i)); } return sb.toString(); } public static String getArrayAsString(String[] arr) { if ((arr == null) || (arr.length == 0)) return ""; StringBuffer sb = new StringBuffer(); for (int i = 0; i < arr.length; ++i) { if (i > 0) sb.append(","); sb.append(arr[i]); } return sb.toString(); } public static String getSetAsString(Set set) { if ((set == null) || (set.size() == 0)) return ""; StringBuffer sb = new StringBuffer(); int i = 0; Iterator it = set.iterator(); while (it.hasNext()) { if (i++ > 0) sb.append(","); sb.append(it.next().toString()); } return sb.toString(); } public static String hangeToBig(double value) { char[] hunit = { '拾', '佰', '仟' }; char[] vunit = { '万', '亿' }; char[] digit = { 38646, '壹', 36144, '叁', 32902, '伍', 38470, '柒', '捌', '玖' }; long midVal = (long) (value * 100.0D); String valStr = String.valueOf(midVal); String head = valStr.substring(0, valStr.length() - 2); String rail = valStr.substring(valStr.length() - 2); String prefix = ""; String suffix = ""; if (rail.equals("00")) { suffix = "整"; } else { suffix = new StringBuilder().append(digit[(rail.charAt(0) - '0')]) .append("角").append(digit[(rail.charAt(1) - '0')]) .append("分").toString(); } char[] chDig = head.toCharArray(); char zero = '0'; byte zeroSerNum = 0; for (int i = 0; i < chDig.length; ++i) { int idx = (chDig.length - i - 1) % 4; int vidx = (chDig.length - i - 1) / 4; if (chDig[i] == '0') { zeroSerNum = (byte) (zeroSerNum + 1); if (zero == '0') { zero = digit[0]; } else { if ((idx != 0) || (vidx <= 0) || (zeroSerNum >= 4)) continue; prefix = new StringBuilder().append(prefix) .append(vunit[(vidx - 1)]).toString(); zero = '0'; } } else { zeroSerNum = 0; if (zero != '0') { prefix = new StringBuilder().append(prefix).append(zero) .toString(); zero = '0'; } prefix = new StringBuilder().append(prefix) .append(digit[(chDig[i] - '0')]).toString(); if (idx > 0) prefix = new StringBuilder().append(prefix) .append(hunit[(idx - 1)]).toString(); if ((idx != 0) || (vidx <= 0)) continue; prefix = new StringBuilder().append(prefix) .append(vunit[(vidx - 1)]).toString(); } } if (prefix.length() > 0) prefix = new StringBuilder().append(prefix).append('圆').toString(); return new StringBuilder().append(prefix).append(suffix).toString(); } public static String jsonUnescape(String str) { return str.replace("&quot;", "\"").replace("&nuot;", "\n"); } public static String htmlEntityToString(String dataStr) { dataStr = dataStr.replace("&apos;", "'").replace("&quot;", "\"") .replace("&gt;", ">").replace("&lt;", "<") .replace("&amp;", "&"); int start = 0; int end = 0; StringBuffer buffer = new StringBuffer(); while (start > -1) { int system = 10; if (start == 0) { int t = dataStr.indexOf("&#"); if (start != t) { start = t; } if (start > 0) { buffer.append(dataStr.substring(0, start)); } } end = dataStr.indexOf(";", start + 2); String charStr = ""; if (end != -1) { charStr = dataStr.substring(start + 2, end); char s = charStr.charAt(0); if ((s == 'x') || (s == 'X')) { system = 16; charStr = charStr.substring(1); } } try { char letter = (char) Integer.parseInt(charStr, system); buffer.append(new Character(letter).toString()); } catch (NumberFormatException e) { e.printStackTrace(); } start = dataStr.indexOf("&#", end); if (start - end > 1) { buffer.append(dataStr.substring(end + 1, start)); } if (start == -1) { int length = dataStr.length(); if (end + 1 != length) { buffer.append(dataStr.substring(end + 1, length)); } } } return buffer.toString(); } public static String stringToHtmlEntity(String str) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); switch (c) { case '\n': sb.append(c); break; case '<': sb.append("&lt;"); break; case '>': sb.append("&gt;"); break; case '&': sb.append("&amp;"); break; case '\'': sb.append("&apos;"); break; case '"': sb.append("&quot;"); break; default: if ((c < ' ') || (c > '~')) { sb.append("&#x"); sb.append(Integer.toString(c, 16)); sb.append(';'); } else { sb.append(c); } } } return sb.toString(); } public static String encodingString(String str, String from, String to) { String result = str; try { result = new String(str.getBytes(from), to); } catch (Exception e) { result = str; } return result; } /** * 判断一个字符串(以,分割)后是否包含某一个字符串 * @param str * @param contain * @return */ public static boolean contain(String str,String contain){ for(String s:str.split(",")){ if(s.equals(contain)) return true; } return false; } /** * 删除input字符串中的html格式 * * @param input * @param length * @return */ public static String splitAndFilterString(String input, int length) { if (input == null || input.trim().equals("")) { return ""; } // 去掉所有html元素, String str = input.replaceAll("\\&[a-zA-Z]{1,10};", "").replaceAll( "<[^>]*>", ""); str = str.replaceAll("[(/>)<]", ""); int len = str.length(); if (len <= length) { return str; } else { str = str.substring(0, length); str += "......"; } return str; } public static String getValByJsonKey(String json,String key){ String result = "" ; if(StringUtils.isNotBlank(json)){ JSONArray jsonArray = JSONArray.fromObject(json); for(int i=0;i<jsonArray.size();i++){ JSONObject jsonObject = jsonArray.getJSONObject(0); result +=jsonObject.getString(key)+","; } } return result; } /** * 将Java对象转换为符合JSON格式的字符串 * @param obj 待转换的对象 * @return JSON字符串 */ public static String toJson(Object obj) { GsonBuilder builder = new GsonBuilder(); builder.excludeFieldsWithoutExposeAnnotation(); Gson gson = builder.create(); return gson.toJson(obj); } /** * 将json字符串转换为Java对象 * @param json * @param objArray * @return */ @SuppressWarnings("unchecked") public static <T> T fromJson(String json, Type objArray) { GsonBuilder builder = new GsonBuilder(); builder.excludeFieldsWithoutExposeAnnotation(); Gson gson = builder.create(); return (T) gson.fromJson(json, objArray); } public static void main(String[] args) { String s= StringUtil.hangeToBig(12343.34); String tt ="1,3,45,5"; System.out.println(tt.replaceAll(",", "','")); System.out.println(s); } }
true
aadf2ae7eccc9a18b93fe279e54b3d35e8c94f40
Java
LahiruNikolin/Madd-Tute02
/app/src/main/java/com/example/intentsproj/FirstActivity.java
UTF-8
1,274
2.3125
2
[]
no_license
package com.example.intentsproj; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class FirstActivity extends AppCompatActivity { private Button btn; EditText num1; EditText num2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_first); btn= findViewById(R.id.btn1); num1=findViewById(R. id. et1); num2=findViewById(R. id.et2); btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntent = new Intent(FirstActivity.this, SecondActivity.class); myIntent.putExtra("num1", num1.getText().toString()); myIntent.putExtra("num2", num2.getText().toString());//Optional parameters startActivity(myIntent); Toast.makeText(getApplicationContext(), "Yoy clicked Ok button!", Toast.LENGTH_LONG).show(); } }); } }
true
371997c77097f7e19d100a28f5eecf9220d28a5b
Java
roosi/utils
/src/com/roosi/utils/net/JsonObjectResponse.java
UTF-8
496
2.25
2
[]
no_license
package com.roosi.utils.net; import org.json.JSONException; import org.json.JSONObject; public class JsonObjectResponse extends Response { private JSONObject mJsonObject = null; public JsonObjectResponse() { } @Override public void setContent(String content) { super.setContent(content); try { mJsonObject = new JSONObject(content); } catch (JSONException e) { e.printStackTrace(); } } public JSONObject getJson() { return mJsonObject; } }
true
e69a729cad2964dd08d5b130130e9582c4f72881
Java
sinozuke/-Compi1-Proyecto1_server
/src/BackEnd/Analizador/Consola/AnalizadorSintactico_compilador_consola.java
UTF-8
281,763
2.125
2
[]
no_license
//---------------------------------------------------- // The following code was generated by CUP v0.11a beta 20060608 // Mon Apr 18 08:10:54 CST 2016 //---------------------------------------------------- package BackEnd.Analizador.Consola; import java_cup.runtime.*; import BackEnd.DAO.Objetos.*; import BackEnd.DAO.Compilador.*; import BackEnd.DAO.Hash.Tabla_Hash_compilador; import java.util.ArrayList; import BackEnd.Conexion.Enlace_Envio; import static compi1.proyecto1_server.pkg201403775.Compi1Proyecto1_Server201403775.hash; import static compi1.proyecto1_server.pkg201403775.Compi1Proyecto1_Server201403775.inter; import static compi1.proyecto1_server.pkg201403775.Compi1Proyecto1_Server201403775.errores; /** CUP v0.11a beta 20060608 generated parser. * @version Mon Apr 18 08:10:54 CST 2016 */ public class AnalizadorSintactico_compilador_consola extends java_cup.runtime.lr_parser { /** Default constructor. */ public AnalizadorSintactico_compilador_consola() {super();} /** Constructor which sets the default scanner. */ public AnalizadorSintactico_compilador_consola(java_cup.runtime.Scanner s) {super(s);} /** Constructor which sets the default scanner. */ public AnalizadorSintactico_compilador_consola(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\244\000\002\002\004\000\002\002\003\000\002\004" + "\004\000\002\004\003\000\002\004\012\000\002\006\005" + "\000\002\010\004\000\002\010\003\000\002\007\013\000" + "\002\007\007\000\002\007\007\000\002\024\005\000\002" + "\024\003\000\002\034\002\000\002\034\003\000\002\047" + "\003\000\002\047\003\000\002\036\010\000\002\027\005" + "\000\002\025\005\000\002\025\003\000\002\026\002\000" + "\002\026\003\000\002\050\005\000\002\050\003\000\002" + "\051\005\000\002\051\003\000\002\052\005\000\002\052" + "\003\000\002\053\005\000\002\053\003\000\002\054\010" + "\000\002\054\003\000\002\055\010\000\002\055\003\000" + "\002\056\005\000\002\056\003\000\002\057\005\000\002" + "\057\003\000\002\057\003\000\002\011\011\000\002\011" + "\011\000\002\011\011\000\002\011\011\000\002\011\004" + "\000\002\011\004\000\002\031\010\000\002\005\007\000" + "\002\032\002\000\002\032\005\000\002\012\004\000\002" + "\012\003\000\002\013\006\000\002\013\003\000\002\014" + "\011\000\002\014\003\000\002\045\004\000\002\045\003" + "\000\002\046\011\000\002\046\011\000\002\046\011\000" + "\002\046\011\000\002\046\011\000\002\046\011\000\002" + "\046\004\000\002\046\004\000\002\043\005\000\002\043" + "\003\000\002\044\005\000\002\044\005\000\002\044\005" + "\000\002\044\005\000\002\044\005\000\002\044\005\000" + "\002\033\003\000\002\033\003\000\002\033\003\000\002" + "\033\007\000\002\003\014\000\002\003\006\000\002\003" + "\014\000\002\015\004\000\002\015\003\000\002\016\006" + "\000\002\041\004\000\002\041\003\000\002\042\011\000" + "\002\042\011\000\002\042\011\000\002\042\011\000\002" + "\042\011\000\002\042\011\000\002\042\011\000\002\042" + "\011\000\002\037\005\000\002\037\003\000\002\040\005" + "\000\002\040\005\000\002\040\005\000\002\040\005\000" + "\002\040\005\000\002\040\005\000\002\040\005\000\002" + "\040\005\000\002\035\003\000\002\035\003\000\002\017" + "\011\000\002\017\011\000\002\020\004\000\002\020\003" + "\000\002\021\011\000\002\021\011\000\002\021\011\000" + "\002\021\011\000\002\021\011\000\002\021\011\000\002" + "\021\011\000\002\022\004\000\002\022\003\000\002\023" + "\011\000\002\023\011\000\002\030\010\000\002\030\010" + "\000\002\030\010\000\002\030\006\000\002\030\006\000" + "\002\030\006\000\002\060\005\000\002\060\003\000\002" + "\063\005\000\002\063\003\000\002\064\006\000\002\064" + "\003\000\002\065\006\000\002\065\006\000\002\065\006" + "\000\002\065\006\000\002\065\006\000\002\065\006\000" + "\002\065\006\000\002\061\005\000\002\061\003\000\002" + "\066\005\000\002\066\003\000\002\067\006\000\002\067" + "\003\000\002\070\006\000\002\070\006\000\002\070\006" + "\000\002\070\006\000\002\070\006\000\002\062\005\000" + "\002\062\003\000\002\071\005\000\002\071\003\000\002" + "\072\006\000\002\072\003\000\002\073\006\000\002\073" + "\006\000\002\073\006\000\002\073\006\000\002\073\006" + "\000\002\073\006\000\002\073\006" }); /** Access to production table. */ public short[][] production_table() {return _production_table;} /** Parse-action table. */ protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\u0203\000\006\003\007\036\010\001\002\000\004\002" + "\u0205\001\002\000\010\002\000\003\007\036\u0204\001\002" + "\000\010\002\ufffe\003\ufffe\036\ufffe\001\002\000\006\036" + "\u0201\037\u0202\001\002\000\010\041\012\072\013\073\011" + "\001\002\000\004\036\u017e\001\002\000\004\036\135\001" + "\002\000\004\050\014\001\002\000\004\063\015\001\002" + "\000\004\016\016\001\002\000\004\036\023\001\002\000" + "\004\036\020\001\002\000\004\072\021\001\002\000\004" + "\037\022\001\002\000\010\002\ufffd\003\ufffd\036\ufffd\001" + "\002\000\006\020\025\035\027\001\002\000\010\020\025" + "\035\027\036\ufffc\001\002\000\004\066\036\001\002\000" + "\010\020\ufffa\035\ufffa\036\ufffa\001\002\000\004\020\030" + "\001\002\000\004\063\031\001\002\000\006\016\033\017" + "\032\001\002\000\004\004\035\001\002\000\004\004\034" + "\001\002\000\010\020\ufff7\035\ufff7\036\ufff7\001\002\000" + "\010\020\ufff8\035\ufff8\036\ufff8\001\002\000\010\020\037" + "\062\ufff4\067\ufff4\001\002\000\006\062\ufff3\067\ufff3\001" + "\002\000\006\062\ufff5\067\ufff5\001\002\000\006\062\042" + "\067\043\001\002\000\010\020\037\062\ufff4\067\ufff4\001" + "\002\000\004\063\044\001\002\000\004\070\045\001\002" + "\000\020\017\064\020\065\021\046\022\062\064\052\066" + "\057\070\066\001\002\000\004\064\126\001\002\000\034" + "\004\uffdd\005\uffdd\006\uffdd\023\uffdd\024\uffdd\025\uffdd\026" + "\uffdd\036\uffdd\037\uffdd\062\uffdd\065\uffdd\067\uffdd\071\uffdd" + "\001\002\000\034\004\uffdf\005\uffdf\006\uffdf\023\uffdf\024" + "\uffdf\025\uffdf\026\uffdf\036\uffdf\037\uffdf\062\uffdf\065\uffdf" + "\067\uffdf\071\uffdf\001\002\000\032\004\uffe1\005\uffe1\006" + "\uffe1\023\uffe1\024\uffe1\025\uffe1\026\uffe1\036\uffe1\037\uffe1" + "\062\uffe1\067\uffe1\071\uffe1\001\002\000\004\020\112\001" + "\002\000\032\004\uffe3\005\uffe3\006\uffe3\023\uffe3\024\uffe3" + "\025\uffe3\026\uffe3\036\uffe3\037\uffe3\062\uffe3\067\uffe3\071" + "\uffe3\001\002\000\024\004\ufff2\005\ufff2\006\ufff2\025\107" + "\036\ufff2\037\ufff2\062\ufff2\067\ufff2\071\ufff2\001\002\000" + "\032\004\uffe5\005\uffe5\006\uffe5\023\uffe5\024\104\025\uffe5" + "\026\uffe5\036\uffe5\037\uffe5\062\uffe5\067\uffe5\071\uffe5\001" + "\002\000\030\004\uffe7\005\uffe7\006\uffe7\023\102\025\uffe7" + "\026\uffe7\036\uffe7\037\uffe7\062\uffe7\067\uffe7\071\uffe7\001" + "\002\000\016\017\064\020\065\021\046\022\062\066\057" + "\070\066\001\002\000\026\004\uffe9\005\uffe9\006\uffe9\025" + "\uffe9\026\100\036\uffe9\037\uffe9\062\uffe9\067\uffe9\071\uffe9" + "\001\002\000\004\071\076\001\002\000\004\064\071\001" + "\002\000\022\004\ufff1\005\ufff1\006\ufff1\036\ufff1\037\ufff1" + "\062\ufff1\067\ufff1\071\ufff1\001\002\000\034\004\uffdb\005" + "\uffdb\006\uffdb\023\uffdb\024\uffdb\025\uffdb\026\uffdb\036\uffdb" + "\037\uffdb\062\uffdb\065\uffdb\067\uffdb\071\uffdb\001\002\000" + "\034\004\uffda\005\uffda\006\uffda\023\uffda\024\uffda\025\uffda" + "\026\uffda\036\uffda\037\uffda\062\uffda\065\uffda\067\uffda\071" + "\uffda\001\002\000\010\017\064\020\065\066\057\001\002" + "\000\004\071\070\001\002\000\034\004\uffde\005\uffde\006" + "\uffde\023\uffde\024\uffde\025\uffde\026\uffde\036\uffde\037\uffde" + "\062\uffde\065\uffde\067\uffde\071\uffde\001\002\000\012\017" + "\064\020\065\066\057\070\066\001\002\000\004\062\073" + "\001\002\000\012\017\064\020\065\066\057\070\066\001" + "\002\000\004\065\075\001\002\000\034\004\uffe0\005\uffe0" + "\006\uffe0\023\uffe0\024\uffe0\025\uffe0\026\uffe0\036\uffe0\037" + "\uffe0\062\uffe0\065\uffe0\067\uffe0\071\uffe0\001\002\000\004" + "\004\077\001\002\000\010\020\ufff9\035\ufff9\036\ufff9\001" + "\002\000\016\017\064\020\065\021\046\022\062\066\057" + "\070\066\001\002\000\030\004\uffe8\005\uffe8\006\uffe8\023" + "\102\025\uffe8\026\uffe8\036\uffe8\037\uffe8\062\uffe8\067\uffe8" + "\071\uffe8\001\002\000\016\017\064\020\065\021\046\022" + "\062\066\057\070\066\001\002\000\032\004\uffe6\005\uffe6" + "\006\uffe6\023\uffe6\024\104\025\uffe6\026\uffe6\036\uffe6\037" + "\uffe6\062\uffe6\067\uffe6\071\uffe6\001\002\000\016\017\064" + "\020\065\021\046\022\062\066\057\070\066\001\002\000" + "\032\004\uffe4\005\uffe4\006\uffe4\023\uffe4\024\uffe4\025\uffe4" + "\026\uffe4\036\uffe4\037\uffe4\062\uffe4\067\uffe4\071\uffe4\001" + "\002\000\006\025\107\067\110\001\002\000\016\017\064" + "\020\065\021\046\022\062\066\057\070\066\001\002\000" + "\034\004\uffdc\005\uffdc\006\uffdc\023\uffdc\024\uffdc\025\uffdc" + "\026\uffdc\036\uffdc\037\uffdc\062\uffdc\065\uffdc\067\uffdc\071" + "\uffdc\001\002\000\026\004\uffea\005\uffea\006\uffea\025\uffea" + "\026\100\036\uffea\037\uffea\062\uffea\067\uffea\071\uffea\001" + "\002\000\004\062\113\001\002\000\004\020\114\001\002" + "\000\004\066\115\001\002\000\010\017\120\062\uffec\067" + "\uffec\001\002\000\004\065\117\001\002\000\022\004\ufff0" + "\005\ufff0\006\ufff0\036\ufff0\037\ufff0\062\ufff0\067\ufff0\071" + "\ufff0\001\002\000\006\062\uffeb\067\uffeb\001\002\000\006" + "\062\123\067\124\001\002\000\006\062\uffed\067\uffed\001" + "\002\000\010\017\120\062\uffec\067\uffec\001\002\000\004" + "\065\uffef\001\002\000\006\062\uffee\067\uffee\001\002\000" + "\014\017\064\020\065\022\062\066\057\070\066\001\002" + "\000\004\062\130\001\002\000\014\017\064\020\065\022" + "\062\066\057\070\066\001\002\000\004\065\132\001\002" + "\000\032\004\uffe2\005\uffe2\006\uffe2\023\uffe2\024\uffe2\025" + "\uffe2\026\uffe2\036\uffe2\037\uffe2\062\uffe2\067\uffe2\071\uffe2" + "\001\002\000\006\062\ufff6\067\ufff6\001\002\000\010\020" + "\ufffb\035\ufffb\036\ufffb\001\002\000\004\036\142\001\002" + "\000\004\036\u017b\001\002\000\004\036\u0178\001\002\000" + "\004\036\uffce\001\002\000\004\036\u0175\001\002\000\014" + "\010\144\040\145\042\147\047\150\055\146\001\002\000" + "\004\036\uffcc\001\002\000\022\011\u010d\012\u010b\013\u010c" + "\014\u010e\044\u0112\050\u0111\056\u0110\061\u0137\001\002\000" + "\004\061\u012b\001\002\000\020\043\257\050\267\052\265" + "\054\260\056\266\057\262\061\264\001\002\000\004\036" + "\233\001\002\000\004\036\151\001\002\000\004\036\154" + "\001\002\000\004\036\230\001\002\000\004\036\uff94\001" + "\002\000\020\043\163\045\156\050\162\051\161\052\155" + "\053\157\054\160\001\002\000\004\036\222\001\002\000" + "\004\036\215\001\002\000\004\036\210\001\002\000\004" + "\036\203\001\002\000\004\036\176\001\002\000\004\036" + "\171\001\002\000\004\036\164\001\002\000\004\017\165" + "\001\002\000\004\036\166\001\002\000\004\043\167\001" + "\002\000\004\037\170\001\002\000\004\036\uff93\001\002" + "\000\004\016\172\001\002\000\004\036\173\001\002\000" + "\004\050\174\001\002\000\004\037\175\001\002\000\004" + "\036\uff92\001\002\000\004\016\177\001\002\000\004\036" + "\200\001\002\000\004\051\201\001\002\000\004\037\202" + "\001\002\000\004\036\uff91\001\002\000\004\016\204\001" + "\002\000\004\036\205\001\002\000\004\054\206\001\002" + "\000\004\037\207\001\002\000\004\036\uff8d\001\002\000" + "\004\015\211\001\002\000\004\036\212\001\002\000\004" + "\053\213\001\002\000\004\037\214\001\002\000\004\036" + "\uff8e\001\002\000\004\020\216\001\002\000\004\036\217" + "\001\002\000\004\045\220\001\002\000\004\037\221\001" + "\002\000\004\036\uff90\001\002\000\004\017\223\001\002" + "\000\004\036\224\001\002\000\004\052\225\001\002\000" + "\004\037\226\001\002\000\004\036\uff8f\001\002\000\004" + "\036\uff95\001\002\000\022\043\163\045\156\047\231\050" + "\162\051\161\052\155\053\157\054\160\001\002\000\004" + "\037\232\001\002\000\004\036\uff97\001\002\000\004\036" + "\236\001\002\000\004\036\254\001\002\000\004\036\uff8b" + "\001\002\000\006\043\240\045\237\001\002\000\004\036" + "\246\001\002\000\004\036\241\001\002\000\004\017\242" + "\001\002\000\004\036\243\001\002\000\004\043\244\001" + "\002\000\004\037\245\001\002\000\004\036\uff8a\001\002" + "\000\004\020\247\001\002\000\004\036\250\001\002\000" + "\004\045\251\001\002\000\004\037\252\001\002\000\004" + "\036\uff89\001\002\000\004\036\uff8c\001\002\000\010\042" + "\255\043\240\045\237\001\002\000\004\037\256\001\002" + "\000\004\036\uff96\001\002\000\004\063\u0103\001\002\000" + "\004\063\u0101\001\002\000\006\037\uffbe\062\uffbe\001\002" + "\000\004\063\377\001\002\000\006\037\uffca\062\373\001" + "\002\000\004\063\300\001\002\000\004\063\276\001\002" + "\000\004\063\274\001\002\000\004\063\272\001\002\000" + "\004\037\271\001\002\000\004\036\uffcd\001\002\000\004" + "\016\273\001\002\000\006\037\uffba\062\uffba\001\002\000" + "\004\017\275\001\002\000\006\037\uffbc\062\uffbc\001\002" + "\000\004\017\277\001\002\000\006\037\uffb8\062\uffb8\001" + "\002\000\010\032\303\033\302\034\304\001\002\000\006" + "\037\uffbd\062\uffbd\001\002\000\006\037\uff99\062\uff99\001" + "\002\000\004\036\305\001\002\000\006\037\uff98\062\uff98" + "\001\002\000\006\003\306\036\307\001\002\000\006\036" + "\371\037\372\001\002\000\016\050\321\052\314\054\315" + "\056\320\057\322\060\316\001\002\000\006\003\306\036" + "\312\001\002\000\006\003\uffc8\036\uffc8\001\002\000\020" + "\050\321\052\314\054\315\055\317\056\320\057\322\060" + "\316\001\002\000\006\003\uffc9\036\uffc9\001\002\000\004" + "\036\364\001\002\000\004\036\357\001\002\000\004\036" + "\352\001\002\000\004\037\uffcb\001\002\000\004\036\345" + "\001\002\000\004\036\330\001\002\000\004\036\323\001" + "\002\000\004\017\324\001\002\000\004\036\325\001\002" + "\000\004\057\326\001\002\000\004\037\327\001\002\000" + "\006\003\uffc6\036\uffc6\001\002\000\012\016\333\017\331" + "\064\334\074\332\001\002\000\020\004\uffb6\005\uffb6\006" + "\uffb6\036\uffb6\037\uffb6\062\uffb6\067\uffb6\001\002\000\020" + "\004\uffb5\005\uffb5\006\uffb5\036\uffb5\037\uffb5\062\uffb5\067" + "\uffb5\001\002\000\020\004\uffb7\005\uffb7\006\uffb7\036\uffb7" + "\037\uffb7\062\uffb7\067\uffb7\001\002\000\004\020\341\001" + "\002\000\004\036\336\001\002\000\004\050\337\001\002" + "\000\004\037\340\001\002\000\006\003\uffc5\036\uffc5\001" + "\002\000\004\062\342\001\002\000\004\020\343\001\002" + "\000\004\065\344\001\002\000\020\004\uffb4\005\uffb4\006" + "\uffb4\036\uffb4\037\uffb4\062\uffb4\067\uffb4\001\002\000\004" + "\017\346\001\002\000\004\036\347\001\002\000\004\056" + "\350\001\002\000\004\037\351\001\002\000\006\003\uffc7" + "\036\uffc7\001\002\000\004\016\353\001\002\000\004\036" + "\354\001\002\000\004\060\355\001\002\000\004\037\356" + "\001\002\000\006\003\uffc2\036\uffc2\001\002\000\012\016" + "\333\017\331\064\334\074\332\001\002\000\004\036\361" + "\001\002\000\004\054\362\001\002\000\004\037\363\001" + "\002\000\006\003\uffc4\036\uffc4\001\002\000\004\017\365" + "\001\002\000\004\036\366\001\002\000\004\052\367\001" + "\002\000\004\037\370\001\002\000\006\003\uffc3\036\uffc3" + "\001\002\000\006\003\uffc1\036\uffc1\001\002\000\006\003" + "\uffc0\036\uffc0\001\002\000\016\050\267\052\265\054\260" + "\056\266\057\262\061\374\001\002\000\004\063\376\001" + "\002\000\006\037\uffbf\062\uffbf\001\002\000\006\033\302" + "\034\304\001\002\000\004\017\u0100\001\002\000\006\037" + "\uffbb\062\uffbb\001\002\000\004\016\u0102\001\002\000\006" + "\037\uffb9\062\uffb9\001\002\000\004\017\u0104\001\002\000" + "\004\036\u0105\001\002\000\004\036\u0107\001\002\000\004" + "\036\u0127\001\002\000\004\010\u0109\001\002\000\004\036" + "\uffaf\001\002\000\022\011\u010d\012\u010b\013\u010c\014\u010e" + "\044\u0112\050\u0111\056\u0110\061\u010f\001\002\000\006\037" + "\uffa2\062\uffa2\001\002\000\004\063\u0125\001\002\000\004" + "\063\u0123\001\002\000\004\063\u0121\001\002\000\004\063" + "\u011f\001\002\000\004\063\u011d\001\002\000\004\063\u011b" + "\001\002\000\004\063\u0119\001\002\000\004\063\u0117\001" + "\002\000\006\037\u0115\062\u0114\001\002\000\022\011\u010d" + "\012\u010b\013\u010c\014\u010e\044\u0112\050\u0111\056\u0110\061" + "\u010f\001\002\000\004\036\uffae\001\002\000\006\037\uffa3" + "\062\uffa3\001\002\000\004\017\u0118\001\002\000\006\037" + "\uff9f\062\uff9f\001\002\000\004\016\u011a\001\002\000\006" + "\037\uff9e\062\uff9e\001\002\000\004\017\u011c\001\002\000" + "\006\037\uffa0\062\uffa0\001\002\000\006\033\302\034\304" + "\001\002\000\006\037\uffa1\062\uffa1\001\002\000\020\017" + "\064\020\065\021\046\022\062\064\052\066\057\070\066" + "\001\002\000\006\037\uff9a\062\uff9a\001\002\000\020\017" + "\064\020\065\021\046\022\062\064\052\066\057\070\066" + "\001\002\000\006\037\uff9c\062\uff9c\001\002\000\012\016" + "\333\017\331\064\334\074\332\001\002\000\006\037\uff9d" + "\062\uff9d\001\002\000\012\016\333\017\331\064\334\074" + "\332\001\002\000\006\037\uff9b\062\uff9b\001\002\000\006" + "\010\u0109\055\u0129\001\002\000\004\036\uffb0\001\002\000" + "\004\037\u012a\001\002\000\004\036\uffb1\001\002\000\004" + "\063\u012c\001\002\000\004\016\u012d\001\002\000\004\057" + "\u0130\001\002\000\004\037\u012f\001\002\000\004\036\uffd3" + "\001\002\000\004\063\u0131\001\002\000\004\017\u0132\001" + "\002\000\006\037\uffd1\044\u0133\001\002\000\004\063\u0135" + "\001\002\000\004\037\uffd2\001\002\000\004\017\u0136\001" + "\002\000\004\037\uffd0\001\002\000\004\063\u013a\001\002" + "\000\006\037\u0139\062\u0114\001\002\000\004\036\uffb2\001" + "\002\000\010\032\u013b\033\302\034\304\001\002\000\004" + "\036\u013c\001\002\000\004\036\u013e\001\002\000\004\036" + "\uffac\001\002\000\022\011\u0144\012\u0142\013\u0143\014\u0145" + "\044\u014a\050\u0147\056\u0146\060\u0148\001\002\000\004\036" + "\u0141\001\002\000\004\036\uffad\001\002\000\024\010\u0149" + "\011\u0144\012\u0142\013\u0143\014\u0145\044\u014a\050\u0147\056" + "\u0146\060\u0148\001\002\000\004\036\u016f\001\002\000\004" + "\036\u016a\001\002\000\004\036\u0165\001\002\000\004\036" + "\u0160\001\002\000\004\036\u015b\001\002\000\004\036\u0156" + "\001\002\000\004\036\u0151\001\002\000\004\037\u0150\001" + "\002\000\004\036\u014b\001\002\000\004\017\u014c\001\002" + "\000\004\036\u014d\001\002\000\004\044\u014e\001\002\000" + "\004\037\u014f\001\002\000\004\036\uffa4\001\002\000\004" + "\036\uffb3\001\002\000\004\016\u0152\001\002\000\004\036" + "\u0153\001\002\000\004\060\u0154\001\002\000\004\037\u0155" + "\001\002\000\004\036\uffa5\001\002\000\012\016\333\017" + "\331\064\334\074\332\001\002\000\004\036\u0158\001\002" + "\000\004\050\u0159\001\002\000\004\037\u015a\001\002\000" + "\004\036\uffaa\001\002\000\004\017\u015c\001\002\000\004" + "\036\u015d\001\002\000\004\056\u015e\001\002\000\004\037" + "\u015f\001\002\000\004\036\uffab\001\002\000\020\017\064" + "\020\065\021\046\022\062\064\052\066\057\070\066\001" + "\002\000\004\036\u0162\001\002\000\004\014\u0163\001\002" + "\000\004\037\u0164\001\002\000\004\036\uffa7\001\002\000" + "\020\017\064\020\065\021\046\022\062\064\052\066\057" + "\070\066\001\002\000\004\036\u0167\001\002\000\004\011" + "\u0168\001\002\000\004\037\u0169\001\002\000\004\036\uffa9" + "\001\002\000\012\016\333\017\331\064\334\074\332\001" + "\002\000\004\036\u016c\001\002\000\004\013\u016d\001\002" + "\000\004\037\u016e\001\002\000\004\036\uffa6\001\002\000" + "\012\016\333\017\331\064\334\074\332\001\002\000\004" + "\036\u0171\001\002\000\004\012\u0172\001\002\000\004\037" + "\u0173\001\002\000\004\036\uffa8\001\002\000\004\036\uffcf" + "\001\002\000\010\010\144\041\u0176\055\146\001\002\000" + "\004\037\u0177\001\002\000\010\002\uffd9\003\uffd9\036\uffd9" + "\001\002\000\004\041\u0179\001\002\000\004\037\u017a\001" + "\002\000\010\002\uffd6\003\uffd6\036\uffd6\001\002\000\004" + "\041\u017c\001\002\000\004\037\u017d\001\002\000\010\002" + "\uffd7\003\uffd7\036\uffd7\001\002\000\004\027\u017f\001\002" + "\000\004\030\u0184\001\002\000\004\036\u0181\001\002\000" + "\004\073\u0182\001\002\000\004\037\u0183\001\002\000\010" + "\002\uffd8\003\uffd8\036\uffd8\001\002\000\010\010\u0185\046" + "\u0186\055\u0187\001\002\000\006\004\u01d7\031\u01d6\001\002" + "\000\006\004\u01ac\031\u01ab\001\002\000\006\004\u0189\031" + "\u0188\001\002\000\016\007\u0191\050\u0193\052\u0190\054\u018a" + "\056\u0192\057\u018b\001\002\000\004\036\uff84\001\002\000" + "\004\063\u01a8\001\002\000\004\063\u01a5\001\002\000\012" + "\004\uff70\005\uff70\006\uff70\067\uff70\001\002\000\012\004" + "\uff72\005\uff72\006\uff72\067\uff72\001\002\000\012\004\uff74" + "\005\u019f\006\uff74\067\uff74\001\002\000\006\004\u01a4\006" + "\u019d\001\002\000\004\063\u01a1\001\002\000\004\066\u019a" + "\001\002\000\004\063\u0197\001\002\000\004\063\u0194\001" + "\002\000\004\063\u0195\001\002\000\012\016\333\017\331" + "\064\334\074\332\001\002\000\012\004\uff6e\005\uff6e\006" + "\uff6e\067\uff6e\001\002\000\004\063\u0198\001\002\000\004" + "\017\u0199\001\002\000\012\004\uff6f\005\uff6f\006\uff6f\067" + "\uff6f\001\002\000\016\007\u0191\050\u0193\052\u0190\054\u018a" + "\056\u0192\057\u018b\001\002\000\006\006\u019d\067\u019c\001" + "\002\000\012\004\uff71\005\uff71\006\uff71\067\uff71\001\002" + "\000\016\007\u0191\050\u0193\052\u0190\054\u018a\056\u0192\057" + "\u018b\001\002\000\012\004\uff75\005\u019f\006\uff75\067\uff75" + "\001\002\000\016\007\u0191\050\u0193\052\u0190\054\u018a\056" + "\u0192\057\u018b\001\002\000\012\004\uff73\005\uff73\006\uff73" + "\067\uff73\001\002\000\004\063\u01a2\001\002\000\004\017" + "\u01a3\001\002\000\012\004\uff6c\005\uff6c\006\uff6c\067\uff6c" + "\001\002\000\004\036\uff87\001\002\000\004\063\u01a6\001" + "\002\000\004\017\u01a7\001\002\000\012\004\uff6d\005\uff6d" + "\006\uff6d\067\uff6d\001\002\000\004\063\u01a9\001\002\000" + "\012\016\333\017\331\064\334\074\332\001\002\000\012" + "\004\uff6b\005\uff6b\006\uff6b\067\uff6b\001\002\000\022\007" + "\u01b5\043\u01ad\045\u01b6\050\u01b7\051\u01b8\052\u01b4\053\u01b3" + "\054\u01ae\001\002\000\004\036\uff85\001\002\000\004\063" + "\u01d3\001\002\000\004\063\u01d0\001\002\000\012\004\uff7d" + "\005\uff7d\006\uff7d\067\uff7d\001\002\000\012\004\uff7f\005" + "\uff7f\006\uff7f\067\uff7f\001\002\000\012\004\uff81\005\u01c7" + "\006\uff81\067\uff81\001\002\000\006\004\u01cf\006\u01c5\001" + "\002\000\004\063\u01cc\001\002\000\004\063\u01c9\001\002" + "\000\004\066\u01c2\001\002\000\004\063\u01bf\001\002\000" + "\004\063\u01bc\001\002\000\004\063\u01b9\001\002\000\004" + "\063\u01ba\001\002\000\012\016\333\017\331\064\334\074" + "\332\001\002\000\012\004\uff7a\005\uff7a\006\uff7a\067\uff7a" + "\001\002\000\004\063\u01bd\001\002\000\012\016\333\017" + "\331\064\334\074\332\001\002\000\012\004\uff7b\005\uff7b" + "\006\uff7b\067\uff7b\001\002\000\004\063\u01c0\001\002\000" + "\012\016\333\017\331\064\334\074\332\001\002\000\012" + "\004\uff76\005\uff76\006\uff76\067\uff76\001\002\000\022\007" + "\u01b5\043\u01ad\045\u01b6\050\u01b7\051\u01b8\052\u01b4\053\u01b3" + "\054\u01ae\001\002\000\006\006\u01c5\067\u01c4\001\002\000" + "\012\004\uff7e\005\uff7e\006\uff7e\067\uff7e\001\002\000\022" + "\007\u01b5\043\u01ad\045\u01b6\050\u01b7\051\u01b8\052\u01b4\053" + "\u01b3\054\u01ae\001\002\000\012\004\uff82\005\u01c7\006\uff82" + "\067\uff82\001\002\000\022\007\u01b5\043\u01ad\045\u01b6\050" + "\u01b7\051\u01b8\052\u01b4\053\u01b3\054\u01ae\001\002\000\012" + "\004\uff80\005\uff80\006\uff80\067\uff80\001\002\000\004\063" + "\u01ca\001\002\000\004\017\u01cb\001\002\000\012\004\uff79" + "\005\uff79\006\uff79\067\uff79\001\002\000\004\063\u01cd\001" + "\002\000\012\016\333\017\331\064\334\074\332\001\002" + "\000\012\004\uff78\005\uff78\006\uff78\067\uff78\001\002\000" + "\004\036\uff88\001\002\000\004\063\u01d1\001\002\000\012" + "\016\333\017\331\064\334\074\332\001\002\000\012\004" + "\uff77\005\uff77\006\uff77\067\uff77\001\002\000\004\063\u01d4" + "\001\002\000\004\017\u01d5\001\002\000\012\004\uff7c\005" + "\uff7c\006\uff7c\067\uff7c\001\002\000\022\007\u01e1\011\u01df" + "\012\u01dd\013\u01de\014\u01e0\043\u01da\044\u01e3\050\u01e2\001" + "\002\000\004\036\uff83\001\002\000\012\004\uff65\005\uff65" + "\006\uff65\067\uff65\001\002\000\012\004\uff67\005\uff67\006" + "\uff67\067\uff67\001\002\000\004\063\u01fe\001\002\000\012" + "\004\uff69\005\u01ef\006\uff69\067\uff69\001\002\000\006\004" + "\u01fd\006\u01ed\001\002\000\004\063\u01fa\001\002\000\004" + "\063\u01f7\001\002\000\004\063\u01f4\001\002\000\004\063" + "\u01f1\001\002\000\004\066\u01ea\001\002\000\004\063\u01e7" + "\001\002\000\004\063\u01e4\001\002\000\004\063\u01e5\001" + "\002\000\012\016\333\017\331\064\334\074\332\001\002" + "\000\012\004\uff5e\005\uff5e\006\uff5e\067\uff5e\001\002\000" + "\004\063\u01e8\001\002\000\012\016\333\017\331\064\334" + "\074\332\001\002\000\012\004\uff63\005\uff63\006\uff63\067" + "\uff63\001\002\000\022\007\u01e1\011\u01df\012\u01dd\013\u01de" + "\014\u01e0\043\u01da\044\u01e3\050\u01e2\001\002\000\006\006" + "\u01ed\067\u01ec\001\002\000\012\004\uff66\005\uff66\006\uff66" + "\067\uff66\001\002\000\022\007\u01e1\011\u01df\012\u01dd\013" + "\u01de\014\u01e0\043\u01da\044\u01e3\050\u01e2\001\002\000\012" + "\004\uff6a\005\u01ef\006\uff6a\067\uff6a\001\002\000\022\007" + "\u01e1\011\u01df\012\u01dd\013\u01de\014\u01e0\043\u01da\044\u01e3" + "\050\u01e2\001\002\000\012\004\uff68\005\uff68\006\uff68\067" + "\uff68\001\002\000\004\063\u01f2\001\002\000\020\017\064" + "\020\065\021\046\022\062\064\052\066\057\070\066\001" + "\002\000\012\004\uff5f\005\uff5f\006\uff5f\067\uff5f\001\002" + "\000\004\063\u01f5\001\002\000\020\017\064\020\065\021" + "\046\022\062\064\052\066\057\070\066\001\002\000\012" + "\004\uff60\005\uff60\006\uff60\067\uff60\001\002\000\004\063" + "\u01f8\001\002\000\012\016\333\017\331\064\334\074\332" + "\001\002\000\012\004\uff61\005\uff61\006\uff61\067\uff61\001" + "\002\000\004\063\u01fb\001\002\000\012\016\333\017\331" + "\064\334\074\332\001\002\000\012\004\uff62\005\uff62\006" + "\uff62\067\uff62\001\002\000\004\036\uff86\001\002\000\004" + "\063\u01ff\001\002\000\004\017\u0200\001\002\000\012\004" + "\uff64\005\uff64\006\uff64\067\uff64\001\002\000\010\002\uffd4" + "\003\uffd4\036\uffd4\001\002\000\010\002\uffd5\003\uffd5\036" + "\uffd5\001\002\000\010\002\uffff\003\uffff\036\uffff\001\002" + "\000\006\041\012\073\011\001\002\000\004\002\001\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\u0203\000\010\002\003\004\004\011\005\001\001\000" + "\002\001\001\000\004\011\u0202\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\004" + "\006\016\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\006" + "\007\025\010\023\001\001\000\004\007\133\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\002\001\001\000\006\024\040" + "\034\037\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\004\034\132\001\001\000\002\001\001" + "\000\002\001\001\000\026\036\062\047\060\050\053\051" + "\057\052\055\053\054\054\052\055\050\056\047\057\046" + "\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\002\001\001\000" + "\022\050\105\051\057\052\055\053\054\054\052\055\050" + "\056\047\057\046\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\004\057\066\001\001\000\002\001" + "\001\000\002\001\001\000\006\056\071\057\046\001\001" + "\000\002\001\001\000\006\056\073\057\046\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\016\052\100\053\054\054\052\055\050\056" + "\047\057\046\001\001\000\002\001\001\000\014\053\102" + "\054\052\055\050\056\047\057\046\001\001\000\002\001" + "\001\000\012\054\104\055\050\056\047\057\046\001\001" + "\000\002\001\001\000\002\001\001\000\020\051\110\052" + "\055\053\054\054\052\055\050\056\047\057\046\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\004\027\115\001\001\000\006\025\120" + "\026\121\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + "\026\124\001\001\000\002\001\001\000\002\001\001\000" + "\010\055\126\056\047\057\046\001\001\000\002\001\001" + "\000\010\055\130\056\047\057\046\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\014\003\142\012\140\013\137\017\136\031\135\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\006\003\142\013\u0173\001\001\000\002\001\001\000" + "\002\001\001\000\006\037\u0137\040\u0109\001\001\000\002" + "\001\001\000\010\014\267\043\262\044\260\001\001\000" + "\002\001\001\000\002\001\001\000\006\020\151\021\152" + "\001\001\000\004\021\226\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\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\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\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\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" + "\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\006\022\233\023\234\001\001" + "\000\004\023\252\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" + "\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\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\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\002\001\001\000\002\001\001\000" + "\002\001\001\000\004\035\300\001\001\000\002\001\001" + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + "\006\045\307\046\310\001\001\000\002\001\001\000\002" + "\001\001\000\004\046\312\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\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\004\033\334\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\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\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\004\033\357\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\002\001\001\000\002\001\001" + "\000\002\001\001\000\004\044\374\001\001\000\002\001" + "\001\000\002\001\001\000\004\035\300\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\006\015\u0105" + "\016\u0107\001\001\000\004\016\u0127\001\001\000\002\001" + "\001\000\002\001\001\000\006\037\u0112\040\u0109\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\002\001\001\000\002\001" + "\001\000\004\040\u0115\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\004\035\u011d\001\001\000\002\001\001\000\026\036" + "\062\047\u011f\050\053\051\057\052\055\053\054\054\052" + "\055\050\056\047\057\046\001\001\000\002\001\001\000" + "\026\036\062\047\u0121\050\053\051\057\052\055\053\054" + "\054\052\055\050\056\047\057\046\001\001\000\002\001" + "\001\000\004\033\u0123\001\001\000\002\001\001\000\004" + "\033\u0125\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\004\005\u012d\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\004\032\u0133\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\004\035" + "\u011d\001\001\000\002\001\001\000\006\041\u013e\042\u013c" + "\001\001\000\002\001\001\000\002\001\001\000\004\042" + "\u013f\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\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\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\004\033\u0156\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" + "\002\001\001\000\026\036\062\047\u0160\050\053\051\057" + "\052\055\053\054\054\052\055\050\056\047\057\046\001" + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + "\000\002\001\001\000\026\036\062\047\u0165\050\053\051" + "\057\052\055\053\054\054\052\055\050\056\047\057\046" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\004\033\u016a\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\004\033\u016f\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\002\001\001\000\002\001\001\000\002\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + "\030\u017f\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\002\001" + "\001\000\012\061\u018e\066\u018d\067\u018c\070\u018b\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\002\001\001\000\002\001" + "\001\000\002\001\001\000\002\001\001\000\004\033\u0195" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\012\061\u019a\066\u018d\067\u018c" + "\070\u018b\001\001\000\002\001\001\000\002\001\001\000" + "\010\066\u019d\067\u018c\070\u018b\001\001\000\002\001\001" + "\000\006\067\u019f\070\u018b\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\002\001\001\000\004\033\u01a9\001\001\000\002" + "\001\001\000\012\060\u01b1\063\u01b0\064\u01af\065\u01ae\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\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\004\033\u01ba\001\001\000\002" + "\001\001\000\002\001\001\000\004\033\u01bd\001\001\000" + "\002\001\001\000\002\001\001\000\004\033\u01c0\001\001" + "\000\002\001\001\000\012\060\u01c2\063\u01b0\064\u01af\065" + "\u01ae\001\001\000\002\001\001\000\002\001\001\000\010" + "\063\u01c5\064\u01af\065\u01ae\001\001\000\002\001\001\000" + "\006\064\u01c7\065\u01ae\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\004\033\u01cd\001\001\000\002\001\001\000\002" + "\001\001\000\002\001\001\000\004\033\u01d1\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + "\001\001\000\012\062\u01db\071\u01da\072\u01d8\073\u01d7\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\002\001\001\000\002" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\004\033\u01e5\001\001\000\002" + "\001\001\000\002\001\001\000\004\033\u01e8\001\001\000" + "\002\001\001\000\012\062\u01ea\071\u01da\072\u01d8\073\u01d7" + "\001\001\000\002\001\001\000\002\001\001\000\010\071" + "\u01ed\072\u01d8\073\u01d7\001\001\000\002\001\001\000\006" + "\072\u01ef\073\u01d7\001\001\000\002\001\001\000\002\001" + "\001\000\026\036\062\047\u01f2\050\053\051\057\052\055" + "\053\054\054\052\055\050\056\047\057\046\001\001\000" + "\002\001\001\000\002\001\001\000\026\036\062\047\u01f5" + "\050\053\051\057\052\055\053\054\054\052\055\050\056" + "\047\057\046\001\001\000\002\001\001\000\002\001\001" + "\000\004\033\u01f8\001\001\000\002\001\001\000\002\001" + "\001\000\004\033\u01fb\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\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$AnalizadorSintactico_compilador_consola$actions action_obj; /** Action encapsulation object initializer. */ protected void init_actions() { action_obj = new CUP$AnalizadorSintactico_compilador_consola$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$AnalizadorSintactico_compilador_consola$do_action(act_num, parser, stack, top); } /** Indicates start state. */ public int start_state() {return 0;} /** Indicates start production. */ public int start_production() {return 0;} /** <code>EOF</code> Symbol index. */ public int EOF_sym() {return 0;} /** <code>error</code> Symbol index. */ public int error_sym() {return 1;} protected final static int _error_sync_size = 8; protected int error_sync_size( ) { return _error_sync_size; } /**Metodo al que se llama automáticamente ante algún error sintactico.*/ public void syntax_error(Symbol s){ System.out.println("Error en la Línea " + (s.right+1) +" Columna "+s.left+ ". Identificador " +s.value + " no reconocido."); } /**Metodo al que se llama en el momento en que ya no es posible una recuperación de errores.*/ public void unrecovered_syntax_error(Symbol s) throws java.lang.Exception{ System.out.println("Error en la Línea " + (s.right+1)+ "Columna "+s.left+". Identificador " + s.value + " no reconocido."); } } /** Cup generated class to encapsulate user supplied action code.*/ class CUP$AnalizadorSintactico_compilador_consola$actions { Tabla_Hash_compilador hash_compi = new Tabla_Hash_compilador(); private final Enlace_Envio enlace=new Enlace_Envio(); StringBuilder reply= new StringBuilder(); Boolean Respondido = false; private final AnalizadorSintactico_compilador_consola parser; /** Constructor */ CUP$AnalizadorSintactico_compilador_consola$actions(AnalizadorSintactico_compilador_consola parser) { this.parser = parser; } /** Method with the actual generated action code. */ public final java_cup.runtime.Symbol CUP$AnalizadorSintactico_compilador_consola$do_action( int CUP$AnalizadorSintactico_compilador_consola$act_num, java_cup.runtime.lr_parser CUP$AnalizadorSintactico_compilador_consola$parser, java.util.Stack CUP$AnalizadorSintactico_compilador_consola$stack, int CUP$AnalizadorSintactico_compilador_consola$top) throws java.lang.Exception { /* Symbol object for return from actions */ java_cup.runtime.Symbol CUP$AnalizadorSintactico_compilador_consola$result; /* select the action based on the action number */ switch (CUP$AnalizadorSintactico_compilador_consola$act_num) { /*. . . . . . . . . . . . . . . . . . . .*/ case 163: // COMPARAP4 ::= sucursal igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("sucursal"); RESULT.productos = hash.get_productosc("sucursal", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 162: // COMPARAP4 ::= tamano igual igual EQ { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("tamaño"); if(val.variables.isEmpty() && val.Ecuacion.equals("")){ RESULT.productos = hash.get_productosc("tamaño", (Object)val.Ecuacion); }else{ reply.append(enlace.reply_error("semantico", "la ecuacion ingresada no se puede evaluar", valleft, valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 161: // COMPARAP4 ::= cantidad igual igual EQ { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("cantidad"); if(val.variables.isEmpty() && val.Ecuacion.equals("")){ RESULT.productos = hash.get_productosc("cantidad", (Object)val.Ecuacion); }else{ reply.append(enlace.reply_error("semantico", "la ecuacion ingresada no se puede evaluar", valleft, valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 160: // COMPARAP4 ::= color igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("color"); RESULT.productos = hash.get_productosc("color", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 159: // COMPARAP4 ::= marca igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("marca"); RESULT.productos = hash.get_productosc("marca", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 158: // COMPARAP4 ::= nombre igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("nombre"); RESULT.productos = hash.get_productosc("nombre", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 157: // COMPARAP4 ::= id igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("id"); RESULT.productos = hash.get_productosc("id", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP4",57, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 156: // COMPARAP3 ::= COMPARAP4 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP3",56, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 155: // COMPARAP3 ::= NOT parentesisi COMPARAP1 parentesisf { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Query(); RESULT.valuados = val.valuados; RESULT.productos = hash.Negar_productos(val.productos); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP3",56, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 154: // COMPARAP2 ::= COMPARAP3 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP2",55, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 153: // COMPARAP2 ::= COMPARAP2 AND COMPARAP3 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); ArrayList<Producto> temp2 = new ArrayList(); if(!val1.productos.isEmpty()){ Producto prueba = val1.productos.get(0); val1.valuados.stream().forEach((String s)->{ val2.productos.stream().forEach((Producto p)->{ switch(s){ case "id": if(p.getId()==prueba.getId()){ temp2.add(p); } break; case "nombre": if(p.getNombre().equals(prueba.getNombre())){ temp2.add(p); } break; case "marca": if(p.getMarca().equals(prueba.getMarca())){ temp2.add(p); } break; case "color": if(p.getColor().equals(prueba.getColor())){ temp2.add(p); } break; case "cantidad": if(p.getCantidad()==prueba.getCantidad()){ temp2.add(p); } break; case "tamaño": if(p.getTamaño()==prueba.getTamaño()){ temp2.add(p); } break; case "sucursal": if(p.getSucursal()==prueba.getSucursal()){ temp2.add(p); } break; } }); }); } if(!val2.productos.isEmpty()){ Producto prueba = val2.productos.get(0); val2.valuados.stream().forEach((String s)->{ val1.productos.stream().forEach((Producto p)->{ switch(s){ case "id": if(p.getId()==prueba.getId()){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "nombre": if(p.getNombre().equals(prueba.getNombre())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "marca": if(p.getMarca().equals(prueba.getMarca())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "color": if(p.getColor().equals(prueba.getColor())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "cantidad": if(p.getCantidad()==prueba.getCantidad()){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "tamaño": if(p.getTamaño()==prueba.getTamaño()){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "sucursal": if(p.getSucursal()==prueba.getSucursal()){ if(!temp2.contains(p)){ temp2.add(p); } } break; } }); }); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP2",55, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 152: // COMPARAP1 ::= COMPARAP2 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP1",48, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 151: // COMPARAP1 ::= COMPARAP1 OR COMPARAP2 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); val1.productos.stream().forEach(RESULT.productos::add); val2.productos.stream().forEach(RESULT.productos::add); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAP1",48, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 150: // COMPARAT4 ::= direccion igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("direccion"); RESULT.tiendas = hash.get_tiendasc("direccion", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT4",54, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 149: // COMPARAT4 ::= telefono igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("telefono"); RESULT.tiendas = hash.get_tiendasc("telefono", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT4",54, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 148: // COMPARAT4 ::= propietario igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("propietario"); RESULT.tiendas = hash.get_tiendasc("propietario", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT4",54, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 147: // COMPARAT4 ::= nombre igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("nombre"); RESULT.tiendas = hash.get_tiendasc("nombre", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT4",54, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 146: // COMPARAT4 ::= codigo igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.valuados.add("codigo"); RESULT.tiendas = hash.get_tiendasc("codigo", (Object)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT4",54, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 145: // COMPARAT3 ::= COMPARAT4 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT3",53, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 144: // COMPARAT3 ::= NOT parentesisi COMPARAT1 parentesisf { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Query(); RESULT.tiendas = hash.Negar_tiendas(val.tiendas); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT3",53, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 143: // COMPARAT2 ::= COMPARAT3 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT2",52, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 142: // COMPARAT2 ::= COMPARAT2 AND COMPARAT3 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); ArrayList<Tienda> temp2 = new ArrayList(); if(!val1.valuados.isEmpty()){ Tienda temp = val1.tiendas.get(0); val1.valuados.stream().forEach((String s)->{ val2.tiendas.stream().forEach((Tienda t)->{ switch(s){ case "codigo": if(t.getCodigo()==temp.getCodigo()){ temp2.add(t); } break; case "propietario": if(t.getPropietario()==temp.getPropietario()){ temp2.add(t); } break; case "nombre": if(t.getNombre().equals(temp.getNombre())){ temp2.add(t); } break; case "dirreccion": if(t.getDirreccion().equals(temp.getDirreccion())){ temp2.add(t); } break; case "telefono": if(t.getTelefono()==temp.getTelefono()){ temp2.add(t); } break; } }); }); }else if(!val2.valuados.isEmpty()){ Tienda temp = val2.tiendas.get(0); val2.valuados.stream().forEach((String s)->{ val1.tiendas.stream().forEach((Tienda t)->{ switch(s){ case "codigo": if(t.getCodigo()==temp.getCodigo()){ temp2.add(t); } break; case "propietario": if(t.getPropietario()==temp.getPropietario()){ temp2.add(t); } break; case "nombre": if(t.getNombre().equals(temp.getNombre())){ temp2.add(t); } break; case "dirreccion": if(t.getDirreccion().equals(temp.getDirreccion())){ temp2.add(t); } break; case "telefono": if(t.getTelefono()==temp.getTelefono()){ temp2.add(t); } break; } }); }); } RESULT.tiendas = temp2; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT2",52, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 141: // COMPARAT1 ::= COMPARAT2 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT1",47, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 140: // COMPARAT1 ::= COMPARAT1 OR COMPARAT2 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.tiendas.stream().forEach(RESULT.tiendas::add); val2.tiendas.stream().forEach(RESULT.tiendas::add); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAT1",47, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 139: // COMPARAU4 ::= password igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("password", val); RESULT.valuados.add("password"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 138: // COMPARAU4 ::= direccion igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("direccion", val); RESULT.valuados.add("direccion"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 137: // COMPARAU4 ::= email igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("email", val); RESULT.valuados.add("email"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 136: // COMPARAU4 ::= telefono igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("telefono", val); RESULT.valuados.add("telefono"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 135: // COMPARAU4 ::= apellido igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("apellido", val); RESULT.valuados.add("apellido"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 134: // COMPARAU4 ::= nombre igual igual CONSM { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("nombre", val); RESULT.valuados.add("nombre"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 133: // COMPARAU4 ::= id igual igual numero { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); RESULT.usuarios = hash.get_usuariosc("id", val); RESULT.valuados.add("id"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU4",51, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 132: // COMPARAU3 ::= COMPARAU4 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU3",50, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 131: // COMPARAU3 ::= NOT parentesisi COMPARAU1 parentesisf { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Query(); RESULT.usuarios = hash.Negar_usuarioss(val.usuarios); val.valuados.stream().forEach(RESULT.valuados::add); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU3",50, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 130: // COMPARAU2 ::= COMPARAU3 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU2",49, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 129: // COMPARAU2 ::= COMPARAU2 AND COMPARAU3 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); ArrayList<Usuario> temp2 = new ArrayList(); if(!val1.usuarios.isEmpty()){ Usuario prueba = val1.usuarios.get(0); val1.valuados.stream().forEach((String s)->{ val2.usuarios.stream().forEach((Usuario p)->{ switch(s){ case "id": if(p.getId()==prueba.getId()){ temp2.add(p); } break; case "nombre": if(p.getNombre().equals(prueba.getNombre())){ temp2.add(p); } break; case "apellido": if(p.getApellido().equals(prueba.getApellido())){ temp2.add(p); } break; case "password": if(p.getPassword().equals(prueba.getPassword())){ temp2.add(p); } break; case "telefono": if(p.getTelefono()==prueba.getTelefono()){ temp2.add(p); } break; case "email": if(p.getEmail().equals(prueba.getEmail())){ temp2.add(p); } break; case "direeccion": if(p.getDirreccion().equals(prueba.getDirreccion())){ temp2.add(p); } break; } }); }); } if(!val2.usuarios.isEmpty()){ Usuario prueba = val2.usuarios.get(0); val2.valuados.stream().forEach((String s)->{ val1.usuarios.stream().forEach((Usuario p)->{ switch(s){ case "id": if(p.getId()==prueba.getId()){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "nombre": if(p.getNombre().equals(prueba.getNombre())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "apellido": if(p.getApellido().equals(prueba.getApellido())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "password": if(p.getPassword().equals(prueba.getPassword())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "telefono": if(p.getTelefono()==prueba.getTelefono()){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "email": if(p.getEmail().equals(prueba.getEmail())){ if(!temp2.contains(p)){ temp2.add(p); } } break; case "direccion": if(p.getDirreccion().equals(prueba.getDirreccion())){ if(!temp2.contains(p)){ temp2.add(p); } } break; } }); }); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU2",49, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 128: // COMPARAU1 ::= COMPARAU2 { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU1",46, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 127: // COMPARAU1 ::= COMPARAU1 OR COMPARAU2 { Query RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Query val1 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Query val2 = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Query(); val1.usuarios.stream().forEach(RESULT.usuarios::add); val2.usuarios.stream().forEach(RESULT.usuarios::add); val1.valuados.stream().forEach(RESULT.valuados::add); val2.valuados.stream().forEach(RESULT.valuados::add); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("COMPARAU1",46, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 126: // CONSULTA ::= extraer de producto pyc { Query RESULT =null; ArrayList<Producto> val = hash.get_productos(); reply.append("id---nombre----marca----color----cantidad-------tamaño------sucursal"); val.stream().forEach((Producto u)->{ reply.append(u.getId()); reply.append(u.getNombre()); reply.append(u.getMarca()); reply.append(u.getColor()); reply.append(u.getCantidad()); reply.append(u.getTamaño()); reply.append(u.getSucursal()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 125: // CONSULTA ::= extraer de tienda pyc { Query RESULT =null; ArrayList<Tienda> val = hash.get_tiendas(); reply.append("Codigo---Propietario----Nombre----Direcciones----Telefono"); val.stream().forEach((Tienda u)->{ reply.append(u.getCodigo()); reply.append(u.getPropietario()); reply.append(u.getNombre()); reply.append(u.getDirreccion()); reply.append(u.getTelefono()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 124: // CONSULTA ::= extraer de usuario pyc { Query RESULT =null; ArrayList<Usuario> val = hash.get_usuarios(); reply.append("Nombre---Apellido----Id----Password----Telefono----Dirreccion"); val.stream().forEach((Usuario u)->{ reply.append(u.getNombre()); reply.append(u.getApellido()); reply.append(u.getId()); reply.append(u.getPassword()); reply.append(u.getTelefono()); reply.append(u.getDirreccion()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 123: // CONSULTA ::= extraer de producto donde COMPARAP1 pyc { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; reply.append("id---nombre----marca----color----cantidad-------tamaño------sucursal"); val.productos.stream().forEach((Producto u)->{ reply.append(u.getId()); reply.append(u.getNombre()); reply.append(u.getMarca()); reply.append(u.getColor()); reply.append(u.getCantidad()); reply.append(u.getTamaño()); reply.append(u.getSucursal()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 122: // CONSULTA ::= extraer de tienda donde COMPARAT1 pyc { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; reply.append("Codigo---Propietario----Nombre----Direcciones----Telefono"); val.tiendas.stream().forEach((Tienda u)->{ reply.append(u.getCodigo()); reply.append(u.getPropietario()); reply.append(u.getNombre()); reply.append(u.getDirreccion()); reply.append(u.getTelefono()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 121: // CONSULTA ::= extraer de usuario donde COMPARAU1 pyc { Query RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; reply.append("Codigo---Propietario----Nombre----Direcciones----Telefono"); val.tiendas.stream().forEach((Tienda u)->{ reply.append(u.getCodigo()); reply.append(u.getPropietario()); reply.append(u.getNombre()); reply.append(u.getDirreccion()); reply.append(u.getTelefono()); }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSULTA",22, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 120: // LOGINP ::= DI password DI identificador DI password DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setPassword((String)val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("LOGINP",17, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 119: // LOGINP ::= DI id DI numero DI id DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setId(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("LOGINP",17, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 118: // LOGIN ::= LOGINP { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Usuario val = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("LOGIN",16, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 117: // LOGIN ::= LOGIN LOGINP { Usuario RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Usuario val1 = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Usuario val2 = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT= new Usuario(); if(val1.getId()==0 && val2.getId()!=0){ RESULT.setId(val2.getId()); }else if(val1.getId()!=0 && val2.getId()==0){ RESULT.setId(val1.getId()); }else{ reply.append(enlace.reply_error("semantico", "Atributos ingresado para login incorrectos", val1left, val2right)); } if(val1.getPassword().equals("vacio") && !val2.getPassword().equals("vacio")){ RESULT.setPassword(val2.getPassword()); }else if(!val1.getPassword().equals("vacio") && val2.getPassword().equals("vacio")){ RESULT.setPassword(val1.getPassword()); }else{ reply.append(enlace.reply_error("semantico", "Atributos ingresado para login incorrectos", val2left, val2right)); } if(RESULT.getId()==0 || RESULT.getPassword()==null){ reply.append(enlace.reply_error("semantico", "error en ingreso para logear, Fallo Critico", val1left, val2right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("LOGIN",16, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 116: // REGISUSUP ::= DI direccion DI cadena DI direccion DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setDirreccion(val.replaceAll("\"","")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 115: // REGISUSUP ::= DI email DI correo DI email DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setEmail(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 114: // REGISUSUP ::= DI telefono DI numero DI telefono DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setTelefono(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 113: // REGISUSUP ::= DI password DI identificador DI password DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setPassword(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 112: // REGISUSUP ::= DI apellido DI cadena DI apellido DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setApellido(val.replaceAll("\"","")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 111: // REGISUSUP ::= DI nombre DI cadena DI nombre DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setNombre(val.replaceAll("\"","")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 110: // REGISUSUP ::= DI id DI numero DI id DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Usuario(); RESULT.setId(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSUP",15, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 109: // REGISUSU ::= REGISUSUP { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Usuario val = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSU",14, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 108: // REGISUSU ::= REGISUSU REGISUSUP { Usuario RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Usuario val1 = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Usuario val2 = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; if(val2.getId()!=0 && RESULT.getId()==0){ RESULT.setId(val2.getId()); }else if(val2.getId()!=0 && RESULT.getId()!=0){ reply.append(enlace.reply_error("semantico", "Atributo id declarado mas de una vez", val2left, val2right)); } if(!val2.getNombre().equals("vacio") && RESULT.getNombre().equals("vacio")){ RESULT.setNombre(val2.getNombre()); }else if(!val2.getNombre().equals("vacio") && !RESULT.getNombre().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo nombre declarado mas de una vez", val2left, val2right)); } if(!val2.getApellido().equals("vacio") && RESULT.getApellido().equals("vacio")){ RESULT.setApellido(val2.getApellido()); }else if(!val2.getApellido().equals("vacio") && !RESULT.getApellido().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo apellido declarado mas de una vez", val2left, val2right)); } if(!val2.getPassword().equals("vacio") && RESULT.getPassword().equals("vacio")){ RESULT.setPassword(val2.getPassword()); }else if(!val2.getPassword().equals("vacio") && !RESULT.getPassword().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo password declarado mas de una vez", val2left, val2right)); } if(!val2.getTelefono().equals("vacio") && RESULT.getTelefono().equals("vacio")){ RESULT.setTelefono(val2.getTelefono()); }else if(!val2.getTelefono().equals("vacio") && !RESULT.getTelefono().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo telefono declarado mas de una vez", val2left, val2right)); } if(!val2.getEmail().equals("vacio") && RESULT.getEmail().equals("vacio")){ RESULT.setEmail(val2.getEmail()); }else if(!val2.getEmail().equals("vacio") && !RESULT.getEmail().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo email declarado mas de una vez", val2left, val2right)); } if(!val2.getDirreccion().equals("vacio") && RESULT.getDirreccion().equals("vacio")){ RESULT.setDirreccion(val2.getDirreccion()); }else if(!val2.getDirreccion().equals("vacio") && !RESULT.getDirreccion().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Atributo dirreccion declarado mas de una vez", val2left, val2right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISUSU",14, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 107: // USUARIO ::= DI iniciousuario DI LOGIN DI iniciousuario DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Usuario val = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = val; if(RESULT.getId()!=0 && !RESULT.getPassword().equals("vacio")){ if(!hash.usuExist(RESULT.getId()-1)){ Usuario prueba = hash.getusu(RESULT.getId()); if(prueba.getPassword().equals(RESULT.getPassword())){ inter.txtsalida.setText("Log In en funcionamiento... Si Accedio"); Respondido = true; }else{ enlace.reply_login(RESULT.getId(), "Log In en funcionamiento... no Accedio"); Respondido = true; } }else{ enlace.reply_login(RESULT.getId(), "Log In en funcionamiento... Fail"); Respondido = true; } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("USUARIO",13, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 106: // USUARIO ::= DI crearusuario DI REGISUSU DI crearusuario DF { Usuario RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Usuario val = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = val; if(RESULT.getId()!=0 && !RESULT.getNombre().equals("vacio") && !RESULT.getApellido().equals("vacio") && !RESULT.getTelefono().equals("vacio") && !RESULT.getEmail().equals("vacio")){ if(hash.usuExist(RESULT.getId()-1)){ hash.insertar_usu(RESULT.getId(),RESULT); reply.append(enlace.reply_registro_usu(RESULT.getId(),"True")); }else{ reply.append(enlace.reply_registro_usu(RESULT.getId(),"False")); } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("USUARIO",13, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 105: // ACCION ::= ELIMINACION { String RESULT =null; RESULT = "eliminar"; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCION",27, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 104: // ACCION ::= MODIFICACION { String RESULT =null; RESULT = "modificar"; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCION",27, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 103: // ACCIONESPRODUP ::= tamano igual EQ { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); if(val.variables.isEmpty()){ RESULT.setTamaño(Integer.parseInt(val.Ecuacion)); }else{ reply.append(enlace.reply_error("semantico", "ecuacion encontrada sin valor exacto", valleft, valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 102: // ACCIONESPRODUP ::= marca igual CONSM { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); RESULT.setMarca(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 101: // ACCIONESPRODUP ::= cantidad igual EQ { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); if(val.variables.isEmpty()){ RESULT.setCantidad(Integer.parseInt(val.Ecuacion)); }else{ reply.append(enlace.reply_error("semantico", "ecuacion encontrada sin valor exacto", valleft, valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 100: // ACCIONESPRODUP ::= color igual CONSM { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); RESULT.setColor(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 99: // ACCIONESPRODUP ::= nombre igual cadena { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); RESULT.setNombre(val.replaceAll("\"", "")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 98: // ACCIONESPRODUP ::= sucursal igual numero { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); RESULT.setSucursal(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 97: // ACCIONESPRODUP ::= codigo igual numero { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); RESULT.setId(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 96: // ACCIONESPRODUP ::= tipo igual ACCION { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Producto(); switch (val) { case "eliminar": RESULT.setEliminar(true); break; case "modificar": RESULT.setModificar(true); break; default: reply.append(enlace.reply_error("semantico", "valor de Accion no Encontrado", valleft, valright)); break; } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODUP",30, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 95: // ACCIONESPRODU ::= ACCIONESPRODUP { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Producto val = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODU",29, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 94: // ACCIONESPRODU ::= ACCIONESPRODU coma ACCIONESPRODUP { Producto RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Producto val1 = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Producto val2 = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; if(val2.getId()!=0 && RESULT.getId()==0){ RESULT.setId(val2.getId()); }else if(!val2.getNombre().equals("vacio") && RESULT.getNombre().equals("vacio")){ RESULT.setNombre(val2.getNombre()); }else if(val2.getCantidad()!=0 && RESULT.getCantidad()==0){ RESULT.setCantidad(val2.getCantidad()); }else if(!val2.getMarca().equals("vacio") && RESULT.getMarca().equals("vacio")){ RESULT.setMarca(val2.getMarca()); }else if(!val2.getColor().equals("vacio") && RESULT.getColor().equals("vacio")){ RESULT.setColor(val2.getColor()); }else if(val2.getTamaño()!=0 && RESULT.getTamaño()==0){ RESULT.setTamaño(val2.getTamaño()); }else if(!val2.getImg().equals("vacio") && RESULT.getImg().equals("vacio")){ RESULT.setImg(val2.getImg()); }else if(val2.getSucursal()!=0 && RESULT.getSucursal()==0){ RESULT.setSucursal(val2.getSucursal()); }else if(val2.isModificar()&& !RESULT.isModificar()){ RESULT.setModificar(true); }else if(val2.isEliminar() && !RESULT.isEliminar()){ RESULT.setEliminar(true); }else if(val2.getId()!=0 && RESULT.getId()!=0){ reply.append(enlace.reply_error("semantico", "La etiqueta id ya se ha escrito con anterioridad", val2left, val2right)); }else if(!val2.getNombre().equals("vacio") && !RESULT.getNombre().equals("vacio")){ reply.append(enlace.reply_error("semantico", "La etiqueta nombre ya se ha escrito con anterioridad", val2left, val2right)); }else if(val2.getCantidad()!=0 && RESULT.getCantidad()!=0){ reply.append(enlace.reply_error("semantico", "La etiqueta cantidad ya se ha escrito con anterioridad", val2left, val2right)); }else if(!val2.getMarca().equals("vacio") && !RESULT.getMarca().equals("vacio")){ reply.append(enlace.reply_error("semantico", "La etiqueta marca ya se ha escrito con anterioridad", val2left, val2right)); }else if(!val2.getColor().equals("vacio") && !RESULT.getColor().equals("vacio")){ reply.append(enlace.reply_error("semantico", "La etiqueta color ya se ha escrito con anterioridad", val2left, val2right)); }else if(val2.getTamaño()!=0 && RESULT.getTamaño()!=0){ reply.append(enlace.reply_error("semantico", "La etiqueta tamaño ya se ha escrito con anterioridad", val2left, val2right)); }else if(!val2.getImg().equals("vacio") && !RESULT.getImg().equals("vacio")){ reply.append(enlace.reply_error("semantico", "La etiqueta img ya se ha escrito con anterioridad", val2left, val2right)); }else if(val2.getSucursal()!=0 && RESULT.getSucursal()!=0){ reply.append(enlace.reply_error("semantico", "La etiqueta sucursal ya se ha escrito con anterioridad", val2left, val2right)); }else if(val2.isModificar()&& RESULT.isModificar()){ reply.append(enlace.reply_error("semantico", "La etiqueta Accion modificar ya ha sido validada", val2left, val2right)); }else if(val2.isEliminar() && RESULT.isEliminar()){ reply.append(enlace.reply_error("semantico", "La etiqueta Accion Eliminar ya ha sido validada", val2left, val2right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESPRODU",29, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 93: // REGISPRODUP ::= DI sucursal DI numero DI sucursal DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setSucursal(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 92: // REGISPRODUP ::= DI imagen DI cadena DI imagen DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setPath(val.replaceAll("\"","")); Runtime.getRuntime().exec("cp "+RESULT.getPath()+" /var/www/html/"); String[] imgtemp = val.replaceAll("\"","").split("/"); RESULT.setImg(imgtemp[imgtemp.length-1]); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 91: // REGISPRODUP ::= DI color DI CONSM DI color DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setColor(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 90: // REGISPRODUP ::= DI tamano DI EQ DI tamano DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); if(val.variables.isEmpty()){ RESULT.setTamaño(Integer.parseInt(val.Ecuacion)); }else{ reply.append(enlace.reply_error("semantico","La Ecuacion no devuelve ningun valor",valleft,valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 89: // REGISPRODUP ::= DI marca DI CONSM DI marca DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setMarca(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 88: // REGISPRODUP ::= DI cantidad DI EQ DI cantidad DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); if(val.variables.isEmpty()){ RESULT.setCantidad(Integer.parseInt(val.Ecuacion)); }else{ reply.append(enlace.reply_error("semantico","La Ecuacion no devuelve ningun valor",valleft,valright)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 87: // REGISPRODUP ::= DI nombre DI CONSM DI nombre DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setNombre(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 86: // REGISPRODUP ::= DI codigo DI numero DI codigo DF { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Producto(); RESULT.setId(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODUP",32, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 85: // REGISPRODU ::= REGISPRODUP { Producto RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Producto val = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODU",31, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 84: // REGISPRODU ::= REGISPRODU REGISPRODUP { Producto RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Producto val1 = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Producto val2 = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; if(val2.getId()!=0 && RESULT.getId()==0){ RESULT.setId(val2.getId()); }else if(!val2.getNombre().equals("vacio") && RESULT.getNombre().equals("vacio")){ RESULT.setNombre(val2.getNombre()); }else if(val2.getCantidad()!=0 && RESULT.getCantidad()==0){ RESULT.setCantidad(val2.getCantidad()); }else if(!val2.getMarca().equals("vacio") && RESULT.getMarca().equals("vacio")){ RESULT.setMarca(val2.getMarca()); }else if(!val2.getColor().equals("vacio") && RESULT.getColor().equals("vacio")){ RESULT.setColor(val2.getColor()); }else if(val2.getTamaño()!=0 && RESULT.getTamaño()==0){ RESULT.setTamaño(val2.getTamaño()); }else if(!val2.getImg().equals("vacio") && RESULT.getImg().equals("vacio")){ RESULT.setImg(val2.getImg()); RESULT.setPath(val2.getPath()); }else if(val2.getSucursal()!=0 && RESULT.getSucursal()==0){ RESULT.setSucursal(val2.getSucursal()); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REGISPRODU",31, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 83: // CONJUNTOPP ::= DI producto ACCIONESPRODU DF { ArrayList<Producto> RESULT =null; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Producto val2 = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new ArrayList(); RESULT.add(val2); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONJUNTOPP",12, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 82: // CONJUNTOP ::= CONJUNTOPP { ArrayList<Producto> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; ArrayList<Producto> val = (ArrayList<Producto>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONJUNTOP",11, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 81: // CONJUNTOP ::= CONJUNTOP CONJUNTOPP { ArrayList<Producto> RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; ArrayList<Producto> val1 = (ArrayList<Producto>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; ArrayList<Producto> val2 = (ArrayList<Producto>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; val2.stream().forEach(RESULT::add); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONJUNTOP",11, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 80: // PRODUCTO ::= DI tienda id igual numero DI CONJUNTOP DI tienda DF { Object RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; ArrayList<Producto> val2 = (ArrayList<Producto>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; val2.stream().forEach((Producto p)->{ p.setSucursal(Integer.parseInt(val1)); if(p.isEliminar()){ if(!hash.produExist(hash.Hash_Cod_Producto(p.getSucursal(), p.getId()))){ hash.eliminarproduc(hash.Hash_Cod_Producto(p.getSucursal(), p.getId())); reply.append(enlace.reply_eliminacion_producto(p.getId(), p.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe Producto con id: "+p.getId(), val2left, val2right)); reply.append(enlace.reply_eliminacion_producto(p.getId(), p.getSucursal(), "False")); } }else if(p.isModificar()){ if(!hash.produExist(hash.Hash_Cod_Producto(p.getSucursal(), p.getId()))){ hash.modificarprodu(hash.Hash_Cod_Producto(p.getSucursal(), p.getId()), p); reply.append(enlace.reply_modificacion_producto(p.getId(), p.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe Producto con id: "+p.getId(), val2left, val2right)); reply.append(enlace.reply_eliminacion_producto(p.getId(), p.getSucursal(), "False")); } }else if(p.isRegistro()){ if(hash.produExist(hash.Hash_Cod_Producto(p.getSucursal(), p.getId()))){ hash.modificarprodu(hash.Hash_Cod_Producto(p.getSucursal(), p.getId()), p); reply.append(enlace.reply_eliminacion_producto(p.getId(), p.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "Ya Existe Producto con id: "+p.getId(), val2left, val2right)); reply.append(enlace.reply_eliminacion_producto(p.getId(), p.getSucursal(), "False")); } }else{ reply.append(enlace.reply_error("semantico", "No se ha especificdo ninguna accion para el producto id: "+ String.valueOf(p.getId()), val2left, val2right)); reply.append(enlace.reply_registro_producto(p.getId(), p.getSucursal(), "False")); } }); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PRODUCTO",1, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-9)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 79: // PRODUCTO ::= DI producto ACCIONESPRODU DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Producto val = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; if(val.isEliminar()){ if(!hash.produExist(hash.Hash_Cod_Producto(val.getSucursal(), val.getId()))){ hash.eliminarproduc(hash.Hash_Cod_Producto(val.getSucursal(), val.getId())); reply.append(enlace.reply_eliminacion_producto(val.getId(), val.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe Producto con id: "+val.getId(), valleft, valright)); reply.append(enlace.reply_eliminacion_producto(val.getId(), val.getSucursal(), "False")); } }else if(val.isModificar()){ if(!hash.produExist(hash.Hash_Cod_Producto(val.getSucursal(), val.getId()))){ hash.modificarprodu(hash.Hash_Cod_Producto(val.getSucursal(), val.getId()), val); reply.append(enlace.reply_modificacion_producto(val.getId(), val.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe Producto con id: "+val.getId(), valleft, valright)); reply.append(enlace.reply_eliminacion_producto(val.getId(), val.getSucursal(), "False")); } }else if(val.isRegistro()){ reply.append(enlace.reply_error("sintactico","Sentencia Erronea para la creacion de Producto", valleft, valright)); reply.append(enlace.reply_eliminacion_producto(val.getId(), val.getSucursal(), "False")); }else{ reply.append(enlace.reply_error("semantico","No se ha especificdo ninguna accion para el producto id: "+ String.valueOf(val.getId()), valleft, valright)); reply.append(enlace.reply_eliminacion_producto(val.getId(), val.getSucursal(), "False")); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PRODUCTO",1, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 78: // PRODUCTO ::= DI producto tipo igual CREACION DI REGISPRODU DI producto DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Producto val = (Producto)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; if(val!=null){ if(val.getId()!=0 && !val.getNombre().equals("vacio") && val.getSucursal()!=0){ if(hash.produExist(hash.Hash_Cod_Producto(val.getSucursal(), val.getId()))){ hash.modificarprodu(hash.Hash_Cod_Producto(val.getSucursal(), val.getId()), val); reply.append(enlace.reply_registro_producto(val.getId(), val.getSucursal(), "True")); }else{ reply.append(enlace.reply_error("semantico", "Ya se Encuentra Ocupado el Id:" + val.getId(), valleft, valright)); reply.append(enlace.reply_registro_producto(val.getId(), val.getSucursal(), "False")); } }else{ reply.append(enlace.reply_error("semantico","Alguno de los parametros obligatorios se encuentra disponible", valleft, valright)); reply.append(enlace.reply_registro_producto(val.getId(), val.getSucursal(), "False")); } }else{ reply.append(enlace.reply_error("semantico","no se ha epecificado ningun atributo", valleft, valright)); reply.append(enlace.reply_registro_producto(val.getId(), val.getSucursal(), "False")); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PRODUCTO",1, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-9)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 77: // CONSM ::= corchetei identificador coma identificador corchetef { String RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; if(this.hash_compi.estaseccion(val1)){ Seccion_Mate temp1 = this.hash_compi.devolver_seccion(val1); if(temp1.estacons(val2)){ Cons_Mate temp2 =temp1.devolverconst(val2); if(temp2.valor_num!=null){ RESULT = temp2.valor_num; }else{ RESULT = temp2.valor_str; } }else{ reply.append(enlace.reply_error("semantico", "No Existe Contante Declarada en la seccion mate:"+temp1.id, val2left, val2right)); } }else{ reply.append(enlace.reply_error("semantico", "No Existe la seccion mate:"+val1, val1left, val1right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSM",25, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 76: // CONSM ::= avacio { String RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Object val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = "vacio"; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSM",25, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 75: // CONSM ::= numero { String RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSM",25, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 74: // CONSM ::= cadena { String RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val.replaceAll("\"", ""); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONSM",25, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 73: // ACCIONESTIENDAP ::= telefono igual numero { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); RESULT.setTelefono(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 72: // ACCIONESTIENDAP ::= direccion igual cadena { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); RESULT.setDirreccion(val.replaceAll("\"", "")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 71: // ACCIONESTIENDAP ::= nombre igual cadena { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); RESULT.setNombre(val.replaceAll("\"", "")); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 70: // ACCIONESTIENDAP ::= propietario igual numero { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); RESULT.setPropietario(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 69: // ACCIONESTIENDAP ::= codigo igual numero { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); RESULT.setCodigo(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 68: // ACCIONESTIENDAP ::= tipo igual ACCION { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Tienda(); if(val.equals("eliminar")){ RESULT.setEliminar(true); }else if(val.equals("modificar")){ RESULT.setModificar(true); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDAP",34, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 67: // ACCIONESTIENDA ::= ACCIONESTIENDAP { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Tienda val = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT=val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDA",33, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 66: // ACCIONESTIENDA ::= ACCIONESTIENDA coma ACCIONESTIENDAP { Tienda RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Tienda val1 = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Tienda val2 = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; if(val2.getCodigo()!=0 && RESULT.getCodigo()==0){ RESULT.setCodigo(val2.getCodigo()); }else if(!val2.getNombre().equals("vacio") && RESULT.getNombre().equals("vacio")){ RESULT.setNombre(val2.getNombre()); }else if(val2.getPropietario()!=0 && RESULT.getPropietario()==0){ RESULT.setPropietario(val2.getPropietario()); }else if(!val2.getDirreccion().equals("vacio") && RESULT.getDirreccion().equals("vacio")){ RESULT.setDirreccion(val2.getDirreccion()); }else if(!val2.getTelefono().equals("vacio") && RESULT.getTelefono().equals("vacio")){ RESULT.setTelefono(val2.getTelefono()); }else if(!val2.getImg().equals("vacio") && RESULT.getImg().equals("vacio")){ RESULT.setImg(val2.getImg()); }else if(val2.isEliminar() && !RESULT.isEliminar()){ RESULT.setEliminar(true); }else if(val2.isModificar() && !RESULT.isModificar()){ RESULT.setModificar(true); }else if(val2.getCodigo()!=0 && RESULT.getCodigo()!=0){ reply.append(enlace.reply_error("semantico", "Etiqueta Codigo ya ha sido declarada", val2left, val2right)); }else if(!val2.getNombre().equals("vacio") && !RESULT.getNombre().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Etiqueta Nombre ya ha sido declarada", val2left, val2right)); }else if(val2.getPropietario()!=0 && RESULT.getPropietario()!=0){ reply.append(enlace.reply_error("semantico", "Etiqueta Propietario ya ha sido declarada", val2left, val2right)); }else if(!val2.getDirreccion().equals("vacio") && !RESULT.getDirreccion().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Etiqueta Dirreccion ya ha sido declarada", val2left, val2right)); }else if(!val2.getTelefono().equals("vacio") && RESULT.getTelefono().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Etiqueta Telefono ya ha sido declarada", val2left, val2right)); }else if(!val2.getImg().equals("vacio") && !RESULT.getImg().equals("vacio")){ reply.append(enlace.reply_error("semantico", "Etiqueta img ya ha sido declarada", val2left, val2right)); }else if(val2.isEliminar() && RESULT.isEliminar()){ reply.append(enlace.reply_error("semantico", "Ya se ha estipulado que la accion es eliminar", val2left, val2right)); }else if(val2.isModificar() && !RESULT.isModificar()){ reply.append(enlace.reply_error("semantico", "ya se ha estipulado que la accion es modificar", val2left, val2right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("ACCIONESTIENDA",33, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 65: // CONTREGISTIENDAP ::= error DF { Tienda RESULT =null; RESULT = new Tienda(); System.out.println("me sincronize con DF"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 64: // CONTREGISTIENDAP ::= error DI { Tienda RESULT =null; RESULT = new Tienda(); System.out.println("me sincronize con DI"); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 63: // CONTREGISTIENDAP ::= DI imagen DI cadena DI imagen DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setPath(val.replaceAll("\"","")); Runtime.getRuntime().exec("cp "+RESULT.getPath()+" /var/www/html/"); String[] imgtemp = val.replaceAll("\"","").split("/"); RESULT.setImg(imgtemp[imgtemp.length-1]); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 62: // CONTREGISTIENDAP ::= DI telefono DI numero DI telefono DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setTelefono(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 61: // CONTREGISTIENDAP ::= DI direccion DI CONSM DI direccion DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setDirreccion(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 60: // CONTREGISTIENDAP ::= DI nombre DI CONSM DI nombre DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setNombre(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 59: // CONTREGISTIENDAP ::= DI propietario DI numero DI propietario DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setPropietario(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 58: // CONTREGISTIENDAP ::= DI codigo DI numero DI codigo DF { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; RESULT = new Tienda(); RESULT.setCodigo(Integer.parseInt(val)); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDAP",36, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 57: // CONTREGISTIENDA ::= CONTREGISTIENDAP { Tienda RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Tienda val = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDA",35, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 56: // CONTREGISTIENDA ::= CONTREGISTIENDA CONTREGISTIENDAP { Tienda RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Tienda val1 = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Tienda val2 = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val1; if(val2.getCodigo()!=0 && RESULT.getCodigo()==0){ RESULT.setCodigo(val2.getCodigo()); }else if(!val2.getNombre().equals("vacio") && RESULT.getNombre().equals("vacio")){ RESULT.setNombre(val2.getNombre()); }else if(val2.getPropietario()!=0 && RESULT.getPropietario()==0){ RESULT.setPropietario(val2.getPropietario()); }else if(!val2.getDirreccion().equals("vacio") && RESULT.getDirreccion().equals("vacio")){ RESULT.setDirreccion(val2.getDirreccion()); }else if(!val2.getTelefono().equals("vacio") && RESULT.getTelefono().equals("vacio")){ RESULT.setTelefono(val2.getTelefono()); }else if(!val2.getImg().equals("vacio") && RESULT.getImg().equals("vacio")){ RESULT.setImg(val2.getImg()); RESULT.setPath(val2.getPath()); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTREGISTIENDA",35, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 55: // TIENDA ::= ACCIONESTIENDA { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Tienda val = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; if(val.isEliminar()){ if(!hash.tiendaExist(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo()))){ hash.eliminartienda(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo())); reply.append(enlace.reply_eliminar_tienda(val.getCodigo(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe La tienda con id:"+val.getCodigo(), valleft, valright)); reply.append(enlace.reply_eliminar_tienda(val.getCodigo(), "False")); } }else if(val.isModificar()){ if(!hash.tiendaExist(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo()))){ hash.modificartienda(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo()), val); reply.append(enlace.reply_modificacion_tienda(val.getCodigo(), "True")); }else{ reply.append(enlace.reply_error("semantico", "No Existe La tienda con id:"+val.getCodigo(), valleft, valright)); reply.append(enlace.reply_modificacion_tienda(val.getCodigo(), "False")); } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("TIENDA",10, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 54: // TIENDA ::= tipo igual CREACION DI CONTREGISTIENDA DI tienda { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Tienda val = (Tienda)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; if(val!=null){ if(val.getCodigo()!=0 && !val.getDirreccion().equals("vacio") && !val.getImg().equals("vacio") && !val.getNombre().equals("vacio") && val.getPropietario()!=0 && !val.getTelefono().equals("vacio")){ if(hash.tiendaExist(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo()))){ hash.modificartienda(hash.Hash_Cod_Tienda(val.getPropietario(), val.getCodigo()), val); reply.append(enlace.reply_registro_tienda(val.getCodigo(), "True")); }else{ reply.append(enlace.reply_error("semantico","Tienda ya existente con el id:"+ String.valueOf(val.getCodigo()), valleft, valright)); reply.append(enlace.reply_registro_tienda(val.getCodigo(), "False")); } }else{ reply.append(enlace.reply_error("semantico","Todos los valores son nesesario, ninguno puede ser nulo", valleft, valright)); reply.append(enlace.reply_registro_tienda(val.getCodigo(), "False")); } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("TIENDA",10, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 53: // PETICIONP ::= PRODUCTO { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Object val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONP",9, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 52: // PETICIONP ::= DI tienda TIENDA DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Object val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONP",9, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 51: // PETICION ::= PETICIONP { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Object val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICION",8, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 50: // PETICION ::= PETICION PETICIONP { Object RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Object val1 = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Object val2 = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICION",8, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 49: // CONTGETP ::= sucursal igual numero { String RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTGETP",24, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 48: // CONTGETP ::= { String RESULT =null; RESULT = ""; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTGETP",24, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 47: // CONTGET ::= cadena propietario igual numero CONTGETP { ArrayList<Object> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).value; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); if(val.replaceAll("\"", "").equals("productos")){ if(!val2.equals("")){ ArrayList<Producto> temp1 = hash.get_productosc("sucursal",(Object)val2); ArrayList<Producto> temp2 = new ArrayList(); ArrayList<Object> temp3 = new ArrayList(); temp1.stream().forEach((Producto p)->{ temp2.add(p); temp3.add((Object)p); }); RESULT = temp3; reply.append(enlace.reply_lista_productos(temp2)); }else{ reply.append(enlace.reply_error("semantico", "a solicitado productos pero no ha especificado sucursal", val2left, val2right)); } }else if(val.replaceAll("\"", "").equals("tiendas")){ if(!val2.equals("")){ reply.append(enlace.reply_error("semantico", "Atributo sucursal no era nesesario para obtener tiendas", val2left, val2right)); }else{ ArrayList<Tienda> temp1 = hash.get_tiendasc("propietario",(Object)val1); ArrayList<Tienda> temp2 = new ArrayList(); ArrayList<Object> temp3 = new ArrayList(); temp1.stream().forEach((Tienda p)->{ temp2.add(p); temp3.add((Object)p); }); RESULT = temp3; reply.append(enlace.reply_lista_tiendas(temp2)); } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTGET",3, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 46: // GET ::= DI get tipo igual CONTGET DF { String RESULT =null; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("GET",23, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 45: // PETICIONES ::= error DI { Object RESULT =null; int eleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int eright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; System.out.println("me sincronize con $" + eleft + " " + " " + eright); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 44: // PETICIONES ::= error DF { Object RESULT =null; int eleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int eright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Object e = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; System.out.println("me sincronize con -$" + eleft + " " + " " + eright); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 43: // PETICIONES ::= DI request DI USUARIO DI request DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Usuario val = (Usuario)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 42: // PETICIONES ::= DI request DI GET DI request DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 41: // PETICIONES ::= DI consulta DI CONSULTA DI consulta DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Query val = (Query)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 40: // PETICIONES ::= DI request DI PETICION DI request DF { Object RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Object val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; //---------------------- CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PETICIONES",7, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 39: // EXPREG ::= identificador { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); RESULT.variables.add(val); RESULT.Ecuacion=val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREG",45, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 38: // EXPREG ::= numero { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); RESULT.Ecuacion = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREG",45, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 37: // EXPREG ::= parentesisi EQP parentesisf { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Ecuacion(); if(!val.variables.isEmpty()){ RESULT.Ecuacion = "("+ val.Ecuacion +")"; val.variables.stream().forEach(RESULT.variables::add); }else{ RESULT.Ecuacion =val.Ecuacion; } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREG",45, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 36: // EXPREF ::= EXPREG { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREF",44, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 35: // EXPREF ::= llavesi EXPREG llavesf { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Ecuacion(); if(!val.variables.isEmpty()){ RESULT.variables = val.variables; RESULT.Ecuacion = "{" + val.Ecuacion + "}"; }else{ RESULT.Ecuacion =val.Ecuacion; } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREF",44, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 34: // EXPREE ::= EXPREF { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREE",43, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 33: // EXPREE ::= raiz corchetei EXPREF coma EXPREF corchetef { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = new Ecuacion(); if(val1.variables.isEmpty() && val2.variables.isEmpty()){ if(!val2.Ecuacion.equals("0")){ RESULT.Ecuacion=String.valueOf(Math.pow((double)Integer.parseInt(val1.Ecuacion),1/(double)Integer.parseInt(val2.Ecuacion))); }else{ reply.append(enlace.reply_error("semantico", "Se ha hecho una raiz de valor 0", val2left, val2right)); } }else{ RESULT.Ecuacion="Rq["+val1.Ecuacion+","+val2.Ecuacion+"]"; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREE",43, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 32: // EXPRED ::= EXPREE { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPRED",42, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 31: // EXPRED ::= potencia corchetei EXPREE coma EXPREE corchetef { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; if(val1.variables.isEmpty() && val2.variables.isEmpty()){ try{ RESULT.Ecuacion=String.valueOf(Math.pow((double)Integer.parseInt(val1.Ecuacion),(double)Integer.parseInt(val2.Ecuacion))); }catch(Exception ex){ reply.append(enlace.reply_error("semantico", "Operacion matematica invalida", val1left, val1right)); } }else{ RESULT.Ecuacion="Ptn["+val1.Ecuacion+","+val2.Ecuacion+"]"; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPRED",42, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 30: // EXPREC ::= EXPRED { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREC",41, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 29: // EXPREC ::= EXPREC division EXPRED { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); if(val1.variables.isEmpty() && val2.variables.isEmpty()){ if(!val2.Ecuacion.equals("0")){ RESULT.Ecuacion = String.valueOf((double)Integer.parseInt(val1.Ecuacion)/(double)Integer.parseInt(val2.Ecuacion)); }else{ reply.append(enlace.reply_error("semantico", "Operacion matematica invalida", val1left, val1right)); } }else{ RESULT.Ecuacion=val1.Ecuacion+"/"+val2.Ecuacion; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREC",41, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 28: // EXPREB ::= EXPREC { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREB",40, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 27: // EXPREB ::= EXPREB multiplicacion EXPREC { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); if(val1.variables.isEmpty() && val2.variables.isEmpty()){ RESULT.Ecuacion = String.valueOf((double)Integer.parseInt(val1.Ecuacion)*(double)Integer.parseInt(val2.Ecuacion)); }else{ RESULT.Ecuacion=val1.Ecuacion+"*"+val2.Ecuacion; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREB",40, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 26: // EXPREA ::= EXPREB { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREA",39, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 25: // EXPREA ::= EXPREA resta EXPREB { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); if(val1.variables.isEmpty() && val2.variables.isEmpty()){ RESULT.Ecuacion = String.valueOf((double)Integer.parseInt(val1.Ecuacion)-(double)Integer.parseInt(val2.Ecuacion)); }else{ RESULT.Ecuacion=val1.Ecuacion+"-"+val2.Ecuacion; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EXPREA",39, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 24: // EQP ::= EXPREA { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EQP",38, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 23: // EQP ::= EQP suma EXPREA { Ecuacion RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Ecuacion val1 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val2 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); if(val1.variables.isEmpty() && val2.variables.isEmpty()){ RESULT.Ecuacion = String.valueOf((double)Integer.parseInt(val1.Ecuacion)+(double)Integer.parseInt(val2.Ecuacion)); }else{ RESULT.Ecuacion=val1.Ecuacion+"-"+val2.Ecuacion; val1.variables.stream().forEach(RESULT.variables::add); val2.variables.stream().forEach(RESULT.variables::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EQP",38, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 22: // PARAMSNP ::= numero { ArrayList<String> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); RESULT.add(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSNP",20, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 21: // PARAMSNP ::= { ArrayList<String> RESULT =null; RESULT=new ArrayList(); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSNP",20, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 20: // PARAMSN ::= PARAMSNP { ArrayList<String> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; ArrayList<String> val = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); if(!val.isEmpty()){ val.stream().forEach(RESULT::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSN",19, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 19: // PARAMSN ::= PARAMSN coma PARAMSNP { ArrayList<String> RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; ArrayList<String> val1 = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; ArrayList<String> val2 = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); if((!val1.isEmpty() && val2.isEmpty()) || (val2.isEmpty() && val1.isEmpty())){ reply.append(enlace.reply_error("semantico", "Declracion Erronea", val1left, val1right)); } if(!val2.isEmpty() && !val1.isEmpty()){ val2.stream().forEach(RESULT::add); val1.stream().forEach(RESULT::add); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSN",19, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 18: // CONTMATEF ::= parentesisi PARAMSN parentesisf { ArrayList<String> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; ArrayList<String> val = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATEF",21, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 17: // MATEF ::= corchetei identificador coma identificador CONTMATEF corchetef { String RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val3left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val3right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; ArrayList<String> val3 = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; if(this.hash_compi.estaseccion(val1)){ Seccion_Mate secciontemp = this.hash_compi.devolver_seccion(val1); if(secciontemp.estafuncion(val2)){ Funcion_Mate funciontemp = secciontemp.devolverfuncion(val2); if(funciontemp.parametros.size()==val3.size()){ RESULT = funciontemp.devolver_entero(val3); }else{ reply.append(enlace.reply_error("semantico","El numero de Paramteroos ingresado no coiciden con los que se nesesitan",val3left,val3right)); } }else{ reply.append(enlace.reply_error("semantico", "La Funcion Declarada no Existe", val2left, val2right)); } }else{ reply.append(enlace.reply_error("semantico", "La seccion Mate no Existe", val1left, val1right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("MATEF",28, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-5)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 16: // EQ ::= MATEF { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Ecuacion(); RESULT.Ecuacion=val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EQ",37, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 15: // EQ ::= EQP { Ecuacion RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Ecuacion val = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("EQ",37, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 14: // PARAMSP ::= identificador { String RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSP",26, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 13: // PARAMSP ::= { String RESULT =null; RESULT=""; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMSP",26, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 12: // PARAMS ::= PARAMSP { ArrayList<String> RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); if(!val.equals("")){RESULT.add(val);} CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMS",18, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 11: // PARAMS ::= PARAMS coma PARAMSP { ArrayList<String> RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; ArrayList<String> val1 = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new ArrayList(); val1.stream().forEach(RESULT::add); if(RESULT.isEmpty() && !val2.equals("")){ reply.append(enlace.reply_error("sintactico", "error, declaracion de paramtero antes de " + val2, val1left, val1right)); }else if(!RESULT.isEmpty() && val2.equals("")){ reply.append(enlace.reply_error("sintactico","Coma sobrante", val2left, val2right)); }else{ RESULT.add(val2); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("PARAMS",18, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 10: // CONTMATEP ::= constante identificador igual cadena pyc { Seccion_Mate RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; Cons_Mate constante = new Cons_Mate(); constante.id=val1; constante.valor_str=val2.replaceAll("\"", ""); RESULT = new Seccion_Mate(); RESULT.agregar_constante(constante); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATEP",5, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 9: // CONTMATEP ::= constante identificador igual numero pyc { Seccion_Mate RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; String val2 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; Cons_Mate constante = new Cons_Mate(); constante.id=val1; constante.valor_num=val2; RESULT = new Seccion_Mate(); RESULT.agregar_constante(constante); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATEP",5, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-4)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 8: // CONTMATEP ::= identificador parentesisi PARAMS parentesisf igual llavesi EQ llavesf pyc { Seccion_Mate RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-8)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-8)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-8)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)).right; ArrayList<String> val2 = (ArrayList<String>)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-6)).value; int val3left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val3right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; Ecuacion val3 = (Ecuacion)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; Funcion_Mate funcion = new Funcion_Mate(); funcion.id=val1; funcion.parametros=val2; if(funcion.parametros.size() == val3.variables.size()){ if(funcion.parametros.containsAll(val3.variables)){ funcion.parametros=val3.variables; funcion.accion=val3.Ecuacion; RESULT = new Seccion_Mate(); RESULT.agregar_funcion(funcion); }else{ reply.append(enlace.reply_error("semantico", "los parametros declarados no coiciden con los de la ecuacion", val2left, val2right)); } }else if(funcion.parametros.size()<val3.variables.size()){ reply.append(enlace.reply_error("semantico","Hay Mas Variables que parametros declarado para la funcion " + funcion.id, val3left, val3right)); }else if(funcion.parametros.size()>val3.variables.size()){ reply.append(enlace.reply_error("semantico","Hay parametros declarados demas en la funcion " + funcion.id, val1left, val1right)); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATEP",5, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-8)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 7: // CONTMATE ::= CONTMATEP { Seccion_Mate RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Seccion_Mate val = (Seccion_Mate)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; if(val!=null){ RESULT = val; } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATE",6, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 6: // CONTMATE ::= CONTMATE CONTMATEP { Seccion_Mate RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Seccion_Mate val1 = (Seccion_Mate)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Seccion_Mate val2 = (Seccion_Mate)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; if(val1!=null){ RESULT = val1; if(val2!=null){ if(!val2.funciones.isEmpty()){ val2.funciones.stream().forEach(RESULT::agregar_funcion); } if(!val2.constantes.isEmpty()){ val2.constantes.stream().forEach(RESULT::agregar_constante); } } }else if(val2!=null){ RESULT = val2; if(val1!=null){ if(!val1.funciones.isEmpty()){ val1.funciones.stream().forEach(RESULT::agregar_funcion); } if(!val1.constantes.isEmpty()){ val1.constantes.stream().forEach(RESULT::agregar_constante); } } } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("CONTMATE",6, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // MATE ::= cadena DI CONTMATE { Seccion_Mate RESULT =null; int val1left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).left; int val1right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).right; String val1 = (String)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)).value; int val2left = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).left; int val2right = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()).right; Seccion_Mate val2 = (Seccion_Mate)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.peek()).value; RESULT = new Seccion_Mate(); RESULT.id = val1.replaceAll("\"", ""); if(val2!=null){ val2.funciones.stream().forEach(RESULT::agregar_funcion); val2.constantes.stream().forEach(RESULT::agregar_constante); } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("MATE",4, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-2)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 4: // REQUEST ::= DI mate nombre igual MATE DI mate DF { StringBuilder RESULT =null; int valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).left; int valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).right; Seccion_Mate val = (Seccion_Mate)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-3)).value; this.hash_compi.agregar_seccion(val); CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REQUEST",2, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-7)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 3: // REQUEST ::= PETICIONES { StringBuilder RESULT =null; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REQUEST",2, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 2: // REQUEST ::= REQUEST PETICIONES { StringBuilder RESULT =null; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("REQUEST",2, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 1: // INICIA ::= REQUEST { Object RESULT =null; if(!Respondido){ inter.txtsalida.setText(reply.toString()); }else{ reply = new StringBuilder(); Respondido = false; } CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("INICIA",0, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } return CUP$AnalizadorSintactico_compilador_consola$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 0: // $START ::= INICIA EOF { Object RESULT =null; int start_valleft = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).left; int start_valright = ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).right; Object start_val = (Object)((java_cup.runtime.Symbol) CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)).value; RESULT = start_val; CUP$AnalizadorSintactico_compilador_consola$result = parser.getSymbolFactory().newSymbol("$START",0, ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.elementAt(CUP$AnalizadorSintactico_compilador_consola$top-1)), ((java_cup.runtime.Symbol)CUP$AnalizadorSintactico_compilador_consola$stack.peek()), RESULT); } /* ACCEPT */ CUP$AnalizadorSintactico_compilador_consola$parser.done_parsing(); return CUP$AnalizadorSintactico_compilador_consola$result; /* . . . . . .*/ default: throw new Exception( "Invalid action number found in internal parse table"); } } }
true
cd70948120efa6fe9ec98c7bf41d3957e6bf53fe
Java
GPC-debug/fss
/runpriority/src/main/java/com/gongbo/fss/runpriority/annotation/RunPriority.java
UTF-8
486
2.171875
2
[]
no_license
package com.gongbo.fss.runpriority.annotation; import com.gongbo.fss.runpriority.constant.Priority; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; //运行优先级注解,定义在initView,initListener,initData等方法上 @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface RunPriority { int priority() default Priority.NORMAL; }
true
0bd1d5757478978669c234982a7abe930940434b
Java
weydsonmacedo/manage-account-api
/src/main/java/br/com/donus/manageaccountapi/model/Status.java
UTF-8
249
2.140625
2
[]
no_license
package br.com.donus.manageaccountapi.model; public enum Status { ACTIVE("ATIVO"), INACTIVE("INATIVO"); private String status; private Status(String status) { this.status = status; } public String getStatus() { return status; } }
true
f8236321a4dd28dd7fd5c569beb25b052865454e
Java
sandeepsandy9699/Insight
/src/test/java/com/insight68taf/stepDefinitions/APIStepDefinition.java
UTF-8
4,910
2.40625
2
[]
no_license
package com.insight68taf.stepDefinitions; import java.util.HashMap; import java.util.List; import java.util.Map; import org.json.simple.JSONObject; import com.insight68taf.utils.APIHelper; import cucumber.api.DataTable; import cucumber.api.java.en.And; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import io.restassured.RestAssured; import io.restassured.response.Response; /** * name APIStepDefinition * * @author Sandeep description Step definitions for API.feature file */ public class APIStepDefinition { private Response response = null; @Given("^To initiate base uri and required headers$") public void to_initiate_base_uri_and_required_headers(DataTable dt) { List<List<String>> URI = dt.raw(); String baseURI = URI.get(0).get(0).toString(); RestAssured.baseURI = baseURI; } @Then("^Create Request object for GET method$") public void create_Request_object_for_GET_method(DataTable dt) { List<List<String>> endpoint = dt.raw(); response = APIHelper.executeGETMethod(endpoint.get(0).get(0).toString()); response.getBody().prettyPrint(); } @SuppressWarnings("unchecked") @Then("^Create Request object for PUT method$") public void create_Request_object_for_PUT_method(DataTable dt) { List<Map<String, String>> data = dt.asMaps(String.class, String.class); System.out.println("*************** Actual Data Table - data value as-- " + data); // Response Object creation JSONObject requestParams = null; for (int i = 0; i < data.size(); i++) { requestParams = new JSONObject(); requestParams.put("username", data.get(i).get("username")); requestParams.put("productId", data.get(i).get("productId")); requestParams.put("endDate", data.get(i).get("endDate")); Map<String, Object> headerMap = new HashMap<String, Object>(); headerMap.put("Content-Type", data.get(i).get("contenttype")); response = APIHelper.executePUTMethod(headerMap, requestParams, data.get(i).get("EndPoint")); response.getBody().prettyPrint(); } } @SuppressWarnings("unchecked") @Then("^Create Request object for DELETE method$") public void create_Request_object_for_DELETE_method(DataTable dt) { List<Map<String, String>> data = dt.asMaps(String.class, String.class); System.out.println("*************** Actual Data Table - data value as-- " + data); // Response Object creation JSONObject requestParams = null; for (int i = 0; i < data.size(); i++) { requestParams = new JSONObject(); requestParams.put("username", data.get(i).get("username")); requestParams.put("productId", data.get(i).get("productId")); Map<String, Object> headerMap = new HashMap<String, Object>(); headerMap.put("Content-Type", data.get(i).get("contenttype")); response = APIHelper.executeDELETEMethod(headerMap, requestParams, data.get(i).get("EndPoint")); response.getBody().prettyPrint(); } } @And("^Validate the Response status code and status line$") public void validate_the_Response_status_code_and_status_line() { int statusCode = response.getStatusCode(); String statusLine = response.getStatusLine(); String contentType = response.header("Content-Type"); APIHelper.validateStatusCode(statusCode); APIHelper.validateContentType(contentType); APIHelper.validateStatusLine(statusLine); } // POST @SuppressWarnings("unchecked") @Then("^Create Request object creation for POST method and get Responce with following data$") public void create_Request_object_creation_for_POST_method_and_get_Responce_with_following_data(DataTable dt) { List<Map<String, String>> data = dt.asMaps(String.class, String.class); System.out.println("*************** Actual Data Table - data value as-- " + data); // Response Object creation JSONObject requestParams = null; for (int i = 0; i < data.size(); i++) { requestParams = new JSONObject(); requestParams.put("firstname", data.get(i).get("firstname")); requestParams.put("lastname", data.get(i).get("lastname")); requestParams.put("email", data.get(i).get("email")); requestParams.put("mobilenumber", data.get(i).get("mobilenumber")); requestParams.put("extensionNumber", data.get(i).get("extensionNumber")); requestParams.put("username", data.get(i).get("username")); requestParams.put("password", data.get(i).get("password")); requestParams.put("passwordConfirm", data.get(i).get("passwordConfirm")); requestParams.put("country", data.get(i).get("country")); requestParams.put("state", data.get(i).get("state")); requestParams.put("city", data.get(i).get("city")); requestParams.put("authorities", data.get(i).get("authorities")); Map<String, Object> headerMap = new HashMap<String, Object>(); headerMap.put("Content-Type", data.get(i).get("contenttype")); response = APIHelper.executePOSTMethod(headerMap, requestParams, data.get(i).get("EndPoint")); response.getBody().prettyPrint(); } } }
true
902ed207ff4bda200ba4cf6fac88139aac0eaca9
Java
pgu/pgu-geo
/src/pgu/client/contacts/ContactsPlace.java
UTF-8
561
2.078125
2
[]
no_license
package pgu.client.contacts; import com.google.gwt.place.shared.Place; import com.google.gwt.place.shared.PlaceTokenizer; import com.google.gwt.place.shared.Prefix; public class ContactsPlace extends Place { @Prefix("contacts") public static class Tokenizer implements PlaceTokenizer<ContactsPlace> { @Override public String getToken(final ContactsPlace place) { return ""; } @Override public ContactsPlace getPlace(final String token) { return new ContactsPlace(); } } }
true
3b01fd1c4b0e686fd2ebf3ea66d39617b524df4a
Java
dav9670/Entourage
/app/src/main/java/com/david/entourage/Application/AppController.java
UTF-8
2,921
2.203125
2
[]
no_license
package com.david.entourage.Application; import android.app.Application; import android.content.Context; import android.location.Location; import android.os.Handler; import android.text.TextUtils; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import com.david.entourage.Place.Places; import com.google.android.gms.common.api.GoogleApiClient; import static com.david.entourage.Application.AppConfig.TAG; public class AppController extends Application { private RequestQueue mRequestQueue; private int requestInterval; private long lastRequestTime; private static AppController sInstance; private static Location lastKnownLocation; private static GoogleApiClient googleApiClient; private static Places places; @Override public void onCreate(){ super.onCreate(); sInstance = this; places = new Places(); requestInterval = 3000; lastRequestTime = System.currentTimeMillis(); } public static synchronized AppController getInstance(){ return sInstance; } public RequestQueue getRequestQueue(){ if(mRequestQueue == null){ mRequestQueue = Volley.newRequestQueue(getApplicationContext()); } return mRequestQueue; } public <T> void addToRequestQueue(Request<T> req, String tag){ req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req){ req.setTag(TAG); getRequestQueue().add(req); } public <T> void addToRequestQueueTimer(final Request<T> req){ Handler handler = new Handler(); Runnable runnable = new Runnable() { @Override public void run() { req.setTag(TAG); getRequestQueue().add(req); } }; long delay = requestInterval - (System.currentTimeMillis() - lastRequestTime); handler.postDelayed(runnable,delay > 0 ? delay : 0); lastRequestTime = System.currentTimeMillis(); } public void cancelPendingRequestQueue(Object Tag){ if(mRequestQueue != null){ mRequestQueue.cancelAll(Tag); } } public static Context getContext(){ return sInstance.getApplicationContext(); } public static Location getLastKnownLocation() { return lastKnownLocation; } public static void setLastKnownLocation(Location lastKnownLocation) { AppController.lastKnownLocation = lastKnownLocation; } public static GoogleApiClient getGoogleApiClient() { return googleApiClient; } public static void setGoogleApiClient(GoogleApiClient googleApiClient) { AppController.googleApiClient = googleApiClient; } public static Places getPlaces() { return places; } }
true
11f99b0e54794aa7fd64d0fe1dea08b3938e777b
Java
bierzan/mtgboard-REST-back
/src/main/java/com/brzn/mtgboard/card/cardsSet/CardSetRepo.java
UTF-8
250
1.953125
2
[]
no_license
package com.brzn.mtgboard.card.cardsSet; import org.springframework.data.jpa.repository.JpaRepository; public interface CardSetRepo extends JpaRepository<CardSet, Long> { CardSet findByCode(String code); CardSet findByName(String name); }
true
541a60c17184e2e02f5a6a7a362419feeacc71d7
Java
AbnerZheng/DBhwForMIT
/src/java/simpledb/IntegerAggregator.java
UTF-8
4,684
2.9375
3
[]
no_license
package simpledb; import java.util.HashMap; import java.util.Iterator; import java.util.NoSuchElementException; /** * Knows how to compute some aggregate over a set of IntFields. */ public class IntegerAggregator implements Aggregator { private static final long serialVersionUID = 1L; private final Op op; private final int aField; private final Type gbFieldType; private final int gbField; private final boolean hasGroup; private final HashMap<Field, Integer> groupData; private final HashMap<Field, Integer> groupCount; /** * Aggregate constructor * * @param gbfield * the 0-based index of the group-by field in the tuple, or * NO_GROUPING if there is no grouping * @param gbfieldtype * the type of the group by field (e.g., Type.INT_TYPE), or null * if there is no grouping * @param afield * the 0-based index of the aggregate field in the tuple * @param what * the aggregation operator */ public IntegerAggregator(int gbfield, Type gbfieldtype, int afield, Op what) { this.gbField = gbfield; this.gbFieldType = gbfieldtype; this.aField = afield; this.op = what; this.hasGroup = gbfield != NO_GROUPING; this.groupData = new HashMap<>(); this.groupCount = new HashMap<>(); } /** * Merge a new tuple into the aggregate, grouping as indicated in the * constructor * * @param tup * the Tuple containing an aggregate field and a group-by field */ public void mergeTupleIntoGroup(Tuple tup) { final int cur = ((IntField) tup.getField(aField)).getValue(); Field key; if(!hasGroup){ key = null; }else { key = tup.getField(gbField); } switch (op){ case MIN: this.groupData.compute(key, (k,v)->{ if(v == null){ return cur; } if(cur < v){ return cur; } return v; }); break; case MAX: this.groupData.compute(key, (k,v)->{ if(v == null){ return cur; } if(cur > v) { return cur; } return v; }); break; case AVG: this.groupCount.compute(key, (k,v)->{ if(v != null){ return v+1; }else{ return 1; } }); this.groupData.compute(key, (k,v)->{ if(v == null){ return cur; }else{ return v + cur; } }); break; case SUM: this.groupData.compute(key, (k,v)->{ if(v==null){ return cur; }else { return cur + v; } }); break; case COUNT: this.groupData.compute(key, (k,v)->{ if(v != null){ return v+1; }else{ return 1; } }); break; case SC_AVG: case SUM_COUNT: System.out.println("not implement"); } } /** * Create a OpIterator over group aggregate results. * * @return a OpIterator whose tuples are the pair (groupVal, aggregateVal) * if using group, or a single (aggregateVal) if no grouping. The * aggregateVal is determined by the type of aggregate specified in * the constructor. */ public OpIterator iterator() { return new OpIterator() { private Iterator<Field> keyIterator; private boolean opened; @Override public void open() throws DbException, TransactionAbortedException { this.opened = true; this.keyIterator = groupData.keySet().iterator(); } @Override public boolean hasNext() throws DbException, TransactionAbortedException { return this.keyIterator.hasNext(); } @Override public Tuple next() throws DbException, TransactionAbortedException, NoSuchElementException { if(!opened){ throw new DbException("haven't been opened"); } final Field key = this.keyIterator.next(); final Tuple tuple = new Tuple(getTupleDesc()); IntField result = null; switch (op){ case SUM: case MAX: case MIN: result = new IntField(groupData.get(key)); break; case COUNT: result = new IntField(groupData.get(key)); break; case AVG: final int i = groupData.get(key) / groupCount.get(key); result = new IntField(i); break; } tuple.setField(0, key); tuple.setField(1, result); return tuple; } @Override public void rewind() throws DbException, TransactionAbortedException { this.keyIterator = groupData.keySet().iterator(); } @Override public TupleDesc getTupleDesc() { Type[] types = new Type[2]; types[0] = gbFieldType; types[1] = Type.INT_TYPE; return new TupleDesc(types); } @Override public void close() { this.opened = false; } }; } }
true
c8265c95bab11f50648b08babbed476dcbd4db09
Java
jeonminhee/bitcamp-java-2018-12
/java-spring-webmvc/src/main/java/bitcamp/app1/Controller05_1.java
UTF-8
2,997
2.53125
3
[]
no_license
// 요청 핸들러의 리턴 값 - 콘텐트를 직접 리턴하기 package bitcamp.app1; import javax.servlet.http.HttpServletResponse; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/c05_1") public class Controller05_1 { // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h1 @GetMapping("h1") @ResponseBody public String handler1() { return "<html><body><h1>abc가각간</h1></body></html>"; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h2 @GetMapping(value="h2", produces="text/html;charset=UTF-8") @ResponseBody public String handler2() { return "<html><body><h1>abc가각간</h1></body></html>"; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h3 @GetMapping("h3") @ResponseBody public String handler3(HttpServletResponse response) { response.setContentType("text/html;charset=UTF-8"); return "<html><body><h1>abc가각간</h1></body></html>"; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h4 @GetMapping("h4") public HttpEntity<String> handler4() { HttpEntity<String> entity = new HttpEntity<>("<html><body><h1>abc가각간</h1></body></html>"); return entity; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h5 @GetMapping(value="h5", produces="text/html;charset=UTF-8") public HttpEntity<String> handler5() { HttpEntity<String> entity = new HttpEntity<>("<html><body><h1>abc가각간</h1></body></html>"); return entity; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h6 @GetMapping(value="h6", produces="text/html;charset=UTF-8") public HttpEntity<String> handler6() { HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "text/html;charset=UTF-8"); HttpEntity<String> entity = new HttpEntity<>( "<html><body><h1>abc가각간</h1></body></html>", headers); return entity; } // 테스트 // http://localhost:8080/java-spring-webmvc/app1/c05_1/h6 @GetMapping(value="h7", produces="text/html;charset=UTF-8") public ResponseEntity<String> handler7() { HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "text/html;charset=UTF-8"); headers.add("BIT-OK", "ohora"); ResponseEntity<String> entity = new ResponseEntity<>( "<html><body><h1>abc가각간</h1></body></html>", headers, HttpStatus.OK); return entity; } }
true
381d68857bbf0f2faae063243bbd8bd305018a4f
Java
ArshdeepSingh98/ToDoList
/app/src/main/java/com/example/arshdeep/todolist/CompletedActivity.java
UTF-8
785
1.59375
2
[]
no_license
package com.example.arshdeep.todolist; import android.content.Intent; import android.support.annotation.NonNull; import android.support.design.widget.BottomNavigationView; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Adapter; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.List; import java.util.Stack; public class CompletedActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_completed); } }
true
43dcbc629a3d5182a2b88f1cd4909904827f77fb
Java
rushing-mario/AllMyTestCode
/app/src/main/java/com/okry/amt/animation/PropertyAnimationTest.java
UTF-8
2,914
2.46875
2
[]
no_license
package com.okry.amt.animation; import android.animation.*; import android.app.Activity; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.widget.Toast; import com.okry.amt.R; import java.util.ArrayList; /** * Created by MR on 14-2-19. */ public class PropertyAnimationTest extends Activity { View mView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_property_animation); mView = findViewById(R.id.view_to_animate); mView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(PropertyAnimationTest.this, "view clicked!", Toast.LENGTH_SHORT).show(); } }); } @Override public boolean onTouchEvent(MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN){ ObjectAnimator move1 = moveX(mView, 0, mView.getRootView().getWidth() - mView.getWidth()); ObjectAnimator move2 = moveY(mView, mView.getY(), mView.getY() + 200); ObjectAnimator move3 = moveX(mView, mView.getRootView().getWidth() - mView.getWidth(), mView.getRootView().getWidth() - mView.getWidth() - 200); ObjectAnimator fadeOut = fade(mView, 1, 0); fadeOut.setRepeatCount(1); fadeOut.setRepeatMode(ValueAnimator.REVERSE); AnimatorSet moveAnim = new AnimatorSet(); moveAnim.play(move1).before(move2); moveAnim.play(move2).with(move3); moveAnim.setDuration(2000); AnimatorSet animAll = new AnimatorSet(); animAll.play(fadeOut).after(moveAnim); animAll.start(); animAll.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { ArrayList<String> list = new ArrayList<String>(null); } }); return true; } return super.onTouchEvent(event); } private ObjectAnimator moveX(View v, float start, float end){ return ObjectAnimator.ofFloat(v,"x",start,end ); } private ObjectAnimator moveY(View v, float start, float end){ return ObjectAnimator.ofFloat(v,"y",start,end ); } private ObjectAnimator fade(View v, float start, float end){ return ObjectAnimator.ofFloat(v, "alpha", start, end); } }
true
d8f68094c67430ed3e21a46e5326506bf194fa68
Java
toku87/Algorytmy
/Algorytmy/src/Algorithms/WydawaniePieniedzy.java
UTF-8
1,538
3.203125
3
[]
no_license
package Algorithms; import java.util.Arrays; public class WydawaniePieniedzy extends AbstractAlgorithm { @Override public String getName() { return "wydawanie kasy"; } @Override public void runAlgorithm(String[] input) { int[] banknoty = {200, 100, 50, 20, 10, 5, 2, 1}; int[] grosze = {50, 20, 10, 5, 2,1}; int[] iloscbanknotow = {0,0,0,0,0,0,0,0}; int[] iloscgroszy = {0,0,0,0,0,0}; int kwotazlotowki = Integer.valueOf(input[1]); int kwotagroszy = Integer.valueOf(input[2]); while (kwotazlotowki >0) { for (int i = 0; i < banknoty.length; i++) { if (kwotazlotowki >= banknoty[i]) { kwotazlotowki = kwotazlotowki - banknoty[i]; iloscbanknotow[i]++; break; } } } while (kwotagroszy >0) { for (int i = 0; i < grosze.length; i++) { if (kwotagroszy >= grosze[i]) { kwotagroszy = kwotagroszy - grosze[i]; iloscgroszy[i]++; break; } } } for (int i = 0; i <banknoty.length ; i++) { System.out.printf("%d x %d złotych \n", iloscbanknotow[i], banknoty[i]); } for (int j = 0; j < grosze.length ; j++) { System.out.printf("%d x %d groszy \n", iloscgroszy[j], grosze[j]); } } }
true
f36969d3a0cf22ec39f612d557aec46aba6d2456
Java
ecrespin12/medicanet
/app/src/main/java/clasesResponse/RecetaModel.java
UTF-8
635
1.71875
2
[]
no_license
package clasesResponse; import com.google.gson.annotations.SerializedName; public class RecetaModel { @SerializedName("rme_codmdc") public int rme_codmdc; @SerializedName("rme_codcme") public int rme_codcme; @SerializedName("rme_indicaciones") public String rme_indicaciones; @SerializedName("rme_cantidad") public double rme_cantidad; @SerializedName("mdc_codigo") public int mdc_codigo; @SerializedName("mdc_nombre") public String mdc_nombre; @SerializedName("mdc_descripcion") public String mdc_descripcion; @SerializedName("mdc_medida") public String mdc_medida; }
true
599218e7dbb23cbe2495b93ebfd56b11e92cf37a
Java
zokapacker/SeleniumJavaUnsplash
/src/test/java/pages/EditProfilePage.java
UTF-8
3,347
1.90625
2
[]
no_license
package pages; import java.io.IOException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class EditProfilePage { WebDriver driver; public EditProfilePage(WebDriver driver) { this.driver=driver; } @FindBy(xpath="//*[@id=\"popover-avatar-loggedin-menu-desktop\"]/div[1]/button/div/img") public WebElement profileIcon; @FindBy(linkText="View profile") public WebElement viewProfile; @FindBy(linkText="Edit profile") public WebElement editProfileButton; @FindBy(linkText="Email settings") public WebElement emailSettings; @FindBy(linkText="Change password") public WebElement changePassword; @FindBy(linkText="Connect accounts") public WebElement connectAccounts; @FindBy(linkText="Applications") public WebElement applications; @FindBy(linkText="Close account") public WebElement closeAccount; @FindBy(linkText="Change profile image") public WebElement changeProfileImage; @FindBy(xpath="//*[@id=\"edit_user_4639221\"]/div[1]/div[1]/a/div/img") public WebElement profileImage; @FindBy(id="user_first_name") public WebElement inputFirstName; @FindBy(id="user_last_name") public WebElement inputLastName; @FindBy(id="user_email") public WebElement inputEmail; @FindBy(id="user_username") public WebElement inputUsername; @FindBy(id="user_url") public WebElement inputUrl; @FindBy(id="user_location") public WebElement inputLocation; @FindBy(id="user_instagram_username") public WebElement inputInstagramUsername; @FindBy(id="twitter_username") public WebElement inputTwitterUsername; @FindBy(id="user_bio") public WebElement inputBio; @FindBy(id="user_interests_tag") public WebElement inputInterests; @FindBy(id="user_allow_messages") public WebElement checkboxMessaging; @FindBy(name="commit") public WebElement updateAccountButton; @FindBy(xpath="/html/body/div[4]/div/div/div/div[2]/div[2]/ul/li") public WebElement errorFirstName; //nastaviti public void clickViewProfile() { profileIcon.click(); viewProfile.click(); } public void clickEditButton() { profileIcon.click(); viewProfile.click(); editProfileButton.click(); } public void clickEmailSettings() throws Exception { emailSettings.click(); Thread.sleep(2000); } public void clickChangePassword() { changePassword.click(); } public void clickConnectAccounts() throws Exception { connectAccounts.click(); Thread.sleep(2000); } public void clickApplications() { applications.click(); } public void clickCloseAccount() { closeAccount.click(); } public void clickChangeProfileImage() { changeProfileImage.click(); } public void clickEditProfileButton() { editProfileButton.click(); } public void uploadImage() throws Exception { changeProfileImage.click(); Runtime.getRuntime().exec("C:/Users/Korisnik/Desktop/TESTING/FileUploadScript.exe"); Thread.sleep(11000); } public void editProfileInfo(String firstNameField, String lastNameField, String locationField, String bioField) { inputFirstName.clear(); inputFirstName.sendKeys(firstNameField); inputLastName.clear(); inputLastName.sendKeys(lastNameField); inputLocation.clear(); inputLocation.sendKeys(locationField); inputBio.clear(); inputBio.sendKeys(bioField); updateAccountButton.click(); } }
true
2a1e1ec70c7cb99fe385eb2e1967126f4bafd667
Java
rencclive/flink-sql-computing-platform
/platform-server/server-master/src/main/java/com/woophee/platform/server/master/service/impl/DefineRealtimeJobServiceImpl.java
UTF-8
6,523
1.929688
2
[ "Apache-2.0" ]
permissive
package com.woophee.platform.server.master.service.impl; import com.alibaba.fastjson.JSON; import com.woophee.platform.server.master.common.Response; import com.woophee.platform.server.master.common.RestResult; import com.woophee.platform.server.master.dao.mapper.DefineGroupMapper; import com.woophee.platform.server.master.dao.mapper.DefineJobMapper; import com.woophee.platform.server.master.dao.mapper.DefineRealtimeJobMapper; import com.woophee.platform.server.master.dao.model.*; import com.woophee.platform.server.master.exception.FlinkRuntimException; import com.woophee.platform.server.master.exception.ServiceException; import com.woophee.platform.server.master.service.DefineRealtimeJobService; import com.woophee.platform.server.master.model.DefineRealtimeJobVO; import com.woophee.platform.server.common.model.JobType; import com.woophee.platform.server.common.model.flink.FlinkSubmitRequest; import com.woophee.platform.server.common.model.page.PageList; import com.woophee.platform.server.master.service.FlinkJobService; import org.apache.ibatis.session.RowBounds; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @Service public class DefineRealtimeJobServiceImpl implements DefineRealtimeJobService { @Autowired private DefineGroupMapper defineGroupMapper; @Autowired private DefineJobMapper defineJobMapper; @Autowired private DefineRealtimeJobMapper defineRealtimeJobMapper; @Autowired private FlinkJobService flinkJobService; @Override @Transactional public Response create(DefineRealtimeJob defineRealtimeJob) { //TODO:名字不能重复 DefineJob defineJob = new DefineJob(); defineJob.setName(defineRealtimeJob.getName()); defineJob.setType(JobType.REALTIME); defineJobMapper.insert(defineJob); defineRealtimeJob.setId(defineJob.getId()); defineRealtimeJobMapper.insert(defineRealtimeJob); return Response.succeed(); } @Override @Transactional public Response update(DefineRealtimeJob defineRealtimeJob) { DefineJob defineJob = new DefineJob(); defineJob.setId(defineRealtimeJob.getId()); defineJob.setName(defineRealtimeJob.getName()); defineJob.setType(JobType.REALTIME); defineJobMapper.updateByPrimaryKeySelective(defineJob); int result = defineRealtimeJobMapper.updateByPrimaryKeySelective(defineRealtimeJob); if (result == 0) { throw new FlinkRuntimException("Fail to delete the data by id: " + JSON.toJSONString(defineRealtimeJob)); } return Response.succeed(); } @Override @Transactional public Response delete(Integer id) { int result = defineRealtimeJobMapper.deleteByPrimaryKey(id); if (result == 0) { throw new ServiceException("Fail to delete the data by id: " + id); } defineJobMapper.deleteByPrimaryKey(id); return Response.succeed(); } @Override public RestResult<DefineRealtimeJob> retrieve(Integer id) { RestResult<DefineRealtimeJob> result = new RestResult<>(true); DefineRealtimeJob defineRealtimeJob = defineRealtimeJobMapper.selectByPrimaryKey(id); result.setData(defineRealtimeJob); return result; } @Override public PageList<DefineRealtimeJob> query(Integer groupId, Integer pageIndex, Integer pageSize) { PageList<DefineRealtimeJob> result = new PageList<>(); DefineRealtimeJobExample defineRealtimeJobExample = new DefineRealtimeJobExample(); if(groupId != null) { defineRealtimeJobExample.createCriteria().andGroupIdEqualTo(groupId); } result.setTotalCount(defineRealtimeJobMapper.countByExample(defineRealtimeJobExample)); result.setDataList(defineRealtimeJobMapper.selectByExampleWithRowbounds(defineRealtimeJobExample, new RowBounds((pageIndex - 1) * pageSize, pageSize))); return result; } @Override public PageList<DefineRealtimeJobVO> webQuery(Integer groupId, Integer pageIndex, Integer pageSize) { //分别查询两张表对应数据 DefineRealtimeJobExample defineRealtimeJobExample = new DefineRealtimeJobExample(); if(groupId != null) { defineRealtimeJobExample.createCriteria().andGroupIdEqualTo(groupId); } List<DefineRealtimeJob> defineRealtimeJobs = defineRealtimeJobMapper.selectByExampleWithRowbounds(defineRealtimeJobExample, new RowBounds((pageIndex - 1) * pageSize, pageSize)); List<Integer> groupIds = defineRealtimeJobs.stream().map(DefineRealtimeJob::getGroupId).collect(Collectors.toList()); DefineGroupExample defineGroupExample = new DefineGroupExample(); defineGroupExample.createCriteria().andIdIn(groupIds); List<DefineGroup> defineGroups = defineGroupMapper.selectByExample(defineGroupExample); //service层拼接联表查询 List<DefineRealtimeJobVO> dataList = new ArrayList<>(); defineRealtimeJobs.forEach(defineRealtimeJob -> { DefineRealtimeJobVO defineRealtimeJobVO = new DefineRealtimeJobVO(); BeanUtils.copyProperties(defineRealtimeJob, defineRealtimeJobVO); defineRealtimeJobVO.setGroupName(defineGroups.stream() .filter(defineGroup -> defineGroup.getId().equals(defineRealtimeJob.getGroupId())).findFirst().get().getName()); dataList.add(defineRealtimeJobVO); }); //拼装分页结果 PageList<DefineRealtimeJobVO> result = new PageList<>(); result.setTotalCount(defineRealtimeJobMapper.countByExample(defineRealtimeJobExample)); result.setDataList(dataList); return result; } @Override public Response submit(Integer id) { DefineRealtimeJob defineRealtimeJob = defineRealtimeJobMapper.selectByPrimaryKey(id); FlinkSubmitRequest flinkSubmitRequest = new FlinkSubmitRequest(); flinkSubmitRequest.setProgramArgs("-j "+ id); flinkSubmitRequest.setParallelism(String.valueOf(defineRealtimeJob.getParallelism())); //先硬编码,指定集群id为1的集群提交任务 flinkJobService.submitJob(1,flinkSubmitRequest); return Response.succeed(); } }
true
2894c05e42022e0625d30c5d34ed40e11fde2c07
Java
zmyer/rsocket-java
/rsocket-core/src/main/java/io/rsocket/framing/DataFrame.java
UTF-8
2,143
2.640625
3
[ "Apache-2.0" ]
permissive
/* * Copyright 2015-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.rsocket.framing; import static java.nio.charset.StandardCharsets.UTF_8; import io.netty.buffer.ByteBuf; import java.util.Objects; import java.util.function.Function; /** An RSocket frame that only contains data. */ public interface DataFrame extends Frame { /** * Returns the data as a UTF-8 {@link String}. * * @return the data as a UTF-8 {@link String} */ default String getDataAsUtf8() { return getUnsafeData().toString(UTF_8); } /** * Returns the length of the data in the frame. * * @return the length of the data in the frame */ default int getDataLength() { return getUnsafeData().readableBytes(); } /** * Returns the data directly. * * <p><b>Note:</b> this data will be outside of the {@link Frame}'s lifecycle and may be released * at any time. It is highly recommended that you {@link ByteBuf#retain()} the data if you store * it. * * @return the data directly * @see #getDataAsUtf8() * @see #mapData(Function) */ ByteBuf getUnsafeData(); /** * Exposes the data for mapping to a different type. * * @param function the function to transform the data to a different type * @param <T> the different type * @return the data mapped to a different type * @throws NullPointerException if {@code function} is {@code null} */ default <T> T mapData(Function<ByteBuf, T> function) { Objects.requireNonNull(function, "function must not be null"); return function.apply(getUnsafeData()); } }
true
315f19af74d0e9aa8461bfcb78da9ff6673342ba
Java
Alaeddinalhamoud/Java-RMI-Query-CSV-File
/query-client/src/model/HousesPrices.java
UTF-8
1,037
2.953125
3
[]
no_license
package model; import java.io.Serializable; public class HousesPrices implements Serializable { //this class to set and get the HousePrice data and print it. //its Serializable coz of shared with the Interfaces.. at same time saver need it to pass the data using this class private static final long serialVersionUID = 1L; private int PRICE; private String YEAR; private String POSTCODE; public HousesPrices() { } public HousesPrices(int Price,String Year,String PostCode) { this.PRICE=Price; this.YEAR=Year; this.POSTCODE=PostCode; } @Override public String toString() { return "House Price [Price: " + PRICE + ", Year: " + YEAR + ", PostCode: " + POSTCODE +"]"; } public int getPRICE() { return PRICE; } public void setPRICE(int pRICE) { PRICE = pRICE; } public String getYEAR() { return YEAR; } public void setYEAR(String year) { YEAR = year; } public String getPOSTCODE() { return POSTCODE; } public void setPOSTCODE(String pOSTCODE) { POSTCODE = pOSTCODE; } }
true
56373af63f7ef179cb3f134f72ac26633033183a
Java
KillerBananaZ/POO2019-30223
/Students/Bouaru Radu/Homework/Zoowsome/src/javasmmr/zoowsome/models/animals/Whale.java
UTF-8
908
2.546875
3
[]
no_license
package javasmmr.zoowsome.models.animals; import static javasmmr.zoowsome.repositories.AnimalRepository.createNode; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLStreamException; import org.w3c.dom.Element; import javasmmr.zoowsome.services.factories.Constants; public class Whale extends Aquatic{ public Whale(Integer nrOfLegs, String name, Integer avgSwimDepth, waterType water, double maintenanceCost, double dangerPerc) { super(nrOfLegs, name, avgSwimDepth, water, maintenanceCost, dangerPerc); } public Whale() { super(0, "Spermie", 5000, waterType.saltwater, 7, 0.5); } public void encodeToXml(XMLEventWriter eventWriter) throws XMLStreamException{ super.encodeToXml(eventWriter); createNode(eventWriter, Constants.XML_TAGS.DISCRIMINANT, Constants.Animals.Aquatics.Whale); } public void decodeFromXml(Element element) { super.decodeFromXml(element); } }
true
6b984fd6bc7d4f3f57390cf9484ed2cead905445
Java
caiqianyi/guess
/framework/common-utils/src/main/java/com/lebaoxun/commons/utils/FormulaCalculate.java
UTF-8
8,145
2.390625
2
[]
no_license
package com.lebaoxun.commons.utils; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.TreeMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.lebaoxun.commons.exception.I18nMessageException; public class FormulaCalculate { private static Logger logger = LoggerFactory.getLogger(FormulaCalculate.class); private final static String pdr[] = new String[]{"\\=","\\>","\\<","\\>\\=","\\<\\="}; private final static String ljs[] = new String[]{"&&","||"}; private static int has(String array[],String s){ int count = 0; for(int i=0;i<array.length;i++){ int k = 0; while(k < s.length()){ int index = s.indexOf(array[i].replace("\\", ""),k); if(index == -1){ return count; } k = index+1; count++; } } return count; } private static TreeMap<Integer,Integer> pair(String str, char s, char e){ TreeMap<Integer,Integer> result = new TreeMap<Integer,Integer>(); List<Integer> i1 = new ArrayList<Integer>(); for(int i=0;i<str.length();i++){ if(str.charAt(i) == s){ i1.add(i); } if(str.charAt(i) == e){ Integer end = i == str.length()? i : i+1; result.put(i1.remove(i1.size()-1), end); } } return result; } public static boolean check(String lots[],String line){ TreeMap<Integer,Integer> result = pair(line, '(', ')'); String ls = line; for(Integer s : result.keySet()){ Integer e = result.get(s); String str = line.substring(s,e); String l = str.substring(1,str.length() -1); int ei = has(new String[]{"("}, l); logger.debug("check|s={},e={},str={},l={},ei={}",s,e,str,l,ei); Boolean ss = null; if(ei > 1){ ss = check(lots, l); }else if(has(ljs, l) > 0 || has(pdr, l) > 0){ ss = bqCheck(lots, l); } if(ss != null){ ls = ls.replace(str, ss+""); } } //logger.debug("check|ls={}",ls); int ei = has(new String[]{"("}, ls); if(ei > 0 && has(ljs, ls) > 0){ return check(lots, ls); } return bqCheck(lots, ls); } public static boolean bqCheck(String lots[],String line){ Integer i = 0, last = null; List<Integer> resultK = new ArrayList<Integer>(); List<Boolean> resultV = new ArrayList<Boolean>(); while(i<line.length()){ String str = line.substring(i, line.length()); boolean isHas = false; for(int k=0;k<ljs.length;k++){ int d = str.indexOf(ljs[k]); if(d > -1){ i += d+2; String s = str.substring(0, d); logger.debug("bqCheck|s={},d={},i={},line={}",s,d,i,line); resultK.add(k); resultV.add(dxdCheck(lots,s)); last = k; isHas = true; break; } } if(isHas == false){ if(i == 0){ return dxdCheck(lots, line); } resultV.add(dxdCheck(lots,str)); logger.debug("bqCheck|str={},last={}",str,last); i = line.length(); } } if(resultK.contains(1)){ return resultV.contains(true); } //logger.debug("bqCheck|line={},result={},is={}",line,resultV,resultV.contains(false)); return !resultV.contains(false); } public static boolean dxdCheck(String lots[],String line){ if("true".equalsIgnoreCase(line.trim()) || "false".equalsIgnoreCase(line.trim())){ return Boolean.parseBoolean(line); } for(int i=1;i<=lots.length;i++){ line = line.replaceAll("#N"+i, Integer.parseInt(lots[i-1])+""); } int index = -1; for(int i=0;i<pdr.length;i++){ int idex = line.split(pdr[i]).length; if(idex < 2){ continue; } if(idex > 2){ throw new I18nMessageException("500","Wrong Expression"); } if(idex == 1 && index > -1){ throw new I18nMessageException("500","Wrong Expression"); } index = i; } String lls[] = line.split(pdr[index]); String left = lls[0]; Double result = calculate(left), right = Double.parseDouble(lls[1]); switch (index) { case 1: return result > right; case 2: return result < right; case 3: return result >= right; case 4: return result <= right; } return result.equals(right); } public static Double calculate(String line) { line = line.replaceAll(" ", ""); TreeMap<Integer,Integer> result = pair(line, '(', ')'); String ls = line; for(Integer s : result.keySet()){ Integer e = result.get(s); String str = line.substring(s,e); logger.debug("calculate|s={},e={},str={}",s,e,str); String l = str.substring(1,str.length() -1); ls = ls.replace(str, calculateBase(l)+""); } //logger.debug("calculate|ls={}",ls); return calculateBase(ls); } private static Double calculateBase(String str) { String temp = ""; if (str.charAt(0) != '-' && !(str.charAt(0) <= '9' && str.charAt(0) >= '0')) { throw new I18nMessageException("500","Wrong Expression"); } LinkedList<Double> list = new LinkedList<Double>(); LinkedList<Character> optList = new LinkedList<Character>(); Double doubleTemp; boolean isFormerOpt = true; for (int index = 0; index <= str.length() - 1; index++) { if (index == 0) { isFormerOpt = true; } else { if (str.charAt(index - 1) > '9' || str.charAt(index - 1) < '0') { isFormerOpt = true; } else { isFormerOpt = false; } } if (str.charAt(index) != '+' && str.charAt(index) != '*' && str.charAt(index) != '/' && str.charAt(index) != '%' && (!(str.charAt(index) == '-' && isFormerOpt == false))) { temp += str.charAt(index); } else { doubleTemp = new Double(temp); list.add(doubleTemp); temp = ""; optList.add(str.charAt(index)); } } doubleTemp = new Double(temp); list.add(doubleTemp); temp = ""; /* * for (int index = 0; index <= list.size() - 1; index++) { * System.out.println(list.get(index)); } for (int index = 0; index <= * optList.size() - 1; index++) { * System.out.println(optList.get(index)); } */ boolean isThereHigherOpt = true; while (isThereHigherOpt == true) { /* * for (Iterator<Character> it = optList.iterator(); it.hasNext();) * { if (it.next() == '*' || it.next() == '/') { isThereHigherOpt = * true; int index = optList.indexOf(it.next()); * * break; } } */ isThereHigherOpt = false; for (int index = 0; index <= optList.size() - 1; index++) { if (optList.get(index) == '*') { Double t = list.get(index) * list.get(index + 1); list.remove(index + 1); list.set(index, t); optList.remove(index); isThereHigherOpt = true; break; } if (optList.get(index) == '/') { Double t = list.get(index) / list.get(index + 1); list.remove(index + 1); list.set(index, t); optList.remove(index); isThereHigherOpt = true; break; } if (optList.get(index) == '%') { Double t = list.get(index) % list.get(index + 1); list.remove(index + 1); list.set(index, t); optList.remove(index); isThereHigherOpt = true; break; } } } while (optList.isEmpty() == false) { for (int index = 0; index <= optList.size() - 1; index++) { if (optList.get(index) == '+') { Double t = list.get(index) + list.get(index + 1); list.remove(index + 1); list.set(index, t); optList.remove(index); break; } if (optList.get(index) == '-') { Double t = list.get(index) + 0.0 - list.get(index + 1); list.remove(index + 1); list.set(index, t); optList.remove(index); break; } } } /* * System.out.println("/////////////////////////////////"); for (int * index = 0; index <= optList.size() - 1; index++) { // * System.out.println(index); System.out.println(list.get(index)); * System.out.println(optList.get(index)); * System.out.println(list.get(index + 1)); } */ if (list.size() == 1) { return list.get(0); } throw new I18nMessageException("500","Wrong Expression"); } public static void main(String[] args) { String lots[] = new String[] { "08", "01", "06", "04", "10" }; System.out.println(check(lots, "(true&&1+2>=3)||true")); System.out.println(check(lots, "((((#N1*#N3+#N4)%2=0||1+1=2)&&1+2>=3&&1+#N1=9)&&true)&&(true&&((1+2)*2*(2+4)=36))")); //System.out.println("123&&123||".indexOf("&&")); } }
true
cd965bb3ef8b5542b247cad3de50c92ee34de1ec
Java
samsonanami/IDAPI
/DocumentVerification/src/main/java/com/fintech/orion/documentverification/custom/common/DateOfBirthValidation.java
UTF-8
6,065
2.078125
2
[]
no_license
package com.fintech.orion.documentverification.custom.common; import com.fintech.orion.dataabstraction.entities.orion.ResourceName; import com.fintech.orion.documentverification.common.exception.CustomValidationException; import com.fintech.orion.documentverification.custom.CustomValidation; import com.fintech.orion.documentverification.strategy.OperationDateComparator; import com.fintech.orion.documentverification.translator.OcrValueTranslator; import com.fintech.orion.documentverification.translator.OcrValueTranslatorFactory; import com.fintech.orion.documentverification.translator.exception.TranslatorException; import com.fintech.orion.dto.hermese.model.oracle.response.OcrFieldData; import com.fintech.orion.dto.hermese.model.oracle.response.OcrFieldValue; import com.fintech.orion.dto.hermese.model.oracle.response.OcrResponse; import com.fintech.orion.dto.response.api.ValidationData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** * Created by MudithaJ on 12/27/2016. */ @Component public class DateOfBirthValidation extends ValidationHelper implements CustomValidation { private static final Logger LOGGER = LoggerFactory.getLogger(DateOfBirthValidation.class); @Autowired private OperationDateComparator dateComparator; @Autowired private OcrValueTranslatorFactory ocrValueTranslatorFactory; OcrValueTranslator ocrValueTranslator; @Override public ValidationData validate(ResourceName resourceName, OcrResponse ocrResponse) throws CustomValidationException { ValidationData validationData = new ValidationData(); ocrValueTranslator = ocrValueTranslatorFactory.getOcrValueTranslator(getOcrExtractionFieldName()); OcrFieldData fieldData = getFieldDataById(getOcrExtractionFieldName(), ocrResponse); validationData = validateInput(fieldData); if (validationData.getValidationStatus()) { try { validationData = validateDateOfBirth(fieldData.getValue(), ocrResponse); } catch (TranslatorException e) { validationData.setValidationStatus(false); validationData.setRemarks(getFailedRemarksMessage()); LOGGER.error("Error while translating validating date of birth ", e); } } validationData.setCriticalValidation(isCriticalValidation()); validationData.setId("Date of Birth Validation"); return validationData; } private List<OcrFieldValue> filterFieldDataValueList(OcrFieldValue base, List<OcrFieldValue> values) { String idOfTheFirstObject = base.getId(); String prefixOfFirstObjectId = idOfTheFirstObject.substring(0, idOfTheFirstObject.lastIndexOf('#') + 1); String suffixOfFirstObjectId = idOfTheFirstObject.split("##")[2].toString(); if (suffixOfFirstObjectId.equals("PP")) { String removeObjectId = prefixOfFirstObjectId.concat("NPP"); return values.stream().filter(p -> !p.getId().equals(removeObjectId) && !p.getId().equals(idOfTheFirstObject)).collect(Collectors.toList()); } else if (suffixOfFirstObjectId.equals("NPP")) { String removeObjectId = prefixOfFirstObjectId.concat("PP"); return values.stream().filter(p -> !p.getId().equals(removeObjectId) && !p.getId().equals(idOfTheFirstObject)).collect(Collectors.toList()); } return values; } private ValidationData validateDateOfBirth(List<OcrFieldValue> values, OcrResponse ocrResponse) throws CustomValidationException, TranslatorException { ValidationData validationData = new ValidationData(); if (!values.isEmpty() && values.size()>1) { for (OcrFieldValue ocrFieldValue : values.subList(0, 2)) { String firstDateOfBirth = ocrFieldValue.getValue(); String templateCategory = getTemplateCategory(ocrFieldValue.getId(), ocrResponse); Date dateOfBirth = (Date) ocrValueTranslator.translate(firstDateOfBirth, templateCategory); List<OcrFieldValue> filteredOcrFieldValueList = filterFieldDataValueList(ocrFieldValue, values); validationData = compareRestOfTheDatesWithBaseDate(dateOfBirth, filteredOcrFieldValueList, ocrResponse); if (validationData.getValidationStatus()) { return validationData; } } } else { validationData.setValidationStatus(false); validationData.setRemarks("Not Enough data to complete the validation. Need two or more date of births from" + "multiple documents to complete this verification."); } return validationData; } private ValidationData compareRestOfTheDatesWithBaseDate(Date base, List<OcrFieldValue> values, OcrResponse ocrResponse) throws TranslatorException { ValidationData validationData = new ValidationData(); for (OcrFieldValue value : values) { String templateCategory = getTemplateCategory(value.getId(), ocrResponse); Date dateOfBirth = (Date) ocrValueTranslator.translate(value.getValue(), templateCategory); if (!dateComparator.doDataValidationOperation(base, dateOfBirth, templateCategory).isStatus()) { validationData.setValidationStatus(false); validationData.setValue(value.getValue()); validationData.setRemarks(getFailedRemarksMessage()); } else { validationData.setValidationStatus(true); validationData.setValue(value.getValue()); validationData.setRemarks(getSuccessRemarksMessage()); break; } } return validationData; } }
true
5ff3256368ac83f7c43a3bf8710e82665f6c397d
Java
lucapino/sheetmaker
/src/main/java/com/github/lucapino/sheetmaker/renderer/TemplateFilter.java
UTF-8
12,876
2.375
2
[]
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 com.github.lucapino.sheetmaker.renderer; import com.github.lucapino.sheetmaker.model.movie.Movie; import com.github.lucapino.sheetmaker.model.tv.Episode; import com.github.lucapino.sheetmaker.parsers.AudioInfo; import com.github.lucapino.sheetmaker.parsers.MovieInfo; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.io.FilenameUtils; /** * * @author tagliani */ public class TemplateFilter { // %COVER%, %PATH%, %BACKGROUND%, %FANART1%, %FANART2%, %FANART3% are managed directly by renderer public static Map<String, String> createTokenMap(Movie movie, MovieInfo movieInfo, Episode episode) { Map<String, String> result = new HashMap<>(); result.put("%TITLEPATH%", movieInfo.getTitlePath()); // %MOVIEFILENAME% Current movie filename Spread.2009.mkv (for c,\movies\spread\spread.2009.mkv) result.put("%MOVIEFILENAME%", movieInfo.getMovieFileName()); // %MOVIEFILENAMEWITHOUTEXT% Current movie filename without extension Spread.2009 (for c,\Movies\Spread\Spread.2009.mkv) result.put("%MOVIEFILENAMEWITHOUTEXT%", FilenameUtils.getBaseName(movieInfo.getMovieFileName())); // %MOVIEFOLDER% Current movie folder name Spread (for c,\Movies\Spread\Spread.2009.mkv) result.put("%MOVIEFOLDER%", movieInfo.getMovieFolder()); // %MOVIEPARENTFOLDER% Current movie parent folder name Movies (for c,\Movies\Spread\Spread.2009.mkv) result.put("%MOVIEPARENTFOLDER%", movieInfo.getParentMovieFolder()); result.put("%TITLE%", movie.getTitle()); // %ORIGINALTITLE% Original movie title Inglourious Basterds result.put("%ORIGINALTITLE%", movie.getOriginalTitle()); // %PLOT% Synopsis Some description of the movie. result.put("%PLOT%", movie.getPlot()); // %TAGLINE% The Tagline Some tagline result.put("%TAGLINE%", movie.getTagline()); // %COMMENTS% Free "joker" field for the user own data Some free test the user can place on the sheet //TODO result.put("%COMMENTS%", ""); result.put("%YEAR%", movie.getYear()); result.put("%RUNTIME%", movie.getRuntime()); String actors = movie.getActors().toString(); result.put("%ACTORS%", actors.substring(1, actors.length() - 1)); String genres = movie.getGenres().toString(); result.put("%GENRES%", genres.substring(1, genres.length() - 1)); String directors = movie.getDirectors().toString(); result.put("%DIRECTORS%", directors.substring(1, directors.length() - 1)); result.put("%CERTIFICATION%", movie.getCertification()); result.put("%RELEASEDATE%", movie.getReleaseDate()); result.put("%MPAA%", movie.getMPAA() ); // %IMDBID% IMDb Id of the movie tt1186370 result.put("%IMDBID%", movie.getImdbId() ); result.put("%CERTIFICATIONTEXT%", movie.getCertification() ); String countries = movie.getCountries().toString(); result.put("%COUNTRIES%", countries.substring(1, countries.length() - 1)); String studios = movie.getStudios().toString(); result.put("%STUDIOS%", studios.substring(1, studios.length() - 1)); // %ALLSUBTITLES% List of distinct embedded/external subtitles (English names) English, Spanish,German * String allSubtitles = movieInfo.getAllSubtitles().toString(); result.put("%ALLSUBTITLES%", allSubtitles.substring(1, allSubtitles.length() - 1)); // %ALLSUBTITLESTEXT% List of distinct embedded/external subtitles (native names) English, Espanol,Deutsch * String allLocalizedSubtitles = movieInfo.getAllLocalizedSubtitles().toString(); result.put("%ALLSUBTITLESTEXT%", allLocalizedSubtitles.substring(1, allLocalizedSubtitles.length() - 1)); String embeddedSubtitles = movieInfo.getEmbeddedSubtitles().toString(); result.put("%SUBTITLES%", embeddedSubtitles.substring(1, embeddedSubtitles.length() - 1)); // %SUBTITLES1% … %SUBTITLES5% Individual embedded subtitles (English names) English // %SUBTITLESTEXT% List of embedded subtitles (Native names) English, Francais, Deutsch * String embeddedLocalizedSubtitles = movieInfo.getEmbeddedLocalizedSubtitles().toString(); result.put("%SUBTITLESTEXT%", embeddedLocalizedSubtitles.substring(1, embeddedLocalizedSubtitles.length() - 1)); // %EXTERNALSUBTITLESTEXT% List of external subtitles (Native names) English, Francais, Deutsch * String externalLocalizedSubtitles = movieInfo.getExternalLocalizedSubtitles().toString(); result.put("%EXTERNALSUBTITLESTEXT%", externalLocalizedSubtitles.substring(1, externalLocalizedSubtitles.length() - 1)); // %EXTERNALSUBTITLES% List of external subtitles (English names) English, French * String externalSubtitles = movieInfo.getExternalSubtitles().toString(); result.put("%EXTERNALSUBTITLES%", externalSubtitles.substring(1, externalSubtitles.length() - 1)); // %EXTERNALSUBTITLES1% … %EXTERNALSUBTITLES5% Individual external subtitles (English names) English // TODO // %RATING% The rating of the movie (x of 10) 6.8/10 result.put("%RATING%", (Double.valueOf(movie.getRatingPercent()) / 10) + "/10"); // %RATINGPERCENT% The rating as percent 68 result.put("%RATINGPERCENT%", movie.getRatingPercent()); if (episode != null) { /** * ************** Start TV Shows ******************** */ // %SEASON% The autodetected season number for the current movie 4 result.put("%SEASON%", "" + episode.getSeason().getNumber()); // %EPISODE% The autodetected episode (or CD) number for the current movie 2 result.put("%EPISODE%", "" + episode.getNumber()); // %EPISODETITLE% The current episode name Fire + Water result.put("%EPISODETITLE%", episode.getTitle()); // %EPISODEPLOT% Synopsis of the current episode Some description of the episode. result.put("%EPISODEPLOT%", episode.getOverview()); // %EPISODERELEASEDATE% Release date of the current episode 12.03.2010 (formatted using collector's format) // TODO result.put("%EPISODERELEASEDATE%", ""); // %EPISODELIST% List of episodes for the current season 1, 2, 3 * List<Episode> episodes = episode.getSeason().getEpisodes(); List<String> episodeList = new ArrayList<>(); for (Episode currentEpisode : episodes) { episodeList.add("" + currentEpisode.getNumber()); } String res = episodeList.toString(); result.put("%EPISODELIST%", res.substring(1, res.length() - 1)); // %EPISODENAMESLIST% List of episodes titles for the current season Title One, Title Two * episodes = episode.getSeason().getEpisodes(); List<String> episodeNameList = new ArrayList<>(); for (Episode currentEpisode : episodes) { episodeNameList.add(currentEpisode.getTitle()); } res = episodeNameList.toString(); result.put("%EPISODENAMESLIST%", res.substring(1, res.length() - 1)); // %EPISODEGUESTSTARS% List of guest stars for the current episode John B, John C * List<String> episodeGuestsList = episode.getGuestStars(); String episodeGuests = episodeGuestsList.toString(); result.put("%EPISODEGUESTSTARS%", episodeGuests.substring(1, episodeGuests.length() - 1)); // %EPISODEWRITERS% List of writers for the current episode John B, John C * // TODO result.put("%EPISODEWRITERS%", ""); } /** * ************** End TV Shows ******************** */ // %MEDIAFORMATTEXT% See below list of media values supported. Loaded from /Template/MediaFormats/MediaFormat/@Name Returns value from @Text attribute MKV result.put("%MEDIAFORMATTEXT%", movieInfo.getMediaformat()); // %SOUNDFORMATTEXT% See below list of sound values supported. /Template/SoundFormats/SoundFormat/@Name Returns value from @Text attribute MP3 result.put("%SOUNDFORMATTEXT%", movieInfo.getSoundFormat()); // %RESOLUTIONTEXT% See below list of resolution values supported. /Template/Resolutions/Resolution/@Name Returns value from @Text attribute 1080P result.put("%RESOLUTIONTEXT%", movieInfo.getResolution()); // %VIDEOFORMATTEXT% See below list of video values supported. /Template/VideoFormats/VideoFormat/@Name Returns value from @Text attribute AVC result.put("%VIDEOFORMATTEXT%", movieInfo.getVideoFormat()); result.put("%FRAMERATETEXT%", movieInfo.getFrameRate()); // %FRAMERATE% Formatted frame rate of the movie (to allow mapping to filenames). The ‘.’ character is replaced by the ‘_’ character. 23_976 result.put("%FRAMERATE%", movieInfo.getFrameRate().replace(".", "_")); result.put("%ASPECTRATIOTEXT%", movieInfo.getAspectRatio()); // %ASPECTRATIO% Formatted aspect ration (to allow mapping to filenames). The ‘.’ character is replaced by the ‘_’ character and the ‘,’ character is replaced by ‘-’. 16-9 or 2_35-1 or 4-3 result.put("%ASPECTRATIO%", movieInfo.getAspectRatio().replace(":", "-")); result.put("%VIDEORESOLUTION%", movieInfo.getVideoResolution()); // %VIDEORESOLUTIONTEXT% The movie resolution 1920x1080 result.put("%VIDEORESOLUTIONTEXT%", movieInfo.getVideoResolution()); // TODO result.put("%VIDEOCODECTEXT%", ""); result.put("%VIDEOBITRATETEXT%", movieInfo.getVideoBitrate()); result.put("%AUDIOCODECTEXT%", movieInfo.getAllAudioInfo().get(0).getAudioCodec()); result.put("%AUDIOCHANNELSTEXT%", movieInfo.getAudioChannels()); result.put("%AUDIOBITRATETEXT%", movieInfo.getAudioBitrate()); // TODO, convert in minutes result.put("%DURATIONTEXT%", movieInfo.getDuration()); // %DURATION% The detected (mediainfo) duration of the movie (minutes) 98 result.put("%DURATION%", movieInfo.getDuration()); // %DURATIONSEC% The detected (mediainfo) duration of the movie (seconds) 5880 result.put("%DURATIONSEC%", "" + (Integer.valueOf(movieInfo.getDuration()) * 60)); // TODO, convert in human kB, MB, GB result.put("%FILESIZETEXT%", movieInfo.getFileSize()); // %CONTAINERTEXT% The detected (mediainfo) container format (as it comes from MediaInfo) Matroska result.put("%CONTAINERTEXT%", movieInfo.getContainer()); // %LANGUAGECODE% The two letter ISO code of the language of the first audio stream en result.put("%LANGUAGECODE%", movieInfo.getLanguageCode()); // %LANGUAGE% The language of the first audio stream (always the English name) Spanish result.put("%LANGUAGE%", movieInfo.getLanguage()); // %LANGUAGES% The languages of all audio streams (always the English names) Spanish/English/Italian * List<String> languages = new ArrayList<>(); for (AudioInfo audioInfo : movieInfo.getAllAudioInfo()) { languages.add(audioInfo.getLanguage()); } String languagesString = languages.toString(); result.put("%LANGUAGES%", languagesString.substring(1, languagesString.length() - 1)); // %LANGUAGECODES% The two letter ISO code of the languages of all audio streams es/en/it * List<String> languagesCodes = new ArrayList<>(); for (AudioInfo audioInfo : movieInfo.getAllAudioInfo()) { languagesCodes.add(audioInfo.getLanguageCode().toLowerCase()); } String languagesCodesString = languagesCodes.toString(); result.put("%LANGUAGECODES%", languagesCodesString.substring(1, languagesCodesString.length() - 1)); // %CERTIFICATIONCOUNTRYCODE% The two letter code of the country selected in Options/IMDB as Certification Country (default value, us) es result.put("%CERTIFICATIONCOUNTRYCODE%", "us"); // %LANGUAGES1% … %LANGUAGES5% Individual audio languages (English names) English // TODO result.put("%LANGUAGES1%", ""); return result; } }
true
e3a660c8be76a8b6563c78edc7a21535a2a27817
Java
toshytwx/AirplaneTickets
/src/java/gmail/dimon0272/WebApp/actions/AddLuggageAction.java
UTF-8
526
2.421875
2
[]
no_license
package gmail.dimon0272.WebApp.actions; import gmail.dimon0272.WebApp.model.Luggage; import gmail.dimon0272.WebApp.service.LuggageService; public class AddLuggageAction implements Action { private LuggageService luggageService; private Luggage luggage; public AddLuggageAction(LuggageService customerService, Luggage customer) { this.luggageService = customerService; this.luggage = customer; } @Override public void execute() { luggageService.saveLuggage(luggage); } }
true
d29b2df59a71284a2eaf498f916fc2ecd01a512d
Java
MirkoPoder/operaBankBack
/src/main/java/com/example/podermirko/operabankback/models/mappers/TransactionRowMapper.java
UTF-8
843
2.46875
2
[]
no_license
package com.example.podermirko.operabankback.models.mappers; import com.example.podermirko.operabankback.models.Transaction; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; public class TransactionRowMapper implements RowMapper<Transaction> { @Override public Transaction mapRow(ResultSet resultSet, int i) throws SQLException { Transaction transaction = new Transaction(); transaction.setId(resultSet.getLong("id")); transaction.setAccountNumberFrom(resultSet.getString("fromaccount_number")); transaction.setAccountNumberTo(resultSet.getString("toaccount_number")); transaction.setAmount(resultSet.getBigDecimal("amount")); transaction.setDescription(resultSet.getString("description")); return transaction; } }
true
8b91285de06df98f0fa73bde164d6905e47fb3c8
Java
gavin-ao/Task_Baby
/src/main/java/data/driven/cm/entity/taskbaby/WechatPublicDetailEntity.java
UTF-8
4,430
2.25
2
[]
no_license
package data.driven.cm.entity.taskbaby; import java.util.Date; /** * @Author: lxl * @describe 公众号详细信息表 * @Date: 2018/11/22 17:06 * @Version 1.0 */ public class WechatPublicDetailEntity { /** * 主键 */ private String id; /** * 公众号信息表外键 */ private String wechatPublicId; /** * 授权方昵称 */ private String nickName; /** * 授权方头像 */ private String headImg; /** * 授权方公众号类型,在微信公众号上用的是数组,现改成用逗号拼接到一个字段里 */ private String serviceTypeInfo; /** * 授权方认证类型,在微信公众号上用的是数组,现改成用逗号拼接到一个字段里 */ private String verifyTypeInfo; /** * 授权方公众号的原始ID */ private String userName; /** * 公众号的主体名称 */ private String principalName; /** * 授权方公众号所设置的微信号 */ private String alias; /** * 以了解以下功能的开通状况(0代表未开通,1代表已开通): * open_store:是否开通微信门店功能 * open_scan:是否开通微信扫商品功能 * open_pay:是否开通微信支付功能 * open_card:是否开通微信卡券功能 * open_shake:是否开通微信摇一摇功能 * 微信公众号发过来的是json格式的字符串,现直接存储到字段里 */ private String businessInfo; /** * 二维码图片的URL */ private String qrcodeUrl; /** * 授权方appid */ private String authorizationAppid; /** * 公众号授权给开发者的权限集列表 */ private String funcInfo; /** *创建时间 */ private Date createAt; /** * 二维号图片关联sys_picture表中id */ private String qrPicId; public String getQrPicId() { return qrPicId; } public void setQrPicId(String qrPicId) { this.qrPicId = qrPicId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getWechatPublicId() { return wechatPublicId; } public void setWechatPublicId(String wechatPublicId) { this.wechatPublicId = wechatPublicId; } public String getNickName() { return nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getHeadImg() { return headImg; } public void setHeadImg(String headImg) { this.headImg = headImg; } public String getServiceTypeInfo() { return serviceTypeInfo; } public void setServiceTypeInfo(String serviceTypeInfo) { this.serviceTypeInfo = serviceTypeInfo; } public String getVerifyTypeInfo() { return verifyTypeInfo; } public void setVerifyTypeInfo(String verifyTypeInfo) { this.verifyTypeInfo = verifyTypeInfo; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPrincipalName() { return principalName; } public void setPrincipalName(String principalName) { this.principalName = principalName; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getBusinessInfo() { return businessInfo; } public void setBusinessInfo(String businessInfo) { this.businessInfo = businessInfo; } public String getQrcodeUrl() { return qrcodeUrl; } public void setQrcodeUrl(String qrcodeUrl) { this.qrcodeUrl = qrcodeUrl; } public String getAuthorizationAppid() { return authorizationAppid; } public void setAuthorizationAppid(String authorizationAppid) { this.authorizationAppid = authorizationAppid; } public String getFuncInfo() { return funcInfo; } public void setFuncInfo(String funcInfo) { this.funcInfo = funcInfo; } public Date getCreateAt() { return createAt; } public void setCreateAt(Date createAt) { this.createAt = createAt; } }
true
4b2ae8302721b4ed39a139dff832a2eda3372f44
Java
Team2168/2018_Offseason_Project
/src/org/team2168/subsystems/TelescopicArm.java
UTF-8
4,367
2.796875
3
[]
no_license
package org.team2168.subsystems; import org.team2168.OI; import org.team2168.Robot; import org.team2168.RobotMap; import org.team2168.commands.TelescopicArm.DriveTelescopicArmWithJoysticks; import edu.wpi.first.wpilibj.AnalogInput; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; import edu.wpi.first.wpilibj.Victor; import edu.wpi.first.wpilibj.command.Subsystem; /** * Subsystem class for the telescopic arm * @author DM */ public class TelescopicArm extends Subsystem { private static TelescopicArm instance = null; private Victor armMotor1; private Victor armMotor2; private Victor armMotor3; private DoubleSolenoid armBrake; private AnalogInput potentiometer; private static DigitalInput fullyUp; private static DigitalInput fullyDown; public volatile double telescopicMotor1Voltage; public volatile double telescopicMotor2Voltage; public volatile double telescopicMotor3Voltage; /** * Default Constructer for telescopic arm */ private TelescopicArm() { armMotor1 = new Victor(RobotMap.ARM_MOTOR_1); armMotor2 = new Victor(RobotMap.ARM_MOTOR_2); armMotor3 = new Victor(RobotMap.ARM_MOTOR_3); armBrake = new DoubleSolenoid(RobotMap.ARM_BRAKE_FORWARD, RobotMap.ARM_BRAKE_REVERSE); fullyUp = new DigitalInput(RobotMap.ARM_RAISED); fullyDown = new DigitalInput(RobotMap.ARM_LOWERED); potentiometer = new AnalogInput(RobotMap.ARM_POSITION_POT); } /** * singleton constructor of Telescopic Arm */ public static TelescopicArm GetInstance() { if (instance ==null) instance = new TelescopicArm(); return instance; } /** * Checks to see if arm is fully up * @return true if pressed, false if not */ public boolean isArmFullyUp() { return !fullyUp.get(); } /** * Checks to see if arm is fully down * @return true if pressed, false if not */ public boolean isArmFullyDown() { return !fullyDown.get(); } public double getRawPot() { return potentiometer.getVoltage(); } /** * Drives the first Arm Motor at a speed from -1 to 1 where 1 is forward and negative 1 is backwards * @param speed */ private void driveArmMotor1(double speed) { if(RobotMap.ARM_MOTOR_REVERSED1) speed = -speed; armMotor1.set(speed); telescopicMotor1Voltage = Robot.pdp.getBatteryVoltage() * speed; } /** * Drives the second Arm Motor at a speed from -1 to 1 where 1 is forward and negative 1 is backwards * @param speed */ private void driveArmMotor2(double speed) { if(RobotMap.ARM_MOTOR_REVERSED2) speed = -speed; armMotor2.set(speed); telescopicMotor2Voltage = Robot.pdp.getBatteryVoltage() * speed; } /** * Drives the third Arm Motor at a speed from -1 to 1 where 1 is forward and negative 1 is backwards * @param speed */ private void driveArmMotor3(double speed) { if(RobotMap.ARM_MOTOR_REVERSED3) speed = -speed; armMotor3.set(speed); telescopicMotor3Voltage = Robot.pdp.getBatteryVoltage() * speed; } /** * Drives all Arm Motors at a speed from -1 to 1 where 1 is forward and negative 1 is backwards * @param speed */ public void driveAllMotors(double speed) { if((speed > 0 && isArmFullyDown())||(speed < 0 && isArmFullyUp())){ enableBrake(); driveArmMotor1(0); driveArmMotor2(0); driveArmMotor3(0); } else if (Math.abs(speed) > 0.2) { disableBrake(); driveArmMotor1(speed); driveArmMotor2(speed); driveArmMotor3(speed); } else { enableBrake(); armMotor1.set(0); armMotor2.set(0); armMotor3.set(0); } } /** * Enables the pneumatic brake */ public void enableBrake() { armBrake.set(Value.kForward); } /** * Gets the current state of the pneumatic brake * * @return True when brake is enabled */ public boolean isBrakeEnabled() { return armBrake.get() == Value.kForward; } /** * Disables the pneumatic brake */ public void disableBrake() { armBrake.set(Value.kReverse); } /** * Gets the current state of the pneumatic brake * * @return True when brake is disabled */ public boolean isBrakeDisabled() { return armBrake.get() == Value.kReverse; } public void initDefaultCommand() { // Set the default command for a subsystem here. setDefaultCommand(new DriveTelescopicArmWithJoysticks(OI.getInstance().operatorJoystick)); } }
true
1616784ca808fe7bd728442da3f011f492776da7
Java
alexuaaaa/cucumber-tests
/src/test/java/cucumber/classobjs/PatientGender.java
UTF-8
229
2.21875
2
[]
no_license
package cucumber.classobjs; public class PatientGender { public String gender; public String path; public PatientGender(String gender, String path) { this.gender = gender; this.path = path; } }
true
113f3e8a2e5f326c24efce5b230df05b60623600
Java
kjhulin/secure-notepad
/Crypto.java
UTF-8
14,146
2.71875
3
[]
no_license
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import javax.crypto.Mac; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class Crypto { private final static int SALT_SIZE = 8; private final static int IV_SIZE = 16; private final static int HMAC_SIZE = 20; private final static int NUM_ROUNDS = 1024; private final static int AES_KEY_SIZE = 256; private final static int HMAC_KEY_SIZE = 160; private final static String AES_CIPHER_MODE = "AES/CTR/NoPadding"; private final static String SHA1_MODE = "SHA-1"; private final static String SHA256_MODE = "SHA-256"; private final static String HMAC_MODE = "HMacSHA1"; // Encrypt AES-256 of Plaintext // Input: Cleartext byte file (cleartext), String password (pass) from GUI // Output: CryptoStore object contains (byte[] for IV and keySalt), File (cleartext) now contains Ciphertext bytes public static CryptoStore encryptAES(File cleartext, String pass) { CryptoStore cs = new CryptoStore(generateBytes(SALT_SIZE), generateBytes(IV_SIZE), new byte[0], new byte[0]); //System.out.println("ENC SALT: " + toHexString(cs.getKeySalt())); //System.out.println("ENC IV: " + toHexString(cs.getIV())); byte[] secret = generateSecret(pass, cs.getKeySalt(), NUM_ROUNDS, AES_KEY_SIZE); //System.out.println("ENC SECRET: " + toHexString(secret) + "\t(" + secret.length + ")"); SecretKeySpec keySpec = new SecretKeySpec(secret, "AES"); Arrays.fill(secret, (byte) 0x00); String filename = cleartext.toString(); File input = new File("cleartext.old"); moveFile(cleartext, input); File out = new File(filename); //System.out.println("ENC File: " + filename); //System.out.println("ENC File: " + input); //System.out.println("ENC Output: " + out); // Encrypt Contents try { final Cipher cipher = Cipher.getInstance(AES_CIPHER_MODE); IvParameterSpec ivSpec = new IvParameterSpec(cs.getIV()); cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec); FileInputStream is = new FileInputStream(input); CipherOutputStream os = new CipherOutputStream(new FileOutputStream(out), cipher); byte[] buf = new byte[1024]; int numRead = 0; while((numRead = is.read(buf)) >= 0) os.write(buf, 0, numRead); is.close(); os.close(); } catch(IOException ioe) {ioe.printStackTrace();} catch(NoSuchAlgorithmException nsae) {nsae.printStackTrace();} catch(NoSuchPaddingException nspe) {nspe.printStackTrace();} catch(InvalidAlgorithmParameterException iape) {iape.printStackTrace();} catch(InvalidKeyException ike) {ike.printStackTrace();} // Remove cleartext file boolean confirm = input.delete(); if(!confirm) throw new IllegalArgumentException("ENC: Cannot Delete Input File"); return cs; } // Decrypt AES-256 of Ciphertext // Input: Ciphertext byte file (ciphertext), String password (pass) from GUI, CryptoStore (cs) generated by Encrypt AES-256 // Output: File (ciphertext) now contains Cleartext bytes public static void decryptAES(File ciphertext, String pass, CryptoStore cs) { //System.out.println("DEC SALT: " + toHexString(cs.getKeySalt())); //System.out.println("DEC IV: " + toHexString(cs.getIV())); byte[] secret = generateSecret(pass, cs.getKeySalt(), NUM_ROUNDS, AES_KEY_SIZE); //System.out.println("DEC SECRET: " + toHexString(secret) + "\t(" + secret.length + ")"); SecretKeySpec keySpec = new SecretKeySpec(secret, "AES"); Arrays.fill(secret, (byte) 0x00); String filename = ciphertext.toString(); File input = new File("ciphertext.old"); moveFile(ciphertext, input); File out = new File(filename); //System.out.println("DEC File: " + filename); //System.out.println("DEC File: " + input); //System.out.println("DEC Output: " + out); // Encrypt Contents try { final Cipher cipher = Cipher.getInstance(AES_CIPHER_MODE); IvParameterSpec ivSpec = new IvParameterSpec(cs.getIV()); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); CipherInputStream is = new CipherInputStream(new FileInputStream(input), cipher); FileOutputStream os = new FileOutputStream(out); byte[] buf = new byte[1024]; int numRead = 0; while((numRead = is.read(buf)) >= 0) os.write(buf, 0, numRead); is.close(); os.close(); } catch(IOException ioe) {ioe.printStackTrace();} catch(NoSuchAlgorithmException nsae) {nsae.printStackTrace();} catch(NoSuchPaddingException nspe) {nspe.printStackTrace();} catch(InvalidAlgorithmParameterException iape) {iape.printStackTrace();} catch(InvalidKeyException ike) {ike.printStackTrace();} // Remove cleartext file boolean confirm = input.delete(); if(!confirm) throw new IllegalArgumentException("DEC: Cannot Delete Input File"); } // Generate 160/256-bit key from password + salt over iterations public static byte[] generateSecret(String pass, byte[] salt, int iter, int size) { byte[] key = pass.getBytes(); final MessageDigest md; try { if(size == HMAC_KEY_SIZE) md = MessageDigest.getInstance(SHA1_MODE); else md = MessageDigest.getInstance(SHA256_MODE); for(int i = 0; i < iter; i++) { final byte[] secret = new byte[key.length + salt.length]; System.arraycopy(key, 0, secret, 0, key.length); System.arraycopy(salt, 0, secret, key.length, salt.length); Arrays.fill(key, (byte) 0x00); md.reset(); key = md.digest(secret); Arrays.fill(secret, (byte) 0x00); //System.out.println("KEY (" + i + "): " + toHexString(key)); } } catch(NoSuchAlgorithmException e) { e.printStackTrace(); } return key; } // Calculate HMAC of Cipher Text // Input: Ciphertext byte file (ciphertext) <- generated by Decrypt AES-256, String password (pass) from GUI, CryptoStore (cs) // If verify HMAC -> cs should be a new CryptoStore containing the hashSalt // Ouput: returns new CryptoStore with hashSalt and HMAC values only // If calc HMAC -> cs should be the CryptoStore returned by Encrypt AES-256 // Ouput: returns modified CryptoStore (cs) with hashSalt and HMAC values appended public static CryptoStore calcHMAC(File ciphertext, String pass, CryptoStore cs) { if(cs.getHashSalt().length <= 0) cs.setHashSalt(generateBytes(SALT_SIZE)); byte[] secret = generateSecret(pass, cs.getHashSalt(), NUM_ROUNDS, HMAC_KEY_SIZE); //System.out.println("SECRET: " + toHexString(secret) + "\t(" + secret.length + ")"); SecretKeySpec sKey = new SecretKeySpec(secret, HMAC_MODE); Arrays.fill(secret, (byte) 0x00); //System.out.println("SECRET: " + toHexString(secret) + "\t(" + secret.length + ")"); byte[] value = null; try { InputStream is = new FileInputStream(ciphertext); byte[] buf = new byte[1024]; Mac mac = Mac.getInstance(HMAC_MODE); mac.init(sKey); int numRead; while((numRead = is.read(buf)) >= 0) mac.update(buf); value = mac.doFinal(); is.close(); } catch(FileNotFoundException fnfe) {fnfe.printStackTrace();} catch(IOException ioe) {ioe.printStackTrace();} catch(NoSuchAlgorithmException nsae) {nsae.printStackTrace();} catch (InvalidKeyException ike) {ike.printStackTrace();} if(cs.getHMAC().length <= 0) { cs.setHMAC(value); return cs; } else return new CryptoStore(new byte[0], new byte[0], value, cs.getHashSalt()); } // Generates Secure Random Number of Bytes public static byte[] generateBytes(int num) { num = (num >= 0) ? num : 0; final byte[] bytes = new byte[num]; SecureRandom sr = new SecureRandom(); sr.nextBytes(bytes); return bytes; } // Converts Byte Array to Hex String public static String toHexString(byte[] b) { StringBuffer sb = new StringBuffer(b.length * 2); for (int i = 0; i < b.length; i++) { int v = b[i] & 0xff; if (v < 16) sb.append('0'); sb.append(Integer.toHexString(v)); } return sb.toString().toUpperCase(); } // Converts Hex String to Byte Array public static byte[] toByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); } return data; } // Copies source to destination and Deletes source private static void moveFile(File src, File dest) { try { InputStream is = new FileInputStream(src); OutputStream os = new FileOutputStream(dest); byte[] buf = new byte[1024]; int numRead; while ((numRead = is.read(buf)) >= 0) os.write(buf, 0, numRead); is.close(); os.close(); boolean confirm = src.delete(); if(!confirm) throw new IllegalArgumentException("MOVE: Cannot Delete Src File"); } catch(FileNotFoundException fnfe) {fnfe.printStackTrace();} catch(IOException ioe) {ioe.printStackTrace();} } // Create Encrypted File // Input: Ciphertext bytes file, CryptoStore object (keySalt + IV + hashSalt + HMAC) // Output: File (ciphertext) /w Hex Representation of all input data public static void createFile(File ciphertext, CryptoStore cs) { try { String filename = ciphertext.toString(); File input = new File("ciphertext.old"); moveFile(ciphertext, input); File out = new File(filename); InputStream is = new FileInputStream(input); OutputStream os = new FileOutputStream(out); long len = (long) input.length(); int numRead = 0; int c = 0; String hex; while(numRead < len) { c = (numRead + 1024) <= len ? 1024 : (int) (len - numRead); byte[] content = new byte[c]; is.read(content); hex = toHexString(content); os.write(hex.getBytes()); numRead += c; } hex = toHexString(cs.getKeySalt()); os.write(hex.getBytes()); hex = toHexString(cs.getIV()); os.write(hex.getBytes()); hex = toHexString(cs.getHashSalt()); os.write(hex.getBytes()); hex = toHexString(cs.getHMAC()); os.write(hex.getBytes()); is.close(); os.close(); boolean confirm = input.delete(); if(!confirm) throw new IllegalArgumentException("CREATE: Cannot Delete Input File"); } catch(FileNotFoundException fnfe) {fnfe.printStackTrace();} catch(IOException ioe) {ioe.printStackTrace();} } // Parse Encrypted File // Input: HexFormat bytes file // Output: File (hexFormat) now contains Ciphertext bytes, returns CryptoStore object (keySalt + IV + hashSalt + HMAC) public static CryptoStore parseFile(File hexFormat) { CryptoStore cs = new CryptoStore(); try { String filename = hexFormat.toString(); File input = new File("hexformat.old"); moveFile(hexFormat, input); File out = new File(filename); InputStream is = new FileInputStream(input); OutputStream os = new FileOutputStream(out); long len = (long) input.length() - ((SALT_SIZE + IV_SIZE + SALT_SIZE + HMAC_SIZE) * 2); int numRead = 0; int c = 0; String hex; while(numRead < len) { c = (numRead + 1024) <= len ? 1024 : (int) (len - numRead); byte[] content = new byte[c]; is.read(content); hex = new String(content); byte[] bytes = toByteArray(hex); os.write(bytes); numRead += c; } byte[] content = new byte[SALT_SIZE * 2]; is.read(content); hex = new String(content); cs.setKeySalt(toByteArray(hex)); content = new byte[IV_SIZE * 2]; is.read(content); hex = new String(content); cs.setIV(toByteArray(hex)); content = new byte[SALT_SIZE * 2]; is.read(content); hex = new String(content); cs.setHashSalt(toByteArray(hex)); content = new byte[HMAC_SIZE * 2]; is.read(content); hex = new String(content); cs.setHMAC(toByteArray(hex)); is.close(); os.close(); boolean confirm = input.delete(); if(!confirm) throw new IllegalArgumentException("PARSE: Cannot Delete Input File"); } catch(FileNotFoundException fnfe) {fnfe.printStackTrace();} catch(IOException ioe) {ioe.printStackTrace();} return cs; } // Test Main public static void main(String[] args) { File cleartext = new File("cleartext.txt"); String password = "This is an extremely long generic key 0123456789"; CryptoStore cs = encryptAES(cleartext, password); cs = calcHMAC(cleartext, password, cs); System.out.println("Password:\t" + password); System.out.println("Key Salt:\t" + toHexString(cs.getKeySalt())); System.out.println("Cipher IV:\t" + toHexString(cs.getIV())); System.out.println("Hash Salt:\t" + toHexString(cs.getHashSalt())); System.out.println("HMAC:\t" + toHexString(cs.getHMAC())); createFile(cleartext, cs); cs = null; cs = parseFile(cleartext); CryptoStore dCS = new CryptoStore(); dCS.setHashSalt(cs.getHashSalt()); dCS = calcHMAC(cleartext, password, dCS); System.out.println("Hash Salt:\t" + toHexString(dCS.getHashSalt())); System.out.println("HMAC:\t" + toHexString(dCS.getHMAC())); decryptAES(cleartext, password, cs); System.out.println("Password:\t" + password); System.out.println("Key Salt:\t" + toHexString(cs.getKeySalt())); System.out.println("Cipher IV:\t" + toHexString(cs.getIV())); System.out.println("Hash Salt:\t" + toHexString(cs.getHashSalt())); System.out.println("HMAC:\t" + toHexString(cs.getHMAC())); } }
true
90ef187797c180b1d24bd2b02fac6eec156a0017
Java
JetBrains/intellij-sdk-docs
/code_samples/settings/src/main/java/org/intellij/sdk/settings/AppSettingsState.java
UTF-8
1,417
1.867188
2
[ "Apache-2.0" ]
permissive
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.sdk.settings; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.State; import com.intellij.openapi.components.Storage; import com.intellij.util.xmlb.XmlSerializerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Supports storing the application settings in a persistent way. * The {@link State} and {@link Storage} annotations define the name of the data and the file name where * these persistent application settings are stored. */ @State( name = "org.intellij.sdk.settings.AppSettingsState", storages = @Storage("SdkSettingsPlugin.xml") ) public class AppSettingsState implements PersistentStateComponent<AppSettingsState> { public String userId = "John Q. Public"; public boolean ideaStatus = false; public static AppSettingsState getInstance() { return ApplicationManager.getApplication().getService(AppSettingsState.class); } @Nullable @Override public AppSettingsState getState() { return this; } @Override public void loadState(@NotNull AppSettingsState state) { XmlSerializerUtil.copyBean(state, this); } }
true
9da2f58df509addb89f99803c91076945a87f7d6
Java
divanshuarneja/Ricerocks
/missile.java
UTF-8
3,277
3.15625
3
[]
no_license
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) import java.util.List; /** * Missile class. An explosion occurs when it hits the rock * * @Team15 */ public class missile extends SmoothMover implements MissileSubject { /** * Act - do whatever the missile wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ int life = 30; ConcreteLargeRock rgb =new ConcreteLargeRock(); ConcreteSmallRock rgs =new ConcreteSmallRock(); public missile (Vector speed, int rotation) { super(speed); setRotation(rotation); addForce(new Vector(rotation, 15)); Greenfoot.playSound("missile.mp3"); } public void act() { if(life <= 0) { getWorld().removeObject(this); } else { life--; move(); checkRockHit(); } } public void checkRockHit() { Rock a = (Rock) getOneIntersectingObject(Rock.class); if (a != null) { int shipX = 0; int shipY = 0; updateScore(a); getWorld().removeObject(a); try{ List<Ship> l = getWorld().getObjects(Class.forName("Ship")); shipX =((Ship)l.get(0)).getX() ; shipY =((Ship)l.get(0)).getY() ; System.out.println("Ship X:"+ shipX); System.out.println("Ship Y:"+ shipY); }catch(Exception e){ e.printStackTrace(); } int x = Greenfoot.getRandomNumber(getWorld().getWidth()); int y = Greenfoot.getRandomNumber(getWorld().getHeight()); //Generating new Rock x and y if it is in radius of the ship 150 pixels while( ((x - shipX)*(x - shipX) + (y - shipY)*(y - shipY) ) < 150*150){ x = Greenfoot.getRandomNumber(getWorld().getWidth()); y = Greenfoot.getRandomNumber(getWorld().getHeight()); } //System.out.println("Rock X: " + x); //System.out.println("Rock Y: " + y); int selectRock = Greenfoot.getRandomNumber(2); if (selectRock == 0) { getWorld().addObject(rgs.makeRock("S"), x, y); } else { getWorld().addObject(rgb.makeRock("B"), x, y); } explode(); } } public void updateScore( Rock a){ int score; Score s1 = new Score("Score:"+ Score.sc); if (a instanceof SmallRock) { ScoreInterface s = new SmallDecorator(s1); score = s.addScore() ; s1.setScore(score); } else if (a instanceof LargeRock) { ScoreInterface s = new LargeDecorator(s1); score = s.addScore() ; s1.setScore(score); } } public void explode() { getWorld().addObject( new Explosion(), getX(), getY()); getWorld().removeObject(this); } }
true
71434ea7b99549c59ee86e8e55a319a3bb370561
Java
MohammedBesha/FoodDelivery
/app/src/main/java/com/zetatech/foodapp/data/models/ResponseKitchenDetails.java
UTF-8
646
2.109375
2
[]
no_license
package com.zetatech.foodapp.data.models; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; //Represents Kitchen Details Model public class ResponseKitchenDetails { @SerializedName("data") @Expose private KitchenDetailsData data; @SerializedName("status") @Expose private String status; @SerializedName("status_code") @Expose private long statusCode; public KitchenDetailsData getData() { return data; } public String getStatus() { return status; } public long getStatusCode() { return statusCode; } }
true
cecc1fc960cdbaa48681c43656725585b8dde7df
Java
zzyviolette/Animalia-DAR
/src/model/dao/CommentDao.java
UTF-8
2,406
2.609375
3
[]
no_license
package model.dao; import java.util.ArrayList; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; import model.bo.Comment; import model.bo.Utilisateur; import utils.HibernateUtil; public class CommentDao { public boolean saveDetails(String name, String description, int mark){ { boolean flag=true; Session session = HibernateUtil.openSession(); Comment comment=new Comment(); comment.setName(name); comment.setDescription(description); comment.setMark(mark); Transaction transaction=session.beginTransaction(); try { session.save(comment); transaction.commit(); }catch(Exception e) { transaction.rollback(); flag=false; } session.close(); return flag; } } public List<Comment> getListOfComments(){ List<Comment> list = new ArrayList<Comment>(); Session session = HibernateUtil.openSession(); Transaction tx = null; try { tx = session.getTransaction(); tx.begin(); list = session.createQuery("from Comment").list(); tx.commit(); } catch (Exception e) { if (tx != null) { tx.rollback(); } e.printStackTrace(); } finally { session.close(); } return list; } public List<Comment> find() { Session session = HibernateUtil.openSession(); Transaction tx = null; List<Comment> comments = new ArrayList<Comment>(); try { tx = session.getTransaction(); tx.begin(); Query query = session.createQuery("from Comment as comment order by mark DESC,length(description) DESC"); query.setFirstResult(0); query.setMaxResults(3); comments = query.list(); tx.commit(); } catch (Exception e) { if (tx != null) { tx.rollback(); } e.printStackTrace(); } finally { session.close(); } return comments; } }
true
c909b2b056c32d1eccdeff68ec568a74ad42796d
Java
dmelemed/catan
/src/melemed/catan/cards/DevelopmentCard.java
UTF-8
223
1.773438
2
[]
no_license
package melemed.catan.cards; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public enum DevelopmentCard { SOLDIER; private static final Logger logger = LoggerFactory.getLogger(DevelopmentCard.class); }
true
88fa0ac70155d6ac222084f01ef057d469e49117
Java
bmarshall-zenoss/optiq
/src/main/java/org/eigenbase/relopt/RelOptAbstractTable.java
UTF-8
2,337
1.90625
2
[ "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
/* // Licensed to Julian Hyde under one or more contributor license // agreements. See the NOTICE file distributed with this work for // additional information regarding copyright ownership. // // Julian Hyde 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.eigenbase.relopt; import java.util.*; import org.eigenbase.rel.*; import org.eigenbase.reltype.*; import com.google.common.collect.ImmutableList; /** * A <code>RelOptAbstractTable</code> is a partial implementation of {@link * RelOptTable}. * * @author jhyde * @version $Id$ * @since May 3, 2002 */ public abstract class RelOptAbstractTable implements RelOptTable { //~ Instance fields -------------------------------------------------------- protected RelOptSchema schema; protected RelDataType rowType; protected String name; //~ Constructors ----------------------------------------------------------- protected RelOptAbstractTable( RelOptSchema schema, String name, RelDataType rowType) { this.schema = schema; this.name = name; this.rowType = rowType; } //~ Methods ---------------------------------------------------------------- public String getName() { return name; } public List<String> getQualifiedName() { return ImmutableList.of(name); } public double getRowCount() { return 100; } public RelDataType getRowType() { return rowType; } public void setRowType(RelDataType rowType) { this.rowType = rowType; } public RelOptSchema getRelOptSchema() { return schema; } public List<RelCollation> getCollationList() { return Collections.<RelCollation>emptyList(); } } // End RelOptAbstractTable.java
true
41ec3f3f3f259252803fa95eb8a59a530d9a9e9e
Java
aidenyan/inside
/inside-service/src/main/java/com/jimmy/service/sys/SysConfigService.java
UTF-8
229
1.585938
2
[]
no_license
package com.jimmy.service.sys; import com.jimmy.dto.SysConfigDTO; /** * Created by Administrator on 2019/5/27/027. */ public interface SysConfigService { SysConfigDTO find(); void save(SysConfigDTO sysConfigDTO); }
true
1caa3e9f48b314b106bead0d5eff45f3c5c1d93f
Java
katiewu/Crawler
/src/test/edu/upenn/cis455/XPathCrawlerTest.java
UTF-8
1,606
2.453125
2
[]
no_license
package test.edu.upenn.cis455; import java.util.List; import junit.framework.TestCase; import edu.upenn.cis455.crawler.Processor; import edu.upenn.cis455.crawler.RobotManager; import edu.upenn.cis455.crawler.URLFrontier; public class XPathCrawlerTest extends TestCase { String url; URLFrontier urlFrontier; protected void setUp() throws Exception { super.setUp(); url = "https://dbappserv.cis.upenn.edu/crawltest.html"; urlFrontier = new URLFrontier(1); } public void testProcessor(){ List<String> links = Processor.extractLink(url); assertEquals(links.contains("https://dbappserv.cis.upenn.edu/crawltest/nytimes/"), true); assertEquals(links.contains("https://dbappserv.cis.upenn.edu/crawltest/bbc/"), true); assertEquals(links.contains("https://dbappserv.cis.upenn.edu/crawltest/cnn/"), true); assertEquals(links.contains("https://dbappserv.cis.upenn.edu/crawltest/international/"), true); } public void testRobotManager(){ RobotManager.addRobot(url); assertEquals(RobotManager.isValid("https://dbappserv.cis.upenn.edu/crawltest/marie/private/"), false); assertEquals(RobotManager.isValid("https://dbappserv.cis.upenn.edu/crawltest/foo/"), false); assertEquals(RobotManager.isValid("https://dbappserv.cis.upenn.edu/crawltest/marie/private"), true); assertEquals(RobotManager.isValid("https://dbappserv.cis.upenn.edu/crawltest/"), true); } public void testURLFrontier(){ urlFrontier.pushURL(url); assertEquals(urlFrontier.filter(url), false); assertEquals(urlFrontier.filter("https://dbappserv.cis.upenn.edu/crawltest/marie/private"), true); } }
true
8d3930608f2800feee61c1b4073caef6608b3894
Java
crttcr/RoostDomain
/src/main/java/xivvic/roost/dao/UserDao.java
UTF-8
508
2.453125
2
[]
no_license
package xivvic.roost.dao; import java.util.List; import xivvic.roost.domain.User; public interface UserDao extends DomainEntityDao { /** * Return the unique user with the matching (case insensitive) email. * * @param email the email to match * @return the user with the provided email, or null if none exist. */ User findByEmail(String email); User findByUserName(String u_name); /** * Returns all the users in the system. * * @return list of all users */ List<User> list(); }
true
40e54066870d822839d4fa1450037df765214bd1
Java
xfworld/rain
/activity/src/test/java/org/david/pattern/Singleton/num/Singleton.java
UTF-8
241
2.328125
2
[]
no_license
package org.david.pattern.Singleton.num; /** * Created by mac on 15-4-7. */ /**单元素的枚举类型是实现单例的最佳方法,自带反序列化,防止多次实例化 * */ public enum Singleton { INSTANCE }
true
8a7ba963bf59740605c15ab3ddea2b103142631e
Java
mikeando/janb
/src/main/java/janb/models/FileModel.java
UTF-8
1,545
2.46875
2
[]
no_license
package janb.models; import janb.Action; import janb.controllers.IController; import janb.mxl.IMxlFile; import janb.mxl.MxlAnnotation; import javafx.util.Pair; import java.util.ArrayList; import java.util.List; /** * Created by michaelanderson on 7/01/2015. */ public class FileModel extends AbstractModel { private String title; IMxlFile file; final IViewModel viewModel; List<AnnotationModel> annotations = new ArrayList<>(); public FileModel(IMxlFile file, IViewModel viewModel) { this.viewModel = viewModel; if(file==null) throw new NullPointerException("file can not be null"); this.file = file; title = file.getBaseName(); final List<MxlAnnotation> mxlAnnotations = file.getAnnotations(); if(mxlAnnotations!=null) { for (MxlAnnotation mxlAnnotation : mxlAnnotations) { annotations.add(new AnnotationModel(mxlAnnotation)); } } } @Override public String getTitle() { return title; } @Override public List<Pair<String, Action>> getContextActions() { final ArrayList<Pair<String, Action>> actions = new ArrayList<>(); actions.add(new Pair<>("Open File", this::openFile)); return actions; } //TODO: These need to be two-way bindings. private void openFile(IController iController) { viewModel.showContent(file); } @Override public List<IModel> getChildModels() { return new ArrayList<>(annotations); } }
true
e3ce0ff0bd4faafe752b6e7027f2030783305fd3
Java
AcadGildAcademy/BD-2015May06-Ajay-Mathais
/Collections/src/collections/Hashmap.java
UTF-8
668
3.34375
3
[]
no_license
package collections; import java.util.*; import java.util.Map.Entry; public class Hashmap { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Map<Integer, String> map = new HashMap <Integer, String> (); map.put(1, "tutorials"); map.put(2, "point"); map.put(3, "is best"); Set<Entry<Integer, String>> es = map.entrySet(); Iterator <Entry <Integer, String>> itr = es.iterator(); while(itr.hasNext()){ Entry<Integer, String> curr = (Entry<Integer, String>) itr.next(); System.out.println(curr.getKey() + " = " + curr.getValue()); } } }
true
885d4ec0e26adbae5352dd2d0f27d7a45954923b
Java
zk-spica/LiTZ
/src/litz/ButtonList.java
UTF-8
2,030
2.546875
3
[]
no_license
package litz; import java.awt.Color; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JLabel; public class ButtonList extends Div { int height, width, buttonHeight, buttonWidth; Div[] list; static Image selectorImage; boolean operatable = true; private JLabel selector; private int nButton, margin, movePadding, selectorIndex = 0; public ButtonList(int posx, int posy, int _nButton, int _buttonWidth, int _buttonHeight) { super(); nButton = _nButton; buttonHeight = _buttonHeight; buttonWidth = _buttonWidth; margin = buttonHeight/4; height = _buttonHeight*nButton+margin*2; width = (int)(_buttonWidth*1.2)+margin*2; movePadding = width-margin*2-buttonWidth; setBounds(posx, posy, width, height); setBackground(new Color(255, 255, 255, 60)); list = new Div[nButton]; for (int i=0; i<nButton; ++i) { list[i] = new Div(0, margin + i*buttonHeight, (int)(buttonWidth*1.1), buttonHeight); add(list[i]); final int _i = i; list[i].addMouseListener(new MouseAdapter(){ public void mouseEntered(MouseEvent e) { if (operatable) moveSelector(_i); } }); } ImageIcon icon = new ImageIcon(selectorImage.getScaledInstance(width, buttonHeight, Image.SCALE_SMOOTH)); selector = new JLabel(); selector.setIcon(icon); selector.setBounds(0, margin, width, buttonHeight); add(selector); Animator.animate(list[0], movePadding, 0); } public synchronized void moveSelector(int index) { Animator.animate(selector, 0, (index-selectorIndex)*buttonHeight); Animator.animate(list[selectorIndex], -movePadding, 0); Animator.animate(list[index], movePadding, 0); selectorIndex = index; } }
true
409b26c781d7877fb45b52f77aebb8497884a677
Java
FRC4561TerrorBytes/TB2016PreSeason
/robot_2015/src/org/usfirst/frc/team4561/robot/subsystems/Loader.java
UTF-8
1,365
2.734375
3
[]
no_license
package org.usfirst.frc.team4561.robot.subsystems; import org.usfirst.frc.team4561.robot.RobotMap; import edu.wpi.first.wpilibj.DigitalOutput; import edu.wpi.first.wpilibj.SpeedController; import edu.wpi.first.wpilibj.Talon; import edu.wpi.first.wpilibj.Victor; import edu.wpi.first.wpilibj.command.Subsystem; /** * Takes a Boolean value. Turns the loader belt on or off. */ public class Loader extends Subsystem { SpeedController beltMotor; public DigitalOutput loadedLED = new DigitalOutput(RobotMap.LOADED_LED); //TODO: Add a digital input on an unknown port that'll be the loaded sensor. Will return a boolean. // Put methods for controlling this subsystem // here. Call these from Commands. public Loader() { constructMotorControllers(); } public void initDefaultCommand() { // Set the default command for a subsystem here. //setDefaultCommand(new MySpecialCommand()); } public void constructMotorControllers() { if(RobotMap.LOADER_USE_VICTORS) { beltMotor = new Victor(RobotMap.BELT_MOTOR); } else { beltMotor = new Talon(RobotMap.BELT_MOTOR); } } /** * Takes a double value. Sets the loader belt speed. */ public void setBeltSpeed(double speed) { beltMotor.set(speed); } public double getBeltSpeed() { return beltMotor.get(); } }
true
687cad12015260b661512c0751bb7c137d66bf02
Java
logosty/leetcode
/src/main/java/com/logosty/learning/leetcode/section600/part68/Solution684.java
UTF-8
2,190
3.46875
3
[]
no_license
package com.logosty.learning.leetcode.section600.part68; /** * @author logosty(ganyingle) on 2021/1/27 15:19 * 684. 冗余连接 中等 * 在本问题中, 树指的是一个连通且无环的无向图。 * * 输入一个图,该图由一个有着N个节点 (节点值不重复1, 2, ..., N) 的树及一条附加的边构成。附加的边的两个顶点包含在1到N中间,这条附加的边不属于树中已存在的边。 * * 结果图是一个以边组成的二维数组。每一个边的元素是一对[u, v] ,满足 u < v,表示连接顶点u 和v的无向图的边。 * * 返回一条可以删去的边,使得结果图是一个有着N个节点的树。如果有多个答案,则返回二维数组中最后出现的边。答案边 [u, v] 应满足相同的格式 u < v。 * * 示例 1: * * 输入: [[1,2], [1,3], [2,3]] * 输出: [2,3] * 解释: 给定的无向图为: * 1 * / \ * 2 - 3 * 示例 2: * * 输入: [[1,2], [2,3], [3,4], [1,4], [1,5]] * 输出: [1,4] * 解释: 给定的无向图为: * 5 - 1 - 2 * | | * 4 - 3 * 注意: * * 输入的二维数组大小在 3 到 1000。 * 二维数组中的整数在1到N之间,其中N是输入数组的大小。 * 更新(2017-09-26): * 我们已经重新检查了问题描述及测试用例,明确图是无向 图。对于有向图详见冗余连接II。对于造成任何不便,我们深感歉意。 */ public class Solution684 { /** * 执行用时: * 0 ms * , 在所有 Java 提交中击败了 * 100.00% * 的用户 * 内存消耗: * 38.9 MB * , 在所有 Java 提交中击败了 * 39.38% * 的用户 */ public int[] findRedundantConnection(int[][] edges) { int[] parent = new int[edges.length + 1]; for (int i = 0; i < parent.length; i++) { parent[i] = i; } for (int[] edge : edges) { int i = find(edge[0], parent); int j = find(edge[1], parent); if (i == j) { return edge; } parent[i] = j; } return null; } private int find(int i, int[] parent) { if (i != parent[i]) { parent[i] = find(parent[i], parent); } return parent[i]; } }
true