method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
313d2321-f737-43b7-bd72-59f1f1594580 | 6 | @Get
public Intervention read() {
Intervention target = null;
String userKey = (String) getRequest().getAttributes().get("userid");
String interventionKey = (String) getRequest().getAttributes().get(
"interventionid");
if (userKey == null || interventionKey == null)
return null;
EntityManager em =... |
4146ba43-74d5-40bd-b414-3c501aadf61d | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((!this.unInvoked)&&(invoker!=null))
{
if((!CMLib.flags().isInTheGame(invoker, false))
||(invoker.amDead())
||(invoker.amDestroyed())
||((affected!=null)&&(affected instanceof MOB)&&(invoker.location()!=((MOB)affected).location())))
u... |
8d65bef7-264c-454f-9986-753b499d4b05 | 9 | public boolean parse (String usage) {
Debug.trace(usage);
boolean status = true;
source = new TokenString(usage, delimiters);
argList = new ArgList();
// First token. Usage is optional.
String token = source.next();
if (token.equalsIgnoreCase("usage")) {
... |
42108035-380e-4125-97f7-923e63be74dc | 1 | @DELETE
@Path("/v2.0/networks/{networkId}")
public Response deleteNetwork(@PathParam("networkId") String networkId) throws MalformedURLException, IOException{
//Send the HTTP request to the REST service
HttpURLConnection conn=HTTPConnector.HTTPConnect(new URL(this.URLpath+"/"+networkId), OpenstackNetProxyConstant... |
92fd9b91-d819-42cc-a038-e1bb7901ea81 | 5 | protected Point pickMove(Map<Point, Item> sightedItems) {
Entry<Point, Item> mostDesired = null;
for (Entry<Point, Item> entry : sightedItems.entrySet()) {
if (mostDesired == null || (mostDesired != null && mostDesired.getValue() == null)) {
mostDesired = entry;
} else if (mostDesired != null) {
m... |
7f8f75bf-4f94-4518-b64b-6c032b0ae8e7 | 6 | public boolean hasWinner() {
String slots = "";
for (int[] winComb : winCombs) {
for (int aWinComb : winComb) slots += getSlot(aWinComb);
if(slots.equals("XXXX") || slots.equals("XXX")) return true;
if(slots.equals("OOOO") || slots.equals("OOO")) return true;
... |
3688e38e-a032-465d-aea9-16ed3d661275 | 7 | private void replaceZeros(int matrix[][])
{
boolean rows[] = new boolean[matrix.length];
boolean columns[] = new boolean[matrix[0].length];
//find all 0 positions first
for(int i = 0; i < matrix.length; i++)
{
for(int j = 0; j <matrix[i].length; j++)
{
// store the row, column position
if(ma... |
e654cfb2-61da-4e2c-86d7-cffd5f29f12c | 8 | public boolean czyWpolu(int mouseX, int mouseY){
if( mouseX<karta.odstep || mouseY<karta.odstep ||
mouseX>(karta.odstep+karta.szerokosc)*szerokosc || mouseY>(karta.odstep+karta.szerokosc)*dlugosc
)
return false;
int wsp = (mouseX-karta.odstep)/(karta.szerokosc+karta.odstep);
int start = wsp*(karta.s... |
3b5ce85a-633d-49ac-9ee8-4cd057578045 | 2 | @Override
public void generate() throws GeneratorException {
XHTMLOptions optionsHTML = XHTMLOptions.create();
// Extract image
File imageFolder = new File(report.getOutput() + "/images/");
optionsHTML.setExtractor(new FileImageExtractor(imageFolder));
optionsHTML.URIResolver(new Fil... |
9d825858-7483-4ae8-add4-6705913c86b4 | 6 | final void method3049(ByteBuffer class348_sub49, int i, int i_9_) {
anInt9331++;
int i_10_ = i;
while_198_:
do {
do {
if (i_10_ != 0) {
if (i_10_ != 1) {
if ((i_10_ ^ 0xffffffff) == -3)
break;
break while_198_;
}
} else {
anInt9329 = class348_sub49.getUByte();
break ... |
d98fb617-587d-4601-96ed-624142b1b7fd | 8 | private void exit() {
try {
File f = new File(filepath);
PrintWriter output;
output = new PrintWriter(f);
for (Employee e : employeeList) {
output.println(e.getName());
output.println(e.getTitle());
output.println();// blank line to separate title and tasks
ArrayList<Task> unfinishedTaskLi... |
f6a3df64-3ba8-4ae8-8adf-b349f1d37b49 | 9 | public int setNewOwner(int prevID) {
int team = -1;
PlayerInfo prev = null;
for (PlayerInfo p : m_team1) {
if (p.getId() == prevID) {
prev = p;
team = 1;
break;
}
}
// only check team 2 if owner not in team 1
if (prev == null) {
for (PlayerInfo p : m_team2) {
if (p.getId() == pre... |
d5cfccda-8e51-4733-86cb-e434f5022f5f | 8 | private BasicBlock[] makeBlocks(HashMap markTable) {
Mark[] marks = (Mark[])markTable.values()
.toArray(new Mark[markTable.size()]);
java.util.Arrays.sort(marks);
ArrayList blocks = new ArrayList();
int i = 0;
BasicB... |
3de18c0b-b92c-4bac-9dd7-02ebb79e3dda | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (! (obj instanceof PacketListener)) {
return false;
}
PacketListener other = (PacketListener) obj;
... |
d25c1acc-15b9-404e-8049-2942b4a2b7d5 | 0 | public void endGame() {
this.isActive = false;
} |
330fcad9-a223-49c8-a9bc-6711bb65dbae | 6 | @Override
public void actionPerformed(ActionEvent e)
{
if (!Utils.isEmptyString(userName.getText(), false) && !Utils.isEmptyString(password.getText(), false))
{
try
{
userName.setCaretPosition(userName.getText().length());
if (userName.getText().length() > 15)
{
userName.setText("Name Is T... |
1761e94e-79bd-4e41-ad46-15c6d1a79f32 | 6 | private static int getPartition(int[] arr, int start, int end)
{
int partition = arr[start];
int low = -1;
int high = end + 1;
while (low < high)
{
low++;
while (arr[low] < partition && low < end) low++;
high--;
... |
eb3919cd-d09e-463c-a43c-40a57e046e17 | 1 | public void restartGame() {
//Make a new thread to ensure we don't run it on the EDT
new Thread() {
public void run() {
if (panel != null) {
panel.removeComponentListener(panel);
panel.removeMouseMotionListener(panel);
... |
642ae196-c3d4-4881-8af8-d439054f69d2 | 1 | public void load45DegreeSlopeRight(Rectangle2D e) {
for(int x = 0; x < e.getWidth() / 2; x++) {
platforms.add(new Platform(new Rectangle2D.Double(e.getX() + ((e.getWidth() / (TileSet.tileWidth / 2)) * x),
e.getMaxY() - ((e.getHeight() / (TileSet.tileHeight / 2)) * x), (e.getWidth() / (TileSet.tileWidth / 2))... |
228c1bd4-8c16-4f61-ae9a-fcd075877ecb | 6 | @Override
public void update(GameContainer container, int delta) throws SlickException {
Input input = container.getInput();
float playerY = playerPaddle.getY();
if (input.isKeyDown(Input.KEY_UP)) {
if (playerY > UPPER_WALL) {
// The lower the delta the slowest the sprite ... |
3031d4dc-ca55-4f9d-b7b8-9148581ab810 | 0 | public void setVue(VueVisiteurs vue) {
this.vue = vue;
} |
622429b5-6f87-4ad9-8425-839baa3d8eda | 5 | protected void printWordTopicDistribution(_Doc d,
File wordTopicDistributionFolder, int k) {
String wordTopicDistributionFile = d.getName() + ".txt";
try {
PrintWriter pw = new PrintWriter(new File(
wordTopicDistributionFolder, wordTopicDistributionFile));
_Doc4DCMLDA DCMDoc = (_Doc4DCMLDA) d;
for... |
66a94093-86b7-430e-a9d8-9c8fadf194f2 | 3 | public Builder mergeAuthentication(protocols.ChatProtocol.Authentication value) {
if (authenticationBuilder_ == null) {
if (((bitField0_ & 0x00000008) == 0x00000008) &&
authentication_ != protocols.ChatProtocol.Authentication.getDefaultInstance()) {
authentication_ =
... |
3655b146-8909-4bbf-a2c6-438621c6585c | 7 | public void mouseEvent(MouseEvent event) {
int action = event.getAction();
// mouseX = event.getX();
// mouseY = event.getY();
// if ((action == MouseEvent.DRAG) || (action == MouseEvent.MOVE)) {
// pmouseX = emouseX;
// pmouseY = emouseY;
// mouseX = event.getX();
// mouseY = event.getY();
// }
... |
54f43f31-2054-435a-a09f-47ade0b278e4 | 4 | @Override
public void DomainClick(int index)
{
if(index != -1) { // If The click was out of the grid
IntDomain idom = cpController.GetCPVariable(activeX, activeY).getDomain();
DisposableIntIterator iter = idom.getIterator();
int val = 1;
for(;index >= 0 && iter.hasNext(); index--) {
val = ite... |
c5e750ac-235d-41b2-a42a-1c26f768ba77 | 4 | public static int glLoadPNG(String location) {
int texture = glGenTextures();
glBindTexture(GL_TEXTURE_2D, texture);
InputStream in = null;
try {
in = new FileInputStream(location);
PNGDecoder decoder = new PNGDecoder(in);
ByteBuffer buffer = BufferUtils.createByteBuffer(4... |
de7acc80-a987-47c3-b1d5-5ddb975918eb | 6 | public EventPanel(FreeColClient freeColClient, GUI gui, EventType type) {
super(freeColClient, gui);
setLayout(new MigLayout("wrap 1", "[center]", "[]20"));
// TODO: simplify this -- event should contain the necessary
// information; add it to enum or upgrade to class
String te... |
b1b7fc95-a5f2-4c63-bfc7-27586931eb13 | 3 | public static void switchScreen(JPanel panel)
{
if (panel instanceof PanelKeyGen)
{
selectKeyGen.setEnabled(false);
selectSign.setEnabled(true);
selectVerify.setEnabled(true);
panelKeyGen.setVisible(true);
panelSign.setVisible(false);
panelVerify.setVisible(false);
}
else if (panel instan... |
9987184f-7ef3-48b7-9262-b101e6badf5a | 0 | @BeforeClass
public static void setUpClass() {
} |
d09a2ce8-e5a3-4696-b422-87bbd504e4fb | 7 | public void playerSkillMod(int[] playerShipModifiers) {
int max = 0;
int maxPosition = 0;
for (int i = 0; i < playerShipModifiers.length; i++) {
if (playerShipModifiers[i] > max) {
max = playerShipModifiers[i];
maxPosition = i;
}
}
... |
8dbe98b4-90f9-46ab-a3f7-9d695245ae6a | 3 | public static pgrid.service.corba.simulation.SimulationHandle narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof pgrid.service.corba.simulation.SimulationHandle)
return (pgrid.service.corba.simulation.SimulationHandle)obj;
else if (!obj._is_a (id ()))
... |
3c84fb9c-5f6a-4442-b465-e72d53bd28d7 | 2 | private static byte[] buildTri() {
byte[] tri = new byte[TABLE_LENGTH];
for (int i = 0; i < TABLE_LENGTH; i++) {
if (i < TABLE_LENGTH / 2) {//what goes up...
tri[i] = (byte) Math.round(lerp(-127, 127, i / ((float) TABLE_LENGTH / 2)));
} else {//...must come down.... |
671baf08-c544-44e1-8bf5-8c53e3e8d8ba | 9 | private static ArrayList<String> filter (ArrayList<String> wordList)
{
ArrayList<String> filteredWords = new ArrayList<String>();
filteredWords.add("usgin");
filteredWords.add("document:text");
filteredWords.add("document:image");
filteredWords.add("Downloadable");
for (int i = wordList.size() - 1; i >= 0; ... |
4f5da3e7-ffde-485d-836c-a7a1d834cd98 | 0 | public void setIdHospital(Integer idHospital) {
this.idHospital = idHospital;
} |
3fc92fd4-98f6-4029-b44b-492df1236827 | 4 | @Override
public void delete(IEmailKontakt emailKontakt) {
Connection con = null;
try {
con = initDBConnection();
} catch (SQLException e) {
e.printStackTrace();
}
PreparedStatement ps = null;
try {
con.setAutoCommit(false);
ps = con.prepareStatement("DELETE FROM Kontakt WHERE KontaktId = ?");
... |
1a165618-2e63-4d2f-b7b9-0bee0be713c0 | 6 | public void run(){
double currTime;
double prevTime = System.nanoTime() / NANO_TO_SEC;
double FPSTIMER = System.nanoTime();
double maxTimeDiff = 100.0 / 1000.0;
double delta = 1.0 / 60.0;
double processes = 0, frames = 0;
while(true){
currTime = System.nanoTime() / NANO_TO_SEC;
if(currTime - prevTi... |
63d24bc1-7b61-45fa-925e-524b0c918c4c | 7 | void chooseMaxMinMakespan() {
/* Find the min makespan in one class, and then find the max one */
double tmpMinMakespan = Double.MAX_VALUE;
double tmpMaxMinMakespan = -1;
int iTmpMinClass = -1;
int iTmpMinSite = -1;
int iTmpMinCPU = -1;
iMinClass = -1;
iMinSite = -1;
iMinCPU = -1;
for (int i = 0;... |
5a2fb00e-9011-48fb-a93a-65c87c32ef3b | 5 | public boolean equals(Flight flight) {
return this.identifier.equals(flight.identifier) &&
this.departureAirport.equals(flight.departureAirport) &&
this.departureTime.equals(flight.departureTime) &&
this.arrivalAirport.equals(flight.arrivalAirport) &&
this.arrivalTime.equals(flight.arrivalTime... |
5b4a42d7-71cc-46f2-85e8-e1405a5bfd0b | 1 | public void testConstructor_8int__PeriodType3() throws Throwable {
try {
new MutablePeriod(1, 2, 3, 4, 5, 6, 7, 8, PeriodType.dayTime());
fail();
} catch (IllegalArgumentException ex) {}
} |
a2866d23-68a5-4ab8-9368-803ed3fdcc91 | 7 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((author == null) ? 0 : author.hashCode());
result = prime * result + currentQuantity;
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + idN... |
311081ae-50e7-428f-898f-a1e7083fd0f7 | 4 | public static boolean estNumeroMobile(String source){
if(source.length() == 10 && ( source.substring(0,2).equals("06") || source.substring(0,2).equals("07"))){
try {
Integer.parseInt(source) ;
return true ;
}
catch(NumberFormatException e){
return false ;
}
}
else {
return false ;
}
... |
969facd5-4047-4d25-a5c9-d4b73bfc4f11 | 2 | public static Integer toInteger(Object obj) {
if(obj==null)
return null;
String string=StringUtils.trimNonNumeric(obj.toString());
Integer o=null;
try {
o=new Integer(Integer.parseInt(string));
} catch (NumberFormatException ex) {
}
return o;
} |
48bef665-e166-463b-8d68-6744cdb33080 | 4 | public Message(String message_xml) {
message_id = 0;
robot_name = "";
command = Command.UNKNOWN;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
try {
builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(m... |
8de812b8-f6c1-4f5f-991d-58f626106d0a | 3 | @Override
public void paintShape(mxGraphics2DCanvas canvas, mxCellState state)
{
Shape shape = createShape(canvas, state);
if (shape != null)
{
// Paints the background
if (configureGraphics(canvas, state, true))
{
canvas.fillShape(shape, hasShadow(canvas, state));
}
// Paints the foregroun... |
f189105e-5e57-470e-9b42-fc1c8b55aa2f | 6 | public boolean collide() {
for(int i = 0; i < 4; i++) {
int tx = blocks[i].getX();
int ty = blocks[i].getY();
if(tx < 0 || tx > Game.boardSizeX - 1)
return true;
if(ty < 0) continue;
if(ty > Game.boardSizeY - 1 || Game.blocks[tx][ty] !... |
a68c6f75-a6b5-44a5-8c6e-32ad24be2dcb | 1 | private static void fitToSize(Graph g, int xSize, int ySize, int padding) {
double xMax = findGreatestX(g);
double yMax = findGreatestY(g);
double xCoefficient = (xSize - padding) / xMax;
double yCoefficient = (ySize - padding) / yMax;
for (int i = 0; i < g.getVertices().getSize(... |
bba028a9-37d0-45fa-addb-78268ba546e4 | 9 | public int read(byte[] abData, int nOffset, int nLength) {
LOG.log(Level.FINE, ">TCircularBuffer.read(): called.");
dumpInternalState();
if (!isOpen()) {
if (availableRead() > 0) {
nLength = Math.min(nLength, availableRead());
LOG.log(Level.FINE, "read... |
9661f212-3d43-4a02-adf6-2c5f70d0dbab | 8 | public static boolean hasNonRepeatingSpacers(CRISPR candidateCRISPR, double maxSimilarity)
{
//assumes at least two elements
String firstRepeat = candidateCRISPR.repeatStringAt(0);
String firstSpacer = candidateCRISPR.spacerStringAt(0);
if (candidateCRISPR.numRepeats() >= 3)
{
... |
a1f1953b-7ec2-44eb-897b-678feeb95f72 | 1 | public static void main(String[] args){
args = removeOptionFromArgs(args);
String calculatedValue = usesDecimal ? Calculator.run(args, true) : Calculator.run(args);
System.out.println(calculatedValue);
System.exit(0);
} |
3ec88d88-520d-4d46-80b2-ee88f1c1a6cb | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String) object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boole... |
ae4097a6-e013-47e0-8c94-671fdde01afe | 8 | public Boolean isAt(Position p, Move d) {
switch (d) {
case UP:
return (this.x == (p.x)) && (this.y == p.y - 1);
case DOWN:
return (this.x == (p.x)) && (this.y == p.y + 1);
case LEFT:
return (this.x == (p.x - 1)) && (this.y == p.y);
case RIGHT:
return (this.x... |
8c2cc9ad-9d63-445c-a275-a9939c1a4d57 | 2 | public void InsertaFinal2(int idProceso, String nombreProceso)
{ if ( VaciaLista())
PrimerNodo = new NodosListaProceso (nombreProceso);
else{
NodosListaProceso aux= PrimerNodo;
while(aux.siguiente != null){
aux=aux.siguiente;
}
aux.si... |
8dae90d9-4022-4b61-bcde-515abbf94466 | 2 | public Server deployVirtualMachine(String serviceOfferingId, String templateId, String zoneId,
CreateServerOptions options) throws Exception
{
CloudStackApiClient client = new CloudStackApiClient(DEPLOY_VIRTUALMACHINE, apiKey, secretKey, apiUrl);
client.addParam("serviceofferingid", serviceOfferingId);
client... |
e5da40fa-9c32-4b91-b2dc-d178c9e399fe | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
c10c3e8e-68b8-493b-9a5f-10808c57264a | 0 | public EventHandlerClass(CreeperWarningMain plugin) {
this.plugin = plugin;
this.pds = new playerDataSave(plugin);
} |
0e9f910d-9ad7-4e76-8f28-0fe591bf9be4 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof AbstractEntity)) return false;
AbstractEntity that = (AbstractEntity) o;
return !(id != null ? !id.equals(that.id) : that.id != null);
} |
8bde6e79-efb4-4d4d-bc5a-10c9e5cdc153 | 0 | @Override
public boolean isConverted() {
// TODO Auto-generated method stub
return false;
} |
4595ea34-a90a-4d1e-9b6b-48976b5cbd45 | 7 | private static int parseParenSExpression (String aString, int startingIndex) {
int length = aString.length();
int parenLevel = 1;
boolean isQuotedString = false;
int charsParsed = 0;
char ch = ' ';
int index = startingIndex;
while (parenLevel != 0) {
i... |
94760280-bdc4-480a-a24b-0a977994998c | 0 | public int GetToLastBusStopTicks()
{
//get the tick time person got off the bus
return toLastBusStopTicks;
} |
fc72fb2d-42ea-496b-94fe-3e1858ba096d | 3 | public static void main(String[] args) {
Factual factual = factual();
Query q = new Query()
.only("name", "address")
.search("cafe")
.within(new Circle(34.06018, -118.41835, 5000))
.field("postcode").isEqual("90067")
.field("category").isEqual("Food & Beverage")
.limit(25);
// Run t... |
2217dff0-472c-45be-af08-b6eded7c0bbb | 0 | private void initLabel(){
final Dimension labelDim = new Dimension(150, 20);
totalQuestions = new JLabel("Total questions: ");
totalQuestions.setSize(labelDim);
numberTotQuestions = new JLabel("0");
numberTotQuestions.setSize(labelDim);
currentQuestions = new JLabel("Cu... |
fcb3330f-5985-4100-8e0c-1e94c9fbacb6 | 1 | public LocalDebugInfo[] locals() {
if (code != null) {
return code.locals();
}
return new LocalDebugInfo[0];
} |
9f02b235-7cda-47d4-b8a4-6db2647badb4 | 3 | public void backpropagate(double score) {
GameTreeNode cursor = this;
while(cursor != null) {
if(score == 0)
cursor.ties++;
else if(score > 0)
cursor.wins++;
else
cursor.losses++;
cursor = cursor.parent;
}
} |
ec38be51-8ace-4e85-b539-f6f4efe489af | 1 | public int evaluateBoard(Board board, Player player) {
int boardValue = 0;
if (player == Player.black) {
boardValue = evaluateValueofBoardForBlack(board);
} else {
boardValue = evaluateValueofBoardForWhite(board);
}
return boardValue;
} |
1dd1e4fb-d583-48ed-a989-d9c060a0bf6d | 0 | public void setCity(String city) {
Address.setCity(city);
} |
02b4562c-c6f6-455b-a87f-3710f68651d6 | 4 | public void receiveData() throws IOException {
byte code = getDataInputStream().readByte();
if(code == 0) { // Move entity packet
long id = getDataInputStream().readLong();
Entity entity = getEntityGroup().getEntityById(id);
float x = getDataInputStream().readFloat(... |
cc2e3ec5-b183-49a2-9083-c4cc55b2e4ca | 6 | public static FsNode parseFsNode(String fsxml) {
try {
FsNode newnode = new FsNode("unknown","unknown");
Document doc = DocumentHelper.parseText(fsxml);
if (doc!=null) {
Element rootnode = doc.getRootElement();
String name = rootnode.getName();
String id = rootnode.attributeValu... |
7b17b6d0-e52a-4d6d-8d63-a5ef3a83bfce | 5 | public static String nameForLong(long name) {
try {
if (name <= 0L || name >= 0x5b5b57f8a98a5dd1L) {
return "invalid_name";
}
if (name % 37L == 0L) {
return "invalid_name";
}
int index = 0;
char characters[] = new char[12];
while (name != 0L) {
long l = name;
name /= 37L;
char... |
c5c8b002-a50b-401b-a103-57e735effff8 | 5 | public ArrayList<Square> getNeighbors()
{
ArrayList<Square> nabors=new ArrayList<Square>();
for (int x=gx-1;x<=gx+1;x++)
{
for (int y=gy-1;y<=gy+1;y++)
{
if ( (x==gx) ^ (y==gy))//removes diagonals and center
{
if (Sq... |
320656ed-8b90-4829-b268-72d6903ea866 | 5 | private int bestArrangement(int mask, int currentLastWordIndex) {
int maxScore = INVALID_SCORE;
// myWord[currentLastWordIndex] has already been used
if (((int) Math.pow(2, currentLastWordIndex) & mask) != 0)
return INVALID_SCORE;
for (int i = 0; i < myWords.length; i++) {
if (i == currentLastWordIndex) /... |
a3b43b02-84ac-465e-8649-060722e94d0c | 5 | @Override
public void Draw(Graphics2D g2d)
{
switch (gameState)
{
case PLAYING:
game.Draw(g2d, mousePosition());
break;
case GAMEOVER:
g2d.setColor(Color.black);
g2d.drawString("The winner is " + Game.winner, fra... |
9476808f-e842-4350-aec9-bcc8acb6f08c | 8 | protected void updateCapabilitiesFilter(Capabilities filter) {
Instances tempInst;
Capabilities filterClass;
if (filter == null) {
m_ClustererEditor.setCapabilitiesFilter(new Capabilities(null));
return;
}
if (!ExplorerDefaults.getInitGenericObjectEditorFilter())
tempInst ... |
bf71710e-b4c5-431f-9629-972f99d0ba60 | 2 | private void doStand() {
// Set StageMario left or right side
switch (marioObject.getDirection()) {
case LEFT:
marioObject.setAnimation(StandLeft);
break;
case RIGHT:
marioObject.setAnimation(StandRight);
break;
... |
a9e956a1-0ecf-4e3d-ad43-89eb32cc0ef6 | 2 | public static pgrid.service.corba.repair.RepairHandle unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof pgrid.service.corba.repair.RepairHandle)
return (pgrid.service.corba.repair.RepairHandle)obj;
else
{
org.omg.CORBA.portable.Delega... |
4ead8d47-119d-48a5-aa88-4e302af28c1e | 8 | @Override
public void caseAAvalieExpLogicaDefinicaoComando(AAvalieExpLogicaDefinicaoComando node)
{
inAAvalieExpLogicaDefinicaoComando(node);
if(node.getAvalie() != null)
{
node.getAvalie().apply(this);
}
if(node.getLPar() != null)
{
node.g... |
15492153-81aa-475e-a1b8-25c638e57b85 | 6 | private synchronized Element send(String request) {
System.out.println(request);
if (request!=null ) {
long current = System.currentTimeMillis();
long past = current - this.lastRequestTime;
System.out.println("current:"+current+",past:"+past+ ((past < this.timeBetweenRequest) ? ",wait:"+(this.timeBetwee... |
35f373ee-40d3-40ff-a9de-2d8ee3fafb5a | 8 | public Boolean process() {
// Permissions
if(!plugin.permission.canCreate(player)) {
noPermission();
return true;
}
// Valid command format
if(args.length >= 2 && args.length <= 3) {
// Slot does not exist
if(!plugin.slotData.isSlot(args[1])) {
this.name = args[1];
... |
322d6b0d-a2f2-45e8-82e8-6279d0d01bdd | 8 | private int evalBoardPlace(GameBoard board, Team t1, Team t2){
//favor making a mill
int val = 0;
//this turns team
for(GamePiece p : t1.teamPieces){
if (!p.isInMill()){
if(board.detectNineManMill(t1, p.getR(), p.getP())) {
p.setInMill(true);
val += 20;
}
}
if (p.getP() % ... |
fba8f1c4-4726-40bb-a6f2-47c05d83f4cb | 5 | public void createHairListsOutOfWhiteLists() {
// createOblivionWhiteList();
createApachiiWhileList();
for (HDPT headpart : SkyProcStarter.merger.getHeadParts()) {
if (m_HairsNormalWhiteList.contains(headpart.getEDID())) {
m_HairsNormalList.add(headpart);
... |
eb6d654b-1663-40bd-bf81-b1bf0f74996b | 4 | public boolean IsAlive(int playerID) {
for (Planet p : planets) {
if (p.Owner() == playerID) {
return true;
}
}
for (Fleet f : fleets) {
if (f.Owner() == playerID) {
return true;
}
}
return false;
... |
1bd63640-b8b6-484c-b60f-f1aa1ee3313e | 9 | private void sietesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sietesMouseClicked
// TODO add your handling code here:
try {
if (conexion == true && enviando == 0) {
enviando = 1;
int opciones;
if (esinicio != 0 && 7 <= esin... |
987492bd-4305-45a8-8832-1269bd39602f | 3 | public static void main(String args[]) throws FileNotFoundException, IOException {
File file = new File("wikiTestFile.txt");
File oFile = new File("test.html");
FileOutputStream fileOutputStream = new FileOutputStream(oFile);
OutputStreamWriter outputStreamWriter = new OutputStreamWriter... |
d8394c8d-7c82-4eea-ac5c-a8b6cd637909 | 1 | public void removePush() {
if (condStack != null)
cond = condStack.mergeIntoExpression(cond);
bodyBlock.removePush();
} |
75832df4-0a34-4a1c-a106-7774767d8819 | 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... |
aff00b84-7d65-484b-8f6b-66dcd21bef89 | 4 | public static ArrayList <WordsPair> load(String newfile){
ArrayList<WordsPair> temp = new ArrayList();
ArrayList<String> tempLoad = new ArrayList();
try {
FileReader fileReader = new FileReader(newfile);// a BufferedReader needs a FileReader
BufferedReader br = n... |
1002ed18-20cf-4292-873f-cb35dbffac56 | 3 | public void edgeDraw(Graphics2D g) {
if (state == DeliverState.delivered)
return;
if (GUI.controls.get("v_bubble-messages").isActive()) {
bubbleDraw(g);
} else {
g.setColor(gColor);
double x = edge.from.getX() * (1.0 - position) + edge.to.getX() * ... |
b9ed079d-807c-487b-932f-c616416cea0c | 9 | public void mouseMove(MouseEvent me, EditPartViewer viewer) {
if (!isViewerImportant(viewer))
return;
setViewer(viewer);
if (!isInputSynched(me)) {
boolean b1 = getCurrentInput().isMouseButtonDown(1);
boolean b2 = getCurrentInput().isMouseButtonDown(2);
boolean b3 = getCurrentInput().isMouseButtonDown... |
edb7fb14-896d-41b8-8d00-f43c84e782d5 | 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... |
fb3b2573-29bf-4818-9a26-817441022460 | 1 | public static synchronized MyLogger getMyLogger(){
if(myLogger == null)
myLogger = new MyLogger();
return myLogger;
} |
7649f3c2-e8fe-47fb-ba32-e46612a215d5 | 1 | private void showHistoryArea(Map<String, Object> state) {
@SuppressWarnings("unchecked")
List<String> guessHistory = (List<String>)state.get(GUESSHISTORY);
this.historyArea.clear();
if (guessHistory != null){
this.historyArea.add(this.createGuessPanel(guessHistory));
}
} |
b403c456-f706-494a-9db4-5d1c33b2ea3c | 1 | public int getHeight() {
Window window = device.getFullScreenWindow();
if (window != null) {
return window.getHeight();
}
else {
return 0;
}
} |
96d7b2b4-467b-4ba5-a071-cb8fa492a0b8 | 0 | public static EventListJsonConverter getInstance() {
return instance;
} |
9d42a0c6-0eb5-479a-9134-05218e1d3ea9 | 9 | private static void editProfile() throws SQLException {
char c;
String s;
while(true){
//print your profile
System.out.println("What would you like to edit?\n");
System.out.println("F: First Name");
System.out.println("L: Last Name");
S... |
f5bbd23b-4c2a-4a5a-a08a-7678052c1ae4 | 6 | @EventHandler
public void BlazeFastDigging(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getBlazeConfig().getDouble("Blaze.FastDi... |
bdf85db1-d2db-405b-a5f8-6b507294eef9 | 2 | public void setupGame() {
ants.clear();
numBlackAnts = 0;
numRedAnts = 0;
world.resetWorld();
world.replaceFood();
ants = world.placeAnts(blackAntBrain, redAntBrain);
for (Ant a : ants) {
if (a.getColour()) { //BLACK
numBlackAnts++;
... |
ccc2bccd-aec3-4a0e-8839-44a86e9b44e6 | 9 | @Override
public String toString() {
return "BandUser {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (idx != null ? " idx [" + idx + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue ... |
7676548e-b28b-4ed1-9b77-2442f2b0e1d5 | 6 | private static HashMap<String, Integer> getDocumentFrequency(String dirName, Normalizer normalizer, boolean removeStopWords) throws IOException {
// Création de la table des mots
HashMap<String, Integer> hits = new HashMap<String, Integer>();
File dir = new File(dirName);
String wordLC;
if (dir.isDirectory())... |
e70edd81-0acb-4b6b-8497-68b4e636c4f3 | 6 | @Override
public int compareTo(ModelId modelId) {
if (this.id == null)
return 1;
if (this.isNewId() && modelId.isNewId())
return this.id.compareTo(modelId.id);
if (!this.isNewId() && !modelId.isNewId())
return this.id.compareTo(modelId.id);
if (this.isNewId())
return -1;
return 1;
} |
4f70ef1a-a223-4bab-a86e-293ea2dd0f93 | 8 | public boolean handleRedstoneEvent(Block block, BlockRedstoneEvent event)
{
if (istSchild(block))
{
Sign signBlock = (Sign) block.getState();
if (signBlock == null) {
return false;
}
// System.out.println(" plugin: handleRedstoneEvent()... |
c3aaf4df-9175-41fc-87f3-1b3b5151f0ae | 7 | public static void compare(PrintStream out, byte data1[], byte data2[])
{
ByteArrayInputStream inputStream1 = new ByteArrayInputStream(data1);
ByteArrayInputStream inputStream2 = new ByteArrayInputStream(data1);
int inputLength1 = data1.length;
int inputLength2 = data2.length;
int minSize = (inputLength1 > i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.