method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4f57fd3d-d3ce-4cd4-a699-7625a11041f8 | 2 | public boolean getDirection (char current, char[] neighbors){
if(current == neighbors[4] || current == neighbors[6]){
return true;
} else {
return false;
}
} |
5752848e-f48d-455e-82e5-a2dcdd9bd09e | 1 | private int scoreBowl(int[] bowl) {
int score = 0;
for (int i = 0; i < preferences.length; i++) {
score += bowl[i] * preferences[i];
}
return score;
} |
1605d18c-0141-4756-9219-0deac82111b5 | 7 | @Test
public void KATest() {
userInput.add("hi");
userInput.add("daniel");
userInput.add("can you help me in the kitchen");
userInput.add("bring me something");
userInput.add("bring me sausage");
userInput.add("yes");
userInput.add("ingredient");
userInput.add("supermarket");
userInput.add("bring me sausage");
removabl... |
afcd1017-d316-4bc0-9370-03d2c9052a72 | 0 | public JLabel getjLabelLogin() {
return jLabelLogin;
} |
f11b8956-9cce-40cc-91f5-0b89c10f27b9 | 2 | @Override
public void absolute(final int localPointer) {
if (localPointer < 0 || localPointer >= rows.size()) {
throw new IndexOutOfBoundsException("INVALID POINTER LOCATION: " + localPointer);
}
pointer = localPointer;
currentRecord = new RowRecord(rows.get(pointer), me... |
1eb12771-4043-4f28-ac8b-134d9b749c7b | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
int k=input.nextInt();
char q;
for(int r=0;r<k;r++){
String path=input.next();
int count=0,y=0,x;
for(int i=0;i<path.length();i++... |
505ae694-602e-47d4-a8e7-a6dce38612d5 | 0 | public TurnChanger (Player player1, Player player2){
turn = 0;
players[0]=player1;
players[1]=player2;
} |
c7df3bff-e440-4094-809d-8ce6509c1a89 | 1 | public void visit_castore(final Instruction inst) {
stackHeight -= 3;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
23f0de9d-4273-44b4-aa26-c54b5d104b8a | 5 | private static void attackBala(Ant ant) {
int XLoc = ant.getLocationX();
int YLoc = ant.getLocationY();
int randNum = RandomNumGen.randomNumber(0, 3);
// 50% Chance of killing a Bala ant in the same node as the soldier ant
if (randNum == 1 || randNum == 3) {
// Iterates through the linked list of b... |
7a38cec8-73fb-4cbc-a1a4-967cc2900933 | 5 | private void onClick() {
String newStatus;
String callNumber = textFields.get(0).getText().trim();
int copyNo;
if (!isNumeric(textFields.get(1).getText().trim())){
popMsg("copyNo must be a number!");
return;
}
copyNo = Integer.parseInt(textFields.get(1).getText().trim());
// check if book exists
... |
d68cf6b6-a5ee-4d4f-846a-3d7b3397f1da | 8 | public boolean placePiece(Piece piece, int x, int y) { // colocando peça no pre-jogo
if (status == statusPreGame) {
if (board.getPiece(x, y) == null) { // lugar vazio
int id = piece.getRank();
int co = piece.getColor();
if (co == teamRed && isRedField(x, y)) {
if (redCollected[id - Piece.pSpy] > ... |
f967d2d5-b2b9-41a5-a6e1-7a56d677580f | 5 | public int addEmployee(String fname, String lname, String email)
throws ServletException {
//TODO implement method that adds an employee to repository
//This method should check that email is not used by other employees
if (fname.equals("") || lname.equals("") || email.equals("")){
t... |
336604ac-ad85-434e-838a-30caa9df6c0d | 7 | public static boolean moveSpot(NPC npc) {
WorldTile key = new WorldTile(npc);
WorldTile spot = moveSpots.get(key);
if (spot == null && moveSpots.containsValue(key)) {
for (WorldTile k : moveSpots.keySet()) {
WorldTile v = moveSpots.get(k);
if (v.getX() == key.getY() && v.getY() == key.getX()
&& v... |
1b6c188d-befd-447f-a97a-c3b53dc1cc32 | 1 | private void readBounds( BoxData<?> data, XElement xparent ) {
XElement xbounds = xparent.getElement( "bounds" );
data.setX( xbounds.getElement( "x" ).getInt() );
data.setY( xbounds.getElement( "y" ).getInt() );
data.setWidth( xbounds.getElement( "width" ).getInt() );
data.setHeight( xbounds.getElement( "heig... |
42347434-c58c-4849-a992-6f324e5cc230 | 6 | public static List<String> readWebPage(String url)
{
ArrayList<String> toRet = new ArrayList<String>();
@SuppressWarnings("resource")
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = null;
do
{
try
{
response = client.execute(request);
... |
ad0567bb-479f-46d2-89db-f876ca63fba1 | 4 | public String echo(String input) throws java.rmi.RemoteException {
connect();
if (echoSocket != null && os != null && is != null) {
try {
os.println(input);
os.flush();
output= is.readLine();
} catch (IOException e) {
System.err.println("I/O failed in reading/writing... |
39b85c1b-4e64-4388-a783-6bb0db08869a | 8 | @Test
public void testPlayerIterator() {
int i = 0;
int count = 0;
for (Player p : testGame.getTableIterator(players.get(i))) {
assertEquals(players.get(i), p);
i++;
if (i == players.size()) {
i = 0;
}
count++;
}
assertEquals(0, i);
assertEquals(players.size(), count);
i = 1;
cou... |
0ba97c01-5b28-4319-a136-c8babf54bd9c | 2 | @Override
protected Integer compute() {
int sum = 0;
if((start - end) < THRESHOLD){
for(int i = start; i< end;i++){
sum += i;
}
}else{
int middle = (start + end) /2;
Calculator left = new Calculator(start, middle);
C... |
694cde46-689b-404d-b041-f01a7d076dfe | 4 | public static void one_test(TestHolder test) throws Exception {
System.out.print(test);
char expect = test.expect.charAt(0);
RE re;
try {
re = new RE(test.patt);
} catch (RESyntaxException e) {
boolean success = (expect == 'c');
// If we expected success but got failure, throw.
if (!success) { ... |
8570a325-a8d3-4ddb-8a54-d0ef47704a8a | 8 | @Override
public void endElement(String uri, String localName, String qName)
throws SAXException {
// System.out.println("Ending -->" + qName);
try {
if (currenttag.equals(TagName.ID) && isFirst) {
pageid = sb.toString();
currentPage.setId(pageid);
isFirst = false;
//IndexingTools.init();
}... |
3e036382-063e-41ee-a61a-99822630cfd3 | 2 | public boolean verifyJavaVersion()
{
if (!System.getProperty("os.name").startsWith("Windows"))
{
return true;
}
String version = System.getProperty("java.version");
double ver = Double.parseDouble(version.substring(0, 3));
int build = Integer.parseInt(version.substring(6));
return ver == JAVA_VERSION_... |
47ac9ba3-af99-4092-8081-0b2d291e633a | 5 | private void checkOSStarted(VirtualMachine virtualMachine) throws Exception {
String startTimeout = virtualMachine
.getProperty(VirtualMachineConstants.START_TIMEOUT);
boolean checkTimeout = startTimeout != null;
int remainingTries = 0;
if (checkTimeout) {
remainingTries = Integer.parseInt(startTimeout... |
a8dc0f82-804e-428a-846d-0c28a1d2f84e | 7 | public static void main(String[] args) {
Scanner inFile = null;
try {
// Create a scanner to read the file, file name is parameter
inFile = new Scanner(new File(System.getProperty("user.dir")
+ "/src/Files/prog464a.dat"));
} catch (FileNotFoundException e) {
System.out.println("File not found!");
... |
4965ce18-75f0-4d76-a78c-1f405d86e6cd | 9 | @Override protected boolean canFigureMove(Point x, Point Abs) {
if (((x.x == 2 || x.x == -2) && (x.y == 1 || x.y == -1) ||
(x.y == 2 || x.y == -2) && (x.x == 1 || x.x == -1)) &&
!C.isFigure(Abs))
return true;
return false;} |
be6ce799-1dcd-4ea8-b35c-7140571e8aa6 | 4 | public ExternalFilesystem(String basedir) throws IOException
{
if (basedir.endsWith("/") || basedir.endsWith("\\"))
basedir = basedir.substring(0, basedir.length() - 1);
baseDirectory = new File(basedir);
if (!baseDirectory.exists()) throw new IOException("Directory '" + basedir... |
c898e792-e03b-4d6c-bb45-874944d00a44 | 7 | public static QuadVector<String,Integer,Integer,Boolean> cabilities(HTTPRequest httpReq)
{
final QuadVector<String,Integer,Integer,Boolean> theclasses=new QuadVector<String,Integer,Integer,Boolean>();
if(httpReq.isUrlParameter("CABLES1"))
{
int num=1;
String behav=httpReq.getUrlParameter("CABLES"+num);
... |
2ef16358-dd33-4d48-b652-c13d7c8dd855 | 5 | public static void main(String args[]) {
int a = 0;
int b = 0;
int c = 0;
int sum;
int sqr;
int product;
loop : for (c = 2; c > 0; c++) {
for (b = 1; b < c; b++) {
for (a = 1; a < b; a++) {
sqr =(int)(Math.pow(a, 2... |
44c145fa-369f-4f0b-a2c0-1399f9808cfa | 0 | public void setNeighbors(Cell[] neighbors) {
this.neighbors = neighbors;
} |
8c4471bd-4b35-4a1c-8c2a-45a356b2e611 | 0 | private void handleError(String message, Exception e)
{
MessageDialog.getInstance().showError(message);
LOGGER.error(message, e);
} |
5cba8931-244a-4471-97c7-43407f24fec4 | 6 | private List<MorrisLineAdjacent> getSkewUpLineAdjacent() {
List<MorrisLineAdjacent> lines = new ArrayList<MorrisLineAdjacent>();
boolean bsru = this.hasSkewRightUp();
boolean bsld = this.hasSkewLeftDown();
MorrisLineAdjacent oneLine = null;
if (bsru && bsld) { //this is in the middle
oneLine = new MorrisLi... |
95b52ab5-7408-4fe4-9fb6-fa9da08dd937 | 7 | private NoB busca(NoB no, int x) {
NoB pt = no;
if (pt == null) return null ; //nao achou
else {
pt = pt.proximo;
while (pt.proximo != null && pt.chave < x) pt = pt.proximo;
if (pt.chave < x && pt.pagina != null) pt = busca(pt.pagina,x);
else if (pt.chave > x && pt.anterior.pagina != null) pt = busca(... |
96daeb84-4135-46e6-b63b-9b79dffa8157 | 1 | public long getTransferRate() {
long time = (System.currentTimeMillis() - _startTime) / 1000;
if (time <= 0) {
return 0;
}
return getProgress() / time;
} |
a57a6e43-3da5-443b-a947-556ff5aea690 | 7 | public void detectAll(){
for(int baud : BAUD_RATES) {
SerialPort serialPort = null;
InputStream in = null;
OutputStream out = null;
try {
log.info("Opening serial port...");
serialPort = (SerialPort) port... |
ec382532-9ee7-4a4c-9556-ed0ef36d560c | 8 | public void monitotarPressao(float pressao, Paciente paciente)
throws ControllerException {
try {
if (pressao < 0 || pressao > 30) {
throw new ControllerException("valor da pressão é inválido");
}
if (ValidarPaciente(paciente) && (pressao < 8 || pressao > 12)) {
Publish publish = new Publish(paci... |
8ad39095-2f2a-4728-bf91-be052194a07a | 7 | public CheckResultMessage checkDayofMonth() {
int r1 = get(2, 2);
int c1 = get(3, 2);
date();
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (!(getValueString(r1 + 1, c1 - 1, 0)
.equals(lastMaxDay + "日") && getValueString(... |
323adf21-ce48-4ac8-8450-41babeb5ec05 | 5 | private final int method1104(Model class124_101_, int i, int i_102_,
short i_103_) {
anInt1858++;
int i_104_ = ((Model) class124_101_).vertexX[i_102_];
int i_105_ = ((Model) class124_101_).vertexY[i_102_];
int i_106_ = ((Model) class124_101_).vertexZ[i_102_];
for (int i_107_ = i; i_107_ < ((Model) this).verti... |
37148519-0a6b-4d44-8e8f-6d26ea818fb5 | 4 | private Dock getDockInternal() {
for (DockLayoutNode child : mChildren) {
if (child instanceof DockContainer) {
return (Dock) ((DockContainer) child).getParent();
} else if (child instanceof DockLayout) {
Dock dock = ((DockLayout) child).getDockInternal();
if (dock != null) {
return dock;
}... |
bf6da77b-267e-49dd-b216-673db60aee14 | 1 | public void run() {
try {
writeRouteLog(msgEvent, msg);
Logger.getLogger(WriteLog.class.getName()).log(Level.SEVERE, "Записано " + WriteLog.getCurrentTime());
} catch (IOException ex) {
Logger.getLogger(WriteLog.class.getName()).log(Level.SEVERE, null, ex);
}
... |
05d37879-bf7c-412e-9a96-12a64e63a997 | 6 | private static Object
normaliseObject(
Object o )
{
if ( o instanceof Integer ){
o = new Long(((Integer)o).longValue());
}else if ( o instanceof Boolean ){
o = new Long(((Boolean)o).booleanValue()?1:0);
}else if ( o instanceof Float ){
o = String.valueOf((Floa... |
2438d05d-df7a-4bca-87f4-ab4d9f9fef8a | 6 | public void saveAlbumsPhotos(String folderToSave) {
MyDownloadExecutor executor = new MyDownloadExecutor(nThreads);
for (Album album : albums) {
File folder = new File(folderToSave + album.getAid() + "_" + fixWindowsFileName(album.getTitle()));
boolean success = folder.mkdirs();
... |
3dbbe5b6-706a-4f1e-a2f3-363a0d1515dd | 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... |
bb8b0c27-039a-4588-9b6e-8b02d8f5541f | 6 | public void keyPressed(KeyEvent e)
{
int keycode = e.getKeyCode();
System.out.println("key pressed: ");
switch(keycode)
{
case KeyEvent.VK_UP:
System.out.println("up");
this.upPress = true;
break;
case KeyEvent.VK_DOWN:
System.out.println("down");
this.downPress = true;
break;
cas... |
f8c3342d-6f4d-44c7-9663-afe5453a5a27 | 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... |
bbbf6229-7626-4a6e-9e4f-921d65df9906 | 8 | private ButtonType getButtonType(int keyCode) {
switch (keyCode) {
case KeyEvent.VK_UP:
return ButtonType.Up;
case KeyEvent.VK_DOWN:
return ButtonType.Down;
case KeyEvent.VK_LEFT:
return ButtonType.Left;
case KeyEvent.VK_RIGHT:
return ButtonType.Right;
case KeyEvent.VK_SPACE:
return... |
77e378f4-349f-4734-b6e6-d82856f1dccb | 1 | public void testWithFieldAdded_DurationFieldType_int_5() {
LocalDate test = new LocalDate(2004, 6, 9);
try {
test.withFieldAdded(DurationFieldType.hours(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
5e235ae7-f1bf-4702-9064-95415e59d0fe | 1 | public static <T, E extends Exception> T validateHandler(OwnerView view, T parameterToValidate, Validator<T, E> validator, MethodProvider<T> methodProvider) {
List<E> validateExceptionList = validator.validate(parameterToValidate);
if (!validateExceptionList.isEmpty()) {
view.printValidateE... |
c545d3f8-0822-43ab-833d-61cc27373449 | 8 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0)
&&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS))
&&((msg.amITarget(affected))))
{
final MOB target=(MOB)msg.target();
if((!target.isInCombat())
&&(msg.source().isMonst... |
2853dd0e-c1f1-410a-aba4-b32276e9bbb7 | 0 | public List<Speciality> getSpecialityList() {
return specialityList;
} |
f520d51e-fd7c-4e29-94ef-1bd2259d236e | 7 | private static void printMembers(Member[] mems){
for (Member m : mems) {
Annotation[] annotations = new Annotation[0];
if (m instanceof Field) {
annotations = ((Field)m).getAnnotations();
}
if (m instanceof Constructor) {
annotations = ((Constructor<?>)m).getAnnotations();
}
if (m instanceo... |
67567dbc-0d44-4c5b-9389-65f796bde2c8 | 6 | final Class27_Sub1 method703(boolean flag1, int i) {
Class27_Sub1 class27Sub1 = (Class27_Sub1) Class142_Sub27_Sub6.aMRUNodes_4752.getObjectForID((flag1 ? 0x40000 : 0) | (anInt1013 | i << 16));
if (class27Sub1 != null) {
return class27Sub1;
}
Class137.aClass73_2264.method791(a... |
3142bd42-068a-4b4a-9b22-05e77ca1cd64 | 8 | public double evaluateSubset (BitSet subset) throws Exception {
int [] fs;
int i;
int count = 0;
for (i=0;i<m_numAttribs;i++) {
if (subset.get(i)) {
count++;
}
}
double [] instArray = new double[count];
int index = 0;
fs = new int[count];
for (i=0;i<m_numAttribs;i++) {... |
26f1ec21-1e89-4559-bf99-2bd67dba36da | 5 | public void readXML() {
try {
File xmlFile = new File("basedados.xml");
DocumentBuilderFactory documentFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder documentBuilder = documentFactory
.newDocumentBuilder();
Document doc = documen... |
df45b44f-6803-437b-9d31-c48da9ebf79b | 0 | public String getName(){
return file.getName();
} |
58d92509-150e-48e2-b791-e54e7542323e | 8 | public static MDDManager getProxy(MDDStore store, List<?> customOrder) {
MDDVariable[] rawVariables = store.getAllVariables();
// build order mapping
boolean sameOrder = rawVariables.length == customOrder.size();
int[] custom2store = new int[customOrder.size()];
for (int i=0 ; i<custom2store.length ; i++) ... |
ef82d5df-9ba5-4443-b8f2-2aa02a4a5e1b | 3 | private void loadAvaliblePlattformar() {
try {
ArrayList<String> plattemp = DB.fetchColumn("select pid from PLATTFORM");
ArrayList<Plattform> platt = new ArrayList<>();
for (String st : plattemp) {
platt.add(new Plattform(Integer.parseInt(st)));
}
... |
a3ee2d5b-675e-4eca-abd9-5df1d6605ad2 | 9 | public boolean checkBlockInitializer(InvokeOperator invoke) {
if (!invoke.isThis() || invoke.getFreeOperandCount() != 0)
return false;
MethodAnalyzer methodAna = invoke.getMethodAnalyzer();
if (methodAna == null)
return false;
FlowBlock flow = methodAna.getMethodHeader();
MethodType methodType = methodA... |
6f5e79d6-45cf-4b82-bba9-032a0684533e | 4 | private HashMap<Article, Location> findArticle(int articleID, int quantity)
{
HashMap<Article, Location> map = new HashMap<Article, Location>();
for (Location location : locations) {
for (int i = 0; i < location.getArticles().size() && quantity > 0; i++) {
if (location.getArticles().get(i).getArticleID() ... |
ead5de37-14a2-4e31-8d7d-323ffbddcfed | 9 | protected Container createComboBox(final Object[] args) {
final String tip =
((args.length > 0) && (args[0] != null))
? args[0].toString()
: null;
final String text =
((args.length > 1) && (args[1] != null))
? args[1].toStri... |
2f5287aa-1f80-4ef3-a057-63edf888e6af | 3 | public void close() {
ServerLogger.info(Server.class, "Closing server", null);
stopDataServers();
try {
outputStream.close();
} catch (IOException e) {
// do nothing
}
try {
inputStream.close();
} catch (IOException e) {
// do nothing
}
try {
connectionSocket.close();
} catch (IOExc... |
c521ae43-06e1-48a2-bb7c-b9dd8da7d588 | 3 | public void sendInterrupt (byte buf [])
throws IOException
{
if ("interrupt" != getType () || buf.length > getMaxPacketSize ())
throw new IllegalArgumentException ();
if (spi == null)
spi = iface.getDevice ().getSPI ();
// FIXME getInterval() ms timeout (caller guarantees periodicity)
spi.writeInt... |
e0ffbe9c-0d25-4afc-8827-8d1d2c13ba85 | 3 | public void bubble ()
{
char temp; // tijdelijke opslag van de waarde
int i, j; // waarde 1, 2
for (j = 0; j < rij.length; j++) // voor elke j kleiner dan de lengte van rij
{
for (i = 1; i < rij.length - j; i++) // voor elke i kleiner dan de lengte van rij - j
... |
fab6b200-5420-4f9d-9ad9-e2a136342669 | 8 | private void updateQueues()
{
while(!taskSet.isEmpty() && taskSet.peek().getArrivalTime() <= currentTime)
{
if(isPreSatisfied(taskSet.peek()))
{
readyQueue.addLast(taskSet.poll());
}
else
{
Task t = taskSet.poll();
t.setWaiting();
waitQueue.addLast(t);
}
}
for(Task t : waitQu... |
6973ba9f-6a81-477c-b930-aab61595e0da | 5 | public PublicKey decodePublicKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[0]
|| k[1] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[1]
|| k[2] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[2]
|| k[3] != Registry.MAGIC_RAW_RSA_PUBLIC_KEY[3]) {
throw new Ill... |
97583e6c-2829-47f7-b768-5cdcfe15d859 | 0 | public static int byteArrayToInt(byte[] b) {
// 0是高位,3是低位
// 每次取最高8位
int i = (b[0] << 24) & 0xFF000000;
i |= (b[1] << 16) & 0xFF0000;
i |= (b[2] << 8) & 0xFF00;
i |= b[3] & 0xFF;
return i;
} |
5d53a667-24c9-459b-a1b1-be4d2e935e62 | 0 | @SuppressWarnings("unchecked")
public List<Customer> getAllCustomers() {
return (List<Customer>) this.em.createNamedQuery("findAllCustomers")
.getResultList();
} |
ff687893-17e9-40a7-9c14-4c288a67101f | 8 | public Instruction newInstruction(MethodModel _methodModel, ByteReader byteReader, boolean _isWide) {
Instruction newInstruction = null;
if (clazz != null) {
try {
final Constructor<?> constructor = clazz.getDeclaredConstructor(MethodModel.class, ByteReader.class, boolean.c... |
8f91d4d0-4050-4e8b-bda3-eca3b1e88c53 | 1 | @SuppressWarnings("rawtypes")
private String getEnumValue(final Field field, final Object object) {
String resValue = null;
Object value = getRawValue(field, object);
if (value != null) {
int valEnum = ((Enum) value).ordinal();
resValue = String.valueOf(valEnum);
}
return resValue;
} |
1c16b0e9-0374-4032-b35a-e56842cc60dc | 4 | @SuppressWarnings("unchecked")
private void initGUI()
{
// C O M P O N E N T S ---------------------------------------------
this.jcbState = new JComboBox<ImageIcon>(EzimImage.icoStates);
this.jcbState.setEditable(false);
this.jcbState.addItemListener
(
new ItemListener()
{
public void itemStateCh... |
484bb66f-ebb4-45ae-88ff-2245350d7b6b | 6 | public void update(float delta){
Vector2D position = circleShape.getPosition();
if((position.x -radius/2)<0){ circleShape.setXPosition(radius/2); velocity.thisBounceNormal(new Vector2D(1,0));}
if((position.x +radius/2)>GamePanel.WIDTH){ circleShape.setXPosition(GamePanel.WIDTH-radius/2);... |
7df7fd45-2ed4-420c-9197-5ac292654715 | 0 | @Test
public void runTestArrayAccess2() throws IOException {
InfoflowResults res = analyzeAPKFile("ArraysAndLists_ArrayAccess2.apk");
Assert.assertEquals(0, res.size());
} |
70c29454-c03f-40da-8544-59aae05bd3a2 | 5 | public static boolean isValidOption(String option) {
if (GRE_OPTION_A.equals(option) || GRE_OPTION_B.equals(option)
|| GRE_OPTION_C.equals(option) || GRE_OPTION_D.equals(option)
|| GRE_OPTION_E.equals(option)) {
return true;
}
return false;
} |
bd9441c9-6496-4338-bc74-bef350580e6b | 6 | private void method392(byte abyte0[], int i, int j, int k, int l, int i1) {
int j1 = i + j * width;
int k1 = width - k;
int l1 = 0;
int i2 = 0;
if (j < topY) {
int j2 = topY - j;
l -= j2;
j = topY;
i2 += j2 * k;
j1 += j2... |
53916b41-2a29-4d74-8e19-b7aa7f2ac95c | 7 | void loadSettings(String name, String value) throws Exception {
if(name==null) return;
if(name.equals("name")) { //$NON-NLS-1$
documentName=value;
}
if(name.equals("author")) { //$NON-NLS-1$
documentAuthor=value;
}
if(name.equals("date")) { //$NON-NLS-1$
documentDate=new SimpleDateFormat("yyyy/M... |
0517e9e8-fbe2-458f-9ca4-956f1181d02d | 8 | private void createSlide(Attributes attrs) {
slide = new Slide(slideDef);
// loop through all attributes, setting appropriate values
for (int i = 0; i < attrs.getLength(); i++) {
if (attrs.getQName(i).equals("id"))
slide.setId(Integer.valueOf(attrs.getValue(i)));
else if (attrs.getQName(i).equals("backg... |
aa7d8a36-81d7-4e01-8e18-f8b990ef6cf3 | 2 | public float getPhysicalWidthInch() {
int w = getWidth();
int pw = getPhysicalWidthDpi();
if (w > 0 && pw > 0) {
return ((float)w) / ((float)pw);
} else {
return -1.0f;
}
} |
f860d9eb-08c8-44f6-b763-94ab5e8dc606 | 2 | public static int getID(String usu){
String sql = " SELECT idusuarios FROM usuarios WHERE usuario = '"+usu+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return 0;
}
if(!BD.getInstance().sqlFetch()){
return 0;
}
return BD.getInstance().getInt(... |
24009062-07d8-413f-b2a3-2f286799f79d | 4 | public void step() {
if (board.getState() == State.GAME_OVER) {
board.clear();
board.setState(State.PLAYING);
}
if (board.fallingBlock == null) {
board.addFallingBlock(tm.getPoly(rand.nextInt(tm.getNumberOfTypes())));
}
if (CollisionDetector.... |
d7ffebd8-da9b-42df-8dba-8c15984aede6 | 1 | public ProductDao getProductDao(){
if(productDao==null)
productDao=new ProductDaoImpl();
return productDao;
} |
a9d52423-f84d-4e0f-b905-9066c2e9f321 | 8 | protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
ContainerFigure container = new ContainerFigure();
if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
}
if (!... |
620855bd-a2bc-4b12-ad9f-fa35cd8be321 | 8 | public static void main(String[] args) {
PlayerReplayer playerReplayers[] = new PlayerReplayer[NUM_SLOTS];
Scanner input;
int num = 0;
File dir = new File(Position.GAME_NAME + "Commands");
String inputfilename;
File[] directoryListing = dir.listFiles();
if (directoryListing != null) {
... |
34cf6c99-0db7-46ea-840f-1be3d7d858d0 | 2 | private void options() {
final Stage dialog = new Stage();
initializeDialog(dialog);
Label label = new Label(txt);
defaultVolume = makeVolumeSlider();
Button okButton = new Button("OK");
okButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
... |
f07302e7-6851-4e18-b099-7064fe8d0d1b | 6 | public void takeFromContainer(int playerID, int index) {
Player p = this.playerIDs.get(playerID);
if (p != null) {
Location on = p.getLocationInFrontOf();
if (board.tileAt(on).getOn() != null && board.tileAt(on).getOn() instanceof Inventory) {
Inventory takingFrom = (Inventory)board.tileAt(on).getOn();
... |
cadebcc1-9cd8-44ab-bdfc-76e105edcaf1 | 7 | public static void startupPartialMatch() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, (... |
fd304631-a923-4042-92e9-a1decb4af866 | 7 | @Override
public boolean remove(T element) {
int i = 0;
int hashCode = element.hashCode() % hashTable.size();
if (keyCode.get(hashCode).equals("f") && hashTable.get(hashCode).equals(element)) {
hashTable.set(hashCode, null);
keyCode.set(hashCode, "r");
return true;
} else if (keyCode.get(hashCode).equ... |
8060ea47-7a9a-48aa-9c0e-bafa7ede73da | 2 | private static void showWallet(ApiAuthorization auth, int acId) {
AbstractWalletTransactionsParser parser = WalletTransactionsParser.getInstance();
WalletTransactionsResponse response;
try {
response = parser.getResponse(auth, 1000);
Set<ApiWalletTransaction> walletTransactions = response.getAll();
Deci... |
e7aa374a-608b-4344-ac39-a93255a05b97 | 3 | public static YearsStatisticsByCities convert(
CitiesStatisticsByYears statisticsByYears) {
YearsStatisticsByCities yearsStatisticsByCities = new YearsStatisticsByCities();
Map<City, EmployeesStatisticsByYears> emplByCities = new TreeMap<City, EmployeesStatisticsByYears>();
EmployeesStatisticsByYears employe... |
56294452-a6a4-467d-9800-06b093d058c6 | 5 | public void addChunk() {
String chunkName = null;
List<DataNodeEntry> locations = null;
try {
chunkName = this.nameNodeStub.nameChunk();
if (Hdfs.Core.DEBUG) {
System.out.println("DEBUG HDFSFile.addChunk(): chunk name:" + chunkName);
}
locations = this.nameNodeStub.select(this.replicaFactor);... |
cfe43547-540f-450c-8669-1557c78f493d | 0 | @Test
public void testGetMarker() {
System.out.println("getMarker");
Unmark instance = new Unmark(6, 9);
int expResult = 6;
int result = instance.getMarker();
assertEquals(expResult, result);
} |
48aff5c8-a2d0-4823-ba3b-b5e2ce88044a | 6 | public static void insertSqlCommandTemplate(PropertyList template) {
{ Stella_Object commandname = template.lookup(Sdbc.KWD_COMMAND);
{ Stella_Object temp000 = template.lookup(Sdbc.KWD_DATA_SOURCE);
{ Cons datasources = (((temp000 != null) ? temp000 : Sdbc.KWD_DEFAULT)).consify();
Stella_O... |
1ca92854-8bd5-4252-a5d3-a05b74a2e3d3 | 4 | private boolean checkSpawnerLocation(int x, int y){
for(int ya = y - spawnerRadius; ya < y + spawnerRadius + 1; ya++){
for(int xa = x - spawnerRadius; xa < x + spawnerRadius + 1; xa++){
if(!checkBounds(xa, ya)) continue;
if(!getTile(xa, ya).equals(Tile.floorTile)) return false;
}
}
return true;
} |
2ed4cc36-d230-451c-93dc-673f3c91cd9b | 2 | public void updateUserbyUserName(final String name, final String pass, final String phone,
final int type) {
for (User u : userList.getUserList()) {
if (name.equals(u.getName())) {
u.setPassword(pass);
u.setPhoneNumber(phone);
u.setType(ty... |
4855841a-e727-4631-b014-fdfe68071834 | 1 | public void truncate(float max) {
if(this.length() > max) {
this.normalize();
this.x *= max;
this.y *= max;
}
} |
c0fb809e-c86b-4219-a0d0-f6e6a844a4a1 | 4 | private void DownLoad10K(String urlStr, String outPath) {
// the length of input stream
int chByte = 0;
// the url of the doc to download
URL url = null;
// HTTP connection
HttpURLConnection httpConn = null;
InputStream in = null;
FileOutputStream out = null;
try {
url = new URL(urlStr);
http... |
244e7749-c764-4e8a-89ca-2d7c26e3094f | 0 | @Override
public IReceiveQuery getReceiveQuery() {
return receiveQuery;
} |
db74bc6a-ae26-4581-888d-29bb0d5f2f0a | 7 | public void generate() {
final int maxHeight = HEIGHT / 2;
final int stepHeight = maxHeight / 75 * blockSize;
int maxBlockHeight = 0;
blockHeights[0] = Util.rand(maxHeight);
for (int i = 1; i < blocksCount; i++) {
int value = blockHeights[i - 1] + Util.rand(-... |
f15cb198-e6cb-4cf9-be0d-372e26502a03 | 5 | public void run() {
debug("GC: started");
synchronized (this) {
for (; ;) {
while (rrdMap.size() > capacity && rrdGcList.size() > 0) {
try {
RrdEntry oldestRrdEntry = (RrdEntry) rrdGcList.get(0);
debug("GC: closing " + oldestRrdEntry.dump());
removeRrdEntry(oldestRrdEntry);
} catc... |
40fdd4a5-fe35-4c09-8f02-8ef569bb591a | 9 | public boolean deduplicate (ObjectatEvent event) {
boolean success = false;
// Update last timestamp
this.setLast(new Date());
// Update count
this.setEventCount(this.getEventCount() + 1);
if (event.isOwned() != this.isOwned()) {
if (this.logger != null) {
this.logger.log(ObjectatLogLevel.DE... |
d2265b2a-c1b6-409b-8b2e-d47ccb76a258 | 5 | public static void main( String[] args )
{
WorkBookHandle book = null;
try
{ // generate a PDF and confirm
// load the current file and output it to same directory
book = new WorkBookHandle( System.getProperty( "user.dir" ) + "/docs/samples/Input_CSV/contacts.csv" );
System.out.println( book.getStats() ... |
7e9b6dc1-5ae6-4a7d-851b-d62e3d5b6af4 | 9 | public Point fight(){
int aLost = 0;
int dLost = 0;
// Resets dice values
d[DEFENDERFIRST]=0;
d[DEFENDERSECOND]=0;
a[ATTACKERFIRST]=0;
a[ATTACKERSECOND]=0;
a[ATTACKERTHIRD]=0;
unitsAttacker = getFirstTerritory().getNbrOfUnits() - 1;
unitsDefender = getSecondTerritory().getNbrOfUnits();
fo... |
cafacc05-137a-4631-a021-c3e0763f3516 | 8 | public int[][] AllPairsShortestPath(int[][] matrix) {
int numberVertices = matrix.length;
// create new storage container for path and weight information
path = new int[numberVertices][numberVertices];
pathWeights = new int[numberVertices][numberVertices];
// Initialise containers;
for (int i ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.