method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
dab2ba18-ef62-4b4b-801d-a996f14ead0b | 4 | public void drawHealthBars(SpriteBatch sb){
Color tint = sb.getColor();
for(Entity e: healthBars.keySet()){
for(int i = 0; i < e.getMaxHealth(); i++){
if(i<=e.getHealth())
if(e.frozen)
sb.setColor(Color.CYAN);
else
sb.setColor(Color.RED);
else
sb.setColor(Color.GRAY);
sb.dr... |
7870bd08-0cad-43bb-9a4d-8ca610c43364 | 1 | public int getTotalTermCount(SQLconnection sqLconnection, int paperID) {
String query = "select totalcount from papertermcount where paperID="
+ paperID;
int count = 0;
ResultSet rs = sqLconnection.Query(query);
try {
rs.next();
count = rs.getInt("totalcount");
rs.close();
} catch (SQLException e... |
fced2ad6-9d64-4876-8241-cce1803065b3 | 6 | private static int DFS(TreeNode node) {
if (node.left == null && node.right == null) {
return 1;
}
if (node.left != null && node.right == null) {
return DFS(node.left) + 1;
}
if (node.left == null && node.right != null) {
return DFS(node.right) + 1;
}
return Math.min(DFS(node.left), DFS(node.rig... |
85876bce-7a32-4cc8-a0b6-5a6d62ab8227 | 8 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g); // Paint background, border
//------------ Collision detection
//Check the pellets
roundCheck(1);//pellets single and doubleshots
//Rocket check
roundCheck(0);//0 is rockets
//check the takeover rockets
roundCheck(3);
//-----... |
1f4d08ed-09be-4b22-9b9f-c6955936f8b9 | 1 | public static void update() {
for(Keybind keybinds : Keybind.values()) {
keybinds.key.setHeld(keybinds.key.isPressed());
keybinds.key.update();
}
} |
cb86fc9b-9cb8-45cb-9f19-07039e3a2ad2 | 7 | @EventHandler
public void GhastWither(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.getZombieConfig().getDouble("Ghast.Wither.Dod... |
9b37add3-224e-4a19-99b6-1cb6d467afc9 | 6 | public String longestCommonPrefix(String[] strs) {
if(strs.length ==0)
return "";
if(strs.length ==1)
return strs[0];
for(int i =0;;i++){
for(int j=0;j< strs.length;j++){
if(i >= strs[j].length())
return strs[j].substring(0... |
72f6bbc9-978e-45dc-98af-700af729c286 | 3 | @Override
public String toString() {
switch(this) {
case BIANCO: return "BIANCO";
case NERO: return "NERO";
case NULL: return "NULL";
default: throw new IllegalArgumentException();
}
} |
1c72080f-dc1d-40db-a0fa-ebfa27df5af2 | 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... |
e2a0b65d-db8a-448f-983f-55e231d66e86 | 0 | @Override
public int delete(Integer idMetier) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
86fdd3b9-ce9f-4607-98d7-19c92f79608c | 7 | public String toString() {
StringBuilder sb = new StringBuilder();
int c1 = 18;
int sc = 6;
// Print header
sb.append(String.format("%" + c1 + "s |", "Category"));
for (Player player : players) {
sb.append(String.format(" %-" + (sc * 3 + 4) + "s |", player.getName()));
}
sb.append... |
b160a38b-1c24-425b-9911-f3311374d8e9 | 2 | void init() {
addTypeConverter(String.class, Long.class, Long::valueOf);
addTypeConverter(String.class, Long.TYPE, Long::valueOf);
addTypeConverter(String.class, Integer.class, Integer::valueOf);
addTypeConverter(String.class, Integer.TYPE, Integer::valueOf);
addTypeConverter(String.class, Byte.class, Byte::v... |
cb4f01a8-dfcc-4cad-a681-61fa273080a2 | 3 | public int roomChooser(){
list.clear();
for(int i=0; i<map.size(); i++){
int[] tmp = new int[6];
tmp = getValue(i);
if ((tmp[0]==1)&&(tmp[1]==1)){
list.add(i);
}
}
int l = list.size();
int m = (int)(Math.random()*l);
return list.get(m);
} |
5b08001c-0308-45dc-bd3b-53a9f87438f9 | 0 | public void addPeriod(Period per)
{
this.periods.add(per);
} |
9bbcc4f4-1e58-4da3-8d9f-af91eb31298e | 7 | @Override
public void run() {
long lastCycle = 0;
long systemTime;
while (isRunning()) {
systemTime = System.currentTimeMillis();
if ((systemTime - lastCycle) > cycleLength) {
if (getTasks().size() > 0) {
Iterator<ITask> it = getTasks().iterator();
while (it.hasNext()) {
if (!it.next()... |
b0404642-720a-4329-bb97-1b623260c4af | 5 | private void drawPhysicsVariables() {
g2d.setTransform(identity);
g2d.setColor(Color.RED);
Ship s = DataController.getInstance().getPlayerShip();
double dX = (s.getDest()==null)?0:s.getDest().getX();
double dY = (s.getDest()==null)?0:s.getDest().getY();
String temp;
... |
32e47d07-3b48-4f38-b6d2-c6b6ef1f7b2b | 5 | public void transferResultToNextGen(NeighbourhoodMatrix nextgen,
PVector source, TemplateMatrix templateCopy) {
// transfer non-zero cells from rectified to correct target octant
Octant oct = new Octant(source.heading());
for(int col=0; col<3; col++)
for (int row=0; row<3; row++) {
PVector v = templateC... |
f6ae0a24-cb5b-4720-9741-f367ce9820ae | 1 | private static int booleanString(boolean b){
if(b){
return 1;
}
else{
return 0;
}
} |
3101b557-4e3e-43e7-9982-db2359ee6a98 | 6 | private boolean light(int xa, int ya, int dir) {
List<Light> lights = level.getLights(x, y, dir);
if (lights.size() <= 0) return false;
Light light = lights.get(0);
if (light.intensity > 30) return false;
if (light.dir == 3) {
light.x--;
} else if (light.dir == 1) {
light.x++;
} else if (light.dir =... |
c8a9a178-8e5c-422d-9482-477bb07f9a33 | 1 | public void Add(Tick t) {
synchronized(ticks) {
if (!ticks.contains(t))
ticks.add(t);
}
} |
1634b7de-9fbc-4e9d-846e-6c95dece02a9 | 4 | public static List<Laureate> filterByPrizeYearRange(
List<Laureate> inputList, String startYear, String endYear) {
List<Laureate> outputList = new ArrayList<Laureate>();
int sYear = Integer.getInteger(startYear);
int eYear = Integer.getInteger(endYear);
// parse input, kee... |
8469031c-e9d8-47a4-843a-f674e3d23f94 | 8 | public Place getPlaceInDirection(Place currentPlace, String direction)
{
int x = currentPlace.getLocation().getX();
int y = currentPlace.getLocation().getY();
if (direction.equals("East") && x + 1 < myLength)
return myPlaceGrid[x + 1][y];
else if (direction.equals("South") && y + 1 < myWidth)
return m... |
b01ab162-f35b-4460-899a-bf0828665e47 | 3 | public synchronized boolean isBeenPlayed() {
boolean result = !(game == null) && !game.hasStarted()
|| isWaitingForUsers;
if (playerCount == 0) {
result = false;
game = null;
}
return result;
} |
7d7aac03-5ce3-43b8-a0a3-71d4fca0e755 | 2 | @RequestMapping(value = {"/MovimientoBancario/{idMovimientoBancario}"}, method = RequestMethod.GET)
public void read(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idMovimientoBancario") int idMovimientoBancario) {
try {
ObjectMapper jackson = new ObjectM... |
a78ee5c9-e550-414f-ad68-6e6b8c64d364 | 0 | @Override
public Clock deepCopy() {
LogicClock newClock = new LogicClock();
newClock.clock = this.clock;
return newClock;
} |
a9597e55-1e4f-47e9-86ff-6d601e948526 | 3 | public void log(String str) {
FileWriter fw = null;
try {
fw = new FileWriter(this.logFile, true);
String date = new Date().toString();
fw.write(date + " : " + str);
fw.write(LINE_SEPARATOR);
} catch (IOException e) {
System.err.println("Couldn't log this : " + str);
} finally {
if (fw != null... |
fcf431b5-ee93-49cd-a5f8-600402e9a1d8 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
948d7431-87fc-4e31-8d3c-38835627f9a2 | 3 | private int getDeciSeconds() {
if (last == null || !last.hasNext()) {
// less than min, but more than the half
int half = (Math.round(MIN_SECONDS / 2) - 1) * 10;
return (new Random()).nextInt(half) + half;
} else {
int sec = last.getSeconds();
if ((new Random()).nextBoolean()) {
return (sec * ... |
351517ba-a047-46d1-908c-b25cc9e1af3b | 9 | protected static String pwdElaborate( String p ){
String[] words;
String answer;
int numLenght = 10;
if ( p.equals( "-an" ) ) {
charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
numLenght = 62;
} else if ( p.equals... |
ec0ed2bf-7f59-489f-b84c-2bda0344964f | 4 | public boolean doTransformations() {
StructuredBlock last = flowBlock.lastModified;
return (!isEntered && CompleteSynchronized.enter(this, last))
|| (isEntered && object == null && CompleteSynchronized
.combineObject(this, last));
} |
4636ebe1-b507-4713-bd4c-26b1928db464 | 0 | public String getId() {
return id;
} |
a04b5fcc-22e1-4078-9ac5-ce0d9079e647 | 3 | @Override
public NormalLikeDistribution[] getOrderDistributions(double mean, double sd) {
double[] divisors = new double[numberOfOrderPeriods];
double sum = 0;
for (int i = 0; i < numberOfOrderPeriods;i++){
divisors[i] = i+1;
sum += i+1;
}
RealSinglePointDistribution emptyOrder = new Real... |
9caa1d51-ea2f-43b7-92e5-a68bf6c94137 | 4 | public boolean isInString(String string, String s) {
int stringLength = string.length();
int lowestCount = d;
for (int i = 0; i < stringLength - this.k + 1; i++) {
String compare = string.substring(i, i + this.k);
int count = 0;
for (int j = 0; j < this.k; j+... |
a8cb0da0-2a8f-4d66-a1cb-9dcb1954a6ee | 3 | public void gravarTurmasDeDisciplinasEmArquivo(String nomeArquivo)
throws IOException {
BufferedWriter gravador = null;
try {
gravador = new BufferedWriter(new FileWriter(nomeArquivo));
for (Disciplina disciplina : this.disciplina) {
gravador.write(disciplina.getCodigo() + "\n");
gravador.write(dis... |
a47d682f-686e-4afb-90e7-c2642a9bd474 | 1 | public void setSelected(int selected) {
this.selected = selected;
if (selected >= 0) {
sel.setText(Integer.toString(selected));
} else {
sel.setText("");
}
sel.revalidate();
} |
ac907edb-1dd4-4609-bc3a-eee545bdde1b | 3 | public static boolean isGetter(Method method)
{
if(!method.getName().startsWith("get")) return false;
if(method.getParameterTypes().length != 0) return false;
if(void.class.equals(method.getReturnType())) return false;
return true;
} |
c3083fe6-b244-4125-8422-b1e375b3894a | 8 | @EventHandler
public void onChat(AsyncPlayerChatEvent event) {
final Player player = event.getPlayer();
if (player.getName().equalsIgnoreCase("jacklin213") || player.hasPermission("linbot.access")) {
String msg = event.getMessage();
String[] words = msg.split(" ");
if (words[0].startsWith("!")) {
fina... |
81207770-c474-4879-ac13-1e939570b586 | 9 | final public String selectexpr() throws ParseException {
/*@bgen(jjtree) SEL */
SimpleNode jjtn000 = new SimpleNode(JJTSEL);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);Token t; String s; String sel = "";
try {
t = jj_consume_token(SELECT);
sel += t.image.toString();
s =... |
a840a73d-7284-48a5-8ee7-a6fd020c96a1 | 4 | protected boolean sendAck(int tag,boolean status,int gridletId,int destId)
{
boolean success = false;
switch (tag)
{
case GridSimTags.GRIDLET_PAUSE_ACK:
case GridSimTags.GRIDLET_RESUME_ACK:
case GridSimTags.GRIDLET_SUBMIT_ACK:
int[] array ... |
a52780d8-ded9-4894-8b60-15cd751b56ae | 5 | public void shuttleSort(boolean printpasses) {
for (int pass = 1; pass < elements.length; pass++) {
for (int i = pass; i > 0; i--) {
T current = elements[i];
T other = elements[i - 1];
int compResult = current.compareTo(other);
if (comp... |
69566ee4-5b34-4f75-913c-1c5ffdd385bc | 4 | @Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("version_check")) {
int value = (Integer) evt.getNewValue();
if (value == RESULT_UP_TO_DATE) {
setVisible(false);
Application.window = new BotWindow();
Application.window.init(true);
System.out.prin... |
98ea3843-e768-4c13-b64d-0866cabe41b8 | 2 | public boolean isAdmin(String forumId, User user) {
for (int i = 0; i < forums.size(); i++) {
if (forums.get(i).getId().equals(forumId))
return forums.get(i).isAdmin(user);
}
return false;
} |
b145805e-1bde-4bf4-8e6d-a384ef0ae732 | 7 | /*package protected */boolean fireDockableStateWillChange(DockableStateWillChangeEvent e) {
DockingDesktop desk = e.getFutureState().getDesktop();
if(desk.getMaximizedDockable() != null) {
// veto events coming from autohide and floating components if a component is maximized
// @todo : this could be improv... |
97892506-8f21-4d14-96fb-87bdf5700e9d | 1 | private boolean jj_3_8() {
if (jj_3R_26()) return true;
return false;
} |
feeb9e2b-7c22-4368-8a6f-6d4409e390fc | 5 | @Override
public void validate() {
Graphics g = getGraphics();
final FontMetrics fontMetrics = g.getFontMetrics();
String[] allLines = content.split("\n");
int allLinesN = allLines.length;
int nLines = 0;
int h = 0;
for (int i = 0; i < allLinesN; ++i) {
... |
5ea75a3f-259a-46b9-a968-c8cdad0c6279 | 2 | public void expand(double factor) {
if(factor < this.min) {
this.min = factor;
}
if(factor > this.max) {
this.max = factor;
}
} |
a60c7468-24e5-4b43-9d5a-9a885ab01375 | 2 | @Test
public void testLoadFromCacheSuccessOnCustomPage() {
AbstractPage p = AbstractPage.bakeAPage(null,"http://noctura.bandcamp.com/album/demos", null, null);
assertEquals(true, p.loadFromCache());
assertEquals("Demos", p.getTitle());
assertEquals(7, p.childPages.size());
boolean found = false;
for (Abstr... |
3b2ffa11-c281-42e5-aae2-906d5ed169f4 | 3 | public void initialize()
{
if (GameApplet.thisApplet != null)
{
Enumeration localEnumeration = getEnvironment().getObjects().elements();
while (localEnumeration.hasMoreElements())
{
Object localObject = localEnumeration.nextElement();
if (!(localObject instanceof Cannon))
... |
429f6bc1-15cb-4c84-a402-bb92a7bd19d5 | 2 | public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Counting words");
int n = scan.nextInt();
String[] wordsStr = new String[n];
for(int i=0; i<n; i++)
{
wordsStr[i] = scan.next();
}
Arrays.sort(wordsStr);
for(int i=0; i<n; i++)
{
System.... |
e2341a14-cae5-4dea-b7eb-56801325b703 | 6 | @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
public void onQuit(PlayerQuitEvent event) throws IOException {
Player player = event.getPlayer();
if (DataBase.isInCombat(player)) {
long end = DataBase.getEndingTime(player);
if (!Clock.isEnded(end)) {
if (player.getGameMode() != GameMo... |
18e9817f-8bf1-4ecd-aba1-2bb489c680fd | 3 | static private int jjMoveStringLiteralDfa14_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(12, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(13, active0);
return 14;
}
switch(curChar)
{
... |
5377788d-7529-4834-9678-a3f4bf69f51f | 5 | public boolean isRelationalOp() {
return val.equals(LT) ||
val.equals(LE) ||
val.equals(EQ) ||
val.equals(NE) ||
val.equals(GT) ||
val.equals(GE);
} |
9e78ec30-6112-4f3e-805a-6d5a3f1ddf22 | 1 | public boolean Check(ArrayList<Integer> slv){
HashSet<Integer> tmp = new HashSet();
for (int i : slv){
tmp.addAll(sets.get(i));
}
return nodes.equals(tmp);
} |
37198165-3987-46b7-8263-bcc2ea23f360 | 9 | public static String getSystemTmpDirectory () {
if (systemTmpDir != null) {
return (systemTmpDir);
}
String dir = getProperty("java.io.tmpdir");
if (dir == null) {
dir = getProperty("TMP");
}
if (dir == null) {
dir = getProperty("TEMP");
}
if (dir == null) {
dir = getProperty("TMPDIR");
... |
8d096aab-be8d-469c-a1cb-0834f369e415 | 1 | public long getNumberOfSamples() {
if (this.isMpeg) {
// audioInputStream.getFrameLength() returns -1 for MP3s
// thus another method is needed:
// the following WORKAROUND will approximate the number of samples only
// - usually it is SMALLER!
return... |
1cd4875c-9959-4118-865e-5763ef78e5b2 | 5 | public static void main(String[] args) {
// TODO Auto-generated method stub
boolean vorhanden = false;
Person[] personen = new Person[0];
do {
String nachname = Tastatur.inputString("Nachname: ");
String vorname = Tastatur.inputString("Vorname: ");
String geschlecht = Tastatur.inputString("Geschlecht ... |
f7add814-edbd-4413-8818-baf147e78bd8 | 1 | protected long getNextCallId() {
final ReentrantLock l = lock;
l.lock();
try {
if (++prevCallId > Long.MAX_VALUE) {
prevCallId = Long.MIN_VALUE;
}
return prevCallId;
}
finally {
l.unlock();
}
} |
ae5f84df-ac5c-4af2-8455-2b632d31a23b | 5 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int result = 0;
int n = in.nextInt();
int k = in.nextInt();
List<Integer> n_table = new ArrayList<Integer>();
for (int i = 0 ; i < n ; ... |
34a2a857-153b-4fb4-8005-8e1b1a713c63 | 6 | private final void checkSliderPosition()
{
if (isVertical)
{
if (slider.getYD() < y + scrollBarThickness)
slider.setY(y + scrollBarThickness);
else if (slider.getYD() + slider.getHeightD() > y + height - scrollBarThickness)
slider.setY(y + height - slider.getHeightD() - scrollBarTh... |
25b90fb9-8746-4347-9dc4-b3617c15005c | 4 | private void btnReplaceItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnReplaceItemActionPerformed
{//GEN-HEADEREND:event_btnReplaceItemActionPerformed
if (!archive.fileExists(selectedPath))
throw new UnsupportedOperationException("oops, bug");
JFileChoose... |
f0aaa794-ecbf-4545-bcac-623821992544 | 9 | private void cargarSetPrueba(){
DefaultTableModel temp = (DefaultTableModel) this.tablaSetPruebas.getModel();
String csvFile = "dataset/diabetes_prueba.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
try {
double maximo0 = normalizacion.obtenerMaximo(0, csvFile);
doubl... |
11a478b6-5cb1-4f87-bf7b-17b890cd252b | 4 | public static void takeTurn(int turn) {
int food = AntColony.node[13][13].food;
// The queen eats one unit of food in node 13,13 per turn
if (food == 0)
AntColony.endSim = true;
else
AntColony.node[13][13].setFoodAmount(food - 1);
// The queen hatches a new ant once per day (every ten turns)
i... |
41bdfff6-9e2b-4cd1-be5d-727096024163 | 4 | public Matrix minus(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(M, N);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
C.data[i][j] = A.data[i][j] - B.data[i... |
1848f81b-d82c-45b6-a094-105aebf02d1e | 7 | public static String[] dealString(String str){
String[] s = str.split(":");
//s[0]
s[0] = s[0].trim();
int first = s[0].indexOf(" ");
int last = s[0].lastIndexOf(" ");
//ոֵλòͬ
if(first<last){
String[] subStr = s[0].split(" ");
StringBuffer sb = new StringBuffer();
sb.append(subStr[0]);
for(in... |
0d9c6ca2-cac0-4f55-8092-f36cd72f6846 | 9 | public static BufferedImage crop(BufferedImage image)
{
int width = image.getWidth(),
height = image.getHeight(),
minX = width,
maxX = 0,
minY = height,
maxY = 0;
for( int x = 0; x < width; x++)
for( int y = 0; y < height; y++ ) {
if( (image.getRGB(x, y) & 0x00FFFFFF) != 0 ) {
i... |
af53ed39-67c1-4aca-8be7-290d16f23a7b | 2 | public State getStateForVariable(String variable,
VariableDependencyGraph graph) {
State[] states = graph.getStates();
for (int k = 0; k < states.length; k++) {
if (states[k].getName().equals(variable))
return states[k];
}
return null;
} |
e87538bc-ec83-4a17-be15-a8b26842c2df | 6 | public static void validateNumericTypes(Number number1, Number number2) {
if ((number1 instanceof Integer) && (number2 instanceof Integer)) {
return;
}
if ((number1 instanceof Long) && (number2 instanceof Long)) {
return;
}
if ((number1 instanceof Double) ... |
9e7afcab-8d58-406b-9cd1-4e7f95fb6bcf | 0 | @Test
public void findDuplicateTypeHand_whenFourJacks_returnsFourOfaKind() {
Hand hand = findDuplicateTypeHand(quadsJacksWithTenKicker());
assertEquals(HandRank.FourOfAKind, hand.handRank);
assertEquals(Rank.Jack, hand.ranks.get(0));
assertEquals(Rank.Ten, hand.ranks.get(1));
} |
38e037d9-84b5-47b3-b2ac-d51376fce603 | 9 | private void populateElements() {
JPanel content = (JPanel) this.getContentPane();
content.setLayout(new GridBagLayout());
content.setBorder(new EmptyBorder(10, 5, 6, 5));
GridBagConstraints c;
int x = 0, y = 0;
c = new GridBagConstraints();
c.insets = new Insets(0, 7, 0, 0);
c.weightx = 0;
c.gridx... |
084057b8-00f5-49ac-8b3f-e2976926fe62 | 8 | public Memorable next(Memorable previous){
Memorable last = future.remove(0);
future.add(null);
if(last!=null){
int d=last.lastSucceed();
for(int i=d-1;i<future.size();i++){
if(future.get(i)==null){
if(i-1>0 && future.get(i-1)==last){
... |
45449d6e-6e99-44e6-808e-199613902fcc | 1 | public void testWithFieldAdded3() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
try {
test.withFieldAdded(null, 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
b02dfe66-3921-44e1-94a5-30b38acd8d82 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
d5fba9b2-01a3-4c81-b829-4277509d61fa | 6 | public String getTooltipExtraText(final Province current) {
final int id = current.getId();
if (!editor.Main.map.isLand(id))
return "";
final String rel = Text.getText(mapPanel.getModel().getHistString(id, "religion"));
if (rel.length() == 0)
return "";
... |
c761d72e-fadd-4ce3-998d-3e478ad57e34 | 1 | public static boolean isExponent(int c) {
return c == 'e' || c == 'E';
} |
f83b8e76-9a89-4bb4-aaad-8981dcf6f164 | 4 | final public void subArea(ParseArea area) throws ParseException {
ParseSubArea subArea = new ParseSubArea();
jj_consume_token(SUBAREA);
jj_consume_token(56);
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ATYPE:
case IDENT:
;
break;
default:... |
57818ab0-afcd-43a6-8b2d-aa51541eee64 | 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... |
7abca6dc-5efb-499d-b989-8de2b46878a5 | 3 | public void render(GameContainer gc, StateBasedGame sb, Graphics gr) {
int invx = 1000;
int invy = 200;
if(draw){
invbg.draw(invx, invy);
PlayerInventory plinv = ((Player)this.owner).getPD().getInv();
if(plinv.getEqweapon() != null){
plinv.getEqweapon().getIcon().draw(invx + 4, invy + 2);
}
if(... |
998d16e9-0084-4e2f-8b65-5cf489835977 | 3 | @Override
public List<Autor> listAll() {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Autor> autores = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LIST);
... |
46503785-d674-485e-9ff8-a02ddef2ddf3 | 3 | private void sendToNeighbours(Byte[] data) {
try {
lock.lock();
TreeSet<Byte> neighbours = networkTreeMap.get(deviceID);
if(neighbours != null){
for(Byte nb : neighbours) {
send(nb, data);
// System.out.println("Sending to neighbour: " + nb);
}
}
} catch (CallbackException e) {
e... |
657558ca-f596-4e20-825e-ce8251c4334a | 3 | public String getClassName()
{
if ( kind == FragKind.aligned || kind == FragKind.merged )
return style;
else if ( style != null )
return "inserted-"+style;
else
return "inserted";
} |
0c014d7b-24c1-46d1-adeb-80cf59e5da16 | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
101c75cd-fa4c-4028-8388-5b82848ddcee | 9 | @Override
public int[] sort(int[] target, boolean asc) {
int length = 0;
if (asc) {
for (int data : target) {
length++;
for (int i = 0; i < length; i++) {
if (data < target[i]) {
int headOfMoving = target[i];
target[i] = data;
int tmp;
for (++i; i < length; i++) {
... |
69800184-ccf2-4d27-a16f-b0d05df9c2c8 | 4 | public Boolean tileMatchesAvailable(){
/*
for (int i = 0; i < getX(); i++) {
for (int u = 0; u < getY(); u++) {
if (cells[i][u]!= 0) {
for (int direction = 0; direction < 4; direction++) {
int [] vector = getVector(direction);
int other = cells[i+vector[... |
5c5a2c7d-c081-4e2b-ac2e-10580e5a9f5d | 5 | private void saveContact() throws SQLException {
// TODO: When adding new and editing given contacts, check for doubles in the database. Give them visible IDs to make the difference when contacts really have the same names.
if (checkFieldsForSaving()) {
clsContactsDetails mContactD... |
94a51318-8100-4a97-b3d6-ba6544cdab24 | 8 | private void getData_with_index(ByteBuffer buf, final int index, OnDataListener dataListener) throws SQLException {
int offset = index;
final int idx[] = new int[6];
getIndex(buf, offset * 10, idx);
int wordid = -1;
if ((idx[3] == 0) && ((idx[5] - idx[1]) > 0)) {
//word
wordid = dataListener.... |
8736aeb9-5d7d-4d90-a06b-5cff9ec07b5c | 3 | edge moveUpRight()
{
edge f = this;
while ((null != f) && ( f.tail.leftEdge != f))
f = f.tail.parentEdge;
//go up the tree until f is a leftEdge
if ( null == f )
return f; //triggered at end of search
else
return(f.tail.rightEdge);
//and then go right
} |
e58cb04c-cd58-42c6-9944-b6b64b2cf634 | 6 | public void run() {
LevelLoader loader = new LevelLoader(this, "arena.svg");
loader.loadObjects();
addPhysicsObjects();
while (true) {
lastFrame = System.currentTimeMillis();
try {
Thread.sleep(SLEEP_TIME);
} catch (InterruptedException e) {
System.err.println("Failed to sleep in Model loop. ... |
be1e034d-dc0e-4bb7-b6ab-42275f206e26 | 6 | public void choice(int selection, GameGrid grid) {
switch (selection) {
case 1:
setGridSize(grid);
break;
case 2:
setAlivecells(grid);
break;
case 3:
setRandomCellsAlive(grid);
break;
case 4:
getCurrentSetup(grid);
break;
case 5:
startGame();
break;
case 6:
endGame();... |
cee37086-e235-45e6-a26b-74557340fb2a | 3 | public List<User> getFollowers(String userEmail)
{
initConnection();
List<User> followerList = new ArrayList<User>();
String preparedString = null;
PreparedStatement preparedQuery = null;
try
{
//Prepare Statement - Get users that are following currently logged-in user ("Followers")
preparedStrin... |
3f92b329-2ea0-4e02-aaa4-205b289a9dbd | 2 | private void initMessage() throws InvalidDataException {
if( code == CloseFrame.NOCODE ) {
reason = Charsetfunctions.stringUtf8( super.getPayloadData() );
} else {
ByteBuffer b = super.getPayloadData();
int mark = b.position();// because stringUtf8 also creates a mark
try {
b.position( b.position() ... |
95fb7e04-d2df-4953-863f-d359cf59e732 | 4 | public Map<String, UUID> call() throws Exception {
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
int requests = (int) Math.ceil(names.size() / PROFILES_PER_REQUEST);
for (int i = 0; i < requests; i++) {
HttpURLConnection connection = createConnection();
String ... |
bd654327-2310-4542-8c30-d8836571736f | 5 | mainWindow(){
int i,j,r;
JButton titleScreen=new JButton(new ImageIcon(getClass().getResource("TitleScreen.jpg")));
this.ventana.setSize(700, 485);
panel.setLayout(null);
titleScreen.setBounds(0, 0, 700, 485);
panel.add(titleScreen);
titleScreen.addActionListener(this);
this.ventana.getContentPane().add... |
c80042b3-cdff-45c3-b51f-7eb1012c6829 | 0 | public void driver() {
System.out.println("audo drive");
} |
68cfce6c-3201-4acd-92c5-f38f9b5632ec | 2 | public void run() throws IOException {
System.out.println("started processing " + dirName);
//all transcripts from ensembl, sorted
getAllTranscripts();
Collections.sort(allTranscr);
trSize = allTranscr.size(); //number of transcripts
//all files to use
ArrayList... |
6a2cce35-accb-4dd3-95d7-b3f4dd720d31 | 0 | public Tea() {
this.setName("Coffee");
this.setPrice(new BigDecimal(15));
} |
41ee9e62-9570-402c-82c8-aaa0239278cf | 4 | public People(int peopleCount) {
people = new Person[peopleCount];
viruses = new Viruses();
for (int i = 0; i < peopleCount; i++) {
int x = 0, y = 0;
boolean keepGoing = true;
while (keepGoing) {
x = getRandomInRange(0, GamePanel.WIDTH - Person.RADIUS*2);
y = getRandomInRange(0, GamePanel.HEIGHT ... |
2685d3d3-0f2f-4473-a2f7-20274244811e | 5 | private static int addValue(String line, PriorityQueue<Integer> lowestH, PriorityQueue<Integer> highestH) {
int val = Integer.parseInt(line);
long mid = highestH.isEmpty() ? Long.MIN_VALUE : highestH.peek();
// add
if( val > mid)
highestH.add(val);
else
lo... |
95dddd9b-5776-41e8-ba6e-4550e593c4fd | 7 | @Override
public boolean handle(Request r, Response resp) {
String templatePath = Profile.getInstance().getTemplatePathFor(r, TEMPLATE_NAME);
// load the template
Templator tr = new Templator();
Template t;
try {
t = tr.newTemplate(templatePath);
} catch (FileNotFoundException e) {
resp.setBody... |
43ca0423-7a28-40bd-af4c-3ce853574dd6 | 3 | public void setLivingAnimations(EntityLiving var1, float var2, float var3, float var4) {
EntityWolf var5 = (EntityWolf)var1;
if(var5.isWolfAngry()) {
this.wolfTail.rotateAngleY = 0.0F;
} else {
this.wolfTail.rotateAngleY = MathHelper.cos(var2 * 0.6662F) * 1.4F * var3;
}
... |
63f5ee57-b0c3-4933-9d85-13c16b846faa | 1 | private StockStorage() {
try {
File fXmlFile = new File(fileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(fXmlFile);
doc.getDocumentElemen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.