method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2124d0b8-5e9d-48e1-a792-f71b0f956f8c | 9 | private static void addTreasureChest(Scanner scanner,Grid grid){
System.out.println("please provide a name for your treasure chest :");
String chest = scanner.nextLine();
while(chest==null||chest.equals("")){
System.out.println("please provide a name for your treasure chest :");
chest=scanner.nextLine();
... |
90c674d3-fdec-4a08-a712-84ccfe3cd110 | 0 | public TrieNode(char ch){
this.ch=ch;
} |
01a82f6c-6725-4269-9925-56e08db0659f | 0 | public void setMedico(Medico medico) {
this.medico = medico;
} |
31627e6e-849b-41ef-abd9-5f34c6f5321b | 4 | public static boolean isPalindrom(String text) {
if (text == null || text.length() == 0) {
return false;
}
for (int i = 0; i < text.length(); i++) {
if (text.charAt(i) != text.charAt(text.length()-1-i)) {
return false;
}
}
ret... |
102e2527-9690-484c-9fcb-1d54d18cef8b | 8 | public void SBC(int tmp)
{
if ((m6502.p & F_D) !=0)
{
int c = (m6502.p & F_C) ^ F_C;
int sum = m6502.a - tmp - c;
int lo = (m6502.a & 0x0f) - (tmp & 0x0f) - c;
int hi = (m6502.a & 0... |
4c50dd53-fda8-4794-9bf2-ef82ccf4a897 | 2 | private Color getFreshColor(Integer value)
{
Color fresh = converter.getColor(value);
usedColors.put(value, fresh);
if (value > maxValue)
{
maxValue = value;
for(IntegerColorLibraryListener listener : listeners)
listener.maxValueChanged(value, this);
}
return fresh;
} |
d196a72b-80dc-46bc-8d1b-4d4649c195ec | 8 | public ReportPrinter(int type, String pageTitle, String driverNum, String cabID, String firstName,
String middleName, String lastName, String phoneNum, JTable jTable1) {
try {
String reportSource = null;
if (type == -1) {
reportSource = "C:\\Users\\Reaper\\Do... |
03587c60-74a7-4d32-9d79-3e7ddbf7667e | 1 | @Override
public LinkedList<Entry<S, T>> getEntrySet() {
LinkedList<Entry<S, T>> lst = new LinkedList<>();
Node n = ls.head;
while (n != null) {
lst.add(new AbstractMap.SimpleEntry<S, T>(n.key, n.value));
n = n.next;
}
return lst;
} |
348917c7-9d50-48f8-ab23-d4bef692da6c | 8 | public boolean hasEntryPoint(Cell cell, int entryPointId){
String result = "";
char c = get(cell);
if(entryPointId == 1) {
return StringUtils.isOneOf(c, entryPoints1);
} else if(entryPointId == 2) {
return StringUtils.isOneOf(c, entryPoints2);
} else if(entryPointId == 3) {
return StringUtils.isO... |
b8ca6137-2e63-406b-b243-d967a27a4cf8 | 9 | public void pelaajaOnKaakossa() {
Pelaaja kiekollinen = getKiekollinen();
int pelaajiaSuunnassa = 0;
for (Pelaaja pelaaja : pelaajat) {
if (kiekollinen.getY() < pelaaja.getY() && pelaaja.getX() > kiekollinen.getX()) {
int x = pelaaja.getX() - kiekollinen.getX();
... |
39465590-5f35-4bdc-80b5-2dae69ffb684 | 3 | private final GenericObject getCtryHistory(final String tag) {
GenericObject hist = historyCache.get(tag);
if (hist == null) {
String histFile = resolver.getCountryHistoryFile(tag);
if (histFile == null) {
System.err.println("Cannot find country histo... |
c65c65ce-de6e-49ad-b7e4-1a68edcd8e57 | 9 | public static void main(String[] args) throws IOException,
URISyntaxException {
// -----------------
// 0.
// INITIALIZES TIMER
// -----------------
// Initializes a Timer object
//
// This Timer begins timing once the user has given the authorization
// code. Once all downloads are finished, it st... |
58688912-d8cd-4c61-9ca1-37a61a09ce6f | 9 | public Replacer getReplacer() {
Map<AttributeKey, Object> attrs = new HashMap<AttributeKey, Object>();
if (patternRadioButton.isSelected()) {
attrs.put(AttributeKey.TURN_ON_REGEX, regexCheckBox.isSelected());
attrs.put(AttributeKey.FROM_PATTERN, fromTextField.getT... |
a8114f83-ef9f-4455-b7e7-119319716068 | 8 | public boolean winDiagonal() {
char first = board[0][0];
if ((first == 'o' || first == 'x') && board[1][1] == first
&& board[2][2] == first) {
return true;
}
first = board[0][2];
if ((first == 'o' || first == 'x') && board[1][1] == first
&& board[2][0] == first) {
return true;
}
return false... |
83fc51dc-065c-4f82-8111-39ab1a380196 | 9 | public void keyPressed(KeyEvent e){//set the right X/Y-add
int key = e.getKeyCode();
if(key == KeyEvent.VK_LEFT || key == KeyEvent.VK_A){
xAdd = getSpeed();
}
if(key == KeyEvent.VK_RIGHT || key == KeyEvent.VK_D){
xAdd = -getSpeed();
}
if(key == Key... |
662f75b4-9347-47b2-95a7-f9b659781b69 | 3 | public boolean containsItemSet(ArrayList<Item> subItemSet) {
for (int i = 0; i < this.itemSet.size(); i++) {// loop through biggest
// itemSet
for (int j = 0; j < subItemSet.size(); j++) {// check against inner
// subset
Item item = subItemSet.get(j);
if (!this.itemSet.contains... |
9f8357ea-f19b-4dc0-8d49-f3c9ad0242f3 | 0 | public Transition getTransition() {
return myTransition;
} |
0e0419eb-54e3-4e1b-957b-7b3bee132630 | 2 | public static void closeQuietly(Closeable closeable) {
if (closeable == null) return;
try {
closeable.close();
} catch (IOException ex) {
// quietly...
}
} |
d997c6f7-c8c7-4c42-b4d6-3a2c79e13c44 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
150f87f1-90c6-42cd-aaf5-b151755db667 | 6 | @Override
public void remove(int i, int j) throws BadLocationException {
int k = getSelectionStart();
if (k > 0) {
k--;
}
String s = getMatch(getText(0, k));
if (!isStrict && s == null) {
super.remove(i, j);
... |
7b25f095-f99e-4caa-82bb-93f9ce3b9ec1 | 2 | public void sendTitle(String title){
JSONObject o = new JSONObject();
try {
o.put("message", "title");
o.put("text", title);
sendMessage(o);
}
catch(JSONException e){}
catch(IOException e){}
} |
f9262cf6-e89d-4e4b-adb3-0f768eb3839b | 6 | public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getActionCommand().equals("Cut")) {
if (tf != null) {
tf.cut();
} else {
ta.cut();
}
}
if (actionEvent.getActionCommand().equals("Copy")) {
if (t... |
bb520f1b-aa75-44fb-9d25-adafabebbdfd | 4 | private synchronized void requestNextBlocks() {
if (this.requests == null || this.requestedPiece == null) {
throw new IllegalStateException("Trying to request blocks out " +
"of a piece download context!");
}
while (this.requests.remainingCapacity() > 0 &&
this.lastRequestedOffset < this.requestedPie... |
94241ba3-9986-4e82-8e99-bd9aa6cac9d4 | 2 | public int getIndex (TreeNode n)
{
for (int i = 0; i < children.length; i++)
if (n == children [i])
return i;
return -1;
} |
a7e53d52-8a1b-48be-bd58-7f37bb86e706 | 9 | public void fastLearn() {
double weight = 0.0;
if (getFired() && (!getInhibitory()))
//System.out.println("fastLearn " + id);
for (int synapseIndex=0;synapseIndex<getCurrentSynapses();synapseIndex++)
{
CANTNeuron toNeuron = synapses[synapseIndex].getTo();
if (toNeuron.getFired())
{
we... |
00c2452f-808d-45f7-808a-5d7ae1f48164 | 2 | public void load(String source)
{
try
{
this.source = source;
if (source.startsWith("http://"))
image = ImageIO.read(new URL(source).openStream());
else
image = ImageIO.read(new File(source));
label.setIcon(new ImageIco... |
41c05691-f173-447a-bfe6-5c76d34f7a90 | 1 | private void stepBackward() {
index = Math.max(index - 1, 0);
modelingTimeText.setText(nodes[index] + "ns");
status("Step backward to node #" + index + " at " + nodes[index] + "ns");
displayer.updateUITables();
if(timeDiagramsWindow != null) timeDiagramsWindow.redrawTimeDiagrams(... |
60f8d199-2a0e-404f-8898-7e9a9d657653 | 0 | public boolean hasEmptyTreesSet(Integer state) {
return !FiniteTreesTable.containsKey(state);
} |
0671b143-5943-4168-a550-15e7ef8a3033 | 9 | private final static Map<String, Path> buildRootMap() {
final String[] bases = FileSystem.getBases();
final Map<String, Path> map = new HashMap<>();
final String baseName;
final Path home = FileSystem.getBase();
Path base = home;
if (base != null) {
while (base.parent != null) {
base = base.parent;
... |
127f528a-a1e3-4a7f-a767-56181df14f82 | 3 | @Override
public void doLoopAction()
{
if (hit && !done)
{
setAnimation(new String[]
{
"questionmark end"
});
super.doHit();
if (getGoinUp() == 20)
{
hit = false;
... |
6c33686d-1a9f-440e-8197-239b0e9c9919 | 7 | protected boolean computeCell(int col, int row) {
// Compute whether this cell is alive or dead in the next generation
// using "countNeighbours"
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < ... |
6da0d5eb-3c5b-41bd-be22-6c593f4a8f44 | 6 | public HashMap<String, NewRDPParserFileLine> tryForRDPMap(File rdpFile)
{
try
{
if( rdpFile.exists())
return NewRDPParserFileLine.getAsMapFromSingleThread(rdpFile.getAbsolutePath());
File seqFile = new File( ConfigReader.getETreeTestDir() + File.separator + "consensusSequences.txt");
if( seqFil... |
bf67e9e3-ca83-4519-91b2-ad9b75c545d0 | 7 | @Override
public Object visitReturnStat(returnStat_AST node, ScopeElement data) {
binaryExpression_AST returnStmt = node.expr;
MethodUnit methodUnit = (MethodUnit) data.getScopeUnit().getUnit();
if (methodUnit == null)
return null;
Type methodReturnType = methodUnit.getReturnType().typeObj;
if (returnStmt... |
c718b3ab-c15e-460d-b866-394220e38608 | 9 | public static JSONArray JSONArrayOfSubgroupFromJsonArray(JSONArray organizedJson, String key){
int len = organizedJson.length();
int i,j,k,l;
JSONArray json = new JSONArray();
String subgroup_name;
boolean ok = false;
for(i = 0; i < len && !ok; i++)
{
JSONArray groups = organizedJson.getJSONObject(i).... |
26bc8cfd-4443-429c-b9ba-938ccd9933b4 | 4 | @Test
public void checkSafeMap()
{
map = SafeMap.getInstance();
Boolean isGood = false;
map.setSize(5,2);
map.createMap();
int amntOfBlue = 0;
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 5; j++)
{
if(map.getTiles()[i][j] == Colour.BLUE)
amntOfBlue++;
}
}
if(amntOfBlue <= 2... |
d93462cb-6b76-41e1-9532-d0a8ecc7531f | 0 | @Override public Iterator<GeoJsonObject> iterator()
{
return geometries.iterator();
} |
a3d85c49-0faf-47a5-ba82-a510ba5b24de | 7 | boolean clauseAtomSpec() {
if (!tokenNext(Token.dot))
return invalidAtomSpecification();
Token tokenAtomSpec = tokenNext();
if (tokenAtomSpec == null)
return true;
String atomSpec = "";
if (tokenAtomSpec.tok == Token.integer) {
atomSpec += "" + tokenAtomSpec.intValue;
tokenAtomSpec = tokenNext();
... |
549c96df-4548-4046-a826-fe10fa8df6e1 | 2 | public String[][] getAllValues() throws IOException {
ArrayList<String[]> records = new ArrayList<String[]>();
String[] values;
String[][] ret = null;
while ((values = getLine()) != null) {
records.add(values);
}
if (records.size() > 0) {
ret = new... |
fb20d958-e23f-45c6-8d13-34d3b241b618 | 4 | public Node construirKDTree(ArrayList<double[]> puntos, int splitAxis) {
if (puntos.size() == 1) {
return new Node(puntos.get(0), null, null, null);
}
// generar eje nuevo
double newSplitAxis = getSplitAxis(puntos, splitAxis);
// separar los puntos en dos grupos
ArrayList<double[]> puntosA = new ArrayLi... |
78ebbb16-00a4-48a4-99ba-ab94f5d1db1a | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
1c751fae-48a6-429e-8ecf-76433e94b607 | 8 | public NNCalc calcJacobi(double[] nnInp) {
final NNCalc res = NNresjacob;
for (int i = 0; i < nn_in; i++) {
act[0][i] = (nnInp[i] - inmin[i]) / (inmax[i] - inmin[i]);
}
for (int pl = 0; pl < nplanes - 1; pl++) {
final double[] act_pl_1 = act[pl + 1];
... |
b02df52b-8605-4f38-8522-44a5e8ca15da | 0 | @Before
public void setUp()
{
createInjector( new QuartzModule()
{
@Override
protected void schedule()
{
Properties properties = new Properties()
{
private static final long serialVersionUID = 1L;
... |
9c0eeccf-7386-43fd-a5a5-b67461bef6b7 | 3 | public static void main(String args []) throws ParseException
{
Logger logger = LoggerFactory.getLogger(Delang.class);
logger.info("Start DeLANG Interpreter...");
DelangSetting setting = new DelangSetting();
setting.init();
Delang parser = new Delang(System.in);
while(true)
{
System.out.pr... |
84f6c17d-9edb-4bf5-a7e8-26110cca3803 | 8 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
char[] s1 = br.readLine().toCharArray();
char[] s2 = br.readLine().toCharArray();
int l1 = s1.length;
int l2 = s2.length;
// int max_distance = Integer.MIN_VALUE;
int[][] e... |
ad144dec-07cf-4041-bf9f-46607ecae710 | 2 | private void initListeners(com.actimind.diagnostic.xml.Monitor m, List<SingleStatProcessor> processors, StatDB db) throws Exception, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException {
ListenersFactory lf = new ListenersFactory();
List<StatProcessorListener> l... |
6ed9fe02-cd8b-4787-8aa2-d94ecf976023 | 1 | public ArrayList viewMyBookingStatus() {
ArrayList temp = new ArrayList();
Query q = em.createQuery("SELECT t from BookingEntity t");
for (Object o : q.getResultList()) {
BookingEntity p = (BookingEntity) o;
temp.add(String.valueOf(p.getStatus()));
System.out... |
292d30a8-3451-42a0-9e72-a09b01072445 | 2 | public List<Organism> mutation(int numForAverageFitness) throws Exception {
List<Organism> mutated = new ArrayList<>();
int N = this.getNumberOrganisms();
for (int i = 0; i < N; i++) {
OrganismFactory fabrica = new OrganismFactory();
Organism organism4mutation = fabrica.d... |
e0253068-7f3f-46cf-a750-d1d75feb4f8c | 2 | public final void grow(int wantedSize) {
if (written)
throw new IllegalStateException("adding to written ConstantPool");
if (tags.length < wantedSize) {
int newSize = Math.max(tags.length * 2, wantedSize);
int[] tmpints = new int[newSize];
System.arraycopy(tags, 0, tmpints, 0, count);
tags = tmpints;... |
75c3ba04-02b7-493f-9f0e-60ac5962580a | 1 | private void killEverything() {
for (int i = 0; i < enemies.size(); i++) {
Enemy e;
e = enemies.get(i);
double ex = e.getx();
double ey = e.gety();
//e.kill();
Random randbloodtype = new Random();
int randzombieblood = randbloodtype.nextInt((2 - 1) + 1) + 1;
bloodsplatter.add(new BloodSplatter... |
b92753fa-31cf-4ba3-bef8-738973d1642c | 8 | public static void main(String []args){
Person p1 = new Java8().new Person("bob", "7-Jun-2013");
Person p2 = new Java8().new Person("bob", "7-Jun-2013");
if (p1 == p2)
System.out.println("Person p1==p2 " + p1.toString() + " " + p2.toString());
else
System.out.pr... |
94d7defb-5243-4292-a2f0-a5b75e53a4f5 | 5 | @Override
public void run() {
System.out.println("asa2");
byte[] data=new byte[1024];
BufferedInputStream playbackInputStream = null;
try {
playbackInputStream=new BufferedInputStream(new AudioInputStream(socket.getInputStream(),format,2147483647));
} catch (IOExc... |
5534cb99-7663-4f84-955e-699bdd90d070 | 7 | void createTabList(Composite parent) {
tabList = new Tree(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
Arrays.sort(tabs, new Comparator<Object>() {
public int compare(final Object tab0, final Object tab1) {
return ((GraphicsTab)tab0).getText().compareTo(((GraphicsTab)tab1).getText());
}
});... |
35543c5e-f6b6-4185-8b54-ec29edfae554 | 3 | public void myInit(ArrayList<Solve> population) {
for (int i = 0; i < populationsize; i++) {
population.add(randomSolve(chromosomesize));
}
int val, imin = 0;
int min = Integer.MAX_VALUE;
for (int i = 0; i < populationsize; i++) {
//population.get(i).Valu... |
c70df6d1-444e-47cc-abff-c36ec9424aa2 | 0 | public void setState(int newState) {
this.state = newState;
} |
b67b151e-8e5d-4aca-a9f4-3ff26cbb31b1 | 6 | private JSONRPC2Response handleJSONRPC2Exception(JSONRPC2SessionException e) {
JSONRPC2Response errorResponse;
String errorType = null;
if (e.getCauseType() == JSONRPC2SessionException.JSONRPC2_ERROR) {
errorType = "JSONRPC2 Error: " + e.getMessage();
}
if (e.getCause... |
c81bdde4-25a4-497e-87dd-2b076d7ec33f | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
d8f024d6-4935-450c-b536-55538cb9ac56 | 7 | public JSONObject getJsonMsg(String... keys) {
JSONObject jsonMsg = new JSONObject();
for (String key : keys) {
switch (key) {
case "id":
jsonMsg.put("id", String.valueOf(this._id));
break;
case "content":
jsonMsg.put("content", this._content);
break;
case "sentDate":
jsonMsg.put("se... |
24887122-d60c-4a10-bb98-9b3bc3977c4b | 3 | protected static short[][] unpackFromStrings(String[] sa)
{
// Concatanate initialization strings.
StringBuffer sb = new StringBuffer(sa[0]);
for (int i=1; i<sa.length; i++)
sb.append(sa[i]);
int n=0; // location in initialization string
int size1 = (((int)sb.charAt(n))<<16) | ((int)s... |
fe4ca745-2292-4d80-9091-f7de68676d9d | 5 | public Account getByCurrency(Client client, String currency) {
Account res = null;
try {
session = HibernateUtil.getSessionFactory().getCurrentSession();
res = null;
String hql = "from Account a where a.client.id=" + client.getClient_id();
session.beginTra... |
0b66b76d-9614-40d7-afbe-06562042872f | 3 | public JSONWriter object() throws JSONException {
if (this.mode == 'i') {
this.mode = 'o';
}
if (this.mode == 'o' || this.mode == 'a') {
this.append("{");
this.push(new JSONObject());
this.comma = false;
return this;
}
t... |
661f7ee8-747c-4a9e-b4bb-73b93a7c7721 | 3 | public void testCalendar() {
if (TestAll.FAST) {
return;
}
System.out.println("\nTestBuddhistChronology.testCalendar");
DateTime epoch = new DateTime(1, 1, 1, 0, 0, 0, 0, BUDDHIST_UTC);
long millis = epoch.getMillis();
long end = new DateTime(3000, 1, 1, 0, 0,... |
df60cd89-9744-463f-90f0-fc49e4190d6b | 5 | public void draw(Graphics2D g) {
for (int row = rowOffset; row < rowOffset + numRowsToDraw; row++) {
if (row >= numRows)
break;
for (int col = colOffset; col < colOffset + numColsToDraw; col++) {
if (col >= numCols)
break;
if (map[row][col] == 0)
continue;
int rc = map[row][col];
... |
e9fee6c3-704c-4ea3-aff9-49a1b93ab6ab | 1 | public static boolean error(int code) {
return code / 100 == 4 || code / 100 == 5;
} |
dc154707-ace4-45fb-8809-cc868f401469 | 4 | private synchronized void finishGame(String nickname) {
pauseFlag = true;
for(PlayerState ps : players) {
if(ps.getNickname().equals(nickname)) {
ps.setActive(false);
if(!hasActivePlayer()) {
stopGame();
} else {
... |
4d4d346f-f9be-4e61-aee2-629fd7990267 | 0 | public static void main(String[] args) {
DangerousMonster barney = new DragonZilla();
u(barney);
v(barney);
Vampire vlad = new VeryBadVampire();
u(vlad);
v(vlad);
w(vlad);
} |
25e0db7a-625d-4c46-8b45-78854110dc66 | 3 | public boolean apply(Player player) {
Player.Ids rhs = player.getIds();
if (mlbId.equals(rhs.get("mlb"))) {
return true;
}
if (lahmanId.equals(rhs.get("lahman"))) {
return true;
}
if (name.equals(player.getBio().getName())) {
return t... |
57c8b27a-5ddc-4874-a127-61486d268d30 | 4 | public static void main(String[] args){
int result=0;
int i=0,j=0;
for(i=999;i>99;i--){
for (j=999;j>99;j--){
if (isPalindrome(i*j) && i*j>result)
{ result = i*j;}
}
}
System.out.println(result);
System.out.println(isPalindrome(202));
} |
cdd75721-ff1a-470b-b452-46a3c6cbcbb2 | 2 | public void toggleQ3()
{
if (Q3Associated.equals(true))
{
ecgQuicImage.updateImage("src/com/anakena/freePcaInterlock/Q3InactiveQUIC.png");
ecgPanel.updateValue("X");
Q3Associated = false;
}
else if (Q3Associated.equals(false))
{
ecgQuicImage.updateImage("src/com/anakena/freePcaInterlock/Q3ActiveQ... |
36b11ae9-faf9-4b51-88b1-e6b48e4d7f9d | 7 | public void update(Product product, Product updatedProduct) {
// Copy the fields.
Field[] fields = product.getClass().getFields();
for (Field f : fields) {
if (!f.getName().equals("id")){
try {
f.set(product, f.get(updatedProduct));
} catch (SecurityException e) {
// TODO Auto-generated ca... |
d77ee726-b6eb-4015-8ef5-299a83a833ee | 8 | public int getBestSquare(Board board, int x, int y) {
for (int radius = 1; radius < board.w; radius++) {
int size = 2*radius;
if ((x+size) >= board.w || (y+size) >= board.h)
return radius-1;
for (int i = 0; i <= size; i++)
{
if (!board.cells[x+i][y+size-1])
return radius-1;
if (!board.cel... |
876943e3-f003-4097-8c9a-e679e356b5f7 | 0 | public String getDesc() {
return desc;
} |
18566499-cc54-42c2-968e-341afd72cc5e | 6 | public void checkCondition(ArrayList<OperateShape> shapes) {
for (OperateShape ball : shapes) {
if (ball instanceof Circle) {
for (OperateShape block : shapes) {
event = new CollisionEvent();
if (block instanceof Block) {
checkCollisionBlock(ball, block);
if (isCollision) {
... |
b0cdb3a0-6ea0-4550-b5d4-740d6ce5eed2 | 8 | public static int posicionXFicha(int ficha, int torre) {
int k = (torre - 1) * 200;
switch (ficha) {
case 1:
return 110 + k;
case 2:
return 100 + k;
case 3:
return 90 + k;
case 4:
return 80 + ... |
5db95c20-9244-475b-a60e-9df97659abf0 | 2 | public static Vector<Spectacle> getSpectables () throws BDException {
Vector<Spectacle> res = new Vector<Spectacle>();
String requete = "select DISTINCT numS, nomS from LesSpectacles order by numS asc";
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
try {
conn = BDConnexion.getConne... |
f0f824b5-b094-4cd3-a96a-cc437f368bda | 2 | @Override
public void informPairsOfNameChange() {
for(WorldCoordinate coord : getPairs()) {
SignalReceiver recv = getReceiverAt(coord);
if(recv != null){
recv.onPairNameChange(getCoords(), getName());
}
}
} |
1f5140d1-14bc-4f40-b8ff-e0cd02c64df7 | 3 | private ComponentEntry availableController(String associationKey) {
for (String key : this.accessControllers.keySet()) {
if (this.accessControllers.get(key).associationKey.equals(associationKey) && !this.accessControllers.get(key).associated) {
return this.accessControllers.get(key);
}
}
return null;
} |
24865667-d903-4761-985e-9ee4b66e3546 | 4 | public Station getStationSuivante(Station s){
if(!stations.contains(s)){
return null;
}
for (int i = 0; i < stations.size(); i++) {
if(s.getNom().equals(stations.get(i).getNom())){
if(i < stations.size()){
return stations.get(i+1);
}
}
}
return null;
} |
588d54c8-b184-45f9-9309-8eaf2ed1cc9a | 9 | private static Predictor train(List<Instance> instances, String algorithm, int numIter,
double gd_eta, int numFeaturesToSelect, double online_learning_rate, int online_training_iterations,
double polynomial_kernel_exponent, double cluster_lambda, int num_clusters, int clustering_training_iterations) {
// TODO T... |
866c04bb-8a80-40d6-96ed-a38eebfe98fb | 1 | public double calculateExpectedScore() {
double score = 0;
double[] fruitProbabilities = predictDistribution();
for (int i = 0; i < typesOfFruit; i++) {
score += fruitProbabilities[i] * bowlSize * pref[i];
}
return score;
} |
3b5d0d08-9cd0-4e8d-a223-faab81da088a | 9 | public SessionListenerCollection(HttpSession session) throws GuacamoleException {
// Pull cached listeners from session
listeners = (Collection) session.getAttribute(SESSION_ATTRIBUTE);
// If no listeners stored, listeners must be loaded first
if (listeners == null) {
// L... |
43ee9929-e7e1-4adb-90d2-9bd4956ba0fa | 6 | public static void main(String args[])
{
//<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://download.orac... |
c67fb609-6bfa-47b7-acf2-196c283ec0e1 | 0 | public static void setGridDimensions(int width, int height) {
grid = new Grille(width, height, new RuleSet("23/3")); // Conway's game of life by default
} |
2d72c4d0-c83d-4368-9d8b-0e9962661d69 | 2 | public static String channelList(Collection<Channel> channels) {
PacketBuilder buffer = new PacketBuilder(
SendOpcode.CHANNEL_LIST.getValue());
for (Channel channel : channels) {
int count = channel.countClients();
buffer.writeByte(0x00);
buffer.writeString(channel.getName());
buffer.writeByte(0x0A... |
a7453039-8f1e-4da1-9627-f507af59c934 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final CustomerHirarchy other = (CustomerHirarchy) obj;
if (!Objects.equals(this.idHirarchy, other.idHirarchy)) ... |
c841e085-9632-429f-a6a5-f6a0b812c819 | 4 | public String getAspectSelection(){
String res = "";
ButtonModel bma = aspectGroup.getSelection();
ButtonModel bma2 = secondAspectGroup.getSelection();
if (bma == null) return null;
res+=bma.getActionCommand();
if (bma2!=null){... |
580144fb-40db-4abc-a069-832a4882c9e3 | 7 | @Override
public Command read(Set<Command> availableCommands) {
String commandString = null;
while (true) {
try {
System.out.println("Choose one:");
for (Command command : availableCommands) {
System.out.print(command.toString());
... |
2814726f-1499-44a5-a8c8-43a654dfe8b5 | 6 | @EventHandler
public void onJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
if(!RushPlugin.isGameRunning() || RushPlugin.isGameFinished())
p.setGameMode(GameMode.ADVENTURE);
if(RushPlugin.isGameRunning() && !RushPlugin.isGameFinished())
if(!RushPlugin.isARushPlayer(e.getPlayer()))
p.sendMessage(Cha... |
38d6059b-e9b3-4a91-9ad5-51b842fb35e1 | 5 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "ban", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if (args.length == 0) {
return false;
}
String msg ... |
9b5c054c-087c-49d2-b7f3-dbfd4d7f2795 | 7 | private String accessString() {
String s = "";
if ((accessFlags & 0x0001) > 0) s += "public ";
if ((accessFlags & 0x0002) > 0) s += "private ";
if ((accessFlags & 0x0004) > 0) s += "protected ";
if ((accessFlags & 0x0008) > 0) s += "static ";
if ((accessFlags & 0x0010) > 0) s += "fin... |
b5aea594-e8b3-4afd-9c02-4981c1000483 | 2 | public User validateUser(String userId) {
User user = null;
Connection connection = (new DbConnection()).getConnection();
try {
Statement statement = connection.createStatement();
String sql = IS_USER_EXISTS + userId + "'";
ResultSet resultSet = statement.executeQuery(sql);
if (resultSet.next()) {
... |
bf214556-f5f6-4e65-8327-d3e450708e87 | 3 | public void LoginVerification() throws IOException {
this.response.setContentType("text/html;charset=utf-8");
this.response.setCharacterEncoding("UTF-8");
userName = request.getParameter("userName");
password = request.getParameter("password");
System.out.println("we get the parameter" + userName + "!!!" + pa... |
91b514be-7fd5-4ef8-816b-8fb41b9db54f | 4 | public int getY() {
boolean test = false;
if (test || m_test) {
System.out.println("Coordinate :: getY() BEGIN");
}
if (test || m_test) {
System.out.println("Coordinate :: getY() END");
}
return m_Y;
} |
efe4eeb4-7b42-4b00-994e-fab81a657890 | 6 | public int read(final int[] docs, final int[] freqs)
throws IOException {
final int length = docs.length;
if (currentFieldOmitTermFreqAndPositions) {
return readNoTf(docs, freqs, length);
} else {
int i = 0;
while (i < length && count < df) {
// manually inlined call to n... |
3afbe6df-7164-4efc-b51e-13438ec94497 | 5 | public Method findSetMethod(Field field, Class<?> paramType) {
if(field == null)
return null;
if(getFieldDetailStore().isSetMethodPresentFor(field)) {
return getFieldDetailStore().setMethodOf(field);
}
String setterName = createMethodName("set", field.getName()... |
3661cfe6-4d20-41ab-9e41-ad3caf019753 | 4 | private void addEvents() {
loggerAboutDialog.entry();
developerPane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.g... |
8bc8e9ab-7891-465e-b247-7d3c8405b8b8 | 0 | @Test
@Ignore // not supported, would require taint tracking via files
public void runTestPrivateDataLeak3() throws IOException {
InfoflowResults res = analyzeAPKFile("AndroidSpecific_PrivateDataLeak3.apk");
Assert.assertEquals(2, res.size());
} |
1a876ff1-565d-4f5a-9497-e1391992ead7 | 4 | public static final Object fromCompactExternalId(String compactExternalId, CycAccess access)
throws IOException {
if ((compactExternalId == null) || ("".equals(compactExternalId))) {
throw new IllegalArgumentException(compactExternalId + "is not a valid compact external id.");
}
// @todo sup... |
31451310-8c0f-4c6d-8653-86c642a3022c | 6 | private boolean canUse() {
if(!VBLogin.self.isLoggedIn()) {
return false;
}
if (VBLogin.self.getUsergroupId() == 8) {
return false;
}
int[] vip = {10, 11, 6, 9};
if(manifest.type() == ScriptType.FREE) {
return true;
... |
402a61b9-117d-451d-b1f7-425ca263779e | 1 | public static float[] castToFloatArray(int[] intArr){
float[] tmp = new float[intArr.length];
for (int i = 0 ; i < intArr.length; i++) tmp[i] = (float) intArr[i];
return tmp;
} |
63cb0e19-c4c8-40e3-9d81-bb5340ef70c3 | 2 | public ArrayList<Item> getKeys(ThePlayer p)
{
ArrayList<Item> toReturn = new ArrayList<Item>();
for(Item i : p.getFFCharacter().getInventory())
{
if (i instanceof Key)
{
toReturn.add(i);
}
}
return toReturn;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.