text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void CanBeDama(Casella pCasella){
//controlla se la casella non ha ancora una dama
if(pCasella.getDama().getColore().equals(Dama.Colori.NULL)){
//capisce su quale versante va fatta la dama
if(pCasella.getPedina().getColore().equals(Pedina.Colori.BIANCO)){
... | 4 |
@Override
public List<Integer> save(List<LinkDirectionCity> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException {
try {
return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (LinkDirectionCity bean) -> {
Object[] objects = new Object[2];
... | 1 |
public ArrayList<Element> parse() throws HPPPlusException {
ArrayList<Parseable> parseList = (ArrayList<Parseable>) data.clone();
for (int i=0;i<handlers.size();i++) {
Element handler = handlers.get(i);
for (int j=0;j<parseList.size();j++) {
if (handler.isMatch(p... | 9 |
private void menuConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuConnectActionPerformed
Globals.global_connection = new dbConn(Globals.FD_database);
this.setTitle(Globals.FD_database + " Connected=" +Globals.global_connection.get_connection_state());
combo_persons.r... | 1 |
private int skip(int startIndex) {
// System.out.print("Skipping past index: ");
// System.out.println(startIndex);
int condition = -1; // not a valid condition (so we can tell
// later if
// something goes wrong)
try { // in case we throw an IndexOutOfBoundsException on
// eleme... | 3 |
public static void main(String[] args) {
double n;
int count = 1;
int maxN = 0;
int max = 0;
for (int i = 1; i < 1000000; i++) {
n = i;
count = 1;
while (n != 1) {
if (isEven(n)) {
n = n / 2;
} else {
n = (n * 3) + 1;
}
count++;
if (n == 1) {
break;
}
}... | 5 |
@Override
public int lastIndexOf( Object elem )
{
if( elem == null )
{
for( int i = size - 1; i >= 0; i-- )
{
if( elementData[i] == null )
{
return i;
}
}
}
else
{
for( int i = size - 1; i >= 0; i-- )
{
if( elem.equals( elementData[i] ) )
{
return i;
}
}
... | 5 |
public static void directselectionsorting(int[] a ){
for (int i = 0; i < a.length; i++) {
int k = i;
for (int j = i+1; j < a.length; j++) {
if (a[k]>=a[j]) {
k = j;
}
}
if (k != i) {
int tmp;
tmp = a[i];
a[i] = a[k];
a[k] = tmp;
}
}
} | 4 |
private void persist(PersistAction persistAction, String successMessage) {
if (selected != null) {
this.setEmbeddableKeys();
try {
if (persistAction != PersistAction.DELETE) {
this.ejbFacade.edit(selected);
} else {
... | 8 |
private void btnProcesarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProcesarActionPerformed
String ruta = tfArchivo.getText();
String origen = (String) selectOrigen.getSelectedItem();
String grupo = (String) selectGrupo.getSelectedItem();
//revision de que hay... | 4 |
public void closeSocket() {
try {
socket.close();
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
static void verifyDivergenceDirichletArgs(double[] xs, double[] ys) {
if (xs.length != ys.length) {
String msg = "Parameter arrays must be the same length."
+ " Found xs.length=" + xs.length
+ " ys.length=" + ys.length;
throw new IllegalArgumentException(m... | 9 |
private boolean followPath() {
if (pathing) {
if (path.size() == 0) {
return false;
}
if (pathindex == path.size() - 1) {//we finished the path
pathing = false;
return false;
}
parent.moveTo(path.get(pat... | 3 |
public Indir<Resource> getres(final int id) {
synchronized (rescache) {
Indir<Resource> ret = rescache.get(id);
if (ret != null)
return (ret);
ret = new Indir<Resource>() {
public int resid = id;
Resource res;
p... | 5 |
public void solveDFS(char[][] board, int r, int c){
if(r < 0 || r >= R || c >= C || c < 0) return;
if(board[r][c] == 'X') return;
if(visited[r][c]) return;
visited[r][c] = true;
solveDFS(board, r-1,c);
solveDFS(board, r+1,c);
solveDFS(board, r,c-1);
solve... | 6 |
public int priority()
{
for (int i = 0; i < priorities.length; i++)
{
for (char operator: priorities[i])
{
if (operator == value) return priorities.length - i;
}
}
return 0;
} | 3 |
public final long getMessageDelay() {
return _messageDelay;
} | 0 |
public void promoteNameToValue() throws IOException {
expect(JsonToken.NAME);
Iterator<?> i = (Iterator<?>) peekStack();
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
stack.add(entry.getValue());
stack.add(new JsonPrimitive((String)entry.getKey()));
} | 6 |
public boolean tjekPeriode(int periodeFra, int periodeTil) throws MonthException {
if (periodeFra < 1 || periodeFra > 12 || periodeTil < 1 || periodeTil > 12) {
throw new MonthException();
} else {
if (periodeFra > periodeTil) {
throw new MonthException();
... | 5 |
public static void main(String[] args) {
while (true) {
try {
// Post-increment is zero first time:
if (count++ == 0)
throw new ThreeException();
System.out.println("No exception");
} catch (ThreeException e) {
System.out.println("ThreeException");
} finally {
System.out.println("In ... | 4 |
public void crawler() //抓取微博
{
init();
Date lastestDate = lastTime;
String urlsuffix = '/' + uid;
for(;;)
{
try {
Document page = PageFetcher.getPage(cookies, baseUrl + urlsuffix); //获取页面
List<Weibo> weibos = PageResolver.resolveUserPage(page, uid, screenName); //分析页面,得到微博
if(weibos.i... | 7 |
protected void recursiveBalance(TreeNode currentNode) {
setBalance(currentNode);
int balance = currentNode.balance;
if (balance == -2) {
if (height(currentNode.left.left) >= height(currentNode.left.right)) {
currentNode = rotateRight(currentNode);
} else {
currentNode = doubleRotateLeftRight(curre... | 5 |
public ImageBean getImage(int idimage){
ImageBean imageBean = null;
try {
PreparedStatement statement = connection.prepareStatement(GET_IMAGE_BY_ID);
statement.setString(1, new Integer(idimage).toString());
ResultSet resultSet = statement.executeQuery();
if(resultSet.next() == false) return nu... | 3 |
public void calculateNextGeneration() {
System.out.println(population.size());
//// Prepare
calculateCumulativeFitness();
//// Reproduce species
int speciesToReproduce = (int)(REPRODUCTION_RATE * POPULATION_SIZE);
speciesToRepr... | 5 |
public int func_50024_a(int par1, int par2)
{
int var3 = par2;
boolean var4 = par1 < 0;
int var5 = Math.abs(par1);
for (int var6 = 0; var6 < var5; ++var6)
{
if (var4)
{
while (var3 > 0 && this.text.charAt(var3 - 1) == 32)
... | 9 |
public EsteenTyyppi getTyyppi() {
return tyyppi;
} | 0 |
public String Apagar(){
String r = "";
if(dao.Apagar(entidade)){
r = "listagemFuncao.xhtml";
return r;
}
else{
return r;
}
} | 1 |
public boolean canImport(TransferSupport support) {
if (!support.isDrop()) { //only supports drops, change this
return false;
}
if (!support.isDataFlavorSupported(new DataFlavor(Card.class, "Card")) &&
!support.isDataFlavorSupported(localObjectFlavor)) {
return false; //only import Card and Integer obje... | 3 |
@Transient
public static boolean isValidServerTypeClassName(String className){
Object object = null;
try{
object = Class.forName(className).newInstance();
}catch(Exception e){
return false;
}
if(object instanceof Model)
return true;
return false;
... | 2 |
final void method1227(byte i, int i_61_, int i_62_, ItemLoader class255) {
try {
if (i == 42) {
anInt2099++;
if (i_62_ == -1)
anIntArray2092[i_61_] = 0;
else if (class255.getItemDefinition(-125, i_62_) != null) {
anIntArray2092[i_61_]
= Class273.bitOr(1073741824, i_62_);
method1234(-100... | 5 |
public void removeUnreachable() {
if ((preOrder == null) || (edgeModCount != preOrder.edgeModCount)) {
buildLists();
}
final Iterator iter = nodes.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry e = (Map.Entry) iter.next();
final GraphNode v = (GraphNode) e.getValue();
if (v.preO... | 4 |
protected boolean on_board(int [] move, int i){
if (x + move[0] * i > -1 && x + move[0] * i < 8) {
if (y + move[1] * i > -1 && y + move[1] * i < 8) {
return true;
}
}
return false;
} | 4 |
@Override
public void writeBytes(byte[] b, int offset, int length) throws IOException {
int bytesLeft = BUFFER_SIZE - bufferPosition;
// is there enough space in the buffer?
if (bytesLeft >= length) {
// we add the data to the end of the buffer
System.arraycopy(b, offset, buffer, bufferPositio... | 7 |
public Wave44(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 3000; i++){
if(i % 8 == 0)
add(m.buildMob(MobID.ONIX));
else if(i % 7 == 0)
add(m.buildMob(MobID.MACHOP));
else if(i % 6 == 0)
add(m.buildMob(MobID.GRAVELER));
else if(i % 5 == 0)
add(m.buildMob(MobID.MAROWAK... | 5 |
public boolean canSubmit() {
if (System.currentTimeMillis() > timeStart
&& System.currentTimeMillis() < timeEnd)
return true;
else
return false;
} | 2 |
protected static Ptg calcAtanh( Ptg[] operands )
{
if( operands.length != 1 )
{
return PtgCalculator.getNAError();
}
double dd = 0.0;
try
{
dd = operands[0].getDoubleVal();
}
catch( NumberFormatException e )
{
return PtgCalculator.getValueError();
}
if( (dd > 1) || (dd < -1) )
{
ret... | 5 |
@Test
public void testNum2wordWithZeroOrOne() {
assertTrue(_phonewordFinder.num2words("3569370").size() > 0);
assertTrue(_phonewordFinder.num2words("3569371").size() > 0);
assertTrue(_phonewordFinder.num2words("03569371").size() > 0);
} | 0 |
public String simplifyPath(String path) {
Stack<String> S = new Stack<>();
String[] pathArray = path.split("/");
for (int i = 0; i < pathArray.length; i++) {
if (!S.isEmpty() && pathArray[i].equals(".."))
S.pop();
else if (pathArray[i].length() == 0 || pat... | 8 |
private static void findIncSubSeq(int[] arr) {
int oldStart = 0, oldSum = 0, sum = 0, start = 0;
start = arr[0];
sum += start;
for(int i = 1; i < arr.length; i++)
{
if(arr[i-1] == arr[i] -1)
{
sum += arr[i];
}
else
{
if(sum > oldSum)
... | 8 |
private boolean validTargetNotParent(Sprite s){
boolean returnVal = true;
if(s instanceof Ship){
Ship ship = (Ship)s;
if(parent == ship) returnVal = false;
}else if(s instanceof Turret){
Turret turret = (Turret)s;
if(parent == turret.parent) returnVal = false;
}else{
//expand validtarget here
}... | 4 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Grade)) {
return false;
}
Grade other = (Grade) object;
if ((this.id == null && other.id != null) || (this.id !... | 5 |
public void putBit(int bit) throws IOException {
if (!(bit == 0 || bit == 1)) {
throw new IllegalArgumentException("argument must be 0 or 1");
}
// If the buffer has eight bits, need to flush it first.
if (numBits == 8) {
flushBits();
}
// Add th... | 3 |
public Rectangle getCurrentFrameRect() {
int x = 0, y = 0;
if (frameSize.height > 0 && frameSize.width > 0) {
y = ((int) currentFrame / fpl) * (frameSize.height + borderWidth);
x = ((int) currentFrame % fpl) * (frameSize.width + borderWidth);
}
return new Rectan... | 2 |
private boolean gebaeudeZerstoeren()
{
boolean erfolg = false;
int angreifererfolg = ermittleAngreiferErfolg();
if ( angreifererfolg == 0 )
{
erfolg = false;
}
else if ( angreifererfolg > 0 )
{
ArrayList<Land> laendereien = this.opfer.getLandListe();
int i = 0;
while ( i < laendereien.size... | 5 |
public void edit(Feed feed) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
feed = em.merge(feed);
em.getTransaction().commit();
} catch (Exception ex) {
... | 5 |
public static boolean isNumber(CharSequence s) {
boolean ret = true;
for (int i = 0; ret && i < s.length(); i++) {
Character c = s.charAt(i);
if (i == 0 && c == '-') continue;
if (!Character.isDigit(c)) ret = false;
}
return ret;
} | 5 |
public static final boolean containsWord(String container, String searchedWord, String seperatorChars) {
if (searchedWord == null)
return false;
int startIndex = container.indexOf(searchedWord);
if (startIndex == -1) {
return false;
}
if (startIndex == 0 || seperatorChars.indexOf(container.charAt(startI... | 6 |
public String cryptanalyseCle(IMessage clair, IMessage crypte) {
/*
* Mthode determinant d'abord la longueur de la cl, puis effectuant une cryptanalyse de
* type Cesar sur les "sous messages"
*/
try {
long d=new Date().getTime();
int l=this.longueurCleMin(clair, crypte,true);
String key="";
int... | 7 |
public static void main(String [] args) throws SQLException
{
ConnectionHandler C = new ConnectionHandler();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String userType = "";
String userID = "";
String userPwd = "";
LoginHandler L;
System.out.println("Hello, are you a manag... | 6 |
boolean match(String s) {
// expect whitespace after token?
boolean alone = s.endsWith(" ");
s = s.trim();
if (!text.startsWith(s)) { return false; }
if (alone && text.length() > s.length()) {
char n = text.charAt(s.length());
if (n != '#' && !Character.isWhitespace(n)) { return false; }
}
for(char ... | 6 |
public int placeMeeple(Player player, int xBoard, int yBoard, int xTile,
int yTile) {
// Don't allow a player to play on a 'null' tiletype.
if (gameBoard[yBoard][xBoard] == null
|| gameBoard[yBoard][xBoard].getTileType(xTile, yTile) == null) {
return 1;
}
// First we need to check the correctness of... | 7 |
private final int method642(int i, short i_305_, int i_306_) {
int i_307_ = Class10.anIntArray179[method637(i, i_306_)];
TextureDefinition class12
= ((AbstractToolkit) aHa_Sub1_5353).aD4579.getTexture(i_305_ & 0xffff, -6662);
int i_308_ = ((TextureDefinition) class12).aByte201 & 0xff;
if (i_308_ != 0) {
i... | 6 |
public static void WeekEleven() throws IOException
{
System.out.println("So what did Damon learn this week?");
boolean next = false;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (!next)
{
System.out.println("Knowledge: " + DamonStats.Knowledge);
System.out.prin... | 8 |
Client getClientByName(String name){
ArrayList < Client > tclients = new ArrayList < Client > ();
tclients.addAll(clients);
for (int i = 0; i < channels.size(); i++) {
ArrayList < Client > clients = channels.get(i).getUsers();
for (Client c: clients) {
if ... | 5 |
public int mostVisitedAction() {
int selected = -1;
double bestValue = -Double.MAX_VALUE;
boolean allEqual = true;
double first = -1;
for (int i=0; i<children.length; i++) {
if(children[i] != null)
{
if(first == -1)
fi... | 7 |
@EventHandler
public void handleFishCatchings(PlayerFishEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
Entity caught = event.getCaught();
if (user != null && caught instanceof Fish) {
Cuboid cuboid = Cuboid.getCuboid(player.getLoca... | 4 |
public void printer(double number) {
if ((number - Math.floor(number)) == 0) {
text.setText(String.valueOf((int)number));
} else {
text.setText(String.valueOf(number));
}
} | 1 |
@Override
public TokenStream tokenStream(String fieldName, Reader reader) {
// whitespace tokenizer
TokenStream result = new WhitespaceTokenizer(Version.LUCENE_36, reader);
// covert to lowercase
result = new LowerCaseFilter(Version.LUCENE_36, result);
// remove separators and strange characters
CharT... | 9 |
public void renderBlockFallingSand(Block block, World world, int i, int j, int k) {
float f = 0.5F;
float f1 = 1.0F;
float f2 = 0.8F;
float f3 = 0.6F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
float f4 = block.getBlockBright... | 6 |
public Boolean actualizar_marca(String marca, String marcaNuevo) {
Boolean est = false;
List DNList = new cDN().leer_por_marca(marca);
Transaction trns = null;
sesion = HibernateUtil.getSessionFactory().openSession();
try {
trns = sesion.beginTransaction();
... | 3 |
public static void main(String[] args) {
Scanner lea = new Scanner(System.in);
do{
System.out.println("Direccion: ");
String path = lea.next();
if(!path.equalsIgnoreCase("exit")){
System.out.println("Append? (s/n): ");
... | 5 |
public static Insert prepareInsert(Object t, String keyspace, String table,String w_cl) {
Insert insert = QueryBuilder.insertInto(keyspace, table);
Class<?> c = t.getClass();
try {
for (Field f : c.getDeclaredFields()) {
f.setAccessible(true);
if (f.... | 8 |
public void render(Screen screen){
if(dir==0){
if(walking){
animUp.setSpeed(50);
sprite=animUp.next();
}else {
sprite = Sprite.player_up;
animUp.resetAnim();
}
}
if(dir==1){
if(walking){
animRight.setSpeed(50);
sprite=animRight.next();
... | 8 |
public double[] standardizedPersonRanges(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedPersonRanges;
} | 2 |
public void countOffSetPerCurrentDay(){
for(int i = 0; i < x_length; i++){
for(int j = 0; j < y_length; j++){
int coins_per_neighbout = this.state_for_day[i][j]/COINS_DISTRIBUTED_PER_NUM;
int take_away_from_current_cell = 0;
if(numb... | 9 |
int[] merge(int[] arr){
int min=arr[1]-arr[0];
int index=0;
for(int i=0;i<arr.length;i+=2){
if(arr[i+1]-arr[i]<min){
min=arr[i+1]-arr[i];
index=i;
}
if(i+3<arr.length && arr[i+2]>arr[i] && arr[i+3]>arr[i+1]){
if(... | 9 |
public void tileInit()
{
//Stringville
for(int i=0; i<50; i++)
tile[167+i][495]=WATER;
for(int i=0; i<50; i++)
tile[167+i][496]=WATER;
for(int i = 0; i < 500; i++)
{
for(int j = 0; j <500; j++)
{
tile[i][j] = LOW_GRASS;
}
}
// tile[30][30] = 1;
// tile[11][490] = 1;
// tile[14][4... | 6 |
public void loadBoardConfig() throws BadConfigFormatException, FileNotFoundException {
// Create a file reader and wrap it in a scanner to read the file
FileReader boardConfigFile = new FileReader(boardConfigFilename);
Scanner fileScanner = new Scanner(boardConfigFile);
// Initialize variables
String[] cel... | 6 |
public String toString() {
return "Point - X: " + x + " Y: " + y;
} | 0 |
public Node add_1(Node a, Node b){
Node resHead = null;
Node resTail = null;
int carry = 0;
while(a != null && b != null){
int value = a.value + b.value + carry;
Node n = new Node(value%10);
if(resHead == null){
resHead = n;
resTail = n;
}
else{
resTail.next = n;
... | 9 |
public String getType(){
String returnString = "";
//supertype
if(!supertype.equals("")){
returnString = supertype + " ";
}
//types
for(int i = 0; i < type.size(); i++){
returnString += type.get(i) + " ";
}
//dash and subtypes
if(subtype.size() != 0){
returnString += "- ";
fo... | 4 |
public void testBindFunctions() throws Exception {
Bindings bindings = null;
bindings = parse("${ns:f0()}").bind(context.getFunctionMapper(), null);
assertSame(context.getFunctionMapper().resolveFunction("ns", "f0"), bindings.getFunction(0));
try { bindings.getFunction(1); fail(); } catch (Exception e) {}
... | 9 |
@Override
@SuppressWarnings("deprecation")
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DBRefBase dbRefBase = (DBRefBase) o;
if (_id != null ? !_id.equals(dbRefBase._id) : dbRefBase._id != n... | 7 |
public void update() {
if (chess.getTurn() % 2 == 0) {
turns.setText("Black turn");
} else {
turns.setText("White turn");
}
if (chess.getInfo() == 0) {
info.setText("");
}
if (chess.getInfo() == 1) {
... | 6 |
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... | 8 |
private static final int hexToInt(char c) throws ParseException {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('a' <= c && c <= 'f'){
return c - 'a' + 10;
} else if ('A' <= c && c <= 'F') {
return c - 'A' + 10;
} else {
throw new ParseException("None-hex character in un... | 6 |
public int specialAttack3() {
return skill3.attack(this.getAgility(), this.getLuck());
} | 0 |
protected void loadFilters() {
filterArray = new BufferedImageOp[1];
short[] straight = new short[256];
short[] subtracted = new short[256];
for (int i = 0; i < 256; i++) {
straight[i] = (short)i;
if (i > 8) {
subtracted[i] = (short)(i - 8... | 2 |
private void checkEnd() {
if (end) {
throw new IllegalStateException("Cannot call a visit method after visitEnd has been called");
}
} | 1 |
protected void load() throws MaltChainedException {
try {
final BufferedReader in = new BufferedReader(getGuide().getConfiguration().getConfigurationDir().getInputStreamReaderFromConfigFile(getModelName()+".dsm"));
final Pattern tabPattern = Pattern.compile("\t");
while(true) {
String line = in.readLine(... | 7 |
public boolean checkForObstruction(Location init, Location fin, Tile[][] obstructedBoard, Piece pieceToCheck)
{
//I'm thinking that I should take the locations, subtract the columns and rows from final and initial positions, then iterate over the differences
//Once I'm iterating over the differences, I check if th... | 9 |
public void loadFromReader(TSLReader reader) throws InvalidTSLException, IOException
{
clear();
if(reader.getState() != TSLReader.State.OBJECT)
{
throw new IllegalStateException("Current value is not a TSL Object");
}
while(true)
{
reader.moveNext();
switch(reader.getState(... | 5 |
public Account findAccount(String accountName, String clientId) throws XStoreException{
Account account = null;
logger.info("accountName - " + accountName);
logger.info("clientId - " + clientId);
try {
TypedQuery<Account> qry = em.createQuery("select A from Account A where A.client.clientName=:clientId and A... | 2 |
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... | 6 |
public void paint(Graphics g) {
//Background
g.setColor(background);
g.fillRect(0, 0, Run.window.getWidth(), Run.window.getHeight());
//
//Title
g.setFont(titleFont);
g.setColor(Color.white);
g.drawString(pauseTitleText, 50, 50);
//
//Buttons
g.setFont(buttonFont);
if (!hoveringResume)... | 3 |
public void revertCheck(Player player){
Block playerBlock = player.getLocation().getBlock();
Iterator<Block> iterator = revertMap.get(player).iterator();
while(iterator.hasNext()){
Block nextBlock = iterator.next();
int xCheck = abs(nextBlock.getX()) - abs(playerBlock.get... | 7 |
public static void runGame() {
GameController game = new GameController();
while (s2.team[0].isLebendig()) {
s1.team[0].attack(s2.team[0]);
//s2.team[0].attack(s1.team[0]);
for (int i = 0; i < s1.getAnzahl(); i++){
if (s1.team[i].isLebendig() == false){
s1.loesche(s1.team[i]);
}
}
... | 5 |
protected Point getBlockSnap() {
if (currentlyPlacing != null) {
int x = (gameController.getCurrentMousePosition().x
+ gameController.getMapOffsetX())
/ BlockManager.getBlockWidth()
* BlockManager.getBlockWidth();
int y = (gameC... | 2 |
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof PieDataset)) {
return false;
}
PieDataset that = (PieDataset) obj;
int count = getItemCount();
if (that.getItemCount() != count) {
return... | 8 |
public synchronized void monter(Festivalier fest) {
// le festivalier est-il dans une navette?
boolean in = false;
// tant qu'il n'y a pas de navette, le festivalier s'endort.
// une fois reveille, il essaie de monter dans une navette.
while (nNavettes == 0 || !in) {
try {
wait();
} catch (Exception... | 6 |
public void dumbDecelerate(double amount) {
if(x == 0.0) {
//do nothing
} else if(x > 0.0) {
if (x - amount > 0.0) {
x = x - amount;
} else {
x = 0.0;
}
} else {
if (x + amount < 0.0) {
x = x + amount;
} else {
x = 0.0;
}
}
if (y == 0.0) {
//do nothing
} else if(y... | 8 |
private void handleAndroidManifestFile(String apk, IManifestHandler handler) {
File apkF = new File(apk);
if (!apkF.exists())
throw new RuntimeException("file '" + apk + "' does not exist!");
boolean found = false;
try {
ZipFile archive = null;
try {
archive = new ZipFile(apkF);
Enumeration<?>... | 7 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.editdirection");
resaveParamsSaveDirection(request);
try {
Criteria criteria = new Criteria();
Direction direction =... | 6 |
private static void organize(File dir) {
File all = new File(dir, "z_all");
if(!all.exists()){
all.mkdir();
}
for (File temp : dir.listFiles()) {
if (temp.isDirectory() && !temp.getName().equals("z_all")) {
int index = 0;
for (File file : temp.listFiles()) {
if (!file.isDirectory()) {
i... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == jbtReset){
enablerListener.enableSortButton(false);
resetRadioButtons();
resetDataFields();
// clear text fields on stats panel
controller.getStatsPanel().clearTextFields();
// Clear sort panel tex... | 7 |
private void createDOMTree(){
Element rootEle = dom.createElement("table");
dom.appendChild(rootEle);
Element idsRoot = dom.createElement("vertexes");
rootEle.appendChild(idsRoot);
for (int i = 0; i < ids.size(); i++) {
Element vertex = dom.createEle... | 5 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(affected instanceof SailingShip)
{
final SailingShip I=(SailingShip)affected;
if(I.subjectToWearAndTear())
{
final PhysicalAgent currentVictim = I.getCombatant();
if(currentVictim ... | 9 |
private void copyArray(Object obj) {
if (obj instanceof ArrayList<?>) {
ArrayList<Value> value = new ArrayList<>();
@SuppressWarnings("unchecked")
ArrayList<Object> data = (ArrayList<Object>) obj;
for (Object o : data) {
value.add(new Value(o));
}
data_ = value;
} else {
ArrayList<Value> ... | 4 |
public void addGameListener(GameListener listener) {
listeners.add(listener);
} | 0 |
private static String fillString( String in, int len )
{
String out = new String(in);
while ( out.length() < len )
out = " " + out;
return(out);
} | 1 |
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.