method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
41809289-add2-4af9-bb50-09f82b7df377 | 9 | @Override
public boolean condition(Event E) {
if (E instanceof ContextEvent){
ContextEvent event = (ContextEvent)E;
if (event.getContext() == context){
if (event.getContext().isEnabled()){
if(!event.getContext().isStalled()){
// Can't list duplicate entries for instructions re-executed due t... |
7ec45835-d8f2-4b5b-86a5-0792bdb27ed5 | 8 | public static ArrayList<Command> addPossibleBoxCommandsForDirection(
dir direction, Field agentLocationInPlan, Field boxLocationInPlan,
Collection<Field> blockedFields) {
ArrayList<Command> possibleCommands = new ArrayList<Command>();
// Find possible pull commands
for (dir d : dir.values()) {
// we ca... |
6b8fd2e7-6a85-4805-8db6-f3b5f1834c2e | 6 | @Override
public void stopService() {
for (Communicator comm : clients.getClients()) {
try {
comm.sendData(new Message(GlobalConstants.ID_SYS_MSG, SystemMessageHeaders.LOGOUT, null));
} catch (ConnectionException ex) {
LOG.warning("Client connection ti... |
b99b6ea9-54ef-40dd-b2bf-838803612e9e | 2 | public void InsertarImagen(ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca.insert... |
4d4531c9-7295-4d7a-a55c-f8b40e6dfb40 | 2 | public void remove(CollidableObject collidableObject)
{
Iterator<CollidableObject> i= collidableList.iterator();
int index=0;
while (i.hasNext())
{
if (i.equals(collidableObject))
{
collidableList.remove(index);
break;
}
index++;
}
} |
794309e4-1c80-4b46-affd-aa8241541773 | 3 | @Test(expected = BeanstreamApiException.class)
public void invalidAmountVoidPayment() throws BeanstreamApiException {
CardPaymentRequest paymentRequest = getCreditCardPaymentRequest(
getRandomOrderId("PEDRO"), "90.00");
PaymentResponse response = null;
try {
response = beanstream.payments().makePayment(... |
46dce3fe-4483-4963-9211-8969157e5f00 | 1 | private void showFeedbackArea(Map<String, Object> state) {
@SuppressWarnings("unchecked")
List<String> feedbackHistory = (List<String>)state.get(FEEDBACKHISTORY);
this.feedbackArea.clear();
if (feedbackHistory != null){
this.feedbackArea.add(this.createFeedbackPanel(feedbackHistory));
}
} |
185ef9f4-1b33-4713-8824-b56831e45d63 | 6 | public boolean isPalindrome(int x) {
if (x < 0) {
return false;
}
int digit = 0;
int num = x;
while (num != 0) {
digit++;
num /= 10;
}
int length = digit;
while (digit >= length / 2) {
num = x;
... |
3c80f474-a7ac-49c4-a339-bbf05d793322 | 0 | public static void main(String[] args) {
System.out.println(NumberToText(100282));
} |
fca7f133-fffc-4894-b478-0e342c3d3420 | 3 | public Node encode(Object obj)
{
Node node = null;
if (obj != null)
{
String name = mxCodecRegistry.getName(obj);
mxObjectCodec enc = mxCodecRegistry.getCodec(name);
if (enc != null)
{
node = enc.encode(this, obj);
}
else
{
if (obj instanceof Node)
{
node = ((Node) obj).cl... |
1f4eee12-72c6-4c94-82da-44ed8379a69d | 9 | public void print ()
{
out.println ("\n Table " + name);
out.print ("|-");
for (int i = 0; i < attribute.length; i++) {
out.print ("---------------");
}
out.println ("-|");
out.print ("| ");
for (String a : attribute) {
out.printf ("%1... |
9088ff2b-48cb-49be-93b5-4d72599c0f5f | 0 | public void setDeptId(int deptId) {
this.deptId = deptId;
} |
40649821-8aeb-4494-803e-11b2cb67c361 | 5 | void initializeToolBar() {
toolbar = new JToolBar();
f_new = new JButton();
f_new.setIcon(new javax.swing.ImageIcon(getClass().getResource("/frontend/resources/new.png"))); // NOI18N
f_new.setToolTipText("New File");
f_new.setBorderPainted(false);
f_new.setFocusable(f... |
1bb23df5-1fb8-4b91-b00f-7d000fc9c880 | 5 | private String readNextLine() throws InvalidCommandException {
logger.trace("Attempting to read next line");
if (reader == null) {
if (!processQueue.isEmpty())
loadNextReader();
else
return null;
}
String line = null;
try {... |
4cc5d1b1-978e-4fab-b391-4de454031dc3 | 9 | public boolean execute()
{
long time = peersim.core.CommonState.getTime();
if ((time % epoch) == 0) {
initvar = -1.0;
}
/* Initialization */
final int len = Network.size();
IncrementalStats stats = new IncrementalStats();
/* Compute max, min, average */
for (int i=0; i < len; i++) {
Node node = Network.g... |
2b3f8c6e-ffd7-4453-bd26-707a0ff046ec | 1 | @Override
public Class<?> getDataType() {
return BlankData.class;
} |
3cd76a39-9b2d-42ec-84d6-ff1e0f0bd922 | 5 | @Test
public void testDeleteElement() {
int blockSize = 100;
int keySize = 4;
int numIndexPairs = 300;
AbstractBlockBasedIndex<?> index = createIndex(tempFolder, keySize, blockSize);
IndexPair[] indexPairs = new IndexPair[numIndexPairs];
for (int i = 0; i < numIndexPairs; i++) {
byte si... |
88628bf4-cd9e-4503-9489-37044d6795e9 | 2 | private static double[] generateWave(Double rate, double... freqMagPhase) {
double[] data = new double[TWO_POWER];
for (int fm = 0; fm < freqMagPhase.length; fm += 3) {
double frequency = freqMagPhase[fm];
double magnitude = freqMagPhase[fm + 1];
double phase = freqMagPhase[fm + 2];
for (int t = 0; t <... |
1aa2a857-04df-4a99-b0a1-99bc648b26fe | 8 | public void paint(Graphics g) {
Graphics g2d = (Graphics2D) g;
// g2d.drawString("Hello", 50, 50);
// g2d.fillOval(250, 250, diskSize, diskSize);
java.awt.Color white = java.awt.Color.WHITE;
java.awt.Color black = java.awt.Color.BLACK;
int initial_x = 50;
int initial_y = 50;
g2d.setColor(black);
for (... |
424f06bc-2e78-4790-a472-4438ed920e94 | 1 | private static String toString(double value) {
String result = Double.toString(value);
if (result.endsWith(".0")) { //$NON-NLS-1$
result = result.substring(0, result.length() - 2);
}
return result;
} |
5a2df076-9e60-46bb-a514-b1c0d1c8304b | 2 | void parseETag() throws java.lang.Exception
{
String name;
name = readNmtoken(true);
if (name != currentElement) {
error("mismatched end tag", name, currentElement);
}
skipWhitespace();
require('>');
if (handler != null) {
handler.endEl... |
55601a4a-59ef-49d6-9a21-8303f441d349 | 5 | @Override
public int insertCustomer(Customer customer) {
String sql = "INSERT INTO customer (forename, surname, house_no, "
+ "street, postcode, email, balance, card_no, cust_password)"
+ " VALUES ('" + customer.getForename() + "', '"
+ customer.getSurname() + "', '"
+ cust... |
7d4774f4-8897-40f0-b5db-bc91d4fa011f | 8 | public void insertarIconos(){
if(contadorMinas==1)
this.setIcon (uno);
if(contadorMinas==2)
this.setIcon(dos);
if(contadorMinas==3)
this.setIcon(tres);
if(contadorMinas==4)
this.setIcon(cuatro);
if(contadorMinas==5)
this.setIcon(cinco);
if(contadorMinas==6)
this.setIcon(seis);
if(contado... |
c0c42133-6081-46bd-8328-1b83fe0cdf7c | 9 | public void gameLoop()
{
Scanner s = input;
boolean done = false;
MultiRummy nr = null;
gc = null;
nr = new MultiRummy();
System.out.printf("Connect address: %s\n", nr.getConnectString());
do
{
System.out.printf(">> ");
String cmd = s.nextLine();
int i;
Matcher m = null;
for (i ... |
3149e7ca-23c8-42c9-9f06-6bd69021dd12 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
04568e3e-40cb-4f22-a7d1-9e6cbcd06e2d | 5 | public boolean equals(Object other) {
if (other == null)
return false;
if (other == this)
return true;
if (!(other instanceof Vector))
return false;
Vector otherVector = (Vector) other;
if (otherVector.x == x && otherVector.y == y)
return true;
return false;
} |
5a234bd2-52a4-40f4-af83-037b73145886 | 4 | @Test(groups = { "Integer-Sorting", "Primitive Sort" })
public void testInsertionSortInt() {
Reporter.log("[ ** Insertion Sort ** ]\n");
try {
testSortIntegers = new InsertionSort<>(
primitiveShuffledArrayInt.clone());
Reporter.log("1. Unsorted Random Array\n");
timeKeeper = System.currentTimeMill... |
2a28db44-3f18-4a1c-a642-92cb1d235f12 | 2 | private static URL url(String str) {
try {
str = URLEncoder.encode(str, ENCODING);
} catch (UnsupportedEncodingException e) {
return null;
}
URL url = null;
try {
url = new URL(apiurl + apikey + "&target=" + lang + "&q=" + str);
} catch (MalformedURLException e) {
return null;
}
return url;
... |
4112bd00-b25f-453d-93ba-2e0cc0e417d2 | 9 | public int colisionesMisDisparosConList(List list) {
int colisionesMortales = 0;
Iterator<Disparo> itDisparo = disparos.iterator();
try{
while(itDisparo.hasNext()){
Disparo disparo = itDisparo.next();
Iterator<Solido> itSolido = list.iterator(); ... |
2f7d0c61-0fc9-47ff-94bd-0d2dc675dc55 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected!=null)&&(affected instanceof MOB)&&(tickID==Tickable.TICKID_MOB))
{
final MOB mob=(MOB)affected;
if((target==null)
||(mob.location()!=target.location())
||(!CMLib.flags().canBeSeenBy(target,mob)))
{
aborted = true;
u... |
b7fa8b6c-eb45-437f-990d-cf1f9d7f380d | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractPuzzle other = (AbstractPuzzle) obj;
if (counter != other.counter) {
return false;
}
if (difficulty != other.dif... |
4ae86550-f775-4a9f-a342-5086d7443e60 | 9 | @Override
public void perform(ISConnection connection, Map<String, String> params) {
List<String> keys = new ArrayList<String>();
keys.add("folder");
keys.add("file");
keys.add("nazev");
keys.add("popis");
keys.add("njmeno");
keys.add("opt");
boolean ... |
b7c3ddf8-b723-430b-ace0-9c58e5e6dc6c | 1 | @Override
public void run() {
try {
sendBlockMangerData();
} catch (Exception e) {
EIError.debugMsg("Error Receiving Block Manager Data..." + e.getMessage());
}
} |
2531068a-1752-4603-8070-5364efe11a17 | 6 | protected boolean toggleFeature(Features feature) {
switch (feature.getValue()) {
case 1: return setRoad(!road);
case 2: return setRailroad(!railroad);
case 3: return setIrrigation(!irrigation);
case 4: return setVillage(!village);
case 5: return setCi... |
b2766d87-341c-4ccb-92f4-59cf1babd83b | 4 | @Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
int leagueYear;
String LeagueTitle = request.getParameter("title1");
String LeagueSeason = request.getP... |
e18eb024-c7c7-422e-80bd-376644289b33 | 8 | public int calLCSLength(char[] X, char[] Y){
if (X== null || Y == null ) return -1;
int m = X.length;
int n = Y.length;
c = new int[m+1][n+1];
b = new char[m+1][n+1];
for (int i = 0; i < m; i++) {
c[i][0] = 0;
}
for (int j = 0; j < n; j++) {... |
5da52aa9-4425-4de0-80dd-271251212755 | 2 | public void addForceFieldToConnection(ForceField forceField) {
if (forceField == null)
throw new IllegalArgumentException("The given forcefield for the forcefieldconnection can't be null!");
if (this.forceFields.contains(forceField))
throw new IllegalArgumentException("The given forcefield is already added in... |
98ed7202-a50d-481e-96da-f306c79ea33b | 2 | @Override
public void Consultar() throws SQLException
{
try
{
Conexion.GetInstancia().Conectar();
ResultSet rs = Conexion.GetInstancia().EjecutarConsulta("SELECT TipProSer_Descuento,Des_Descuento,Porcen_Descuento FROM Descuento WHERE Id_Descuento ='"+ObDecuento.getId_Des... |
ff32478f-7d0a-401b-acec-1a70838fc607 | 6 | public void RemovePlayer(Player player) {
if (Creator.ID == player.ID && (CurrentGameStatus == GameStatus.WaitingForPlayer || CurrentGameStatus == GameStatus.FirstRoundPlacing) || Players.size() == 1)
Finish();
else
player.PlayerStatus = PlayerStatus.Undefined;
if (_spi... |
0458ec3d-5f82-46eb-bd07-f5d3dc23621c | 8 | protected void setGapSequence(String newGapSequence, int whichGapSequence) {
int sLen = 0;
switch (whichGapSequence) {
case GAP_ONE:
sLen = m_s1_size;
break;
case GAP_TWO:
sLen = m_s2_size;
break;
default:
System.err.pr... |
4262ded0-dd9a-4768-b899-b04f047f9795 | 0 | @Test
public void out_a_car_when_in_a_car() {
Car car = new Car();
Ticket ticket = manager.in(car);
Assert.assertSame(manager.out(ticket), car);
} |
f39e0649-e659-4911-b851-50bf37b2143d | 7 | private static Comparator<ContentObject> getContentObjectSizeComparator() {
if (contentObjectSizeComparator == null) {
contentObjectSizeComparator = new Comparator<ContentObject>() {
@Override
public int compare(ContentObject o1, ContentObject o2) {
if (o1 == null || o2 == null || o1.getCoords() == nu... |
e47f9cd9-b3f8-463d-8768-8627ef366f3d | 0 | public JButton getButtonCancel(){
return buttonCancel;
} |
8bbc06b1-3e8b-4b9a-8ef1-d48f5b4fffe2 | 1 | private int evalState(State s) {
if (me.equals("red"))
return s.getnRed() - s.getnBlue();
return s.getnBlue() - s.getnRed();
} |
912e0e78-e3e7-4b10-9b5f-22151f19976d | 8 | public void playercommand(String commandWord,Command command,Parser parser,boolean wantToQuit) throws IOException{
if (commandWord.equals("help")) {
printHelp(parser);
} else if (commandWord.equals("quit")) {
wantToQuit = quit(command);
} else if (commandWord.equals("take")) {
playerTake(command);
} e... |
bf1e5415-b0f5-4479-bb30-c04dceca9235 | 3 | public static void main (String [] args) {
Socket s = null;
InputStreamReader input;
BufferedReader b;
PrintWriter p;
String result = null;
InputStreamReader stdin;
BufferedReader console;
String line = null;
try {
s = new Socket(Utils.REGISTRAR_ADDR, Utils.FAULTMNGR_PORT);
s.setKeep... |
b29d3d3a-f90d-4a0a-a2d6-ba6d448eef3f | 3 | public Enemy getEnemy(int ID){
ArrayList<Enemy> enemies = actualRoom.Enemies;
int i=0;
while(enemies.get(i).getEnemyID() != ID && i < enemies.size()) ++i;
if(i < enemies.size()) return enemies.get(i);
else return null;
} |
8d653171-b642-4e69-b0b1-b46710fdda43 | 7 | void removeDev (DeviceImpl dev)
{
synchronized (devices) {
DeviceImpl d = devices [dev.getAddress () - 1];
int i;
if (d == null || d != dev)
return;
i = d.getAddress () - 1;
devices [i] = null;
if (root == i) {
root = -1;
if (Linux.trace)
System.err.println ("bus root hu... |
59da7601-2769-4e09-b65c-8c63be466ddd | 9 | public Vector[] generatePath() {
int xP = begin.getX(), yP = begin.getY();
Vector v = new Vector(begin, end);
Directions[] baseDirections = Direction.getDirectionByVector(v).isStraight() ? new Directions[] { Direction.getDirectionByVector(v) } : Direction.getDirectionByVector(v).split();
Directions xD = baseDir... |
d79e4c0b-89ac-468c-a001-3b1a49841276 | 4 | public ModelInfo dupe()
{
ModelInfo mi = new ModelInfo();
if (author != null)
mi.author = new String(author);
if (name != null)
mi.name = new String(name);
if (source != null)
mi.source = new String(source);
if (modelNumber != null)
mi.modelNumber = new ... |
401433fc-3263-4378-9774-0748fec545ea | 1 | public void connexionServeur() throws IOException {
connexion.envoyer("INIT");
if((reponse = connexion.recevoir()).equals("200 READY")) {//200 READY
reponse = connexion.recevoir();//ID CONTROLEUR + JSON LIGNES
int idControleur = 0;
Main.controleur.setId(idControleur);
}
} |
9c5f6bde-6c17-49e2-8688-d62010f379b3 | 2 | @Override
public boolean isFull() {
for (int i = 0; i < buffer.length; ++i) {
if (buffer[i] == null) {
return false;
}
}
return true;
} |
baf191e2-5a87-4f7b-993a-15848d1d6190 | 0 | public void IncrementTotalPassangersTransported()
{
//increment passenger onboard
totalPassengersTransported += 1;
} |
e1c17d3d-24a3-4187-a299-6871693f0fc3 | 6 | private void button_remove_red_listMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_remove_red_listMousePressed
if(frame_index_selected!=-1)
{
if(current_frame==null)
{
Element new_frame = hitboxes_doc.createElement("Frame");
new_frame.setAttribute("n... |
7e51aa1e-aff2-40d1-aac4-0660b190d386 | 3 | public boolean findAtWest(int piece, int x, int y){
if(y==0 || b.get(x, y-1)==EMPTY_PIECE) return false;
else if(b.get(x, y-1)==piece) return true;
else return findAtWest(piece,x,y-1); // there is an opponent
} // end findAtWest |
8f6e8cb9-e084-4ebe-bcb8-3173715d2921 | 8 | final public void Assignment_expression() throws ParseException {
/*@bgen(jjtree) Assignment_expression */
SimpleNode jjtn000 = new SimpleNode(JJTASSIGNMENT_EXPRESSION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
Le... |
0e992431-0879-4b05-aaf0-d6754f003524 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidadElementos()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
e7765d3f-3a69-4bd0-8b41-e32d077aa12b | 3 | private ArrayList<Couple> comptage()
{
ArrayList<Couple> resultats = new ArrayList();
ArrayList<String> lettre = new ArrayList();
for(int i=0; i<this.longueur_texte; i++)
{
if(lettre.isEmpty() == false)
{
int test = lettre.indexOf("" + this.text.charAt(i));
if(test != -1)
// Le cas o�test es... |
a1495894-885b-4c3b-baad-add698313da9 | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (; ; ) {
StringTokenizer st = new StringTokenizer(in.readLine().trim());
int P = parseInt(st.nextToken()), V = parseInt(st.nextToken()), E = parseInt(st.nextToken());
if(P=... |
8e593b15-980b-4fe3-b01e-bdcecbf565af | 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... |
dfb892b0-9b09-47c5-8353-2fcdea539dcc | 0 | public int getState() {
return state;
} |
d1a1ce30-c07c-42ff-8748-0e2e1ad59b8d | 8 | private PublicKey loadPublicKey(Object publicKeyObject, boolean isCert)
throws IOException, GeneralSecurityException {
PublicKey publicKey;
if (publicKeyObject instanceof PublicKey) {
publicKey = (PublicKey)publicKeyObject;
} else if (publicKeyObject instanceof X509Certificate... |
59d52291-c9de-446c-b6a4-1fb9d657a4c3 | 8 | public Dot move(String[] grid, int current_r, int current_c, Direction direct) {
Dot newDot = null;
newDot = new Dot();
switch (direct) {
case UP:
newDot.rowNum = (current_r - 1);
newDot.columnNum = current_c;
break;
case D... |
19c38fff-7305-480d-b374-875dbeccc70f | 8 | public void render(Bitmap b) {
if(dir == 0) {
ImageManager.renderFromImage(entityType, b, (int)x, (int)y, ((animation_frame == 0) ? 1 : 0), 16);
} else if (dir == 1) {
ImageManager.renderFromImage(entityType, b, (int)x, (int)y, 2 + ((animation_frame == 0) ? 1 : 0), 16);
} else if (dir == 2) {
ImageManage... |
4b1e0979-670a-40ca-89a7-61de626cfd7e | 3 | public void checkWin()
{
boolean win = true;
for(int i = 0; i<numEnemy; i++)
if(enemy[i].alive)
win = false;
if(win)
{
lp.level++;
lp.updateLabels();
numEnemy+=2;
reset();
}
} |
c718e12c-4414-49c4-8af1-1720827295e9 | 2 | public static Ontology getOntologyObject(ExtendedIterator<Ontology> ontologies) {
Ontology o = null;
if (ontologies.hasNext()) {
o = ontologies.next();
}
if (ontologies.hasNext()) {
log.warn("More than one ontology object was found.");
}
return o;... |
1529fd41-af0c-4e59-bbc5-7f932f33dd36 | 6 | public synchronized static String getPlayerStatus(String uIP) {
String msg = "GET_PLAYER_STATUS PLAYER_NOT_FOUND";
NodeList nList = doc.getElementsByTagName("player");
Element player = getPlayerElement(uIP, true);
if (nList != null && player != null) {
if (player.getParentNode().getNodeName()
.equals("... |
5a8058c7-1598-4395-b311-1ec469f5a267 | 3 | public void swapInventory(int from, int to) {
inventory.swapInventoryLocations(from, to);
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.NONE && registry.getNetworkThread() != null) {
if (registry.getNetworkThread().readyForUpdates()) {
... |
0ac19882-33ab-4038-9ec3-8ce601ce99e4 | 9 | public void runGameTimedSpeedOptimised(Controller<MOVE> pacManController,Controller<EnumMap<GHOST,MOVE>> ghostController,boolean fixedTime,boolean visual)
{
Game game=new Game(0);
GameView gv=null;
if(visual)
gv=new GameView(game).showGame();
if(pacManController instanceof HumanController)... |
941770f9-bc1c-4d27-bf9e-0604c9d332cd | 4 | @Override
public void handleMessages(Inbox inbox) {
while (inbox.hasNext()) {
Message m = inbox.next();
if (m instanceof PackHello) {
statistic.countHeardMessagesTree();
PackHello msg = (PackHello) m;
System.out
.println("-------------MSG Hello arrive------------------");
System.out.pr... |
f90d808b-8144-4a1e-9fb7-58c213c320f9 | 4 | public boolean verifDeplacementValide(int x, int y, Jeu j){
// On teste si le voleur se déplace en diagonale ou en direction unique :
boolean directionUnique = (x == this.getPositionX() || y == this.getPositionY());
int nbCasesParcourues = 0; // nombre de cases nécessaires à parcourir pour arriv... |
a13f06a4-1fdf-4ee5-a629-76c11695b8a4 | 7 | public void setfocus(Widget w) {
if (focusctl) {
if (w != focused) {
Widget last = focused;
focused = w;
if (last != null)
last.hasfocus = false;
w.hasfocus = true;
if (last != null)
last.lostfocus();
w.gotfocus();
if ((ui != null) && ui.rwidgets.containsKey(w))
wdgmsg("f... |
b0131ed7-c560-4aed-b82e-21c9ceb27ab2 | 5 | @Override
public void init() {
running_as_applet = true;
acontext = getAppletContext();
String s = getParameter("jorbis.player.playlist");
playlistfile = s;
s = getParameter("jorbis.player.icestats");
if (s != null && s.equals("yes")) {
icestats = true;... |
95b0ffbf-7632-44a3-a482-6e94044ade48 | 0 | public void setVille(String ville) {
this.ville = ville;
} |
7276a277-53b5-4ee4-9db0-1989054bb218 | 1 | private static String convertWithDriver(Object parameter) {
try {
return JSON.serialize(parameter);
} catch (Exception e) {
String message = "无法将参数[" + parameter + "]绑定到查询json字符串中";
throw new IllegalMongoShellException(message, e);
}
} |
2b083023-807a-4321-a6d8-2c1291dd18b8 | 3 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Map<String,String> fouten = new HashMap<>();
BigDecimal percentage = null;
try {
percentage = new BigDecimal(request.getParameter("percentage"));
if (percentage.compareTo(BigDeci... |
68ea9e86-12f0-44ae-b34a-68bb2298c424 | 0 | int peekInt() {
return ((Integer) peek()).intValue();
} |
b27c0f46-b2c5-421b-930e-a46b80b8fc01 | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
adacecf4-8d82-43d6-b2e2-175670db41c4 | 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... |
72a7bf4e-3111-4cbf-a51d-84409a1ba956 | 6 | private void convertFileDataToArray(int i, String root) {
// for each time stage file construct array 85 fundamental data
// points for each symbol
float[][] data = new float[dbSet.size()][];
// for each time stage file construct array 7 technical data points
// for each symbol
float[][][] pdata = new float... |
d5ad137a-0da8-46b8-bcd0-a06544dea379 | 3 | public String toString(){
String s="";
for(int y=polyominos[0].length-1;y>=0;y--){
for(int x=0;x<polyominos.length;x++){
if(polyominos[x][y]==1)
s+="X";
else
s+="O";
}
s+="\n";
}
return s;
} |
99f77d8c-9723-452e-b9e2-60f2b56b66de | 6 | public void paintComponent(Graphics g){
super.paintComponent(g);
if(rightHeld){
Driver.pView.imgNum = (Driver.pView.imgNum + 1) % Driver.pView.frameCount;
Driver.player.moveRight();
}
if( leftHeld){
Driver.player.moveLeft();
}
// Spawn enemies based on spawn frequency
if(((Driver.player.getDi... |
ca8a16a0-796d-40cd-8350-74ec7923ace2 | 5 | private int getMinIndex(List<Pair<Integer, mouseNode>> nodes, Pair<Integer, Integer> target, mouseNode init) {
if (nodes.isEmpty()) {
return -1;
}
int minValue = 99999;
int minPos = 0;
for (int i = 0; i < nodes.size(); i++) {
if (nodes.get(i).second == i... |
0320d5cf-3927-4e3b-93f2-403e86e216a6 | 1 | private void generateHardwareSetAlternativesGeneration(int generation) {
for (HardwareSet hws : project.getHardwareSets())
hws.generateHardwareSetAlternativesGeneration(generation);
} |
853e8e8d-c75b-4229-9c20-fa2ccf96e546 | 4 | private void initBoard() {
int last = b.length-1;
for(int i = 0; i < b.length;i++) {
b[i][0] = 4;
b[i][last]=4;
b[0][i] = 4;
b[last][i] = 4;
}
for(int i = 1; i < last;i++) {
b[i][1] = 6;
b[i][last-1]=6;
b[1][i] = 6;
b[last-1][i] = 6;
}
for(int i = 2; i < last -1;i++) {
fo... |
efc9f5c3-b308-4fa1-b209-370cace67427 | 5 | public final ObjectProperty<ToggleGroup> toggleGroupProperty() {
if (null == toggleGroup) {
toggleGroup = new ObjectPropertyBase<ToggleGroup>() {
private ToggleGroup oldToggleGroup;
@Override protected void invalidated() {
final ToggleGroup toggleG... |
081926e1-db6f-4aa8-b2b1-e0e154ef2423 | 9 | public double olbStart() {
sortResources();
sortClass();
calculateWeight();
dmMinminCost = new double[iSite][iCPUMaxNum];
dmMinminTime = new double[iSite][iCPUMaxNum];
double[] daMinminTimeBySite = new double[iSite];
boolean lastActivity;
// find the current cheapest site for the acitvities.
int k =... |
c66bc10e-3f01-4a8c-9caf-d7bd56d8ddaf | 4 | public void paint(Graphics g)
{
super.paint(g);
//Draw the individual elements
for (int i = 0; i < playerList.size(); i++){
g.drawImage(playerList.get(i).getImage(), playerList.get(i).getX(), playerList.get(i).getY(), this);
}
for (int i = 0; i < enemyList.size(); i++){
g.dra... |
5b9c2403-4055-4590-9657-a61a84b909e5 | 1 | private int getMinInd(int pos1, int pos2) {
return heap[pos1] <= heap[pos2] ? pos1 : pos2;
} |
d7fe9ba8-25ad-4faf-bf65-ca82c9f61283 | 1 | public JPanel getWindowMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.windowMenu;
} |
4c4dc37b-4870-46b2-8f96-dc8ce3338a3d | 0 | @Override
public void endDocument() throws SAXException {
super.endDocument();
complete = true;
} |
3b2a97cd-fdf7-44e8-aadf-3e27066064b0 | 8 | public static void main(String [] args) {
try {
Stats ps = new Stats();
java.io.LineNumberReader r = new java.io.LineNumberReader(
new java.io.InputStreamReader(System.in));
String line;
while ((line = r.readLine()) != null) {
line = line.trim();
if (line.equals("") |... |
034ce59e-4160-498d-b4fe-3bc0dbc26be1 | 5 | public Writer write(Writer writer) throws JSONException {
try {
boolean b = false;
int len = length();
writer.write('[');
for (int i = 0; i < len; i += 1) {
if (b) {
writer.write(',');
}
Obj... |
c76ef79c-f3c5-40f8-9d2c-b63bd387080a | 5 | public UIFurnace(EntityPlayer p, TileEntityFurnace tileEntity, World world)
{
this.tile = tileEntity;
this.theWorld = world;
for(int i = 0 ; i < 10 ; i++)
{
this.slots[i] = new UIInventorySlot(BlockyMain.width / 2 - 16 - (32 * 4) - 12 + i * 32 + i + 3, BlockyMain.height / 2 - 32-50 - 3 - 32 - 20... |
b6e62176-ff1a-476f-a86a-f3ae2cc638a5 | 6 | private void bookRoomButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bookRoomButtonActionPerformed
if (roomTable.getSelectedRow() > -1) {
Room chosenRoom = null;
int selectedRowIndex = roomTable.getSelectedRow();
int roomNo = (Integer) roomTableModel.... |
ffcbf3c1-a27b-4a30-a965-6d905c353d81 | 2 | private WorldCoordinate getOtherTrackLocation(WorldCoordinate otherCoord) {
SignalBlock other = getSignalAt(otherCoord);
if (other != null) {
WorldCoordinate track = other.getTrackLocation();
if (track != null)
trackCache.put(otherCoord, track);
return... |
5b65d0cb-b2d9-47cb-ae4b-eb1c898f7284 | 4 | public static void main(String[] args){
//initial stuff used in making the map
int x = 80; int y = 25; int dungeon_objects = 0;
//convert a string to a int, if there's more then one arg
if (args.length >= 1)
dungeon_objects = Integer.parseInt(args[0]);
if (args.length >= 2)
x = Integer.parseInt(args[1... |
936df42d-5747-41cd-a572-45f12295e4b1 | 9 | private void runGibbsSampling() {
for (int i = 0; i < param.nIterations; ++i) {
for (int d = 0; d < param.D; ++d) {
int N = docs[d].length;
for (int n = 0; n < N; ++n) {
// Sample from p(z_i|z_-i, w)
sampleTopicAssignment(d, n);
}
}
if (i >= param.nBurnin) {
if (i == param.nBurnin
... |
c5a76550-518a-4fab-b4a2-3ef409b75415 | 0 | public static void setController(MainController controller) {
mainController = controller;
} |
abc9c013-a1e2-441d-a194-da665045cfd5 | 9 | private List<Opdracht> leesOpdrachtenVanBestand() {
File file = new File("bestanden/opdrachten");
List<Opdracht> list = new ArrayList<Opdracht>();
if (file.exists()) {
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNext()) {
String lijn = scanner.nextLine();
String[] velden = li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.