method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4fd363ef-2d19-4b02-b0a0-efe85fea4a6e | 8 | public boolean placeToken(int _column)
{
if(checkIfValidColumn(_column) == true)
{
int win;
for (int i = 0; i < row; i ++)
{
if (i == row - 1)
{
gameGrid[i][_column - 1] = currentPlayer;
win = checkForAWinner();
notifyOfGameChange(i, _column);
if (win != 0)
{
... |
7afb8247-0624-4250-ae06-d1f82954dc8e | 5 | public static void populateFromMap(Object obj, Map<String, Object> properties,
Map<String, Method> setters) throws IllegalAccessException,
InvocationTargetException {
if (obj == null || setters == null || setters.isEmpty()) {
return;
}
... |
25a72a2d-b628-4486-b05c-8241880b5e32 | 3 | @Override
public void render() {
GameActor a = Application.get().getLogic().getActor(Application.get().getLogic().getGame().getBaseID());
PhysicsComponent pc = null;
if(a != null) {
pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
}
if(pc != nul... |
76f0fd63-69fb-4c70-862c-fb782737ee9e | 3 | protected CycList substituteForBackquote(CycList messageCycList,
Timer timeout)
throws IOException, CycApiException {
if (messageCycList.treeContains(CycObjectFactory.backquote)) {
CycList substituteCycList = new CycList();
substituteCycList.add(CycObjectFactory.makeCycSymbol("read-f... |
ab19ad43-322e-4499-b0e1-02fa849f458a | 0 | public void setjButtonNew(JButton jButtonNew) {
this.jButtonNew = jButtonNew;
} |
1fde4490-ef33-483d-99e0-ed007f3da3b2 | 9 | private QueryPart parseRestrictions(String rql, AtomicInteger pos) {
ComplexPart part = new ComplexPart();
rql = rql.trim();
boolean isString = false; //if true, we are dealing with a string
boolean isMethodWithParenthesis = false; //if true, it is not a sub expression
char ch... |
22a111df-dec5-40bb-96e2-934aff30629b | 0 | public UnitProductionRemover() {
} |
67141f6d-f3ae-409f-8006-cb0a78eadad1 | 2 | public static String[] parseAka(String data) {
Jmdb.log.debug("Parsing movie AKAs");
Matcher matcher = akaPattern.matcher(data);
String akas;
String[] aka = null;
if (matcher.find()) {
akas = htmlEntityDecode(matcher.group(1).trim());
... |
2685d881-7b70-459c-8a57-9eae62431dd0 | 2 | public int getAttributeSize() {
int size = 2; /* attribute count */
if (unknownAttributes != null) {
Iterator i = unknownAttributes.values().iterator();
while (i.hasNext())
size += 2 + 4 + ((byte[]) i.next()).length;
}
return size;
} |
6865c93d-20f6-438f-b129-f6d89daf1f15 | 0 | void showErrorMessage(String message) {
errorMessage.setVisible(true);
errorMessage.setText(message);
} |
be670709-bae4-4f67-b002-386775bb1952 | 9 | @Override
public boolean equals(Object obj){
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
PieceLocation other = (PieceLocation)obj;
if (this.location == null){
if (other.location != null) return false;
} else if (!this.location.equa... |
2790afc5-08a7-4e43-a005-74ca60c32ee8 | 8 | public static int countNeighbours(long world, int col, int row) {
int c = 0;
if (getCell(world, col - 1, row - 1) == true) {
c += 1;
}
if (getCell(world, col, row - 1) == true) {
c += 1;
}
if (getCell(world, col + 1, row - 1) == true) {
c += 1;
}
if (getCell(world, col - 1, row) == true) {
... |
f781a87f-964c-4e3d-8dc8-65ef90b6873f | 7 | private boolean isClassBox(String owner) {
if (!owner.startsWith("java/lang/")) {
return false;
}
String className = owner.substring("java/lang/".length());
return (className.equals("Integer") ||
className.equals("Double") ||
... |
e3ae934c-616d-420a-92c0-f7e31fb73e77 | 0 | public Worker () {
//initial settings
isInputActive = true;
this.keyboard = new BufferedReader(new InputStreamReader(System.in));
System.out.println(MSG_WELCOME);
//start
this.lifeCycle();
} |
ad883029-fc40-4136-b779-c8e18b9e1b8a | 4 | public static int listCompare(ArrayList<Double> l1, ArrayList<Double> l2){
int size = l1.size();
int i;
double[] diff = new double[size];
for(i = 0; i < size; i++){
Double d1 = l1.get(i);
Double d2 = l2.get(i);
if(d1 - d2 > epsilon){
... |
551e0ef1-23db-4fee-bc2d-0ec8483eaa37 | 9 | public void drawPath(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
List<String> path = new ArrayList<>();
if (player.isSelected()) {
Field mouseOverField = null;
for (int i = 0; i < hexMap.length; i++) {
for (int j = 0; j < hexMap[i].length; j++) {
if (hexM... |
5db09805-bbe5-4c1d-b991-694c9cd58ef7 | 1 | public static void deleteElement(ElementField element) {
if (element != null) {
_elements_sprite.remove(element);
}
} |
882bf316-bfcb-4cab-adfc-7759fa9b0946 | 1 | public ArrayList<Student> students(ResultSet rs) throws Exception {
DBConnector db = new DBConnector();
ArrayList<Student> data = new ArrayList<>();
while (rs.next()) {
data.add(new Student(db.getPerson(rs.getInt("personid"))));
}
return data;
} |
d3fe6c2c-207c-48d9-a2c7-208d6f6b738f | 5 | public Object getValueAt(int row, int column) {
try {
Class c = rows.get(row).getClass();
BeanInfo beanInfo = Introspector.getBeanInfo(c, Object.class);
PropertyDescriptor pd = beanInfo.getPropertyDescriptors()[column];
Method m = pd.get... |
a38b720e-6ff8-4a5e-a7ec-ae75f51e9e3d | 5 | @Override
public LevelData getData() throws LevelIOException
{
String leveltxt = "";
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
//odd: the Object param of getContents is not currently used
Transferable contents = clipboard.getContents(null);
b... |
51bdb0ef-7cdc-4267-a49a-ef1d272b9dab | 2 | @Override
public T next() {
if (!mNextValid) {
if (!hasNext()) {
throw new NoSuchElementException();
}
}
mNextValid = false;
return mNext;
} |
ac1d98f7-cd5d-4045-90a9-b4278e8d01f9 | 7 | public void gameLoop() {
//Main game Loop of the game
boolean pieceFree = true;
while (true) {
if (!isSpawnFree()) {
System.out.println("\n\n\n\n GAME OVER \n\n\n");
this.grid.fireGameOver();
break;
} else {
... |
91b942ae-8077-4ca8-a2bc-bb34b00bf071 | 4 | public void setDialogButton(String[] buttons){
dialogButtonsPanel.removeAll();
dialogButtonsPanel.add(dialogFiller);
for(String buttonName : buttons){
if(buttonName.equals("ok")){
dialogButtonsPanel.add(okButton);
}
else if(buttonName.... |
8d9f6393-2d45-4667-bc54-a1324f21b4f9 | 2 | public User getUserByEmail(String email) {
try {
String sql = "select * from user where email=" + email;
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()) {
User user = new User();
user.setUserId(Integer.parseInt(rs.getString("user_id")));
user.setE... |
67d2fda1-6975-48c3-aa6c-42bff48bbf81 | 8 | public boolean has(Player player, String node) {
try {
if (vaultPerms != null) {
return vaultPerms.has(player, node);
} else if (nijPerms != null) {
return nijPerms.getHandler().has(player, node);
}
// System.out.println("no perm: checking superperm for " + player.getName() + ": " + node);
// Sys... |
6345042c-9799-404d-8c28-037e8c3a949c | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Customer other = (Customer) obj;
if (customerID == null) {
if (other.customerID != null)
return false;
} else if (!customerID.equals(oth... |
5234d916-3903-45cb-948f-b86e20b9c74c | 4 | @Override
public boolean activate() {
return (!Inventory.contains(Constants.BEAR_FUR)
&& !Bank.isOpen()
&& !Constants.BURTHOPE_BANK_AREA.contains(Players.getLocal())
&& !Constants.BEAR_AREA.contains(Players.getLocal())
&& !Constants.ESCAPE_AREA.contains(Players.getLocal()));
... |
7b394928-2bb9-449f-9f08-39ba1afeeec9 | 1 | @Override
public void removeObserver(IObserver observer) {
int index = this.observers.indexOf(observer);
if (index >= 0) {
this.observers.remove(index);
}
} |
699e644f-d73c-464b-b371-43707bbe01c0 | 5 | @Override
public void unsetResource(ResourceType resource) {
Player player = presenter.getClientModel().getServerModel().getPlayerByID(presenter.getPlayerInfo().getID());
switch(resource.name().toLowerCase()) {
case "brick":
this.brickState = 0;
this.desiredBrick = 0;
this.offeredBrick = 0;
this.... |
16dd5c10-ca1e-4a4a-9d2f-8fe57c25ea91 | 7 | public Imagen traslacion(Imagen imgFuente, double factX, double factY) {
Imagen imgResultado = new Imagen();
imgResultado = imgFuente.clone();
short[][] matrizResultado = new short[imgFuente.getN()][imgFuente.getM()];
short[][] matrizFuente = imgFuente.getMatrizGris();
... |
ee606cc5-5919-49bb-bd42-b278e8fc2150 | 5 | public SlideShow parse(String aPathName) {
if (Debug.parser)
System.out.println("xmlPath"+aPathName);
xmlPath = aPathName;
xmlPath = xmlPath.replace('\\', '/');
// get schema and xml files
File inputFile = new File(aPathName);
if (!inputFile.exists()) {
System.out.println("Parser error: passed file d... |
364395bc-e9dc-430f-8690-93a026c171a0 | 0 | public final boolean isDefault() {
return this.equals(defaultFlags);
} |
d99268e0-85d9-4985-ab6a-426d8273b898 | 2 | private void checkEnoughCapacity(int number) {
// if (array.length - currentSize < number) {
// expandVectorCapacityBy(number - array.length + currentSize);
// }
if (array.length - currentSize < number) {
changeVectorCapacityBy(array.length);
} else if (currentSize < array.length / 4) {
changeVectorCapa... |
1f152717-3c61-4045-9a8f-7d893eae0eea | 0 | public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
} |
365c7c84-ef25-4289-9a7a-4c4293deeae4 | 5 | private ItemStack getResult(ArrayList<String> holder){
ItemStack fail = new ItemStack(Material.SKULL);
ItemStack dish = null;
if(!this.recipeSpiceyChicken(holder,fail).isSimilar(fail)){
return this.recipeSpiceyChicken(holder,fail);
}
if(!this.recipeSeasonedChicken(holder,fail).isSimilar(fail)){
return this.r... |
820d4c46-f0b7-4281-96e8-034a2796c783 | 1 | public void makeOpAssign(int operatorIndex) {
setOperatorIndex(operatorIndex);
if (subExpressions[1] instanceof NopOperator)
subExpressions[1].type = Type.tUnknown;
opAssign = true;
} |
f6ddbe2c-73c0-4f40-a5d4-2935e4c94ac2 | 5 | public boolean movable(int x,int y,int xOrig, int yOrig){
if(thePlayer.getHitPoints() <= 0){
return false;
}
/* not movable, out of boundary*/
if (!inBounds(x, y))
return false;
//player isn't movable, start attack for player
if(floor[x][y] instanceof Monster){
/*if(floor[xOrig][yOrig... |
d5d331a4-55e6-4d19-9233-340e22ff97db | 9 | @Override
protected void CustomRender(GameContainer gc, Graphics g) throws SlickException {
g.drawImage(fond, Ctes.CARACS_X_FOND, Ctes.CARACS_Y_FOND);
afficheClasse(perso, g);
g.drawString("Niveau " +perso.getNiveau(), Ctes.CARACS_X_NIVEAU, Ctes.CARACS_Y_NIVEAU);
if (perso.getNiveau(... |
35582307-53ca-4d9d-a038-f7b294774447 | 2 | protected void cascadingCut(Fibonaccinode y) {
Fibonaccinode z = y.parent;
if (z != null) {
if (!y.mark) {
//merkataan solmu
y.mark = true;
} else {
cut(y, z);
cascadingCut(z);
}
}
} |
02c74664-7858-49a8-8b96-89a8a0a58f11 | 6 | @Override
public void selectCourses(List<Integer> mainCourseList, List<Integer> additionalCourseList, int userId) throws SQLException {
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connect =... |
ed05a570-e82c-4473-9948-1ca80ad92d98 | 2 | public boolean equals(Node other) {
return other != null && x == other.getX() && y == other.getY();
} |
793199cd-7c77-491f-b149-dc0efc87ee2e | 7 | private void zoomOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutButtonActionPerformed
diagramPanel.getScaleRatio()[0] -= 0.25;
diagramPanel.getScaleRatio()[1] -= 0.25;
diagramPanel.getScaleRatio()[0] = Math.max(0.3, getDiagramPanel().getScaleRatio()[0]);
... |
30c9a66f-dde7-48b0-8ec6-944edbeacdac | 5 | private void getNextPosition() {
// movement
if (left) {
dx -= moveSpeed;
if (dx < -maxSpeed) {
dx = -maxSpeed;
}
} else if (right) {
dx += moveSpeed;
if (dx > maxSpeed) {
dx = maxSpeed;
}
}
// falling
if (falling) {
dy += fallSpeed;
}
} |
86940cd1-abc2-4039-89ba-2624956c431a | 4 | private static String convertToHex(byte[] data) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9)) {
... |
de892be7-dec0-410a-8cd3-b2ed71b47417 | 2 | public static ArrayList<Kill> compaireEntityLoss(ArrayList<Kill> Kills,
String name) {
ArrayList<Kill> output = new ArrayList<Kill>();
for (Kill k : Kills) {
if (k.getVictim().findAttribute(name)) {
output.add(k);
}
}
return output;
} |
fe7cc4c2-e217-4d75-a1ef-eb4d4651a55a | 6 | void permute(int size) {
int M = size;
int poped = 0;
Stack<Integer> s = new Stack<Integer>();
s.push(0);
while (!s.empty()) {
int top = s.peek();
int i = 0;
for (i = 1; i <= M; ++i) {
if (find(top, i))
conti... |
3e76e9f7-1bdc-4aac-85c5-d7c8aebfae81 | 9 | private void handleLineFragmentInDefaultState(String line) throws IOException {
// System.out.println("Handling line fragment: state=" + parsingState
// + ", vbLevel=" + verbatimMode
// + ", iLevel=" + indentLevel
// + ", line=" + line
// ... |
cb0ebcca-72b0-414b-bed0-191b9c544c61 | 3 | private void btnEditarClienteSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarClienteSalvarActionPerformed
try {
if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) {
carregaObjeto();
if (dao.Salvar(cl... |
f605345e-0ee5-47ff-bfa5-cc7c951ba981 | 4 | @Override
public E get(E e) {
if(contains(e)){
setIn = new Node(e);
current = root;
while(current!=null){
if(setIn.object.compareTo(current.object)<0){
current = current.right;
}else if(setIn.object.compareTo(current.object)>0){
current = current.left;
}else{
return current.object... |
7e2e7fc0-a288-4880-9c2e-b1434c20665c | 5 | public void getAllRecursion() throws MalformedURLException{
List<String> thisList = new ArrayList<>();
for(String l: links){
thisList.add(l);
}
links.clear();
for(String l: thisList){
URL url = new URL(l);
if(finishedLinks.indexOf(l) == -1 && verifyLink(url)){
finishedLinks.add(l);
String we... |
db807988-7a8a-44a0-84b1-06aa6940c6c3 | 4 | public boolean move(List<Color> source, List<Color> dest) {
if (dest.size() == 0 || dest.contains(source.get(0))) {
// regular move
dest.add(source.remove(source.size() - 1));
return true;
} else if (dest.size() == 1 && !dest.contains(source.get(0))) {
// blot
// move opponent's piece to rail
this... |
9f642c97-2922-409b-8e01-8d42feb954ac | 8 | public final void addConnection(AbstractSelectableChannelConnection conn, Set<String> allowedEvents) throws ConnectionException {
if (conn.isClosed()) {
return;
}
final SelectableChannel channel = conn.getChannel();
try {
synchronized (guard) {
... |
c59dc60d-4d32-4705-b923-3857f05b8810 | 2 | public static <T extends DC> Similarity getPhiSim(Set<Pair<T,T>> done)
{ if(done!=null)
{ if(done.next!=null)
{ return new Similarity(done.a.fst().delta(done.a.snd()).simi().getValue()+(getPhiSim(done.next).getValue()));
}
else
{ return new Similarity(done.a.fst().delta(done.a.snd()).simi(... |
33612901-3a5c-4e92-94d3-cb28b90ddafc | 2 | @Override
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) {
try
{
if (e.getMessage() instanceof String)
{
Channels.write(ctx, e.getFuture(), ChannelBuffers.copiedBuffer(
(String) e.getMessage(), Charset.forName("UTF-8")));
}
else
{
EventResponse Message = (EventR... |
6ed1ed34-cd55-4c43-8cf3-ceb56f40cbf5 | 1 | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
processRequest(request, response);
} catch (Exception ex) {
Logger.getLogger(ControlJsp.class.getName()).log(Level.SEVERE, null, e... |
f41022f1-6669-443a-abe5-0038d904cc00 | 1 | public void reportFail(String service) throws RemoteException
{
//Splits service to get the server ID
String tmp[] = service.split("Acesso");
//Parse server ID to int
Integer pos = new Integer(Integer.parseInt(tmp[1]));
try
{
System.out.println("Client " + RemoteServer.getClientHost() + " reported dow... |
da51f569-0391-41a5-8273-b9fd9ac80bc5 | 5 | @Override
public void report(final SortedMap<String, Gauge> gauges, final SortedMap<String, Counter> counters, final SortedMap<String, Histogram> histograms,
final SortedMap<String, Meter> meters, final SortedMap<String, Timer> timers) {
final long timestampClock = clock.getTime();
final... |
c17319e0-e09a-4efb-b8fb-dce8a275935c | 1 | private void playAudio() {
try {
// Get everything set up for
// playback.
// Get the previously-saved data
// into a byte array object.
byte audioData[] = byteArrayOutputStream.toByteArray();
// Get an input stream on the
// byte array containing the data
InputStream byteArrayInputStream = ne... |
3554fa4a-c937-4285-8917-3ce3832484fc | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PeriodBrand other = (PeriodBrand) obj;
if (manufacture == null) {
if (other.manufacture != null)
return false;
} else if (!manufacture.e... |
1249ffdc-0e3c-432c-b357-703eeef8bad5 | 5 | public void startConnection() {
String host = plugin.getConfig().getString("hostname", "localhost");
String port = plugin.getConfig().getString("port", "3306");
String username = plugin.getConfig().getString("username", "root");
String password = plugin.getConfig().getString("password", ... |
14e0ff8b-7909-4717-95f5-2af1c13667c5 | 2 | @Override
@SuppressWarnings("SleepWhileInLoop")
public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
System.out.println("Producer interrupted");
return;
}
buffer.p... |
668116ab-f78a-45d3-ac37-7c8aac12034c | 3 | public void run()
{
init();
//For keeping track of nanoTime
long start;
long elapsed;
long wait;
while(running)
{
//The start time of the function call
start = System.nanoTime();
//update variables, create and draw images
update();
draw();
drawToScreen();
//set th... |
e3c0ac8f-72d8-49c5-974c-ae955b6558a6 | 3 | public long update(HTSMsg msg) {
HTSMsg chann = channels.get(((Number)msg.get(CHANNELID)).longValue());
for (String name : msg.keySet()){
if (Arrays.asList(HTSMsgFields).contains(name)){
chann.put(name, msg.get(name));
}
else if (name.equals("method")){
//This is normal, do nothing...
}
... |
dfdfbc10-233e-448e-9036-47d011ae84cf | 8 | public static void main(String[] args) throws Exception {
CommandLine cmd = null;
String host = ClientApp.DEFAULT_HOST;
int port = ClientApp.DEFAULT_PORT;
cmd = ClientApp.parseArgs( args );
if( cmd != null ) {
if ( cmd.hasOption("host") ) {
host = cmd.getOptionValue("host");
}
if... |
add449e6-b255-48af-b8e0-e9f1cb36b009 | 4 | private boolean checkOutofBounds(Direction dir, int row, int col) {
if(dir == Direction.LEFT){
return col <0;
}
else if (dir == Direction.RIGHT){
return col> COLS - 1;
}
else if(dir == Direction.UP){
return row <0;
}
else if(dir == Direction.DOWN){
return row > ROWS - 1;
}
return false;
... |
742bd10b-e644-4072-9ba5-0e0ae2be8035 | 1 | private void checkfs() {
if (fsm != null) {
fsm.check();
}
} |
101f4258-5cc3-40f6-a325-db63080b35ac | 4 | private Face connectHalfEdges (
HalfEdge hedgePrev, HalfEdge hedge)
{
Face discardedFace = null;
if (hedgePrev.oppositeFace() == hedge.oppositeFace())
{ // then there is a redundant edge that we can get rid off
Face oppFace = hedge.oppositeFace();
HalfEdge hedgeOpp;
if (hedgeP... |
f6a80fa3-d741-4adb-a294-da9e055af3b5 | 8 | private void processPhil() {
ArrayList<String> line = new ArrayList<String>();
int indent = _firstLine ? _indent + _parindent : _indent;
for (String word : _wordLine) {
if (word == null || word.matches("\\s")
|| word.matches("\\n")) {
continue;
... |
9122eba4-8e6a-456d-94ae-f1bebfb4bcf7 | 6 | public void gen_for_controller(SemanticRec controllerRec, SemanticRec forDirection) {
boolean increment = false;
//determine whether or not to increment or decrement
switch (forDirection.getRecType()) {
case FOR_DIRECTION:
if (forDirection.getDatum(0).equalsIgnoreCase(TokenTy... |
7046b6cd-382b-4615-a0f5-73fa13c75dba | 9 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if(cmd.getName().equalsIgnoreCase("delowner")){
if(args.length != 2){
sender.sendMessage("/delowner <ChannelN... |
0c8735fa-b962-4f7a-a5dc-f7ade44e3766 | 2 | public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new SecurityManager());
}
String name = "Compute";
try {
Registry registry = LocateRegistry.getRegistry(args[0]);
Compute comp = (Compute) re... |
3795c60e-d995-418a-8935-8f1528873cc5 | 4 | public String Listen(String valide, String stop, int time){
TextToSpeech tts = new TextToSpeech();
Microphone mic = new Microphone(AudioFileFormat.Type.WAVE);
while (true)
{
try{
Thread.sleep(2000);
tts.playSynth("Please, Speak now...");
Thread.sleep(50);
mic.open();
mic.captureAudioToFile(f... |
b85bfceb-d72d-4531-87f7-2d7873f716c1 | 5 | public Hash get(long hash) throws IOException {
processQueue();
Reference<Hash> ref = map.get(hash);
Hash h = null;
if (ref != null) {
h = ref.get();
}
if (h != null) {
return h;
}
Hash[] hashes = fileStore.readHash(hash);
if (hashes == null) {
System.out.println("Readback failed, map contain... |
dfee53b9-5c97-42f7-81c1-f327a9d7532b | 7 | @EventHandler
public void WitherRegeneration(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("Wither.Re... |
3fd53868-d850-4a31-b79d-dd8ffdb0c2d3 | 5 | public static void main(String[] args) {
ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
List<Future<Integer>> results = new ArrayList<>();
for (int i = 0; i < 5; i++) {
Future<Integer> submit =
newCachedThreadPool.submit(new MyCallable(5 + i));
results.add(submit);
}
for (I... |
411a4452-8299-4672-a2c2-58798fcbffbc | 5 | public void sendResult(ParisModel paris) {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
String htmlBody = "<div style='background-color:#000000; color:#FFFFFF; padding:10px; font-size:16px;'>";
htmlBody += "<h1 style='text-align:center;... |
a718fd88-75a5-4747-a130-536914ba1ff4 | 9 | @Override
public void izvrsiAnalizu() {
// konstante u skladu sa formulama
int n = stepenMultiprogramiranja;
int k = brojKorisnickihDiskova + BROJ_SISTEMSKIH_DISKOVA + 1;
// izračunato Gordon-Njuelovom metodom i hardkodovano za ovaj konkretan zadatak
double[] x = { 1, 0.36, 0.45, 3.4 / brojKorisnickihDisk... |
4a4ec7f2-1815-4a6c-855e-5c7d29d57bef | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final PackageCoverageStatisticsKey other = (PackageCoverageStatisticsKey) obj;
if (keyName == null) {
if (other.keyName != null)
return fa... |
70d7c0bd-39b0-4f5f-9f88-670fc9b30353 | 9 | static final public void FormParList() throws ParseException {
Token token;
Symbol sy;
formPar();
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COLON:
case VOID:
case INT:
case BOOL:
case BYREF:
;
break;
default:
jj... |
e4197919-c5d0-45cb-b932-6c489bad9c3e | 5 | public boolean laggTillAnvandareFranSkolDB(String anvandarnamnIn, String losenordIn){
ArrayList<String> dataFranPersondatabas = new ArrayList<String>();
try{
// H�mtar data om personen fr�n persondatabasen.
connection2 = getConnection2();
preparedStatement = connection2.prepareStatement("SELECT * FROM pers... |
c2a117c7-0a16-42bd-b99f-3f25c145fd18 | 4 | public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (semiMajorAxis < 0) {
throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative");
}
if (semiMinorAxis < 0) {
throw new IllegalArgumentException("ellipse s... |
b12a7639-1fbe-4593-b9ac-83f6f9f94ccb | 2 | public void paint1(Graphics g) {
g.setColor(Color.YELLOW);
g.setFont(new Font("default", Font.BOLD, 20));
g.drawImage(principal.getImagenI(), principal.getPosX(), principal.getPosY(),this);
g.drawImage(obs1.getImagenI(),obs1.getPosX(), obs1.getPosY(),this);
for(int i = ... |
315f7b58-b0cd-4637-9753-70582c69ca71 | 3 | protected Rectangle getObjectRectangle()
{
boolean found = false;
Rectangle r = new Rectangle(0, 0, 0, 0);
for (LevelItem i : objs)
{
if(!(i instanceof NSMBObject))
continue;
NSMBObject o = (NSMBObject) i;
if (fou... |
1a94a849-d414-4bed-a55c-ba252b3f7c5c | 2 | protected void writeError(String toWrite, boolean severe) {
if (toWrite != null) {
if (severe) {
this.log.severe(this.PREFIX + this.DATABASE_PREFIX + toWrite);
} else {
this.log.warning(this.PREFIX + this.DATABASE_PREFIX + toWrite);
}
}
} |
61bcd31f-8d34-4ddb-a0d6-8e475f9a6409 | 5 | @Override
public String getRandomQuestion() {
if (size() > 0) {
randomWord();
int randomIndex;
String randomWordText;
int index;
String randomWordTextFirst = "";
if (randomWordArray == 0) {
randomIndex = random.nextInt(... |
0a30ca1c-dbf8-46b3-9b6e-c2c9395fd50f | 4 | public void registerAllMasterFiles() {
DataGridResource res = (DataGridResource) Sim_system
.get_entity(super.resourceID_);
AbstractRC rc = null;
if (res.hasLocalRC()) {
rc = res.getLocalRC();
} else {
rc = (AbstractRC) Sim_system.get_entity(super.... |
f15fc07f-7cfa-47b2-9ca1-f10cf1511b2c | 5 | public static void registerClient(final MapleClient c) {
if (c.finishLogin() == 0) {
c.getSession().write(LoginPacket.getAuthSuccessRequest(c));
c.setIdleTask(TimerManager.getInstance().schedule(new Runnable() {
public void run() {
c.getSession().close();
}
}, 10 * 60 * 10000));
} else {
... |
900f09a7-8ded-479f-a457-f764d26d3fd1 | 6 | void updatePair( double[][] A, edge nearEdge, edge farEdge, node v,
node root, double dcoeff, direction d )
{
edge sib;
//the various cases refer to where the new vertex has
//been inserted, in relation to the edge nearEdge
switch( d )
{
case UP:
//this case is called when v has... |
dbd2ac62-eb7f-42f1-b097-b3a427182060 | 6 | public void csNaturalDisasters(Random random, ChangeSet cs, int probability) {
if (Utils.randomInt(logger, "check for natural disasters", random, 100) < probability) {
int size = getNumberOfSettlements();
if (size < 1) return;
// randomly select a colony to start with, then g... |
0025c6bf-50d9-40ca-862c-507f6b9d8331 | 1 | public void addElement(AstronomicalObject element) {
if (!elements.contains(element)) {
elements.add(element);
log.info("{} added to {} system", element.getName(), name);
} else
log.warn("{} not added to {} system. Object with same name already exists", element.getNam... |
9313fb5e-7b00-4a0d-811d-c559029bca5d | 4 | @Override
public Match findMatchById(Long id) {
checkDataSource();
if (id == null) {
throw new IllegalArgumentException("id is null");
}
try (Connection conn = dataSource.getConnection();
PreparedStatement st = conn.prepareStatement("SELECT id, hometeamid,... |
f9c034ee-f903-4e9e-bd49-8434c08b98cb | 0 | public static Tags fromString(String string) {
return TO_ENUM.get(string.toUpperCase());
} |
68c2a6ed-ef86-4bcb-b6a7-0e1d9bd3352d | 2 | @Override
public void collideWith(Element e) {
if (e instanceof Player) {
final Player playerEntered = (Player) e;
if (!player.equals(playerEntered)) {
player.setPlayerStatus(PlayerStatus.LOST);
playerEntered.setPlayerStatus(PlayerStatus.WON);
getGrid().getEventManager().sendEvent(new Event(Ev... |
28091ead-994f-430c-b155-90c7daf9b3db | 5 | public int getMossaMinNDMax(){
int ndmin = 12;
if(desmosse!=null)
//Trovo il minimo tra i vmax
for(DescrittoreMossa dm : desmosse)
if(dm!=null && dm.getNdmaxEnemyForest()<ndmin)
ndmin = dm.getNdmaxEnemyForest();
//Restituisco il vmin se è valido
return ndmin!=12?ndmin:-1;
} |
7462a2eb-359d-4694-bd8c-d3c21e412442 | 1 | @Override
public void render(Art art, Level level)
{
frame++;
frame %= 14;
if (invTimer % 10 == 0)
{
art.drawTile(art.spriteSheet, getX(), getY(), 6 + frame / 2, 8);
art.drawTile(art.spriteSheet, getX(), getY() + 8, 6 + frame / 2 + 32, 8);
}
} |
4a4a82c5-7a0b-495a-9b88-1e2f2e5d0fec | 9 | public boolean isMatched(String s) {
if (s == null) return false;
switch (this) {
case NONE: return s.isEmpty();
case STR: return !s.isEmpty();
case INT: return s.matches("\\d+");
case PRI: return s.matches(Priorite.REGEX);
case DAT: return Date.isMatched(s);
case HRE: return... |
fe4b173a-7611-41db-b5f8-dc636d5d6681 | 4 | @Override
public boolean hasNext() {
// TODO Auto-generated method stub
boolean currentRowHasTokens = this.rowTokens > 0;
boolean hasNext = false;
assert(!(currentRow > maxRowNumber));
if(currentRowHasTokens){
hasNext = true;
}else{
if(currentRow < maxRowNumber){
int checkedRow = 0;
int... |
6b6b5d3f-a1f3-4643-bb4e-fa345d283bb4 | 5 | @Override
public void buttonStateCheck(Input input) {
int mX = input.getMouseX();
int mY = input.getMouseY();
int farX = getX() + getStoredImage().getImage().getWidth();
int farY = getY() + getStoredImage().getImage().getHeight();
if (pointContains(getX(), mX, farX) && pointContains(getY(), mY, farY)) {
... |
f0177261-03fe-4c16-8896-f261ae35ff54 | 6 | @Override
public boolean shadow_hit(Ray ray, FloatRef tmin) {
if (!bbox.hit(ray))
return false;
double x1 = ray.getOrigin().getX();
double y1 = ray.getOrigin().getY();
double z1 = ray.getOrigin().getZ();
double d1 = ray.getDirection().getX();
double d2 =... |
c255b21f-0f6f-4153-8741-c7c5b68a8fcc | 4 | public static String getCharset(String page)
{
//
page = page.toLowerCase(Locale.getDefault());
int charsetIndex = page.indexOf("charset=");
Pattern pattern = Pattern.compile("[a-z0-9/-]{1}");
// 如果不存在charset=
if (charsetIndex < 0)
{
return "utf-8";
}
// 截取掉字符集前的所有字符
String indefiniteChar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.