method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
da5ff7a0-f988-40c7-98b5-1c5f6168bf61 | 3 | public int checkCol( String message ){
int num = -1;
boolean getInt = true;
while (getInt) {
num = getInt( message );
if ( num < 1 || num > 9 ) {
System.out.println("Oops that is not a valid column, try again.");
}
else {
return num;
}
}
return -1;
} |
56ee5e7b-f314-4b66-91fb-be1bcbc982a6 | 1 | private void sleep() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
06150fba-e518-4a70-bf1b-406fe3196357 | 3 | public synchronized Cont collect(int id){
while ( buffer_v[id-1] == null && !faliureDetector.isSuspect(id)){
try{
Utils.out(pid, "waiting for " + id + " "+ faliureDetector.isSuspect(id));
wait();
}catch (InterruptedException e){
Utils.out(pid,"interrupted exception");
}
}
Utils.out(pid,"wait... |
8e3ed996-2d94-4397-a202-1401784011b9 | 6 | public static void main(String[] args){
long start = System.nanoTime();
int sum = 2;
int p = 1;
int p2 = 2;
//fibNum() is not used for the sake of performance
while(p < 4000000 && p2 < 4000000){
p = p+p2;
if(p%2 == 0 && p < 4000000){
sum += p;
}
p2 = p+p2;
if(p2%2 == 0 && p2 < 4000000)... |
1890e7c5-5373-4173-8d83-43ee645fd033 | 6 | private void getOutcome(int a, int d) {
attackers = a;
defenders = d;
outcome = new double[attackers + 1][defenders + 1];
for (int i = 0; i < attackers + 1; i++)
for (int j = 0; j < defenders + 1; j++)
outcome[i][j] = -1.0;
outcome[attackers][defenders] = 1.0;
double winOdds = 0.0;
String likely... |
3381809f-b98f-4f1a-bd58-5df4809bdfb0 | 9 | private void printParametersToFile(int niteration) throws IOException
{
PrintWriter pw;
String szfile;
if (szoutfileID.equals(""))
{
szfile = szoutputdir+"/model_"+numstates+".txt";
pw = new PrintWriter(szfile);
}
else
{
szfile = szoutputdir+"/model_"+numstates+"_"+szoutfileID+".txt";
... |
18f73a0b-4c00-45a9-bbe6-97d4a02b02a8 | 5 | public static void main(String argv[]) {
try {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
DefaultHandler handler = new DefaultHandler() {
boolean bfname = false;
boolean blname =... |
4e312ca4-ab2b-4add-8e0b-df4a28b5d669 | 7 | public boolean canCastleRight(Board board) {
if (!this.canCastle) {
return false;
}
if (this.inCheck(board)) {
return false;
}
PossibleTile space1 = new PossibleTile(this.getX() + 1, this.getY(), this);
PossibleTile space2 = new PossibleTile(this.getX() + 2, this.getY(), this);
if (
spaceInCheck(... |
310cfe86-4dec-4394-ae2a-c81a912a78b5 | 4 | @Override
public double getValue(int row, int col) throws MatrixIndexOutOfBoundsException {
if ((row < 0) || (col < 0) || (row >= mas.size()) || (col >= mas.get(0).size())) {
throw new MatrixIndexOutOfBoundsException("Inadmissible value of an index.");
}
return mas.get(row).get(c... |
e93d9646-574c-402b-875d-5f9416d83fe7 | 9 | public String toString() {
String result = "Runs from: " + m_RunLower + " to: " + m_RunUpper + '\n';
result += "Datasets:";
for (int i = 0; i < m_Datasets.size(); i ++) {
result += " " + m_Datasets.elementAt(i);
}
result += '\n';
result += "Custom property iterator: "
+ (m_UseProper... |
a0cfddd3-dd31-4f32-a0d7-0c56816d36be | 2 | public void send(String message) {
this.logger.debug("Sending '" + message + "'");
DatagramSocket clientSocket = null;
try {
clientSocket = new DatagramSocket();
byte[] sendData;
sendData = message.getBytes();
DatagramPacket sendPacket = new Datag... |
49a8fafe-9d51-4be2-8063-efdf392d1da4 | 1 | public static Coordinate2D fromString(String fStr)
{
String[] fStrSplit = fStr.split (",");
double cX = 0;
double cY = 0;
try {
cX = Double.parseDouble (fStrSplit[0].trim ());
cY = Double.parseDouble (fStrSplit[1].trim ());
} catch (Exception e) {
e.printStackTrace ();
return null;
}
re... |
286e16d9-afd2-42bd-8f8b-c07eb900a5d9 | 9 | private void loadClassFiles(String dir, String pack) {
urls = new Vector<URL>();
File file = new File(dir);
if (!file.exists())
return;
File files[] = file.listFiles();
for (File f1:files){
if (f1.getName().endsWith(".zip")){
unZip(f1.getAb... |
b8154aaf-1d49-48ab-9a62-c66cf6d7923c | 6 | public static boolean zipFolderTo(File folder, File outputLocation) {
FileOutputStream fOut = null;
BufferedOutputStream bOut = null;
ZipArchiveOutputStream tOut = null;
try {
outputLocation.mkdirs();
outputLocation.delete();
fOut = new FileOutputStream(outputLocation);
bOut = new BufferedOutputStr... |
b0251dad-c01e-42ab-80e6-34a86522d5c1 | 1 | public static synchronized Singleton getSingletonObject()
{
if (singletonObject == null){
singletonObject = new Singleton();
}
return singletonObject;
} |
5653a41a-3d27-40d6-97ef-972cf99f5d4d | 2 | public void clear(int color) {
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
set(i, j, color);
}
}
} |
abdf96e3-45fe-4ed6-b6ab-48695b994c02 | 7 | protected void dumpTree(int depth,StringBuffer text)
throws Exception {
for (int i = 0; i < m_sons.length; i++) {
text.append("\n");
for (int j = 0; j < depth; j++)
text.append("| ");
if(m_hasConstr)
text.append(m_localModel.leftSide(m_train)+ "#" + m_id);
else
... |
7a17f789-476a-471b-bcc5-eb2c26f9bb15 | 6 | public void attackingMove(){
if ((getxCoord() - speed < rightBoundary && getxCoord() - speed > leftBoundary)
&& (getyCoord() < bottomBoundary && getyCoord() > topBoundary)) {
if(getyCoord() < 117){
setImageIcon(upBoat);
setyCoord(getyCoord() ... |
b888b81b-fe80-47cb-b7db-5e5ce9e59266 | 8 | final boolean method796(ConfigHandler interface17, int i) {
anInt1351++;
if (((NpcDefinition) this).anIntArray1377 == null)
return true;
int config = -1;
if (anInt1368 != -1)
config = interface17.getSetting(anInt1368);
else if (anInt1354 != -1)
config = interface17.getRawConfig(anInt1354);
if (conf... |
c5327ea0-3a72-4403-9216-f484e4bad834 | 7 | public void testConstructor_int_int_int_DateTimeZone() throws Throwable {
DateMidnight test = new DateMidnight(2002, 6, 9, PARIS);
assertEquals(ISOChronology.getInstance(PARIS), test.getChronology());
assertEquals(TEST_TIME_NOW_PARIS, test.getMillis());
assertEquals(2002, test.getYear())... |
7e7e7574-110c-4a97-a857-754daf802bd9 | 9 | public static void main(String args[]) {
long startT = System.currentTimeMillis();
//assume all are prime
for(int i = 2; i < isPrime.length; i++)
isPrime[i] = true;
setIsPrime();
for(int i = 1000; i < 10000; i++)
if(isPrime[i])
for(int j = i+1; j < 10000; j++)
if( isPrime[j] && isPerm(i, j) ... |
bdfab3e2-20f2-43d2-ac06-2c350d519213 | 9 | private Printer newJavaPrinter(String n, List<String> imports, String sup, String type, List<String> impl, String jdoc) throws FileNotFoundException {
String name = properties.getProperty(n);
if ( name == null ) throw Util.failure("unknown class template: "+n);
File f = new File(name + ".java");... |
0b5b12f1-8691-43e9-b1b3-85269b257cd7 | 9 | public static File createTemplateClassesDir(File tmpDir, String dirPath,
Log log) {
File destDir = null;
if (dirPath != null && !dirPath.isEmpty()) {
// handle file-based paths
if (dirPath.startsWith("file:")) {
des... |
e3622a7b-fd80-4375-80a9-86d485239d4f | 1 | public void start() {
for (Citation i : citations) {
recogniseCitation(i);
}
} |
2a6d2002-bcce-453c-aef9-f091f0d3415d | 4 | @Override()
public void tick(int verb) {
super.tick(verb);
if (verb == DOWN && brainMode.isSelected()) {
// if it's a fresh piece, call the brain to give us
// some ideal real estate for it
if (count != saveCount){
board.undo();
idealLocation = brain.bestMove(board, currentPiece, HEIGHT, null);
... |
5db6b4df-6e0c-4d03-b3cb-a391f444a9fe | 4 | public boolean removeHole(int holeNumber) {
boolean success = false;
if(holeNumber <= getHolesPos().size()) {
// Remove Breeze
Position hole = new Position();
for(int i=-1; i<2; i++) {
hole.setX(getHolePos(holeNumber-1).getX());
hole.setX(hole.getX()+i);
for(int j=-1; j<2; j++) {
... |
5e3f5ba7-50aa-4b5d-bde9-bfa71d7e98b1 | 2 | public void clearScreen(int colour){
for(int x = 0; x < width; x++){
for(int y = 0; y < height; y++){
setPixel(x, y, colour);
}
}
} |
291341d0-16d1-4109-8dde-dedcc20d8bbf | 0 | public void setAdult(boolean adult) {this.adult = adult;} |
8308c277-18b3-41c2-b271-43523e4830c0 | 4 | private void expand2(byte[] src, byte[] dst) {
for(int i=1,n=dst.length ; i<n ; i+=4) {
int val = src[1 + (i >> 2)] & 255;
switch(n-i) {
default: dst[i+3] = (byte)((val ) & 3);
case 3: dst[i+2] = (byte)((val >> 2) & 3);
case 2: dst[i+... |
10a5b974-d1ca-4aa4-8a36-d39617cbfa63 | 7 | protected void produceRows(ValueNode root, LinkedList<Object[]> rowsPool,
LinkedList<Object[]> result, Set<Integer> processedFields) {
if (root.fieldIdx != null) { // Field value (leaf)
int fieldIdx = root.fieldIdx.intValue();
if (rowsPool.size() == 0) {
// Create new row, and push it to the rows pool
... |
fe07e547-2e1e-4e68-bb25-531304d05d08 | 3 | public static String getGlyphName(int unicode) {
while (glyphLoaderThread != null && glyphLoaderThread.isAlive()) {
synchronized (glyphToUnicodes) {
try {
glyphToUnicodes.wait(250);
} catch (InterruptedException ex) {
// ignore
... |
14748981-7bc6-4b51-be14-f9bea5e53e06 | 3 | public AntennaConnection() throws CorruptConfigurationEntryException {
if(! initialized) { // only initialize once
double geomNodeRMax = Configuration.getDoubleParameter("GeometricNodeCollection/rMax");
try {
rMaxSquare = Configuration.getDoubleParameter("UDG/rMax");
} catch(CorruptConfigurationEntryExce... |
ef1ec7e7-5ae8-4576-bfc8-b8c8a268b02c | 6 | @Override
public void run() {
int buffersize=size;
double datasize=30*buffersize*1024;
System.out.println(datasize+"");
int num=(int)datasize/buffersize;
byte toSend[] = new byte[buffersize];
byte toReceive[] = new byte[buffersize];
for (int i=0; i<buffersize; i++){
toSend[i] = (byte)2;
}
long s... |
ea9095cb-d13d-4596-975e-5d836b45dac4 | 0 | private void swap(int[] array, int left, int right){
int temp = array[left];
array[left] = array[right];
array[right] = temp;
} |
43bd085e-ac77-4b4c-b378-afc18ebae209 | 1 | @Override
public void onUpdate() {
if(x>=800 + 64)
x = -64;
x++;
} |
fb688f18-e5ad-4ede-85ac-465a61eb227e | 6 | public int getSlotsAvailable() {
List<Player> players = game.getPlayers();
int n = 0;
for (int i = 0; i < players.size(); i++) {
ServerPlayer p = (ServerPlayer) players.get(i);
if (!p.isEuropean() || p.isREF()) {
continue;
}
if (!(p... |
7907c42a-b736-4701-a21d-6fc1757a2b35 | 4 | public boolean push(E e) {
VALUES[end] = e;
if (end==begin && !empty) begin++;
end++;
if (end==MAX) end=0;
if (begin==MAX) begin=0;
empty = false;
return true;
} |
a965a6da-af18-49ed-ac4b-4245917f718d | 5 | @Override
public String composeText(boolean replaceTextContent, boolean recursive) {
String composed = "";
//Compose from text lines
for (int i=0; i<textLines.getTextObjectCount(); i++) {
if (recursive)
((LowLevelTextContainer)textLines.getTextObject(i)).composeText(replaceTextContent, recursive);
if (... |
c27682a7-93db-48b4-9a5a-46be58af32e7 | 9 | public static void unpackFTL(String path) {
if (!ShipIO.isNull(path) && new File(path).exists()) {
ftlLoadPath = new String(path);
debug("Unpacking .ftl:", true);
temporaryFiles = new File("sprlmnl_tmp");
temporaryFiles.mkdirs();
temporaryFilesInUse = true;
if (temporaryFiles != null && temporaryF... |
0ebad890-6670-48b9-93ae-3675491cc9a9 | 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)
bufpos... |
0b60c410-c711-4391-84ae-1949a4cdc1a5 | 3 | public MainFrame() {
extractorFactory = new ExtractorFactory();
initComponents();
jTree = new JTree();
jTree.setModel(null);
if (menuOpenIconPath != null && menuOpenIconPath != null
&& extractIconPath != null) {
ImageIcon menuOpenIcon = new Imag... |
d1c75b52-71ce-4119-a961-34fc273acdf8 | 2 | public Position getElementPosition(Element element) {
for (Map.Entry<Position, Square> entry : squares.entrySet())
if (entry.getValue().getElements().contains(element))
return entry.getKey();
return null;
} |
f2ef459a-e3da-4e25-abf0-8a9d605260f4 | 1 | static TreeNode findNodeOneLevel(TreeNode node, Object nodeDatum) {
if (nodeDatum.equals(node.getDatum())) {
return node;
}
return null;
} |
9c75e7cd-d739-4414-b378-e21fda3fee2a | 8 | public void moveDown()
{
Grid2d Temp; //TEMPORARY SHAPE that contains new position
Temp = new Grid2d(ARRAY_ROWS,ARRAY_COLS);
if (moveable == true)
{
for ( int r=0; r<this.maxRow(); r++)
{
for (int c=0; c < this.maxCol(); c++)
{
boolean value = this.getElement(r,c);
if ( value == t... |
8325c28e-5498-4c23-a406-edde6d8b5ead | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
11f60ae8-17ae-42e6-8e1c-538afb1e4d79 | 5 | @EventHandler
public void onLeaveArena(PlayerLeaveArenaEvent evt){
for(Map.Entry<Arena, Location> entry : SignUpdate.getCons().signLocs.entrySet()){
if(entry.getKey() != evt.getArena())return;
if(entry.getValue().getBlock().getType() != Material.SIGN ||
entry.getValue().getBlock().getType() != Material.S... |
11d21fc2-3dde-4291-a05c-da4ca60c3275 | 0 | public void setExtra(Map<String, String> extra) {
this.extra = extra;
} |
1e4fc06a-932e-4fac-82fb-b411b806a0a0 | 3 | @Test
public void testSortWithValues() {
long[] ids = new long[] {7,4,5,8,2,9};
float[] valuef = new float[] {7.0f, 4.0f, 5.0f, 8.0f, 2.0f, 9.0f};
byte[] valuedat = new byte[4 * valuef.length];
FloatConverter floatConv = new FloatConverter();
for(int i=0; i < valuef.length; ... |
541588b6-49de-4ee7-8058-900b4dcf0b54 | 8 | public static String removeBlockComments(String allCode) {
char[] characters = allCode.toCharArray();
int pos = 0;
allCode = "";
for(char character : characters) {
if(character == '/') {
if(pos == 0) pos++;
else if(pos == 3) {
... |
abd4153a-2e09-453f-8800-1b26d2f94003 | 9 | public static int[] assignNextMin(int heap[])
{
int pos = -1;
int min = 0;
if( a1.length > (p1+1) )
{
min = a1[p1+1];
pos = 0;
}
if( a2.length > (p2+1) )
{
int value = a2[p2+1];
if(value < min)
{
min = value;
pos = 1;
}
}
if( a3.length > (p3+1))
{
int value... |
786bf241-52dc-457c-9e4c-70253eaa7eaf | 2 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof DayArrivedMessage)) return false;
DayArrivedMessage that = (DayArrivedMessage) o;
return Arrays.equals(playerNames, that.playerNames);
} |
aa1a979c-6eac-4c46-9527-3d971c1414b3 | 6 | public static World getInferenceCache(Context context, Keyword kind) {
if (!Logic.worldStateP(context)) {
return (((World)(context)));
}
{ World world = Logic.lookupInferenceCache(context, kind);
if (world != null) {
return (world);
}
Logic.processCheckTypesAgenda();
w... |
59613d8b-1ada-4918-80b3-52053e9fcece | 7 | private Sequence extractSequence(Node node) {
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (node.getNodeName().equalsIgnoreCase("datablock")) {
Node child = node.getFirstChild();
while(child != null) {
if (child.getNodeType()==Node.TEXT_NODE) {
String seqText = child.getNodeValue().trim();
... |
451e27ac-8777-4d02-b81b-4bc6a6df9b15 | 2 | public LocalInfo findSlot(int slot) {
for (int i = 0; i < count; i++)
if (locals[i].getSlot() == slot)
return locals[i];
return null;
} |
5eeae906-0431-4d51-85a4-65db43fab8e3 | 0 | @Override
public void buildPart2() {
} |
a6f7f2fe-ca2c-4c87-983f-1f82bcbe95d6 | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=proficienc... |
df3b766b-030f-454a-a528-a54cbc4828eb | 3 | public static void insertText(Node node, JoeTree tree, OutlineLayoutManager layout) {
// Abort if node is not editable
if (!node.isEditable()) {
return;
}
Node newNode = new NodeImpl(tree,"");
int newNodeIndex = 0;
Node newNodeParent = null;
if ((!node.isLeaf()) && (node.isExpanded())) {
newN... |
b46506b0-abea-4896-b5cd-1fd1e00983cb | 4 | public void write(DataOutputStream out) throws IOException {
int i, n;
out.writeInt(0xCAFEBABE); // magic
out.writeShort(minor); // minor version
out.writeShort(major); // major version
constPool.write(out); // constant pool
out.writeShort(accessFlags);
out.write... |
700539f8-a854-4695-a750-77ff3f1fef65 | 0 | public void setP(byte[] value) {
this.p = value;
} |
474d5916-6c3e-43e0-9344-1f61b9e16e58 | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
45031d59-74ea-4b08-bc84-48bbd3486e48 | 5 | public static void loadProfiles(String... langs) throws LangDetectException {
for(int i=0; i<langs.length;i++){
InputStream is = LangProfile.class.getClassLoader()
.getResourceAsStream("profiles/"+langs[i]);
try {
LangProfile profile = JSON.decode(is, Lang... |
953b9b4d-1da9-472d-af03-a9768e470a18 | 5 | private void parentRoulette() {
// TODO Auto-generated method stub
long totalFitness = 0;
for(Chromasome chro : population){
totalFitness += chro.getFitness();
}
mu = totalFitness / populationSize;
long varHold = 0;
//long selection = (long)(rand.nextDouble() * totalFitness);
for(Chromasome chro : po... |
ac32e21b-b315-433a-8d5d-9f5c031571b1 | 8 | static private int jjMoveStringLiteralDfa10_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(8, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0);
return 10;
}
switch(curChar)
{
c... |
74645e88-1bf1-440b-a2d4-9343694e2c0d | 8 | @Override
public void actionPerformed(ActionEvent ae)
{
// TODO Auto-generated method stub
if(ae.getSource()==okButton)
{
if(nameTextField.getText().equals("") || subjectTextField.getText().equals("") || topicTextField.getText().equals(""))
{
JOptionPane.showMessageDialog(this,"Please fill all the F... |
365cb74f-5b13-4a8b-ae08-babf1e2f8f02 | 3 | @SuppressWarnings("static-access")
private void ROUND3() {
enemises.clear();
System.out.println("Round3!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
c083a5b6-0d53-4e94-a0e1-96f83564d411 | 1 | public Character(String x, boolean isLiving, boolean isControlled) {
isAlive = isLiving;
if (isControlled == true) {
System.out.println("Controller Running");
Controller2.start();
}
Controller3.start();
name = x;
run();
} |
b1a08ba0-ae2c-432f-9127-8e789b104d78 | 6 | @Override
public void keyReleased(KeyEvent evt) {
//Get key char, convert to string and make it lowercase for easier comparison
String key = Character.toString(evt.getKeyChar()).toLowerCase();
//For 3 orbs
if(key.equals("q")) {
invokerGamePlayPanel.setNewOrbs(key);
}
else if(key.equals("w")) {
... |
6637f7dd-6c5a-49b3-a1ec-5bf499241ca8 | 2 | public static int minimum(int ar[]) {
int min = ar[0];
System.out.print("Array Is :\t");
for (int i = 1; i < ar.length; i++) {
System.out.print(ar[i] + " ");
if (min > ar[i]) {
min = ar[i];
}
}
System.out.print("\n");
return min;
} |
0abdc7d1-f5a2-4d32-8d40-251bb2ad005b | 0 | @Override
public void actionPerformed(ActionEvent e) {
((PreferencesFrame) GUITreeLoader.reg.get(GUITreeComponentRegistry.PREFERENCES_FRAME)).show();
} |
63ffab74-39ea-4700-a8b0-5e263c2a22e6 | 3 | public void ayuda(JTextArea area){
try {
BufferedReader in = new BufferedReader(new FileReader("help.txt"));
String cadena;
while ((cadena = in.readLine()) != null) {
area.append("\n"+cadena);
}
in.close();
} catch (FileNotFound... |
96fb41dd-f7f1-4a86-8cba-034bd7b8b831 | 9 | public Item buyNewItem(int forLevel){
Random gen = new Random();
int chance = gen.nextInt(100);
if(chance<25) //25% chance of a Core
{
switch(gen.nextInt(Math.max(2+(forLevel/10),2))){ //A base minimum searchable items, to a maximum of the items
case 0:
return new Item("Core", "Trigger", forLevel, s... |
da913334-466a-41da-b364-3ed145a66afa | 3 | private void copyPALtoABGR(ByteBuffer buffer, byte[] curLine) {
if(paletteA != null) {
for(int i=1,n=curLine.length ; i<n ; i+=1) {
int idx = curLine[i] & 255;
byte r = palette[idx*3 + 0];
byte g = palette[idx*3 + 1];
byte b = palette[i... |
586fad0d-aaec-413e-9815-02e1137ac00e | 6 | private static int Consultation(int choosenMenu) {
switch (choosenMenu) {
case 1:
for (Iterator<String> it = listLeague.keySet().iterator(); it.hasNext();) {
String keyListLeague = it.next();
League leagueToDisplay = listLeague.get(keyListLeag... |
c2d84f6a-c8c8-4da1-9338-2153040c0799 | 8 | private BitSet selectRadialBonds(String str) {
MolecularModel mm = (MolecularModel) model;
int n = mm.bonds.size();
if (n == 0)
return null;
BitSet bs = new BitSet(n);
if ("selected".equalsIgnoreCase(str)) {
synchronized (mm.bonds.getSynchronizationLock()) {
for (int i = 0; i < n; i++) {
if (mm... |
6da56381-f355-4e5f-8f1f-86b9ffa613c2 | 5 | public Item generateItem(){
Vector2f v = new Vector2f(0,0);
if (type == ItemType.ARMOR){
return new Armor(this, v,0,0);
}
else if (type == ItemType.HEAD){
return new Helm(this, v,0,0);
}
else if (type == ItemType.OFFHAND){
return new OffHand(this,v,0,0);
}
else if (type == ItemType.BOOTS){
r... |
328af260-8c87-43db-8e66-0953a84acd3e | 7 | public final void run() throws FatalError {
Output.printClockLn(" -> Außendienst ("
+ ((this.difficult == 1) ? "schwer" : "leicht")
+ ((medicine != -1) ? ", Medizin ab " + medicine + "%" : "")
+ ")", Output.INFO);
try {
boolean result = false;
for (int i = 0; i < 10 && !result; i++) {
if (i ... |
cc5a3dd3-66fb-4ce9-8b52-ed96a530cfc4 | 7 | public void move(int f, int t) {
if (this.getPoint(f).size() == 0) {
// no piece to move
StdOut.println("no piece to move");
return;
}
if ((getCurrentPlayer() == getPlayer1()
&& f < t)
|| (getCurrentPlayer() == getPlayer2()
&& t < f)) {
// correct direction
if (this.getState().movesLef... |
75783543-4939-4f99-b363-c5614c2af653 | 7 | @SuppressWarnings("rawtypes")
@Override
protected void checkAfterParse(Method method) throws DaoGenerateException {
super.checkAfterParse(method);
MapperBy mapperBy = method.getAnnotation(MapperBy.class);
Class<? extends RowMapper> mapperType = AutoDetectRowMapper.class;
if (mapperBy != null) {
mapperType... |
1b3eada2-b3ca-425c-a74f-0349e39c50c8 | 1 | public static Class<?>[] getAllInterfaces(Object instance) {
Assert.notNull(instance, "Instance must not be null");
return getAllInterfacesForClass(instance.getClass());
} |
4255e706-eb12-4609-b11c-baf3cc25c50b | 8 | public int Winner() {
Set<Integer> remainingPlayers = new TreeSet<Integer>();
for (Planet p : planets) {
remainingPlayers.add(p.Owner());
}
for (Fleet f : fleets) {
remainingPlayers.add(f.Owner());
}
remainingPlayers.remove(0);
if (numTurns > maxGameLength) {
int leadingPlayer = -1;
int mostSh... |
643cfa4c-08c8-4293-ba72-a78d6a8c4527 | 2 | public static final boolean isXAML(String fileName) {
for (String file : XAML) {
if (file.equals(fileName)) {
return true;
}
}
return false;
} |
7909f47b-4b17-49d1-8c42-e7d56795048d | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(commands.size()<2)
{
mob.tell(L("Invoke awe on whom and of whom?"));
return false;
}
final String aweWhom=CMParms.combine(commands,1);
final MOB target=getTarget(mob,new XVector(comman... |
629cead1-e8fb-4c90-b390-5eff449fff01 | 7 | @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
{
this.version = USER_VERSION;
int version = ois.readInt();
if(version >= 2 && version < 3)
{
this.username = ois.readUTF();
this.stats_normal = readArrayStats((ArrayList<Stats>) ois.... |
386c5260-5724-4ba3-b177-98adf95e86ed | 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... |
1521e71a-b069-450a-9ac5-7f6ccb2b91b8 | 0 | public double capacity() { return capacity; } |
1a41b0be-3585-4604-937e-48041243d480 | 1 | public void updateObjects() {
for (int i = 0; i < objects.size(); i++) {
tempObject = objects.get(i);
tempObject.update(objects);
}
} |
95deafa6-154f-40d5-9e34-6bc2749760fd | 0 | public static void main(String[] args) {
Target target = new Adapter();
target.method1();
} |
2cf9a851-5bd2-471d-99b5-3c10dc6ddfbd | 6 | private void callBiOperator2(String op, String method, String invertMethod, String alterantive, String invertAlterantive, XValue left, XValue right) {
if (handles__getItem__(left)) {
callHelper("_" + method, left, right);
} else {
XValue m = XUtils.lookupTry(rt, left, method, XValue.REF_NONE);
if (m == nul... |
f4bab9b8-1ce9-4211-8afa-21dcd53f8543 | 8 | public int compareTo(Object tmp )
{
int result;
if (tmp instanceof Person)
result = (firstTicks < ((Person)tmp).GetFirstTicks() ? -1 : (firstTicks == ((Person)tmp).GetFirstTicks() ? 0 : 1));
else if (tmp instanceof BlankEvent)
result = (firstTicks < ((BlankEv... |
98826cdc-d6cf-4d25-8727-607198eb536f | 8 | public static Instruction getFieldInsn(
final int opcode,
final String owner,
final String name,
final String desc) {
return new Instruction() {
@Override
public boolean accept(AbstractInsnNode node) {
if (node.getType() == ... |
196dc34f-f878-4a44-8d06-3dd8bdbc1e2e | 4 | private void tvFileViewValueChanged(javax.swing.event.TreeSelectionEvent evt)//GEN-FIRST:event_tvFileViewValueChanged
{//GEN-HEADEREND:event_tvFileViewValueChanged
boolean sel = true;
TreePath path = tvFileView.getSelectionPath();
TreeNode _tn = null;
if (path == null) sel =... |
0de35ac7-02cb-45bf-aadf-832409586ff8 | 4 | public void headToHead(Attraction attr1, Attraction attr2) {
if (attr1 != null) {
//recommendation.addAttraction(attr1);
for (String tag : attr1.getTags()){
tags.add(tag);
}
}
if (attr2 != null) {
//recommendation.addAttraction(attr2);
for (String tag : attr2.getTags()){
tags.add(tag);
}... |
a7bfa3b1-150a-4260-84ed-45e0aef59e08 | 3 | void attackPlaceVerticallyAbove(int position, char[] boardElements, int dimension, int numberOfLinesAbove) {
while (numberOfLinesAbove > 0) {
if (isPossibleToPlaceOnPreviousLine(elementVerticallyAbove(dimension, position, numberOfLinesAbove))
&& isBoardElementEmpty(boardElements[... |
9f397534-68f9-4398-9600-ad47f2c0b897 | 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... |
16c524b4-c276-4dc5-8b5a-e922215d1f13 | 1 | @Test
public void delMaxTest() {
for (int i = 1; i < 10; i++) {
int[] inserts = initializeRandomTable(10000 * ((int) Math.pow(2, i) / 4));
printTime(testPriorityQueuePoll(inserts));
printTime(testBinaryHeapDelMin(inserts));
}
} |
d94936c7-26df-42cc-ab95-ff9a4d43a478 | 0 | public void addSimulator(Automaton atm, AutomatonSimulator simulator, boolean isTuring) {
// TODO Auto-generated method stub
myAutomaton=atm;
mySimulator=simulator;
myIsTuringMachine=isTuring;
} |
047f96e5-0113-4bb1-b8a8-075bfe35d508 | 0 | public boolean isHorizontal() {
return isHorizontal;
} |
f7100b0b-beb8-4514-95a5-f9a69e9426c9 | 3 | public static Choice getChoice(String s) {
for (Choice c : Choice.values())
for (String string : c.getOptions())
if (string.equalsIgnoreCase(s))
return c;
return null;
} |
ca348d2d-724e-42ba-9be2-8cb626bd4185 | 2 | public String join(String separator) throws JSONException {
int len = this.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 1) {
if (i > 0) {
sb.append(separator);
}
sb.append(JSONObject.valueToString(this.myArrayL... |
730da9d7-9d06-4f58-89f6-227616e50e9d | 7 | public int hire(ArrayList<Person> workPool){
SkillType active = holding.getRelevantSkill();
if (active == null) return 0; //no active skill is bad.
workers.clear();
int capacity = holding.getTaskAdjustedCapacity();
for (Person worker:workPool){
//do an insertion Sort.
ListIterator<Person> i = workers... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.