method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d74229bf-1dc2-4348-a55d-3dc9a88ebada | 1 | public static double dot( double[] vec1, double[] vec2 )
{
int n = vec1.length;
double res = 0.0;
for ( int i = 0; i < n; ++i )
res += vec1[i] * vec2[i];
return(res);
} |
ee79b407-3250-435e-9f90-031f878664bd | 0 | public void setMoveRight(boolean a){
moveRight = a;
} |
e92682c7-8c03-4b54-a517-8307f160c4ab | 9 | public void menu(User u) throws MenuExitException {
//boolean done = false;
String menuString = "Configure Mob:"+this.getPlayerName()+"\r\n";
menuString += "(1) Configure Mob Name \r\n";
menuString += "(2) Confifure Mob Description \r\n";
menuString += "(3) Configure Mob Respawn Timeout \r\n";
menuString +=... |
63e0dd5e-eeb3-46ee-8abd-a3e00533fd7f | 2 | public circularLinkedListNode itemExistInList(char item) {
circularLinkedListNode p = head;
while (p.next != null) {
if (p.item == item)
return p;
else p = p.next;
}
return null;
} |
5c72efd6-b747-4b5a-b29f-271453091bae | 1 | public List<String> getAlias() {
if (alias == null) {
alias = new ArrayList<String>();
}
return this.alias;
} |
7c996680-44fc-43a3-8f7a-7fe6f1ad2763 | 4 | public boolean httpPost(String url, String queryString,
QAsyncHandler callback, Object cookie) {
if (url == null || url.equals("")) {
return false;
}
PostMethod httpPost = new PostMethod(url);
httpPost.addParameter("Content-Type",
"application/x-www-form-urlencoded");
httpPost.getParams().setParamet... |
71a524b8-a1e8-4f60-bee9-946c5b6d52ac | 9 | @SuppressWarnings("unused")
private void goRecursive(NGraph<LBFSData> g, int round, NVertexOrder<D> order) {
//Laatste ronde!
if( order.order.size() == g.getNumberOfVertices() ) {
//Reverse the list
Collections.reverse(order.order);
//Create the treedecomposition to get the upperbound
PermutationT... |
a96aca69-84e1-4f87-816a-9bfc52a42a9c | 0 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
loginthread logthread = new loginthread();
logthread.IP = jTextField4.getText();
logthread.scan = false;
l... |
a9ffe171-43f8-48fc-a1c1-e0ff6f0c1159 | 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... |
54dd3711-257e-42ae-9062-ca145aff523b | 8 | protected boolean validateNewAccount(EntryDialog d, String handle) throws IOException {
boolean rc=false;
if(handle==null || handle.length()==0) {
_log.debug("Handle is null");
_session.send(d
.getErrorResponse("We're sorry, but you must select a screen name"));
} else {
if (handle.length() > 10) {
... |
5d99c5b6-ed58-4619-8c2c-fbef8a923013 | 6 | public void setNewType(int type)
{
switch(type)
{
case UNIT_TYPE_SWORDMAN: setSword();
break;
case UNIT_TYPE_SPEARMAN: setSpear();
break;
case UNIT_TYPE_ARCHER: setArcher();
break;
case UNIT_TYPE_CAVAL... |
4f351a6b-430d-4690-8a9a-131bf8f077ae | 2 | public boolean isDead() {
return currentState == ProcessState.ABORTED || currentState == ProcessState.FAILED || currentState == ProcessState.SUCCEEDED;
} |
e860f00b-e89a-4f86-b86c-7cdfe1b82ced | 6 | protected static Ptg calcColumn( Ptg[] operands )
{
if( operands[0] instanceof PtgFuncVar )
{
// we need to return the col where the formula is.
PtgFuncVar pfunk = (PtgFuncVar) operands[0];
try
{
int loc = pfunk.getParentRec().getColNumber();
loc += 1;
return new PtgInt( loc );
}
catc... |
81faa5c2-fdb8-4baa-ae7f-9a7927b128b2 | 4 | @Override
public boolean saveUser(String user) throws SQLException,
ClassNotFoundException {
sqlClass();
sqlCon();
if (!customField.isEmpty()) {
query = "SELECT user_id FROM " + tablePref
+ "profile_fields_data WHERE pf_" + customField + "='"
+ user + "'";
ResultSet rs = SELECT(query);
if (... |
b2463772-5c00-466c-bbef-fe259490cb14 | 7 | public static Side nearestSide( Rectangle source, Rectangle target ){
double smx = source.getCenterX();
double smy = source.getCenterY();
int tx = target.x;
int ty = target.y;
int tw = target.width;
int th = target.height;
int sx = source.x;
int sy = source.y;
int sw = source.width;
int sh = ... |
dace55d9-7899-496e-a1c3-bbfb14b7b21a | 9 | public void testBigKey251() throws TimeoutException, MemcachedException {
if(c instanceof QuickCachedClientImpl) {
c.setMaxSizeAllowedForKey(-1);
}
String readObject = null;
String key = null;
StringBuilder keyPrefix = new StringBuilder();
for(int i=0;i<250;i++) {
keyPrefix.append("k");
}
... |
e6f7633b-33c8-4b54-8b69-e060b7e03cf6 | 7 | private static void print(String prefix, WrapperLoader<?> loader) throws FileNotFoundException, NoSuchMethodException {
PrintWriter writer = null;
try {
final File output = new File("output" + File.separator + prefix + loader.getClass().getDeclaredMethod("load", int.class).getReturnType().getSimpleName().toLower... |
e8b320bb-85a6-4a6e-a3b1-f52f28fcb008 | 1 | @Test
public void throwInvalidBudgetTypeExceptionWhenBudgetTypeIsInValidTestTwo() throws Exception {
try {
budgetFactory.requestBudgetByType("ERROR");
fail("Budget Type is not valid.");
} catch (InvalidBudgetTypeException e) {
assertEquals("Invalid Budget Type.",... |
f4a45467-9915-4bc8-8a1b-b38889282f92 | 6 | private static void getExecutionPlansFromDB(
List<DeltaSQLStatementSnapshot> sqlStatementsToLoad,
PreparedStatement sqlTextStatement) throws SQLException {
ResultSet executionPlansResultSet = sqlTextStatement.executeQuery();
// use a definitely not used (invalid) SQL ID and Chi... |
074ca218-a5fa-4ea3-aabb-2957075c1689 | 3 | void setItemBackground () {
if (!instance.startup) {
table1.getItem (0).setBackground (itemBackgroundColor);
}
/* Set the background color item's image to match the background color of the item. */
Color color = itemBackgroundColor;
if (color == null) color = table1.getItem (0).getBackground ();
TableIte... |
d4e83882-77be-4678-a6da-c1d0aeaeba34 | 0 | public EbonySword(){
this.name = Constants.EBONY_SWORD;
this.attackScore = 13;
this.attackSpeed = 15;
this.money = 720;
} |
dd82103b-ecd0-413b-a335-276aebc09bb3 | 0 | public Iterable<String> keys() { return keysWithPrefix(""); } |
ca2df0bc-fcf5-4e20-931e-dd33a4641413 | 4 | public boolean stalled ()
{
// Check whether there was decoding error.
if (!next ())
return false;
while (to_read == 0) {
if (!next ()) {
if (!next ())
return false;
return true;
}
}
... |
805a856b-54b6-42d6-bce7-9ed33f7d133e | 2 | public void addnegative() {
for (Resource.Image img : res.layers(Resource.imgc)) {
if (img.id < 0)
add(img);
}
} |
778f60a2-460e-452d-ac2f-67cb7a10845e | 2 | @Test
public void testGetAcademysAsJson() {
System.out.println("getAcademysAsJson");
String academys = amock.getAcademysAsJson();
System.out.println(academys);
if (academys.contains("CPH") && academys.contains("Fort Bregan")) {
assertTrue(true);
}
assertFa... |
f51aa14f-91e8-48d7-8ffe-a116b6eb876c | 4 | private void doMain() throws FileNotFoundException {
if (gedcomIn.isDirectory()) {
int cnt = 0;
for (File file : gedcomIn.listFiles()) {
convertAndCompareGedcom(file);
if (++cnt % 100 == 0) {
System.out.print(".");
}
}
} else if (... |
b5838bc7-2b8f-4d3e-a429-2aa2a8ab8732 | 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... |
4b10b958-71ae-4880-ac1b-8e244a87c14b | 4 | public Arctica.fuelGroups getFuelGroup(int blockID)
{
Arctica.fuelGroups group = Arctica.fuelGroups.NONE;
if(fuelBlocksGroupIDlist_Wool.contains(blockID))
{
group = Arctica.fuelGroups.WOOL;
}
else if(fuelBlocksGroupIDlist_CraftedWood.contains(blockID))
{
group =... |
d2f9a4a8-e47e-49f0-a9c4-26cb0896b4a5 | 7 | void readConfig(String configFilePath) {
try {
Scanner s = null;
s = new Scanner(new BufferedReader(new FileReader(configFilePath)));
mintime = 0;
// nsegments
nsegments = s.nextInt();
nblocks = new int[nsegments];
... |
f20d924d-ecc0-4ed3-8344-72e442ef0aad | 1 | public Shader( String fileName )
{
ShaderResource oldResource = loadedShaders.get( fileName );
if ( oldResource != null )
{
resource = oldResource;
resource.addReference();
}
else
{
resource = new ShaderResource();
String vertexShaderText = loadShader( fileName + ".vert" );
String fragment... |
5c2ffbc5-5ed4-4b18-b264-e4cf46c71464 | 5 | public void processInput(String lineOfText, client clientObj) {
this.clientObj = clientObj;
if (!lineOfText.isEmpty()) {
String[] args = lineOfText.split("\\s+");
String command = args[0];
String[] remArgs = new String[args.length-1];
... |
b1dd44ce-d92e-49b6-a945-3f34f672449f | 6 | public void checaColision(){
//boolean auxAterrizado = false;
/* Checamos colisiones con los tiles en horizontal */
double oldX = pato.getPosX();
double newX = oldX + pato.getVelocidadX();
Point tile = getTileCollision(pato, newX, pato.getPosY());
if (tile == null) {
pato.setDoublePosX(newX);
}
... |
3804bae7-d208-4aed-8c06-fafe75537780 | 1 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
if (e.getDocument() == null) {
setEnabled(false);
} else {
setEnabled(true);
}
} |
871735e1-8a5a-417a-b9c4-ef02e6b4998f | 9 | private byte getRegister4015(){
boolean oldFrameInterruptFlag = _frameInterruptFlag;
if(!_justSet){
if(_frameInterruptFlag) {
// System.out.println("Clearing Interrupt 4015");
_frameInterruptFlag = false; // need to handle a special case here
//triggerCount = 0;
}
}
byte b =
... |
e9f346bf-acb1-4e67-9833-5ad3446ac9cf | 4 | public Behaviour jobFor(Actor actor) {
if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
final int linkMod = (int) (5 * (1 - stocks.shortagePenalty(DATALINKS))) ;
if (actor.vocation() == Background.AUDITOR) {
final Venue t... |
d85a729a-f960-4fc0-a491-1c3276b877a9 | 7 | public static int[][] zeroMatrix(int[][] mtx){
int m = mtx.length;
int n = mtx[0].length;
int[][] outMtx = mtx;
boolean[] rowZero = new boolean[m];
boolean[] colZero = new boolean[n];
Arrays.fill(rowZero, false);
Arrays.fill(colZero, false);
// find the rows and columns that need to be zeroed
for (in... |
6a7bc583-449d-4e9f-8714-efee185d9043 | 5 | public boolean isCellEditable(int row, int col) {
boolean result = false;
if(isEnabled && col == 1 &&
(endEnabling == -1 || (row>= startEnabling && row <= endEnabling)))
result = true;
return result;
} |
0050595c-2647-482b-b658-a3695db58c66 | 4 | public void sortArray() {
this.arrayAccess = 0;
this.comparisions = 0;
int arrLength = this.array.length;
int inner, outer;
T temp;
/**
* Create the Gap sequences, in this I have followed the useless Gap
* sequence that was given by Shell which does no... |
f94f51ac-49bf-4fbb-b69b-20ec09b77865 | 1 | @Override
public void paint(Graphics g) {
if (image != null) {
g.drawImage(image,0,0,this);
}
} |
0f98a387-0b50-430a-9777-3035bacf4583 | 3 | public T get()
{
try
{
switch (pType)
{
case FIELD:
Object fieldValue = connectedField.get(connectedObject);
return clazz.cast(fieldValue);
case METHOD:
Object met... |
69aa10a7-851b-45f2-bf8b-0f449db7500e | 1 | public void up() {
currentlySelected++;
if(currentlySelected >= countItemsInInventory())
currentlySelected = 0;
} |
2c1e68c1-71b6-43db-8c90-926b3f7510e6 | 8 | public static void main(String[] args) throws IOException {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
HashMap<Integer,Integer> map1 ;
HashMap<Integer,Integer> map2 ;
HashMap<Integer,Integer> map3 ;
int n,a,b;
ArrayList<Integer> array;
... |
c1148d5d-8a29-4b45-bb6e-a5e3cf21f0d8 | 2 | protected void endTracking() {
component.setLocationC(target.getLocationXC(), target.getLocationYC());
target.socket(component);
switch (destAction) {
case (DEST_VISIBLE_TRUE) : {
component.setVisible(false);
} break;
case (DEST_VISIBLE_FALSE)... |
f5679548-d8e1-40b9-b7d6-36b0429bc9d9 | 7 | protected Rectangle ForceSquare(Graphics g, Rectangle r) {
Rectangle dr;
int x = r.x;
int y = r.y;
int width = r.width;
int height = r.height;
double xrange = 0.0;
double yrange = 0.0;
double range;
if (dataset == null | dataset.isEmpty())
return r;
// Force all the axis to have the same range... |
529b3686-000a-4393-9b0b-6ec10fce9785 | 3 | public void setRight(PExp node)
{
if(this._right_ != null)
{
this._right_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
a506cb43-8037-4a00-825c-a6a9f1ab7c64 | 5 | public void start() throws JSchException{
Session _session=getSession();
try{
sendRequests();
Request request=new RequestExec(command);
request.request(_session, this);
}
catch(Exception e){
if(e instanceof JSchException) throw (JSchException)e;
if(e instanceof Throwable)
... |
40287b5e-d2f1-4e8a-b566-d971eb3a9f7d | 2 | synchronized List<Utr5prime> get5primeUtrs() {
if (utrs == null) {
Transcript tr = (Transcript) findParent(Transcript.class);
// Get UTRs and sort them
utrs = tr.get5primeUtrs();
if (isStrandPlus()) Collections.sort(utrs, new IntervalComparatorByStart()); // Sort... |
68fd5c30-c998-4d37-9672-3d78defa5748 | 0 | public void raiseSalary(double byPercent)
{
double raise = salary * byPercent / 100;
salary += raise;
} |
44801766-1b4b-4950-93c3-ab45d2e32e76 | 5 | private static String formURL(int ID, int page) {
String urlPartPage;
String urlPartOptions = "no-items/xml/";
String urlStart = "https://zkillboard.com/api/";
if (urlPartID == null || !urlPartID.contains(String.valueOf(ID))) {
if (api.Eve.isCorporationID(ID)) {
urlPartID = "corporationID/" + ID + "/";
... |
02af60f4-6779-4527-ab06-23ae5adbf94d | 6 | public static HTTPRequest fromSocket(Socket client) throws IOException
{
Vector<String> headerData = new Vector<String>();
BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
while ( !reader.ready() && client.isConnected() );
while ( client.isConnected() )
{
Str... |
5e958291-818b-4d6c-a34b-81bd725d2a58 | 0 | public AIPaddle(int x, int y, double speed, int gameWidth, int gameHeight, int width, int height) {
SPEED = speed;
this.x = x;
this.y = y;
this.height = height;
this.width = width;
this.gameHeight = gameHeight;
this.gameWidth = gameWidth;
} |
1204721d-0c87-4cf1-8563-3e62b37706bf | 1 | public void setBattle(Battle b) {
this.battle = b;
try {
playerImage = new Image("/res/sprites/pokemon/" + b.getPlayer().getPokemon().get_image());
enemyImage = new Image("/res/sprites/pokemon/" + b.getEnemy().get_image());
} catch (SlickException e) {
// TODO Auto-generated catch block
e.printStackTr... |
3f76d968-dd80-45da-907e-fd612a3a160b | 9 | public TransactionRecord getNextTransaction(Customer customer) throws IOException {
TransactionRecord transaction;
//read first line to get customer name
String name = reader.readLine();
tok = new StringTokenizer(name);
//parse customer name into first and last
try {
... |
9559ba96-457b-4fe5-8127-d6fbbb42301f | 9 | public static void main(String args[]) {
Scanner scan = new Scanner(new BufferedInputStream(System.in));
int w = scan.nextInt();
scan.nextInt();
String in = scan.next();
String dic[] = new String[w];
for (int i = 0; i < w; i ++) {
dic[i] = scan.next();
}
int[] dp = new int[in.length()+1];
for (int ... |
51614816-9f29-4eda-b4ec-76725c37000d | 9 | public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getActionBytes());
}
if (((bitField0_ & 0x... |
ed423596-146a-462e-817e-cfaa099cb8f1 | 8 | public void collisionWithMob(List<Mob> mobs) {
for (Projectile p : liste) {
for (Mob m : mobs) {
if (p.getX() < m.getX1() && p.getX1() > m.getX() && p.getY() < m.getY1() && p.getY1() > m.getY() && p.isActive()) {
TYPE t = TYPE.DAMAGE;
if (p.isT... |
b9800c4a-c033-46e8-8a3c-a2760fa48617 | 4 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String action = request.getParameter("action");
//由context parameter取得JDBC需要的資訊
ServletContext sc = this.getServletConfig().getServletContext();... |
892164f6-14dc-4863-8e7c-b1c2911334e2 | 0 | public void setjLabel6(JLabel jLabel6) {
this.jLabel6 = jLabel6;
} |
20263ca5-3682-4879-bcfd-abe1dc693c10 | 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 fe... |
7e47b881-445e-496e-9e87-976c8d7cceb9 | 0 | @Before
public void setUp() {
} |
382e6eb9-83f7-48e3-a797-61e0b906e2d4 | 9 | @Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new dModListener(this), this);
getCommand("leaderboard").setExecutor(new dModLeaderboard(this));
getCommand("pvpreset").setExecutor(new dModPvpStat(this));
getCommand("dmreload").setExecutor(this);
... |
0c622bcb-46c1-41b9-9607-492798013672 | 4 | public static String invertCrossPiece(Cube cube, Side side) {
String a = "";
TileColor color = cube.getFace(side);
if (color.equals(TileColor.blue)) {
a = ",F,DI,L,D";
} else if (color.equals(TileColor.red)) {
a = ",R,DI,F,D";
} else if (color.equals(TileColor.green)) {
a = ",B,DI,R,D";
} else if (... |
db6539d2-aa72-44cb-bd4d-cd74e038baeb | 2 | private void finalizeRemovalWithoutChecking() {
try
{
List<User> aUser = User.list();
for(User user:aUser) {
VenueRemovalFinalized notification = new VenueRemovalFinalized(this);
Notification.add(user.getId(), notification);
}
this.delete();
} catch (SQLException e)
{
e.printStackTrac... |
ba20867b-83ac-4094-b387-dea3e910e403 | 1 | public static Item getItemFromUIN(String uin){
if(registeredItems.containsKey(uin))
return registeredItems.get(uin);
return null;
} |
69bdd760-abdc-4982-8acc-c7b13628bba1 | 3 | public void run() {
/* You fill this in, along with any subsidiary methods */
setSize(WIDTH, HEIGHT);
setBrickField();
paddleCtrl = new PaddleControl(this, PADDLE_WIDTH, PADDLE_HEIGHT, PADDLE_Y_OFFSET);
ballConroll = new BallControl(this, BALL_RADIUS);
addMouseListeners();
ballConroll.throwBa... |
b01c26ce-0c73-4fdc-b0e0-96172098c2a4 | 7 | public void loadTracesToFESVo(int sourceID)
{
int sizeOfExtendedHeaders =
readShort(SEGY.SEGY_NUM_OF_EXTENDED_TEXTUAL_FILE_HEADER_BYTE_NUM)
* SEGY.SEGY_TEXTUAL_HEADER_SIZE;
int sizeOfAllHeaders = SEGY.SEGY_TEXTUAL_HEADER_SIZE
+ S... |
4463421a-1a67-49b1-b9a1-b048719d420c | 4 | public LinkedList<Waypoint> getClosestWaypoints(Vector2 pos)
{
if (waypoints.size() > 0)
{
LinkedList<Waypoint> res = new LinkedList<Waypoint>();
Waypoint start = waypoints.get(0);
double min = pos.getDistance(start.drawX(), start.drawY());
for (Waypoint w : waypoints)
{
double tmp = pos.getDis... |
349964f1-6631-46c2-96af-67bbba146602 | 1 | public void render(int arg0, int arg1, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) {
Model model = getRotatedModel();
if (model != null) {
height = model.height;
model.render(arg0, arg1, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
} |
053daaa7-9214-479f-8f4d-8166e7c14a3e | 0 | public CheckResultMessage check22(int day) {
return checkReport.check22(day);
} |
75bf8caf-149b-4883-8a43-1c262be338c8 | 3 | public void receive() {
System.out.println("\nClient " + id + " receive buffer: " + buffer);
if (!buffer.isEmpty()) {
Operation o = buffer.get(0);
System.out.println("[TEMP]");
if (!this.isSynchronized()) {
System.out.println("[TEMP] before synccheck " + o + " == " + sync);
if (o.isSync()) {
... |
3e95cb86-7236-4e1e-81c0-11798a18c86c | 2 | private static void writeFile(File file, File targetFile){
BufferedReader reader;
FileOutputStream output = null;
try {
reader = new BufferedReader(new FileReader(file));
output = new FileOutputStream(targetFile);
file.createNewFile();
while(reader.ready()){
String s = reader.readLine();
outpu... |
68742909-d807-49eb-8c3c-9eb4d31423b0 | 6 | private void readShade(GroupSector gs, Node node) {
Direction d = null;
String direction = null;
Color shade;
String color = null;
String texture = null;
NamedNodeMap map = node.getAttributes();
Node attrs;
attrs = map.getNamedItem( "dir" );
if ( attrs != null ) {
direction = attrs.getNode... |
2fe2fadd-ae8a-4cda-994a-175a9c6cc054 | 9 | public Model getRecoloredModel(int arg0) {
if (stackIds != null && arg0 > 1) {
int id = -1;
for (int i = 0; i < 10; i++) {
if (arg0 >= stackAmounts[i] && stackAmounts[i] != 0) {
id = stackIds[i];
}
}
if (id != -1) {
return ItemDefinition.forId(id).getRecoloredModel(1);
}
}
Model mo... |
c524cf07-7f94-4aa2-ab5d-0ccd698f64bf | 1 | public Bouton(String name, int X, int Y, int width, int height) {
super(name);
_name = name;
//setBackground(Color.WHITE);
setBounds(X,Y,width,height);
addMouseListener(this);
setOpaque(true);
setBorder(null);
try {
setImg(ImageIO.read(new File("img/button/button.png")));
} catch (IOException... |
87123124-5c1b-433a-bc52-af147ab00cb8 | 8 | public int[] getResourceCardsEarned(int rollNumber, Player player) {
int cardsEarned[] = new int[5];
for (int i = 0; i < cardsEarned.length; i++) {
cardsEarned[i] = 0;
}
// For each tile that has the roll number, look at all of its nodes
// and see if the player has a settlement ... |
3cf0354e-cf24-404c-a8b6-0a428f93b867 | 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... |
a4c9a688-555a-4d5f-9d0a-ca7c8f2bff03 | 4 | public boolean areBracketsValid(String content) {
int openBrackets = 0;
for (char c : content.toCharArray()) {
if (c == openingBracket)
openBrackets++;
else if (c == closingBracket) {
openBrackets--;
if (openBrackets < 0)
... |
5bfe13e2-8782-4e53-871e-231b112c1f37 | 9 | public void configureUI() {
ArrayList<Integer> previousBundle = null;
ArrayList<Integer> nextBundle = null;
boolean first = true;
Float[] keys = Database.BUNDLES.keySet().toArray(
new Float[Database.BUNDLES.size()]);
int maxBundleSize = 0;
int i = 0;
for (ArrayList<Integer> bundle : Database.BUNDLES.v... |
54771ed8-5512-4ce2-a1f3-ff66b9613289 | 9 | @Override
public ServerModel buyDevCard(BuyDevCardRequest request, CookieParams cookie) throws InvalidMovesRequest {
if(request == null) {
throw new InvalidMovesRequest("Error: invalid buy dev card request");
}
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
int owner=request.getPlayerI... |
2e714efe-c8f5-4780-8588-ad937fd208e7 | 3 | public static Estado copiarEstado(Estado estado){
HashMap<ArrayList<Integer>, Celula> blankcellestado = estado.getBlankcells();
Celula[][] celulasestado = estado.getMatriz();
HashMap<ArrayList<Integer>, Celula> blankcellcopiado = new HashMap();
Celula[][] celulascopiado = new Ce... |
09673b11-f802-4465-8e39-795edb49616c | 3 | private void playMatch(int redBrain, int blackBrain, World world, GUI gui, int matchNum, int totalMatches) {
Gameplay game = new Gameplay(antBrains.get(redBrain), antBrains.get(blackBrain));
game.loadWorld(world);
//game.generateWorld();
game.setupGame();
game.playGame(gui, match... |
9b4549b9-a120-4aff-a7c2-e77ad7d17937 | 5 | public String getDefaultComment() {
switch (this) {
case CLAIM:
return ModReq.getInstance().Messages.getString("log.claim.default");
case CLOSE:
return ModReq.getInstance().Messages.getString("log.close.default");
case REOPEN:
r... |
fdc1f2b6-9f39-49b7-b46b-48739052e05f | 1 | public synchronized void stop() {
if (!running)
return;
running = false;
System.exit(0);
} |
8ddfb921-dca7-4a22-8473-e331ab96b3ca | 2 | public Boolean isOwner(SlotMachine slot) {
if(plugin.permission.isAdmin(player) || slot.getOwner().equalsIgnoreCase(player.getName())) {
return true;
}
return false;
} |
dea6822d-ca0f-47d2-b6c1-39e502f55fc0 | 1 | private void processMouseReleased(MouseEvent e) {
int buttonCode = e.getButton();
Point clickPoint = e.getPoint();
if (buttonCode == MouseEvent.BUTTON1) {
gameController.handleReleased(clickPoint);
}
} |
17e1ec76-f130-4acf-aab4-e1b9d0cc6cf2 | 8 | public Point move( Direction d ){
switch( d ){
case down: if( _down == null ){ _down = create( _x, _y+1 ); } return _down;
case left: if( _left == null ){ _left = create( _x+1, _y ); } return _left;
case right: if( _right == null ){ _right = create( _x-1, _y ); } return _right;
case up: if( _up == null ){... |
c99e7db2-4fc8-4f93-8bf3-d984c8fbbd66 | 3 | @Override
public T pull() throws InterruptedException {
synchronized (taskQueue) {
while (taskQueue.size() == 0 && !endOfData) {
taskQueue.wait();
}
if (taskQueue.size() > 0) {
T task = taskQueue.removeFirst();
notifyUpdate... |
7803b8b0-4f54-47f5-8b21-d2f122acfe0f | 8 | private static int parse(String[] args, CompiledClass[] result) {
int n = -1;
for (int i = 0; i < args.length; ++i) {
String a = args[i];
if (a.equals("-m"))
if (n < 0 || i + 1 > args.length)
return -1;
else
... |
86bed08a-3975-4f35-913f-4c6f542b4c47 | 4 | public boolean match(Pattern pattern)
{
String[] patternArray = pattern.getPatternArray();
// path and pattern must have the same number of entries.
if (pathArray.length != patternArray.length) return false;
// check respective path and pattern array, taking wild card into account.
for (int i = 0; i < pathAr... |
6e9de9d6-e43a-468a-a6d7-eac6749ebf5f | 5 | @Override
public boolean isObstacle(Element e) {
if (e == null)
throw new IllegalArgumentException("The given arguments are invalid!");
for (Element element : getGrid().getElementsOnPosition(getGrid().getElementPosition(destination)))
if (!(element instanceof Teleporter) && (element instanceof Obstacle) &... |
116bd7c5-bea6-46c5-8dcb-96ef3c1d0c59 | 4 | @Override
public boolean equals(Object object) {
if (object == null) { return false; }
if (object == this) { return true; }
if (object instanceof Time) {
Time time = (Time)object;
return (this.hour == time.getHour() && this.min == time.getMin());
... |
a96b24cf-9cd7-4c3f-884e-e4367f81706d | 0 | public T getValue() {
return value;
} |
79d2ceda-e81a-4560-bf2a-feba88c5a1ea | 8 | final Buffer method2120(int i, MapBuffer mapbuffer, boolean bool) {
anInt4756++;
if (i != 0)
((Class285) this).aClass377_4759 = null;
if ((anInt4736 ^ 0xffffffff) == -1) {
method2126((byte) -36);
if (anInt4746 <= 0) {
anInt4736 = 2;
return aNativeHeapBuffer4748;
}
OpenGL.glBindBufferARB(... |
35031821-bad6-4f4c-a503-2a6b364dd866 | 2 | public void setCurrentVehicleAcceptor(VehicleAcceptor road, double requestedPostion) {
_currentRoad = road;
// //reset the position
// this.setPosition(0);
// //this.moveTo(requestedPostion);
// double free = this.checkFreeSpaceAhead();
//if the road is clear AND we want to skip it, we need to ... |
84c8637d-2c8d-48b3-b32d-77d4ce911750 | 8 | public RuleSetModel(Element model, Instances dataDictionary,
MiningSchema miningSchema) throws Exception {
super(dataDictionary, miningSchema);
if (!getPMMLVersion().equals("3.2")) {
// TODO: might have to throw an exception and only support 3.2
}
String fn = model.getAttribut... |
69538387-2b6b-4798-94af-4287c0d0b4ae | 1 | public double heuristicTest(int i, int j, int destI, int destJ) {
int undoSetI = this.destI_pos;
int undoSetJ = this.destJ_pos;
double estimation = -1;
try {
BitmapGraph.A_Star testAs = new BitmapGraph.A_Star();
this.destI_pos = destI;
this.destJ_pos ... |
ffadb2f5-11cd-409d-877a-62da2e955782 | 5 | public Collection<String> getMainGroopsOrd()
{
// A Map of groopName --> Count
Map<String, Integer> mainGroopMap = new TreeMap<String, Integer>();
Collection<String> mainGroops = new Vector<String>();
Iterator<Track> tIt = tracks.iterator();
while (tIt.hasNext())
{
// In... |
17fd4ac0-2b67-4c72-a76d-9c7b813f8cdd | 7 | public static boolean canConvert(Class<?> from, Class<?> to) {
if (from == String.class && to.isArray()) {
return true;
}
// get it from the internal cache.new ArrayConverter((String)
// from).getArrayForType(to);
Converter<Object, ?> c = co.get(key(from, to));
if (c == null) {
// service provider loo... |
8124143e-cfb2-4a0d-85a3-821d5cb23f28 | 7 | @Override
public void keyReleased(KeyEvent e) {
int id = e.getKeyCode(); // KeyCode des KeyEvents auslesen
// Mittels KeyEvent prüfen, was für eine Taste losgelassen wurde, Wahrheitswert setzen
switch (id) {
case (KeyEvent.VK_W):
figUp = false;
break;
case (KeyEvent.VK_A):
figLeft = fals... |
aa1cd56f-8bf5-452f-a4db-f8b5bfb7ea50 | 0 | public int getUserRoleId() {
return userRoleId;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.