method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4ac1e253-24f9-466a-a395-f78791f50223 | 2 | public boolean matchesUnaryOperator(String text) {
int unaryCount = this.unaryList.size();
for(int i = 0;i<unaryCount;i++) {
String currentUnaryOperator = this.unaryList.get(i).getLiteral();
boolean isMatchingExpression = text.equals(currentUnaryOperator);
if (isMatchingExpression) {
return true;
... |
e09c83de-0cab-4cde-a8cf-584b9a9af13e | 2 | public boolean removePort(String port_name){
Port sgl;
boolean item_found = false;
for(int i=0;i<ports.size();i++){
sgl = (Port) ports.get(i);
if (sgl.name.equals(port_name)){
item_found = ports.remove(i) != null;
break;
}
}
return item_found;
} |
47f246c5-d87c-43b9-83a9-b6cf4c483342 | 9 | static final void method3171(AbstractToolkit var_ha, int i, int i_0_, int i_1_,
int i_2_, int i_3_, int i_4_, boolean bool,
boolean bool_5_) {
Class9.aHa171 = var_ha;
Npc.anInt10503 = i;
Class348_Sub40_Sub5.aBoolean9121
= (Npc.anInt10503 > 1
&& Class9.aHa171.supportsMultipleCores());
Class362... |
a2678803-9d65-40de-9e31-7996ed4d8cf9 | 1 | public void addQoS(QoS qos) {
if (grantedQoSs == null) {
grantedQoSs = new ArrayList<QoS>();
}
grantedQoSs.add(qos);
} |
a74fb65c-71b0-444c-be42-e98dbb08e0bf | 1 | @AfterClass
public static void restoreContactsTxt(){
try {
Files.copy(Paths.get("contactsCOPY.txt"),Paths.get("contacts.txt"));
Files.delete(Paths.get("contactsCOPY.txt"));
} catch (IOException ex){
ex.printStackTrace();
}
} |
1fcad41d-de15-4a28-a72b-197f1591914b | 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... |
95a35d8b-63be-43e6-b016-b769fffa090a | 0 | @Override
public void propertyChange(PropertyChangeEvent evt) {
propertyName = evt.getPropertyName();
} |
713d1233-8cf4-4963-888b-195fb0228685 | 8 | private void showSearchGame(Graphics2D g2, Rectangle d, Font font) {
// buscar juego en espera
// cuando el mastergamethread reciba una conexion, esta pantalla desaparecera
if (RemotePlayer != null) {
if (RemotePlayer.startsWith("ERROR")) {
JOptionPane.showMessageDial... |
0aec3b50-529a-449f-b1cb-548f364cd945 | 9 | private void generateRaster(int dy, int iN, int iS, int[] axRaster, int[] azRaster, int iRaster, Rgb16[] gouraud) {
/*
* Logger.debug("generateRaster\n" + "N="+ax[iN]+","+ay[iN]+","+az[iN]+"\n" +
* "S="+ax[iS]+","+ay[iS]+","+az[iS]+"\n");
*/
int xN = ax[iN], zN = az[iN];
int xS = ax[iS], zS = az[iS];
i... |
2964bc4f-c48f-4f78-9a28-365eb8a1ad4c | 7 | private ArrayList parseListElement(String str, ValueParser parser)
throws Exception {
StringTokenizer st = new StringTokenizer(str, "/");
int size = st.countTokens();
if (size < 1 || size > 2) {
throw new Exception("syntax error");
}
ArrayList values;
try {
values = parseRange(st.nextToken(), parse... |
851fecec-3d05-4204-8765-df42c0c12692 | 1 | @Override
public String getValue(int place) throws NotExist {
if (place <= count) {
return super.getValue(place);
} else {
throw new NotExist("Element with such id doesn't exist");
}
} |
44af4404-7df6-4690-beb6-f1c17c9af89d | 0 | @Override
public void show() {
showLine();
out.println(getMessage());
showLine();
inputString();
} |
858b412c-b91d-45a5-82b7-ea33d9580dcf | 5 | @Override
public int[] select(Population pop, int toSelect){
double minimal = pop.people[0].fitness();
//if population is not ordered, search the worst one.
if(minimal* pop.getBest().fitness()>=0) minimal=0;
//only necessary if fitness of pop has both symbols (+/-)
toSelect=Math.min(toSelect, pop.peop... |
bcd06ab1-b725-432b-b863-6ed68782dc69 | 1 | @RequestMapping(value="comprar", method=RequestMethod.POST)
public ModelAndView comprar(@ModelAttribute(value="nombreProducto") String nombreProducto, @ModelAttribute(value="cantidadProducto") Integer cantidadProducto) {
Stock stock = Stock.getInstance();
Carrito carrito = Carrito.getInstance();
ModelMap mode... |
61764a11-68da-46b3-a357-9e27b7942693 | 1 | public int rob(TreeNode root) {
if (root == null) {
return 0;
}
HashMap<TreeNode,int[]> aux=new HashMap<TreeNode, int[]>();
postOrderTraversal(root,aux);
return Math.max(aux.get(root)[0],aux.get(root)[1]);
} |
91c26d64-8283-484d-9f42-d636c638c114 | 5 | private void instantiateType(){
gScale = 1;
switch(type){
case FIREBALL:
damageType = DamageType.FIRE;
damageVal = 1;
speed = 3;
restitution = 0.25f;
break;
case SPELL:
damageType = DamageType.DARKMAGIC;
damageVal = 1;
speed = 3;
restitution = 0.25f;
break;
case ICE_SPIKE:
dam... |
c429dabd-9c1f-44bd-b954-42cfe1c66735 | 1 | public boolean containsAll(final Collection<?> c) {
return queue.containsAll(c);
} |
3f92c8cf-2e81-44c4-a70c-8bbf79cc0e95 | 3 | public static double getWeaponDamage(WeaponType type) {
switch (type) {
case mel_sword:
return 10;
case mel_hammer:
return 15;
case rng_bow:
return 10;
}
return 1;
} |
16669900-2d54-4be8-97d1-8519c27afbc9 | 2 | public static boolean verificarCapsLook() {
boolean capsLigado = false;
if (System.getProperty("os.name").toUpperCase().contains("WINDOWS")) {
capsLigado = Toolkit.getDefaultToolkit().getLockingKeyState(
KeyEvent.VK_CAPS_LOCK);
}
if (capsLigado) {
... |
174e2abb-23aa-4d20-9eb1-f2c220f1e1f5 | 5 | public void calcComplexDomain() {
FFTComponents components = this.nextPhase();
float[] spectrum = components.spectrum;
float[] lastSpectrum = new float[spectrum.length];
double[] phase = new double[components.real.length];
double[] previousPhase = new double[components.real.length];
double[] antePreviousPh... |
8b0db7f2-6ba4-4ebc-a5e2-b8aae76a3dd7 | 0 | public int targetSdkVersion() {
return this.targetSdkVersion;
} |
62a2abc7-d809-47eb-bbb0-dcde50c70fca | 5 | public List<Tache> lireFichier(String fichier){
//lecture du fichier texte
try{
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
String ligne;
//On lit ligne par ligne
while ((ligne=br.readLine())!=null)... |
aee676b4-479b-4e50-aa7e-3fd25e74a235 | 3 | public String PerbaikiSpasi(double doubleAngka){
String strAngka = KonversiKwitansi(doubleAngka);
String angkaBaru = "";
int JmlSpasi =0;
for (int i=1;i<strAngka.length();i++){
if (strAngka.charAt(i)==' ' && strAngka.charAt(i-1)==' ') {
angkaBaru = angkaBaru.s... |
71842d58-d5c8-482a-9353-db8831e8950e | 2 | public EncryptedHand waitEncryptedHand()
throws InvalidSubscriptionException, IOException,
InterruptedException {
final Subscription eSub = elvin.subscribe(NOT_TYPE + " == '"
+ SEND_ENCRYPTED_HAND + "' && " + GAME_ID + " == '"
+ gameHost.getID() + "' && " + REQ_USER + " == '"
+ user.getID() + "'"... |
eb6dea95-49aa-4e1c-bdcb-210872a45c2e | 9 | static protected void FillBuff() throws java.io.IOException {
if (maxNextCharInd == available) {
if (available == bufsize) {
if (tokenBegin > 2048) {
bufpos = maxNextCharInd = 0;
available = tokenBegin;
} else if (tokenBegin < 0... |
1a6ab76e-6942-4851-a7ad-c6be6957de51 | 4 | public void setPixel(int x, int y, short red, short green, short blue) {
short[] values = new short[] {red,green,blue};
if (inRange(red) && inRange(green) && inRange(blue)){
for (int i = 0; i < imageArray[y][x].length; i++){
imageArray[y][x][i] = values[i];
}
}
} |
b35c5d2b-b647-401e-9482-c9179e6721e9 | 0 | public Deplacement2(int date1, int id1, int taille1) {
super(date1, id1, taille1);
} |
e97519a5-1e29-4b88-812d-1319d8bff52b | 5 | public void cancelAction(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_RIGHT){
right = false;
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT){
left = false;
}
else if(e.getKeyCode() == KeyEvent.VK_UP){
jump = false;
}
else if(e.getKeyCode() == KeyEvent.VK_1){
if(mana >= Monster_1.manaCost){
... |
afaa524d-4118-444c-bd35-d5e1c45b8bd1 | 2 | public UniDatabaseManager() {
try {
Class.forName(driver);
conn = (Connection) DriverManager
.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.prin... |
734be0d6-116e-4f15-b8ff-bf7168b898a0 | 5 | @Override
public void doing(Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException {
JSONArray lstJSON = new JSONArray();
logger.debug(ConfigDialog.phones + "-----------------------");
for (int i = 0; i < ConfigDialog.phones; i++) {
Long num = getNum();
logger.de... |
83c0a0fd-eed9-4770-ba2b-7752fb5ba13a | 9 | public AgentLocation getGoalLocation( AgentLocation location, Area sensorView )
{
Rectangle2D bounds = sensorView.getBounds();
double curX = location.getX();
double curY = location.getY();
double curTheta = location.getTheta();
double newX = -1;
... |
60b51b0e-5dd7-41ea-b62d-03ea013a3f2e | 0 | public void printOutMessage() {
String toPrint =
ant11.getMessage() + ant12.getMessage() + ant21.getMessage()
+ ant22.getMessage() + ant31.getMessage();
//Person1 replace P1 with your name
//and gburdell1 with your gt id
Person1 p1 = new Person1("Hutchinson Pryor");
... |
12d659dc-85f9-4a18-be12-ca30f7c26e8e | 7 | public static StorageSlot recycleSlot(Stella_Class renamed_Class) {
{ Surrogate instancetype = renamed_Class.classType;
StorageSlot recycleslot = null;
{ Slot slot = null;
Iterator iter000 = renamed_Class.classSlots();
while (iter000.nextP()) {
slot = ((Slot)(iter000.value));... |
4ae6c717-16e1-438b-aa9f-c812851bf4e1 | 2 | @Override
public int[] getAttributes() {
Random r = new Random();
int[] local = {0, 0, 0, 0, 0, 0};
for (int i = 0; i < 6; i++) {
int[] rolls = {0, 0, 0, 0};
for (int k = 0; k < 4; k++) {
rolls[k] = r.nextInt(6) + 1;
}
Arrays.so... |
bd34d30e-62d0-4268-be83-a430c432ff0f | 5 | public static void main(String[] args) throws IOException {
System.out.println((int)'\n');
// String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ " +
// "abcdefghijklmnopqrstuvwxyz " +
// "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ " +
// "абвгдеёжзийклмнопрстуфхчцшщъыьэюя " +
// ... |
73ded135-3a5b-477d-a1c0-9b875328d157 | 7 | public void setListMatrix(float rList) {
if (rList <= 0)
throw new IllegalArgumentException("rList<=0");
this.rList = rList;
double[] sig = new double[Element.NMAX];
sig[ID_NT] = nt.getSigma();
sig[ID_PL] = pl.getSigma();
sig[ID_WS] = ws.getSigma();
sig[ID_CK] = ck.getSigma();
sig[ID_MO] = mo.getSigm... |
7eb378bd-94d2-4538-a207-40da8386afb5 | 2 | private int getMaxChildHeuristic(TrieNode node) {
int max = 0;
for (TrieNode child : node.getChildren().values()) {
if (child.getHeuristic() > max) {
max = child.getHeuristic();
}
}
return max;
} |
ff7a6ab0-d60d-4997-81ce-728e66b4a6b7 | 8 | public void addDropping(Dropping.TYPE type){
if(type==null || stone)
return;
switch(type){
case BIG_SLIDER: dropping=new BigSliderDropping(x+(width-BigSliderDropping.WIDTH)/2, y+height);
break;
case SMALL_SLIDER: dropping=new Smal... |
e3a5d378-ecfe-4a1e-9b1d-99a90c7f1dac | 9 | @Override
public void channelCommand(MessageEvent<PircBotX> event) throws IllegalAccessException, SQLException, InstantiationException {
super.channelCommand(event);
if(args.length==2){
try {
if(existsInDatabase(db, "HIGHLIGHTS", args[1].toLowerCase())){
... |
bce30094-3179-4d26-84e8-c67cb838cfa1 | 4 | @Override
public void execute() {
seqSample(() -> {
int numItems = curGb.readMemory(curGb.pokemon.numItemsAddress);
for (int i = 0; i < numItems; i++) {
int curItem = curGb.readMemory(curGb.pokemon.numItemsAddress + 2*i + 1);
if (curItem == item) {
itemGoalPosition = i;
... |
203a12fd-4f3b-4ca1-965e-d314edc9c99a | 0 | @Override
public void setMobile(String mobile) {
super.setMobile(mobile);
} |
7835b9b1-60c8-4f66-8ccd-37eca4731858 | 2 | public long blocTime(){
if(this.endCheck){
return this.totalTime;
}
else{
if(!this.startCheck){
System.out.println("Class Time: method totalTime: No start marker has been set - -9999 rturned");
return -9999L;
}
else... |
c4b6240f-2700-4951-9c94-cbe4b149e31d | 0 | private void parseHTML(File file) {
// Stores all contents of file in a single string
String fullString = fileToString(file);
// Turns the string into an array of words, split non accepted
// characters
ArrayList<String> parsedArray = splitToArray(fullString);
// Removes ... |
bf969706-f605-4f10-b66a-b8cad389dc7a | 2 | public boolean jumpMayBeChanged() {
return !isBreaked
&& (caseBlocks[caseBlocks.length - 1].jump != null || caseBlocks[caseBlocks.length - 1]
.jumpMayBeChanged());
} |
29bd82f1-5465-4489-8499-105528c515f6 | 9 | public static String replaceValues(
String s, String begin, String end, Map<String, String> values) {
if ((s == null) || (begin == null) || (end == null) ||
(values == null) || (values.size() == 0)) {
return s;
}
StringBuilder sb = new StringBuilder(s.length());
int pos = 0;
while (true) {
int... |
da325e11-9910-465a-beed-ef972081fe1b | 4 | @Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
leaveInputMode();
break;
case KeyEvent.VK_ENTER:
finishTurn();
break;
case KeyEvent.VK_LEFT: // no-break
case KeyEvent.VK_RIGHT:
stopTurning();
break;
}
} |
c35daa4a-c355-496c-97d7-459b86a10b16 | 7 | public void updateSigns()
{
for (Location loc : getSigns()) {
if ((loc.getBlock().getState() instanceof Sign))
{
Sign sign = (Sign)loc.getBlock().getState();
int total = getPlayers().size();
if (this.getState() == GameState.INGAME) {
sign.setLine(3, ChatColor.... |
5d1655e6-1031-4293-a2d0-dc8842b96067 | 6 | public void promoteNameToValue() throws IOException {
expect(JsonToken.NAME);
Iterator<?> i = (Iterator<?>) peekStack();
Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next();
stack.add(entry.getValue());
stack.add(new JsonPrimitive((String)entry.getKey()));
} |
a49e4c59-e183-4bdc-ba20-f663ab8a4ff3 | 0 | protected void initialize() {
Robot.shooter.getPIDController().setSetpoint(0);
Robot.shooter.setMotorValRaw(0);
} |
df7413ec-b82e-4258-ab5a-d13c74c6cc0a | 3 | public void handlePressedKeys(ArrayList<KeyButtons> keyPressed)
{
if (keyPressed.contains(KeyButtons.DOWN))
{
menuDown();
}
if (keyPressed.contains(KeyButtons.UP))
{
menuUp();
}
if (keyPressed.contains(KeyButtons.CONFIRM))
{
... |
3e6b66c1-9dc0-4022-891b-2f1c3b8eff47 | 4 | public static double getDouble() {
double x = 0.0;
while (true) {
String str = readRealString();
if (str == null) {
errorMessage("Floating point number not found.",
"Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE);
}
... |
18f58d6a-d84f-4a2d-9e68-b54c025f41df | 1 | public void windowClosing(WindowEvent e) {
if (confirmQuit("Exit")) {
System.exit(0);
}
} |
380f7c44-a68f-47e6-bca2-618136b453bc | 7 | protected SQLPermissionBase getBaseClass(PermissionType type, String name) {
switch (type) {
case USER:
return new SQLPermissionUser(name);
case GROUP:
return new SQLPermissionGroup(name);
case WORLD:
return new SQLPermissionWor... |
ec56bace-caf3-49ec-93a7-d360664b3418 | 8 | public static void main(String[] args) {
if(args.length < 1) {
System.out.println("Insufficient args. . ERROR!");
System.exit(1);
}
ArrayList<XMLFile> results = null;
XMLFile ret = null;
switch(args[0].charAt(0)) {
case 'i':
System.out.println("Populating database.");
pop... |
691afea9-cb99-4019-b147-1b6ae2e65da3 | 2 | public void load(InputStream in) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = reader.readLine()) != null) {
if (line.charAt(0) == '#')
continue;
int delim = line.indexOf('=');
String key = line.substring(0, delim);
String ... |
0cf7d68a-348e-4784-a072-6ca33f987937 | 1 | public void omniScore(int a){
rover = head;
while(rover != null){
rover.score = 0;
rover = rover.next;
}
} |
1bbcf40d-2ee2-4e45-9741-1572f2edb34c | 4 | @Override
public boolean containsLong(String name) {
JOSObject<? , ?> raw = this.getObject(name);
if(raw == null) return false;
if(raw.getName().equalsIgnoreCase(LONG_NAME)) return true;
return false;
} |
116ebbcb-704f-4919-9e37-89fb7a93f373 | 8 | public void update(double delta) {
Iterator<Brick> i = removeQueue.iterator();
while (i.hasNext()) {
Brick b = i.next();
b.update(delta);
if (b.opacity < 0.1) {
i.remove();
}
}
for (int x = 0; x < size; ++x) {
f... |
f0421fdf-3d94-4142-97b3-4f21b39454c1 | 9 | public boolean equals(Object o)
{
if (o == this)
{
return true;
}
if (!(o instanceof RSAPrivateCrtKey))
{
return false;
}
RSAPrivateCrtKey key = (RSAPrivateCrtKey)o;
return this.getModulus().equals(key.getModulus())
... |
fe557ecd-bb4a-4a0d-9adf-0cd578063b8f | 8 | private void setI(){
double [] rows = new double [arr.length];
for(int i=0;i<arr.length;i++){
rows[i]=0;
for(int j=0;j<arr.length;j++){
if(i!=j){
rows[i]=rows[i]+arr[i][j];
}
}
}
for(int i=0;i<arr.len... |
b804f482-fcc3-4083-9317-b0b4921a5027 | 2 | public void unprotect(xAuthPlayer xp) {
Player p = xp.getPlayer();
plugin.getPlyrDtHndlr().restoreData(xp, p);
if (xp.isCreativeMode())
p.setGameMode(GameMode.CREATIVE);
int timeoutTaskId = xp.getTimeoutTaskId();
if (timeoutTaskId > -1) {
Bukkit.getScheduler().cancelTask(timeoutTaskId);
xp.setTimeo... |
7cd4fb59-da9f-4d8f-8560-ae6195c78a77 | 2 | public double variance_of_ComplexModuli() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
double[] re = this.array_as_modulus_of_Complex();
double variance = Stat.variance(re);
Stat.nFactor... |
394512b5-4944-484e-9c0a-442c63b89751 | 8 | public static Integer[] fudge(Integer layer[]){
Random rand = new Random();
int len = layer.length-1;
int i = 0, curDepth = 0;
//skip to the location of the top layer (pass over nulls)
while(layer[i] == null && i < len)
i++;
int top = curDepth = i;
double depth;
//do not fudge the top layer
i++;... |
ae4abb69-936f-4e34-9937-ea975821f00c | 7 | public String readLine()
{
if (lCurrentPosition == -1 || strCurrentContent == null)
{
return null;
}
String strReturn;
int newline = strCurrentContent.indexOf("\r");
if (newline == -1)
{
newline = strCurrentContent.indexOf("\n");
if (newline == -1)
{
strReturn = strCurrentContent;
str... |
46681cc2-6486-49e1-bb66-cf88f532ca33 | 5 | private int findMinimumValueAndReachCorner(int m, int n) {
// count++;
if(table[m][n]!=-1)
return table[m][n];
if (m == rows - 1 && n == columns - 1) {
return table[m][n]=num[m][n];
}
if (m == rows - 1) {
return table[m][n]=num[m][n] + findMini... |
f45ebb7a-ba6b-4716-84d8-fe16004b68ae | 1 | public static double[][] powerSymmMatrix(
double[][] inMatrix,
double power )
{
EigenValueDecompositionSymm eigenDeco =
new EigenValueDecompositionSymm(inMatrix);
int m = Matrix.getNumOfRows(inMatrix);
double[][] eigenVectors = eigenDeco.getEigenVectors();
double[] eigenValues = eigenDeco.getEigenValues();
for... |
d016e249-d2eb-44fd-92ab-55a095a358b9 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[... |
afea19aa-e8e1-49bf-8880-876c9229ce3c | 3 | public void paintComponent(Graphics g){
super.paintComponent(g);
g.setColor(Color.GRAY);
g.fillRect(0, 0,this.getWidth(),this.getHeight());
if(img!=null){
Carreaux carr=null;
int x=0,y=0,xBlanc,yBlanc;
for(int i=0;i<nbCarreau;i++)
for(int j=0;j<nbCarreau;j++){
carr=carreau[i][j];
//les ... |
fc6e462f-1702-4639-9ebb-fa6359160faf | 2 | public void updateSize()
{
int gw = fm.stringWidth(name);
for (int i = 0; i < sizeInformation(); i++)
gw = fm.stringWidth((String) (data.getValue(getCodeInformation(i),
DictionnaireTable.NAME))) < gw ? gw : fm
.stringWidth((String) (data.getValue(... |
a0d80274-c80d-4575-9951-facb0392eb9f | 3 | public ClientPaket(ServerKontext kontext, Spieler spieler, String nachricht)
{
_dead = !spieler.lebendig();
Raum aktuellerRaum = kontext.getAktuellenRaumZu(spieler);
if(_dead)
{
// TODO: win / lose screen
_showWinScreen = spieler.hatGewonnen();
_showLoseScreen = !_showWinScreen;
_moeglicheAusgaenge... |
dac9f91e-2f62-43f0-a8a3-f1c134de79cd | 1 | private int get2Fold(int fold) {
int ret = 2;
while (ret < fold) {
ret *= 2;
}
return ret;
} |
884a0446-0b42-4e5d-9397-28121c7451b7 | 4 | private static void loadBadWords(Buffer stream, char badWords[][],
byte badBytes[][][]) {
for (int w = 0; w < badWords.length; w++) {
char badWord[] = new char[stream.getUnsignedByte()];
for (int c = 0; c < badWord.length; c++)
badWord[c] = (char) stream.getUnsignedByte();
badWords[w] = badWord;
b... |
1103c065-0341-4458-a750-4ab97090d35c | 2 | public static Event read (SocketBase s)
{
Msg msg = s.recv (0);
if (msg == null)
return null;
ByteBuffer buffer = msg.buf ();
int event = buffer.getInt ();
int len = buffer.get ();
byte [] addr = n... |
8c375118-1afc-4e54-9f64-2764a47383df | 2 | public boolean blockUntilUsersFinished() throws InterruptedException,
IOException {
// 30 second timeout
for (int timeout = 0; timeout < 300; timeout++) {
if (usersHaveData >= currentGameMembers.size()) {
// return
waiterSub.remove();
return true;
}
Thread.sleep(100);
}
waiterSub.remo... |
ea079a46-9884-4a8f-98d4-cbbe0b7f9fe9 | 6 | private int heapify(int node, int heapSize){
int largestIndex = node;
if(tree.getLeftIndex(node) < heapSize ){
if(tree.hasLeftChild(node) && tree.getLeftValue(node) > array[largestIndex]){
largestIndex = tree.getLeftIndex(node);
}
if(tree.hasRightChild(node) && tree.getRightIndex(node) < heapSize){
... |
2aefbab4-842c-4b6e-a9e3-4a46781c8477 | 7 | public void DBUpdateClanKills(String clan, String name, int adjMobKills, int adjPlayerKills)
{
if(((adjMobKills==0)&&(adjPlayerKills==0))
||(clan==null)
||(name==null))
return;
DBConnection D=null;
try
{
D=DB.DBFetch();
final ResultSet R=D.query("SELECT * FROM CMCHCL where CMCLAN='"+clan+"' and C... |
6613ebe2-8b2c-490f-a6a8-7ffb50566b8c | 6 | public void update(long sysTime, Game game) {
// Every in game tick, the bullet gets updated here
// Let's calculate how long the bullet has been alive here (We can later use this in calculations)
long lifeTime = sysTime - birth;
if(life > lifeTime) {
float percent = (float)(lifeTime)/(float)(life... |
4d615e29-88b2-4442-8360-8d1d45128a7b | 7 | public void checkDetails(Object details, int selectedtab) {
if (selectedtab == 0) { return; } // first tab contains lite information
String sAsin = (String) getProperty(details, "Asin");
if (sAsin != null) {
String searchstring = "AsinSearch=" + sAsin + "&type=heavy";
Object nProductInfo = getResponse(searc... |
e50ba704-9ee3-437e-9778-bf8010966387 | 5 | @Override
protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
DecoderState decoderState = (DecoderState) session.getAttribute(DECODER_STATE_KEY);
if (decoderState == null) {
decoderState = new DecoderState();
session.setAttrib... |
652b7970-6308-4c95-8030-d0359ee5d6cb | 4 | public void reverseList() {
// check if first three nodes exist before while-loop
if (this.start == null || this.start.getTail() == null || this.start.getTail().getTail() == null) {
return;
}
// separate case for start node
Node<T> secondNode = this.start.getTail();
Node<T> thirdNode = secondNode.getTail... |
0f037197-16f1-4a51-beb5-dee24d1219f1 | 8 | public int goTo(int did) {
int startSkipIndex = 0;
if (did > skipList.get(currentSkipIndex).did) {
startSkipIndex = currentSkipIndex;
}
// Look up the skip list to get the did that is equal
// or just greater than the incoming did
int selectedSkipIndex = 0;
for (int i = startSkipIndex; i < skipList.s... |
f4996fe7-1b9f-4fb9-9618-78a4de631551 | 5 | public boolean abort() throws LoginException {
if (succeeded == false) {
return false;
} else if (succeeded == true && commitSucceeded == false) {
// login succeeded but overall authentication failed
succeeded = false;
username = null;
if (password != null) {
for (int i = 0; i < password.length; ... |
7aa73ad5-f14d-49be-9480-8c6d896b22d2 | 6 | protected List<Acronym> extractSingleAcronyms(String text){
ArrayList<Acronym> extractedPairs = new ArrayList<Acronym>();
int iOpen = text.indexOf("(");
int iClose = -1;
String mOutOfPar = "";
String mInPar = "";
while(iOpen != -1){
iClose = -1;
int numPar = 0;
for (int p = iOpen+1; p < text.leng... |
89ebb668-3961-4e95-8c12-10954f0fab83 | 1 | public static String getPrefix(String src, String... delimiter)
{
int i = findIndex(src, delimiter);
if (i == -1)
return src;
else
return src.substring(0, i);
} |
4d0e41ae-63a8-4730-93ee-9847f4314c5f | 4 | @Override
public void mousePressed(MouseEvent click) {
for (int i = 0; i < components.getLength(); i++) {
Componente component = components.get(i);
for (int j = 0; j < component.getOutputs(); j++) {
if (component.getRectSalidas().get(j).contains(click.getPoint())) {
... |
b6bdb190-fc5e-4089-8aef-57f0a9124993 | 2 | public static boolean searchRecurse(int[] A, int value, int index)
{
if(index >= A.length){
System.out.println("Element not found");
return false;
}
if(A[index] == value){
System.out.println("Element is found");
return true;
}
... |
f985a54e-5046-4724-aa97-617d22150baa | 6 | @Override
public double defuzzify(Term term, double minimum, double maximum) {
if (maximum - minimum > getResolution()) {
FuzzyLite.logger().warning(String.format(
"[accuracy warning] resolution (%d)"
+ "is smaller than the range (%f, %f). "
... |
e54df59e-e700-413b-99b9-d5d7da3edefe | 9 | @Override
public void drop(final DropTargetDropEvent ev) {
ev.acceptDrop(ev.getDropAction());
try {
final Object source = ev.getTransferable().getTransferData(
ComponentDragDrop.supportedFlavors[0]);
FormWidget cmp = null;
final FormCanvas canvas = (FormCanvas) ev.getDropTargetContext()
.getComp... |
c55f265d-74f1-4af7-88eb-5c8fc0677d70 | 6 | private int millisecondToOtherFormat(long duration, String conversionSwitch) {
switch (conversionSwitch) {
case ("year"):
return (int) (duration / 31556952000L);
case ("month"):
return (int) (duration / 2629746000L);
case ("week"):
... |
20e657a4-42b9-4545-8e97-bc570ef80bdc | 9 | public String indexar() {
try {
File dir = new File(directorio);
if (!Datos.getInstance().consultarDocumento(dir.getName())) return "Documento ya procesado";
if (dir.exists()) {
try (BufferedReader info = new BufferedReader(new InputStreamReader(new FileInputS... |
b0254fab-07fd-4ade-9b13-9d894a9634a8 | 6 | @Override
public void actionPerformed(ActionEvent e) {
JMenuItem source = (JMenuItem) (e.getSource());
boolean needRepaint = !mode.equals(source.getText());
mode = source.getText();
switch (mode) {
case "None":
setVisible(false);
break;
case "Single":
outCoupler.jitterMode(false);
setVisible(... |
d5d3e0e1-67a2-4e5e-9a40-689d40ab884a | 8 | * the dockable when leaving its auto-hide border.
* */
public void addHiddenDockable(Dockable dockable,
RelativeDockablePosition dockedPosition) {
/* not used from inside the API : only for user applications */
DockableState currentState = getDockableState(dockable); // should be
... |
2e467a2a-d881-4cdf-8946-97c90ed5e397 | 9 | private int getShift(String from, String selectedItem) {
if (selectedItem.toLowerCase().equals("none")) {
return -1;
}
if (from.toLowerCase().equals("red")) {
if (selectedItem.toLowerCase().equals("red")) {
return 0;
} else if (selectedItem.toLowerCase().equals("green")) {
return 8;
} else
... |
fd85f59f-f4ec-48de-8161-907b2633e895 | 9 | private LinkedList<Diff> diff_lineMode(String text1, String text2,
long deadline) {
// Scan the text on a line-by-line basis first.
LinesToCharsResult b = diff_linesToChars(text1, text2);
text1 = b.chars1;
text2 = b.chars2;
List<String> linearray = b.lineArray;
LinkedList<Diff> diffs = diff_main(text1, ... |
f4b3d9c1-4832-4319-a70b-78521a73476d | 2 | private void addProgram(String text, int type)
{
int shader = glCreateShader(type);
if(shader == 0)
{
System.err.println("Shader Creation Failed: Could not find valid memory location when adding shader");
System.exit(1);
}
glShaderSource(shader, text);
glCompileShader(shader);
if (glGetSha... |
1343172e-0e13-4fa4-b56c-bb5c2b7bb31d | 0 | @Test
public void testStartPlagiatsSearchStringInt()
{
assertEquals(0, 0);
} |
1179862e-7cf5-4c5f-a390-bdbe5844539b | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Label other = (Label) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if ... |
deadfbb8-360b-4e94-812a-78ab2678dd08 | 6 | private Match findMatch(A a) {
assert a != null;
Node n = sentinel.left();
if (n == null) {
return new Match(false, sentinel, true);
}
while (true) {
int c = a.compareTo(n.contents);
if (c == 0) {
return new Match(true, n, false);
} else if (c < 0) {
if (n.... |
3703bdab-c5ce-4ef3-95b2-e317dd83aa76 | 3 | public ZoomDataBlock(int zoomLevel, SeekableStream fis, RPTreeLeafNodeItem leafHitItem,
HashMap<Integer, String> chromosomeMap, boolean isLowToHigh, int uncompressBufSize) {
this.zoomLevel = zoomLevel;
this.leafHitItem = leafHitItem;
this.chromosomeMap = chromosomeMap;
... |
3816c2b7-9c0f-4264-a5b5-39058cdea655 | 9 | @Override
public void HUDAreaRightClicked(HUDArea ha) {
HUDArea hudArea = null;
int playerInventorySlot = 0;
int selectedStart = registry.getInvSlotFrom();
for (int i = 0; i < hudAreas.size(); i++) {
playerInventorySlot = i + registry.getPlayerInventorySize(registry.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.