method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
30691f48-d378-435f-bcf7-9bc6ff4d21a4 | 9 | public void readNumber() {
boolean hex = false;
int start = column - 1;
/* special case for hex numbers */
if (line.charAt(start) == '0' && line.charAt(column) == 'x') {
column++;
hex = true;
}
while (column < line.length()) {
char c = line.charAt(column);
if (!Character.isDigit(c)) {
... |
643d0c14-c89f-40b1-aacc-c712a44adc7c | 3 | public void EliminaFinal ()
{
if ( VaciaLista())
System.out.println ("No hay elementos");
else
{
if (PrimerNodo == PrimerNodo.siguiente)
PrimerNodo = null;
else
{
NodosProcesos Actual =PrimerNodo;
while (Actual.siguiente.siguiente != PrimerNodo)
Actual = Actual.siguiente;
Actua... |
58d8b3a5-3af6-4240-a0dd-3f277a3fbe31 | 4 | public int get(final int index) {
final int i0 = index >>> 23;
final int[][] map1;
if (i0 != 0) {
if (map == null)
return NOT_FOUND;
map1 = map[i0];
if (map1 == null)
return NOT_FOUND;
} else
map1 = map10;
final int[] map2 = map1[(index >>> 12) & 0x7ff];
if (map2 == null)
return NO... |
d3ac3813-dea6-4301-85a7-e8a27796e8b1 | 3 | public static void main(String[] args) {
if(args.length < 1){
System.err.println("Usage: java SudokuSolver intput-file.txt");
System.exit(0);
}
Puzzle sudoku = new Puzzle(3);
try {
sudoku.populatePuzzle(args[0]);
System.out.println(sudoku.toString());
... |
8d071f98-dd76-4b61-a3a1-2fc8c0fcd45c | 7 | private void jTextField6FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextField6FocusLost
boolean es_componente=false;
int i=0;
Component[] components = jPanel3.getComponents();
while ((!es_componente)&&(i<components.length)){
if (components[i]=... |
45166d63-c53f-4850-b754-de280ca817d5 | 9 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof Tuple<?, ?>)) {
return false;
}
Tuple<?, ?> other = (Tuple<?, ?>) obj;
return equal(first, other.getFirst())
&& equal(second, other.getSecond());
} |
aa3316bc-ce00-492e-9b42-31a7957d4371 | 2 | private static void deal() {
deck.shuffle();
System.out.println("Shuffled");
for (int i = 0; i < 26; i++) {
for (int j = 0; j < hands.length; j++) {
hands[j].put(deck.getCard());
}
}
} |
2096f65a-19a8-4d4b-90c0-f04e55ae1ad3 | 2 | public void iniciarCarga()
{ //Utilizando Hilos
new Thread()
{
@Override
public void run()
{
int i = 0;
while (i <= 100)
{
i+=2;
Progreso.setValue(i);
t... |
230067d9-ac1b-4c54-b676-ec08f8cc537d | 2 | private boolean checkMouse(GenericNode depart) {
if (!graph.poPornoT(depart)) {
listVarInt.put("actuel", listVarInt.get("actuel") + 1);
if (listVarInt.get("actuel") == listSouris.size()) {
listVarInt.put("actuel", 0);
}
return true;
}
... |
12f8fecf-6b06-4f08-9250-16200426989c | 7 | @Override
public void run()
{
// Synchronise on thread counter
synchronized( AsyncTransmitter.threadCount )
{
// If no other threads exist, change receiver
if( AsyncTransmitter.threadCount < 1 )
... |
65844494-170d-4bcf-93c8-a1af25fb3e1a | 2 | @Override
public void paint(Graphics gr)
{
initDraw(gr);
switch(serverMode)
{
case graphic:
setGraphicMode();
DrawGraphicMode(gr);
break;
case text:
setTextMode();
DrawTextMode(gr);
break;
default:
break;
}
} |
df12e03f-726f-48f3-8018-cf56026cd75a | 5 | public boolean canBlockSeeTheSky(int x, int y)
{
if(chunkID < 0)
{
x = 15-x;
}
if(x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length)
return false;
return y >= heightMap[x];
} |
7032506b-1464-4024-ae95-774154fa749a | 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... |
73703326-f042-4738-8477-c81a8ebe070c | 4 | private void loadPanel() {
Vector<String> settings = new Vector<>();
for (BaseSetting bs : BaseSetting.SETTINGS) {
settings.add(bs.getName());
}
Vector<String> generators = new Vector<>();
for (BaseGenerator bg : _setting.getGenerators()) {
generators.add(... |
7c7fd88d-d076-416e-a3a4-abcd45f829bb | 6 | public void setFields(Materie m, Node node) {
NodeList childNodes = node.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node cNode = childNodes.item(i);
if (cNode instanceof Element) {
String content = cNode.getLastChild().getTextContent().trim();
switch (cNode.getNodeName()) {
... |
c9ead4a3-5c70-4a3b-b876-8c1bdd3cbd5b | 1 | public ValueType top() throws NotExistException {
if (amount != 0) {
return head.value;
} else {
throw new NotExistException("Stack is empty!");
}
} |
13630fe7-1866-48a3-b1e0-3b4d5f847ed3 | 5 | private void addAllUniforms(String shaderText) {
HashMap<String, ArrayList<GLSLStruct>> structs = findUniformStructs(shaderText);
final String UNIFORM_KEYWORD = "uniform";
int uniformStartLocation = shaderText.indexOf(UNIFORM_KEYWORD);
while (uniformStartLocation != -1) {
if... |
b68ab1ff-9403-4794-a590-ca3c139a1dd0 | 7 | @Override
protected void processGraph()
{
theLevels = new ArrayList<Map<Node, Graph>>(levelNodes.size());
for(Map<Node, Node> level : levelNodes)
{
// create the level
Map<Node, Graph> graphs = new HashMap<Node, Graph>();
theLevels.add(graphs);
// put the nodes in corresponding graphs
for(Map... |
c40a931e-b967-4f6b-8a75-7d7bfaf9e935 | 6 | protected Behaviour nextBrowsing() {
final float range = Nest.forageRange(species) * 2 ;
Target centre = mind.home() ;
if (centre == null) centre = this ;
final Batch <Flora> sampled = new Batch <Flora> () ;
world.presences.sampleFromKey(centre, world, 5, sampled, Flora.class) ;
/*
fina... |
da6c76f7-a31a-41fe-8d6b-067bbafd0de6 | 9 | private void rotate_nearest_y(final Image image, final Image rotated) {
// Initialization:
messenger.log("Nearest-neighbor sampling in x-z");
progressor.status("Rotating"+component+"...");
progressor.steps(odims.c*odims.t*odims.z*odims.y);
// Rotate using the inverse of the rotation matrix:
final Coor... |
929e6cae-dc60-42b9-b64b-5e8ee22e5cef | 9 | public void buildTAFFile(ArrayList<String> names,
ArrayList<String> numbers,
ArrayList<String> courses) throws IOException {
File workAreaFile = new File(directory + WORK);
HashMap<String, String> workAreas = loadWorkAreas(workAreaFile);
HashMap<String, ArrayList<String>... |
8e1b86a2-7e5e-4ac3-9331-b06d72766401 | 8 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if((mob.isInCombat())&&(mob.fetchWieldedItem()==null))
{
final Room R=mob.location();
if((R!=null)
&&(R.findItem(null,"club")==null)
&&((R.domainType()==Room.DOMAIN_OUTDOORS_WOODS)
||((R.myResource()&RawMater... |
e52f3491-4da4-4827-84ad-579096010c15 | 8 | public PingjiaoResultVO getTeacherPjResult(CourseVO course) {
String sql =
"select "
+ "tchstatus,"
+ "sturesult "
+ "from "
+ "class "
+ "where "
+ "course_grade=? and "
+ "course_semester=? and "
+ "course_name=? and "
+ "class=? and "
+ "teacher_id=?;";
String[] paramete... |
077ba063-0d0c-402c-ad84-628878cfa11f | 9 | private void updateOffsets() {
if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) {
this.xOffset = 0.0;
this.yOffset = 0.0;
}
else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) {
this.xOffset = -this.blockWidth / 2.0;
this.yOffset = 0... |
0629e1a5-656b-4afd-8b33-8fb0c68bf3a5 | 8 | public void deleteNode(T deleteItem){
LinkedListNode<T> current;
LinkedListNode<T> trailCurrent;
boolean found;
if ( first == null) //the list is empty
System.err.println("Cannot delete from an empty "
+ "list.");
else{
i... |
faa669dc-2b99-4297-b163-c52d2b059b46 | 0 | public Object get(String key) {
return datas.get(key);
} |
5194def4-7910-4c31-817a-c23c2072c5f1 | 6 | void register_cont(IFCModel __model) throws Exception {
JButton[] buttons;
int _MAX;
_model = __model;
_toolbar.removeAll();
buttons = _model.exportTools();
if (buttons != null) {
_MAX = buttons.length;
for (int i=0; i... |
d7766546-f6a1-4449-895f-fe853a328a7d | 2 | public int withdrawAmount(int amount){
if(amount > 0 && (bal-amount >500))
{
bal -= amount;
}
else
System.out.println("You Have Low Balance\n So You Cannot able Withdraw from your Account");
return bal;
} |
110a4a8c-aad9-40b7-90dc-ff2a2b1736f4 | 2 | public int destinationNum()
{
if (locationEnd == null || locationEnd.length == 0)
{
return 0;
} else
{
return locationEnd.length;
}
} |
ef7636ea-3c71-4e08-9ae2-7f21e4daea2f | 2 | public int nextIndex() {
if (next == null) {
return size();
}
if (cache == null) {
cache = toArray();
}
return next.index;
} |
a84f31bc-53c1-4473-87c3-6ba8c899bb3c | 4 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == startStop){
if(playing){
playing = false;
startStop.setText("Start playing");
backButton.setEnabled(true);
stopMelody();
} else if(!playing) {
playing = true;
startStop.setText("Stop playing");
backButton.... |
67fe0387-3547-4035-a838-c40f919288f9 | 2 | protected void streamCopy (InputStream in, OutputStream out)
throws IOException {
logger.entering(getClass().getName(), "streamCopy");
byte[] buf = new byte[8192];
int bytesRead;
do {
bytesRead = in.read(buf);
if (bytesRead > 0)
out.wr... |
44644e9b-7048-4d52-9d27-f510a8e970e3 | 3 | public String cadastrar() {
if (!nome.isEmpty() && !crm.isEmpty()) {
MedicoDAO medico = new MedicoDAO(null, nome, crm);
FacesContext contexto = FacesContext.getCurrentInstance();
if (medico.cadastrar()) {
FacesMessage mensagem = new FacesMessage("Cadastro real... |
342b76dd-83d7-44a8-a1b4-1ad631e4b4ff | 4 | public double standardizedPersonMinimum(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
if(!this.va... |
0ae19c25-d70f-41f5-8e6c-d3a08c421b11 | 8 | protected void func_75208_c(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(thePlayer.worldObj, thePlayer, field_75228_b);
if (!thePlayer.worldObj.isRemote)
{
int i = field_75228_b;
float f = FurnaceRecipes.smelting().func_77601_c(par1ItemStack.itemID);
... |
066cf74b-d6a6-466c-8902-fb18fd51b88c | 6 | private Application() {
try {
System.out.println("Wachtwoord:");
Scanner sc = new Scanner(System.in);
pw = sc.nextLine();
swt = new Thread(new Runnable() {
@Override
public void run() {
try {
... |
e7f95abb-ad86-4f62-b64a-9ef37bf0d3db | 7 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Book other = (Book) obj;
if (!Objects.equals(this.book_ID, other.book_ID)) {
return false;
... |
c3ca3584-7e1f-4d27-822a-25b80ebed3cc | 5 | public void saveShieldsBaseToFile() {
if (plugin.getListener() == null || plugin.getListener().getShields() == null) {
return;
}
if (!shieldbaseFile.exists())
{
try {
shieldbaseFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
HashMap<Block, ShieldBase> map = p... |
730c015d-fc9a-498e-9bc5-3d4500b212a7 | 8 | protected static int partition(double[] arrayToSort, double[] linkedArray, int l, int r) {
double pivot = arrayToSort[(l + r) / 2];
double help;
while (l < r) {
while ((arrayToSort[l] < pivot) && (l < r)) {
l++;
}
while ((arrayToSort[r] > pivot) && (l < r)) {
r--;
}
... |
17941f40-7633-477c-898f-6d43782c698b | 2 | public String getNamesOfBoxes(){
if(!checkConsolidate)this.consolidate();
String names = "";
for(int i=0; i<this.nBoxes; i++){
BlackBox bb = openPath.get(i);
names = names + i +": "+bb.getName() + " ";
}
return names;
} |
7e824544-8972-4039-aae1-8f0a7b5d152a | 1 | public void draw(Graphics g) {
if (first == null)
return;
java.awt.Graphics2D g2 = (java.awt.Graphics2D) g;
Stroke s = g2.getStroke();
g2.setStroke(STROKE);
g2.setColor(COLOR);
g2.drawLine(first.getPoint().x, first.getPoint().y, hover.x, hover.y);
g2.setStroke(s);
} |
48c3e3a8-1e1e-4388-b828-a0bd288ab7d5 | 7 | private void fillField() {
LinkedList<ICard> listCardarenoteinfieldCards = new LinkedList<ICard>();
listCardarenoteinfieldCards.addAll(getUnusedCards());
for (int index = 0; index < sizeOfField; index++) {
if (this.getCardInFieldGame().get(index) == null
&& !(listCardarenoteinfieldCards.isEmpty())) {
... |
dd07c253-ab9f-47e2-b9d3-e8e3243b6ccd | 1 | private void tokenize() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
verifyValidParenStructuring();
if(!hasBeenEvaluated) {
this.expressionList = tokenizeImpl(removeWhiteSpace(this.expressionString.toCharArray()));
}
} |
b548d96a-57e9-4cb4-b774-52131490f02f | 0 | public ComputerPlayer(Game game) {
this.game = game;
} |
edb38044-aaca-4455-b70c-ec8e940b059b | 9 | protected void init() throws IOException {
if (internalIn2 != null)
return;
String encoding;
byte bom[] = new byte[BOM_SIZE];
int n, unread;
n = internalIn.read(bom, 0, bom.length);
if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) ... |
3182f2a3-5feb-43ee-b24d-a2d8af10f959 | 8 | private static final void drawCircleArcs(Graphics g, int x, int y, int xc,
int yc, int octant) {
switch (octant) {
// 1st Octant
case 1:
g.drawLine(y + xc, x + yc,
y + xc, x + yc);
break;
// 2nd Octant
... |
2e95e6dd-514f-4e6e-abd9-aded8e28a13c | 6 | public Token getLastNonCommentNonWhitespaceToken() {
Token last = null;
for (Token t=this; t!=null && t.isPaintable(); t=t.nextToken) {
switch (t.type) {
case COMMENT_DOCUMENTATION:
case COMMENT_EOL:
case COMMENT_MULTILINE:
case WHITESPACE:
break;
default:
last = t;
break;
... |
1185b4d9-148e-4ec8-ab0a-b244377de265 | 2 | private static void add(List<Point> points, List<Point> available, int x, int y)
{
Point p = new Point(x, y);
if (!points.contains(p) && !available.contains(p))
{
available.add(p);
}
} |
470d3cb0-e8eb-4ad1-a360-e1f3a320cf2c | 3 | public boolean stillRoom() {
for (int i = 0; i < _board.length; i++ ) {
for (int n = 0; n < _board.length; n++) {
if (_board[i][n] == 0) {
return true;
}
}
}
return false;
} |
e1c0bbb3-996f-4b14-a300-39f0c2b493cb | 2 | private void onInsertImageMenuItemClick(ActionEvent evt){
if(this.getJFileChooser().showOpenDialog(this) == JFileChooser.APPROVE_OPTION){
try {
String fullFilePath = this.getJFileChooser().getSelectedFile().getAbsolutePath();
InsertImageEventArgs args = new InsertImageEventArgs(this.getGraphics(), this.get... |
dc4bf67c-ae1e-4f7a-b834-a695fc011097 | 9 | public static void fillWithExampleData(TFacade ap) {
String t1[] = { "1", "Author1", "Title1", "ISBN1", "Publisher1" };
String t2[] = { "1", "Author2", "Title2", "ISBN2", "Publisher2" };
String t3[] = { "1", "Author3", "Title3", "ISBN3", "Publisher3" };
String t4[] = { "3", "Author1", "T... |
81f26c9f-583e-4e88-bedf-7cf267a696a5 | 4 | public String row(int i)
throws Exception
{
// Gather some basic information
int th = this.top.height();
int bh = this.bottom.height();
int tw = this.top.width();
int bw = this.bottom.width();
int h = th + bh;
// Determine padding
String padtop = "";
String padbot = "";
if... |
4b69998a-1c63-43e2-a774-e2793c9f73cd | 4 | public void onEnable() {
instance = this;
saveDefaultConfig();
tableManager = new TableManager();
if(FileIO.checkFileCreate("/FancyRoulette/", "tileslocations.bin")) {
FileIO.checkFileCreate("/FancyRoulette/", "spinnerslocations.bin");
tableManager.loadData();
}
if(! getConfig().getBoolean("opt ... |
1232d852-3a53-4897-afae-8615a6824270 | 6 | public static void setPublicKeys(Value publicKeyValues)
{
// Checks whether the value object has the required fields.
if(!publicKeyValues.hasChildren(ValueIdentifiers.getElGamalPublicKey()) ||
!publicKeyValues.hasChildren(ValueIdentifiers.getRsaPublicKey()) ||
!publicKeyValues.getFirstChild(ValueIdentifiers.... |
7895276a-0a0e-4399-b2db-fce16ff06231 | 5 | @Override
public void update(int delta) {
if(currentBehaviour!= null)
this.currentBehaviour.update(delta);
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
addY(-getMoveSpeed());
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
addX(-getMoveSpeed());
}
... |
ca8b45e7-63d3-4c31-8f57-3a4bc4ce7ee1 | 1 | @Test
public void testQuiz1() {
Quiz quiz = Quiz.getQuizByQuizName("Bunny Quiz");
int quizID = quiz.quizID;
// General info
assertEquals(quiz.category, "Animals");
assertEquals(quiz.creator.username, "stanford");
// Update
quiz.raterNumber = 100;
quiz.totalRating = 356;
quiz.updateCurrentQuiz(); ... |
abb53620-4612-4f45-b5b9-e29464b820d1 | 8 | private static final int getNextMatchPosImpl(String searchFor,
String searchIn, boolean goForward,
boolean matchCase, boolean wholeWord) {
if (wholeWord) {
int len = searchFor.length();
int temp = goForward ? 0 : searchIn.length();
int tempChange = goForward ? 1 : -1;
while (true) {
i... |
1e99ed3b-1632-41dc-8ecd-8756c4c9c167 | 0 | public Items getHead() {
return head;
} |
1255c857-8fee-445f-88b2-49a23694d36b | 4 | public void removeBinarization(Operation op) {
for (int i = 0; i < operations.size(); i++) {
if (operations.get(i) == op) {
JCheckBox deleted = allImages.get(i);
// stergem din hashtable-uri
labelList.remove(deleted);
imageList.remove(deleted);
// stergem din panelul mare din dreapta
/... |
5dda78f3-c0fa-4c85-8470-74c1e3e62f11 | 8 | private double[][] computeDistanceMatrix() {
int nIntersections = 0;
double[][] s = new double[nCircles][nCircles];
for (int i = 0; i < nPolygons; i++) {
char[] c = encode(i);
for (int j = 0; j < c.length; j++) {
if (c[j] == '0')
continue;
for (int k = j + 1; k < c.length; k++) {
if (c[k] ... |
51eb1dfa-66c7-4982-92d7-0da5cf1b492e | 2 | public ComplexMatrix add(ComplexMatrix b) throws Exception {
checkConsistenceAndThrowException(b);
int rowSize = getRowSize();
int colSize = getColSize();
ComplexMatrix mx = emptyMatrix(rowSize, colSize);
for (int ri = 0; ri < rowSize; ri++) {
for (int ci = 0; ci < ... |
bae7ae37-7e86-4e2e-887d-d6d1d51e6206 | 6 | public static Person createNewPerson(String email, String firstName, String lastName) {
if (email != null && !email.isEmpty() && firstName != null &&
!firstName.isEmpty() &&
lastName != null && !lastName.isEmpty()) {
return new Person(email, firstName, lastName);
... |
ae415aaa-985f-4f45-a6d9-acb9c345ae34 | 7 | public static int sum(int a, int b) {
int carry = 0;
int sum = 0;
for( int bit = 0 ; bit < 32; bit++) {
int x = ((1<< bit) & a) != 0 ? 1: 0 ;
int y = ((1 << bit) & b) != 0 ? 1: 0;
int z = x^y;
if(z == 0) {
z = carry;
... |
6714d26c-fef5-4bca-b047-e06c3f8c9128 | 1 | public WumpusPerceptionOntology() {
super(ONTOLOGY_NAME, BasicOntology.getInstance());
try
{
add(new PredicateSchema(TYPE_NAME), WumpusPerception.class);
PredicateSchema ps = (PredicateSchema)getSchema(TYPE_NAME);
ps.add(PERCEPTION_STENCH, (Primitive... |
aa943cd6-0215-4884-ab37-633177d403bf | 4 | @Override
public void learnNetworkRules(List<Pair> learningDataset, int startRuleNum,
int endRuleNum, int epochPerRule) {
double smallestError = 0;
int bestRuleCount = 0;
for (int r = startRuleNum; r <= endRuleNum; r++) {
createRules(r);
double iterError = 0;
System.out.println("==========");
... |
bf5ed7e4-59d9-48db-847e-e5818a78bc32 | 9 | public void setData(ItemCaract caract, Numeric value) {
if (caract.getNumericType() != value.getNumericType()) {
throw new IllegalArgumentException();
}
if (data.containsKey(caract.getNumericType())) {
throw new IllegalStateException();
}
data.put(caract, value);
boolean change = false;
do {
chan... |
1dd744eb-c502-4cf3-a5ea-74f3d42df96a | 3 | */
public void setPositions(Point position) {
int count = 0;
for (Iterator<Plant> it = plants.iterator(); it.hasNext();) {
Plant plant = it.next();
int x = (int) position.getX() + (count + 20);
int y = (int) position.getY() + (count + 20);
if (x > Grid.BOUND_MAX_X - 10) {
x = Grid.BOUND_MA... |
e0b75044-6eb7-44b6-9a78-0871d82c74cb | 1 | public static void Stop() {
if (Thread.currentThread() instanceof JSThread) {
JSThread current = (JSThread) Thread.currentThread();
current.jsContext.Stop();
}
} |
5f1ee1e4-ad4d-495a-a3a5-83e72f4a5b87 | 6 | public Instrument next() {
Random rand = new Random();
switch(rand.nextInt(6)) {
case 0:
return new Wind();
case 1:
return new Percussion();
case 2:
return new Stringed();
case 3:
return new Brass();
case 4:
... |
e416280b-bc9e-4e16-a7dd-245a62bc8347 | 9 | public static Map<String, Field> getPreferenceFields(Object o) {
Class<?> c = o.getClass();
Field[] prefFields = c.getDeclaredFields();
Map<String, Field> fields = new HashMap<String, Field>();
for (Field field : prefFields) {
int mod = field.getModifiers();
String name = field.getName();
Class<?> typ... |
937ca8ac-54c9-4de6-b5a7-2a2fa344d288 | 5 | public List<Edge> getDirections(Node to)
{
directionKeys.clear();
Node[] route = calculateRoute(to).toArray(new Node[calculateRoute(to).size()]);
//HashMap<String, Double> directions = new HashMap<>();
List<Edge> listToReturn = new ArrayList<>();
for (int i = 0; i < route.length; i++)
{
int next = 0;
... |
8bf59688-dae9-4b59-ae72-c55f659b497d | 0 | public void setMessage(String text) {
listModel.addElement(text);
this.invalidate();
this.validate();
} |
12ac32aa-4c5d-489f-9396-20474b785f2c | 3 | @Override
protected void process_pipe_term_ack ()
{
// Notify the user that all the references to the pipe should be dropped.
assert (sink!=null);
sink.terminated (this);
// In terminating and double_terminated states there's nothing to do.
// Simply deallocate the pi... |
463f9d28-5e6d-44a2-9cee-c838bc42841e | 8 | public boolean saveChunks(boolean var1, IProgressUpdate var2) {
int var3 = 0;
for(int var4 = 0; var4 < this.chunkList.size(); ++var4) {
Chunk var5 = (Chunk)this.chunkList.get(var4);
if(var1 && !var5.neverSave) {
this.func_28063_a(var5);
}
if(var5.needsSaving... |
e6e94b97-64d4-4d7b-ba9f-a0f9db0ec0fe | 2 | public Berechtigung getBerechtigungzuMitarbeiter(String Benutzername) {
ResultSet resultSet;
Berechtigung rueckgabe = null;
try {
resultSet = db
.executeQueryStatement("SELECT b.* FROM Berechtigungen b, OrgaEinheiten c, Benutzer a WHERE b.idBerechtigung = c.idMitarbeiterBerechtigung AND c.idOrgaEinheit = ... |
283928cd-db03-470b-8255-5244c76b81c6 | 9 | public static <E extends ConcurrentEntry<E>> ListReport reportDeadNodes(E e) {
ListReport report = new ListReport();
for (;;) {
final E next = e.getNext();
if (next == null) {
break;
}
if (!EntryUtils.isHead(e)) {
if (EntryU... |
66df9c32-2f10-41dd-b18a-0c5adf6afeca | 5 | public void saveBlockData() {
try {
if (!isOnStart) {
if (!this.fileX.exists()) {
this.invManager.createNewFile(this.fileX, this.worldDir);
}
save(blockX, this.blockFileX);
if (!this.fileY.exists()) {
... |
4a4a5e85-29a8-4751-b95c-3aad9fbac9c6 | 8 | private void algorithmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_algorithmButtonActionPerformed
try{
double crossChance = Float.parseFloat(crossover.getText());
double mutationChance = Float.parseFloat(mutation.getText());
int populationNum = Int... |
9ce12341-3f9d-42ab-ac40-8d6c5a80dc22 | 6 | private String getParsedText(String lineSeperator) {
StringBuilder parsedText = new StringBuilder();
if (jtpOutputTabs.getSelectedIndex() == TEXT_TAB_INDEX) {
return jtaOutputText.getText();
} else if (jtpOutputTabs.getSelectedIndex() == LIST_TAB_INDEX) {
DefaultListModel... |
c7e1ac5d-04d7-4f24-95e1-61f4f5267951 | 2 | public void testForFields_datetime_YH() {
DateTimeFieldType[] fields = new DateTimeFieldType[] {
DateTimeFieldType.year(),
DateTimeFieldType.hourOfDay(),
};
int[] values = new int[] {2005, 12};
List types = new ArrayList(Arrays.asList(fields));
Dat... |
8da6c49e-a73e-4267-8c92-724f819879f3 | 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... |
3cda01c2-0226-4f42-8ea8-e7c788d2f41b | 6 | public static Collection<Quaternion> generateSymmetryGroup3D(
final List<Quaternion> generators) {
int newElems = 0;
Set <Quaternion> group = new HashSet<Quaternion>(generators);
Set<Quaternion> newGroupelem = new HashSet<>();
Quaternion z;
do {
newElems = 0;
for (Quaternion x : gr... |
40df62f5-d606-4164-80fb-600694e718f6 | 7 | private void playCard(TurnContext state) {
putCard(state);
if (state.currentPlayable.isEmpty())
if (state.g.canDraw())
state.selection = null; //end the turn
else if (state.currentPlayable == getHand())
if (!getFaceUp().isEmpty())
switchToFaceUp(state);
else if (!getFaceDown().isEmpty())
... |
a905d20b-70f6-430f-857c-de30de6f4903 | 4 | @Override
protected Object decode(ChannelHandlerContext Handler, Channel Channel, ChannelBuffer Buffer)
{
try
{
if (Buffer.readableBytes() < 5)
{
return null;
}
int BufferIndex = Buffer.readerIndex();
Session Habbo = Grizzly.GrabHabboHotel().GrabSessionHandler().GrabSession(Channel);
... |
bba818bd-06a5-4b35-8bee-c64aaa5ec574 | 5 | public static void demote(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
if (tree.getYoungestInSelection().isFirstChild()) {
return;
}
// Put the Undoable onto the UndoQueue
Node targetNode = tree.getYoungestInSelection().prevSibling();
CompoundUndoableMove undoable = new CompoundUndoabl... |
64702d7a-4ff6-42c2-b7e9-d7bf4e2f5663 | 4 | public boolean canAttackCell(Unit attackingUnit) {
// attackable unit
if (getUnit() != null) {
// check not on friendly teams
if (!Teams.getTeamFriends(
Teams.getTeamOfPlayer(attackingUnit.getOwner())).contains(
getUnit().getOwner(... |
7a3a35ca-0344-4c9e-9364-967a05b96fd2 | 5 | @SuppressWarnings("deprecation")
public void showMonitor(final User target, final User receiver) {
if (target == null)
return;
try {
final BankAccount acc = Economy.getInstance().getAccount(target);
final Player player = receiver.getPlayer();
if (acc == null) {
player.sendMessage(lang.ge... |
56060b86-10d1-41d6-9e3c-cf603b37e8e3 | 7 | @Test
public void drawLineVertical(){
Whiteboard wb = new Whiteboard();
Color newColor = new Color(100, 2, 50);
Color white = new Color();
ArrayList<Point> expectedPoints = new ArrayList<Point>();
for (int i = 300; i < 301; i ++){
for (int j = 200; j < 501; j ++){... |
98385466-c633-4cb5-b29f-0d5715f49852 | 7 | protected int widestDim(double[][] nodeRanges, double[][] universe) {
final int classIdx = m_Instances.classIndex();
double widest = 0.0;
int w = -1;
if (m_NormalizeNodeWidth) {
for (int i = 0; i < nodeRanges.length; i++) {
double newWidest = nodeRanges[i][WIDTH] / universe[i][WIDTH];
... |
358fd3f0-511a-4bc1-a03b-3708902d6757 | 0 | public static int getPixelLength(){return lengthOfChunk*Building.lengthOfBuilding;} |
a272dfb7-ac90-4f1b-a4c5-500880ad78a8 | 6 | public static void main(String[] args) {
// switch - int, String or enum
System.out.println("Please add number of month");
Scanner sc = new Scanner(System.in);
int month = sc.nextInt();
switch (month) {
case 1:
case 2:
case 3:
System.out.println("This is the first quarter of the year");
break;
... |
631ca83f-4ff8-468b-9cb2-9ccbd4ea11bb | 2 | public void visitVarExpr(final VarExpr expr) {
if (!expr.isDef()) {
if (expr.def() != null) {
prop(expr, expr.def());
}
}
} |
30ca8b54-deec-4e84-b6a1-3168f70fcc3c | 6 | void resetButtonsToPanelRules()
{
// Reset the buttons to support the original panel rules,
// including whether the next or back buttons are enabled or
// disabled, or if the panel is finishable.
WizardModel model = wizard.getModel() ;
WizardPanelDescriptor descriptor = model.getCurrentPanel... |
0fde762d-1e86-433c-b32d-b13f840be1fe | 3 | @Override
public boolean isCommonSubexpression(Instruction i) {
if(i instanceof BinaryInstruction) {
BinaryInstruction b = (BinaryInstruction)i;
return this.getOpcode() == b.getOpcode()
&& this.arg1.equals(b.arg1)
&& this.arg2.equals(b.arg2);
}... |
982c11ef-b012-421c-a0b7-c3db0de424f1 | 2 | public void initRegisterModel() {
for(int x=0; x< 32;x++){
for(int y=1; y<9; y++){
ramModel.setValueAt("00", x, y);
}
}
} |
48869841-b7ba-4ad3-83a1-84a9531b3a68 | 0 | @Override
public BufferedImage draw()
{
BufferedImage image = new BufferedImage(Building.lengthOfBuilding, Building.lengthOfBuilding, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.setColor(Color.orange);
g.fillRect(1, 1, lengthOfBuilding-2, lengthOfBuilding-2);
return image;
} |
413fa51d-b9b4-4c7b-8618-07997290be18 | 7 | public void tick() {
this.updateWeather();
long var2;
if (this.isAllPlayersFullyAsleep()) {
boolean var1 = false;
if (this.spawnHostileMobs && this.difficultySetting >= 1) {
var1 = SpawnerAnimals.performSleepSpawning(this, this.playerEntities);
... |
d2211881-bb1e-4a9a-9ccf-502be4cb518f | 1 | public ShouldCollideWithPowerFailureVisitor(PositionChangedObservable collider) {
if (collider == null)
throw new IllegalArgumentException("The given collider is invalid!");
this.collider = collider;
} |
c03389d8-6841-4419-9423-61915fe61938 | 9 | @Override
protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context)
throws IOException, InterruptedException {
Iterator<VectorWritable> it = values.iterator();
if (!it.hasNext()) {
return;
}
Vector value = it.next().get();
Iterator<Vector.Element>... |
00fc7153-313f-4090-b6c1-c8f56dc57ad2 | 0 | @Override
public ArrayList<String> getGoToList() {
// TODO Auto-generated method stub
return null;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.