method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8284d743-da39-4b0d-ab2c-b69f2a755d9e | 9 | public void establishPersistentConnection() throws FileNotFoundException , IOException {
try{
Server = new ServerSocket (SERVER_PORT);
Server.setReuseAddress(true);
}catch(BindException e){
System.out.println("Exception in establishPersistentConnection(). Cause : " + e.toString() );
return;
}
... |
e35c0451-689d-456d-8003-b4f33714c65b | 2 | public static List<Double> furthestPoint(Matrix points, List<Double> point) {
double furthestDistance = Double.NEGATIVE_INFINITY;
int furthestIndex = -1;
int size = points.getNumRows();
for (int i = 0; i < size; i++) {
List<Double> row = points.getRow(i);
double d... |
b052e7ef-e91e-4968-9f2e-6219ba0f1390 | 3 | public static String getFormattedDisplatString(ResultModel rm){
String separator = System.getProperty("line.separator");
if(rm.getExplains().size()==0){
return "暂无翻译结果";
}else{
StringBuilder sb = new StringBuilder();
if(!rm.getPhonetic().isEmpty()){
sb.append("音标: [" + rm.getPhonetic() + "]").append(... |
38a849ec-5404-411f-85dd-752eaa01676c | 2 | public void draw(Graphics2D g2d, int[] screen, View helper) {
float scale = (float)(screen[1]/500.0*size/32.0); // Scale the bullet shape
g2d.translate(position[0]/500*screen[1],position[1]/500*screen[1]); // Translate to the position of the bullet.
g2d.rotate(angle... |
123edf6d-a3fe-4fa3-98fd-a63295b09dbb | 4 | static void printArrayInt(int[] array) {
if (array == null || array.length == 0)
return;
for (int i = 0; i < array.length; i++) {
if (i > 0)
System.out.print(" ");
System.out.print(array[i]);
}
System.out.println();
} |
4330f315-344e-4096-b00d-fb2586e705ac | 6 | public static void main(String[] args) {
int counter = 0;
int height = 40;
System.out.println("Triangle: ");
System.out.println();
for (int i = 1; i <= height; i++) {
counter = 0;
if (i < 10)
System.out.print(" ");
System.out.print(i + "): ");
for (int k = height; k > i; k--)
Syst... |
7b173068-0fda-4875-aa9c-86653da03b7b | 2 | private int whichSlot()
{
for(int i = 0; i < cSelect.getInventory().getSize(); i++)
{
if(within(cSelect.getInventory().area(i))) {
return i;
}
}
return -1;
} |
c2d5bbc7-e199-412c-9434-81b918787be2 | 7 | public T getBestTransition() {
if (getPossibleTransitions().isEmpty()) {
return null;
}
final int currentPlayer = getCurrentPlayer();
Path<T, N> path;
boolean stop = false;
// TODO : do it in a interuptable Thread
do {
path = selection(pathToR... |
21b6aa4d-175d-49af-9cd4-387f9f2acf11 | 8 | public static GNSSData getInterpolatedGNSSData(List<GNSSData> dataBase,int n,int index,double target)
{
int gpsWeek = dataBase.get(0).getGpst().getWN();
int offset = 0;
double []towArray = new double[n];
double []latArray = new double[n];
double []lonArray = new double [n];... |
80ed9d00-e8c2-46b7-9dd5-8fac07d20a50 | 2 | public void updateInOutCatch(FlowBlock catchFlow) {
VariableSet gens = ((TryBlock) block).gen;
/*
* Merge the locals used in the catch block with those written by the
* try block
*/
catchFlow.in.merge(gens);
/*
* The gen/kill sets must be updated for every jump in the other block
*/
Iterator ... |
3045a4a9-ed62-41f9-85ff-9a43bb0f82ba | 6 | void pack(Info vi, Object imap, Buffer opb){
InfoMapping0 info=(InfoMapping0)imap;
/* another 'we meant to do it this way' hack... up to beta 4, we
packed 4 binary zeros here to signify one submapping in use. We
now redefine that to mean four bitflags that indicate use of
deeper features... |
28ea9a89-4ced-4a04-8b98-5d7c8302d6c9 | 9 | public String change2(String t) {
if (t.equals("服饰"))
t ="fz" ;
else if (t.equals("鞋包"))
t = "xb";
else if (t.equals("珠宝手表"))
t ="zb" ;
else if (t.equals("数码"))
t ="sm" ;
else if (t.equals("电子产品"))
t = "dz";
else if (t.equals( "日用百货"))
t ="ry";
else if (t.equals("文化玩乐"))
... |
e5dbf2eb-a011-4295-b59f-79e9ff00a64e | 6 | protected Object toType( Number num ) {
Class jType = getType().getJavaType();
if( jType == Long.TYPE || jType == Double.TYPE ) {
// Should already be the right type
return num;
}
if( jType == Byte.TYPE ) {
return num.byteVa... |
6a70edb4-a889-4f50-bdaf-b16518deb8ae | 2 | public HashSet<BoardCell> getTargets(int index, int steps) {
// This is the initial setup function that calls our recursive calcTargets().
HashSet<Integer> targetList = new HashSet<Integer>();
HashSet<Integer> visitedList = new HashSet<Integer>();
steps = steps + 1;
if(getCellAt(index).isDoorway()) {
targe... |
7782f7e0-b916-4e01-8781-1ff24b6543ab | 5 | @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 Employee)) {
return false;
}
Employee other = (Employee) object;
if ((this.id == null && other.id != null) || (... |
c3962a1f-6938-48fd-acec-f4bb4149da0c | 8 | final void method3899(int i, int i_50_, Class21 class21, boolean bool) {
try {
anInt9854++;
if (bool != true)
((NativeOpenGlToolkit) this).aBoolean9921 = true;
int i_51_;
int i_52_;
if (class21 != Class249.aClass21_3217) {
if (Class348_Sub5_Sub1.aClass21_8832 != class21) {
if (Class2... |
3bfdcaeb-9bb0-452a-bed5-85a2d8d6f51b | 2 | public int max_number_of_frames(int streamsize) // E.B
{
if (h_vbr == true) return h_vbr_frames;
else
{
if ((framesize + 4 - h_padding_bit) == 0) return 0;
else return(streamsize / (framesize + 4 - h_padding_bit));
}
} |
1acbfb51-63f7-4b51-9b7f-aba4ce2bd631 | 1 | public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool(new DaemonThreadFactory());
for (int i = 0; i < 10; i++)
exec.execute(new DaemonFromFactory());
System.out.println("All daemons started");
TimeUnit.MILLISECONDS.slee... |
b29fa940-fe84-4833-88f7-ab205b0376e0 | 9 | private node minValue(node localHead, double alpha, double beta) {
ArrayList<node> ch = localHead.getChildren();
double temp = Double.MAX_VALUE;
//terminating state
if (localHead.getValue() == 5 || localHead.getValue() == -5) {
return localHead;
}
//leaf nod... |
a74726ee-b816-419c-998a-bfcdda835503 | 7 | public HTAccess(Resource resource)
{
BufferedReader htin=null;
try
{
htin=new BufferedReader(new InputStreamReader(resource.getInputStream()));
parse(htin);
_lastModified=resource.lastModified();
if (_userFile!=... |
a4a495ed-9d79-4251-a675-2568737c2972 | 4 | @Override
public void mouseReleased(MouseEvent e) {
// Catch for Solaris/Mac if they did the popup trigger.
if (e.isConsumed()) {
return;
}
recordRenderer(e.getComponent());
// Shorthand
Node currentNode = textArea.node;
JoeTree tree = currentNode.getTree();
// This is detection for W... |
751a72c1-6a9b-43b9-af78-0c0dd3b97289 | 9 | @Override
public void update(Observable o, Object arg) {
//force une pause entre les différents messages
try {
Thread.sleep(Constante.TIME_SLEEP_BETWEEN_ACTION);
} catch (InterruptedException ex) {
}
int hpEnnemy = getPlayer().getMediator().getHPForPokemon(getPlay... |
8ceb6548-f3ed-4ef2-8370-625f6a4df4a2 | 3 | public static BufferedImage[][] load(String s, int w, int h) {
BufferedImage[][] ret;
try {
BufferedImage spritesheet = ImageIO.read(Content.class.getResourceAsStream(s));
int width = spritesheet.getWidth() / w;
int height = spritesheet.getHeight() / h;
ret = new BufferedImage[height][width];
for (in... |
b1f29d7a-b325-48db-84cd-65962db11a21 | 5 | public static void calculateBiomeData(Tile tile, Point[] surrPoints) {
Tile[] sTiles = Utils.surroundingPointsToTiles(surrPoints); // Pattern produced by this method matches the encoding.
for (int i = 0; i < sTiles.length; i++) {
Tile sTile = sTiles[i];
// Higher precedence tiles overlap the lower precedence... |
9e1e8acd-cb79-4a54-8414-984c36af7b42 | 6 | 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... |
8f69b68b-e49e-455b-9028-c21c1470e0d6 | 3 | public Presa(int f, int c) {
ub = new Punto();
ub.y = (int) (f * Math.random());
ub.x = (int) (c * Math.random());
//Solo debe de caer en celdas Vacias
while (Tablero.tab[ub.y][ub.x] != 0) {
// Me aseguro que no me desborden
while (ub.y == f)
ub.y = (int) (f * Math.random());
while (ub.x == c)
... |
6a400b40-076f-40df-bf1d-48dcedda6545 | 4 | public static Expression newLiteral(Token tok)
{
switch(tok.getKind())
{
case TRUE: return new LiteralBool(tok.getLineNumber(), tok.getCharPos(), LiteralBool.Value.TRUE);
case FALSE: return new LiteralBool(tok.getLineNumber(), tok.getCharPos(), LiteralBool.Value.FALSE);
case INTEGER: return new LiteralInt(to... |
68d2eebe-8bd8-46e2-bbe7-813fed3d6aee | 5 | public void affichageTimers() {
int nbMinutes = timerSeconde / 60;
int nbSecondes = timerSeconde % 60;
int nbHeures = nbMinutes / 60;
String displayMinutes, displaySecondes, displayHeures;
nbMinutes = nbMinutes % 60;
if (nbMinutes < 10) {
displayMinutes = ... |
c56d3ab8-3d6e-46f1-9a9c-b646a2ec946f | 7 | public void updateBalls()
{
for (int i = 0; i < balls.size(); i++)
{
Ball b = balls.get(i);
b.display();
b.move();
if (b.getX() > Animation.WALL_LEN + Animation.WALL_WID)
{
balls.remove(b);
readyForBall = tru... |
8a755c92-8c15-499c-9974-4f08bb04812f | 1 | public void unlock()
{
if (--lockCount == 0) {
//QMessageBox.about(this, "UNLOCK", "");
lockEnableButtons();
QApplication.restoreOverrideCursor();
QApplication.processEvents();
}
} |
a3d2003d-5815-4df3-86ab-ee16c6b368ba | 4 | public int getTileTop(int xWorld, int yWorld) {
Point mapCoord = new Point(xWorld, yWorld);
Rectangle r = null;
int x, y;
Tile t;
for(int i = 0; i < 64; i++) {
for(int j = 0; j < 46; j++) {
r = null;
x = (((i * tileWidth) + tileWidth / ... |
c7262c79-6908-4123-897b-fcffd737aa02 | 0 | public List<ResConfig> getConfigurations() {
return this.configurations;
} |
f8f5413b-ae75-4272-8096-bbcb8b68681c | 3 | public boolean interact(Level level, int xt, int yt, Player player, Item item, int attackDir) {
if (item instanceof ToolItem) {
ToolItem tool = (ToolItem) item;
if (tool.type == ToolType.pickaxe) {
if (player.payStamina(6 - tool.level)) {
hurt(level, xt, yt, 1);
return true;
}
}
}
retur... |
cb7fcd19-971e-457a-b075-46902e738cc7 | 4 | private int getAddr(int obj, int offs) {
obj = obj + size;
if (obj<0 || obj>=hp) {
fatal("Invalid object reference");
}
int len = heap[obj];
if (offs<1 || offs>len) {
fatal("Invalid offset");
}
return obj+offs;
} |
a287542a-c5a9-4ac0-8d1b-a6c27c27c757 | 3 | public Tabla(String cadena, String usuario, String contraseña, String url, String tipo) {
this.cadena = cadena;
if(tipo.equals("DSPACE")){
// consulta en DSpace
consulta = "select c.collection_id ID, c.name NOMBRE, c.short_description DESCRIPCION, t.name COMUNIDAD from collection... |
aa3b1a3f-3f47-4b90-a12a-2e438c8d42de | 1 | public boolean canHaveAsCreditLimit(BigInteger creditLimit) {
return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0);
} |
7a3cb08a-e64c-4e44-9341-87c263d4d17b | 2 | public List<Benutzer> getAlleBenutzer() {
ResultSet resultSet;
List<Benutzer> rueckgabe = new ArrayList<Benutzer>();
try {
resultSet = db.executeQueryStatement("SELECT * FROM Benutzer");
while (resultSet.next()) {
rueckgabe.add(new Benutzer(resultSet, db, this));
}
resultSet.close();
} catch (SQ... |
06b615de-aa9c-4d3b-a2ad-86227ce2facc | 2 | public NeuronLayer(int inputs, int outputs, Random random) {
weights = new double[inputs][outputs];
oldAdjustments = new double[weights.length][weights[0].length];
for (int y = 0; y < outputs; y++) {
for (int x = 0; x < inputs; x++) {
w... |
a9f435fc-5beb-4f06-a804-e2a77034b9e0 | 1 | @Override
public File nextOutputFolder() {
if (!basedir.exists()) {
basedir.mkdirs();
}
String filename = daf.format(new Date());
File nextFolder = new File(basedir, filename);
return nextFolder;
} |
7047639c-a7ac-44e1-b5de-cdf71e4a3a1c | 6 | public void print_bill()
{
pY_offset =-5;
try{
String strLine;
FileInputStream in = new FileInputStream("Printer\\Printer_bill");
int items_num =1;
try (BufferedReader bufffile = new BufferedReader(new InputStreamReader(in, "UTF8")))
{
... |
4e3b893f-f73f-4112-bc18-d1e90dc961f5 | 3 | public void giftClickTest(DriverGenerator dg) {
// boiler plate
WebDriver wd = dg.generate();
ParallelPrepHelper pph = new ParallelPrepHelper(wd);
// setup
boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE);
boolean giftCardLink = pph.clickOnVisibleElement(GIFT_CARDS_LINK);
boolean priceRangeLink = pph.... |
ec5a3356-1b8a-4392-a238-cfb03df3ba50 | 5 | public JSONObject updateNotificationTag(int QUESTION_ID, int USER_ID)
{
try {
Class.forName(JDBC_DRIVER);
conn=DriverManager.getConnection(DB_URL,USER,PASS);
stmt=conn.createStatement();
json=new JSONObject();
json.put(SUCCESS, 0);
int result=stmt.executeUpdate("update NOTIFICATION ... |
a22327ea-f5de-4b8d-8c01-d676d4257a3d | 8 | public static void main(String[] args) {
try {
int player1Type = Player.HUMAN_PLAYER;
int player2Type = Player.HUMAN_PLAYER;
if( args.length != 2 ) {
System.out.println("Usage: program <player 1 type> <player 2 type>");
System.out.println(" where player type = human, random, or minimax");
... |
ff6506ac-327a-4123-a19d-952a6df27f2b | 1 | public static boolean checkMobile(String mobile) {
String regex = "^1[358]\\d{9}$";
if (Pattern.matches(regex, mobile)) {
return true;
}
return false;
} |
a8871238-b3e4-4ff0-afe4-2869cb07f173 | 8 | public boolean checkWin() {
int check = 0;
int mines = 0;
if (!isHasLost()) {
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if ((board[i][j] instanceof Blank || board[i][j] instanceof Treasure)
&& board[i][j].isAlreadyChecked())
check++;
if (bo... |
2f5bba54-31ac-4e8c-a92d-a53f5d4bab75 | 2 | public void gaFram()
{
if(aktuell >= 0 && aktuell < polyLinje.getHorn().length - 1)
{
aktuell++;
}else
{
aktuell = -1;
}
} |
8d0b3689-b541-4a44-b45d-303aa11937b9 | 7 | private void desplazar(desplazarBoton desplazar) throws SQLException, IOException{
switch (desplazar) {
case PRIMERO:
res.first();
break;
case ANTERIOR:
if(!res.isFirst()){
if(res.previous());
}
break;
case SIGUIENTE:
if(!res.isLast()){
res.next();
}
break;
case UL... |
e2cde94b-821f-4f7e-b493-e4ea5ab43620 | 5 | public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("annonce")) {
fcts.addElement(currentFacture);
currentFacture = null;
} else if (qName.equals("id_facture")) {
id_factureT = "close";
} else if (qName.equ... |
650a145c-593b-42e0-a6f4-ad9498e5378c | 9 | protected List<Framedata> translateRegularFrame( ByteBuffer buffer ) throws InvalidDataException {
while ( buffer.hasRemaining() ) {
byte newestByte = buffer.get();
if( newestByte == START_OF_FRAME ) { // Beginning of Frame
if( readingState )
throw new InvalidFrameException( "unexpected START_OF_FRAME... |
587155da-13c4-4312-a78a-417645c57c5d | 1 | public String getRosterName (int i) {
Roster r = MainWindow.rosterDB.getRosterByID (rosters.get(i));
if (r.getIsAspirant())
return "HFL->" + r.getGivenName() + " " + r.getFamilyName() + "<";
return r.getGivenName() + " " + r.getFamilyName();
} |
b4eaf2c8-04f6-4a6b-a321-3fc2e98d6c39 | 6 | @EventHandler
public void BlazeNausea(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.getBlazeConfig().getDouble("Blaze.Nausea.Dodg... |
154a0bc1-bd5e-4199-811f-2c513ea7cf1e | 9 | public void loadRace() {
RandomAccessFile rafFile2;
String strStore;
String strRaceDir;
if (isPet()) {
strRaceDir = "defPets";
} else {
strRaceDir = "defRaces";
}
try {
if (RACE == null) {
chatMessage("Choose one of the following races:\n");
File filRaces = new File(strRaceDir);
Strin... |
e2bf6d58-5400-420a-95cd-38bf46cc642c | 1 | public static Node maximum(Node root){
while(root.right != null)
root = root.right;
return root;
} |
5af258df-0588-4a57-8310-be7beb8a330d | 1 | @Override
public void run() {
if(animationStage == 1)
{
//System.out.println("Animation stage updated to 2!");
animationStage = 2;
} else
{
//System.out.println("Animation stage updated to 1!");
animationStage = 1;
}
} |
6e486ca2-d0d9-4f1a-abac-42cdf41f8cf8 | 8 | public static PageResult<Article> getPage(int page, int numItemsInPage)
throws SQLException, NamingException {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
if (page <= 0) {
page = 1;
}
DataSource ds = getDataSource();
PageResult<Article> result = new PageResult<Article>... |
a65d68bd-5015-4d7d-8b56-c1f09732dcb2 | 4 | public BufferedImage getImage(String imageURL) {
/* Get the image (load it if neccesary). */
BufferedImage image = (BufferedImage) images.get(imageURL);
if (image == null) {
try {
image = loadImage(new URI(imageURL).toURL());
} catch (MalformedURLException e) {
System.err.println("Breakout: Malforme... |
87db4a00-8865-4c14-af26-9b3cddd431dc | 9 | private DeepSpaceCalculator(TLE tle, DeepSpaceValueObject dsv) {
this.dsv = dsv;
thgr = thetaG(tle.getRefepoch());
eq = tle.getEo();
xnq = dsv.xnodp;
aqnv = AbstractSatellite.invert(dsv.aodp);
xqncl = tle.getXincl();
xmao = tle.getXmo();
xpidot = dsv.omgdot + dsv.xnodot;
sinq = Math.sin(tle.g... |
0bc677ec-5340-4497-80f6-b315da90a338 | 1 | public SslHelper() {
creds = null;
try {
trusted = KeyStore.getInstance(KeyStore.getDefaultType());
trusted.load(null, null);
} catch(Exception e) {
throw(new Error(e));
}
} |
144d8287-3f6f-4c73-9b03-ac50e078e177 | 8 | public static void load() { //for loading data
if(serObj.dir.list().length > 0) {
System.out.println("The following files are saved");
Integer count = 1;
for(File files : serObj.dir.listFiles()) {
loadedAssignments.put(count, files.getName());
System.out.println(count + ": " + files.getName());
c... |
9d338034-589e-4206-8a3d-06b1c6e3f95e | 3 | public boolean verifyRobot(Robot paramRobot)
{
if (paramRobot.getAssembly("Launcher") == null) {
return false;
}
Enumeration localEnumeration = GameApplet.thisApplet.getGameState().getSpecialProgramParts().elements();
while (localEnumeration.hasMoreElements()) {
if ((localEnumeration.next... |
c8bf0271-5d32-4d82-9b60-1e9f049a52a9 | 1 | public void remove(int offs, int len) throws BadLocationException
{
super.remove(offs, len);
if (getLength() < 1)
super.insertString(0, "0", null);
} |
39ad30b5-00a8-4fc8-837d-2d71aef6cd46 | 6 | public short getAddress(String functionName) throws ProgramException {
Short address = (Short)functions.get(functionName);
if (address != null) {
return address.shortValue();
} else {
String className =
functionName.substring(0, functionName.indexOf("."));
if (staticRange.get(className) == null) {
... |
ba99678a-945c-421d-adc9-8f407196a4ad | 8 | public void write(Day day) {
renameFile(day.getDate());
File file = getFile(day.getDate());
FileWriter fileWriter = null;
try {
fileWriter = new FileWriter(file);
JSONWriter output = new JSONWriter(fileWriter);
output.array();
for ... |
5e8fe1d5-dc1b-4624-8f99-f4115bed92d4 | 4 | @SuppressWarnings("unchecked")
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
try {
Date startDate = ViewTools.DATE_FORMAT.parse(req.getParameter("startDate"));
Date endDate = ViewTools.DATE_FORMAT.parse(req.getPa... |
d75db60f-587a-417a-ba64-21710d7e7fc1 | 8 | public Element createAddressElement(String street, String houseNumber, String postcode, String city) throws ProfilerException {
if (street == null || houseNumber == null || postcode == null || city == null
|| street.isEmpty() || houseNumber.isEmpty() || postcode.isEmpty() || city.isEmpty()) {
... |
492013c3-ae6e-4815-8c0d-2363dafb7f58 | 0 | public final int getFpcount() { return fpcount; } |
3ee36423-731c-40dc-a8fa-a3ce8fe1ef74 | 0 | public void testGamesAreAddedToTheMap() {
GameMap map = new GameMap();
Game g1 = map.createGame();
Game g2 = map.createGame();
Game g3 = map.createGame();
assertEquals(g1, map.getGame(g1.getGameId()));
assertEquals(g2, map.getGame(g2.getGameId()));
assertEquals(g3, map.getGame(g3.getGam... |
c7079dc1-7496-4296-bc0b-eebd18ed4c2b | 8 | private automata.pda.PushdownAutomaton readPDA(BufferedReader reader)
throws IOException {
String ender = reader.readLine().trim();
if (!(ender.equals("FINAL") || ender.equals("EMPTY") || ender
.equals("FINAL+EMPTY")))
throw new ParseException(ender
+ " is a bad finishing type for PDA!");
automata.... |
38bbe770-de38-44bc-8562-cd16a594aee7 | 7 | public boolean fire(TableroDos enemy, int x, int y){
if(enemy.shipMap[x][y]!=" " && this.map.fireMap[x][y]!="x" && this.map.fireMap[x][y]!="o"){
String nameBarco=enemy.shipMap[x][y].substring(0,2);
switch (nameBarco) {
case "A-":
this.puntos+=4;
... |
f0c81cb8-95a2-42b2-acce-54915ed03604 | 0 | public UndoKeeper(Automaton master){
myMaster = master;
myDeck = new LinkedList<Automaton>();
myBackDeck = new LinkedList<Automaton>();
numUndo = Universe.curProfile.undo_num;
} |
cab1f7e6-9fd9-4f00-8a1a-76c23102e563 | 9 | private void decodeHeader(BufferedReader in, Map<String, String> pre, Map<String, String> parms, Map<String, String> header)
throws InterruptedException {
try {
// Read the request line
String inLine = in.readLine();
if (inLine == null) {
... |
67c7e8f8-cf67-4f0f-8555-dbe3eae52e15 | 3 | public static void main(String[] args)
{
try
{
MP3 mp3 = new MP3(new URL("http://www.beaglebuddy.com/content/downloads/mp3/01.Hells%20Bells.mp3"));
// if there was any invalid information (ie, frames) in the .mp3 file,
// then display the errors to the user
if (mp3.ha... |
c3712652-730b-4515-b15a-aefef6217b0f | 4 | public static void main(String[] args) {
String inputExpression = "";
String exitKey = "exit";
try {
do {
System.out.println("Enter an expression or \"exit\" for exit.");
Scanner scan = new Scanner(System.in);
inputExpression = scan.ne... |
32205772-03a4-4252-8c0c-c359500fa7ab | 7 | private void insert(List<int[]> spans, int[] target) {
int insertIndex = -1;
if (spans.isEmpty()) {
spans.add(target);
return;
}
for (int i = 0; i < spans.size(); i++) {
int[] span = spans.get(i);
if (!(target[1] < span[0] - 1 || target[... |
f13ebfe0-9c35-4f73-ad35-8f232b1c8020 | 5 | private void updateNPCs(Stream stream, int arg1) {
localEntityCount = 0;
entityUpdateCount = 0;
updateNpcMovement(stream);
method46(arg1, stream);
parseNpcUpdateFlags(stream);
for (int k = 0; k < localEntityCount; k++) {
int l = localPlayerIndices[k];
... |
146dcc3d-4b81-448c-97d3-7e741a82ca38 | 3 | protected void updateHeight() {
int lesserHeight = 0;
int greaterHeight = 0;
if (lesser != null) {
AVLNode<T> lesserAVLNode = (AVLNode<T>) lesser;
lesserHeight = lesserAVLNode.height;
}
if (greater != null) {
AVLNode<T> greaterAVLNode = (AVLNode<T>) greater;
greaterHeight = greaterAVLNode... |
0cac57b6-fd78-488f-b583-563895cba3f7 | 4 | public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... |
a1623421-efe8-4bc0-8833-b22271a6a4b2 | 0 | public void setId(String value) {
this.id = value;
} |
d22d895c-13c3-4bdb-8c4d-5f73fd08eb21 | 0 | @Test(expected = ParkException.class)
public void out_by_wrong_ticket_when_in_a_car() {
Park park = new Park(10);
park.in(new Car("京A123456"));
park.out(new Ticket("京B123456"));
} |
8bec4190-0e6c-4b89-8d77-c12c9df060f0 | 1 | public void run() {
maxn = 10000;
kstop = 10;
pcento = 0.01;
peps = 0.00001;
int iseed = 10;
int iniflg = 0;
System.out.println("Pcento: " + pcento);
double bestpoint[], bestx[], bestf;
double x0[] = randomSampler();
//double x0[] = {-1... |
f5acfd88-78ae-4e70-a6b6-9913698f5be6 | 3 | public int[] getHoraAlarma(){
int[] par= new int[2];
try{
par[0] = new Integer(txfHora.getText());
par[1] = new Integer(txfMinuto.getText());
if (par[0]<=24 && par[1]<=60) {
lblError.setText("Alarma guardada!!!");
lblError.setForeground(Color.GREEN);
}
}catch(Exception e){
lblError.setText(... |
bcb74580-2b36-48e4-912f-929e3ab249bb | 8 | private FieldDescriptor(final FieldDescriptorProto proto,
final FileDescriptor file,
final Descriptor parent,
final int index,
final boolean isExtension)
throws DescriptorValidationExcept... |
c3c14592-7bcf-464f-896b-3b78a7c84308 | 0 | public JTextField getjTextFieldMotifVis() {
return jTextFieldMotifVis;
} |
a04bdd12-07b1-4268-b8e4-289f175edfa9 | 8 | public static double time(String alg, Comparable[] a) {
Stopwatch timer = new Stopwatch();
if (alg.equals("Insertion")) Insertion.sort(a);
if (alg.equals("Selection")) Selection.sort(a);
if (alg.equals("Shell")) Shell.sort(a);
if (alg.equals("Merge")) Merge.sort(a);
if (alg.equals("MergeWithImpr... |
ae6c7205-1524-48a8-bfd9-e818b1100ea2 | 6 | private void knightBottomBottomLeftPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 1 && y1 >= 2) && (x1 < maxWidth && y1 < maxHeight))
{
if(board.getChessBoardSquare(x1-1, y1-2).getPiece().getPieceType() != board.getBlankPiece()... |
0918004a-e783-4a10-a1ae-8795a6ce9725 | 2 | public void loadCaptchaImage(PacketCaptchaImage p) {
if (!p.hasCaptcha) {
JOptionPane.showMessageDialog(this, p.key, "Error", JOptionPane.ERROR_MESSAGE, null);
this.setVisible(false);
mf.cancelRegistration();
return;
}
try {
img = I... |
ac07fcfe-008b-4d0c-b963-702d3442badf | 8 | private void refreshTitleAndDescription() {
if (board.getPlayerWhite() != null && board.getPlayerBlack() != null) {
if (board.getWhiteRank() != null && board.getBlackRank() != null) {
titleLabel.setText(board.getPlayerWhite() + " (" + board.getWhiteRank() + ")" +
... |
d7d23d75-5df1-41d0-b255-397d751a0dfa | 0 | public void setPassword(String password) {
this.password = password;
} |
fdf955e0-3852-4323-8bd0-e84e0c48f66d | 7 | private static String intToOperator(int i){
if(i != 0 && i != 1 && i != 2){
//System.out.println("incorrect value for int to operator"); used for testing
}
switch (i){
case 0: return "+";
case 1: return "-";
case 2: return "*";
case 3: ... |
bcdd1e5a-cfaa-401f-bd06-62b3754c9703 | 9 | public final void end() {
if(this.vertices > 0) {
this.buffer.clear();
this.buffer.put(this.data, 0, this.length);
this.buffer.flip();
if(this.texture && this.color) {
GL11.glInterleavedArrays(10794, 0, this.buffer);
} else if(this.texture) {
GL... |
5c8e3b09-c26d-4665-84d1-95b67ef11e4d | 5 | private void GenerateGameGrid()
{
//TODO Prettification of gamegrid
for (Integer i = 0; i < columns; i++)
{
ColumnConstraints column = new ColumnConstraints();
column.setPercentWidth(100/columns);
GameGrid.getColumnConstraints().add(column);
f... |
d0a5ae57-9351-42e2-a541-528f2c649d3a | 0 | public void addLoginListener(LoginListener listener){
loginListeners.add(listener);
} |
08f120bb-6ce1-4c08-abc6-b74f00659b1e | 1 | private void launchDialog()
{
String inputValue = JOptionPane.showInputDialog("Enter HyperLink name");
if(inputValue!=null){
hyperLinkNames.add(inputValue);
jList2.setListData(hyperLinkNames.toArray());
Metafile mf = new Metafile();
mf.rectID = hyp... |
782ed1ee-aeeb-4d88-9ef2-c5ebe736bea9 | 7 | public void run()
{
while (thread != null && state == STATE_PLAYING && read != -1) {
if (written >= read) {
try {
read = audioInputStream.read(buffer, 0, buffer.length);
written = 0;
}
catch (IOException e) {
e.printStackTrace();
... |
a283d8dd-8526-4672-ab05-d154351b70e6 | 0 | @Override
public void endDocument () {} |
f1d3b93c-42e9-4432-8074-545844508066 | 1 | public void setNametextFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.nametextFontStyle = UIFontInits.NAME.getStyle();
} else {
this.nametextFontStyle = fontstyle;
}
somethingChanged();
} |
fa3ae486-9655-4e52-b87d-eaca29d968e3 | 4 | public CFGResult computeIf(Block condBlock, ArithmeticResult cond, CFGResult then,
CFGResult elseResult) {
if (cond.getKind() == Kind.CONST) { // the branch result is fixed.
if (cond.getConstValue() > 0) {
return then;
} else if (elseResult != null) {
return elseResult;
} else {
return CFGResu... |
41dda0e5-723a-4311-8090-602eb1c2a9da | 8 | private List<Posicao> posicoesPossiveisBispo(Posicao posicao) {
List<Posicao> posicoesPossiveis = new ArrayList<>();
int[] posicoesVariantes = new int[2];
int colunaAtual, linhaAtual;
/*
* a combinacao das posicoes variantes fara o bispo se mover nas quatro
* diagonai... |
87919545-866b-4761-90cb-dac6402ff959 | 3 | public boolean isSelfCollision()
{
for (int i = 1; i < snake.getBody().size(); i++) {
if (snake.getHead().getX() == snake.getBody().get(i).getX() &&
snake.getHead().getY() == snake.getBody().get(i).getY()) {
return true;
}
}
return ... |
6f3786eb-f314-45f8-a566-8674d4454e34 | 2 | public boolean isRightMost(treeNode curNode) {
treeNode parent = curNode.parent;
if (parent == null) // root
return true;
if (parent.rightLeaf == curNode) // is parent's right leaf, see if
// parent's is right most
return isRightMost(parent);
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.