blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
df377dde199ce107716bf523422a2cd13ff63363
2db15b2dec49559e9d97d28cfafbb2cfbdb3b9ad
/src/main/java/dataclustering/CONST.java
1fdeb7842f099dfff4261f41caad71b8f27f2b44
[]
no_license
sdgdsffdsfff/em-mapred
cb173858e532be5b46779548cc596dc5c78b7402
085566a89bbd27bfb79ae91d4b4890fd00f2a66e
refs/heads/master
2021-01-20T10:53:39.379313
2014-11-09T16:57:41
2014-11-09T16:57:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,316
java
package dataclustering; import java.util.Vector; /** * * @author wgybzb * */ public class CONST { static final double INF = (double) 2000000000 * (double) 2000000000; static final int EUCLIDEAN = 1; static final int MANHATTAN = 2; static final int BASIC_KMEANS = 1; static final int EM_KMEANS = 2; static final int BISECTING_KMEANS = 3; static final int K_MEDOIDS = 4; static boolean STOP; static double Distance(Point3D p1, Point3D p2, int DistanceType) { switch (DistanceType) { case EUCLIDEAN: return Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y) + (p2.z - p1.z) * (p2.z - p1.z)); default: return Math.abs(p2.x - p1.x) + Math.abs(p2.y - p1.y) + Math.abs(p2.z - p1.z); } } static double calSSE(Cluster C, int DistanceType) { double sum = 0; for (int i = 0; i < C.V.size(); i++) { sum += Distance(C.V.elementAt(i), C.Centroid, CONST.EUCLIDEAN) * Distance(C.V.elementAt(i), C.Centroid, DistanceType); } return sum; } static Point3D getCentroid(Vector<Point3D> V) { double x = 0; double y = 0; double z = 0; for (int i = 0; i < V.size(); i++) { x += V.elementAt(i).x; y += V.elementAt(i).y; z += V.elementAt(i).z; } x /= V.size(); y /= V.size(); z /= V.size(); return new Point3D(x, y, z); } static boolean Equal(Point3D p1, Point3D p2, int DistanceType) { switch (DistanceType) { case EUCLIDEAN: if (Distance(p1, p2, EUCLIDEAN) < 0.001) { return true; } return false; default://MANHATTAN if (Distance(p1, p2, MANHATTAN) < 0.005) { return true; } return false; } } static double SumOfError(int[] M, int[] B, boolean[] IsMedoids, int K, Vector<Point3D> V, int DistanceType) { double SOE = 0; for (int i = 0; i < V.size(); i++) if (!IsMedoids[i]) { double MinDis = INF; for (int j = 0; j < K; j++) { if (MinDis > Distance(V.elementAt(i), V.elementAt(M[j]), DistanceType)) { MinDis = Distance(V.elementAt(i), V.elementAt(M[j]), DistanceType); B[i] = j; } } SOE += MinDis; } return SOE; } static double NormalDistribution(Point3D p, Point3D mean, double Deviation) { double result = Math.exp(-(Distance(p, mean, EUCLIDEAN) * Distance(p, mean, EUCLIDEAN)) / (2 * Deviation * Deviation)); return result; } }
[ "wgybzb@sina.cn" ]
wgybzb@sina.cn
8c8d47bdc7c8a578da717d8915a02a967a0cd9cc
df385fca1f4b7cea572b3f72bc3c39eb8c5dba1e
/Submissions/Assignment 8b/Assignment 8b/CircuitPiper/src/org/mathpiper/ui/gui/applications/circuitpiper/model/components/Component.java
249155edc9c8411602b97d57c3fe75c0a67229aa
[]
no_license
Brumous101/Advanced-Circuit-Analysis
34ade6f3598a59ce6c4bd15e6882cd8d932a5380
c5530bb6972470b31d9c0e4457c6651f6fe565d4
refs/heads/master
2023-01-15T17:59:18.336936
2020-12-01T05:23:38
2020-12-01T05:23:38
297,159,826
0
0
null
null
null
null
UTF-8
Java
false
false
23,940
java
package org.mathpiper.ui.gui.applications.circuitpiper.model.components; import java.awt.Color; import java.awt.RenderingHints; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; import org.mathpiper.ui.gui.applications.circuitpiper.circuitjs1.elements.CircuitElm; import org.mathpiper.ui.gui.applications.circuitpiper.model.Circuit; import org.mathpiper.ui.gui.applications.circuitpiper.model.Terminal; import org.mathpiper.ui.gui.applications.circuitpiper.model.components.active.ControlledSource; import org.mathpiper.ui.gui.applications.circuitpiper.model.components.passive.Wire; import org.mathpiper.ui.gui.applications.circuitpiper.view.ScaledGraphics; import org.mathpiper.ui.gui.applications.circuitpiper.view.ScopePanel; /*AUTHORS: - Kevin Stueve (2009-12-20): initial published version #***************************************************************************** # Copyright (C) 2009 Kevin Stueve kstueve@uw.edu # # Distributed under the terms of the GNU General Public License (GPL) # http://www.gnu.org/licenses/ #***************************************************************************** */ abstract public class Component implements DisplayLabel, Turtle { protected static Map<String, Double> siToValue; public CircuitElm circuitElm; public boolean isHideValue = false; public boolean isHighlight = false; static { setSiToValue(new HashMap<String, Double>()); getSiToValue().put("Y", Math.pow(10, 24)); getSiToValue().put("Z", Math.pow(10, 21)); getSiToValue().put("E", Math.pow(10, 18)); getSiToValue().put("P", Math.pow(10, 15)); getSiToValue().put("T", Math.pow(10, 12)); getSiToValue().put("G", Math.pow(10, 9)); getSiToValue().put("M", Math.pow(10, 6)); getSiToValue().put("k", Math.pow(10, 3)); getSiToValue().put("h", Math.pow(10, 2)); getSiToValue().put("da", Math.pow(10, 1)); getSiToValue().put("", Math.pow(10, 0)); getSiToValue().put("d", Math.pow(10, -1)); getSiToValue().put("c", Math.pow(10, -2)); getSiToValue().put("m", Math.pow(10, -3)); getSiToValue().put("μ", Math.pow(10, -6)); getSiToValue().put("n", Math.pow(10, -9)); getSiToValue().put("p", Math.pow(10, -12)); getSiToValue().put("f", Math.pow(10, -15)); getSiToValue().put("a", Math.pow(10, -18)); getSiToValue().put("z", Math.pow(10, -21)); getSiToValue().put("y", Math.pow(10, -24)); } protected String componentSubscript; protected Color color; protected Terminal headTerminal; protected Terminal tailTerminal; protected String siPrefix = ""; protected static String micro = "\u03BC"; protected static String[] siPrefixes = {"Y", "Z", "E", "P", "T", "G", "M", "k", "", "m", micro, "n", "p", "f", "a", "z", "y"}; protected String primary; protected String secondary; protected String primaryUnit; protected String primaryUnitPlural; protected String primarySymbol; protected String primaryUnitSymbol; protected String secondaryUnitSymbol; protected String preselectedPrimaryPrefix; protected String preselectedFrequencyPrefix; protected String preselectedPhaseShiftPrefix; protected String enteredPrimaryValue; protected String selectedPrimaryPrefix; protected String selectedFrequencyPrefix; protected String selectedPhaseShiftPrefix; protected String frequencySymbol; protected Double primaryValue;//changed to double from Double on Dec 29 2008 protected Double frequency; protected Double phaseShift; protected Double calculatedValue; protected String enteredFrequency; protected String enteredPhaseShift; protected double secondaryValue = 0.0; protected boolean isConstant; protected boolean isHeldConstant; protected String fullValue = ""; protected List<ScopePanel> scopePanels = new ArrayList(); protected Circuit circuit; protected String label; public double y1, yj, zj, k1, k2, k3, k4, k5, k6, I1, y2, y3, originalValue, twoStepValue, oneStepValue, originalCurrent, delta1; public Component(final int x, final int y, Circuit circuit) { this.circuit = circuit; headTerminal = new Terminal(x, y, circuit); tailTerminal = new Terminal(x+1, y+1, circuit); connectHeadAndTail(); } public String getID() { return getPrimarySymbol() + getComponentSubscript(); } //import java.text.DecimalFormat; public static String formatValue(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "Error "; } String sign = ""; if (d == 0.0) { return "0.00 "; } if (d < 0) { sign = "-"; } double absd = Math.abs(d); int p = (int) Math.floor(Math.log(absd) / Math.log(1000)); double mantissa = absd / Math.pow(1000, p); //System.out.println(mantissa+" "+p*3); //System.out.println((-3.5)); DecimalFormat format; if (mantissa < 10) { format = new DecimalFormat("0.00"); //mantissa=((mantissa*100))/100; } else if (mantissa < 100) { format = new DecimalFormat("00.0"); //mantissa=((mantissa*10))/10; } else { format = new DecimalFormat("000"); } if (absd < 10e-24 || absd >= 10e27 || 8 - p < 0 || 8 - p >= getSiPrefixes().length) { return sign + format.format(mantissa) + "E" + 3 * p + ""; } //int i=8-p; return sign + format.format(mantissa) + getSiPrefixes()[8 - p] + ""; } public void moveTail(final int x, final int y) { getTailTerminal().setX(x); getTailTerminal().setY(y); connectHeadAndTail(); } public void setTail(Terminal theTerminal) { disconnectHeadAndTail(); setTailTerminal(theTerminal); connectHeadAndTail(); if(getCircuitElm() != null) { if(this instanceof ControlledSource) { this.circuitElm.x1 = theTerminal.getX(); this.circuitElm.y1 = theTerminal.getY(); } else { this.circuitElm.x2 = theTerminal.getX(); this.circuitElm.y2 = theTerminal.getY(); } this.getCircuitElm().setPoints(); } } public void setHead(Terminal theTerminal) { disconnectHeadAndTail(); setHeadTerminal(theTerminal); connectHeadAndTail(); if(getCircuitElm() != null) { if(this instanceof ControlledSource) { this.circuitElm.x2 = theTerminal.getX(); this.circuitElm.y2 = theTerminal.getY(); } else { this.circuitElm.x1 = theTerminal.getX(); this.circuitElm.y1 = theTerminal.getY(); } this.getCircuitElm().setPoints(); } } public void connectHeadAndTail() { getHeadTerminal().myConnectedTo.add(getTailTerminal()); getTailTerminal().myConnectedTo.add(getHeadTerminal()); getHeadTerminal().in.add(this); getTailTerminal().out.add(this); } public void disconnectHeadAndTail() { getHeadTerminal().myConnectedTo.remove(getTailTerminal()); getTailTerminal().myConnectedTo.remove(getHeadTerminal()); getHeadTerminal().in.remove(this); getTailTerminal().out.remove(this); } public boolean badSize() { return getHeadTerminal().getX() == getTailTerminal().getX() && getHeadTerminal().getY() == getTailTerminal().getY(); } public void draw(ScaledGraphics sg) throws Exception { sg.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if(((this instanceof Wire) && getCircuit().circuitPanel.drawingPanel.isDrawWireLabels) || !(this instanceof Wire)) { drawLabel(sg); } } public double sqr(double x) { return x * x; } public String getDisplayLabel() throws Exception { String text = ""; if(this.circuitElm != null) { text = this.circuitElm.getDisplayLabel(); } else { if (this.getPrimaryValue() != null) { String unit; if (this.getPrimaryValue() == 1) { unit = this.getPrimaryUnitSymbol();//primaryUnit; } else { unit = this.getPrimaryUnitSymbol();//Plural; } text = formatValue(this.getPrimaryValue()) + unit; } else if(this.getLabel() != null) { text = getLabel(); } else { throw new Exception("Empty component label."); } } return text; } public int getLabelDistance() { return 25; } public void drawLabel(ScaledGraphics sg) throws Exception { String text = ""; int distanceFromSymbol = getLabelDistance(); int x1 = this.getHeadTerminal().getX(); int y1 = this.getHeadTerminal().getY(); int x2 = this.getTailTerminal().getX(); int y2 = this.getTailTerminal().getY(); int run = x2 - x1; int rise = y2 - y1; double d = Math.sqrt(sqr(run / 2.0) + sqr(rise / 2.0)); double textYOffset = sg.getScaledTextHeight(getID()); //textYOffset = 10; //todo:tk:font metrics don't seem to be working duirng printing. if (rise * run > 0) { sg.drawString(getID(), (x1 + run / 2.0 + Math.abs(rise) / (2.0 * d) * distanceFromSymbol), (y1 + rise / 2.0 - Math.abs(run) / (2.0 * d) * distanceFromSymbol) ); } else { sg.drawString(getID(), (x1 + run / 2.0 + Math.abs(rise) / 2.0 / d * distanceFromSymbol), (y1 + rise / 2.0 + Math.abs(run) / 2.0 / d * distanceFromSymbol)); } if(getCircuit().circuitPanel.drawingPanel.isDrawComponentValues && isHideValue == false) { text = getDisplayLabel(); if (rise * run > 0) { sg.drawString(text, (x1 + run / 2.0 + Math.abs(rise) / (2.0 * d) * distanceFromSymbol), (y1 + textYOffset + rise / 2.0 - Math.abs(run) / (2.0 * d) * distanceFromSymbol) ); } else { sg.drawString(text, (x1 + run / 2.0 + Math.abs(rise) / 2.0 / d * distanceFromSymbol), (y1 + textYOffset + rise / 2.0 + Math.abs(run) / 2.0 / d * distanceFromSymbol)); } } } public void reverse() { disconnectHeadAndTail(); Terminal oldHead = getHeadTerminal(); this.setHeadTerminal(this.getTailTerminal()); this.setTailTerminal(oldHead); connectHeadAndTail(); } /* g the graphics component. x1 x-position of first point. y1 y-position of first point. x2 x-position of second point. y2 y-position of second point. d the width of the arrow. h the height of the arrow. Obatined from https://stackoverflow.com/questions/2027613/how-to-draw-a-directed-arrow-line-in-java */ public void drawArrowLine(ScaledGraphics sg, double x1, double y1, double x2, double y2, double d, double h) { double dx = x2 - x1; double dy = y2 - y1; double D = Math.sqrt(dx*dx + dy*dy); double xm = D - d; double xn = xm; double ym = h; double yn = -h; double x; double sin = dy / D, cos = dx / D; x = xm*cos - ym*sin + x1; ym = xm*sin + ym*cos + y1; xm = x; x = xn*cos - yn*sin + x1; yn = xn*sin + yn*cos + y1; xn = x; int[] xpoints = {(int) Math.round(x2), (int) Math.round(xm), (int) Math.round(xn)}; int[] ypoints = {(int) Math.round(y2), (int) Math.round(ym), (int) Math.round(yn)}; sg.drawLine(x1, y1, x2, y2); sg.fillPolygon(xpoints, ypoints, 3); } protected void handleAttribute(Stack<String> attributes) throws Exception { if(attributes != null && attributes.size() == 1) { String attribute = attributes.pop(); double value = Double.parseDouble(attribute); setPrimaryValue((Double) value); setEnteredPrimaryValue("" + 1 / getSiToValue().get(getSiPrefix()) * getPrimaryValue()); } else { throw new Exception("Wrong number of attibutes."); } } protected void handleACSourceAttributes(Stack<String> attributes) throws Exception // todo:tk:move into new ACSource class. { if(attributes != null && attributes.size() == 3) { try { String attribute = attributes.pop(); double value = Double.parseDouble(attribute); setPrimaryValue((Double) value); setEnteredPrimaryValue("" + 1 / getSiToValue().get(getSiPrefix()) * getPrimaryValue()); attribute = attributes.pop(); value = Double.parseDouble(attribute); setFrequency((Double) value); setEnteredFrequency("" + getFrequency()); attribute = attributes.pop(); value = Double.parseDouble(attribute); setPhaseShift((Double) value); setEnteredPhaseShift("" + getPhaseShift()); } catch (NumberFormatException nfe) { setPrimaryValue(null); setFrequency(null); setPhaseShift(null); setEnteredPrimaryValue(""); setEnteredFrequency(""); setEnteredPhaseShift(""); throw nfe; } } else { throw new Exception("Wrong number of attibutes."); } } public static Map<String, Double> getSiToValue() { return siToValue; } public static void setSiToValue(Map<String, Double> aSiToValue) { siToValue = aSiToValue; } public CircuitElm getCircuitElm() { return circuitElm; } public void setCircuitElm(CircuitElm circuitElm) { this.circuitElm = circuitElm; } public String getComponentSubscript() { return componentSubscript; } public void setComponentSubscript(String subscript) { this.componentSubscript = subscript; } public Color getColor() { return color; } public void setColor(Color color) { this.color = color; } public Terminal getHeadTerminal() { return headTerminal; } public void setHeadTerminal(Terminal headTerminal) { this.headTerminal = headTerminal; } public Terminal getTailTerminal() { return tailTerminal; } public void setTailTerminal(Terminal tailTerminal) { this.tailTerminal = tailTerminal; } public String getSiPrefix() { return siPrefix; } public void setSiPrefix(String siPrefix) { this.siPrefix = siPrefix; } public static String getMicro() { return micro; } public static void setMicro(String aMicro) { micro = aMicro; } public static String[] getSiPrefixes() { return siPrefixes; } public static void setSiPrefixes(String[] aSiPrefixes) { siPrefixes = aSiPrefixes; } public String getPrimary() { return primary; } public void setPrimary(String primary) { this.primary = primary; } public String getSecondary() { return secondary; } public void setSecondary(String secondary) { this.secondary = secondary; } public String getPrimaryUnit() { return primaryUnit; } public void setPrimaryUnit(String primaryUnit) { this.primaryUnit = primaryUnit; } public String getPrimaryUnitPlural() { return primaryUnitPlural; } public void setPrimaryUnitPlural(String primaryUnitPlural) { this.primaryUnitPlural = primaryUnitPlural; } public String getPrimarySymbol() { return primarySymbol; } public void setPrimarySymbol(String primarySymbol) { this.primarySymbol = primarySymbol; } public String getPrimaryUnitSymbol() { return primaryUnitSymbol; } public void setPrimaryUnitSymbol(String primaryUnitSymbol) { this.primaryUnitSymbol = primaryUnitSymbol; } public String getSecondaryUnitSymbol() { return secondaryUnitSymbol; } public void setSecondaryUnitSymbol(String secondaryUnitSymbol) { this.secondaryUnitSymbol = secondaryUnitSymbol; } public String getPreselectedPrimaryPrefix() { return preselectedPrimaryPrefix; } public void setPreselectedPrimaryPrefix(String preselectedPrimaryPrefix) { this.preselectedPrimaryPrefix = preselectedPrimaryPrefix; } public String getPreselectedFrequencyPrefix() { return preselectedFrequencyPrefix; } public void setPreselectedFrequencyPrefix(String preselectedFrequencyPrefix) { this.preselectedFrequencyPrefix = preselectedFrequencyPrefix; } public String getPreselectedPhaseShiftPrefix() { return preselectedPhaseShiftPrefix; } public void setPreselectedPhaseShiftPrefix(String preselectedPhaseShiftPrefix) { this.preselectedPhaseShiftPrefix = preselectedPhaseShiftPrefix; } public String getEnteredPrimaryValue() { return enteredPrimaryValue; } public void setEnteredPrimaryValue(String enteredPrimaryValue) { this.enteredPrimaryValue = enteredPrimaryValue; } public String getSelectedPrimaryPrefix() { return selectedPrimaryPrefix; } public void setSelectedPrimaryPrefix(String selectedPrimaryPrefix) { this.selectedPrimaryPrefix = selectedPrimaryPrefix; } public String getSelectedFrequencyPrefix() { return selectedFrequencyPrefix; } public void setSelectedFrequencyPrefix(String selectedFrequencyPrefix) { this.selectedFrequencyPrefix = selectedFrequencyPrefix; } public String getSelectedPhaseShiftPrefix() { return selectedPhaseShiftPrefix; } public void setSelectedPhaseShiftPrefix(String selectedPhaseShiftPrefix) { this.selectedPhaseShiftPrefix = selectedPhaseShiftPrefix; } public String getFrequencySymbol() { return frequencySymbol; } public void setFrequencySymbol(String frequencySymbol) { this.frequencySymbol = frequencySymbol; } public Double getPrimaryValue() { return primaryValue; } public void setPrimaryValue(Double primaryValue) { this.primaryValue = primaryValue; } public Double getFrequency() { return frequency; } public void setFrequency(Double frequency) { this.frequency = frequency; } public Double getPhaseShift() { return phaseShift; } public void setPhaseShift(Double phaseShift) { this.phaseShift = phaseShift; } public Double getCalculatedValue() { return calculatedValue; } public void setCalculatedValue(Double calculatedValue) { this.calculatedValue = calculatedValue; } public String getEnteredFrequency() { return enteredFrequency; } public void setEnteredFrequency(String enteredFrequency) { this.enteredFrequency = enteredFrequency; } public String getEnteredPhaseShift() { return enteredPhaseShift; } public void setEnteredPhaseShift(String enteredPhaseShift) { this.enteredPhaseShift = enteredPhaseShift; } public double getSecondaryValue() { return secondaryValue; } public void setSecondaryValue(double secondaryValue) { this.secondaryValue = secondaryValue; } public boolean isIsConstant() { return isConstant; } public void setIsConstant(boolean isConstant) { this.isConstant = isConstant; } public boolean isIsHeldConstant() { return isHeldConstant; } public void setIsHeldConstant(boolean isHeldConstant) { this.isHeldConstant = isHeldConstant; } public String getFullValue() { return fullValue; } public void setFullValue(String fullValue) { this.fullValue = fullValue; } public List<ScopePanel> getScopePanels() { return scopePanels; } public void addScopePanel(ScopePanel scopePanel) { this.scopePanels.add(scopePanel); circuit.circuitPanel.scopesPanel.add(scopePanel); circuit.circuitPanel.scopesPanel.invalidate(); circuit.circuitPanel.scopesPanel.revalidate(); circuit.circuitPanel.scopesPanel.repaint(); } public void deleteScopePanel(ScopePanel scopePanel) { scopePanels.remove(scopePanel); circuit.circuitPanel.scopesPanel.remove(scopePanel); circuit.circuitPanel.scopesPanel.invalidate(); circuit.circuitPanel.scopesPanel.revalidate(); circuit.circuitPanel.scopesPanel.repaint(); } public void deleteScopePanels() { scopePanels.clear(); circuit.circuitPanel.scopesPanel.removeAll(); circuit.circuitPanel.scopesPanel.invalidate(); circuit.circuitPanel.scopesPanel.revalidate(); circuit.circuitPanel.scopesPanel.repaint(); } public Circuit getCircuit() { return circuit; } public void setCircuit(Circuit circuit) { this.circuit = circuit; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getInfo() { StringBuilder sb = new StringBuilder(); if(this.getCircuitElm() != null) { CircuitElm cirElm = this.getCircuitElm(); String info[] = new String[10]; cirElm.getInfo(info); for (int index = 0; info[index] != null; index++) { sb.append(info[index]); sb.append("\n"); } } else { sb.append(""); } return sb.toString().trim(); } public String getTurtle() { StringBuilder sb = new StringBuilder(); sb.append(Circuit.turtleIndent + "cp:type \"" + getClass().getSimpleName() + "\" ;"); sb.append(Circuit.turtleIndent + "cp:subscript \"" + getComponentSubscript() + "\" ;"); sb.append(Circuit.turtleIndent + "cp:terminal \"" + headTerminal.getID() + "\" ;"); sb.append(Circuit.turtleIndent + "cp:terminal \"" + tailTerminal.getID() + "\" ;"); return sb.toString(); } public String toString() { return this.getClass().getSimpleName() + "_" + getComponentSubscript() + " " + this.getHeadTerminal().getX() + " " + this.getHeadTerminal().getY()+ " " + this.getTailTerminal().getX() + " " + this.getTailTerminal().getY(); } }
[ "Brumous101@gmail.com" ]
Brumous101@gmail.com
7a5eff64617307a3dc27e46e7110a753067d4a19
06e668fd576487bad70f6c14b54d7a3152a2a654
/Athus/src/java/Telas/Acesso.java
043c056ff34f1b697f468ac8d3a5d4e6c407b55d
[]
no_license
danielxxaraujo/Athus-ei
807af77f532349ad1a2462d31c587e9652379cee
220f3c3417f46b73343afdc616ade3cf2bb9909a
refs/heads/master
2021-01-13T04:00:01.158662
2017-01-05T16:29:47
2017-01-05T16:29:47
78,120,309
0
0
null
null
null
null
UTF-8
Java
false
false
4,026
java
package Telas; import Dados.Sistema; import Dados.Usuario; import Negocios.NMenu; import Negocios.NSistema; import Negocios.NUsuario; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet(name = "Acesso", urlPatterns = {"/Acesso"}) public class Acesso extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try{ HttpSession session = request.getSession(); if (session.getAttribute("matricula") == null){ response.sendRedirect("TUsuario"); } else { Usuario usuarioAtivo = new NUsuario().ConsultarMatricula(session.getAttribute("matricula").toString()); List<Sistema> sistemas = new NSistema().Listar(); out.println(new NMenu().Cabecalho(usuarioAtivo)); out.println("<table border=0 width=100%>"); out.println(" <tr>"); int linha = 0; for (int x = 0; x < sistemas.size(); x++){ out.println("<td style='text-align: center;'>" + "<a href='"+ sistemas.get(x).getHRef() +"'>" + "<img src='"+ sistemas.get(x).getImagem()+"' width='"+ sistemas.get(x).getWidth1()+"' height='"+ sistemas.get(x).getHeight1()+"' ><br>" + "<img src='"+ sistemas.get(x).getTitulo()+"' width='"+ sistemas.get(x).getWidth2()+"' height='"+ sistemas.get(x).getHeight2()+"' >" + "</a></td>"); linha ++; if (linha >= 5){ out.println("</tr><tr>"); linha = 0; } } out.println(" </tr>"); out.println("</table>"); out.println(new NMenu().RodaPe()); } } catch (Exception e){ out.println("<DIV>"+ e +"</DIV>"); } finally { out.close(); } } // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "danielxxaraujo@gmail.com" ]
danielxxaraujo@gmail.com
d839b1eda5c52df3b5203d4bd9426b32fa933962
33024b755c9ebf08f2ef6aecef51f23ce7c82b16
/src/factory_method_pattern/pizzas/Pizza.java
63b0f247d69765402ee4c7ebc4d77a9adc08c0d1
[]
no_license
h4rib0/FactoryPattern
2ad4a855c270e6f5a2d858a8f3453683d6b0decd
38265a3b0046eed25d861a7933e948494c083c90
refs/heads/master
2021-01-10T11:00:48.030679
2015-11-18T21:41:17
2015-11-18T21:41:17
46,443,852
0
0
null
null
null
null
UTF-8
Java
false
false
1,292
java
package factory_method_pattern.pizzas; import java.util.ArrayList; public abstract class Pizza { public String name; public String dough; public String sauce; public ArrayList toppings = new ArrayList(); public void prepare() { System.out.println("Preparing " + name); System.out.println("Tossing dough..."); System.out.println("Adding sauce..."); System.out.println("Adding toppings: "); for (int i = 0; i < toppings.size(); i++) { System.out.println(" " + toppings.get(i)); } } public void bake() { System.out.println("Bake for 25 minutes at 350"); } public void cut() { System.out.println("Cutting the pizza into diagonal slices"); } public void box() { System.out.println("Place pizza in official PizzaStore box"); } public String getName() { return name; } public String toString() { StringBuffer display = new StringBuffer(); display.append("---- " + name + " ----\n"); display.append(dough + "\n"); display.append(sauce + "\n"); for (int i = 0; i < toppings.size(); i++) { display.append(toppings.get(i) + "\n"); } return display.toString(); } }
[ "github@haraldwolz.de" ]
github@haraldwolz.de
11fb80925c36d76d2d26cda123a35ab2d39c1827
262ac424474d757d0856c203ec6285d40bceec71
/src/com/aus/common/util/CreateRtfToPdf.java
bf232342a72280b838ddce392a82d0fac9b3a869
[]
no_license
nicho/MSS
ab01357715224b8d91639dd3d3ed11942a373050
7736ea5ea48cc425485f2d7debc988ec4c45f7bb
refs/heads/master
2021-05-08T08:08:36.985749
2017-10-15T05:13:42
2017-10-15T05:13:42
106,985,197
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.aus.common.util; import java.util.Map; public class CreateRtfToPdf { public static void rtfToPdf(Map<String, Object> contextMap, String address1, String address2) { try { RTFGenerator generator = new RTFGenerator(); generator.setContextMap(contextMap); generator.run(CreateRtfToPdf.class.getResource(address1).getPath(), address2); } catch (Exception e) { e.printStackTrace(); } } }
[ "Administrator@CK8K5SWQNI4JQQU" ]
Administrator@CK8K5SWQNI4JQQU
f6696095eecf570b961517cd48f746904b7ed475
0e3a1e815919b9a7fc81e4e765c61f83277ae1b6
/gulimall-ware/src/main/java/com/wgl/gulimall/ware/controller/WareSkuController.java
666c72039c74a5472103084f6fa759bd0545fd94
[ "Apache-2.0" ]
permissive
JayMeWangGL/gulimall
2e6bd31058f544d56b2c5e5da37afe18fb9d48c9
8ae829f6685e0b3d9766507ec67d035a6a508c4a
refs/heads/master
2023-01-20T21:55:23.224467
2020-11-23T06:42:14
2020-11-23T06:42:14
314,486,700
0
0
null
null
null
null
UTF-8
Java
false
false
2,199
java
package com.wgl.gulimall.ware.controller; import java.util.Arrays; import java.util.Map; //import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.wgl.gulimall.ware.entity.WareSkuEntity; import com.wgl.gulimall.ware.service.WareSkuService; import com.wgl.common.utils.PageUtils; import com.wgl.common.utils.R; /** * 商品库存 * * @author wangguoli * @email wangguoli@gmail.com * @date 2020-11-23 14:34:06 */ @RestController @RequestMapping("ware/waresku") public class WareSkuController { @Autowired private WareSkuService wareSkuService; /** * 列表 */ @RequestMapping("/list") //@RequiresPermissions("ware:waresku:list") public R list(@RequestParam Map<String, Object> params){ PageUtils page = wareSkuService.queryPage(params); return R.ok().put("page", page); } /** * 信息 */ @RequestMapping("/info/{id}") //@RequiresPermissions("ware:waresku:info") public R info(@PathVariable("id") Long id){ WareSkuEntity wareSku = wareSkuService.getById(id); return R.ok().put("wareSku", wareSku); } /** * 保存 */ @RequestMapping("/save") //@RequiresPermissions("ware:waresku:save") public R save(@RequestBody WareSkuEntity wareSku){ wareSkuService.save(wareSku); return R.ok(); } /** * 修改 */ @RequestMapping("/update") //@RequiresPermissions("ware:waresku:update") public R update(@RequestBody WareSkuEntity wareSku){ wareSkuService.updateById(wareSku); return R.ok(); } /** * 删除 */ @RequestMapping("/delete") //@RequiresPermissions("ware:waresku:delete") public R delete(@RequestBody Long[] ids){ wareSkuService.removeByIds(Arrays.asList(ids)); return R.ok(); } }
[ "910792937@qq.com" ]
910792937@qq.com
96a5b5567c4520883d5b14b653d6b01cb32f9264
e99b64391ba4876f409e4745637f5d85aec483e2
/android_framework/services/src/main/java/github/tornaco/android/thanos/services/app/view/ShowCurrentComponentViewR.java
9062625154fdbbb8be88eb46e5a3e259be650128
[]
no_license
511xy/Thanox
0a05a89b442ef041bd2189275a04e8b35ff66d93
e12b3bae4cefc193441ceabb632999807eebaaa9
refs/heads/master
2020-09-27T21:13:50.053676
2019-12-08T02:08:40
2019-12-08T02:08:40
226,610,955
1
0
null
2019-12-08T03:51:48
2019-12-08T03:51:47
null
UTF-8
Java
false
false
550
java
package github.tornaco.android.thanos.services.app.view; import android.content.ComponentName; import github.tornaco.android.thanos.core.util.AbstractSafeR; import lombok.Setter; public class ShowCurrentComponentViewR extends AbstractSafeR { @Setter private ComponentName name; @Setter private CurrentComponentView view; @Override public void runSafety() { if (name != null && view != null) { view.attach(); view.show(); view.setText(name.flattenToString()); } } }
[ "tornaco@163.com" ]
tornaco@163.com
09d32b6aae608ba9b94dfb8490d5b2d1aa34b987
d4c50d8fe5f08c51044cfaab16079819d3fcbc4f
/app/src/main/java/com/example/mobiapp/instaapp/retrofit/classes/AllPosts.java
7811fd82a085047fea4a4e0fd59c6af3853e2fc5
[]
no_license
koverko-developer/InstaApp
4410baf4ac19c373551094cf3579cb46282e9abc
35d62398aadc8916302d61e399ca1ccd0798ef84
refs/heads/master
2021-06-23T03:43:01.700566
2017-09-04T16:19:07
2017-09-04T16:19:07
102,380,295
0
0
null
null
null
null
UTF-8
Java
false
false
909
java
package com.example.mobiapp.instaapp.retrofit.classes; /** * Created by mobi app on 04.09.2017. */ import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import java.util.List; public class AllPosts { @SerializedName("pagination") @Expose private Pagination pagination; @SerializedName("data") @Expose private List<Datum> data = null; @SerializedName("meta") @Expose private Meta meta; public Pagination getPagination() { return pagination; } public void setPagination(Pagination pagination) { this.pagination = pagination; } public List<Datum> getData() { return data; } public void setData(List<Datum> data) { this.data = data; } public Meta getMeta() { return meta; } public void setMeta(Meta meta) { this.meta = meta; } }
[ "kow" ]
kow
d48e2014bc509501de5abe551c9c65a227d34e1d
a5e6559825bb0417c24d9a26438853099067a130
/PullToRefreshLib/build/generated/source/r/androidTest/debug/com/handmark/pulltorefresh/library/test/R.java
f6e2dd6021615abbe1b110d3c0ba030f870053ff
[]
no_license
fish19920404/defaultDevSample
2a773adf3afde359d06fc78b0382f55e513c730b
638db3b502382f86a224c7d3b4359e19f141023c
refs/heads/master
2021-07-10T15:28:34.228070
2017-10-09T10:43:09
2017-10-09T10:43:09
106,267,447
1
0
null
null
null
null
UTF-8
Java
false
false
32,839
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.handmark.pulltorefresh.library.test; public final class R { public static final class anim { public static final int slide_in_from_bottom=0x7f040000; public static final int slide_in_from_top=0x7f040001; public static final int slide_out_to_bottom=0x7f040002; public static final int slide_out_to_top=0x7f040003; } public static final class attr { /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int loadingText=0x7f010000; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int loadingTextAppearance=0x7f010001; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int ptrAdapterViewBackground=0x7f010012; /** <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>rotate</code></td><td>0x0</td><td></td></tr> <tr><td><code>flip</code></td><td>0x1</td><td></td></tr> <tr><td><code>custom</code></td><td>0x2</td><td></td></tr> </table> */ public static final int ptrAnimationStyle=0x7f01000e; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrDrawable=0x7f010008; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrDrawableBottom=0x7f010014; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrDrawableEnd=0x7f01000a; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrDrawableStart=0x7f010009; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrDrawableTop=0x7f010013; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int ptrHeaderBackground=0x7f010003; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int ptrHeaderSubTextColor=0x7f010005; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrHeaderTextAppearance=0x7f01000c; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int ptrHeaderTextColor=0x7f010004; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int ptrListViewExtrasEnabled=0x7f010010; /** <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>disabled</code></td><td>0x0</td><td></td></tr> <tr><td><code>pullFromStart</code></td><td>0x1</td><td></td></tr> <tr><td><code>pullFromEnd</code></td><td>0x2</td><td></td></tr> <tr><td><code>both</code></td><td>0x3</td><td></td></tr> <tr><td><code>manualOnly</code></td><td>0x4</td><td></td></tr> <tr><td><code>pullDownFromTop</code></td><td>0x1</td><td></td></tr> <tr><td><code>pullUpFromBottom</code></td><td>0x2</td><td></td></tr> </table> */ public static final int ptrMode=0x7f010006; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int ptrOverScroll=0x7f01000b; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int ptrRefreshableViewBackground=0x7f010002; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int ptrRotateDrawableWhilePulling=0x7f010011; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int ptrScrollingWhileRefreshingEnabled=0x7f01000f; /** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int ptrShowIndicator=0x7f010007; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int ptrSubHeaderTextAppearance=0x7f01000d; } public static final class color { public static final int circle=0x7f060000; public static final int dialog_bg=0x7f060001; public static final int rect=0x7f060002; public static final int shadow=0x7f060003; public static final int triangle=0x7f060004; public static final int view_bg=0x7f060005; } public static final class dimen { public static final int header_footer_left_right_padding=0x7f070000; public static final int header_footer_top_bottom_padding=0x7f070001; public static final int indicator_corner_radius=0x7f070002; public static final int indicator_internal_padding=0x7f070003; public static final int indicator_right_padding=0x7f070004; } public static final class drawable { public static final int aa_dialog_bg=0x7f020000; public static final int about_logo=0x7f020001; public static final int default_ptr_flip=0x7f020002; public static final int default_ptr_rotate=0x7f020003; public static final int ic_loading_progress_pull=0x7f020004; public static final int ic_slogan=0x7f020005; public static final int indicator_arrow=0x7f020006; public static final int indicator_bg_bottom=0x7f020007; public static final int indicator_bg_top=0x7f020008; public static final int loading_icon=0x7f020009; public static final int ptr_progress_bar=0x7f02000a; public static final int pull_to_refresh_gold=0x7f02000b; public static final int shadow=0x7f02000c; } public static final class id { public static final int both=0x7f080003; public static final int custom=0x7f08000a; public static final int disabled=0x7f080004; public static final int fl_inner=0x7f080011; public static final int flip=0x7f08000b; public static final int gridview=0x7f080000; public static final int indication=0x7f08000d; public static final int loadView=0x7f080010; public static final int manualOnly=0x7f080005; public static final int promptTV=0x7f08000e; public static final int pullDownFromTop=0x7f080006; public static final int pullFromEnd=0x7f080007; public static final int pullFromStart=0x7f080008; public static final int pullUpFromBottom=0x7f080009; public static final int pull_to_refresh_image=0x7f080012; public static final int pull_to_refresh_progress=0x7f080013; public static final int pull_to_refresh_sub_text=0x7f080015; public static final int pull_to_refresh_text=0x7f080014; public static final int rotate=0x7f08000c; public static final int scrollview=0x7f080001; public static final int shapeLoadingView=0x7f08000f; public static final int webview=0x7f080002; } public static final class layout { public static final int image_load_view=0x7f030000; public static final int layout_dialog=0x7f030001; public static final int load_view=0x7f030002; public static final int pull_to_refresh_header_horizontal=0x7f030003; public static final int pull_to_refresh_header_vertical=0x7f030004; } public static final class string { public static final int pull_to_refresh_from_bottom_pull_label=0x7f050003; public static final int pull_to_refresh_from_bottom_refreshing_label=0x7f050004; public static final int pull_to_refresh_from_bottom_release_label=0x7f050005; public static final int pull_to_refresh_pull_label=0x7f050000; public static final int pull_to_refresh_refreshing_label=0x7f050001; public static final int pull_to_refresh_release_label=0x7f050002; } public static final class style { public static final int custom_dialog=0x7f090000; } public static final class styleable { /** Attributes that can be used with a LoadingView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #LoadingView_loadingText com.handmark.pulltorefresh.library.test:loadingText}</code></td><td></td></tr> <tr><td><code>{@link #LoadingView_loadingTextAppearance com.handmark.pulltorefresh.library.test:loadingTextAppearance}</code></td><td></td></tr> </table> @see #LoadingView_loadingText @see #LoadingView_loadingTextAppearance */ public static final int[] LoadingView = { 0x7f010000, 0x7f010001 }; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#loadingText} attribute's value can be found in the {@link #LoadingView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.handmark.pulltorefresh.library.test:loadingText */ public static final int LoadingView_loadingText = 0; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#loadingTextAppearance} attribute's value can be found in the {@link #LoadingView} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:loadingTextAppearance */ public static final int LoadingView_loadingTextAppearance = 1; /** Attributes that can be used with a PullToRefresh. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #PullToRefresh_ptrAdapterViewBackground com.handmark.pulltorefresh.library.test:ptrAdapterViewBackground}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrAnimationStyle com.handmark.pulltorefresh.library.test:ptrAnimationStyle}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrDrawable com.handmark.pulltorefresh.library.test:ptrDrawable}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrDrawableBottom com.handmark.pulltorefresh.library.test:ptrDrawableBottom}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrDrawableEnd com.handmark.pulltorefresh.library.test:ptrDrawableEnd}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrDrawableStart com.handmark.pulltorefresh.library.test:ptrDrawableStart}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrDrawableTop com.handmark.pulltorefresh.library.test:ptrDrawableTop}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrHeaderBackground com.handmark.pulltorefresh.library.test:ptrHeaderBackground}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrHeaderSubTextColor com.handmark.pulltorefresh.library.test:ptrHeaderSubTextColor}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrHeaderTextAppearance com.handmark.pulltorefresh.library.test:ptrHeaderTextAppearance}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrHeaderTextColor com.handmark.pulltorefresh.library.test:ptrHeaderTextColor}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrListViewExtrasEnabled com.handmark.pulltorefresh.library.test:ptrListViewExtrasEnabled}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrMode com.handmark.pulltorefresh.library.test:ptrMode}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrOverScroll com.handmark.pulltorefresh.library.test:ptrOverScroll}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrRefreshableViewBackground com.handmark.pulltorefresh.library.test:ptrRefreshableViewBackground}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrRotateDrawableWhilePulling com.handmark.pulltorefresh.library.test:ptrRotateDrawableWhilePulling}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrScrollingWhileRefreshingEnabled com.handmark.pulltorefresh.library.test:ptrScrollingWhileRefreshingEnabled}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrShowIndicator com.handmark.pulltorefresh.library.test:ptrShowIndicator}</code></td><td></td></tr> <tr><td><code>{@link #PullToRefresh_ptrSubHeaderTextAppearance com.handmark.pulltorefresh.library.test:ptrSubHeaderTextAppearance}</code></td><td></td></tr> </table> @see #PullToRefresh_ptrAdapterViewBackground @see #PullToRefresh_ptrAnimationStyle @see #PullToRefresh_ptrDrawable @see #PullToRefresh_ptrDrawableBottom @see #PullToRefresh_ptrDrawableEnd @see #PullToRefresh_ptrDrawableStart @see #PullToRefresh_ptrDrawableTop @see #PullToRefresh_ptrHeaderBackground @see #PullToRefresh_ptrHeaderSubTextColor @see #PullToRefresh_ptrHeaderTextAppearance @see #PullToRefresh_ptrHeaderTextColor @see #PullToRefresh_ptrListViewExtrasEnabled @see #PullToRefresh_ptrMode @see #PullToRefresh_ptrOverScroll @see #PullToRefresh_ptrRefreshableViewBackground @see #PullToRefresh_ptrRotateDrawableWhilePulling @see #PullToRefresh_ptrScrollingWhileRefreshingEnabled @see #PullToRefresh_ptrShowIndicator @see #PullToRefresh_ptrSubHeaderTextAppearance */ public static final int[] PullToRefresh = { 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014 }; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrAdapterViewBackground} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrAdapterViewBackground */ public static final int PullToRefresh_ptrAdapterViewBackground = 16; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrAnimationStyle} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>rotate</code></td><td>0x0</td><td></td></tr> <tr><td><code>flip</code></td><td>0x1</td><td></td></tr> <tr><td><code>custom</code></td><td>0x2</td><td></td></tr> </table> @attr name com.handmark.pulltorefresh.library.test:ptrAnimationStyle */ public static final int PullToRefresh_ptrAnimationStyle = 12; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrDrawable} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrDrawable */ public static final int PullToRefresh_ptrDrawable = 6; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrDrawableBottom} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrDrawableBottom */ public static final int PullToRefresh_ptrDrawableBottom = 18; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrDrawableEnd} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrDrawableEnd */ public static final int PullToRefresh_ptrDrawableEnd = 8; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrDrawableStart} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrDrawableStart */ public static final int PullToRefresh_ptrDrawableStart = 7; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrDrawableTop} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrDrawableTop */ public static final int PullToRefresh_ptrDrawableTop = 17; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrHeaderBackground} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrHeaderBackground */ public static final int PullToRefresh_ptrHeaderBackground = 1; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrHeaderSubTextColor} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrHeaderSubTextColor */ public static final int PullToRefresh_ptrHeaderSubTextColor = 3; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrHeaderTextAppearance} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrHeaderTextAppearance */ public static final int PullToRefresh_ptrHeaderTextAppearance = 10; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrHeaderTextColor} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrHeaderTextColor */ public static final int PullToRefresh_ptrHeaderTextColor = 2; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrListViewExtrasEnabled} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". @attr name com.handmark.pulltorefresh.library.test:ptrListViewExtrasEnabled */ public static final int PullToRefresh_ptrListViewExtrasEnabled = 14; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrMode} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>disabled</code></td><td>0x0</td><td></td></tr> <tr><td><code>pullFromStart</code></td><td>0x1</td><td></td></tr> <tr><td><code>pullFromEnd</code></td><td>0x2</td><td></td></tr> <tr><td><code>both</code></td><td>0x3</td><td></td></tr> <tr><td><code>manualOnly</code></td><td>0x4</td><td></td></tr> <tr><td><code>pullDownFromTop</code></td><td>0x1</td><td></td></tr> <tr><td><code>pullUpFromBottom</code></td><td>0x2</td><td></td></tr> </table> @attr name com.handmark.pulltorefresh.library.test:ptrMode */ public static final int PullToRefresh_ptrMode = 4; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrOverScroll} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". @attr name com.handmark.pulltorefresh.library.test:ptrOverScroll */ public static final int PullToRefresh_ptrOverScroll = 9; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrRefreshableViewBackground} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrRefreshableViewBackground */ public static final int PullToRefresh_ptrRefreshableViewBackground = 0; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrRotateDrawableWhilePulling} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". @attr name com.handmark.pulltorefresh.library.test:ptrRotateDrawableWhilePulling */ public static final int PullToRefresh_ptrRotateDrawableWhilePulling = 15; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrScrollingWhileRefreshingEnabled} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". @attr name com.handmark.pulltorefresh.library.test:ptrScrollingWhileRefreshingEnabled */ public static final int PullToRefresh_ptrScrollingWhileRefreshingEnabled = 13; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrShowIndicator} attribute's value can be found in the {@link #PullToRefresh} array. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". @attr name com.handmark.pulltorefresh.library.test:ptrShowIndicator */ public static final int PullToRefresh_ptrShowIndicator = 5; /** <p>This symbol is the offset where the {@link com.handmark.pulltorefresh.library.test.R.attr#ptrSubHeaderTextAppearance} attribute's value can be found in the {@link #PullToRefresh} array. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". @attr name com.handmark.pulltorefresh.library.test:ptrSubHeaderTextAppearance */ public static final int PullToRefresh_ptrSubHeaderTextAppearance = 11; }; }
[ "136687211@qq.com" ]
136687211@qq.com
a8bd84670f24035f9674bcd08a2488395305b280
6881a41152de57cf81467a80064409b04290ea19
/commons/src/main/java/com/base/commons/exceptions/ApiException.java
a5ca65091f346ef7e092ec7cc0a4b282416d1ae1
[]
no_license
premsudheep/java-base-modules
b16832621f4ca94af0dd6c94446fc8f03e67d99b
3d5361f3e0f829ac64ccd2406027e020bd002445
refs/heads/master
2023-03-28T06:37:26.716200
2021-03-26T09:39:47
2021-03-26T09:39:47
351,728,344
0
0
null
null
null
null
UTF-8
Java
false
false
1,278
java
package com.base.commons.exceptions; import com.base.commons.model.exception.Status; public class ApiException extends Exception { private Status status; public ApiException(Status status) { this.status = status; } public ApiException(String message, Status status) { super(message); this.status = status; } public ApiException(String message, Throwable cause, Status status) { super(message, cause); this.status = status; } public ApiException(Throwable cause, Status status) { super(cause); this.status = status; } public ApiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Status status) { super(message, cause, enableSuppression, writableStackTrace); this.status = status; } public ApiException(Status status , String errorMessage) { super(errorMessage); this.status = status; } public ApiException(Status status , String errorMessage, Throwable cause) { super(errorMessage, cause); this.status = status; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } }
[ "premsudheepramanadham@Prems-MacBook-Pro.local" ]
premsudheepramanadham@Prems-MacBook-Pro.local
34fcd08fc1554d19fd89579fd9e02355d6c34dda
af1a2e98536696ed6c3d43ee6a0a169fc91c470e
/app/src/main/java/com/amplifyframework/datastore/generated/model/Photos.java
7227a809625576dc3e43931b02b6afbe90bb36ce
[]
no_license
Jperzval/Amp_Photo
25cf90b03c33d17989bd74c34d56e85795ac2d5e
d2dd035ad032dcdf9836fa4e3f0ddd06cf4ea771
refs/heads/main
2023-04-24T01:41:52.791086
2021-05-18T17:41:46
2021-05-18T17:41:46
362,565,682
1
2
null
2021-05-18T17:41:47
2021-04-28T18:14:37
Java
UTF-8
Java
false
false
6,916
java
package com.amplifyframework.datastore.generated.model; import java.util.List; import java.util.UUID; import java.util.Objects; import androidx.core.util.ObjectsCompat; import com.amplifyframework.core.model.Model; import com.amplifyframework.core.model.annotations.Index; import com.amplifyframework.core.model.annotations.ModelConfig; import com.amplifyframework.core.model.annotations.ModelField; import com.amplifyframework.core.model.query.predicate.QueryField; import static com.amplifyframework.core.model.query.predicate.QueryField.field; /** This is an auto generated class representing the Photos type in your schema. */ @SuppressWarnings("all") @ModelConfig(pluralName = "Photos") @Index(name = "byUser", fields = {"userID"}) public final class Photos implements Model { public static final QueryField ID = field("Photos", "id"); public static final QueryField PRIORITY = field("Photos", "priority"); public static final QueryField TITLE = field("Photos", "title"); public static final QueryField USER_ID = field("Photos", "userID"); private final @ModelField(targetType="ID", isRequired = true) String id; private final @ModelField(targetType="Priority") Priority priority; private final @ModelField(targetType="String", isRequired = true) String title; private final @ModelField(targetType="ID", isRequired = true) String userID; public String getId() { return id; } public Priority getPriority() { return priority; } public String getTitle() { return title; } public String getUserId() { return userID; } private Photos(String id, Priority priority, String title, String userID) { this.id = id; this.priority = priority; this.title = title; this.userID = userID; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if(obj == null || getClass() != obj.getClass()) { return false; } else { Photos photos = (Photos) obj; return ObjectsCompat.equals(getId(), photos.getId()) && ObjectsCompat.equals(getPriority(), photos.getPriority()) && ObjectsCompat.equals(getTitle(), photos.getTitle()) && ObjectsCompat.equals(getUserId(), photos.getUserId()); } } @Override public int hashCode() { return new StringBuilder() .append(getId()) .append(getPriority()) .append(getTitle()) .append(getUserId()) .toString() .hashCode(); } @Override public String toString() { return new StringBuilder() .append("Photos {") .append("id=" + String.valueOf(getId()) + ", ") .append("priority=" + String.valueOf(getPriority()) + ", ") .append("title=" + String.valueOf(getTitle()) + ", ") .append("userID=" + String.valueOf(getUserId())) .append("}") .toString(); } public static TitleStep builder() { return new Builder(); } /** * WARNING: This method should not be used to build an instance of this object for a CREATE mutation. * This is a convenience method to return an instance of the object with only its ID populated * to be used in the context of a parameter in a delete mutation or referencing a foreign key * in a relationship. * @param id the id of the existing item this instance will represent * @return an instance of this model with only ID populated * @throws IllegalArgumentException Checks that ID is in the proper format */ public static Photos justId(String id) { try { UUID.fromString(id); // Check that ID is in the UUID format - if not an exception is thrown } catch (Exception exception) { throw new IllegalArgumentException( "Model IDs must be unique in the format of UUID. This method is for creating instances " + "of an existing object with only its ID field for sending as a mutation parameter. When " + "creating a new object, use the standard builder method and leave the ID field blank." ); } return new Photos( id, null, null, null ); } public CopyOfBuilder copyOfBuilder() { return new CopyOfBuilder(id, priority, title, userID); } public interface TitleStep { UserIdStep title(String title); } public interface UserIdStep { BuildStep userId(String userId); } public interface BuildStep { Photos build(); BuildStep id(String id) throws IllegalArgumentException; BuildStep priority(Priority priority); } public static class Builder implements TitleStep, UserIdStep, BuildStep { private String id; private String title; private String userID; private Priority priority; @Override public Photos build() { String id = this.id != null ? this.id : UUID.randomUUID().toString(); return new Photos( id, priority, title, userID); } @Override public UserIdStep title(String title) { Objects.requireNonNull(title); this.title = title; return this; } @Override public BuildStep userId(String userId) { Objects.requireNonNull(userId); this.userID = userId; return this; } @Override public BuildStep priority(Priority priority) { this.priority = priority; return this; } /** * WARNING: Do not set ID when creating a new object. Leave this blank and one will be auto generated for you. * This should only be set when referring to an already existing object. * @param id id * @return Current Builder instance, for fluent method chaining * @throws IllegalArgumentException Checks that ID is in the proper format */ public BuildStep id(String id) throws IllegalArgumentException { this.id = id; try { UUID.fromString(id); // Check that ID is in the UUID format - if not an exception is thrown } catch (Exception exception) { throw new IllegalArgumentException("Model IDs must be unique in the format of UUID.", exception); } return this; } } public final class CopyOfBuilder extends Builder { private CopyOfBuilder(String id, Priority priority, String title, String userId) { super.id(id); super.title(title) .userId(userId) .priority(priority); } @Override public CopyOfBuilder title(String title) { return (CopyOfBuilder) super.title(title); } @Override public CopyOfBuilder userId(String userId) { return (CopyOfBuilder) super.userId(userId); } @Override public CopyOfBuilder priority(Priority priority) { return (CopyOfBuilder) super.priority(priority); } } }
[ "greggnicholas@pursuit.org" ]
greggnicholas@pursuit.org
50cb3701010a6ab50f348d4db06150f58c65c72d
2958df3f24ae8a8667394b6ebb083ba6a9a1d36a
/Universal08Cloud/src/br/UFSC/GRIMA/capp/AgrupadorDeWorkingSteps.java
3d48255304c32a1c5b08bb355214eb06f056b40c
[]
no_license
igorbeninca/utevolux
27ac6af9a6d03f21d815c057f18524717b3d1c4d
3f602d9cf9f58d424c3ea458346a033724c9c912
refs/heads/master
2021-01-19T02:50:04.157218
2017-10-13T16:19:41
2017-10-13T16:19:41
51,842,805
0
0
null
null
null
null
UTF-8
Java
false
false
6,179
java
package br.UFSC.GRIMA.capp; import java.util.Vector; import br.UFSC.GRIMA.entidades.features.Feature; public class AgrupadorDeWorkingSteps { public Vector workingsteps; // vetor de ws de uma face *******??????? public Vector grupos = new Vector(); public AgrupadorDeWorkingSteps(Vector vetorWorkingstep) { this.workingsteps = vetorWorkingstep; this.grupos = this.agrupar(); this.imprimirDados(); } /** * * @param workingStepsDoBloco -> vetor de vetores das workinSteps de cada uma das faces * @return -> Vetor de vetores agrupados por camadas */ /*public Vector agruparCamadas(Vector workingStepsDoBloco) { Vector saida = new Vector(); for(int pointIndex = 0; pointIndex < workingStepsDoBloco.size(); pointIndex++) { Vector workingStepsFaceTmp = (Vector)workingStepsDoBloco.elementAt(pointIndex); Vector camadas = this.agruparPorCamadas(workingStepsFaceTmp); saida.add(camadas); } return saida; }*/ public Vector agrupar() { Vector saida = new Vector(); for (int i= 0; i < this.workingsteps.size(); i++) { Vector vTmp = (Vector)this.workingsteps.elementAt(i);//vetor de ws de uma face //System.out.println("Face------>>>" + new Face(pointIndex).getTipoString()); //saida.add(this.agruparFace(vTmp)); saida.add(this.agruparPorCamadas(vTmp)); } return saida; } /** * * @param vetorFace Vetor de Workingsteps de uma face * @return */ public Vector agruparFace(Vector vetorFace){ Vector saida = new Vector(); Vector tmp = new Vector(); for(int i = 0; i < vetorFace.size(); i++){ Workingstep wsTmp = (Workingstep)vetorFace.elementAt(i); Feature fTmp = (Feature)wsTmp.getFeature(); //System.out.println(fTmp.getDados()); --------> } //System.out.println("********** Workingsteps (Tamanho do vetor WS): " + vetorFace.size() + " ***********"); boolean terminou = false; while(!terminou){ /*for(vetorFace){ *procurar ws cuja br.UFSC.GRIMA.feature nao possui mae e nem anteriores -> garante q a br.UFSC.GRIMA.feature tem z == 0 * para cada ws encontrado deve-se criar um grupo de workingsteps * if(nao tem mae e naum tem anteriores){ * for(vetorFace){ * if(wstemp2.feature.getmae == wstmp.feature){ * adiciona o workingstep no grupo de workingsteps como filha * } * } * } * } */ for (int i = 0; i < vetorFace.size(); i++) { Workingstep wTmp = (Workingstep)vetorFace.elementAt(i); Feature fTmp = wTmp.getFeature(); if (fTmp.featureMae == null && fTmp.featuresAnteriores == null)//isto garante que esta em Z = 0 { GrupoDeWorkingSteps gws = new GrupoDeWorkingSteps(); gws.maes.add(wTmp); for (int j = 0; j < vetorFace.size(); j ++) { Workingstep wTmp2 = (Workingstep)vetorFace.elementAt(j); Feature fTmp2 = wTmp2.getFeature(); //System.out.println("%%%%%%%%%%" + fTmp2.featureMae); if(fTmp2.featureMae != null){ if(fTmp2.featureMae.equals(fTmp)) { gws.filhas.add(wTmp2); //System.out.println("gws.filhas: " + gws.filhas); } } } saida.add(gws); //System.out.println(gws.getDados()); } } terminou = true; } return saida; } public Vector agruparPorCamadas(Vector workingStep) { Vector saida = new Vector(); double zAtual = -1; boolean terminou = false; while (!terminou) { double zTmp = -1; for (int i = 0; i < workingStep.size(); i++) { Workingstep wsTmp = (Workingstep)workingStep.elementAt(i); Feature fTmp = wsTmp.getFeature(); if (zTmp == -1 && fTmp.getPosicaoZ() > zAtual) { zTmp = fTmp.getPosicaoZ(); } else if(fTmp.getPosicaoZ() < zTmp && fTmp.getPosicaoZ() > zAtual) { zTmp = fTmp.getPosicaoZ(); } } //System.out.println("Camada Z = " + zTmp); if(zTmp == -1){ terminou = true; } else{ zAtual = zTmp; Vector novo = new Vector(); for(int j = 0; j < workingStep.size(); j ++){ Workingstep wsTmp2 = (Workingstep)workingStep.elementAt(j); Feature fTmp2 = wsTmp2.getFeature(); if (fTmp2.getPosicaoZ() == zAtual) { novo.add(wsTmp2); } } saida.add(novo); // System.out.println("Sequencias possiveis:"); //this.gerarSequencias(novo.size()); //System.out.println("Tamanho do grupo: " + novo.size()); } } /*for(int pointIndex = 0; pointIndex < saida.size(); pointIndex++){ Vector camadaTmp = (Vector)saida.elementAt(pointIndex); System.out.println("Camada -> z= " + ((Workingstep)camadaTmp.elementAt(0)).getFeature().getPosicaoZ()); for(int j = 0; j < camadaTmp.size(); j++){ Workingstep wsTmp = (Workingstep)camadaTmp.elementAt(j); System.out.println(wsTmp.getDados()); } }*/ //this.gerarSequencias(saida.size()); //System.out.println("saida.size: " + saida.size()); return saida; } public void imprimirDados(){ //imprimir os dados do vetor de grupos System.out.println("\n"); System.out.println("======================================================="); System.out.println("== Dados do Agrupador de Workingsteps =="); System.out.println("======================================================="); for(int i = 0; i < this.grupos.size(); i++){ Vector camadasDaFaceI = (Vector)this.grupos.elementAt(i); System.out.printf("..:: Face #%d (possui %d camadas) ::..\n", i, camadasDaFaceI.size()); for(int j = 0; j < camadasDaFaceI.size(); j++){ Vector camadaJ = (Vector)camadasDaFaceI.elementAt(j); System.out.printf("\tCamada #%d (possui %d workingsteps)\n", j, camadaJ.size()); for(int k = 0; k < camadaJ.size(); k++){ Workingstep wsTmp = (Workingstep)camadaJ.elementAt(k); System.out.printf("\t\tWorkingstep #%d (%s)\n", k, wsTmp.getFeature().toString()); } System.out.println(""); } } System.out.println("======================================================="); } }
[ "pilarrmeister@gmail.com" ]
pilarrmeister@gmail.com
66e450f25493c6145413de86f3bf040dcac74aa7
fb83849834e80686ae310f40a0b874e2669181c7
/api/src/main/java/org/openmrs/module/cpm/ProposedConceptResponsePackage.java
34d6356ea1b08723930becb4d1d972a80e51edae
[]
no_license
ThreeToes/openmrs-cpm
2e735d6b0d49482423396815c8e3086f2f0a8875
0513a1fc8aeb03f9076a05fbbf64bcf97963596d
refs/heads/master
2021-01-18T10:05:21.335216
2013-03-12T07:42:38
2013-03-12T07:42:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,084
java
package org.openmrs.module.cpm; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.annotations.GenericGenerator; import org.openmrs.Auditable; import org.openmrs.User; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import java.util.Date; import java.util.HashSet; import java.util.Set; /** * This class represents a set of Concepts that has been proposed as a single group. It acts as a wrapper for * individual concept proposals - providing attributes that record the proposers rationale for why the concepts * are needed, and allowing the proposal reviewer to manage a master/detail style listing of the overall proposal * package and its individual concepts. */ @Entity @Table(name = "cpm_proposed_concept_response_package") public class ProposedConceptResponsePackage extends ShareablePackage<ProposedConceptResponse> implements Auditable { private static Log log = LogFactory.getLog(ProposedConceptResponsePackage.class); private Integer proposedConceptResponsePackageId; private String proposedConceptPackageUuid; private User creator; private Date dateCreated; private User changedBy; private Date dateChanged; private Integer version; public ProposedConceptResponsePackage() { dateCreated = new Date(); dateChanged = new Date(); version = 0; } @Id @GeneratedValue(generator = "nativeIfNotAssigned") @GenericGenerator(name = "nativeIfNotAssigned", strategy = "org.openmrs.api.db.hibernate.NativeIfNotAssignedIdentityGenerator") @Column(name = "cpm_proposed_concept_response_package_id", nullable = false) @Override public Integer getId() { return proposedConceptResponsePackageId; } @Override public void setId(final Integer id) { proposedConceptResponsePackageId = id; } @Column(name = "cpm_proposed_concept_package_uuid") public String getProposedConceptPackageUuid() { return proposedConceptPackageUuid; } public void setProposedConceptPackageUuid(final String proposedConceptPackageUuid) { this.proposedConceptPackageUuid = proposedConceptPackageUuid; } @Column(name = "date_created", nullable = false) @Temporal(TemporalType.DATE) @Override public Date getDateCreated() { return dateCreated; } @Override public void setDateCreated(final Date dateCreated) { this.dateCreated = dateCreated; } @Column(name = "date_changed") @Temporal(TemporalType.DATE) @Override public Date getDateChanged() { return dateChanged; } @Override public void setDateChanged(final Date dateChanged) { this.dateChanged = dateChanged; } @Column(nullable = false) public Integer getVersion() { return version; } public void setVersion(final Integer version) { this.version = version; } @ManyToOne @JoinColumn(name = "creator") @Override public User getCreator() { return creator; } @Override public void setCreator(final User creator) { this.creator = creator; } @ManyToOne @JoinColumn(name = "changedBy") @Override public User getChangedBy() { return changedBy; } @Override public void setChangedBy(final User changedBy) { this.changedBy = changedBy; } @OneToMany(mappedBy = "proposedConceptPackage", cascade = CascadeType.ALL, orphanRemoval = true) @Override public Set<ProposedConceptResponse> getProposedConcepts() { return proposedConcepts; } /* * Utility methods */ @Override public String toString() { final StringBuffer appender = new StringBuffer(); appender.append("ConceptReviewPackage("); appender.append(getId()); appender.append(")"); appender.append(super.toString()); return appender.toString(); } }
[ "dsanders@rapilabs.com" ]
dsanders@rapilabs.com
4f007d693a65b9a8a2a2633cd0d8887627141fd1
8d8df099c35db127b72ab883e737691f27148e18
/core/src/masterofgalaxy/world/WorldStateRestorer.java
abf40ebebc59cbf0ea5dab129e635ed4adab8a05
[ "BSD-2-Clause" ]
permissive
Zalewa/MasterOfGalaxy
8d63e74dbe68357fda7404007013a655aacd4738
246b1c408560e44c397ffc7de2285e5fff0185fc
refs/heads/master
2021-01-01T18:49:24.791727
2018-06-06T21:22:46
2018-06-06T21:22:46
28,742,028
0
0
null
null
null
null
UTF-8
Java
false
false
5,970
java
package masterofgalaxy.world; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.utils.Array; import masterofgalaxy.assets.actors.Races; import masterofgalaxy.assets.i18n.I18N; import masterofgalaxy.ecs.components.*; import masterofgalaxy.ecs.entities.FleetFactory; import masterofgalaxy.ecs.entities.StarFactory; import masterofgalaxy.exceptions.SavedGameException; import masterofgalaxy.gamestate.Player; import masterofgalaxy.gamestate.PlayerBuilder; import masterofgalaxy.gamestate.Race; import masterofgalaxy.gamestate.savegame.*; import masterofgalaxy.gamestate.ships.ShipDesign; import java.text.MessageFormat; import java.util.logging.Level; import java.util.logging.Logger; public class WorldStateRestorer { private final WorldScreen worldScreen; private Logger logger = Logger.getLogger(WorldStateRestorer.class.getName()); private WorldState worldState; public WorldStateRestorer(WorldScreen worldScreen) { this.worldScreen = worldScreen; } public void restore(WorldState state) throws SavedGameException { this.worldState = state; restoreWorld(); restoreRaces(); restorePlayers(); restoreStars(); restoreColonies(); restoreFleets(); } private void restoreRaces() { worldScreen.getWorld().setRaces(worldState.races); } private void restoreWorld() { worldScreen.setTurn(worldState.turn); worldScreen.getWorld().setPlayField(worldState.playField); } private void restorePlayers() throws SavedGameException { worldScreen.getWorld().setPlayers(PlayerBuilder.fromStates(worldState.players)); Player currentPlayer = null; for (Player player : worldScreen.getWorld().getPlayers()) { Race race = Races.findRaceByName(worldScreen.getWorld().getRaces(), player.getState().getRaceName()); if (race == null) { throw new SavedGameException(I18N.resolve("$raceCannotBeFoundInSaveGame", player.getState().getRaceName(), player.getName())); } player.setRace(race); if (player.getName().equals(worldState.currentPlayer)) { currentPlayer = player; } } if (currentPlayer == null) { throw new SavedGameException(I18N.resolve("$savedCurrentPlayerNotFoundOnPlayersList")); } worldScreen.setCurrentPlayer(currentPlayer); } private void restoreStars() { for (StarState star : worldState.stars) { restoreStar(star); } } private void restoreStar(StarState starState) { Player owner = worldScreen.getWorld().findPlayerByName(starState.owner); Entity star = StarFactory.build(worldScreen.getGame(), worldScreen.getEntityEngine()); Mappers.id.get(star).id = starState.id; Mappers.playerOwner.get(star).setOwner(owner); Mappers.body.get(star).setState(starState.body); Mappers.star.get(star).setState(starState.star); Mappers.name.get(star).setName(starState.name); RenderComponent render = Mappers.spriteRender.get(star); render.setColor(starState.star.klass.getColor()); render.setScaleToSize(starState.body.getSize()); } private void restoreColonies() { for (ColonyPersistence colony : worldState.colonies) { restoreColony(colony); } } private void restoreColony(ColonyPersistence colonyState) { Entity star = worldScreen.getWorld().findEntityById(colonyState.entityId); if (star != null) { ColonyComponent colony = worldScreen.getEntityEngine().createComponent(ColonyComponent.class); colony.entity = star; colony.state.set(colonyState.state); star.add(colony); } else { logger.log(Level.SEVERE, MessageFormat.format("parent entity '{0}' for colony not found", colonyState.entityId)); } } private void restoreFleets() throws SavedGameException { for (FleetState fleet : worldState.fleets) { restoreFleet(fleet); } } private void restoreFleet(FleetState fleetState) throws SavedGameException { Player owner = worldScreen.getWorld().findPlayerByName(fleetState.owner); Entity fleet = FleetFactory.build(worldScreen.getGame(), worldScreen.getEntityEngine()); Mappers.id.get(fleet).id = fleetState.id; Mappers.playerOwner.get(fleet).setOwner(owner); Mappers.body.get(fleet).setState(fleetState.body); if (fleetState.dockedAt != null) { Entity entity = worldScreen.getWorld().findEntityById(fleetState.dockedAt); if (entity != null) { Docker.dock(worldScreen, fleet, entity); } } if (fleetState.targetId != null) { Entity entity = worldScreen.getWorld().findEntityById(fleetState.targetId); if (entity != null) { EntityTargetComponent target = Mappers.entityTarget.get(fleet); target.target = entity; } } restoreFleetShips(fleet, fleetState.ships); } private void restoreFleetShips(Entity fleet, Array<FleetShipsState> shipsStates) throws SavedGameException { Player player = Mappers.playerOwner.get(fleet).getOwner(); FleetComponent fleetComponent = Mappers.fleet.get(fleet); for (FleetShipsState shipsState : shipsStates) { ShipDesign design = player.getState().findShipDesignByName(shipsState.designName); if (design == null) { throw new SavedGameException(I18N.resolve("$saveGamePlayerShipDesignMissing", player.getName(), shipsState.designName)); } FleetComponent.Ship fleetShip = fleetComponent.getOrCreateShipOfDesign(design); fleetShip.count = shipsState.count; } } }
[ "zalewapl@gmail.com" ]
zalewapl@gmail.com
d4d20cd5b40cfb90c9389004dc6edb14074cf23c
d4fe4be15cd8d191a241022d50304356492629ba
/src/main/java/powers/ArmourType.java
65acbf9645980be3765e45e851119500222761e3
[]
no_license
cjmcauley/week12_day4_fantasyAdventureLab
3bc5677bda7825b5eaf00d3b5032642af9b74b63
df88d1bac08c7840b25288ddc4116062ad12085f
refs/heads/master
2020-07-24T22:12:57.602760
2019-09-12T14:00:12
2019-09-12T14:00:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
package powers; public enum ArmourType { SHIELD(2), HELMET(3), BODY(4); private final int resistance; ArmourType(int resistance) { this.resistance = resistance; } public int getResistance(){ return this.resistance; } }
[ "fidelma.beagan@gmail.com" ]
fidelma.beagan@gmail.com
d45366411e6151bfffa15fe57580869ea6664337
73586494382a3a57c28846ba5c7083b57aeba8eb
/1/Computing-Platforms/2019-10-23-Preparation-Projects/HTTPServer/src/MyHTTPServer.java
1b243fff2dc4c34b2ddcb7dbfb9df3836b80f273
[]
no_license
gabibbo97/ce-masters-degree-hub
918e165ae4243ab101b209b463966d58aad56d69
adb9e90fc00de79866fdc5ffafed3d52170cc6fc
refs/heads/master
2020-08-01T05:15:16.828091
2019-11-28T14:26:35
2019-11-28T14:26:35
210,875,002
1
1
null
null
null
null
UTF-8
Java
false
false
918
java
import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.concurrent.Executor; import java.util.concurrent.Executors; public class MyHTTPServer implements Runnable { @Override public void run() { final Executor executor = Executors.newFixedThreadPool(8); try { final ServerSocketChannel serverSocket = ServerSocketChannel.open(); serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 8000)); System.out.println("Started listening with HTTPServer"); while (true) { final SocketChannel clientSocket = serverSocket.accept(); System.out.println("Accepted connection"); final HTTPRouter router = new HTTPRouter(clientSocket); executor.execute(router); } } catch (final IOException e) { e.printStackTrace(); } } }
[ "gabibbo97@gmail.com" ]
gabibbo97@gmail.com
ff8c10070be53b4bad7d7e96bde5b1ea274eeb6e
8c0ed455a44d83a5f8fb0eaa8bad8bcfe3cab04a
/admin/src/main/java/top/zhwen/dao/UserMapper.java
a8eb288e35290dde2a33ce7fe06893f25a00f716
[]
no_license
electron1w/Spring-boot-xls
8766f6884f3c418c8c34c2b35ea6b9a5ac01cc76
d72b056ea34a0b1d7db1cc5fbdb68fe39dca9803
refs/heads/master
2020-03-07T06:19:12.363582
2018-03-29T17:06:58
2018-03-29T17:06:59
127,318,800
1
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
package top.zhwen.dao; import top.zhwen.domain.User; import top.zhwen.domain.UserExample; import top.zhwen.vo.UserVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import top.zhwen.domain.User; import top.zhwen.domain.UserExample; import java.util.List; @Mapper public interface UserMapper { long countByExample(UserExample example); int deleteByExample(UserExample example); int deleteByPrimaryKey(Long id); int insert(User record); int insertSelective(User record); List<User> selectByExample(UserExample example); List<UserVO> queryUserRole(UserExample example); User selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example); int updateByExample(@Param("record") User record, @Param("example") UserExample example); int updateByPrimaryKeySelective(User record); int updateByPrimaryKey(User record); int deleteByIds(String[] ids); }
[ "zenghaowen12@gmail.com" ]
zenghaowen12@gmail.com
dc929b31f40c27d06a3e8f6249a6b769ba6b66fb
b7979c8d5b25200c9dd3b9f87da11c71a5ce7eec
/bqss-app-provider/src/main/java/com/bast/core/Service.java
38eb86528fd84d706656bc231a3fe9c04500a3b1
[]
no_license
itboots/bq-cloud
df0aabc364ac93b782a862094d26ea08f8bb8981
38c5b2e74bf0f8579dc5a16ed4cdccf606bbb33d
refs/heads/master
2021-06-19T16:41:53.351159
2017-07-17T08:32:46
2017-07-17T08:32:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
944
java
package com.bast.core; import org.apache.ibatis.exceptions.TooManyResultsException; import tk.mybatis.mapper.entity.Condition; import java.util.List; /** * Service 层 基础接口,其他Service 接口 请继承该接口 */ public interface Service<T extends BaseModel> { void save(T model);//持久化 void save(List<T> models);//批量持久化 void deleteById(Integer id);//通过主鍵刪除 void deleteByIds(String ids);//批量刪除 eg:ids -> “1,2,3,4” T update(T model);//更新 T findById(Integer id);//通过ID查找 T findBy(String fieldName, Object value) throws TooManyResultsException; //通过Model中某个成员变量名称(非数据表中column的名称)查找,value需符合unique约束 List<T> findByIds(String ids);//通过多个ID查找//eg:ids -> “1,2,3,4” List<T> findByCondition(Condition condition);//根据条件查找 List<T> findAll();//获取所有 }
[ "97653637@qq.com" ]
97653637@qq.com
d52af46162165eea4eb768228f589e9287168c86
d830c0d34d97f7adacdd4d200b9e487304955550
/tests/algorithms/imageProcessing/Gaussian1DRecursiveTest.java
f84ea5028950657ee30450bc6d988ebd50791a01
[ "MIT" ]
permissive
dukson/curvature-scale-space-corners-and-transformations
4600863935cbf19206f00d3d4827e5208e64d83e
51554f6ad89af01a7f5ad77820186c33e29df433
refs/heads/master
2021-01-20T07:48:26.420428
2014-12-06T09:36:00
2014-12-06T09:36:00
41,126,067
1
0
null
null
null
null
UTF-8
Java
false
false
5,416
java
package algorithms.imageProcessing; import algorithms.util.PolygonAndPointPlotter; import algorithms.misc.MiscMath; import algorithms.util.PairIntArray; import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; /** * * @author nichole */ public class Gaussian1DRecursiveTest { public Gaussian1DRecursiveTest() { } @Before public void setUp() { } @After public void tearDown() { } @Test public void testCompareRecursiveConvolveGaussian1D() throws IOException { System.out.println("testCompareRecursiveConvolveGaussian1D"); /* a is a dirac delta function w/ peak at value 1 a convolved with gauss(sigma=2) = a smoothed by sigma=2 (a convolved with gauss(sigma=2)) convolved w/ gauss(sigma=2) = a smoothed by sigma=2*sqrt(2) */ // kernel for 2*sqrt(2) is size 13 int n = 15; int h = n >> 1; PairIntArray a = new PairIntArray(n); for (int i = 0; i < n; i++) { int xc = i - h; if (i == h) { a.add(xc, 255); } else { a.add(xc, 0); } } Kernel1DHelper kernel1DHelper = new Kernel1DHelper(); float[] gSIGMATWO = Gaussian1D.getKernel(SIGMA.TWO); // ===== convolve 'a' with a gaussian kernel of sigma=2 ======== // ===== as a 1-D convolution with the y-axis // 1-D convolution of 'a' X-axis w/ a sigma=2 1D Gaussian kernel PairIntArray ac2 = new PairIntArray(n); for (int i = 0; i < n; i++) { double convY = kernel1DHelper.convolvePointWithKernel(a, i, gSIGMATWO, false); ac2.add(a.getX(i), (int)convY); } // ====== convolving 'ac2' w/ a sigma=2 kernel should produce same // results as 'a' convolved by a sigma=2*sqrt(2). PairIntArray ac2c2 = new PairIntArray(n); for (int i = 0; i < n; i++) { double convY = kernel1DHelper.convolvePointWithKernel(ac2, i, gSIGMATWO, false); ac2c2.add(ac2.getX(i), (int)convY); } // ==== convolve 'a' by a sigma=2*sqrt(2) kernel float[] gSIGMATWOSQRT2 = Gaussian1D.getKernel(SIGMA.TWOSQRT2); PairIntArray ac2sqrt2 = new PairIntArray(n); for (int i = 0; i < n; i++) { double convY = kernel1DHelper.convolvePointWithKernel(a, i, gSIGMATWOSQRT2, false); ac2sqrt2.add(a.getX(i), (int)convY); } // compare ac2c2 to ac2sqrt2 PolygonAndPointPlotter plotter = new PolygonAndPointPlotter(); float xMax, yMax, xMin, yMin; xMin = MiscMath.findMin(ac2.getX()); xMax = MiscMath.findMax(ac2.getX()); yMin = MiscMath.findMin(ac2.getY()); yMax = MiscMath.findMax(ac2.getY()); plotter.addPlot(xMin, xMax, yMin, yMax, ac2.getX(), ac2.getY(), ac2.getX(), ac2.getY(), "a conv w/ gaussian1d(sigma=2)"); String filePath = plotter.writeFile(); xMin = MiscMath.findMin(ac2c2.getX()); xMax = MiscMath.findMax(ac2c2.getX()); yMin = MiscMath.findMin(ac2c2.getY()); yMax = MiscMath.findMax(ac2c2.getY()); plotter.addPlot(xMin, xMax, yMin, yMax, ac2c2.getX(), ac2c2.getY(), ac2c2.getX(), ac2c2.getY(), "a conv w/ g(2) conv w/ g(2)"); plotter.writeFile(); xMin = MiscMath.findMin(ac2sqrt2.getX()); xMax = MiscMath.findMax(ac2sqrt2.getX()); yMin = MiscMath.findMin(ac2sqrt2.getY()); yMax = MiscMath.findMax(ac2sqrt2.getY()); plotter.addPlot(xMin, xMax, yMin, yMax, ac2sqrt2.getX(), ac2sqrt2.getY(), ac2sqrt2.getX(), ac2sqrt2.getY(), "a conv w/ g(2*sqrt(2))"); plotter.writeFile(); System.out.println(filePath); // assert that peaks are the same and FWHM are the same float yMax0 = Float.MIN_VALUE; float yMax1 = Float.MIN_VALUE; int yMax0Idx = -1; int yMax1Idx = -1; for (int i = 0; i < ac2c2.getN(); i++) { if (ac2c2.getY(i) > yMax0) { yMax0 = ac2c2.getY(i); yMax0Idx = i; } } for (int i = 0; i < ac2sqrt2.getN(); i++) { if (ac2sqrt2.getY(i) > yMax1) { yMax1 = ac2sqrt2.getY(i); yMax1Idx = i; } } assertTrue(yMax0Idx == yMax1Idx); assertTrue(Math.abs(yMax0 - yMax1) < 0.01); float FWHM0 = GaussianHelperForTests.measureFWHM(ac2c2.getX(), ac2c2.getY()); float FWHM1 = GaussianHelperForTests.measureFWHM(ac2sqrt2.getX(), ac2sqrt2.getY()); float expectedFWHM = (float)(SIGMA.getValue(SIGMA.TWOSQRT2) * 2.f * Math.sqrt(2*Math.log(2))); float eps = 2*(ac2c2.getX(4) - ac2c2.getX(3)); assertTrue(Math.abs(FWHM0 - expectedFWHM) < eps); assertTrue(Math.abs(FWHM1 - expectedFWHM) < eps); } }
[ "nichole@climbwithyourfeet.com" ]
nichole@climbwithyourfeet.com
fc4f1fa0aeedad2fa989eed6908d4185afe3a6cf
614b19621f6477bc522d45adf8ea8f71f573bcb8
/battleship-back-end/src/main/java/pl/nn44/battleship/service/MonteCarloFleet.java
2cd8262800a887d6bb2e7f1caa5ad676a0fa20ca
[ "MIT" ]
permissive
180254/Battleship44
95bd10fa001a3964625b31a65091633eabcd79a2
2c91c68bf80b0e7b264365d40449ce5f551514cb
refs/heads/master
2023-03-07T14:36:11.667618
2021-07-28T06:36:41
2021-07-28T06:36:41
64,911,718
0
1
MIT
2023-03-05T12:54:26
2016-08-04T07:16:46
Java
UTF-8
Java
false
false
5,015
java
package pl.nn44.battleship.service; import pl.nn44.battleship.gamerules.FleetMode; import pl.nn44.battleship.gamerules.GameRules; import pl.nn44.battleship.model.Coord; import pl.nn44.battleship.model.Grid; import pl.nn44.battleship.model.Ship; import javax.annotation.Nullable; import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.*; public class MonteCarloFleet { private final ThreadPoolExecutor executorService; private final ScheduledExecutorService cancelerService; private final GameRules gameRules; private final Random random; private final MetricsService metricsService; private final Duration timeout; public MonteCarloFleet(GameRules gameRules, Random random, MetricsService metricsService, int corePoolSize, int maximumPoolSize, Duration keepAliveTime, Duration timeout) { // based on Executors.newCachedThreadPool() this.executorService = new ThreadPoolExecutor( corePoolSize, maximumPoolSize, keepAliveTime.toMillis(), TimeUnit.MILLISECONDS, new SynchronousQueue<>()); this.cancelerService = Executors.newSingleThreadScheduledExecutor(); this.gameRules = gameRules; this.random = random; this.metricsService = metricsService; this.timeout = timeout; metricsService.registerDeliverableMetric("monteCarloFleet.currentPoolSize", executorService::getPoolSize); } public CompletableFuture<Grid> maybeRandomFleet() { CompletableFuture<Grid> futureGrid = CompletableFuture.supplyAsync(this::randomFleet, executorService); futureGrid.whenComplete((grid, throwable) -> { String metricCounterKey; if (throwable != null) { String throwableSimpleName = throwable.getClass().getSimpleName(); metricCounterKey = "monteCarloFleet." + throwableSimpleName; } else if (grid == null) { metricCounterKey = "monteCarloFleet.completedNull"; } else { metricCounterKey = "monteCarloFleet.completedOk"; } metricsService.incrementCounter(metricCounterKey); }); cancelerService.schedule(() -> futureGrid.cancel(true), timeout.toMillis(), TimeUnit.MILLISECONDS); return futureGrid; } @Nullable private Grid randomFleet() { long startTime = System.currentTimeMillis(); List<Integer> availableShipSizes = gameRules.getFleetSizes().getAvailableShipSizes(); List<Ship> doneShips = new ArrayList<>(availableShipSizes.size()); List<Integer> doneShipSizes = new ArrayList<>(availableShipSizes.size()); Grid grid = null; for (int shipSize : availableShipSizes) { if (Thread.interrupted()) { return null; } doneShipSizes.add(shipSize); while (true) { if (Thread.interrupted()) { return null; } Ship ship = null; while (ship == null) { if (Thread.interrupted()) { return null; } ship = randomShip(shipSize); } doneShips.add(ship); grid = new Grid(gameRules.getGridSize(), doneShips); FleetVerifier fleetVerifier = FleetVerifierFactory.forRules(gameRules, doneShipSizes); if (fleetVerifier.verify(grid)) { break; } else { doneShips.remove(doneShips.size() - 1); } } } long elapsedTime = System.currentTimeMillis() - startTime; metricsService.recordElapsedTime("monteCarloFleet.avgTimeMs", elapsedTime, TimeUnit.MILLISECONDS); return grid; } @Nullable private Ship randomShip(int size) { Coord coord = randomCoord(); if (!coord.isProper(gameRules.getGridSize())) { return null; } List<Coord> shipCoords = new ArrayList<>(size); shipCoords.add(coord); Direction direction = randomDirection(); for (int i = 0; i < size - 1; i++) { if (gameRules.getFleetMode() == FleetMode.CURVED) { direction = randomDirection(); } coord = direction.move(coord); if (!coord.isProper(gameRules.getGridSize())) { return null; } shipCoords.add(coord); } return new Ship(shipCoords); } private Coord randomCoord() { return Coord.create( random.nextInt(gameRules.getGridSize().getRows()), random.nextInt(gameRules.getGridSize().getCols())); } private Direction randomDirection() { Direction[] values = Direction.values(); return values[random.nextInt(values.length)]; } enum Direction { UP(1, 0), DOWN(-1, 0), LEFT(0, -1), RIGHT(0, 1); private final int rowShift; private final int colShift; Direction(int rowShift, int colShift) { this.rowShift = rowShift; this.colShift = colShift; } public Coord move(Coord coord) { return Coord.create(coord.getRow() + rowShift, coord.getCol() + colShift); } } }
[ "180254@users.noreply.github.com" ]
180254@users.noreply.github.com
ebb341acfead31c848027b56627a26119ba8b37e
7a96414d5b49603238e95a6b1e77809a77143082
/software/ear/src/test/java/gov/nih/nci/firebird/selenium2/tests/protocol/registration/ReviseUnApprovedRegistrationAsInvestigatorTest.java
4bdfa43093f8ae5161cf81c18ace0d8946074b67
[]
no_license
NCIP/nci-ocr
822788379a2bf0a95ee00e1667e365766cc8c794
e36adffb92fdb9833bb8835f87eab4b46594019e
refs/heads/master
2016-09-05T12:40:31.309373
2013-08-28T14:32:45
2013-08-28T14:32:45
12,298,569
2
1
null
null
null
null
UTF-8
Java
false
false
8,295
java
/** * The software subject to this notice and license includes both human readable * source code form and machine readable, binary, object code form. The NCI OCR * Software was developed in conjunction with the National Cancer Institute * (NCI) by NCI employees and 5AM Solutions, Inc. (5AM). To the extent * government employees are authors, any rights in such works shall be subject * to Title 17 of the United States Code, section 105. * * This NCI OCR Software License (the License) is between NCI and You. You (or * Your) shall mean a person or an entity, and all other entities that control, * are controlled by, or are under common control with the entity. Control for * purposes of this definition means (i) the direct or indirect power to cause * the direction or management of such entity, whether by contract or otherwise, * or (ii) ownership of fifty percent (50%) or more of the outstanding shares, * or (iii) beneficial ownership of such entity. * * This License is granted provided that You agree to the conditions described * below. NCI grants You a non-exclusive, worldwide, perpetual, fully-paid-up, * no-charge, irrevocable, transferable and royalty-free right and license in * its rights in the NCI OCR Software to (i) use, install, access, operate, * execute, copy, modify, translate, market, publicly display, publicly perform, * and prepare derivative works of the NCI OCR Software; (ii) distribute and * have distributed to and by third parties the NCI OCR Software and any * modifications and derivative works thereof; and (iii) sublicense the * foregoing rights set out in (i) and (ii) to third parties, including the * right to license such rights to further third parties. For sake of clarity, * and not by way of limitation, NCI shall have no right of accounting or right * of payment from You or Your sub-licensees for the rights granted under this * License. This License is granted at no charge to You. * * Your redistributions of the source code for the Software must retain the * above copyright notice, this list of conditions and the disclaimer and * limitation of liability of Article 6, below. Your redistributions in object * code form must reproduce the above copyright notice, this list of conditions * and the disclaimer of Article 6 in the documentation and/or other materials * provided with the distribution, if any. * * Your end-user documentation included with the redistribution, if any, must * include the following acknowledgment: This product includes software * developed by 5AM and the National Cancer Institute. If You do not include * such end-user documentation, You shall include this acknowledgment in the * Software itself, wherever such third-party acknowledgments normally appear. * * You may not use the names "The National Cancer Institute", "NCI", or "5AM" * to endorse or promote products derived from this Software. This License does * not authorize You to use any trademarks, service marks, trade names, logos or * product names of either NCI or 5AM, except as required to comply with the * terms of this License. * * For sake of clarity, and not by way of limitation, You may incorporate this * Software into Your proprietary programs and into any third party proprietary * programs. However, if You incorporate the Software into third party * proprietary programs, You agree that You are solely responsible for obtaining * any permission from such third parties required to incorporate the Software * into such third party proprietary programs and for informing Your * sub-licensees, including without limitation Your end-users, of their * obligation to secure any required permissions from such third parties before * incorporating the Software into such third party proprietary software * programs. In the event that You fail to obtain such permissions, You agree * to indemnify NCI for any claims against NCI by such third parties, except to * the extent prohibited by law, resulting from Your failure to obtain such * permissions. * * For sake of clarity, and not by way of limitation, You may add Your own * copyright statement to Your modifications and to the derivative works, and * You may provide additional or different license terms and conditions in Your * sublicenses of modifications of the Software, or any derivative works of the * Software as a whole, provided Your use, reproduction, and distribution of the * Work otherwise complies with the conditions stated in this License. * * THIS SOFTWARE IS PROVIDED "AS IS," AND ANY EXPRESSED OR IMPLIED WARRANTIES, * (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, * NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. IN NO * EVENT SHALL THE NATIONAL CANCER INSTITUTE, 5AM SOLUTIONS, INC. OR THEIR * AFFILIATES 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 gov.nih.nci.firebird.selenium2.tests.protocol.registration; import static gov.nih.nci.firebird.selenium2.pages.util.FirebirdEmailUtils.getExpectedSubject; import static gov.nih.nci.firebird.service.messages.FirebirdMessageTemplate.REGISTRATION_REVISION_INITIATED_EMAIL_TO_COORDINATOR; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import gov.nih.nci.firebird.data.RegistrationStatus; import gov.nih.nci.firebird.selenium2.pages.investigator.profile.OrganizationAssociationsTab; import gov.nih.nci.firebird.selenium2.pages.investigator.protocol.registration.BrowseRegistrationsPage; import gov.nih.nci.firebird.selenium2.pages.investigator.protocol.registration.RegistrationOverviewTab; import gov.nih.nci.firebird.selenium2.pages.investigator.protocol.registration.ResubmissionCommentsDialog; import gov.nih.nci.firebird.selenium2.pages.investigator.protocol.registration.SignAndSubmitRegistrationDialog; import gov.nih.nci.firebird.test.LoginAccount; public class ReviseUnApprovedRegistrationAsInvestigatorTest extends AbstractReviseUnApprovedRegistrationTest { @Override LoginAccount getLogin() { return getDataSet().getInvestigatorLogin(); } @Override BrowseRegistrationsPage navigateToBrowseRegistrations() { return openHomePage(getLogin()).getInvestigatorMenu().clickProtocolRegistrations(); } @Override void submitRegistration(RegistrationOverviewTab overviewTab) { ResubmissionCommentsDialog commentsDialog = (ResubmissionCommentsDialog) overviewTab.clickSubmitRegistration(); commentsDialog.typeComments("I am done revising"); SignAndSubmitRegistrationDialog signDialog = (SignAndSubmitRegistrationDialog) commentsDialog.clickSave(); signDialog.getHelper().signAndSubmit(getLogin()).clickClose(); overviewTab.getHelper().assertHasStatus(RegistrationStatus.SUBMITTED); assertTrue(overviewTab.isReviseRegistrationButtonPresent()); assertFalse(overviewTab.isSubmitRegistrationButtonPresent()); } @Override protected int getExpectedEmailCount() { return 7; } @Override int getExpectedEmailCount_InReview() { return 4; } @Override void checkForRoleSpecificEmails(boolean wasSubmitted) { String expectedSubject = getExpectedSubject(REGISTRATION_REVISION_INITIATED_EMAIL_TO_COORDINATOR, getDataSet() .getInvestigatorRegistration()); getEmailChecker().getSentEmail(getDataSet().getCoordinators().get(0).getPerson().getEmail(), expectedSubject); getEmailChecker().getSentEmail(getDataSet().getCoordinators().get(1).getPerson().getEmail(), expectedSubject); } @Override OrganizationAssociationsTab navigateToOrganizationAssociationTab() { return openHomePage(getLogin()).getInvestigatorMenu().clickProfile().getPage() .clickOrganizationAssociationsTab(); } }
[ "mkher@fusionspan.com" ]
mkher@fusionspan.com
7f6efac3f7cf51b1b0e67bb7379ebb5beb139a50
28552d7aeffe70c38960738da05ebea4a0ddff0c
/google-ads/src/main/java/com/google/ads/googleads/v3/services/stub/MediaFileServiceStubSettings.java
332781cf82d30eafcbcc5cbb40416c1406df3bb0
[ "Apache-2.0" ]
permissive
PierrickVoulet/google-ads-java
6f84a3c542133b892832be8e3520fb26bfdde364
f0a9017f184cad6a979c3048397a944849228277
refs/heads/master
2021-08-22T08:13:52.146440
2020-12-09T17:10:48
2020-12-09T17:10:48
250,642,529
0
0
Apache-2.0
2020-03-27T20:41:26
2020-03-27T20:41:25
null
UTF-8
Java
false
false
12,760
java
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.ads.googleads.v3.services.stub; import com.google.ads.googleads.v3.resources.MediaFile; import com.google.ads.googleads.v3.services.GetMediaFileRequest; import com.google.ads.googleads.v3.services.MutateMediaFilesRequest; import com.google.ads.googleads.v3.services.MutateMediaFilesResponse; import com.google.api.core.ApiFunction; import com.google.api.core.BetaApi; import com.google.api.gax.core.GaxProperties; import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.StatusCode; import com.google.api.gax.rpc.StubSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; import java.io.IOException; import java.util.List; import javax.annotation.Generated; import org.threeten.bp.Duration; // AUTO-GENERATED DOCUMENTATION AND CLASS /** * Settings class to configure an instance of {@link MediaFileServiceStub}. * * <p>The default instance has everything set to sensible defaults: * * <ul> * <li>The default service address (googleads.googleapis.com) and default port (443) are used. * <li>Credentials are acquired automatically through Application Default Credentials. * <li>Retries are configured for idempotent methods but not for non-idempotent methods. * </ul> * * <p>The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * * <p>For example, to set the total timeout of getMediaFile to 30 seconds: * * <pre> * <code> * MediaFileServiceStubSettings.Builder mediaFileServiceSettingsBuilder = * MediaFileServiceStubSettings.newBuilder(); * mediaFileServiceSettingsBuilder * .getMediaFileSettings() * .setRetrySettings( * mediaFileServiceSettingsBuilder.getMediaFileSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * MediaFileServiceStubSettings mediaFileServiceSettings = mediaFileServiceSettingsBuilder.build(); * </code> * </pre> */ @Generated("by gapic-generator") @BetaApi public class MediaFileServiceStubSettings extends StubSettings<MediaFileServiceStubSettings> { /** The default scopes of the service. */ private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES = ImmutableList.<String>builder().build(); private final UnaryCallSettings<GetMediaFileRequest, MediaFile> getMediaFileSettings; private final UnaryCallSettings<MutateMediaFilesRequest, MutateMediaFilesResponse> mutateMediaFilesSettings; /** Returns the object with the settings used for calls to getMediaFile. */ public UnaryCallSettings<GetMediaFileRequest, MediaFile> getMediaFileSettings() { return getMediaFileSettings; } /** Returns the object with the settings used for calls to mutateMediaFiles. */ public UnaryCallSettings<MutateMediaFilesRequest, MutateMediaFilesResponse> mutateMediaFilesSettings() { return mutateMediaFilesSettings; } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public MediaFileServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcMediaFileServiceStub.create(this); } else { throw new UnsupportedOperationException( "Transport not supported: " + getTransportChannelProvider().getTransportName()); } } /** Returns a builder for the default ExecutorProvider for this service. */ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { return InstantiatingExecutorProvider.newBuilder(); } /** Returns the default service endpoint. */ public static String getDefaultEndpoint() { return "googleads.googleapis.com:443"; } /** Returns the default service scopes. */ public static List<String> getDefaultServiceScopes() { return DEFAULT_SERVICE_SCOPES; } /** Returns a builder for the default credentials for this service. */ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); } /** Returns a builder for the default ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(MediaFileServiceStubSettings.class)) .setTransportToken( GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } /** Returns a new builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); } /** Returns a builder containing all the values of this settings class. */ public Builder toBuilder() { return new Builder(this); } protected MediaFileServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); getMediaFileSettings = settingsBuilder.getMediaFileSettings().build(); mutateMediaFilesSettings = settingsBuilder.mutateMediaFilesSettings().build(); } /** Builder for MediaFileServiceStubSettings. */ public static class Builder extends StubSettings.Builder<MediaFileServiceStubSettings, Builder> { private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder<GetMediaFileRequest, MediaFile> getMediaFileSettings; private final UnaryCallSettings.Builder<MutateMediaFilesRequest, MutateMediaFilesResponse> mutateMediaFilesSettings; private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions = ImmutableMap.builder(); definitions.put( "retry_policy_1_codes", ImmutableSet.copyOf( Lists.<StatusCode.Code>newArrayList( StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); RETRYABLE_CODE_DEFINITIONS = definitions.build(); } private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS; static { ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder(); RetrySettings settings = null; settings = RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(5000L)) .setRetryDelayMultiplier(1.3) .setMaxRetryDelay(Duration.ofMillis(60000L)) .setInitialRpcTimeout(Duration.ofMillis(3600000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(3600000L)) .setTotalTimeout(Duration.ofMillis(3600000L)) .build(); definitions.put("retry_policy_1_params", settings); settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(3600000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(3600000L)) .setTotalTimeout(Duration.ofMillis(3600000L)) .build(); definitions.put("no_retry_1_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { this((ClientContext) null); } protected Builder(ClientContext clientContext) { super(clientContext); getMediaFileSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); mutateMediaFilesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( getMediaFileSettings, mutateMediaFilesSettings); initDefaults(this); } private static Builder createDefault() { Builder builder = new Builder((ClientContext) null); builder.setTransportChannelProvider(defaultTransportChannelProvider()); builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); builder.setEndpoint(getDefaultEndpoint()); return initDefaults(builder); } private static Builder initDefaults(Builder builder) { builder .getMediaFileSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); builder .mutateMediaFilesSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); return builder; } protected Builder(MediaFileServiceStubSettings settings) { super(settings); getMediaFileSettings = settings.getMediaFileSettings.toBuilder(); mutateMediaFilesSettings = settings.mutateMediaFilesSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( getMediaFileSettings, mutateMediaFilesSettings); } // NEXT_MAJOR_VER: remove 'throws Exception' /** * Applies the given settings updater function to all of the unary API methods in this service. * * <p>Note: This method does not support applying settings to streaming methods. */ public Builder applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception { super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); return this; } public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() { return unaryMethodSettingsBuilders; } /** Returns the builder for the settings used for calls to getMediaFile. */ public UnaryCallSettings.Builder<GetMediaFileRequest, MediaFile> getMediaFileSettings() { return getMediaFileSettings; } /** Returns the builder for the settings used for calls to mutateMediaFiles. */ public UnaryCallSettings.Builder<MutateMediaFilesRequest, MutateMediaFilesResponse> mutateMediaFilesSettings() { return mutateMediaFilesSettings; } @Override public MediaFileServiceStubSettings build() throws IOException { return new MediaFileServiceStubSettings(this); } } }
[ "noreply@github.com" ]
PierrickVoulet.noreply@github.com
a4a622ac8f79cae386a3599552ba5eac829d8047
9178cb1f2991f8f874e0da1583ddd8197376bdf4
/src/leetcode/MaximumDifference.java
1d33acf9879e5d53b5d96988c34bc87cd7a0e64d
[]
no_license
andrewyee510/Algorithms
55311dfff87f713a03ab33f826de484473dc8f1d
b2e8fe0bc271487326ea56ee9a5600fd842efbd4
refs/heads/master
2021-01-13T02:27:08.214419
2013-04-16T04:25:23
2013-04-16T04:25:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,082
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package leetcode; /** * * @author Andrew */ public class MaximumDifference { public static int maxDiff(int []a){ if(a.length == 0 || a.length ==1){return 0;} int min = a[0]; int current = Integer.MIN_VALUE; int total =Integer.MIN_VALUE; int prev = a[0]; for(int i=1; i<a.length; i++){ current = a[i]; if(current > min){ min = Math.min(a[i-1], min); prev = min; total = Math.max(total, current-min); } else{//prev min = current; } System.out.println("current=" + current + " min="+ min+ " total="+ total); } return total; } public static void main(String args[]){ int [] a = {2,3,0,6,4,8,1}; int [] b = {7,9,5,6,6,9}; System.out.println(maxDiff(b)); } }
[ "ayyee510@gmail.com" ]
ayyee510@gmail.com
d8412c624a89a5b3155c42891b7b46eea741c6cd
890506a96e6dfb3b1f53f6a950473b87ea584d4d
/20180422Exam/Skeleton/src/main/java/org/softuni/mostwanted/cotrollers/RaceController.java
c5b80afe6efc8dc8ed2b52e2c9cb2e6a6593ba3f
[ "MIT" ]
permissive
lapd87/SoftUniDatabasesFrameworksHibernateAndSpringData
9a05cb43b476faa38db05ec4e15e507697554fcc
2cfe33e8fc4ab8c8de7b6373f6164f97da76a10a
refs/heads/master
2020-03-13T04:40:39.707800
2018-04-25T07:34:38
2018-04-25T07:34:38
130,967,789
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package org.softuni.mostwanted.cotrollers; import org.softuni.mostwanted.domain.dto.importDtos.RaceXMLWrapperDto; import org.softuni.mostwanted.parser.interfaces.Parser; import org.softuni.mostwanted.services.race.RaceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import javax.xml.bind.JAXBException; import java.io.IOException; /** * Created by IntelliJ IDEA. * User: LAPD * Date: 22.4.2018 г. * Time: 20:00 ч. */ @Controller public class RaceController { private final RaceService raceService; private final Parser parser; @Autowired public RaceController(RaceService raceService, @Qualifier("XMLParser") Parser parser) { this.raceService = raceService; this.parser = parser; } public String importDataFromXML(String xmlContent) { StringBuilder sb = new StringBuilder(); try { RaceXMLWrapperDto raceXMLWrapperDto = parser.read(RaceXMLWrapperDto.class, xmlContent); raceXMLWrapperDto.getRaceEntry().forEach(r -> { try { sb.append(this.raceService.create(r)) .append(System.lineSeparator()); } catch (IllegalArgumentException ignored) { } }); } catch (JAXBException | IOException e) { e.printStackTrace(); } return sb.toString(); } }
[ "mario87lapd@gmail.com" ]
mario87lapd@gmail.com
86055c2bad43a88d982de0d56c401c9449d65109
bd14d254522cfc0e711afec952146b63e2ac492b
/src/application/Program.java
0c8165d87d2a88080d2141513055ce478b820ca1
[]
no_license
PedroMozany/Multiplica-oSimples
194f8e09f1049c913835527eeea1db789ef274cf
baa0f31d8a7eb32c005ad86e1a3a5c1e844f8b65
refs/heads/master
2023-06-15T12:16:30.561315
2021-02-14T23:32:12
2021-02-14T23:32:12
338,923,468
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package application; import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int A, B, Total; A = sc.nextInt(); B = sc.nextInt(); Total = A * B; System.out.println("PROD = " + Total); sc.close(); } }
[ "pedro.mozanny@hotmail.com" ]
pedro.mozanny@hotmail.com
46e1533caee3c6fa903a4b84089f1b12b984268b
d75890b6bb92831a86b13678c4252f4699cc2c48
/src/graphics/utilities/AnimationEventController.java
d224fc844d6ffefa9a05fd2251a9992bc8943dac
[]
no_license
Peter-Odd/DollyWood
d6541223701afd0194a6025877aaac17d3c75dbc
8c6e819c735a4b9165495773cd145973bd9d41b4
refs/heads/master
2020-05-17T21:58:19.495419
2014-11-17T19:15:11
2014-11-17T19:15:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,751
java
package graphics.utilities; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.Random; import org.lwjgl.util.vector.Vector3f; /** * AnimationEventController is a holder and executor of events. * It can hold multiple animations(or events) each with multiple keyframes(or states). * The controller can be run on it's own thread or step by step using step function. * <br /> * It calculates the current state of the animation based on 2 states and a progress float. * @see AnimationEvent * @see AnimationState * @author OSM Group 5 - DollyWood project * @version 1.0 */ public class AnimationEventController implements Runnable{ private int tickLength; public ArrayList<AnimationEvent> events = new ArrayList<>(); /** * Sets for how long the thread should sleep between working. Only relevant if used with a thread. * @param tickLength Time in ms */ public AnimationEventController(int tickLength) { this.tickLength = tickLength; } @SuppressWarnings("unchecked") /** * returns all animationEvents * @return */ public synchronized ArrayList<AnimationEvent> getEvents(){ return (ArrayList<AnimationEvent>) events.clone(); } /** * Calculates the current state of the animation based on 2 states and a progress float, for each of the events. */ public synchronized void step(){ Iterator<AnimationEvent> it = events.iterator(); while(it.hasNext()){ AnimationEvent e = it.next(); if((int)e.currentModelProgress+1 == e.modelStates.size()){ if(e.loopType == 0) it.remove(); else e.resetModelState(); continue; } if((int)e.currentAnimationProgress+1 == e.animationStates.size()){ it.remove(); continue; } else{ updateState(e.currentModelState, e.currentModelProgress, e.modelStates); e.currentModelProgress += e.modelStates.get((int)e.currentModelProgress).speed; if((int)e.currentAnimationProgress+1 < e.animationStates.size()){ updateState(e.currentAnimationState, e.currentAnimationProgress, e.animationStates); e.currentAnimationProgress += e.animationStates.get((int)e.currentAnimationProgress).speed; } /*if((int)e.currentAnimationProgress+1 == e.animationStates.size()){ if(e.loopType == 1){ e.resetAnimationState(); } }*/ } } } private void updateState(AnimationState state, float progress, ArrayList<AnimationState> stateList){ state.position = blendVectors(stateList.get((int)progress).position, stateList.get((int)progress+1).position, progress-(int)progress); state.scale = blendVectors(stateList.get((int)progress).scale, stateList.get((int)progress+1).scale, progress-(int)progress); state.rotation = blendVectors(stateList.get((int)progress).rotation, stateList.get((int)progress+1).rotation, progress-(int)progress); state.model = stateList.get((int)progress).model; } private Vector3f blendVectors(Vector3f preVal, Vector3f postVal, float ammount){ float x = preVal.x + (postVal.x-preVal.x)*(ammount); float y = preVal.y + (postVal.y-preVal.y)*(ammount); float z = preVal.z + (postVal.z-preVal.z)*(ammount); return new Vector3f(x,y,z); } /** * Starter for thread. * it stops when there are no more events to animate. */ public void run() { while(events.size() > 0){ step(); try { Thread.sleep(tickLength); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } /** * Loads a non-binary .ani file and returns the AnimationEvent within. * <br> * A .ani file consists primarily of 5 fields. and looks like the following<br /> * o string with model name<br /> * p x.x y.y z.z //Position vector<br /> * r x.x y.y z.z //Rotation vector<br /> * sc x.x y.y z.z //Scale vector<br /> * s x.x //Speed of the keyframe.<br /> * * These field should appear in this order, and can be repeated for each keyframe.<br /> * You can then specify if the animation should loop with the string:<br /> * lt LOOP * @param filename Location of the .ani file * @param position Position offset. This is where the animation will be centered * @param rotation Rotation offset. * @param scale Scale offset. Note that they should be 0.0, if a final scale of 1.0 is desired * @throws FileNotFoundException */ public void loadEvent(String filename, String animationID, Vector3f position, Vector3f rotation, Vector3f scale, float speed) throws FileNotFoundException{ BufferedReader in = new BufferedReader(new FileReader(filename)); String line = null; AnimationEvent event = new AnimationEvent(animationID); ArrayList<AnimationEvent> events = new ArrayList<>(); ArrayList<AnimationState> animationStates = new ArrayList<>(); event.subAnimationID = "default"; AnimationState state = null; try { while((line = in.readLine()) != null){ if(line.startsWith("o ") || line.startsWith("a ")){ String[] components = line.split(" "); state = new AnimationState(); state.model = components[1]; state.position = new Vector3f(); state.rotation = new Vector3f(); state.scale = new Vector3f(); if(components.length > 2 && !event.subAnimationID.equals(components[2])){ if(event.totalStates() > 0){ event.currentModelState = event.modelStates.get(0).clone(); event.currentAnimationState = new AnimationState(position, rotation, scale, speed); events.add(event); } event = new AnimationEvent(animationID); event.subAnimationID = components[2]; } if(components[0].equals("o")) event.modelStates.add(state); else if(components[0].equals("a")){ animationStates.add(state); state.position = new Vector3f(position.x, position.y, position.z); state.rotation = new Vector3f(rotation.x, rotation.y, rotation.z); state.scale = new Vector3f(scale.x, scale.y, scale.z); } } else if(line.startsWith("p ")){ String[] components = line.split(" "); Vector3f.add(state.position, parseVector(components, 1), state.position); } else if(line.startsWith("r ")){ String[] components = line.split(" "); Vector3f.add(state.rotation, parseVector(components, 1), state.rotation); } else if(line.startsWith("sc ")){ String[] components = line.split(" "); Vector3f.add(state.scale, parseVector(components, 1), state.scale); } else if(line.startsWith("s ")){ String[] components = line.split(" "); state.speed = Float.parseFloat(components[1]); } else if(line.startsWith("lt ")){ String[] components = line.split(" "); if(components[1].equals("LOOP")) event.loopType = 1; } } in.close(); } catch(IOException e){ e.printStackTrace(); } event.currentModelState = event.modelStates.get(0).clone(); if(event.animationStates.size() > 0) event.currentAnimationState = event.animationStates.get(0).clone(); else event.currentAnimationState = new AnimationState(position, rotation, scale, speed); events.add(event); for(AnimationEvent e : events) e.animationStates.addAll(animationStates); this.events.addAll(events); } private Vector3f parseVector(String[] components, int offset){ float x = Float.parseFloat(components[0+offset]); float y = Float.parseFloat(components[1+offset]); float z = Float.parseFloat(components[2+offset]); return new Vector3f(x,y,z); } public void addAnimationState(AnimationState animationState, String animationID) { for(AnimationEvent e : events){ if(e.superAnimationID.equals(animationID)) e.animationStates.add(animationState); } } public void setRandomAnimationSpeed(String animationID, float min, float max) { float range = Math.abs(max-min)/2.0f; Random random = new Random(); for(AnimationEvent e : events){ if(e.superAnimationID.equals(animationID)){ for(AnimationState s : e.animationStates){ s.speed = min+(random.nextFloat()*2.0f*range+range); } } } } public void setRandomModelSpeed(String animationID, float min, float max) { float range = Math.abs(max-min)/2.0f; Random random = new Random(); float randomSpeed = min+(random.nextFloat()*2.0f*range+range); for(AnimationEvent e : events){ if(e.superAnimationID.equals(animationID)){ for(AnimationState s : e.modelStates){ s.speed = randomSpeed; } } } } }
[ "marcusmunger@hotmail.com" ]
marcusmunger@hotmail.com
672ba1235f5f4c4badcf3151bbdeb853ceb3f48d
5675fa422cdc15704cd08cfc8b40bcb50530c882
/src/main/java/com/lcf/model/CommentLikesRecord.java
f73ebda6c4f32b6bf4905a4f3f3ab386d5558f6e
[]
no_license
liujianview/myBlog
7b05b5cf9a3e9cb5d21c53a3a0dcf5b81104632b
ccb247daa1d0e373f6e04942546b25fb042762bc
refs/heads/master
2023-03-14T22:37:14.005692
2021-03-26T02:49:57
2021-03-26T02:49:57
331,816,935
10
1
null
null
null
null
UTF-8
Java
false
false
722
java
package com.lcf.model; import lombok.Data; import lombok.NoArgsConstructor; /** * @author: liuchuanfeng * @Date: 2020/7/12 13:43 * Describe: 文章评论点赞记录 */ @Data @NoArgsConstructor public class CommentLikesRecord { private long id; /** * 文章id */ private long articleId; /** * 评论的id */ private long pId; /** * 点赞人 */ private int likerId; /** * 点赞时间 */ private String likeDate; public CommentLikesRecord(long articleId, int pId, int likerId, String likeDate) { this.articleId = articleId; this.pId = pId; this.likerId = likerId; this.likeDate = likeDate; } }
[ "1546855350@qq.com" ]
1546855350@qq.com
f869af78f43c4eafd7b55ac39731ef821f727a10
0493ffe947dad031c7b19145523eb39209e8059a
/OpenJdk8uTest/src/test/javax/management/Introspector/IsMethodTest.java
ff65c28c9768003e10ac25a369b454384c73bbf4
[]
no_license
thelinh95/Open_Jdk8u_Test
7612f1b63b5001d1df85c1df0d70627b123de80f
4df362a71e680dbd7dfbb28c8922e8f20373757a
refs/heads/master
2021-01-16T19:27:30.506632
2017-08-13T23:26:05
2017-08-13T23:26:05
100,169,775
0
1
null
null
null
null
UTF-8
Java
false
false
5,568
java
package test.javax.management.Introspector; /* * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * @test * @bug 4947001 4954369 4954409 4954410 * @summary Test that "Boolean isX()" and "int isX()" define operations * @author Eamonn McManus * @run clean IsMethodTest * @run build IsMethodTest * @run main IsMethodTest */ import javax.management.AttributeNotFoundException; import javax.management.MBeanAttributeInfo; import javax.management.MBeanInfo; import javax.management.MBeanOperationInfo; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; import test.javax.management.*; /* This regression test covers a slew of bugs in Standard MBean reflection. Lots of corner cases were incorrect: In the MBeanInfo for a Standard MBean: - Boolean isX() defined an attribute as if it were boolean isX() - int isX() defined neither an attribute nor an operation When calling MBeanServer.getAttribute: - int get() and void getX() were considered attributes even though they were operations in MBeanInfo When calling MBeanServer.invoke: - Boolean isX() could not be called because it was (consistently with MBeanInfo) considered an attribute, not an operation */ public class IsMethodTest { public static void main(String[] args) throws Exception { System.out.println("Test that Boolean isX() and int isX() both " + "define operations not attributes"); MBeanServer mbs = MBeanServerFactory.createMBeanServer(); Object mb = new IsMethod(); ObjectName on = new ObjectName("a:b=c"); mbs.registerMBean(mb, on); MBeanInfo mbi = mbs.getMBeanInfo(on); boolean ok = true; MBeanAttributeInfo[] attrs = mbi.getAttributes(); if (attrs.length == 0) System.out.println("OK: MBean defines 0 attributes"); else { ok = false; System.out.println("TEST FAILS: MBean should define 0 attributes"); for (int i = 0; i < attrs.length; i++) { System.out.println(" " + attrs[i].getType() + " " + attrs[i].getName()); } } MBeanOperationInfo[] ops = mbi.getOperations(); if (ops.length == 4) System.out.println("OK: MBean defines 4 operations"); else { ok = false; System.out.println("TEST FAILS: MBean should define 4 operations"); } for (int i = 0; i < ops.length; i++) { System.out.println(" " + ops[i].getReturnType() + " " + ops[i].getName()); } final String[] bogusAttrNames = {"", "Lost", "Thingy", "Whatsit"}; for (int i = 0; i < bogusAttrNames.length; i++) { final String bogusAttrName = bogusAttrNames[i]; try { mbs.getAttribute(on, bogusAttrName); ok = false; System.out.println("TEST FAILS: getAttribute(\"" + bogusAttrName + "\") should not work"); } catch (AttributeNotFoundException e) { System.out.println("OK: getAttribute(" + bogusAttrName + ") got exception as expected"); } } final String[] opNames = {"get", "getLost", "isThingy", "isWhatsit"}; for (int i = 0; i < opNames.length; i++) { final String opName = opNames[i]; try { mbs.invoke(on, opName, new Object[0], new String[0]); System.out.println("OK: invoke(\"" + opName + "\") worked"); } catch (Exception e) { ok = false; System.out.println("TEST FAILS: invoke(" + opName + ") got exception: " + e); } } if (ok) System.out.println("Test passed"); else { System.out.println("TEST FAILED"); System.exit(1); } } public static interface IsMethodMBean { public int get(); public void getLost(); public Boolean isThingy(); public int isWhatsit(); } public static class IsMethod implements IsMethodMBean { public int get() { return 0; } public void getLost() { } public Boolean isThingy() { return Boolean.TRUE; } public int isWhatsit() { return 0; } } }
[ "truongthelinh95@gmail.com" ]
truongthelinh95@gmail.com
7caa0016d05e921a977d59eaffb93e0fabc89f1a
13a62ca15e7f4eafaab9dfa2b804584df35c0beb
/app/src/main/java/ariel/az/devcode20/Principal.java
7b590bd0fa6473257b11764dfa64025757b47aef
[]
no_license
RYNEEER/devCode2.0
134b5e33f765a0e01dd599b98a4d8f9c43fb4774
39a4f8afd8a1535a31c27e96652666261c1934cc
refs/heads/master
2020-09-21T21:52:33.047875
2019-11-15T17:21:45
2019-11-15T17:21:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,982
java
package ariel.az.devcode20; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.Fragment; import android.os.Bundle; import android.view.MenuItem; import com.google.android.material.bottomnavigation.BottomNavigationView; import ariel.az.devcode20.Fragmentos.iniciofragmento; import ariel.az.devcode20.Fragmentos.perfilfragmento; import ariel.az.devcode20.Fragmentos.publicacionfragmento; public class Principal extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_principal); BottomNavigationView bottomNav = findViewById(R.id.navegation); bottomNav.setOnNavigationItemSelectedListener(navListener); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, new iniciofragmento()).commit(); } private BottomNavigationView.OnNavigationItemSelectedListener navListener = new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) { Fragment selectedFragment = null; switch (menuItem.getItemId()) { case R.id.home: selectedFragment = new iniciofragmento(); break; case R.id.publicacion: selectedFragment = new publicacionfragmento(); break; case R.id.profile: selectedFragment = new perfilfragmento(); break; } getSupportFragmentManager().beginTransaction().replace(R.id.fragment_layout, selectedFragment).commit(); return true; } }; }
[ "deibyrex011@outlook.es" ]
deibyrex011@outlook.es
fc0226685795c0ba59b053addd60582ba44cebb2
32dea875e76d46f0fc4c399c3d1a2b546bcbd5b8
/Tile.java
41ba00dc20841e653d84557431bd592dd46c483b
[]
no_license
Eric4106/CivilizationVII
15be44398ad771d29238acaa49b7a91cc2260065
eb10fa1cff98b3bfdc6eafb4af4c29a7fd8e94e5
refs/heads/master
2021-03-04T11:09:19.482640
2020-03-13T12:08:59
2020-03-13T12:08:59
246,029,194
0
0
null
null
null
null
UTF-8
Java
false
false
9,323
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package civilization.vii; //@author 710568 import java.awt.Color; import java.awt.Graphics; public class Tile extends Sprite { public class Yeilds { private int food, production, gold, science, faith, tourism, culture, happiness; } private static final int width = 50; private static final int height = 50; private String terain; private boolean hill; private Color color; private Feature feature; private Resource resource; public Tile(int x, int y) { super(x, y); this.terain = "TERAIN_GRASS"; this.hill = false; this.color = setColor(); this.feature = createFeature(); this.resource = createResource(); } public Tile(int x, int y, int terainId) { super(x, y); this.terain = setTerain(terainId); this.color = setColor(); this.feature = createFeature(); this.resource = createResource(); } public Tile(int x, int y, String terain) { super(x, y); this.terain = terain; this.color = setColor(); this.feature = createFeature(); this.resource = createResource(); } public String setTerain(int terainId) { String terain; switch(terainId) { case 0: terain = "TERAIN_GRASS"; break; case 1: terain = "TERAIN_PLAINS"; break; case 2: terain = "TERAIN_DESERT"; break; case 3: terain = "TERAIN_TUNDRA"; break; case 4: terain = "TERAIN_SNOW"; break; case 5: terain = "TERAIN_COAST"; break; case 6: terain = "TERAIN_OCEAN"; break; case 7: terain = "TERAIN_MOUNTAINS"; break; default: System.out.println("Unknown Terain Id at (" + super.getX() + ", " + super.getY() + ") - Recived: " + terainId); terain = null; break; } return terain; } public Color setColor() { Color color; switch(terain) { case "TERAIN_GRASS": color = new Color(20, 200, 60); break; case "TERAIN_PLAINS": color = new Color(180, 220, 60); break; case "TERAIN_DESERT": color = new Color(240, 240, 140); break; case "TERAIN_TUNDRA": color = new Color(120, 120, 120); break; case "TERAIN_SNOW": color = new Color(220, 240, 255); break; case "TERAIN_COAST": color = new Color(100, 200, 255); break; case "TERAIN_OCEAN": color = new Color(20, 0, 140); break; case "TERAIN_MOUNTAINS": color = new Color(140, 80, 0); break; default: System.out.println("Unknown Terain at (" + super.getX() + ", " + super.getY() + ") - Recived: " + terain); color = new Color(0, 0, 0); break; } return color; } public String getTerain() { return terain; } public void generateHills() { if (!(getTerain().equals("TERAIN_OCEAN") || getTerain().equals("TERAIN_COAST") || getTerain().equals("TERAIN_MOUNTAINS"))) { if (Math.random() < .2) { if (getTerain().equals("TERAIN_SNOW")) { if (Math.random() < .33) { this.hill = true; } else { this.hill = false; } } else { this.hill = true; } } else { this.hill = false; } } else { this.hill = false; } } public Feature createFeature() { Feature feature = null; switch(terain) { case "TERAIN_GRASS": if (Math.random() < .40) { feature = new Feature(super.getX(), super.getY(), "FEATURE_FOREST"); } else if (Math.random() < .33) { feature = new Feature(super.getX(), super.getY(), "FEATURE_JUNGLE"); } else if (Math.random() < .25) { feature = new Feature(super.getX(), super.getY(), "FEATURE_MARSH"); } break; case "TERAIN_PLAINS": if (Math.random() < .5) { feature = new Feature(super.getX(), super.getY(), "FEATURE_FOREST"); } break; case "TERAIN_DESERT": if (Math.random() < .1) { feature = new Feature(super.getX(), super.getY(), "FEATURE_OASIS"); } else if (Math.random() < .37) { feature = new Feature(super.getX(), super.getY(), "FEATURE_FLOOD_PLAINS"); } break; case "TERAIN_TUNDRA": if (Math.random() < .66) { feature = new Feature(super.getX(), super.getY(), "FEATURE_FOREST"); } break; case "TERAIN_SNOW": feature = null; break; case "TERAIN_COAST": if (Math.random() < .15) { feature = new Feature(super.getX(), super.getY(), "FEATURE_ATOLL"); } break; case "TERAIN_OCEAN": if (Math.random() < .1) { feature = new Feature(super.getX(), super.getY(), "FEATURE_ATOLL"); } else if (Math.random() < .17) { feature = new Feature(super.getX(), super.getY(), "FEATURE_ATOLL"); } break; case "TERAIN_MOUNTAINS": feature = null; break; default: System.out.println("Unknown Terain at (" + super.getX() + ", " + super.getY() + ") - Recived: " + terain); feature = null; break; } return feature; } public Resource createResource() { Resource resource = null; if (hill) { switch(terain) { case "TERAIN_GRASS": break; case "TERAIN_PLAINS": break; case "TERAIN_DESERT": break; case "TERAIN_TUNDRA": break; case "TERAIN_SNOW": break; case "TERAIN_COAST": break; case "TERAIN_OCEAN": break; case "TERAIN_MOUNTAINS": break; default: System.out.println("Unknown Terain at (" + super.getX() + ", " + super.getY() + ") - Recived: " + terain); resource = null; break; } } else { switch(terain) { case "TERAIN_GRASS": break; case "TERAIN_PLAINS": break; case "TERAIN_DESERT": break; case "TERAIN_TUNDRA": break; case "TERAIN_SNOW": break; case "TERAIN_COAST": break; case "TERAIN_OCEAN": break; case "TERAIN_MOUNTAINS": break; default: System.out.println("Unknown Terain at (" + super.getX() + ", " + super.getY() + ") - Recived: " + terain); resource = null; break; } } return resource; } @Override public void draw(Graphics g) { g.setColor(color); g.fillRect(super.getX() * width, super.getY() * height, width, height); if (getTerain().equals("TERAIN_MOUNTAINS")) { g.setColor(new Color(0, 0, 0)); int sideMargin = 10; int topMargin = 10; int bottomMargin = 5; int[] xPoints = new int[3]; xPoints[0] = (super.getX() * width) + sideMargin; xPoints[1] = (super.getX() * width) + width / 2; xPoints[2] = (super.getX() * width) + width - sideMargin; int[] yPoints = new int[3]; yPoints[0] = (super.getY() * height) + height - bottomMargin; yPoints[1] = (super.getY() * height) + topMargin; yPoints[2] = (super.getY() * height) + height - bottomMargin; g.fillPolygon(xPoints, yPoints, 3); } if (hill) { g.setColor(new Color(0, 0, 0)); int sideMargin = 10; int topMargin = 25; int bottomMargin = 3; int[] xPoints = new int[3]; xPoints[0] = (super.getX() * width) + sideMargin; xPoints[1] = (super.getX() * width) + width / 2; xPoints[2] = (super.getX() * width) + width - sideMargin; int[] yPoints = new int[3]; yPoints[0] = (super.getY() * height) + height - bottomMargin; yPoints[1] = (super.getY() * height) + topMargin; yPoints[2] = (super.getY() * height) + height - bottomMargin; g.fillPolygon(xPoints, yPoints, 3); } if (feature != null) { g.setColor(new Color(0, 0, 0)); try { g.drawString(feature.getFeature(), (super.getX() * width) + 5, (super.getY() * height) + 25); } catch(Exception NullPointerException) {} } } public void printInfo() { System.out.print("(" + super.getX() + ", " + super.getY() + ")"); System.out.print(" - Type: " + terain); System.out.print(" - Hill: " + hill); if (feature != null) { System.out.print(" - Feature: " + feature.getFeature()); } else { System.out.print(" - Feature: null"); } if (resource != null) { System.out.print(" - Feature: " + resource.getResource()); } else { System.out.print(" - Feature: null"); } System.out.println(); } }
[ "noreply@github.com" ]
Eric4106.noreply@github.com
1e8fa7a241e86d9b6163f268a4b0bb587ad19aa0
2ec3df58e6413932338aa756444647cf5782e164
/app/src/main/java/com/android/loginwithgmail/Duration.java
d7012cc7120c76bc4d0966ad764133e2ab684d52
[]
no_license
Anusara25836/GUBKKproject
85c60702345cc31feecfff58920b9bd9f44d8fad
1c8fa60a1940c3075e440d7a5faca6571dcd95b6
refs/heads/master
2020-01-23T21:44:44.821081
2017-03-20T10:35:32
2017-03-20T10:35:32
74,694,094
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package com.android.loginwithgmail; public class Duration { public String text; public int value; public Duration(String text, int value) { this.text = text; this.value = value; } }
[ "anusara.2960@gmail.com" ]
anusara.2960@gmail.com
e798b23bf43bf3d894292796291234d52e793de4
af65fb90cf88e3b23503f26a534d2fdf33722d46
/JAVABasicReview/src/com/kermit/list/AsList.java
84ad3ae26884d83eb5dd866d1d1e07a6bb146c31
[]
no_license
kermitliu1/JAVABasicReview
2320ce824be971695bb76aa1cfab90eaf5a8eb8b
0994ea221153ed8f03e946ce98cd2392fc8eb9f7
refs/heads/master
2023-06-22T13:56:51.603801
2017-10-10T13:39:46
2017-10-10T13:39:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package com.kermit.list; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class AsList { public static void main(String[] args) { // 数组转集合,不能增加和减少元素,但是可以用集合的思想操作数组 String[] arr = {"a","b","c","d"}; List<String> list = Arrays.asList(arr); // 数组转集合 System.out.println(list); // [a, b, c, d] int[] arr1 = {11,12,33,44}; // 基本数据类型数组转成集合,会将整个数组当成一个对象 List<int[]> list1 = Arrays.asList(arr1); // 数组对象 System.out.println(list1); // [[I@7852e922] Integer[] arr2 = {11,12,33,44}; List<Integer> list2 = Arrays.asList(arr2); System.out.println(list2); // [11, 12, 33, 44] // 集合转数组 带泛型 ArrayList<String> arrList = new ArrayList<>(); arrList.add("a"); arrList.add("b"); arrList.add("c"); arrList.add("d"); arrList.add("e"); String[] array = arrList.toArray(new String[0]); // 数组长度小于等于集合的size时,转换后的数组长度等于集合长度 // 数组长度大于集合size时,分配的数组长度就和指定的长度一样 for (String string : array) { System.out.println(string); } } }
[ "kermitkangxu@163.com" ]
kermitkangxu@163.com
d5ebbba6632a84d65b47ff7cea4bcf31a8324956
62736a74c640c3775472592807b2f1500c297084
/MicroGames/src/main/java/git/jluvisi/util/Permissions.java
99a8e97ed91ef53244d8107b6ee7f867d8b6293b
[ "Apache-2.0" ]
permissive
jluvisi2021/MicroGames
c74896ca3a5ba497cb9d602fc0e603962e08864f
855cdb32dcf6d4f9aee2668b2884788c5915fde4
refs/heads/main
2023-02-21T00:51:40.593231
2021-01-23T01:51:35
2021-01-23T01:51:35
331,084,994
1
0
null
null
null
null
UTF-8
Java
false
false
1,401
java
package git.jluvisi.util; /** * Manages the permissions in the plugin. Permissions are repersented as enums * which point to the node of the config. */ public enum Permissions { /** <strong>Node:</strong> <i>permissions.reload-config </i> */ RELOAD_CONFIG("permissions.reload-config"), /** <strong>Node:</strong> <i>permissions.setup-game-sign </i> */ SETUP_SIGN("permissions.setup-game-sign"), /** <strong>Node:</strong> <i>permissions.destroy-game-sign </i> */ DESTROY_SIGN("permissions.destroy-game-sign"), /** <strong>Node:</strong> <i>permissions.use-join-sign </i> */ JOIN_GAME_SIGN("permissions.use-join-sign"), /** <strong>Node:</strong> <i>permissions.join-game </i> */ JOIN_GAME("permissions.join-game"), /** <strong>Node:</strong> <i>permissions.leave-game </i> */ LEAVE_GAME("permissions.leave-game"), /** <strong>Node:</strong> <i>permissions.leave-game </i> */ BEGIN_GAME("permissions.start-game"), /** <strong>Node:</strong> <i>notify-announce-game-start </i> */ NOTIFY("permissions.notify-announce-game-start"); /** Repersents the path in the config relative to the enum. */ private final String node; Permissions(String node) { this.node = node; } /** Returns the raw node of the config without any parsing. */ @Override public String toString() { return node; } }
[ "65638832+jluvisi2021@users.noreply.github.com" ]
65638832+jluvisi2021@users.noreply.github.com
660c48cfbf76e170a02febb8a203ba5d6fd9e885
16d722ab38d42aefa3df802c521dfd514ddad339
/src/his/app/DisplayConfigActivity.java
f34456b99075ae96f3dcfe19e9b3a518ae8b7b60
[]
no_license
GaoYJian/QueueDisplay
83eaf6d779f50284710871dd323b2cb0208653e1
b3cb60da95cd055411176856226173da3be07069
refs/heads/master
2021-01-17T17:42:19.882929
2017-08-22T08:41:15
2017-08-22T08:41:15
61,359,694
0
0
null
null
null
null
GB18030
Java
false
false
3,355
java
package his.app; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class DisplayConfigActivity extends Activity { private EditText configEditText; private Button confirmBtn; private Button testConnect; View main; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.openconfig); configEditText=(EditText)findViewById(R.id.et_configText); confirmBtn=(Button)findViewById(R.id.btn_confirm); testConnect = (Button)findViewById(R.id.btn_testConnect); SharedPreferences sp = getSharedPreferences("userInfo", Context.MODE_WORLD_READABLE); configEditText.setText(sp.getString("DISPLAY_WEBSERVICE", "")); confirmBtn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub setConfig(); } }); testConnect.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub if(configEditText.length()==0){ disPlayToast("请输入地址"); }else{ ConnectHanlder ch = new ConnectHanlder(); if(ch.Ping(configEditText.getText().toString())){ disPlayToast("网络连通成功"); }else{ disPlayToast("网络连通失败"); } } } }); } private void setConfig(){ String textContext=configEditText.getText().toString(); if(textContext.equals("")) return; SharedPreferences sp = getSharedPreferences("userInfo", Context.MODE_WORLD_READABLE); sp.edit().putString("DISPLAY_WEBSERVICE", textContext).commit(); Intent intent=new Intent(); intent.setClass(DisplayConfigActivity.this, HISQueueDisplayActivity.class); startActivity(intent); DisplayConfigActivity.this.finish(); } private void exitActivity(){ //DisplayConfigActivity.this.finish(); //System.exit(0); Intent intent = new Intent(); intent.setClass(DisplayConfigActivity.this, HISQueueDisplayActivity.class); startActivity(intent); DisplayConfigActivity.this.finish(); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { exitActivity(); } return true; } public void disPlayToast(String s){ Toast toast = Toast.makeText(this, s, Toast.LENGTH_SHORT); // 设置toast显示的位置 toast.setGravity(Gravity.TOP, 0, 80); // 显示该Toast toast.show(); } /* private void ToTestActivity(View view){ Intent intent = new Intent(); intent.setClass(DisplayConfigActivity.this,TestActivity.class); startActivity(intent); DisplayConfigActivity.this.finish(); }*/ }
[ "411219209@qq.com" ]
411219209@qq.com
c08641d858d199bac1029dcb3f13183c41554740
2d5e3dd1c6cd71a71d78ffca9980a8884cf4dc6e
/src/main/java/com/xj/iws/common/data/DataProcess.java
e13922438a24361898bec66109511fa207842378
[]
no_license
dashtom3/iws-server-user
a17d4d2ffb116b7525108a3d459e01a1466b869b
6b5c9602c7aa9d4927a2f2d66aa624513084e8a4
refs/heads/master
2021-05-11T17:10:45.651208
2018-01-30T03:42:31
2018-01-30T03:42:31
117,788,927
0
0
null
null
null
null
UTF-8
Java
false
false
17,164
java
package com.xj.iws.common.data; import com.xj.iws.common.enums.DataEnum; import com.xj.iws.common.utils.ByteUtil; import com.xj.iws.common.utils.StrCastUtil; import com.xj.iws.http.mvc.dao.PointRoleDao; import com.xj.iws.http.mvc.entity.DataEntity; import com.xj.iws.http.mvc.entity.util.DataField; import com.xj.iws.http.mvc.entity.PointFieldEntity; import com.xj.iws.http.mvc.entity.util.ViewDataEntity; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.*; /** * * Created by XiaoJiang01 on 2017/3/16. */ @Component public class DataProcess { @Autowired PointRoleDao pointRoleDao; List<Map<String, String>> status; public List<PointFieldEntity> pointFields; private static int odd=0;//用于计数四个BIT public DataProcess() { } public void enable(List<PointFieldEntity> pointFields) { this.pointFields = pointFields; status = pointRoleDao.getStatus(0); } public List<DataField> pumpStatus(DataEntity data) { List<DataField> pumpStatus = new ArrayList<DataField>(); //数据分段 String[] arrayData = DataFormat.subData(data.getData(), 4); for (int i = 0; i < pointFields.size(); i++) { //获取数据对应字段 PointFieldEntity field = pointFields.get(i); DataField dataField; switch (field.getRoleId()) { case 4: dataField = role04(arrayData[i]); dataField.setNumber(i); dataField.setName(field.getName()); pumpStatus.add(dataField); break; case 5: dataField = role05(arrayData[i]); dataField.setNumber(i); dataField.setName(field.getName()); pumpStatus.add(dataField); break; default: break; } } return pumpStatus; } public ViewDataEntity process(DataEntity data,int type) { String port = data.getPort(); String number = data.getNumber(); Date time = data.getTime(); int count = data.getCount(); int length = data.getBit(); String addressName = data.getAddressName(); String locationName = data.getLocationName(); String roomName = data.getRoomName(); String groupName = data.getGroupName(); String value = data.getData(); if (null == value || "".equals(value)) return null; List<DataField> dataFields =new ArrayList<DataField>(); boolean flag=false; if(type==2){//MODBUS协议 String[] arrayData = DataFormat.subData(data.getData(), length); dataFields = analyze(arrayData); if(!"ER".equals(data.getError())){ flag=true; } }else if(type==1){//TCP协议 dataFields = analyzeForSComm(data.getData()); } ViewDataEntity viewData = new ViewDataEntity(port, number, time, DataEnum.No_Exception, count, addressName, locationName, roomName, groupName, dataFields); if (flag) { viewData.setException(DataEnum.Exception); } return viewData; } private List<DataField> analyzeForSComm(String data) { List<DataField> dataFields=new ArrayList<DataField>(); data=data.substring(50);//去掉5-6层,留下7层数据 //将电表规则进行数据解析 int index=0; for(int i=0;i<pointFields.size();i++){ PointFieldEntity field=pointFields.get(i); DataField dataField; switch (field.getRoleId()){ case 6: numberToZero(); dataField=role07(data,field,index); index+=2; break; case 7: numberToZero(); dataField=role08(data,field,index); index+=2; break; case 8: numberToZero(); dataField=role09(data,field,index); index+=4; break; case 9: numberToZero(); dataField=role10(data,field,index); index+=8; break; case 10: numberToZero(); dataField=role11(data,field,index,field.getLength()); index+=8; break; case 11: if(odd==0){ dataField=role12(data,field,index); index+=2; odd++; }else{ dataField=role15(data,field,index); numberToZero(); } break; case 12: numberToZero(); dataField=role13(data,field,index); index+=2; break; case 13: numberToZero(); dataField=role14(data,field,index); index+=2; break; case 18: numberToZero(); dataField = new DataField(); index+=20; break; case 16: numberToZero(); dataField = new DataField(); index+=8; break; case 14: numberToZero(); dataField = new DataField(); index+=2; break; case 17: numberToZero(); dataField=role16(data,field,index); index+=2; break; case 15: numberToZero(); dataField = new DataField(); index+=4; break; case 19: numberToZero(); dataField = new DataField(); index+=100; break; default: numberToZero(); dataField = new DataField(); break; } dataField.setNumber(i); dataField.setName(field.getName()); dataFields.add(dataField); } numberToZero(); return dataFields; } private DataField role10(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,8+index); System.out.println("temp_data"); Long value=Long.parseLong(temp_data.trim(), 16); dataField.setData(value + field.getUnit()); return dataField; } private DataField role16(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index-2,index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(7))){ value="无水故障"; }else if("1".equals(code.substring(6,7))){ value="高水信号"; }else if("1".equals(code.substring(5,6))){ value="地面积水信号"; }else if("1".equals(code.substring(4,5))){ value="相序故障"; }else if("1".equals(code.substring(3,4))) { value = "地面积水信号"; }else{ value="正常"; } dataField.setData(value); return dataField; } private DataField role15(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index-2,index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(0,1))){ value="故障"; }else if("1".equals(code.substring(1,2))){ value="空开跳闸"; }else if("01".equals(code.substring(2,4))){ value="运行"; }else { value="休息"; } dataField.setData(value); return dataField; } private DataField role14(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,2+index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(6,7))){ value="视频监控报警"; }else{ value="正常"; } dataField.setData(value); return dataField; } private DataField role13(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,2+index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(5,6))){ value="非法入侵信号2"; }else if("1".equals(code.substring(3,4))){ value="非法入侵信号1"; }else{ value="正常"; } dataField.setData(value); return dataField; } private DataField role12(String data, PointFieldEntity field, int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,2+index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(4,5))){ value="故障"; }else if("1".equals(code.substring(5,6))){ value="空开跳闸"; }else if("01".equals(code.substring(6))){ value="运行"; }else { value="休息"; } dataField.setData(value); return dataField; } private DataField role11(String data, PointFieldEntity field, int index,int length) { DataField dataField = new DataField(); String temp_data=data.substring(index,8+index); System.out.println("temp_data"); Float value=Float.intBitsToFloat((int)Long.parseLong(temp_data.trim(), 16)); if(!value.isNaN()){ if(field.getMultiple()!=0){ value=value/(field.getMultiple());//除以倍率 } }else{ value=0f; } BigDecimal b = new BigDecimal(value); BigDecimal bigDecimal= b.setScale(length, BigDecimal.ROUND_HALF_UP); dataField.setData(bigDecimal + field.getUnit()); return dataField; } private DataField role07(String data, PointFieldEntity field,int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,2+index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("1".equals(code.substring(4,5))){ value="故障"; }else if("1".equals(code.substring(3,4))){ value="运行"; }else{ value="休息"; } dataField.setData(value); return dataField; } private DataField role08(String data, PointFieldEntity field,int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,2+index); String code= StrCastUtil.hexStrToBinaryStr(temp_data); String value=""; if("00".equals(code.substring(6,8))){ value="无"; }else if("01".equals(code.substring(6,8))){ value="低液位报警"; }else if("10".equals(code.substring(6,8))){ value="高液位报警"; } dataField.setData(value); return dataField; } private DataField role09(String data, PointFieldEntity field,int index) { DataField dataField = new DataField(); String temp_data=data.substring(index,4+index); Integer value=Integer.parseInt(temp_data,16); dataField.setValue(value); String unit=field.getUnit(); if(unit==null) unit=""; dataField.setData(String.valueOf(value) + unit); return dataField; } private List<DataField> analyze(String[] data) { List<DataField> dataFields = new ArrayList<DataField>(); for (int i = 0; i < pointFields.size(); i++) { PointFieldEntity field = pointFields.get(i); DataField dataField; int j = field.getNumber() -1; //分别对应数据库中不同的释义规则 switch (field.getRoleId()) { case 1: dataField = role01(data[j], field); break; case 2: dataField = role02(data[j]); break; case 3: dataField = role03(data[j]); break; case 4: dataField = role04(data[j]); break; case 5: dataField = role05(data[j]); break; case 6: dataField = role06(data[j], field); break; default: dataField = new DataField(); break; } dataField.setNumber(i); dataField.setName(field.getName()); dataFields.add(dataField); } return dataFields; } private DataField role01(String s, PointFieldEntity field) { DataField data = new DataField(); double value = (double) Integer.parseInt(s, 16) / field.getMultiple(); if (value < field.getMin() || value > field.getMax()) { data.setException(DataEnum.Exception); } data.setValue(value); data.setData(String.valueOf(value) + field.getUnit()); return data; } private DataField role02(String s) { DataField data = new DataField(); StringBuffer value = new StringBuffer(); s = ByteUtil.hexToBinary(s); s = s.substring(8, 16); char[] point = s.toCharArray(); // for (int j = 0; j < point.length; j++) { // if (point[j] == '1') { // value.append(status.get(1).get(String.valueOf(j + 1)) + " "); // } // } //修改 for (int j = 0; j < point.length; j++) { if (point[j] == '1') { value.append(status.get(1).get(String.valueOf(j + 1)) + ""); break; } } if (point[5] == '1') { data.setException(DataEnum.Exception); } data.setData(String.valueOf(value)); data.setValue(Double.parseDouble(s)); return data; } private DataField role03(String s) { DataField data = new DataField(); StringBuffer value = new StringBuffer(); s = ByteUtil.hexToBinary(s); s = s.substring(10, 16); char[] point = s.toCharArray(); for (int j = 0; j < point.length; j++) { // if (point[j] == '1') { // value.append(status.get(2).get(String.valueOf(j + 1)) + " "); // data.setData(String.valueOf(value)); // data.setException(DataEnum.Exception); // } //修改 if (point[j] == '1') { value.append(status.get(2).get(String.valueOf(j + 1)) + ""); data.setData(String.valueOf(value)); data.setException(DataEnum.Exception); break; } } data.setValue(Double.parseDouble(s)); return data; } private DataField role04(String s) { DataField data = new DataField(); int i = Integer.parseInt(s); data.setValue(i); data.setData(status.get(3).get(String.valueOf(i + 1))); return data; } private DataField role05(String s) { DataField data = new DataField(); int i = Integer.parseInt(s); data.setValue(i); data.setData(status.get(4).get(String.valueOf(i + 1))); return data; } private DataField role06(String s, PointFieldEntity field) { DataField data = new DataField(); double temp = (double) Float.intBitsToFloat(Integer.parseInt(s, 16)); double value = Double.parseDouble(new DecimalFormat("#.00").format(temp)); if (value < field.getMin() || value > field.getMax()) { data.setException(DataEnum.Exception); } data.setValue(value); data.setData(String.valueOf(value) + field.getUnit()); return data; } //清零计数器 private void numberToZero(){ if(odd!=0){ odd=0; } } }
[ "15222004571@163.com" ]
15222004571@163.com
f89182aadfd067c09a55a338a019f474d93fa59d
8433deaa604c202d8867dff6b8c5f4abac3a21b0
/src/main/java/com/example/domain/Authorities.java
8dbfedafa455167c7459c0138f16c6cfbc4d5532
[ "Unlicense" ]
permissive
briansheen/myWeather
dfd7db1878d7ca046daee79e70f35de2e5ef39b7
24e2294ecb06d2399263f02aca49b11c26f362f6
refs/heads/master
2021-06-22T19:30:25.001851
2017-08-21T08:41:56
2017-08-21T08:41:56
100,439,720
0
0
null
null
null
null
UTF-8
Java
false
false
925
java
package com.example.domain; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.Table; /** * Created by bsheen on 8/18/17. */ @Entity @Table(name="authorities") public class Authorities { @EmbeddedId private AuthCompKey compKey; public AuthCompKey getCompKey() { return compKey; } public void setCompKey(AuthCompKey compKey) { this.compKey = compKey; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Authorities that = (Authorities) o; return compKey.equals(that.compKey); } @Override public int hashCode() { return compKey.hashCode(); } @Override public String toString() { return "Authorities{" + "compKey=" + compKey + '}'; } }
[ "bsheen@gmail.com" ]
bsheen@gmail.com
80719f31e0c22187cc7e8a719b9603b876220e14
be09fa37ea108eb7957e4bf0438cc98d8dbb6b71
/src/main/java/com/axity/status/service/StatusService.java
bef3f0c937d2963d1c7b8c26c3c5bc2ce0fcc9f1
[]
no_license
lfbv98/Status
c464acc2d20431d6766673492339ef28aeff864b
f3bf059a32c72ca0a9cb0a37efe3f3a0cdf87893
refs/heads/master
2023-01-30T22:51:27.197630
2020-11-23T17:01:58
2020-11-23T17:01:58
314,444,241
0
0
null
null
null
null
UTF-8
Java
false
false
12,402
java
package com.axity.status.service; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumSet; import java.util.List; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import com.axity.status.model.AppModel; import com.axity.status.model.Modelo; import com.axity.status.model.SmsModel; import com.axity.status.service.model.ServicioModel; import com.axity.status.util.TransactionCode; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @Service public class StatusService { @Value("${url.app}") private String hostapp; @Value("${url.sms}") private String hostsms; @Value("${url.forms}") private String hostforms; @Value("${url.apdo}") private String hostapdo; @Value("${url.apdoudp}") private String hostapdoudp; @Value("${url.schedule}") private String hostschedule; @Value("${url.catalogo}") private String hostcatalogo; private static final Set<HttpStatus> validStates = EnumSet.of(HttpStatus.OK, HttpStatus.CREATED, HttpStatus.ACCEPTED); private static final Set<HttpStatus> invalidStates = EnumSet.of(HttpStatus.UNAUTHORIZED, HttpStatus.NOT_FOUND); private static final Set<HttpStatus> maintenanceStates = EnumSet.of(HttpStatus.SERVICE_UNAVAILABLE); private static final Logger LOG = LoggerFactory.getLogger(StatusService.class); public Modelo status() { // TODO Auto-generated method stub Modelo response = new Modelo(); try { List<ServicioModel> consulta = new ArrayList<>(); consulta.add(consultaApp()); consulta.add(consultaSMS()); consulta.add(consultaForms()); consulta.add(consultaApdo()); consulta.add(consultaApdoUDP()); consulta.add(consultaSchedule()); consulta.add(consultaCatalogo()); response.setServicios(consulta); response.setCode(TransactionCode.OK.getCode()); response.setMessage(TransactionCode.OK.getMessage()); } catch(Exception e) { response.setCode(TransactionCode.ERROR_TRANSACTION.getCode()); response.setMessage(TransactionCode.ERROR_TRANSACTION.getMessage()); LOG.error("Error al obtener el catalogo de establecimientos"); e.printStackTrace(); } return response; } private ServicioModel consultaApp() { ServicioModel service = new ServicioModel(); final String uri = hostapp; RestTemplate restTemplate = new RestTemplate(); AppModel newAppModel = new AppModel(); newAppModel.setEmail("jorge.delgado2@axity.com"); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); Gson gson = new GsonBuilder().create(); String json = gson.toJson(newAppModel); HttpEntity<String> request = new HttpEntity<>(json, headers); service.setName("App"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.POST, request, String.class); if (validStates.contains(response.getStatusCode())) { service.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { service.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (maintenanceStates.contains(response.getStatusCode())) { service.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return service; //Use the response.getBody() } private ServicioModel consultaSMS() { ServicioModel serviciosms = new ServicioModel(); final String uri = hostsms; RestTemplate restTemplate = new RestTemplate(); SmsModel newSmsModel = new SmsModel(); newSmsModel.setEmail("luis.buitrago@axity.com"); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); Gson gson = new GsonBuilder().create(); String json = gson.toJson(newSmsModel); HttpEntity<String> request = new HttpEntity<>(json, headers); serviciosms.setName("SMS"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.POST, request, String.class); if (validStates.contains(response.getStatusCode())) { serviciosms.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { serviciosms.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { serviciosms.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return serviciosms; } private ServicioModel consultaForms() { ServicioModel servicioforms = new ServicioModel(); final String uri = hostforms; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String> request = new HttpEntity<>(null, headers); servicioforms.setName("Forms"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, request, String.class); if (validStates.contains(response.getStatusCode())) { servicioforms.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { servicioforms.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { servicioforms.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return servicioforms; } private ServicioModel consultaApdo() { ServicioModel servicioapdo = new ServicioModel(); final String uri = hostapdo; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String> request = new HttpEntity<>(null, headers); servicioapdo.setName("Apartado de Lugares"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, request, String.class); if (validStates.contains(response.getStatusCode())) { servicioapdo.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { servicioapdo.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { servicioapdo.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return servicioapdo; } private ServicioModel consultaApdoUDP() { ServicioModel servicioapdoudp = new ServicioModel(); final String uri = hostapdoudp; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String> request = new HttpEntity<>(null, headers); servicioapdoudp.setName("Apartado de Lugares UDP"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, request, String.class); if (validStates.contains(response.getStatusCode())) { servicioapdoudp.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { servicioapdoudp.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { servicioapdoudp.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return servicioapdoudp; } private ServicioModel consultaSchedule() { ServicioModel servicioschedule = new ServicioModel(); final String uri = hostschedule; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String> request = new HttpEntity<>(null, headers); servicioschedule.setName("Schedule"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, request, String.class); if (validStates.contains(response.getStatusCode())) { servicioschedule.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { servicioschedule.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { servicioschedule.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return servicioschedule; } private ServicioModel consultaCatalogo() { ServicioModel serviciocatalogo = new ServicioModel(); final String uri = hostcatalogo; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON)); HttpEntity<String> request = new HttpEntity<>(null, headers); serviciocatalogo.setName("Catalogo Ladas"); ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, request, String.class); if (validStates.contains(response.getStatusCode())) { serviciocatalogo.setStatus("Activo"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); }else if (invalidStates.contains(response.getStatusCode())) { serviciocatalogo.setStatus("Fuera de Servicio"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } else if (maintenanceStates.contains(response.getStatusCode())) { serviciocatalogo.setStatus("Mantenimiento"); String respuestabody = response.getBody(); LOG.info("El contenido de la respuesta es "+respuestabody); } return serviciocatalogo; } }
[ "lfbuitrago@gmail.com" ]
lfbuitrago@gmail.com
e931ccc58ba1791da2dcabf5c6419afc8faffb33
75d1f41d291ba9662b5abf12b5fd01a240f9cd5a
/xui_lib/src/main/java/com/xuexiang/xui/widget/textview/supertextview/BaseTextView.java
9647929e9f8515480b9640bcbd62f27c7dd07813
[ "Apache-2.0" ]
permissive
CrackerCat/XUI
4730ef38a46bf69e0cbf94ec5236fd4257b457b3
491d9f770fa74f51df6c50b8967810ae136ec2f1
refs/heads/master
2023-02-19T05:18:02.818052
2022-11-17T15:41:05
2022-11-17T15:41:05
239,412,037
0
1
Apache-2.0
2020-02-10T02:34:06
2020-02-10T02:34:06
null
UTF-8
Java
false
false
5,112
java
package com.xuexiang.xui.widget.textview.supertextview; import android.content.Context; import android.graphics.Typeface; import android.text.InputFilter; import android.text.TextUtils; import android.util.AttributeSet; import android.view.Gravity; import android.widget.LinearLayout; import android.widget.TextView; import io.github.inflationx.calligraphy3.HasTypeface; /** * 基础TextView * * @author xuexiang * @since 2019/1/14 下午10:09 */ public class BaseTextView extends LinearLayout implements HasTypeface { private Context mContext; private TextView mTopTextView, mCenterTextView, mBottomTextView; private LayoutParams mTopTVParams, mCenterTVParams, mBottomTVParams; public BaseTextView(Context context) { super(context); init(context); } public BaseTextView(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public BaseTextView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } private void init(Context context) { this.setOrientation(VERTICAL); mContext = context; initView(); } private void initView() { initTopView(); initCenterView(); initBottomView(); } private void initTopView() { if (mTopTVParams == null) { mTopTVParams = getParams(mTopTVParams); } if (mTopTextView == null) { mTopTextView = initTextView(mTopTVParams, mTopTextView); } } private void initCenterView() { if (mCenterTVParams == null) { mCenterTVParams = getParams(mCenterTVParams); } if (mCenterTextView == null) { mCenterTextView = initTextView(mCenterTVParams, mCenterTextView); } } private void initBottomView() { if (mBottomTVParams == null) { mBottomTVParams = getParams(mBottomTVParams); } if (mBottomTextView == null) { mBottomTextView = initTextView(mBottomTVParams, mBottomTextView); } } private TextView initTextView(LayoutParams params, TextView textView) { textView = getTextView(textView, params); textView.setGravity(Gravity.CENTER); addView(textView); return textView; } /** * 初始化textView * * @param textView 对象 * @param layoutParams 对象 * @return 返回 */ public TextView getTextView(TextView textView, LayoutParams layoutParams) { if (textView == null) { textView = new TextView(mContext); textView.setLayoutParams(layoutParams); textView.setVisibility(GONE); } return textView; } /** * 初始化Params * * @param params 对象 * @return 返回 */ public LayoutParams getParams(LayoutParams params) { if (params == null) { params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } return params; } private void setTextString(TextView textView, CharSequence textString) { textView.setText(textString); if (!TextUtils.isEmpty(textString)) { textView.setVisibility(VISIBLE); } } public void setTopTextString(CharSequence s) { setTextString(mTopTextView, s); } public void setCenterTextString(CharSequence s) { setTextString(mCenterTextView, s); } public void setBottomTextString(CharSequence s) { setTextString(mBottomTextView, s); } public TextView getTopTextView() { return mTopTextView; } public TextView getCenterTextView() { return mCenterTextView; } public TextView getBottomTextView() { return mBottomTextView; } public void setMaxEms(int topMaxEms, int centerMaxEms, int bottomMaxEms) { mTopTextView.setEllipsize(TextUtils.TruncateAt.END); mCenterTextView.setEllipsize(TextUtils.TruncateAt.END); mBottomTextView.setEllipsize(TextUtils.TruncateAt.END); mTopTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(topMaxEms)}); mCenterTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(centerMaxEms)}); mBottomTextView.setFilters(new InputFilter[]{new InputFilter.LengthFilter(bottomMaxEms)}); } public void setCenterSpaceHeight(int centerSpaceHeight) { mTopTVParams.setMargins(0, 0, 0, centerSpaceHeight / 2); mCenterTVParams.setMargins(0, centerSpaceHeight / 2, 0, centerSpaceHeight / 2); mBottomTVParams.setMargins(0, centerSpaceHeight / 2, 0, 0); } @Override public void setTypeface(Typeface typeface) { if (mTopTextView != null) { mTopTextView.setTypeface(typeface); } if (mCenterTextView != null) { mCenterTextView.setTypeface(typeface); } if (mBottomTextView != null) { mBottomTextView.setTypeface(typeface); } } }
[ "xuexiangjys@163.com" ]
xuexiangjys@163.com
8368d2c726fa11f1350ed7aad2e2b26006e27a4c
60ab345245921aea8cab939fd44679d758b0d093
/src/com/afunms/system/manage/SystemManager.java
8c9157ab7d1f74aaeb67d212b8cb6e8329ff9eba
[]
no_license
guogongzhou/afunms
405d56f7c5cad91d0a5e1fea5c9858f1358d0172
40127ef7aecdc7428a199b0e8cce30b27207fee8
refs/heads/master
2021-01-15T19:23:43.488074
2014-11-11T06:36:48
2014-11-11T06:36:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,518
java
package com.afunms.system.manage; import java.util.List; import com.afunms.common.base.BaseManager; import com.afunms.common.base.DaoInterface; import com.afunms.common.base.ErrorMessage; import com.afunms.common.base.ManagerInterface; import com.afunms.common.util.SessionConstant; import com.afunms.system.dao.DepartmentDao; import com.afunms.system.dao.FunctionDao; import com.afunms.system.model.Department; import com.afunms.system.model.Function; import com.afunms.system.model.User; import com.afunms.system.util.CreateRoleFunctionTable; public class SystemManager extends BaseManager implements ManagerInterface { public String execute(String action) { if (action.equals("list")) { User user = (User) session.getAttribute(SessionConstant.CURRENT_USER); Function root = null; FunctionDao functionDao = null; try { functionDao = new FunctionDao(); root = (Function) functionDao.findByID("70"); } catch (Exception e) { } finally { functionDao.close(); } CreateRoleFunctionTable crft = new CreateRoleFunctionTable(); List<Function> functionRoleList = crft.getRoleFunctionListByRoleId(String.valueOf(user.getRole())); List<Function> functionList = crft.getAllFuctionChildByRoot(root, functionRoleList); request.setAttribute("root", root); request.setAttribute("functionList", functionList); return "/system/manage/list.jsp"; } if (action.equals("ready_add")) { return "/system/department/add.jsp"; } if (action.equals("add")) { Department vo = new Department(); vo.setDept(getParaValue("dept")); vo.setMan(getParaValue("man")); vo.setTel(getParaValue("tel")); DaoInterface dao = new DepartmentDao(); setTarget("/dept.do?action=list"); return save(dao, vo); } if (action.equals("delete")) { DaoInterface dao = new DepartmentDao(); setTarget("/dept.do?action=list"); return delete(dao); } if (action.equals("update")) { Department vo = new Department(); vo.setId(getParaIntValue("id")); vo.setDept(getParaValue("dept")); vo.setMan(getParaValue("man")); vo.setTel(getParaValue("tel")); DaoInterface dao = new DepartmentDao(); setTarget("/dept.do?action=list"); return update(dao, vo); } if (action.equals("ready_edit")) { DaoInterface dao = new DepartmentDao(); setTarget("/system/department/edit.jsp"); return readyEdit(dao); } setErrorCode(ErrorMessage.ACTION_NO_FOUND); return null; } }
[ "happysoftware@foxmail.com" ]
happysoftware@foxmail.com
bcc3fdf1e8157f3b4e445ca6f5b34d79323b82c1
5916cf923c71c4678913317651d4054823e0fb04
/hw7/src/markup/UnorderedList.java
9b38a7edeb363d1016f7bde07b00faf99e87ebee
[]
no_license
Emgariko/JavaHW-first-term
8d5d6fda4afe7667d4cbdb3fd0fc9ea272df2b4a
b9a3e9f5f29258329d573f14d8d7166eb4f97a92
refs/heads/master
2023-03-12T11:56:24.509292
2021-02-28T13:32:23
2021-02-28T13:32:23
224,055,328
1
0
null
null
null
null
UTF-8
Java
false
false
256
java
package markup; import java.util.List; public class UnorderedList extends AbstractList { public UnorderedList(List<ListItem> t) { super(t); } @Override public void toHtml(StringBuilder s) { super.toHtml(s, "ul"); } }
[ "emil2001garipov@gmail.com" ]
emil2001garipov@gmail.com
c37578143a7c2d2c9a51aa0b2e2cf1e2e983e0e2
f27208b206d767a8b39d1d3868ab4fc74947ea7b
/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/saveparticipant/ISaveParticipantPreferenceConfiguration.java
f0aceb5ea5561260b20318d8dc235660823d21bc
[]
no_license
DeveloperLiberationFront/Program-Navigation-Plugin
f6f1b267455a6c33fb25f4095b2cc6477a31eb65
7e154c3c81777d2a93d9fb0fc6a6b03fdd387414
refs/heads/master
2021-01-17T06:16:42.004151
2017-08-12T01:47:08
2017-08-12T01:47:08
47,132,566
2
2
null
2017-02-06T21:52:12
2015-11-30T16:49:36
Java
UTF-8
Java
false
false
3,398
java
/******************************************************************************* * Copyright (c) 2006, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.ui.javaeditor.saveparticipant; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.jface.preference.IPreferencePageContainer; /** * Preference UI to configure details of a save participant on the the * Java &gt; Editor &gt; Save Participants preference page. * <p> * Clients may implement this interface. * </p> * * @since 3.3 */ public interface ISaveParticipantPreferenceConfiguration { /** * Creates a control that will be displayed on the Java &gt; Editor &gt; Save Participants * preference page to edit the details of a save participant. * * @param parent the parent composite to which to add the preferences control * @param container the container in which this preference configuration is displayed * @return the control that was added to the <code>parent</code> */ Control createControl(Composite parent, IPreferencePageContainer container); /** * Called after creating the control. * <p> * Implementations should load the preferences values and update the controls accordingly. * </p> * @param context the context from which to load the preference values from * @param element the element to configure, or null if this configures the workspace settings */ void initialize(IScopeContext context, IAdaptable element); /** * Called when the <code>OK</code> button is pressed on the preference * page. * <p> * Implementations should commit the configured preference settings * into their form of preference storage.</p> */ void performOk(); /** * Called when the <code>Defaults</code> button is pressed on the * preference page. * <p> * Implementation should reset any preference settings to * their default values and adjust the controls accordingly.</p> */ void performDefaults(); /** * Called when the preference page is being disposed. * <p> * Implementations should free any resources they are holding on to.</p> */ void dispose(); /** * Called when project specific settings have been enabled */ void enableProjectSettings(); /** * Called when project specific settings have been disabled */ void disableProjectSettings(); /** * Called when a compilation unit is saved. * <p> * @param context the context in which the compilation unit is saved * @return true if the corresponding {@link IPostSaveListener} needs to be informed */ boolean isEnabled(IScopeContext context); /** * Called when the property page is opened to check whether this has enabled settings * in the given context. * * @param context the context to check * @return true if this has settings in context */ boolean hasSettingsInScope(IScopeContext context); }
[ "dcbrow10@ncsu.edu" ]
dcbrow10@ncsu.edu
d9ba9e989a91c1445c487eb561cb6a327c37d1f1
dc21ef6099ca0885dbee3f983943138cdc9e88e4
/src/main/java/com/imooc/myo2o/sample/activemq/queue/TestConsumer.java
0f926d35cb92ea5908d51f18b8ba6f1113b06c6a
[]
no_license
phl925883406/ssmProject
812b84a0dc7fe51b729eb2349450bbaba703a166
c7ec93ab99f44cdabf998a3255074fd7fd7b4c5e
refs/heads/master
2022-12-25T10:47:38.149528
2020-01-28T10:07:53
2020-01-28T10:07:53
236,498,563
2
0
null
2022-12-16T11:36:17
2020-01-27T13:39:21
Java
UTF-8
Java
false
false
2,468
java
package com.imooc.myo2o.sample.activemq.queue; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.TextMessage; import com.imooc.myo2o.sample.activemq.ActiveMQUtil; import org.apache.activemq.ActiveMQConnectionFactory; import cn.hutool.core.util.RandomUtil; /** * 订阅者 * @author root * */ public class TestConsumer { //服务地址,端口默认61616 private static final String url="tcp://127.0.0.1:61616"; //这次消费的消息名称 private static final String topicName="queue_style"; //消费者有可能是多个,为了区分不同的消费者,为其创建随机名称 private static final String consumerName="consumer-" + RandomUtil.randomString(5); public static void main(String[] args) throws JMSException { //0. 先判断端口是否启动了 Active MQ 服务器 ActiveMQUtil.checkServer(); System.out.printf("%s 消费者启动了。 %n", consumerName); //1.创建ConnectiongFactory,绑定地址 ConnectionFactory factory=new ActiveMQConnectionFactory(url); //2.创建Connection Connection connection= factory.createConnection(); //3.启动连接 connection.start(); //4.创建会话 Session session=connection.createSession(false, Session.AUTO_ACKNOWLEDGE); //5.创建一个目标 (主题类型) Destination destination=session.createQueue(topicName); //6.创建一个消费者 MessageConsumer consumer=session.createConsumer(destination); //7.创建一个监听器 consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message arg0) { // TODO Auto-generated method stub TextMessage textMessage=(TextMessage)arg0; try { System.out.println(consumerName +" 接收消息:"+textMessage.getText()); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); //8. 因为不知道什么时候有,所以没法主动关闭,就不关闭了,一直处于监听状态 //connection.close(); } }
[ "925883406@qq.com" ]
925883406@qq.com
b9e35fd589551b8ac33811db477e9311e66f75d9
c6d93152ab18b0e282960b8ff224a52c88efb747
/huntkey/code/eureka-server/src/main/java/com/zhang/EurekaApplication.java
90693765c6c33abc278299955d7e94c67689036f
[]
no_license
BAT6188/company-database
adfe5d8b87b66cd51efd0355e131de164b69d3f9
40d0342345cadc51ca2555840e32339ca0c83f51
refs/heads/master
2023-05-23T22:18:22.702550
2018-12-25T00:58:15
2018-12-25T00:58:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.zhang; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; /** * 启动类 * * @author Administrator * */ @SpringBootApplication @EnableEurekaServer // 表示注册Eurker Server到本地 public class EurekaApplication { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); } }
[ "729235023@qq.com" ]
729235023@qq.com
b732ce55a20c996f0a902be9edbe1f2aec7b7194
c2fb6846d5b932928854cfd194d95c79c723f04c
/java_backup/java.jimut/jimut_class/anagrams.java
d159c15e0fdcda9a3e70baaab28cb746c1e722a2
[ "MIT" ]
permissive
Jimut123/code-backup
ef90ccec9fb6483bb6dae0aa6a1f1cc2b8802d59
8d4c16b9e960d352a7775786ea60290b29b30143
refs/heads/master
2022-12-07T04:10:59.604922
2021-04-28T10:22:19
2021-04-28T10:22:19
156,666,404
9
5
MIT
2022-12-02T20:27:22
2018-11-08T07:22:48
Jupyter Notebook
UTF-8
Java
false
false
1,566
java
import java.io.*; class anagrams { public static void main (String args[])throws IOException { InputStreamReader ab = new InputStreamReader (System.in); BufferedReader cd = new BufferedReader(ab); String n,m,g,k,x="",y=""; int i,j,l,lt; char h,h1; System.out.println("Enter the first word in capital letters"); n = cd.readLine(); System.out.println("Enter the second word in capital letters"); m = cd.readLine(); g = n; k =m; l = g.length(); lt = k.length(); for(i=65;i<90;i++) {//start of for loop h = (char)(i); for(j=0;j<l;j++) { h1 = g.charAt(j); if(h==h1) { x=x+h; } } } for(i=65;i<90;i++) { h = (char)(i); for(j=0;j<lt;j++) { h1 = k.charAt(j); if(h==h1) { y=y+h; } } } if(x.equals(y)) { System.out.println(m+" and "+n+" are annagram words"); } else { System.out.println(m+" and "+n+" are not annagram words"); } } }
[ "jimutbahanpal@yahoo.com" ]
jimutbahanpal@yahoo.com
0f78328ed4e54eeb7ffebc4ddab5fe39acbb9fcc
81b87e748c6d30d248fb85219ad297bcdac0f9dc
/src/main/java/com/finance/web/controller/FinanceController.java
12e39927ab8fb867029d200db45465dcc90db661
[]
no_license
spalaniyandi/JewelFinance
0b221807bfe89b0ec9132c3cf6f673f5b82e92ae
e66bdfb26df7892a9d9b725f1c7e6b1a30a78037
refs/heads/master
2021-01-10T21:51:40.147187
2015-09-17T12:23:27
2015-09-17T12:23:27
41,319,702
0
0
null
null
null
null
UTF-8
Java
false
false
5,661
java
package com.finance.web.controller; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.finance.service.ReceiptService; import com.finance.service.exceptions.ReceiptNotFoundException; import com.finance.web.domain.ReceiptModel; import com.finance.web.domain.ReceiptQueryModel; @Controller public class FinanceController { Logger logger = LoggerFactory.getLogger(FinanceController.class); private static final String CREATE_RECEIPT = "New Receipt"; private static final String VIEW_RECEIPT = "View Receipt"; private static final String SEARCH_RECEIPT = "Search Receipt"; @Autowired private ReceiptService receiptService; @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); sdf.setLenient(true); binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true)); } @RequestMapping(value="/welcome", method=RequestMethod.GET) public String welcomePage(Model model) { String message = "Welcome to finance application"; model.addAttribute("message", message); return "welcome"; } @RequestMapping(value="/receipt", method=RequestMethod.GET) public String newReceipt(Model model) { logger.info("Inside get receipt"); model.addAttribute("receipt", new ReceiptModel()); model.addAttribute("receiptTitle", CREATE_RECEIPT); return "receipt"; } @RequestMapping(value="/receipt/{receiptId}", method=RequestMethod.GET) public String getReceipt(@PathVariable("receiptId") long receiptId, Model model) { logger.info("Inside get receipt"); ReceiptModel receiptModel = null; try { receiptModel = receiptService.getReceipt(receiptId); } catch(ReceiptNotFoundException rnfex) { model.addAttribute("errorMessage", rnfex.getMessage()); rnfex.printStackTrace(); logger.error(rnfex.getMessage()); } catch (Exception ex) { ex.printStackTrace(); logger.error(ex.getMessage()); } model.addAttribute("receipt", receiptModel); model.addAttribute("receiptTitle", VIEW_RECEIPT); return "receipt"; } @RequestMapping(value="/receipt", method=RequestMethod.POST) public String createReceipt( @Valid @ModelAttribute("receipt") ReceiptModel receipt, BindingResult result, Model model) { if (result.hasErrors()) { logger.info("post receipt errors"); return "receipt"; } logger.info("Inside post receipt"); logger.info(receipt.getLoanDate().toString()); try { receiptService.createNewReceipt(receipt); } catch (Exception ex) { ex.printStackTrace(); logger.error(ex.getMessage()); } model.addAttribute("receipt", receipt); return "success"; } @RequestMapping(value="search/receipt", method=RequestMethod.GET) public String newSearchReceipt(Model model) { logger.info("Inside search view receipt"); ReceiptQueryModel receiptQuery = new ReceiptQueryModel(); model.addAttribute("receiptQuery", receiptQuery); model.addAttribute("receiptTitle", SEARCH_RECEIPT); return "searchReceipt"; } @RequestMapping(value="/receipt/search", method=RequestMethod.GET) public String searchReceipt( @ModelAttribute("receiptQuery") ReceiptQueryModel receiptQuery, BindingResult result, Model model) { if (result.hasErrors()) { logger.info("receipt search errors"); return "receiptSearch"; } logger.info("Inside search receipt"); List<ReceiptModel> receipts = null; try { receipts = receiptService.searchReceipts(receiptQuery); } catch(Exception ex) { ex.printStackTrace(); logger.error("Error while searching receipts. Message: "+ex.getMessage()); } model.addAttribute("receiptQuery", receiptQuery); model.addAttribute("receipts", receipts); return "searchReceipt"; } @RequestMapping(value = "/login", method = RequestMethod.GET) public ModelAndView login( @RequestParam(value = "error", required = false) String error, @RequestParam(value = "logout", required = false) String logout) { ModelAndView model = new ModelAndView(); if (error != null) { model.addObject("error", "Invalid username and password!"); } if (logout != null) { model.addObject("msg", "You've been logged out successfully."); } model.setViewName("login"); return model; } /*@SuppressWarnings("unchecked") @ModelAttribute public Map getPhoneTypeList() { Map<String, String> phoneTypes = new LinkedHashMap<String, String>(); phoneTypes.put("mobile", "mobile"); phoneTypes.put("home", "home"); phoneTypes.put("work", "work"); Map phoneTypeList = new HashMap(); phoneTypeList.put("phoneTypeList", phoneTypes); return phoneTypeList; }*/ }
[ "suresh.sps@gmail.com" ]
suresh.sps@gmail.com
b4ee8172212fd591ec759c4ca81a29a499a3c5cd
a11d75daf559aa4522ff27f8ee11c4d8c7029fc0
/web/src/main/java/com/mysticcoders/mysticpaste/web/components/DefaultFocusBehavior.java
fdd1547fc41fec81d031a8f9e5b2082e7c83a6b6
[ "Apache-2.0" ]
permissive
elementalvoid/mysticpaste
9f431a376777c9f66d270613101081d62f54201c
3f6779f532ef7ef1784296dfd2f0a38ef10825a8
refs/heads/master
2021-01-17T21:46:54.526288
2011-10-13T20:58:57
2011-10-13T20:58:57
2,490,031
1
0
null
null
null
null
UTF-8
Java
false
false
1,161
java
/* * Created by IntelliJ IDEA. * User: kinabalu * Date: Oct 28, 2009 * Time: 10:54:23 AM */ package com.mysticcoders.mysticpaste.web.components; import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.markup.html.IHeaderResponse; import org.apache.wicket.markup.html.form.FormComponent; public class DefaultFocusBehavior extends Behavior { private static final long serialVersionUID = 1L; private Component component; // TODO is this really necessary with the new behavior now? @Override public void bind(Component component) { if (!(component instanceof FormComponent)) { throw new IllegalArgumentException("DefaultFocusBehavior: component must be instanceof FormComponent"); } this.component = component; component.setOutputMarkupId(true); } @Override public void renderHead(Component component, IHeaderResponse headerResponse) { super.renderHead(component, headerResponse); headerResponse.renderOnLoadJavaScript("document.getElementById('" + component.getMarkupId() + "').focus();"); } }
[ "andrew@mysticcoders.com" ]
andrew@mysticcoders.com
1a8eb00099f4f1413ea0bf2c7fa74095f9005e8c
5e6abc6bca67514b4889137d1517ecdefcf9683a
/Server/src/main/java/org/gielinor/game/world/map/zone/impl/KaramjaZone.java
f59b78776e5aca7d39b3607dfbe4a3fae6cc6c07
[]
no_license
dginovker/RS-2009-317
88e6d773d6fd6814b28bdb469f6855616c71fc26
9d285c186656ace48c2c67cc9e4fb4aeb84411a4
refs/heads/master
2022-12-22T18:47:47.487468
2019-09-20T21:24:34
2019-09-20T21:24:34
208,949,111
2
2
null
2022-12-15T23:55:43
2019-09-17T03:15:17
Java
UTF-8
Java
false
false
1,686
java
package org.gielinor.game.world.map.zone.impl; import org.gielinor.game.node.Node; import org.gielinor.game.node.entity.Entity; import org.gielinor.game.node.entity.player.Player; import org.gielinor.game.node.item.Item; import org.gielinor.game.world.map.zone.MapZone; /** * Represents the karamja zone area. * @author 'Vexia * @version 1.0 */ public final class KaramjaZone extends MapZone { /** * Represents the region ids. */ private static final int[] REGIONS = new int[]{ 11309, 11054, 11566, 11565, 11567, 11568, 11053, 11821, 11055, 11057, 11569, 11822, 11823, 11825, 11310, 11311, 11312, 11313, 11314, 11056, 11057, 11058, 10802, 10801 }; /** * Represents the karamjan rum item. */ private static final Item KARAMJAN_RUM = new Item(431); /** * Constructs a new {@code KaramjaZone} {@code Object}. */ public KaramjaZone() { super("karamja", true); } @Override public void configure() { for (int regionId : REGIONS) { registerRegion(regionId); } } @Override public boolean teleport(Entity entity, int type, Node node) { if (entity instanceof Player) { final Player p = ((Player) entity); int amt = p.getInventory().getCount(KARAMJAN_RUM); if (amt != 0) { p.getInventory().remove(new Item(KARAMJAN_RUM.getId(), amt)); p.getActionSender().sendMessage("During the trip you lose your rum to a sailor in a game of dice. Better luck next time!"); } } return super.teleport(entity, type, node); } }
[ "dcress01@uoguelph.ca" ]
dcress01@uoguelph.ca
5601c3ed099e27572c0654ddfb84bef953d908c1
ff12f4954090c90a972b0a2e5ed88088caef8de1
/src/main/java/com/mort/airthmethic/listnode/Test.java
1d07668b3be493529383e1898a20223036f36f97
[]
no_license
lining79355504/simple
a464a53e359b5ae39f179484c6c7240f36372eae
df88dc3b3d15c85b82740844844b840891d54131
refs/heads/master
2022-11-30T11:50:50.511355
2022-11-25T03:53:48
2022-11-25T03:53:48
82,872,089
0
0
null
2022-11-09T07:27:04
2017-02-23T01:51:20
Java
UTF-8
Java
false
false
2,753
java
package com.mort.airthmethic.listnode; import com.mort.airthmethic.listnode.ListNode; import java.util.HashSet; import java.util.Set; /** * @author mort * @Description * @date 2022/3/7 **/ public class Test { /** * Definition for singly-linked list. * class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * } */ /** * 判断链表是否有环 * * @param head * @return */ public static boolean isCycle(ListNode head) { if (null == head) { return false; } ListNode first = head, second = head.next; while (true) { if (null == second || null == second.next) { System.out.println("no ring"); return false; } if (first.val == second.val) { //has ring return first ring node return true; } first = first.next; second = second.next.next; } } // /** // * 返回环形链表的第一个环节点 // * 非环形链表返回null // * // * @param head // * @return // */ // public static ListNode detectCycle(ListNode head) { // Set<Integer> valSet = new HashSet<>(); // ListNode tmp = head; // while (null != tmp) { // if (valSet.contains(tmp.val)) { // return tmp; // } // valSet.add(tmp.val); // tmp = tmp.next; // } // return null; // } /** * 返回环形链表的第一个环节点 * 非环形链表返回null * * @param head * @return */ public static ListNode detectCycle(ListNode head) { Set<Integer> valSet = new HashSet<>(); ListNode tmp = head; while (null != tmp) { if (valSet.contains(tmp.val)) { //获取环节点 ListNode tmpBeta = head; while (null != tmpBeta) { if (tmpBeta.val == tmp.val) { return tmpBeta; } tmpBeta = tmpBeta.next; } } valSet.add(tmp.val); tmp = tmp.next; } return null; } public static void main(String[] args) { int[] data = {3, 2, 0, -4}; ListNode listNode = ListNode.newInstance(data); detectCycle(listNode); // int[] dataRing = {3, 2, 0, -4, 2}; int[] dataRing = {-1, -7, 7, -4, 19, 6, -9, -5, -2, -5}; ListNode ringListNode = ListNode.newInstance(dataRing); detectCycle(ringListNode); } }
[ "mortaceli@gmail.com" ]
mortaceli@gmail.com
66fedfc9f68419840f241c3e0621e631d43f67ab
d461286b8aa5d9606690892315a007062cb3e0f3
/src/main/java/com/ziaan/beta/FileDelete.java
139d9bad23346bd462fc64a1a271390dfb09ac11
[]
no_license
leemiran/NISE_DEV
f85b26c78aaa5ffadc62c0512332c9bdfe5813b6
6b618946945d8afa08826cb98b5359f295ff0c73
refs/heads/master
2020-08-07T05:04:38.474163
2019-10-10T01:55:33
2019-10-10T01:55:33
212,016,199
0
0
null
null
null
null
UHC
Java
false
false
2,254
java
// ********************************************************** // 1. 제 목: 파일 삭제 // 2. 프로그램명: FileDelete.java // 3. 개 요: // 4. 환 경: JDK 1.3 // 5. 버 젼: 0.1 // 6. 작 성: 2003. 10. 12 // 7. 수 정: // // ********************************************************** package com.ziaan.beta; import java.io.File; public class FileDelete { public FileDelete() { } public boolean allDelete(String v_realPath) { boolean delAllDir_success = false; boolean delFile_success = false; boolean delDir_success = false; boolean temp_success = false; File [] dirsAndFiles = null; int idx_point = 0; try { File delAllDir = new File(v_realPath); // 삭제할 폴더(하부폴더 및 파일을 포함한)의 File 객체 생성한다 dirsAndFiles = delAllDir.listFiles(); if ( dirsAndFiles != null ) { if(!(v_realPath.equals("/emc_backup/LMS/content/") || v_realPath.equals("/emc_backup/LMS/content") || v_realPath.equals("/emc_backup/LMS/dev_ROOT/content/") || v_realPath.equals("/emc_backup/LMS/dev_ROOT/content"))) { for ( int i = 0; i < dirsAndFiles.length; i++ ) { String dirAndFile = dirsAndFiles [i].toString(); idx_point = dirAndFile.indexOf("."); // 각 경로마다 제일 뒤의 .을 찾는다 (파일여부) if ( idx_point != -1) { // 파일이 존재한다면 먼저 파일 삭제 delFile_success = dirsAndFiles [i].delete(); // 해당 경로의 파일 삭제 } else { // 폴더 인 경우 temp_success = this.allDelete(dirAndFile); // 하위에 폴더 및 파일 존재 여부 확인 후 삭제 delDir_success = dirsAndFiles [i].delete(); // 해당 경로의 폴더 삭제 } } // delAllDir.delete(); // 마지막에 지정된 폴더까지 삭제 delAllDir_success = true; } } } catch (Exception ie ) { delAllDir_success = false; ie.printStackTrace(); } return delAllDir_success; } }
[ "knise@10.60.223.121" ]
knise@10.60.223.121
406b9836db0611e9c633cfd68f2f242e5aa7784b
b403ee1004a20092b4f4c354628e2a50c442d771
/app/src/main/java/ca/teyssedre/android/transmissioncontrol/model/request/JsonArguments.java
60bccec274bba61ef42f0bc3d16dab6ddc3d5f0b
[]
no_license
ilvelh/transmissioncontrolle
f040a511a514da9dcbfc40f82e0572ec517ffc94
cabc824fadc11b2d0f9822a5532751a79f791e55
refs/heads/master
2020-12-31T06:56:38.966703
2016-06-07T13:23:49
2016-06-07T13:23:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package ca.teyssedre.android.transmissioncontrol.model.request; import org.json.JSONObject; public abstract class JsonArguments implements JsonTransformable { @Override public JSONObject toJson() { return new JSONObject(); } }
[ "p0l1c3$974zaza" ]
p0l1c3$974zaza
63d9e8a7ac97d869976e3b8ba2b497c9ecac88fe
e25ff8bb6770d5831985a43df56841f73cd2f3c3
/src/main/java/com/my/buy/dao/CommentDao.java
050e8cb7e9f223aafbcc0c05d28906bd9be699f8
[]
no_license
hillionlane/buy
bc89e8bf7fb8f0d393468dc3f9ef66510a45a805
bf93152b1ee0f2ed296fcb14b4b6e69e56fb6410
refs/heads/master
2023-06-10T21:17:12.547655
2021-07-02T14:04:29
2021-07-02T14:04:29
382,362,100
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package com.my.buy.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.my.buy.entity.Comment; public interface CommentDao { /** * F1:添加评论 */ int insertComment(Comment comment); /** * F2:根据商品Id获取评论列表 * @param productId * @return */ List<Comment> queryCommentList(long productId); /** * F3:删除评论 * @return */ int deleteComment(long commentId); /** * F4:通过commentId获取comment * @param commentId * @return */ Comment queryCommentById(long commentId); }
[ "Hillionlane@outlook.com" ]
Hillionlane@outlook.com
854eaf102c367da9b4c71de090734984d463c52a
d789579cda907ba03c37e401da56e8c64197ad3a
/CA1/eight-puzzle-ai-client-master/src/algorithms/search/BFS.java
f9509c40c3a496ab104799f1a834153a2956ce65
[]
no_license
nikinazaran/AI-Fall-98-99
6b71132ef2c32bbbe09773ca03bf461646981d36
97cfcf6bd13ce4025bb43f351dc5636f40c144fc
refs/heads/master
2022-03-14T00:06:31.430165
2019-11-07T13:28:31
2019-11-07T13:28:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,694
java
package algorithms.search; import algorithms.Algorithm; import java.util.*; //import Client; public class BFS implements Algorithm { Queue<State> queue; Stack<String> finalRoute; // UP, DOWN, LEFT, RIGHT static int round; State goalState; Set<State> visited; public BFS() { queue = new LinkedList<>(); finalRoute = new Stack<>(); visited = new LinkedHashSet<State>(); round = 1; } @Override public String makeMove(String[][] grid) { if (round == 1) { State cur = new State(grid, null, null, 1); goalState = Helper.goalMaker(grid.length); queue.add(cur); Helper.addToGeneratedStates(cur); State ans = solve(); findRoute(ans); round++; } //System.out.println(finalRoute.peek()); return finalRoute.pop(); } private State solve() { State thisState; while (!queue.isEmpty()) { thisState = queue.poll(); visited.add(thisState); //thisState.printState(); //debugging purposes if (thisState.equals(goalState)) { return thisState; } thisState.fillAdj(); for (int i = 0; i < 4; i++) { State temp = thisState.adj[i]; if (!visited.contains(temp)) { visited.add(temp); queue.add(temp); } } } return null; } private void findRoute(State ans) { while (ans.parent != null) { finalRoute.add(ans.action); ans = ans.parent; } } }
[ "niki13sh@gmail.com" ]
niki13sh@gmail.com
71eaf41f6677407cc22147096826b0877689a65a
f7da8a81d463408b91b82a5a2224e46a0509b8df
/src/jw/engine/init/VirtualInput.java
7d84adff4fa3ff3c6ca497ee3bb5f469ba548dd0
[]
no_license
jameswhiteman/JW-Game-Engine
7a959bc14b34bb634cbef3af13b0b31c164fcb57
eb13b7fa772d93eeeb764e6c992a7e56889bbdc5
refs/heads/master
2021-01-02T09:26:36.643970
2012-10-04T02:47:12
2012-10-04T02:47:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package jw.engine.init; public class VirtualInput { public static boolean[] keys = new boolean[Controller.TOTAL_CONTROLS]; public static void setKeyStates(boolean[] newKeys) { keys = newKeys; } public static boolean getKeyState(int num) { return keys[num]; } }
[ "james_whiteman93@yahoo.com" ]
james_whiteman93@yahoo.com
be0d5f918c89787c01e961c7c0938517fc91cde9
74d3ac86bd82721e070c5ff7d9740b0ce4458cd1
/src/dev/tilegame/tiles/RockTile.java
4e5ab547e98280bec039821190dc81c8b3407eb9
[]
no_license
shadowfox23xxv/OccultVector
f62274f13727a763853d63d838fe484523ef3a04
861230d64df549cbb4f1ea72163c033f87a8f2ec
refs/heads/master
2021-01-16T23:22:37.868432
2016-07-28T07:39:58
2016-07-28T07:39:58
64,810,826
0
0
null
null
null
null
UTF-8
Java
false
false
299
java
package dev.tilegame.tiles; import dev.tilegame.gfx.Assets; import java.awt.image.BufferedImage; public class RockTile extends Tile { public RockTile(int id) { super(Assets.stone, id); } @Override public boolean isSolid(){ return true; } }
[ "bleakbriar@Home-boxPC" ]
bleakbriar@Home-boxPC
4b079d357e1c685c0bab70f425b714336e1e6a6b
76f5fa81a96fc98abdb63dacf4fa3ea8618a35ac
/src/test/java/org/assertj/db/api/assertions/AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test.java
2ca0df482fff5947677182ff8d74990b7c080305
[ "Apache-2.0" ]
permissive
Patouche/assertj-db
86476dbbf63e896b9f6a65120a3788f68539da2a
f65a5a8a939850c0c7bdf63dd0b5057355227f08
refs/heads/main
2023-05-06T10:29:02.287295
2021-03-08T20:42:42
2021-03-08T20:42:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,156
java
/* * 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. * * Copyright 2015-2021 the original author or authors. */ package org.assertj.db.api.assertions; import org.assertj.core.api.Assertions; import org.assertj.db.api.ChangeColumnValueAssert; import org.assertj.db.api.TableColumnValueAssert; import org.assertj.db.common.AbstractTest; import org.assertj.db.common.NeedReload; import org.assertj.db.type.Changes; import org.assertj.db.type.Table; import org.junit.Test; import java.time.LocalTime; import static org.assertj.db.api.Assertions.assertThat; import static org.junit.Assert.fail; /** * Tests on {@link org.assertj.db.api.assertions.AssertOnValueChronology} class : * {@link org.assertj.db.api.assertions.AssertOnValueChronology#isBeforeOrEqualTo(java.time.LocalTime)} method. * * @author Yosuke Nishikawa */ public class AssertOnValueChronology_IsBeforeOrEqualTo_LocalTime_Test extends AbstractTest { /** * This method tests the {@code isBeforeOrEqualTo} assertion method. */ @Test @NeedReload public void test_is_before_or_equal_to() { Table table = new Table(source, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); ChangeColumnValueAssert changeColumnValueAssert = assertThat(changes).change().column("var8").valueAtEndPoint(); ChangeColumnValueAssert changeColumnValueAssert2 = changeColumnValueAssert.isBeforeOrEqualTo(LocalTime.of(9, 46, 30)); Assertions.assertThat(changeColumnValueAssert).isSameAs(changeColumnValueAssert2); TableColumnValueAssert tableColumnValueAssert = assertThat(table).column("var8").value(); TableColumnValueAssert tableColumnValueAssert2 = tableColumnValueAssert.isBeforeOrEqualTo(LocalTime.of(9, 46, 30)); Assertions.assertThat(tableColumnValueAssert).isSameAs(tableColumnValueAssert2); } /** * This method should fail because the value is after. */ @Test @NeedReload public void should_fail_because_value_is_after() { Table table = new Table(source, "test"); Changes changes = new Changes(table).setStartPointNow(); update("update test set var14 = 1 where var1 = 1"); changes.setEndPointNow(); try { assertThat(changes).change().column("var8").valueAtEndPoint().isBeforeOrEqualTo(LocalTime.of(9, 46, 29)); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at end point of Column at index 7 (column name : VAR8) of Change at index 0 (with primary key : [1]) of Changes on TEST table of 'sa/jdbc:h2:mem:test' source] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before or equal to %n" + " <09:46:29.000000000>")); } try { assertThat(table).column("var8").value().isBeforeOrEqualTo(LocalTime.of(9, 46, 29)); fail("An exception must be raised"); } catch (AssertionError e) { Assertions.assertThat(e.getMessage()).isEqualTo(String.format("[Value at index 0 of Column at index 7 (column name : VAR8) of TEST table] %n" + "Expecting:%n" + " <09:46:30.000000000>%n" + "to be before or equal to %n" + " <09:46:29.000000000>")); } } }
[ "julien.vanroy@gmail.com" ]
julien.vanroy@gmail.com
a8c92ab929385600a5b9e5ab168c20804e44ad64
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/g/a/pv.java
714158bf8f43fe1782e341dead9c567e45851d42
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
597
java
package com.tencent.mm.g.a; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.sdk.b.b; public final class pv extends b { public pv.a cMa; public pv() { this((byte)0); } private pv(byte paramByte) { AppMethodBeat.i(80735); this.cMa = new pv.a(); this.xxG = false; this.callback = null; AppMethodBeat.o(80735); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes5-dex2jar.jar * Qualified Name: com.tencent.mm.g.a.pv * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
85363dc33eaae9ba13c3025d67b0259d735bed6e
c3445da9eff3501684f1e22dd8709d01ff414a15
/LIS/sinosoft-parents/lis-business/src/main/java/com/sinosoft/utility/JdbcUrlBackUp.java
189ff298ce6030116c1cc673993c167742feb26e
[]
no_license
zhanght86/HSBC20171018
954403d25d24854dd426fa9224dfb578567ac212
c1095c58c0bdfa9d79668db9be4a250dd3f418c5
refs/heads/master
2021-05-07T03:30:31.905582
2017-11-08T08:54:46
2017-11-08T08:54:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,108
java
/** * Copyright (c) 2002 sinosoft Co. Ltd. * All right reserved. */ package com.sinosoft.utility; import org.apache.log4j.Logger; /** * <p> * ClassName: JdbcUrl * </p> * <p> * Description: 构建 Jdbc 的 url * </p> * <p> * Copyright: Copyright (c) 2002 * </p> * <p> * Company: sinosoft * </p> * * @author: HST * @version: 1.0 * @date: 2002-05-31 */ public class JdbcUrlBackUp { private static Logger logger = Logger.getLogger(JdbcUrlBackUp.class); // @Field private String DBType; private String IP; private String Port; private String DBName; private String ServerName; private String UserName; private String PassWord; // @Constructor public JdbcUrlBackUp() { // WebLogic连接池,其中MyPool为连接池的名称 // DBType = "WEBLOGICPOOL"; // DBName = "MyPool"; // DBType = "ORACLE"; // IP = "10.0.22.10"; // Port = "1521"; // DBName = "zkrtest"; // UserName = "suggest"; // PassWord = "suggest"; // DBType = "ORACLE"; // IP = "10.0.22.9"; // Port = "1529"; // DBName = "test"; // UserName = "lis6test"; // PassWord = "lis6test"; DBType = "ORACLE"; IP = "10.0.22.166"; Port = "1521"; DBName = "lis6"; UserName = "lis6update"; PassWord = "lis6update"; } // @Method public String getDBType() { return DBType; } public String getIP() { return IP; } public String getPort() { return Port; } public String getDBName() { return DBName; } public String getServerName() { return ServerName; } public String getUserName() { return UserName; } public String getPassWord() { return PassWord; } public void setDBType(String aDBType) { DBType = aDBType; } public void setIP(String aIP) { IP = aIP; } public void setPort(String aPort) { Port = aPort; } public void setDBName(String aDBName) { DBName = aDBName; } public void setServerName(String aServerName) { ServerName = aServerName; } public void setUser(String aUserName) { UserName = aUserName; } public void setPassWord(String aPassWord) { PassWord = aPassWord; } /** * 获取连接句柄 * * @return String */ public String getJdbcUrl() { // String sUrl = ""; StringBuffer sUrl = new StringBuffer(256); // Oracle连接句柄 if (DBType.trim().toUpperCase().equals("ORACLE")) { // sUrl = "jdbc:oracle:thin:@" + IP + ":" // + Port + ":" // + DBName; sUrl.append("jdbc:oracle:thin:@"); sUrl.append(IP); sUrl.append(":"); sUrl.append(Port); sUrl.append(":"); sUrl.append(DBName); } // InforMix连接句柄 if (DBType.trim().toUpperCase().equals("INFORMIX")) { // sUrl = "jdbc:informix-sqli://" + IP + ":" // + Port + "/" // + DBName + ":" // + "informixserver=" + ServerName + ";" // + "user=" + UserName + ";" // + "password=" + PassWord + ";"; sUrl.append("jdbc:informix-sqli://"); sUrl.append(IP); sUrl.append(":"); sUrl.append(Port); sUrl.append(DBName); sUrl.append(":"); sUrl.append("informixserver="); sUrl.append(ServerName); sUrl.append(";"); sUrl.append("user="); sUrl.append(UserName); sUrl.append(";"); sUrl.append("password="); sUrl.append(PassWord); sUrl.append(";"); } // SqlServer连接句柄 if (DBType.trim().toUpperCase().equals("SQLSERVER")) { // sUrl = "jdbc:inetdae:" + IP + ":" // + Port + "?sql7=true&database=" + DBName + "&charset=gbk"; sUrl.append("jdbc:inetdae:"); sUrl.append(IP); sUrl.append(":"); sUrl.append(Port); sUrl.append("?sql7=true&database="); sUrl.append(DBName); sUrl.append("&charset=gbk"); } // WebLogicPool连接句柄 if (DBType.trim().toUpperCase().equals("WEBLOGICPOOL")) { // sUrl = "jdbc:weblogic:pool:" + DBName; sUrl.append("jdbc:weblogic:pool:"); sUrl.append(DBName); } // DB2连接句柄 if (DBType.trim().toUpperCase().equals("DB2")) { // sUrl = "jdbc:db2://" + IP + ":" // + Port + "/" // + DBName; sUrl.append("jdbc:db2://"); sUrl.append(IP); sUrl.append(":"); sUrl.append(Port); sUrl.append("/"); sUrl.append(DBName); } return sUrl.toString(); } }
[ "dingzansh@sinosoft.com.cn" ]
dingzansh@sinosoft.com.cn
f23d3251f6605aab8edd01a5abdf5d1fbfc90beb
f731c2731267739cef42b5a6e5fa64e0e9c1dbf2
/module_mine/src/test/java/com/test/module_mine/ExampleUnitTest.java
a26532dbe4dbf42b34f3b9061d75d9541ffadd84
[]
no_license
dapengyou/module_health
a2864bd1356d689c6f263afce0905256112c00ff
a669f51662336087d2fb2f210985c4476e6ad005
refs/heads/master
2020-03-22T07:33:25.385787
2018-07-05T09:18:09
2018-07-05T09:18:09
139,707,716
2
0
null
null
null
null
UTF-8
Java
false
false
381
java
package com.test.module_mine; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "ladyztt@sina.com" ]
ladyztt@sina.com
94e19d39c80043bdcf84837700331c1ea5937326
f6ec172aa6075acf40d7318c1999909f4a56674e
/app/src/main/java/it/unitn/disi/witmee/sensorlog/model/audio/AU.java
538bdf7d551e67d32f6cfe0ea0b17de51e5a06a7
[]
no_license
Aktobohor/Ilog-android
f77394944bc37b5486c2d8da0064ad7635a732d5
a396ceb08738372ed7c27216ec9cfe6785e12c77
refs/heads/master
2020-04-01T21:58:25.247099
2018-12-11T20:58:00
2018-12-11T20:58:00
153,684,471
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package it.unitn.disi.witmee.sensorlog.model.audio; import it.unitn.disi.witmee.sensorlog.model.sensors.AbstractSensorEvent; import it.unitn.disi.witmee.sensorlog.utils.Utils; /** * Created by mattiazeni on 5/11/17. */ public class AU extends AbstractSensorEvent { //AudioEvent private String audioStream; public AU() { } public AU(long timestamp, int accuracy, String audioStream) { super(timestamp, accuracy, 0); this.audioStream = audioStream; } public String getAudioStream() { return audioStream; } public void setAudioStream(String audioStream) { this.audioStream = audioStream; } @Override public String toString() { return this.getClass().getSimpleName() + Utils.SEPARATOR+ getAudioStream()+Utils.SEPARATOR+ Utils.longToStringFormat(getTimestamp()); } }
[ "manuel32@hotmail.it" ]
manuel32@hotmail.it
43e57135c2d2532882e9c6f4a4f1112cf2c58d99
d715b7e67fbb79a67f866eeb968f35dce1448842
/mobilehealth/app/src/main/java/com/cmcc/mobilehealthcare/im/ChatListViewAdapter.java
cffcd864773a5a06c9a3d8d363ac83e5ecec25a4
[]
no_license
wyfeng2213/projectDemo
22b0277613140235bfb47887664334a91b22917f
4ec3ebc846ef2219dcd5794b9c26cf3b8dae17a2
refs/heads/master
2021-01-23T03:05:21.065929
2017-03-24T09:15:43
2017-03-24T09:15:43
86,048,250
0
0
null
null
null
null
UTF-8
Java
false
false
6,366
java
package com.cmcc.mobilehealthcare.im; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import com.cmcc.mobilehealthcare.R; import java.util.List; public class ChatListViewAdapter extends BaseAdapter { public static final int TYPE_TEXT_LEFT = 0; public static final int TYPE_TEXT_RIGHT = 1; public static final int TYPE_IMAGE_LEFT = 2; public static final int TYPE_IMAGE_RIGHT = 3; private List<MessageModel> dataSource; private LayoutInflater inflater = null; private Context context = null; public ChatListViewAdapter(Context context) { super(); this.inflater = LayoutInflater.from(context); this.context = context; } public List<MessageModel> getDatasource() { return dataSource; } public void setDatasource(List<MessageModel> dataSource) { this.dataSource = dataSource; } @Override public int getItemViewType(int position) { // TODO Auto-generated method stub MessageModel model = dataSource.get(position); return model.getMsgUiType(); } @Override public int getViewTypeCount() { // TODO Auto-generated method stub return 4; } @Override public int getCount() { // TODO Auto-generated method stub return dataSource == null ? 0 : dataSource.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return dataSource.get(arg0); } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return arg0; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub MessageModel model = this.dataSource.get(position); int type = getItemViewType(position); ViewHolderText holderText = null; ViewHolderImage holderImage = null; if (convertView == null) { switch (type) { case TYPE_TEXT_LEFT: convertView = inflater.inflate(R.layout.msg_text_left, null); holderText = new ViewHolderText(); // holderText.name = (TextView) convertView.findViewById(R.id.msg_text_left_user); holderText.text = (TextView) convertView.findViewById(R.id.msg_text_left_content); holderText.status = (TextView) convertView.findViewById(R.id.msg_text_left_status); convertView.setTag(holderText); break; case TYPE_TEXT_RIGHT: convertView = inflater.inflate(R.layout.msg_text_right, null); holderText = new ViewHolderText(); // holderText.name = (TextView) convertView.findViewById(R.id.msg_text_right_user); holderText.text = (TextView) convertView.findViewById(R.id.msg_text_right_content); holderText.status = (TextView) convertView.findViewById(R.id.msg_text_right_status); convertView.setTag(holderText); break; case TYPE_IMAGE_LEFT: convertView = inflater.inflate(R.layout.msg_image_left, null); holderImage = new ViewHolderImage(); // holderImage.name = (TextView) convertView.findViewById(R.id.msg_image_left_user); holderImage.image = (ImageView) convertView.findViewById(R.id.msg_image_left_content); holderImage.progressBar = (ProgressBar) convertView.findViewById(R.id.msg_image_left_progress); holderImage.status = (TextView) convertView.findViewById(R.id.msg_image_left_status); convertView.setTag(holderImage); break; case TYPE_IMAGE_RIGHT: convertView = inflater.inflate(R.layout.msg_image_right, null); holderImage = new ViewHolderImage(); // holderImage.name = (TextView) convertView.findViewById(R.id.msg_image_right_user); holderImage.image = (ImageView) convertView.findViewById(R.id.msg_image_right_content); holderImage.progressBar = (ProgressBar) convertView.findViewById(R.id.msg_image_right_progress); holderImage.status = (TextView) convertView.findViewById(R.id.msg_image_right_status); convertView.setTag(holderImage); break; } } else { switch (type) { case TYPE_TEXT_LEFT: case TYPE_TEXT_RIGHT: holderText = (ViewHolderText) convertView.getTag(); break; case TYPE_IMAGE_LEFT: case TYPE_IMAGE_RIGHT: holderImage = (ViewHolderImage) convertView.getTag(); break; } } final String originalPath = model.getMsgOriginalPath(); final String originalUri = model.getMsgOriginalUri(); if (holderImage != null) { holderImage.image.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent intent = new Intent(context, OriginalActivity.class); if (originalPath != null && originalPath.length() > 0) intent.putExtra(OriginalActivity.ORIGINAL_PATH, originalPath); if (originalUri != null && originalUri.length() > 0) intent.putExtra(OriginalActivity.ORIGINAL_URI, originalUri); context.startActivity(intent); } }); } switch (type) { case TYPE_TEXT_LEFT: case TYPE_TEXT_RIGHT: // holderText.name.setText(model.getMsgByUser()); holderText.text.setText(model.getMsgText()); holderText.status.setText(model.getMsgStatus()); break; case TYPE_IMAGE_LEFT: case TYPE_IMAGE_RIGHT: // holderImage.name.setText(model.getMsgByUser()); holderImage.status.setText(model.getMsgStatus()); holderImage.progressBar.setProgress(model.getProgress()); holderImage.image.setDrawingCacheEnabled(true); Bitmap bmp = holderImage.image.getDrawingCache(); holderImage.image.setDrawingCacheEnabled(false); if (bmp != null) { bmp.recycle(); bmp = null; } String bmpPath = model.getMsgThumbPath(); Bitmap bitmap = BitmapFactory.decodeFile(bmpPath); if (bitmap != null) holderImage.image.setImageBitmap(bitmap); else holderImage.image.setImageResource(R.drawable.ic_launcher); break; } return convertView; } public static class ViewHolderText { // public TextView name; public TextView text; public TextView status; } public static class ViewHolderImage { // public TextView name; public ImageView image; public ProgressBar progressBar; public TextView status; } }
[ "874999821@qq.com" ]
874999821@qq.com
a3756f54f54175bf6e47af0c436ab81127b2a774
5fc9fdaada298c05ff2c695d3bee98b9f7d78e6e
/app/src/test/java/com/decoder/hamedpa/thetowersofhanoi/ExampleUnitTest.java
9684470eac5dd71eef9c01f71aa170ebd3dd826a
[]
no_license
pariazar/TheTowersofHanoi
56b6399f21a1dca1b0b7c266c6943c5df9c36341
e68f3db4a1b3c34a8b48174c0383d5e19b4867fb
refs/heads/master
2023-03-13T14:04:59.837337
2017-03-20T16:12:14
2017-03-20T16:12:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.decoder.hamedpa.thetowersofhanoi; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "hamedpa21@gmail.com" ]
hamedpa21@gmail.com
d3e9682ee6a9bbf1522d66709c53ae35fab9757b
dc4564f9fc9bbd0a31eae6acba06d237db31a896
/Modification/CRM_Avengers/src/ui/DroitsController.java
1a1e4c8163df36b3eb95f9300c74d1398b9ff778
[]
no_license
A78770/Java
c893f4649b94c4967817e2d62458fdbaa53589a4
12c3288b22a2c1c61940561404963ff3c84f672b
refs/heads/master
2022-12-22T10:39:09.422687
2020-09-06T22:41:51
2020-09-06T22:41:51
270,570,473
0
0
null
null
null
null
ISO-8859-1
Java
false
false
7,462
java
package ui; import java.io.IOException; import java.net.URL; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ResourceBundle; import javax.swing.JOptionPane; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import service.dao.UserDao; public class DroitsController implements Initializable{ @FXML private ComboBox<String> combo_uti; @FXML private ComboBox<String> combo_droits; @FXML private Button btn_val; @FXML private Button btn_ann; @FXML private Button supprdrt; @Override public void initialize(URL location, ResourceBundle resources) { // TODO Auto-generated method stub UserDao user = new UserDao(); ObservableList<String> liste = FXCollections.observableArrayList("Administrateur", "Civils", "Organisations"); ObservableList<String> nom = FXCollections.observableArrayList(); combo_droits.setItems(liste); Connection connection = user.getConnection(); Statement statement=null; try { statement = connection.createStatement(); String query = "select * from civil where Login IS NOT NULL"; ResultSet result =statement.executeQuery(query); while(result.next()) { nom.add(result.getString("Login")); } combo_uti.setItems(nom); } catch (SQLException e) { throw new RuntimeException(e); } } @FXML public void handleuti(ActionEvent e) { } @FXML public void handlebtnvaldrt(ActionEvent e) { int iduti=0; int i=0; boolean mod=false; if(combo_droits.getValue()!=null || combo_uti.getValue()!=null) { UserDao user = new UserDao(); Connection connection = user.getConnection(); Statement statement=null; try { statement = connection.createStatement(); String query = "select * from civil where Login='"+combo_uti.getValue()+"'"; ResultSet result =statement.executeQuery(query); while(result.next()) { iduti=result.getInt("IdCiv"); } query="select * from droits WHERE IDcivil = '"+iduti+"'"; result=statement.executeQuery(query); if(result.next()) { i++; if (result.getInt("droit")==3) { query="SELECT COUNT (*) AS total FROM droits WHERE droit=3"; result=statement.executeQuery(query); if (result.next()) { if(result.getInt("total")==1) { JOptionPane.showMessageDialog(null, "Modification impossible, il doit y avoir au moins un administrateur", "Information", JOptionPane.INFORMATION_MESSAGE); }else { query="UPDATE droits SET droit = "; if(combo_droits.getValue()=="Administrateur") { query+= "'3'"; } if(combo_droits.getValue()=="Civils") { query+= "'1'"; } if(combo_droits.getValue()=="Organisations") { query+= "'2'"; } query+=" WHERE IDcivil="+iduti; statement.executeQuery(query); JOptionPane.showMessageDialog(null, "Droits changés/ajoutés", "Réussite", JOptionPane.INFORMATION_MESSAGE); mod=true; } } }else { query="UPDATE droits SET droit = "; if(combo_droits.getValue()=="Administrateur") { query+= "'3'"; } if(combo_droits.getValue()=="Civils") { query+= "'1'"; } if(combo_droits.getValue()=="Organisations") { query+= "'2'"; } query+=" WHERE IDcivil="+iduti; statement.executeQuery(query); JOptionPane.showMessageDialog(null, "Droits changés/ajoutés", "Réussite", JOptionPane.INFORMATION_MESSAGE); mod=true; } } if (i==0) { query="INSERT INTO droits (IDcivil, droit) VALUES ('"+iduti+"',"; if(combo_droits.getValue()=="Administrateur") { query+= "'3')"; } if(combo_droits.getValue()=="Civils") { query+= "'1')"; } if(combo_droits.getValue()=="Organisations") { query+= "'2')"; } statement.executeQuery(query); JOptionPane.showMessageDialog(null, "Droits changés/ajoutés", "Réussite", JOptionPane.INFORMATION_MESSAGE); mod=true; } if (mod) { try { Parent page =(Parent) FXMLLoader.load(getClass().getResource("Menu.fxml")); Scene scene4 = new Scene(page); Main.window.setScene(scene4); Main.window.setTitle("Menu"); Main.window.setWidth(600); Main.window.setHeight(300); } catch (IOException g) { // TODO Auto-generated catch block g.printStackTrace(); } } } catch (SQLException f) { throw new RuntimeException(f); } }else { JOptionPane.showMessageDialog(null, "Veuillez choisir un utilisateur et des droits svp", "Réussite", JOptionPane.INFORMATION_MESSAGE); } } @FXML public void handlebtnann(ActionEvent e) { try { Parent page =(Parent) FXMLLoader.load(getClass().getResource("Menu.fxml")); Scene scene4 = new Scene(page); Main.window.setScene(scene4); Main.window.setTitle("Menu"); Main.window.setWidth(600); Main.window.setHeight(300); } catch (IOException g) { // TODO Auto-generated catch block g.printStackTrace(); } } public void handlesupp(ActionEvent e) { if (combo_uti.getValue()==null) { JOptionPane.showMessageDialog(null, "Veuillez choisir un utilisateur svp", "Information", JOptionPane.INFORMATION_MESSAGE); }else { int iduti=0; UserDao user = new UserDao(); Connection connection = user.getConnection(); Statement statement=null; try { statement = connection.createStatement(); String query = "select * from civil where Login='"+combo_uti.getValue()+"'"; ResultSet result =statement.executeQuery(query); if(result.next()) { iduti=result.getInt("IdCiv"); } query = "select * from droits where IDcivil = "+iduti; result =statement.executeQuery(query); if(result.next()) { if(result.getInt("droit")==3) { query="SELECT COUNT(*) as total FROM droits WHERE droit = '3'"; result =statement.executeQuery(query); if(result.next()) { if (result.getInt("total")==1){ JOptionPane.showMessageDialog(null, "Suppression impossible, il doit y avoir au moins un administrateur", "Information", JOptionPane.INFORMATION_MESSAGE); }else { query = "DELETE FROM droits WHERE IDcivil = '"+iduti+"' AND droit = '3'"; statement.executeQuery(query); JOptionPane.showMessageDialog(null, "Suppression réussie", "Information", JOptionPane.INFORMATION_MESSAGE); } } }else { query = "DELETE FROM droits WHERE IDcivil = '"+iduti+"' AND droit = '"+result.getInt("droit")+"'"; statement.executeQuery(query); JOptionPane.showMessageDialog(null, "Suppression réussie", "Information", JOptionPane.INFORMATION_MESSAGE); } }else { JOptionPane.showMessageDialog(null, "L'utilisateur n'a pas de droits, suppression impossible", "Information", JOptionPane.INFORMATION_MESSAGE); } } catch (SQLException k) { throw new RuntimeException(k); } } } }
[ "noreply@github.com" ]
A78770.noreply@github.com
c71898fe3608d307aa0849b566cf92f61c77a65b
411466be21186e41730aa8a66a2ca7b1ba71ef41
/duobao-upms/duobao-upms-client/src/main/java/online/duobao/upms/client/shiro/session/UpmsSession.java
1898b533aa6e621541fd56a07b00eeacd8f058e5
[]
no_license
hjldev/duobao
b0dcf6ff64df03a4982b6435149c8068a7f1d0e2
6f765b9950c6ddd5a3575944004d1a5c85ffd19b
refs/heads/master
2020-06-18T06:50:00.935010
2017-06-13T03:08:14
2017-06-13T03:08:21
94,161,737
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
package online.duobao.upms.client.shiro.session; import org.apache.shiro.session.mgt.SimpleSession; /** * 重写session * Created by shuzheng on 2017/2/27. */ public class UpmsSession extends SimpleSession { public static enum OnlineStatus { on_line("在线"), off_line("离线"), force_logout("强制退出"); private final String info; private OnlineStatus(String info) { this.info = info; } public String getInfo() { return info; } } // 用户浏览器类型 private String userAgent; // 在线状态 private OnlineStatus status = OnlineStatus.off_line; public String getUserAgent() { return userAgent; } public void setUserAgent(String userAgent) { this.userAgent = userAgent; } public OnlineStatus getStatus() { return status; } public void setStatus(OnlineStatus status) { this.status = status; } }
[ "a2437463@126.com" ]
a2437463@126.com
54f73d44a89ddd81df7073a31160b2a7245a4fc2
b39d7e1122ebe92759e86421bbcd0ad009eed1db
/sources/android/app/-$$Lambda$WallpaperManager$Globals$2yG7V1sbMECCnlFTLyjKWKqNoYI.java
f05d8829df55db4cd0d1c996136db8ad016d44eb
[]
no_license
AndSource/miuiframework
ac7185dedbabd5f619a4f8fc39bfe634d101dcef
cd456214274c046663aefce4d282bea0151f1f89
refs/heads/master
2022-03-31T11:09:50.399520
2020-01-02T09:49:07
2020-01-02T09:49:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
707
java
package android.app; import android.app.WallpaperManager.OnColorsChangedListener; import android.util.Pair; import java.util.function.Predicate; /* compiled from: lambda */ public final /* synthetic */ class -$$Lambda$WallpaperManager$Globals$2yG7V1sbMECCnlFTLyjKWKqNoYI implements Predicate { private final /* synthetic */ OnColorsChangedListener f$0; public /* synthetic */ -$$Lambda$WallpaperManager$Globals$2yG7V1sbMECCnlFTLyjKWKqNoYI(OnColorsChangedListener onColorsChangedListener) { this.f$0 = onColorsChangedListener; } public final boolean test(Object obj) { return Globals.lambda$removeOnColorsChangedListener$0(this.f$0, (Pair) obj); } }
[ "shivatejapeddi@gmail.com" ]
shivatejapeddi@gmail.com
d58c265dcaffe49ec79ec32349729a31787c766d
8c2ab8fbe4a94939de3e5f8dee4fd60a09f28bc1
/app/src/main/java/liam/example/com/videoapplication/dagger/components/ActivityComponent.java
955870981b1912b2f61f63320bc2b7f80f82735c
[]
no_license
lDuffy/videoApplication
570cb894233b9d79be2245d3d45c5d40cf1a902b
6e95d71dbbd3db82f45789cb9db00b38a08721f9
refs/heads/master
2021-01-22T06:32:27.198712
2017-02-16T11:02:46
2017-02-16T11:02:46
81,864,329
0
0
null
null
null
null
UTF-8
Java
false
false
734
java
package liam.example.com.videoapplication.dagger.components; import dagger.Component; import liam.example.com.videoapplication.dagger.PerActivity; import liam.example.com.videoapplication.dagger.modules.ActivityModule; import liam.example.com.videoapplication.detail.DetailFragment; import liam.example.com.videoapplication.main.MainActivity; import liam.example.com.videoapplication.main.MainFragment; /** * Activity component used in dependancy injection. */ @PerActivity @Component(modules = ActivityModule.class, dependencies = {AppComponent.class}) public interface ActivityComponent { void inject(MainActivity mainActivity); void inject(MainFragment mainFragment); void inject(DetailFragment detailFragment); }
[ "liam.duffy@synchronoss.com" ]
liam.duffy@synchronoss.com
46a4c58787da78c36812eac6426900722c912d48
442bab63495ff3cd6f946e776037b7958e144075
/src/teacher/ProposalVerify.java
f8fbf02e457cbbfcae8e5c0d5b79f50a0582bfcd
[]
no_license
nenew/gd
b8946f896f20d7739cf8ee7340cf0cffcbb6fb57
4abe05068f8ceb42806853d28517bfdbeceb0f4a
refs/heads/master
2016-09-01T19:22:14.488855
2013-06-19T12:21:51
2013-06-19T12:21:51
8,771,516
0
1
null
null
null
null
UTF-8
Java
false
false
3,856
java
package teacher; import hibernate.*; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @SuppressWarnings("serial") public class ProposalVerify extends HttpServlet { public ProposalVerify() { super(); } public void destroy() { super.destroy(); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); Integer id = (Integer) request.getSession().getAttribute("id"); Integer priority = (Integer) request.getSession().getAttribute( "priority"); Integer mainid = Integer.parseInt(request.getParameter("mainid")); Integer proposalid = Integer.parseInt(request.getParameter("proposalid")); if (!id.equals(mainid)) { out.print("<div class=\"alert alert-error alertfix\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>警告! </strong> 非本人,禁止操作!</div>"); return; } if (priority != 2) { out.print("<div class=\"alert alert-error alertfix\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button><strong>警告! </strong> 无操作权限</div>"); return; } try { ProposalDAO proposaldao = new ProposalDAO(); MainDAO maindao = new MainDAO(); ProfileDAO profiledao = new ProfileDAO(); profiledao.getSession().clear(); profiledao.getSession().beginTransaction().commit(); proposaldao.getSession().clear(); proposaldao.getSession().beginTransaction().commit(); Profile profile = (Profile)profiledao.findByProperty("main.id", proposaldao.findById(proposalid).getStudentid()).iterator().next(); Proposal proposal = (Proposal) proposaldao.findById(proposalid); String proposalanalysis = proposal.getProposalanalysis(); String proposalcontent = proposal.getProposalcontent(); String proposalfacility = proposal.getProposalfacility(); String proposaltitle = proposal.getThesistitle(); out.print("<div><h3>毕业设计题目:</h3><input type=\"text\" disabled id=\"proposaltitle\" value=\"" + proposaltitle + "\"></div><div class=\"clearfix\"><div style=\"float:left;\"><h5>学生姓名:</h5><input disabled type=\"text\" value=\""+maindao.findById(proposal.getStudentid()).getName()+"\"></input></div><div style=\"float:left;margin-left:30px;\"><h5>学生专业:</h5><input disabled type=\"text\" value=\""+profile.getDepartment()+"\"></input></div><div style=\"float:left;margin-left:30px;\"><h5>学生电话:</h5><input disabled type=\"text\" value=\""+profile.getPhonenum()+"\"></input></div></div><div><h3>资料调研分析:</h3><div class=\"well wellfix\">" + proposalanalysis + "</div></div><div><h3>设计方案及预期目标:</h3><div class=\"well wellfix\">" + proposalcontent + "</div></div><div><h3>所需仪器:</h3><div class=\"well wellfix\">" + proposalfacility + "</div></div><div class=\"clearfix\"><br><div style=\"text-align:center;\"><button class=\"btn btn-danger btn-large\" type=\"button\" approve=\"no\" proposalid=\"" + proposal.getProposalid() + "\">未达标</button><button class=\"btn btn-success btn-large\" style=\"margin-left:50px;\" type=\"button\" approve=\"yes\" proposalid=\"" + proposal.getProposalid() + "\">审核通过</button></div><div id=\"outputs\"></div></div>"); } catch (Exception e) { out.print(e); } } public void init() throws ServletException { } }
[ "nenew.net@gmail.com" ]
nenew.net@gmail.com
408b12398d70bafc377b9e12981b947f58a58e1d
1b5338ff4e05cc3c124eb59de707b484f0537933
/springboot10-gp-demo/src/main/java/com/panda/study2019/gp/springboot10gpdemo/Springboot10GpDemoApplication.java
6df062c525f624b54cb9f526fc222f57516df0dd
[]
no_license
likaisheng001/panda2019
794a2e7a7347750ef1390aab3a20949ca95bf6d8
43485e2023b90fb01f4c0e8f7cefa8dcfd35cfd1
refs/heads/master
2022-04-07T05:36:06.810153
2020-03-04T03:05:48
2020-03-04T03:05:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package com.panda.study2019.gp.springboot10gpdemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Springboot10GpDemoApplication { public static void main(String[] args) { SpringApplication.run(Springboot10GpDemoApplication.class, args); } }
[ "1805318928@qq.com" ]
1805318928@qq.com
4d99394b7385b4739b15efb8dee66169d372bc75
743e387df4aada6bb3ba6613f7c9acbefdcd543e
/src/main/java/com/example/messervice/entities/Catalog.java
ecde8bae2dbecc1602d114b20c6f37c4a3780109
[]
no_license
dmitriytimoshenko/messervice
d24efc0117d62f4ab3527515faea20c71aca8147
93635a783ee813afbfd29e9a48b792e6a389e884
refs/heads/master
2023-04-29T17:53:33.058110
2020-02-16T21:48:35
2020-02-16T21:48:35
240,970,584
0
0
null
2023-04-14T19:31:46
2020-02-16T21:42:26
Java
UTF-8
Java
false
false
494
java
package com.example.messervice.entities; import org.springframework.stereotype.Component; import javax.xml.bind.annotation.*; import java.util.ArrayList; import java.util.List; @Component @XmlRootElement(name = "CATALOG") @XmlAccessorType(XmlAccessType.FIELD) public class Catalog { @XmlElement(name = "CD") private List<CD> CDs = new ArrayList<>(); public List<CD> getCDs() { return CDs; } public void setCDs(List<CD> CDs) { this.CDs = CDs; } }
[ "asassinich@gmail.com" ]
asassinich@gmail.com
d8e10af851c90f96c1464182673d79c3ca538621
6d70a6f622b1d6ee7f49356a6a1778f3a30999f2
/br.ufpe.cin.dsql.diagram/src/dsql/diagram/parsers/MessageFormatParser.java
4944f89364cadd2df63121001a3e631ab527b589
[]
no_license
edsonalves/dsql
6d840a93cddda44afe56145ae9200195c5c3e247
8189ad0ff0aca136f83d882c8f616831d834f97f
refs/heads/master
2020-05-06T15:33:15.560254
2019-12-27T19:53:11
2019-12-27T19:53:11
180,195,800
1
0
null
null
null
null
UTF-8
Java
false
false
4,497
java
/* * */ package dsql.diagram.parsers; import java.text.FieldPosition; import java.text.MessageFormat; import java.text.ParsePosition; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.tooling.runtime.parsers.AbstractAttributeParser; import org.eclipse.osgi.util.NLS; import dsql.diagram.part.DsqlDiagramEditorPlugin; import dsql.diagram.part.Messages; /** * @generated */ public class MessageFormatParser extends AbstractAttributeParser { /** * @generated */ private String defaultPattern; /** * @generated */ private String defaultEditablePattern; /** * @generated */ private MessageFormat viewProcessor; /** * @generated */ private MessageFormat editorProcessor; /** * @generated */ private MessageFormat editProcessor; /** * @generated */ public MessageFormatParser(EAttribute[] features) { super(features); } /** * @generated */ public MessageFormatParser(EAttribute[] features, EAttribute[] editableFeatures) { super(features, editableFeatures); } /** * @generated */ protected String getDefaultPattern() { if (defaultPattern == null) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < features.length; i++) { if (i > 0) { sb.append(' '); } sb.append('{'); sb.append(i); sb.append('}'); } defaultPattern = sb.toString(); } return defaultPattern; } /** * @generated */ public void setViewPattern(String viewPattern) { super.setViewPattern(viewPattern); viewProcessor = null; } /** * @generated */ public void setEditorPattern(String editorPattern) { super.setEditorPattern(editorPattern); editorProcessor = null; } /** * @generated */ protected MessageFormat getViewProcessor() { if (viewProcessor == null) { viewProcessor = new MessageFormat(getViewPattern() == null ? getDefaultPattern() : getViewPattern()); } return viewProcessor; } /** * @generated */ protected MessageFormat getEditorProcessor() { if (editorProcessor == null) { editorProcessor = new MessageFormat( getEditorPattern() == null ? getDefaultEditablePattern() : getEditorPattern()); } return editorProcessor; } /** * @generated */ protected String getDefaultEditablePattern() { if (defaultEditablePattern == null) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < editableFeatures.length; i++) { if (i > 0) { sb.append(' '); } sb.append('{'); sb.append(i); sb.append('}'); } defaultEditablePattern = sb.toString(); } return defaultEditablePattern; } /** * @generated */ public void setEditPattern(String editPattern) { super.setEditPattern(editPattern); editProcessor = null; } /** * @generated */ protected MessageFormat getEditProcessor() { if (editProcessor == null) { editProcessor = new MessageFormat( getEditPattern() == null ? getDefaultEditablePattern() : getEditPattern()); } return editProcessor; } /** * @generated */ public String getEditString(IAdaptable adapter, int flags) { EObject element = (EObject) adapter.getAdapter(EObject.class); return getEditorProcessor().format(getEditableValues(element), new StringBuffer(), new FieldPosition(0)) .toString(); } /** * @generated */ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) { ParsePosition pos = new ParsePosition(0); Object[] values = getEditProcessor().parse(editString, pos); if (values == null) { return new ParserEditStatus(DsqlDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex()))); } return validateNewValues(values); } /** * @generated */ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) { Object[] values = getEditProcessor().parse(newString, new ParsePosition(0)); return getParseCommand(adapter, values, flags); } /** * @generated */ public String getPrintString(IAdaptable adapter, int flags) { EObject element = (EObject) adapter.getAdapter(EObject.class); return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString(); } }
[ "edson31415@gmail.com" ]
edson31415@gmail.com
4936ab6edbeb3599215b26dc9fa8ce7e403f65e7
9e93739b0e3028be1d03403366923588cded30af
/FRIEND_mini_project_01/src/main/ui/FindIDPwUI.java
5efc993a5ee4c3f3c20592aed84a0fd522c10cb0
[]
no_license
yoeubi/mini_project_01
99ec191f2d1c9b25acf68c24e23b994b3b9996b3
1064001b83662749a894e07d0eaf888cd2efa591
refs/heads/master
2021-09-09T12:58:41.573861
2018-03-16T10:44:43
2018-03-16T10:44:43
125,133,987
0
0
null
null
null
null
UTF-8
Java
false
false
511
java
package main.ui; import util.Getter; public class FindIDPwUI { public void findIdPw() { System.out.println("1. ID 찾기 "); System.out.println("2. PassWord 찾기 "); String result = Getter.getStr("원하시는 항목을 선택 해주세요 : "); if(result.equals("1")) { new FindIDUI().service(); }else if(result.equals("2")) { new FindPwUI().findPwUI(); }else { System.out.println("번호를 잘못 누르셨습니다."); new FindIDPwUI().findIdPw(); } } }
[ "mook2177@naver.com" ]
mook2177@naver.com
6cd097b449df8baad72b8d179f6d4bf4b7fef1ad
a01a64814a1ed4ced2b38562f79afa54ed72628f
/java-operator/src/main/java/com/octank/handler/Routes.java
e7bd349e3e1fae97f4a6a013eb1dc03b4af3d670
[ "MIT-0" ]
permissive
kferrone/k8s-rbac-iam-java-operator
c5f7bd2df5f6dcfa4a9a3cc030fd16b8df10a451
266b51b1ba2986770f5e2ffe0d439cfe3b11041e
refs/heads/master
2022-11-24T04:39:57.621577
2020-06-10T19:44:23
2020-06-10T19:44:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
213
java
package com.octank.handler; public interface Routes { public static final String PING = "/ping"; public static final String HEALTH_LIVENESS = "/live"; public static final String HEALTH_READINESS = "/ready"; }
[ "viji@sarathy.io" ]
viji@sarathy.io
1705b78d41c850fbcb7f09ca4eb9f58c9c88620c
a3f0a877b2d4b6d079b74debc1b5eee7ad1cc0af
/src/HyperSkill/symmetricMatrix.java
d301e1c8204f2fcc1e9c721fd3cc34c5550ad92b
[]
no_license
Fei-D/GoogleSearchTest
9292ea78648c141144f50a2b388b6167d56ec130
a725b77f9e8648665aae25cf83771a26adf87f8f
refs/heads/master
2020-05-24T06:33:15.531333
2019-05-17T03:25:52
2019-05-17T03:25:52
187,140,283
0
0
null
null
null
null
UTF-8
Java
false
false
1,599
java
package HyperSkill; import java.util.Scanner; public class symmetricMatrix { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] matrix = new int[n][n]; boolean symmetric = true; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { matrix[i][j] = sc.nextInt(); } } for (int i = 0; i < n; i++) { for (int j = 0; j < matrix[i].length; j++) { if (matrix[i][j] != matrix[j][i]) { symmetric = false; break; } } } if (symmetric == true) { System.out.println("YES"); } else { System.out.println("NO"); } } } /** correct answer * import java.util.Scanner; * * public class Main { * public static void main(String[] args) { * Scanner scanner = new Scanner(System.in); * int len = scanner.nextInt(); * int[][] numbers = new int[len][len]; * * for (int i = 0; i < len; i++) { * for (int j = 0; j < len; j++) { * numbers[i][j] = scanner.nextInt(); * } * } * * for (int i = 0; i < numbers.length; i++) { * for (int j = i + 1; j < numbers.length; j++) { * if (numbers[i][j] != numbers[j][i]) { * System.out.println("NO"); * return; * } * } * } * * System.out.println("YES"); * } * } */
[ "fei.deng@airnz.co.nz" ]
fei.deng@airnz.co.nz
cd3f0613adb9f1f80b7cf72b58dc035c06456410
1f8f7a8106e1ddf68d20ea5d32465b3ef488a6c1
/src/main/java/com/emusicstore/controller/OrderController.java
630c4562b45c7f33c5223b5b61cd79022668ac0c
[]
no_license
vashistks/emusicstore
7195c676b2c9eb10a4a95a42c205496c3a76c72a
5e845042b1a32b79ebb607908d6c67ff2de56e9c
refs/heads/master
2020-06-19T03:23:17.679497
2016-12-02T04:03:40
2016-12-02T04:03:40
74,922,312
0
0
null
null
null
null
UTF-8
Java
false
false
1,311
java
package com.emusicstore.controller; import com.emusicstore.model.Cart; import com.emusicstore.model.Customer; import com.emusicstore.model.CustomerOrder; import com.emusicstore.service.CartService; import com.emusicstore.service.CustomerOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class OrderController { @Autowired private CartService cartService; @Autowired private CustomerOrderService customerOrderService; @RequestMapping("/order/{cartId}") public String createOrder(@PathVariable("cartId") int cartId) { CustomerOrder customerOrder = new CustomerOrder(); Cart cart=cartService.getCartById(cartId); customerOrder.setCart(cart); Customer customer = cart.getCustomer(); customerOrder.setCustomer(customer); customerOrder.setBillingAddress(customer.getBillingAddress()); customerOrder.setShippingAddress(customer.getShippingAddress()); customerOrderService.addCustomerOrder(customerOrder); return "redirect:/checkout?cartId="+cartId; } }
[ "bramakr@g.clemson.edu" ]
bramakr@g.clemson.edu
72e24a8ef29675752f490b361b226fe6a8ce46b9
bba2396f78c025d2bea460960f4c36e891217027
/src/main/java/creational/factory/Shop.java
d507491918fdf9dcdedc44f64d0af053b06dff9b
[]
no_license
FitzgeraldMouseton/patterns
93b421519ec7f41760c1aab4754c2bec5c321209
5b009214d0a603641f0fcddde5305e4950554345
refs/heads/master
2023-03-10T17:02:06.297136
2021-02-26T10:35:19
2021-02-26T10:35:19
294,437,792
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package creational.factory; import creational.factory.pages.CartPage; import creational.factory.pages.ItemPage; import creational.factory.pages.SearchPage; public class Shop extends Website { @Override public void createWebsite() { pages.add(new CartPage()); pages.add(new ItemPage()); pages.add(new SearchPage()); } }
[ "fitzgerald.mouseton@yandex.ru" ]
fitzgerald.mouseton@yandex.ru
1eba6e3390d457b854cab7bff96d22a5360ab5fb
24d0cfcad54a3949813eb2f87f3e61f5dd9ea991
/encryptdecrypt/machines/UnicodeCipherMachine.java
76ab6a5ed1fc52fc0907bfc5b6147b0d506f89b9
[]
no_license
alexDemidoff/encription_decription
4a802b465d7d87f2c01635c2e892a123c529bec0
1eaae143a25f609fa5d0f2015090daa2b9565e70
refs/heads/main
2023-02-24T14:12:20.124943
2021-01-25T18:01:58
2021-01-25T18:01:58
332,836,714
1
0
null
null
null
null
UTF-8
Java
false
false
1,537
java
package encryptdecrypt.machines; import encryptdecrypt.enums.Mode; public class UnicodeCipherMachine extends CipherMachine { public UnicodeCipherMachine(String data, int key, Mode mode) { super(data, key, mode); } @Override protected String decrypt(String data, int key) { return encrypt(data, -key); } //Encodes in symbols excluding the special ones @Override protected String encrypt(String data, int key) { StringBuilder result = new StringBuilder(); String[] lines = data.split(System.lineSeparator()); for (String line : lines) { for (int i = 0; i < line.length(); i++) { result.append(encodeOneSymbol(line.charAt(i), key)); } result.append(System.lineSeparator()); } //Deleting the line separator at the end of result text result.delete(result.lastIndexOf(System.lineSeparator()), result.length()); return result.toString(); } @Override protected char encodeOneSymbol(char c, int key) { int index = calculateNewUnicodePosition(c, key); return (char) index; } private int calculateNewUnicodePosition(char c, int key) { //We define borders to exclude the special symbols int startIndex = 32; int endIndex = 127; int index = (c + key) % endIndex; index = index < 0 ? endIndex - index : index; index = index < startIndex ? index + startIndex : index; return index; } }
[ "alexdeveloper123@gmail.com" ]
alexdeveloper123@gmail.com
8d572e21266f62876e44738f8a8e13616b85cfda
458a0b2cca92cd36442915c80015de518d14f9d5
/okhttp/src/main/java/io/grpc/transport/okhttp/OkHttpClientTransportFactory.java
be7d6356081d4abeaec3612c89ce536181a98e0d
[ "BSD-3-Clause" ]
permissive
meghana0507/grpc-java-poll
f53f8835d0b1250c5f3a9f5fada52e83dc3feb46
b35805a7265e5d6d9468ab17bc33b92ed00ecd97
refs/heads/master
2016-09-06T01:58:08.362835
2015-03-23T16:56:42
2015-03-23T16:56:42
32,693,315
1
0
null
null
null
null
UTF-8
Java
false
false
2,848
java
/* * Copyright 2014, Google Inc. 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. * * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package io.grpc.transport.okhttp; import com.google.common.base.Preconditions; import io.grpc.transport.ClientTransport; import io.grpc.transport.ClientTransportFactory; import java.net.InetSocketAddress; import java.util.concurrent.ExecutorService; import javax.net.ssl.SSLSocketFactory; /** * Factory that manufactures instances of {@link OkHttpClientTransport}. */ class OkHttpClientTransportFactory implements ClientTransportFactory { private final InetSocketAddress address; private final ExecutorService executor; private final String authorityHost; private final SSLSocketFactory sslSocketFactory; public OkHttpClientTransportFactory(InetSocketAddress address, String authorityHost, ExecutorService executor, SSLSocketFactory factory) { this.address = Preconditions.checkNotNull(address, "address"); this.executor = Preconditions.checkNotNull(executor, "executor"); this.authorityHost = Preconditions.checkNotNull(authorityHost, "authorityHost"); this.sslSocketFactory = factory; } @Override public ClientTransport newClientTransport() { return new OkHttpClientTransport(address, authorityHost, executor, sslSocketFactory); } }
[ "ubuntu@ip-172-31-14-233.us-west-1.compute.internal" ]
ubuntu@ip-172-31-14-233.us-west-1.compute.internal
537ba00b94ddf522144291effb96c4780dc24208
0b62cc3924680d08aad1cffac4133c08ce49b69a
/app/src/main/java/com/example/hsl/myapplication/MainActivity.java
e413c8afab4c76b43b758c737d624832ddf30843
[]
no_license
LeeHyoSeon/MyApplication4
8cf94fe4cd482f006cf9ee4869cf27e6a1fef8dc
4392f681a1d10e48623b03215d753f7fbd4b7a9d
refs/heads/master
2021-05-06T12:23:40.171614
2017-12-05T02:16:24
2017-12-05T02:16:24
113,119,862
0
0
null
null
null
null
UTF-8
Java
false
false
342
java
package com.example.hsl.myapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "gytjs92@gmail.com" ]
gytjs92@gmail.com
bd8f48ce75a6aad3a2e0e36f6b0ae34c50450a60
2eb352aa0f9e7426d6d73472cb32330f3e45585c
/src/main/java/controllers/BookController.java
e591f3f525c5f2655618e6988376c13a06608fa1
[]
no_license
gregorcox/week_9-day_3-lab
8093f3c8a93f3b1ecb31a742fd6f443fb70889ba
05ff3016e9affbef0c8f37a8fa765bea5db99d31
refs/heads/master
2020-03-23T10:08:32.031931
2018-07-18T13:30:54
2018-07-18T13:30:54
141,427,571
0
0
null
null
null
null
UTF-8
Java
false
false
759
java
package controllers; import db.DBHelper; import models.Book; import spark.ModelAndView; import spark.template.velocity.VelocityTemplateEngine; import java.util.HashMap; import java.util.List; import java.util.Map; import static spark.Spark.get; public class BookController { public BookController(){ this.setupEndPoints(); } private void setupEndPoints(){ get("/books", (req, res) -> { Map<String, Object> model = new HashMap<>(); model.put("template", "templates/books/index.vtl"); List<Book> books = DBHelper.getAll(Book.class); model.put("books", books); return new ModelAndView(model, "templates/layout.vtl"); }, new VelocityTemplateEngine()); } }
[ "gregorcox@gmail.com" ]
gregorcox@gmail.com
dffb7edd659ca406808d5f94201a3f890e14604f
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/google--closure-compiler/4c0608b02da98848593262f4667b1469b7738812/before/ReplaceIdGeneratorsTest.java
9228ec22c63e650874b4431b9116602222757093
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
18,100
java
/* * Copyright 2009 The Closure Compiler 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 com.google.javascript.jscomp; import static com.google.javascript.jscomp.ReplaceIdGenerators.INVALID_GENERATOR_PARAMETER; import com.google.common.collect.ImmutableMap; /** * Tests for {@link ReplaceIdGenerators}. * */ public final class ReplaceIdGeneratorsTest extends Es6CompilerTestCase { private boolean generatePseudoNames = false; private ReplaceIdGenerators lastPass = null; private String previousMappings = null; @Override protected CompilerPass getProcessor(final Compiler compiler) { RenamingMap xidTestMap = new RenamingMap() { private final ImmutableMap<String, String> map = ImmutableMap.of( "foo", ":foo:", "bar", ":bar:"); @Override public String get(String value) { String replacement = map.get(value); return replacement != null ? replacement : "unknown:" + value; } }; lastPass = new ReplaceIdGenerators( compiler, new ImmutableMap.Builder<String, RenamingMap>() .put("goog.events.getUniqueId", ReplaceIdGenerators.UNIQUE) .put("goog.place.getUniqueId", ReplaceIdGenerators.UNIQUE) .put("xid", xidTestMap) .build(), generatePseudoNames, previousMappings); return lastPass; } @Override protected void setUp() throws Exception { super.setUp(); generatePseudoNames = false; previousMappings = null; compareJsDoc = false; } @Override protected int getNumRepetitions() { return 1; } public void testBackwardCompat() { test("foo.bar = goog.events.getUniqueId('foo_bar')", "foo.bar = 'a'", "foo.bar = 'foo_bar$0'"); } public void testSerialization1() { testMap( LINE_JOINER.join( "var x = goog.events.getUniqueId('xxx');", "var y = goog.events.getUniqueId('yyy');"), LINE_JOINER.join( "var x = 'a';", "var y = 'b';"), LINE_JOINER.join( "[goog.events.getUniqueId]", "", "a:testcode:1:32", "b:testcode:2:32", "", "")); } public void testSerialization2() { testMap( LINE_JOINER.join( "/** @consistentIdGenerator */", "id = function() {};", "f1 = id('f1');", "f1 = id('f1')"), LINE_JOINER.join( "id = function() {};", "f1 = 'a';", "f1 = 'a'"), LINE_JOINER.join( "[id]", "", "a:f1", "", "")); } public void testReusePreviousSerialization1() { previousMappings = LINE_JOINER.join( "[goog.events.getUniqueId]", "", "previous1:testcode:1:32", "previous2:testcode:2:32", "", "[goog.place.getUniqueId]", "", ""); testMap("var x = goog.events.getUniqueId('xxx');\n" + "var y = goog.events.getUniqueId('yyy');\n", "var x = 'previous1';\n" + "var y = 'previous2';\n", "[goog.events.getUniqueId]\n" + "\n" + "previous1:testcode:1:32\n" + "previous2:testcode:2:32\n" + "\n"); } public void testReusePreviousSerialization2() { previousMappings = "[goog.events.getUniqueId]\n" + "\n" + "a:testcode:1:32\n" + "b:testcode:2:32\n" + "\n" + "[goog.place.getUniqueId]\n" + "\n" + "\n"; testMap( "var x = goog.events.getUniqueId('xxx');\n" + "\n" + // new line to change location "var y = goog.events.getUniqueId('yyy');\n", "var x = 'a';\n" + "var y = 'c';\n", "[goog.events.getUniqueId]\n" + "\n" + "a:testcode:1:32\n" + "c:testcode:3:32\n" + "\n"); } public void testReusePreviousSerializationConsistent1() { previousMappings = "[id]\n" + "\n" + "a:f1\n" + "\n"; testMap( "/** @consistentIdGenerator */ id = function() {};" + "f1 = id('f1');" + "f1 = id('f1')", "id = function() {};" + "f1 = 'a';" + "f1 = 'a'", "[id]\n" + "\n" + "a:f1\n" + "\n"); } public void testSimple() { test("/** @idGenerator */ foo.getUniqueId = function() {};" + "foo.bar = foo.getUniqueId('foo_bar')", "foo.getUniqueId = function() {};" + "foo.bar = 'a'", "foo.getUniqueId = function() {};" + "foo.bar = 'foo_bar$0'"); test("/** @idGenerator */ goog.events.getUniqueId = function() {};" + "foo1 = goog.events.getUniqueId('foo1');" + "foo1 = goog.events.getUniqueId('foo1');", "goog.events.getUniqueId = function() {};" + "foo1 = 'a';" + "foo1 = 'b';", "goog.events.getUniqueId = function() {};" + "foo1 = 'foo1$0';" + "foo1 = 'foo1$1';"); } public void testObjectLit() { test("/** @idGenerator */ goog.xid = function() {};" + "things = goog.xid({foo1: 'test', 'foo bar': 'test'})", "goog.xid = function() {};" + "things = {'a': 'test', 'b': 'test'}", "goog.xid = function() {};" + "things = {'foo1$0': 'test', 'foo bar$1': 'test'}"); } public void testObjectLit_empty() { test("/** @idGenerator */ goog.xid = function() {};" + "things = goog.xid({})", "goog.xid = function() {};" + "things = {}", "goog.xid = function() {};" + "things = {}"); } public void testObjectLit_function() { test("/** @idGenerator */ goog.xid = function() {};" + "things = goog.xid({foo: function() {}})", "goog.xid = function() {};" + "things = {'a': function() {}}", "goog.xid = function() {};" + "things = {'foo$0': function() {}}"); testEs6( "/** @idGenerator */ goog.xid = function() {};" + "things = goog.xid({foo: function*() {}})", "goog.xid = function() {};" + "things = {'a': function*() {}}", "goog.xid = function() {};" + "things = {'foo$0': function*() {}}"); } public void testObjectLit_ES6() { testErrorEs6(LINE_JOINER.join( "/** @idGenerator */", "goog.xid = function() {};", "things = goog.xid({fooX() {}})"), ReplaceIdGenerators.SHORTHAND_FUNCTION_NOT_SUPPORTED_IN_ID_GEN); testErrorEs6(LINE_JOINER.join( "/** @idGenerator */ ", "goog.xid = function() {};", "things = goog.xid({shorthand})"), ReplaceIdGenerators.SHORTHAND_ASSIGNMENT_NOT_SUPPORTED_IN_ID_GEN); testErrorEs6(LINE_JOINER.join( "/** @idGenerator */", "goog.xid = function() {};", "things = goog.xid({['fooX']: 'test'})"), ReplaceIdGenerators.COMPUTED_PROP_NOT_SUPPORTED_IN_ID_GEN); } public void testClass() { testSameEs6("", LINE_JOINER.join( "/** @idGenerator */", "goog.xid = function() {};", "things = goog.xid(class fooBar{})"), ReplaceIdGenerators.INVALID_GENERATOR_PARAMETER); } public void testSimpleConsistent() { test("/** @consistentIdGenerator */ id = function() {};" + "foo.bar = id('foo_bar')", "id = function() {};" + "foo.bar = 'a'", "id = function() {};" + "foo.bar = 'foo_bar$0'"); test("/** @consistentIdGenerator */ id = function() {};" + "f1 = id('f1');" + "f1 = id('f1')", "id = function() {};" + "f1 = 'a';" + "f1 = 'a'", "id = function() {};" + "f1 = 'f1$0';" + "f1 = 'f1$0'"); test("/** @consistentIdGenerator */ id = function() {};" + "f1 = id('f1');" + "f1 = id('f1');" + "f1 = id('f1')", "id = function() {};" + "f1 = 'a';" + "f1 = 'a';" + "f1 = 'a'", "id = function() {};" + "f1 = 'f1$0';" + "f1 = 'f1$0';" + "f1 = 'f1$0'"); } public void testSimpleStable() { testNonPseudoSupportingGenerator( "/** @stableIdGenerator */ id = function() {};" + "foo.bar = id('foo_bar')", "id = function() {};" + "foo.bar = '125lGg'"); testNonPseudoSupportingGenerator( "/** @stableIdGenerator */ id = function() {};" + "f1 = id('f1');" + "f1 = id('f1')", "id = function() {};" + "f1 = 'AAAMiw';" + "f1 = 'AAAMiw'"); } public void testVar() { test("/** @consistentIdGenerator */ var id = function() {};" + "foo.bar = id('foo_bar')", "var id = function() {};" + "foo.bar = 'a'", "var id = function() {};" + "foo.bar = 'foo_bar$0'"); testNonPseudoSupportingGenerator( "/** @stableIdGenerator */ var id = function() {};" + "foo.bar = id('foo_bar')", "var id = function() {};" + "foo.bar = '125lGg'"); } public void testLet() { testEs6( "/** @consistentIdGenerator */ let id = function() {};" + "foo.bar = id('foo_bar')", "let id = function() {};" + "foo.bar = 'a'", "let id = function() {};" + "foo.bar = 'foo_bar$0'"); testNonPseudoSupportingGeneratorEs6( "/** @stableIdGenerator */ let id = function() {};" + "foo.bar = id('foo_bar')", "let id = function() {};" + "foo.bar = '125lGg'"); } public void testConst() { testEs6( "/** @consistentIdGenerator */ const id = function() {};" + "foo.bar = id('foo_bar')", "const id = function() {};" + "foo.bar = 'a'", "const id = function() {};" + "foo.bar = 'foo_bar$0'"); testNonPseudoSupportingGeneratorEs6( "/** @stableIdGenerator */ const id = function() {};" + "foo.bar = id('foo_bar')", "const id = function() {};" + "foo.bar = '125lGg'"); } public void testInObjLit() { test("/** @consistentIdGenerator */ get.id = function() {};" + "foo.bar = {a: get.id('foo_bar')}", "get.id = function() {};" + "foo.bar = {a: 'a'}", "get.id = function() {};" + "foo.bar = {a: 'foo_bar$0'}"); testNonPseudoSupportingGenerator( "/** @stableIdGenerator */ get.id = function() {};" + "foo.bar = {a: get.id('foo_bar')}", "get.id = function() {};" + "foo.bar = {a: '125lGg'}"); } public void testInObjLit2() { test("/** @idGenerator {mapped}*/ xid = function() {};" + "foo.bar = {a: xid('foo')}", "xid = function() {};" + "foo.bar = {a: ':foo:'}", "xid = function() {};" + "foo.bar = {a: ':foo:'}"); } public void testMapped() { test("/** @idGenerator {mapped}*/ xid = function() {};" + "foo.bar = xid('foo');", "xid = function() {};" + "foo.bar = ':foo:';", "xid = function() {};" + "foo.bar = ':foo:';"); } public void testMappedMap() { testMap("/** @idGenerator {mapped}*/ xid = function() {};" + "foo.bar = xid('foo');" + "foo.bar = xid('foo');", "xid = function() {};" + "foo.bar = ':foo:';" + "foo.bar = ':foo:';", "[xid]\n" + "\n" + ":foo::foo\n" + "\n"); } public void testMapped2() { test("/** @idGenerator {mapped}*/ xid = function() {};" + "foo.bar = function() { return xid('foo'); };", "xid = function() {};" + "foo.bar = function() { return ':foo:'; };", "xid = function() {};" + "foo.bar = function() { return ':foo:'; };"); } public void testTwoGenerators() { test("/** @idGenerator */ var id1 = function() {};" + "/** @idGenerator */ var id2 = function() {};" + "f1 = id1('1');" + "f2 = id1('1');" + "f3 = id2('1');" + "f4 = id2('1');", "var id1 = function() {};" + "var id2 = function() {};" + "f1 = 'a';" + "f2 = 'b';" + "f3 = 'a';" + "f4 = 'b';", "var id1 = function() {};" + "var id2 = function() {};" + "f1 = '1$0';" + "f2 = '1$1';" + "f3 = '1$0';" + "f4 = '1$1';"); } public void testMixedGenerators() { test("/** @idGenerator */ var id1 = function() {};" + "/** @consistentIdGenerator */ var id2 = function() {};" + "/** @stableIdGenerator */ var id3 = function() {};" + "f1 = id1('1');" + "f2 = id1('1');" + "f3 = id2('1');" + "f4 = id2('1');" + "f5 = id3('1');" + "f6 = id3('1');", "var id1 = function() {};" + "var id2 = function() {};" + "var id3 = function() {};" + "f1 = 'a';" + "f2 = 'b';" + "f3 = 'a';" + "f4 = 'a';" + "f5 = 'AAAAMQ';" + "f6 = 'AAAAMQ';", "var id1 = function() {};" + "var id2 = function() {};" + "var id3 = function() {};" + "f1 = '1$0';" + "f2 = '1$1';" + "f3 = '1$0';" + "f4 = '1$0';" + "f5 = 'AAAAMQ';" + "f6 = 'AAAAMQ';"); } public void testNonLiteralParam1() { testSame("/** @idGenerator */ var id = function() {}; " + "var x = 'foo';" + "id(x);", ReplaceIdGenerators.INVALID_GENERATOR_PARAMETER); } public void testNonLiteralParam2() { testSame("/** @idGenerator */ var id = function() {}; " + "id('foo' + 'bar');", ReplaceIdGenerators.INVALID_GENERATOR_PARAMETER); } public void testLocalCall() { testError("/** @idGenerator */ var id = function() {}; " + "function Foo() { id('foo'); }", ReplaceIdGenerators.NON_GLOBAL_ID_GENERATOR_CALL); } public void testConditionalCall() { testError(LINE_JOINER.join( "/** @idGenerator */", "var id = function() {}; ", "while(0){ id('foo');}"), ReplaceIdGenerators.CONDITIONAL_ID_GENERATOR_CALL); testError(LINE_JOINER.join( "/** @idGenerator */", "var id = function() {}; ", "for(;;){ id('foo');}"), ReplaceIdGenerators.CONDITIONAL_ID_GENERATOR_CALL); testError("/** @idGenerator */ var id = function() {}; " + "if(x) id('foo');", ReplaceIdGenerators.CONDITIONAL_ID_GENERATOR_CALL); test("/** @consistentIdGenerator */ var id = function() {};" + "function fb() {foo.bar = id('foo_bar')}", "var id = function() {};" + "function fb() {foo.bar = 'a'}", "var id = function() {};" + "function fb() {foo.bar = 'foo_bar$0'}"); testNonPseudoSupportingGenerator( "/** @stableIdGenerator */ var id = function() {};" + "function fb() {foo.bar = id('foo_bar')}", "var id = function() {};" + "function fb() {foo.bar = '125lGg'}"); testErrorEs6( LINE_JOINER.join( "/** @idGenerator */", "var id = function() {}; ", "for(x of [1, 2, 3]){ id('foo');}"), ReplaceIdGenerators.CONDITIONAL_ID_GENERATOR_CALL); } public void testConflictingIdGenerator() { testError("/** @idGenerator \n @consistentIdGenerator \n*/" + "var id = function() {}; ", ReplaceIdGenerators.CONFLICTING_GENERATOR_TYPE); testError("/** @stableIdGenerator \n @idGenerator \n*/" + "var id = function() {}; ", ReplaceIdGenerators.CONFLICTING_GENERATOR_TYPE); testError("/** @stableIdGenerator \n " + "@consistentIdGenerator \n*/" + "var id = function() {}; ", ReplaceIdGenerators.CONFLICTING_GENERATOR_TYPE); test("/** @consistentIdGenerator */ var id = function() {};" + "if (x) {foo.bar = id('foo_bar')}", "var id = function() {};" + "if (x) {foo.bar = 'a'}", "var id = function() {};" + "if (x) {foo.bar = 'foo_bar$0'}"); } public void testUnknownMapping() { testSame("" + "/** @idGenerator {mapped} */\n" + "var id = function() {};\n" + "function Foo() { id('foo'); }\n", ReplaceIdGenerators.MISSING_NAME_MAP_FOR_GENERATOR); } public void testBadGenerator1() { testSame("/** @idGenerator */ id = function() {};" + "foo.bar = id()", INVALID_GENERATOR_PARAMETER); } public void testBadGenerator2() { testSame("/** @consistentIdGenerator */ id = function() {};" + "foo.bar = id()", INVALID_GENERATOR_PARAMETER); } private void testMap(String code, String expected, String expectedMap) { test(code, expected); assertEquals(expectedMap, lastPass.getSerializedIdMappings()); } private void test(String code, String expected, String expectedPseudo) { generatePseudoNames = false; test(code, expected); generatePseudoNames = true; test(code, expectedPseudo); } private void testEs6(String code, String expected, String expectedPseudo) { generatePseudoNames = false; testEs6(code, expected); generatePseudoNames = true; testEs6(code, expectedPseudo); } private void testNonPseudoSupportingGenerator(String code, String expected) { generatePseudoNames = false; test(code, expected); generatePseudoNames = true; test(code, expected); } private void testNonPseudoSupportingGeneratorEs6(String code, String expected) { generatePseudoNames = false; testEs6(code, expected); generatePseudoNames = true; testEs6(code, expected); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
dda72e0212edbab75d8151b9a4fb859a97a18899
e8e4c044df1abe90a24add7fcd8d995dfe954053
/kps-sample-client-api/src/main/java/tr/gov/nvi/kpsv2/KisiListeleme.java
fad35076beec3a9624cd1f9339f5ad44b34b2120
[]
no_license
harunergul/KimlikPaylasimSistemi
a5e40cc5fbb82f19932c8538d5685f3b7578d9c7
aaaa183aac5088f76b0b4ab6cacdb88e2b5cd636
refs/heads/main
2023-07-10T03:50:51.545578
2021-08-17T06:45:47
2021-08-17T06:45:47
394,894,748
0
0
null
null
null
null
ISO-8859-9
Java
false
false
7,531
java
package tr.gov.nvi.kpsv2; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.TimeZone; import javax.xml.bind.JAXBElement; import javax.xml.datatype.DatatypeConfigurationException; import javax.xml.datatype.DatatypeFactory; import tr.gov.nvi.kpsv2.model.KisiModel; import tr.gov.nvi.kpsv2.model.ParametreModel; import tr.gov.nvi.kpsv2.model.SayfalamaModel; import tr.gov.nvi.kpsv2.model.TarihModel; import tr.gov.nvi.kpsv2.ws.client.exceptions.NviServiceException; import tr.gov.nvi.kpsv2.ws.client.factory.KPSClientFactory2; import tr.gov.nvi.kpsv2.ws.kisilistele.CstCinsiyet; import tr.gov.nvi.kpsv2.ws.kisilistele.DogumTarihveCinsiyeteGoreKisiBilgisi; import tr.gov.nvi.kpsv2.ws.kisilistele.KisiListeleServis; import tr.gov.nvi.kpsv2.ws.kisilistele.KisiListeleSorguKriteri; import tr.gov.nvi.kpsv2.ws.kisilistele.KisiListesi; import tr.gov.nvi.kpsv2.ws.kisilistele.KisiListesiSonucu; import tr.gov.nvi.kpsv2.ws.kisilistele.ObjectFactory; import tr.gov.nvi.kpsv2.ws.kisilistele.Parametre; import tr.gov.nvi.kpsv2.ws.kisilistele.TarihBilgisi; public class KisiListeleme { private static ObjectFactory kisiListeleObjectFactory = new ObjectFactory(); private KisiListeleme() { } public static SayfalamaModel<KisiModel> kisiListele(int ilce, Date baslangicTarih, Date bitisTarih, CstCinsiyet cinsiyet) throws NviServiceException { SayfalamaModel<KisiModel> result = null; try { DatatypeFactory dtFactory = DatatypeFactory.newInstance(); GregorianCalendar baslangicCal = new GregorianCalendar(TimeZone.getDefault()); baslangicCal.setTime(baslangicTarih); GregorianCalendar bitisCal = new GregorianCalendar(TimeZone.getDefault()); bitisCal.setTime(bitisTarih); KisiListeleSorguKriteri kriter = kisiListeleObjectFactory.createKisiListeleSorguKriteri(); kriter.setIlce(kisiListeleObjectFactory.createKisiListeleSorguKriteriIlce(Integer.valueOf(ilce))); kriter.setBaslangicTarih(kisiListeleObjectFactory.createKisiListeleSorguKriteriBaslangicTarih(dtFactory.newXMLGregorianCalendar(baslangicCal))); kriter.setBitisTarih(kisiListeleObjectFactory.createKisiListeleSorguKriteriBitisTarih(dtFactory.newXMLGregorianCalendar(bitisCal))); kriter.setCinsiyet(kisiListeleObjectFactory.createKisiListeleSorguKriteriCinsiyet(cinsiyet)); kriter.setSayfaAnahtari(null); KisiListeleServis servis = KPSClientFactory2.Instance.newKisiListele(); KisiListesiSonucu sonuc = servis.sayfala(kriter); if (sonuc.getHataBilgisi().getValue() == null) { KisiListesi sonucListe = sonuc.getSorguSonucu().getValue(); List<DogumTarihveCinsiyeteGoreKisiBilgisi> kisiBilgisiListesi = sonucListe.getSonuc().getValue().getDogumTarihveCinsiyeteGoreKisiBilgisi(); result = new SayfalamaModel<KisiModel>(); result.setKriter(kriter); result.setAnahtar(sonucListe.getSayfaAnahtari().getValue().longValue()); for (int i = 0; i < kisiBilgisiListesi.size(); i++) { result.getList().add(convertToKisiModel(kisiBilgisiListesi.get(i))); } return result; } else { String hataMesaji = String.format("%d: %s", sonuc.getHataBilgisi().getValue().getKod().getValue(), sonuc.getHataBilgisi().getValue().getAciklama().getValue()); throw new NviServiceException(hataMesaji); } } catch (DatatypeConfigurationException dtcEx) { throw new NviServiceException("DatatypeFactory oluşturulamadı.", dtcEx); } } public static SayfalamaModel<KisiModel> kisiListele(SayfalamaModel<KisiModel> oncekiSayfa) throws NviServiceException { SayfalamaModel<KisiModel> result = null; KisiListeleSorguKriteri kriter = (KisiListeleSorguKriteri)oncekiSayfa.getKriter(); kriter.setSayfaAnahtari(kisiListeleObjectFactory.createKisiListeleSorguKriteriSayfaAnahtari(Long.valueOf(oncekiSayfa.getAnahtar()))); KisiListeleServis servis = KPSClientFactory2.Instance.newKisiListele(); KisiListesiSonucu sonuc = servis.sayfala(kriter); if (sonuc.getHataBilgisi().getValue() == null) { KisiListesi sonucListe = sonuc.getSorguSonucu().getValue(); List<DogumTarihveCinsiyeteGoreKisiBilgisi> kisiBilgisiListesi = sonucListe.getSonuc().getValue().getDogumTarihveCinsiyeteGoreKisiBilgisi(); result = new SayfalamaModel<KisiModel>(); result.setKriter(kriter); result.setAnahtar(sonucListe.getSayfaAnahtari().getValue().longValue()); for (int i = 0; i < kisiBilgisiListesi.size(); i++) { result.getList().add(convertToKisiModel(kisiBilgisiListesi.get(i))); } return result; } else { String hataMesaji = String.format("%d: %s", sonuc.getHataBilgisi().getValue().getKod().getValue(), sonuc.getHataBilgisi().getValue().getAciklama().getValue()); throw new NviServiceException(hataMesaji); } } private static KisiModel convertToKisiModel(DogumTarihveCinsiyeteGoreKisiBilgisi kisi) { KisiModel result = new KisiModel(); result.setHata(convertToParametreModel(kisi.getHataBilgisi())); result.setTcKimlikNo(kisi.getTCKimlikNo().getValue().longValue()); result.setAd(kisi.getTemelBilgisi().getValue().getAd().getValue()); result.setSoyad(kisi.getTemelBilgisi().getValue().getSoyad().getValue()); result.setAnneAd(kisi.getTemelBilgisi().getValue().getAnneAd().getValue()); result.setBabaAd(kisi.getTemelBilgisi().getValue().getBabaAd().getValue()); result.setDogumYer(kisi.getTemelBilgisi().getValue().getDogumYer().getValue()); result.setDogumTarih(convertToTarihModel(kisi.getTemelBilgisi().getValue().getDogumTarih())); result.setCinsiyet(convertToParametreModel(kisi.getTemelBilgisi().getValue().getCinsiyet())); result.setDurum(convertToParametreModel(kisi.getDurumBilgisi().getValue().getDurum())); result.setMedeniHal(convertToParametreModel(kisi.getDurumBilgisi().getValue().getMedeniHal())); result.setOlumTarih(convertToTarihModel(kisi.getDurumBilgisi().getValue().getOlumTarih())); result.setKayitYerIl(convertToParametreModel(kisi.getKayitYeriBilgisi().getValue().getIl())); result.setKayitYerIlce(convertToParametreModel(kisi.getKayitYeriBilgisi().getValue().getIlce())); result.setKayitYerCilt(convertToParametreModel(kisi.getKayitYeriBilgisi().getValue().getCilt())); result.setAileSiraNo(kisi.getKayitYeriBilgisi().getValue().getAileSiraNo().getValue().intValue()); result.setBireySiraNo(kisi.getKayitYeriBilgisi().getValue().getBireySiraNo().getValue().intValue()); return result; } private static TarihModel convertToTarihModel(JAXBElement<TarihBilgisi> tarihElement) { if (tarihElement == null) { return null; } TarihBilgisi tarih = tarihElement.getValue(); if (tarih == null || (tarih.getAy() == null && tarih.getGun() == null && tarih.getYil() == null)) { return null; } TarihModel result = new TarihModel(); result.setGun(tarih.getGun().getValue()); result.setAy(tarih.getAy().getValue()); result.setYil(tarih.getYil().getValue()); return result; } private static ParametreModel convertToParametreModel(JAXBElement<Parametre> parametreElement) { if (parametreElement == null) { return null; } Parametre parametre = parametreElement.getValue(); if (parametre == null || (parametre.getKod().getValue() == null && parametre.getAciklama().getValue() == null)) { return null; } ParametreModel result = new ParametreModel(); result.setKod(parametre.getKod().getValue().intValue()); result.setAciklama(parametre.getAciklama().getValue()); return result; } }
[ "harunergul@outlook.com" ]
harunergul@outlook.com
eb0cbd208dce60314721ff63028782a5f79fc933
410dc10d381a83145ecdd68ae6d4e2b36320a1de
/First 15 programs./Sum.java
ec8bdab78741228bb57ee71ac4ce31b28fec1a78
[]
no_license
aaaryya1/java-program
445918eab63f2ea368b126130bafb434997ff499
46657398f483ff45fb225032bdf39378af09d519
refs/heads/main
2023-08-11T19:35:55.553290
2021-10-03T08:26:20
2021-10-03T08:26:20
370,914,076
0
0
null
null
null
null
UTF-8
Java
false
false
107
java
public class Sum { public static void main(String[] args) { System.out.println(760+25); } }
[ "noreply@github.com" ]
aaaryya1.noreply@github.com
1cb39d73a8a84bac98c2ca424b0c05a9cce14ce6
b5e08012256167c4e64f64d12f6ab857739f237c
/restclient-lib/src/main/java/org/wiztools/restclient/ViewAdapter.java
2084c634233bd14d1c41a4fe0a4244e40ea7a153
[ "Apache-2.0" ]
permissive
mdsol/rest-client
66f24948bd409c0f5f8c98d66373e7a8c4ddf819
d706fd802e16e1338171f56f93e540019b61585c
refs/heads/master
2021-01-22T04:05:04.941636
2020-02-13T10:31:57
2020-02-13T10:31:57
92,425,778
1
0
Apache-2.0
2020-02-13T10:31:59
2017-05-25T17:05:02
Java
UTF-8
Java
false
false
438
java
package org.wiztools.restclient; import org.wiztools.restclient.bean.Response; import org.wiztools.restclient.bean.Request; /** * * @author subwiz */ public class ViewAdapter implements View { public void doStart(Request request) { } public void doResponse(Response response) { } public void doCancelled() { } public void doEnd() { } public void doError(String error) { } }
[ "subwiz@08545216-953f-0410-99bf-93b34cd2520f" ]
subwiz@08545216-953f-0410-99bf-93b34cd2520f
8a319c80ab38a32fc49bb14aafcf5255d6659795
6198ebcf4b29c289074fe260bfa9bab614172b96
/src/VarshaT/Program11.java
eb457def40e8804cace1787d33f14eb4e468c656
[]
no_license
KrishnaKTechnocredits/Aug19JavaG1
affe0db20e2b014650683f9c80ff1062c6276cd9
a26407fa7f2a443e529c2f6a35e14d0a41df783b
refs/heads/master
2022-03-09T13:28:42.052516
2019-10-01T09:12:45
2019-10-01T09:12:45
204,036,671
1
0
null
null
null
null
UTF-8
Java
false
false
759
java
/* WAP to find to number is palindrome or not. Note:- Palindrome means given word/number is same to read from forward and backward i.e. actual number :- 12321 reverse of actual number :- 12321 */ package VarshaT; import java.util.Scanner; public class Program11 { void reverse(int num) { int x=0,sum=0,num1; num1= num; while(num>0) { x=num%10; num/=10; sum=sum*10+x; } if(num1== num) System.out.println("number is plaindrome"); else System.out.println("number is plaindrome"); } public static void main(String[] args) { Program11 program11= new Program11(); Scanner sc= new Scanner(System.in); System.out.println("enter the number"); int num= sc.nextInt(); program11.reverse(num); sc.close(); } }
[ "varshatiwari1408@gmail.com" ]
varshatiwari1408@gmail.com
814725e684f34939ca27d21d887eae1a280979a5
48a682c64ac98b46756a3ed436cd425a78312068
/app/src/main/java/rannygaming/developers/footballfan/ModeTeammatesActivity2.java
7aaaf766da73244726019b69e396a23dbfb1043e
[]
no_license
ronnytvi/FootballFan
915732e2ec121c1a092f380522e9a737d9c21b98
ee4e61b3bd512ad99f5201996386f7d598566ccb
refs/heads/main
2023-08-27T07:12:06.646886
2021-11-05T20:25:03
2021-11-05T20:25:03
425,075,072
0
0
null
null
null
null
UTF-8
Java
false
false
12,865
java
package rannygaming.developers.footballfan; import android.content.Intent; import android.content.SharedPreferences; import android.os.AsyncTask; import android.os.Bundle; import android.os.CountDownTimer; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import com.bumptech.glide.Glide; import com.google.android.material.bottomsheet.BottomSheetDialog; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import java.util.Random; public class ModeTeammatesActivity2 extends AppCompatActivity { static ImageView imageView; static Button btnVar1; static Button btnVar2; static Button btnVar3; static Button btnVar4; public ProgressBar pb; CountDownTimer mCountDownTimer; static int counter = ModeTeammatesActivity.counter; static String image_path = ""; //Randomize static int min = 1; static int max = 4; static Random r = new Random(); static int index = r.nextInt(max - min + 1) + min; //Randomize end //Валюта и подсказка static String login; SharedPreferences sharedPreferences; private static final String SHARED_PREF_NAME = "mypref"; private static final String KEY_LOGIN = "login"; Button btnHelp; static String help; static Button btvMoney; static String URL_Buy_Help = "https://rannygaming.ru/footballfanphp/buyhelp.php" ; Integer statusHelp = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mode_teammates); btvMoney = findViewById(R.id.btvMoney); sharedPreferences = getSharedPreferences(SHARED_PREF_NAME, MODE_PRIVATE); login = sharedPreferences.getString(KEY_LOGIN, null); new ModeTeammatesActivity.Level_Money().execute(); new Task().execute(); btnHelp = findViewById(R.id.btnHelp); btnHelp.setText("50 Footcoin"); btnHelp.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String currentMoney = btvMoney.getText().toString(); Integer mMoney = Integer.valueOf(currentMoney); String money = "50"; if (statusHelp == 0){ if (mMoney >= 50){ BuyHelp(login, URL_Buy_Help, money); new ModePlayerActivity.Level_Money().execute(); statusHelp = 1; final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(ModeTeammatesActivity2.this, R.style.BottomSheetDialogTheme); View bottomSheetView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.layout_bottom_sheet_help, (LinearLayout)findViewById(R.id.bottomSheetContainer)); TextView tvHelp = bottomSheetView.findViewById(R.id.tvHelp); tvHelp.setText(help); bottomSheetView.findViewById(R.id.btnOk).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bottomSheetDialog.dismiss(); } }); bottomSheetDialog.setContentView(bottomSheetView); bottomSheetDialog.show(); } } else if (mMoney < 50 && statusHelp == 0){ Toast.makeText(ModeTeammatesActivity2.this, "У вас недостаточно Footcoin`s", Toast.LENGTH_LONG).show(); } else if (statusHelp == 1){ final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(ModeTeammatesActivity2.this, R.style.BottomSheetDialogTheme); View bottomSheetView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.layout_bottom_sheet_help, (LinearLayout)findViewById(R.id.bottomSheetContainer)); TextView tvHelp = bottomSheetView.findViewById(R.id.tvHelp); tvHelp.setText(help); bottomSheetView.findViewById(R.id.btnOk).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { bottomSheetDialog.dismiss(); } }); bottomSheetDialog.setContentView(bottomSheetView); bottomSheetDialog.show(); } } }); btnVar1 = findViewById(R.id.btnVar1); btnVar1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (btnVar1.getText().toString() == Task.replys){ counter++; } btnClick(ModeTeammatesActivity3.class); } }); btnVar2 = findViewById(R.id.btnVar2); btnVar2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (btnVar2.getText().toString() == Task.replys){ counter++; } btnClick(ModeTeammatesActivity3.class); } }); btnVar3 = findViewById(R.id.btnVar3); btnVar3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (btnVar3.getText().toString() == Task.replys){ counter++; } btnClick(ModeTeammatesActivity3.class); } }); btnVar4 = findViewById(R.id.btnVar4); btnVar4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (btnVar4.getText().toString() == Task.replys){ counter++; } btnClick(ModeTeammatesActivity3.class); } }); pb = findViewById(R.id.pbTimer); mCountDownTimer = new CountDownTimer(21000,1000) { @Override public void onTick(long millisUntilFinished) { Log.v("Log_tag", "Tick of Progress"+ millisUntilFinished); pb.setProgress((int) (millisUntilFinished/1000)); } @Override public void onFinish() { Intent intent = new Intent(ModeTeammatesActivity2.this, ModeTeammatesActivity3.class); startActivity(intent);finish(); } }; mCountDownTimer.start(); imageView = (ImageView) findViewById(R.id.imageView); Glide.with(this).load(image_path).into(imageView); } //SQL запрос static class Task extends AsyncTask<Void, Void, Void> { String error = ""; static String replys = ""; String vars2 = ""; String vars3 = ""; String vars4 = ""; static String path_to_image; @Override protected Void doInBackground(Void... voids) { try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection(ModeLogoActivity.url, ModeLogoActivity.user, ModeLogoActivity.password); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM questions_mode_teammates WHERE id=?"); preparedStatement.setString(1, String.valueOf(ModeTeammatesActivity.numAsk2)); ResultSet resultSet = preparedStatement.executeQuery(); while (resultSet.next()) { path_to_image = resultSet.getString(2); replys = resultSet.getString(3); vars2 = resultSet.getString(4); vars3 = resultSet.getString(5); vars4 = resultSet.getString(6); } connection.close(); } catch (Exception e) { error = e.toString(); } return null; } @Override protected void onPostExecute(Void aVoid) { Glide.with(imageView.getContext()).load(path_to_image).into(imageView); if (index == 1){ btnVar1.setText(replys); btnVar2.setText(vars2); btnVar3.setText(vars3); btnVar4.setText(vars4); } else if (index == 2){ btnVar1.setText(vars2); btnVar2.setText(replys); btnVar3.setText(vars3); btnVar4.setText(vars4); } else if (index == 3){ btnVar1.setText(vars3); btnVar2.setText(vars2); btnVar3.setText(replys); btnVar4.setText(vars4); } else { btnVar1.setText(vars4); btnVar2.setText(vars2); btnVar3.setText(vars3); btnVar4.setText(replys); } super.onPostExecute(aVoid); } } //SQL end public void btnClick(Class mClass) { mCountDownTimer.cancel(); Intent intent = new Intent(this, mClass); startActivity(intent); finish(); } //SQL запрос Level & Money static class Level_Money extends AsyncTask<Void, Void, Void> { String error=""; static String mMoney; @Override protected Void doInBackground(Void... voids) { try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection(ModeLogoActivity.url, ModeLogoActivity.user, ModeLogoActivity.password); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM users WHERE login = ?"); preparedStatement.setString(1, login); ResultSet resultSet = preparedStatement.executeQuery(); while(resultSet.next()){ mMoney = resultSet.getString(8); } } catch (Exception e){ error = e.toString(); } return null; } @Override protected void onPostExecute(Void aVoid) { btvMoney.setText(mMoney); super.onPostExecute(aVoid); } } public void BuyHelp(final String login, final String URL, final String money){ class SendPostReqAsyncTask extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... params) { String LoginHolder = login; String MoneyHolder = money; List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("login", LoginHolder)); nameValuePairs.add(new BasicNameValuePair("money", MoneyHolder)); try { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(URL); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8")); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); } catch (ClientProtocolException e) { } catch (IOException e) { } return "Data Inserted Successfully"; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); } } SendPostReqAsyncTask sendPostReqAsyncTask = new SendPostReqAsyncTask(); sendPostReqAsyncTask.execute(login, money); } }
[ "romik.p2011@gmail.com" ]
romik.p2011@gmail.com
a039952f61f9151a84531344b5d15a1786d556a0
6b604c73636f5e9a3b80e61627c0bc14eed9c320
/src/main/java/com/codeup/springblog/models/PostDetails.java
ee6c5cde79e58ef996b32d9dc47b0c2e881e2c32
[]
no_license
Robert-Rutherford/Spring-examples
c64fe95966f48502f954abd1f79ed961c4f24423
99cee2510a3638784b999e57738e1cdd927693dd
refs/heads/master
2020-12-21T18:47:41.728239
2020-02-05T17:37:25
2020-02-05T17:37:25
236,526,210
0
0
null
null
null
null
UTF-8
Java
false
false
1,430
java
package com.codeup.springblog.models; import javax.persistence.*; import java.util.List; @Entity @Table(name = "postsDetails") public class PostDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(nullable = false) private long id; private boolean isAwesome; @Column(columnDefinition = "TEXT") private String historyOfPost; @Column(nullable = false) private String topicDescription; // @OneToMany(cascade = CascadeType.ALL, mappedBy = "user") // private List<PostImage> postImages; public PostDetails(){} // public List<PostImage> getPostImages() { // return postImages; // } // // public void setPostImages(List<PostImage> postImages) { // this.postImages = postImages; // } public long getId() { return id; } public void setId(long id) { this.id = id; } public boolean isAwesome() { return isAwesome; } public void setAwesome(boolean awesome) { isAwesome = awesome; } public String getHistoryOfPost() { return historyOfPost; } public void setHistoryOfPost(String historyOfPost) { this.historyOfPost = historyOfPost; } public String getTopicDescription() { return topicDescription; } public void setTopicDescription(String topicDescription) { this.topicDescription = topicDescription; } }
[ "robertl.rutherford2@gmail.com" ]
robertl.rutherford2@gmail.com
8e9520b2a852f3f0ebdd4f7f6e4b1f0a83c23457
30ade89feefcca75cf5c28fc8385623eb0cd3b36
/collection/src/main/java/collectionArrayList/CustomerList.java
f13f7b5cc8bcd1d9b6a23b4b1cbc14558117bf44
[]
no_license
Akshay4877/java
1a139aadb0e1df215f1a5516f8068c64888df6cf
b721fee9b0a7252026d7e79437a6312a38874cc6
refs/heads/main
2023-07-24T22:39:33.186750
2021-09-02T08:55:50
2021-09-02T08:55:50
402,147,258
0
0
null
null
null
null
UTF-8
Java
false
false
1,460
java
package collectionArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.lang.*; public class CustomerList implements Comparable<CustomerList> { int custid; String cuts_name; int prodquntity; public CustomerList(int custid, String cuts_name, int prodquntity) { super(); this.custid = custid; this.cuts_name = cuts_name; this.prodquntity = prodquntity; } @Override public String toString() { return "CustomerCollection [custid=" + custid + ", cuts_name=" + cuts_name + ", prodquntity=" + prodquntity + "]"; } @Override public int compareTo(CustomerList o) { if(prodquntity==o.prodquntity) return 0; else if(prodquntity > o.prodquntity ) return 1; else return -1; } public static void main(String[] args) { ArrayList<CustomerList> arr=new ArrayList<CustomerList>(); arr.add(new CustomerList(1,"swati",20)); arr.add(new CustomerList(2,"smita",15)); arr.add(new CustomerList(3,"swapnali",5)); arr.add(new CustomerList(4,"Nikita",12)); arr.add(new CustomerList(5,"usha",9)); System.out.println("add method in customer"); for(CustomerList c:arr) System.out.println(c); System.out.println("camparable sorting....."); Collections.sort(arr); for(CustomerList c:arr) System.out.println(c); } }
[ "noreply@github.com" ]
Akshay4877.noreply@github.com
d389f091fe48cbbb4967d456041ae7e8f359fdb0
58ea1a193ac9cbc853de1075e3cf1dcc9ee73e7b
/lemonhello/src/main/java/com/example/lemonhello/interfaces/LemonPaintContext.java
94fd7f3bf85d632ae2e008b110a8d9c810fff21d
[]
no_license
A-10ng/StudentAgency
99a63e5533acd8eab07c79384f4ac74c2954ce15
49241200dfbd8fdc5a37393994dd48c47a615e6a
refs/heads/master
2022-11-22T08:06:38.526648
2020-03-23T05:19:37
2020-03-23T05:19:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package com.example.lemonhello.interfaces; import android.graphics.Canvas; /** * 正式绘制动画的接口 */ public interface LemonPaintContext { /** * 绘制方法 * * @param canvas 要绘制图形的画布 * @param playProgress 当前动画播放的进度 */ void paint(Canvas canvas, float playProgress); }
[ "2674461089@qq.com" ]
2674461089@qq.com
72203d2b12292e2d78c3a4a30e82822746659635
be9764fed53499145b64132f6c475632180f36e4
/Semaphore-CoffeeMachine/Coffee/src/model/Pingado.java
9d6fc8eeb5991456b0cc9c730cd48e35dc3f72a1
[]
no_license
juliadsilva/Java
67072d02a3ecb2fae6051cae6395083ea594f342
7b855170f4ec3c0c664a22376f2c6f14b5b957bd
refs/heads/master
2023-03-16T19:07:52.532541
2021-03-02T23:31:44
2021-03-02T23:31:44
288,713,552
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package model; /** * * @author julin */ public class Pingado extends Bebida { public static final int qtdAgua = 5; public static final int qtdIngrediente = 40; private int qtdAcucar; public Pingado (int qtdAcucar) { super(qtdAcucar, qtdAgua, qtdIngrediente, "Café com Leite"); } }
[ "juliadanielesilva@outlook.com" ]
juliadanielesilva@outlook.com
2301f54f89e76c239ff05d4978acfbeca9f79031
87c2c834df1bf1aad6d2d0ad423db404a8a27729
/ntua/mint2/src/main/java/gr/ntua/ivml/mint/actions/ImportsPanel.java
94aedca5444998e712134dfd41f1199308397291
[ "Apache-2.0" ]
permissive
diegoceccarelli/contrib
62998f86ad436a5a85abfed9a94a38ee5f903315
b750afab573cdad71fbe4eb419fb43715a19ab3a
refs/heads/master
2021-01-18T08:57:32.927561
2014-09-17T09:29:48
2014-09-17T09:29:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,384
java
package gr.ntua.ivml.mint.actions; import gr.ntua.ivml.mint.Publication; import gr.ntua.ivml.mint.db.DB; import gr.ntua.ivml.mint.db.LockManager; import gr.ntua.ivml.mint.persistent.DataUpload; import gr.ntua.ivml.mint.persistent.Dataset; import gr.ntua.ivml.mint.persistent.Organization; import gr.ntua.ivml.mint.persistent.User; import gr.ntua.ivml.mint.view.Import; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.log4j.Logger; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; @Results({ @Result(name="error", location="importsPanel.jsp"), @Result(name="success", location="importsPanel.jsp") }) public class ImportsPanel extends GeneralAction{ protected final Logger log = Logger.getLogger(getClass()); private int startImport, maxImports; private long orgId; private long userId=-1; private String action=""; private String actionmessage=""; private User u=null; private Organization o=null; private ArrayList uploadCheck=new ArrayList(); private String labels=""; @Action(value="ImportsPanel") public String execute() throws Exception { if(this.action.equalsIgnoreCase("delete")){ boolean del=false; LockManager lm = DB.getLockManager(); for(int i=0;i<uploadCheck.size();i++) { DataUpload du=DB.getDataUploadDAO().getById(Long.parseLong((String)uploadCheck.get(i)), false); if(du==null){ addActionMessage("Import "+uploadCheck.get(i)+" missing from database."); } else if( lm.isLocked( du ) != null ) { addActionMessage( "Error!Import "+uploadCheck.get(i)+" currently locked. " ); } else{ try{ del=DB.getDataUploadDAO().makeTransient(du); addActionMessage("Import "+du.getOriginalFilename()+" successfully deleted"); }catch (Exception ex){ log.debug("exception thrown:"+ex.getMessage()); } } } if(del){ while(startImport>this.getImportCount()){ startImport=startImport-maxImports; } if(startImport<0){startImport=0;} } return SUCCESS; } if(startImport>this.getImportCount()){ setActionmessage("Page does not exist."); startImport=0;} return SUCCESS; } public String getActionmessage(){ return(actionmessage); } public void setActionmessage(String message){ this.actionmessage=message; } public String getLabels(){ return(labels); } public void setLabels(String labels){ this.labels=labels; } public void setUploadCheck(String uploadCheck){ this.uploadCheck=new ArrayList(); if(uploadCheck.trim().length()>0){ String[] chstr=uploadCheck.split(","); java.util.Collection c=java.util.Arrays.asList(chstr); this.uploadCheck.addAll(c); } } public String getPstatusIcon(){ Publication p = o.getPublication(); if( Dataset.PUBLICATION_OK.equals( p.getStatus())) return "images/okblue.png"; else if( Dataset.PUBLICATION_FAILED.equals( p.getStatus())) return "images/problem.png"; else if( Dataset.PUBLICATION_RUNNING.equals( p.getStatus())) return "images/loader.gif"; return "images/spacer.gif"; } public String getPstatus(){ String result = getO().getPublication().getStatus(); return result; } public void setAction(String action){ this.action=action; } public int getStartImport() { return startImport; } public void setStartImport( int startImport ) { this.startImport = startImport; } public int getMaxImports() { return maxImports; } public void setMaxImports(int maxImports) { this.maxImports = maxImports; } public long getOrgId() { return orgId; } public void setOrgId(long orgId) { this.orgId = orgId; this.o=DB.getOrganizationDAO().findById(orgId, false); } public long getUserId() { return userId; } public void setUserId(long userId) { this.userId = userId; this.u=DB.getUserDAO().findById(userId, false); } public User getU(){ return this.u; } public Organization getO(){ return this.o; } public List<Import> getImports() { List<Import> result = new ArrayList<Import>(); if(this.getUserId()!=-1){ result=getUserImports(); } else if(this.labels!=null && this.labels.length()>0 && (!this.labels.equalsIgnoreCase("null"))){ result=getLabelImports(); } else{result=getAllImports();} return result; } public List<Import> getUserImports() { Organization org = null; User u=null; List<Import> result = new ArrayList<Import>(); u = DB.getUserDAO().findById(userId, false); org = DB.getOrganizationDAO().findById(orgId, false); List<Dataset> du= DB.getDatasetDAO().findNonDerivedByOrganizationUser(org, u); //log.debug("du size:"+du.size()+" for user:"+ u.getLogin()+" and org:"+ org.getName()); if( du == null ) return Collections.emptyList(); //log.debug("startImport:"+startImport+" maxImports:"+maxImports); List<Dataset> l = du; if(startImport<0)startImport=0; while(du.size()<=startImport){ startImport=startImport-maxImports; } if(du.size()>(startImport+maxImports)){ l = du.subList((int)(startImport), startImport+maxImports);} else{ l = du.subList((int)(startImport),du.size());} for( Dataset x: l ) { Import su = new Import(x); result.add(su); } return result; } public List<Import> getLabelImports() { Organization org = null; List<Import> result = new ArrayList<Import>(); org = DB.getOrganizationDAO().findById(orgId, false); List<Dataset> du= DB.getDatasetDAO().findNonDerivedByOrganizationFolders(org, this.labels.split(",")); if( du == null ) return Collections.emptyList(); List<Dataset> l = du; if(startImport<0)startImport=0; while(du.size()<=startImport){ startImport=startImport-maxImports; } if(du.size()>(startImport+maxImports)){ l = du.subList((int)(startImport), startImport+maxImports);} else{ l = du.subList((int)(startImport),du.size());} for( Dataset x: l ) { Import su = new Import(x); result.add(su); } return result; } public List<Import> getAllImports() { try{ Organization org = null; User u=null; List<Import> result = new ArrayList<Import>(); u = DB.getUserDAO().findById(userId, false); org = DB.getOrganizationDAO().findById(orgId, false); List<Dataset> du= DB.getDatasetDAO().findNonDerivedByOrganization(org); //log.debug("du size:"+du.size()+" for user:"+ u.getLogin()+" and org:"+ org.getName()); if( du == null ) return Collections.emptyList(); //log.debug("startImport:"+startImport+" maxImports:"+maxImports); List<Dataset> l = du; if(startImport<0)startImport=0; while(du.size()<=startImport){ startImport=startImport-maxImports; } if(du.size()>(startImport+maxImports)){ l = du.subList((int)(startImport), startImport+maxImports);} else if(startImport>=0){ l = du.subList((int)(startImport),du.size());} for( Dataset x: l ) { Import su = new Import(x); result.add(su); } return result; }catch (Exception ex){ log.error(ex.getMessage(), ex ); return Collections.EMPTY_LIST; } } public int getImportCount() { int result=0; Organization org = null; org = DB.getOrganizationDAO().findById(orgId, false); if(this.userId==-1 && (this.labels==null || this.labels.length()==0 || (this.labels.equalsIgnoreCase("null")))){ List<User> uploaders=DB.getDataUploadDAO().getUploaders(org); for( User cu:uploaders){ List<Dataset> du= DB.getDatasetDAO().findNonDerivedByOrganizationUser(org, cu); result+=du.size(); } } else if(this.labels!=null && this.labels.length()>0 && (!this.labels.equalsIgnoreCase("null"))){ if( org == null) return 0; result=DB.getDatasetDAO().findNonDerivedByOrganizationFolders(org, this.labels.split(",")).size(); } else{ User u=null; u = DB.getUserDAO().findById(userId, false); if( org == null || u==null ) return 0; result=DB.getDatasetDAO().findNonDerivedByOrganizationUser(org, u).size(); } return result; } }
[ "georgios.markakis@kb.nl" ]
georgios.markakis@kb.nl
6110e8300536c1d4c8e29e983795330064ce0e3d
c233b2aefb56a7a9a0d3e791f6674025fa8f88bb
/src/main/java/com/example/demo/CustomannotationApplication.java
d29e00b1516854b96c083aebf99a7d25c14e027d
[]
no_license
vijaysrj/customannotation
f288b4b3f5b3becd337ab95448a24955d4beae1a
4fa2f2d55f377e31625d9daabb94dcd0f7d87141
refs/heads/master
2023-06-03T06:45:15.498785
2021-06-15T11:24:29
2021-06-15T11:24:29
377,137,609
2
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CustomannotationApplication { public static void main(String[] args) { SpringApplication.run(CustomannotationApplication.class, args); } }
[ "vijay.srj@gmail.com" ]
vijay.srj@gmail.com
06b91cc4b1542942b3c1bfdcaa0e713f22dcd2b6
243c0a92d79f2669c1f1cdba086ddc5144c46408
/protege-editor-owl/src/main/java/org/protege/editor/owl/client/event/CommitOperationEvent.java
f610f30cb5232a966b1c62a09faebf5e4bf84482
[ "BSD-2-Clause" ]
permissive
NCIEVS/protege
eb6d4cfbd189c58ffc573727421ce13b140e0871
b8700c7d46d12bbd19a3610120c2ba480bac3837
refs/heads/master
2023-08-31T18:21:21.765580
2023-07-18T09:52:30
2023-07-18T09:52:30
97,023,240
0
2
null
2018-08-28T17:36:01
2017-07-12T15:23:54
Java
UTF-8
Java
false
false
1,340
java
package org.protege.editor.owl.client.event; import java.util.Collections; import java.util.List; import org.protege.editor.owl.server.versioning.api.DocumentRevision; import org.protege.editor.owl.server.versioning.api.RevisionMetadata; import org.semanticweb.owlapi.model.OWLOntologyChange; /** * @author Josef Hardi <johardi@stanford.edu> <br> * Stanford Center for Biomedical Informatics Research */ public class CommitOperationEvent { private final DocumentRevision revision; private final RevisionMetadata metadata; private final List<OWLOntologyChange> changes; public CommitOperationEvent(DocumentRevision revision, RevisionMetadata metadata, List<OWLOntologyChange> changes) { this.revision = revision; this.metadata = metadata; this.changes = changes; } /** * Get the revision number assigned for the commit */ public DocumentRevision getCommitRevision() { return revision; } /** * Get the metadata about the commit (e.g., commiter name, email, comment) */ public RevisionMetadata getCommitMetadata() { return metadata; } /** * Get the list of changes associated with the commit. */ public List<OWLOntologyChange> getCommitChanges() { return Collections.unmodifiableList(changes); } }
[ "yinghua_1@yahoo.com" ]
yinghua_1@yahoo.com
4dfeac0ea0e39a5f99ee3c334de0a473654e15de
344d317984689d552463cd6e8f62171ba20aace7
/src/main/java/com/robobank/exceptions/StatementContollerAdvice.java
98cd85eb23f94a1e573bc6bdef8a6222737b9ace
[]
no_license
LuckyGupta01/Project_POC
9f0d493617553979c41d55a16496ff018ca9d376
6cb40e03ef6ab2d1d7262a3f86b14d16b1d6ab80
refs/heads/master
2020-09-21T04:28:07.652164
2019-11-27T17:08:06
2019-11-27T17:08:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,673
java
package com.robobank.exceptions; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @ControllerAdvice public class StatementContollerAdvice extends ResponseEntityExceptionHandler { @ExceptionHandler(InvalidDataException.class) ResponseEntity<Object> handleInvalidData(InvalidDataException exception, WebRequest request) { HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON); return handleExceptionInternal(exception, "Invalid Data", header, HttpStatus.BAD_REQUEST, request); } @ExceptionHandler(InvalidFileFormatException.class) ResponseEntity<Object> handleInvalidFileFormat(InvalidFileFormatException exception, WebRequest request) { HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON); return handleExceptionInternal(exception, "Invalid File Format", header, HttpStatus.BAD_REQUEST, request); } @ExceptionHandler(CustomerStatementException.class) ResponseEntity<Object> handleStatementData(CustomerStatementException exception, WebRequest request) { HttpHeaders header = new HttpHeaders(); header.setContentType(MediaType.APPLICATION_JSON); return handleExceptionInternal(exception, "Invalid Statements", header, HttpStatus.BAD_REQUEST, request); } }
[ "suraj.gupta2@cognizant.com" ]
suraj.gupta2@cognizant.com
faf70a6de22a29065c6093a8709715e66a7b5429
295f298c18bac4624f444efd5a7652272609a9f6
/src/main/java/se/lexicon/elmira/jpaassignmentrecipedatabase/entity/Ingredient.java
cfcbe68c6f455e8dd365fbffe4610641585ce3a3
[]
no_license
EELMMAD/jpa-assignment-recipe-database
0f27ad2f3fe592c5fd58d4cd6490e9551cbbbb80
b8292e55c9139e7036c7b221859fbb0212eadff6
refs/heads/master
2022-12-03T18:01:33.728207
2020-08-24T06:47:56
2020-08-24T06:47:56
289,095,904
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package se.lexicon.elmira.jpaassignmentrecipedatabase.entity; import java.util.Objects; public class Ingredient { private int id; private String name; public Ingredient() { } public Ingredient(String ingredient) { setName(ingredient); } public int getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Ingredient that = (Ingredient) o; return getId() == that.getId() && Objects.equals(getName(), that.getName()); } @Override public int hashCode() { return Objects.hash(getId(), getName()); } @Override public String toString() { return "Ingredient{" + "id=" + id + ", name='" + name + '\'' + '}'; } }
[ "elmiramadadi@gmail.com" ]
elmiramadadi@gmail.com
777e912985f8612d3823ae90048a4ca200d04ed4
00893596e0d1635fce13c654e9bad3b9db90a3ab
/Assignment3/src/com/example/assignment3/MyRenderer.java
5684e46a237935a9d4fe13f537b397edf364e56c
[]
no_license
jclui/iat381_assignment3
8a833a73518e489fb48e13adca7c371daec7239c
39063b1d571734a7c993511aa43763501360a03e
refs/heads/master
2020-12-24T16:14:43.252958
2013-07-21T01:38:07
2013-07-21T01:38:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,332
java
package com.example.assignment3; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.opengles.GL10; import android.content.Context; import android.opengl.GLES10; import android.opengl.GLSurfaceView; import android.opengl.GLU; public class MyRenderer implements GLSurfaceView.Renderer { Context context; private Pyramid pyramid = new Pyramid(); private Cube cube = new Cube(); private Rect rect = new Rect(); private static float anglePyramid = 0; // Rotational angle in degree for pyramid private static float angleCube = 0; // Rotational angle in degree for cube private static float speedPyramid = 2.0f; // Rotational speed for pyramid private static float speedCube = -1.5f; // Rotational speed for cube public static float mAngleX; public static float mAngleY; public static boolean renderPyramid = false; public static boolean renderCube = false; @Override // Called when the surface is first created or recreated. public void onSurfaceCreated(GL10 gl, EGLConfig config) { // Set the background frame color gl.glClearColor(0.5f, 0.5f, 0.5f, 1.0f); // Set depth's clear-value gl.glClearDepthf(1.0f); // Enables depth-buffer for hidden surface removal gl.glEnable(GL10.GL_DEPTH_TEST); // The type of depth testing gl.glDepthFunc(GL10.GL_LEQUAL); // Perspective view gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); // Enable smooth color shading gl.glShadeModel(GL10.GL_SMOOTH); // Disables Dither gl.glDisable(GL10.GL_DITHER); } @Override // Called to draw the current frame public void onDrawFrame(GL10 gl) { // Redraw background color gl.glClear(GLES10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); if (renderPyramid == true) { // ----- Render the Pyramid ----- gl.glLoadIdentity(); // Reset the model-view matrix gl.glTranslatef(-3.5f, 0.0f, -8.0f); // Translate left and into the screen //gl.glRotatef(anglePyramid, 0.1f, 1.0f, -0.1f); // Rotate (NEW) gl.glRotatef(mAngleX, 0, 1, 0); gl.glRotatef(mAngleY, 1, 0, 0); pyramid.draw(gl); // Draw the pyramid (NEW) } if (renderCube == true) { // ----- Render the Color Cube ----- gl.glLoadIdentity(); // Reset the model-view matrix gl.glTranslatef(0.0f, 0.0f, -8.0f); // Translate right and into the screen gl.glScalef(0.8f, 0.8f, 0.8f); // Scale down (NEW) //gl.glRotatef(angleCube, 1.0f, 1.0f, 1.0f); // rotate about the axis (1,1,1) (NEW) gl.glRotatef(mAngleX, 0, 1, 0); gl.glRotatef(mAngleY, 1, 0, 0); cube.draw(gl); // Draw the cube (NEW) } // ----- Render the Color Cube ----- gl.glLoadIdentity(); // Reset the model-view matrix gl.glTranslatef(3.5f, 0.0f, -8.0f); // Translate right and into the screen gl.glScalef(0.8f, 0.8f, 0.8f); // Scale down (NEW) //gl.glRotatef(angleCube, 1.0f, 1.0f, 1.0f); // rotate about the axis (1,1,1) (NEW) gl.glRotatef(mAngleX, 0, 1, 0); gl.glRotatef(mAngleY, 1, 0, 0); rect.draw(gl); // Draw the cube (NEW) // Update the rotational angle after each refresh (NEW) anglePyramid += speedPyramid; // (NEW) angleCube += speedCube; // (NEW) } @Override // Called when the surface is first displayed and after window's size changes. // Used to set the view port and projection mode. public void onSurfaceChanged(GL10 gl, int width, int height) { if (height == 0) height = 1; // To prevent divide by zero float aspect = (float)width / height; // Set the viewport (display area) to cover the entire window gl.glViewport(0, 0, width, height); // Setup perspective projection, with aspect ratio matches viewport gl.glMatrixMode(GL10.GL_PROJECTION); // Select projection matrix gl.glLoadIdentity(); // Reset projection matrix // Use perspective projection GLU.gluPerspective(gl, 45, aspect, 0.1f, 100.f); gl.glMatrixMode(GL10.GL_MODELVIEW); // Select model-view matrix gl.glLoadIdentity(); // Reset } }
[ "jcl42@sfu.ca" ]
jcl42@sfu.ca
b57c20b9c41f4aa555bdff4b7396c3088d4a3a6d
cad699854ba71a736843c62f9eb8d0c6457c39fc
/nfc_st/src/main/java/example/ldgd/com/checknfc/generic/SlidingTabStrip2.java
7a70cfa9cf62f5a1785044e9f06c526d467eeb8d
[]
no_license
zhangsan2016/NFC_ST
efe1802fdff6fdf2e2fcb43f10018cdc9b46559a
5ede9b0414dce5104b3a8edd87aa67e4891fcf35
refs/heads/master
2020-05-23T11:20:49.276388
2019-05-15T02:34:22
2019-05-15T02:34:22
186,734,650
0
0
null
null
null
null
UTF-8
Java
false
false
8,946
java
package example.ldgd.com.checknfc.generic; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.util.TypedValue; import android.view.View; import android.widget.LinearLayout; /** * Created by ldgd on 2019/3/15. * 功能: * 说明: */ public class SlidingTabStrip2 extends LinearLayout { //选项卡底部下划线的高度常量,高度不要超过下划线高度,不然会覆盖 private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 6; //选项卡底部长线的默认颜色透明度 private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; //选项卡指示下划线的高度常量 private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 6; // private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF1899A2; private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20; private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f; //底部下划线 private final int mBottomBorderThickness; private final Paint mBottomBorderPaint; //指示下划线高度 private final int mSelectedIndicatorThickness; private final Paint mSelectedIndicatorPaint; private final int mDefaultBottomBorderColor; private final Paint mDividerPaint; // private final float mDividerHeight; private int mSelectedPosition; private float mSelectionOffset; private SlidingTabLayout.TabColorizer mCustomTabColorizer; private final SimpleTabColorizer mDefaultTabColorizer; public SlidingTabStrip2(Context context) { this(context, null); } SlidingTabStrip2(Context context, AttributeSet attrs) { super(context, attrs); setWillNotDraw(false); // 获取手机屏幕参数,density就是屏幕的密度 final float density = getResources().getDisplayMetrics().density; // 这个类是工具类,作为一个动态容器,它存放一些数据值,这些值主要是resource中的值。 TypedValue outValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorBackground, outValue, true); final int themeForegroundColor = outValue.data; mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA); mDefaultTabColorizer = new SimpleTabColorizer(); mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR); mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor, DEFAULT_DIVIDER_COLOR_ALPHA)); // mDefaultTabColorizer.setDividerColors(getResources().getColor(R.color.indicatorColors), DEFAULT_DIVIDER_COLOR_ALPHA); mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density); mBottomBorderPaint = new Paint(); // mBottomBorderPaint.setColor( setColorAlpha(R.color.light_blue, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA)); mBottomBorderPaint.setColor(Color.argb(230, 175, 200, 201)); // mBottomBorderPaint.setColor(mDefaultBottomBorderColor); //mBottomBorderPaint.setColor(getResources().getColor(R.color.indicatorColors)); // mBottomBorderPaint.setColor(mDefaultBottomBorderColor); mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density); mSelectedIndicatorPaint = new Paint(); // mDividerHeight = DEFAULT_DIVIDER_HEIGHT; mDividerPaint = new Paint(); mDividerPaint.setStrokeWidth((int) (DEFAULT_DIVIDER_THICKNESS_DIPS * density)); } public void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) { mCustomTabColorizer = customTabColorizer; invalidate(); } public void setSelectedIndicatorColors(int... colors) { // Make sure that the custom colorizer is removed mCustomTabColorizer = null; mDefaultTabColorizer.setIndicatorColors(colors); invalidate(); } public void setDividerColors(int... colors) { // Make sure that the custom colorizer is removed mCustomTabColorizer = null; mDefaultTabColorizer.setDividerColors(colors); invalidate(); } public void onViewPagerPageChanged(int position, float positionOffset) { mSelectedPosition = position; mSelectionOffset = positionOffset; invalidate(); } @Override protected void onDraw(Canvas canvas) { final int height = getHeight(); final int childCount = getChildCount(); // final int dividerHeightPx = (int) (Math.min(Math.max(0f, mDividerHeight), 1f) * height); final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null ? mCustomTabColorizer : mDefaultTabColorizer; // Thick colored underline below the current selection if (childCount > 0) { View selectedTitle = getChildAt(mSelectedPosition); int left = selectedTitle.getLeft(); int right = selectedTitle.getRight(); int selectedWidth = selectedTitle.getWidth() / 3 - 30; int color = tabColorizer.getIndicatorColor(mSelectedPosition); // Thin underline along the entire bottom edge 底部线条 // mBottomBorderPaint.setColor( setColorAlpha(Color.RED, DEFAULT_BOTTOM_BORDER_COLOR_ALPHA)); canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint); if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) { int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1); if (color != nextColor) { color = blendColors(nextColor, color, mSelectionOffset); } // Draw the selection partway between the tabs View nextTitle = getChildAt(mSelectedPosition + 1); left = (int) (mSelectionOffset * nextTitle.getLeft() + (1.0f - mSelectionOffset) * left); right = (int) (mSelectionOffset * nextTitle.getRight() + (1.0f - mSelectionOffset) * right); } mSelectedIndicatorPaint.setColor(color); /* canvas.drawRect(left + selectedWidth, height - mSelectedIndicatorThickness, right - selectedWidth, height, mSelectedIndicatorPaint);*/ canvas.drawRect(left, 0 , right, height,mBottomBorderPaint); canvas.drawRect(left , height - mSelectedIndicatorThickness, right , height, mSelectedIndicatorPaint); } // Vertical separators between the titles //设置分割线 /* int separatorTop = (height - dividerHeightPx) / 2; for (int i = 0; i < childCount - 1; i++) { View child = getChildAt(i); mDividerPaint.setColor(tabColorizer.getDividerColor(i)); canvas.drawLine(child.getRight(), separatorTop, child.getRight(), separatorTop + dividerHeightPx, mDividerPaint); }*/ } /** * Set the alpha value of the {@code color} to be the given {@code alpha} value. */ private static int setColorAlpha(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); } /** * Blend {@code color1} and {@code color2} using the given ratio. * * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend, * 0.0 will return {@code color2}. */ private static int blendColors(int color1, int color2, float ratio) { final float inverseRation = 1f - ratio; float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation); float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation); float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation); return Color.rgb((int) r, (int) g, (int) b); } private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer { private int[] mIndicatorColors; private int[] mDividerColors; @Override public final int getIndicatorColor(int position) { return mIndicatorColors[position % mIndicatorColors.length]; } @Override public final int getDividerColor(int position) { return mDividerColors[position % mDividerColors.length]; } public void setIndicatorColors(int... colors) { mIndicatorColors = colors; } public void setDividerColors(int... colors) { mDividerColors = colors; } } }
[ "602694077@qq.com" ]
602694077@qq.com
4feb4a3930498b56f1efc1ebab5a03aa8638aa13
2aeb7242b9d7c6b2dc8b714f79a16fa2ec3579e1
/src/main/java/com/tech/dao/UserDao.java
f3b87a40d78d880062a834f40765b3ae8cd94518
[]
no_license
Paun990/TechLogin
18b3fdfd31d3fe92d22d941e6b29f5a87f140728
e33ec58420e3557f7dbbe28966f66f832e16854d
refs/heads/master
2020-09-21T04:37:13.478019
2016-08-23T07:07:08
2016-08-23T07:07:08
66,281,436
0
0
null
null
null
null
UTF-8
Java
false
false
397
java
package com.tech.dao; import java.util.List; import com.tech.entity.User; public interface UserDao { public static final String SPRING_QUALIFIER = "userDao"; public List<User> getUsers(); public User getUserById(int id); public void addUser(User user); public void updateUser(User user); public void deleteUser(int id); public List<User> filterUser(String sort, String filter); }
[ "m.paunovic@dyntechdoo.com" ]
m.paunovic@dyntechdoo.com
9486bfd1dc72f1d220ea22b774aca0527eaed798
1df90070ca003eaa925bcd71dd1a67536a954d6d
/app/src/main/java/com/qrcode/app/zxing/camera/FlashlightManager.java
054b79c870402ee65b7addaf9c0e0c3dc2e064bb
[]
no_license
Jliuzzt/GpsCheckGas
e88327ef98f11028991bf86e703027ae90bf8073
5a88cc577a76138041e7c4603f0ea2c86d8b5013
refs/heads/master
2021-01-24T18:04:45.782913
2017-04-11T14:38:31
2017-04-11T14:38:31
84,387,235
0
0
null
null
null
null
UTF-8
Java
false
false
4,870
java
/* * Copyright (C) 2010 ZXing 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 com.qrcode.app.zxing.camera; import android.os.IBinder; import android.util.Log; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * This class is used to activate the weak light on some camera phones (not flash) * in order to illuminate surfaces for scanning. There is no official way to do this, * but, classes which allow access to this function still exist on some devices. * This therefore proceeds through a great deal of reflection. * * See <a href="http://almondmendoza.com/2009/01/05/changing-the-screen-brightness-programatically/"> * http://almondmendoza.com/2009/01/05/changing-the-screen-brightness-programatically/</a> and * <a href="http://code.google.com/p/droidled/source/browse/trunk/src/com/droidled/demo/DroidLED.java"> * http://code.google.com/p/droidled/source/browse/trunk/src/com/droidled/demo/DroidLED.java</a>. * Thanks to Ryan Alford for pointing out the availability of this class. */ final class FlashlightManager { private static final String TAG = FlashlightManager.class.getSimpleName(); private static final Object iHardwareService; private static final Method setFlashEnabledMethod; static { iHardwareService = getHardwareService(); setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService); if (iHardwareService == null) { Log.v(TAG, "This device does supports control of a flashlight"); } else { Log.v(TAG, "This device does not support control of a flashlight"); } } private FlashlightManager() { } /** * Control camera flash switch */ //FIXME static void enableFlashlight() { setFlashlight(false); } static void disableFlashlight() { setFlashlight(false); } private static Object getHardwareService() { Class<?> serviceManagerClass = maybeForName("android.os.ServiceManager"); if (serviceManagerClass == null) { return null; } Method getServiceMethod = maybeGetMethod(serviceManagerClass, "getService", String.class); if (getServiceMethod == null) { return null; } Object hardwareService = invoke(getServiceMethod, null, "hardware"); if (hardwareService == null) { return null; } Class<?> iHardwareServiceStubClass = maybeForName("android.os.IHardwareService$Stub"); if (iHardwareServiceStubClass == null) { return null; } Method asInterfaceMethod = maybeGetMethod(iHardwareServiceStubClass, "asInterface", IBinder.class); if (asInterfaceMethod == null) { return null; } return invoke(asInterfaceMethod, null, hardwareService); } private static Method getSetFlashEnabledMethod(Object iHardwareService) { if (iHardwareService == null) { return null; } Class<?> proxyClass = iHardwareService.getClass(); return maybeGetMethod(proxyClass, "setFlashlightEnabled", boolean.class); } private static Class<?> maybeForName(String name) { try { return Class.forName(name); } catch (ClassNotFoundException cnfe) { // OK return null; } catch (RuntimeException re) { Log.w(TAG, "Unexpected error while finding class " + name, re); return null; } } private static Method maybeGetMethod(Class<?> clazz, String name, Class<?>... argClasses) { try { return clazz.getMethod(name, argClasses); } catch (NoSuchMethodException nsme) { // OK return null; } catch (RuntimeException re) { Log.w(TAG, "Unexpected error while finding method " + name, re); return null; } } private static Object invoke(Method method, Object instance, Object... args) { try { return method.invoke(instance, args); } catch (IllegalAccessException e) { Log.w(TAG, "Unexpected error while invoking " + method, e); return null; } catch (InvocationTargetException e) { Log.w(TAG, "Unexpected error while invoking " + method, e.getCause()); return null; } catch (RuntimeException re) { Log.w(TAG, "Unexpected error while invoking " + method, re); return null; } } private static void setFlashlight(boolean active) { if (iHardwareService != null) { invoke(setFlashEnabledMethod, iHardwareService, active); } } }
[ "553446164@qq.com" ]
553446164@qq.com
6497cbf5363113cb6c48bf464203f870fce30a00
5cd9f54b9b4d1ece816d28c7193398621eed51a9
/impl/src/test/java/org/jboss/seam/solder/test/compat/visibility/AnnotatedTypeObserverExtension.java
43092aaf383c219aa616a16e22648451e1f8995f
[]
no_license
aslakknutsen/solder
ec9c8ef761912fe1a7e9c3dd73a047395bde9e22
76ebfc19be3fefa62b01e750269265145984e7f8
refs/heads/master
2021-01-16T20:45:35.559258
2011-03-24T23:03:35
2011-03-24T23:03:35
1,525,445
0
0
null
null
null
null
UTF-8
Java
false
false
1,499
java
/* * JBoss, Home of Professional Open Source * Copyright 2011, Red Hat, Inc. and/or its affiliates, and individual * contributors by the @authors tag. See the copyright.txt in the * distribution for a full listing of individual contributors. * * 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.jboss.seam.solder.test.compat.visibility; import java.util.ArrayList; import java.util.List; import javax.enterprise.event.Observes; import javax.enterprise.inject.spi.Extension; import javax.enterprise.inject.spi.ProcessAnnotatedType; public class AnnotatedTypeObserverExtension implements Extension { private List<Class<?>> observed; public AnnotatedTypeObserverExtension() { observed = new ArrayList<Class<?>>(); } public <X> void processAnnotatedType(@Observes ProcessAnnotatedType<X> event) { observed.add(event.getAnnotatedType().getJavaClass()); } public boolean observed(Class<?> c) { return observed.contains(c); } }
[ "dan.j.allen@gmail.com" ]
dan.j.allen@gmail.com
7da0717830c61550c3ac44bf79cb02a2a7cf3c0a
796a60c90586fcb44485043191a488b17cc28883
/src/main/java/book/dhsjms/wish/designmodel/_05prototype/TestPrototype.java
a89521a9d2d531ad961465ca8e176a925194b263
[]
no_license
jnjeG/java-examples
8f565a4a654ec55747166b16769dfa4811076100
0bf5b3bbed99ab0c186f425afef1ac2fc48a5906
refs/heads/master
2021-01-21T04:47:28.873913
2016-07-15T02:05:04
2016-07-15T02:05:04
53,187,352
0
0
null
null
null
null
UTF-8
Java
false
false
610
java
package book.dhsjms.wish.designmodel._05prototype; /** * 原型模式用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。(浅复制和深复制) */ public class TestPrototype { public static void main(String[] args) { Resume a = new Resume("Big"); a.SetPersonalInfo("male", "27"); a.SetWorkExperience("2008-07-25", "Foxconn"); Resume b = (Resume)a.Clone(); b.SetWorkExperience("2012-07-25", "Foxconn"); Resume c = (Resume)a.CloneDeep(); c.SetWorkExperience("2013-11-01", "Foxconn"); a.Display(); b.Display(); c.Display(); } }
[ "qchycjj@126.com" ]
qchycjj@126.com
2926ee5e9962b4e3bffae44041dfb2f03087664e
c65f06ca4f11b8672530301278dc125a425772cd
/java/src/main/java/br/jus/tredf/justicanumeros/util/ParsingXML.java
b838792d5631c33ac6d1756ff71b72775d61d836
[]
no_license
alisonsilva/tredf
186ff059bf51653ae7e476454616bf9492cd8273
cfbd4a6956a89e6b4da541073fd5d86a855742bf
refs/heads/master
2020-03-09T06:20:49.645739
2018-07-27T21:45:20
2018-07-27T21:45:20
128,636,875
0
0
null
null
null
null
UTF-8
Java
false
false
3,421
java
package br.jus.tredf.justicanumeros.util; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.StringWriter; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.commons.lang3.StringUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import br.jus.tredf.justicanumeros.model.envioxml.EnvioProcessoXML; import br.jus.tredf.justicanumeros.model.exception.ParametroException; public class ParsingXML { public static void main(String[] args) throws Exception { ParsingXML parsing = new ParsingXML(); byte[] arqXml = new byte[1024]; InputStream fio = ParsingXML.class.getResourceAsStream("/teste.xml"); StringBuffer strBuff = new StringBuffer(); while((fio.read(arqXml)) > 0) { strBuff.append(arqXml); } List<EnvioProcessoXML> processos = parsing.infoProcesso(strBuff.toString()); } private List<EnvioProcessoXML> infoProcesso(String fullText) throws Exception { if(StringUtils.isEmpty(fullText)) { throw new ParametroException("Xml está vazio", 1); } List<EnvioProcessoXML> processos = new ArrayList<EnvioProcessoXML>(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(new ByteArrayInputStream(fullText.getBytes())); NodeList nList = doc.getElementsByTagName("processo"); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); for(int idx = 0; idx < nList.getLength(); idx++){ EnvioProcessoXML procXml = new EnvioProcessoXML(); Node nNode = nList.item(idx); if(nNode.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element)nNode; DOMSource source = new DOMSource(element); StreamResult result = new StreamResult(new StringWriter()); transformer.transform(source, result); procXml.setClasseProcessual(element.getAttribute("classeProcessual")); procXml.setNumero(element.getAttribute("numero")); procXml.setCodLocalidade(StringUtils.isEmpty(element.getAttribute("codigoLocalidade")) ? 0 : Integer.valueOf(element.getAttribute("codigoLocalidade"))); procXml.setNivelSigilo(StringUtils.isEmpty(element.getAttribute("nivelSigilo")) ? 0 : Integer.valueOf(element.getAttribute("nivelSigilo"))); procXml.setIntervencaoMp(StringUtils.isEmpty(element.getAttribute("intervencaoMP")) ? 0 : Boolean.parseBoolean(element.getAttribute("intervencaoMP")) ? 1 : 0); String dtAjuizamento = element.getAttribute("dataAjuizamento"); if(!StringUtils.isEmpty(dtAjuizamento)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); procXml.setDtAjuizamento(sdf.parse(dtAjuizamento)); } processos.add(procXml); } } return processos; } }
[ "alisonsilva123@gmail.com" ]
alisonsilva123@gmail.com