blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 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 684M ⌀ | 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 132
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 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a365c9151bd0df7ce2daa944fd89d1eb297ca89b | 0beb7f97613a0815b7a8de3ce972d9ac802203c0 | /Drawable.java | 816d70fb669f6711737ff5acf883f4962b5f0846 | [] | no_license | pwamsley2015/Leap-Project | 5730ebde66bc6dd1b5ac7c03cf19f4405115ed35 | 20e309b08aafa6d0a1bbf61707e8d6c81bed1ebb | refs/heads/master | 2021-01-13T14:28:00.907910 | 2014-10-21T20:57:28 | 2014-10-21T20:57:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | import java.awt.Graphics;
/**
*
* @author Michael Maunu
*
*/
public interface Drawable {
public void draw(Graphics g);
public int getX();
public int getY();
public int getWidth();
public int getHeight();
}
| [
"pwamsley2015@francisparker.org"
] | pwamsley2015@francisparker.org |
715bd550dfd504a6e2381faced7c1773929735e9 | 81cfc08cbc069be2dd5c94cc199f139ccbd19be8 | /src/main/java/com/lastbubble/nikoli/hashiwokakero/HashiwokakeroSolver.java | 998af92ee55855682ffc58ac397458cf4b9a0919 | [] | no_license | lastbubble/nikoli | 662a31349629661679381d5fd238f5814a51d0f8 | 16025c36f748ce213ed8039f9a62eefe5bd494f6 | refs/heads/master | 2020-03-18T04:59:37.133978 | 2019-12-04T03:47:05 | 2019-12-04T03:47:05 | 134,317,869 | 0 | 0 | null | 2019-12-04T03:47:07 | 2018-05-21T19:50:48 | Java | UTF-8 | Java | false | false | 2,988 | java | package com.lastbubble.nikoli.hashiwokakero;
import static com.lastbubble.nikoli.logic.Formula.*;
import com.lastbubble.nikoli.Cell;
import com.lastbubble.nikoli.Grid;
import com.lastbubble.nikoli.logic.Formula;
import com.lastbubble.nikoli.solver.Solver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class HashiwokakeroSolver extends Solver<Bridge> {
private final Grid<Integer> grid;
public HashiwokakeroSolver(Grid<Integer> grid) {
this.grid = grid;
Set<Bridge> allBridges = allBridges();
Map<Cell, List<Bridge>> bridgesForCell = new HashMap<>();
for (Bridge bridge : allBridges) {
varFor(bridge);
bridgesForCell.computeIfAbsent(bridge.oneEnd(), k -> new ArrayList<>()).add(bridge);
bridgesForCell.computeIfAbsent(bridge.otherEnd(), k -> new ArrayList<>()).add(bridge);
if (bridge.weight() > 1) { add(implies(varFor(bridge), varFor(bridge.withWeight(1)))); }
allBridges.stream()
.filter(x -> bridge.crosses(x))
.forEach(x -> add(implies(varFor(bridge), not(varFor(x)))));
}
grid.filledCells().forEach(cell -> {
addExactly(grid.valueAt(cell).orElse(0), bridgesForCell.getOrDefault(cell, new ArrayList<Bridge>()).stream());
});
}
Set<Bridge> allBridges() {
Set<Bridge> bridges = new HashSet<Bridge>();
grid.filledCells().sorted().forEach(oneEnd -> {
int oneValue = grid.valueAt(oneEnd).orElse(0);
Consumer<? super Cell> addBridges = otherEnd -> {
int otherValue = grid.valueAt(otherEnd).orElse(0);
if (oneValue != 1 || otherValue != 1) {
bridges.add(Bridge.connecting(oneEnd, otherEnd));
}
if (oneValue != 1 && otherValue != 1) {
bridges.add(Bridge.connecting(oneEnd, otherEnd).incrementWeight());
}
};
grid.filledCells()
.filter(c -> oneEnd.y() == c.y() && oneEnd.x() < c.x())
.sorted()
.findFirst()
.ifPresent(addBridges);
grid.filledCells()
.filter(c -> oneEnd.x() == c.x() && oneEnd.y() < c.y())
.sorted()
.findFirst()
.ifPresent(addBridges);
});
return bridges;
}
@Override protected boolean acceptable(Stream<Bridge> solution) {
Set<Bridge> bridges = solution.collect(Collectors.toSet());
List<Set<Bridge>> links = new LinksFinder(bridges.stream()).find();
if (links.size() == 1) { return true; }
for (Set<Bridge> invalidLink : links) {
add(anyOf(invalidLink.stream().map(this::varFor).map(Formula::not)));
}
return false;
}
@Override protected Set<Bridge> canonicalize(Set<Bridge> bridges) {
return bridges.stream()
.filter(x -> !(x.weight() == 1 && bridges.contains(x.withWeight(2))))
.collect(Collectors.toSet());
}
}
| [
"heaton.eric@gmail.com"
] | heaton.eric@gmail.com |
31f7f3c0743fd3a2f5b046057ef7e4e9c01cf58f | aaabffe8bf55973bfb1390cf7635fd00ca8ca945 | /src/main/java/com/microsoft/graph/requests/generated/BaseWorkbookFunctionsNorm_InvRequestBuilder.java | d2859ad21b125be39e7687f3aa1ee8786457c863 | [
"MIT"
] | permissive | rgrebski/msgraph-sdk-java | e595e17db01c44b9c39d74d26cd925b0b0dfe863 | 759d5a81eb5eeda12d3ed1223deeafd108d7b818 | refs/heads/master | 2020-03-20T19:41:06.630857 | 2018-03-16T17:31:43 | 2018-03-16T17:31:43 | 137,648,798 | 0 | 0 | null | 2018-06-17T11:07:06 | 2018-06-17T11:07:05 | null | UTF-8 | Java | false | false | 3,104 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.generated;
import com.microsoft.graph.concurrency.*;
import com.microsoft.graph.core.*;
import com.microsoft.graph.models.extensions.*;
import com.microsoft.graph.models.generated.*;
import com.microsoft.graph.http.*;
import com.microsoft.graph.requests.extensions.*;
import com.microsoft.graph.requests.generated.*;
import com.microsoft.graph.options.*;
import com.microsoft.graph.serializer.*;
import java.util.Arrays;
import java.util.EnumSet;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Base Workbook Functions Norm_Inv Request Builder.
*/
public class BaseWorkbookFunctionsNorm_InvRequestBuilder extends BaseActionRequestBuilder {
/**
* The request builder for this WorkbookFunctionsNorm_Inv
*
* @param requestUrl the request URL
* @param client the service client
* @param requestOptions the options for this request
* @param probability the probability
* @param mean the mean
* @param standardDev the standardDev
*/
public BaseWorkbookFunctionsNorm_InvRequestBuilder(final String requestUrl, final IBaseClient client, final java.util.List<? extends Option> requestOptions, final com.google.gson.JsonElement probability, final com.google.gson.JsonElement mean, final com.google.gson.JsonElement standardDev) {
super(requestUrl, client, requestOptions);
bodyParams.put("probability", probability);
bodyParams.put("mean", mean);
bodyParams.put("standardDev", standardDev);
}
/**
* Creates the IWorkbookFunctionsNorm_InvRequest
*
* @return the IWorkbookFunctionsNorm_InvRequest instance
*/
public IWorkbookFunctionsNorm_InvRequest buildRequest() {
return buildRequest(getOptions());
}
/**
* Creates the IWorkbookFunctionsNorm_InvRequest with specific requestOptions instead of the existing requestOptions
*
* @param requestOptions the options for the request
* @return the IWorkbookFunctionsNorm_InvRequest instance
*/
public IWorkbookFunctionsNorm_InvRequest buildRequest(final java.util.List<? extends Option> requestOptions) {
WorkbookFunctionsNorm_InvRequest request = new WorkbookFunctionsNorm_InvRequest(
getRequestUrl(),
getClient(),
requestOptions
);
if (hasParameter("probability")) {
request.body.probability = getParameter("probability");
}
if (hasParameter("mean")) {
request.body.mean = getParameter("mean");
}
if (hasParameter("standardDev")) {
request.body.standardDev = getParameter("standardDev");
}
return request;
}
}
| [
"caitbal@microsoft.com"
] | caitbal@microsoft.com |
777cb94244d3fffc334e0f01666ba63326ae7885 | 678ca04590085153844262e345491e6e18eef882 | /src/main/java/com/foxconn/fii/data/primary/model/entity/TestStationMetaNbb.java | f2e65cfdc38185a5c522a0e23d759dd0e5c44d30 | [] | no_license | nguyencuongat97/test_system | 1e0bbbc404598b9c17c91b04d12ce3f76de315fb | 6d655a202b1f6571e3022dc1c7cfb8cb7e696fd5 | refs/heads/master | 2023-01-21T03:34:07.174133 | 2020-11-24T04:23:09 | 2020-11-24T04:23:09 | 315,518,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,075 | java | package com.foxconn.fii.data.primary.model.entity;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.util.Date;
@Data
@Entity
@Table(name = "test_station_meta_nbb")
public class TestStationMetaNbb {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "factory")
private String factory;
@Column(name = "customer")
private String customer;
@Column(name = "stage_name")
private String stageName;
@Column(name = "group_name")
private String groupName;
@Column(name = "line_name")
private String lineName;
@Column(name = "station_id")
private String stationId;
@Column(name = "ip_address")
private String ipAddress;
@Column(name = "mac_address")
private String macAddress;
@CreationTimestamp
@Column(name = "created_at")
private Date createdAt;
@UpdateTimestamp
@Column(name = "updated_at")
private Date updatedAt;
}
| [
"Administrator@V0990891-FII.vn.foxconn.com"
] | Administrator@V0990891-FII.vn.foxconn.com |
d7949dc53a5dbeffe18096c2e889868caba813be | f76bab37d6d310fc79c136299c2dfee3d7e8998c | /src/demo13/FirstAnnoImpl.java | 9adf53dbbf5ba848eef56ab42058fcf1b13d8130 | [] | no_license | Jayleonc/myClass | cd39be10fa6a288bbb897da345ad11666a48e626 | 69c47174f993dbdef7f11babf7e18493202b5227 | refs/heads/master | 2022-11-04T14:01:56.765131 | 2020-06-17T01:36:41 | 2020-06-18T04:23:43 | 255,582,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package demo13;
import java.lang.annotation.Annotation;
public class FirstAnnoImpl implements FristAnno{
@Override
public String className() {
return "demo13.demo1";
}
@Override
public String methodName() {
return "eat";
}
@Override
public Class<? extends Annotation> annotationType() {
return null;
}
}
| [
"471511932@qq.com"
] | 471511932@qq.com |
de61abe18c47298e338b02b63a7a0b911a149134 | 1e75a5e2bed9e191d0d563657241cf79f8cacdb0 | /src/main/java/local/jordi/busapplication/shared/messaging/serializer/ISerializer.java | 2e00e9ed6d715a1d83f0292581c75ffabe65bd27 | [] | no_license | Spacegod007/BusApplication | c2185eaf2c9ec5aa4f9c9a18d20b0094fff25460 | 94b507373d58ab5ba4f20525c6a0887782b9af39 | refs/heads/master | 2020-05-03T11:31:49.880135 | 2019-03-31T14:24:25 | 2019-03-31T14:24:25 | 178,603,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package local.jordi.busapplication.shared.messaging.serializer;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.io.IOException;
public interface ISerializer <T> {
String serialize(T t) throws JsonProcessingException;
T deserialize(String serialized) throws IOException;
}
| [
"jordivanroij@live.nl"
] | jordivanroij@live.nl |
8693a02c9ff53a329123e04cf2a624752a7f3ffd | c4fabc1709581cc35d23016cf38fa7d94c643b28 | /common/darkevilmac/utilities/gui/ContainerEnergySolidifier.java | 009044363de8889e4211ddad076cbcfd3c4aca7d | [] | no_license | EndermanParty/Utilities3 | 02d0b17a2c76a1e1e7dfc7c967e45591bbea60da | 358a73281a0b9c67877b8e89c497d69d7d355731 | refs/heads/master | 2021-01-18T17:36:16.106128 | 2014-04-19T00:30:54 | 2014-04-19T00:30:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,022 | java | package darkevilmac.utilities.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import darkevilmac.utilities.tile.TileEntityEnergySolidifier;
public class ContainerEnergySolidifier extends Container {
public TileEntityEnergySolidifier tile;
public ContainerEnergySolidifier(InventoryPlayer invPlayer, TileEntityEnergySolidifier tile) {
this.tile = tile;
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(invPlayer, 9 + x + y * 9, 8 + x * 18, 84 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(invPlayer, x, 8 + x * 18, 142));
}
addSlotToContainer(new Slot(tile, 0, 0, 0));
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return tile.isUseableByPlayer(player);
}
}
| [
"bk1325@gmail.com"
] | bk1325@gmail.com |
76ccf52ef1d159a8beb6784562544b2ddc71bb20 | 736553b16fe4a9c9d52eba96e6e8c5ae0fc6d034 | /customview/src/main/java/com/sjc/customview/MyDrawWidget1.java | f58dac71bc45ae6910168713de80de5b02b80195 | [] | no_license | jiachensun/TestDemo | 9afbb66e2560c93f50685a4ec924dab14928328b | c7b9eb8a9f3200334269a5590666e8b9914d5138 | refs/heads/master | 2022-12-02T14:36:32.860433 | 2020-08-20T10:23:37 | 2020-08-20T10:23:37 | 283,651,311 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,310 | java | package com.sjc.customview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import androidx.annotation.Nullable;
/**
* @Author sjc
* @Date 2020/7/1
* Description:
*/
public class MyDrawWidget1 extends View {
private Bitmap originBitmap;
private BitmapFactory.Options options;
private Matrix mMatrix;
private Rect mSrcRect;
private Rect mDstRect;
private int dstBottom;
public MyDrawWidget1(Context context) {
super(context);
Log.i("MyDrawWidget", "MyDrawWidget(Context context)");
init();
}
public MyDrawWidget1(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
Log.i("MyDrawWidget", "MyDrawWidget(Context context, @Nullable AttributeSet attrs)");
init();
}
private void init() {
originBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.androidhotfix);
mMatrix = new Matrix();
mSrcRect = new Rect(0, 0, 0, 0);
mDstRect = new Rect(0, 0, 0, 0);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Log.i("MyDrawWidget", "onDraw = " + getWidth() + ", " + getHeight());
// Bitmap
float scale = getWidth() / (float) originBitmap.getWidth();
mMatrix.preScale(scale, scale);
float bitHeight = originBitmap.getHeight() * scale;
mDstRect.right = getWidth();
mDstRect.bottom = 200;
canvas.drawBitmap(originBitmap, mSrcRect, mDstRect, null);
}
float lastY = 0;
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
lastY = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
// if (las)
invalidate();
}
return true;
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
return super.dispatchTouchEvent(event);
}
}
| [
"1943844826@qq.com"
] | 1943844826@qq.com |
7795e05b39664e15e5b63d231cfc07a20ebe03b1 | a0de3b5d832e2de4d3288b25588c2429bf982c11 | /INVENTARIO_DOMINIO/src/main/java/es/enaire/inventario/dtos/FamiliaInstalacionDTO.java | d68b348f1e8a549fc583fd80637b8e6e0a69f623 | [] | no_license | josega1983/inventarioETNA | 1ac462fb30e795dbb896ec05ed213b1e640142b7 | 063fe7eea78fce08b721756bb4b82b1defb5b2e5 | refs/heads/master | 2021-05-14T10:53:43.762821 | 2018-01-08T14:49:52 | 2018-01-08T14:49:52 | 116,363,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,987 | java | package es.enaire.inventario.dtos;
import java.io.Serializable;
import java.util.Date;
import es.enaire.inventario.annotations.IdTarget;
/**
* Clase de mapeo con la informacion de familia instalaciones.
*
*/
public class FamiliaInstalacionDTO implements Serializable {
/**
* Indicador de serializacion
*/
private static final long serialVersionUID = -8016867573096305531L;
/**
* El id
*/
@IdTarget
private Long id;
/**
* Nombre
*/
private String nombre;
/**
* Area
*/
private String area;
/**
* Observaciones
*/
private String observaciones;
/**
* Activo
*/
private String activo;
/**
* Fecha de Alta
*/
private Date fechaAlta;
/**
* Fecha de baja
*/
private Date fechaBaja;
/**
* Opciones a mostrar en el estado del menu
*/
private String estadoMenu;
/**
* Obtiene el id
* @return el id
*/
public Long getId() {
return id;
}
/**
* Establece el id
* @param id el id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Obtiene el nombre
* @return el nombre
*/
public String getNombre() {
return nombre;
}
/**
* Establece el nombre
* @param nombre el nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* Obtiene el area
* @return el area
*/
public String getArea() {
return area;
}
/**
* Establece el area
* @param area el area
*/
public void setArea(String area) {
this.area = area;
}
/**
* Obtiene las observaciones
* @return las observaciones
*/
public String getObservaciones() {
return observaciones;
}
/**
* Establece las observaciones
* @param observaciones las observaciones
*/
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
/**
* Obtiene si es activo
* @return si es activo
*/
public String getActivo() {
return activo;
}
/**
* Establece si es activo
* @param activo si es activo
*/
public void setActivo(String activo) {
this.activo = activo;
}
/**
* Obtiene el area
* @return el area
*/
public Date getFechaAlta() {
return fechaAlta;
}
/**
* Establece el area
* @param fechaAlta el area
*/
public void setFechaAlta(Date fechaAlta) {
this.fechaAlta = fechaAlta;
}
/**
* Obtiene la fecha de baja
* @return la fecha de baja
*/
public Date getFechaBaja() {
return fechaBaja;
}
/**
* Establece la fecha de baja
* @param fechaBaja la fecha de baja
*/
public void setFechaBaja(Date fechaBaja) {
this.fechaBaja = fechaBaja;
}
/**
* Obtiene el estado del menu
* @return El estado del menu
*/
public String getEstadoMenu() {
return estadoMenu;
}
/**
* Establece el estado del menu
* @param estadoMenu El estado de menu a establecer
*/
public void setEstadoMenu(String estadoMenu) {
this.estadoMenu = estadoMenu;
}
}
| [
"jgromero@LEAN01JGROMERO.lean.na.nav.es"
] | jgromero@LEAN01JGROMERO.lean.na.nav.es |
26313b4943ad0b25585e2eb83aae56c64f465868 | 1a32d704493deb99d3040646afbd0f6568d2c8e7 | /BOOT-INF/lib/com/google/common/collect/SortedIterables.java | ac908190db1e50d6f6d8c4bb4f74f801ae1c9ea3 | [] | no_license | yanrumei/bullet-zone-server-2.0 | e748ff40f601792405143ec21d3f77aa4d34ce69 | 474c4d1a8172a114986d16e00f5752dc019cdcd2 | refs/heads/master | 2020-05-19T11:16:31.172482 | 2019-03-25T17:38:31 | 2019-03-25T17:38:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | /* */ package com.google.common.collect;
/* */
/* */ import com.google.common.annotations.GwtCompatible;
/* */ import com.google.common.base.Preconditions;
/* */ import java.util.Comparator;
/* */ import java.util.SortedSet;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @GwtCompatible
/* */ final class SortedIterables
/* */ {
/* */ public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements)
/* */ {
/* 37 */ Preconditions.checkNotNull(comparator);
/* 38 */ Preconditions.checkNotNull(elements);
/* */ Comparator<?> comparator2;
/* 40 */ if ((elements instanceof SortedSet)) {
/* 41 */ comparator2 = comparator((SortedSet)elements); } else { Comparator<?> comparator2;
/* 42 */ if ((elements instanceof SortedIterable)) {
/* 43 */ comparator2 = ((SortedIterable)elements).comparator();
/* */ } else
/* 45 */ return false; }
/* */ Comparator<?> comparator2;
/* 47 */ return comparator.equals(comparator2);
/* */ }
/* */
/* */
/* */ public static <E> Comparator<? super E> comparator(SortedSet<E> sortedSet)
/* */ {
/* 53 */ Comparator<? super E> result = sortedSet.comparator();
/* 54 */ if (result == null) {
/* 55 */ result = Ordering.natural();
/* */ }
/* 57 */ return result;
/* */ }
/* */ }
/* Location: C:\Users\ikatwal\Downloads\bullet-zone-server-2.0.jar!\BOOT-INF\lib\guava-22.0.jar!\com\google\common\collect\SortedIterables.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"ishankatwal@gmail.com"
] | ishankatwal@gmail.com |
bfb07f08c0640b2b85a83a942ff65f2c6eaeb8c8 | 22ee41186696f5b3cea30be199053f469f04abe3 | /src/eu/zeigermann/vaadin/demo/forms/customfield/Person.java | 4e126713036daaf11ee021b23d67562056f0cadc | [] | no_license | AussieEngineer/vaadin7-sandbox | 0ffea05b9e225858d06ee92fbb2de227b3c9e484 | 4c6901fc2092cb5d8ba71b6f1186be35e469fd6c | refs/heads/master | 2021-01-18T04:53:30.978125 | 2013-02-28T14:34:52 | 2013-02-28T14:34:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | package eu.zeigermann.vaadin.demo.forms.customfield;
import java.io.Serializable;
import java.util.Date;
public class Person implements Serializable {
private String firstName;
private String lastName;
private Address address;
private String phoneNumber;
private String email;
private Date dateOfBirth;
private String comments;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
} | [
"oliver.zeigermann@gmail.com"
] | oliver.zeigermann@gmail.com |
434a2fb9753c9bdc3abdf25bd59d8b4b4ad24f0b | c40fbc9aaea5ade34f0961e712bd9b364ea45487 | /src/ru/job4j/loop/DegreeLoop.java | 0d0d995cd3637a1171bc4483213243ec0db676a2 | [] | no_license | SileLence/job4j_elementary | 282046e5802965eae79ac5e0246a316517473e41 | dec683761fcdbab462f5f53c7ec277307264c1f3 | refs/heads/master | 2023-05-26T07:52:14.991858 | 2021-06-12T22:05:07 | 2021-06-12T22:05:07 | 364,361,683 | 1 | 0 | null | 2021-05-04T19:16:45 | 2021-05-04T19:16:44 | null | UTF-8 | Java | false | false | 226 | java | package ru.job4j.loop;
public class DegreeLoop {
public static int calculate(int a, int n) {
int result = a;
for (int i = 1; i < n; i++) {
result *= a;
}
return result;
}
}
| [
"smkslnc@gmail.com"
] | smkslnc@gmail.com |
b1e60fc80c3416bf140f85c7532559afef39c4aa | 18059078755f6e97cca5c26e23c1d8611ece6b1c | /app/src/androidTest/java/com/example/android/loonatheapp/ExampleInstrumentedTest.java | 4fd4c054cad4f0d5139357e44ab67d33f8c7edff | [] | no_license | baziyad48/loonatheapp | d526fbdae0366fabb15959a730d5e112f2bdb37f | 18fa88397f5bb494ab9366f44b1a09ca0c39c687 | refs/heads/master | 2020-08-06T05:24:46.685386 | 2019-10-04T15:52:57 | 2019-10-04T15:52:57 | 212,833,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package com.example.android.loonatheapp;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.android.loonatheapp", appContext.getPackageName());
}
}
| [
"huhummamalybaziyad@gmail.com"
] | huhummamalybaziyad@gmail.com |
f26f1322444ac2ed48caa7dfcb159f76df045b2c | 9d6af757d35b83fd1db3d99c0d382a8b7c3a7f9a | /MerlionAirlinesLibrary/src/ejb/session/stateless/FlightSchedulePlanSessionBeanRemote.java | 965f9ae56f781eb67a39ae13dcc3af6ee833850a | [] | no_license | anthonyxavier64/MerlionAirlines | afbc202c1f25825f8d68bbcf5cdc7b0ce92074fa | 0563d1442bf2545da4d59663c0c42210303b74ee | refs/heads/master | 2023-01-13T22:54:39.128963 | 2020-11-15T15:56:08 | 2020-11-15T15:56:08 | 304,269,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 876 | 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 ejb.session.stateless;
import entity.Flight;
import entity.FlightSchedulePlan;
import exception.FlightSchedulesOverlapException;
import java.util.List;
import javax.ejb.Remote;
/**
*
* @author yappeizhen
*/
@Remote
public interface FlightSchedulePlanSessionBeanRemote {
public List<FlightSchedulePlan> viewAllFlightSchedulePlans();
public Long createNewFlightSchedulePlan(FlightSchedulePlan newFsp, Flight flight);
public void addFlightScheduleToFlightSchedulePlan(Long flightSchedulePlanId, Long flightScheduleId) throws FlightSchedulesOverlapException;
public FlightSchedulePlan retrieveFSPById(Long id);
public int deleteFlightSchedulePlan(long fspId);
}
| [
"yappeizhen@u.nus.edu"
] | yappeizhen@u.nus.edu |
0bee70b85228a2b580f03328936d341bb2ebbc47 | c18194776e4ee2d4e5b7d3fe6e4ec5d24b0e1d1d | /net.projecteuler/src/net/projecteuler/problems/Problem0025.java | 40497d681db77c1cba7dd7567b9280cc77c8dc3b | [] | no_license | tdongsi/java | f2a8ea433f2452a50cf2321b94c2446a1b274a17 | 5f1b87ad3509b03e4af5f6cdbd294bf7326d4cc7 | refs/heads/master | 2021-04-22T14:29:16.733296 | 2020-10-17T23:38:56 | 2020-10-17T23:38:56 | 10,755,263 | 0 | 0 | null | 2020-10-17T23:38:57 | 2013-06-18T06:19:32 | Java | UTF-8 | Java | false | false | 919 | java | /**
*
*/
package net.projecteuler.problems;
import java.math.BigInteger;
/**
* What is the first term in the Fibonacci sequence to contain 1000 digits?
*
* @author tdongsi
*
*/
public class Problem0025 {
/**
* @param args
*/
public static void main(String[] args) {
Problem0025 solver = new Problem0025();
int answer = solver.findFibonacci(1000);
System.out.println("Answer is: " + answer );
}
/**
* Find the order number of the first Fibonacci number
* that has the length of the given length limit.
*
* @param lengthLimit
* @return
*/
public int findFibonacci( int lengthLimit )
{
BigInteger f1 = BigInteger.ONE;
BigInteger f2 = BigInteger.ONE;
int termCounter = 2;
while ( f2.toString().length() < lengthLimit )
{
f2 = f2.add(f1);
f1 = f2.subtract(f1);
termCounter++;
}
// System.out.println("Answer is: " + f2 );
return termCounter;
}
}
| [
"dongsi.tuecuong@gmail.com"
] | dongsi.tuecuong@gmail.com |
3c35a061970fc66bc8dd591aa885a0d3f957f1bf | 8237977a3e68acf1e92ed18b543343858aa5b21b | /app/src/main/java/bjx/com/siji/wxapi/WXPayEntryActivity.java | 75f5ac06b1669de0e2fea131ed58806467b2e535 | [] | no_license | richax/bjx.com.siji | bbe0f814d7247c194e8bf9f71defcb9cfef4f7b6 | 1cca172e9fadaffba3ed3d2eefad517482518f2f | refs/heads/master | 2023-03-23T23:29:38.735789 | 2019-04-28T17:57:23 | 2019-04-28T17:57:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,784 | java | package bjx.com.siji.wxapi;
import android.content.Intent;
import android.os.Bundle;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelpay.PayResp;
import com.tencent.mm.opensdk.openapi.IWXAPI;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
import bjx.com.siji.R;
import bjx.com.siji.contants.Constants;
import bjx.com.siji.ui.activity.BaseActivity;
import bjx.com.siji.utils.MD5;
import bjx.com.siji.utils.ToastUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class WXPayEntryActivity extends BaseActivity implements IWXAPIEventHandler {
private IWXAPI api;
@Override
protected void initView(Bundle savedInstanceState) {
setContentView(R.layout.pay_result);
api = WXAPIFactory.createWXAPI(this, Constants.WX_APPID);
api.handleIntent(getIntent(), this);
}
@Override
protected void setListener() {
}
@Override
protected void processLogic(Bundle savedInstanceState) {
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
api.handleIntent(intent, this);
}
@Override
public void onReq(BaseReq req) {
}
@Override
public void onResp(BaseResp resp) {
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
if(resp.errCode == -2) {
ToastUtil.show("取消支付");
} else if(resp.errCode == 0) {
String tradeNo = ((PayResp) resp).extData;
mEngine.reqPayQueryForWX(userModel.getSj_id(), tradeNo, MD5.getMessageDigest((userModel.getSj_id() + Constants.BASE_KEY + tradeNo).getBytes())).enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
try {
String str = response.body().string();
JSONObject jo = new JSONObject(str);
int status = jo.getInt("status");
String msg = jo.getString("msg");
if (status == 200) {
ToastUtil.show("支付成功");
} else if (status == 500 || status == 501) {
ToastUtil.show("订单支付失败");
} else if (status == 502) {
ToastUtil.show("订单异常");
}
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable t) {
showNetErrToast();
}
});
} else if(resp.errCode == -1) {
ToastUtil.show("支付失败");
}
finish();
}
}
} | [
"sheng123"
] | sheng123 |
629f6ec9429770ebda4d832101da68a99fdd836e | a5449a0a7c948c13fa3205b561a2318ce57a7914 | /my_android_v3/MyApplicationrecycle_view/app/src/main/java/com/example/myapplicationrecycle_view/Crypto/HmacRipeMDCoder.java | e92835f30cb127c0fc99de1d69884b06ed452e6b | [] | no_license | RAchange/my_android_v3 | ecf65d4bc8bca329fac21006c80474ea27478acd | 71fbd7e799446615140b2a27f8d44f4667d1db60 | refs/heads/master | 2023-02-09T01:31:42.445692 | 2020-12-31T18:58:50 | 2020-12-31T18:58:50 | 321,771,204 | 0 | 3 | null | 2021-01-20T12:36:43 | 2020-12-15T19:39:56 | Java | UTF-8 | Java | false | false | 2,061 | java | package com.example.myapplicationrecycle_view.Crypto;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.util.encoders.Hex;
import java.security.Security;
import javax.crypto.KeyGenerator;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
public abstract class HmacRipeMDCoder {
public static byte[] initHmacRipeMD128Key() throws Exception {
Security.addProvider(new BouncyCastleProvider());
KeyGenerator keyGenerator = KeyGenerator.getInstance("HmacRipeMD128");
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded();
}
public static byte[] encodeHmacRipeMD128(byte[] data, byte[] key) throws Exception {
Security.addProvider(new BouncyCastleProvider());
SecretKey secretKey = new SecretKeySpec(key, "HmacRipeMD128");
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey);
return mac.doFinal(data);
}
public static String encodeHmacRipeMD128Hex(byte[] data, byte[] key) throws Exception {
byte[] b = encodeHmacRipeMD128(data, key);
return new String(Hex.encode(b));
}
public static byte[] initHmacRipeMD160Key() throws Exception {
Security.addProvider(new BouncyCastleProvider());
KeyGenerator keyGenerator = KeyGenerator.getInstance("HmacRipeMD160");
SecretKey secretKey = keyGenerator.generateKey();
return secretKey.getEncoded();
}
public static byte[] encodeHmacRipeMD160(byte[] data, byte[] key) throws Exception {
Security.addProvider(new BouncyCastleProvider());
SecretKey secretKey = new SecretKeySpec(key, "HmacRipeMD160");
Mac mac = Mac.getInstance(secretKey.getAlgorithm());
mac.init(secretKey);
return mac.doFinal(data);
}
public static String encodeHmacRipeMD160Hex(byte[] data, byte[] key) throws Exception {
byte[] b = encodeHmacRipeMD160(data, key);
return new String(Hex.encode(b));
}
}
| [
"a0979730525@gmail.com"
] | a0979730525@gmail.com |
5d88140dbd8fb7f0f703c7989f5b819f0f6fde3c | 2dc2eaaaa86febeea8b287b58b40d9e12e25f35a | /src/main/java/com/sp/sgbc/model/Account.java | 59f013e64bfdf7502a1bdd6b20fcf6abfb931ca2 | [] | no_license | sankarpadakula/sgbc | 1ba9dd2d176fbb99d75af8ddf535780ec3a34de3 | f51c1290dff45dc17d9004e73e549da571bd7f82 | refs/heads/master | 2020-03-20T11:42:14.228923 | 2019-06-11T14:27:00 | 2019-06-11T14:27:00 | 137,410,059 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,466 | java | package com.sp.sgbc.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;
public class Account {
/* @Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
@ManyToOne(cascade = CascadeType.ALL)
private Applicant applicant;
private Double totalAmount;
private Double totalPaidAmount;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "account")
private List<Transaction> transactions = new ArrayList<Transaction>();
@DateTimeFormat(pattern = "dd/MM/yyyy")
private Date startDate;
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
@Temporal(TemporalType.DATE)
private Date createdDate;
private String modifiedBy;
@DateTimeFormat(pattern = "dd/MM/yyyy HH:mm")
@Temporal(TemporalType.DATE)
private Date modifiedDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Applicant getApplicant() {
return applicant;
}
public void setApplicant(Applicant applicant) {
this.applicant = applicant;
}
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public Double getTotalPaidAmount() {
return totalPaidAmount;
}
public void setTotalPaidAmount(Double totalPaidAmount) {
this.totalPaidAmount = totalPaidAmount;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public String getModifiedBy() {
return modifiedBy;
}
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
public Date getModifiedDate() {
return modifiedDate;
}
public void setModifiedDate(Date modifiedDate) {
this.modifiedDate = modifiedDate;
}*/
}
| [
"sankar.padakula@turner.com"
] | sankar.padakula@turner.com |
77a8336a55f1b0dd904dcc92461a9dc3460384df | b1a43f2f595e650bf85a35f3fb5edd3104f8ab2d | /app/src/main/java/com/example/unittestingexamples/ui/noteslist/NotesListViewModel.java | 910db5a5b9b9779513407ab3beb9810da6d723db | [] | no_license | MaksymilianWojcik/UnitTestingExamples | e979af9d908536bdbb7ce84f906cfd265c8954c8 | 5532ee9fec33dcf42419602d6bc9a681983ccbc1 | refs/heads/master | 2020-08-01T08:05:28.335478 | 2019-09-28T16:01:23 | 2019-09-28T16:01:23 | 210,924,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,432 | java | package com.example.unittestingexamples.ui.noteslist;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModel;
import com.example.unittestingexamples.models.Note;
import com.example.unittestingexamples.repository.NoteRepository;
import com.example.unittestingexamples.ui.Resource;
import java.util.List;
import javax.inject.Inject;
public class NotesListViewModel extends ViewModel {
private final NoteRepository noteRepository;
private MediatorLiveData<List<Note>> notes = new MediatorLiveData<>();
@Inject
public NotesListViewModel(NoteRepository noteRepository) {
this.noteRepository = noteRepository;
}
public LiveData<Resource<Integer>> deleteNote(final Note note) throws Exception {
return noteRepository.deleteNote(note);
}
public LiveData<List<Note>> observeNotes() {
return notes;
}
public void getNotes() { // triggering the actual quering for those notes
final LiveData<List<Note>> source = noteRepository.getNotes();
notes.addSource(source, new Observer<List<Note>>() {
@Override
public void onChanged(List<Note> notesList) {
if(notesList != null) {
notes.setValue(notesList);
}
notes.removeSource(source);
}
});
}
}
| [
"maksymilian.wojcik@acasus.com"
] | maksymilian.wojcik@acasus.com |
eac7bf9c8c128ef1cfb0aafc7c32faa1ed13944a | 44abee7981ec47704f59d0cb9345efc4b909ad4f | /src/chap18/lecture/outputstream/OutputStreamEx2.java | e0544fbea82ad30ad2c9a7012a0f3cd43e48b4cb | [] | no_license | hyojjjin/java20200929 | ad24e96c2c3837f695951be783c59418559eceee | 8a2d7b34bc814465c83ae0efa0bd59f29205c738 | refs/heads/master | 2023-03-11T22:56:51.890496 | 2021-03-02T01:08:15 | 2021-03-02T01:08:15 | 299,485,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package chap18.lecture.outputstream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
public class OutputStreamEx2 {
public static void main(String[] args) throws Exception {
String source = "도망쳐파이리.png";
String copy = "도망쳐파이리-copy.png";
InputStream is = new FileInputStream(source);
OutputStream os = new FileOutputStream(copy);
int b = 0;
while((b = is.read()) != -1) {
os.write(b);
}
System.out.println("복사 완료");
is.close();
os.close();
}
}
| [
"hjjin2_@naver.com"
] | hjjin2_@naver.com |
f0af32c0fd657feecc25a12478800be72aa779c0 | 10c25e6a03eaf920e2a33871af18a3bb08bf2002 | /src/main/java/com/test/sample/utils/BrowserFactory.java | 68e4a235907e7cf5b9224d3378fa97f0de636f4a | [] | no_license | manojbehera970/sample | e0e6362c030eb3faf29ca6e0fb6aae7da77f7d0b | c029e113e87fb319f9c5af84eb57aa65e75b9a4b | refs/heads/master | 2021-07-16T08:23:42.048951 | 2017-10-22T09:59:18 | 2017-10-22T09:59:18 | 107,854,055 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,425 | java | package com.test.sample.utils;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.safari.SafariDriver;
import com.test.sample.BrowserType;
import com.test.sample.Config;
import com.test.sample.Constants;
public class BrowserFactory {
private static Map<String, WebDriver> drivers = new HashMap<String, WebDriver>();
// public WebDriver driver = browserFactory();
// public static WebDriver driver = new ChromeDriver();
/*
* Factory method for getting browsers
*/
public static WebDriver getBrowser(BrowserType browserName) {
WebDriver driver = null;
// System.setProperty("webdriver.gecko.driver","G:\\eclipse-workspace\\zeeui\\driver\\geckodriver.exe");
// String browserType=Config.getValue("BROWSER_TYPE");
if (browserName.equals(BrowserType.FIREFOX)) {
System.setProperty("webdriver.gecko.driver", Constants.firefoxDriver);
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.download.manager.showWhenStarting", false);
profile.setPreference("browser.download.dir", Config.getValue("EXPORT_FILE_PATH"));
profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"image/jpg, text/csv,text/xml,application/xml,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/excel,application/pdf,application/octet-stream");
driver = new FirefoxDriver(profile);
drivers.put("firefox", driver);
} else if (browserName.equals("chrome")) {
System.setProperty("webdriver.chrome.driver", Constants.chromeDriver);
Map<String, String> prefs = new Hashtable<String, String>();
prefs.put("download.prompt_for_download", "false");
prefs.put("download.default_directory", Config.getValue("EXPORT_FILE_PATH"));
prefs.put("download.extensions_to_open",
"image/jpg, text/csv,text/xml,application/xml,application/vnd.ms-excel,application/x-excel,application/x-msexcel,application/excel,application/pdf,application/octet-stream");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);
driver = new ChromeDriver(options);
drivers.put("chrome", driver);
} else if (browserName.equals("ie")) {
System.setProperty("webdriver.ie.driver", Config.getValue("IE_DRIVER"));
driver = new InternetExplorerDriver();
drivers.put("ie", driver);
} else if (browserName.equals("edge")) {
System.setProperty("webdriver.edge.driver", Config.getValue("EDGE_DRIVER"));
driver = new EdgeDriver();
drivers.put("edge", driver);
} else if (browserName.equals("safari")) {
driver = new SafariDriver();
drivers.put("safari", driver);
} else if (browserName.equals("htmlUnit")) {
driver = new HtmlUnitDriver();
}
return driver;
}
public static void closeAllDriver() {
for (String key : drivers.keySet()) {
// drivers.get(key).close();
drivers.get(key).quit();
}
}
}
| [
"manoj.behera@myntra.com"
] | manoj.behera@myntra.com |
c44a93c9fd075f4519507fdc393888f30117ac40 | 22d6d9e189b642378ac820ecc5b5627a9db785ab | /src/cn/itcast/homework/jdbc/Emp.java | 65611987320a93c8d761611492cb996c25d67fed | [] | no_license | Simon199201/JavaWeb | 7656963e0aa0eb2124d5e1c6f8786bb9ef4108d4 | d239da012fbc372f077265e07099c4b55fd77de5 | refs/heads/master | 2020-07-30T08:52:42.705105 | 2019-11-29T06:43:52 | 2019-11-29T06:43:52 | 210,162,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,550 | java | package cn.itcast.homework.jdbc;
import java.util.Date;
public class Emp {
private int id;
private String ename;
private int sex;
private String job;
private double salary;
private Date join_time;
private int dept_id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
public Date getJoin_time() {
return join_time;
}
public void setJoin_time(Date join_time) {
this.join_time = join_time;
}
public int getDept_id() {
return dept_id;
}
public void setDept_id(int dept_id) {
this.dept_id = dept_id;
}
@Override
public String toString() {
return "Emp{" +
"id=" + id +
", ename='" + ename + '\'' +
", sex=" + sex +
", job='" + job + '\'' +
", salary=" + salary +
", join_time=" + join_time +
", dept_id=" + dept_id +
'}';
}
}
| [
"zhangxinmeng@ainirobot.com"
] | zhangxinmeng@ainirobot.com |
4d0b8f9301e2bdbb7c941d85a2f9adf92e8dd629 | dc764d2507d0ba46dd472db5a51b3722aa730206 | /012. Class/src/com/planb/main/Tree.java | da142ab18e27995044a9ffd8d0e567c4fe15becc | [
"MIT"
] | permissive | JoMingyu/--Awesome-Java-- | 13e75ea652181104a2a143f19dd78814fe4d21fa | da73720d8eab7beec0507c68e33a5dce00a4d84c | refs/heads/master | 2021-03-27T10:29:24.918938 | 2017-08-01T01:00:13 | 2017-08-01T01:00:13 | 95,401,469 | 2 | 0 | null | null | null | null | UHC | Java | false | false | 295 | java | package com.planb.main;
public class Tree {
/*
* 객체들은 모두 속성과 행동을 가지고 있다
* 이걸 클래스화 시켜서 필드와 메소드로 표현한다
*/
String name;
int height;
String getInfo() {
return "Name is " + name + ", height is " + height;
}
}
| [
"city7310@naver.com"
] | city7310@naver.com |
7f9566ec3f09e4911206fd2841e7876dc92372ba | a87561e0455a66484abddc95536f4f7309b9b8bc | /app/src/main/java/br/com/caelum/cadastro/Fragment/MapaFragment.java | 46d724f467fb24117f04c8aa3235f179b6801e34 | [] | no_license | dFenille/cadastroCaelum | d607c03d19c770ff38a78a7e73ab3ee7cdb283e8 | 9ca10e92b818c4562d1a4cba962cbb448851700e | refs/heads/master | 2021-08-19T10:03:43.098731 | 2017-11-25T19:03:18 | 2017-11-25T19:03:18 | 109,520,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | package br.com.caelum.cadastro.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.util.List;
import java.util.zip.Inflater;
import br.com.caelum.cadastro.DAO.AlunoDao;
import br.com.caelum.cadastro.Helpers.Localizador;
import br.com.caelum.cadastro.Models.Aluno;
import br.com.caelum.cadastro.R;
/**
* Created by android7087 on 25/11/17.
*/
public class MapaFragment extends SupportMapFragment {
public List<Aluno> listaAluno;
@Override
public void onResume() {
super.onResume();
Localizador localizador = new Localizador(getActivity());
GoogleMap googleMap = (GoogleMap) getMap();
centralizar(localizador.getCoordenada("Rua Vergueiro 3185 Vila Mariana"),googleMap);
AlunoDao alunoDao = new AlunoDao(getActivity());
listaAluno = alunoDao.lista();
for(Aluno aluno : listaAluno){
MarkerOptions mark = new MarkerOptions();
mark.title(aluno.getNome());
mark.position(localizador.getCoordenada(aluno.getEndereco()));
googleMap.addMarker(mark);
}
}
public void centralizar(LatLng coord,GoogleMap map){
map.moveCamera(CameraUpdateFactory.newLatLngZoom(coord,11f));
}
}
| [
"Diego"
] | Diego |
78652ce10893f3636850d194a2ced5062de20198 | 8dbb0cf5d3a07c7c3543d0a42409164d16c79e78 | /src/com/jamie/traffic/Car.java | ff87d4c2cc05de46af8753ce7d282f5c408b0eb7 | [] | no_license | jplmr/TrafficSimulation | f81f7cdabb935f631016bcdb272d65019703711b | 6f25619a785312f3bdaea943769a221c9801113b | refs/heads/master | 2020-04-11T08:59:25.286616 | 2012-03-30T04:56:40 | 2012-03-30T04:56:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,563 | java | package com.jamie.traffic;
import java.util.ArrayList;
public class Car implements Comparable<Car> {
public Edge edge;
public Node destination;
public Node imDest;
public double distance;
public double speed;
public double targetSpeed;
// Weights arrays
public double[] weightsIH;
public double[] weightsHO;
// Network layers
public double[] input;
public double[] hidden;
public double[] output;
public int points = 1;
public static final double maxSpeed = 3.0;
public boolean isSwitched = false;
public String name;
public double percent;
public double lowerPercentLimit;
public double upperPercentLimit;
public Car(String name) {
input = new double[5];
hidden = new double[3];
output = new double[1];
weightsIH = new double[input.length * hidden.length];
weightsHO = new double[hidden.length * output.length];
this.name = name;
}
public Car clone() {
Car newCar = new Car(name);
newCar.distance = this.distance;
return newCar;
}
public static double sigmoid(double o, double top) {
return top / (1 + Math.exp(-o));
}
public static void sigmoid(double[] o, double top) {
for (int i = 0; i < o.length; i++) {
o[i] = sigmoid(o[i], top);
}
}
public String toString() {
return "" + percent;
}
@Override
public int compareTo(Car o) {
return (int) Math.signum(distance - o.distance);
}
public static void pushLayer(double a[], double b[], double w[]) {
for (int i = 0; i < b.length; i++) {
for (int j = 0; j < a.length; j++) {
b[i] += w[i * a.length + j] * a[j];
}
}
}
}
| [
"jjiceman2007@gmail.com"
] | jjiceman2007@gmail.com |
4c905ba9eadd410781e2cb7dbf4421dd83a45013 | a9dfe146378e89ffda174d474d9ba17357da40a4 | /ClientSide/src/presenter/Presenter.java | 41826f601b4d260468082fd215cc659d6c1a62a9 | [] | no_license | nir581/MyProject | 0a09f1a62b0ef72b38577cac62606401d2a3eb48 | 426a4f58ea19a414b80b720ef85a4044b1a78296 | refs/heads/master | 2021-01-23T11:04:12.716102 | 2015-01-22T00:02:18 | 2015-01-22T00:02:18 | 29,611,314 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,881 | java | package presenter;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
import config.LoadProperties;
import presenter.UserCommands.Command;
import viewNwindow.GameWindow;
import viewNwindow.MyConsoleView;
import viewNwindow.View;
import viewNwindow.WelcomeWindow;
import model.Model;
import model.MyModel;
public class Presenter implements Observer {
//the Observables
private Model model;
private View view; //a view window
private WelcomeWindow w; //welcomeWindow
private ArrayList<Model> models; //all running models
private static Thread t; //for the View
private UserCommands commands; //the Factory of Commands
public Presenter(Model model, WelcomeWindow w) {
this.model = model;
this.w = w;
this.commands = new UserCommands();
this.models = new ArrayList<Model>();
}
public void setView(View view) {
this.view = view;
this.view.addObserver(this);
}
public boolean indexInRange(int index) {
if (index>0 && index<=this.models.size()) //the index is valid
return true;
return false;
}
public void findSolutionInAModel(int i) { //checks if there's a solution for the specific problem at this time point
if (!indexInRange(i))
((MyConsoleView) view).indexNotInRange(false);
else {
if ( models.get(i-1).getSolution() == null ) //there's no solution yet
((MyConsoleView) view).solutionFoundOrNot(false);
else //case: regular solution or "no solution"
view.solutionFoundOrNot(true);
}
}
public void showSolutionInModel(int i) { //presents the solution to the User
//System.out.println("s3");
if (!indexInRange(i)) {
//System.out.println("s5");
((MyConsoleView) view).indexNotInRange(false); //fix!!!!!!!!!!!!!!
}
else {
if (models.get(i-1).getSolution() != null) {
//System.out.println("s7");
view.displaySolution(models.get(i-1).getSolution());
}
else {
//System.out.println("s8");
view.solutionFoundOrNot(false);
}
}
}
public void exitSafetlyFromAllModels() {
if (models != null) {
for(int i=0; i<models.size(); i++)
if(models.get(i).getT() != null && models.get(i).getT().isAlive())
models.get(i).stopThread();
}
}
public void fromModel(Object arg1) {
if (arg1 != null) {
if ( ((String)arg1).startsWith("isThereASolution") ) { //option 1
String s = ((String)arg1).substring(((String)arg1).length()-1);
int index = Integer.parseInt(s);
findSolutionInAModel(index); }
else if ( ((String)arg1).startsWith("presentSolution") ) { //op2
String s = ((String)arg1).substring(((String)arg1).length()-1);
int index = Integer.parseInt(s);
showSolutionInModel(index); }
else if ( ((String)arg1).equals("safeExit") ) //op3
exitSafetlyFromAllModels();
else if ( ((String)arg1).startsWith("afterMoves") ) { //op4
String[] a = ((String)arg1).split(" ");
sendDescription(a[1]);
}
else
sendDescription(null); //op5- getDescription
}
}
public void fromWelcomeWindow(Object arg1) {
if(w.getGameWindow() != null && view == null)
setView(w.getGameWindow());
if (arg1 != null) {
String s = ((String)arg1).toString();
LoadProperties.setFILE_NAME(s);
}
}
public void fromView(Object arg1) {
String action = view.getUserAction();
String[] arr = action.split(": ");
String commandName = arr[0];
String args = ""; //extra Parameters
if (arr.length > 1)
args = arr[1];
Command command = commands.selectCommand(commandName);
Model m = command.doCommand(this.model, args);
//check if we got a new model from the command
if (m != this.model) {
this.model = m;
models.add(m);
this.model.addObserver(this); //the presenter itself is the Observer
}
if(models != null)
System.out.println("number of models in models arr is: "+models.size());
}
@Override
public void update(Observable observable, Object arg1) {
if (observable instanceof Model) {
fromModel(arg1);
}
else if (observable instanceof WelcomeWindow) {
fromWelcomeWindow(arg1);
}
else if (observable instanceof View) {
fromView(arg1);
}
}
private void sendDescription(String str) {
if (str != null){
((GameWindow)view).setDescription(str);
}
else {
String s = ((MyModel)model).getDomainDescription();
((GameWindow)view).setDescription(s);
}
}
//Main()
public static void main(String[] args) {
MyModel model = new MyModel();
WelcomeWindow w = new WelcomeWindow(700, 700, "Welcome Window");
Presenter presenter = new Presenter(model, w);
model.addObserver(presenter);
w.addObserver(presenter);
w.run();
System.out.println("end main");
}
}
| [
"nir581@gmail.com"
] | nir581@gmail.com |
d0a8254ba36ca6eefbc08717c88b70b8033b17e2 | d8d8b290e326966cb920515e5a44ea98a290accf | /Server/TestClient/src/com/kodgames/client/action/battle/BCPlayStepSYNAction.java | 6daf685ba615e2c2102e81ad25b385978a7a93e3 | [] | no_license | k896152374/Kodgames | b3c20c867c8dc8eb82b2edabf27682d6f038db2f | aff536b42aaa79035570d6f0249a469192ebb3c6 | refs/heads/master | 2023-03-17T23:58:26.599593 | 2017-06-05T02:49:27 | 2017-06-05T02:49:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package com.kodgames.client.action.battle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.kodgames.client.service.battle.BattleService;
import com.kodgames.corgi.core.net.Connection;
import com.kodgames.corgi.core.net.common.ActionAnnotation;
import com.kodgames.corgi.core.net.handler.message.ProtobufMessageHandler;
import com.kodgames.message.proto.battle.BattleProtoBuf.BCPlayCardRES;
import com.kodgames.message.proto.battle.BattleProtoBuf.BCPlayStepSYN;
@ActionAnnotation(actionClass = BCPlayStepSYNAction.class, messageClass = BCPlayStepSYN.class, serviceClass = BattleService.class)
public class BCPlayStepSYNAction extends ProtobufMessageHandler<BattleService, BCPlayStepSYN>
{
private static final Logger logger = LoggerFactory.getLogger(BCPlayStepSYNAction.class);
@Override
public void handleMessage(Connection connection, BattleService service, BCPlayStepSYN message, int callback)
{
logger.info("{} : {} -> {}.", getClass().getSimpleName(), connection.getConnectionID(), message);
service.onPlayStepSYN(connection, message, callback);
}
}
| [
"314158258@qq.com"
] | 314158258@qq.com |
6a0198f87fec8847d6e6fc7970e958098fad0fb9 | 195d28f3af6b54e9859990c7d090f76ce9c49983 | /issac-security-core/src/main/java/com/issac/security/core/authentication/AbstractChannelSecurityConfig.java | dbe67ba8112d1c739bbf4f13cabc75123b623205 | [] | no_license | IssacYoung2013/security | a00aa95b7c385937aa1add882d499db91f693253 | 00564b7f1406638cf4fb4cf89d46e1d65e566f1a | refs/heads/master | 2020-04-18T21:28:00.116411 | 2019-01-29T01:27:27 | 2019-01-29T01:27:27 | 167,765,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package com.issac.security.core.authentication;
import com.issac.security.core.constants.SecurityConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
/**
*
* author: ywy
* date: 2019-01-27
* desc:
*/
public class AbstractChannelSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
protected AuthenticationSuccessHandler issacAuthenticationSuccessHandler;
@Autowired
protected AuthenticationFailureHandler issacAuthenticationFailureHandler;
protected void applyPasswordAuthenticationConfig(HttpSecurity http) throws Exception {
http.formLogin()
.loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL)
.loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM)
.successHandler(issacAuthenticationSuccessHandler)
.failureHandler(issacAuthenticationFailureHandler);
}
}
| [
"issacyoung@msn.cn"
] | issacyoung@msn.cn |
111a41c59d59b908c3d603035cf5f66bd4b16101 | 071b292a74b0af9d1b079f5e2066c13b3302777a | /app/src/androidTest/java/com/example/kast/guessthecelebrityapp/ExampleInstrumentedTest.java | d993bb80013b8bbdfa433240d97c85c2f186bf61 | [] | no_license | KaupoA/GuessTheCelebrityApp | 483705f9755ba6dbac68fea929c14b86604bdcdd | bdd0076b9ad85ce06c4d454dc2832090453a9406 | refs/heads/master | 2021-05-06T17:09:10.833944 | 2017-11-23T10:28:30 | 2017-11-23T10:28:30 | 111,796,085 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package com.example.kast.guessthecelebrityapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.kast.guessthecelebrityapp", appContext.getPackageName());
}
}
| [
"kaupo.aun@gmail.com"
] | kaupo.aun@gmail.com |
4b35be9680c54e3728971447c851ef0a90db4ba5 | d8f08d65512765a485a469390268e37f34d70d2e | /Java/src/GenericItemType.java | 3db66dd0df6a4d9761a5e08b4b4b277a02a7a997 | [] | no_license | rramsdany/MinHeap | fd7ee319dc4461722c2179b76bc88a453c7978f1 | 0a5bb236b56e14cb7335b36e41da46079cafb095 | refs/heads/master | 2023-04-09T02:18:01.479294 | 2021-04-09T06:23:41 | 2021-04-09T06:23:41 | 352,888,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 218 | java | public abstract class GenericItemType {
public abstract boolean isLess(GenericItemType git);
public abstract boolean isEqual(GenericItemType git);
public abstract boolean isGreater(GenericItemType git);
}
| [
"rramsdany@gmail.com"
] | rramsdany@gmail.com |
c94b6dd73b4ed42c6c5efe7c4f846fb2e60106c4 | 3e99baac957fa652b5d6af99d3b04ab639638263 | /src/main/java/com/homework06/View.java | 67d365bc82a8caf98bb066fd8855a75cd44b5cbe | [] | no_license | Anni-Gao/java-test-an | 0d06d26f9117f81af86e146f66858d1d6beb2d09 | 5634ad9255de8dc3536cad685b615fa3480d7bc8 | refs/heads/master | 2023-01-24T05:18:38.836697 | 2020-12-09T10:50:48 | 2020-12-09T10:54:22 | 319,928,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package com.homework06;
public class View {
private OnClickable onClickable;
public OnClickable getOnClickable(){
return onClickable;
}
public void setOnClickable(OnClickable onClickable){
this.onClickable = onClickable;
}
} | [
"1183723408@qq.com"
] | 1183723408@qq.com |
6f78f799e21ca78aef7fbfcedcbf8c53ef6ec116 | 67fe5fffed1135afaaee446bfe39214498a13b05 | /src/main/java/org/doremus/diaboloConverter/musResource/DoremusResource.java | c6c3b98e4437ebaf90c6f4951cf151c3eca820ff | [
"Apache-2.0"
] | permissive | DOREMUS-ANR/diabolo-converter | 9288126fbfb09967a10cfd6e8d07e5b9050f259e | c7652bd83e9c1784330d11fb68be46375cc4d9b5 | refs/heads/master | 2020-03-24T04:50:55.730306 | 2018-11-21T14:37:49 | 2018-11-21T14:37:49 | 142,466,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,166 | java | package org.doremus.diaboloConverter.musResource;
import org.apache.jena.datatypes.xsd.XSDDatatype;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.rdf.model.*;
import org.apache.jena.util.ResourceUtils;
import org.apache.jena.vocabulary.DC;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.doremus.diaboloConverter.ConstructURI;
import org.doremus.diaboloConverter.files.DiaboloRecord;
import org.doremus.ontology.CIDOC;
import java.net.URI;
import java.net.URISyntaxException;
public abstract class DoremusResource {
String className;
final String sourceDb = "rfd"; // radio france diabolo
protected DiaboloRecord record;
protected Model model;
protected URI uri;
protected Resource resource;
protected String identifier;
public DoremusResource() {
// do nothing, enables customisation for child class
this.model = ModelFactory.createDefaultModel();
this.className = this.getClass().getSimpleName();
}
public DoremusResource(URI uri) {
this();
this.uri = uri;
this.resource = model.createResource(this.uri.toString());
}
public DoremusResource(String identifier) {
this();
this.identifier = identifier;
this.resource = null;
/* create RDF resource */
try {
this.uri = ConstructURI.build(this.sourceDb, this.className, this.identifier);
this.resource = model.createResource(this.uri.toString())
.addProperty(DC.identifier, this.identifier);
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
protected void setUri(String uri) {
if (this.uri != null && uri.equals(this.uri.toString())) return;
try {
this.uri = new URI(uri);
if (this.resource != null)
this.resource = ResourceUtils.renameResource(this.resource, uri);
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
public DoremusResource(DiaboloRecord record) {
this(record.getId());
this.record = record;
}
public DoremusResource(DiaboloRecord record, String identifier) {
this(identifier);
this.record = record;
}
public Resource asResource() {
return this.resource;
}
public Model getModel() {
return this.model;
}
public String getIdentifier() {
return this.identifier;
}
protected void addNote(String text) {
if (text == null) return;
text = text.trim();
if (text.isEmpty()) return;
this.resource
.addProperty(RDFS.comment, text, "fr")
.addProperty(CIDOC.P3_has_note, text, "fr");
}
public URI getUri() {
return uri;
}
protected void setClass(OntClass _class) {
this.resource.addProperty(RDF.type, _class);
}
public DoremusResource addProperty(Property property, DoremusResource resource) {
if (resource != null) {
this.addProperty(property, resource.asResource());
this.model.add(resource.getModel());
}
return this;
}
public DoremusResource addProperty(Property property, Resource resource) {
if (resource != null) this.resource.addProperty(property, resource);
return this;
}
public DoremusResource addProperty(Property property, String literal) {
if (literal != null && !literal.isEmpty()) this.resource.addProperty(property, literal.trim());
return this;
}
public DoremusResource addProperty(Property property, String literal, String lang) {
if (literal != null && !literal.isEmpty()) this.resource.addProperty(property, literal.trim(), lang);
return this;
}
protected DoremusResource addProperty(Property property, Literal literal) {
if (literal != null) this.resource.addProperty(property, literal);
return this;
}
protected DoremusResource addProperty(Property property, String literal, XSDDatatype datatype) {
if (literal != null && !literal.isEmpty()) this.resource.addProperty(property, literal.trim(), datatype);
return this;
}
public void addTimeSpan(E52_TimeSpan timeSpan) {
if(timeSpan!=null&& timeSpan.asResource()!= null)
this.resource.addProperty(CIDOC.P4_has_time_span, timeSpan.asResource());
this.model.add(timeSpan.getModel());
}
}
| [
"pasquale.lisena@eurecom.fr"
] | pasquale.lisena@eurecom.fr |
2d91360eaba6b62a4884a82af07f4955301345fc | 576a54161cdf04f249de9e4b290b844b0283474b | /IMKit/build/generated/source/r/debug/io/rong/imkit/R.java | 416bc866cd7758dad727d98cd9f25e11cfc2caeb | [] | no_license | laozhu123/Iteacher | cd59de08c3ef4337899901daa0ac4aacc83ae0e7 | 6fbeea1e9b6e129d591c5750a941bdc0336ee966 | refs/heads/master | 2021-01-20T11:32:10.547229 | 2016-11-19T11:49:26 | 2016-11-19T11:49:26 | 59,818,412 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,611 | 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 io.rong.imkit;
public final class R {
public static final class array {
public static int rc_emoji_code=0x7f050000;
public static int rc_emoji_res=0x7f050001;
}
public static final class attr {
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<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 int RCCornerRadius=0x7f010001;
/** <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 int RCDefDrawable=0x7f010004;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<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 int RCMask=0x7f010002;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<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 int RCMinShortSideSize=0x7f010000;
/** <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>square</code></td><td>0</td><td></td></tr>
<tr><td><code>circle</code></td><td>1</td><td></td></tr>
</table>
*/
public static int RCShape=0x7f010003;
/** <p>Must be one 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>SCE</code></td><td>0x123</td><td></td></tr>
<tr><td><code>CES</code></td><td>0x231</td><td></td></tr>
<tr><td><code>ECS</code></td><td>0x321</td><td></td></tr>
<tr><td><code>CSE</code></td><td>0x213</td><td></td></tr>
<tr><td><code>SC</code></td><td>0x120</td><td></td></tr>
<tr><td><code>CS</code></td><td>0x21</td><td></td></tr>
<tr><td><code>EC</code></td><td>0x320</td><td></td></tr>
<tr><td><code>CE</code></td><td>0x023</td><td></td></tr>
<tr><td><code>C</code></td><td>0x020</td><td></td></tr>
</table>
*/
public static int RCStyle=0x7f010005;
}
public static final class bool {
public static int rc_enable_get_remote_history_message=0x7f060000;
public static int rc_is_show_warning_notification=0x7f060001;
public static int rc_play_audio_continuous=0x7f060002;
public static int rc_read_receipt=0x7f060003;
public static int rc_stop_custom_service_when_quit=0x7f060004;
public static int rc_typing_status=0x7f060005;
}
public static final class color {
public static int rc_conversation_top_bg=0x7f070000;
public static int rc_draft_color=0x7f070001;
public static int rc_input_bg=0x7f070002;
public static int rc_location_text=0x7f070003;
public static int rc_message_user_name=0x7f070004;
public static int rc_normal_bg=0x7f070005;
public static int rc_notice_normal=0x7f070006;
public static int rc_notice_text=0x7f070007;
public static int rc_notice_warning=0x7f070008;
public static int rc_notification_bg=0x7f070009;
public static int rc_picprev_toolbar_transparent=0x7f07000a;
public static int rc_picsel_catalog_shadow=0x7f07000b;
public static int rc_picsel_grid_mask=0x7f07000c;
public static int rc_picsel_grid_mask_pressed=0x7f07000d;
public static int rc_picsel_toolbar=0x7f07000e;
public static int rc_picsel_toolbar_send_disable=0x7f07000f;
public static int rc_picsel_toolbar_send_normal=0x7f070010;
public static int rc_picsel_toolbar_send_pressed=0x7f070011;
public static int rc_picsel_toolbar_send_text_disable=0x7f070012;
public static int rc_picsel_toolbar_send_text_normal=0x7f070013;
public static int rc_picsel_toolbar_transparent=0x7f070014;
public static int rc_plugins_bg=0x7f070015;
public static int rc_text_color_primary=0x7f070016;
public static int rc_text_color_primary_inverse=0x7f070017;
public static int rc_text_color_secondary=0x7f070018;
public static int rc_text_color_tertiary=0x7f070019;
public static int rc_text_voice=0x7f07001a;
public static int rc_voice_cancle=0x7f07001b;
public static int rc_voice_color=0x7f07001c;
public static int rc_voice_color_left=0x7f07001d;
public static int rc_voice_color_right=0x7f07001e;
}
public static final class dimen {
public static int rc_conversation_item_data_size=0x7f080000;
public static int rc_conversation_item_name_size=0x7f080001;
}
public static final class drawable {
public static int rc_add_people=0x7f020000;
public static int rc_an_voice_receive=0x7f020001;
public static int rc_an_voice_sent=0x7f020002;
public static int rc_bg_editinput=0x7f020003;
public static int rc_bg_item=0x7f020004;
public static int rc_bg_menu=0x7f020005;
public static int rc_bg_text_hover=0x7f020006;
public static int rc_bg_text_normal=0x7f020007;
public static int rc_bg_voice_popup=0x7f020008;
public static int rc_btn_input=0x7f020009;
public static int rc_btn_pub_service_enter_hover=0x7f02000a;
public static int rc_btn_pub_service_enter_normal=0x7f02000b;
public static int rc_btn_pub_service_follow_hover=0x7f02000c;
public static int rc_btn_pub_service_follow_normal=0x7f02000d;
public static int rc_btn_public_service_enter_selector=0x7f02000e;
public static int rc_btn_public_service_unfollow_selector=0x7f02000f;
public static int rc_btn_send=0x7f020010;
public static int rc_btn_send_hover=0x7f020011;
public static int rc_btn_send_normal=0x7f020012;
public static int rc_btn_voice=0x7f020013;
public static int rc_btn_voice_hover=0x7f020014;
public static int rc_btn_voice_normal=0x7f020015;
public static int rc_complete=0x7f020016;
public static int rc_complete_hover=0x7f020017;
public static int rc_conversation_list_msg_send_failure=0x7f020018;
public static int rc_conversation_list_msg_sending=0x7f020019;
public static int rc_conversation_newmsg=0x7f02001a;
public static int rc_corner_location_style=0x7f02001b;
public static int rc_corner_style=0x7f02001c;
public static int rc_corner_voice_style=0x7f02001d;
public static int rc_default_discussion_portrait=0x7f02001e;
public static int rc_default_group_portrait=0x7f02001f;
public static int rc_default_portrait=0x7f020020;
public static int rc_ed_pub_service_search_hover=0x7f020021;
public static int rc_ed_pub_service_search_normal=0x7f020022;
public static int rc_ed_public_service_search_selector=0x7f020023;
public static int rc_grid_camera=0x7f020024;
public static int rc_grid_image_default=0x7f020025;
public static int rc_grid_image_error=0x7f020026;
public static int rc_ic_admin_selector=0x7f020027;
public static int rc_ic_bubble_left=0x7f020028;
public static int rc_ic_bubble_no_left=0x7f020029;
public static int rc_ic_bubble_no_right=0x7f02002a;
public static int rc_ic_bubble_right=0x7f02002b;
public static int rc_ic_bubble_white=0x7f02002c;
public static int rc_ic_camera=0x7f02002d;
public static int rc_ic_camera_normal=0x7f02002e;
public static int rc_ic_camera_selected=0x7f02002f;
public static int rc_ic_def_coversation_portrait=0x7f020030;
public static int rc_ic_def_msg_portrait=0x7f020031;
public static int rc_ic_def_rich_content=0x7f020032;
public static int rc_ic_delete=0x7f020033;
public static int rc_ic_emoji_block=0x7f020034;
public static int rc_ic_extend=0x7f020035;
public static int rc_ic_extend_normal=0x7f020036;
public static int rc_ic_extend_selected=0x7f020037;
public static int rc_ic_keyboard=0x7f020038;
public static int rc_ic_keyboard_normal=0x7f020039;
public static int rc_ic_keyboard_selected=0x7f02003a;
public static int rc_ic_location=0x7f02003b;
public static int rc_ic_location_item_default=0x7f02003c;
public static int rc_ic_location_normal=0x7f02003d;
public static int rc_ic_location_selected=0x7f02003e;
public static int rc_ic_menu_keyboard=0x7f02003f;
public static int rc_ic_message_block=0x7f020040;
public static int rc_ic_no=0x7f020041;
public static int rc_ic_no_hover=0x7f020042;
public static int rc_ic_no_selector=0x7f020043;
public static int rc_ic_notice_loading=0x7f020044;
public static int rc_ic_notice_point=0x7f020045;
public static int rc_ic_notice_wraning=0x7f020046;
public static int rc_ic_phone=0x7f020047;
public static int rc_ic_phone_normal=0x7f020048;
public static int rc_ic_phone_selected=0x7f020049;
public static int rc_ic_picture=0x7f02004a;
public static int rc_ic_picture_normal=0x7f02004b;
public static int rc_ic_picture_selected=0x7f02004c;
public static int rc_ic_setting_friends_add=0x7f02004d;
public static int rc_ic_setting_friends_delete=0x7f02004e;
public static int rc_ic_smiley=0x7f02004f;
public static int rc_ic_smiley_normal=0x7f020050;
public static int rc_ic_smiley_selected=0x7f020051;
public static int rc_ic_star=0x7f020052;
public static int rc_ic_star_hover=0x7f020053;
public static int rc_ic_star_selector=0x7f020054;
public static int rc_ic_text=0x7f020055;
public static int rc_ic_text_normal=0x7f020056;
public static int rc_ic_text_selected=0x7f020057;
public static int rc_ic_trangle=0x7f020058;
public static int rc_ic_voice=0x7f020059;
public static int rc_ic_voice_normal=0x7f02005a;
public static int rc_ic_voice_receive=0x7f02005b;
public static int rc_ic_voice_receive_play1=0x7f02005c;
public static int rc_ic_voice_receive_play2=0x7f02005d;
public static int rc_ic_voice_receive_play3=0x7f02005e;
public static int rc_ic_voice_selected=0x7f02005f;
public static int rc_ic_voice_sent=0x7f020060;
public static int rc_ic_voice_sent_play1=0x7f020061;
public static int rc_ic_voice_sent_play2=0x7f020062;
public static int rc_ic_voice_sent_play3=0x7f020063;
public static int rc_ic_volume_0=0x7f020064;
public static int rc_ic_volume_1=0x7f020065;
public static int rc_ic_volume_2=0x7f020066;
public static int rc_ic_volume_3=0x7f020067;
public static int rc_ic_volume_4=0x7f020068;
public static int rc_ic_volume_5=0x7f020069;
public static int rc_ic_volume_6=0x7f02006a;
public static int rc_ic_volume_7=0x7f02006b;
public static int rc_ic_volume_8=0x7f02006c;
public static int rc_ic_volume_cancel=0x7f02006d;
public static int rc_ic_volume_wraning=0x7f02006e;
public static int rc_ic_warning=0x7f02006f;
public static int rc_ic_yes=0x7f020070;
public static int rc_ic_yes_hover=0x7f020071;
public static int rc_ic_yes_selector=0x7f020072;
public static int rc_icon_admin=0x7f020073;
public static int rc_icon_admin_hover=0x7f020074;
public static int rc_img_camera=0x7f020075;
public static int rc_indicator=0x7f020076;
public static int rc_indicator_hover=0x7f020077;
public static int rc_item_list_selector=0x7f020078;
public static int rc_item_top_list_selector=0x7f020079;
public static int rc_loading=0x7f02007a;
public static int rc_mebmer_delete=0x7f02007b;
public static int rc_no=0x7f02007c;
public static int rc_no_hover=0x7f02007d;
public static int rc_notification_network_available=0x7f02007e;
public static int rc_origin_check_nor=0x7f02007f;
public static int rc_origin_check_sel=0x7f020080;
public static int rc_picsel_back_normal=0x7f020081;
public static int rc_picsel_back_pressed=0x7f020082;
public static int rc_picsel_catalog_pic_shadow=0x7f020083;
public static int rc_picsel_catalog_selected=0x7f020084;
public static int rc_picsel_empty_pic=0x7f020085;
public static int rc_picsel_pictype_normal=0x7f020086;
public static int rc_praise=0x7f020087;
public static int rc_praise_hover=0x7f020088;
public static int rc_progress_sending_style=0x7f020089;
public static int rc_public_service_menu_bg=0x7f02008a;
public static int rc_radio_button_off=0x7f02008b;
public static int rc_radio_button_on=0x7f02008c;
public static int rc_read_receipt=0x7f02008d;
public static int rc_receive_voice_one=0x7f02008e;
public static int rc_receive_voice_three=0x7f02008f;
public static int rc_receive_voice_two=0x7f020090;
public static int rc_sel_picsel_toolbar_back=0x7f020091;
public static int rc_sel_picsel_toolbar_send=0x7f020092;
public static int rc_selector_grid_camera_mask=0x7f020093;
public static int rc_send_voice_one=0x7f020094;
public static int rc_send_voice_three=0x7f020095;
public static int rc_send_voice_two=0x7f020096;
public static int rc_sp_grid_mask=0x7f020097;
public static int rc_switch_btn=0x7f020098;
public static int rc_unread_count_bg=0x7f020099;
public static int rc_unread_message_count=0x7f02009a;
public static int rc_unread_remind_without_count=0x7f02009b;
public static int rc_voice_icon_left=0x7f02009c;
public static int rc_voice_icon_right=0x7f02009d;
public static int rc_voice_unread=0x7f02009e;
public static int rc_voide_message_unread=0x7f02009f;
public static int select_check_nor=0x7f0200a0;
public static int select_check_sel=0x7f0200a1;
public static int u1f004=0x7f0200a2;
public static int u1f30f=0x7f0200a3;
public static int u1f319=0x7f0200a4;
public static int u1f332=0x7f0200a5;
public static int u1f339=0x7f0200a6;
public static int u1f33b=0x7f0200a7;
public static int u1f349=0x7f0200a8;
public static int u1f356=0x7f0200a9;
public static int u1f35a=0x7f0200aa;
public static int u1f366=0x7f0200ab;
public static int u1f36b=0x7f0200ac;
public static int u1f377=0x7f0200ad;
public static int u1f37b=0x7f0200ae;
public static int u1f381=0x7f0200af;
public static int u1f382=0x7f0200b0;
public static int u1f384=0x7f0200b1;
public static int u1f389=0x7f0200b2;
public static int u1f393=0x7f0200b3;
public static int u1f3a4=0x7f0200b4;
public static int u1f3b2=0x7f0200b5;
public static int u1f3b5=0x7f0200b6;
public static int u1f3c0=0x7f0200b7;
public static int u1f3c2=0x7f0200b8;
public static int u1f3e1=0x7f0200b9;
public static int u1f434=0x7f0200ba;
public static int u1f436=0x7f0200bb;
public static int u1f437=0x7f0200bc;
public static int u1f44a=0x7f0200bd;
public static int u1f44c=0x7f0200be;
public static int u1f44d=0x7f0200bf;
public static int u1f44e=0x7f0200c0;
public static int u1f44f=0x7f0200c1;
public static int u1f451=0x7f0200c2;
public static int u1f46a=0x7f0200c3;
public static int u1f46b=0x7f0200c4;
public static int u1f47b=0x7f0200c5;
public static int u1f47c=0x7f0200c6;
public static int u1f47d=0x7f0200c7;
public static int u1f47f=0x7f0200c8;
public static int u1f484=0x7f0200c9;
public static int u1f48a=0x7f0200ca;
public static int u1f48b=0x7f0200cb;
public static int u1f48d=0x7f0200cc;
public static int u1f494=0x7f0200cd;
public static int u1f4a1=0x7f0200ce;
public static int u1f4a2=0x7f0200cf;
public static int u1f4a3=0x7f0200d0;
public static int u1f4a4=0x7f0200d1;
public static int u1f4a9=0x7f0200d2;
public static int u1f4aa=0x7f0200d3;
public static int u1f4b0=0x7f0200d4;
public static int u1f4da=0x7f0200d5;
public static int u1f4de=0x7f0200d6;
public static int u1f4e2=0x7f0200d7;
public static int u1f525=0x7f0200d8;
public static int u1f52b=0x7f0200d9;
public static int u1f556=0x7f0200da;
public static int u1f600=0x7f0200db;
public static int u1f601=0x7f0200dc;
public static int u1f602=0x7f0200dd;
public static int u1f603=0x7f0200de;
public static int u1f605=0x7f0200df;
public static int u1f606=0x7f0200e0;
public static int u1f607=0x7f0200e1;
public static int u1f608=0x7f0200e2;
public static int u1f609=0x7f0200e3;
public static int u1f60a=0x7f0200e4;
public static int u1f60b=0x7f0200e5;
public static int u1f60c=0x7f0200e6;
public static int u1f60d=0x7f0200e7;
public static int u1f60e=0x7f0200e8;
public static int u1f60f=0x7f0200e9;
public static int u1f611=0x7f0200ea;
public static int u1f612=0x7f0200eb;
public static int u1f613=0x7f0200ec;
public static int u1f614=0x7f0200ed;
public static int u1f615=0x7f0200ee;
public static int u1f616=0x7f0200ef;
public static int u1f618=0x7f0200f0;
public static int u1f61a=0x7f0200f1;
public static int u1f61c=0x7f0200f2;
public static int u1f61d=0x7f0200f3;
public static int u1f61e=0x7f0200f4;
public static int u1f61f=0x7f0200f5;
public static int u1f621=0x7f0200f6;
public static int u1f622=0x7f0200f7;
public static int u1f623=0x7f0200f8;
public static int u1f624=0x7f0200f9;
public static int u1f628=0x7f0200fa;
public static int u1f629=0x7f0200fb;
public static int u1f62a=0x7f0200fc;
public static int u1f62b=0x7f0200fd;
public static int u1f62c=0x7f0200fe;
public static int u1f62d=0x7f0200ff;
public static int u1f62e=0x7f020100;
public static int u1f62f=0x7f020101;
public static int u1f630=0x7f020102;
public static int u1f631=0x7f020103;
public static int u1f632=0x7f020104;
public static int u1f633=0x7f020105;
public static int u1f634=0x7f020106;
public static int u1f635=0x7f020107;
public static int u1f636=0x7f020108;
public static int u1f637=0x7f020109;
public static int u1f648=0x7f02010a;
public static int u1f649=0x7f02010b;
public static int u1f64a=0x7f02010c;
public static int u1f64f=0x7f02010d;
public static int u1f680=0x7f02010e;
public static int u1f6ab=0x7f02010f;
public static int u1f6b2=0x7f020110;
public static int u1f6bf=0x7f020111;
public static int u23f0=0x7f020112;
public static int u23f3=0x7f020113;
public static int u2600=0x7f020114;
public static int u2601=0x7f020115;
public static int u2614=0x7f020116;
public static int u2615=0x7f020117;
public static int u261d=0x7f020118;
public static int u263a=0x7f020119;
public static int u26a1=0x7f02011a;
public static int u26bd=0x7f02011b;
public static int u26c4=0x7f02011c;
public static int u26c5=0x7f02011d;
public static int u270a=0x7f02011e;
public static int u270b=0x7f02011f;
public static int u270c=0x7f020120;
public static int u270f=0x7f020121;
public static int u2744=0x7f020122;
public static int u2b50=0x7f020123;
}
public static final class id {
public static int C=0x7f090035;
public static int CE=0x7f090036;
public static int CES=0x7f090037;
public static int CS=0x7f090038;
public static int CSE=0x7f090039;
public static int EC=0x7f09003a;
public static int ECS=0x7f09003b;
public static int SC=0x7f09003c;
public static int SCE=0x7f09003d;
public static int account=0x7f090052;
public static int back=0x7f090070;
public static int btn_cancel=0x7f09003f;
public static int btn_isOK=0x7f090041;
public static int camera_mask=0x7f090084;
public static int catalog_listview=0x7f09007a;
public static int catalog_window=0x7f090079;
public static int checkbox=0x7f090086;
public static int circle=0x7f090033;
public static int description=0x7f090055;
public static int enter=0x7f090056;
public static int evaluate_text=0x7f090064;
public static int follow=0x7f090057;
public static int func=0x7f090054;
public static int gridlist=0x7f090078;
public static int image=0x7f090075;
public static int image_layout=0x7f090080;
public static int index_total=0x7f090071;
public static int introduction=0x7f090063;
public static int iv_complete=0x7f090068;
public static int iv_no=0x7f09006b;
public static int iv_yes=0x7f09006a;
public static int layout_praise=0x7f090065;
public static int layout_praise_area=0x7f090067;
public static int mask=0x7f090085;
public static int name=0x7f090051;
public static int number=0x7f090081;
public static int origin_check=0x7f090074;
public static int pic_camera=0x7f090083;
public static int pic_type=0x7f09007b;
public static int pop_layout=0x7f09006d;
public static int portrait=0x7f090050;
public static int preview=0x7f09007e;
public static int preview_text=0x7f09007f;
public static int rc_actionbar=0x7f090000;
public static int rc_back=0x7f090001;
public static int rc_btn_cancel=0x7f090002;
public static int rc_btn_ok=0x7f090003;
public static int rc_chebox_pictrue=0x7f090043;
public static int rc_checkbox=0x7f090004;
public static int rc_content=0x7f090005;
public static int rc_conversation_content=0x7f090006;
public static int rc_conversation_msg_block=0x7f090007;
public static int rc_conversation_status=0x7f090008;
public static int rc_conversation_time=0x7f090009;
public static int rc_conversation_title=0x7f09000a;
public static int rc_cs_msg=0x7f090047;
public static int rc_cs_stars=0x7f090045;
public static int rc_cs_yes_no=0x7f090046;
public static int rc_emoji_item=0x7f090048;
public static int rc_ext=0x7f09008e;
public static int rc_fragment=0x7f09000b;
public static int rc_frame=0x7f09000c;
public static int rc_icon=0x7f09000d;
public static int rc_img=0x7f09000e;
public static int rc_indicator=0x7f09005e;
public static int rc_input=0x7f09004b;
public static int rc_input_custom_menu=0x7f09008c;
public static int rc_input_extension=0x7f09000f;
public static int rc_input_main=0x7f090010;
public static int rc_input_menu=0x7f09008a;
public static int rc_input_switch=0x7f090011;
public static int rc_item0=0x7f090012;
public static int rc_item1=0x7f090013;
public static int rc_item2=0x7f090014;
public static int rc_item3=0x7f090015;
public static int rc_item4=0x7f090016;
public static int rc_item5=0x7f090017;
public static int rc_item6=0x7f090018;
public static int rc_item7=0x7f090019;
public static int rc_item8=0x7f09001a;
public static int rc_item9=0x7f09001b;
public static int rc_item_conversation=0x7f09001c;
public static int rc_layout=0x7f09001d;
public static int rc_left=0x7f09001e;
public static int rc_list=0x7f09001f;
public static int rc_logo=0x7f090020;
public static int rc_menu_item_text=0x7f090061;
public static int rc_menu_line=0x7f090062;
public static int rc_menu_switch=0x7f090088;
public static int rc_message_send_failed=0x7f090021;
public static int rc_msg=0x7f090022;
public static int rc_new=0x7f090023;
public static int rc_new_message_count=0x7f09004d;
public static int rc_new_message_number=0x7f09004e;
public static int rc_pager=0x7f090024;
public static int rc_pager_fragment=0x7f09003e;
public static int rc_photoView=0x7f09004a;
public static int rc_plugins=0x7f09008d;
public static int rc_portrait=0x7f090025;
public static int rc_portrait_right=0x7f090026;
public static int rc_progress=0x7f090027;
public static int rc_read_receipt=0x7f090028;
public static int rc_right=0x7f090029;
public static int rc_search_btn=0x7f09005a;
public static int rc_search_ed=0x7f090059;
public static int rc_search_list=0x7f09005b;
public static int rc_send=0x7f09002a;
public static int rc_sent_status=0x7f09002b;
public static int rc_setting_item=0x7f09005c;
public static int rc_status_bar=0x7f090049;
public static int rc_switcher=0x7f090087;
public static int rc_switcher1=0x7f090089;
public static int rc_switcher2=0x7f09008b;
public static int rc_time=0x7f09002c;
public static int rc_title=0x7f09002d;
public static int rc_title_layout=0x7f09002e;
public static int rc_txt=0x7f09002f;
public static int rc_unread_message=0x7f090030;
public static int rc_unread_message_count=0x7f09004c;
public static int rc_unread_message_icon=0x7f09005f;
public static int rc_unread_message_icon_right=0x7f090060;
public static int rc_unread_message_right=0x7f090031;
public static int rc_view_pager=0x7f09005d;
public static int rc_voice_unread=0x7f09006c;
public static int rc_warning=0x7f090032;
public static int rc_webview=0x7f090044;
public static int rel_group_intro=0x7f090053;
public static int select_check=0x7f090077;
public static int selected=0x7f090082;
public static int send=0x7f090072;
public static int show_pictrue=0x7f090040;
public static int shownumber=0x7f090042;
public static int square=0x7f090034;
public static int text=0x7f090076;
public static int toolbar_bottom=0x7f090073;
public static int toolbar_top=0x7f09006f;
public static int tv_line=0x7f090066;
public static int tv_prompt=0x7f090069;
public static int type_image=0x7f09007d;
public static int type_text=0x7f09007c;
public static int unfollow=0x7f090058;
public static int viewpager=0x7f09004f;
public static int volume_animation=0x7f09008f;
public static int whole_layout=0x7f09006e;
}
public static final class integer {
public static int rc_audio_encoding_bit_rate=0x7f0a0000;
public static int rc_chatroom_first_pull_message_count=0x7f0a0001;
public static int rc_custom_service_evaluation_interval=0x7f0a0002;
public static int rc_image_quality=0x7f0a0003;
public static int rc_image_size=0x7f0a0004;
}
public static final class layout {
public static int rc_ac_albums=0x7f030000;
public static int rc_ac_camera=0x7f030001;
public static int rc_ac_picture_pager=0x7f030002;
public static int rc_ac_selected_pictrue=0x7f030003;
public static int rc_ac_webview=0x7f030004;
public static int rc_cs_alert_human_evaluation=0x7f030005;
public static int rc_cs_alert_robot_evaluation=0x7f030006;
public static int rc_cs_alert_warning=0x7f030007;
public static int rc_emoji_gridview=0x7f030008;
public static int rc_emoji_item=0x7f030009;
public static int rc_fr_conversation=0x7f03000a;
public static int rc_fr_conversation_member_list=0x7f03000b;
public static int rc_fr_conversationlist=0x7f03000c;
public static int rc_fr_dialog_alter=0x7f03000d;
public static int rc_fr_image=0x7f03000e;
public static int rc_fr_messageinput=0x7f03000f;
public static int rc_fr_messagelist=0x7f030010;
public static int rc_fr_photo=0x7f030011;
public static int rc_fr_public_service_inf=0x7f030012;
public static int rc_fr_public_service_search=0x7f030013;
public static int rc_fr_public_service_sub_list=0x7f030014;
public static int rc_fragment_base_setting=0x7f030015;
public static int rc_input_pager_layout=0x7f030016;
public static int rc_item_app_service_conversation=0x7f030017;
public static int rc_item_base_conversation=0x7f030018;
public static int rc_item_conversation=0x7f030019;
public static int rc_item_conversation_member=0x7f03001a;
public static int rc_item_discussion_conversation=0x7f03001b;
public static int rc_item_discussion_notification_message=0x7f03001c;
public static int rc_item_group_conversation=0x7f03001d;
public static int rc_item_image_message=0x7f03001e;
public static int rc_item_information_notification_message=0x7f03001f;
public static int rc_item_location_message=0x7f030020;
public static int rc_item_message=0x7f030021;
public static int rc_item_preview_fragment=0x7f030022;
public static int rc_item_progress=0x7f030023;
public static int rc_item_public_service_conversation=0x7f030024;
public static int rc_item_public_service_input_menu=0x7f030025;
public static int rc_item_public_service_input_menu_item=0x7f030026;
public static int rc_item_public_service_input_menus=0x7f030027;
public static int rc_item_public_service_list=0x7f030028;
public static int rc_item_public_service_message=0x7f030029;
public static int rc_item_public_service_multi_rich_content_message=0x7f03002a;
public static int rc_item_public_service_rich_content_message=0x7f03002b;
public static int rc_item_public_service_search=0x7f03002c;
public static int rc_item_rich_content_message=0x7f03002d;
public static int rc_item_system_conversation=0x7f03002e;
public static int rc_item_text_message=0x7f03002f;
public static int rc_item_text_message_evaluate=0x7f030030;
public static int rc_item_voice_message=0x7f030031;
public static int rc_pic_popup_window=0x7f030032;
public static int rc_picprev_activity=0x7f030033;
public static int rc_picsel_activity=0x7f030034;
public static int rc_picsel_catalog_listview=0x7f030035;
public static int rc_picsel_grid_camera=0x7f030036;
public static int rc_picsel_grid_item=0x7f030037;
public static int rc_plugin_gridview=0x7f030038;
public static int rc_wi_block=0x7f030039;
public static int rc_wi_block_popup=0x7f03003a;
public static int rc_wi_input=0x7f03003b;
public static int rc_wi_notice=0x7f03003c;
public static int rc_wi_plugins=0x7f03003d;
public static int rc_wi_text_btn=0x7f03003e;
public static int rc_wi_txt_provider=0x7f03003f;
public static int rc_wi_vo_popup=0x7f030040;
public static int rc_wi_vo_provider=0x7f030041;
}
public static final class string {
public static int rc_called_accept=0x7f040000;
public static int rc_called_is_calling=0x7f040001;
public static int rc_called_not_accept=0x7f040002;
public static int rc_called_on_hook=0x7f040003;
public static int rc_cancel=0x7f040069;
public static int rc_confirm=0x7f04006a;
public static int rc_conversation_List_operation_failure=0x7f040004;
public static int rc_conversation_list_app_public_service=0x7f040005;
public static int rc_conversation_list_default_discussion_name=0x7f040006;
public static int rc_conversation_list_dialog_cancel_top=0x7f040007;
public static int rc_conversation_list_dialog_remove=0x7f040008;
public static int rc_conversation_list_dialog_set_top=0x7f040009;
public static int rc_conversation_list_empty_prompt=0x7f04000a;
public static int rc_conversation_list_my_chatroom=0x7f04000b;
public static int rc_conversation_list_my_customer_service=0x7f04000c;
public static int rc_conversation_list_my_discussion=0x7f04000d;
public static int rc_conversation_list_my_group=0x7f04000e;
public static int rc_conversation_list_my_private_conversation=0x7f04000f;
public static int rc_conversation_list_not_connected=0x7f040010;
public static int rc_conversation_list_popup_cancel_top=0x7f040011;
public static int rc_conversation_list_popup_set_top=0x7f040012;
public static int rc_conversation_list_public_service=0x7f040013;
public static int rc_conversation_list_system_conversation=0x7f040014;
public static int rc_cs_cancel=0x7f04006b;
public static int rc_cs_evaluate_human=0x7f04006c;
public static int rc_cs_evaluate_robot=0x7f04006d;
public static int rc_cs_submit=0x7f04006e;
public static int rc_dialog_cancel=0x7f040015;
public static int rc_dialog_item_message_copy=0x7f040016;
public static int rc_dialog_item_message_delete=0x7f040017;
public static int rc_dialog_ok=0x7f040018;
public static int rc_discussion_nt_msg_for_add=0x7f040019;
public static int rc_discussion_nt_msg_for_added=0x7f04001a;
public static int rc_discussion_nt_msg_for_exit=0x7f04001b;
public static int rc_discussion_nt_msg_for_is_open_invite_close=0x7f04001c;
public static int rc_discussion_nt_msg_for_is_open_invite_open=0x7f04001d;
public static int rc_discussion_nt_msg_for_removed=0x7f04001e;
public static int rc_discussion_nt_msg_for_rename=0x7f04001f;
public static int rc_discussion_nt_msg_for_who_removed=0x7f040020;
public static int rc_discussion_nt_msg_for_you=0x7f040021;
public static int rc_exit_calling=0x7f040022;
public static int rc_file_not_exist=0x7f040023;
public static int rc_forbidden_in_chatroom=0x7f040024;
public static int rc_image_default_saved_path=0x7f04006f;
public static int rc_info_forbidden_to_talk=0x7f040025;
public static int rc_info_not_in_chatroom=0x7f040026;
public static int rc_info_not_in_discussion=0x7f040027;
public static int rc_info_not_in_group=0x7f040028;
public static int rc_init_failed=0x7f040029;
public static int rc_input_send=0x7f04002a;
public static int rc_input_voice=0x7f04002b;
public static int rc_join_chatroom_failure=0x7f040070;
public static int rc_kicked_from_chatroom=0x7f04002c;
public static int rc_message_content_draft=0x7f04002d;
public static int rc_message_content_image=0x7f04002e;
public static int rc_message_content_location=0x7f04002f;
public static int rc_message_content_rich_text=0x7f040030;
public static int rc_message_content_voice=0x7f040031;
public static int rc_message_unknown=0x7f040032;
public static int rc_message_unread_count=0x7f040033;
public static int rc_name=0x7f040034;
public static int rc_network_error=0x7f040035;
public static int rc_network_exception=0x7f040036;
public static int rc_network_is_busy=0x7f040037;
public static int rc_notice_connecting=0x7f040038;
public static int rc_notice_create_discussion=0x7f040039;
public static int rc_notice_create_discussion_fail=0x7f04003a;
public static int rc_notice_data_is_loading=0x7f04003b;
public static int rc_notice_disconnect=0x7f04003c;
public static int rc_notice_download_fail=0x7f04003d;
public static int rc_notice_enter_chatroom=0x7f04003e;
public static int rc_notice_input_conversation_error=0x7f04003f;
public static int rc_notice_load_data_fail=0x7f040040;
public static int rc_notice_network_unavailable=0x7f040041;
public static int rc_notice_select_one_picture_at_last=0x7f040042;
public static int rc_notice_tick=0x7f040043;
public static int rc_notification_new_msg=0x7f040044;
public static int rc_notification_new_plural_msg=0x7f040045;
public static int rc_notification_ticker_text=0x7f040046;
public static int rc_permission_camera=0x7f040071;
public static int rc_permission_grant_needed=0x7f040072;
public static int rc_permission_microphone=0x7f040073;
public static int rc_permission_microphone_and_camera=0x7f040074;
public static int rc_picprev_origin=0x7f040075;
public static int rc_picprev_origin_size=0x7f040076;
public static int rc_picprev_select=0x7f040077;
public static int rc_picsel_catalog_allpic=0x7f040078;
public static int rc_picsel_catalog_number=0x7f040079;
public static int rc_picsel_pictype=0x7f04007a;
public static int rc_picsel_selected_max=0x7f04007b;
public static int rc_picsel_take_picture=0x7f04007c;
public static int rc_picsel_toolbar=0x7f04007d;
public static int rc_picsel_toolbar_preview=0x7f04007e;
public static int rc_picsel_toolbar_preview_num=0x7f04007f;
public static int rc_picsel_toolbar_send=0x7f040080;
public static int rc_picsel_toolbar_send_num=0x7f040081;
public static int rc_plugins_camera=0x7f040047;
public static int rc_plugins_image=0x7f040048;
public static int rc_plugins_location=0x7f040049;
public static int rc_plugins_voip=0x7f04004a;
public static int rc_pub_service_info_account=0x7f04004b;
public static int rc_pub_service_info_description=0x7f04004c;
public static int rc_pub_service_info_enter=0x7f04004d;
public static int rc_pub_service_info_follow=0x7f04004e;
public static int rc_pub_service_info_unfollow=0x7f04004f;
public static int rc_quit_custom_service=0x7f040050;
public static int rc_read_all=0x7f040051;
public static int rc_rejected_by_blacklist_prompt=0x7f040052;
public static int rc_save_picture=0x7f040082;
public static int rc_save_picture_at=0x7f040083;
public static int rc_send_format=0x7f040053;
public static int rc_setting_clear_msg_fail=0x7f040054;
public static int rc_setting_clear_msg_name=0x7f040055;
public static int rc_setting_clear_msg_prompt=0x7f040056;
public static int rc_setting_clear_msg_success=0x7f040057;
public static int rc_setting_conversation_notify=0x7f040058;
public static int rc_setting_conversation_notify_fail=0x7f040059;
public static int rc_setting_get_conversation_notify_fail=0x7f04005a;
public static int rc_setting_name=0x7f04005b;
public static int rc_setting_set_top=0x7f04005c;
public static int rc_setting_set_top_fail=0x7f04005d;
public static int rc_src_file_not_found=0x7f040084;
public static int rc_voice_cancel=0x7f04005e;
public static int rc_voice_dialog_cancel_send=0x7f04005f;
public static int rc_voice_dialog_swipe=0x7f040060;
public static int rc_voice_dialog_time_short=0x7f040061;
public static int rc_voice_failure=0x7f040062;
public static int rc_voice_rec=0x7f040063;
public static int rc_voice_short=0x7f040064;
public static int rc_voip_cpu_error=0x7f040065;
public static int rc_waiting=0x7f040066;
public static int rc_yes=0x7f040067;
public static int rc_yesterday_format=0x7f040068;
}
public static final class style {
public static int RCTheme=0x7f0b0000;
public static int RCTheme_Message_RichContent_TextView=0x7f0b0001;
public static int RCTheme_Message_TextView=0x7f0b0002;
public static int RCTheme_Message_Username_TextView=0x7f0b0003;
public static int RCTheme_Notification=0x7f0b0004;
public static int RCTheme_TextView=0x7f0b0005;
public static int RCTheme_TextView_Large=0x7f0b0006;
public static int RCTheme_TextView_Large_Inverse=0x7f0b0007;
public static int RCTheme_TextView_Medium=0x7f0b0008;
public static int RCTheme_TextView_New=0x7f0b0009;
public static int RCTheme_TextView_Small=0x7f0b000a;
public static int RcDialog=0x7f0b000b;
public static int horizontal_light_thin_divider=0x7f0b000c;
public static int vertical_light_thin_divider=0x7f0b000d;
}
public static final class styleable {
/** Attributes that can be used with a AsyncImageView.
<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 #AsyncImageView_RCCornerRadius io.rong.imkit:RCCornerRadius}</code></td><td></td></tr>
<tr><td><code>{@link #AsyncImageView_RCDefDrawable io.rong.imkit:RCDefDrawable}</code></td><td></td></tr>
<tr><td><code>{@link #AsyncImageView_RCMask io.rong.imkit:RCMask}</code></td><td></td></tr>
<tr><td><code>{@link #AsyncImageView_RCMinShortSideSize io.rong.imkit:RCMinShortSideSize}</code></td><td></td></tr>
<tr><td><code>{@link #AsyncImageView_RCShape io.rong.imkit:RCShape}</code></td><td></td></tr>
</table>
@see #AsyncImageView_RCCornerRadius
@see #AsyncImageView_RCDefDrawable
@see #AsyncImageView_RCMask
@see #AsyncImageView_RCMinShortSideSize
@see #AsyncImageView_RCShape
*/
public static final int[] AsyncImageView = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004
};
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCCornerRadius}
attribute's value can be found in the {@link #AsyncImageView} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<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 io.rong.imkit:RCCornerRadius
*/
public static int AsyncImageView_RCCornerRadius = 1;
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCDefDrawable}
attribute's value can be found in the {@link #AsyncImageView} 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 io.rong.imkit:RCDefDrawable
*/
public static int AsyncImageView_RCDefDrawable = 4;
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCMask}
attribute's value can be found in the {@link #AsyncImageView} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<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 io.rong.imkit:RCMask
*/
public static int AsyncImageView_RCMask = 2;
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCMinShortSideSize}
attribute's value can be found in the {@link #AsyncImageView} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<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 io.rong.imkit:RCMinShortSideSize
*/
public static int AsyncImageView_RCMinShortSideSize = 0;
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCShape}
attribute's value can be found in the {@link #AsyncImageView} 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>square</code></td><td>0</td><td></td></tr>
<tr><td><code>circle</code></td><td>1</td><td></td></tr>
</table>
@attr name io.rong.imkit:RCShape
*/
public static int AsyncImageView_RCShape = 3;
/** Attributes that can be used with a InputView.
<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 #InputView_RCStyle io.rong.imkit:RCStyle}</code></td><td></td></tr>
</table>
@see #InputView_RCStyle
*/
public static final int[] InputView = {
0x7f010005
};
/**
<p>This symbol is the offset where the {@link io.rong.imkit.R.attr#RCStyle}
attribute's value can be found in the {@link #InputView} array.
<p>Must be one 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>SCE</code></td><td>0x123</td><td></td></tr>
<tr><td><code>CES</code></td><td>0x231</td><td></td></tr>
<tr><td><code>ECS</code></td><td>0x321</td><td></td></tr>
<tr><td><code>CSE</code></td><td>0x213</td><td></td></tr>
<tr><td><code>SC</code></td><td>0x120</td><td></td></tr>
<tr><td><code>CS</code></td><td>0x21</td><td></td></tr>
<tr><td><code>EC</code></td><td>0x320</td><td></td></tr>
<tr><td><code>CE</code></td><td>0x023</td><td></td></tr>
<tr><td><code>C</code></td><td>0x020</td><td></td></tr>
</table>
@attr name io.rong.imkit:RCStyle
*/
public static int InputView_RCStyle = 0;
};
}
| [
"qqq2830@163.com"
] | qqq2830@163.com |
dd8581e57a01f0cd8940c7d3f287ec7e9dc80cfb | 1d26343455c94ebb9d0c5333f826ace1d470e970 | /SWT/BASICS/Generics(Bottle)/Generics(bottle)/src/Bottle.java | 2b174aa4dcbf374d499a88dd245dfafeb00f912f | [] | no_license | Laschoking/Bingo | dad47c65d8a8828b96eddb1ba73c1219af3ac2ea | 8a4dfc2b063e1f1c990db1b3d4058077d1579498 | refs/heads/master | 2020-03-27T00:26:56.889805 | 2018-09-17T13:47:15 | 2018-09-17T13:47:15 | 145,623,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java |
public class Bottle <T>{
private T content;
private boolean fillStatus = false;
public Bottle() {}
public boolean isEmpty() {
return !fillStatus;
}
public void fill(T content) {
this.content = content;
if (fillStatus == true) throw new IllegalStateException();
else fillStatus = true;
}
public T empty(){
if (fillStatus == false) throw new IllegalStateException("Fehler in empty");
else fillStatus = false;
return content;
}
}
| [
"knut.berling@gmx.de"
] | knut.berling@gmx.de |
ea5f37853784fc8db604ed9a2d09be75aa9d1ede | 9e2962186dae3467ed220d10e500081b239428ae | /myblog/src/test/java/com/regisprojects/myblog/myblog/MyblogApplicationTests.java | 023470714e5087495bb225e6925062ff4549dc95 | [] | no_license | regisPatrick/NetBeansProjects | a227de47b364445f630dee2fcc506c02dd05395d | cb24b978e3e8c1c01ea477d723b10e116e188faa | refs/heads/master | 2022-06-24T20:50:07.472400 | 2021-04-12T01:01:02 | 2021-04-12T01:01:02 | 246,128,238 | 0 | 0 | null | 2022-06-21T03:46:57 | 2020-03-09T19:50:41 | HTML | UTF-8 | Java | false | false | 223 | java | package com.regisprojects.myblog.myblog;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MyblogApplicationTests {
@Test
void contextLoads() {
}
}
| [
"regis86@hotmail.com"
] | regis86@hotmail.com |
929ae6a596819d64ee91ecf00fc52a7e6f29c6dd | 3845c2c2b60f749de4f84b79f94ca9724bdd91d6 | /Stock_Prediction_Module/src/kr/ac/jbnu/sql/stock/persistance/DBConnect.java | bc9bb00f20887a8d3adbfea369c644829bf12802 | [] | no_license | carpediem0212/Stock_Prediction | 3b1546d9af953073db3c0af9895216b4b07b4692 | 281c93d31ef5818fdcf295f8f06711b253117fb4 | refs/heads/master | 2021-04-26T22:14:30.395224 | 2018-03-06T10:25:10 | 2018-03-06T10:25:10 | 124,041,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,014 | java | package kr.ac.jbnu.sql.stock.persistance;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import kr.ac.jbnu.sql.stock.Constants;
public class DBConnect {
private static DBConnect connectInstance = null;
private Connection conn;
private String jdbc_driver = Constants.JDBC_DRIVER;
private String jdbc_url = Constants.JDBC_URL;
private DBConnect() {
}
public static DBConnect getDBInstance() {
if (connectInstance == null) {
connectInstance = new DBConnect();
}
return connectInstance;
}
public void connect() {
try {
Class.forName(jdbc_driver);
conn = DriverManager.getConnection(jdbc_url, Constants.DB_USER, Constants.DB_PASSWORD);
} catch (Exception e) {
e.printStackTrace();
}
}
public void disconnect() {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public Connection getConnection() {
return conn;
}
}
| [
"gooodin1991@gmail.com"
] | gooodin1991@gmail.com |
288132b861f0146585df07a804096b4d0270245b | 55355e79b62a2f1a7b07162f3dd131ca852d8adf | /src/main/java/utils/CollectionUtils.java | 5c9f9c6891bdb1f1870c3fc89cabbbd77317161c | [] | no_license | dragon1672/Java-2-Lab | e39840542d7ba76fb453c0b74a9d948f8bea3efe | 2159744cc488c8293ab05d3e6c201b6edd899f18 | refs/heads/master | 2021-01-21T13:33:29.078312 | 2015-06-12T16:01:51 | 2015-06-12T16:01:51 | 35,436,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,692 | java | package utils;
import utils.FunctionInterfaces.Functions.Function2;
import utils.Predicates.Predicate;
import java.util.*;
/**
* Created by Anthony on 1/20/2015.
*/
@SuppressWarnings("unused")
public class CollectionUtils {
//region Helper Classes =====================================================================================================
public interface Selector<IN, OUT> {
OUT Select(IN obj);
}
public interface AggregateFunction<T> extends Function2<T,T,T> {
@Override
T Invoke(T toBuild, T current);
}
//endregion
//region Where calls ========================================================================================================
public static <T> Iterable<T> filter(Iterable<T> elements, Predicate<? super T> theTest) {
return filter(elements, theTest, obj -> obj);
}
public static <T, SelectType> Iterable<T> filter(Iterable<T> elements, Predicate<SelectType> theTest, Selector<? super T, SelectType> selector) {
return () -> new Iterator<T>() {
final Iterator<T> back = elements.iterator();
Object next = null;
@Override
public boolean hasNext() {
while (next == null) {
T tmp;
if (back.hasNext()) {
if (theTest.Invoke(selector.Select(tmp = back.next()))) {
next = tmp;
}
} else {
break;
}
}
return next != null;
}
@SuppressWarnings("unchecked")
@Override
public T next() {
T tmp = (T)next;
next = null;
return tmp;
}
};
}
//endregion
public static <T> int count(Iterable<T> collection) {
int ret = 0;
for (T ignored : collection) ret++;
return ret;
}
@SuppressWarnings("LoopStatementThatDoesntLoop")
public static <T> boolean isEmpty(Iterable<T> collection) {
for (T ignored : collection) return false;
return true;
}
/**
* Returns a collection in reverse order
* Not Lazy
* @param collection collection to iterate backwards on
* @param <T> collection type
* @return handle to move over list backwards
*/
public static <T> Iterable<T> reverse(Iterable<T> collection) {
LinkedList<T> reversed = new LinkedList<>();
for(T elem : collection) {
reversed.addFirst(elem);
}
return reversed;
}
/**
* Returns a collection in reverse order
* @param collection collection to iterate backwards on
* @param <T> collection type
* @return handle to move over list backwards
*/
public static <T> Iterable<T> reverse(List<T> collection) {
return () -> new Iterator<T>() {
final List<T> back = collection;
int index = collection.size()-1;
@Override
public boolean hasNext() {
return index >= 0;
}
@Override
public T next() {
return back.get(index--);
}
};
}
/**
* Returns a collection in reverse order
* @param collection collection to iterate backwards on
* @param <T> collection type
* @return handle to move over list backwards
*/
@SafeVarargs
public static <T> Iterable<T> reverse(T ... collection) {
return () -> new Iterator<T>() {
final T[] back = collection;
int index = collection.length-1;
@Override
public boolean hasNext() {
return index >= 0;
}
@Override
public T next() {
return back[index--];
}
};
}
//region FirstOrDefault =====================================================================================================
@SuppressWarnings("LoopStatementThatDoesntLoop")
public static <T> T firstOrDefault(Iterable<T> collection) {
for (T t : collection) return t;
return null;
}
@SafeVarargs
public static <T> T firstOrDefault(T... collection) {
return firstOrDefault(toIterable(collection));
}
public static <T> T firstOrDefault(Iterable<T> collection, Predicate<T> condition) {
return firstOrDefault(filter(collection, condition));
}
public static <T> T firstOrDefault(T[] collection, Predicate<T> condition) {
return firstOrDefault(toIterable(collection), condition);
}
//endregion
//region Transform Type =====================================================================================================
@SafeVarargs
public static <T> List<T> toList(T... collection) {
return toList(toIterable(collection));
}
public static <T> List<T> toList(Iterable<T> collection) {
if(collection instanceof List) {
return (List<T>)collection;
}
List<T> ret = new ArrayList<>();
for (T t : collection) ret.add(t);
return ret;
}
@SafeVarargs
public static <T> Set<T> toSet(T... collection) {
return toSet(toIterable(collection));
}
public static <T> Set<T> toSet(Iterable<T> collection) {
Set<T> ret = new HashSet<>();
if(collection instanceof Set) {
return (Set<T>)collection;
}
for (T elem : collection) {
if (!ret.contains(elem)) {
ret.add(elem);
}
}
return ret;
}
@SuppressWarnings("SpellCheckingInspection")
@SafeVarargs
public static <T> Iterable<T> toIterable(T... prams) {
return () -> new Iterator<T>() {
final T[] backingData = prams;
int index = 0;
@Override
public boolean hasNext() {
return index < backingData.length;
}
@Override
public T next() {
return backingData[index++];
}
};
}
/**
* Joins collections together
* Will iterate in the same order they are passed in
* @param collections
* @param <T> type of collection
* @return hook to iterate over all the collections
*/
@SafeVarargs
public static <T> Iterable<T> join(Iterable<T> ... collections) {
return selectMany(toIterable(collections));
}
public static <T> Iterable<T> selectMany(Iterable<Iterable<T>> collection) {
return () -> new Iterator<T>() {
final Iterator<Iterator<T>> backingData = select(collection, Iterable::iterator).iterator();
Iterator<T> current = null;
@Override
public boolean hasNext() {
if(current != null && current.hasNext()) return true;
while((current == null || !current.hasNext()) && backingData.hasNext()) {
current = backingData.next();
}
return (current != null && current.hasNext());
}
@Override
public T next() {
return current.next();
}
};
}
@SuppressWarnings("SpellCheckingInspection")
public static <T> Iterable<T> emptyIterable() {
return toIterable();
}
//endregion
public static <T, OUT> Iterable<OUT> select(Iterable<T> collection, Selector<? super T, OUT> selector) {
return () -> new Iterator<OUT>() {
final Iterator<T> backing = collection.iterator();
@Override
public boolean hasNext() {
return backing.hasNext();
}
@Override
public OUT next() {
return selector.Select(backing.next());
}
};
}
/**
*
* @param collection
* @param aggregator
* @param <T>
* @return
*/
public static <T> T aggregate(Iterable<T> collection, T seed, AggregateFunction<T> aggregator) {
T aggregated = seed;
for(T current : collection) {
aggregated = aggregator.Invoke(aggregated,current);
}
return aggregated;
}
//region SubIndexing ========================================================================================================
public static <T> Iterable<T> subCollection(Iterable<T> collection, int startingIndex) {
return subCollection(collection, startingIndex,Integer.MAX_VALUE);
}
public static <T> Iterable<T> subCollection(Iterable<T> collection, int startingIndex, int length) {
return () -> new Iterator<T>() {
final Iterator<T> backbone = collection.iterator();
int index = 0;
@Override
public boolean hasNext() {
while(backbone.hasNext() // still stuff left
&& index < startingIndex // before start
&& index > startingIndex + length) { // haven't gone over the end
backbone.next(); // trash
index++;
}
return backbone.hasNext();
}
@Override
public T next() {
return backbone.next();
}
};
}
public static <T> Iterable<T> subCollection(List<T> collection, int startingIndex) {
if(startingIndex == 0) return collection;
return subCollection(collection, startingIndex,Integer.MAX_VALUE);
}
public static <T> Iterable<T> subCollection(List<T> collection, int startingIndex, int length) {
if (startingIndex == 0 && collection.size() <= length) return collection;
return () -> new Iterator<T>() {
final List<T> backbone = collection;
int index = startingIndex;
@Override
public boolean hasNext() {
return index < backbone.size() && index < startingIndex + length;
}
@Override
public T next() {
return backbone.get(index++);
}
};
}
public static <T> Iterable<T> subCollection(T[] collection, int startingIndex) {
if(startingIndex == 0) return toIterable(collection);
return subCollection(collection, startingIndex,Integer.MAX_VALUE);
}
public static <T> Iterable<T> subCollection(T[] collection, int startingIndex, int length) {
if(startingIndex == 0 && collection.length <= length) return toIterable(collection);
return () -> new Iterator<T>() {
final T[] backbone = collection;
int index = startingIndex;
@Override
public boolean hasNext() {
return index < backbone.length && index < startingIndex + length;
}
@Override
public T next() {
return backbone[index++];
}
};
}
//endregion //*/
public static <T> boolean anyMatch(Iterable<T> collection, Predicate<? super T> theTest) {
for(T t : collection) if(theTest.Invoke(t)) return true;
return false;
}
public static <T> boolean allMatch(Iterable<T> collection, Predicate<? super T> theTest) {
for(T t : collection) if(!theTest.Invoke(t)) return true;
return false;
}
public static <T> boolean noneMatch(Iterable<T> collection, Predicate<? super T> theTest) {
for(T t : collection) if(theTest.Invoke(t)) return false;
return true;
}
} | [
"dragon1672@gmail.com"
] | dragon1672@gmail.com |
eedcaaaf2961142f155a5f32db8c0bffce8b4798 | b9ee27e085a8784987363578805a87037b632844 | /app/src/main/java/com/example/quotify/Adapter/CategoryAdapter.java | cf452fce1d09cf69666dd2fa2b24fbe246e05580 | [] | no_license | MilanVadhel/Quotes-Application | 3d79b10d3c6c69c0baaeca1fb529ecfcbd295a0d | 237f8a62e6cc32ef8f85ed52a17881dd89e15332 | refs/heads/master | 2020-12-30T05:53:28.631050 | 2020-06-05T06:51:17 | 2020-06-05T06:51:17 | 238,882,714 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,362 | java | package com.example.quotify.Adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.quotify.CaptionActivity;
import com.example.quotify.Model.Category;
import com.example.quotify.R;
import com.google.firebase.messaging.FirebaseMessaging;
import com.squareup.picasso.Picasso;
import java.security.acl.LastOwnerException;
import java.util.ArrayList;
import java.util.Collection;
public class CategoryAdapter extends RecyclerView.Adapter<CategoryAdapter.CategoryViewholder> implements Filterable
{
Context context;
ArrayList<Category> categoryArrayList;
ArrayList<Category> categoryArrayListAll;
public CategoryAdapter(Context context, ArrayList<Category> categoryArrayList) {
this.context = context;
this.categoryArrayList = categoryArrayList;
categoryArrayListAll=new ArrayList<>(categoryArrayList);
}
@NonNull
@Override
public CategoryViewholder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view= LayoutInflater.from(context).inflate(R.layout.category_item,parent,false);
return new CategoryViewholder(view);
}
@Override
public void onBindViewHolder(@NonNull CategoryViewholder holder, final int position) {
holder.cname.setText(categoryArrayList.get(position).getCname());
Picasso.with(context).load(categoryArrayList.get(position).getImg()).into(holder.cimg);
holder.card_view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(context, CaptionActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
String categoryName=categoryArrayList.get(position).getCname();
intent.putExtra("CNAME",categoryName);
context.startActivity(intent);
}
});
holder.heart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
FirebaseMessaging.getInstance().subscribeToTopic(categoryArrayList.get(position).getCname());
}
});
}
@Override
public int getItemCount() {
return categoryArrayList.size();
}
Filter filter=new Filter() {
@Override
protected FilterResults performFiltering(CharSequence charSequence) {
ArrayList<Category> filteredList=new ArrayList<>();
if(charSequence.toString().isEmpty())
{
filteredList.addAll(categoryArrayListAll);
}
else
{
for(Category category:categoryArrayList)
{
if(category.getCname().toLowerCase().contains(charSequence.toString().toLowerCase()))
{
filteredList.add(category);
}
}
}
FilterResults filterResults=new FilterResults();
filterResults.values=filteredList;
return filterResults;
}
@Override
protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
categoryArrayList.clear();
categoryArrayList.addAll((Collection<? extends Category>) filterResults.values);
notifyDataSetChanged();
}
};
@Override
public Filter getFilter() {
return filter;
}
public class CategoryViewholder extends RecyclerView.ViewHolder {
TextView cname;
ImageView cimg,heart;
CardView card_view;
public CategoryViewholder(@NonNull View itemView) {
super(itemView);
card_view=itemView.findViewById(R.id.cardView);
cname=itemView.findViewById(R.id.categoryName);
cimg=itemView.findViewById(R.id.categoryImg);
heart=itemView.findViewById(R.id.heartBtn);
}
}
}
| [
"vadhelmilan.07@gmail.com"
] | vadhelmilan.07@gmail.com |
d111a09f03d935c98dfe9eb53d97943f2153e47c | bbecb81fe0106194ca6173e2a65178c6a7925250 | /GetPostGroupF/app/src/test/java/g/vanthanhbk/getpostgroupf/ExampleUnitTest.java | fc247426fdb09dd41fc848d64bd1c69fe2ebe9de | [] | no_license | VanThanh1812/view_design | 4fd8653c20ed276780e4a5906e0bc2dd1f4be7e5 | 0e9c7533b34837a1e4c43377cd44c2d2588dadf8 | refs/heads/master | 2020-12-24T11:24:50.455885 | 2016-11-08T01:34:25 | 2016-11-08T01:34:25 | 73,033,422 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package g.vanthanhbk.getpostgroupf;
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);
}
} | [
"phanvanthanh.mrt@gmail.com"
] | phanvanthanh.mrt@gmail.com |
532d06249483b8acc490cf2f95aca99a75193b6b | e830de2981f0aa2ec32fb57edebcd76ae792c965 | /src/main/java/dz/elit/clinique/repository/CliniqueRepository.java | aaa80accd12e390433575be93ff59de0daad2d01 | [] | no_license | hayadi/clinique-manager | a4dc9283618b3e2dc08c60babbc553aa90561f2d | 7560753b4d684f829ad8ff46580f2e78a86be99d | refs/heads/master | 2022-12-25T06:59:11.996328 | 2019-10-09T14:00:35 | 2019-10-09T14:00:35 | 213,931,072 | 0 | 0 | null | 2022-12-16T05:06:14 | 2019-10-09T13:49:14 | Java | UTF-8 | Java | false | false | 1,120 | java | package dz.elit.clinique.repository;
import dz.elit.clinique.domain.Clinique;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.*;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
/**
* Spring Data repository for the Clinique entity.
*/
@Repository
public interface CliniqueRepository extends JpaRepository<Clinique, Long> {
@Query(value = "select distinct clinique from Clinique clinique left join fetch clinique.medecins",
countQuery = "select count(distinct clinique) from Clinique clinique")
Page<Clinique> findAllWithEagerRelationships(Pageable pageable);
@Query("select distinct clinique from Clinique clinique left join fetch clinique.medecins")
List<Clinique> findAllWithEagerRelationships();
@Query("select clinique from Clinique clinique left join fetch clinique.medecins where clinique.id =:id")
Optional<Clinique> findOneWithEagerRelationships(@Param("id") Long id);
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
3e8d4bc362b549d9ee93c8f51a2aece88e27d756 | 4143ffc6a4fb807ddc44c96d4afde6db24a4957c | /app/src/main/java/com/goku/sample/adapter/ProductAdapter.java | 917cdf2bbc574878610379dfd2f57a068713d190 | [] | no_license | pxson001/Android-LoadMore | c88c31821481907f884337506efde45212f1eb56 | ef826333154838d2eddb92bf0c8effa1a3826c34 | refs/heads/master | 2021-01-10T23:07:54.140121 | 2016-10-11T16:35:41 | 2016-10-11T16:35:41 | 70,613,513 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,625 | java | package com.goku.sample.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.goku.loadmore.R;
import com.goku.sample.model.Product;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Trang Pham on 10/7/2016.
*/
public class ProductAdapter extends BaseAdapter {
private List<Product> productList;
private Context context;
public ProductAdapter(Context context, List<Product> productList) {
this.context = context;
this.productList = productList;
}
public void update(List<Product> productList, boolean isLoadmore) {
this.productList = productList;
notifyDataSetChanged();
}
@Override
public int getCount() {
return productList.size();
}
@Override
public Product getItem(int position) {
return productList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
ViewHolder viewHolder;
Product product = productList.get(position);
if (view == null) {
view = LayoutInflater.from(context).inflate(R.layout.item_product, parent, false);
viewHolder = new ViewHolder(view);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) view.getTag();
}
viewHolder.productImageView.setImageResource(R.drawable.placeholder);
if (product.getImageProduct().size() > 0) {
String url = product.getImageProduct().get(0);
Glide.with(context).load(url)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.fitCenter()
.placeholder(R.drawable.placeholder)
.error(R.drawable.placeholder)
.into(viewHolder.productImageView);
}
viewHolder.productTextView.setText(product.getName());
return view;
}
static class ViewHolder {
@BindView(R.id.product_imageview)
ImageView productImageView;
@BindView(R.id.product_textview)
TextView productTextView;
public ViewHolder(View view) {
ButterKnife.bind(this, view);
}
}
}
| [
"pxson.001@gmail.com"
] | pxson.001@gmail.com |
c521253fcfacddafa7c21f2a18570d20cd1c7e83 | cf9e810e9c1b4fbf86f5012b56f0740f8e434063 | /app/src/main/java/com/example/zieng/c9asteroids/Asteroid.java | f680be333a9468fa92c7e7abc4e3bd7d4f60716a | [] | no_license | shollynoob/android-asteroids | 1fc4d903df04ac29ec4587f7e73e483a5b797db9 | 86c55ca2d566359084afbdfe72ffeed114ec6372 | refs/heads/master | 2021-01-16T19:07:46.178754 | 2015-11-16T08:44:09 | 2015-11-16T08:44:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,145 | java | package com.example.zieng.c9asteroids;
import android.graphics.PointF;
import java.util.Random;
/**
* Created by zieng on 10/18/15.
*/
public class Asteroid extends GameObject
{
PointF [] points;
CollisionPackage cp;
public Asteroid(int levelNumber,int mapWidth,int mapHeight)
{
super();
setType(Type.ASTEROID);
Random r = new Random();
setRotationRate(r.nextInt(50*levelNumber)+10);
setTravellingAngle(r.nextInt(360));
int x=r.nextInt(mapWidth - 100)+50;
int y=r.nextInt(mapHeight - 100) + 50;
if(x>250 && x<350) // avoid the asteroid spawn near the center
x+=100;
if(y>250 && y<350)
y+=100;
setWorldLocation(x,y);
setSpeed(r.nextInt(25*levelNumber)+1); //avoid the speed = 0
setMaxSpeed(140);
if(getSpeed()>getMaxSpeed())
setSpeed(getMaxSpeed());
generatePoints(); // call the parent setVertices , define random asteroid shape
//initialize the collision package
cp = new CollisionPackage(points,getWorldLocation(),25,getFacingAngle());
}
public void update(float fps)
{
setxVelocity((float)(getSpeed()*Math.cos(Math.toRadians(getTravellingAngle() + 90))));
setyVelocity((float)(getSpeed()*Math.sin(Math.toRadians(getTravellingAngle() + 90))));
move(fps);
//update the collision package
cp.facingAngle = getFacingAngle();
cp.worldLocation = getWorldLocation();
}
public void generatePoints()
{
points = new PointF[7];
Random r = new Random();
int i;
//First a point roughly centre below 0
points[0]=new PointF();
i=r.nextInt(10)+1;
if(i%2==0)
i=-i;
points[0].x=i;
i=-(r.nextInt(20)+5);
points[0].y=i;
//now a point below centre but to the right and up a bit
points[1]=new PointF();
i=r.nextInt(14)+11;
points[1].x=i;
i=-(r.nextInt(12)+1);
points[1].y=i;
//above 0 to the right
points[2]=new PointF();
i=r.nextInt(14)+11;
points[2].x=i;
i=r.nextInt(12)+1;
points[2].y=i;
//roughly center above 0
points[3]=new PointF();
i=r.nextInt(10)+1;
if(i%2==0)
i=-i;
points[3].x=i;
i=(r.nextInt(20)+5);
points[3].y=i;
//left above 0
points[4] = new PointF();
i=-(r.nextInt(14)+11);
points[4].x = i;
i=r.nextInt(12)+1;
points[4].y=i;
//left below 0
points[5] =new PointF();
i=-(r.nextInt(14)+11);
points[5].x =i;
i=-(r.nextInt(12)+1);
points[5].y=i;
// the seventh point is used for crossing number algorithm to collision test
points[6] = new PointF();
points[6].x = points[0].x;
points[6].y = points[0].y;
float [] asteroidVertices = new float[]{
points[0].x,points[0].y,0,
points[1].x,points[1].y,0,
points[1].x,points[1].y,0,
points[2].x,points[2].y,0,
points[2].x,points[2].y,0,
points[3].x,points[3].y,0,
points[3].x,points[3].y,0,
points[4].x,points[4].y,0,
points[4].x,points[4].y,0,
points[5].x,points[5].y,0,
points[5].x,points[5].y,0,
points[0].x,points[0].y,0,
};
setVertices(asteroidVertices);
}
public void bounce()
{
//reverse the travelling angle
if(getTravellingAngle() >= 180)
setTravellingAngle(getTravellingAngle()-180);
else
setTravellingAngle(getTravellingAngle()+180);
//reverse the velocity for occasionally they get stuck
setWorldLocation(getWorldLocation().x - getxVelocity() / 3, getWorldLocation().y - getyVelocity() / 3);
setSpeed(getSpeed() * 1.1f); // speed up 10%
if(getSpeed() > getMaxSpeed())
setSpeed(getMaxSpeed());
}
}
| [
"lijiebug@gmail.com"
] | lijiebug@gmail.com |
e4c6c9136da662821b36a0e3d7465f717431de49 | f98ca2fdbaf3374a5955eb82dfe782ac655b0f73 | /simple-security-config/src/main/java/com/wis/security/encoder/UpperCaseEncryptEncoder.java | 2f27d70a6f9297ac53f066c0f629d7afe0b6f3eb | [
"Apache-2.0"
] | permissive | liubo777/spring-boot-wis | 11c076d0cd46f877500eefc7662aa245782e5062 | 50bf6a38d505f0abf8f7cf4eda92079a51b942bb | refs/heads/master | 2022-06-24T01:14:36.262201 | 2020-02-22T15:25:55 | 2020-02-22T15:25:55 | 222,838,743 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,019 | java | package com.wis.security.encoder;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* RSA方式加密和验证
* 如果有嵌套方式,则表示先用嵌套的处理器进行加密,最后用RSA方式加密,
* 解密时要将原数据使用嵌套的处理器加密后,与RSA解密后的字符串进行比较
* @author wh
*/
public class UpperCaseEncryptEncoder implements PasswordEncoder{
private PasswordEncoder encoder=new NoneEncryptEncoder();
public UpperCaseEncryptEncoder(PasswordEncoder encoder){
this.encoder=encoder;
}
public UpperCaseEncryptEncoder() {
this(new NoneEncryptEncoder());
}
public String encode(CharSequence rawPassword) {
return encoder.encode(rawPassword).toUpperCase();
}
public boolean matches(CharSequence rawPassword, String encodedPassword) {
//先对原始数据进行加密,再对数据进行md5
String pass1=rawPassword.toString().toUpperCase();
String pass2=""+encodedPassword;
return encoder.matches(pass1, pass2);
}
}
| [
"535797316@qq.com"
] | 535797316@qq.com |
fd302c6420b2c067091f870d6fb4463c1519ed2b | 7c0c65c6bfc29822153f2d33ea7f5739f700bc31 | /app/src/main/java/com/example/bloodsoul/flowingview/sweepview/SweepDrawer.java | 3c30ca3465316b64e817c5077f02fbf5126d75ae | [] | no_license | Bloodsoul121/FlowView | 1324bcfce2c6487b676e37274d40c678b7cb9a80 | 4136a01ec57d03819a7590d7d45c84943a250f2d | refs/heads/master | 2021-08-16T09:00:47.233160 | 2017-11-19T13:13:50 | 2017-11-19T13:13:50 | 111,281,275 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,340 | java | package com.example.bloodsoul.flowingview.sweepview;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
/**
* 绘制小圆的扩散动画
* @author sheng
*/
public class SweepDrawer extends BaseSplashDrawer {
private Point[] mCircles;
private ValueAnimator mAnimator;
private float mCurrentRate;
private View view;
private IOnAnimEndListener listener;
private final float START_RADIUS = 8;
private int centerX,centerY;
public SweepDrawer(final View view, final IOnAnimEndListener listener) {
this.view = view;
this.listener = listener;
mCircles = new Point[]{new Point(getX(0), getY(0), START_RADIUS,
Color.parseColor("#FF59DABC"),
Color.parseColor("#FFE2FFF8")), new Point(getX(1), getY(1), START_RADIUS,
Color.parseColor("#FF8BEAB4"),
Color.parseColor("#FFECFCF3"))
, new Point(getX(2), getY(2), START_RADIUS,
Color.parseColor("#FFFACD74"),
Color.parseColor("#FFFAF6EE")), new Point(getX(3), getY(3), START_RADIUS,
Color.parseColor("#FFFFB0B0"),
Color.parseColor("#FFFDF8F8"))
, new Point(getX(4), getY(4), START_RADIUS,
Color.parseColor("#FF6BDEF5"),
Color.parseColor("#FFE7F7FA")), new Point(getX(5), getY(5), START_RADIUS,
Color.parseColor("#FFCA61E4"),
Color.parseColor("#FFF3E2F7"))};
}
private float getX(int i){
double angle = i * (float) (2 * Math.PI / 6);
float cx = (float) (getMetricsWidth(view.getContext())/2 + 32 * Math.cos(angle));
return cx;
}
private float getY(int i){
double angle = i * (float) (2 * Math.PI / 6);
float cy = (float) (getMetricsHeight(view.getContext())/2 + 32 * Math.sin(angle));
return cy;
}
public void setDistanceXYR(int i,float x,float y,float r){
for (int j = 0; j < mCircles.length; j++) {
Point p = mCircles[i];
p.setDistanceX(x-p.x);
p.setDistanceY(y-p.y);
p.setDesR(r);
}
}
public void startAnim(){
mAnimator = ValueAnimator.ofFloat(0, 1f);
mAnimator.setDuration(500);
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
// 获取当前的距离百分比
mCurrentRate = (float) animation.getAnimatedValue();
// 提醒View重新绘制
view.invalidate();
}
});
mAnimator.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
listener.onAnimEnd();
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
// 开始计算
mAnimator.start();
}
@Override
public void draw(Canvas canvas, Paint paint) {
for (int i = 0; i < mCircles.length; i++) {
Point p = mCircles[i];
paint.setColor(p.color);
p.x = getX(i)+p.distanceX*mCurrentRate;
p.y = getY(i)+p.distanceY*mCurrentRate;
p.r = START_RADIUS+p.disR*mCurrentRate;
canvas.drawCircle(p.x, p.y, p.r, paint);
}
}
@Override
public void setCenterXY(int x, int y) {
centerX = x;
centerY = y;
}
public void cancelAnimator() {
mAnimator.cancel();
mAnimator = null;
}
public static int getMetricsWidth(Context context)
{
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.widthPixels;
}
public static int getMetricsHeight(Context context)
{
DisplayMetrics dm = context.getResources().getDisplayMetrics();
return dm.heightPixels;
}
public class Point{
public float x;
public float y;
public float r;
public int color;
public float distanceY;
public float distanceX;
public float desR;
public float disR;
public int startColor;
public int toColor;
public Point(float x, float y, float r,int color,int toColor) {
this.x = x;
this.y = y;
this.r = r;
this.color = this.startColor = color;
this.toColor = toColor;
}
public void setX(float x) {
this.x = x;
}
public void setY(float y) {
this.y = y;
}
public void setR(float r) {
this.r = r;
}
public void setColor(int color) {
this.color = color;
}
public void setDistanceY(float distanceY) {
this.distanceY = distanceY;
}
public void setDistanceX(float distanceX) {
this.distanceX = distanceX;
}
public void setDesR(float desR) {
this.desR = desR;
disR = desR-START_RADIUS;
}
public void setToColor(int toColor) {
this.toColor = toColor;
}
}
public Point[] getCircles() {
return mCircles;
}
} | [
"812566160@qq.com"
] | 812566160@qq.com |
04915450a922f2dc938ef2703a466ad28b9b7400 | 966bae4f5e7a1e6e43cf1e8bc0e52f620abf10ec | /javarush/test/level13/lesson02/task05/Solution.java | 040b80e522c4ee14472e79818476d827ca51560b | [] | no_license | Daniil1178/javarush | 8207a585af929f229e4b11488f88cc1e393cecac | 3cd21b8753099fe1c9c26cd139c3dab25c8a4a79 | refs/heads/master | 2021-01-02T22:44:57.173454 | 2015-01-30T15:42:57 | 2015-01-30T15:42:57 | 30,077,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.javarush.test.level13.lesson02.task05;
/* 4 ошибки
Исправь 4 ошибки в программе, чтобы она компилировалась.
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
System.out.println(new Hobbie().HOBBIE.toString());
System.out.println(new Hobbie().toString());
}
interface Desire
{
public String toString();
}
interface Dream
{
public static Hobbie HOBBIE = new Hobbie();
}
static class Hobbie implements Desire,Dream
{
public static int INDEX = 1;
@Override
public String toString()
{
INDEX++;
return "" + INDEX;
}
}
}
| [
"daniil1178@gmail.com"
] | daniil1178@gmail.com |
bf479f8042d36969d5c3e71d93d7e2a1b954b5d8 | b8937ea343d8bed172175189ed5781efcf22bf19 | /src/main/java/com/sioo/util/RabbitMQProducerUtil2.java | c6ba0d6525949e7907c37961fccf4839952d8116 | [] | no_license | diamimi/hy_middle_services | 2ad7a74211e174e3b2e05b685bfc6e399d352c0e | 0ee209c4972f036ceb1e9179788007741272c646 | refs/heads/master | 2021-01-21T20:38:20.971201 | 2018-07-10T10:01:43 | 2018-07-10T10:01:43 | 92,262,093 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,612 | java | package com.sioo.util;
import com.alibaba.fastjson.JSON;
import com.caucho.hessian.io.HessianInput;
import com.caucho.hessian.io.HessianOutput;
import com.rabbitmq.client.AMQP.BasicProperties;
import com.rabbitmq.client.AMQP.Queue.DeclareOk;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.QueueingConsumer;
import com.sioo.cache.ConfigCache;
import com.sioo.log.LogInfo;
import org.apache.log4j.Logger;
import org.springframework.amqp.AmqpIllegalStateException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.amqp.support.converter.SimpleMessageConverter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeoutException;
public class RabbitMQProducerUtil2 {
private static Logger log = Logger.getLogger(RabbitMQProducerUtil2.class);
// 连接配置
private ConnectionFactory factory = null;
private Connection connection = null;
private Channel channel = null;
private DeclareOk declareOk;
public static RabbitMQProducerUtil2 producerUtil;
private volatile MessageConverter messageConverter = new SimpleMessageConverter();
// config
private final static int DEFAULT_PORT = 5672;
private final static String DEFAULT_USERNAME = "sioo";
private final static String DEFAULT_PASSWORD = "sioo58657686";
// private final static int DEFAULT_PROCESS_THREAD_NUM =
// Runtime.getRuntime().availableProcessors() * 2;
// private static final int PREFETCH_SIZE = 1;
private final static String DEFAULT_HOST = "127.0.0.1";
public static RabbitMQProducerUtil2 getProducerInstance() {
if (producerUtil != null) {
return producerUtil;
}else{
try {
producerUtil = new RabbitMQProducerUtil2();
} catch (Exception e) {
log.error("初始化RabbitMQ2失败,\r\n", e);
}
}
return producerUtil;
}
/**
* 发送
*
* @param queueName
* 队列名称
* @param obj
* 发送对象
* @param priority
* 优先级,最大10,最小为0,数值越大优先级越高
* @throws IOException
*/
public void send(String queueName, Object obj, int priority) {
try {
BasicProperties.Builder properties = new BasicProperties.Builder();
properties.priority(priority);
channel.basicPublish("", queueName, properties.build(), serialize(obj));
} catch (Exception e) {
LogInfo.getLog().errorAlert("放入RabbitMQ消息队列异常",
"[RabbitMQProducerUtil.send(" + queueName + "," + JSON.toJSONString(obj) + "," + priority + ") Exception]" + LogInfo.getTrace(e));
}
}
public void send(String queueName, Object obj) throws IOException {
try {
channel.basicPublish("", queueName, com.rabbitmq.client.MessageProperties.PERSISTENT_TEXT_PLAIN, serialize(obj));
} catch (Exception e) {
LogInfo.getLog().errorAlert("放入RabbitMQ消息队列异常", "[RabbitMQProducerUtil.send(" + queueName + "," + JSON.toJSONString(obj) + ") Exception]" + LogInfo.getTrace(e));
}
}
/**
* 初始化
*
* @throws IOException
* @throws TimeoutException
*/
private RabbitMQProducerUtil2() throws IOException, TimeoutException {
try {
ConfigCache configCache = ConfigCache.getInstance();
if(configCache.getServerType()==0){
factory = new ConnectionFactory();
factory.setHost(configCache.getRabbitHost1() == null ? DEFAULT_HOST : configCache.getRabbitHost1());
factory.setPort(configCache.getRabbitPort1() <= 0 ? DEFAULT_PORT : configCache.getRabbitPort1());
factory.setUsername(configCache.getRabbitUserName1() == null ? DEFAULT_USERNAME : configCache.getRabbitUserName1());
factory.setPassword(configCache.getRabbitPassword1() == null ? DEFAULT_PASSWORD : configCache.getRabbitPassword1());
factory.setAutomaticRecoveryEnabled(true);
factory.setRequestedHeartbeat(5);// 心跳时间s
factory.setNetworkRecoveryInterval(6000);// 网络重连失败重试间隔时间ms
connection = factory.newConnection();
channel = connection.createChannel();
}else if(configCache.getServerType()==1){
factory = new ConnectionFactory();
factory.setHost(configCache.getRabbitHost0() == null ? DEFAULT_HOST : configCache.getRabbitHost0());
factory.setPort(configCache.getRabbitPort0() <= 0 ? DEFAULT_PORT : configCache.getRabbitPort0());
factory.setUsername(configCache.getRabbitUserName0() == null ? DEFAULT_USERNAME : configCache.getRabbitUserName0());
factory.setPassword(configCache.getRabbitPassword0() == null ? DEFAULT_PASSWORD : configCache.getRabbitPassword0());
factory.setAutomaticRecoveryEnabled(true);
factory.setRequestedHeartbeat(5);// 心跳时间s
factory.setNetworkRecoveryInterval(6000);// 网络重连失败重试间隔时间ms
connection = factory.newConnection();
channel = connection.createChannel();
}
/* ConfigCache configCache = ConfigCache.getInstance();
// 初始化
factory = new ConnectionFactory();
factory.setHost(configCache.getRabbitHost() == null ? DEFAULT_HOST : configCache.getRabbitHost());
factory.setPort(configCache.getRabbitPort() <= 0 ? DEFAULT_PORT : configCache.getRabbitPort());
factory.setUsername(configCache.getRabbitUserName() == null ? DEFAULT_USERNAME : configCache.getRabbitUserName());
factory.setPassword(configCache.getRabbitPassword() == null ? DEFAULT_PASSWORD : configCache.getRabbitPassword());
factory.setAutomaticRecoveryEnabled(true);
factory.setRequestedHeartbeat(5);// 心跳时间s
factory.setNetworkRecoveryInterval(6000);// 网络重连失败重试间隔时间ms
connection = factory.newConnection();
channel = connection.createChannel();*/
} catch (Exception e) {
LogInfo.getLog().errorAlert("初始化RabbitMQ参数异常", "[RabbitMQProducerUtil() Exception]" + LogInfo.getTrace(e));
}
}
/**
* 单个获取
*
* @param queueName
* 队列名称
* @param exchangeName
* 交换器名称
* @return
*/
public Object getObj(String queueName) throws Exception {
try {
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-max-priority", 10);
channel.queueDeclare(queueName, true, false, false, args);
// 流量控制
channel.basicQos(1);
return receive(channel, queueName);
} catch (IOException e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取单个消息失败,IO异常。", "[RabbitMQProducerUtil.getObj(" + queueName + ") IOException]" + LogInfo.getTrace(e));
} catch (Exception e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取单个消息异常。", "[RabbitMQProducerUtil.getObj(" + queueName + ") Exception]" + LogInfo.getTrace(e));
}
return null;
}
/**
* 批量获取
*
* @param queueName
* 队列名称
* @param exchangeName
* 交换器名称
* @return
*/
public List<Object> getObjList(String queueName, int limit) {
List<Object> list = new ArrayList<Object>();
try {
Map<String, Object> args = new HashMap<String, Object>();
args.put("x-max-priority", 10);
channel.queueDeclare(queueName, true, false, false, args);
// 流量控制
channel.basicQos(1);
// 声明消费者
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queueName, false, consumer);
for (int i = 0; i < limit; i++) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
Object obj = deSerialize(delivery.getBody());
if (obj != null) {
list.add(obj);
channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); // 反馈给服务器表示收到信息
}
}
return list;
} catch (IOException e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取多个消息失败,IO异常。", "[RabbitMQProducerUtil.getObjList(" + queueName + "," + limit + ") IOException]" + LogInfo.getTrace(e));
} catch (Exception e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取多个消息异常。", "[RabbitMQProducerUtil.getObjList(" + queueName + "," + limit + ") Exception]" + LogInfo.getTrace(e));
}
return null;
}
public List<Object> getObjListNoPriority(String queueName, int limit) {
List<Object> list = new ArrayList<Object>();
try {
channel.queueDeclare(queueName, true, false, false, null);
// 流量控制
channel.basicQos(1);
// 声明消费者
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queueName, false, consumer);
for (int i = 0; i < limit; i++) {
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
Object obj = deSerialize(delivery.getBody());
if (obj != null) {
list.add(obj);
channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); // 反馈给服务器表示收到信息
}
}
return list;
} catch (IOException e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取多个带优先级消息失败,IO异常。",
"[RabbitMQProducerUtil.getObjListNoPriority(" + queueName + "," + limit + ") IOException]" + LogInfo.getTrace(e));
} catch (Exception e) {
LogInfo.getLog().errorAlert("从RabbitMQ获取多个带优先级消息异常。", "[RabbitMQProducerUtil.getObjListNoPriority(" + queueName + "," + limit + ") Exception]" + LogInfo.getTrace(e));
}
return null;
}
/**
* 获取队列长度
*
* @param queueName
* 队列名称
* @return
*/
public int getQueueListSize(String queueName) {
int count = 0;
try {
declareOk = channel.queueDeclare(queueName, false, false, false, null);
declareOk.getMessageCount();
} catch (IOException e) {
LogInfo.getLog().errorAlert("获取RabbitMQ消息队列大小异常。", "[RabbitMQProducerUtil.getQueueListSize(" + queueName + ") Exception]" + LogInfo.getTrace(e));
}
return count;
}
private Object receive(Channel channel, String queueName) throws Exception {
try {
// 声明消费者
QueueingConsumer consumer = new QueueingConsumer(channel);
channel.basicConsume(queueName, false, consumer);
while (true) {
// 等待队列推送消息
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
Object obj = deSerialize(delivery.getBody());
if (obj != null) {
channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); // 反馈给服务器表示收到信息
}
return obj;
}
} catch (Exception e) {
LogInfo.getLog().errorAlert("回复RabbitMQ消息队列消息异常。",
"[RabbitMQProducerUtil.receive(" + JSON.toJSONString(channel) + "," + queueName + ") Exception]" + LogInfo.getTrace(e));
}
return null;
}
public void close() {
try {
channel.close();
connection.close();
} catch (IOException e) {
LogInfo.getLog().errorAlert("关闭RabbitMQ连接失败,IO异常。", "[RabbitMQProducerUtil.close() IOException]" + LogInfo.getTrace(e));
} catch (TimeoutException e) {
LogInfo.getLog().errorAlert("关闭RabbitMQ连接失败,Timeout异常。", "[RabbitMQProducerUtil.close() Exception]" + LogInfo.getTrace(e));
}
}
public byte[] serialize(Object obj) throws IOException {
ByteArrayOutputStream baos = null;
HessianOutput output = null;
try {
baos = new ByteArrayOutputStream(1024);
output = new HessianOutput(baos);
output.startCall();
output.writeObject(obj);
output.completeCall();
} catch (final IOException ex) {
throw ex;
} finally {
if (output != null) {
try {
baos.close();
} catch (final IOException ex) {
LogInfo.getLog().errorAlert("序列化RabbitMQ消息异常。", "[RabbitMQProducerUtil.serialize() ByteArrayOutputStream.colse() IOException]" + LogInfo.getTrace(ex));
}
}
}
return baos != null ? baos.toByteArray() : null;
}
public Object deSerialize(byte[] in) {
Object obj = null;
ByteArrayInputStream bais = null;
HessianInput input = null;
try {
bais = new ByteArrayInputStream(in);
input = new HessianInput(bais);
input.startReply();
obj = input.readObject();
input.completeReply();
} catch (final IOException ex) {
LogInfo.getLog().errorAlert("反序列化RabbitMQ消息失败,IO异常。", "[RabbitMQProducerUtil.deSerialize() IOException]" + LogInfo.getTrace(ex));
} catch (final Throwable ex) {
LogInfo.getLog().errorAlert("反序列化RabbitMQ消息异常。", "[RabbitMQProducerUtil.deSerialize() Throwable]" + LogInfo.getTrace(ex));
} finally {
if (input != null) {
try {
bais.close();
} catch (final IOException ex) {
log.error("[RabbitMQ] deSerialize ByteArrayInputStream close failed, IOException: " + ex.toString());
}
}
}
return obj;
}
protected Message convertMessageIfNecessary(final Object object) {
if (object instanceof Message) {
return (Message) object;
}
return getRequiredMessageConverter().toMessage(object, new MessageProperties());
}
private MessageConverter getRequiredMessageConverter() throws IllegalStateException {
MessageConverter converter = this.getMessageConverter();
if (converter == null) {
throw new AmqpIllegalStateException("No 'messageConverter' specified. Check configuration of RabbitTemplate.");
}
return converter;
}
public MessageConverter getMessageConverter() {
return messageConverter;
}
public Channel getChannel() {
return channel;
}
public void setChannel(Channel channel) {
this.channel = channel;
}
}
| [
"bigmheqi@sina.com"
] | bigmheqi@sina.com |
bf2a8aef0821c5f0482e111dc0ce344c777f12b8 | 4c93ad60e0caf75566df97f8982861dc99aa470e | /1202ch0603/src/main/java/com/kim/ch0603/Student.java | 2db84c2f7e703d88cd99a750df5b0b67bdd9c2e4 | [] | no_license | snowskyblue/SpringEx | 1fca622edc7a8a554bc345898edc7db1eb10ff5f | 94596e6659cbeb5b32ef60d7d340acff7a20a100 | refs/heads/master | 2022-12-22T19:58:10.917691 | 2020-02-07T08:45:50 | 2020-02-07T08:45:50 | 228,328,473 | 0 | 0 | null | 2022-12-16T01:01:08 | 2019-12-16T07:31:09 | Java | UTF-8 | Java | false | false | 369 | java | package com.kim.ch0603;
public class Student {
String name;
int age;
public Student(String name, int age) {
super();
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
| [
"juliakim0823@gmail.com"
] | juliakim0823@gmail.com |
71f698ffae3ed55a901635c9b48b3f1760565d5c | e7d0fdfa3120e1ee9b810f3be55b60e45e805f2b | /FSC/src/com/classes/controller/ProductModifyController.java | b9301e995745997e55b6ef5a5e9d7eb7bbd43133 | [] | no_license | Adriano-Amato/TecnologieSoftwareWeb | 999f521e2f6e90ae44b8c221c3fd00d24f2ffae9 | 63df8d0953d743121c65063878f772bbc22a2dde | refs/heads/main | 2023-05-09T09:43:50.273659 | 2021-05-31T19:55:03 | 2021-05-31T19:55:03 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 5,292 | java | package com.classes.controller;
import com.classes.model.bean.products.ImageBean;
import com.classes.model.bean.products.ProductBean;
import com.classes.model.dao.ImageModel;
import com.classes.model.dao.ProductModel;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Iterator;
public class ProductModifyController extends HttpServlet {
static String SAVE_DIR = "";
public void init() {
// Get the file location where it would be stored
SAVE_DIR = getServletConfig().getInitParameter("file-upload");
}
private static final String insertError = "Errori nei campi di input";
public ProductModifyController(){
super();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
/*UPLOAD CONTROLLER*/
String appPath = req.getServletContext().getRealPath("");
String savePath = appPath + File.separator + SAVE_DIR;
String filePath = null; //qui e' salvata l'immagine uploadata, poi bisogna inserirla nel DB
File f = null;
byte[] bytes = null;
File fileSaveDir = new File(savePath);
if (!fileSaveDir.exists()) {
fileSaveDir.mkdir();
}
for (Part part : req.getParts()) {
String fileName = extractFileName(part);
if (fileName != null && !fileName.equals("")) {
filePath = savePath + File.separator + fileName;
part.write(filePath);
f = new File(filePath);
bytes = Files.readAllBytes(f.toPath());
}
}
/**/
String oldProductId = req.getParameter("oldProd");
ProductModel pm = new ProductModel();
ImageModel im = new ImageModel();
ProductBean oldProduct = null;
ImageBean oldImage = null;
if (oldProductId != null ) {
try {
oldProduct = pm.doRetrieveByKey(oldProductId);
oldImage = im.doRetrieveByKey(Integer.toString(oldProduct.getCode()));
} catch (SQLException e1) {
e1.printStackTrace();
}
}
String nome = req.getParameter("nome");
String descrizione = req.getParameter("desc");
String prezzoStr = req.getParameter("prezzo");
String quantitaStr = req.getParameter("quantita");
int prezzo = Integer.parseInt(prezzoStr);
int quantita = Integer.parseInt(quantitaStr);
//Controllo null e RegEx
if ( nome != null || descrizione != null || prezzoStr != null || quantitaStr != null) {
if ( ( ! ( nome.matches("[A-Za-z]+$") && descrizione.matches("[A-Za-z ]+$") && prezzoStr.matches("^[0-9]+$") && quantitaStr.matches("^[0-9]+$")) ) || ( prezzo < 0 || quantita < 0 ) ) {
req.setAttribute("errorAoC", insertError);
req.getRequestDispatcher(req.getContextPath() + "/aOcProduct.jsp").forward(req, resp);
return;
}
}
else {
resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Errori nei parametri della richiesta!");
return;
}
if ( oldProduct != null ) { //MODIFICA PRODOTTO
if(filePath!=null){ //vuol dire che è stata uploadata una immagine
oldImage.setImage(bytes);
}
oldProduct.setDescription(descrizione);
oldProduct.setName(nome);
oldProduct.setPrice(prezzo);
oldProduct.setQuantity(quantita);
try {
pm.doUpdate(oldProduct);
im.doUpdate(oldImage);
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
else { //AGGIUNGI PRODOTTO
ProductBean newProduct = new ProductBean();
Collection<ProductBean> prodotti = null;
try {
prodotti = pm.doRetriveAll("codId");
} catch (SQLException e) {
e.printStackTrace();
}
/* Trovo il max codId fin'ora */
Iterator<?> iterator = prodotti.iterator();
int codMax = -1;
ProductBean appProd;
while (iterator.hasNext() ) {
appProd = (ProductBean) iterator.next();
if (appProd.getCode() > codMax )
codMax = appProd.getCode();
}
/*-----------------------------*/
ImageBean newImage = new ImageBean();
int newCodId = codMax + 1;
newImage.setCodId(newCodId);
newImage.setImage(bytes);
newProduct.setDescription(descrizione);
newProduct.setName(nome);
newProduct.setPrice(prezzo);
newProduct.setQuantity(quantita);
newProduct.setCode(newCodId);
try {
pm.doSave(newProduct);
im.doSave(newImage);
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
resp.sendRedirect("/ProductController");
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter out = resp.getWriter();
resp.setContentType("text/plain");
out.write("Error: GET method is used but POST method is required");
out.close();
}
private String extractFileName(Part part) {
// content-disposition: form-data; name="file"; filename="file.txt"
String contentDisp = part.getHeader("content-disposition");
String[] items = contentDisp.split(";");
for (String s : items) {
if (s.trim().startsWith("filename")) {
return s.substring(s.indexOf("=") + 2, s.length() - 1);
}
}
return "";
}
}
| [
"68477271+Demux23@users.noreply.github.com"
] | 68477271+Demux23@users.noreply.github.com |
b97c47ef21035f599b6d97a36ea2c14871b39091 | f7c55fb8644443d09e01b75540d8b6d234a189e8 | /app/src/main/java/com/test/keytotech/di/start/StartComponent.java | f286c6c0a6409cfa792df6de123bb360896a52ec | [] | no_license | AndriiRokobit/KeyToTech | 3be33ace6b386a6dac366147a8adb0e9a137ef1a | 67b9d90ab3672962dd6b3c05a2251cf670a2036a | refs/heads/master | 2020-07-03T11:34:17.103635 | 2019-08-12T08:45:48 | 2019-08-12T08:45:48 | 201,887,552 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package com.test.keytotech.di.start;
import com.test.keytotech.mvp.start.StartPresenter;
import dagger.Subcomponent;
@Subcomponent(modules = {StartModule.class})
public interface StartComponent {
StartPresenter provideStartPresenter();
}
| [
"andri.rokobit@gmail.com"
] | andri.rokobit@gmail.com |
969babc9c9b0cb1ff698dd3dc9dd31f9b5d1a76e | c5ca82622d155ca142cebe93b12882992e93b1f6 | /src/com/geocento/webapps/earthimages/emis/common/share/entities/ORDER_STATUS.java | 6670d72ab9d6c38dbe177f58f56efec8d6af5d16 | [] | no_license | leforthomas/EMIS | 8721a6c21ad418380e1f448322fa5c8c51e33fc0 | 32e58148eca1e18fd21aa583831891bc26d855b1 | refs/heads/master | 2020-05-17T08:54:22.044423 | 2019-04-29T20:45:24 | 2019-04-29T20:45:24 | 183,617,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 843 | java | package com.geocento.webapps.earthimages.emis.common.share.entities;
public enum ORDER_STATUS {
// user requested the products in the order
REQUESTED,
// supplier rejected the request
CANCELLED,
// supplier quoted the request
QUOTED,
// user rejected the quote
QUOTEREJECTED,
// user accepted and paid the quote
ACCEPTED,
// products are being generated
INPRODUCTION,
// failed to produce the order
FAILED,
// order has been completed and products are available
COMPLETED,
// order has been archived and products have been delivered and are not downloadable anymore
DELIVERED,
//The order has been closed or archived by the user, not possible to add more products
ARCHIVED
};
| [
"leforthomas@gmail.com"
] | leforthomas@gmail.com |
c1cd6afd2068dd6328edb9b2b4c342165a037fb6 | 2b53d9754066a8594f8a839589022893969abf36 | /src/main/java/mekanism/common/network/PacketUpdateTile.java | ed9ecdbdaed5171df6a289df9a3f8996fa86860d | [
"MIT"
] | permissive | Dolbaeobik/Mekanism | 6ccf298e336765144a6139ce72104b7a04a59aec | ce8ab6f5240f35f33bf1b3b8145ccaea5c1fde40 | refs/heads/master | 2022-04-25T07:04:47.641641 | 2020-04-23T16:24:31 | 2020-04-23T16:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,903 | java | package mekanism.common.network;
import java.util.function.Supplier;
import mekanism.common.Mekanism;
import mekanism.common.tile.base.TileEntityUpdateable;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.network.NetworkEvent.Context;
public class PacketUpdateTile {
private final CompoundNBT updateTag;
private final BlockPos pos;
public PacketUpdateTile(TileEntityUpdateable tile) {
this(tile.getPos(), tile.getReducedUpdateTag());
}
private PacketUpdateTile(BlockPos pos, CompoundNBT updateTag) {
this.pos = pos;
this.updateTag = updateTag;
}
public static void handle(PacketUpdateTile message, Supplier<Context> context) {
PlayerEntity player = BasePacketHandler.getPlayer(context);
if (player == null) {
return;
}
context.get().enqueueWork(() -> {
TileEntityUpdateable tile = MekanismUtils.getTileEntity(TileEntityUpdateable.class, player.world, message.pos, true);
if (tile == null) {
Mekanism.logger.warn("Update tile packet received for position: {} in world: {}, but no valid tile was found.", message.pos,
player.world.getDimension().getType().getRegistryName());
} else {
tile.handleUpdatePacket(message.updateTag);
}
});
context.get().setPacketHandled(true);
}
public static void encode(PacketUpdateTile pkt, PacketBuffer buf) {
buf.writeBlockPos(pkt.pos);
buf.writeCompoundTag(pkt.updateTag);
}
public static PacketUpdateTile decode(PacketBuffer buf) {
return new PacketUpdateTile(buf.readBlockPos(), buf.readCompoundTag());
}
} | [
"richard@freimer.com"
] | richard@freimer.com |
8ce41343e978258b580edfeecdde0930f345a8f6 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_722981e79886307cfd5b69b5eca866bc7762e333/Persistit/2_722981e79886307cfd5b69b5eca866bc7762e333_Persistit_t.java | 2cce0909640bd372ad385414a33f97b9b8982b80 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 82,349 | java | /*
* Copyright (c) 2004 Persistit Corporation. All Rights Reserved.
*
* The Java source code is the confidential and proprietary information
* of Persistit Corporation ("Confidential Information"). You shall
* not disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Persistit Corporation.
*
* PERSISTIT CORPORATION MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
* SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT
* NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
* A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. PERSISTIT CORPORATION SHALL
* NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
* MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/
package com.persistit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.ResourceBundle;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicBoolean;
import com.persistit.encoding.CoderManager;
import com.persistit.encoding.KeyCoder;
import com.persistit.encoding.ValueCoder;
import com.persistit.exception.LogInitializationException;
import com.persistit.exception.PersistitException;
import com.persistit.exception.PersistitIOException;
import com.persistit.exception.PropertiesNotFoundException;
import com.persistit.exception.ReadOnlyVolumeException;
import com.persistit.exception.VolumeAlreadyExistsException;
import com.persistit.exception.VolumeNotFoundException;
import com.persistit.logging.AbstractPersistitLogger;
import com.persistit.logging.DefaultPersistitLogger;
/**
* <p>
* Creates and manages the the runtime environment for a Persistit™
* database. To use <tt>Persistit</tt>, an application invokes one of the static
* {@link #initialize} methods to load a set of properties that govern
* Persistit's behavior, and to initialize its memory structures. When
* terminating, the application should invoke the static {@link #close} method
* to complete all database writes, close all files and relinquish all buffer
* memory.
* </p>
* <p>
* Once initialized, there is a single <tt>Persistit</tt> instance available
* from the {@link #getInstance} method. Various non-static methods are
* available on this instance. The {@link #close} method releases the
* <tt>Persistit</tt> instance, allowing its memory to be released.
* </p>
* <p>
* An application interacts with Persistit by creating {@link Exchange} objects
* and invoking their methods.
* </p>
* <p>
* During initialization this class optionally creates a small Swing UI
* containing various useful diagnostic views of internal state. To request this
* utility, include the command-line parameter
* <code>-Dcom.persistit.showgui=true</code>, or specify the property
* </code>showgui=true</code> in the properties file supplied to the
* {@link #initialize} method.
* </p>
*
* @version 1.1
*/
public class Persistit implements BuildConstants {
/**
* This version of Persistit
*/
public final static String VERSION = "Persistit JSA 2.1-20100512"
+ (Debug.ENABLED ? "-DEBUG" : "");
/**
* The internal version number
*/
public final static int BUILD_ID = 21001;
/**
* The copyright notice
*/
public final static String COPYRIGHT = "Copyright (c) 2004-2009 Persistit Corporation. All Rights Reserved.";
/**
* Determines whether multi-byte integers will be written in little- or
* big-endian format. This constant is <tt>true</tt> in all current builds.
*/
public final static boolean BIG_ENDIAN = true;
/**
* Prefix used to form the a system property name. For example, the property
* named <tt>pwjpath=xyz</tt> can also be specified as a system property on
* the command line with the option -Dcom.persistit.pwjpath=xyz.
*/
public final static String SYSTEM_PROPERTY_PREFIX = "com.persistit.";
/**
* Name of utility GUI class.
*/
private final static String PERSISTIT_GUI_CLASS_NAME = SYSTEM_PROPERTY_PREFIX
+ "ui.AdminUI";
/**
* Name of Open MBean class
*/
private final static String PERSISTIT_JMX_CLASS_NAME = SYSTEM_PROPERTY_PREFIX
+ "jmx.PersistitOpenMBean";
/**
* Default suffix for properties file name
*/
public final static String DEFAULT_PROPERTIES_FILE_SUFFIX = ".properties";
/**
* Default properties file name
*/
public final static String DEFAULT_CONFIG_FILE = "persistit.properties";
/**
* Default maximum time (in milliseconds) to allow for successful completion
* of an operation.
*/
static final long DEFAULT_TIMEOUT_VALUE = 30000; // Thirty seconds
/**
* Upper bound maximum time (in milliseconds) to allow for successful
* completion of an operation. This is the maximum timeout value you can
* specify for individual <tt>Exchange</tt>.
*/
static final long MAXIMUM_TIMEOUT_VALUE = 86400000; // One day
/**
* Property name by which name of properties file can be supplied.
*/
public final static String CONFIG_FILE_PROPERTY_NAME = "properties";
/**
* Property name prefix for specifying buffer size and count. The full
* property name should be one of "1024", "2048", "4096", "8192" or "16384"
* appended to this string, e.g., "buffer.count.8192".
*/
public final static String BUFFERS_PROPERTY_NAME = "buffer.count.";
/**
* Property name prefix for specifying Volumes. The full property name
* should be a unique ordinal number appended to this string, e.g.,
* "volume.1", "volume.2", etc.
*/
public final static String VOLUME_PROPERTY_PREFIX = "volume.";
/**
* Property name for specifying the file specification for the log.
*/
public final static String LOG_PATH_PROPERTY_NAME = "logpath";
/**
* Default path name for the log. Note, sequence suffix in the form .nnnnnn
* will be appended.
*/
public final static String DEFAULT_LOG_PATH = "persistit_log";
/**
* Property name for specifying the size of each prewrite journal, e.g.,
* "pwjsize=512K".
*/
public final static String LOG_SIZE_PROPERTY_NAME = "logsize";
/**
* Default System Volume Name
*/
public final static String DEFAULT_SYSTEM_VOLUME_NAME = "_system";
/**
* Property name for specifying the system volume name
*/
public final static String SYSTEM_VOLUME_PROPERTY = "sysvolume";
/**
* Default Transactions Volume Name
*/
public final static String DEFAULT_TXN_VOLUME_NAME = "_txn";
/**
* Property name for specifying the transaction volume name
*/
public final static String TXN_VOLUME_PROPERTY = "txnvolume";
/**
* Property name for specifing whether Persistit should display diagnostic
* messages. Property value must be "true" or "false".
*/
public final static String VERBOSE_PROPERTY = "verbose";
/**
* Property name for specifying whether Persistit should retry read
* operations that fail due to IOExceptions.
*/
public final static String READ_RETRY_PROPERTY = "readretry";
/**
* Property name for maximum length of time a Persistit operation will wait
* for I/O completion before throwing a TimeoutException.
*/
public final static String TIMEOUT_PROPERTY = "timeout";
/**
* Property name to specify package and/or class names of classes that must
* be serialized using standard Java serialization.
*/
public final static String SERIAL_OVERRIDE_PROPERTY = "serialOverride";
/**
* Property name to specify whether DefaultValueCoder should use a declared
* no-arg contructor within each class being deserialized. Unless specified
* as <tt>true</tt>, Serializable classes will be instantiated through
* platform-specific API calls.
*/
public final static String CONSTRUCTOR_OVERRIDE_PROPERTY = "constructorOverride";
/**
* Property name for specifying whether Persistit should attempt to launch a
* diagnostic utility for viewing internal state.
*/
public final static String SHOW_GUI_PROPERTY = "showgui";
/**
* Property name for log switches
*/
public final static String LOGGING_PROPERTIES = "logging";
/**
* Property name for log file name
*/
public final static String LOGFILE_PROPERTY = "logfile";
/**
* Property name for the optional RMI registry host name
*/
public final static String RMI_REGISTRY_HOST_PROPERTY = "rmihost";
/**
* Property name for the optional RMI registry port
*/
public final static String RMI_REGISTRY_PORT = "rmiport";
/**
* Property name for specifying the file specification for the journal file.
*/
public final static String JOURNAL_PATH = "jnlpath";
/**
* Property name for specifying whether Persistit should write fetch and
* traverse operations to the journal file.
*/
public final static String JOURNAL_FETCHES = "journalfetches";
/**
* Property name for enabling Persistit Open MBean for JMX
*/
public final static String JMX_PARAMS = "jmx";
/**
* Property name for pseudo-property "timestamp";
*/
public final static String TIMESTAMP_PROPERTY = "timestamp";
/**
* Maximum number of Exchanges that will be held in an internal pool.
*/
public final static int MAX_POOLED_EXCHANGES = 100;
/**
* Default environment name
*/
public final static String DEFAULT_ENVIRONMENT = "default";
/**
* New-Line character sequence
*/
public final static String NEW_LINE = System.getProperty("line.separator");
/**
* Minimal command line documentation
*/
private final static String[] USAGE = {
"java.persistit.Persistit [options] [property_file_name]", "",
" where flags are", " -g to show the Admin UI",
" -i to perform integrity checks on all volumes",
" -w to wait for the Admin UI to connect",
" -? or -help to show this help message", };
private final static long KILO = 1024;
private final static long MEGA = KILO * KILO;
private final static long GIGA = MEGA * KILO;
private final static long TERA = GIGA * KILO;
private final static long SHORT_DELAY = 500;
private final static long CLOSE_LOG_INTERVAL = 30000;
/**
* If a thread waits longer than this, apply throttle to slow down other
* threads.
*/
private static final long THROTTLE_THRESHOLD = 5000;
private AbstractPersistitLogger _logger;
/**
* Start time
*/
private final long _startTime = System.currentTimeMillis();
private final HashMap<Integer, BufferPool> _bufferPoolTable = new HashMap<Integer, BufferPool>();
private final ArrayList<Volume> _volumes = new ArrayList<Volume>();
private final HashMap<Long, Volume> _volumesById = new HashMap<Long, Volume>();
private Properties _properties = new Properties();
private AtomicBoolean _initialized = new AtomicBoolean();
private AtomicBoolean _closed = new AtomicBoolean();
private long _beginCloseTime;
private long _nextCloseTime;
private final LogBase _logBase = new LogBase(this);
private boolean _suspendShutdown;
private boolean _suspendUpdates;
private UtilControl _localGUI;
private CoderManager _coderManager;
private ClassIndex _classIndex = new ClassIndex(this);
private ThreadLocal<Transaction> _transactionThreadLocal = new ThreadLocal<Transaction>();
private ThreadLocal _waitingThreadLocal = new ThreadLocal();
private ThreadLocal _throttleThreadLocal = new ThreadLocal();
private ManagementImpl _management;
private final Journal _journal = new Journal(this);
private final LogManager _logManager = new LogManager(this);
private final TimestampAllocator _timestampAllocator = new TimestampAllocator();
private Stack _exchangePool = new Stack();
private boolean _readRetryEnabled;
private long _defaultTimeout;
private final SharedResource _transactionResourceA = new SharedResource(
this);
private final SharedResource _transactionResourceB = new SharedResource(
this);
private final LockManager _lockManager = new LockManager();
private static volatile long _globalThrottleCount;
private long _nextThrottleBumpTime;
private long _localThrottleCount;
private volatile Thread _shutdownHook;
/**
* <p>
* Initialize Persistit using properties supplied by the default properties
* file. The name of this file is supplied by the system property
* <tt>com.persistit.properties</tt>. If that property is not specified, the
* default file path is <tt>./persistit.properties</tt> in the current
* working directory. If Persistit has already been initialized, this method
* does nothing. This method is threadsafe; if multiple threads concurrently
* attempt to invoke this method, one of the threads will actually perform
* the initialization and the other threads will do nothing.
* </p>
* <p>
* Note that Persistit starts non-daemon threads that will keep a JVM from
* exiting until {@link #close} is invoked. This is to ensure that all
* pending updates are written before the JVM exit.
* </p>
*
* @return The singleton Persistit instance that has been created.
* @throws PersistitException
* @throws IOException
* @throws Exception
*/
public boolean initialize() throws PersistitException {
return initialize(getProperty(CONFIG_FILE_PROPERTY_NAME,
DEFAULT_CONFIG_FILE));
}
/**
* <p>
* Initialize Persistit using the supplied properties file path. If
* Persistit has already been initialized, this method does nothing. This
* method is threadsafe; if multiple threads concurrently attempt to invoke
* this method, one of the threads will actually perform the initialization
* and the other threads will do nothing.
* </p>
* <p>
* Note that Persistit starts non-daemon threads that will keep a JVM from
* exiting until {@link #close} is invoked. This is to ensure that all
* pending updates are written before the JVM exit.
* </p>
*
* @param propertyFileName
* The path to the properties file.
* @return The singleton Persistit instance that has been created.
* @throws PersistitException
* @throws IOException
*/
public boolean initialize(String propertyFileName)
throws PersistitException {
Properties properties = new Properties();
try {
if (propertyFileName.contains(DEFAULT_PROPERTIES_FILE_SUFFIX)
|| propertyFileName.contains(File.separator)) {
properties.load(new FileInputStream(propertyFileName));
} else {
ResourceBundle bundle = ResourceBundle
.getBundle(propertyFileName);
for (Enumeration e = bundle.getKeys(); e.hasMoreElements();) {
final String key = (String) e.nextElement();
properties.put(key, bundle.getString(key));
}
}
} catch (FileNotFoundException fnfe) {
// A friendlier exception when the properties file is not found.
throw new PropertiesNotFoundException(fnfe.getMessage());
} catch (IOException ioe) {
throw new PersistitIOException(ioe);
}
return initialize(properties);
}
/**
* Replaces substitution variables in a supplied string with values taken
* from the properties available to Persistit (see {@link getProperty}).
*
* @param text
* String in in which to make substitutions
* @param properties
* Properties containing substitution values
* @return
*/
String substituteProperties(String text, Properties properties, int depth) {
int p = text.indexOf("${");
while (p >= 0 && p < text.length()) {
p += 2;
int q = text.indexOf("}", p);
if (q > 0) {
String propertyName = text.substring(p, q);
if (Util.isValidName(propertyName)) {
// sanity check to prevent stack overflow
// due to infinite loop
if (depth > 20)
throw new IllegalArgumentException("property "
+ propertyName
+ " substitution cycle is too deep");
String propertyValue = getProperty(propertyName, depth + 1,
properties);
if (propertyValue == null)
propertyValue = "";
text = text.substring(0, p - 2) + propertyValue
+ text.substring(q + 1);
q += propertyValue.length() - (propertyName.length() + 3);
} else
break;
} else {
break;
}
p = text.indexOf("${");
}
return text;
}
public Properties getProperties() {
return _properties;
}
/**
* <p>
* Returns a property value, or <tt>null</tt> if there is no such property.
* The property is taken from one of the following sources:
* <ol>
* <li>A system property having a prefix of "com.persistit.". For example,
* the property named "pwjpath" can be supplied as the system property named
* com.persistit.pwjpath. (Note: if the security context does not permit
* access to system properties, then system properties are ignored.)</li>
* <li>The supplied Properties object, which was either passed to the
* {@link #initialize(Properties)} method, or was loaded from the file named
* in the {@link #initialize(String)} method.</li>
* <li>The pseudo-property name <tt>timestamp</tt>. The value is the current
* time formated by <tt>SimpleDateFormat</tt> using the pattern
* yyyyMMddHHmm. (This pseudo-property makes it easy to specify a unique log
* file name each time Persistit is initialized.</li>
* </ol>
* </p>
* If a property value contains a substitution variable in the form
* <tt>${<i>pppp</i>}</tt>, then this method attempts perform a
* substitution. To do so it recursively gets the value of a property named
* <tt><i>pppp</i></tt>, replaces the substring delimited by <tt>${</tt> and
* <tt>}</tt>, and then scans the resulting string for further substitution
* variables.
*
* @param propertyName
* The property name
* @return The resulting string
*/
public String getProperty(String propertyName) {
return getProperty(propertyName, null);
}
/**
* <p>
* Returns a property value, or a default value if there is no such
* property. The property is taken from one of the following sources:
* <ol>
* <li>A system property having a prefix of "com.persistit.". For example,
* the property named "pwjpath" can be supplied as the system property named
* com.persistit.pwjpath. (Note: if the security context does not permit
* access to system properties, then system properties are ignored.)</li>
* <li>The supplied Properties object, which was either passed to the
* {@link #initialize(Properties)} method, or was loaded from the file named
* in the {@link #initialize(String)} method.</li>
* <li>The pseudo-property name <tt>timestamp</tt>. The value is the current
* time formated by <tt>SimpleDateFormat</tt> using the pattern
* yyyyMMddHHmm. (This pseudo-property makes it easy to specify a unique log
* file name each time Persistit is initialized.</li>
* </ol>
* </p>
* If a property value contains a substitution variable in the form
* <tt>${<i>pppp</i>}</tt>, then this method attempts perform a
* substitution. To do so it recursively gets the value of a property named
* <tt><i>pppp</i></tt>, replaces the substring delimited by <tt>${</tt> and
* <tt>}</tt>, and then scans the resulting string for further substitution
* variables.
*
* @param propertyName
* The property name
* @param defaultValue
* The default value
* @return The resulting string
*/
public String getProperty(String propertyName, String defaultValue) {
String value = getProperty(propertyName, 0, _properties);
return value == null ? defaultValue : value;
}
private String getProperty(String propertyName, int depth,
Properties properties) {
String value = null;
value = getSystemProperty(SYSTEM_PROPERTY_PREFIX + propertyName);
if (value == null && properties != null) {
value = properties.getProperty(propertyName);
}
if (value == null && TIMESTAMP_PROPERTY.equals(propertyName)) {
value = (new SimpleDateFormat("yyyyMMddHHmm")).format(new Date());
}
if (value != null)
value = substituteProperties(value, properties, depth);
return value;
}
/**
* Sets a property value in the Persistit Properties map. If the specified
* value is null then an existing property of the specified name is removed.
*
* @param propertyName
* The property name
* @param value
* Value to set, or <tt>null<tt> to remove an existing property
*/
public void setProperty(final String propertyName, final String value) {
if (value == null) {
_properties.remove(propertyName);
} else {
_properties.setProperty(propertyName, value);
}
}
private String getSystemProperty(final String propertyName) {
return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty(propertyName);
}
});
}
/**
* <p>
* Initialize Persistit using the supplied <code>java.util.Properties</code>
* instance. Applications can use this method to supply computed Properties
* rather than reading them from a file. If Persistit has already been
* initialized, this method does nothing. This method is threadsafe; if
* multiple threads concurrently attempt to invoke this method, one of the
* threads will actually perform the initialization and the other threads
* will do nothing.
* </p>
* <p>
* Note that Persistit starts non-daemon threads that will keep a JVM from
* exiting until {@link #close} is invoked. This is to ensure that all
* pending updates are written before the JVM exit.
* </p>
*
* @param properties
* The Properties object from which to initilialize Persistit
* @return <tt>true</tt> if Persistit was actually initialized during this
* invocation of this method, or <tt>false</tt> if Persisit was
* already initialized.
*
* @throws PersistitException
* @throws IOException
*/
public boolean initialize(Properties properties) throws PersistitException {
boolean fullyInitialized = false;
try {
properties.putAll(_properties);
_properties = properties;
getPersistitLogger();
try {
_logBase.logstart();
} catch (Exception e) {
System.err.println("Persistit(tm) Logging is disabled due to "
+ e);
if (e.getMessage() != null && e.getMessage().length() > 0) {
System.err.println(e.getMessage());
}
e.printStackTrace();
}
String logSpecification = getProperty(LOGGING_PROPERTIES);
if (logSpecification != null) {
try {
_logBase.setLogEnabled(logSpecification,
AbstractPersistitLogger.INFO);
} catch (Exception e) {
throw new LogInitializationException(e);
}
}
StringBuffer sb = new StringBuffer();
int bufferSize = Buffer.MIN_BUFFER_SIZE;
while (bufferSize <= Buffer.MAX_BUFFER_SIZE) {
sb.setLength(0);
sb.append(BUFFERS_PROPERTY_NAME);
sb.append(bufferSize);
String propertyName = sb.toString();
int count = (int) getLongProperty(propertyName, -1,
BufferPool.MINIMUM_POOL_COUNT,
BufferPool.MAXIMUM_POOL_COUNT);
if (count != -1) {
if (_logBase.isLoggable(LogBase.LOG_INIT_ALLOCATE_BUFFERS)) {
_logBase.log(LogBase.LOG_INIT_ALLOCATE_BUFFERS, count,
bufferSize);
}
BufferPool pool = new BufferPool(count, bufferSize, this);
_bufferPoolTable.put(new Integer(bufferSize), pool);
}
bufferSize <<= 1;
}
String logPath = getProperty(LOG_PATH_PROPERTY_NAME,
DEFAULT_LOG_PATH);
int logSize = (int) getLongProperty(LOG_SIZE_PROPERTY_NAME,
LogManager.DEFAULT_LOG_SIZE, LogManager.MINIMUM_LOG_SIZE,
LogManager.MAXIMUM_LOG_SIZE);
_logManager.init(logPath, logSize);
for (Enumeration enumeration = properties.propertyNames(); enumeration
.hasMoreElements();) {
String key = (String) enumeration.nextElement();
if (key.startsWith(VOLUME_PROPERTY_PREFIX)) {
boolean isOne = true;
try {
Integer.parseInt(key.substring(VOLUME_PROPERTY_PREFIX
.length()));
} catch (NumberFormatException nfe) {
isOne = false;
}
if (isOne) {
VolumeSpecification volumeSpecification = new VolumeSpecification(
getProperty(key));
if (_logBase.isLoggable(LogBase.LOG_INIT_OPEN_VOLUME)) {
_logBase.log(LogBase.LOG_INIT_OPEN_VOLUME,
volumeSpecification.describe());
}
Volume.loadVolume(this, volumeSpecification);
}
}
}
String rmiHost = getProperty(RMI_REGISTRY_HOST_PROPERTY);
String rmiPort = getProperty(RMI_REGISTRY_PORT);
boolean enableJmx = getBooleanProperty(JMX_PARAMS, true);
_readRetryEnabled = getBooleanProperty(READ_RETRY_PROPERTY, true);
_defaultTimeout = getLongProperty(TIMEOUT_PROPERTY,
DEFAULT_TIMEOUT_VALUE, 0, MAXIMUM_TIMEOUT_VALUE);
if (rmiHost != null || rmiPort != null) {
ManagementImpl management = (ManagementImpl) getManagement();
management.register(rmiHost, rmiPort);
}
if (enableJmx) {
setupOpenMBean();
}
// Set up the parent CoderManager for this instance.
String serialOverridePatterns = getProperty(Persistit.SERIAL_OVERRIDE_PROPERTY);
DefaultCoderManager cm = new DefaultCoderManager(this,
serialOverridePatterns);
_coderManager = cm;
if (getBooleanProperty(SHOW_GUI_PROPERTY, false)) {
try {
setupGUI(true);
} catch (Exception e) {
// If we can't open the utility gui, well, tough.
}
}
//
// Now that all volumes are loaded and we have the PrewriteJournal
// cooking, recover or roll back any transactions that were
// pending at shutdown.
//
Transaction.recover(this);
flush();
setupJournal();
_initialized.set(true);
_closed.set(false);
if (_shutdownHook == null) {
_shutdownHook = new Thread(new Runnable() {
public void run() {
try {
close0(true, false);
getLogBase().log(LogBase.LOG_SHUTDOWN_HOOK);
} catch (PersistitException e) {
}
}
}, "ShutdownHook");
Runtime.getRuntime().addShutdownHook(_shutdownHook);
}
fullyInitialized = true;
} finally {
// clean up?? TODO
}
return fullyInitialized;
}
/**
* Perform any necessary recovery processing. This method is called each
* time Persistit starts up, but it only causes database modifications if
* there are uncommitted in the prewrite journal buffer.
*
* @param pwjPath
* @throws IOException
* @throws PersistitException
*/
void performRecoveryProcessing(String pwjPath) throws PersistitException {
// RecoveryPlan plan = new RecoveryPlan(this);
// try {
// plan.open(pwjPath);
// if (plan.isHealthy() && plan.hasUncommittedPages()) {
// if (_logBase.isLoggable(_logBase.LOG_INIT_RECOVER_BEGIN)) {
// _logBase.log(_logBase.LOG_INIT_RECOVER_BEGIN);
// }
//
// if (_logBase.isLoggable(_logBase.LOG_INIT_RECOVER_PLAN)) {
// _logBase.log(_logBase.LOG_INIT_RECOVER_PLAN, plan.dump());
// }
//
// plan.commit(false);
//
// if (_logBase.isLoggable(_logBase.LOG_INIT_RECOVER_END)) {
// _logBase.log(_logBase.LOG_INIT_RECOVER_END);
// }
// }
// } finally {
// plan.close();
// }
}
private void setupJournal() throws PersistitException {
String journalPath = getProperty(JOURNAL_PATH);
boolean journalFetches = getBooleanProperty(JOURNAL_FETCHES, false);
if (journalPath != null) {
_journal.setup(journalPath, journalFetches);
}
}
/**
* Reflectively attempts to load and execute the PersistitOpenMBean setup
* method. This will work only if the persistit_jsaXXX_jmx.jar is on the
* classpath. By default, PersistitOpenMBean uses the platform JMX server,
* so this also required Java 5.0+.
*
* @param params
* "true" to enable the PersistitOpenMBean, else "false".
*/
private void setupOpenMBean() {
try {
Class clazz = Class.forName(PERSISTIT_JMX_CLASS_NAME);
Method setupMethod = clazz.getMethod("setup",
new Class[] { Persistit.class });
setupMethod.invoke(null, new Object[] { this });
} catch (Exception e) {
if (_logBase.isLoggable(LogBase.LOG_MBEAN_EXCEPTION)) {
_logBase.log(LogBase.LOG_MBEAN_EXCEPTION, e);
}
}
}
synchronized void addVolume(Volume volume)
throws VolumeAlreadyExistsException {
Long idKey = new Long(volume.getId());
Volume otherVolume = _volumesById.get(idKey);
if (otherVolume != null) {
throw new VolumeAlreadyExistsException("Volume " + otherVolume
+ " has same ID");
}
otherVolume = getVolume(volume.getPath());
if (otherVolume != null
&& volume.getPath().equals(otherVolume.getPath())) {
throw new VolumeAlreadyExistsException("Volume " + otherVolume
+ " has same path");
}
_volumes.add(volume);
_volumesById.put(idKey, volume);
}
synchronized void removeVolume(Volume volume, boolean delete) {
Long idKey = new Long(volume.getId());
_volumesById.remove(idKey);
_volumes.remove(volume);
// volume.getPool().invalidate(volume);
if (delete) {
volume.getPool().delete(volume);
}
}
/**
* <p>
* Returns an <tt>Exchange</tt> for the specified {@link Volume Volume} and
* the {@link Tree Tree} specified by the supplied name. This method
* optionally creates a new <tt>Tree</tt>. If the <tt>create</tt> parameter
* is false and a <tt>Tree</tt> by the specified name does not exist, this
* constructor throws a
* {@link com.persistit.exception.TreeNotFoundException}.
* </p>
* <p>
* This method uses an <tt>Exchange</tt> from an internal pool if one is
* available; otherwise it creates a new <tt>Exchange</tt>. When the
* application no longer needs the <tt>Exchange</tt> returned by this
* method, it should return it to the pool by invoking
* {@link #releaseExchange} so that it can be reused.
* </p>
*
* @param volume
* The Volume
*
* @param treeName
* The tree name
*
* @param create
* <tt>true</tt> to create a new Tree if one by the specified
* name does not already exist.
*
* @throws PersistitException
*/
public Exchange getExchange(Volume volume, String treeName, boolean create)
throws PersistitException {
if (volume == null)
throw new VolumeNotFoundException();
Exchange exchange = null;
synchronized (_exchangePool) {
if (!_exchangePool.isEmpty()) {
exchange = (Exchange) _exchangePool.pop();
exchange.setRelinquished(false);
}
}
if (exchange == null) {
exchange = new Exchange(this, volume, treeName, create);
} else {
exchange.removeState();
exchange.init(volume, treeName, create);
}
return exchange;
}
/**
* <p>
* Returns an <tt>Exchange</tt> for the {@link Tree} specified by treeName
* within the {@link Volume} specified by <tt>volumeName</tt>. This method
* optionally creates a new <tt>Tree</tt>. If the <tt>create</tt> parameter
* is false and a <tt>Tree</tt> by the specified name does not exist, this
* constructor throws a
* {@link com.persistit.exception.TreeNotFoundException}.
* </p>
* <p>
* The <tt>volumeName</tt< you supply must match exactly one open
* <tt>Volume</tt>. The name matches if either (a) the <tt>Volume</tt> has
* an optional alias that is equal to the supplied name, or (b) if the
* supplied name matches a substring of the <tt>Volume</tt>'s pathname. If
* there is not unique match for the name you supply, this method throws a
* {@link com.persistit.exception.VolumeNotFoundException}.
* </p>
* <p>
* This method uses an <tt>Exchange</tt> from an internal pool if one is
* available; otherwise it creates a new <tt>Exchange</tt>. When the
* application no longer needs the <tt>Exchange</tt> returned by this
* method, it should return it to the pool by invoking
* {@link #releaseExchange} so that it can be reused.
* </p>
*
* @param volumeName
* The volume name that either matches the alias or a partially
* matches the pathname of exactly one open <tt>Volume</tt>.
*
* @param treeName
* The tree name
*
* @param create
* <tt>true</tt> to create a new Tree if one by the specified
* name does not already exist.
*
* @throws PersistitException
*/
public Exchange getExchange(String volumeName, String treeName,
boolean create) throws PersistitException {
Volume volume = getVolume(volumeName);
if (volume == null)
throw new VolumeNotFoundException(volumeName);
return getExchange(volume, treeName, create);
}
/**
* <p>
* Releases an <tt>Exchange</tt> to the internal pool. A subsequent
* invocation of {@link #getExchange} will reuse this <tt>Exchange</tt>. An
* application that gets an <tt>Exchange</tt> through the
* {@link #getExchange} method <i>should</i> release it through this method.
* An attempt to release the <tt>Exchange</tt> if it is already in the pool
* results in an <tt>IllegalStateException</tt>.
* </p>
* <p>
* This method clears all state information in the <tt>Exchange</tt> so that
* no information residing in the <tt>Exhange</tt> can be obtained by a
* different, untrusted application.
* </p>
*
* @param exchange
* The <tt>Exchange</tt> to release to the pool. If <tt>null</tt>
* , this method returns silently.
*
* @throws IllegalStateException
*/
public void releaseExchange(Exchange exchange) {
releaseExchange(exchange, true);
}
/**
* <p>
* Releases an <tt>Exchange</tt> to the internal pool. A subsequent
* invocation of {@link #getExchange} will reuse this <tt>Exchange</tt>. An
* application that gets an <tt>Exchange</tt> through the
* {@link #getExchange} method <i>should</i> release it through this method.
* An attempt to release the <tt>Exchange</tt> if it is already in the pool
* results in an <tt>IllegalStateException</tt>.
* </p>
* <p>
* This method optionally clears all state information in the
* <tt>Exchange</tt> so that no residual information in the <tt>Exhange</tt>
* can be obtained by a different, untrusted thread. In a closed
* configuration in which there is only one application, it is somewhat
* faster to avoid clearing the byte arrays used in representing the state
* of this <tt>Exchange</tt> by passing <tt>false</tt> as the value of the
* <tt>secure</tt> flag.
* </p>
*
* @param exchange
* The <tt>Exchange</tt> to release to the pool. If <tt>null</tt>
* , this method returns silently.
* @param secure
* <tt>true</tt> to clear all state information; <tt>false</tt>
* to leave the state unchanged.
*
* @throws IllegalStateException
*/
public void releaseExchange(Exchange exchange, boolean secure) {
if (exchange != null) {
synchronized (_exchangePool) {
exchange.setRelinquished(true);
exchange.setSecure(secure);
if (_exchangePool.contains(exchange)) {
throw new IllegalStateException(
"Exchange is already in the pool");
}
if (_exchangePool.size() < MAX_POOLED_EXCHANGES) {
_exchangePool.push(exchange);
}
}
}
}
/**
* Get a <code>link java.util.List</code> of all the {@link Volume}s being
* managed by this Persistit instance. Volumes are specified by the
* properties used in initializing Persistit.
*
* @return the List
*/
public Volume[] getVolumes() {
Volume[] list = new Volume[_volumes.size()];
for (int index = 0; index < list.length; index++) {
list[index] = _volumes.get(index);
}
return list;
}
/**
* Opens a Volume. The volume must already exist.
*
* @param pathName
* The full pathname to the file containing the Volume.
* @param ro
* <tt>true</tt> if the Volume should be opened in read- only
* mode so that no updates can be performed against it.
* @return The Volume.
* @throws PersistitException
*/
public Volume openVolume(final String pathName, final boolean ro)
throws PersistitException {
return openVolume(pathName, null, 0, ro);
}
/**
* Opens a Volume with a confirming id. If the id value is non-zero, then it
* must match the id the volume being opened.
*
* @param pathName
* The full pathname to the file containing the Volume.
*
* @param alias
* A friendly name for this volume that may be used internally by
* applications. The alias need not be related to the
* <tt>Volume</tt>'s pathname, and typically will denote its
* function rather than physical location.
*
* @param id
* The internal Volume id value - if non-zero this value must
* match the id value stored in the Volume header.
*
* @param ro
* <tt>true</tt> if the Volume should be opened in read- only
* mode so that no updates can be performed against it.
*
* @return The <tt>Volume</tt>.
*
* @throws PersistitException
*/
public Volume openVolume(final String pathName, final String alias,
final long id, final boolean ro) throws PersistitException {
File file = new File(pathName);
if (file.exists() && file.isFile()) {
return Volume.openVolume(this, pathName, alias, id, ro);
}
throw new PersistitIOException(new FileNotFoundException(pathName));
}
/**
* Loads and/or creates a volume based on a String-valued specification. The
* specification has the form: <br />
* <i>pathname</i>[,<i>options</i>]... <br />
* where options include: <br />
* <dl>
* <dt><tt>alias</tt></dt>
* <dd>An alias used in looking up the volume by name within Persistit
* programs (see {@link com.persistit.Persistit#getVolume(String)}). If the
* alias attribute is not specified, the the Volume's path name is used
* instead.</dd>
* <dt><tt>drive<tt></dt>
* <dd>Name of the drive on which the volume is located. Sepcifying the
* drive on which each volume is physically located is optional. If
* supplied, Persistit uses the information to improve I/O throughput in
* multi-volume configurations by interleaving write operations to different
* physical drives.</dd>
* <dt><tt>readOnly</tt></dt>
* <dd>Open in Read-Only mode. (Incompatible with create mode.)</dd>
*
* <dt><tt>create</tt></dt>
* <dd>Creates the volume if it does not exist. Requires <tt>bufferSize</tt>, <tt>initialPagesM</tt>, <tt>extensionPages</tt> and
* <tt>maximumPages</tt> to be specified.</dd>
*
* <dt><tt>createOnly</tt></dt>
* <dd>Creates the volume, or throw a {@link VolumeAlreadyExistsException}
* if it already exists.</dd>
*
* <dt><tt>temporary</tt></dt>
* <dd>Creates the a new, empty volume regardless of whether an existing
* volume file already exists.</dd>
*
* <dt><tt>id:<i>NNN</i></tt></dt>
* <dd>Specifies an ID value for the volume. If the volume already exists,
* this ID value must match the ID that was previously assigned to the
* volume when it was created. If this volume is being newly created, this
* becomes its ID number.</dd>
*
* <dt><tt>bufferSize:<i>NNN</i></tt></dt>
* <dd>Specifies <i>NNN</i> as the volume's buffer size when creating a new
* volume. <i>NNN</i> must be 1024, 2048, 4096, 8192 or 16384</dd>.
*
* <dt><tt>initialPages:<i>NNN</i></tt></dt>
* <dd><i>NNN</i> is the initial number of pages to be allocated when this
* volume is first created.</dd>
*
* <dt><tt>extensionPages:<i>NNN</i></tt></dt>
* <dd><i>NNN</i> is the number of pages by which to extend the volume when
* more pages are required.</dd>
*
* <dt><tt>maximumPages:<i>NNN</i></tt></dt>
* <dd><i>NNN</i> is the maximum number of pages to which this volume can
* extend.</dd>
*
* </dl>
*
*
* @param volumeSpec
* Volume specification
*
* @return The <tt>Volume</tt>
*
* @throws PersistitException
*/
public Volume loadVolume(final String volumeSpec) throws PersistitException {
return Volume.loadVolume(this, new VolumeSpecification(
substituteProperties(volumeSpec, _properties, 0)));
}
public boolean deleteVolume(final String volumeName)
throws PersistitException {
final Volume volume = getVolume(volumeName);
if (volume == null) {
return false;
} else {
removeVolume(volume, true);
new File(volume.getPath()).delete();
return true;
}
}
/**
* Returns an implementation of the <tt>Management</tt> interface. This
* implementation is a singleton; the first invocation of this method will
* create an instance; subsequent invocations will return the same instance.
*
* @return the singleton implementation of a <tt>Management</tt> from which
* system management services can be obtained.
*/
public synchronized Management getManagement() {
if (_management == null) {
_management = new ManagementImpl(this);
}
return _management;
}
/**
* Returns the copyright notice for this product
*
* @return The copyright notice
*/
public static String copyright() {
return COPYRIGHT;
}
/**
* Returns the version identifier for this version of Persistit™
*
* @return The version identifier
*/
public static String version() {
return VERSION;
}
/**
* The time at which the log was started.
*
* @return The time in milliseconds
*/
public long startTime() {
return _startTime;
}
/**
* The number of milliseconds since the log was opened.
*
* @return The elapsed time interval in milliseconds
*/
public long elapsedTime() {
return System.currentTimeMillis() - _startTime;
}
/**
* Looks up a {@link Volume} by id. At creation time, each <tt>Volume</tt>
* is assigned a unique long ID value.
*
* @param id
* @return the <tt>Volume</tt>, or <i>null</i> if there is no open
* <tt>Volume</tt> having the supplied ID value.
*/
public Volume getVolume(long id) {
return _volumesById.get(new Long(id));
}
/**
* <p>
* Looks up a {@link Volume} by name or path. The supplied name must match
* only one of the open volumes. If it matches none of the volumes, or if
* there are multiple volumes with matching names, then this method returns
* <tt>null</tt>.
* </p>
* <p>
* The supplied name can match a volume in one of two ways:
* <ul>
* <li>(a) its name by exact match</li>
* <li>(b) its path, by matching the canonical forms of the volume's path
* and the supplied path.</li>
* </ul>
* </p>
*
* @param name
* Name that identifies a volume by matching either its alias (if
* it has one) or a substring of its file name.
*
* @return the <tt>Volume</tt>, or <i>null</i> if there is no unique open
* Volume that matches the supplied <tt>partialName</tt>.
*/
public Volume getVolume(String name) {
if (name == null) {
throw new NullPointerException("Null volume name");
}
Volume result = null;
for (int i = 0; i < _volumes.size(); i++) {
Volume vol = _volumes.get(i);
if (name.equals(vol.getName())) {
if (result == null)
result = vol;
else {
return null;
}
}
}
if (result != null) {
return result;
}
final File file = new File(name);
for (int i = 0; i < _volumes.size(); i++) {
Volume vol = _volumes.get(i);
if (file.equals(new File(vol.getPath()))) {
if (result == null)
result = vol;
else {
return null;
}
}
}
return result;
}
/**
* <p>
* Returns the designated system volume. The system volume contains the
* class index and other structural information. It is specified by the
* <tt>sysvolume</tt> property with a default value of "_system".
* </p>
* <p>
* This method handles a configuration with exactly one volume in a special
* way. If the <tt>sysvolume</tt> property is unspecified and there is
* exactly one volume, then this method returns that volume volume as the
* system volume even if its name does not match the default
* <tt>sysvolume</tt> property. This eliminates the need to specify a system
* volume property for configurations having only one volume.
* </p>
*
* @return the <tt>Volume</tt>
* @throws VolumeNotFoundException
* if the volume was not found
*/
public Volume getSystemVolume() throws VolumeNotFoundException {
return getSpecialVolume(SYSTEM_VOLUME_PROPERTY,
DEFAULT_SYSTEM_VOLUME_NAME);
}
/**
* <p>
* Returns the designated transaction volume. The transaction volume is used
* to transiently hold pending updates prior to transaction commit. It is
* specified by the <tt>txnvolume</tt> property with a default value of
* "_txn".
* </p>
* <p>
* This method handles a configuration with exactly one volume in a special
* way. If the <tt>txnvolume</tt> property is unspecified and there is
* exactly one volume, then this method returns that volume as the
* transaction volume even if its name does not match the default
* <tt>txnvolume</tt> property. This eliminates the need to specify a
* transaction volume property for configurations having only one volume.
* </p>
*
* @return the <tt>Volume</tt>
* @throws VolumeNotFoundException
* if the volume was not found
*/
public Volume getTransactionVolume() throws VolumeNotFoundException {
return getSpecialVolume(TXN_VOLUME_PROPERTY, DEFAULT_TXN_VOLUME_NAME);
}
/**
* Returns the default timeout for operations on an <tt>Exchange</tt>. The
* application may override this default value for an instance of an
* <tt>Exchange</tt> through the {@link Exchange#setTimeout(long)} method.
* The default timeout may be specified through the
* <tt>com.persistit.defaultTimeout</tt> property.
*
* @return The default timeout value, in milliseconds.
*/
public long getDefaultTimeout() {
return _defaultTimeout;
}
/**
* Indicates whether this instance has been initialized.
*
* @return <tt>true</tt> if this Persistit has been initialized.
*/
public boolean isInitialized() {
return _initialized.get();
}
/**
* Indicates whether this instance of Persistit has been closed.
*
* @return <tt>true</tt> if Persistit has been closed.
*/
public boolean isClosed() {
return _closed.get();
}
/**
* Indicates whether Persistit will retry read any operation that fails due
* to an IOException. In many cases, an IOException occurs due to transient
* conditions, such as a file being locked by a backup program. When this
* property is <tt>true</tt>, Persistit will repeatedly retry the read
* operation until the timeout value for the current operation expires. By
* default this property is <tt>true</tt>. Use the com.persistit.readretry
* property to disable it.
*
* @return <tt>true</tt> to retry a read operation that fails due to an
* IOException.
*/
public boolean isReadRetryEnabled() {
return _readRetryEnabled;
}
public void copyBackPages() throws Exception {
_logManager.copyBack(Long.MAX_VALUE);
}
/**
* Looks up a volume by name.
*
* @param name
* The name
* @return the Volume
* @throws VolumeNotFoundException
* if the volume was not found
*/
private Volume getSpecialVolume(String propName, String dflt)
throws VolumeNotFoundException {
String volumeName = getProperty(propName, dflt);
Volume volume = getVolume(volumeName);
if (volume == null) {
if ((_volumes.size() == 1) && (volumeName == dflt)) {
volume = _volumes.get(0);
} else {
throw new VolumeNotFoundException(volumeName);
}
}
return volume;
}
/**
* @param size
* the desired buffer size
* @return the <tt>BufferPool</tt> for the specific buffer size
*/
BufferPool getBufferPool(int size) {
return _bufferPoolTable.get(new Integer(size));
}
/**
* @return A HashMap containing all the <tt>BufferPool</tt>s keyed by their
* size.
*/
HashMap getBufferPoolHashMap() {
return _bufferPoolTable;
}
/**
* <p>
* Close the Persistit Log and all {@link Volume}s. This method is
* equivalent to {@link #close(boolean) close(true)}.
*
* @throws PersistitException
* @throws IOException
* @throws PersistitException
* @throws IOException
* @return <tt>true</tt> if Persistit was initialized and this invocation
* closed it, otherwise false.
*/
public void close() throws PersistitException {
close0(true, false);
}
/**
* <p>
* Close the Persistit Log and all {@link Volume}s. This method does nothing
* and returns <tt>false</tt> if Persistit is currently not in the
* initialized state. This method is threadsafe; if multiple threads
* concurrently attempt to close Persistit, only one close operation will
* actually take effect.
* </p>
* <p>
* The <tt>flush</tt> determines whether this method will pause to flush all
* pending updates to disk before shutting down the system. If
* <tt>flush</tt> is <tt>true</tt> and many updated pages need to be
* written, the shutdown process may take a significant amount of time.
* However, upon restarting the system, all updates initiated before the
* call to this method will be reflected in the B-Tree database. This is the
* normal mode of operation.
* </p>
* <p>
* When <tt>flush</tt> is false this method returns quickly, but without
* writing remaining dirty pages to disk. The result after restarting
* Persistit will be valid, internally consistent B-Trees; however, recently
* applied updates may be missing.
* </p>
* <p>
* Note that Persistit starts non-daemon threads that will keep a JVM from
* exiting until you close Persistit. This is to ensure that all pending
* updates are written before the JVM exit. Therefore the recommended
* pattern for initializing, using and then closing Persistit is:
* <code><pre>
* try
* {
* Persistit.initialize();
* ... do work
* }
* finally
* {
* Persisit.close();
* }
* </pre></code> This pattern ensures that Persistit is closed properly and
* all threads terminated even if the application code throws an exception
* or error.
* </p>
* VolumeClosedException.
*
* @param flush
* <tt>true</tt> to ensure all dirty pages are written to disk
* before shutdown completes; <tt>false</tt> to enable fast
* (but incomplete) shutdown.
*
* @throws PersistitException
* @throws IOException
* @throws PersistitException
* @throws IOException
* @return <tt>true</tt> if Persistit was initialized and this invocation
* closed it, otherwise false.
*/
public void close(final boolean flush) throws PersistitException {
close0(flush, false);
}
private synchronized void close0(final boolean flush, final boolean byHook)
throws PersistitException {
if (_closed.get() || !_initialized.get()) {
return;
}
if (!byHook && _shutdownHook != null) {
try {
Runtime.getRuntime().removeShutdownHook(_shutdownHook);
} catch (IllegalStateException ise) {
// Shouldn't happen
}
_shutdownHook = null;
}
// Wait for UI to go down.
while (!byHook && _suspendShutdown) {
try {
wait(500);
} catch (InterruptedException ie) {
}
}
if (byHook) {
shutdownGUI();
}
flush();
_closed.set(true);
_journal.close();
for (final BufferPool pool : _bufferPoolTable.values()) {
pool.close(flush);
}
_logManager.close();
for (final BufferPool pool : _bufferPoolTable.values()) {
int count = pool.countDirty(null);
if (count > 0) {
_logBase.log(LogBase.LOG_STRANDED, pool, count);
}
}
final List<Volume> volumes = new ArrayList<Volume>(_volumes);
for (final Volume volume : volumes) {
volume.close();
}
while (!_volumes.isEmpty()) {
removeVolume(_volumes.get(0), false);
}
_logBase.logend();
_volumes.clear();
_volumesById.clear();
_bufferPoolTable.clear();
_transactionThreadLocal.set(null);
_waitingThreadLocal.set(null);
if (_management != null) {
_management.unregister();
_management = null;
}
}
/**
* Write all pending updates to the underlying OS file system. This
* operation runs asynchronously with other threads performing updates. Upon
* successful completion, this method ensures that all updates performed
* prior to calling flush() (except for those performed within as-yet
* uncommitted transactions) will be written; however, some updates
* performed by other threads subsequent to calling flush() may also be
* written.
*
* @return <i>true</i> if any file writes were performed, else <i>false</i>.
* @throws PersistitException
* @throws IOException
*/
public boolean flush() throws PersistitException {
if (_closed.get() || !_initialized.get()) {
return false;
}
for (final Volume volume : _volumes) {
volume.flush();
}
for (final BufferPool pool : _bufferPoolTable.values()) {
if (pool != null) {
pool.flush();
}
}
_logManager.force();
_journal.flush();
return true;
}
void waitForIOTaskStop(final IOTaskRunnable task) {
if (_beginCloseTime == 0) {
_beginCloseTime = System.currentTimeMillis();
_nextCloseTime = _beginCloseTime + CLOSE_LOG_INTERVAL;
}
task.kick();
while (!task.isStopped()) {
synchronized (this) {
try {
wait(SHORT_DELAY);
} catch (InterruptedException ie) {
break;
}
}
final long now = System.currentTimeMillis();
if (now > _nextCloseTime) {
_logBase.log(LogBase.LOG_WAIT_FOR_CLOSE,
(_nextCloseTime - _beginCloseTime) / 1000);
_nextCloseTime += CLOSE_LOG_INTERVAL;
}
}
}
/**
* Request OS-level file synchronization for all open files managed by
* Persistit. An application may call this method after {@link #flush} to
* ensure (within the capabilities of the host operating system) that all
* database updates have actually been written to disk.
*
* @throws IOException
*/
public void sync() throws PersistitIOException {
if (_closed.get() || !_initialized.get()) {
return;
}
final ArrayList<Volume> volumes = _volumes;
for (int index = 0; index < volumes.size(); index++) {
Volume volume = (Volume) volumes.get(index);
if (!volume.isReadOnly()) {
try {
volume.sync();
} catch (ReadOnlyVolumeException rove) {
// ignore, because it can't happen
}
}
}
_logManager.force();
}
/**
* Waits until updates are no longer suspended. The
* {@link #setUpdateSuspended} method controls whether update operations are
* currently suspended.
*/
public void suspend() {
while (isUpdateSuspended()) {
try {
Thread.sleep(SHORT_DELAY);
} catch (InterruptedException ie) {
break;
}
}
}
/**
* Gets the <tt>Transaction</tt> object for the current thread. The
* <tt>Transaction</tt> object lasts for the life of the thread. See
* {@link com.persistit.Transaction} for more information on how to use
* Persistit's transaction facilities.
*
* @return This thread <tt>Transaction</tt> object.
*/
public Transaction getTransaction() {
Transaction txn = _transactionThreadLocal.get();
if (txn == null) {
txn = new Transaction(this);
_transactionThreadLocal.set(txn);
}
return txn;
}
/**
* Returns the <code>java.awt.Container</code> object that contains the
* diagnostic GUI, if it is open. Otherwise this method returns <i>null</i>.
* The caller must cast the returned Object to Container. Persistit is
* designed to avoid loading Swing or AWT classes in the event no GUI is
* desired in order to minimize memory usage and startup time.
*
* @return an Object that can be cast to <code>java.awt.Container</code>, or
* <i>null</i> if no diagnostic UI is open.
*/
public Object getPersistitGuiContainer() {
return _localGUI;
}
/**
* Sets the {@link com.persistit.encoding.CoderManager} that will supply
* instances of {@link com.persistit.encoding.ValueCoder} and
* {@link com.persistit.encoding.KeyCoder}.
*
* @param coderManager
*/
public synchronized void setCoderManager(CoderManager coderManager) {
_coderManager = coderManager;
}
/**
* Returns the current CoderManager.
*
* @return The current {@link com.persistit.encoding.CoderManager}.
*/
public synchronized CoderManager getCoderManager() {
return _coderManager;
}
public LogBase getLogBase() {
return _logBase;
}
ClassIndex getClassIndex() {
return _classIndex;
}
Class classForHandle(int handle) {
ClassInfo ci = _classIndex.lookupByHandle(handle);
if (ci == null)
return null;
else
return ci.getDescribedClass();
}
KeyCoder lookupKeyCoder(Class cl) {
if (_coderManager == null)
return null;
return _coderManager.lookupKeyCoder(cl);
}
ValueCoder lookupValueCoder(Class cl) {
if (_coderManager == null)
return null;
return _coderManager.lookupValueCoder(cl);
}
Journal getJournal() {
return _journal;
}
public LogManager getLogManager() {
return _logManager;
}
TimestampAllocator getTimestampAllocator() {
return _timestampAllocator;
}
ThreadLocal getWaitingThreadThreadLocal() {
return _waitingThreadLocal;
}
ThreadLocal getThrottleThreadLocal() {
return _throttleThreadLocal;
}
SharedResource getTransactionResourceA() {
return _transactionResourceA;
}
SharedResource getTransactionResourceB() {
return _transactionResourceB;
}
LockManager getLockManager() {
return _lockManager;
}
/**
* Replaces the current logger implementation.
*
* @see com.persistit.logging.AbstractPersistitLogger
* @see com.persistit.logging.JDK14LoggingAdapter
* @see com.persistit.logging.Log4JAdapter
* @param logger
* The new logger implementation
*/
public void setPersistitLogger(AbstractPersistitLogger logger) {
_logger = logger;
}
/**
* @return The current logger.
*/
public AbstractPersistitLogger getPersistitLogger() {
if (_logger == null)
_logger = new DefaultPersistitLogger(getProperty(LOGFILE_PROPERTY));
return _logger;
}
/**
* Convenience method that performs an integrity check on all open
* <tt>Volume</tt>s and reports detailed results to
* {@link java.lang.System#out}.
*
* @throws PersistitException
*/
public void checkAllVolumes() throws PersistitException {
IntegrityCheck icheck = new IntegrityCheck(this);
for (int index = 0; index < _volumes.size(); index++) {
Volume volume = _volumes.get(index);
System.out.println("Checking " + volume + " ");
try {
icheck.checkVolume(volume);
} catch (Exception e) {
System.out.println(e + " while performing IntegrityCheck on "
+ volume);
}
}
System.out.println(" " + icheck.toString(true));
}
/**
* Parses a property value as a long integer. Permits suffix values of "K"
* for Kilo- and "M" for Mega-, "G" for Giga- and "T" for Tera-. For
* example, the supplied value of "100K" yields a parsed result of 102400.
*
* @param propName
* Name of the property, used in formating the Exception if the
* value is invalid.
* @param dflt
* The default value.
* @param min
* Minimum permissible value
* @param max
* Maximum permissible value
* @return The numeric value of the supplied String, as a long.
* @throws IllegalArgumentException
* if the supplied String is not a valid integer representation,
* or is outside the supplied bounds.
*/
long getLongProperty(String propName, long dflt, long min, long max) {
String str = getProperty(propName);
if (str == null)
return dflt;
return parseLongProperty(propName, str, min, max);
}
/**
* Parses a string as a long integer. Permits suffix values of "K" for Kilo-
* and "M" for Mega-, "G" for Giga- and "T" for Tera-. For example, the
* supplied value of "100K" yields a parsed result of 102400.
*
* @param propName
* Name of the property, used in formating the Exception if the
* value is invalid.
* @param str
* The string representation, e.g., "100K".
* @param min
* Minimum permissible value
* @param max
* Maximum permissible value
* @return The numeric value of the supplied String, as a long.
* @throws IllegalArgumentException
* if the supplied String is not a valid integer representation,
* or is outside the supplied bounds.
*/
static long parseLongProperty(String propName, String str, long min,
long max) {
long result = Long.MIN_VALUE;
long multiplier = 1;
if (str.length() > 1) {
switch (str.charAt(str.length() - 1)) {
case 't':
case 'T':
multiplier = TERA;
break;
case 'g':
case 'G':
multiplier = GIGA;
break;
case 'm':
case 'M':
multiplier = MEGA;
break;
case 'k':
case 'K':
multiplier = KILO;
break;
}
}
String sstr = str;
boolean invalid = false;
if (multiplier > 1) {
sstr = str.substring(0, str.length() - 1);
}
try {
result = Long.parseLong(sstr) * multiplier;
}
catch (NumberFormatException nfe) {
invalid = true;
}
if (result < min || result > max || invalid) {
throw new IllegalArgumentException("Value '" + str
+ "' of property " + propName + " is invalid");
}
return result;
}
/**
* Parses a string value as either <i>true</i> or <i>false</i>.
*
* @param propName
* Name of the property, used in formating the Exception if the
* value is invalid.
* @param dflt
* The default value
* @return <i>true</i> or <i>false</i>
*/
public boolean getBooleanProperty(String propName, boolean dflt) {
String str = getProperty(propName);
if (str == null)
return dflt;
str = str.toLowerCase();
if ("true".equals(str))
return true;
if ("false".equals(str))
return false;
throw new IllegalArgumentException("Value '" + str + "' of property "
+ propName + " must be " + " either \"true\" or \"false\"");
}
/**
* Attemps to open the diagnostic GUI that displays some useful information
* about Persistit's internal state. If the UI has already been opened, this
* method merely sets the shutdown suspend flag.
*
* @param suspendShutdown
* If <tt>true</tt>, sets the shutdown suspend flag. Setting this
* flag suspends the {@link #close} method to permit continued
* use of the diagnostic GUI.
* @throws ClassNotFoundException
* @throws IllegalAccessException
* @throws InstantiationException
*/
public void setupGUI(boolean suspendShutdown)
throws IllegalAccessException, InstantiationException,
ClassNotFoundException, RemoteException {
if (_localGUI == null) {
if (_logBase.isLoggable(LogBase.LOG_INIT_CREATE_GUI)) {
_logBase.log(LogBase.LOG_INIT_CREATE_GUI);
}
_localGUI = (UtilControl) (Class.forName(PERSISTIT_GUI_CLASS_NAME))
.newInstance();
}
_localGUI.setManagement(getManagement());
_suspendShutdown = suspendShutdown;
}
/**
* Closes the diagnostic GUI if it previously has been opened. Otherwise
* this method does nothing.
*/
public void shutdownGUI() {
if (_localGUI != null) {
_localGUI.close();
_suspendShutdown = false;
_localGUI = null;
}
}
/**
* Indicates whether Persistit will suspend its shutdown activities on
* invocation of {@link #close}. This flag is intended for use by management
* tools that need to keep Persistit open even when the application has
* requested it to close so that the final state of the Persistit
* environment can be examined.
*
* @return <tt>true</tt> if Persistit will wait when attempting to close;
* <tt>false</tt> if the <tt>close</tt> operation will not be
* suspended.
*/
public boolean isShutdownSuspended() {
return _suspendShutdown;
}
/**
* Determines whether Persistit will suspend its shutdown activities on
* invocation of {@link #close}. This flag is intended for use by management
* tools that need to keep Persistit open even when the application has
* requested it to close so that the final state of the Persistit
* environment can be examined.
*
* @param suspended
* <tt>true</tt> to specify that Persistit will wait when
* attempting to close; otherwise <tt>false</tt>.
*/
public void setShutdownSuspended(boolean suspended) {
_suspendShutdown = suspended;
}
/**
* Indicates whether Persistit is suspending all updates. When set, this
* property will cause all updates to be suspended until the property is
* cleared. This capability is intended primarily for diagnostic and
* management support.
*
* @return <tt>true</tt> if all updates are suspended; otherwise
* <tt>false</tt>.
*/
public synchronized boolean isUpdateSuspended() {
return _suspendUpdates;
}
/**
* Controls whether Persistit will suspend all Threads that attempt to
* update any Volume. When set, this property will cause all updates to be
* suspended until the property is cleared. This capability is intended
* primarily for diagnostic support and management support.
*
* @param suspended
* <tt>true</tt> to suspend all updates; <tt>false</tt> to enable
* updates.
*/
public synchronized void setUpdateSuspended(boolean suspended) {
_suspendUpdates = suspended;
if (Debug.ENABLED && !suspended)
Debug.setSuspended(false);
}
private static class Throttle {
private long _throttleCount;
}
private Throttle getThrottle() {
ThreadLocal throttleThreadLocal = getThrottleThreadLocal();
Throttle throttle = (Throttle) throttleThreadLocal.get();
if (throttle == null) {
throttle = new Throttle();
throttleThreadLocal.set(throttle);
}
return throttle;
}
void bumpThrottleCount() {
_globalThrottleCount++;
Throttle throttle = getThrottle();
throttle._throttleCount = _globalThrottleCount;
}
void setNextThrottleDelay(final long now) {
_nextThrottleBumpTime = now + THROTTLE_THRESHOLD;
}
void handleRetryThrottleBump(final long now) {
if (now > _nextThrottleBumpTime) {
_nextThrottleBumpTime += THROTTLE_THRESHOLD;
bumpThrottleCount();
}
}
void throttle() {
if (_globalThrottleCount != _localThrottleCount) {
Throttle throttle = getThrottle();
if (throttle._throttleCount < _globalThrottleCount) {
try {
Thread.sleep(500);
} catch (InterruptedException ie) {
}
}
_localThrottleCount = throttle._throttleCount = _globalThrottleCount;
}
}
/**
* Initializes Persistit using a property file path supplied as the first
* argument, or if no arguments are supplied, the default property file
* name. As a side-effect, this method will apply any uncommitted updates
* from the prewrite journal. As a side-effect, this method will also open
* the diagnostic UI if requested by system property or property value in
* the property file.
*
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
boolean gui = false;
boolean icheck = false;
boolean wait = false;
String propertiesFileName = null;
for (int index = 0; index < args.length; index++) {
String s = args[index];
if (s.startsWith("?") || s.startsWith("-?") || s.startsWith("-h")
|| s.startsWith("-H")) {
usage();
return;
}
if (s.equalsIgnoreCase("-g"))
gui = true;
else if (s.equalsIgnoreCase("-i"))
icheck = true;
else if (s.equalsIgnoreCase("-w"))
wait = true;
else if (!s.startsWith("-") && propertiesFileName == null) {
propertiesFileName = s;
} else {
usage();
return;
}
}
Persistit persistit = new Persistit();
persistit.initialize(propertiesFileName);
try {
if (gui) {
persistit.setupGUI(wait);
}
if (icheck) {
persistit.checkAllVolumes();
}
if (wait) {
persistit.setShutdownSuspended(true);
}
} catch (Exception e) {
e.printStackTrace();
persistit.setShutdownSuspended(false);
} finally {
persistit.close();
}
}
private static void usage() {
for (int index = 0; index < USAGE.length; index++) {
System.out.println(USAGE[index]);
}
System.out.println();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
eb4fac5465a2cd6331fd463bda1062a306e9fae1 | 850b0cb4f383baa720cdea4013e404a689e07e2b | /Alldatabases(1)/app/src/main/java/com/example/alldatabases/AddressGet.java | e0c9c96a88915a7144880e1cce7ebad114bd33e7 | [] | no_license | shinjeonghea/EDU-Kotlin | 7ad164b41a506601dac9540c380449b811a9fd27 | c074247e3c6f7a0d390cc077ffa248d1eeb1b677 | refs/heads/master | 2023-07-05T07:53:21.659292 | 2021-08-12T07:02:23 | 2021-08-12T07:02:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,832 | java | package com.example.alldatabases;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import com.skt.Tmap.TMapData;
import com.skt.Tmap.TMapPOIItem;
import com.skt.Tmap.TMapPoint;
import java.util.ArrayList;
public class AddressGet extends AppCompatActivity {
double[] temp;
ArrayList<String> itemsS = new ArrayList<String>();
ArrayList<TMapPOIItem> items = new ArrayList<TMapPOIItem>();
TMapPoint[] positions = new TMapPoint[2];
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.get_address);
Intent addressIntent = getIntent();
temp = addressIntent.getDoubleArrayExtra("requestAddress");
Button startBtn = (Button)findViewById(R.id.startBtn);
Button endBtn = (Button)findViewById(R.id.arrivalBtn);
Button returnAddress = (Button)findViewById(R.id.doFindLoad);
final EditText startEdit = (EditText)findViewById(R.id.startEdt);
final EditText endEdit = (EditText)findViewById(R.id.arrivalEdt);
final ListView list = (ListView)findViewById(R.id.searchResult_list_item);
startBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TMapData tmapdata = new TMapData();
String tmp = startEdit.getText().toString();
ArrayAdapter adapter;
items.clear();
itemsS.clear();
if (tmp == null) return;
try {
items = tmapdata.findAllPOI(tmp);
for (int i=0; i < items.size(); i++){
itemsS.add(items.get(i).name);
}
adapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, itemsS);
list.setAdapter(adapter);
} catch (Exception e){
e.printStackTrace();
}
}
});
endBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TMapData tmapdata = new TMapData();
String tmp = endEdit.getText().toString();
final ArrayAdapter adapter;
items.clear();
itemsS.clear();
if (tmp == null) return;
try {
items = tmapdata.findAllPOI(tmp);
for (int i=0; i < items.size(); i++){
itemsS.add(items.get(i).name);
}
adapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_list_item_1, itemsS);
list.setAdapter(adapter);
} catch (Exception e){
e.printStackTrace();
}
}
});
returnAddress.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
temp[0] = positions[0].getLatitude();
temp[1] = positions[0].getLongitude();
temp[2] = positions[1].getLatitude();
temp[3] = positions[1].getLongitude();
Log.d("d7", ""+temp[0]);
Log.d("d7", ""+temp[1]);
Log.d("d7", ""+temp[2]);
Log.d("d7", ""+temp[3]);
Intent intent = new Intent();
intent.putExtra("reponseAddress",temp);
setResult(RESULT_OK, intent);
finish();
}
});
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if(startEdit.isFocused()){
startEdit.setText(itemsS.get(position));
positions[0] = items.get(position).getPOIPoint();
Log.d("d7", positions[0].toString());
}
else if(endEdit.isFocused()){
endEdit.setText(itemsS.get(position));
positions[1] = items.get(position).getPOIPoint();
Log.d("d7", items.get(position).toString());
Log.d("d7", positions[1].toString());
}
else{
}
}
});
// setResult(RESULT_OK, addressIntent);
// finish();
}
} | [
"wjdgml6859@naver.com"
] | wjdgml6859@naver.com |
1c54ffa1170452d3d8f34f4636040827218771c2 | b2bc60c46b46b2693369c65df372270861554a67 | /src/com/company/collection/CollectionGenericTest.java | 7e1d4bdef452d1c82aadc517957cc79b73404379 | [] | no_license | SuFarther/JavaProject | b4bf0fb3d094044240221af67049b180aae94e09 | d1dd5c764ecd8a5b24ed8a1e0de7478a160a511b | refs/heads/master | 2023-07-15T17:50:44.915482 | 2021-08-28T04:43:07 | 2021-08-28T04:43:07 | 390,173,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | package com.company.collection;
import java.util.ArrayList;
/**
* @author 苏东坡
* @version 1.0
* @ClassName CollectionGenericTest
* @company 公司
* @Description Collection下面的实现类ArrayList实现泛型作用
* (1)JDK1.5以后
* (2) 泛型实际就是一个<>引起来的参数类型,这个参数类型具体在使用的时候才可以确定具体的类型
* (3) 使用了泛型以后,可以确定集合中存放的类型,在编译时期,就可以检查出来
* (4) 使用泛型你可能觉得麻烦,实际使用了泛型后才会简单,后期的遍历操作简单
* (5) 泛型的类型,但是引用数据类型,不是基本数据类型
* (6) ArrayList<Integer> al = el ArrayList<Integer>(); 在JDK1.7后ArrayList<Integer> al = el ArrayList<>();
* @createTime 2021年08月10日 06:49:49
*/
public class CollectionGenericTest {
public static void main(String[] args) {
//加入泛型限制数据的类型
ArrayList al = new ArrayList();
al.add(80);
al.add(30);
al.add(20);
al.add("哈哈");
al.add(9.5);
for (Object obj : al){
System.out.println(obj);
}
System.out.println("没有使用泛型之前的集合al为 :" +al);
System.out.println("-------------------------");
// ArrayList<Integer> al2 = new ArrayList<Integer>();
ArrayList<Integer> al2 = new ArrayList<>();
al2.add(10);
al2.add(30);
al2.add(40);
al2.add(10);
// al2.add("哈哈"); //报错,不是Integer指定的类型
for (Integer i:al2){
System.out.println(i);
}
System.out.println("没有使用泛型之前的集合al2为 :" +al2);
}
}
| [
"2257346739@qq.com"
] | 2257346739@qq.com |
f4f113cc783bfa031d90011106341bef76383a6c | 960f36973a3dfb5b5bd7af0ef6dad25ce8b49b71 | /src/main/java/dao/impl/FieldDaoHibernateImpl.java | 296bf6aa49b0b1248b726c39921754b2c347fda4 | [] | no_license | borysovdenys/infostroytesttask | ccf3bfea765e8228eaafb8e2a8362669eb268f43 | 4386898631f0b008a052657499842280b1d968af | refs/heads/master | 2020-03-28T10:37:01.198150 | 2018-09-10T12:59:40 | 2018-09-10T12:59:40 | 148,126,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,443 | java | package dao.impl;
import dao.FieldDao;
import entity.*;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.query.Query;
import utility.HibernateUtils;
import javax.faces.bean.ManagedBean;
import java.util.ArrayList;
import java.util.List;
@ManagedBean
public class FieldDaoHibernateImpl implements FieldDao {
private static final Logger LOGGER = Logger.getLogger(FieldDaoHibernateImpl.class);
public List<Field> getFieldsAsAList() {
Session session = HibernateUtils.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("from Field order by id");
ArrayList<Field> listOfFields = (ArrayList<Field>) query.getResultList();
session.flush();
transaction.commit();
return listOfFields;
}
@Override
public void addField(Field field) {
Session session = HibernateUtils.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
session.save(field);
session.flush();
transaction.commit();
}
public void deleteFieldFromDBById(int id) {
Session session = HibernateUtils.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("delete from Field where id=:fieldId");
query.setParameter("fieldId", id);
query.executeUpdate();
session.flush();
transaction.commit();
}
@Override
public void updateField(Field field) {
Session session = HibernateUtils.getSessionFactory().openSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("update Field set label=:fieldLabel,type=:fieldType,required=:fieldRequired,isActive=:fieldIsActive, options=:fieldOptions where id=:fieldId");
query.setParameter("fieldId", field.getId());
query.setParameter("fieldLabel", field.getLabel());
query.setParameter("fieldType", field.getType());
query.setParameter("fieldRequired", field.isRequired());
query.setParameter("fieldIsActive", field.isActive());
query.setParameter("fieldOptions", field.getOptions());
query.executeUpdate();
session.flush();
transaction.commit();
}
}
| [
"defan3171@gmail.com"
] | defan3171@gmail.com |
2455e6ba64480db0be32db2a3bab27c7af1e0809 | 7ce7ed639b86cc061bb2d9e253067c71bd8f7890 | /src/main/java/com/caijianlong/stock_trade_system/config/RedisConfig.java | 9653914a679b4da1ff08747271bd4930c5fec733 | [] | no_license | mercuriussss/stock_trade_system | e2c8e471f6251c72e671aa3963f52eb22bd0d32b | 6467a065e942a6315b3ede5db1e7b5f2b0c7db40 | refs/heads/master | 2023-03-15T08:39:24.065670 | 2021-03-23T16:41:52 | 2021-03-23T16:41:52 | 295,776,684 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,854 | java | package com.caijianlong.stock_trade_system.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.time.Duration;
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport{
private static final StringRedisSerializer STRING_SERIALIZER = new StringRedisSerializer();
private static final GenericJackson2JsonRedisSerializer JACKSON__SERIALIZER = new GenericJackson2JsonRedisSerializer();
@Bean
public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
//设置缓存过期时间
RedisCacheConfiguration redisCacheCfg=RedisCacheConfiguration.defaultCacheConfig()
.entryTtl(Duration.ofHours(1))
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(STRING_SERIALIZER))
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(JACKSON__SERIALIZER));
return RedisCacheManager.builder(RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory))
.cacheDefaults(redisCacheCfg)
.build();
}
@Bean
@ConditionalOnMissingBean(name = "redisTemplate")
public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory factory){
// 配置redisTemplate
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setConnectionFactory(factory);
// key序列化
redisTemplate.setKeySerializer(STRING_SERIALIZER);
// value序列化
redisTemplate.setValueSerializer(JACKSON__SERIALIZER);
// Hash key序列化
redisTemplate.setHashKeySerializer(STRING_SERIALIZER);
// Hash value序列化
redisTemplate.setHashValueSerializer(JACKSON__SERIALIZER);
// 开启事务支持
redisTemplate.setEnableTransactionSupport(true);
redisTemplate.afterPropertiesSet();
return redisTemplate;
}
}
| [
"caijianlong615@outlook.com"
] | caijianlong615@outlook.com |
ebafc2ea1a6b52483546882b3ff6196dcb837e7f | 2a2c4469b2350c9d455754e7eaf7216bd5a46047 | /container/container-api/src/main/java/liquid/container/domain/ContainerStatus.java | 09f866207f5202591ab930a5ce6362a0022a864e | [
"Apache-2.0"
] | permissive | woakes070048/liquid | 51bd790c4317ea14445d392c915194fa1821defe | 856749db3e9f0faa4226949830ea4979dbb7d804 | refs/heads/master | 2020-12-13T11:25:23.707668 | 2016-10-07T12:37:44 | 2016-10-07T12:37:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package liquid.container.domain;
/**
*
* User: tao
* Date: 10/3/13
* Time: 4:26 PM
*/
public enum ContainerStatus {
IN_STOCK(0, "container.in.stock"),
ALLOCATED(1, "container.allocated"),
LOADED(2, "container.loaded");
private final int value;
private final String i18nKey;
private ContainerStatus(int value, String i18nKey) {
this.value = value;
this.i18nKey = i18nKey;
}
public int getValue() {
return value;
}
public String getI18nKey() {
return i18nKey;
}
}
| [
"redbrick9@gmail.com"
] | redbrick9@gmail.com |
1d6bbb79840496fde009467a01c52bb5ff9e5f87 | 3ebaee3a565d5e514e5d56b44ebcee249ec1c243 | /assetBank 3.77 decomplied fixed/src/java/com/bright/assetbank/attribute/action/MoveListValueAction.java | d34a3f1b0b196cee5b913a6eb59d99f37aedd0ad | [] | no_license | webchannel-dev/Java-Digital-Bank | 89032eec70a1ef61eccbef6f775b683087bccd63 | 65d4de8f2c0ce48cb1d53130e295616772829679 | refs/heads/master | 2021-10-08T19:10:48.971587 | 2017-11-07T09:51:17 | 2017-11-07T09:51:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,428 | java | /* */ package com.bright.assetbank.attribute.action;
/* */
/* */ import com.bn2web.common.action.Bn2Action;
/* */ import com.bright.assetbank.attribute.form.ListAttributeForm;
/* */ import com.bright.assetbank.attribute.service.AttributeValueManager;
/* */ import com.bright.assetbank.user.bean.ABUserProfile;
/* */ import com.bright.framework.user.bean.UserProfile;
/* */ import javax.servlet.http.HttpServletRequest;
/* */ import javax.servlet.http.HttpServletResponse;
/* */ import org.apache.commons.logging.Log;
/* */ import org.apache.struts.action.ActionForm;
/* */ import org.apache.struts.action.ActionForward;
/* */ import org.apache.struts.action.ActionMapping;
/* */
/* */ public class MoveListValueAction extends Bn2Action
/* */ {
/* 44 */ private AttributeValueManager m_attributeValueManager = null;
/* */
/* */ public ActionForward execute(ActionMapping a_mapping, ActionForm a_form, HttpServletRequest a_request, HttpServletResponse a_response)
/* */ throws Exception
/* */ {
/* 62 */ ActionForward afForward = null;
/* 63 */ ListAttributeForm form = (ListAttributeForm)a_form;
/* 64 */ ABUserProfile userProfile = (ABUserProfile)UserProfile.getUserProfile(a_request.getSession());
/* */
/* 67 */ if (!userProfile.getIsAdmin())
/* */ {
/* 69 */ this.m_logger.debug("This user does not have permission to view the admin pages");
/* 70 */ return a_mapping.findForward("NoPermission");
/* */ }
/* */
/* 73 */ long lAttributeValueId = getLongParameter(a_request, "id");
/* 74 */ boolean bMoveUp = new Boolean(a_request.getParameter("up")).booleanValue();
/* */
/* 76 */ this.m_attributeValueManager.moveListAttributeValue(null, lAttributeValueId, bMoveUp);
/* */
/* 78 */ form.setValue(this.m_attributeValueManager.getListAttributeValue(null, lAttributeValueId));
/* */
/* 80 */ afForward = a_mapping.findForward("Success");
/* */
/* 82 */ return afForward;
/* */ }
/* */
/* */ public void setAttributeValueManager(AttributeValueManager a_attributeValueManager)
/* */ {
/* 87 */ this.m_attributeValueManager = a_attributeValueManager;
/* */ }
/* */ }
/* Location: C:\Users\mamatha\Desktop\com.zip
* Qualified Name: com.bright.assetbank.attribute.action.MoveListValueAction
* JD-Core Version: 0.6.0
*/ | [
"42003122+code7885@users.noreply.github.com"
] | 42003122+code7885@users.noreply.github.com |
a49e319af640ff79cb2c45e366fc56e353dea45d | ea2ae7b3c78520d44a35dc5b08d7242c8a512d39 | /pet-clinic-data/src/main/java/azib/springframework/sfapetclinic/services/PetTypeService.java | e86d1675f4737faa0f10ed712f54ee4c90691fe1 | [] | no_license | syed-azib/sfa-pet-clinic | 9479d385f1ca23378423116c46c48de53f712b0c | 88063bc37982beecba4867021092674f43d24bd3 | refs/heads/master | 2023-01-04T23:40:51.379359 | 2020-10-20T17:14:11 | 2020-10-20T17:14:11 | 297,442,365 | 0 | 0 | null | 2020-10-18T20:31:48 | 2020-09-21T19:36:20 | Java | UTF-8 | Java | false | false | 283 | java | package azib.springframework.sfapetclinic.services;
import azib.springframework.sfapetclinic.model.Pet;
import azib.springframework.sfapetclinic.model.PetType;
import java.util.Set;
public interface PetTypeService extends CrudService<PetType, Long>{
Set<PetType> findAll();
}
| [
"syed.azib@hotmail.com"
] | syed.azib@hotmail.com |
0e6a55c775888810114d0b41939ff2caa3ad7f6b | ebb409b005b83485e99a6937b8b269ba6658aecb | /src/main/java/com/boehm/siebel/deploy/tools/dto/ConverterRequestDTO.java | e33be319500ea9b5f5b36b47ad3789bae2f6b6f7 | [] | no_license | bassista/SiebelDevTools | 21e84e16d1ef5551c47708ef60c0a04e3dc9ac36 | 1efc1849fbee34c499ab89532cab8ae12c31796b | refs/heads/master | 2020-12-20T04:59:56.055279 | 2017-06-06T10:58:51 | 2017-06-06T10:58:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package com.boehm.siebel.deploy.tools.dto;
/**
* Created by boechr on 16.05.2017.
*/
public class ConverterRequestDTO {
public enum ConvertType {
TAB_TO_JIRA ("TAB_TO_JIRA", "Tab to JIRA"),
ROWID_TO_SIEBELQL ("ROWID_TO_SIEBELQL", "RowId to SiebelQL ([Id]='XXX')"),
OR_CONNECTED ("OR_CONNECTED", "OR-Verknüpft ('XXX' OR 'YYY')"),
COMMA_CONNECTED ("COMMA_CONNECTED", "Komma-Verknüpft ('XXX', 'YYY')"),
SIEBPS_TO_STRUCTURE ("SIEBPS_TO_STRUCTURE", "PropertySet to Structured Display");
private final String shortName;
private final String fullName;
ConvertType(String shortName, String fullName) {
this.shortName = shortName;
this.fullName = fullName;
}
public String getShortName() {
return shortName;
}
@org.jetbrains.annotations.Contract(pure = true)
public String getFullName() {
return fullName;
}
};
private ConvertType convertType;
private String request;
private boolean headerAvailable;
public boolean isHeaderAvailable() {
return headerAvailable;
}
public void setHeaderAvailable(boolean headerAvailable) {
this.headerAvailable = headerAvailable;
}
public ConvertType getConvertType() {
return convertType;
}
public void setConvertType(ConvertType convertType) {
this.convertType = convertType;
}
public String getRequest() {
return request;
}
public void setRequest(String request) {
this.request = request;
}
}
| [
"laudatus@web.de"
] | laudatus@web.de |
5a4c6838eadaf6b0e563383042e903a6ef4c052d | 8d8665b24cb605792a24c07682022e48474e8d54 | /Console.java | 24767baffad8934a9c6abdaa784ca0e9a3019ded | [] | no_license | papersusii/myJava | 832c1bc4af74ef59dc679ac3064d676fd9aaf1e8 | b87654173200b2624e44a6d40f2d8674e7430bbf | refs/heads/master | 2020-09-22T15:57:10.876604 | 2016-09-10T01:52:11 | 2016-09-10T01:52:11 | 67,843,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,212 | java | import java.util.Scanner;
public class Console{
private static Scanner input = new Scanner(System.in);
//public static String[] textFileNames={" "," "," "," "," "};
//public static String[] textFileData={" "," "," "," "," "};
public static void main(String[] args){
boolean prgm = true;
float valOfCalc =0F;
String userUsed = "blank";
String userIn = "blank";
String userInSave = "blank";
String textFile="";
Console_Calculator callCalc = new Console_Calculator();
Console_TextEditor callText = new Console_TextEditor();
ActiveText callGame = new ActiveText();
FalloutStyleTerminal callTerm = new FalloutStyleTerminal();
LooksLikeWork callWork = new LooksLikeWork();
System.out.print(">> ");
while(prgm){
try {
userIn = input.nextLine ();
userIn = userIn.toLowerCase();
if (userIn.isEmpty()){
userUsed=userInSave;
} else {
userUsed=userIn;
userInSave=userIn;
}
if (userUsed.equals("help")) {
callText.helpFile();
}
else if (userUsed.indexOf("nt")>=0) {
System.out.println("nt #");
byte fileLocation = Byte.parseByte(userUsed.substring(3,4));
callText.createTextFile(fileLocation);
System.out.println(callText.textFileNames[fileLocation]);
System.out.println(callText.textFileData[fileLocation]);
} else if (userUsed.equals("disp textfile")) {
callText.recallTextFile(textFile);
} else if (userUsed.indexOf('+') >=0) {
valOfCalc = callCalc.addFunction(userUsed,valOfCalc);
} else if ((userUsed.indexOf('-')) >=0) {
valOfCalc = callCalc.subFunction(userUsed,valOfCalc);
} else if ((userUsed.indexOf('*')) >=0) {
valOfCalc = callCalc.multFunction(userUsed,valOfCalc);
} else if ((userUsed.indexOf('/')) >=0) {
valOfCalc = callCalc.divFunction(userUsed,valOfCalc);
} else if ((userUsed.charAt(0)==('.'))) { //why can't you use .equals with pt char?
valOfCalc=callCalc.clearFunction();
} else if ((userUsed.equals("game"))) {
callGame.gameTime();
} else if ((userUsed.equals("terminal"))){
callTerm.runTerminal();
} else if ((userUsed.indexOf("work")) >=0) {
callWork.randomWork(Integer.parseInt(userUsed.substring(0,2)), Float.parseFloat(userUsed.substring(8)));
System.out.println("");
} else if (userUsed.equals("blank")){
System.out.println("Your field is blank. Showing helpfile.");
callText.helpFile();
} else if ((userUsed.equals("terminate")) || (userUsed.equals("exit"))) {
prgm = false;
} else {
System.out.println("Invalid Command");
}
System.out.print(">> ");
}catch(StringIndexOutOfBoundsException e){
System.out.println("Error: String index out of bounds");
System.out.print(">>");
}catch(NumberFormatException e){
System.out.println("If using work function, the first number MUST be 2 digits.");
System.out.print(">>");
}catch(Exception e){
//System.out.print(e);
System.out.println("Something Went Wrong (You did something wrong)");
System.out.print(">> ");
}
}
System.out.println("Session terminated");
//System.out.print("Goodbye");
}
} | [
"ian.adler.nc@gmail.com"
] | ian.adler.nc@gmail.com |
d413b10571329c41baed40305c5c4038a8c6550f | f92eddb726e4f74361f0bf13f505c175a81d8ba2 | /AppCodigo/Tabs/SlidingTabLayoutPesquisa.java | 44558753c0d093c55f9ce2b7b2c5975b6cd34ce8 | [] | no_license | santcou/TdEngCompFabioCoutinho | f746faa2b730ca5f5d969fdacc7e574f7f77149c | 76f81f70073c3fd3a136d5471248de860d78eeee | refs/heads/master | 2020-03-20T02:52:05.740567 | 2018-06-12T21:02:32 | 2018-06-12T21:02:32 | 137,127,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,146 | java | package td2final.engecomp.td2final.Tabs;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* To be used with ViewPager to provide a tab indicator component which give constant feedback as to
* the user's scroll progress.
* <p>
* To use the component, simply add it to your view hierarchy. Then in your
* {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call
* {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for.
* <p>
* The colors can be customized in two ways. The first and simplest is to provide an array of colors
* via {@link #setSelectedIndicatorColors(int...)}. The
* alternative is via the {@link TabColorizer} interface which provides you complete control over
* which color is used for any individual position.
* <p>
* The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
* providing the layout ID of your custom layout.
*/
public class SlidingTabLayoutPesquisa extends HorizontalScrollView {
/**
* Allows complete control over the colors drawn in the tab layout. Set with
* {@link #setCustomTabColorizer(TabColorizer)}.
*/
public interface TabColorizer {
/**
* @return return the color of the indicator used when {@code position} is selected.
*/
int getIndicatorColor(int position);
}
private static final int TITLE_OFFSET_DIPS = 24;
private static final int TAB_VIEW_PADDING_DIPS = 16;
private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
private int mTitleOffset;
private int mTabViewLayoutId;
private int mTabViewTextViewId;
private boolean mDistributeEvenly;
private ViewPager mViewPager;
private SparseArray<String> mContentDescriptions = new SparseArray<String>();
private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
private final SlidingTabStrip mTabStrip;
public SlidingTabLayoutPesquisa(Context context) {
this(context, null);
}
public SlidingTabLayoutPesquisa(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SlidingTabLayoutPesquisa(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// Disable the Scroll Bar
setHorizontalScrollBarEnabled(false);
// Make sure that the Tab Strips fills this View
setFillViewport(true);
mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
mTabStrip = new SlidingTabStrip(context);
addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
}
/**
* Set the custom {@link TabColorizer} to be used.
*
* If you only require simple custmisation then you can use
* {@link #setSelectedIndicatorColors(int...)} to achieve
* similar effects.
*/
public void setCustomTabColorizer(TabColorizer tabColorizer) {
mTabStrip.setCustomTabColorizer((SlidingTabLayout.TabColorizer) tabColorizer);
}
public void setDistributeEvenly(boolean distributeEvenly) {
mDistributeEvenly = distributeEvenly;
}
/**
* Sets the colors to be used for indicating the selected tab. These colors are treated as a
* circular array. Providing one color will mean that all tabs are indicated with the same color.
*/
public void setSelectedIndicatorColors(int... colors) {
mTabStrip.setSelectedIndicatorColors(colors);
}
/**
* Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are
* required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so
* that the layout can update it's scroll position correctly.
*
* @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
*/
public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
mViewPagerPageChangeListener = listener;
}
/**
* Set the custom layout to be inflated for the tab views.
*
* @param layoutResId Layout id to be inflated
* @param textViewId id of the {@link TextView} in the inflated view
*/
public void setCustomTabView(int layoutResId, int textViewId) {
mTabViewLayoutId = layoutResId;
mTabViewTextViewId = textViewId;
}
/**
* Sets the associated view pager. Note that the assumption here is that the pager content
* (number of tabs and tab titles) does not change after this call has been made.
*/
public void setViewPager(ViewPager viewPager) {
mTabStrip.removeAllViews();
mViewPager = viewPager;
if (viewPager != null) {
viewPager.setOnPageChangeListener(new InternalViewPagerListener());
populateTabStrip();
}
}
/**
* Create a default view to be used for tabs. This is called if a custom tab view is not set via
* {@link #setCustomTabView(int, int)}.
*/
protected TextView createDefaultTabView(Context context) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
outValue, true);
textView.setBackgroundResource(outValue.resourceId);
textView.setAllCaps(true);
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding);
return textView;
}
private void populateTabStrip() {
final PagerAdapter adapter = mViewPager.getAdapter();
final View.OnClickListener tabClickListener = new TabClickListener();
for (int i = 0; i < adapter.getCount(); i++) {
View tabView = null;
TextView tabTitleView = null;
if (mTabViewLayoutId != 0) {
// If there is a custom tab view layout id set, try and inflate it
tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
false);
tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
}
if (tabView == null) {
tabView = createDefaultTabView(getContext());
}
if (tabTitleView == null && TextView.class.isInstance(tabView)) {
tabTitleView = (TextView) tabView;
}
if (mDistributeEvenly) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tabView.getLayoutParams();
lp.width = 0;
lp.weight = 1;
}
tabTitleView.setText(adapter.getPageTitle(i));
tabView.setOnClickListener(tabClickListener);
String desc = mContentDescriptions.get(i, null);
if (desc != null) {
tabView.setContentDescription(desc);
}
mTabStrip.addView(tabView);
if (i == mViewPager.getCurrentItem()) {
tabView.setSelected(true);
}
}
}
public void setContentDescription(int i, String desc) {
mContentDescriptions.put(i, desc);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mViewPager != null) {
scrollToTab(mViewPager.getCurrentItem(), 0);
}
}
private void scrollToTab(int tabIndex, int positionOffset) {
final int tabStripChildCount = mTabStrip.getChildCount();
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
return;
}
View selectedChild = mTabStrip.getChildAt(tabIndex);
if (selectedChild != null) {
int targetScrollX = selectedChild.getLeft() + positionOffset;
if (tabIndex > 0 || positionOffset > 0) {
// If we're not at the first child and are mid-scroll, make sure we obey the offset
targetScrollX -= mTitleOffset;
}
scrollTo(targetScrollX, 0);
}
}
private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
private int mScrollState;
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
int tabStripChildCount = mTabStrip.getChildCount();
if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
return;
}
mTabStrip.onViewPagerPageChanged(position, positionOffset);
View selectedTitle = mTabStrip.getChildAt(position);
int extraOffset = (selectedTitle != null)
? (int) (positionOffset * selectedTitle.getWidth())
: 0;
scrollToTab(position, extraOffset);
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageScrolled(position, positionOffset,
positionOffsetPixels);
}
}
@Override
public void onPageScrollStateChanged(int state) {
mScrollState = state;
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageScrollStateChanged(state);
}
}
@Override
public void onPageSelected(int position) {
if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
mTabStrip.onViewPagerPageChanged(position, 0f);
scrollToTab(position, 0);
}
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
mTabStrip.getChildAt(i).setSelected(position == i);
}
if (mViewPagerPageChangeListener != null) {
mViewPagerPageChangeListener.onPageSelected(position);
}
}
}
private class TabClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
for (int i = 0; i < mTabStrip.getChildCount(); i++) {
if (v == mTabStrip.getChildAt(i)) {
mViewPager.setCurrentItem(i);
return;
}
}
}
}
} | [
"fabio.santcou@gmail.com"
] | fabio.santcou@gmail.com |
ede06bc3dc511b9a9146834d25c747090e38876f | d2322c928738e6a52deafa36aa4fb8737eeaed27 | /src/org/expeditee/stats/DocumentStats.java | 42bedbf076979f6c027760c4ca7b3d12ed8db5e3 | [] | no_license | lostminty/Expeditee2014 | a009dd5cc09151e67652181ff62843e9761b88f1 | 181bcf6416c20a6e9d806691e7f811e41d502f06 | refs/heads/master | 2021-01-18T06:23:06.574464 | 2014-05-28T00:18:19 | 2014-05-28T00:18:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | package org.expeditee.stats;
import java.util.HashSet;
import java.util.Set;
import org.expeditee.gui.Frame;
import org.expeditee.gui.FrameIO;
import org.expeditee.gui.MessageBay;
import org.expeditee.items.Text;
public class DocumentStats extends CometStats {
protected int _treeFrames = 0;
protected int _characters = 0;
protected int _words = 0;
protected int _textItems = 0;
protected int _sentences = 0;
public static int wordCount(String paragraph) {
return paragraph.trim().split("\\s+").length + 1;
}
public DocumentStats(Frame topFrame) {
this(topFrame, new HashSet<String>());
}
public DocumentStats(Frame topFrame, Set<String> visited) {
super(topFrame);
visited.add(_name.toLowerCase());
MessageBay.overwriteMessage("Computed: " + _name);
// Initialise variables with the data for this frames comet
_characters = 0;
_words = 0;
_textItems = 0;
_sentences = 0;
_treeFrames = 1;
// Now get all add all the trees for linked items
for (Text i : topFrame.getBodyTextItems(false)) {
_textItems++;
String text = i.getText().trim();
_words += text.split("\\s+").length;
_sentences += text.split("\\.+").length;
_characters += text.length();
String link = i.getAbsoluteLink();
if (link == null)
continue;
// Stop infinite loops by not visiting nodes we have already visited
if (visited.contains(link.toLowerCase())) {
continue;
}
Frame childFrame = FrameIO.LoadFrame(i.getAbsoluteLink());
if (childFrame == null)
continue;
DocumentStats childItemStats = new DocumentStats(childFrame,
visited);
_words += childItemStats._words;
_characters += childItemStats._characters;
_textItems += childItemStats._textItems;
_sentences += childItemStats._sentences;
_treeFrames += childItemStats._treeFrames;
}
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(SessionStats.getDate());
sb.append("DocStats: ").append(_name).append('\n');
sb.append("Title: ").append(_title).append('\n');
sb.append("Frames: ").append(_treeFrames).append('\n');
sb.append("TextItems: ").append(_textItems).append('\n');
sb.append("Sentences: ").append(_sentences).append('\n');
sb.append("Words: ").append(_words).append('\n');
sb.append("Chars: ").append(_characters);
return sb.toString();
}
}
| [
"ascent12@hotmail.com"
] | ascent12@hotmail.com |
1d1a712105259788bb4f2be9af35adec54ea2cd0 | b2f32dfdab456125f816383abda4b709d901d86c | /src/main/java/com/yswl/yswletc/common/utils/EscapeUtil.java | f914056571dcb4f3335d0e6e36d5a4186ebda192 | [] | no_license | lmTLL/yswletc | a34d79abdb8ab85622bf2c6bd7308cf939c13f1c | 4471959289b5a3c82b7897227349ff3140558b6e | refs/heads/master | 2022-06-07T03:45:00.354781 | 2019-11-21T07:21:24 | 2019-11-21T07:21:24 | 214,116,846 | 1 | 0 | null | 2021-06-04T02:14:05 | 2019-10-10T07:33:07 | Java | UTF-8 | Java | false | false | 861 | java | package com.yswl.yswletc.common.utils;
import com.google.gson.JsonObject;
/**
* User: jang
* Date: 2019/10/9
* Time: 14:44
* Description: No Description
*/
public class EscapeUtil {
/**
*
* @param jsonObject json数组
* @param string 属性名
* @return
*/
public static String string(JsonObject jsonObject, String string) {
try {
return jsonObject.get(string).getAsJsonObject().get("words").getAsString();
}catch (Exception e){
e.printStackTrace();
return null;
}
}
public static <T> T demo2(JsonObject jsonObject,String string,T t) {
try {
return (T) jsonObject.get(string).getAsJsonObject().get("words").getAsString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
| [
"156495910@qq.com"
] | 156495910@qq.com |
5df64f6ab01b0dc3df146dbe10d957af791497d2 | 64bac453d05e516e469d68fd984efdaf42e75e9a | /app/src/main/java/com/lambz/lingo_chat/activities/StartupActivity.java | c1e0e1dcaa68e892c46f68caafad186264d277af | [] | no_license | Lambz/Capstone_WeThree_LingoChat_Android | 6137e7eb09b219eedd9ce6c1a3fc88fdf38a7258 | 4d32220bdcdbeebb5c8bff86ff840ed81fb23281 | refs/heads/master | 2023-03-03T04:57:12.050379 | 2021-02-13T00:30:07 | 2021-02-13T00:30:07 | 289,105,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,282 | java | package com.lambz.lingo_chat.activities;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.lambz.lingo_chat.R;
public class StartupActivity extends AppCompatActivity
{
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_startup);
getSupportActionBar().hide();
}
public void signUpClicked(View view)
{
Intent intent = new Intent(this,SignUpActivity.class);
startActivity(intent);
finish();
}
public void signInClicked(View view)
{
Intent intent = new Intent(this,LoginActivity.class);
startActivity(intent);
finish();
}
@Override
protected void onStart()
{
super.onStart();
mAuth = FirebaseAuth.getInstance();
FirebaseUser user = mAuth.getCurrentUser();
if(user != null)
{
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
finish();
}
}
} | [
"chaitanya.sanoriya@gmail.com"
] | chaitanya.sanoriya@gmail.com |
a0ff8eadeba91d0d533b55fc6f5711d059eb4018 | 1eaff03515904ab4e83036f54f50201d529414ed | /app/src/main/java/com/example/multiactivity/Rubik.java | f4c295cc3a0b40167bc1b85d67a0dffc2abdb6c7 | [] | no_license | dpopov185/MultiActivity | 503259660fc0e2319384cfbbdf3b53219ab659a5 | 06aaf337d6449703315d4dfb15fb110545a4095f | refs/heads/master | 2023-01-11T18:08:27.668063 | 2020-11-14T17:15:18 | 2020-11-14T17:15:18 | 312,864,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.example.multiactivity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class Rubik extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rubik);
}
} | [
"dmitriy.nomad@gmail.com"
] | dmitriy.nomad@gmail.com |
5b6daa84cec4113a904b3933c580f897a33c6d68 | edf5952edaa773d2e8f94a605b0b2aaa38aee530 | /src/Visao/TelaChat.java | d96181451fc23a08f5ebc0b1936fe6d71103e93f | [] | no_license | AndrePereira22/BATALHANAVAL | 3b9c49a5775eb0fd9fddcad1054ef109c3d08ba0 | 9baa2def96dd3b036e63c9b623211e167186ba8b | refs/heads/master | 2022-07-22T16:41:37.632137 | 2019-07-11T12:17:43 | 2019-07-11T12:17:43 | 195,322,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,040 | java | package Visao;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import ModeloCliente.Cliente;
public class TelaChat {
// Declara Tela (JPanel)
private JPanel panelChat;
// Declara Componentes
private JTextArea textAreaConversas;
private JScrollPane scrollPane;
private JTextField textFieldChat;
private JButton buttonChat; // Enviar
// Declara Classe de Comunicacao de Dados
private Cliente cliente;
// Construtor da Tela
public TelaChat(Cliente cliente) {
this.cliente = cliente;
// Cria nova Tela (JPanel)
setPanelChat(new JPanel(new GridBagLayout()));
// Cria manipulador de eventos
ButtonHandler handler = new ButtonHandler();
// Cria Campo de texto
setTextFieldChat(new JTextField(40));
getTextFieldChat().addActionListener(handler);
// Cria Campo de texto com um ScrollPane (Barra de Rolagem)
setTextAreaConversas(new JTextArea(5, 20));
getTextAreaConversas().setEditable(false);
scrollPane = new JScrollPane(textAreaConversas);
// Cria botao Enviar
setButtonChat(new JButton("Enviar"));
getTextFieldChat().addActionListener(handler);
getButtonChat().addActionListener(handler);
// Adicionando Componentes a Tela (JPanel).
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.HORIZONTAL;
getPanelChat().add(scrollPane, c);
c.fill = GridBagConstraints.BOTH;
c.weightx = 1.0;
c.weighty = 1.0;
getPanelChat().add(textFieldChat, c);
getPanelChat().add(buttonChat);
}
// Manipulador de Acoes - Botoes (BottonsChat)
private class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
try {
// Se botao for apertado
if (e.getSource() == getButtonChat()) {
// Envia para o servidor
String n = getTextFieldChat().getText();
if (!n.equals("")) {
cliente.getSaida().println(n);
getTextFieldChat().setText("");
}
}
if (e.getSource() == getTextFieldChat()) {
String n = getTextFieldChat().getText();
if (!n.equals("")) {
cliente.getSaida().println(n);
getTextFieldChat().setText("");
}
}
} catch (Exception exception) {
JOptionPane.showMessageDialog(null, "ERRO - Uso incorreto");
}
}
}
public JTextArea getTextAreaConversas() {
return textAreaConversas;
}
public void setTextAreaConversas(JTextArea textAreaConversas) {
this.textAreaConversas = textAreaConversas;
}
public void setTextAreaConversas(String texto) {
this.textAreaConversas.setText(texto);
}
public JScrollPane getScrollPane() {
return scrollPane;
}
public void setScrollPane(JScrollPane scrollPane) {
this.scrollPane = scrollPane;
}
public JTextField getTextFieldChat() {
return textFieldChat;
}
public void setTextFieldChat(JTextField textFieldChat) {
this.textFieldChat = textFieldChat;
}
public JButton getButtonChat() {
return buttonChat;
}
public void setButtonChat(JButton buttonChat) {
this.buttonChat = buttonChat;
}
public JPanel getPanelChat() {
return panelChat;
}
public void setPanelChat(JPanel panelChat) {
this.panelChat = panelChat;
}
}
| [
"Andre-Coude@Coude-PC"
] | Andre-Coude@Coude-PC |
aba539056191fb0d072d5dc7f96f4d0f3e87bce8 | 429878188b43867b3f6653de06d0b2418a30fad8 | /app/src/androidTest/java/com/company42spices/app/ApplicationTest.java | 5745544c743a2ea7a7e93ac3682db97ffa6377fd | [] | no_license | ashgkwd/42spices | a73c6c0b03f725c7b55e7e2c43c5179923435480 | ec453960dc6498dc0e28375f3b9be97dd56c6f78 | refs/heads/master | 2020-06-05T00:53:46.128840 | 2015-07-12T18:56:47 | 2015-07-12T18:56:47 | 38,966,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 354 | java | package com.company42spices.app;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"ash.gkwd@gmail.com"
] | ash.gkwd@gmail.com |
2a599bb1a06d55983ebc854713b37b2718031424 | 2820a107e490ed793129418ce2d3d8de726e26a1 | /src/PlayerTest.java | aae7b41aa9c5da9f30ba1513882ed55824ad4128 | [] | no_license | flavji/digitalRisk | a1a62a3c7ef0b629785eb6ad2ca63b95212d3c28 | 720d5ba3e282c84516c77cb94a270a316445cd10 | refs/heads/main | 2023-02-02T02:43:57.587319 | 2020-12-22T15:05:20 | 2020-12-22T15:05:20 | 305,446,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Tests for Player class.
*
* @author Fareen Lavji
* @version 11.09.2020
*
* @author Fareen. L
* @version 12.07.2020
*/
public class PlayerTest {
Player player;
@Before
public void setUp() throws Exception {
player = new Player("Player");
}
@After
public void tearDown() throws Exception {
player = null;
assertNull(player);
}
@Test
public void getArmyCount() {
// act and assert
assertEquals(0, player.getArmyCount());
}
@Test
public void setArmyCount() {
// setup
player.setArmyCount(5);
// act and assert
assertEquals(5, player.getArmyCount());
}
@Test
public void getName() {
// act and assert
assertEquals("Player", player.getName());
}
@Test
public void getPlayerTurn() {
// act and assert
assertEquals(null, player.getPlayerTurn());
}
@Test
public void getOwnedCountries() {
// act and assert
assertEquals(0, player.getOwnedCountries().size());
}
@Test
public void addNewCountry() {
// setup
player.addCountry(new Country("SouthernEurope", "Europe"));
player.addCountry(new Country("China", "Asia"));
// act and assert
assertEquals(2, player.getOwnedCountries().size());
}
} | [
"fareenmlavji@hotmail.com"
] | fareenmlavji@hotmail.com |
735e158f669c8029aa604ccc845faf117a72584a | ce806578f97ea5b6b8c57427a6d34952ecfa5e4e | /demo-system/demo-system/service/src/main/java/com/manage/system/dao/UserMapper.java | 8275cc4bb8fd3584ba9065b6c355cf287fd2c92f | [] | no_license | wuchongcheng81/manage-system | 0e123b920d25cfa2808496e25028b33078a3b8a7 | 1b4e8d6199c63274e489220aa80827c7a8a71bde | refs/heads/master | 2022-06-23T03:43:31.489104 | 2019-10-10T02:03:14 | 2019-10-10T02:03:14 | 204,585,406 | 0 | 0 | null | 2022-06-17T02:29:41 | 2019-08-27T00:29:18 | JavaScript | UTF-8 | Java | false | false | 276 | java | package com.manage.system.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.manage.system.bean.User;
import java.util.List;
public interface UserMapper extends BaseMapper<User> {
int queryTotal(User user);
List<User> queryList(User user);
}
| [
"563576277@qq.com"
] | 563576277@qq.com |
eb02cfd7b2c109ba89120173c8f9dda0d62fac6f | 2a2dd37a9fb56a0d45ee58122745d2bfc9607034 | /src/test/java/com/mtb/model/TheaterTest.java | 9037a5df209aa255bceca25ed9edfd90e2608410 | [] | no_license | vimittal/MovieTicketBooking | ec801ace4d75929f86cc30cd36e28be041a53508 | a62b061725bfa0d81ffca2450af773a9cf1b2512 | refs/heads/master | 2021-01-19T19:37:24.018328 | 2014-09-15T04:00:43 | 2014-09-15T04:00:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 960 | java | package test.java.com.mtb.model;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import main.java.com.mtb.model.SimpleTheatre;
import main.java.com.mtb.model.Theatre;
import org.junit.Test;
public class TheaterTest {
@Test
public void shouldVarifyWhenSeatsAreAvailabel() {
// given
Theatre theatre = new SimpleTheatre(50);
// then
assertTrue(theatre.areSeatsAvailable(2));
}
@Test
public void shouldVarifyWhenSeatsAllSeatsAreBooked() {
// given
Theatre theatre = new SimpleTheatre(2);
theatre.book(2);
// then
assertFalse(theatre.areSeatsAvailable(2));
}
@Test
public void shouldReturnSeatNumbersAfterSuccessfulBooking() {
// given
Theatre theatre = new SimpleTheatre(50);
String[] expectedSeats = { "1", "2" };
// when
String[] actualSeats = theatre.book(2);
// then
assertArrayEquals(expectedSeats, actualSeats);
}
}
| [
"vmittal@equalexperts.com"
] | vmittal@equalexperts.com |
cd3946b0a5f44b12f541e81e9b3509ce973e43fa | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava17/Foo147.java | e73a11364a84b5170ff24c931c7a57b310db4d72 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package applicationModulepackageJava17;
public class Foo147 {
public void foo0() {
new applicationModulepackageJava17.Foo146().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
59069f2d304c7d1f49c540647a3db7d8fd5a0025 | 565c1cfde1777faaa13591b6a44f5fc247aab4e2 | /59_3sum-closest/3sum-closest.java | 62351bd819d58a3c0eff8814dbd304f447010163 | [] | no_license | AndrewLu1992/lintcodes | 6bcb70287695d8464cee210eb8e46d6ed1316e7c | 365a3cbca25d66525487a96dd4debd66237a568c | refs/heads/master | 2020-04-10T14:57:02.266105 | 2016-09-14T05:27:37 | 2016-09-14T05:27:37 | 68,175,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,536 | java | /*
@Copyright:LintCode
@Author: hanqiao
@Problem: http://www.lintcode.com/problem/3sum-closest
@Language: Java
@Datetime: 16-08-11 21:49
*/
public class Solution {
/**
* @param numbers: Give an array numbers of n integer
* @param target : An integer
* @return : return the sum of the three integers, the sum closest target.
*/
public int threeSumClosest(int[] numbers, int target) {
// write your code here
if (numbers == null || numbers.length < 3) {
return -1;
}
//The same stratergy as 3 sum
Arrays.sort(numbers);
int best = numbers[0] + numbers[1] + numbers[2];
//Attention ! length - 2 for stop at last 2.
for (int i = 0; i < numbers.length - 2; i++) {
int start = i + 1;
int end = numbers.length - 1;
//Collision pointer.
while (start < end) {
int sum = numbers[i] + numbers[start] + numbers[end];
if (Math.abs(sum - target) < Math.abs(best - target)) {
best = sum;
}
if (sum < target) {
start++;
} else if (sum > target) {
end--;
} else {
break;
}
}
if (best == target) {
break;
}
}
return best;
}
}
| [
"hlu22@hawk.iit.edu"
] | hlu22@hawk.iit.edu |
f3bdd0c4e6e7a7570d084fe726b87f784bf1713f | c4acf98f949c588ccd1982eb8663a2b2938f8672 | /src/model/services/PaypalService.java | 32dd77837d469bd41547055383234545a397a3fd | [] | no_license | adrianopequeno/exercicioInterface | 2fde0e247ee5b61fec268e4ade1c21e451b56032 | 261cf3cdcbf2ed59faeb182bc9ec6e45b29554e9 | refs/heads/main | 2023-08-23T06:46:10.758828 | 2021-10-04T02:10:44 | 2021-10-04T02:10:44 | 413,220,114 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package model.services;
public class PaypalService implements OnlinePaymentService {
private static final double PAYMENT_FEE = 0.02;
private static final double MONTHLY_INTEREST = 0.01;
@Override
public double paymentFee(double amount) {
return amount * PAYMENT_FEE;
}
@Override
public double interest(double amount, int months) {
return amount * months * MONTHLY_INTEREST;
}
}
| [
"adrian.pekeno@gmail.com"
] | adrian.pekeno@gmail.com |
9b7f8d46fd9096a08e2c5aafe51856395345698f | 92676aca26207a891edced31714fbbdc352711c7 | /src/main/java/com/bikas/springbootsecurity/SpringbootSecurityApplication.java | 9051a4c0e6b121ea1cc19a6a969f0ebdc212a484 | [] | no_license | bikas1986/springboot-security | 1d6aab1bdc1618610da0a98f8dfbb0c9157b83a9 | 312ddaec68a38dec3ea049f9d6791896ac03cf86 | refs/heads/master | 2021-05-22T13:33:49.714917 | 2020-04-04T13:31:09 | 2020-04-04T13:31:09 | 252,948,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.bikas.springbootsecurity;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootSecurityApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootSecurityApplication.class, args);
}
}
| [
"bikas1986@gmail.com"
] | bikas1986@gmail.com |
295a8bbfba908ab232ff4bfedfb8e6842246193a | 1aeca07f1f0b18bebbff3b51b1796ea5a32d26b1 | /app/src/main/java/skytechhub/myaccounts/component/CheckDeviceProfile.java | 6377d170a7da3d694c9360a96252370aa86fd6d3 | [] | no_license | adhiyadeep/myAccountProduct | a80bef864c5f907a39b220363daea64a14261ad2 | 9ee6480959978bfcc855bebe7593a4549ae8dcd9 | refs/heads/master | 2020-04-08T16:18:48.386812 | 2018-11-28T14:24:14 | 2018-11-28T14:24:14 | 159,513,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,010 | java | package skytechhub.myaccounts.component;
import android.content.Context;
import android.media.AudioManager;
import android.media.RingtoneManager;
import android.net.Uri;
import android.util.Log;
public class CheckDeviceProfile {
public static int getDeviceProfile(Context context) {
AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
switch (am.getRingerMode())
{
case AudioManager.RINGER_MODE_SILENT:
Log.i("MyApp", "Silent mode");
return 1;
case AudioManager.RINGER_MODE_VIBRATE:
Log.i("MyApp", "Vibrate mode");
return 2;
case AudioManager.RINGER_MODE_NORMAL:
Log.i("MyApp", "Normal mode");
return 3;
}
return 1;
}
public static Uri getDefaultNotificationSound() {
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
return uri;
}
}
| [
"adhiyadeep@gmail.com"
] | adhiyadeep@gmail.com |
4fafaea51753ae2716d76fbcf5d68951ff7347e3 | 8297084d4d1335cf4e94133bfb616d1b61308aaa | /src/main/java/ru/nesteria/web/ConclusionUsersStartedNotFinish.java | 829d9b40a222b0b86fb09c74a1b756d9c3165ffc | [] | no_license | alexnester94/smartSoftTask | e9c4337c4015374a9c11aa050fbaa4a7df22ed03 | 0f6264d1d3c0d7c672e2fc25268f68ecb912c995 | refs/heads/master | 2020-03-23T16:43:13.951567 | 2018-07-21T15:32:17 | 2018-07-21T15:32:17 | 141,824,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package ru.nesteria.web;
import ru.nesteria.db.dbFunctions.DBConnect;
import ru.nesteria.db.dbHashMap.SelectUsersStartedNotFinish;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
public class ConclusionUsersStartedNotFinish extends HttpServlet {
final String USERSSTARTEDNOTFINISHQUERY = "SELECT ssoid,subtype" +
" FROM public.smartsofttable" +
" where ssoid != 'Unauthorized' and ssoid != '';";
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
DBConnect connection = new DBConnect();
SelectUsersStartedNotFinish hm2 = new SelectUsersStartedNotFinish();
PrintWriter printWriter = resp.getWriter();
try {
hm2.checkLastStep(hm2.getHashMap(connection.getCon(),USERSSTARTEDNOTFINISHQUERY), printWriter);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
| [
"ya.alexnester@yandex.ru"
] | ya.alexnester@yandex.ru |
2a7b981f8451c6da6f9f12b4e1ca949055a27314 | 1b0da29644309acf014378203a42645af6fa1592 | /sdk/src/main/java/yapily/sdk/credential/KeyCredentials.java | f46a5c3a08af428dd51f8d8c2b1fcdbafc77a3e3 | [
"MIT"
] | permissive | yapily-deepa/yapily-sdk-java | a1279399f712c34011a686de26d94b069f32f083 | b60b6e6b0dd0aa7ad0693e2ef337264d41db409e | refs/heads/master | 2020-03-19T00:21:14.252987 | 2018-05-30T17:02:39 | 2018-05-30T17:02:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 803 | java | package yapily.sdk.credential;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
public class KeyCredentials implements YapilyCredentials {
private final String key;
private final String secret;
public KeyCredentials(String key, String secret) {
this.key = key;
this.secret = secret;
}
@Override
public CredentialsProvider toCredentialsProvider() {
BasicCredentialsProvider basicCredentialsProvider = new BasicCredentialsProvider();
basicCredentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(key, secret));
return basicCredentialsProvider;
}
}
| [
"gkatzioura@gmail.com"
] | gkatzioura@gmail.com |
d5b59aa07805e8dcf02e90803fdf8ecfbc4d6db1 | 896c39c14831c93457476671fdda540a3ef990fa | /kubernetes-model/src/model/java/com/marcnuri/yakc/model/io/k8s/api/core/v1/EndpointAddress.java | 27213a4c60fe443f4dc049c81add0295f1d71199 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | manusa/yakc | 341e4b86e7fd4fa298f255c69dd26d7e3e3f3463 | 7e7ac99aa393178b9d0d86db22039a6dada5107c | refs/heads/master | 2023-07-20T04:53:42.421609 | 2023-07-14T10:09:48 | 2023-07-14T10:09:48 | 252,927,434 | 39 | 15 | Apache-2.0 | 2023-07-13T15:01:10 | 2020-04-04T06:37:03 | Java | UTF-8 | Java | false | false | 1,767 | java | /*
* Copyright 2020 Marc Nuri
*
* 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.marcnuri.yakc.model.io.k8s.api.core.v1;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.marcnuri.yakc.model.Model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.ToString;
/**
* EndpointAddress is a tuple that describes single IP address.
*/
@SuppressWarnings({"squid:S1192", "WeakerAccess", "unused"})
@Builder(toBuilder = true, builderClassName = "Builder")
@AllArgsConstructor
@NoArgsConstructor
@Data
@ToString
public class EndpointAddress implements Model {
/**
* The Hostname of this endpoint
*/
@JsonProperty("hostname")
private String hostname;
/**
* The IP of this endpoint. May not be loopback (127.0.0.0/8 or ::1), link-local (169.254.0.0/16 or fe80::/10), or link-local multicast (224.0.0.0/24 or ff02::/16).
*/
@NonNull
@JsonProperty("ip")
private String ip;
/**
* Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node.
*/
@JsonProperty("nodeName")
private String nodeName;
@JsonProperty("targetRef")
private ObjectReference targetRef;
}
| [
"marc@marcnuri.com"
] | marc@marcnuri.com |
d25456f97fbe669dc198c00f750faa4424325ca4 | 834e6c950069962bd90518b3d965f31269417da2 | /MicroServiceEurekaExample/src/main/java/com/example/jpa/EurekaServer.java | c48be84a0d6160992bc738235592729739c7e676 | [] | no_license | rajesh0409/microserviceexample | 8b9ff4c73828adad6a332f51e754f96e33ed33f5 | 91187b6b3c4ff791c09c67f0914f7499729b18fc | refs/heads/master | 2020-07-14T02:25:42.646090 | 2019-08-29T17:08:42 | 2019-08-29T17:08:42 | 205,212,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.example.jpa;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer {
public static void main(String[] args) {
SpringApplication.run(EurekaServer.class, args);
}
}
| [
"rajeshkumar19.sheelam@gmail.com"
] | rajeshkumar19.sheelam@gmail.com |
e0a493cb2bee4abe2377938f763b0074554e95fb | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/abc066/B/4388320.java | 2fe6051a74f244f89dae19ff32c750cb335b5726 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | Java | false | false | 552 | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
String po=sc.nextLine();
if(po.length()%2==1)po=po.substring(0,po.length()-1);
else po=po.substring(0,po.length()-2);
while(po.length()!=0){
if(po.substring(0,po.length()/2).equals(po.substring(po.length()/2,po.length())))break;
else if (po.length()==2)po="";
else po=po.substring(0,po.length()-2);
}
System.out.println(po.length());
}
} | [
"kwnafi@yahoo.com"
] | kwnafi@yahoo.com |
3bdec83e22447b5701c7541aa8677f57f4a06840 | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/eclipse.jdt.ui/203.java | 376e8814421f4d9030183507b58986c860b7cc2a | [
"MIT"
] | permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package p;
class A<T> {
}
class Outer {
class B extends A<T> {
/**
* comment
*/
void f() {
}
}
}
| [
"tim.menzies@gmail.com"
] | tim.menzies@gmail.com |
e7cdf937b73a222f416134aefd6610042b8a69a5 | e34bae4cc540942e25fc3c75daeb45c1058c6b76 | /toeic-web-logic/src/main/java/vn/education/controller/web/ExerciseQuestionController.java | d49edff7e030abd2e97c911fb8121139cfd9966c | [] | no_license | nguyenhien0209/toeic-web-online | 5bdebc1a06611f613ebd7bbbdb7d789fc0dfafcd | b5cbee2a7c3dcd32bc40b7d6dd8683c2c0526bb9 | refs/heads/master | 2020-05-05T01:18:02.708578 | 2019-04-05T01:06:29 | 2019-04-05T01:06:29 | 179,598,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,399 | java | package vn.education.controller.web;
import vn.education.command.ExerciseQuestionCommand;
import vn.education.core.dto.ExerciseQuestionDTO;
import vn.education.core.web.common.WebConstant;
import vn.education.core.web.utils.FormUtil;
import vn.education.core.web.utils.RequestUtil;
import vn.education.core.web.utils.SingletonServiceUtil;
import javax.servlet.RequestDispatcher;
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 java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@WebServlet(urlPatterns = {"/bai-tap-thuc-hanh.html","/ajax-bai-tap-dap-an.html"})
public class ExerciseQuestionController extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ExerciseQuestionCommand command = FormUtil.populate(ExerciseQuestionCommand.class, request);
getListExerciseQuestion(request, command);
request.setAttribute(WebConstant.LIST_ITEMS, command);
RequestDispatcher rd = request.getRequestDispatcher("/views/web/exercise/detail.jsp");
rd.forward(request,response);
}
private void getListExerciseQuestion(HttpServletRequest request, ExerciseQuestionCommand command) {
Map<String, Object> properties = buildMapProperties(request, command);
command.setMaxPageItems(1);
RequestUtil.initSearchBeanManual(command);
Object[] objects = SingletonServiceUtil.getExerciseQuestionServiceInstance().findExerciseQuestionByProperties(properties,command.getSortExpression(), command.getSortDirection(), command.getFirstItem(), command.getMaxPageItems());
command.setListResult((List<ExerciseQuestionDTO>) objects[1]);
command.setTotalItems(Integer.parseInt(objects[0].toString()));
command.setTotalPages((int)Math.ceil((double) command.getTotalItems() / command.getMaxPageItems()));
}
private Map<String, Object> buildMapProperties(HttpServletRequest request, ExerciseQuestionCommand command) {
ExerciseQuestionDTO pojo = command.getPojo();
Map<String, Object> properties = new HashMap<String, Object>();
// if(pojo.getExercise() != null && pojo.getExercise().getExerciseId() != null) {
// properties.put("exerciseid", pojo.getExercise().getExerciseId());
// }
if(request.getParameter("exerciseId") != null) {
properties.put("exerciseid", request.getParameter("exerciseId"));
}
return properties;
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
ExerciseQuestionCommand command = FormUtil.populate(ExerciseQuestionCommand.class, request);
getListExerciseQuestion(request, command);
for(ExerciseQuestionDTO item : command.getListResult()) {
if(!command.getAnswerUser().equals(item.getCorrectAnswer())) {
command.setCheckAnswer(true);
}
}
request.setAttribute(WebConstant.LIST_ITEMS, command);
RequestDispatcher rd = request.getRequestDispatcher("/views/web/exercise/result.jsp");
rd.forward(request,response);
}
}
| [
"nguyenhien.py.1996@gmail.com"
] | nguyenhien.py.1996@gmail.com |
380de65662956aa4462e5de6b9d2648f59c2d781 | 211fa4a4a504f0983066131e20d90c47a7e8c785 | /language/pt.fct.unl.novalincs.useme.model.edit/src/pt/fct/unl/novalincs/useme/model/GoalModeling/provider/MethodItemProvider.java | 4e8d69cf07c02335d11b103eb11546cae992654d | [] | no_license | MiguelGoulao/useme | 58bd02fff8cd1818b910a7870d4da0a08daea0d6 | d323a1457584bcea2d090e852f0ec9117354fdce | refs/heads/master | 2021-01-01T17:53:52.209516 | 2017-07-21T13:41:34 | 2017-07-21T13:41:34 | 98,192,226 | 0 | 0 | null | 2017-07-24T13:12:44 | 2017-07-24T13:12:44 | null | UTF-8 | Java | false | false | 8,678 | java | /**
*/
package pt.fct.unl.novalincs.useme.model.GoalModeling.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import pt.fct.unl.novalincs.useme.model.GoalModeling.GoalModelingPackage;
import pt.fct.unl.novalincs.useme.model.GoalModeling.Method;
import pt.fct.unl.novalincs.useme.model.UseMe.provider.UseMeEditPlugin;
/**
* This is the item provider adapter for a {@link pt.fct.unl.novalincs.useme.model.GoalModeling.Method} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class MethodItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public MethodItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addNamePropertyDescriptor(object);
addMethodDescriptionPropertyDescriptor(object);
addUsabilityGoalPropertyDescriptor(object);
addTestCasePropertyDescriptor(object);
addUsabilityRequirementPropertyDescriptor(object);
addFunctionalGoalPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_name_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_name_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Method Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addMethodDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_methodDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_methodDescription_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__METHOD_DESCRIPTION,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Usability Goal feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addUsabilityGoalPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_usabilityGoal_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_usabilityGoal_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__USABILITY_GOAL,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Test Case feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTestCasePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_testCase_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_testCase_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__TEST_CASE,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Usability Requirement feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addUsabilityRequirementPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_usabilityRequirement_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_usabilityRequirement_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__USABILITY_REQUIREMENT,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Functional Goal feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addFunctionalGoalPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Method_functionalGoal_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Method_functionalGoal_feature", "_UI_Method_type"),
GoalModelingPackage.Literals.METHOD__FUNCTIONAL_GOAL,
true,
false,
true,
null,
null,
null));
}
/**
* This returns Method.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Method"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Method)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Method_type") :
getString("_UI_Method_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Method.class)) {
case GoalModelingPackage.METHOD__NAME:
case GoalModelingPackage.METHOD__METHOD_DESCRIPTION:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return UseMeEditPlugin.INSTANCE;
}
}
| [
"Ankica@10.0.2.15"
] | Ankica@10.0.2.15 |
5e45a9f98066205c39fadc6dc57603b52d3caeb9 | e3d3eda3a554e6af9e49dbe3d943e2a6a7c4e5f0 | /Introduction to Software Development/faktorial.java | 1f854e6327bbe16b68ab6e677f5cfa5b5e5b9472 | [] | no_license | frankskol/SoftwareDevelopmentClass | 7d50fe4b411f4836e4b1e80b62cb589d0926cf96 | 2eb021080d9374994a2a4c95d8a9f9d21d83e1ae | refs/heads/master | 2018-11-14T22:44:51.439901 | 2018-09-01T23:08:53 | 2018-09-01T23:08:53 | 122,471,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | public class faktorial{
public static void main(String [] args) {
Out.println ("Ganzzahldurschnitt\n==================\n");
Out.println ("Nummer eingeben: ");
int nummer = In.readInt();
int sum = 1;
for (int i = nummer; i >= 1; i--){
Out.print(i + " * ");
sum = sum * i;
}
Out.print(" =" + sum);
Out.println ("\nEnd!");
}
} | [
"frankicoxl2@gmail.com"
] | frankicoxl2@gmail.com |
2cc8f7f4e0fcb215109c3bebb1a7099a0e6120bd | d66be5471ac454345de8f118ab3aa3fe55c0e1ee | /providers/slicehost/src/main/java/org/jclouds/slicehost/compute/strategy/SlicehostLifeCycleStrategy.java | 6a3b01b35764089564843263acd97ec2157d62b4 | [
"Apache-2.0"
] | permissive | adiantum/jclouds | 3405b8daf75b8b45e95a24ff64fda6dc3eca9ed6 | 1cfbdf00f37fddf04249feedd6fc18ee122bdb72 | refs/heads/master | 2021-01-18T06:02:46.877904 | 2011-04-05T07:14:18 | 2011-04-05T07:14:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,097 | java | /**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* 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.jclouds.slicehost.compute.strategy;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.compute.strategy.RebootNodeStrategy;
import org.jclouds.compute.strategy.ResumeNodeStrategy;
import org.jclouds.compute.strategy.SuspendNodeStrategy;
import org.jclouds.slicehost.SlicehostClient;
/**
*
* @author Adrian Cole
*/
@Singleton
public class SlicehostLifeCycleStrategy implements RebootNodeStrategy, SuspendNodeStrategy, ResumeNodeStrategy {
private final SlicehostClient client;
private final GetNodeMetadataStrategy getNode;
@Inject
protected SlicehostLifeCycleStrategy(SlicehostClient client, GetNodeMetadataStrategy getNode) {
this.client = client;
this.getNode = getNode;
}
@Override
public NodeMetadata rebootNode(String id) {
int sliceId = Integer.parseInt(id);
client.hardRebootSlice(sliceId);
return getNode.getNode(id);
}
@Override
public NodeMetadata suspendNode(String id) {
throw new UnsupportedOperationException("suspend not supported");
}
@Override
public NodeMetadata resumeNode(String id) {
throw new UnsupportedOperationException("resume not supported");
}
} | [
"adrian@jclouds.org"
] | adrian@jclouds.org |
dd6cc7ce74ac667470a3456b5c4f2f51b5c1f7c6 | f0f2433122acd275cc61d3b791531c51d192c1f0 | /app/src/main/java/ru/ifmo/practice/util/task/DownloadImageTask.java | 564f734e2ada8b86d6abdb7375dde0c1d8654c33 | [] | no_license | deledzis/VK-SmartFeed | 9ae3bbea05736e5d1f941024736dc84dc03aade4 | e769c1fb7b3cd5ed0fbef90673f5aba9b1191acb | refs/heads/master | 2022-01-10T15:28:06.323309 | 2019-05-18T21:57:19 | 2019-05-18T21:57:19 | 78,027,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package ru.ifmo.practice.util.task;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import java.io.InputStream;
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
@Override
protected Bitmap doInBackground(String... urls) {
String urlDisplay = urls[0];
Bitmap mIcon = null;
try {
InputStream in = new java.net.URL(urlDisplay).openStream();
mIcon = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon;
}
}
| [
"sstyagov2@gmail.com"
] | sstyagov2@gmail.com |
bdd1d4a32a09d7735820ddc502185c79aab0363f | d5515553d071bdca27d5d095776c0e58beeb4a9a | /src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java | fa0ec74e26f56af480b675e877d0c1e5bde48a2f | [] | no_license | ccamel/plantuml | 29dfda0414a3dbecc43696b63d4dadb821719489 | 3100d49b54ee8e98537051e071915e2060fe0b8e | refs/heads/master | 2022-07-07T12:03:37.351931 | 2016-12-14T21:01:03 | 2016-12-14T21:01:03 | 77,067,872 | 1 | 0 | null | 2022-05-30T09:56:21 | 2016-12-21T16:26:58 | Java | UTF-8 | Java | false | false | 1,577 | java | /* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2017, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.activitydiagram3.ftile;
public abstract class AbstractConnection implements Connection {
private final Ftile ftile1;
private final Ftile ftile2;
public AbstractConnection(Ftile ftile1, Ftile ftile2) {
this.ftile1 = ftile1;
this.ftile2 = ftile2;
}
@Override
public String toString() {
return "[" + ftile1 + "]->[" + ftile2 + "]";
}
final public Ftile getFtile1() {
return ftile1;
}
final public Ftile getFtile2() {
return ftile2;
}
}
| [
"plantuml@gmail.com"
] | plantuml@gmail.com |
37c4b6f69bc83623fe3b3deb3a28b82d2fdd9fdd | b449d1c5fcfc09d2c9305ab4811784b9658d1e8a | /app/src/main/java/com/sadi/sreda/MyApplication.java | 4d01a0e0fd6ff4f55583abd33a78af599aad745d | [] | no_license | shahkutub/MonitoringAttendense | c7444bc819302458669263d809f8c14aa23bc1fb | 7eaf2c1ae3f707f28ffa6999c05164272c7b8d87 | refs/heads/master | 2021-04-30T08:39:26.436061 | 2018-05-17T17:18:49 | 2018-05-17T17:18:49 | 121,380,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.sadi.sreda;
import android.app.Application;
import com.sadi.sreda.utils.TypefaceUtil;
/**
* Created by Sadi on 2/18/2018.
*/
public class MyApplication extends Application{
@Override
public void onCreate() {
super.onCreate();
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/SolaimanLipi_reg.ttf");
}
}
| [
"shah.kutub1@gmail.com"
] | shah.kutub1@gmail.com |
f27dbaf8c8392e5a4558eb698406feaa3a2b626f | 1a5ae4a7e7fd788f6b4895548e3d7aa6ca27eb86 | /src/main/java/com/luv2code/springboot/cruddemo/dto/ReactToEvent.java | 8769b3d8494c845c0a81ca444cbc6a96455b5842 | [] | no_license | gudik-zoe/scai-project-be | 2d83b79bc2dff0ac5c2554e98fd8bb129b03d120 | 24dba346e9b84a9fe3057a78e868df0b9580068d | refs/heads/master | 2023-04-24T13:06:27.404568 | 2021-05-10T16:05:08 | 2021-05-10T16:05:08 | 310,256,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | package com.luv2code.springboot.cruddemo.dto;
public class ReactToEvent {
private int idEvent;
private int status;
public ReactToEvent() {
}
public ReactToEvent(int idEvent, int status) {
this.idEvent = idEvent;
this.status = status;
}
public int getIdEvent() {
return idEvent;
}
public void setIdEvent(int idEvent) {
this.idEvent = idEvent;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"tony_khoury993@hotmail.com"
] | tony_khoury993@hotmail.com |
3bfa31ca2743e852e43c9b5d4cab2fae0ae625f4 | 20c7381fea7b2ed6ea8c0201838541a396175872 | /LoadToDataMart - Copy.java | f07f25027d1773c1b24ffe0a766e36fc4da89dc3 | [] | no_license | tudvt/DataWareHouse | 98732b43109cd7dd0e11e5f617a67fa1811262c2 | ebc33eb2fcf4e90b2216ce233a0dcd9959594153 | refs/heads/master | 2022-11-03T07:48:29.560804 | 2020-06-20T17:44:43 | 2020-06-20T17:49:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,938 | java | import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.mysql.jdbc.PreparedStatement;
public class LoadToDataMart {
public static void load(String locationsrc, String locationdes) throws SQLException {
String jdbcURL = "localhost";
String username = "root";
String password = "123456";
PreparedStatement statement = null;
Connection connection = null;
String connectionURL = "jdbc:mysql://localhost:3306/datamart?rewriteBatchedStatements=true&relaxAutoCommit=true";
connection = DriverManager.getConnection(connectionURL, username, password);
System.out.println("ssssssss");
// copy to another db(datamart)
Statement stmt = connection.createStatement();
String sql2 = "insert '" + locationsrc + "' select * from '" + locationdes + "'";
ResultSet rs = stmt.executeQuery(sql2);
stmt.addBatch(sql2);
rs = stmt.executeQuery(sql2);
stmt.executeBatch();
System.out.println("dddddddddd");
}
public static void main(String[] args) throws SQLException {
System.out.println("dsd");
String jdbcURL = "localhost";
String username = "root";
String password = "123456";
PreparedStatement statement = null;
Connection connection = null;
String connectionURL = "jdbc:mysql://localhost:3306/datacontrol?rewriteBatchedStatements=true&relaxAutoCommit=true";
connection = DriverManager.getConnection(connectionURL, username, password);
// find file has status SU
String sql = "select datacontrol.locationsrc,datacontrol.locationdes,datacontrol.numoflistsrc from datacontrol inner join log on datacontrol.ID =log.id where log.statusend like 'TR'";
// statement = connection.prepareStatement(sql);
// statement.execute();
// System.out.println("thnh congf");
// create the java statement
Statement stmt = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
connection.setAutoCommit(false);
// execute the query, and get a java resultset
stmt.addBatch(sql);
ResultSet rs = stmt.executeQuery(sql);
// iterate through the java resultset
String locationsrc = "";
String locationdes = "";
String numoflistsrc = "";
while (rs.next()) {
locationsrc = rs.getString("datacontrol.locationsrc");
locationdes = rs.getString("datacontrol.locationdes");
numoflistsrc = rs.getString("datacontrol.numoflistsrc");
// print the results
System.out.format("%s, %s, %s\n", locationsrc, locationdes, numoflistsrc);
}
connection.commit();
System.out.println("ssssssss");
// copy to another db(datamart)
String sql3="insert datamart.datamart select * from sinhvien.sinhvien";
stmt.executeUpdate(sql3);
//String sql2 = "update sinhvien.hocsinh set sinhvien.hocsinh.Tên='f' where sinhvien.hocsinh.STT like '1'";
// stmt.executeUpdate(sql2);
System.out.println("rưerwer");
System.out.println("dddddddddd");
}
} | [
"dotuongtu196@gmail.com"
] | dotuongtu196@gmail.com |
51fb3f5284de02422337209c8ea6d2a5ed9c446f | 7e8ae6869fc414264c2d25ed85d8070fb35d0fd2 | /src/test/java/stepDef/PolicyDetailsStepDef.java | e41bb44b0bd7520e908863c267d1260ed2d53124 | [] | no_license | goufei123/UIAutomationScript | 162727bf087bfd2a27cb084f7cf8777dcd38c386 | 36687eb06be3e6c676cd09d6b54dc0c00b92b899 | refs/heads/master | 2023-07-21T22:27:16.317140 | 2021-08-26T11:13:24 | 2021-08-26T11:13:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,554 | java | package stepDef;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.asserts.SoftAssert;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import junit.framework.Assert;
import utility.Utility;
public class PolicyDetailsStepDef {
private WebDriver driver;
String policyName;
String compName = "rails";
String compName1 = "sinatra";
String compName2 = "administrate";
public PolicyDetailsStepDef() {
this.driver = Hook.getDriver();
}
@When("^Get the policy details page information$")
public void get_the_policy_details_page_information() throws Throwable {
String policyDetailPageTitle = driver.findElement(By.xpath("//a[text()='Policy Detail']")).getText();
SoftAssert soft = new SoftAssert();
soft.assertEquals(policyDetailPageTitle, "Policy Detail");
System.out.println("Policy Detail page Title ==>" + policyDetailPageTitle);
}
@When("^Get the policy name$")
public void get_the_policy_name() throws Throwable {
policyName = driver.findElement(By.xpath("(//h4)[1]")).getText();
}
@Then("^validate the policy name$")
public void validate_the_policy_name() throws Throwable {
//Thread.sleep(1000);
//System.out.println(policyName);
//String policyNm = policyName.substring(11, 21);
//System.out.println("Policy name ==>" + policyNm);
//SoftAssert soft = new SoftAssert();
//soft.assertEquals(policyNm, "testPolicy");
}
@When("^Click on Denied Add rule$")
public void click_on_Denied_Add_rule() throws Throwable {
driver.findElement(By.xpath("(//span[text()='Add Rule'])[1]")).click();
String parenthandler = driver.getWindowHandle();
for (String winhandle : driver.getWindowHandles()) {
driver.switchTo().window(winhandle);
}
}
@When("^Create the rule with single attribute for Component$")
public void create_the_rule_with_single_attribute_for_Component() throws Throwable {
Thread.sleep(3000);
driver.findElement(By.xpath("(//span[@class='el-radio__inner'])[1]")).click();
/* driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[1]")).click();
List<WebElement> list = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele : list) {
String dropdownValue = ele.getText();
if (dropdownValue.equalsIgnoreCase("Component")) {
if(ele.isDisplayed()==true) {
ele.click();
break;
}else {
driver.findElement(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span")).click();
}
}
}*/
// driver.findElement(By.xpath("//input[@value='single']")).click();
driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[2]")).click();
List<WebElement> list1 = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele1 : list1) {
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Name")) {
ele1.click();
}
}
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@role='textbox']")).sendKeys(compName);
String composition = driver.findElement(By.xpath("//label[text()='Composition']/following::div[1]/div"))
.getText();
Assert.assertEquals(composition, "Deny whenever component name equals " + compName);
System.out.println("\nCreated Rule is ==>" + composition);
new WebDriverWait(driver, 1000).until(ExpectedConditions.elementToBeClickable(By.xpath("//button[text()='Add Rule']")));
driver.findElement(By.xpath("//button[text()='Add Rule']")).click();
}
@Then("^Validate the created rule$")
public void validate_the_created_rule() throws Throwable {
WebDriverWait wait = new WebDriverWait(driver,50);
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@class='item-style']/span")));
List<WebElement> list1 = driver.findElements(By.xpath("//div[@class='item-style']/span"));
for (WebElement ele1 : list1) {
Utility.retryingFindClick(ele1);
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Deny whenever component name equals click")) {
System.out.println("Validated Created Rule is ==>" +dropdownValue);
}else {
System.out.println("not matching");
}
}
}
@When("^Click on Flagged Add rule$")
public void click_on_Flagged_Add_rule() throws Throwable {
driver.findElement(By.xpath("(//span[text()='Add Rule'])[2]")).click();
String parenthandler = driver.getWindowHandle();
for (String winhandle : driver.getWindowHandles()) {
driver.switchTo().window(winhandle);
}
}
@When("^Create the rule with single attribute for Component with flagged policy rule$")
public void create_the_rule_with_single_attribute_for_Component_with_flagged_policy_rule() throws Throwable {
Thread.sleep(3000);
/*driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[1]")).click();
List<WebElement> list = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele : list) {
String dropdownValue = ele.getText();
if (dropdownValue.equalsIgnoreCase("Component")) {
if(ele.isDisplayed()==true) {
ele.click();
break;
}else {
driver.findElement(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span")).click();
}
}
}*/
// driver.findElement(By.xpath("//input[@value='single']")).click();
driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[2]")).click();
List<WebElement> list1 = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele1 : list1) {
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Name")) {
ele1.click();
}
}
driver.findElement(By.xpath("//input[@role='textbox']")).sendKeys(compName1);
String composition = driver.findElement(By.xpath("//label[text()='Composition']/following::div[1]/div"))
.getText();
Assert.assertEquals(composition, "Flag whenever component name equals " + compName1);
System.out.println("\nCreated Rule is ==>" + composition);
driver.findElement(By.xpath("//button[text()='Add Rule']")).click();
}
@Then("^Validate the created rule with flagged policy rule$")
public void validate_the_created_rule_with_flagged_policy_rule() throws Throwable {
WebDriverWait wait = new WebDriverWait(driver,50);
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@class='item-style']/span")));
List<WebElement> list1 = driver.findElements(By.xpath("//div[@class='item-style']/span"));
for (WebElement ele1 : list1) {
Utility.retryingFindClick(ele1);
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Flag whenever component name equals django")) {
System.out.println("Validated Created Rule is ==>" + dropdownValue);
}
}
}
@When("^Click on Approved Add rule$")
public void click_on_Approved_Add_rule() throws Throwable {
driver.findElement(By.xpath("(//span[text()='Add Rule'])[3]")).click();
String parenthandler = driver.getWindowHandle();
for (String winhandle : driver.getWindowHandles()) {
driver.switchTo().window(winhandle);
}
}
@When("^Create the rule with single attribute for Component with Approved policy rule$")
public void create_the_rule_with_single_attribute_for_Component_with_Approved_policy_rule() throws Throwable {
Thread.sleep(3000);
/*driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[1]")).click();
List<WebElement> list = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele : list) {
String dropdownValue = ele.getText();
if (dropdownValue.equalsIgnoreCase("Component")) {
if(ele.isDisplayed()==true) {
ele.click();
break;
}else {
driver.findElement(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span")).click();
}
}
}*/
// driver.findElement(By.xpath("//input[@value='single']")).click();
(new WebDriverWait(driver, 100)).until(ExpectedConditions.presenceOfElementLocated(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[2]")));
driver.findElement(By.xpath("(//i[@class='el-select__caret el-input__icon el-icon-arrow-up'])[2]")).click();
List<WebElement> list1 = driver
.findElements(By.xpath("//ul[@class='el-scrollbar__view el-select-dropdown__list']/li/span"));
for (WebElement ele1 : list1) {
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Name")) {
ele1.click();
}
}
driver.findElement(By.xpath("//input[@role='textbox']")).sendKeys(compName2);
String composition = driver.findElement(By.xpath("//label[text()='Composition']/following::div[1]/div"))
.getText();
Assert.assertEquals(composition, "Approve whenever component name equals " + compName2);
System.out.println("\nCreated Rule is ==>" + composition);
driver.findElement(By.xpath("//button[text()='Add Rule']")).click();
}
@Then("^Validate the created rule with Approved policy rule$")
public void validate_the_created_rule_with_Approved_policy_rule() throws Throwable {
WebDriverWait wait = new WebDriverWait(driver,50);
wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//div[@class='item-style']/span")));
List<WebElement> list1 = driver.findElements(By.xpath("//div[@class='item-style']/span"));
for (WebElement ele1 : list1) {
Utility.retryingFindClick(ele1);
String dropdownValue = ele1.getText();
if (dropdownValue.equalsIgnoreCase("Approve whenever component name equals numpy")) {
System.out.println("Validated Created Rule is ==>" + dropdownValue);
}
}
}
/*
* public Boolean retryingFindClick(WebElement element) { Boolean result =
* false; int attempts = 0; while (attempts < 2) { try { WebElement ele = null;
* ele.click(); result = true; break; } catch (StaleElementReferenceException e)
* { } attempts++; } return result; }
*/
}
| [
"gitlanuser@gmail.com"
] | gitlanuser@gmail.com |
f52ac5e43882b6cc0a8e031d42dde04fb66a34a1 | 45736204805554b2d13f1805e47eb369a8e16ec3 | /net/minecraft/creativetab/CreativeTabs.java | 1f0140d9dc24d19a710d31becf13d39160504ab1 | [] | no_license | KrOySi/ArchWare-Source | 9afc6bfcb1d642d2da97604ddfed8048667e81fd | 46cdf10af07341b26bfa704886299d80296320c2 | refs/heads/main | 2022-07-30T02:54:33.192997 | 2021-08-08T23:36:39 | 2021-08-08T23:36:39 | 394,089,144 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,002 | java | /*
* Decompiled with CFR 0.150.
*
* Could not load the following classes:
* javax.annotation.Nullable
*/
package net.minecraft.creativetab;
import javax.annotation.Nullable;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.NonNullList;
public abstract class CreativeTabs {
public static final CreativeTabs[] CREATIVE_TAB_ARRAY = new CreativeTabs[12];
public static final CreativeTabs BUILDING_BLOCKS = new CreativeTabs(0, "buildingBlocks"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Item.getItemFromBlock(Blocks.BRICK_BLOCK));
}
};
public static final CreativeTabs DECORATIONS = new CreativeTabs(1, "decorations"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Item.getItemFromBlock(Blocks.DOUBLE_PLANT), 1, BlockDoublePlant.EnumPlantType.PAEONIA.getMeta());
}
};
public static final CreativeTabs REDSTONE = new CreativeTabs(2, "redstone"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.REDSTONE);
}
};
public static final CreativeTabs TRANSPORTATION = new CreativeTabs(3, "transportation"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Item.getItemFromBlock(Blocks.GOLDEN_RAIL));
}
};
public static final CreativeTabs MISC = new CreativeTabs(6, "misc"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.LAVA_BUCKET);
}
};
public static final CreativeTabs SEARCH = new CreativeTabs(5, "search"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.COMPASS);
}
}.setBackgroundImageName("item_search.png");
public static final CreativeTabs FOOD = new CreativeTabs(7, "food"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.APPLE);
}
};
public static final CreativeTabs TOOLS = new CreativeTabs(8, "tools"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.IRON_AXE);
}
}.setRelevantEnchantmentTypes(EnumEnchantmentType.ALL, EnumEnchantmentType.DIGGER, EnumEnchantmentType.FISHING_ROD, EnumEnchantmentType.BREAKABLE);
public static final CreativeTabs COMBAT = new CreativeTabs(9, "combat"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Items.GOLDEN_SWORD);
}
}.setRelevantEnchantmentTypes(EnumEnchantmentType.ALL, EnumEnchantmentType.ARMOR, EnumEnchantmentType.ARMOR_FEET, EnumEnchantmentType.ARMOR_HEAD, EnumEnchantmentType.ARMOR_LEGS, EnumEnchantmentType.ARMOR_CHEST, EnumEnchantmentType.BOW, EnumEnchantmentType.WEAPON, EnumEnchantmentType.WEARABLE, EnumEnchantmentType.BREAKABLE);
public static final CreativeTabs BREWING = new CreativeTabs(10, "brewing"){
@Override
public ItemStack getTabIconItem() {
return PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER);
}
};
public static final CreativeTabs MATERIALS = MISC;
public static final CreativeTabs field_192395_m = new CreativeTabs(4, "hotbar"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Blocks.BOOKSHELF);
}
@Override
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_) {
throw new RuntimeException("Implement exception client-side.");
}
@Override
public boolean func_192394_m() {
return true;
}
};
public static final CreativeTabs INVENTORY = new CreativeTabs(11, "inventory"){
@Override
public ItemStack getTabIconItem() {
return new ItemStack(Item.getItemFromBlock(Blocks.CHEST));
}
}.setBackgroundImageName("inventory.png").setNoScrollbar().setNoTitle();
private final int tabIndex;
private final String tabLabel;
private String theTexture = "items.png";
private boolean hasScrollbar = true;
private boolean drawTitle = true;
private EnumEnchantmentType[] enchantmentTypes = new EnumEnchantmentType[0];
private ItemStack iconItemStack;
public CreativeTabs(int index, String label) {
this.tabIndex = index;
this.tabLabel = label;
this.iconItemStack = ItemStack.field_190927_a;
CreativeTabs.CREATIVE_TAB_ARRAY[index] = this;
}
public int getTabIndex() {
return this.tabIndex;
}
public String getTabLabel() {
return this.tabLabel;
}
public String getTranslatedTabLabel() {
return "itemGroup." + this.getTabLabel();
}
public ItemStack getIconItemStack() {
if (this.iconItemStack.func_190926_b()) {
this.iconItemStack = this.getTabIconItem();
}
return this.iconItemStack;
}
public abstract ItemStack getTabIconItem();
public String getBackgroundImageName() {
return this.theTexture;
}
public CreativeTabs setBackgroundImageName(String texture) {
this.theTexture = texture;
return this;
}
public boolean drawInForegroundOfTab() {
return this.drawTitle;
}
public CreativeTabs setNoTitle() {
this.drawTitle = false;
return this;
}
public boolean shouldHidePlayerInventory() {
return this.hasScrollbar;
}
public CreativeTabs setNoScrollbar() {
this.hasScrollbar = false;
return this;
}
public int getTabColumn() {
return this.tabIndex % 6;
}
public boolean isTabInFirstRow() {
return this.tabIndex < 6;
}
public boolean func_192394_m() {
return this.getTabColumn() == 5;
}
public EnumEnchantmentType[] getRelevantEnchantmentTypes() {
return this.enchantmentTypes;
}
public CreativeTabs setRelevantEnchantmentTypes(EnumEnchantmentType ... types) {
this.enchantmentTypes = types;
return this;
}
public boolean hasRelevantEnchantmentType(@Nullable EnumEnchantmentType enchantmentType) {
if (enchantmentType != null) {
for (EnumEnchantmentType enumenchantmenttype : this.enchantmentTypes) {
if (enumenchantmenttype != enchantmentType) continue;
return true;
}
}
return false;
}
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_) {
for (Item item : Item.REGISTRY) {
item.getSubItems(this, p_78018_1_);
}
}
}
| [
"67242784+KrOySi@users.noreply.github.com"
] | 67242784+KrOySi@users.noreply.github.com |
7c298289924d3a3a7c163069c2a13747c8fd5a31 | e291e86e39c5c381089823b8e0cbc6e37129be0d | /backend/src/main/java/com/nchernetsov/fintracking/to/UserTo.java | 79e817868bdfdf4c112347150b65612f5a1f268f | [] | no_license | ChernetsovNG/fintracking_01_04_2017 | 6606b482e1671a0ada3ae6c3126d1f48c9e0e609 | 04b26e364d112d196ac8b00f4b6c188217be9aae | refs/heads/master | 2021-01-19T00:54:03.088799 | 2017-03-20T19:20:27 | 2017-03-20T19:20:27 | 87,216,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,774 | java | package com.nchernetsov.fintracking.to;
import com.nchernetsov.fintracking.util.HasId;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.SafeHtml;
import javax.validation.constraints.Size;
import java.io.Serializable;
public class UserTo implements HasId, Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
@NotBlank
@SafeHtml
private String name;
@Email
@NotBlank
@SafeHtml
private String email;
@Size(min = 5, max = 64, message = " must between 5 and 64 characters")
@SafeHtml
private String password;
public UserTo() {
}
public UserTo(Integer id, String name, String email, String password) {
this.id = id;
this.name = name;
this.email = email;
this.password = password;
}
@Override
public Integer getId() {
return id;
}
@Override
public void setId(Integer id) {
this.id = id;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public boolean isNew() {
return id == null;
}
@Override
public String toString() {
return "UserTo{" +
"id=" + id +
", name='" + name + '\'' +
", email='" + email + '\'' +
'}';
}
}
| [
"n.chernetsov86@gmail.com"
] | n.chernetsov86@gmail.com |
c4ebc151feb57e2be5ffc89f4608470b34019819 | 54a2aacf95d5215f96dd5fcfd8dec061466051cb | /ArrayStrings/KMP.java | c51a89b89c9fad686c23ddc04d3d473b992152ae | [] | no_license | robiee97/DSA_IP | 0ca68777ed57e42a3242d6aae7d2eeca2fb2a662 | e8d2a2f14a9ee78866cca3d46dd88d72eabe414f | refs/heads/master | 2023-01-24T17:57:25.398510 | 2020-11-28T19:37:10 | 2020-11-28T19:37:10 | 281,068,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java |
public class KMP {
public static int[] getLPS(String pattern) {
int j = 0;
int i = 1;
int[] lps = new int[pattern.length()];
lps[0] = 0;
while (i < pattern.length()) {
if (pattern.charAt(i) == pattern.charAt(j)) {
lps[i] = j + 1;
i++;
j++;
} else {
if (j == 0) {
lps[i] = 0;
i++;
} else {
j = lps[j - 1];
}
}
}
return lps;
}
public static void kmp(String text, String pattern) {
int[] lps = getLPS(pattern);
int i = 0;
int j = 0;
while (i < text.length()) {
if (text.charAt(i) == pattern.charAt(j)) {
i++;
j++;
if (j == pattern.length()) {
System.out.println("pattern found at " + (i - pattern.length()));
j = lps[j - 1];
}
} else {
if (j == 0) {
i++;
} else {
j = lps[j - 1];
}
}
}
}
public static void main(String[] args) {
String text = "nkasdhflkjdshfiluweaifusbdkjfahidufehiudskfjweiufhiuefkjsdbfiuefiuerhfjkeriugfrefie";
String pattern = "usbdkjf";
kmp(text, pattern);
}
}
| [
"robinkr.8cl@gmail.com"
] | robinkr.8cl@gmail.com |
9c8f697fb0c7acfde0da176d357f316cc8b1b41f | ee47df4e2119b92fd1ca5e225d7be0e633d2146e | /XML2RDF/src/main/java/DataCrawler/OpenAIRE/OAI_PMH_SaxHandler.java | cbfc7a0467ecf47fc8c5259d33372a9193aed030 | [] | no_license | allen501pc/XML2RDF | 53f7a00f52fbfbe5cf348453ece6490e96c8d474 | c569179f4242db00fcdf01f2557755160e746c06 | refs/heads/master | 2021-01-22T02:49:19.956223 | 2016-02-02T03:14:36 | 2016-02-02T03:14:36 | 29,346,483 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,081 | java | package DataCrawler.OpenAIRE;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Stack;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.lang.StringEscapeUtils;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class OAI_PMH_SaxHandler extends DefaultHandler {
public boolean isFirstPage = true, enterConsumptionElement = false, shouldOutputContent = false ;
public static String NextURL = "";
public static long currentRuns = 0;
public static long maxRuns = 10;
public static FileWriter outputStream ;
public static String outputFilePath = "", consumptionTag = "oai:resumptionToken";
public static String[] ElementNamesOfFirstPage = {"oai:OAI-PMH", "oai:responseDate", "oai:request", "oai:ListRecords"};
public static boolean[] shouldOutputInTheEndOfDocuments = {true, false, false, true};
public static Stack<String> endElements = new Stack<String>();
public static SAXParserFactory factory ;
public static boolean isReady = true;
public void setAsFirstPage(boolean isFirst) {
isFirstPage = isFirst;
}
public void setMaxRuns(long maxNum) {
maxRuns = maxNum;
}
public void setOutputPath(String path) {
outputFilePath = path;
}
public void startDocument() throws SAXException {
NextURL = "";
++currentRuns;
if(maxRuns > 0 && currentRuns > maxRuns) {
throw new SAXException("end of runs:" + maxRuns);
}
isReady = false;
if(isFirstPage) {
try {
outputStream = new FileWriter(outputFilePath, true);
outputStream.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + System.lineSeparator());
if(ElementNamesOfFirstPage.length == shouldOutputInTheEndOfDocuments.length) {
for(int i = 0 ; i < ElementNamesOfFirstPage.length; ++i) {
if(shouldOutputInTheEndOfDocuments[i])
endElements.push(ElementNamesOfFirstPage[i]);
}
}
} catch (IOException e) {
System.out.println("Cannot output data: " + e.getMessage());
}
}
}
public void endDocument() throws SAXException {
/*
if(isFirstPage) {
try {
// outputStream.close();
} catch (IOException e) {
System.out.println("Cannot close output data: " + e.getMessage());
}
} */
isReady = true;
}
public void startElement(String uri, String localName,
String qName, Attributes attributes) {
shouldOutputContent = false;
if(qName.equals(consumptionTag)) {
// Enter conSumption tag.
enterConsumptionElement = true;
} else {
if(isFirstPage) {
try {
shouldOutputContent = true;
outputStream.write("<" + qName );
for(int i = 0; i < attributes.getLength(); ++i) {
String myQName = attributes.getQName(i);
String myAttributeValue = attributes.getValue(i);
outputStream.write( " " + myQName + "=\"" + StringEscapeUtils.escapeXml(myAttributeValue) + "\"");
}
outputStream.write(">" + System.lineSeparator());
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
} else {
boolean hasElementsOfFirstPage = false;
for(int i = 0; i < ElementNamesOfFirstPage.length; ++i) {
if(qName.equals(ElementNamesOfFirstPage[i])) {
hasElementsOfFirstPage = true;
break;
}
}
if(!hasElementsOfFirstPage) {
try {
shouldOutputContent = true;
outputStream.write("<" + qName );
for(int i = 0; i < attributes.getLength(); ++i) {
String myQName = attributes.getQName(i);
String myAttributeValue = attributes.getValue(i);
outputStream.write( " " + myQName + "=\"" + StringEscapeUtils.escapeXml(myAttributeValue) + "\"");
}
outputStream.write(">" + System.lineSeparator());
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public void endElement(String uri, String localName,
String qName) {
if(!qName.equals(consumptionTag)) {
if(isFirstPage) {
boolean hasElementsOfFirstPage = false;
for(int i = 0; i < ElementNamesOfFirstPage.length; ++i) {
if(qName.equals(ElementNamesOfFirstPage[i]) && shouldOutputInTheEndOfDocuments[i] ) {
hasElementsOfFirstPage = true;
break;
}
}
if(!hasElementsOfFirstPage) {
try {
outputStream.write("</" + qName + ">" + System.lineSeparator() );
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
} else {
boolean hasElementsOfFirstPage = false;
for(int i = 0; i < ElementNamesOfFirstPage.length; ++i) {
if(qName.equals(ElementNamesOfFirstPage[i])) {
hasElementsOfFirstPage = true;
break;
}
}
if(!hasElementsOfFirstPage) {
try {
outputStream.write("</" + qName + ">" + System.lineSeparator() );
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
public void characters(char ch[], int start, int length) throws SAXException {
String value = new String(ch, start, length).trim();
if(value.isEmpty()) {
return;
}
if(enterConsumptionElement) {
OAI_PMH_URLGenerator myURL = new OAI_PMH_URLGenerator();
myURL.AddParameters("verb", "ListRecords");
myURL.AddParameters("resumptionToken", value);
NextURL = myURL.GenerateURL();
} else {
try {
if(shouldOutputContent) {
outputStream.write(StringEscapeUtils.escapeXml(value));
outputStream.flush();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
} | [
"allen501pc@gmail.com"
] | allen501pc@gmail.com |
392fb22f304ffe870b87695a14804982cdafbad1 | 9bc00109739f94abf7602df46478f040cf38032e | /prototype_TwoRoomsAndABoom/src/java/proto1/env/EnvView.java | 257f6c2b31a05ba72122233635d5dbbf37f6692a | [] | no_license | metaphori/as1415_conspiraboom | 4e36ddd5b5fdbf548be7433114157cdfdb6c98f3 | 13db65d1a4ec4341d75f2a4d92e1623030f85892 | refs/heads/master | 2020-12-11T06:06:22.387180 | 2014-12-19T12:55:40 | 2014-12-19T12:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,760 | java | package proto1.env;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.util.List;
import java.util.logging.Logger;
import javax.swing.JPanel;
import proto1.game.config.RoomRoles;
import proto1.game.config.Rooms;
import proto1.game.config.TeamRoles;
import proto1.game.config.Teams;
import proto1.game.impl.Player;
import proto1.game.impl.RoomRole;
import proto1.game.impl.Team;
import proto1.game.impl.TeamRole;
import proto1.game.interfaces.IPlayer;
import sun.font.FontScaler;
import jason.asSyntax.Literal;
import jason.asSyntax.Structure;
import jason.environment.Environment;
import jason.environment.grid.GridWorldModel;
import jason.environment.grid.GridWorldView;
import jason.infra.jade.JadeEnvironment;
public class EnvView extends GridWorldView {
protected Env env = null;
protected EnvModel hmodel = null;
public Team winner = null;
public void setWinner(Team winner){
this.winner = winner;
}
protected Logger logger = Logger.getLogger("View");
Font bigFont = new Font("ARIAL", Font.BOLD, 40);
public EnvView(EnvModel model, Env env){
super(model, "Two Rooms and a Boom", 500);
this.hmodel = model;
this.env = env;
defaultFont = new Font("Arial", Font.BOLD, 16); // change default font
setVisible(true);
repaint();
}
@Override public void draw(Graphics g, int x, int y, int object){
//System.out.println("draw");
if(object==Env.DOOR){
g.setColor(Color.LIGHT_GRAY);
super.drawString(g, x, y, new Font("Arial", Font.BOLD, 16), "DOOR");
}
else {
g.setColor(Color.BLACK);
super.draw(g, x, y, object);
}
}
@Override
public void drawAgent(Graphics g, int x, int y, Color c, int id) {
IPlayer reference = hmodel.getPlayerById(0);
super.drawString(g, 4,1, defaultFont, "Point of view: "+reference.getName());
int agId = hmodel.getAgAtPos(x, y);
IPlayer p = hmodel.getPlayerById(id);
Team team = null;
TeamRole tr = TeamRoles.NORMAL;
RoomRole rr = RoomRoles.NORMAL;
List<Literal> percepts = null;
//percepts = env.getPercepts(reference.getName());
percepts = env.consultPercepts(reference.getName());
if(percepts!=null){
for(Literal lt : percepts){
if(lt instanceof Structure){
Structure st = (Structure)lt;
if(st.getFunctor().equals("role")){
String name = st.getTerm(0).toString();
String team_name = st.getTerm(1).toString();
String role = st.getTerm(2).toString();
if(name.equals(p.getName())){
team = team_name.equals(Teams.BLUES.getName()) ? Teams.BLUES : Teams.REDS;
if(role.equals(TeamRoles.BOMBER.getName())){
tr = TeamRoles.BOMBER;
}
else if(role.equals(TeamRoles.PRESIDENT.getName())){
tr = TeamRoles.PRESIDENT;
}
}
} else if(st.getFunctor().equals("leader")){
String name = st.getTerm(0).toString();
if(name.equals(p.getName()))
rr = RoomRoles.LEADER;
}
}
}
}
if(tr.equals(TeamRoles.PRESIDENT)){
c = Color.CYAN;
} else if(tr.equals(TeamRoles.BOMBER)){
c = Color.ORANGE;
} else if(team!=null && team.equals(Teams.BLUES)){
c = Color.BLUE;
} else if(team!=null && team.equals(Teams.REDS)){
c = Color.RED;
}else{
c = Color.GRAY;
}
super.drawAgent(g, x, y, c, -1);
g.setColor(Color.BLACK);
String str = p.getName();
if(rr.equals(RoomRoles.LEADER.getName()))
str = "*"+str+"*";
super.drawString(g, x, y, defaultFont, str);
if(winner!=null){
String ws = winner.equals(Teams.BLUES) ? "PRESIDENT IS ALIVE" : "PRESIDENT ASSASSINATED";
g.setColor(winner.equals(Teams.BLUES) ? Color.BLUE : Color.RED);
super.drawString(g, model.getWidth()/2, model.getHeight()/2, bigFont, ws);
}
}
}
| [
"roberto.casadei12@studio.unibo.it"
] | roberto.casadei12@studio.unibo.it |
546e34ebb63a0d11e1cd714f6949561663813e47 | 338734333ab62bb26c5b6ee7c804747f9f34ec24 | /backend/jpa2-auth/src/com/banistmo/auth/web/dto/DataTransactionFilter.java | a51a2e9b3bdabec8bec609d9a8681676210bbbf8 | [] | no_license | luisjavierjn/authorizer | a30ddf17683f54c4a88f62261459d122d71d6aad | 06f5d003a0698f76249ba77912ac55b0a9900ee9 | refs/heads/master | 2023-01-13T20:21:10.471528 | 2020-11-24T03:28:52 | 2020-11-24T03:28:52 | 315,508,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,147 | java | package com.banistmo.auth.web.dto;
import java.util.Date;
public class DataTransactionFilter {
private String merchant;
private String terminalId;
private String rrnTokenTrans;
private Date tranDateFrom;
private Date tranDateTo;
private Integer lotNo;
public DataTransactionFilter() {
super();
}
public String getMerchant() {
return merchant;
}
public void setMerchant(String merchant) {
this.merchant = merchant;
}
public String getTerminalId() {
return terminalId;
}
public void setTerminalId(String terminalId) {
this.terminalId = terminalId;
}
public String getRrnTokenTrans() {
return rrnTokenTrans;
}
public void setRrnTokenTrans(String rrnTokenTrans) {
this.rrnTokenTrans = rrnTokenTrans;
}
public Date getTranDateFrom() {
return tranDateFrom;
}
public void setTranDateFrom(Date tranDateFrom) {
this.tranDateFrom = tranDateFrom;
}
public Date getTranDateTo() {
return tranDateTo;
}
public void setTranDateTo(Date tranDateTo) {
this.tranDateTo = tranDateTo;
}
public Integer getLotNo() {
return lotNo;
}
public void setLotNo(Integer lotNo) {
this.lotNo = lotNo;
}
}
| [
"luisjavierjn@gmail.com"
] | luisjavierjn@gmail.com |
c67aeba3ffbe3e36e36322749505ad54974d7ea1 | 067a106fb645d7a3fc2ac066bd13d1b069c0950c | /811000293 Assignment 2/Assignment2/app/src/main/java/com/example/warren/assignment2/Page.java | 75abfc5b3afcde56a43bb80874c60f2dd9c38151 | [] | no_license | renocon/Android-App-Elearndroid | 60160eebf25a6cafd8996aedf75a93599c2dfa8a | 6d77007fb27d554560639ca176160a3bddd9d6c7 | refs/heads/master | 2021-01-10T05:07:09.201266 | 2015-05-22T13:24:30 | 2015-05-22T13:24:30 | 36,073,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.example.warren.assignment2;
/**
* Created by Warren on 3/22/2015.
* This class defines the format of a page of a lesson. It contains some text to put in the TextView
* of the lesson viewer and an Image Resource ID to put in the image view. If the Image Resource ID
* is -1, the ImageView is set to be invisible as not all pages have images.
*/
public class Page {
public String txt;
public int img;
public Page(String text, int image){
txt = text;
img = image;
}
}
| [
"Warren-16@live.com"
] | Warren-16@live.com |
eeab8c80b7502d2ce896b6ceef5bdcdf81420e9e | b6b49e7f4b07150e47703b1a74335a88279d735c | /src/test/java/br/com/drogaria/dao/test/EstadoDaoTest.java | 889db9d7ae9515620b85df2fe580d0958b9f6afb | [] | no_license | Evertonnrb/Drograria_v2_final | c922e564a0c90e87b5b17a2912db9eb6d7384593 | fa6d00f28fdbec748d91e2cf5975be313556b007 | refs/heads/master | 2021-01-22T18:15:49.555074 | 2017-03-15T13:26:57 | 2017-03-15T13:26:57 | 85,075,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,168 | java | package br.com.drogaria.dao.test;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import br.com.drogaria.dao.EstadoDao;
import br.com.drogaria.domain.Estado;
public class EstadoDaoTest {
@Test
@Ignore
public void salvar(){
Estado estado = new Estado();
estado.setNome("Bahia");
estado.setSigla("BH");
EstadoDao dao = new EstadoDao();
dao.salvar(estado);
}
@Test
@Ignore
public void listar(){
EstadoDao dao = new EstadoDao();
List<Estado> lista = dao.listar();
System.out.println("Total de registros encontrados "+lista.size());
for(Estado estado : lista){
System.out.println(estado.getNome()+"\t"+estado.getSigla());
}
}
@Test
@Ignore
public void buscar(){
Long codigo = 6L;
EstadoDao dao = new EstadoDao();
Estado estado = dao.buscar(codigo);
if(estado!=null){
System.out.println(estado.getNome()+"\t"+estado.getSigla());
}
}
@Test
@Ignore
public void excluir(){
Long codigo = 6L;
EstadoDao dao = new EstadoDao();
Estado estado = dao.buscar(codigo);
dao.excluir(estado);
if(estado!=null){
System.out.println(estado.getNome()+"\t"+estado.getSigla());
}
}
}
| [
"everton.nrb@hotmail.com"
] | everton.nrb@hotmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.