method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0badab96-aa83-4a3d-ba05-ce47fb2f1617 | 8 | private void move() {
if (x < 0) {
x = Board.M_WIDTH - 1;
direction = LEFT;
moveLeft();
} else if (x > Board.M_WIDTH - 1) {
x = 0;
direction = RIGHT;
moveRight();
} else {
if (board.getLabyrinth().isIntersection(x, y)) {
direction = newDir();
}
if (blue) {
direction = getPacmanO... |
57d087b1-5347-4993-9a88-f148becccc27 | 2 | public void ModifyItem() {
System.out.println(this.itemID);
Items itemlist = new Items();
itemlist.init();
for (Item item : itemlist.getItemList()) {
if (item.itemID.equals(this.itemID)) {
System.out.println("itemFound");
this.itemName = item.itemName;
this.itemDescription = item.itemDescription... |
61cc3835-b9c6-46c2-95e7-1d60f0d1bee2 | 7 | public void testConstructor_int_int_int() throws Throwable {
DateMidnight test = new DateMidnight(2002, 6, 9);
assertEquals(ISOChronology.getInstance(), test.getChronology());
assertEquals(LONDON, test.getZone());
assertEquals(TEST_TIME_NOW_LONDON, test.getMillis());
assertEquals... |
617b4b91-cf6a-4386-8d31-116b4461c547 | 4 | private static void bubbleSort(int[] arr) {
if(arr.length < 2) return;
int right;//每次冒泡那个最大元素落在这个索引位置上
for(int i=0; i<arr.length-1; i++){//需要进行n-1次冒泡
right = arr.length - 1 - i;
for(int j=0; j<right; j++){
if(arr[j] > arr[j+1]){
//swap arr[j] and arr[j+1]
int temp = arr[j];
arr[j] = ar... |
3bad45a0-6cbb-433f-9e17-0df88699e073 | 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... |
fc529eaf-7eb9-457c-b41f-ec6565ffff0e | 1 | public static void main(String[] args) {
for (int i = 1; i <= 20; ++i)
System.out.println(new Count_and_Say().countAndSay(i));
// System.out.println(new Count_and_Say().countAndSay(10));
} |
671c483c-d96e-4954-9644-29bfe55d4f9f | 7 | public static String setRankString(int x)
{
if(x!=1&&x!=11&&x!=12&&x!=13)
{
return Integer.toString(x);
}
if(x==11)
{
return JACK;
}
if(x==12)
{
return QUEEN;
}
if(x==13)
{
return KING;
}
return ACE;
} |
8e57d1c2-894a-46a1-bb69-48e6a7780aa0 | 1 | public ModelCRLV getModelCrlv(ModelCRLV crlv, String action){
ModelIPVA ipva = new ModelIPVA();
if(action.equals("editar"))
ipva.setIdIpva(crlv.getIpva().getIdIpva());
crlv.setVia(Integer.parseInt(txtVia.getText()));
crlv.setCodRenavam(txtCodRenavam.getText());
... |
2d4f6032-1b4e-468f-9e92-bd20b95dcbb3 | 3 | protected void skipAttributes(DataInputStream input) throws IOException {
int count = input.readUnsignedShort();
for (int i = 0; i < count; i++) {
input.readUnsignedShort(); // the name index
long length = input.readInt();
while (length > 0) {
long skipped = input.skip(length);
if (skipped == 0)
... |
2c799957-cfee-46a7-9419-b77c04b26d1e | 4 | public String[] getSets0(){
String[] sets =null;
try{
sets = textField.getText().split(",");
if(textField_1.getText().length()<1) return null;
int x = Integer.valueOf(nbrVarComboBox.getSelectedItem().toString());
x = (int) Math.pow(2, x);
for(String s : sets){
int set = Integer.valueOf(s);
if (!(set... |
64bd6a3e-7101-4ff9-8c29-2f08935bdb80 | 8 | public void run(){
gameStart=0;
new Tile();
windowrunning = true;
running = true;
level = new Level();
image = createVolatileImage(width,height);
//Run the application until the user tells it to close
while(windowrunning){
if(gameStart==1){
startTime = System.currentTimeMillis();
gameStart+... |
dbc7f278-d624-4fa2-9475-bb2a5cf9c8ce | 0 | public SubCategory(String naam, int datatype, float weight)
{
this.naam = naam;
this.datatype = datatype;
this.weight = weight;
this.periods = new ArrayList<Period>();
} |
b2c83c5b-d884-4ef1-9c3a-7c5cf232956f | 4 | public double removeMin() {
if ( _heap.size() == 0 )
return -1.0;
else
_size--;
//store root value for return at end of fxn
double retVal = peekMin();
//store val about to be swapped into root
double foo = _heap.get( _heap.size() - 1);
//swap last (rightmost, deepest) leaf with root
swap( 0, _hea... |
0fc02af5-8b5e-40e7-aef1-4b026c13ff54 | 2 | @Override
public Account getObject(int row, int col) {
if(col == 0 || col == 1) {
return (Account)getValueAt(row, 0);
}else {
return (Account)getValueAt(row, 3);
}
} |
15ad829e-3f92-440e-ada0-3620370a2a80 | 1 | public static String stripBlanks(final String string) {
//// Preconditons
if (string == null)
throw new InvalidParameterException("string cannot be null");
return stripTrailing(stripLeading(string, ' '), ' ');
} |
4d50c473-0b20-4faa-9959-27ead2980c7e | 9 | private void cftbsub(int n, float[] a, int offa, int[] ip, int nw, float[] w) {
if (n > 8) {
if (n > 32) {
cftb1st(n, a, offa, w, nw - (n >> 2));
if ((ConcurrencyUtils.getNumberOfThreads() > 1) && (n > ConcurrencyUtils.getThreadsBeginN_1D_FFT_2Threads())) {
... |
959eeb63-29e9-42d9-9e75-46975a3f4354 | 6 | public DFA(Collection<State> states, Collection<Transition> transitions, Collection<State> acceptables, State start) {
Set<State> statesSet = new HashSet<State>(states);
Set<Transition> transitionsSet = new HashSet<Transition>(transitions);
this.acceptables = new HashSet<State>(acceptables);
for (State st... |
53651da8-428b-4441-9859-4e0cd592b712 | 9 | private void readLuminance() {
int type = sourceImage.getType();
if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) {
int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null);
for (int i = 0; i < picsize; i++) {
... |
b3ef176c-0309-43ba-a5ba-7384b6263da6 | 4 | private static Point[][] get8PlayersPositions() {
int maxPlayers = 8;
Point[][] pos = new Point[8][128];
for(int i = 0; i < maxPlayers;i++ ){
pos [0][i] = new Point(0,2*i);
}
for(int i = 0; i < maxPlayers/2;i++ ){
pos [1][i] = new Point(2 ,1+4*i);
}
for(int i = 0; i < maxPlayers/4;i++ ){
pos [2]... |
997f294c-563e-4ec3-93c2-bacde511c56c | 2 | public void withdraw(int value) {
if(value < 0) {
IllegalArgumentException ex = new IllegalArgumentException(
"You can't withdraw a negative number of dollars!");
log.throwing(getClass().getSimpleName(), "withdraw(int)", ex);
throw ex;
} else if(value > money) {
IllegalArgumentException ex = new Il... |
cd6d1817-6deb-44d9-9afc-2046a10c2660 | 1 | public void method() {
try {
BufferedWriter w = new BufferedWriter(new PrintWriter("texto.txt"));
BufferedReader r = new BufferedReader(new FileReader("text.txt"));
} catch (IOException e) {
}
} |
e9f0c9a1-2517-441a-8d9c-db56090a3770 | 9 | @SuppressWarnings("rawtypes")
@Override
public void onEvent(Event e) {
// TODO Auto-generated method stub
String[] args = {""};
if(e instanceof PrivateMessageEvent) {
PrivateMessageEvent event = (PrivateMessageEvent) e;
args = Colors.removeFormattingAndColors(event.getMessage()).split(" ");
String pref... |
f769aefb-abab-4b0c-8653-3e624bb2de91 | 8 | private static Object[] processValues(Field field, Selection selection) {
FieldType type = TypeUtil.getFieldType(field.getType());
switch (type) {
case INTEGER:
return processIntegerValues(selection);
case DOUBLE:
return processDoubleValues(selection);
case LONG:
return... |
e9b1d3bc-e666-4826-81df-42c9575be08a | 6 | @Override
public int hashCode() {
int result = popProveedorId != null ? popProveedorId.hashCode() : 0;
result = 31 * result + (popNitProveedor != null ? popNitProveedor.hashCode() : 0);
result = 31 * result + (popNombreProveedor != null ? popNombreProveedor.hashCode() : 0);
result = ... |
494dd31b-065c-4e9a-9dfc-0ed4fa1b7ed9 | 4 | public void create(Engine engine, String name, String mapLocation) {
//engine.addWorld(this);
if(cubes == null)
cubes = new ArrayList<Cube>();
try {
BufferedImage image = ImageIO.read(new File(mapLocation));
height = new float[image.getWidth()][image.getHeight()];
width = image.getWidth()*0.25f;... |
fbda596a-a8a9-4841-a201-7b071554d434 | 0 | void without(Gizmo g) {
g = new Gizmo(); // OK -- g not final
g.spin();
} |
0fa574da-fb07-49a8-b51a-75b16db4e6b7 | 3 | @Override
public double percentile(double percentile) {
if (N == 0)
return Double.NaN;
// Number of values in the quartile
double indexing = N * percentile;
// If indexing has digits the index array contains only the number
// indexing + 1. On the other hand, if indexing is an even number (it
// has no... |
ab0ed43b-91b5-47e0-9673-f313f4f290b0 | 2 | public static void main(String... args) {
/*
* Loads the file client.properties from the classpath.
* It is located within the directory src/main/resources.
*/
Config config = new Config("client");
/*
* Retrieve the String value associated with the 'download.dir' key
* and print the absolute path ... |
a053a5ee-608e-4084-9d39-344abc66a478 | 9 | @Test
public void testEndUserApi() throws JFKException{
// create the dummy object
DummyClass dummy = new DummyClass();
// now get the function
IFunctionBuilder builder = JFK.getFunctionBuilder();
IFunction function = builder.bindFunction( dummy, "hello" );
// execute the function
String result = (String... |
d051a7d6-3567-4d62-a2de-45f43b59f06c | 2 | public int dropHeight(Piece piece, int x) {
int high = 10000;
int result = 0;
int temp;
int i;
int[] skirt = piece.getSkirt();
for (i = x; i < x + piece.getWidth(); i++) {
temp = skirt[i - x] - getColumnHeight(i);
if (temp < high) {
high = temp;
result = i;
}
}
return getColumnHeight(re... |
7425f344-74f5-499b-a688-752fc4895d96 | 4 | public void run()
{
try
{
boolean done = false;
while (!done)
{
File file = queue.take();
if (file == FileEnumerationTask.DUMMY)
{
queue.put(file);
done = true;
}
else search(file);
... |
bb3d8763-3103-4218-a22b-42e1106079bf | 3 | public int[] getCurrentLayout() {
String[] face = {"F", "R", "B", "L", "U", "D"};
Color[] colors = {color_red, color_green, color_orange, color_blue, color_yellow, color_white};
int[] layout = new int[6];
//Gets layout of grids on screen
for(int i=0;i<6;i++) { //Loop for each face
for(int n=0;n... |
d8403cd5-66bb-40c2-9a8c-8764b4c55b59 | 4 | final public void run() {
connectionEstablished();
// The message from the server
Object msg;
// Loop waiting for data
try {
while (!readyToStop) {
// Get data from Server and send it to the handler
// The thread waits indefinitely at the following
// statement until something is received fr... |
85e819d8-648a-4b92-8b01-a231866c4995 | 7 | public void accept(final ClassVisitor cv) {
FieldVisitor fv = cv.visitField(access, name, desc, signature, value);
if (fv == null) {
return;
}
int i, n;
n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
for (i = 0; i < n; ++i) {
Annot... |
de5ea07d-964a-460c-9f08-e95c6953ef7c | 0 | @Test
public void runTestRegisterGlobal1() throws IOException {
InfoflowResults res = analyzeAPKFile("Callbacks_RegisterGlobal1.apk");
Assert.assertNotNull(res);
Assert.assertEquals(1, res.size());
} |
dc494d02-c9eb-4b19-a5da-a8e60796e3b1 | 1 | public static WeaponType getWeaponType(String name) {
if (weaponTypes.containsKey(name)) {
return (WeaponType) weaponTypes.get(name);
}
return null;
} |
989de16a-5d4f-4215-9cb2-9bb1059dbef3 | 7 | public static void main(String[] args){
while ( jogo.SearchPacdot(jogo.pacmaze) == true && !(jogo.SamePosition()))
{
jogo.DisplayPacworld();
Scanner in = new Scanner(System.in);
System.out.println("Faz jogada: ");
char tecla = in.nextLine().charAt(0);
int x = 0;
int y = 0;
switch... |
a47e1878-352f-4ce2-a1b0-8b632fe8763f | 6 | private Types.ACTIONS microbial(StateObservation stateObs, int maxdepth, StateHeuristic heuristic, int iterations) {
double[] maxScores = new double[stateObs.getAvailableActions().size()];
for (int i = 0; i < maxScores.length; i++) {
maxScores[i] = Double.NEGATIVE_INFINITY;
}
... |
ef42e31e-17b1-4072-8006-f72e0c08f742 | 6 | public void retractWeapon(int lastKeyPressed) {
try {
int dir = 1;
Point charLoc = new Point(this.getCharacterLocation());
if (!(grid.get(charLoc).returnCharacter().getWeapon() instanceof RangedWeapon)) {
if (lastKeyPressed == KeyEvent.VK_A || lastKeyPressed == KeyEvent.VK_LEFT) {
dir = -1;
} el... |
1d51c277-2c70-4b83-b3b8-5db92018c197 | 0 | @Override
public String getName() {
return NAME;
} |
cf086ec8-08fa-4df0-b98c-4f64fe03fc93 | 2 | public PickUpAction(Grid grid, Item item) {
if (grid == null)
throw new IllegalArgumentException("The given grid is invalid!");
if (item == null)
throw new IllegalArgumentException("The given item is invalid!");
this.grid = grid;
this.item = item;
} |
1740c063-e0fc-473f-a911-bdde7751ecb6 | 0 | public void setVisited(boolean b) {
this.visited = b;
} |
f89d1f81-c436-4f93-817f-27e92fff5a7c | 4 | public void keyReleased(KeyEvent ev) {
if(ev.getKeyCode() == KeyEvent.VK_LEFT) {
if(index != 1)
index--;
}
if(ev.getKeyCode() == KeyEvent.VK_RIGHT) {
index++;
index = index % 1325;
if(index == 0)
index++;
}
comic = getComic(index);
frame.setTitle("XKCD - " + Integer.toStrin... |
755e4c7b-7974-45de-bd64-24f42756fa33 | 5 | private void subledger2(ArrayList<ArrayList> arrayL) {
String query3;
System.out.println("sub2size"+arrayL.size());
for(int i=0; i<arrayL.size(); i++){
arrayTemp=arrayL.get(i);
if(arrayTemp.get(0).matches("reg")){
/*query3 = "insert into suble... |
52abcd5e-f713-42f4-8b03-39183277d7ad | 9 | public static String toFancyTime(int minutes) {
if (minutes <= 0) {
return "0 minutes";
}
StringBuilder time = new StringBuilder();
int days = minutes / 60 / 24;
if (days > 0) {
time.append(days).append(" day").append(days > 1 ? "s" : "");
}
... |
ddc3bdac-fda4-4650-b0c4-d759567b9c86 | 7 | public int maxArea(int[] heights) {
int maxArea = 0;
int start = 0, end = heights.length - 1;
while (start < end) {
int startHeight = heights[start], endHeight = heights[end];
int area = Math.min(startHeight, endHeight) * (end - start);
if (area > maxArea) {... |
5f7c1a1f-6361-4243-b3bd-cd33dd74f841 | 6 | static final boolean method3137(boolean bool, byte i) {
anInt9426++;
boolean bool_0_ = Class348_Sub8.currentToolkit.isBloomSupported();
if (i != -24)
return true;
if (!bool_0_ == !bool)
return true;
if (!bool)
Class348_Sub8.currentToolkit.method3710();
else if (!Class348_Sub8.currentToolkit.method3... |
a090e753-d95a-4015-8fa4-06688e959ef0 | 9 | public static int[] maxProductIncreasingSubsequence(int[] input, int length){
int[] response = new int[length];
/**
* product[n][l] is responsible for keeping max products of
* product[i][3] means from i = 0 ..i in input[] , maximum product of a subsequence of 3 length
* till... |
2b84c0b3-b18b-4029-9d7b-1406de93a301 | 7 | public void save(JavaPlugin plugin) {
File file = new File(plugin.getDataFolder(), FILE);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileOutputStream fileStream = null;
ObjectOutputStream objectStream = null;
try {
fileStream =... |
9a841b0e-38ea-48e5-801c-de27b85c2cc3 | 5 | public static Object getNewObject(FileTypes type, String name){
//TODO add name to construct?
if(type.equals(FileTypes.CODEX)){
return new Codex();
}
else if(type.equals(FileTypes.CODEXITEM)){
return new CodexItem();
}
else if(type.equals(FileTypes.FRAMES)){
return new Frames();
}
else if(type.eq... |
96d9db9b-028f-4052-9fa5-4435ad0166be | 8 | public void loadSettings(ComponentManager componentManager) {
// get all our loaded classes
Vector<Class<?>> classes = null;
try {
classes = getLoadedClasses();
}
catch(Exception e) {
Logger.error("Unhandled exception (%s): %s!", e.getClass().getName(), e.getMessage());
e.printStackTrace();
}
... |
8375ab9f-fe68-412e-afc3-2020850656a2 | 8 | public static void main(String[] args) {
Connection conn = null;
Statement stat= null;
ResultSet resultSet= null;
try{
/* 1.注册数据库驱动, 不同的数据库要导入不同的驱动jar包。Driver就是这个包中的类。*/
/*---这种方式有两个不好的地方:
* 1)查看Driver的源码,我们会发现在 new Driver()的时候,其实已经注册了一次驱动了。这样就造成注册了两次驱动。
* 2)这样写,让程序导入了com.mysql.jdbc.Driv... |
98dc90b9-881a-406e-b7b3-925a3d4d6925 | 0 | public String toString(){
return bins.toString();
} |
24231c1d-7627-44ba-974c-584d30d3a003 | 6 | public void merge(int[] arr, int p, int q, int r) {
int length = arr.length;
int[] tempArray = new int[length];
for (int i = 0; i < length; i++) {
tempArray[i] = arr[i];
}
int temp = p;
int i = p, j = q + 1;
for (; i <= q && j <= r;) {
if (tempArray[i] < tempArray[j]) {
arr[temp++] = tempArra... |
dde31d0b-8a79-446f-9e81-e87fd0a80061 | 6 | static String toXml (String s)
{ int m=s.length();
H.clear();
for (int i=0; i<m; i++)
{ char c=s.charAt(i);
switch(c)
{ case '<' : toH("<"); break;
case '>' : toH(">"); break;
case '&' : toH("&"); break;
case '\'' : toH("'"); break;
case '\"' : toH("""); break;
defau... |
08aa1ce1-3656-4212-a11d-e80f2c67ab66 | 1 | @Override
public int compare(String s1, String s2) {
assert s1 != null && s2 != null;
return String.CASE_INSENSITIVE_ORDER.compare(s1, s2);
} |
673952c7-0af4-455b-8835-016ca443753b | 1 | public void testConstructor_ObjectStringEx6() throws Throwable {
try {
new LocalTime("10:20:30.040+04:00");
fail();
} catch (IllegalArgumentException ex) {}
} |
b7f732eb-8eb6-4d98-8dda-fb236f5a2532 | 0 | public void addNeighbour(Agent a) {
neighbours.add(a);
} |
5de642f2-89d4-43ff-9ccc-644d3651241e | 3 | public void drawRolloverTooltip(Graphics g){
g.setColor(Color.WHITE);
g.setFont(new Font("Arial", Font.BOLD, 20));
g.drawString("Racial Turret", 605, 305);
g.setFont(new Font("Arial", Font.PLAIN, 18));
g.drawString("Cost: "+totalCost +" Gold", 605, 330);
g.drawString("Range: Moderate", 605, 355);
g.drawS... |
d8500add-445f-420c-8bd6-6e6c5f4f5168 | 8 | public Update createUpdate(com.hp.hpl.jena.update.Update arq, String uri) {
if(arq instanceof UpdateModify) {
return createModify((UpdateModify)arq, uri);
}
else if(arq instanceof UpdateClear) {
return createClear((UpdateClear)arq, uri);
}
else if(arq instanceof UpdateCreate) {
return createCreate((U... |
0846c6d6-9b73-40f2-9349-4f187f549cb3 | 4 | private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0, 0L);
return 7;
}
switch(curChar)
{
ca... |
6cca8dd1-1717-4387-9c08-ae8f3a9333f4 | 4 | public static Collection<Class<?>> internalComponents(Class<?> model) {
Collection<Class<?>> comps = new ArrayList<Class<?>>();
comps.add(model);
internalComponents0(comps, model);
return comps;
} |
7c467055-0fc8-45f3-83eb-f06c6b53fbc1 | 9 | public static QuestionPower decode(String str) throws DecodeException {
QuestionPower res = null;
if (str.substring(0,14).compareTo("#QuestionPower") == 0) {
res = new QuestionPower();
int i = 14;
if (str.charAt(i) == '<') {
while (str.charAt(i) != '>') {
... |
1a3d7ce5-d943-44c4-88e0-dbfbfe46d8c4 | 3 | public double interQuartileMean_as_double() {
double mean = 0.0D;
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
mean = Stat.interQuartileMean(dd);
break;
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
mean = (Stat.interQuartileMean(bd)).doubleValue();
bd = null;
... |
3819cb6f-28d1-4973-b6ac-d350c9773ca6 | 8 | private void GLRender() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glRotatef(xRot,1 , 0, 0);
glRotatef(-yRot, 0, 1, 0);
glTranslatef(-camX, -camY, -camZ);
RenderFrame();
// Axis
glBegin(GL_LINES);
glColor3d(1, 0, 0);
glVertex3f(axis[0], ... |
c2a35e5f-ddb3-4bc0-80e4-c0d564a25fa2 | 5 | public int findCombinationsCount(int sum, int vals[]) {
if (sum < 0) {
return 0;
}
if (vals == null || vals.length == 0) {
return 0;
}
int dp[] = new int[sum + 1];
dp[0] = 1;
for (int i = 0; i < vals.length; ++i) {
for (int j =... |
3329e847-7d07-43a4-b59f-982e90a125b5 | 5 | @Override
public void update(Observable o, Object arg) {
if (arg != null && arg instanceof String && ((String) arg).contains("VS")) // View settings updates
{
if (activeGroup != null)
m_container.remove(activeGroup);
if (ViewPreferences.getInstance().getCenterView() == CenterView.TASK) {
activeGroup ... |
11532bcf-e1a6-488b-bba0-717181c6e9cd | 6 | public void changeMark() {
if (this.markState == MarkState.unmarked) {
this.markState = MarkState.flagged;
try {
Image icon = ImageIO.read(getClass().getResource("flagged.gif"));
this.setIcon(new ImageIcon(icon));
} catch (IOException ex) { }
}
else if (this.markState == MarkState.flagged... |
ef76199a-64d6-4275-b30c-97ed3c0b5a13 | 5 | public boolean canBuyDevCard(int playerIndex) {
Player player = serverModel.getPlayers().get(playerIndex);
if (playingCommandsPreconditions(playerIndex) && player.getOre() > 0 && player.getWheat() > 0 && player.getSheep() > 0 && serverModel.getDeck().getTotalDevCardCount() > 0) {
return true;
}
else {
... |
7d02c3ff-458a-44b3-b295-77c7f5f3ae31 | 1 | public void startPoint(String name) {
if (this.goalMap.containsKey(name)) {
Calculator cal = (Calculator) this.goalMap.get(name);
cal.setStartTime(Calendar.getInstance().getTimeInMillis());
} else {
this.goalMap.put(name, new Calculator(name));
}
} |
1da7e543-3f52-46da-b79c-cee57d9d6b4e | 0 | public static void main(String[] args) {
new ViewHandler();
} |
40f60333-be9e-4dcd-bfea-c2b051160e2e | 1 | public void incRegister() {
this.speicherzelle++;
if(this.speicherzelle == 256) {
this.speicherzelle = 0; // Überlauf
}
} |
d62f8eca-1225-4d4d-9d5a-c9d63b3a1d5b | 1 | public void rewindNbytes(int N)
{
int bits = (N << 3);
totbit -= bits;
buf_byte_idx -= bits;
if (buf_byte_idx<0)
buf_byte_idx += BUFSIZE;
} |
952a831b-cdab-414c-915d-47f0e031dc92 | 2 | public void terminateSimulation ()
{
org.omg.CORBA.portable.InputStream $in = null;
try {
org.omg.CORBA.portable.OutputStream $out = _request ("terminateSimulation", false);
$in = _invoke ($out);
return;
} catch (org.omg.CORBA.portabl... |
4e5d5d35-871b-47b9-a814-799edaa0f628 | 4 | private void loadFileNumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadFileNumActionPerformed
try {
String newLine = "\\n";
String sourceContents;
/*/Code to read from file
File inputFile = new File(inputFileName);
FileInputStre... |
72d8e77f-ef70-4a9a-ad0b-3da5f93e4e72 | 5 | public boolean add(Item input) {
if (isFull())
return false;
if (input == null)
return false;
for (int h = 0; h < height; h++) {
for (int w = 0; w < width; w++) {
if (inventory[h][w] == null) {
inventory[h][w] = input;
return true;
}
}
}
return false;
} |
4fce7c29-9804-41bc-9f68-31af504eb1e7 | 6 | public void run() {
try {
CookieManager.setDefault(Client.cookieManager);
//boolean authbool = messenger.authenticate("Lukew4lker", pwInput);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//System.out.print("Enter String");
... |
5a015a4b-7784-4b99-8376-228dccc1067d | 2 | private static long sumOfPred(int i, int j){
long sum = 0;
if (i>0){
sum+=routes[i-1][j];
}
if (j>0){
sum+=routes[i][j-1];
}
return sum;
} |
69dffc77-8cce-40b0-8805-4c709fcb350a | 3 | public void handleClick(int x, int y)
{
for(int i = 0; i < Sidebar.MAX_ELEMS; i++)
{
if((elements[i] != null) && (y >= (elementPos[i])))
{
elements[i].handleClick((int)(x - Sidebar.xPos_), (int)(y - elementPos[i]));
return;
}
}
} |
29705115-bef5-46f0-a65d-f97b9857cd33 | 0 | @Override
public String getNationality() {
return super.getNationality();
} |
4860562e-3351-442b-9a5e-974a84703179 | 8 | public static void checkloginstatus(String num, String downloadpath){
try{
HWND targetwindow=User32.FindWindow("ZocMainWindow", "COM"+num+" [evaluation mode]");//find the ZOC window with specific port number by its class and name
HWND edit=User32.FindWindowEx(targetwindow, new HWND(0),"ZocTerminalArea", null);/... |
be033db8-49a1-48d0-973b-35cacd7e1c50 | 7 | private Object getValue(Object item)
{
Object value = null;
if(item != null)
{
if(item instanceof JTextField)
{
value = ((JTextField) item).getText();
} else if(item instanceof JSpinner)
{
value = ((JSpinner) ite... |
787cd5a6-f823-45c4-af7c-eac2f313804e | 4 | public void printXProportion(String xProportionFile, ArrayList<_Doc> docList) {
System.out.println("x proportion for parent doc");
try {
PrintWriter pw = new PrintWriter(new File(xProportionFile));
for (_Doc d : docList) {
if (d instanceof _ParentDoc) {
for (_ChildDoc doc : ((_ParentDoc) d).m_childDo... |
6c3f3b1d-ec3b-4f6c-a0f7-e9574b77f6a1 | 6 | public void actionPerformed(ActionEvent ae) {
if ("pump".equals(ae.getActionCommand())){
chart.pump = ((JCheckBox)ae.getSource()).isSelected();
if (chart.pump){
optInc.setEnabled(true);
optDec.setEnabled(true);
}
else{
optInc.setEnabled(false);
optDec.setEnabled(false);
}
... |
9ee8a5f2-f855-4c0a-b59a-eb08b9876b8d | 7 | public boolean checkConnection(TagSet tagSet, int tag1, int tag2, int len1, int len2, int typeOfTag2) {
String tag1Name = tagSet.getTagName(tag1);
String tag2Name = tagSet.getTagName(tag2);
if ((tag1Name.startsWith("nc") || tag1Name.charAt(0) == 'f') &&
tag2Name.charAt(0) == 'n') {
if (tag2Name.startsWi... |
91483ea0-5ae8-405b-b703-a9b2b32c1642 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return;
final MOB mob=(MOB)affected;
if((mob.location()!=null)
&&(mob.location().domainType()!=Room.DOMAIN_OUTDOORS_JUNGLE)
&&(mob.location().domainType()!=Room.DOMAIN_OUTDOORS_SWAMP)
&&(mob... |
75ad5465-a66b-465b-92f1-8ca6ebcd5c98 | 7 | public void drawString(int column, int row, String string, ScreenCharacterStyle... styles)
{
if(column >= areaSize.getColumns() || row >= areaSize.getRows() || string == null)
return;
string = TabBehaviour.ALIGN_TO_COLUMN_4.replaceTabs(string, column + topLeft.getColumn());
... |
cf59e8ed-0686-442d-bcd1-ab48da6b9261 | 1 | @Override
Integer redactEntity(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idOrder = (Integer) criteria.getParam(DAO_ID_ORDER);
if (idOrder != null) {
return updateOrder(criteria, dao);
} else {
return createOrder(criteria, dao);
}
} |
027ecf33-3ec7-4ea7-a1dc-ca77355e5089 | 2 | public synchronized void reset() {
for(int i = 0; i < receivedPackets.length; i++)
receivedPackets[i] = null;
receivedPacketHistoryInt = 0;
lastReceivedPacketIndex = -1;
lastReceivedPacketSequenceNumber = Packet.SEQUENCE_NUMBER_NOT_APPLICABLE;
for(int i = 0; i < sentPackets.length; i++)
sentPackets[i] ... |
ef8474cd-50e7-463e-bd07-788d0d1d00cd | 0 | public CheckResultMessage check34(int day) {
return checkReport.check34(day);
} |
f9383bc6-3cdf-4b5a-a821-ca313301e170 | 7 | public void commandAction(Command c, Displayable d) {
if (d == remotedeviceui && c.getLabel().equals("Search")) {
startInquiry(discoveryMode, serviceUUIDs);
} else if (d == remotedeviceui && c.getLabel().equals("Back")) {
callback.commandAction(BACK, remotedeviceui);
} else if (d == remotedeviceui && c.ge... |
76c44a5c-3635-42d4-991e-02feecc5144c | 6 | public static void startupStellaIn() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (... |
8190e4ef-eeef-484f-b488-e1ff81dd8363 | 9 | public void getBalances( SimpleDate asOfWhen, boolean force ) {
// if we're up to date, there is nothing to do
if (upToDate && !force)
return;
// reset all summary amounts to zero
initBal = 0;
totCredits = 0;
totBudget = 0;
totDebits = 0;
finalBal = 0;
// if we have no ledger entries, nothing... |
233e03b0-70d6-43dd-a97f-7a77eda3bef5 | 1 | @Override
public void execute() {
if (this.from.distanceBetweenFile(this.to) == 2) { // King moves right (file difference is positive)
this.rookFrom = board.getField('h', this.from.rank);
this.rookTo = board.getField('e', this.from.rank); // Rook moves left
} else {
this.rookFrom = board.getField('a', thi... |
21533f6a-357f-4fad-a3db-abff2679e0f5 | 4 | private String toString(double number)
{
String result="";
if (Double.toString(number).equals("NaN")||Double.toString(number).equals("Infinity"))
{
result="Error";
}else{
result=Double.toString(number);
//if it's an integer, remove ".0"
if (result.subst... |
0a058c0d-faa8-4637-b44e-030c3f893e57 | 4 | public int _createKey(int key, String subkey) throws RegistryErrorException
{
try
{
int result[] = (int[])createKey.invoke(null, new Object[] {new Integer(key), getString(subkey)});
if(result[ERROR_CODE] == ERROR_SUCCESS)
return result[NATIVE_HANDLE];
else
return -1;
}
... |
b6ecdbb0-c10b-45ec-a1fc-18fba57c915d | 4 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
int bx = (camera.getX() < 0) ? 0 : (int) camera.getX();
int by = (camera.getY() < 0) ? 0 : (int) camera.getY();
int ox = -1 * (bx - (int) camera.getX());
int oy = -1 * (by - (int) camera.getY());
... |
8e0dd808-2143-4bd0-8b1c-06a0c4aa272e | 9 | public List<GeneratedImage> buildCreatedFiles() throws IOException, InterruptedException {
boolean error = false;
final List<GeneratedImage> result = new ArrayList<GeneratedImage>();
for (File f : dir.listFiles()) {
if (error) {
continue;
}
if (f.isFile() == false) {
continue;
}
if (fileToP... |
4e2b4b60-76bb-4eba-add4-b439d245fac5 | 0 | public Status getStatus() {
return status;
} |
0bb984ec-dca9-4f60-9dc0-c7881b405d85 | 5 | public static void createPDFExcel(String path, String[] content, int row, Boolean rotate) {
if (content == null) {
return;
}
try {
File myFile = new File(path);
if (!myFile.exists()) {
myFile.createNewFile();
}
Document document = new Document(rotate == true ? PageSize.A4 : PageSize.A4.rotate()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.