text stringlengths 14 410k | label int32 0 9 |
|---|---|
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 void handle(HttpExchange exchange) throws IOException {
System.out.println("In soldier handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
exchange.getResponseHeaders().set("Content-Type", "appliction/json");
try {
//TODO verif... | 5 |
public void open() throws IOException
{
try
{
CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier(comm);
CommPort p = pid.open(this.getClass().getName(), 2000); //timeout of 2 milliseconds
if (p instanceof SerialPort)
{
port = (SerialPort)p;
//set up the port
port.setSeri... | 7 |
public String getName() {
return name;
} | 0 |
public void changeTache(PrintWriter out, String [] choix){
try{
if((choix[2].equals("libre")||choix[2].equals("affectée")||choix[2].equals("réalisée")) && taches.containsKey(Integer.parseInt(choix[1]))){
taches.get(Integer.parseInt(choix[1])).setStatus(choix[2]);
out.println("OK");
out.flush();
}els... | 5 |
private String getRead( String variable ) {
StringBuilder sb = new StringBuilder();
if ( countRead == 0 ) {
sb.append( "\n" + TAB + TAB + TAB + variable + " readRecord = " + toJavaCase( variable ) + "Dao.read( ");
sb.append( param + " );\n" );
sb.append( TAB + TAB + ... | 3 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attrs)
throws SAXException {
if (qName.equals("result"))
callList = new CallList();
if (qName.equals("rowset")) {
String name = attrs.getValue("name");
if (name.equals("callGroups")) {
callGroups = true;
} ... | 7 |
public void specialAttack() {
skill1.attack(this.getAgility(), this.getLuck());
} | 0 |
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteract (PlayerInteractEvent event) {
Player player = event.getPlayer();
Location playerLoc = player.getLocation();
if (event.getAction().equals(Action.RIGHT_CLICK_AIR) || event.getAction().equals(Action.LEFT_CLICK_AIR) || eve... | 5 |
public static void main(String[] args)
{
Scanner meinScanner = new Scanner(System.in);
int meineZahl = meinScanner.nextInt();
switch(meineZahl)
{
case 1:
System.out.println("ist 1");
break;
case 2:
System.out.println("ist 2");
break;
case 3:
System.out.println("ist 3");
break;
defa... | 6 |
CesheSkypeStatusRequester(SkypeStatusRequester sreq) throws IOException {
file = new File("File.txt");
if (!file.exists()) {
file.createNewFile();
System.out.println("New file File.txt has been created in the current directory");
}
sk = sreq;
} | 1 |
public void tick(LinkedList<GameObject> object) {
x += velocityX;
y += velocityY;
if (jumping || falling){
velocityY += gravity;
if (velocityY>MAX_SPEED)
velocityY = MAX_SPEED;
}
collision(object);
} | 3 |
public void setLocal(String local) {
if(local.length() < 65) {
try {
isValidLocal(local);
this.local = local;
} catch(Exception e) {
System.out.println(e.getMessage());
System.out.println("Local not set.");
}
}
else
System.out.println("Local part length must be less than 65 characters"... | 2 |
@Override
public void run()
{
while (!close)
{
SocketChannel socket = null;
try
{
socket = this.socket.accept();
socket.socket().setTcpNoDelay(true);
socket.configureBlocking(true);
socket.socket().setKeepAlive(true);
socket.socket().setSoTimeout(WAIT_SOTIMEOUT);
//get I... | 8 |
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Library library = new Library();
JSONObject patronJSON = new JSONObject();
int cardNumber = 0;
try {
cardNumber = Integer.parseInt(
request.getParameter("cardNumber"));
} catch ... | 5 |
final private boolean jj_3R_117() {
if (jj_scan_token(SWITCH)) return true;
if (jj_scan_token(LPAREN)) return true;
if (jj_3R_40()) return true;
if (jj_scan_token(RPAREN)) return true;
if (jj_scan_token(LBRACE)) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_1... | 8 |
private void jouerUnCoup(Joueur unJoueur) throws Exception
{
Position positionDesiree = unJoueur.obtenirPositionProposee();
Case laCaseOuPoserLePion = this.plateau.obtenirCase(positionDesiree);
Couleur couleurDuJoueur = unJoueur.obtenirCouleur();
if (positionJouable(couleurDuJoueur, positionDesiree))
{
... | 1 |
private static void startHttpServer(String s, String s1)
{
Class class1;
try
{
class1 = Class.forName(s);
}
catch(ClassNotFoundException classnotfoundexception)
{
throw new UserError("Could not find http server \"" + s + "\".");
}
... | 6 |
private int minValue(int[][] grid, int depth, int alpha, int beta)
{
//check if the board is in a terminal (winning) state and
//return the maximum or minimum utility value (255 - depth or
//0 + depth) if the max player or min player is winning.
int winner = checkForWinner(grid);
if ( winner != GV.PLAYER_E... | 8 |
private boolean isGameMotivatedMove(Location from, Location to){
return (from.equals(Location.R_BEAR_OFF) ||
from.equals(Location.B_BEAR_OFF) ||
to.equals(Location.B_BAR) ||
to.equals(Location.R_BAR))
&& (isMove(from,to));
} | 4 |
public String toString(){
String result = "";
for (int i = 0; i < grid.length; i++){
for (int j = 0; j < grid.length; j++){
if(visited[i][j] == RoomState.HIDDEN)
result += RoomState.HIDDEN.getValue() + " ";
else
result += grid[i][j].getValue() + " ";
}
result = result.trim() + "\n... | 3 |
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
AffineTransform old = g2d.getTransform();
g2d.drawImage(backGround, 0, 0, null);
g2d.translate(64 + p.getPosX(), 64 + p.getPosY());
g2d.rotate(-p.getAngle());
g2d.drawImage(p.getPlayerImage(), -64, -64, null);
g2d.setTransform(old);
g2d... | 5 |
protected HttpResponse execute(HttpRequestBase method) {
try {
method.setHeader(new BasicHeader("Accept", "application/json"));
method.setHeader("Content-Type", "application/json; charset=UTF-8");
HttpResponse rsp = getHttpClient().execute(method);
checkResponse(... | 2 |
public void copySummaries(String base){
File F = new File(base);
for(File filter : F.listFiles())
{
if(filter.isDirectory())
{
String filterName = filter.getName();
System.out.println(filterName);
for(File threshold : filter... | 7 |
public double getMeleeAttack() {
double level = c.playerLevel[0];
double levelMultiplier = 1.00;
if (c.prayerActive[2])
levelMultiplier *= 1.05;
else if (c.prayerActive[7])
levelMultiplier *= 1.1;
else if (c.prayerActive[15])
levelMultiplier *= 1.15;
els... | 7 |
public Instrument1 next() {
switch(rand.nextInt(7)) {
default:
case 0: return new Wind1();
case 1: return new Percussion1();
case 2: return new Stringed1();
case 3: return new Keyboard();
case 4: return new Brass1();
case 5: return new WoodWind1();
case 6: return new Piano();
}
} | 7 |
private NoteIndex translatePointToNoteIndex(Point point) {
// centreer de punten
int rx = point.x - this.getWidth()/2;
int ry = point.y - this.getHeight()/2;
int rr = (int)Math.sqrt(rx*rx+ry*ry);
double radr = Math.atan(((double)ry)/((double)rx));
if(rx < 0 && ry >= 0) {
radr += Math.PI;
}
else if(r... | 8 |
public static boolean isSelXmlNode(Element elem)
{
NodeList childrens = elem.getElementsByTagName(XmlFunction.ATTRIBUTESGRP);
if ((elem.getNodeName().equals(XmlFunction.ATTRIBUTESGRP) ||
elem.getNodeName().equals(XmlFunction.ATTRIBUTES)) &&
childrens.getLength() > 1 &&
elem.getAttribute(XmlFunction.CON... | 4 |
public final WaiprParser.triggers_return triggers() throws RecognitionException {
WaiprParser.triggers_return retval = new WaiprParser.triggers_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal40=null;
Token char_literal42=null;
ParserRuleReturnScope trigger39 =null;
Par... | 8 |
@Override
public boolean doMove() {
int startSteps = curGb.stepCount;
prepareMovement();
while(true) {
if(!check) {
curGb.step(dir); // walk
break;
} else {
State s = curGb.newState();
int add = Util.runToAddressNoLimit(0, dir, curGb.pokemon.walkSuccessAddress, curGb.pokemon.walkFailAddr... | 6 |
@Override
public void close() throws IOException{
cb.close();
super.close();
} | 0 |
public ArrayList<String[]> solveNQueensNew(int n) {
// Start typing your Java solution below
// DO NOT write main() function
int[] res = new int[n];
ArrayList<String[]> resArr = new ArrayList<String[]>();
Arrays.fill(res, -1);
int i = 0, j = 0;
while (i >= 0) { // the ith row
for (j = res[i] + 1; j < n... | 5 |
public int next()
{
return (int)(-scale*Math.log(rnd.nextDouble())*((double)mean));
} | 0 |
public HashMap<Integer, Integer> getCreateItemRequirements() {
if (clientScriptData == null)
return null;
HashMap<Integer, Integer> items = new HashMap<Integer, Integer>();
int requiredId = -1;
int requiredAmount = -1;
for (int key : clientScriptData.keySet()) {
Object value = clientScriptData.get(key);... | 8 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
BotManager frame = new BotManager();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
public int ermittleSabotageAnteil()
{
int angreifersoldaten = this.getSoldateneinsatz();
int opfersoldaten = this.opfer.getSoldaten();
int sabotageAnteil = 0;
if ( opfersoldaten == 0 )
{
sabotageAnteil = 100;
}
else if ( opfersoldaten != 0 )
{
sabotageAnteil = (int) ( angreifersoldaten / opferso... | 4 |
@Override
public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus ) {
Component res = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
if( res instanceof JLabel ) {
synchronized( re... | 5 |
@Override
public void mouseClick(int X, int Y) {
for(int i = 0; i < this.Matrix.size(); i++)
{
if(this.Matrix.get(i).contains(X,Y))
{
this.SelectedCellIndex = i;
break;
}
}
if(this.getMouseListener() != null)
... | 3 |
public Vector2D getAim() {
switch(aim) {
case UP: return new Vector2D(0,-1);
case DOWN: return new Vector2D(0,1);
case LEFT: return new Vector2D(-1,0);
case RIGHT: return new Vector2D(1,0);
case UP_LEFT: return new Vector2D(-1,-1);
case UP_... | 8 |
@Test
public void itShouldDeserializeAPointWithAltitude() throws Exception
{
GeoJsonObject value = mapper.fromJson("{\"coordinates\":[100.0,5.0,123],\"type\":\"Point\"}", GeoJsonObject.class);
Point point = (Point)value;
assertLngLatAlt(100, 5, 123, point.getCoordinates());
} | 0 |
public static boolean chkBox(char[][] arr,int x,int y){
boolean res = true;
Set<Character> set = new HashSet<>();
for(int i=x;i<x+3;i++){
for(int j=y;j<y+3;j++){
if(arr[i][j]!='.')
if(set.contains(arr[i][j])){
res = false;
break;
}else{
set.add(arr[i][j]);
}
}
if(!res)
... | 5 |
@Override
public void caseADeclEscrevaDefinicaoComando(ADeclEscrevaDefinicaoComando node)
{
inADeclEscrevaDefinicaoComando(node);
if(node.getPontoVirgula() != null)
{
node.getPontoVirgula().apply(this);
}
if(node.getRPar() != null)
{
node.g... | 6 |
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 |
public String toString() {
return (parent == null) ? "base package" : getFullName();
} | 1 |
private void jButtonNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNewActionPerformed
//Récupération de la méthode contrôleur 'nouveauRapport'
ctrlCR.nouveauRapport();
}//GEN-LAST:event_jButtonNewActionPerformed | 0 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Email other = (Email) obj;
if (this.id != other.id) {
return false;
}
if (!Ob... | 4 |
public void run() {
try {
int size = this.Destructed.size();
synchronized (this) {
//fix for new launcher
if (size == 0) {
wait();
size = this.Destructed.size();
}
for(int i = 0; i < size; i++) {
((Thread) this.Destructed.get(i)).start();
if (i == size-1) {
wait();
... | 4 |
public static Options load()
{
Options o = new Options();
try
{
File f = new File(Main.loc + "Options.cfg");
DataFile dF = new DataFile();
FileInputStream stream = new FileInputStream((new StringBuilder()).append(f.getAbsolutePath()).toString());
dF.load(stream);
stream.close();
o.mSounds = Bo... | 1 |
public float getSize(){
if(age >1.0f && super.gender)
return 1.1f;
else if(age >1.0f && !super.gender)
return 1.4f;
else{
if(super.gender)
return age + 0.1f;
else
return age + 0.4f;
}
} | 5 |
public static Grammar getTerminalGrammar(Grammar grammar) {
Grammar g = new ContextFreeGrammar();
Set terminalVars = getCompleteUsefulVariableSet(grammar);
Production[] prods = grammar.getProductions();
for (int i = 0; i < prods.length; i++) {
Set v = new HashSet(Arrays.asList(prods[i].getVariables()));
v... | 2 |
void explode(int damage){
int baseDamage = (int)Math.round(damage + 0.2*turnsLeft*damage);
int aoeDamage = (int)Math.round(10 + 0.2*turnsLeft*10);
position.damageTile(baseDamage, dealingPlayer);
if(position.up != null) position.up.damageTile(aoeDamage, dealingPlayer);
if(position.down != null) position.down.damage... | 6 |
public void setCode(String code) {
this.code = code;
} | 0 |
public boolean execute()
{
BufferedReader in = null;
if (filename != null) {
try {
in = new BufferedReader(new FileReader(filename));
} catch (FileNotFoundException e) {
throw new IllegalParameterException(prefix + "." + PAR_FILE, filename
+ " does not exist");
}
} else {
in = new BufferedReader( ... | 9 |
private static boolean areLeftRightEmpty(CatCage leftCage, CatCage rightCage)
{
return (leftCage.getTopCell() == null && leftCage.getRightCell() == null && leftCage.getBottomCell() == null && leftCage.getLeftCell() == null) && (rightCage.getTopCell() == null && rightCage.getRightCell() == null && rightCage.getBottom... | 7 |
private void heapDown(char[] str, int end)
{
int parent=0;
while (parent<end){
int leftChild=2*parent+1;
int rightChild=leftChild+1;
if (leftChild==end){ //Only Left Child exists
if (heapData[parent] < heapData[leftChild])
{
swap(parent,leftChild);
parent=leftChild;
}
else{break;... | 8 |
private void progressiveRun() {
final Thread current = Thread.currentThread();
//if(animated) DjVuOptions.err.println("bcr progressiveRun "+this);
GRect lastFullRect = null;
boolean repeat;
do {
final boolean decoding = page.isDecoding();
repeat = decodin... | 9 |
public float[] getOutput() {
float[] output = new float[outputNs];
for (int i = 0; i < outputNs; i++) {
output[i] = getOutputNeuron(i).getFired() == FiringState.FIRED ? 1f : 0f;
}
return output;
} | 2 |
@Override
public void keyPressed(KeyEvent event) {
// Wenn die Taste "Enter" gedrückt wird, wird die Anmeldung versucht
if (KeyEvent.VK_ENTER == event.getKeyCode()) {
loginButton.doClick();
}
} | 1 |
public void loadFromFile() {
if (filename==null) return;
try {
BufferedReader reader;
try {
File file = new File(filename);
// ignore call if file does not yet exist
if (!file.exists()) return;
reader = new BufferedReader(new FileReader(file));
} catch (java.security.AccessControlException ... | 6 |
@Override
public String getDesc() {
return "GuidedAttack";
} | 0 |
private void setPhysicalWidthDpi(int newValue) {
physicalHeightDpi = newValue;
} | 0 |
int insertKeyRehash(byte val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look u... | 9 |
public void searchByAuthor (LYNXsys system, String query, int page) {
displayedSearchResults.removeAll(displayedSearchResults);
for (int i = 0; i < system.getBooks().size(); i ++) { // loop through arraylist of books
if (system.getBooks().get(i).getAuthorFirstName().equalsIgnoreCase(query) || system.getBooks().... | 8 |
public MapView(MapModel model) {
this.model = model;
initComponents();
this.setTitle("BomberMan");
this.mapTable.setModel(this.model);
this.mapTable.setCellSelectionEnabled(false);
this.mapTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
Tabl... | 1 |
public int addFutureMeeting(Set<Contact> contacts, Calendar date)
{
try
{
if(inPast(date) || !contactList.containsAll(contacts))
{
throw new IllegalArgumentException();
}
Meeting newMeeting = addNewMeeting(date, contacts, "");
this.meetingList.add(newMeeting);
return newMeeting.getId();
}... | 3 |
public int solution(int[] v, int[] w, int C) {
int[] sol, mySol;
int i, myFinalSol;
sol = new int[v.length];
mySol = new int[v.length];
/*
* --------------------------- Base cases ---------------------------
*/
if (C == 0) {
return (0);
}
/*
* =============================================... | 7 |
public void importSong(Song song) {
// Fetch important data from the song.
// Meaning, metadata and the song itself.
Beat[] beats = song.getBeatArray();
this.song = song;
// Create a track for each voice.
int numVoices = song.getNumVoices();
for (int voiceCount = 0; voiceCount < numVoices; voiceCount++... | 5 |
public ListNode reverseKGroup(ListNode head, int k) {
if (head == null)
return null;
if (k <= 1)
return head;
ListNode preHead = new ListNode(0);
preHead.next = head;
ListNode preNode = preHead;
while(preNode.next != null){
preNode =... | 3 |
private String useEllipseVariables(String s) {
int n = view.getNumberOfInstances(EllipseComponent.class);
if (n <= 0)
return s;
int lb = s.indexOf("%ellipse[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
EllipseComponent ellipse;
while (lb != -1 && rb != -1) {
v = s.substring(l... | 9 |
* @param goods The <code>Goods</code> to use in a goods party.
* @param accepted Whether the tax raise was accepted.
* @param cs A <code>ChangeSet</code> to update.
*/
public void csRaiseTax(int tax, Goods goods, boolean accepted,
ChangeSet cs) {
GoodsType goodsType... | 6 |
public static void insertFournisseur(int idville, String nom, String adresse1, String adresse2) throws SQLException {
String query = "";
try {
query = "INSERT INTO FOURNISSEUR (ID_VILLE,FOUNOM,FOUADRESSE1,FOUADRESSE2) VALUES (?,?,?,?); ";
PreparedStatement pStatement = Connecti... | 1 |
@Override
public PlayerAction chooseAction(State state, IPlayer player) throws Exception {
lastAction = new PlayerAction();
lastAction.oldStake = player.getCurrentBet();
// minimum raise
double payToCall = state.getBiggestRaise() - player.getCurrentBet();
double handStrength = 0;
if (state.getStage() == ... | 6 |
@Override
public void run() {
while(!close){
try {
Socket client = server.accept();
System.out.println("ȴ");
synchronized (Server.LOCK) {
ClientId++;
Server.connects.add(new TankConnect(client,ClientId));
}
Thread.sleep(500);
} catch (IOException e) {
e.... | 3 |
public void setY(float y) {
this.y = y;
} | 0 |
private void init(String botname, String botIP, int listenPort, int UDP_listenPort, String password, String description,
String conn_type, String email, String sharesize, int uploadSlots, int downloadSlots, boolean passive,
ShareManager share_manager, DownloadCentral dc) throws IOException, BotException {
if(!... | 7 |
public static void main(String[] args) {
List<Rider> riders = new ArrayList<Rider>();
riders.add(new Rider(75));
riders.add(new Rider(170));
riders.add(new Rider(230));
riders.add(new Rider(5));
List<Raceable> raceables = new ArrayList<Raceable>();
for (Rider ... | 7 |
private double[] dichotStringToDouble(String[] responses){
boolean test0 = false;
int n = responses.length;
double[] converted = new double[n];
for(int i=0; i<n; i++){
boolean test1= false;
for(int j=0; j<this.nDichotomousS; j=j+2){
if(responses[i]... | 4 |
private service getNextService()
{
int startTime = 1500;
int index=0;
for(int i=0; i<todayServices.length; i++)
{
if(todayServices[i].starttime < startTime && !todayServices[i].used)
{
index = i;
startTime = todayServices[i].starttime;
}
}
todayServices[index].used =... | 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 |
public void actionPerformed(ActionEvent e){
String aparencia = "";
if (e.getSource() == janelaPrincipal.getMenuJanela().getCadastro()) {
janelaPrincipal.limparTela();
janelaPrincipal.telaCadastrar();
} else if (e.getSource() == janelaPrincipal.getMenuJanela().getExibir()) {
janelaPrincipal.limparTela();
... | 9 |
@Override
public void handleAutoCloseElementEnd(
final char[] buffer,
final int nameOffset, final int nameLen,
final int line, final int col)
throws ParseException {
if (!this.insideAllSelectorMatchingBlock) {
this.someSelectorsMatch = false;
... | 8 |
private void scoreGame() {
int roundScore = 0;
int lineMultiples = 0;
boolean scored = false;
boolean hasBonus = false;
List<Integer> rowsToKill = new ArrayList<>();
for (int r = 0; r < boardState.length; r++) {
boolean isComplete = true;
for (int ... | 8 |
public void testConstructor_ObjectLocalDate() throws Throwable {
LocalDate date = new LocalDate(1970, 4, 6, BUDDHIST_UTC);
try {
new LocalTime(date);
fail();
} catch (IllegalArgumentException ex) {}
} | 1 |
@Override
public boolean equals(Object obj) {
if(obj instanceof Player) {
Player player = (Player)obj;
long ip = Util.ip2long(player.getAddress().getAddress().getHostAddress());
if(start <= ip && ip <= end) {
return true;
}
}
if(obj instanceof DataCIDR) {
DataCIDR data = (DataCIDR)obj;
if(d... | 5 |
@Override
protected Map<spindle.core.dom.Literal, Map<spindle.core.dom.ConclusionType, spindle.core.dom.Conclusion>> generateConclusions(
InputStream ins) throws ParserException {
Map<spindle.core.dom.Literal, Map<spindle.core.dom.ConclusionType, spindle.core.dom.Conclusion>> conclusions = new TreeMap<spindle.cor... | 5 |
public static double[] stdDeviation(final SampleSet set, final double[] mean) {
if (set.size() == 0) return null;
//
final int inputsize = set.get(0).getInputSize();
final double[] result = new double[inputsize];
long ctr = 0;
//
// compute the squared differen... | 5 |
public Crawler(TileMap tm) {
super(tm);
moveSpeed = 0.7;
maxSpeed = 1;
fallSpeed = 0.2;
maxFallSpeed = 10.0;
width = 25;
height = 25;
cwidth = 20;
cheight = 10;
health = maxHealth = 20;
damage = 3;
try {
BufferedImage spritesheet = ImageIO.read(getClass().getResourceAsStream("/Sprites/Ene... | 2 |
public static void printStepCounts(SingleGbState state) {
System.out.println("size: "+state.stateBuffer.size());
int minStepCount = Integer.MAX_VALUE;
int maxStepCount = Integer.MIN_VALUE;
int minDelayStepCount = Integer.MAX_VALUE;
int maxDelayStepCount = Integer.MIN_VALUE;
for(State s : state.stateBuff... | 4 |
public void setIdSolicitud(int idSolicitud) {
this.idSolicitud = idSolicitud;
} | 0 |
public int getPort() {
return clientPort;
} | 0 |
public void setMeta(Map<MetaEnum, Object> meta) {
this.meta = meta;
} | 0 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (ClassNotFoundException ex) {
Logger.getLogger(truncate.class.getName()).log(Level.SEV... | 4 |
@Override
public void Play(PlayerResponse response) {
try {
// Try to get bid from JSONObject
int bid = response.getBid();
System.out.println("bid : " + response.getBid());
System.out.println("bid from : " + mP.getCurrentTurn());
// Bidder passed, remove from remaining
if(bid == 0) {
... | 7 |
@Override
public String toString() {
StringBuilder triangle = new StringBuilder();
char blank = ' ';
int x = 1;
int numBlanks = 0;
for (int row = 1; row <= height - 1; row++) {
numBlanks = height - row;
int printedBlanks = 0;
while (printedBlanks < numBlanks) {
triangle.append(blank);
pri... | 6 |
@Override
public void display(GLAutoDrawable drawable) {
gl = drawable.getGL();
// Enable VSync
gl.setSwapInterval(1);
// Setup the drawing area and shading mode
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glShadeModel(GL.GL_SMOOTH); // try setting this to GL_FLAT and see
// what happens.
gl.gl... | 3 |
protected boolean controlSizeInput(JTextField textfield) {
boolean ret = true;
String tmp = textfield.getText();
if (!tmp.matches(Constants.SKIN_NUMBER_REGEX)) {
ret = false;
}
return ret;
} | 1 |
public CreateRandom(String connectStr, String userName, String pass,
String outputTable) throws SQLException {
this.connexion = DriverManager.getConnection(connectStr, userName, pass);
this.outputTable = outputTable;
this.rand = new java.util.Random(System.currentTimeMillis());
... | 8 |
protected void addDocumentEnd() {
try {
h.endDocument();
} catch (SAXException ex) {
throw new RuntimeException(ex.toString());
}
} | 1 |
private int compairNameIgnoreCase(String a, String b) {
if(a == null && b == null){
return 0;
}
if(a == null){
return -1;
}
if(b == null){
return 1;
}
a = a.toLowerCase();
b = b.toLowerCase();
for (int i = 0; i < a.length() && i < b.length(); i++) {
if (a.charAt(i) > b.charAt(i)) {
ret... | 8 |
private void injectDependencies()
throws Exception {
// objPool에서 빈을 꺼내어 setXXX() 메서드를 찾는다.
Class<?> clazz = null;
Object dependency = null;
for (Object obj : objPool.values()) {
clazz = obj.getClass(); // 객체의 클래스 정보를 가져온다.
log.debug(clazz.getName());
// 셋터 메서드를 찾는다.
for (Method m : clazz.ge... | 5 |
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.