text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static byte[] decryptByPublicKey(byte[] data, String key)
throws Exception {
// 对密钥解密
byte[] keyBytes = SecurityCoder.base64Decoder(key);
// 取得公钥
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
Key publicKey = keyFa... | 0 |
public static CvTermReference getDefaultCvTerm(String name) {
if (name != null) {
name = name.toUpperCase();
if ("MASCOT".equals(name) || "MATRIX SCIENCE MASCOT".equals(name))
return MASCOT.getSearchEngineScores().get(0);
if ("XTANDEM".equals(name)) return XTA... | 7 |
private Role intToRole(int r) {
if (r == 3) {
return Role.administrator;
} else if (r == 2) {
return Role.scout;
} else if (r == 1) {
return Role.team_member;
}
return null;
} | 3 |
private void aliveOrderInit() {
this.aliveOrder = null;
this.rsizone = false;
} | 0 |
public static boolean closingIn( Point a1, Point a2, Point b1, Point b2 ){
Point cut = intersection( a1, plus( a1, new Point( a2.y - a1.y, a1.x - a2.x )), b1, b2 );
int cx = b1.x - cut.x;
int cy = b1.y - cut.y;
int dx = b1.x - b2.x;
int dy = b1.y - b2.y;
boolean sx = (cx < 0) == (dx < 0);
boolean... | 1 |
public void mouseWheelMoved(MouseWheelEvent e) {
StdScrollPane scrollpane = StdScrollPane.this;
if (scrollpane.isWheelScrollingEnabled()
&& e.getScrollAmount() != 0) {
JScrollBar toScroll;
int direction = 0;
// find which scrollbar to scroll, or return if none
if ((e.getModifiersEx() & MouseW... | 8 |
public void setDescription(String description) {
this.description = description;
} | 0 |
private void finishConnectingAt( int x, int y ){
if( connection == null ){
return;
}
startConnectingAt( false );
connectAt( x, y, false );
if( targetArray == null ){
cancelConnecting();
}
else{
connected( connection, sourceItem, targetItem );
connection = null;
targetArray = null;
... | 2 |
@Override
public Collection<Lot> searchLots (Map<String,String>params, boolean activeOnly, int maxResults) {
long requestId = this.findFreeKey(this.foundLotStatuses);
this.foundLotStatuses.put(requestId, false);
MsgFindLot msg = new MsgFindLot(this.address, this.ms.getAddressService().getAcc... | 3 |
public QueueElement dequeue (AbstractQueue<QueueElement> queue)
throws InterruptedException {
logger.entering(loggerName, "dequeue", queue);
QueueElement qe = null;
while (qe == null) {
if ((qe = queue.poll()) == null)
Thread.currentThread().sleep(200);
... | 2 |
void filterValues(double minValue, double maxValue) throws IOException {
for(int i = 0; i < rows; i++) {
double value = values.get(i);
if(!Double.isNaN(minValue) && !Double.isNaN(value) && minValue > value) {
values.set(i, Double.NaN);
}
if(!Double.isNaN(maxValue) && !Double.isNaN(value) && maxValue <... | 7 |
@Override
/**
* Runs in the background, timing fade in and fade out, changing the sequence,
* and issuing the appropriate volume change messages.
*/
public void run() {
while (!dying()) {
// if not currently fading in or out, put the thread to sleep
if (fadeOutGain == -1.0f && fadeInGain == 1.0... | 3 |
public static void walk(final Tile... path) {
if(!Walking.isRunEnabled()) {
if (Walking.getEnergy() > Random.nextInt(30, 50)) {
Walking.setRun(true);
Task.sleep(400, 500);
}
}
for (int i = path.length - 1; i >= 0; i --) {
if (Calculations.distanceTo(path[i]) >= 15) {
continue;
}
if (Wal... | 5 |
public void edit(Link link) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
link = em.merge(link);
em.getTransaction().commit();
} catch (Exception ex) {
... | 5 |
@Override
public int getBomberNumber() {
return this.number;
} | 0 |
void releaseChildren(boolean destroy) {
if (items != null) {
for (int i = 0; i < items.length; i++) {
TreeItem item = items[i];
if (item != null && !item.isDisposed()) {
item.release(false);
}
}
items = null;
}
if (columns != null) {
for (int i = 0; i < columnCount; i++) {
TreeCol... | 8 |
public InputStream next()
{
if (closed || (next == null && !initial)) return null;
setNext();
if (next == null) return null;
return new InputStreamWrapper(jar);
} | 4 |
private TetrisStateBuffer search(TetrisStateBuffer in) {
stateDistQueue.clear();
veryFirstPiece = withVeryFirstPiece;
TetrisStateBuffer result = null;
addState(search.stateSet.get(search.getInitialState()), in);
int counter = 0;
while (!stateDistQueue.isEmpty()) {
StateDist stateDist = s... | 6 |
public void init(String startLine) {
data = null;
performSeparationOfCommonEdges = true;
if (startLine != null && (startLine.contains("-E") || startLine.contains("--no-separation"))) {
performSeparationOfCommonEdges = false;
}
dropShadows = true;
if (startLine != null && (startLine.contains("-S") || star... | 8 |
final void method3677(Canvas canvas) {
try {
anObject8020 = null;
anInt7936++;
aCanvas7910 = null;
if (canvas != null && canvas != ((NativeToolkit) this).aCanvas7925) {
if (aHashtable8014.containsKey(canvas)) {
anObject8020 = aHashtable8014.get(canvas);
aCanvas7910 = canvas;
}
... | 7 |
public BulletHandler(GameWindow w){
window = w;
panel = window.panel;
initBulletHandler();
controls = window.controls;
player = window.player;
firerate =0;
try{
int index =0;
bulletpics = new BufferedImage[8];
BufferedImage bulletset = ImageIO.read(getClass().getResource("resources/bulletve... | 5 |
public Set<Literal> getSameStartLiterals(Literal literal, ProvabilityLevel provability) {
Set<Literal> relatedLiterals = getRelatedLiterals(literal, provability);
if (null == relatedLiterals) return null;
Set<Literal> sameStartLiterals = new TreeSet<Literal>();
Temporal literalTemporal = literal.getTemporal();
... | 9 |
protected Behaviour getNextStep() {
if (restPoint == null) return null ;
if (restPoint instanceof Tile) {
if (((Tile) restPoint).blocked()) return null ;
}
if (restPoint instanceof Venue && menuFor((Venue) restPoint).size() > 0) {
if (actor.health.hungerLevel() > 0.1f) {
final Action... | 8 |
public void jouerCarte(){
if (!(main.isEmpty())){
boolean carteposee=false;
while(!(carteposee)){
System.out.println("quelle carte voulez vous poser parmi : ");
System.out.println("main :");
int i;
for (i=0;i<main.size();i++){
System.out.println("numero "+ (i+1) +" "+ main.get(i));
//System.o... | 9 |
private static boolean isValidShuffleRecursiveDynamicProgramming(String str1, String str2, String str3, int i, int j, int k, Set<Triplet> cache) {
if(cache.contains(new Triplet(i, j, k))) {
return false;
}
if(k == str3.length()) {
return true;
}
char c =... | 8 |
@Override
public EventSet run(EventSetContext context, EventSet eventSetInUse, Object data) {
if (eventSetInUse != null
&& eventSetInUse.getStatus() == EventSetStatus.COLLECTION_IN_PROGRESS) {
return eventSetInUse;
}
List<EventSet> correlatingEventSets = context.findCorrelatingEventSets(
variableNam... | 9 |
private int loadShader(String file, int type) {
System.out.println("Loading shader <" + file + ">");
StringBuilder source = new StringBuilder();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String line = null;
... | 5 |
@Override
public int compareTo(Spot sp) {
if (candidates.size() < sp.getCandidates().size()) return -1;
if (candidates.size() == sp.getCandidates().size()) return 0;
return 1;
} | 2 |
public String getCode(){
String str = element.getCode();
if(program != null)
str += program.getCode();
return str;
} | 1 |
public void loadFields() {
HashMap<String,String> allFields = readFielldsFromFile();
Field [] fields = this.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
String name = field.getName();
if (allFields.containsKey(name)) {
if (field.getType() ... | 6 |
protected void setSinglePreserved() {
if (parent != null)
parent.setPreserved();
} | 1 |
private void processInput(KeyEvent e) {
Integer keyNum = e.getKeyCode();
Character keyChar = Character.toLowerCase(e.getKeyChar());
if (ACCEPTED_KEYS.contains(keyChar.toString())) {
decodeInput(keyChar);
}
for(int i=0;i<ACCEPTED_NUM_KEYS.lengt... | 3 |
private static String name(PeekReader in) throws IOException {
StringBuilder buf = new StringBuilder();
while(true) {
int c = in.peek();
if(c < 0) {
break;
} else if(namechar((char)c)) {
buf.append((char)in.read());
} else {
break;
}
}
if(buf.length() == 0)
throw(new Fo... | 4 |
@Test
public void testRandomness() throws Exception {
// RandomUtils.useTestSeed(); allows you to create stable unit test
// but in reality one should make a decision on several different test results in order to know the variance
// check how with the default pearson similarity and the top 300 users as neigh... | 1 |
public CodecInfo(String strInfo) {
_isDecoder = _isAudioCodec = _isDecoder = _isSubtitleCodec = _isVideoCodec = _supportDirectRenderingMethod = _supportDrawHorizBand = _supportWeirdFrameTruncation = false;
char[] tagBit = strInfo.substring(1, 8).toCharArray();
if (tagBit[0] != '.')
_isDecoder = true;
if (tag... | 8 |
public Point CheckTiles(int mouseX, int mouseY, int mButton)
{
int row = FindTileRow(mouseY);
int col = FindTileCol(mouseX);
Point p = new Point(row, col);
if(row != -1 && col != -1)
{
if (mButton == MouseEvent.BUTTON1)
{
ChangeTile(row, col);
}
}
... | 3 |
@Override
public void update() {
for (GUI child:children){
child.update();
}
} | 1 |
public String adminUpdateProduct() {
this.product = this.userFacade.getProductById(this.id);
setProductFromProperty();
this.adminFacade.updateProduct(this.product);
return "adminProductDetails";
} | 0 |
public Shell open(Display display) {
// Load the images
Class clazz = HoverHelp.class;
try {
if (images == null) {
images = new Image[imageLocations.length];
for (int i = 0; i < imageLocations.length; ++i) {
InputStream stream = clazz.getResourceAsStream(imageLocations[i]);
ImageData s... | 7 |
@Override
public void run(){
try{
synchronized(this){
BufferedWriter bw=new BufferedWriter(
new OutputStreamWriter(s.getOutputStream()));
BufferedReader br=new BufferedReader(
n... | 8 |
public int getAantalpaginas() {
return aantalpaginas;
} | 0 |
public static void combSort11(double arrayToSort[], int linkedArray[]) {
int switches, j, top, gap;
double hold1; int hold2;
gap = arrayToSort.length;
do {
gap=(int)(gap/1.3);
switch(gap) {
case 0:
gap = 1;
break;
case 9:
case 10:
gap=11;... | 7 |
protected static URL getURL(String classpathPart, String pkgname) {
String urlStr;
URL result;
File classpathFile;
File file;
JarFile jarfile;
Enumeration enm;
String pkgnameTmp;
result = nul... | 7 |
public Border findBorder(int locx, int locy, boolean opt) {
int top = 0, left = 0, bottom = 0, right = 0;
int val;
if (opt) {
val = newRun.getMazeVal(locx, locy);
} else {
val = newRun.getTravVal(locx, locy);
}
if ((val & 0x01) == 0x01) top = 5;
... | 5 |
private static Object nextValue(String jsonStr, AtomicInteger offset) {
while (offset.get() < jsonStr.length()) {
char c = jsonStr.charAt(offset.getAndIncrement());
if (Character.isWhitespace(c)) {
continue;
}
if (c == '"') {
offse... | 9 |
public ServerThread(IPacketProcessor packetProcessor, int port) {
super();
this.packetProcessor = packetProcessor;
try {
socket = new DatagramSocket(port);
start();
} catch (java.lang.IllegalArgumentException e) {
packetProcessor.onError(ModelNotification.CONNECTION_ERROR);
} catch (SocketExceptio... | 2 |
private Rectangle calculatePixelPerfect(VGDLSprite sprite1, VGDLSprite sprite2)
{
Vector2d sprite1v = new Vector2d(sprite1.rect.getCenterX() - sprite1.lastrect.getCenterX(),
sprite1.rect.getCenterY() - sprite1.lastrect.getCenterY());
sprite1v.normalise();
Direction sprite1Di... | 4 |
protected void mismatch()
{
// first test: are we long enough?
if ( pathLen >= MUM.MIN_LEN )
{
// second test: are we unique in the suffix tree?
if ( pos.node.isLeaf() )
{
// third test
if ( isMaximal() )
{
addToPath( arc );
// if we matched at least one byte of the current arc
... | 3 |
public static File[] chooseFiles(JFrame frame, String Button, int mode) {
JFileChooser jfc = new JFileChooser();
jfc.setFileSelectionMode(mode);
jfc.setMultiSelectionEnabled(false);
jfc.setAcceptAllFileFilterUsed(true);
int success = jfc.showDialog(frame, Button);
if(success == JFileChooser.APPROVE_OPTION)... | 1 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (obj instanceof Image) {
if (image.equals((Image) obj)) {
return true;
}
}
if (!(obj instanceof ImagePanel)) {
return false;
}
ImagePanel other = (ImagePanel) ob... | 5 |
public BirthdayStats getBirthdayStats() throws SQLException {
if (!dbcon.IsConnected) { return null; }
BirthdayStats stats = new BirthdayStats();
ResultSet res;
String year = new SimpleDateFormat("YYYY").format(new Date());
String month = new SimpleDateFormat("MM").format(new Date());
// Total birthday r... | 9 |
public XMLElement save() {
XMLElement arrowLink = new XMLElement();
arrowLink.setName("arrowlink");
if (style != null) {
arrowLink.setAttribute("STYLE", style);
}
if (getUniqueId() != null) {
arrowLink.setAttribute("ID", getUniqueId());
}
... | 9 |
public void render(){
texture.bind();
if(!isDead()){
int xChange = (change-1) % 3;
super.render();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(xChange * 0.25f,yChange * 0.25f + 0.25f);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(xChange * 0.25f + 0.25f,yChange * 0.25f + 0.25f);
GL11.glVerte... | 1 |
public User[] loadUsers(ChatChannel channel){
User[] users = null;
try {
Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT);
socket.setSoTimeout(TIMEOUT);
OutputStream outputStream = socket.getOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(
outputStre... | 3 |
public void run() {
try {
//create socket
tcpSocket = new Socket();
// Create remote bind-point
System.out.println("Connecting to " + host + ":" + port + ". Interval: " + interval);
SocketAddress remoteBindPoint = new InetSocketAddress(host, port);
... | 9 |
@Override
public boolean keepCombating(Entity victim) {
boolean isRanging = PlayerCombat.isRanging(player) != 0;
if (!war.isCanCommence()) {
player.getPackets().sendGameMessage("The war hasn't started yet.",
true);
return false;
} else if (player.getCurrentFriendChat().getPlayers().contains(victim)) {... | 9 |
public void computeDerivatives(double t, double[] y, double[] yDot) {
double p;
p = (y[0]*y[0]+y[1]*y[1]+y[2]*y[2]+y[3]*y[3]-1);
yDot[0] = -0.5*y[1]*y[4]-0.5*y[2]*y[5]-0.5*y[3]*y[6]+0.5*y[2]-0.5*y[0]*p;
yDot[1] = 0.5*y[0]*y[4]+0.5*y[2]*y[6]-0.5*y[3]*y[5]-0.5*y[3]-0.5*y[1]*p;
yDot... | 0 |
@Override
public void calculateFractalOrbit() {
iterations = 0;
Complex[] complex = new Complex[1];
complex[0] = new Complex(pixel_orbit);//z
Complex temp = null;
Complex zold = new Complex();
if(parser.foundS()) {
parser.setSvalue(new Complex(complex[... | 8 |
@Override
public Double getBalance(String id) {
if(id == null || "".equals(id.trim())) {
return -1.0;
}
for(Account a : accounts) {
if(id.equals(a.getId())) {
if(a.getBalance() < 0) {
return -1.0;
}
S... | 5 |
public JsonArray getArray(String key) {
Object value = get(key);
if (value instanceof JsonArray) {
return (JsonArray) value;
}
return new JsonArray();
} | 1 |
public void transformBlockInitializer(StructuredBlock block) {
StructuredBlock start = null;
StructuredBlock tail = null;
int lastField = -1;
while (block instanceof SequentialBlock) {
StructuredBlock ib = block.getSubBlocks()[0];
int field = transformOneField(lastField, ib);
if (field < 0)
clazzAn... | 3 |
public final String getAliasesAsString() {
String aliases = "";
for (String alias : this.aliases) {
if (!aliases.isEmpty()) aliases += ", ";
aliases += alias;
}
return aliases;
} | 2 |
@Override
public void process(Exchange e) throws Exception {
String body = e.getIn().getBody(String.class);
body = body.replaceAll("\\[", "");
body = body.replaceAll("\\]", "");
StringTokenizer tok = new StringTokenizer(body, ",");
Date date=null;
String account=null... | 7 |
private void setupContents(int width, int height) {
//set up contents
contentsPanel.setBounds(0, 0, contentsWidth, height);
contentsPanel.setPreferredSize(new Dimension(contentsWidth, height));
contentsPanel.repaint();
contentsPanel.setVisible(false);
JButton mainMenuButton = contentsPanel.getMainMenuButto... | 2 |
private void createTreeView(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.marginHeight = gridLayout.marginWidth = 2;
gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 0;
composite.setLayout... | 6 |
@Override
public void run() {
List<Fetcher> fs = new ArrayList<Fetcher>();
// add shop fetcher
for (String url : this.getInitUrls()) {
Fetcher f = new TBShopFetcher(new RequestWrapper(url,
new TBShopCallback(), null, PriorityEnum.SHOP));
fs.add(f);
}
Map<String, Integer> offered = ne... | 6 |
@Override
public void worldChangedAt(Position pos) {
// Immutable cities and units took away a lot of the elegance here...
CityFigure cf = cityFigures.get(pos);
City city = game.getCityAt(pos);
if (city != null){
if (cf != null) editor.drawing().remove(cf);
... | 6 |
public Instruction getInstruction() {
return this.brain.getInstruction(this.state);
} | 0 |
public void renderCracks(int xPos, int yPos, int damage) {
xPos -= xOffset;
yPos -= yOffset;
int damageSprite = damage / 10;
if (damageSprite > 7) {
damageSprite = 7;
}
for (int y = 0; y < Sprite.CRACKS.SIZE; y++) {
int yp = yPos + y;
for (int x = 0; x < Sprite.CRACKS.SIZE; x++) {
int xp = xPos ... | 8 |
@Override
public void run() {
try {
PUserDBAccess pdbAccess = new PUserDBAccess(dbAccess);
Statement stmt;
stmt = dbAccess.getConnection().createStatement();
PUser collaborativeProfile = pdbAccess.getUserProfile(user, null, clientName, true);
Map... | 8 |
public int doEndTag() throws JspException {
DateTimeZone dateTimeZone = null;
if (value == null) {
dateTimeZone = DateTimeZone.UTC;
} else if (value instanceof String) {
try {
dateTimeZone = DateTimeZone.forID((String) value);
} catch (IllegalA... | 4 |
public boolean containsObject() throws JSONException {
boolean result = false;
Iterator i = this.map.values().iterator();
while (!result && i.hasNext()) {
Object value = i.next();
result = value instanceof JSONObject
|| value instanceof JSONArray
&& ((JSONArray) va... | 5 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(tickID==Tickable.TICKID_MOB)
{
if(fullRound)
{
final MOB mob=(MOB)affected;
if(!mob.isInCombat())
unInvoke();
if(mob.location()!=null)
{
if(mob.location().show(mob,nu... | 8 |
public static void main(String args[]) {
QuickSort quick = new QuickSort();
Scanner scan = new Scanner(System.in);
int N, i;
System.out.println("Enter value of N");
N = scan.nextInt();
int array[] = new int[N];
System.out.println("Enter " + N + " Elements");
for (i = 0; i < N; i++)
array[i] = scan... | 2 |
public static String getDefaultPasswordString() {
String random = RandomStringUtils.randomAlphanumeric(8);
return random;
} | 0 |
public long getLatency(int clientId) {
synchronized(CONNECTION_LOCK) {
ClientInfo client = clients.get(clientId);
if(client != null)
return client.getLatency();
return -1;
}
} | 1 |
private void generatePercentComparisonLines(
TreeMap<Float, Point2D.Float> marketToStockPairing) {
Point2D.Float dailyComparisonInitial = marketToStockPairing
.firstEntry().getValue();
boolean first = true;
for (Entry<Float, Point2D.Float> ent : marketToStockPairing.entrySet()) {
if (first) {
first ... | 6 |
private LISP_object read_from(LinkedList<String> tokens)throws Exception{
if (tokens.size() == 0){
throw new Exception("unexpected EOF while reading");
}
String token = tokens.poll();
if (token.equals("")){
do{
token = tokens.poll();
... | 7 |
public static ArrayList<ArrayList<Field>> generateMap(int maxFields, int tileSize) {
ArrayList<ArrayList<Field>> map = new ArrayList<ArrayList<Field>>();
Random random = new Random();
double center = (double) maxFields/2;
for(int i = 0; i < maxFields; i++){
double probI = Math.abs(center-(... | 8 |
public Element drawShape(int x, int y, int w, int h,
Map<String, Object> style)
{
String fillColor = mxUtils
.getString(style, mxConstants.STYLE_FILLCOLOR);
String strokeColor = mxUtils.getString(style,
mxConstants.STYLE_STROKECOLOR);
float strokeWidth = (float) (mxUtils.getFloat(style,
mxConstant... | 7 |
public void initByArray(int... key) {
@SuppressWarnings("unused")
int lag = N32 >= 623 ? 11 : (N32 >= 68 ? 7 : (N32 >= 39 ? 5 : 3)) ;
int mid = (N32 - lag) / 2;
for (int i = sfmt.length - 1; i >= 0; i--)
sfmt[i] = 0x8b8b8b8b;
int count = key.length >= N32 ? key.length : N32 - 1, r = func1(0x8b8b8b8b)... | 9 |
public JCheckBox getjCheckBoxPracticiens() {
return jCheckBoxPracticiens;
} | 0 |
public static int crypto_core(byte[] outv, byte[] inv, byte[] k, byte[] c)
{
int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
int j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
int i;
j0 = x0 = load_littleendian(c, 0);
j1 = x1 = load_littleendian(k, 0);
j2 =... | 1 |
public void start() {
Random random = new Random();
Scanner scanner = new Scanner(System.in);
while ( true ) {
Long maxId = null;
float maxJC = Float.MIN_VALUE;
float jc;
System.out.print(">>> ");
String humanSay = scanner.nextLine... | 6 |
public static PreparedStatement createPreparedStatement(final Connection con, final String sql,
final boolean returnKeys, final Object... args) throws SQLException {
PreparedStatement ps;
if (returnKeys) {
ps = con.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
} else {
ps = con.prepareStatement... | 3 |
public static void setSpeedHost(String host) {
if (host.length() > 0 && !host.substring(host.length() - 1).equals("/")) {
host += "/";
}
getInstance().speedHost = host;
} | 2 |
private int readInt()
{
int ret = readByteAsInt();
int tmp;
if (ret < 128)
{
return ret;
}
else
{
ret = (ret & 0x7f) << 7;
tmp = readByteAsInt();
if (tmp < 128)
{
ret = ret | tmp;
}
else
{
ret = (ret | tmp & 0x7f) << 7;
tmp = readByteAsInt();
if (tmp < 128)
{
... | 3 |
@Test
public void testSendMessageToListWithQueue() {
LOGGER.log(Level.INFO, "----- STARTING TEST testSendMessageToListWithQueue -----");
String client_hash = "";
String client_hash2 = "";
String server_hash = "";
String server_hash2 = "";
try {
server1.set... | 9 |
private void parseSchemaElement(String element) throws ParseException {
char elementId = element.charAt(0);
String elementTail = element.substring(1);
validateSchemaElementId(elementId);
if (isBooleanSchemaElement(elementTail))
parseBooleanSchemaElement(elementId);
el... | 3 |
private void paintMainMenu(Graphics2D g){
g.setFont(menuFont);
if (inHighScores){
drawHighScores(g);
}else if (inOptions){
drawOptions(g);
}else{
drawMenu(g);
}
} | 2 |
public static int showConfirmDialog(String msg, String title, int option, int type){
if (type < 0 || type > 2) type = 1;
return JOptionPane.showConfirmDialog(null, msg, (title == null ? "Confirm message" : title),
option, type);
} | 3 |
public void runGuesses(ArrayList<FaceData> data) {
for (FaceData fd : data) {
buildNetwork(fd);
boolean guess = true;
int[] acts = new int[4];
for (int i = 0; i < 4; i++) {
double act = calculateActivation(i + 1);
if (act == 1) {
acts[i]++;
guess = false;
}
}
if (isOnlyOneAct(... | 8 |
private String compileCommand(Node command) throws CompilationErrorException {
StringBuilder builder = new StringBuilder();
switch (command.getNodeType()) {
case ASSIGNED:
builder.append(compileAssignValue(command));
break;
case RETURN:
... | 7 |
public JButton getPrevButton(){
if(prevButton == null){
for(Component comp : getComponents()){
if(comp instanceof JButton){
if("Spinner.previousButton".equals(comp.getName())){
prevButton = (JButton) comp;
}
... | 4 |
@Override
public boolean equals(Object o) {
if(!(o instanceof MapEntry)) {
return false;
}
MapEntry<?, ?> me = (MapEntry<?, ?>)o;
return (key == null ? me.getKey() == null : key.equals(me.getKey()))
&& (value == null ? me.getValue() == null : value.equals... | 8 |
public boolean isMoreOuterThan(ClassDeclarer declarer) {
ClassDeclarer ancestor = declarer;
while (ancestor != null) {
if (ancestor == this)
return true;
ancestor = ancestor.getParent();
}
return false;
} | 2 |
@EventHandler
public void WitchSlow(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Slow.DodgeCha... | 6 |
public Vector2f tileForce(Vector2f pos){
Vector2f temp = TileUtil.getCoordinate(pos);
Vector2f force = new Vector2f(0,0);
for(Tile tile : tileList ) {
if (TileUtil.getCoordinate(tile.getPosition()).equals(temp)){
force = tile.getForce();
}
}
return force;
} | 2 |
public PNGDecoder(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if(!checkSignature(buffer)) {
throw new IOException("Not a valid PNG file");
}
... | 7 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.