id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
a79ac37f-7adf-4640-833f-8d640ac27c97 | public void keyReleased(KeyEvent e) {
// si se suelta spacebar, barra se mueve hacia al izquierda
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
dirBarra = 0;
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT) {
dirBarra = 0;
}
} |
01c8d54a-a0c8-4c21-920a-8b6ffbedd2e9 | public void keyPressed(KeyEvent e) {
// si se presiona spacebar, barra se mueve hacia la derecha
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
dirBarra = 1;
}
else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
dirBarra = 2;
}
//si se acaba el juego, se re... |
fe017e3b-f429-42db-b5c7-0df7fe822d0f | public void paint (Graphics graGrafico){
// Inicializan el DoubleBuffer
if (imaImagenApplet == null){
imaImagenApplet = createImage (this.getSize().width,
this.getSize().height);
graGraficaApplet = imaImagenApplet.getGraphics ();
}
... |
565f9773-565b-4600-95b5-fa959b136884 | public void paintAux(Graphics g) {
//se despliegan el score en la esquina superior izq
g.setColor(Color.RED);
g.drawString("Score: " + iScore, 20, 35);
if (entBarra != null && entBloque != null && entProyectil != null && encBloques.size() > 0) {
//Dibuja la imagen de la b... |
a884fe92-584b-490a-8418-34d9d38ad085 | @Override
public void keyTyped(KeyEvent e) {
} |
3c6acf30-454d-490c-a9ab-17a61f4da3f3 | public Entidad(int iX, int iY ,Image imaImagen) {
this.iX = iX;
this.iY = iY;
imiIcono = new ImageIcon(imaImagen);
this.iVelocidad = 1; // default 1 en velocidad
} |
692b401e-d2f7-4e5a-993f-43c24155e740 | public Entidad(int iX, int iY ,ImageIcon icoImagen) {
this.iX = iX;
this.iY = iY;
imiIcono = icoImagen;
this.iVelocidad = 1; // default 1 en velocidad
} |
8d06f8bd-d0e7-4574-82c5-407988eb3d93 | public void setX(int iX) {
this.iX = iX;
} |
a3b12c47-ae6e-4486-94eb-b0f8a187f5cb | public int getX() {
return iX;
} |
661d14c0-c9b8-4407-a7fe-c4d66f62c4a6 | public void setY(int iY) {
this.iY = iY;
} |
2847b2d1-e41c-4845-b1f7-06e80797d37d | public int getY() {
return iY;
} |
964efd15-831e-4230-be36-d48e6fadfc39 | public void setImageIcon(ImageIcon imiIcono) {
this.imiIcono = imiIcono;
} |
596cf3a4-c342-4b9e-ad77-3cd38de53d26 | public ImageIcon getImageIcon() {
return imiIcono;
} |
341ac41a-0526-492f-a68e-4ebd7775dace | public void setImagen(Image imaImagen) {
this.imiIcono = new ImageIcon(imaImagen);
} |
ea7d7a54-3a02-474b-938a-dc20411a5a29 | public Image getImagen() {
return imiIcono.getImage();
} |
abe3feb2-6eb0-4c48-90c0-6c1169c514e6 | public void setVelocidad(int iVelocidad) {
this.iVelocidad = iVelocidad;
} |
8e91dac8-3a1d-4c0c-a95a-5c38954f381a | public int getVelocidad() {
return iVelocidad;
} |
9bc92590-b1f3-438d-964b-68c6c6ad483d | public int getAncho() {
return imiIcono.getIconWidth();
} |
325b25f9-a6ce-4802-be90-98fb2a57062c | public int getAlto() {
return imiIcono.getIconHeight();
} |
c916af72-c551-43c9-a5c6-e0dd7422122f | public void arriba() {
this.setY(this.getY() - iVelocidad);
} |
95a82872-20b3-42b0-b3f2-e52404dc47f8 | public void abajo() {
this.setY(this.getY() + iVelocidad);
} |
3c07340b-438d-4ac0-85de-4e6f2e0af928 | public void derecha() {
this.setX(this.getX() + iVelocidad);
} |
6a3f700e-a12b-4d6b-a4e9-39d76abc5a4b | public void izquierda() {
this.setX(this.getX() - iVelocidad);
} |
4d9f03df-a762-4813-8873-c7affd6b4b19 | public boolean colisiona(Entidad aniParametro) {
// creo un objeto rectangulo a partir de este objeto Entidad
Rectangle recObjeto = new Rectangle(this.getX(),this.getY(),
this.getAncho(), this.getAlto());
// creo un objeto rectangulo a partir del objeto Entidad parametro... |
b9d49392-3a99-4403-9e83-3eecb52209d6 | public boolean colisiona(int iX, int iY) {
// creo un objeto rectangulo a partir de este objeto Personaje
Rectangle recObjeto = new Rectangle(this.getX(),this.getY(),
this.getAncho(), this.getAlto());
// si se colisionan regreso verdadero, sino regreso falso
... |
ab0db59b-0c96-43c6-9c1d-6073ce9b7a0e | public VennDiagram(double[][] centers, double[] diameters, double[] areas, double[] residuals,
String[] circleLabels, String[] residualLabels, double[] colors,
double stress, double stress01, double stress05) {
this.centers = centers;
this.diameters = diamet... |
e6404bf5-98e9-4ba2-a3a9-4ff1f388630d | public VennAnalytic() {
stepsize = .01;
minStress = .000001;
isEqualArea = false;
} |
3ec386c3-85f7-437f-9aea-43b1629b0e5f | public VennDiagram compute(VennData vd) {
String[][] data = vd.data;
double[] areas = vd.areas;
boolean isAreas = vd.isAreas;
if (isAreas)
processAreaData(data, areas);
else
processElementData(data);
computeInitialConfiguration();
scaleDiameters();
scaleConfiguration();
minimizeGlobal();
mi... |
e8d5059e-bb66-4792-9908-6157f00c90f5 | private VennDiagram collectResults() {
double[] colors = new double[nCircles];
for (int j = 0; j < nCircles; j++)
colors[j] = (double) (j + 1) / (nCircles + 1);
double stress01 = 0;
double stress05 = 0;
if (nCircles > 2) {
stress01 = Math.exp(.909 * (nCircles - 6.105)) / (1 + Math.exp(.909 * (nCircles -... |
4d101eaa-6e83-4001-b851-646db38bd6e3 | private void processAreaData(String[][] data, double[] areas) {
HashMap<String, Double> sets = new HashMap<String, Double>();
for (int i = 0; i < data.length; i++) {
String[] s = data[i][0].split("&");
for (int j = 0; j < s.length; j++) {
if (!sets.containsKey(s[j])) {
Double cat = new Double(sets.si... |
a91aa676-8788-49e7-97a5-e4559a4c463d | private void processElementData(String[][] data) {
HashMap<String, Double>[] categories = new HashMap[2];
categories[0] = new HashMap<String, Double>();
categories[1] = new HashMap<String, Double>();
for (int i = 0; i < data.length; i++) {
for (int j = 0; j < 2; j++) {
if (!categories[j].containsKey(data... |
4c0da4f9-88bf-4fb0-b2d1-c970b4472df8 | protected void updateCounts(int[] counts) {
int index = decode(counts);
polyData[index]++;
for (int j = 0; j < counts.length; j++) {
if (counts[j] > 0)
circleData[j]++;
}
nTot++;
} |
30592836-2ebb-4ca7-9072-2c4fdc594bb7 | private char[] encode(int index) {
String s = Integer.toBinaryString(index);
char[] c = s.toCharArray();
int offset = nCircles - c.length;
char[] result = new char[nCircles];
for (int i = 0; i < offset; i++)
result[i] = '0';
System.arraycopy(c, 0, result, offset, c.length);
return result;
} |
0cd1b23b-e738-4477-ac70-8566d0b2f275 | private int decode(int[] subsets) {
String b = "";
for (int j = 0; j < subsets.length; j++) {
if (subsets[j] > 0)
b += '1';
else
b += '0';
}
return Integer.parseInt(b, 2);
} |
8a0f5a9b-f2b7-48a7-8490-7969a431494b | private void calculateAreas() {
totalCount = 0;
int size = 200;
byte[][][] bis = new byte[nCircles][size][size];
double mins = Double.POSITIVE_INFINITY;
double maxs = Double.NEGATIVE_INFINITY;
for (int i = 0; i < nCircles; i++) {
double radius = diameters[i] / 2;
mins = Math.min(centers[i][0] - radius... |
afe9f064-281d-4ec4-932a-9f38e3dff6d7 | private void updatePixels(int[] counts) {
int index = decode(counts);
polyAreas[index]++;
totalCount++;
} |
975c0358-3347-41bc-b34e-b501be91ff07 | public void computeInitialConfiguration() {
double[][] s = computeDistanceMatrix();
if (s == null) {
fixedStart();
return;
}
double[] q = new double[nCircles];
computeScalarProducts(nCircles, s, q);
Eigen.eigenSymmetric(s, s, q);
double rms = Math.sqrt(q[0]) + Math.sqrt(q[1]);
if (Double.isNaN... |
56813e0b-d52f-4a56-bf20-151012432106 | private void fixedStart() {
//System.out.println("Singularity: fixed start based on circles.");
double theta = Math.PI / 2;
double delta = 2 * Math.PI / nCircles;
for (int i = 0; i < nCircles; i++) {
centers[i][0] = .5 + Math.cos(theta);
centers[i][1] = .5 + Math.sin(theta);
theta -= delta;
}
} |
5dda78f3-c0fa-4c85-8470-74c1e3e62f11 | private double[][] computeDistanceMatrix() {
int nIntersections = 0;
double[][] s = new double[nCircles][nCircles];
for (int i = 0; i < nPolygons; i++) {
char[] c = encode(i);
for (int j = 0; j < c.length; j++) {
if (c[j] == '0')
continue;
for (int k = j + 1; k < c.length; k++) {
if (c[k] ... |
da9bb426-0751-4a33-be32-b3631e42c18a | private void computeScalarProducts(int nPoints, double[][] s, double[] q) {
double rms = 0.;
for (int i = 1; i < nPoints; i++) {
for (int j = 0; j < i; j++) {
double dij = s[i][j] * s[i][j];
rms += dij + dij;
q[i] += dij;
q[j] += dij;
}
}
rms = rms / (nPoints * nPoints);
double dsm;
f... |
e94f43a9-f375-4ae7-a0db-2c0343de1625 | private void scaleDiameters() {
diameters = new double[nCircles];
for (int j = 0; j < nCircles; j++)
diameters[j] = 2 * Math.sqrt(circleData[j] / Math.PI / nCircles);
} |
8c8fa4cc-662f-454a-b57e-8be68589426a | private void rescaleDiameters(double[] realDiameters, int iteration) {
if (iteration > 5) {
return;
} else if (iteration == 0) {
double averageDiameter = 0;
for (int j = 0; j < nCircles; j++)
averageDiameter += realDiameters[j];
averageDiameter /= nCircles;
for (int j = 0; j < nCircles; j++)
... |
a2cd1de2-db00-4b78-8f7b-6c6d54a26979 | private void scaleConfiguration() {
double vc = 0;
for (int j = 0; j < 2; j++) {
double mc = 0;
for (int k = 0; k < nCircles; k++)
mc += centers[k][j];
mc /= nCircles;
for (int k = 0; k < nCircles; k++) {
centers[k][j] -= mc;
vc += centers[k][j] * centers[k][j];
}
}
vc = 10. * Math.sq... |
b79bd486-bae5-45f8-ad98-1b85b52ea3ab | private double computeStress() {
/* regression through origin */
calculateAreas();
if (totalCount == 0) {
scaleConfiguration();
calculateAreas();
}
double xx = 0;
double xy = 0;
int n = polyData.length;
double sst = 0;
for (int i = 1; i < n; i++) {
double x = polyData[i];
double y = polyAr... |
098f8db6-085d-4316-8d2d-f00a8827569e | private void minimizeGlobal() {
double[] initialDiameters = new double[nCircles];
System.arraycopy(diameters, 0, initialDiameters, 0, nCircles);
double[][] previousCenters = new double[nCircles][2];
copyCircles(centers, previousCenters);
double lastStress = 1;
for (int iter = 0; iter < 50; iter++) {
res... |
d1c460bb-bc1b-4644-962c-bc545812525e | private void minimizeLocal() {
double[] initialDiameters = new double[nCircles];
System.arraycopy(diameters, 0, initialDiameters, 0, nCircles);
double[][] initialCenters = new double[nCircles][2];
copyCircles(centers, initialCenters);
double[][] previousCenters = new double[nCircles][2];
copyCircles(centers... |
9637893d-58ae-4ae5-ba6c-93f80d612026 | private void moveGlobal() {
double[][] gradients = new double[nCircles][2];
for (int i = 0; i < nPolygons; i++) {
String s = Integer.toBinaryString(i);
char[] c = s.toCharArray();
int offset = nCircles - c.length;
for (int j = 0; j < c.length; j++) {
if (c[j] == '0')
continue;
int jo = j + ... |
17416419-1c51-48bc-b6db-98d10a1802c9 | private void moveLocal() {
double[][] gradients = new double[nCircles][2];
for (int i = 0; i < nCircles; i++) {
centers[i][0] += stepsize;
double xPlus = computeStress();
centers[i][0] -= 2 * stepsize;
double xMinus = computeStress();
centers[i][0] += stepsize;
if (xPlus < xMinus)
gradients[i]... |
1e9f6a31-bec6-4634-90eb-5bcc023f1109 | private void recenter() {
double cx = 0;
double cy = 0;
for (int i = 0; i < nCircles; i++) {
cx += centers[i][0];
cy += centers[i][1];
}
cx = cx / nCircles;
cy = cy / nCircles;
for (int i = 0; i < nCircles; i++) {
centers[i][0] = .5 + centers[i][0] - cx;
centers[i][1] = .5 + centers[i][1] - cy... |
0fa22c6c-3d4b-4af4-8b2b-84803abefe93 | private void copyCircles(double[][] a, double[][] b) {
for (int i = 0; i < nCircles; i++)
System.arraycopy(a[i], 0, b[i], 0, 2);
} |
ca8a8e17-8ea5-4756-b94d-5670d22f1582 | private Eigen() {} |
5f070764-7e10-44c1-8e28-20f7999f7288 | public static void eigenSymmetric(double[][] a, double[][] eigenvectors, double[] eigenvalues) {
// eigenvalues and eigenvectors for dense system (A-lambda*I)x = 0
// returns eigenvectors in columns
double[] e = new double[eigenvalues.length];
Eigen.tred2(a, eigenvectors, eigenvalues, ... |
54389451-5621-4593-a2ea-c383aa8706cc | private static void tred2(double[][] a, double[][] z, double[] d, double[] e) {
/* Tridiagonalization of symmetric matrix.
* This generateMethod is a translation of the Algol procedure tred2(),
* Wilkinson and Reinsch, Handbook for Auto. Comp., Vol II-Linear Algebra, (1971).
... |
685be558-e505-49fb-9799-ad42ba9620c7 | private static int imtql2(double[][] z, double[] d, double[] e) {
/* Implicit QL iterations on tridiagonalized matrix.
* This generateMethod is a translation of the Algol procedure imtql2(),
* Wilkinson and Reinsch, Handbook for Auto. Comp., Vol II-Linear Algebra, (1971).
... |
917ef62f-9537-400c-a307-828925365740 | private static void sort(double[] d, double[][] z) {
int l;
int k;
int j;
int i;
int ip1;
double p;
int ii;
int n = d.length;
/* Sort by eigenvalues (descending) */
for (l = 1; l <= n; l = 3 * l + 1) ;
while (l > 2) {
l = l / 3;... |
0d979c41-de42-4b0a-96bf-fdf22ceeba54 | private Venn() {} |
dcc18ab9-c382-457f-8054-ac67ff022415 | public static void main(String[] argv) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
process();
}
});
} |
ba72ccf5-a870-4a1d-b35a-897750697fb8 | public void run() {
process();
} |
424950df-bf21-4e35-8711-1cad06eb8943 | private static void process() {
String fileName = FilePicker.loadFile();
File file = new File(fileName);
VennData dv = FileReader.getData(file);
VennAnalytic va = new VennAnalytic();
VennDiagram vd = va.compute(dv);
new VennFrame(vd);
} |
a1d524ac-d234-4c0a-b424-4da07e4bd1b6 | public VennFrame(VennDiagram vd) {
Container con = this.getContentPane();
con.setBackground(Color.white);
VennCanvas vc = new VennCanvas(vd);
con.add(vc);
setTitle("Venn/Euler Diagram");
setBounds(0, 0, WIDTH, HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE... |
5828c16b-e3f0-485a-9aff-3abcd1ae0ed4 | public VennCanvas(VennDiagram venn) {
size = 700;
bi = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB);
frc = bi.createGraphics().getFontRenderContext();
size *= .8;
centers = venn.centers;
diameters = venn.diameters;
colors = venn.colors;
label... |
a15a60c1-4a04-4488-a8af-554ae1d9d978 | public void paintComponent(Graphics g) {
Graphics2D g2D = (Graphics2D) bi.getGraphics();
g2D.setColor(Color.WHITE);
g2D.fillRect(0, 0, bi.getHeight(), bi.getWidth());
for (int i = 0; i < centers.length; i++) {
double xi = (centers[i][0] - mins) / (maxs - mins);
do... |
c042b61c-69f7-485e-9eda-d97820b3adb7 | private static Color rainbow(double value, float transparency) {
/* blue to red, approximately by wavelength */
float v = (float) value * 255.f;
float vmin = 0;
float vmax = 255;
float range = vmax - vmin;
if (v < vmin + 0.25f * range)
return new Color(0.f, 4... |
1095a789-1d05-4c94-a5b3-0cd2fe458af5 | public double[] getWidthAndHeight(String s, Graphics2D g2D) {
Font font = g2D.getFont();
Rectangle2D bounds = font.getStringBounds(s, frc);
double[] wh = new double[2];
wh[0] = bounds.getWidth();
wh[1] = .7 * bounds.getHeight();
return wh;
} |
4d0da0e3-bea7-48c0-97ee-573b6f15bdae | public static VennData getData(File fname) {
String[][] data;
double[] areas;
String record;
java.io.BufferedReader fin;
identifySeparator(fname);
nRows = 0;
try {
fin = new java.io.BufferedReader(new java.io.FileReader(fname));
while (fin.... |
35257de0-1f9a-4531-9186-30df216685bb | private static String[][] reformData(String[][] data) {
ArrayList d = new ArrayList(nRows);
for (int i = 0; i < nRows; i++) {
for (int j = 0; j < nCols - 1; j++) {
data[i][j] = data[i][j].trim();
if (data[i][j].equals("1")) {
String[] recor... |
af0fa4bc-6936-4424-a31e-73c284ee6542 | private static boolean isDouble(String s) {
try {
Double.parseDouble(s);
} catch (NumberFormatException ex) {
return false;
}
return true;
} |
4e9b4d47-db7b-4b14-9e98-fa682e07944d | private static void identifySeparator(File fname) {
separators.put(",", new int[2]);
separators.put(";", new int[2]);
separators.put(":", new int[2]);
separators.put("|", new int[2]);
separators.put("\t", new int[2]);
separators.put(" ", new int[2]);
java.io.Buffe... |
253b25ec-38bb-488e-8efa-b27ce5e94758 | private static void countSeparators(String record) {
boolean isUnquoted = true;
for (int i = 0; i < record.length(); i++) {
if (record.charAt(i) == '"')
isUnquoted = !isUnquoted;
if (isUnquoted) {
Object[] keys = separators.keySet().toArray();
... |
58fcf57d-39d1-4999-83d0-1121fb11742d | private static void deleteInvalidSeparators(int n) {
Object[] keys = separators.keySet().toArray();
for (int j = 0; j < keys.length; j++) {
String key = (String) keys[j];
int[] counts = (int[]) separators.get(key);
if (counts[0] == 0 || n > 0 && counts[0] != counts[1]... |
b9ae699f-8a3c-46aa-b2e3-dc2e75822842 | private static String[] split(String record) {
String[] row = new String[nCols];
boolean isUnquoted = true;
int i0 = 0;
int col = 0;
for (int i = 0; i < record.length(); i++) {
if (record.charAt(i) == '"')
isUnquoted = !isUnquoted;
if (isUn... |
751184b9-9479-48f5-ac3e-7d2ac4907afd | private static String trimSpaces(String s) {
return s.trim();
} |
66301cfd-f88d-4e71-badf-5da1fda7598a | private static String trimQuotes(String s) {
if (s.startsWith("\""))
s = s.substring(1, s.length());
if (s.endsWith("\""))
s = s.substring(0, s.length() - 1);
return s;
} |
efab051e-4b31-47fb-9722-1c76289d64e7 | private static String compressBlanks(String record) {
return record.replaceAll(" {2,}", " ").trim();
} |
81469964-91e0-44b4-b835-b28a14b40d3c | public static String loadFile() {
FileDialog fd = new FileDialog(new Frame(), "Open", FileDialog.LOAD);
fd.setLocation(50, 50);
fd.setVisible(true);
return fd.getDirectory() + fd.getFile();
} |
f97ed7e2-9e6f-4bc6-bc7e-0048f5ba0dc0 | public static String saveFile() {
FileDialog fd = new FileDialog(new Frame(), "Save", FileDialog.SAVE);
fd.setLocation(50, 50);
fd.setVisible(true);
return fd.getDirectory() + fd.getFile();
} |
c811107e-557c-4434-b9bc-69d36b9ae90e | public VennData(String[][] data, double[] areas, boolean isAreas) {
this.data = data;
this.areas = areas;
this.isAreas = isAreas;
} |
b4798969-a770-4315-a775-62eafd2ef7aa | public VennData(String[] data, double[] areas) {
this.data = new String[data.length][2];
for (int i = 0; i < data.length; i++) this.data[i][0] = data[i];
this.areas = areas;
this.isAreas = true;
} |
772bb278-c108-45d8-b581-1f299537d296 | public VennData(String[] pair1, String[] pair2) {
this.data = new String[pair1.length][2];
for (int i = 0; i < data.length; i++) {
this.data[i][0] = pair1[i];
this.data[i][1] = pair2[i];
}
this.isAreas = false;
} |
6be53f19-d767-4b89-9adf-3412a7e164e4 | protected Connection getConnection() {
try {
connection = DriverManager.getConnection(DB_URL, "sa", "");
return connection;
} catch (SQLException e) {
throw new RuntimeException(e);
}
} |
3aa75dc8-0860-4239-82e5-38e4ae6b756b | protected void closeResources() {
DbUtils.closeQuietly(rs);
DbUtils.closeQuietly(pst);
DbUtils.closeQuietly(st);
DbUtils.closeQuietly(connection);
} |
5667764f-0d06-42de-a2e6-c773a2949a5c | protected void executeQuery(String queryString) {
try {
st = getConnection().createStatement();
st.executeUpdate(queryString);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
closeResources();
}
} |
f3d8182b-68ec-4bda-86b9-97b7d967d5bd | public void createSchema(String file) {
executeSqlFromFile(getClassPathFile(file));
} |
6b61f970-eba1-42ac-861d-4fa0981477a8 | private String getClassPathFile(String fileName) {
return getClass().getClassLoader().getResource(fileName).getFile();
} |
e9cf7771-e72c-4961-a8de-2be1fc765592 | private void executeSqlFromFile(String sqlFilePath) {
Project project = new Project();
project.init();
SQLExec e = new SQLExec();
e.setProject(project);
e.setTaskType("sql");
e.setTaskName("sql");
e.setSrc(new File(sqlFilePath));
e.setDriver("org.hsqldb.jdbcDriver");
e.setUserid("sa");
e.setPasswor... |
c2b40f66-8cfc-413c-8ab8-bef80a06743c | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String action = request.getParameter("do");
if("insert_data".equals(action)){
try {
new SetupDao().createSchema("example_data.sql");
} catch (Exception e) {
e.printStackTrace();
}
... |
6a3638f4-f4c9-40bf-a4c1-009d79bb8d15 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
} |
4359906c-feee-4ea8-9dd5-6f8e41058846 | public int getId() {
return id;
} |
eac5168c-ab8b-4b8d-ac93-bb6fbad58e8e | public void setId(int id) {
this.id = id;
} |
f6db1a60-cd8d-4bb5-9da8-fcf18eecb51c | public String getNimi() {
return nimi;
} |
54f68864-1688-4f56-90c1-e350e332b167 | public void setNimi(String nimi){
this.nimi = nimi;
} |
8b49fa88-0fe8-4a9a-9cb3-3d183093b503 | public String getKood() {
return kood;
} |
a97716e7-28eb-4bd1-8b4e-dd71906106e5 | public void setKood(String kood) {
this.kood = kood;
} |
22ce81d8-55af-4ccb-af0c-02b69476b5fb | public List<Object> findAllObjects() throws SQLException {
List<Object> objects = new ArrayList<Object>();
try {
st = getConnection().createStatement();
rs = st.executeQuery("SELECT * FROM unit");
while (rs.next()) {
Object object = new Object();
object.setNimi(rs.getString(2));
object.setKoo... |
bda2139f-7872-4607-8926-4c820d97d4e6 | public void deleteRow(String id) throws SQLException {
int row = Integer.parseInt(id);
st = getConnection().createStatement();
rs = st.executeQuery("DELETE FROM unit WHERE id=" + row);
closeResources();
} |
c9cbba57-4ad0-4d91-9536-2a19fb89dbbe | public void clearData() throws SQLException {
st = getConnection().createStatement();
rs = st.executeQuery("TRUNCATE TABLE unit");
closeResources();
} |
7728620f-df83-474e-9ecf-12855f41ebd3 | public List<Object> search(String parameter) throws SQLException {
List<Object> objects = new ArrayList<Object>();
try {
st = getConnection().createStatement();
rs = st.executeQuery("SELECT * FROM unit WHERE UPPER(name) LIKE UPPER('%"
+ parameter + "%')");
while (rs.next()) {
Object object = new ... |
a656a049-9e66-4f59-9c11-39e7e00d6141 | public void addRow(String name, String code) throws SQLException {
st = getConnection().createStatement();
rs = st.executeQuery("INSERT INTO unit VALUES (NEXT VALUE FOR seq1,'"
+ name + "','" + code + "')");
closeResources();
} |
dbb52e98-7594-4a13-b7cd-a6692dcd8e8a | public void contextInitialized(ServletContextEvent arg0) {
try {
new SetupDao().createSchema("schema.sql");
new SetupDao().createSchema("example.sql");
}
catch (Exception e) {
System.out.println(e);
}
} |
fc6c2ac7-227c-4ad4-b251-d42550169cbd | public void contextDestroyed(ServletContextEvent arg0) {
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.