method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
152aad2a-6626-4827-ac43-b242d3fbad8a | 7 | public static void main(String[] args) throws IOException {
Menu menuElement;
boolean gameOver = false;
System.out.println(START_MESSAGE);
System.out.println();
while (!gameOver) {
Field gameField = null;
do {
menuElement = Menu.selectFromM... |
d95f8864-5dd0-4a17-bcbd-2d42a98cc813 | 3 | private automata.fsa.FiniteStateAutomaton readFA(BufferedReader reader)
throws IOException {
automata.fsa.FiniteStateAutomaton fa = new automata.fsa.FiniteStateAutomaton();
// Generic states.
State[] states = readStateCreate(fa, reader);
String[][][] groups = readTransitionGroups(2, 1, states.length, reader)... |
b4e442e9-137f-4280-a3c9-e4d5cdda7bfe | 7 | public Generation getNextGeneration(Generation currentGeneration){
if(currentGeneration == null)
return null;
Generation nextGeneration = new Generation(currentGeneration.getM(), currentGeneration.getN());
//Iterate over each row in currentGeneration
for(int i=0; i < currentGeneration.getM(); i++){
... |
812f477f-59c5-4bf8-bc45-b7f8b4cb279b | 8 | public void process(File cFile) {
boolean modified = false;
try {
String cName = ClassNameFinder.thisClass(BinaryFile.read(cFile));
if (!cName.contains("."))
return; // Ignore unpackaged classes
ClassPool cPool = ClassPool.getDefault();
CtClass ctClass = cPool.get(cName);
for (CtMethod method : c... |
6bc03d5c-54b0-4955-a3b8-f64853e0ec4e | 7 | public Screen() {
long origTime = System.nanoTime();
System.out.println("--------------------------------------------------------------------------------");
System.out.println("Time start at " + (float) Math.round((System.nanoTime() - origTime) / 1000000) / 1000 + " seconds");
// setting size
this.se... |
ebec1c56-aec9-4f26-af36-2d99c8dbaa97 | 6 | private String convertStateToString(int state) {
if (state == JFrame.NORMAL) {
return "NORMAL";
}
String strState = " ";
if ((state & JFrame.ICONIFIED) != 0) {
strState += "ICONIFIED";
}
//MAXIMIZED_BOTH is a concatenation of two bits, so
... |
78eccd39-c765-4eeb-bca8-730acd0fd851 | 2 | public static EntityManager getEntityManager() {
if (JPAUtil.factory == null) {
JPAUtil.factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
}
EntityManager m = JPAUtil.manager.get();
if (m == null) {
m = JPAUtil.factory.createEntityManager();
... |
bc2809c1-747c-4377-96ce-7b11f8e78eb7 | 2 | @Override
public void addCandidate(Route route)
{
if (routes.size() == 0 || route.getLength().lessThan(currentShortestLength()))
{
routes.clear();
routes.add(route);
}
} |
8f7574ab-0d4e-47c9-8736-7b42f5201282 | 0 | public String getGame() {
return game;
} |
96d7db99-ab87-43cd-889d-cd229a239f56 | 4 | public void load() {
Spell spell = Spell.loadSpell(ID + "");
nameText.setText(spell.getName());
spellTypeCombo.setSelectedItem(spell.getSpellType());
costSpinner.setValue(spell.getCost());
toggleType();
switch(spellTypeCombo.getSelectedIndex()) {
case(0):
speedSpinner.setValue(spell.getSpeed());
... |
3f3f69ae-128c-4337-872a-bf33026996a3 | 5 | @Override
public void assignOrder(Orders order, Ship target) {
if(_location.isConflicted()) {
JOptionPane.showMessageDialog(_location, "Planet is in a conflicted zone! Can not perform orders!");
}
if(order == Orders.UPGRADE) {
if(target.getLoc() == _location) {
if(target.setUpgrading(true)) {
clea... |
63518e91-cb0c-47ec-9a7d-61e6e4e74140 | 6 | public final static Map<Integer, Path> readExternals(final InputStream in)
throws IOException {
final Map<Integer, Path> map = new HashMap<>();
if (in != null) {
while (true) {
final IntegerPointer available = new IntegerPointer(
in.available());
if (available.isZero()) {
break;
}
w... |
f65938d5-26f8-414b-933e-c8c79d1b687c | 9 | public start() {
super("Overcast Network XML generator");
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[]{1, 386, 0, 0};
gridBagLayout.rowHeights = new int[]{14, 0, 23, 0, 0, 0, 0, 0};
gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
grid... |
e9e848f7-4d6d-474c-bba6-ab4f135cdc99 | 5 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == this)
this.setFocusable(true);
else if (e.getSource() == btnNameInput) {
GameFile.strPlayerName = inputName.getText();
inputName.setVisible(false);
btnNameInput.setVisible(false);
screenCount += 1;
repaint();
this.setFocusable(tr... |
8285ffb6-eda3-49ee-8674-882f7b1925e8 | 5 | private void startAction(int i) {
if (i == 1) {
if (saveFileExists) {
Gdx.app.log(ChromeGame.LOG, "Run Game From Save File");
} else {
Gdx.app.log(ChromeGame.LOG, "Create a New Game");
game.setScreen(new NGIntro(game));
}
} else if (i == 2) {
if (saveFileExists) {
Gdx.app.log(ChromeGame.... |
bae28107-a5a9-45a1-949f-9d61cc2a5d1d | 1 | @Test
public void transferInstrLOAD_testInvalidRegisterRef() { //Checks LOAD instruction not created with invalid register ref.
try {
instr = new TransferInstr(Opcode.LOAD, 50, 70);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);
} |
cbc86f06-f334-4d9f-aa5b-89ab6636745a | 9 | public CuboidDirection opposite() {
switch (this) {
case North:
return South;
case East:
return West;
case South:
return North;
... |
3f094d19-1479-419d-a7f8-6c38c2b872ef | 9 | static private DOMNode buildEntrySignature(Entry entry) {
String name = entry.getName();
Annotation annotationType = entry.getAnnotationType();
boolean isStatic
= annotationType == Annotation.STATICMETHOD ||
annotationType == Annotation.STATICPROPERTY
? true... |
fa1d8e61-ecf7-499a-a457-3ba24cbd08f8 | 2 | public Position huff(){
IteratorOnPieces iterator = (IteratorOnPieces) player.iterator();
while (iterator.hasNext()){
iterator.next();
Position position = iterator.getPosition();
if(player.getBoard().getPiece(position).getHuff()) {
player.getBoard().eliminate(position);
return position;
}
}
... |
1abc9497-ed3e-4c3a-a398-6ef9589d90cb | 8 | public List<Token> getBestTokens(Sentence sentence) throws IOException {
SentenceIterator iterator = sentence.iterator();
int length = iterator.length();
char[] surface = sentence.getCharacters();
// Initialize the Viterbi lattice
this.bosNode = this.tokenizer.getBOSNode();
this.eosNode = this.tokenizer.g... |
01cc9c96-a60d-4995-9019-421c91115ace | 2 | public static String[] searchCustomer(Integer ID) {
Database db = dbconnect();
String [] Array = null;
try {
String query = ("SELECT * FROM customer WHERE CID = ? AND bDeleted = 0");
db.prepare(query);
db.bind_param(1, ID.toString());
ResultSet rs ... |
143c7c6b-1267-4871-b60f-1a8477406bba | 2 | public boolean exists(String path){
URL imgurl = getClass().getResource(path);
if(imgurl!=null){
try {
ImageIO.read(imgurl);
} catch (IOException ex) {
return false;
}
return true;
}else{
System.err.print... |
2de3d94b-de64-4e82-8b7b-26c50a826b83 | 6 | protected NetQuery(String serviceURL, String query, byte queryType, String defaultGraph, int timeout) {
String urlString = null;
try {
queryString = query;
char delim=serviceURL.indexOf('?')==-1?'?':'&';
if(queryType==Query.UPDATE_TYPE)
urlString = serviceURL;
else {
urlString = serviceURL + del... |
8a0134ae-d4a8-461f-a535-b35f79c8d895 | 2 | synchronized public void setShortestHistory(List<Integer> shortestHistory) {
if (this.shortestHistory.size() == 0
|| shortestHistory.size() < this.shortestHistory.size()) {
this.shortestHistory = shortestHistory;
}
} |
4f0ec9e5-dcae-4165-9d90-c4663d9b17f1 | 4 | private void fireAt(ScannedRobotEvent event) {
if (event.getName().equals(Observer.TARGET)) {
if (NearestNeighborSelector.disabledBotExists()) {
this.bulletPower = Rules.MIN_BULLET_POWER; // set bullet power to min, and snipe disabled robot
} else if (event.getDistance()... |
16299fbd-6b45-4051-afa0-96fdeb6694eb | 2 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ProtocolElem other = (ProtocolElem) obj;
return Objects.equals(this.id, other.id);
} |
8ca1893c-a502-472b-9585-a10d8a090e21 | 1 | protected static StringBuilder removeNewLineSignFromEnd(StringBuilder text) {
if (text.charAt(text.length() - 1) == '\n') {
return new StringBuilder(text.substring(0, text.length() - 1));
} else {
return text;
}
} |
7e144fb0-11cf-4666-a6e5-a091d36ab30c | 4 | public void insert() throws ESellException
{
//Prfen, ob Email schon vorhanden ist
if(!isUserFree(this.email, this.username)){
throw new ESellException(ESellException.ErrorCode.USR_EXISTS);
}
makeConnection();
PreparedStatement preparedStatement = null;
ResultSet res = null;
if(co... |
eeb38ee5-ffde-4646-a83f-1861078a6480 | 5 | private void callAction(UserAction userAction) {
switch (userAction) {
case ADD_NEW_OWNER: callAddNewOwnerAction(); break;
case ADD_NEW_CAR: view.printNoSupport(); break;
case GET_OWNER_BY_ID: view.printNoSupport(); break;
case GET_CAR_BY_ID: view.printNoSupport()... |
cb0e80b1-39cc-4f38-aa70-f5ad4e2e9c1a | 7 | private static Operation interpretNextCommand(Scanner scanner) throws FactoryException {
String command = scanner.next();
if (command.equals("print")) {
System.out.println(image.toString());
} else if (command.equals("printsaved")) {
if (saved.size() == 0)
... |
a30e4cce-bf99-4910-ad7b-5e8e85bd8928 | 4 | @Override
public Double get(int i) {
switch (i) {
case 0: return w;
case 1: return x;
case 2: return y;
case 3: return z;
default: throw new IndexOutOfBoundsException();
}
} |
1d8ec966-7f09-465d-8144-c16f1e7c2a00 | 5 | public void shoot() {
// kornyezo mezook elkerese
List<Field> fieldList = new ArrayList<Field>();
fieldList = field.getNearByRoads(range);
shootableCharacters.clear();
// visitable objektumok vegigjarasa
for (Field f : fieldList) {
for (Visitable v : f.getVisi... |
fa50cf24-96fb-49da-9c61-7390ae88a912 | 3 | public void mouseClicked(int mouseX, int mouseY) {
//Send mouseClick to each object.
//NOTE: for-each caused concurrentModificationException
//because it was adding items to screenObjects
//at some point
for (int i = 0; i < screenObjects.size(); i++) {
ImageButton obj = screenObjects.get(i);
obj.mous... |
1b88b007-cc78-489c-8480-35400a71084c | 0 | private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
//Se cierra la interfaz de abrir
setVisible(false);
}//GEN-LAST:event_btnCerrarActionPerformed |
9916c121-78e7-4a0c-a35c-2e8482887751 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
cb1ccda3-91a3-4139-b6ed-cb9406dd8f0f | 9 | private IStatus doRedo(IProgressMonitor monitor, IAdaptable info,
IUndoableOperation operation) throws ExecutionException {
IStatus status = getRedoApproval(operation, info);
if (status.isOK()) {
notifyAboutToRedo(operation);
try {
status = operation.redo(monitor, info);
} catch (OperationCanceledE... |
44b33049-098a-4296-bbc5-e229919ec6a1 | 0 | public String getName() {
return name;
} |
e02aab83-8a80-4188-8c19-ab3f79df61c3 | 0 | public void eatFuel() {
AbstractMachine.this.fuelLevel -= coef;
// fuelLevel -= coef;
} |
c41b9241-5390-4579-a33a-40857832f6bd | 8 | public int estimateTimeOut(int[] from, int[] to, int[] len) {
Integer l = from.length;
int[] tmp = new int[l];
for (int i = 0; i < l; ++i) {
tmp[i] = to[i];
}
Arrays.sort(tmp);
int idx;
for (int i = 0; i < l; ++i) {
idx = Arrays.binarySe... |
451840e8-2d50-423b-bbb2-5f1c28d0f782 | 2 | private String nextSiteId() {
// TODO: replace this linear search with binary search
double r = random.nextDouble();
for (Map.Entry<String, Double> entry : siteWeights.entrySet()) {
if (r < entry.getValue()) {
return entry.getKey();
}
}
// Unreachable if siteWeights is created co... |
6d8da2a1-16a0-4d90-8650-0b16b0d09a26 | 9 | @Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
String applicationPath = getServletContext().getRealPath("/WEB-INF/classes");
String fileName = config.getInitParameter(CONFIG_FILE_PARAMETER);
databaseProperties = new Properties();
... |
cf13a958-a8db-488a-835d-f73304166d9d | 0 | @Override
public String toString()
{
return "isInterface()";
} |
8d0957c5-1ca9-4a35-8b11-e58222ed5ac7 | 7 | public void Tick()
{
//testDialog.sendMessage("TickMessage!");
Object o = testDialog.pollMessage();
if(o != null) System.out.println(o);
// ====== PROCESS NETWORK MESSAGES ======
while(networkMessages.size() > 0)
{
// No need to check whether message retrievel was successful,
// due to the fact th... |
41d60ff6-6ec6-4384-8702-c113e320dcda | 3 | public static void printerTest() {
DocFlavor myFormat = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
PrintService[] printers = PrintServiceLookup.lookupPrintServices(myFormat, aset);
for (PrintService printService : printers... |
b05d39a0-835a-468f-ad84-697c249ed21b | 3 | public int pop() {
if (index == 0) {
// error, the stack is empty
return Integer.MAX_VALUE;
}
int value = array[index - 1];
index--;
return value;
} |
43b0b237-4a25-4122-ac2f-5e6bf2f5afda | 9 | public static void main(String[] args) {
int matriceA[][] = {{ 1, 2, 3, 4, 5},
{ 6, 7, 8, 9, 10},
{11, 12, 13, 14, 15}};
int matriceX[] = new int[matriceA.length];
int matriceY[] = new int[matriceA[0].length];
int i;
... |
15481dd3-df84-4a99-abdf-60bbc6b4d3da | 7 | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (name.equals(NAMESPACES)) {
checkNotParsing("feature", name);
namespaces = value;
if (!namespaces && !prefixes) {
prefixes = true;
}
} else if (name.equals(NAMESPACE_PREFIXES)... |
c4b80f36-bbbf-4531-b83f-62dfbb2d418f | 9 | public void checkAdd(){
ArrayList newCode = new ArrayList<String>();
String aux1 = ""; String aux2 = "";
boolean inRange, entro;
int sum = 0; int n = 0;
for (int i=0; i<code.size(); i++) {
entro = false;
aux1 = code.get(i);
inRange = (i+8)<code.size();
if(inRange) {
if(code.get(i).indexOf("li... |
38d72c41-8668-41c4-af61-1667e54b6395 | 0 | public double getyCoordinate() {
return yCoordinate;
} |
7e61ed86-6186-4363-991b-c708f8dccb62 | 6 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
EntityManager entityManager = null;
try {
entityManager = factory.createEntityManager();
EloPersistence persistence = new EloPersistence();
persistence.setEntityManager(entityMan... |
55a22268-ea0e-484f-8adb-feac69720f3e | 8 | protected boolean appliesToPressed(KeyEvent e) {
// only match special characters if the modifiers are consistent
if (!characterDef) {
if (!((ctrlDown && e.isControlDown()) || !ctrlDown))
return false;
if (!((altDown && e.isAltDown()) || !altDown))
return false;
}
return ((!characterDef) && (this... |
667eeacc-f589-4559-a0c1-cd2ec4397ab2 | 0 | @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
unprocessedEvents.add(e);
mouse = e.getPoint();
} |
e1ff97c4-e77d-40d5-bb1d-583c5b1595e7 | 0 | public RegularExpression getExpression() {
return expression;
} |
168db5b7-5ec1-4d61-8f2d-38f505e896de | 2 | @Override
public int matches( char[] sequenceA, int indexA, char[] sequenceB, int indexB, int count )
{
for (int i = 0; i < count; i++)
{
if (sequenceA[indexA + i] != sequenceB[indexB + i])
{
return i;
}
}
return count;
} |
de820287-9d17-455b-90ad-c781bcb53cb5 | 7 | final private Expression evaluatePostfix() throws InvalidInputException
{
Stack<Expression> expressionStack = new Stack<Expression>();
while (this.m_outputQueue.hasNext())
{
Token nextToken = this.m_outputQueue.pop();
if (nextToken instanceof Number)
{
expressionStack.push((Number) nextToken);
} ... |
e974f44c-ee85-4e9a-88a2-4f1993fa8f1f | 1 | @Test
public void getPlacesBookedTest() {
try {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
DiningHall d1 = new DiningHall(24, BigDecimal.valueOf(4.00),
DiningHall.Type.MADRUGADORES);
DiningHall d2 = new DiningHall(24, BigDecimal.valueOf(4.00),
DiningHall.Type.MADRUGADORES);
Cal... |
94e0cd6b-2e34-42c0-ab1b-f4fb8bef5352 | 0 | public void setTerminal(String terminal) {
myTerminal = terminal;
} |
2162ebb3-82d8-40a5-861e-cba68f4a6fd8 | 8 | private void atPlusPlus(int token, ASTree oprand, Expr expr)
throws CompileError
{
boolean isPost = oprand == null; // ++i or i++?
if (isPost)
oprand = expr.oprand2();
if (oprand instanceof Variable) {
Declarator d = ((Variable)oprand).getDeclarator();... |
12c40fde-574a-4016-9af5-7878c7151a6a | 2 | public void updateCognitiveVelocity() {
for(int i = 0; i < velocities.length / 2; i++){
for(int k = 0; k < velocities[i].length; k++){
double normDevDist = calculateNormalisedDeviationDistance(k, positions[i][k], personalBest[i]);
velocities[i][k] = weight * velocities[i][k] + normDevDist;
}
}
} |
772e745d-3db4-4812-9b80-52446db0d6e0 | 9 | public ArrayList<Point> pathFrom(int r, int c) {
path.add(new Point(r,c));
int row = r, col = c;
if(fP.hasExitAt(r, c))
return path;
int bestDist = distances[r][c];
if(isValid(r - 1,c) && distances[r -1][c] < bestDist){
row = r -1;
col = c;
}
if(isValid(r + 1,c) && distances[r + 1][c] < bestD... |
5e3736ea-7ae8-41aa-98c2-90e188ee3f36 | 1 | public CommandHandler(TotalPermissions p) {
plugin = p;
SubCommand[] cmds = new SubCommand[]{
new HelpCommand(plugin),
new DebugCommand(plugin),
new UserCommand(plugin),
new GroupCommand(plugin),
new SpecialCommand(plugin),
new Wor... |
692d68cd-80cf-4910-97d0-b9880097491c | 6 | public static MaplePacket getScrollEffect(int chr, ScrollResult scrollSuccess, boolean legendarySpirit) {
MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendPacketOpcode.SHOW_SCROLL_EFFECT);
mplew.writeInt(chr);
switch (scrollSuccess) {
... |
5884f2bd-387d-427f-9821-235ce98a7af9 | 0 | public Iterable<String> keys() {
Queue<String> queue = new Queue<String>();
collect(root, new StringBuilder(), queue);
return queue;
} |
51ddf69d-6115-4ad9-a143-13802263e482 | 2 | @Override
public void onNotice(String target, IRCUserInfo user, String msg) {
if(target.equals("#" + channelName))
if(user.equals(main.getNick()))
chatLog.append("\nNotice:" + msg.replaceFirst(main.getNick(), "You"));
else
chatLog.append("\nNotice:" + msg);
} |
91a750b5-2d84-4a3b-8357-584f8a274318 | 2 | @Override
public void run() {
long then = System.currentTimeMillis();
while(isRunning) {
try {
sleep(20);
} catch (InterruptedException e) {}
long now = System.currentTimeMillis();
level.update((int) (now - then));
then = now;
}
} |
d5cf10f6-f552-483e-8599-195bb5adf3d7 | 2 | @EventHandler(priority = EventPriority.NORMAL)
public void onBlockPlace(BlockPlaceEvent event) {
if (event.getPlayer() != null) {
if (!event.getPlayer().isOp()) {
event.setCancelled(true);
}
}
} |
63fcac2e-b356-414d-ac4e-43bf7caaf071 | 5 | @GET
@Path("/sent/{macAdr}")
@Produces({"application/xml", "application/json"})
public List<History> sent(@PathParam("macAdr") String macAdr) {
query = em.createNamedQuery("UserMaster.findByMacAdr").setParameter("macAdr", macAdr);
if(!query.getResultList().isEmpty()){
um = (UserM... |
9b8dcd07-76b2-45c8-8004-d3b4ad3b530a | 9 | public static boolean hasPAT(String str){
boolean hasPp = false, hasAa = false, hasTt = false, hasPAT = false;
char[] chars = str.toCharArray();
for (int i =0; i < chars.length; i++){
if (chars[i] == 'P' ){
hasPp = true;
}else if(chars[i] == 'A' ){
... |
68392f40-670b-4424-ac52-b4c05ba3777d | 3 | private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed
if (dadosValidos()) {
if (senhasValidas()) {
try {
salvar();
} catch (ValidacaoException ex) {
_unitOfWork.rollbac... |
9c0ee8e4-848d-461b-bfc7-65b87ebbe4a5 | 9 | @Override
public void actionPerformed(ActionEvent e) {
//Set ip address
if (e.getSource() == ipSetButton) {
ipAddress = ipField.getText().trim();
local.println("IP Address set to: " + ipAddress);
log.setCaretPosition(log.getDocument().getLength());
}
// Handle appleButton action.
if (e.getSource() =... |
affdd83b-cdf4-41f9-b4f5-1dcf3ec08995 | 2 | public void limpiarTablaBuscar(){
try {
DefaultTableModel modelo=(DefaultTableModel) tablaBuscar.getModel();
int filas=tablaBuscar.getRowCount();
for (int i = 0;filas>i; i++) {
modelo.removeRow(0);
}
} catch (Exception e) {
JOpt... |
4aa3806f-2fb9-484f-bc97-0842d62dbc07 | 4 | public boolean registrosi(String fecha,String IP)
{
ResultSet res;
try {
res = st.executeQuery("select IP,Fecha from registro");
while(res.next())
{ System.out.println(IP);
System.out.println(String.valueOf(res.getObj... |
7534b2b8-e753-4db8-9277-a9a4efa8d181 | 9 | public void checkCollision() {
if (rec.intersects(MainClass.rachel.recParent)
|| rec.intersects(MainClass.rachel.recChild0)
|| rec.intersects(MainClass.rachel.recChild1)) {
visible = false;
if (MainClass.rachel.getCurrentHealth() > 0) {
MainClass.setScore(MainClass.getScore() + 1);
MainClass.rac... |
49063c36-9460-4960-83cb-217926a20694 | 3 | public Container createContentPane()
{
tree = new JTree(new FileSystemModel(new File(".")));
MouseListener mouseListener = new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
int selRow = tree.getRowForLocation(e.getX(), e.getY());
tree.getPathFor... |
ee6e15d8-943c-46cd-8c79-c8b0ed489736 | 3 | private static int findMin(boolean useX, ArrayList<Point> convexHull) {
int min = Integer.MAX_VALUE;
int index = -1;
for (int i = 0; i < convexHull.size(); i++) {
int val = useX ? convexHull.get(i).x : convexHull.get(i).y;
if (min > val) {
min = val;
index = i;
}
}
return index;
} |
0e3e168b-ef21-4371-878a-ab551bba4dfe | 2 | @Test
public void testGetExitKey() {
for (Direction dir : Direction.values()){
try {
testTile.getExitKey(dir);
fail("IllegalArgumentException was expected");
}
catch (IllegalArgumentException e){
//this exception was expected
}
}
} |
62e790f5-1fdc-4b9c-92e6-2f3c143c3b26 | 3 | private void updateJailOption() {
switch(model.getJailOptionState()) {
case JAILBREAK:
jailOptionText = "Gefaengnisausbruch";
jailOption.setEnabled(true);
break;
case PAYFINE:
jailOptionText = "Frei kaufen";
jailOption.setEnabled(true);
break;
case DEACTIVATED:
jailOptionText ="Ni... |
5303aefa-d498-4006-8044-48aea81e4d1a | 2 | public void subTropas(int desp,int i,ArrayList<Guerrero> arr){
if(this.espacioGuerreros+1<16+this.nivel*5){
if((Integer)this.tropas.get(desp)-1>=0){
this.oro+=arr.get(i).costo;
this.tropas.set(desp,(Integer)this.tropas.get(desp)-1);
this.espacioGuerreros++;
}
... |
9c7246d0-2498-40d5-9f4b-d70d35be42d9 | 5 | public void run(){
try{
ServerType serverType = server.getServerType();
responseOptions = serverType.process(server, instruction, requestOptions);
if(ActionResult.isSuccessResult(responseOptions))
result = Progress.Result.SUCCESS;
else if(ActionResult.isFailureResult(responseOptions))
... |
2a46e533-9ddd-4b51-8dbd-0eb70197caf2 | 3 | private boolean implementsConfigurationSerializable(Class<?> clazz)
{
System.out.println("implementsSerializable()");
for(int i = 0; i < clazz.getInterfaces().length; i++)
{
System.out.println(clazz.getInterfaces()[i].getName().toString());
if(clazz.getInterfaces()[i... |
c0cdf44e-9dee-4398-b5c7-e8d35bf43c7f | 6 | void heapify( heap q, double[] HeapArray, int i, int n )
{
boolean moreswap = true;
do
{
int left = 2 * i;
int right = 2* i + 1;
int smallest;
if ((left <= n) && (HeapArray[p[left]] < HeapArray[p[i]]))
smallest = left;
else
smallest = i;
if ((right <= n) && (HeapArray[p[right]] < HeapA... |
e02c8ccb-2c12-45c1-b0f8-9bf49434b230 | 4 | public Tache getChallengingTask(Tache[] tasks, int time) {
//On récupère la tâche la plus prioritaire qui "peut se réveiller"
int size = tasks.length;
int flag = 0;
Tache challengingTask = null;
while(challengingTask == null && flag < size) {
if ((tasks[flag].getDernierReveil() <= time) && (tasks[flag].... |
21a86098-8500-4193-b9d6-963793e2fe09 | 9 | public void tick() {
tickCount++;
if (!hasFocus()) {
input.releaseAll();
} else {
if (!player.removed && !hasWon) gameTime++;
input.tick();
if (menu != null) {
menu.tick();
} else {
if (player.removed) {
playerDeadTime++;
if (playerDeadTime > 60) {
setMenu(new DeadMenu());
... |
f28c0ecc-2f33-4fdb-95c3-e7e2f9d46d1c | 2 | public TotalPermissions() {
super();
boolean found = false;
Method[] methods = OfflinePlayer.class.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals("getUniqueId")) {
found = true;
break;
}
}
... |
e03674cc-f572-4035-9d95-c9e1485596fb | 9 | static String quote(String path){
byte[] _path=str2byte(path);
int count=0;
for(int i=0;i<_path.length; i++){
byte b=_path[i];
if(b=='\\' || b=='?' || b=='*')
count++;
}
if(count==0)
return path;
byte[] _path2=new byte[_path.length+count];
for(int i=0, j=0; i<_path.... |
aae1f50c-1113-4625-995c-128889688102 | 4 | public void init(String n,int id){
if(n.equals("Etudiant"))
etat = Etat.Etudiant;
else if (n.equals("Etudiant1")){
etat = Etat.Etudiant1;
try {
this.etudiant = new Etudiant(id);
} catch (SQLException ex) {
Logger.getLogger(N... |
506d93ab-b622-42bf-aabc-e8bb6e033298 | 0 | public String getName() {
return name;
} |
e0cfffa6-f8eb-4592-9d9f-cea3880126be | 9 | protected void floatLoop(RasterAccessor src,
RasterAccessor dst,
int filterSize) {
int dwidth = dst.getWidth();
int dheight = dst.getHeight();
int dnumBands = dst.getNumBands();
float dstDataArrays[][] = dst.getFloatDataArrays... |
4fc41711-4008-45db-b23d-f3a90b17238c | 9 | private void setSecondAspectForJump(String firstAspect) {
if (firstAspect!= null){
//setSecondAspectGroupEnabled(false);
setSecondAspectGroupEnabled(true);
if (firstAspect.equals(AData.L)){
l2.setEnabled(false);
} else
if(firstAs... |
e2e837c4-9322-4a3f-921d-ce871efc0cf7 | 4 | public synchronized void remoteUpdateGUI(byte keyState)
{
if ((keyState & m_controller.FORWARD_BIT) > 0) {
updateDirectionIcon(0, true);
} else {
updateDirectionIcon(0, false);
}
if ((keyState & m_controller.BACKWARD_BIT) > 0) {
updateDire... |
6949c007-fb36-4958-b551-400934cf2299 | 7 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String submitButton = (String) request.getParameter("submit_btn");
int targetQuizID = Integer.parseInt(request.getParameter("target_quizid"));
Quiz quiz = Quiz.getQuizByQuizID(targetQuizID);
in... |
f0d727f4-5433-498e-b7ba-8c7952756689 | 5 | private boolean isOnScreen(AbstractActor a)
{
int rightEdge = x + backImg.getWidth(main.getImageObserver());
int height = backImg.getHeight(main.getImageObserver());
if(a instanceof Block)
{
return (a.getXPos() + a.getWidth() >= x &&
a.getXPos() ... |
6cbbb9d8-fba9-4bfd-9227-c2f05313751e | 6 | public void cargarArbol() {
//inicializo el arbol
inicializarArbol();
//cargo las cuentas hijo
r_con.Connection();
int count = 0;
int aux = 0;
Enumeration e = root1.breadthFirstEnumeration();
while (e.hasMoreElements()) {
par... |
e9e4ff45-caff-4ba3-8871-d60234c8bd3f | 5 | public void convertInstr_index(String instr_index){
int i = Integer.parseInt(instr_index);
String b = Integer.toBinaryString(i);
char[] c = new char[((b.toCharArray().length > 26) ? 26 : b.toCharArray().length)];
System.arraycopy(b.toCharArray(), ((b.toCharArray().length > 26) ? 26 : 0),... |
2aff2b3e-6d74-4551-a3a2-a42f98de8342 | 1 | public void right()
{
switch(Main.Screen)
{
case "inGame":
Main.inGameManager.buttonP(3);
break;
}
} |
eed02cb2-a0cd-45c2-a014-cff5afa3d34a | 8 | public void onUpdate() {
this.lastActiveTime = this.timeSinceIgnited;
if(this.worldObj.multiplayerWorld) {
int var1 = this.getCreeperState();
if(var1 > 0 && this.timeSinceIgnited == 0) {
this.worldObj.playSoundAtEntity(this, "random.fuse", 1.0F, 0.5F);
}
this... |
a4c347f2-c506-48a0-b74d-967c1969f29a | 9 | private int getNormalGoodsPriceToBuy(GoodsType type, int amount) {
final int tradeGoodsAdd = 20; // Fake additional trade goods present
final int capacity = getGoodsCapacity();
int current = getGoodsCount(type);
// Increase effective stock if its raw material is produced here.
G... |
6a2d8b41-0869-4fc6-aa67-8eb4c01d2a70 | 7 | Space[][] openSets(Space sp) {
Space[][] sets = new Space[numOpenSets(sp)][5];
int index = 0;
if (numOpenSets(sp) != 0) {
if (isOpen(board[sp.pos[0]], sp.piece, 1)) {
sets[index] = board[sp.pos[0]];
index++;
}
if (isOpen(getColumn(sp.pos[1]), sp.piece, 1)) {
sets[index] = getColumn(sp.pos[1])... |
d7f61355-2e9c-4164-8ef5-409dd70e594d | 0 | public Joining(String alias) {
station = alias;
} |
9d26e5f4-78ba-4708-a834-2ea415cb424c | 9 | public int getArrayIndex(int... ind) {
if(ind.length == indexDim) {
if(ind.length == 1) {
return ind[0];
}
if(ind.length == 2) {
if(this.checkIndex(0, ind[0]) == false ||
this.checkIndex(1, ind[1]) == false) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.