method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
82f8d718-ced4-4f04-b3cc-95b39f910fc6 | 7 | @Override
public void executeTask() {
/* Redundant code here in the event Server and Client start diverting. */
try {
/* Casting to appropriate object. */
switch (node.NODE) {
case SERVER: {
server = (Server) node;
if (RoutingTable.getInstance().registerServer(server)) {
System.out.println(... |
01f34d3c-f96b-492b-b1bb-474cf2a827da | 2 | public List<Strichart> getAlleStricharten() {
ResultSet resultSet;
List<Strichart> listeStricharten = new ArrayList<Strichart>();
try {
resultSet = db
.executeQueryStatement("SELECT * FROM Stricharten");
while (resultSet.next()) {
listeStricharten.add(new Strichart(resultSet, db));
}
resultSe... |
7de8da3e-dd2a-4a6c-83f5-f7975467b37a | 8 | @Override
protected void initPrototypeId(int id)
{
String s;
int arity;
switch (id) {
case Id_constructor: arity=1; s="constructor"; break;
case Id_toString: arity=1; s="toString"; break;
case Id_toLocaleString: arity=1; s="toLocaleString";... |
a18b72ce-71f6-4ef0-8ad2-b47e5100cf89 | 5 | @Override
public String strip(String s) throws Exception {
int length = s.length();
if (oldChars.length < length + 1) {
oldChars = new char[length + 1];
}
s.getChars(0, length, oldChars, 0);
oldChars[length] = '\0'; // avoiding explicit bound check in while
... |
b28f0fc3-bbf8-480e-9039-480f9c27445d | 3 | public static boolean printText(int textId) {
switch(textId) { // texts taken from http://www.mahnerfolg.de/
case 1:
System.out.printf("Sehr geehrter Herr Kunde,\n" +
"\n" +
"in Bezug auf unsere Rechnung Nr.: %d mussten wir heute feststellen, dass Ihre Zahlung bei uns noch nicht eingegangen... |
91289f32-fc36-4261-a777-aeb591750464 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MessageBus other = (MessageBus) obj;
if (mapSubscriberToTopics == null) {
if (other.mapSubscriberToTopics != null)
return false;
} else ... |
31b1aa8a-d0dc-408d-9e13-1f94ebc18003 | 1 | public boolean commit(){
if(isSetForCommitting()){
session.getTransaction().commit();
return true;
}
return false;
} |
a7e284fc-48bb-4e07-99d4-1a52991211c7 | 1 | public byte[] toByteArray() {
return cw == null ? null : cw.toByteArray();
} |
245e1738-6de0-4959-82b4-93e7a91be21c | 4 | public static Color convertStringToColor(String in) {
Color out = Color.black;
if (in.equals("yellow")) {
out = Color.yellow;
} else if (in.equals("blue")) {
out = Color.blue;
} else if (in.equals("red")) {
out = Color.red;
} else if (in.equals("green")) {
out = Color.green;
}
return out;
} |
79198b4e-32f2-4330-a96d-cbffbb86cf91 | 3 | public void stopGame() {
// Setting isRunning to false will
// make the thread stop (see run())
this.isRunning = false;
// Unset the game model...
this.view.setModel(null);
// Stop listening for events
this.view.removeKeyListener(this.keyListener);
// Make sure we wait until the thread has stopped...... |
14790d01-ebe6-4a82-8f0a-ef73fae491b6 | 4 | public synchronized boolean deleteVar(String key)
{
Utils.logger.log(Level.INFO, "Deletting var " + key);
List<String> oldConfiguration;
oldConfiguration = this.currentConfig;
FileWriter fileWriter;
try
{
fileWriter = new FileWriter(this.configFile, false);
}
catch(final IOException exception)
{
... |
19a4834e-96c7-493b-b948-f6d62b63c272 | 9 | private static void validateAmt(char[][] vMap) {
int manAmt = 0, boxAmt = 0, aimAmt = 0;
for (char[] row : vMap) {
for (char cell : row) {
switch (cell) {
case SokobanMap.AIM_CHAR:
aimAmt++;
break;
case SokobanMap.BOX_CHAR:
boxAmt++;
break;
case SokobanMap.MAN_CHAR:
manAm... |
b87500d1-fcbc-417e-8527-55dede69c19f | 3 | public static boolean deleteFile(File file) {
if (file.isDirectory()) {
String[] children = file.list();
for (int i = 0; i < children.length; i++) {
if (!deleteFile(new File(file, children[i]))) {
return false;
}
}
}
return file.delete();
} |
9a10745c-15ed-4d4c-a661-f74db77df353 | 0 | private String readInput() throws IOException {
return this.keyboard.readLine();
} |
036f4f52-5134-4cd1-b3e4-b1dab458a099 | 8 | @Override
public void actionPerformed(ActionEvent e) {
//System.out.println("ChangeFocusAction");
OutlinerCellRendererImpl textArea = null;
boolean isIconFocused = true;
Component c = (Component) e.getSource();
if (c instanceof OutlineButton) {
textArea = ((OutlineButton) c).renderer;
} else if (c i... |
badffaa6-e2dc-41bc-b859-68e91ff89a9f | 5 | public void printCita(int codpac, int numcita)throws IOException{
if(pacienteExiste(codpac)){
String nompac = rpacs.readUTF();
String citapath = getCitaPath(nompac, codpac, numcita);
File cita = new File(citapath);
if(cita.exists()){
S... |
97f20438-aff1-461c-bd36-7a3cbd413bd2 | 3 | public void render() {
AbstractAlgorithm imgGen;
/*
* Now generate the appropriate image! Done separate to above so will
* re-draw whenever any button is pressed.
*/
double scaleSize = gui.getScaleSize();
int width = (int) (gui.imageWidth() / scaleSize), height = (int) (gui
.imageHeight() / scaleSi... |
2d6af956-1c7e-4733-87b5-5b29a2737270 | 1 | public void setBackLeftTrim(int backLeftTrim) {
this.backLeftTrim = backLeftTrim;
if ( ccDialog != null ) {
ccDialog.getTrim3().setText( Integer.toString(backLeftTrim) );
}
} |
a7abb5f9-5365-4e51-bea3-15ed92ee92ba | 7 | public byte[] gextractEncPayload() {
int i, j, k = 0, n_ent;
int total_size;
byte[] temp;
total_size = gmeasureEncPayload();
if (total_size == 0) return null;
n_ent = encrypted_truth_table.size() ;
// Create a result byte array with the appropriate size
... |
9a7580ff-d4aa-4791-9388-a92163fd8300 | 3 | public ImageIcon getImageIcon(byte imageData[], int size) throws IOException {
if(imageData==null)
return null;
ImageIcon ico = new ImageIcon(imageData);
int h=ico.getIconHeight();
int w=ico.getIconWidth();
if(size<=0)// || (h <= size && w <= size)... |
b7d2570f-20b6-434f-a69c-eb55e3e5807c | 9 | protected void linkProgram(List<VertexAttrib> attribLocations) throws LWJGLException {
if (!valid())
throw new LWJGLException("trying to link an invalid (i.e. released) program");
uniforms.clear();
// bind user-defined attribute locations
if (attribLocations != null) {
... |
00793ac0-1497-41e5-ba0a-f48c64c1023b | 4 | public void SetOver(boolean isOver){
boolean test = false;
if (test || m_test) {
System.out.println("GameWindow :: SetOver() BEGIN");
}
getDrawing().SetOver(isOver);
if (test || m_test) {
System.out.println("GameWindow :: SetOver() END");
}
} |
1b02bef2-9501-42f0-833b-6b1031045ce9 | 8 | private boolean r_postlude() {
int among_var;
int v_1;
// repeat, line 70
replab0: while(true)
{
v_1 = cursor;
lab1: do {
// (, line 70
... |
dc91b24c-2a5c-457a-87b9-05f7d3d09c7a | 9 | public static Vector<String> getAllProxyIPs(String ipLibURL)
throws ClientProtocolException, IOException, URISyntaxException {
Vector<String> IPsPageLinks = getIPsPageLinks(ipLibURL);// "http://www.youdaili.cn/"
Vector<String> onePageIPs = new Vector<String>();
Vector<String> allIPs = new Vector<String>();
f... |
20e12205-4f1c-46d5-b656-49906960e128 | 4 | @Override
public HeightMap applyTo(HeightMap... heightMaps){
double[][] finalHeights = new double[heightMaps[0].getHeights().length][heightMaps[0].getHeights()[0].length];
for(HeightMap heightMap: heightMaps) {
double[][] currentHeights = heightMap.getHeights();
for (int x = ... |
9d107fa6-840b-4d30-8bd3-54c438bda6e3 | 9 | public static boolean isIsomorphic(String one, String two) {
if (null == one || null == two) {
return false;
}
if (one.length() != two.length()) {
return false;
}
if (one.length() == 1) {
return true;
}
Map<Character, Integer> ... |
2ee2484e-1ebe-42cb-9874-a0872d53a2d8 | 6 | public boolean isValidSudoku(char[][] board) {
int i ,j, k = 0;
for (i = 0; i< 3; i++)
{
for (j =0; j<9; j++)
choice[i][j] = new HashSet<Integer>();
}
for (i = 0;i<9;i++)
for (j = 0 ;j< 9 ; j++)
{
if (board[i][j] == '.')
{
k ++ ;
}e... |
837b9057-37a0-4375-9aa0-e29fc51f18b8 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
e2554263-af4c-4163-981c-cd1fa9f2de96 | 7 | protected void saveClusterer(String name, Clusterer clusterer,
Instances trainHeader, int[] ignoredAtts) {
File sFile = null;
boolean saveOK = true;
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
sFile = m_FileChooser.getSelectedFile... |
d80938aa-0dc8-4006-bf6d-8da331049b49 | 3 | public static ArrayList<bConsulta2> getMediaHoras(String data_in, Integer gmp, String arg_prod) throws SQLException, ClassNotFoundException {
ArrayList<bConsulta2> sts = new ArrayList();
Connection conPol = conMgr.getConnection("PD");
ResultSet rs;
if (conPol == null) {
throw... |
1a3b2332-78d0-4221-a7d5-d7d070093d63 | 6 | private Token matchNumber() {
SourcePosition pos = new SourcePosition(lineNo, columnNo);
StringBuilder sb = new StringBuilder();
boolean decimal = false;
int character = lookAhead(1);
while ((character >= '0' && character <= '9') || character == '.') {
if (decimal && ... |
d97ced1d-015b-4043-86c1-806ef635c7a6 | 5 | public static void main(String[] args) {
String ficPropertiesJdbc = "gsbJdbc.properties"; // nom du fichier de properties
Properties propertiesJdbc; // objet de propriétés (paramètres de l'appplication) pour Jdbc
FileInputStream input; ... |
ddfebf49-991d-4f66-85e8-0956c289c379 | 6 | public static int RoomService(Client joueur) {
int tempDette = 0;
int choiceInt = -1;
boolean wrong = false;
System.out.println("Que voulez vous prendre?"
+ "\n pour de la nourriture tapez 1 (20€)"
+ "\n pour de la boisson tapez 2");
do {
... |
223b5381-1c9a-41d5-bf05-38b089223ba0 | 7 | public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
AccessPerfiles accessPerfiles;
try {
accessPerfiles = em.getRef... |
239327d9-4204-404a-966f-1f07968845b7 | 5 | protected void checkForHit(){
if (ballX>=(paddleX-ballSize)) { //check for a hit
if (ballY>=paddleY-ballSize+1 && ballY<=paddleY+paddleLength-1) {
hits++;
dx=left;
dy=0; // this is a direct hit
int paddleCenter = paddleY + paddleLength/2;
int ballCenter = ballY + ballSize/2;
double offset = ballCe... |
15dc3d86-045e-4775-83e5-60e6195e68b7 | 7 | private Individual tournamentSelection(Population pop) {
//Create a tournament population
Individual[] tournament = new Individual[GeneticAlgorithmConstants.TOURNAMENT_SIZE];
//For each place in the tournament get an individual
for (int i = 0; i < tournament.length - 1; i++) {
... |
a57cd6a0-18e6-40d7-9142-0fdfc8874f8a | 6 | @Override
public void onEnable()
{
// Load config
File configFile = new File(this.getDataFolder(), "config.yml");
if(!configFile.exists())
{
configFile.getParentFile().mkdirs();
copy(this.getResource(configFile.getName()), configFile);
}
... |
ecddef6d-9111-4351-925b-80a851e12400 | 6 | private void managementPlanUpdate() {
// TODO add your handling code here:
//create an array of arrays to hold all values in chart form
String tempArray[][];
if (!Stakeholders.isEmpty()){
tempArray = new String[Stakeholders.size()][10];
for (int i = 0; i < Stakeho... |
7388c1a2-9f7a-46e9-8b58-b3090472c607 | 2 | public static double EuclideanDistance(ArrayList<Double> l1, ArrayList<Double> l2){
if(l1.size() != l2.size()){
System.err.print("erro in input size\n");
}
int size = l1.size();
double sum = 0;
for(int i = 0; i < size; i++){
sum += (l1.get(i) - l2.get(i)) ... |
ba7ea0b8-7416-4ed6-9670-b5757abef15f | 3 | private static void remove(CuratorFramework client, String command, String[] args) throws Exception {
if (args.length != 1) {
System.err.println("syntax error (expected remove <path>): " + command);
return;
}
String name = args[0];
if (name.contains("/")) {
... |
8d26ae90-f575-42d2-9510-ced605436e26 | 3 | @Override
public TurnAction next() {
// TODO Auto-generated method stub
TurnAction nextPossibleAction = null;
int checkedRow = currentRow;
int checkedTokens = iteratedState.checkRow(checkedRow)- 1;
boolean searchingForNext = !(checkedTokens >= 0);
while(searchingForNext){
checkedTokens = iteratedState.c... |
d10cb729-92b2-4722-a524-6102cb09be2b | 1 | private static boolean validateStringLength(String param){
boolean isValid = false;
if(param.length() > 0){
isValid = true;
}
return isValid;
} |
9413c52b-96b0-4882-9a21-6e9f449a95a2 | 4 | public static boolean isRequestEnd(byte[] request, int length) {
if (length < 4) {
return false;
}
return request[length - 4] == '\r' &&
request[length - 3] == '\n' &&
request[length - 2] == '\r' &&
request[length - 1] == '\n';
} |
6d038046-5b3f-40de-9c0e-a053ccf658a3 | 5 | public void cargarTabla(int perfil){
System.out.println("tabla");
String[] columnas = getColumnas();
Class[] tipoDatosColumnas=getTipoColumnas();
Vector<Vector<Object>> contenidoTabla = new Vector();
contenidoTabla = getContenidoTabla(perfi... |
14a26221-94dc-4b7c-a88d-2e5da848a27a | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
try {
char c = 'A';
int asc = (int) c;
System.out.println(asc);
String message = null;
fr=new FileReader("MyTextFile.txt");
br =new BufferedReader(fr);
message = br.readLine();
System.out.println(message);
String ... |
20726ac1-3a6c-4922-b75c-d1e23659eb47 | 6 | @Override
public void run(int interfaceId, int componentId) {
if (stage == -1) {
sendDialogue(SEND_2_OPTIONS, new String[] {
player.getDisplayName(), "I'd like to trade.",
"Can you repair my items for me?" });
stage = 1;
} else if (stage == 1) {
if (componentId == 1) {
sendEntityDialogue(SEN... |
68a7b3c2-2f5b-4165-8286-f84af1989eb1 | 7 | public static void main(String[] args)
{
int numero = 0,c = 0;
for (int i = 0; i < 2; i++)
{
numero = Integer.parseInt(JOptionPane.showInputDialog(null, "Ingrese un Número Entero Positivo"));
if (numero > 0)
{
i = 2;
}
... |
b613048a-5287-46db-a960-32b00e9d2b70 | 0 | public double getSpeed(){
return this.speed;
} |
cdda5b87-def9-497e-9928-d1151e556e6d | 1 | void requireWhitespace() throws java.lang.Exception
{
char c = readCh();
if (isWhitespace(c)) {
skipWhitespace();
} else {
error("whitespace expected", c, null);
}
} |
ffe3e177-6ed3-40fc-a263-01b3f7f55cd8 | 8 | public Widget createWidget(Composite parent, int style)
{
String tooltip = getTooltip();
GridData controlGD = new GridData( SWT.FILL, SWT.TOP, false, false );
// label
if ( control.getLabel() != null ) {
label = new Label( parent, SWT.NONE );
label.setText( control.getLabel() );
if ( tooltip != nul... |
54c4f5a7-8eeb-405a-91db-4ceb57d6b121 | 3 | public static IntegrationMethods fromString(String name) {
if (name != null) {
for (IntegrationMethods b : IntegrationMethods.values()) {
if (name.equalsIgnoreCase(b.name)) {
return b;
}
}
}
return null;
} |
debbc55b-70f6-4f2a-a481-a85ae2100638 | 5 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
038b055c-b100-4e0e-ae56-236886b64e52 | 4 | private void HelpInsert(IInfo<T> op){
if(op==null || !(op instanceof IInfo) )
return;
CAS_CHILD(op.p, op.l, op.newInternal,op.stamps.pLeftStamp,op.stamps.pRightStamp);
StateInfo<T> app = op.p.si.getReference();
if(app.isIFlag() && app.info == op){
op.p.si.compareAndSet(app, new StateInfo<T>(StateInfo.CLEA... |
0dff5b7b-1d70-4663-8271-8748b875b52a | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if(object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("false"))) {
return false;
} else if(object.equals(Boolean.TRUE) ||
(object instanceof String &&
((Strin... |
098d76d3-efa0-42ad-a527-4889410d2bcb | 2 | public double score(String dna) {
if (logOdds == null) calcLogOddsWeight();
char bases[] = dna.toCharArray();
double score = 0;
for (int i = 0; i < bases.length; i++)
score += getLogOdds(bases[i], i);
return score / length;
// return ((double) score) / (length * SCALE);
} |
d11636b2-636f-4b8f-9d34-0fb6a54db0f1 | 2 | public CtConstructor getClassInitializer() {
CtMember.Cache memCache = getMembers();
CtMember cons = memCache.consHead();
CtMember consTail = memCache.lastCons();
while (cons != consTail) {
cons = cons.next();
CtConstructor cc = (CtConstructor)cons;
i... |
2113e2a4-80b8-4814-9c49-fac6b13e3263 | 4 | static String toHex4String(int pValue)
{
String s = Integer.toString(pValue, 16);
//force length to be four characters
if (s.length() == 0) {return "0000" + s;}
else
if (s.length() == 1) {return "000" + s;}
else
if (s.length() == 2) {return "00" + s;}
else
if (s.length() == 3) {re... |
7b336c4d-8d74-4d5e-8bcb-9d8cd814a466 | 5 | public Sound(String soundFile) {
//soundFile is a .wav audio file from music file
try {
File file = new File(soundFile);
if (file.exists()) {
AudioInputStream sound = AudioSystem.getAudioInputStream(file);
clip = AudioSystem.getClip();
clip.open(sound);
}
else {... |
23e2bacf-8fec-44ee-8ecf-00116bf06fe6 | 5 | public boolean load()
{
if (!this.Valid) {
return false;
}
int i2 = 24;
try
{
DataInputStream localDataInputStream = new DataInputStream(this.rawdata);
int i = localDataInputStream.readInt();
int j = localDataInputStream.readInt();
int k = localDataInputStream.readI... |
d6bd544f-3fd5-40d5-b8da-10d8d1acdd3e | 9 | public static boolean eat(final Player player, Item item, int slot) {
Food food = Food.forId(item.getId());
if (food == null)
return false;
if (player.getFoodDelay() > Utils.currentTimeMillis())
return true;
if (!player.getControlerManager().canEat(food))
return true;
player.getPackets().sendGameMess... |
8e7bb2e8-bead-40ae-9ebb-a79702d14888 | 4 | public void action() {
do {
ACLMessage msgPerception = myAgent.blockingReceive();
// if(log.isLoggable(Logger.WARNING))
// try {
// log.log(Logger.WARNING, "Nachricht empfangen: " + ((WumpusPerception) msgPerception.getContentObject()).toString());
// } catch (UnreadableException e1) {
// // ... |
03e2cc11-c385-4470-b797-3b36b9ee681a | 1 | public void shiftRelease() {
HUD hud = null;
for (int i = (huds.size() - 1); i >= 0; i--) {
hud = huds.get(i);
hud.shiftRelease();
}
} |
4eca869e-3f71-4787-bea1-52e08245b870 | 4 | private void insertEmployeeIntoTable(Employee employee, int daysOfMonth) {
if (employee.isCallWorker() || employee.isClerk() || employee.isMuseumEducator()) {
Object[] fields = new Object[daysOfMonth + 3];
fields[0] = employee.getEmployeeNumber();
fields[1] = employee.getFull... |
cd756b02-cac6-4830-971a-95a69f5e4d8f | 5 | @Override
public final void enter() {
// cancel enter action if checkField caused a state change
if (checkField()) {
return;
}
menu.getContinueButton().setEnabled(true);
IPlayer player = game.getCurrentPlayer();
// Only enable rolling if player has not ... |
140ee3da-1f6b-489c-bb1e-4c2032508948 | 3 | public boolean setItem(FieldItem item, Position position) {
if (isOccupied(position)) {
return false;
}
if (isInField(item)) {
return false;
}
if (!item.getPosition().equals(position)) {
return false;
}
field.put(position, item)... |
83a6b90d-298b-45d6-a2a4-c944f4cab3bb | 0 | public void startGame() {
// Arrange pieces
this.window.board.clearBoard();
this.window.board.arrangeWhitePieces();
this.window.board.arrangeBlackPieces();
// Game active
this.isActive = true;
// White and black player
this.playerWhite = new Player(true);
this.playerBlack = new Player(false);
... |
601f5434-6ccd-4ad0-aea6-85fd2c9c4ad3 | 6 | private void JBSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_JBSalvarActionPerformed
try{
if(consultaAnt != null){
int linhaMedico = JTabelaMedico.getSelectedRow();
int linhaPaciente = JTabelaPaciente.getSelectedRow();
try{
... |
540c2958-8947-49d1-b59b-d56932d71b95 | 5 | public GetSetPixelDemo() {
MinuetoWindow window; // The Minueto window
// Create a 640 by 480 window
window = new MinuetoFrame(640, 480, true);
// Show the game window.
window.setVisible(true);
MinuetoImage image = new MinuetoImage(640, 480);
boolean first = true;
// Game/rendering ... |
7e12c179-305f-4b88-a579-d257f55fa102 | 0 | public void setName(String name) {
this.name = name;
} |
b660fc12-188d-4e17-86f5-ff570436113e | 9 | @Test
public void wrap_book() {
Book<Color, CopyPaper<Color>, Paper<Color>, List<CopyPaper<Color>>> book1 = new Book<Color, CopyPaper<Color>, Paper<Color>, List<CopyPaper<Color>>>();
BookBuilderSpec<?> bookBuilder = wrap(book1);
assertTrue(book1 == bookBuilder.getWrappedObject());
Book<? exte... |
e048c418-dc0b-4a6c-920d-d26c2903ce08 | 2 | public void findSignChange() {
double upLim = this.upLimPlus();
double lowLim = this.lowLimNeg();
// Choosing delta for intervals
double delta = (Math.abs(upLim) + Math.abs(lowLim)) / 10000;
System.out.println("delta = " + delta);
double point1 = lowLim;
double po... |
41b27b76-666f-4742-9f54-5c9359bbf9ba | 7 | public static int lcs(String a, String b) {
int lenA = a.length(), lenB = b.length();
int[] x = new int[lenB + 1];
int[] y = new int[lenB + 1];
int[] w = new int[lenA];
for (int i = 0; i <= lenA; i++) {
for (int j = 0; j <= lenB; j++) {
if (i == 0 || j... |
a3557ce6-47db-4232-b683-2df2234a2bbc | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
GameState frenchState = new GameState(state);
states = new GameState[]{frenchDay(frenchState,card,false)};
}
else if(time == Time.DUSK... |
015878c5-6bf6-44ee-ab7f-0be5273f861f | 6 | public void blink() {
if (getWorld().getObjects(Dolphin.class).size() != 0) {
getXD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getX();
getYD = ((Dolphin) getWorld().getObjects(Dolphin.class).get(0)).getY();
setLocation(getXD + 30, getYD + 25);
}
... |
bc852bba-720c-4c2d-bf9a-9985863b15da | 2 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("Visist Handler");
HttpSession session = request.getSession();
if(session.getAttribute("user") != null && !session.getAttribute("user").equals("")){
response.sendRedirect("2.... |
adf68bf6-9b89-42a1-afdb-257720083d15 | 3 | @Override
public void addUser(UserDTO user) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
}
... |
d4b4d3bd-ad48-4b00-9c62-444618e69be8 | 3 | @Override
public boolean execute(Player player) {
if(!this.hasSecondWord()) {
// if there is no second word, we don't know where to go...
GameEngine.gui.println("Go where?");
return false;
}
String direction = this.getSecondWord();
// Try to leave c... |
0263e14a-5245-4fd4-85c5-b2db0189af18 | 0 | private double getSautDeGeneration() {
return Double.parseDouble(vTxtGeneration.getText());
} |
eb1c62d1-69d0-4c91-ae9b-f47aca310ce3 | 4 | public static void main(String[] args)
{
try
{
String currentPath = System.getProperty("user.dir");
System.out.println("currentPath :" + currentPath );
ComJdbc.connection( currentPath + File.separator + "configdb.properties");
ConfigGetDb getsql = new ConfigGetDb(currentPath + File.separator ... |
c1c907cb-987a-4017-b253-8f244120db61 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((msg.amISource(mob))
&&(msg.tool() instanceof Ability))
{
if(remember.contains(msg.tool()))
return true;
if(forgotten.contains(msg.tool(... |
7631efe8-7fb8-4a41-9e7b-98bc076b2b54 | 4 | public Core() {
infoPacksByType = new HashMap<Class<? extends IInfoPack>, IInfoPack>();
systems = new ArrayList<ISystem>();
entitiesByID = new HashMap<String, IEntity>();
entitiesByPack = new HashMap<Class<? extends IInfoPack>, List<IEntity>>();
handlersByMessage = new HashMap<Cl... |
ec9e1daa-335a-43f4-816d-b280dc1c53c9 | 8 | private String makeDurationString(Duration dur) {
Dur d = VEventHelper.durationToICALDur(dur);
String out = "";
int days = d.getDays();
if (days > 0)
out += days + " " + (days == 1 ? ApplicationSettings.getInstance().getLocalizedMessage("lvip.day") : ApplicationSettings.getInstance().getLocalizedMessage("lvi... |
6ba3ee55-97a8-441e-88f7-bd935876f5b4 | 8 | public synchronized void publishCurrentMarket(MarketDataDTO md) throws Exception {
int bv = md.buyVolume;
int sv = md.sellVolume;
String product = md.product;
String exString = "publishers.CurrentMarketPublisher#publishCurrentMarket";
if (ExceptionHandler.checkIntNegative(bv, exS... |
74463bd9-dfca-467d-b2f8-0fb6cb565037 | 1 | public static void asm_incf(Integer akt_Befehl, Prozessor cpu) {
Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6);
Integer result = cpu.getSpeicherzellenWert(f) + 1;
// Speicherort abfragen
if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) {
// in f Register speichern
cpu.setSpeicherzellenWert(f, result, t... |
891dd808-2ad5-42c0-8d20-f7aeca030a7e | 1 | public static int randomized_partiton(int[] array, int start, int end){
Random r = new Random();
int a = r.nextInt(end);
while(a < start){
a = r.nextInt(end);
}
exchange(array,a,end);
return partition(array,start,end);
} |
52f90a9a-53f7-4692-b28e-7d121585d842 | 4 | public static String getLibraryTitle(Class<?> libraryClass) {
if (libraryClass == null) {
errorMessage("Parameter 'libraryClass' null in method"
+ "'getLibrayTitle'");
return null;
}
if (!Library.class.isAssignableFrom(libraryClass)) {
errorMessage("The specified class does not extend class "
+... |
9e5835d6-bd0c-499e-930f-d584adc4af3d | 4 | @EventHandler(ignoreCancelled = true)
public void onBreak(BlockBreakEvent event) {
Arena arena = OITG.instance.getArenaManager().getArena(event.getPlayer());
if (arena != null && !arena.isBlockBreakingAllowed()) {
event.setCancelled(true);
event.getPlayer().sendMessage(OITG.p... |
22b02048-4e0a-4e58-b34d-2398652b4550 | 6 | public void eliminarAntesDeX(T x){
Nodo<T> q = this.p;
Nodo<T> t = new Nodo<T>();
Nodo<T> r = new Nodo<T>();
boolean bandera = true;
if(this.p.getValor() == x){
System.out.println("No hay valor que proceda de que contenga X");
}else{
q = this.p;
t = this.p;
while(q.getValor() != x && bandera){
... |
c5413a4c-4e5f-48dc-89ca-5907a83a0f81 | 0 | @BeforeClass
public static void setUpBeforeClass() throws Exception {
//Prints.msg("BeforeClass <--> Passei pelo setUpBeforeClass - Antes da classe.");
} |
117bb29a-6472-4a29-be72-d2a5db6b7762 | 6 | public void backToMenu()
{
int reply = JOptionPane.showConfirmDialog(null, "Would you like to return to the Main Menu?");
if(reply == JOptionPane.YES_OPTION)
{
timer.stop();
reply = JOptionPane.showConfirmDialog(null, "Would you like to save your progress before quiting?");
if(reply == JOptionPane.YES_O... |
6d3b45c4-b652-4c87-a573-a129c0976c4a | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} // end method startSetup |
4e5a8e6c-ccf1-40e6-b85e-c05f40408b67 | 2 | public void write(String msg) {
if (!isPaused) {
try {
fileWriter.write(msg + LINE_END);
fileWriter.flush();
} catch (IOException ioe) {
System.out.println("IOException: " + ioe);
}
}
} |
0dba2481-e2ba-44c8-a8f3-f4a8d6845d29 | 6 | public CacheEntry[] getCacheEntries() {
List<CacheEntry> result = new ArrayList<CacheEntry>(17);
for(final Class<?> cacheType: caches.keySet()) {
Cache cache = caches.get(cacheType);
for (final Object readerKey : cache.readerCache.keySet()) {
// we've now materialized a hard ref
... |
0fa4b727-7c10-4b6d-84a7-fbc8cecf501e | 3 | @Override
public void validateCredentials(final String consumerKey, final String consumerSecret) throws IOException
{
if(twitterOAuthCredentials == null)
twitterOAuthCredentials = new TwitterOAuthCredentials();
twitterOAuthCredentials.setOAuthConsumerKey(consumerKey);
twitterOAuthCredentials.setO... |
0a2c4ce5-c02f-42e2-9a47-5a8944322ff2 | 5 | private static void backward() {
destination.remove(MAN);
source.add(MAN);
if (!isSomethingWillBeEaten(destination)) {
return;
}
for (int i = 0; i < destination.size(); i++) {
if (destination.get(i).equals(lastTransfer)) {
continue;
}
ArrayList<String> sourceSimulator = new ArrayList<String>... |
1887863f-be12-4680-92ce-4f48bbdb590e | 2 | public void fillWithNoise(CPRect r) {
CPRect rect = new CPRect(0, 0, width, height);
rect.clip(r);
int value;
Random rnd = new Random();
for (int j = rect.top; j < rect.bottom; j++) {
for (int i = rect.left; i < rect.right; i++) {
value = rnd.nextInt();
value &= 0xff;
value |= (value << 8) | ... |
9f7df60e-c629-4d6d-b296-fbe7bca1a5c0 | 1 | public void visitInsn(final int opcode) {
minSize += 1;
maxSize += 1;
if (mv != null) {
mv.visitInsn(opcode);
}
} |
be93927a-522f-44eb-8fce-754035b85347 | 7 | @Override
public void run() {
int sum = 0;
for(int i = 1; i <= 1000; i++) {
// System.out.println(" " + sum);
if(i == 100) {
sum += 10;
continue;
}
if(m_numberMap.containsKey(String.valueOf(i))) {
sum += m_numberMap.get(String.valueOf(i)).getLength();
// System.out.print(m_numberMa... |
ba9cfff7-2b0f-44c1-90cc-fcfe537e36f0 | 7 | public void calcTargets(int location, int steps){
visited[location] = true;
if(steps == 0){
targets.add(location);
}
else{
try{
if(!getAdjList(location).isEmpty()){
for(int adj : getAdjList(location)){
if(!visited[adj]){
if(getCell(adj).isDoorway()){
if( checkDoorDirection(ge... |
848d6bf7-5d41-4be7-8ac9-7f3321bb89bd | 5 | @Override
public int indexOf(Object o) {
if (o == null) {
for (int i = 0; i < array.length; i++)
if (array[i] == null)
return i;
} else {
for (int i = 0; i < array.length; i++)
if (o.equals(array[i]))
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.