text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void drawHealthBars(SpriteBatch sb){
Color tint = sb.getColor();
for(Entity e: healthBars.keySet()){
for(int i = 0; i < e.getMaxHealth(); i++){
if(i<=e.getHealth())
if(e.frozen)
sb.setColor(Color.CYAN);
else
sb.setColor(Color.RED);
else
sb.setColor(Color.GRAY);
sb.dr... | 4 |
public int getTotalTermCount(SQLconnection sqLconnection, int paperID) {
String query = "select totalcount from papertermcount where paperID="
+ paperID;
int count = 0;
ResultSet rs = sqLconnection.Query(query);
try {
rs.next();
count = rs.getInt("totalcount");
rs.close();
} catch (SQLException e... | 1 |
private static int DFS(TreeNode node) {
if (node.left == null && node.right == null) {
return 1;
}
if (node.left != null && node.right == null) {
return DFS(node.left) + 1;
}
if (node.left == null && node.right != null) {
return DFS(node.right) + 1;
}
return Math.min(DFS(node.left), DFS(node.rig... | 6 |
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g); // Paint background, border
//------------ Collision detection
//Check the pellets
roundCheck(1);//pellets single and doubleshots
//Rocket check
roundCheck(0);//0 is rockets
//check the takeover rockets
roundCheck(3);
//-----... | 8 |
public static void update() {
for(Keybind keybinds : Keybind.values()) {
keybinds.key.setHeld(keybinds.key.isPressed());
keybinds.key.update();
}
} | 1 |
@EventHandler
public void GhastWither(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.getZombieConfig().getDouble("Ghast.Wither.Dod... | 7 |
public String longestCommonPrefix(String[] strs) {
if(strs.length ==0)
return "";
if(strs.length ==1)
return strs[0];
for(int i =0;;i++){
for(int j=0;j< strs.length;j++){
if(i >= strs[j].length())
return strs[j].substring(0... | 6 |
@Override
public String toString() {
switch(this) {
case BIANCO: return "BIANCO";
case NERO: return "NERO";
case NULL: return "NULL";
default: throw new IllegalArgumentException();
}
} | 3 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
@Override
public int delete(Integer idMetier) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} | 0 |
public String toString() {
StringBuilder sb = new StringBuilder();
int c1 = 18;
int sc = 6;
// Print header
sb.append(String.format("%" + c1 + "s |", "Category"));
for (Player player : players) {
sb.append(String.format(" %-" + (sc * 3 + 4) + "s |", player.getName()));
}
sb.append... | 7 |
void init() {
addTypeConverter(String.class, Long.class, Long::valueOf);
addTypeConverter(String.class, Long.TYPE, Long::valueOf);
addTypeConverter(String.class, Integer.class, Integer::valueOf);
addTypeConverter(String.class, Integer.TYPE, Integer::valueOf);
addTypeConverter(String.class, Byte.class, Byte::v... | 2 |
public int roomChooser(){
list.clear();
for(int i=0; i<map.size(); i++){
int[] tmp = new int[6];
tmp = getValue(i);
if ((tmp[0]==1)&&(tmp[1]==1)){
list.add(i);
}
}
int l = list.size();
int m = (int)(Math.random()*l);
return list.get(m);
} | 3 |
public void addPeriod(Period per)
{
this.periods.add(per);
} | 0 |
@Override
public void run() {
long lastCycle = 0;
long systemTime;
while (isRunning()) {
systemTime = System.currentTimeMillis();
if ((systemTime - lastCycle) > cycleLength) {
if (getTasks().size() > 0) {
Iterator<ITask> it = getTasks().iterator();
while (it.hasNext()) {
if (!it.next()... | 7 |
private void drawPhysicsVariables() {
g2d.setTransform(identity);
g2d.setColor(Color.RED);
Ship s = DataController.getInstance().getPlayerShip();
double dX = (s.getDest()==null)?0:s.getDest().getX();
double dY = (s.getDest()==null)?0:s.getDest().getY();
String temp;
... | 5 |
public void transferResultToNextGen(NeighbourhoodMatrix nextgen,
PVector source, TemplateMatrix templateCopy) {
// transfer non-zero cells from rectified to correct target octant
Octant oct = new Octant(source.heading());
for(int col=0; col<3; col++)
for (int row=0; row<3; row++) {
PVector v = templateC... | 5 |
private static int booleanString(boolean b){
if(b){
return 1;
}
else{
return 0;
}
} | 1 |
private boolean light(int xa, int ya, int dir) {
List<Light> lights = level.getLights(x, y, dir);
if (lights.size() <= 0) return false;
Light light = lights.get(0);
if (light.intensity > 30) return false;
if (light.dir == 3) {
light.x--;
} else if (light.dir == 1) {
light.x++;
} else if (light.dir =... | 6 |
public void Add(Tick t) {
synchronized(ticks) {
if (!ticks.contains(t))
ticks.add(t);
}
} | 1 |
public static List<Laureate> filterByPrizeYearRange(
List<Laureate> inputList, String startYear, String endYear) {
List<Laureate> outputList = new ArrayList<Laureate>();
int sYear = Integer.getInteger(startYear);
int eYear = Integer.getInteger(endYear);
// parse input, kee... | 4 |
public Place getPlaceInDirection(Place currentPlace, String direction)
{
int x = currentPlace.getLocation().getX();
int y = currentPlace.getLocation().getY();
if (direction.equals("East") && x + 1 < myLength)
return myPlaceGrid[x + 1][y];
else if (direction.equals("South") && y + 1 < myWidth)
return m... | 8 |
public synchronized boolean isBeenPlayed() {
boolean result = !(game == null) && !game.hasStarted()
|| isWaitingForUsers;
if (playerCount == 0) {
result = false;
game = null;
}
return result;
} | 3 |
@RequestMapping(value = {"/MovimientoBancario/{idMovimientoBancario}"}, method = RequestMethod.GET)
public void read(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idMovimientoBancario") int idMovimientoBancario) {
try {
ObjectMapper jackson = new ObjectM... | 2 |
@Override
public Clock deepCopy() {
LogicClock newClock = new LogicClock();
newClock.clock = this.clock;
return newClock;
} | 0 |
public void log(String str) {
FileWriter fw = null;
try {
fw = new FileWriter(this.logFile, true);
String date = new Date().toString();
fw.write(date + " : " + str);
fw.write(LINE_SEPARATOR);
} catch (IOException e) {
System.err.println("Couldn't log this : " + str);
} finally {
if (fw != null... | 3 |
public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... | 7 |
private int getDeciSeconds() {
if (last == null || !last.hasNext()) {
// less than min, but more than the half
int half = (Math.round(MIN_SECONDS / 2) - 1) * 10;
return (new Random()).nextInt(half) + half;
} else {
int sec = last.getSeconds();
if ((new Random()).nextBoolean()) {
return (sec * ... | 3 |
protected static String pwdElaborate( String p ){
String[] words;
String answer;
int numLenght = 10;
if ( p.equals( "-an" ) ) {
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
numLenght = 62;
} else if ( p.equals... | 9 |
public boolean doTransformations() {
StructuredBlock last = flowBlock.lastModified;
return (!isEntered && CompleteSynchronized.enter(this, last))
|| (isEntered && object == null && CompleteSynchronized
.combineObject(this, last));
} | 4 |
public String getId() {
return id;
} | 0 |
@Override
public NormalLikeDistribution[] getOrderDistributions(double mean, double sd) {
double[] divisors = new double[numberOfOrderPeriods];
double sum = 0;
for (int i = 0; i < numberOfOrderPeriods;i++){
divisors[i] = i+1;
sum += i+1;
}
RealSinglePointDistribution emptyOrder = new Real... | 3 |
public boolean isInString(String string, String s) {
int stringLength = string.length();
int lowestCount = d;
for (int i = 0; i < stringLength - this.k + 1; i++) {
String compare = string.substring(i, i + this.k);
int count = 0;
for (int j = 0; j < this.k; j+... | 4 |
public void gravarTurmasDeDisciplinasEmArquivo(String nomeArquivo)
throws IOException {
BufferedWriter gravador = null;
try {
gravador = new BufferedWriter(new FileWriter(nomeArquivo));
for (Disciplina disciplina : this.disciplina) {
gravador.write(disciplina.getCodigo() + "\n");
gravador.write(dis... | 3 |
public void setSelected(int selected) {
this.selected = selected;
if (selected >= 0) {
sel.setText(Integer.toString(selected));
} else {
sel.setText("");
}
sel.revalidate();
} | 1 |
public static boolean isGetter(Method method)
{
if(!method.getName().startsWith("get")) return false;
if(method.getParameterTypes().length != 0) return false;
if(void.class.equals(method.getReturnType())) return false;
return true;
} | 3 |
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
final Player player = event.getPlayer();
if (player.getName().equalsIgnoreCase("jacklin213") || player.hasPermission("linbot.access")) {
String msg = event.getMessage();
String[] words = msg.split(" ");
if (words[0].startsWith("!")) {
fina... | 8 |
final public String selectexpr() throws ParseException {
/*@bgen(jjtree) SEL */
SimpleNode jjtn000 = new SimpleNode(JJTSEL);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t; String s; String sel = "";
try {
t = jj_consume_token(SELECT);
sel += t.image.toString();
s =... | 9 |
protected boolean sendAck(int tag,boolean status,int gridletId,int destId)
{
boolean success = false;
switch (tag)
{
case GridSimTags.GRIDLET_PAUSE_ACK:
case GridSimTags.GRIDLET_RESUME_ACK:
case GridSimTags.GRIDLET_SUBMIT_ACK:
int[] array ... | 4 |
public void shuttleSort(boolean printpasses) {
for (int pass = 1; pass < elements.length; pass++) {
for (int i = pass; i > 0; i--) {
T current = elements[i];
T other = elements[i - 1];
int compResult = current.compareTo(other);
if (comp... | 5 |
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("version_check")) {
int value = (Integer) evt.getNewValue();
if (value == RESULT_UP_TO_DATE) {
setVisible(false);
Application.window = new BotWindow();
Application.window.init(true);
System.out.prin... | 4 |
public boolean isAdmin(String forumId, User user) {
for (int i = 0; i < forums.size(); i++) {
if (forums.get(i).getId().equals(forumId))
return forums.get(i).isAdmin(user);
}
return false;
} | 2 |
/*package protected */boolean fireDockableStateWillChange(DockableStateWillChangeEvent e) {
DockingDesktop desk = e.getFutureState().getDesktop();
if(desk.getMaximizedDockable() != null) {
// veto events coming from autohide and floating components if a component is maximized
// @todo : this could be improv... | 7 |
private boolean jj_3_8() {
if (jj_3R_26()) return true;
return false;
} | 1 |
@Override
public void validate() {
Graphics g = getGraphics();
final FontMetrics fontMetrics = g.getFontMetrics();
String[] allLines = content.split("\n");
int allLinesN = allLines.length;
int nLines = 0;
int h = 0;
for (int i = 0; i < allLinesN; ++i) {
... | 5 |
public void expand(double factor) {
if(factor < this.min) {
this.min = factor;
}
if(factor > this.max) {
this.max = factor;
}
} | 2 |
@Test
public void testLoadFromCacheSuccessOnCustomPage() {
AbstractPage p = AbstractPage.bakeAPage(null,"http://noctura.bandcamp.com/album/demos", null, null);
assertEquals(true, p.loadFromCache());
assertEquals("Demos", p.getTitle());
assertEquals(7, p.childPages.size());
boolean found = false;
for (Abstr... | 2 |
public void initialize()
{
if (GameApplet.thisApplet != null)
{
Enumeration localEnumeration = getEnvironment().getObjects().elements();
while (localEnumeration.hasMoreElements())
{
Object localObject = localEnumeration.nextElement();
if (!(localObject instanceof Cannon))
... | 3 |
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Counting words");
int n = scan.nextInt();
String[] wordsStr = new String[n];
for(int i=0; i<n; i++)
{
wordsStr[i] = scan.next();
}
Arrays.sort(wordsStr);
for(int i=0; i<n; i++)
{
System.... | 2 |
@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
public void onQuit(PlayerQuitEvent event) throws IOException {
Player player = event.getPlayer();
if (DataBase.isInCombat(player)) {
long end = DataBase.getEndingTime(player);
if (!Clock.isEnded(end)) {
if (player.getGameMode() != GameMo... | 6 |
static private int jjMoveStringLiteralDfa14_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(12, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(13, active0);
return 14;
}
switch(curChar)
{
... | 3 |
public boolean isRelationalOp() {
return val.equals(LT) ||
val.equals(LE) ||
val.equals(EQ) ||
val.equals(NE) ||
val.equals(GT) ||
val.equals(GE);
} | 5 |
public boolean Check(ArrayList<Integer> slv){
HashSet<Integer> tmp = new HashSet();
for (int i : slv){
tmp.addAll(sets.get(i));
}
return nodes.equals(tmp);
} | 1 |
public static String getSystemTmpDirectory () {
if (systemTmpDir != null) {
return (systemTmpDir);
}
String dir = getProperty("java.io.tmpdir");
if (dir == null) {
dir = getProperty("TMP");
}
if (dir == null) {
dir = getProperty("TEMP");
}
if (dir == null) {
dir = getProperty("TMPDIR");
... | 9 |
public long getNumberOfSamples() {
if (this.isMpeg) {
// audioInputStream.getFrameLength() returns -1 for MP3s
// thus another method is needed:
// the following WORKAROUND will approximate the number of samples only
// - usually it is SMALLER!
return... | 1 |
public static void main(String[] args) {
// TODO Auto-generated method stub
boolean vorhanden = false;
Person[] personen = new Person[0];
do {
String nachname = Tastatur.inputString("Nachname: ");
String vorname = Tastatur.inputString("Vorname: ");
String geschlecht = Tastatur.inputString("Geschlecht ... | 5 |
protected long getNextCallId() {
final ReentrantLock l = lock;
l.lock();
try {
if (++prevCallId > Long.MAX_VALUE) {
prevCallId = Long.MIN_VALUE;
}
return prevCallId;
}
finally {
l.unlock();
}
} | 1 |
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int result = 0;
int n = in.nextInt();
int k = in.nextInt();
List<Integer> n_table = new ArrayList<Integer>();
for (int i = 0 ; i < n ; ... | 5 |
private final void checkSliderPosition()
{
if (isVertical)
{
if (slider.getYD() < y + scrollBarThickness)
slider.setY(y + scrollBarThickness);
else if (slider.getYD() + slider.getHeightD() > y + height - scrollBarThickness)
slider.setY(y + height - slider.getHeightD() - scrollBarTh... | 6 |
private void btnReplaceItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnReplaceItemActionPerformed
{//GEN-HEADEREND:event_btnReplaceItemActionPerformed
if (!archive.fileExists(selectedPath))
throw new UnsupportedOperationException("oops, bug");
JFileChoose... | 4 |
private void cargarSetPrueba(){
DefaultTableModel temp = (DefaultTableModel) this.tablaSetPruebas.getModel();
String csvFile = "dataset/diabetes_prueba.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
double maximo0 = normalizacion.obtenerMaximo(0, csvFile);
doubl... | 9 |
public static void takeTurn(int turn) {
int food = AntColony.node[13][13].food;
// The queen eats one unit of food in node 13,13 per turn
if (food == 0)
AntColony.endSim = true;
else
AntColony.node[13][13].setFoodAmount(food - 1);
// The queen hatches a new ant once per day (every ten turns)
i... | 4 |
public Matrix minus(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(M, N);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
C.data[i][j] = A.data[i][j] - B.data[i... | 4 |
public static String[] dealString(String str){
String[] s = str.split(":");
//s[0]
s[0] = s[0].trim();
int first = s[0].indexOf(" ");
int last = s[0].lastIndexOf(" ");
//ոֵλòͬ
if(first<last){
String[] subStr = s[0].split(" ");
StringBuffer sb = new StringBuffer();
sb.append(subStr[0]);
for(in... | 7 |
public static BufferedImage crop(BufferedImage image)
{
int width = image.getWidth(),
height = image.getHeight(),
minX = width,
maxX = 0,
minY = height,
maxY = 0;
for( int x = 0; x < width; x++)
for( int y = 0; y < height; y++ ) {
if( (image.getRGB(x, y) & 0x00FFFFFF) != 0 ) {
i... | 9 |
public State getStateForVariable(String variable,
VariableDependencyGraph graph) {
State[] states = graph.getStates();
for (int k = 0; k < states.length; k++) {
if (states[k].getName().equals(variable))
return states[k];
}
return null;
} | 2 |
public static void validateNumericTypes(Number number1, Number number2) {
if ((number1 instanceof Integer) && (number2 instanceof Integer)) {
return;
}
if ((number1 instanceof Long) && (number2 instanceof Long)) {
return;
}
if ((number1 instanceof Double) ... | 6 |
@Test
public void findDuplicateTypeHand_whenFourJacks_returnsFourOfaKind() {
Hand hand = findDuplicateTypeHand(quadsJacksWithTenKicker());
assertEquals(HandRank.FourOfAKind, hand.handRank);
assertEquals(Rank.Jack, hand.ranks.get(0));
assertEquals(Rank.Ten, hand.ranks.get(1));
} | 0 |
private void populateElements() {
JPanel content = (JPanel) this.getContentPane();
content.setLayout(new GridBagLayout());
content.setBorder(new EmptyBorder(10, 5, 6, 5));
GridBagConstraints c;
int x = 0, y = 0;
c = new GridBagConstraints();
c.insets = new Insets(0, 7, 0, 0);
c.weightx = 0;
c.gridx... | 9 |
public Memorable next(Memorable previous){
Memorable last = future.remove(0);
future.add(null);
if(last!=null){
int d=last.lastSucceed();
for(int i=d-1;i<future.size();i++){
if(future.get(i)==null){
if(i-1>0 && future.get(i-1)==last){
... | 8 |
public void testWithFieldAdded3() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
try {
test.withFieldAdded(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... | 7 |
public String getTooltipExtraText(final Province current) {
final int id = current.getId();
if (!editor.Main.map.isLand(id))
return "";
final String rel = Text.getText(mapPanel.getModel().getHistString(id, "religion"));
if (rel.length() == 0)
return "";
... | 6 |
public static boolean isExponent(int c) {
return c == 'e' || c == 'E';
} | 1 |
final public void subArea(ParseArea area) throws ParseException {
ParseSubArea subArea = new ParseSubArea();
jj_consume_token(SUBAREA);
jj_consume_token(56);
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ATYPE:
case IDENT:
;
break;
default:... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public void render(GameContainer gc, StateBasedGame sb, Graphics gr) {
int invx = 1000;
int invy = 200;
if(draw){
invbg.draw(invx, invy);
PlayerInventory plinv = ((Player)this.owner).getPD().getInv();
if(plinv.getEqweapon() != null){
plinv.getEqweapon().getIcon().draw(invx + 4, invy + 2);
}
if(... | 3 |
@Override
public List<Autor> listAll() {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Autor> autores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST);
... | 3 |
private void sendToNeighbours(Byte[] data) {
try {
lock.lock();
TreeSet<Byte> neighbours = networkTreeMap.get(deviceID);
if(neighbours != null){
for(Byte nb : neighbours) {
send(nb, data);
// System.out.println("Sending to neighbour: " + nb);
}
}
} catch (CallbackException e) {
e... | 3 |
public String getClassName()
{
if ( kind == FragKind.aligned || kind == FragKind.merged )
return style;
else if ( style != null )
return "inserted-"+style;
else
return "inserted";
} | 3 |
@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 |
@Override
public int[] sort(int[] target, boolean asc) {
int length = 0;
if (asc) {
for (int data : target) {
length++;
for (int i = 0; i < length; i++) {
if (data < target[i]) {
int headOfMoving = target[i];
target[i] = data;
int tmp;
for (++i; i < length; i++) {
... | 9 |
public Boolean tileMatchesAvailable(){
/*
for (int i = 0; i < getX(); i++) {
for (int u = 0; u < getY(); u++) {
if (cells[i][u]!= 0) {
for (int direction = 0; direction < 4; direction++) {
int [] vector = getVector(direction);
int other = cells[i+vector[... | 4 |
private void saveContact() throws SQLException {
// TODO: When adding new and editing given contacts, check for doubles in the database. Give them visible IDs to make the difference when contacts really have the same names.
if (checkFieldsForSaving()) {
clsContactsDetails mContactD... | 5 |
private void getData_with_index(ByteBuffer buf, final int index, OnDataListener dataListener) throws SQLException {
int offset = index;
final int idx[] = new int[6];
getIndex(buf, offset * 10, idx);
int wordid = -1;
if ((idx[3] == 0) && ((idx[5] - idx[1]) > 0)) {
//word
wordid = dataListener.... | 8 |
edge moveUpRight()
{
edge f = this;
while ((null != f) && ( f.tail.leftEdge != f))
f = f.tail.parentEdge;
//go up the tree until f is a leftEdge
if ( null == f )
return f; //triggered at end of search
else
return(f.tail.rightEdge);
//and then go right
} | 3 |
public void run() {
LevelLoader loader = new LevelLoader(this, "arena.svg");
loader.loadObjects();
addPhysicsObjects();
while (true) {
lastFrame = System.currentTimeMillis();
try {
Thread.sleep(SLEEP_TIME);
} catch (InterruptedException e) {
System.err.println("Failed to sleep in Model loop. ... | 6 |
public void choice(int selection, GameGrid grid) {
switch (selection) {
case 1:
setGridSize(grid);
break;
case 2:
setAlivecells(grid);
break;
case 3:
setRandomCellsAlive(grid);
break;
case 4:
getCurrentSetup(grid);
break;
case 5:
startGame();
break;
case 6:
endGame();... | 6 |
public List<User> getFollowers(String userEmail)
{
initConnection();
List<User> followerList = new ArrayList<User>();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement - Get users that are following currently logged-in user ("Followers")
preparedStrin... | 3 |
private void initMessage() throws InvalidDataException {
if( code == CloseFrame.NOCODE ) {
reason = Charsetfunctions.stringUtf8( super.getPayloadData() );
} else {
ByteBuffer b = super.getPayloadData();
int mark = b.position();// because stringUtf8 also creates a mark
try {
b.position( b.position() ... | 2 |
public Map<String, UUID> call() throws Exception {
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
int requests = (int) Math.ceil(names.size() / PROFILES_PER_REQUEST);
for (int i = 0; i < requests; i++) {
HttpURLConnection connection = createConnection();
String ... | 4 |
mainWindow(){
int i,j,r;
JButton titleScreen=new JButton(new ImageIcon(getClass().getResource("TitleScreen.jpg")));
this.ventana.setSize(700, 485);
panel.setLayout(null);
titleScreen.setBounds(0, 0, 700, 485);
panel.add(titleScreen);
titleScreen.addActionListener(this);
this.ventana.getContentPane().add... | 5 |
public void driver() {
System.out.println("audo drive");
} | 0 |
public void run() throws IOException {
System.out.println("started processing " + dirName);
//all transcripts from ensembl, sorted
getAllTranscripts();
Collections.sort(allTranscr);
trSize = allTranscr.size(); //number of transcripts
//all files to use
ArrayList... | 2 |
public Tea() {
this.setName("Coffee");
this.setPrice(new BigDecimal(15));
} | 0 |
public People(int peopleCount) {
people = new Person[peopleCount];
viruses = new Viruses();
for (int i = 0; i < peopleCount; i++) {
int x = 0, y = 0;
boolean keepGoing = true;
while (keepGoing) {
x = getRandomInRange(0, GamePanel.WIDTH - Person.RADIUS*2);
y = getRandomInRange(0, GamePanel.HEIGHT ... | 4 |
private static int addValue(String line, PriorityQueue<Integer> lowestH, PriorityQueue<Integer> highestH) {
int val = Integer.parseInt(line);
long mid = highestH.isEmpty() ? Long.MIN_VALUE : highestH.peek();
// add
if( val > mid)
highestH.add(val);
else
lo... | 5 |
@Override
public boolean handle(Request r, Response resp) {
String templatePath = Profile.getInstance().getTemplatePathFor(r, TEMPLATE_NAME);
// load the template
Templator tr = new Templator();
Template t;
try {
t = tr.newTemplate(templatePath);
} catch (FileNotFoundException e) {
resp.setBody... | 7 |
public void setLivingAnimations(EntityLiving var1, float var2, float var3, float var4) {
EntityWolf var5 = (EntityWolf)var1;
if(var5.isWolfAngry()) {
this.wolfTail.rotateAngleY = 0.0F;
} else {
this.wolfTail.rotateAngleY = MathHelper.cos(var2 * 0.6662F) * 1.4F * var3;
}
... | 3 |
private StockStorage() {
try {
File fXmlFile = new File(fileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(fXmlFile);
doc.getDocumentElemen... | 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.