text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static void keyAction(String actionString) {
if (controlsActive) {
if (actionString.equals("Fire")) {
session.player.setFiring(true);
} else if (actionString.equals("SpaceReleased")) {
session.player.setFiring(false);
} else if (actionS... | 9 |
public int Edit_Data(ProfileInfo DataObj) {
//System.out.println("ProfileDAO.Edit_Data()");
int res = 0;
ProfileInfo profileObj = null;
String sql = "UPDATE profile SET Profile_Name=?, Video_Width=?, Video_Height=?, Video_FPS=?, Video_Bitrate=?, Video_Preset=?, Audio_Codec=?, Audio_Bitrate=?, Audio_SampleRat... | 6 |
@Override
public void put( ByteBuffer out, Object v )
{
if (v == null)
{
out.put( Compress.NULL );
}
else
{
out.put( Compress.NOT_NULL );
try
{
for (int i = 0; i < fields.length; i++)
... | 3 |
public static void rectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) {
throw new IllegalArgumentException("half width must be nonnegative");
}
if (halfHeight < 0) {
throw new IllegalArgumentException("half height must be nonnegative")... | 4 |
@Override
public void addServerStopListener(ServerStopListener listener) {
serverStopListenerList.add(ServerStopListener.class, listener);
} | 0 |
private String generateFinalKey(String in) {
String seckey = in.trim();
String acc = seckey + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
MessageDigest sh1;
try {
sh1 = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
return Base64.encodeBytes(sh... | 1 |
public Boolean asBooleanObj()
{
try {
if (isNull()) {
return null;
} else if (isBoolean()) {
return (Boolean) value;
}
String check = asString();
if (check == null) {
return null;
} else if (isTrue(check)) {
return Boolean.TRUE;
} else {
return Boolean.FALSE;
}
} catch... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof XYZ)) {
return false;
}
XYZ other = (XYZ) obj;
if (x != other.x) {
return false;
}
if (y != other.y) {
return false;
}
if (z != other.z) {
re... | 6 |
public static void writeValue( Object thing, OutputStream os ) throws IOException {
if( thing instanceof byte[] ) {
writeByteString( (byte[])thing, os );
} else if( thing instanceof Number ) {
writeNumberCompact( (Number)thing, os );
} else if( Boolean.TRUE.equals(thing) ) {
os.write(BE_TRUE);
} else i... | 6 |
public void setGehRichtung(String richtungsbefehl)
{
if(richtungsbefehl.contains("nord"))
{
_gegangeneRichtung = "nord";
}
else if(richtungsbefehl.contains("ost"))
{
_gegangeneRichtung = "ost";
}
else if(richtungsbefehl.contains("süd"))
{
_gegangeneRichtung = "süd";
}
else if(richtungsbefe... | 4 |
private int decodeResponse(String challenge, String string) {
if (string.length() > 100) {
return 0;
}
int[] shuzi = new int[] { 1, 2, 5, 10, 50 };
String chongfu = "";
HashMap<String, Integer> key = new HashMap<String, Integer>();
int count = 0;
for (int i = 0; i < challenge.length(); i++) {
Stri... | 4 |
public boolean matches( Class<?> clazz )
{
return Modifier.isFinal( clazz.getModifiers() );
} | 1 |
public void addEdge( Vertex<T> v1, Vertex<T> v2 ) {
v1Pos = getVerticesIndexFor( v1 );
v2Pos = getVerticesIndexFor( v2 );
if ( v1Pos == -1 || v2Pos == -1 ) {
throw new IllegalArgumentException( "vertex not found" );
}
// avoid adding duplicate edges
if ( this.adjMatrix[v1Pos][v2Pos] == 0 ... | 3 |
public boolean setNbCoupMax(int nvNbCoupMax){
if(nvNbCoupMax >= MIN_NB_COUPS && nvNbCoupMax <= MAX_NB_COUPS){
Integer coupMax = nvNbCoupMax;
propriete.setProperty("nb_coups", coupMax.toString());
return true;
}
else{
return false;
}
} | 2 |
public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception {
if (splitted[0].equalsIgnoreCase("removeeqrow")) {
int lol = 4;
if (splitted.length == 2) {
lol = (Integer.parseInt(splitted[1]) * 4);
}
for (int i = 0; i ... | 8 |
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
// Override OpenCms Environment with Base OpenCms Zip Url
if (this.getBaseOpenCmsZipUrl() != null) {
this.setOpenCmsEnvironmentZipFile(this.getBaseOpenCmsZipUrl());
}
// Execute OpenCms init
super.execute();
try {
... | 5 |
public void go_up(){
if( this.direction != Tank.direction_up)
this.direction = Tank.direction_up ;
else{
if(this.location_y - this.speed >= 0 && ifCanWalkInThisDirection())
{
this.location_y -= this.speed ;
ifGetProps();
}
}
} | 3 |
protected BufferedImageWithFlipBits scale( Getter<BufferedImage> populator, int width, int height ) throws ResourceNotFound {
assert width != 0;
assert height != 0;
BufferedImage original = getOriginal(populator);
ensureMetadataInitialized(original);
final int dx0, dy0, dx1, dy1;
if( width < 0 ) { dx0 = -w... | 5 |
public static void rotate90CCW(int[][] image) {
if(image.length != image[0].length) {
throw new IllegalArgumentException("The matrix must be square.");
}
double n = image.length;
int f = (int)Math.floor(n/2);
int c = (int)Math.ceil(n/2);
// r... | 3 |
public void setSsn(String ssn) {
this.ssn = ssn;
setDirty();
} | 0 |
public DaedricWarAxe() {
this.name = Constants.DAEDRIC_WAR_AXE;
this.attackScore = 15;
this.attackSpeed = 18;
this.money = 1800;
} | 0 |
public PrimitiveOperator combineRightNLeftOnMin(PrimitiveOperator other) {
boolean[] newTruthTable = new boolean[8];
newTruthTable[0] = truthTable[((other.truthTable[0]) ? 2 : 0) | 0]; //000
newTruthTable[1] = truthTable[((other.truthTable[2]) ? 2 : 0) | 1]; //001
newTruthTable[2] = truthTable[((o... | 8 |
@Test
public void edgeReturnsCorrectVerticesWhenFlipped() {
Vertex v = new Vertex(0);
Vertex u = new Vertex(0);
Edge e = new Edge(v, u);
e.flip();
assertEquals(e.getStart(), u);
assertEquals(e.getEnd(), v);
} | 0 |
private void initialize() {
// Used for saving on pressing Ctrl-Enter and cancelling on escape
KeyAdapter keyAdapter = new KeyAdapter() {
@Override
public void keyPressed(KeyEvent ev) {
if ((ev.getKeyCode() == KeyEvent.VK_ENTER) && ((ev.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()... | 9 |
public boolean updateScheduleRequest(Sport sport) {
String request = null;
switch(sport) {
case NBA: case NHL:
request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/games/" + season + "/" + season2 + "/schedule.xml?api_key=" + sport.getKey();
Eleme... | 4 |
public void addCreatureToWorld(final int creatureType, final Grid g) {
Thread creatureWatcher = new Thread(new Runnable() {
@Override
public void run() {
Random ra = new Random();
if (creatureType == SIMPLE_AGENT) {
while (g.getSimpleCreaturesAmount() < nSimpleCreaturesInWorld) {
// Manage... | 6 |
public Integer getMemory() {
return this.memory;
} | 0 |
public List<Trip> getTripsByUser(User user) throws UserNotLoggedInException {
List<Trip> tripList = new ArrayList<Trip>();
User loggedUser = getLoggedUser();
if (loggedUser != null) {
if (user.isFriendWith(loggedUser)) {
tripList = getTripList(user);
}
return tripList;
} else {
throw new UserNot... | 2 |
@SuppressWarnings ( {
"unused", "resource"
} )
@Test
public void testWriteJournalLarge () throws Exception {
if ( this.socketAddress == null ) {
return;
}
try ( AFUNIXSocket sock = connectToServer() ) {
System.err.println("Client running");
... | 3 |
public boolean exist(char[][] board, String word) {
if (word.length() == 0) {
return true;
}
int row = board.length;
if (row == 0) {
return false;
}
int col = board[0].length;
boolean[][] visited = new boolean[row][col];
for (int ... | 6 |
private int brute(T[] a)
{
int inversions = 0;
for (int i = 1; i < a.length; i++)
for (int j = i - 1; j >= 0; j--)
if (SortHelper.less(a[i], a[j]))
inversions++;
return inversions;
} | 3 |
@Override
public ByteBuffer get(String path) throws IOException {
if (path.startsWith("/crc")) {
return fs.getCrcTable();
} else if (path.startsWith("/title")) {
return fs.getFile(0, 1);
} else if (path.startsWith("/config")) {
return fs.getFile(0, 2);
} else if (path.startsWith("/interface")) {
re... | 9 |
public void draw(Graphics g, double mx, double my) {
g.setColor(Color.BLACK);
if(held && mx < 90.0) {
g.drawString("Angle: "+calcAngle(mx,my), (int)(x+10.0), 440);
g.drawLine((int)mx, (int)my, (int)x, 400);
double tempAngle = calcAngle(mx, my);
double tx = x;
double ty = 400.0;
// Check if... | 6 |
public long getPacketDelay() {
return _packetDelay;
} | 0 |
private static String formatToLength(String base, int length) {
if (base == null) {
throw new NullPointerException();
}
String ret = "";
for (int i = base.length(); i <= length; i++) {
ret += " ";
}
ret += base;
if (base.length() - 1 > le... | 3 |
public Insertar() {
initComponents();
} | 0 |
public void detectLang() {
if (loadProfile()) return;
for (String filename: arglist) {
BufferedReader is = null;
try {
is = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "utf-8"));
Detector detector = detectorFactory.crea... | 6 |
public void visitIntInsn(final int opcode, final int operand) {
mv.visitIntInsn(opcode, operand);
if (constructor && opcode != NEWARRAY) {
pushValue(OTHER);
}
} | 2 |
public void setCipherData(CipherDataType value) {
this.cipherData = value;
} | 0 |
public Field(int dimension, int[] fieldSize, int countInRowForWin) throws NotImplementedException {
this.dimension = dimension;
this.countInRowForWin = countInRowForWin;
switch (dimension) {
case 2:
d2Field = new int[fieldSize[0]][fieldSize[1]];
for (i... | 7 |
private void sendRPC()
{
OpCode code = receivedRPC.getRPCOpcode();
if (code.equals(OpCode.PING_REQUEST))
{
handlePingRequest(receivedRPC);
}
else if (code.equals(OpCode.FIND_NODE_REQUEST))
{
handleFindNodeRequest(receivedRPC);
}
else if (code.equals(OpCode.FIND_VALUE_REQUEST))
{
handleFin... | 4 |
@Override
public void run()
{
try {
gate.await();
} catch (InterruptedException | BrokenBarrierException e) {
e.printStackTrace();
}
isAtWork = true;
if(theBusiness.timer.getTimeOfDay() >= arrivalTime)
{
System.out.println(theBusiness.timer.getCurrentTime() + " " + ... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
int confirmation = JOptionPane.showConfirmDialog(null, "Are you sure to delete card?", "Confirmation", JOptionPane.YES_NO_OPTION);
if (confirmation == JOptionPane.YES_OPTION) {
try {
Connection conn;
S... | 2 |
public RepositoryHandler(String repositoryURL, String repositoryUsername, String repositoryPassword, int repositoryType) {
this.repositoryUsername = repositoryUsername;
this.repositoryPasword = repositoryPassword;
this.repositoryType = repositoryType;
this.repositoryURL = repositoryURL;
... | 2 |
public static void ex15(){
System.out.println("Taula de qualificacions del alumnes: ");
System.out.println("Alumne\tConeptes (60%)\tProcediments (30%)\tActitud (10%)\tFinal");
int c=0, p=0, a=0;
float f=0;
DecimalFormat df=new DecimalFormat("0.00");
for(int i=0; i<25; i++){
c=(int)(Math.random()*11);
p=(in... | 5 |
public double standardDeviation_of_ComplexRealParts() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double[] re = this.array_as_real_part_of_Complex();
double standardDeviation = Stat.stand... | 2 |
public void learnUnlabeledData(FrameSet unlabeledData,
String partitionStyle, int partitionOption,
double convergenceThreshold, double alpha){
double previousDistance = Double.MAX_VALUE;
this.alpha = alpha;
boolean converged = false;
List<FrameSet> batches;
while(!converged){
System.out.print... | 6 |
private void checkCollisions() {
// Collision between ball and left paddle
if (paddles[0].collide(ball)) {
if (ball.getXSpeed() < 0) {
changeBallTrajectory(true);
}
}
// Collision between ball and right paddle
if (paddles[1].collide(ball)) {
if (ball.getXSpeed() > 0) {
changeBallTrajectory... | 6 |
@Test
public void testWrongUser() throws Exception{
AccessControlServer server = new AccessControlServer(1935);
server.start();
SpotStub spot = new SpotStub("139",1935);
spot.start();
SpotStub security = new SpotStub("security",1935);
security.start();
s... | 4 |
public RC4(final byte[] seed)
{
if (seed.length < 1) { throw new IllegalArgumentException("RC4 Key too short (minimum: 1 byte)"); }
if (seed.length > 256) { throw new IllegalArgumentException("RC4 Key too long (maximum: 256 bytes)"); }
for (int i = 0; i < 256; i++)
{
this.s[i] = i;
}
for (int i = 0; i ... | 5 |
public List findByProperty(String propertyName, Object value) {
log.debug("finding Problem instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from Problem as model where model."
+ propertyName + "= ?";
Query queryObject = getSession().createQuery(queryString)... | 1 |
public void updateList() {
for (int i=0;i<parent.window.nbSongsInList;i++) {
if (parent.tracksManager.tracksList.size()>i+listOffset)
{
Track thisTrack = parent.tracksManager.tracksList.get(i+listOffset);
if (thisTrack.getId()==parent.tracksManager.currentTrack) getSpecificCell("edit", i).setValue... | 4 |
public void setUserInput(int[] n)
{
userInput = n;
} | 0 |
@Override
public ArrayList<Chromosome<T>> update()
{
if(chromoPool.size() % (settings.getInt("GAmkIII.popDivision") * 2) != 0)
{
throw new RuntimeException("Gene pool size (" + chromoPool.size() + ") is not dividable by " + (settings.getInt("GAmkIII.popDivision") * 2));
}
... | 9 |
@Override
public V get(K key) {
int i = findEntry(key);
if (i < 0)
return null;
return bucket[i].getValue();
} | 1 |
public VoidValue visitDefine(DefineComponent c) {
addLeadingComments(c);
String name = c.getName();
SourceLocation location = c.getSourceLocation();
Annotation annotation = makeAnnotation(c);
if (name == DefineComponent.START) {
if (!si.isIgnored(c)) {
Pattern body = c.ge... | 8 |
public ReleaseType getLatestType() {
this.waitForThread();
if (this.versionType != null) {
for (ReleaseType type : ReleaseType.values()) {
if (this.versionType.equals(type.name().toLowerCase())) {
return type;
}
}
}
... | 3 |
private String getHelp(String ind) {
boolean found = false;
String help = "";
try {
int index = Integer.parseInt(ind);
for(Command leaf : currentMenu.getCommands()) {
if(leaf.getIndex() == index) {
help = "[" + leaf.getDesc() + "] " + leaf.getHelp();
found = true;
}
}
for(CmdMenu nod... | 8 |
@Override
public String generate(TreeLogger logger, GeneratorContext context,
String typeName) throws UnableToCompleteException {
TypeOracle typeOracle = context.getTypeOracle();
JClassType type = typeOracle.findType(typeName);
if (type.isAbstract() && type.isInterface() == nul... | 7 |
public void updatePtgs()
{
if( expression == null ) // happens upon init
{
return;
}
byte[] rkdata = getData();
int offset = 15 + cch; // the start of the parsed expression
int sz = offset;
int sz2 = rkdata.length - (offset + cce);
cce = 0;
// add up the size of the expressions
for( int i = 0; i... | 7 |
private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... | 5 |
@Override
public void appendTo(Appendable out) {
try {
boolean needComma = false;
out.append('{');
for (Map.Entry<String, Object> entry : mMap.entrySet()) {
if (needComma) {
out.append(',');
} else {
needComma = true;
}
out.append(Json.quote(entry.getKey()));
out.append(':');
... | 4 |
private SplayNode<K> search(K data) {
if (data == getRoot().data) {
return this.root;
} else {
SplayNode<K> padre = null;
SplayNode<K> hijo = this.root;
while ((hijo != null) && (hijo.data != data)) {
if ((Integer)data < (Integer)hijo.data) {
... | 6 |
private MenuItem prompt() throws IOException
{
int option;
while (true) {
display();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String line = input.readLine();
try {
option = Integer.parseInt(line);
if (option >= 0 && option < this.menuItems.size()) {
ret... | 4 |
public boolean noticeUser(String user, String msg) {
boolean success = true;
String[] msgSplit = msg.split("\n");
for(int i=0;i<msgSplit.length;i++){
if(!sendln("NOTICE " + user + " :" + msgSplit[i]) ) {
success = false;
}
}
return success;
} | 2 |
protected void applyShadow(BufferedImage image) {
int dstWidth = image.getWidth();
int dstHeight = image.getHeight();
int left = (this.shadowSize - 1) >> 1;
int right = this.shadowSize - left;
int xStart = left;
int xStop = dstWidth - right;
int yStart = left;
... | 8 |
public void refreshFields(){
this.removeAll();
GridBagConstraints pCon = new GridBagConstraints();
traceBox = new SubPanel(getTopLevelContainer());
intBox = new SubPanel(getTopLevelContainer());
deriveBox = new SubPanel(getTopLevelContainer());
GridBagConstraints bCon = new GridBagConstraints();
... | 9 |
public <T> void put( CapabilityName<T> name, T capability ){
if( capability == null ){
capabilities.remove( name );
}
else{
capabilities.put( name, capability );
}
} | 1 |
private void updateComponents(boolean inserted) {
Map<Class, Object> map = new HashMap<Class, Object>();
for (Element i : elementFlow) {
content = (AbstractDocument.LeafElement) i;
enum3 = content.getAttributeNames();
synchronized (enum3) {
while (enum3.hasMoreElements()) {
name = enum3.nextElemen... | 9 |
static private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
return 5;
}
switch(curChar)
{
cas... | 4 |
public String getAddressType() {
return addressType.get();
} | 0 |
public static Description instantiateExternalVariables(Description self, KeyValueMap bindings) {
if (!(bindings.emptyP())) {
{ Object old$Evaluationmode$000 = Logic.$EVALUATIONMODE$.get();
Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get();
try {
Native.setSpecial(Logic.$EVA... | 6 |
public String tcp2String(Packet packet) {
TCPPacket tcpPacket = (TCPPacket) packet; //Creates a tcpPacket out of the received packet
EthernetPacket ethernetPacket = (EthernetPacket) packet.datalink;
//Creates a ethernet packet to get the ether layer stuff
methodData += src_macInEnglish = ethernetPacket.getS... | 1 |
final void da(int i, int i_636_, int i_637_, int[] is) {
float f = ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492)
.aFloat5681)
+ ((((Class101_Sub1) ((SoftwareToolkit) this).aClass101_Sub1_7492)
.aFloat5662) * (float) i
+ (((Class101_Sub1) ((SoftwareToolkit) this).aClass101... | 6 |
@Override
public void addDevice(Device device) {
Connection conn = null;
PreparedStatement st = null;
try {
conn = OracleDAOFactory.createConnection();
st = conn.prepareStatement(INSERT_DEVICE);
int id_prev = device.getIdPrev();
if (id_prev == -1) {
st.setNull(1, Types.INTEGER);
} else {
s... | 6 |
private PairNode<T> compareAndLink(PairNode<T> first, PairNode<T> second) {
if (second == null) {
return first;
}
if (compare(second.element, first.element) < 0) {
second.prev = first.prev;
first.prev = second;
first.nextSibling = second.leftChild... | 5 |
public boolean inside(int ax,int ay,int aw,int ah,int bx,int by,int bw,int bh) {
return ((ax > bx && ax < bx+bw) && (ay > by && ay < by + bh) &&
(ax + aw > bx && ax + aw < bx + bw) && (ay+ah > by && ay+ah < by+bh));
} | 7 |
public void setIssueNo(String value) {
this.issueNo = value;
} | 0 |
@Override
public boolean equals(Object obj)
{
if(this == obj)
return true;
// this ensures that they both belong to the same switch
if(!super.equals(obj))
return false;
if(!(obj instanceof VirtualPort))
return false;
... | 7 |
public ModUserLoginEvent(Player player) {
this.player = player;
} | 0 |
public ArrayList<Node> generateER(int n,double p){
int linkCounter = 0;
int v = 1;
int w = -1;
double r;
long start = System.currentTimeMillis();
Random gen = new Random();
ArrayList<Node> nodes = new ArrayList<Node>();
Link link;
for(int i=0;i<n;i... | 6 |
boolean exactlyEqual(DsDef def) {
return dsName.equals(def.dsName) && dsType.equals(def.dsType) &&
heartbeat == def.heartbeat && Util.equal(minValue, def.minValue) &&
Util.equal(maxValue, def.maxValue);
} | 4 |
public static int countNeighbours(boolean [][] world, int col, int row){
int total = 0;
total = getCell(world, col-1, row-1) ? total + 1 : total;
total = getCell(world, col , row-1) ? total + 1 : total;
total = getCell(world, col+1, row-1) ? total + 1 : total;
total = getCell(world, col-1, row ) ? total + 1... | 8 |
public static void printMatrix(Object[][] M) {
// Calculation of the length of each column
int[] maxLength = new int[M[0].length];
for (int j = 0; j < M[0].length; j++) {
maxLength[j] = M[0][j].toString().length();
for (int i = 1; i < M.length; i++)
maxLength[j] = Math.max(M[i][j].toString().length(), ... | 5 |
private final void checkoutBand() {
final NoYesPlugin plugin = new NoYesPlugin("Local repository "
+ this.repoRoot.getFilename() + " does not exist",
Main.formatMaxLength(this.repoRoot, null, "The directory ",
" does not exist or is no git-repository.\n")
+ "It can take a while to create it. Conti... | 8 |
public void setKilpienergia(double energia){
if (-50 <= energia && energia <= 100){
this.kilpienergia = energia;
}
} | 2 |
public void setup(Plugin p) {
this.p = p;
if(!p.getDataFolder().exists()) p.getDataFolder().mkdir();
cfile = new File(p.getDataFolder(), "ezPermissions.yml");
if(!cfile.exists()) {
try { cfile.createNewFile(); }
catch (Exception e) { e.printStackTrace(); }
}
config = YamlConfiguration.load... | 4 |
public Database()
{
if (Misc.is(Constants.DatabaseType, new String[] { "sqlite", "h2", "h2sql", "h2db" })) {
this.driver = "org.h2.Driver";
this.dsn = ("jdbc:h2:" + Constants.Plugin_Directory + File.separator + Constants.SQLDatabase + ";AUTO_RECONNECT=TRUE");
this.username = "sa";
this.pas... | 5 |
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
public void onBreak(BlockBreakEvent event)
{
if(!event.getBlock().getWorld().getName().equals(p.getWorld())) return;
Player player = event.getPlayer();
Location loc = event.getBlock().getLocation();
Chunk c = loc.ge... | 7 |
private void dispatchHotkeys(GameContainer c) throws SlickException {
Input input = c.getInput();
if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
bodies.insert(new Body(input.getMouseX() * scale, input.getMouseY() * scale, 0, 0, 1e19, 1e4));
}
if (input.isKeyPressed(Input.KEY_R)) {
in... | 9 |
@EventHandler
public void WolfMiningFatigue(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.getWolfConfig().getDouble("Wolf.MiningF... | 6 |
*/
public void spaceVertical(FastVector nodes) {
// update undo stack
if (m_bNeedsUndoAction) {
addUndoAction(new spaceVerticalAction(nodes));
}
int nMinY = -1;
int nMaxY = -1;
for (int iNode = 0; iNode < nodes.size(); iNode++) {
int nY = getPositionY((Integer) nodes.elementAt(iNode));
if (nY < nM... | 7 |
private RubiksCube doRotate(Rotation aDirection, Face aFace, int offset,
int tlCubieIdx, int trCubieIdx, int brCubieIdx, int blCubieIdx,
int topCubieIdx, int rightCubieIdx, int bottomCubieIdx, int leftCubieIdx) {
// cube's are immutable so we need to return a new cube state.
byte[] toReturn = new byte[20];
... | 8 |
public static void main(String[] args) throws IOException {
SSPPBuildManager manager = new SSPPBuildManager();
if (args.length != 3) {
LOG.info("Usage: java SSPPBuildManager CIUrl tempFolder formalBuildFolder");
System.exit(0);
} else {
CI_URL = args[0];
... | 7 |
public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double)o).isInfinite() || ((Double)o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... | 7 |
@Override
public void remove(Integer[] ids) throws DaoException
{
if ((ids == null) || (ids.length < 1))
{
return ;
}
PooledConnection connection = null;
PreparedStatement pStatement = null;
try
{
connection = (PooledConnection) cp.takeConnection();
StringBuffer query = new StringBuffer(NewsD... | 8 |
private static String FormatInt(String value) {
if (value.length() == 1) {
return "0" + value;
} else {
return value;
}
} | 1 |
private java.util.ArrayList<Element> findImplementations(String base){
java.util.ArrayList<Element> elements = new java.util.ArrayList<Element>();
NodeList Schemas = getSchema();
for (int i=0; i<Schemas.getLength(); i++ ) {
Node node = Schemas.item(i);
String typeName =... | 9 |
int[] mergeObjects(List<Detection> detections, ArrayList<Detection>[][] grid, HashMap<String, Double> sizeInformation) {
long startTime = System.nanoTime();
int num_groups = 0, num_excess = 0;
double ra_cell_size = sizeInformation.get("ra_cell_size");
double dec_cell_size = sizeInformat... | 9 |
@Before
public void setUp() throws Exception {
File f = new File(tmpFilename);
if (f.exists())
if (!f.delete())
throw new IOException("Can't delete cache file for testing\n");
f = null;
} | 2 |
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.