text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} | 5 |
@Test
public void identity_test() {
try{
double [][]exp= {{1.0,0.0}, {0.0,1.0}};
double[][]result = Matrix.identity(2);
Assert.assertArrayEquals(exp, result);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented");
}
} | 1 |
public Student(String no, String name, int age, String sex, Date birthday,
String address, String tel, String email) {
this.no = no;
this.name = name;
this.age = age;
this.sex = sex;
this.birthday = birthday;
this.address = address;
this.tel = tel;
this.email = email;
} | 0 |
public static Type parseType(short source) throws UnknownTypeError
{
switch (source)
{
case 1:
return CHGK;
case 2:
return BRAIN;
case 4:
return SVOYAK;
case 8:
return VERSE;
c... | 7 |
@Test
public void testExperiment3() {
int total = 0;
int count = 0;
for (int i = 0; i < mServerCount; i++) {
try {
mDhtClientArray[i].purge();
} catch (RemoteException e) {
e.printStackTrace();
System.out.println("dhtCli... | 7 |
@Override
public void run() {
while (true) {
if (!done() && clock != null) {
int secondsLeft = (int) (setAt + setMillis - System.currentTimeMillis()) / 1000;
clock.setText(String.valueOf((int) (Math.floor(secondsLeft / 60)))
+ ":" + String.... | 6 |
public void setAlignment(MouseEvent event) {
EventTarget target = event.getTarget();
VerticalAlignment vAlignment = null;
HorizontalAlignment hAlignment = null;
if (target.equals(topLeft)) {
vAlignment = VerticalAlignment.TOP;
hAlignment = HorizontalAlignment.LEF... | 9 |
public static ArrayList<String> getTypeTitle(String type) {
ArrayList<String> ret = new ArrayList<String>();
String filename="E:\\doc\\sort.txt";
String line, s[];
try {
BufferedReader br = new BufferedReader(new FileReader(new File(filename)));
while((line=br.readLine())!=null) {
s = line.split(" ");... | 4 |
public void run(){
while(running){
System.out.println(id + ": " + count);
count++;
this.linha.update();
try{
sleep((long)(wait));
}catch (Exception e){
}
}
System.out.println("The thread is dead!");
} | 2 |
public static void main(String[] args) {
OJ357 oj357=new OJ357();
System.out.println(oj357.countNumbersWithUniqueDigits(3));
} | 0 |
public void addReplace(String zipPath, String extPath) throws IOException
{
Path path = fileSystem.getPath(zipPath);
if(!Files.exists(path))
{
Path parent = path.getParent();
System.out.println(parent);
if(parent != null)
{
Files.createDirectories(parent);
}
Files.createFile(path);
}
... | 2 |
private void go(){
ArrayList<HashSet<Integer>> lists = new ArrayList<HashSet<Integer>>();
lists.add(new HashSet<Integer>());
lists.add(new HashSet<Integer>());
int[] count = new int[101];
for(int i=2;i<=100;i++){
lists.add(new HashSet<Integer>());
int power = isPower(i);
int base = getBase(i);
... | 5 |
public void addHeart(Heart h) {
synchronized(hearts) {
if (!hearts.contains(h))
hearts.add(h);
}
} | 1 |
private static double DaylightSavingTA(double t)
{
// Another workaround! The JRE doesn't seem to know about DST
// before year 1 AD, so we map to equivalent dates for the
// purposes of finding dst. To be safe, we do this for years
// outside 1970-2038.
if (t < 0.0 || t > ... | 7 |
public static void main(String args[])
{
ArrayList<String> output = new ArrayList<>();
Scanner in = new Scanner(System.in);
String line = in.nextLine();
while (line != null && !line.equals(""))
{
/* Do the computations for the given line of input */
St... | 5 |
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) {
// queue keep the need visited node.
// map keep the has visited node in the new graph
Queue<UndirectedGraphNode> queue = new LinkedList<UndirectedGraphNode >();
HashMap<Integer,UndirectedGraphNode > visitedMap = new HashMap<Integer,UndirectedGraph... | 8 |
public Grid(int xSize, int ySize) {
tiles = new Tile[xSize][ySize];
start();
} | 0 |
public static void create(final boolean log) {
if (!log) {
final VBLogin login = new VBLogin("", "");
login.usergroupId = 0;
login.userId = 0;
login.logged = true;
self = login;
}
if (self != null) {
return;
}
... | 7 |
public Set<Map.Entry<Character,Float>> entrySet() {
return new AbstractSet<Map.Entry<Character,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TCharFloatMapDecorator.this.isEmpty();
}
... | 8 |
@Test
public void pow_test() {
try{
double x = 30;
Power3CFunction pow = new Power3CFunction();
double result= pow.function(x);
double exp = 27000.0;
Assert.assertEquals(exp, result, 0.001);
}
catch (Exception e) {
// TODO Auto-generated catch block
fail("Not yet implemented");
}
} | 1 |
public static Document parseXmlStream(InputStream xml) throws IOException {
createFactories();
// Create the document builder.
Document doc = null;
if(xml != null) {
DocumentBuilder builder = null;
try {
builder = Utilities.dbFactory.newDocumentBuilder();
} catch(ParserConfigurationException e) {... | 3 |
@Override
public void push(T task) throws IllegalArgumentException, InterruptedException {
taskCount++;
// final long startTime = System.currentTimeMillis();
taskAcceptor.push(task);
// totalWaitTime += System.currentTimeMillis() - startTime;
} | 0 |
private String getTwoDigits(int num) {
String str = Integer.toString(num);
return num < 10 ? "0" + str : str;
} | 1 |
public ContaCorrente get(int pos)
{
try {
if (this.aContas[pos] != null)
return this.aContas[pos];
return null;
} catch (Exception e) {
return null;
}
} | 2 |
private boolean initializeMods() {
boolean debugVerbose = Settings.getSettings().getDebugLauncher();
final String debugTag = "debug: initializeMods: ";
if (debugVerbose) { Logger.logInfo(debugTag + "pack dir..."); }
Logger.logInfo(ModPack.getSelectedPack().getDir());
ModManager man = new ModManager(new JFram... | 6 |
private char[] readPassword(InputStream in) throws IOException {
char[] lineBuffer;
char[] buf;
int i;
buf = lineBuffer = new char[128];
int room = buf.length;
int offset = 0;
int c;
loop: while (true) {
switch (c = in.read()) {
case -1:
case '\n':
break loop;
case '\r':
int c2... | 9 |
public static ClassInfo getClassInfo(String typeSig) {
if (typeSig.charAt(0) != 'L')
throw new IllegalArgumentException();
return ClassInfo.forName(typeSig.substring(1, typeSig.length() - 1)
.replace('/', '.'));
} | 1 |
@EventHandler
public void onInventoryClose(InventoryCloseEvent event) {
Player player = (Player) event.getPlayer();
if(bm.getSlot(player.getName())!=null){
String bankslot = bm.getSlot(player.getName());
try {
if(bankslot.contains("/")) {
loader.saveSlot(event.getInventory(), bankslot.split("/")[0],... | 3 |
public static int lerak( String sor, int jatekos, int[][] tabla )
{
logger.info("Bábúk lehelyezése");
int oszlopszam = 0, sorszam = 0 ;
int[] sorOsz= new int[2];
sorOsz = Helyezz.helyMeghataroz(sor);
sorszam = sorOsz[0];
oszlopszam = sorOsz[1];
if(sorszam == -1 || oszlopszam == -1)
{
System.out.... | 4 |
public static Point interseccionDeSegmentos(int u1, int v1, int u2, int v2, int x1, int y1, int x2, int y2)
{
Point p = new Point() ;
int res;
int a1,a2,b1,b2,c1,c2,dd;
double xx,yy;
res = -1; // cuando uno de los segmentos es un punto
// res := 0 cuando son paralelas pero no c... | 8 |
public void setBookingDate(Date bookingDate) {
this.bookingDate = bookingDate;
} | 0 |
public String updateMarketIndexData(String index, String arg) {
String dataText = "";
String urlvar = "";
String urlfull = "";
String in = "";
/* Build the appropriate URL string.
urlbase is the beginning format of all CSV data requests.
urlvar is the for... | 8 |
public void paintComponent(Graphics g) {
super.paintComponent(g);
Calendar now = Calendar.getInstance();
hour = now.get(Calendar.HOUR_OF_DAY);
minute = now.get(Calendar.MINUTE);
second = now.get(Calendar.SECOND);
if (hour < 10) {
this.correctionHour = "0";
}
if (hour >= 10) {
this.corr... | 6 |
public DocumentAttributesPanel() {
super();
} | 0 |
public void remove(int offs, int len) throws BadLocationException {
// return immediately when selecting an item
if (selecting) return;
if (hitBackspace) {
// user hit backspace => move the selection backwards
// old item keeps being selected
if (offs>0) {
... | 4 |
@Override
public boolean evaluate(T t) {
if(firstSearchString.evaluate(t) && secondSearchString.evaluate(t)){
return true;
}
else{
return false;
}
} | 2 |
public static void decompress(File in, File out) throws Exception {
File inFile = in;
File outFile = out;
BufferedInputStream inStream = new BufferedInputStream(new FileInputStream(inFile));
BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(outFile));
int propertiesSize = 5;
... | 5 |
public void test_04_parse() {
String vcfFile = "tests/test.nextProt_paren.vcf";
int count = 0;
for (VcfEntry ve : new VcfFileIterator(vcfFile)) {
for (VcfEffect eff : ve.parseEffects()) {
System.out.println(eff);
if (eff.getEffect() == EffectType.NEXT_PROT) count++;
}
}
System.out.println("Coun... | 3 |
public int getCurrCol(){
return currCol;
} | 0 |
public void addStatusCode(String response) {
if ("200".equalsIgnoreCase(response)) {
add200OK();
} else if (response != null && response.startsWith("50")) {
add50X();
} else if (response != null && response.startsWith("40")) {
add40X();
} else if (resp... | 7 |
private void updateSpriteImage() {
String spritename = "player/";
Anchor anchor;
if (xvel < 0) {
spritename += "left/";
anchor = Anchor.TOP_RIGHT;
}
else if (xvel > 0) {
spritename += "right/";
anchor = Anchor.TOP_LEFT;
}
... | 7 |
public static void main(String[] args) {
//Heap Time
HeapBasedPriorityQueue<Integer> heapBasedPriorityQueue = new HeapBasedPriorityQueue<Integer>(Integer.class);
for (int i = 20; i > 0; i--) {
heapBasedPriorityQueue.offer(i);
}
System.out.println("Heap-PQueue's size after adding 20 items: " + heapBasedPrio... | 4 |
public ResultSet checkPatient(String patient_info) {
try {
// checking whether the user enters health care no or patient name
if (Helper.isInteger(patient_info)) {
String selectPatientByNoQuery = "SELECT * FROM PATIENT WHERE health_care_no = "
+ Integer.parseInt(patient_info);
rs = stmt.executeQ... | 2 |
public boolean isSameTree1(TreeNode p, TreeNode q) {
if (p == null && q == null) {
return true;
}
if (p == null || q == null || p.val != q.val) {
return false;
}
return isSameTree1(p.left,q.left) && isSameTree1(p.right, q.right);
} | 6 |
public YahooLifestyleSpider(String startSite, String dirPath, Cobweb cobweb, int maxDepth) throws Exception {
super(startSite, dirPath, cobweb, maxDepth);
} | 0 |
void cropVertically() {
int oldWidth = width;
int oldHeight = height;
int topCrop = 0;
crop: while (topCrop < height) {
for (int mx = 0; mx < width; mx++) {
if (mask[topCrop][mx]) {
break crop;
}
}
topCrop++;
}
int bottomCrop = 0;
crop: while (bottomCrop < height - topCrop) {
for ... | 8 |
public Vector<RawMaterial> getMyWool(MOB M)
{
final Vector<RawMaterial> wool=new Vector<RawMaterial>();
if((M!=null)
&&(M.charStats().getMyRace()!=null)
&&(M.charStats().getMyRace().myResources()!=null)
&&(M.charStats().getMyRace().myResources().size()>0))
{
final List<RawMaterial> V=M.charStats().getMy... | 7 |
public void removerControle(){
if ( this.num_controles == 0 ){
System.out.println("\nNão existe nenhum controle ainda.");
}
else{
System.out.println("\nQual dos consoles você gostaria de remover? "
+ "[ 1 - " + this.num_controles + " ]");
int ... | 9 |
@SuppressWarnings("unchecked")
private static short getIndexOfColor(String color)
{
Hashtable<String, HSSFColor> hashtable = HSSFColor.getTripletHash();
StringBuffer sb = new StringBuffer();
if(color.startsWith("#"))
{
//color = color.substring()
color = color.substr... | 6 |
public static long getFileSize(File file) {
if (!file.isDirectory()) return file.length();
long length = 0;
for (File f : file.listFiles()) {
if (f.isDirectory())
length += getFileSize(f);
else
length += f.length();
}
return length;
} | 3 |
private void checkCollisions() {
/* Actualizamos la posicion en X en base a si hay o no colision */
double posX = player.getPos().getX();
double velX = player.getVel().getX();
double newX = posX + velX;
Rectangle playerBox = new Rectangle((int) newX, (int) player.getPos().getY(),
player.getWidth(),... | 9 |
public List<String> categories() {
LinkedList<String> allCat = new LinkedList<String>();
if(wallpaper!=null) {
allCat.add("wallpapers");
}
if(icons.size()>0) {
allCat.add("app_icons");
}
for(int i=0; i<files.size(); i++) {
if(!allCat.co... | 6 |
private void readPreferences() {
File f = new File("preferences.json");
try {
if (f.exists())
preferences = Preferences.readNew(new FileReader(f));
else {
preferences = new Preferences();
f.createNewFile();
preferences.write(new FileWriter(f));
System.out.println(translation.translate("file.create... | 3 |
private boolean swapForRequest() {
for(Team team : teams)
calcConnections(team);
for(Team team1 : teams)
for(int t2 = teams.size()-1; t2 >= 0;t2--){
if(!team1.equals(teams.get(t2)))
for(int i =0;i < team1.members.size();i++){
... | 8 |
public synchronized void start() {
if (running) {
return;
}
running = true;
thread = new Thread(this);
thread.start();
} | 1 |
public void keyReleased(int k) {
if(k == KeyEvent.VK_UP)player.setUp(false);
if(k == KeyEvent.VK_DOWN)player.setDown(false);
if(k == KeyEvent.VK_LEFT)player.setLeft(false);
if(k == KeyEvent.VK_RIGHT)player.setRight(false);
if(k == KeyEvent.VK_Z)player.setJumping(false);
if(k == KeyEvent.VK_X)player.setFiri... | 7 |
private boolean writeLabel(String label) {
boolean validLabel = true; // Used to determine if the label is a valid label
label = label.trim(); // Remove all trailing/leading whitespace
if (label.indexOf(":") == label.length() - 1) label = label.substring(0, label.length() - 1); ... | 7 |
private boolean isMethodImplemented() {
boolean retVal = false;
if (this.request.getMethod().equals("GET")) {
retVal = true;
}
if (this.request.getMethod().equals("POST")) {
retVal = true;
}
if (this.request.getMethod().equals("OPTIONS")) {
retVal = true;
}
if (this.request.getMethod().equals("... | 5 |
public ParseResult parseAll(Map<String, String> values) throws FormValidationException {
Map<Field, Object> results = new HashMap<>(fields.size());
Map<Field, ValidationException> failures = new HashMap<>(fields.size());
for (Field field : fields) {
String value = values.get(field.getName());
Ob... | 4 |
public static void main(String[] args) {
try {
String cla = "java.util.Calendar";
String method = "getInstance";
String param = "2.5";
Class<?> c = Class.forName(cla);
//System.out.println(Arrays.toString(c.getMethods()));
Method[] methods = c.getMethods();
boolean called = false;
for (int i =... | 8 |
private void handleProperties(final Properties p){
if(p != null){
if(p.containsKey(DB_DIR_KEY)){
dbDir = p.getProperty(DB_DIR_KEY);
}
if(p.containsKey(OVERWRITE_KEY)){
overWrite = Boolean.parseBoolean(p.getProperty(OVERWRITE_KEY));
}
if(p.containsKey(READ_ONLY_KEY)){
readOnly = Boolean.p... | 8 |
public void rotateEdges(TileColor face) {
List<int[]> corners = new ArrayList<int[]>();
List<int[]> edges = new ArrayList<int[]>();
if (face.equals(TileColor.white)) {
// corners
corners.add(createArray(1, 0, 2));
corners.add(createArray(1, 2, 2));
corners.add(createArray(2, 0, 0));
corners.add(cre... | 8 |
public boolean doMovement(Movimiento mov) {
/*decida que hay que hacer */
if(isBloqued){
return false;
}
if (mov.getTipo().equals("recargo")) {
if (this.Recargo(mov.getImporte())) {
this.registerMovement(mov);
return true;
... | 7 |
private static Moves performStep0(BotState state) {
Moves out = new Moves();
List<Region> distanceTwoRegions = new ArrayList<>();
for (Region region : state.getVisibleMap().getOwnedRegions(state)) {
if (region.getDistanceToOpponentBorder() == 2 && region.getIdleArmies() > 0) {
distanceTwoRegions.add(region... | 5 |
public int getATK() {
return atk;
} | 0 |
public double getTotalWeight(ArrayList<Double> amounts) {
double total = 0;
if (amounts.size() < items.size()) {
for (int i = amounts.size(); i < items.size(); i++) {
amounts.add(0.0);
}
}
for (int i = 0; i < amounts.size(); i++) {
tota... | 3 |
@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Message other = (Message) obj;
if (text == null)
{
if (other.text != null)
return false;
}
else if (!text.equals(other.text))
re... | 9 |
public void add(String href, boolean traversed) {
if (href != null) {
if (href.startsWith("javascript") || href.startsWith("news")) return;
if (href.startsWith("http") || href.startsWith("mailto")) {
if (traversed) {
mon.addTraversed(href);
} else {
mon.addRemaining(href);
}
} else {
... | 9 |
@RequestMapping(value = "/signin", method = RequestMethod.POST)
public String signinForm(@ModelAttribute User user, Model model, HttpSession session) {
String userPassword = user.getPassword();
String dbPassword = Database.getPassword(user.getUsername());
String username = user.getUsername();
if(userPassword ... | 4 |
public void altFire(Player player, Environment enviro){
if(canShoot){
canShoot = false;
Position posToCreateCube = Position.screenToWorld(Display.getWidth()/2, Display.getHeight()/2);
BoundingBox bounds = new BoundingBox(1,1,1);
shoot(new SpawnedCube("spawnedcube.png", bounds, posToCreateCube, enviro), en... | 3 |
public Wrapping wrapping(int x) {
// Base constructor call:
return new Wrapping(x) { // Pass constructor argument.
public int value() {
return super.value() * 47;
}
}; // Semicolon required
} | 0 |
public static void startupMethods() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (S... | 6 |
public void openTile(int aX, int aY)
{
final byte openId = mField.getMasks().getOpen().getId(), openBombId = mField.getMasks().getOpenBomb().getId();
if (mField.getTileValue(aX, aY).isEmpty() && isInsideAreas(Tile.create(aX, aY))) openArea(getContainingArea(Tile.create(aX, aY)));
else
{
if (mField.getTileVa... | 3 |
ArrayList<seed> hexPack(double distToWall, double width, double length, ArrayList<Pair> treeLst) {
ArrayList<seed> seedLst = new ArrayList<seed>();
boolean canFitMore = true;
boolean treeCollision = false;
double xIter = distToWall;
int isEven = 1;
double yIter = distToWall;
while( canFitMore ) {
... | 8 |
private void addToCount(String name, int N) {
if(this.count.containsKey(name)) {
int n = this.count.get(name);
if(N < n) {
this.count.remove(name);
this.count.put(name, N);
}
} else {
this.count.put(name, N);
}
} | 2 |
@Override
public void commandReceived(String command)
{
console.writeLine("The command is " + command);
} | 0 |
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isInstance(this);
} | 1 |
public List<ArquivosBeans> getListaBkup() {
try {
listaBkp = new ArrayList<ArquivosBeans>();
int j = 0;
if (dir.isDirectory()) {
String[] filhos = dir.list();
for (int i = 0; i < filhos.length; i++) {
File nome = new File(d... | 7 |
private static BigFraction parse(String s){
try{
if(s == null){
return null;
}
if(s.isEmpty()){
return null;
}
char[] c = s.toCharArray();
c = removeChar(c, (char) 32);
c = removeChar(c, (char) 43);
int l = c.length;
byte[] b = new byte[l];
b[0] = findFirst(c[0]);
... | 8 |
public int getSkillRechargeTimeLeft(SkillBarSkillSlot skillSlot) throws IOException {
int skillRecharge = this.getSkillRecharge(skillSlot);
if (skillRecharge == 0) {
return 0;
}
int timeStamp = this.getTimeStamp();
return skillRecharge - timeStamp;
} | 1 |
public synchronized static DiceHand translateToDiceHand(String rawMsg) {
int totalMod = 0;
ArrayList<Die> dice = new ArrayList<>();
String rollee = "NO_ROLLEE_FOUND";
String[] elements = rawMsg.split(ELEMENT_SEP);
for (int m=0; m<elements.length; m++) {
// ex... | 6 |
public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int p = sc.nextInt();
String str = sc.next();
int firstDiff = -1;
int lastDiff = -1;
int count = 0;
for (int i = 0; i < str.length() / 2; i... | 7 |
public static void MP_STRING_LIT() {
char currentChar = file.charAt(index);
currentLexeme = "";
String tempLexeme = "";
int state = 0;
while(true){
currentChar = file.charAt(index);
switch(state){
case 0:
if(currentChar == '\'') {
//tempLexeme += currentChar; -- don't want quotes in our lexe... | 8 |
private NoteLengthEnum[] generateIrregularTimes(TimeSignatureEnum timeSignature, int maxTime, int speedPercent, Random r) {
int beats = timeSignature.getBeats();
NoteLengthEnum lastBeat = timeSignature.getOneBeat();
NoteLengthEnum currBeat = null;
double remaining = 1.0;
ArrayLis... | 6 |
public void setNowDate() {
setSysDate(getNowYear(), getNowMonth());
getSysRunDate();
setDateNull();
combo1.setSelectedIndex(getShowYear() - 1900);
combo2.setSelectedIndex(getShowMonth());
setDays(getMonthDays(getNowYear(), getNowMonth()),
getInitWeek(sysRunTime[0]), getNowDay());
// labelTime.setText... | 0 |
public void setCommandButtonPadding(int[] padding) {
if ((padding == null) || (padding.length != 4)) {
this.buttonCom_Padding = UIPaddingInits.COM_BTN.getPadding();
} else {
this.buttonCom_Padding = padding;
}
somethingChanged();
} | 2 |
public NBT(byte[] data) throws IllegalArgumentException
{
byte[] uncompressed;
try
{
GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(data));
ByteArrayOutputStream out = new ByteArrayOutputStream();
int res = 0;
byte buf[] = new byte[1024];
while (res >= 0) {
res = in.read(... | 5 |
@Override
public Dimensions getDimensions(){
if(getId()==1){
return new Dimensions(30, 30, 70);
}else if(getId()==2){
return new Dimensions(30, 70, 70);
}else if(getId()==3){
return new Dimensions(70, 70, 70);
}else if(getId()==4){
return new Dimensions(70, 30, 70);
}
return null;
} | 4 |
@Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... | 8 |
@SuppressWarnings("unchecked")
public void showAllData() {
data = (Vector<String[]>) allPorts.clone();
fireTableDataChanged();
} | 0 |
private String hash(char[] arg){
MessageDigest md;
byte[] passbyte = null;
byte[] encoded = null;
String hash = "";
try {
// TODO: Check integrity of SHA256 vs MD5
md = MessageDigest.getInstance("SHA-256"); // Creates an SHA-256 generator
passbyte = new String(arg).getBytes();
encoded... | 4 |
protected void writeItem(OutputStream out, Item item) throws IOException {
out.write(item.asEnum().ordinal());
if(item instanceof Key){
out.write(((Key)item).ID);
out.write(((Key)item).getDescription().length());
out.write(((Key)item).getDescription().getBytes());
}
else if(item instanceof Powerup){
... | 4 |
private void startBtnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_startBtnMouseClicked
initialize();
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
buttons[i][j].setIcon(null);
buttons[i][j].setEnabled(true);
}
... | 9 |
public void stopAll(String type) {
if (type == "wav") {
for (int i = 0; i < clips.size(); i++) {
clips.get(i).stop();
}
} else if (type == "ogg") {
for (int i = 0; i < oggs.size(); i++) {
oggs.get(i).stop();
}
} else {
game.log.jukebox("unknown file type '" + type + "'");
}
} | 4 |
public boolean method564(int id) {
for (int i = 0; i < mapIndices1.length; i++) {
if (mapIndices3[i] == id) {
return true;
}
}
return false;
} | 2 |
private Rama_Hoja buscarObjeto(String pNombre,Rama_Hoja pNodo){
Rama_Hoja resp = null;
if(pNodo.getIdentificador() == pNombre)
resp = pNodo;
else
for(Nodo<Rama_Hoja> iterador = pNodo.getEntradas().getHead(); iterador != null; iterador = iterador.getSiguiente())
... | 2 |
public void DHPhase1() {
// Prep DH
dhParameters = new DHParameterSpec(prime, base);
// Setup key generator
keyGen = null;
try {
keyGen = KeyPairGenerator.getInstance("DH");
} catch (NoSuchAlgorithmException e) {
mylog.out("ERROR", "There is no DH algorithm available.");
}
try {
keyGen.initial... | 4 |
public List<GespieltesSpiel> getSpiele(String teamId, int maxResults) {
List<Spiel> alleSpiele = eloPersistence.findAll(Spiel.class, Integer.MAX_VALUE, "order by m.zeitpunkt desc");
for (Iterator<Spiel> i = alleSpiele.iterator(); i.hasNext();) {
Spiel spiel = i.next();
if (!spiel.getGewinner().getId().equals(... | 5 |
public int updateUser(User userToUpdate) {
try {
// Erforderlicher SQL-Befehl
String sqlStatement = "UPDATE bookworm_database.users SET username = '"
+ userToUpdate.getUserName()
+ "', userrole = '"
+ userToUpdate.getUserRole()
+ "' WHERE id ="
+ userToUpdate.getUserID() + ";";
// ... | 1 |
private boolean cargar() {
int opcion;
boolean cargado = true;
JFileChooser jfc = new JFileChooser();
opcion = jfc.showOpenDialog(this);
if (opcion == JFileChooser.APPROVE_OPTION) {
try {
File archivo = jfc.getSelectedFile();
ObjectInpu... | 3 |
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.