method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
735349be-0491-443b-b9d5-28d066c55661 | 3 | static String getDataSource() {
Properties props = new Properties();
try {
props.load(new InputStreamReader(new FileInputStream("pos.properties"), "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} catch (FileNotFoundException e) {
throw new RuntimeE... |
d704f3cb-40d2-4c3c-84d2-dd832caadeb1 | 5 | public ArrayList<T> levelOrdertoArray(LBT<T> t) {
ArrayList<T> list;
list = new ArrayList<>();
int height=t.height();
for(int i=0;i<Math.pow(2, height)-2;i++){
list.add(null);
}
int i = 0;
ArrayQueue<BinaryTreeNode<T>> q = new ArrayQueue<>();
B... |
cc1d24c6-0b86-484f-954f-8ba5d81f58c3 | 6 | public static boolean combineObject(SynchronizedBlock synBlock,
StructuredBlock last) {
/* Is there another expression? */
if (!(last.outer instanceof SequentialBlock))
return false;
SequentialBlock sequBlock = (SequentialBlock) last.outer;
if (!(sequBlock.subBlocks[0] instanceof InstructionBlock))
r... |
d6dd4042-d152-4eaa-885f-9c0dc24a793e | 2 | private String calc(String input) {
//Person 2 put your implementation here
Random r = new Random();
char[] str = input.toCharArray();
char temp;
int rIndex;
for(int i = 0; i < input.length(); i++){
temp = str[i];
rIndex = r.nextInt(input.length());
str[i] = str[rIndex];
str[rIndex] = temp;
... |
3551e310-094f-4d99-93c7-a089f3e4b216 | 8 | public void setInstances(Instances inst) {
m_Instances = inst;
String [] attribNames = new String [m_Instances.numAttributes()];
for (int i = 0; i < attribNames.length; i++) {
String type = "";
switch (m_Instances.attribute(i).type()) {
case Attribute.NOMINAL:
type = "(Nom) ";
break;
... |
a75c258e-a793-49de-9fcc-3f8b334501da | 5 | @Override
public void update(long delta) {
double timeFactor = (delta) / Main.targetFrameDuration;
System.out.println(timeFactor);
// SPACE DOWN
if (Input.keyDown(32)) {
spaceDown = true;
progressSpeed += 0.05 * timeFactor;
} else {
if (spaceDown && releaseListener != null) {
releaseListener.... |
2668d2a5-bc4c-481c-b25b-e30c80eea59d | 9 | public static void main(String[] args) throws IOException {
Thread threads[] = new Thread[10];
Thread.State status[] = new Thread.State[10];
for(int i = 0; i <10; i++){
threads[i] = new Thread(new Calculator(i));
if(i%2 == 0){
threads[i].setPriority(Thread.MAX_PRIORITY);
}else{
threads[i].setPrio... |
836d089a-fe8c-48f8-9bb7-110ad80e55e7 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Triple)) return false;
Triple triple = (Triple) o;
if (first != null ? !first.equals(triple.first) : triple.first != null) return false;
return !(second != null ? !second.equals(tripl... |
568516cc-f16b-490b-9dba-aa3f6450edd9 | 8 | private void etsiSiirrot() {
paivitaTiedot();
for (int i = 0; i < 10; i++) { //etsii lailliset x-sijainnit
Muodostelma muod = putoava.kloonaa();
if (muod.getMuoto() == Muoto.nelio) {
// nelio-muoto aina samanlainen, ts. sillä ei ole kiertoja
siirra... |
b2d2270c-791d-4662-8e5d-321ec3a7bab1 | 7 | private void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
loadLevel.render(render);
player.render(render);
for (int i = 0; i < pixels.length; i++) {
pixels[i] = render.pixels[i];
}
Menu.score... |
bd70ebb9-bce0-403a-aaea-bbf238186d6b | 2 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onPlayerInteract (PlayerInteractEntityEvent event) {
Entity interactedEntity = event.getRightClicked();
if (interactedEntity instanceof Wolf) {
Wolf hound = (Wolf) inte... |
3f024782-7f22-473a-96c1-cac84071f56f | 2 | public void checkOval(){
if (ovalHeight <= HEIGHT && ovalWidth <= getWidth()){
resetOval();
}
} |
7871a3b2-c635-45a4-8fa9-1a9f5e56615c | 3 | private void initWinchPositionsList() {
try{
RecentLaunchSelections recent = RecentLaunchSelections.getRecentLaunchSelections();
winchPositions = DatabaseUtilities.DatabaseDataObjectUtilities.getWinchPositions();
List<WinchPosition> recentWinchPositions = recent.getRecentWinc... |
c14aefdf-e9cb-4dad-81e9-7d7397ba1c57 | 5 | public void actionPerformed(ActionEvent e){
if(e.getSource() == brushPicker){
for(int ind = 0; ind < brushes.length; ind++){
//Set Editing Brush type
if(brushPicker.getSelectedItem() == brushes[ind]){command = 401; bruush = ind+1; setGonzo(bruush); toggleControls(); break;}
}
fireucEvent();
command = 404; fi... |
86f4329c-337c-4c5e-8607-97a962bd78c8 | 5 | public void addData(TagAndURISubModel dictionary) throws Exception {
boolean alreadyExists = false;
for (int i = 0; i < datas.size() && !alreadyExists; i++) {
TagAndURISubModel item = datas.get(i);
if (item.getTag().equals(dictionary.getTag()) && item.getURI().equals(dictionary.getURI())) {
alreadyExists ... |
1a45d47c-eba6-43db-8d48-324472297a71 | 6 | public boolean insert(String s, State data) {
TrieNode current = root;
if (s.length() == 0) //For an empty character
{
if (!current.isMarker()) {
current.setMarker(true);
} else {
return false;
}
}
for ... |
8170c771-4dba-4318-a0db-8061a4f7fa0b | 5 | private boolean checkForStraight(List<Card> hand)
{
List<Card> newHand = new ArrayList<Card>();
int s = hand.size()-1;
int initValue = 0;
boolean flag = true;
do {
flag = true;
initValue = hand.get(s).getValue();
for (int i = 0 ; i < 5 ; i++)
{
if (hand.get(s-(i+1)).getValue() == initValue)
... |
f8df3083-a0b3-44ad-8bcf-f8c8d9a84c5b | 9 | public void emitEvent(EventObject event) {
int eventType = ((Integer) event.getSource()).intValue();
if (eventType == DataPortListener.DATA_PORT_FINISH_READING) {
System.out.println("Data port read event...\nData port read:");
ByteBuffer bb = dataPort.getReadBuffer();
// debugging
BufferUtil.debug(bb)... |
5b040b20-cabe-4cf5-9496-b27a183e0c1d | 7 | private boolean touchHorizontally(Line first, Line second) {
Point fEnd = first.getEnd();
Point sEnd = second.getEnd();
if (fEnd.getY() != sEnd.getY()) {
return false;
}
Point fStart = first.getStart();
Point sStart = second.getStart();
if ((fStart.... |
6cfa27c9-4e79-45ab-99f4-5b8664ba844d | 1 | private String getDescription() {
String desc = "@Update(" + this.getParsedSql().getOriginalExpression() + ")";
if(this.isReturnId()) {
desc = desc + ",@ReturnId()";
}
return desc;
} |
06e998e8-662f-439d-a272-12eadd282976 | 4 | @Override public ArrayList<Suunta> suunnat()
{
ArrayList<Suunta> suunnat = new ArrayList<Suunta>();
if(palikat[0].sijainti().y() != vertailupiste.y())
suunnat.add(palikat[0].sijainti().y() > vertailupiste.y() ? Suunta.ALAS : Suunta.YLOS);
if(palikat[0].sijainti... |
5b6f4ee7-fe22-49a7-a0ed-3cd47bcb2b48 | 6 | protected void cellDrawn(mxICanvas canvas, mxCellState state)
{
if (isFoldingEnabled() && canvas instanceof mxGraphics2DCanvas)
{
mxIGraphModel model = graph.getModel();
mxGraphics2DCanvas g2c = (mxGraphics2DCanvas) canvas;
Graphics2D g2 = g2c.getGraphics();
// Draws the collapse/expand icons
... |
fd9667f9-9e93-4008-bc4b-9810788a6b62 | 4 | protected void receiveQueryData(IRemoteCallObjectMetaData meta,
IRemoteCallObjectData data, final long callObjectId) throws Exception {
ExceptionList excl = new ExceptionList();
try {
//..execute handler
Object result = null;
if (!meta.getExecCommand().equalsIgnoreCase(ISession.KEEP... |
a3e21e24-d81a-4a13-a376-8c47a332a9b8 | 3 | public Map<String, String> returnMap() throws Exception {
Map<String, String> map = new HashMap<String,String>();
BufferedReader reader = new BufferedReader(new FileReader(this.fileName));
String line;
while ((line = reader.readLine()) != null) {
if (line.trim().length() == 0) {
continue;
}
if (lin... |
359db98c-ebf7-4913-a20e-b7d840698502 | 5 | static private boolean jj_3R_12() {
if (jj_scan_token(SEND)) return true;
if (jj_3R_18()) return true;
if (jj_scan_token(TO)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3_17()) {
jj_scanpos = xsp;
if (jj_3_18()) return true;
}
return false;
} |
28c18494-e6b6-493f-924d-16efb3518dd8 | 8 | public static String query(int table_id, String str, int start_index, int max_fetch) throws Exception
{
JSONObject result = new JSONObject();
JSONArray entry_list = new JSONArray();
Map temp = new LinkedHashMap();
int max_count,count;
int maxCount[] = new int[6];
Conn... |
5a43f4c6-759f-4d6e-806f-6153b8f946ca | 0 | public MultiPolygon add(Polygon polygon)
{
coordinates.add(polygon.getCoordinates());
return this;
} |
a0945642-c8bf-4282-8171-2bd345d751e8 | 6 | public static void main(String[] args) {
//TODO find out what the hell this thing was supposed to do
/*
String path = jPapaya.class.getProtectionDomain().getCodeSource().getLocation().getPath();
try {
String decodedPath = URLDecoder.decode(path, "UTF-8");
System.out.println(path);
System.out.printl... |
b764a35b-d133-4298-888f-9198b9b705f2 | 9 | final private boolean jj_3R_121() {
if (jj_scan_token(FOR)) return true;
if (jj_scan_token(LPAREN)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_192()) jj_scanpos = xsp;
if (jj_scan_token(SEMICOLON)) return true;
xsp = jj_scanpos;
if (jj_3R_193()) jj_scanpos = xsp;
if (jj_scan... |
39f5caa9-8bf9-444e-a870-bf0a1624efa0 | 6 | public static int fromDigit(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
} else if (c >= 'A' && c <= 'F') {
return c - 'A' + 10;
} else if (c >= 'a' && c <= 'f') {
return c - 'a' + 10;
} else
throw new IllegalArgumentException("Invalid hexadecimal dig... |
ebdbd9b1-2507-40eb-b12e-b3754d6905c1 | 5 | public boolean insert(DatabaseTableData data, Class<?> layout, boolean instant) {
Field[] publicFields = layout.getFields();
String fields = "(";
String values = "VALUES (";
for (Field field : publicFields) {
fields += field.getName() + ",";
try {
if (field.getType().isEnum()) {
values... |
02fe5d58-a477-4f10-a554-69f52aea6a29 | 2 | public void menuPrincipal() {
mostrar("Bienvenido al sistema de administracion remota de Bases de datos");
linea();
mostrar("Por favor, ingrese el nombre de la base de datos a consultar");
String db = entrada.nextLine();
while (db == null) {
mostrar("No se ha ingresado el nombre de la base de datos, intent... |
4c963a68-70f5-474d-9c3c-84d773cc9d21 | 2 | @Override
public boolean equals(Object o) {
if (o instanceof Vector2D) {
Vector2D p = (Vector2D) o;
double xD = p.x - x, yD = p.y - y;
return xD == 0 && yD == 0;
}
return false;
} |
0ad9be54-d6c1-437f-b4a4-0999ff51f238 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
int X = Main.DecodeInt();
int Y = Main.DecodeInt();
Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom);
if (Room == null)
{
return;
}
Main.Data.RoomUser.Id... |
024e4531-c623-4c4f-bc44-ef8c2f8c294c | 3 | public static Picture readPictureFromTriangles(String path) throws Exception {
List<Triangle> triangles = new ArrayList<Triangle>();
File file = new File(path);
System.out.println(file.getAbsolutePath());
// File file = new File("/home/arto/Popup-course/triangulation/testi.tr");
... |
5a25cd96-53a6-4f28-bfae-4210f5b888d6 | 8 | private void generatePositions() {
// rozměry
int X = lab.length + 1;
int Y = lab[0].length() + 1;
int tryNr = 0;
int x, y;
// pozice hráče a nepřátel
pos = new Coord[enemies + 1];
// nejprve pozice hráče na volném políčku
int x0 = 0, y0 = 0;
while (pos[0] == null) {
x0 = (int)(Math.rand... |
11ed3533-c00f-4fe7-9612-cf9df3264a88 | 2 | public static boolean isSkeletonWarriorGold (
SkeletonWarriorGold MMSkeletonWarriorGold) {
if (MMSkeletonWarriorGold instanceof Skeleton) {
Skeleton SkeletonWarriorGold = (Skeleton) MMSkeletonWarriorGold;
if (SkeletonWarriorGold.getEquipment().getChestplate()
... |
d7e411cb-389c-4fcb-9006-35481795002a | 8 | public void updateLists() {
// Listen clearen
boxitems.clear();
lastname.clear();
prename.clear();
table.clear();
// L�schdaten einlesen
zeile = 0;
BufferedReader br = null;
String line;
try {
System.out.println("*** Auschecken-Tabllen-Daten werden geladen ***");
br = new Buffere... |
0126feb2-463c-4b59-ae06-142fe5d5fe3e | 4 | public static Session getSession() throws HibernateException {
Session session = (Session) threadLocal.get();
if (session == null || !session.isOpen()) {
if (sessionFactory == null) {
rebuildSessionFactory();
}
session = (sessionFactory != null) ? sessionFactory.openSession()
: null;
thr... |
7663d955-0c67-4832-956d-7264ebae5594 | 9 | private void parentRank() {
// TODO Auto-generated method stub
long totalFitness = 0;
for(Chromasome chro : population){
totalFitness += chro.getFitness();
int index = 0;
while(true){
if(index + 1 > parents.size()){
rouletteTable.add(chro);
break;
}
else if(chro.getFitness() < paren... |
c55d8dab-1069-4a42-87d2-ef9021ba07b0 | 7 | public void changeDirection()
{
int x= 0, y= 0, d= 0, posX, posY;
boolean wall = true;
//Get current position on the board
posX = this.getHLocation();
posY = this.getVLocation();
while(wall) //Are you going to hit a wall?
{
d = r... |
85569b16-5c58-4ed6-ae1b-815c231ad233 | 3 | public boolean isEmptySpace() {
for(int i = 0; i < 9; i++) {
for(int j = 0; j < 9; j++) {
if(entries[i][j].getText().equals("")) {
System.out.println("isEmptySpace() returned false at i: " + i + " j: " + j);
return false;
}
}
}
return true;
} |
032d3e0f-4808-47ac-a676-5d7e88c01024 | 8 | private void pivot(int p, int q) {
// everything but row p and column q
for (int i = 0; i <= M; i++)
for (int j = 0; j <= M + N; j++)
if (i != p && j != q) a[i][j] -= a[p][j] * a[i][q] / a[p][q];
// zero out column q
for (int i = 0; i <= M; i++)
... |
cb63b591-3057-4768-9efe-a30729b14060 | 8 | private void checkCollisionBar(OperateShape ball, OperateShape bar) {
boolean isBallXBarRange = ball.getX() >= bar.getX() - bar.getWidthFromCenter()
&& ball.getX() <= bar.getX() + bar.getWidthFromCenter();
boolean isBallYBarRange = ball.getY() >= bar.getY() - bar.getHeightFromCenter()
&& ball.getY() <= bar.... |
08186ac2-6d03-49d1-b600-862f12ba2ffc | 9 | public static void main(String[] args) {
/*
* if the user has not specified just a URL then
* we don't even want to try to handle the request
*/
if (args.length != 1)
usage();
/*
* We setup a URL object to parse the hostname and
*/
URL url = new URL(args[0]);
/*
... |
be77c5bf-61ce-4661-bcd4-c42746b30453 | 0 | public void setCost(int cost) {
this.cost = cost;
} |
b0898792-824c-4ca8-9306-2c064618adbc | 0 | private void checkCollision(double x, double y) {
int leftTile = (int) getBounds(x, y).getMinX() >> 4;
int rightTile = (int) (getBounds(x, y).getMaxX() - 1) >> 4;
int topTile = (int) getBounds(x, y).getMinY() >> 4;
int bottomTile = (int) (getBounds(x, y).getMaxY() - 1) >> 4;
topLeft = level.getTile(leftTile,... |
19ed3cc0-812e-46b8-bf30-44b1658b5c80 | 4 | private void displayHelp(String helpType) {
String helpText = null;
switch (helpType) {
case HelpMenuView.OBJECTIVE: helpText =
"\t The objective of this game is to try and find \n\n"
+ "\tthe match for each cards by memorizing them";
break;
... |
42dfd496-c570-4fe2-a7fb-15c6ef7a9a57 | 7 | public void bind(SocketAddress address, IoHandler handler,
IoServiceConfig config) throws IOException {
if (handler == null)
throw new NullPointerException("handler");
if (config == null) {
config = getDefaultConfig();
}
if (address != null && !(addre... |
1160e8ca-b5e8-4ecd-be36-7cb58b5f43fe | 0 | protected Transition initTransition(State from, State to)
{
return new MooreTransition(from, to, "");
} |
49e4b75a-98c5-4c9d-b47a-03006fdb7050 | 0 | @Override
public Object clone() throws CloneNotSupportedException {
Student1 student1 = (Student1)super.clone();
student1.setT1((teacher)student1.getT1().clone());
return student1;
} |
5072cee7-450b-4c9f-9873-c255fa8888b2 | 9 | private void planForAgent(Agent agent)
{
TaskDispenser td = agent.td;
Node node = agent.node;
// Remove completed task from queue
if (agent.request != null) {
if (agent.request.requestBox.atField == agent.request.requestGoal) {
agent.request = null;
// System.err.println("Completed request");
... |
b2ba6179-1fde-42f3-bb9b-cd85eca53988 | 1 | private boolean jj_2_8(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_8(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(7, xla); }
} |
65bdba2e-06e7-45d2-9df2-84b70eea561a | 8 | public static ArrayList LexBFS(Graph G, Partition P){
ArrayList sigma = new ArrayList();
System.out.println();
System.out.println("STEP A: Let L be the one element ordered list (V)");
System.out.println("L => (" + P.toString() + ")\n");
System.out.println("STEP B: i 1 to " + G.cardV() + "\n");
int i = 1;... |
59f007c7-a62e-453a-bc71-151a3a102c05 | 2 | public boolean isSetMethodPresentFor(Field field) {
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
return item.getSetMethod() != null ? true : false;
}
return false;
} |
8ee82bba-e09f-4080-9617-b00ac2475eb2 | 8 | public static String caesarianShift(String code, int shift) {
char[] codeline = code.toCharArray();
String result = "";
for(int i = 0; i < codeline.length; i++) {
if(codeline[i] >= 'a' && codeline[i] <= 'z') {
if(codeline[i] + shift > 'z') codeline[i] = (char) (('a' -... |
eea1eba8-0e55-43db-948f-b82fa9955747 | 5 | public final void addSlider(BufferedImage i)
{
TButton slider;
if (i != null)
slider = new TButton(0, 0, i);
else
slider = new TButton(0, 0, 1, 1, "");
sliders.add(slider);
if (i == null)
setSliderImage(sliders.size() - 1, i);
int sWidth = slider.getWidthI();
int sHeigh... |
0301dca1-2ff1-468d-8ec9-4476f037ba62 | 4 | static long solve(int l, int prev, int acum) {
if (l == k)
return 1L;
if ((s - acum) > (k - l) * n)
return 0L;
if (dp[l][prev][acum] != -1L)
return dp[l][prev][acum];
long ans = 0;
int min = Math.min(n, s - acum - (k - l - 1) * n);
min = Math.max(min, prev + 1);
int max = Math.max(0, (s - acum) -... |
5638879e-8fb9-4a2f-8b40-98007e214e75 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (!(obj instanceof ElectricLocomotive))
return false;
ElectricLocomotive other = (ElectricLocomotive) obj;
if (batteryVolume != other.batteryVolume)
return false;
return true;
} |
3646b423-adca-488e-9941-25c7c382489b | 9 | public void move()
{
animation = (animation + 1) % 50;
x -= left? speed:0;
x += right? speed:0;
y -= up? speed:0;
y += down? speed:0;
if ( x < 0 )
x = 0;
if ( x + width > 800 )
x = 800 - width;
if ( y + height > 600 )
... |
453513cb-5848-4db7-9ce5-29eacbf47b6b | 3 | protected void createTradingInventories()
{
int rows = 4;
int rowsP1 = getAllowedGuiRows(p1);
int rowsP2 = getAllowedGuiRows(p2);
if (rowsP2 > rowsP1) {
if (plugin.yamlHandler.configYaml.getBoolean("use_biggest", true))
rows = rowsP2;
else {
rows = rowsP1;
}
}
... |
5c07551b-b8dc-4bd0-ad02-3d711ae338c2 | 0 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
} |
ab5a53fe-6830-4f53-91d8-a77f1580cfc7 | 1 | public void refreshNickname() {
AbstractTab tab = InputHandler.getActiveTab();
if (tab != null) {
String nick = tab.getServerTab().getConnection().getNick();
setText(nick);
}
} |
9e89c6ac-63a3-4505-ae7a-c5ae7cb47f07 | 4 | public void register(Object value) {
if (JSONzip.probe) {
int integer = find(value);
if (integer >= 0) {
JSONzip.log("\nDuplicate key " + value);
}
}
if (this.length >= this.capacity) {
compact();
}
this.list[this.le... |
98ca170c-232c-409d-9b60-ab61d2caecd9 | 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... |
dc64db3d-0d90-4447-8e05-4d3d550f9c50 | 9 | @Override
public void actionPerformed(ActionEvent e) {
if ( e.getSource() == certifications ) {
switchContentPanel(new EditCertificationsPanel());
} else if ( e.getSource() == users ) {
switchContentPanel(new EditUsersPanel());
} else if ( e.getSource() == tools ) {
switchContentPanel(new Edi... |
543321f4-24c9-4e04-9ea9-29c19886b790 | 9 | @Override
Object writeObject(Map<String, Object> functions, Map<String, Object> model, TemplateMessages messages) throws TemplateException {
String o = (String) functionIdentifier.writeObject(functions, model, messages);
Object fp = functions.get(o);
if (fp == null && functionIdentifier.is... |
8e2158a8-03a5-440b-8a1f-1fc97921f9d8 | 6 | public static void unZiphasDir(String zipFileName, String targetDir) throws Exception {
ZipFile zipFile = new ZipFile(zipFileName, "GBK");
Enumeration emu = zipFile.getEntries();
while (emu.hasMoreElements()) {
ZipEntry entry = (ZipEntry) emu.nextElement();
if (entry.isD... |
cb33fb09-56d3-4fe4-8c08-51fefad821e7 | 9 | @Override
public void paste(int x, int y, BaseImage img) {
if(img.getMode() != mode) {
img = img.changeMode(mode);
}
if (img.getHeight()+y < 0 || y >= this.height) {
return;
}
if (img.getWidth()+x < 0 || x >= this.width) {
return;
}
int imgXOff = 0;
int imgYOff = 0;... |
eef8b65a-0ab1-444a-b09d-ce525e69ea50 | 9 | public void update() {
if(autoUpdate == true) {
try {
Updater updater = new Updater(this, "magic-explosion", this.getFile(), Updater.UpdateType.DEFAULT, false);
Updater.UpdateResult result = updater.getResult();
switch(result) {
case SUCCESS:
System.out.println("[M... |
99de9f9e-b505-45a1-b0a2-2e3e3504b01d | 1 | private void placePlayers(){
for (Player p : players) {
grid.addElement(p);
}
} |
98313281-a91a-4755-b578-044915408c58 | 3 | private static void inputLoop(GUIConsoleInterface console, String prompt) {
Reader input;
input = ((JConsole)console).getIn();
BufferedReader bufInput = new BufferedReader(input);
String newline = System.getProperty("line.separator");
console.print(prompt, Color.BLUE);
String line;
... |
e3b7a3d0-eebd-45e0-91ce-0fd2f4e5dd34 | 6 | public static List<String> asArray(final String jsonString) {
if (!jsonString.startsWith("[")) {
throw new IllegalArgumentException(jsonString + " does not appear to be an array");
}
final List<String> elements = new ArrayList<String>();
final StringBuilder sb = new StringBuilder();
int depth = 0;
fo... |
6c8f48ed-60c0-441a-bce9-16ee3fbb2b90 | 9 | public QryResult evaluateBoolean (RetrievalModel r) throws IOException {
// Initialization
allocDaaTPtrs (r);
QryResult result = new QryResult ();
// Sort the arguments so that the shortest lists are first. This
// improves the efficiency of exact-match AND without changing
// the result... |
ccc9d6fb-8226-40a3-a93f-bdfc8e9c65cc | 9 | static private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
cas... |
591c2b89-493b-48f8-8aac-6e992bb0d34f | 9 | public MazeCell anyIntactNeighbor(MazeCell[] Array){ //Will try to find and choose randomly an intact neighbour with his walls up
//Used when creating a labyrinth
MazeCell randcell = null;
int count = 0;
if(Array.length == 0)
System.out.println("No neighbours");
for(int i = 0; i < Array.lengt... |
ed775e71-f503-4c6f-b93c-ea0962ccd0ab | 9 | private static void testStructures() {
out.println("Reading test_structures.sdl");
Tag root = null;
try {
root=new Tag("root").read(new InputStreamReader(
Test.class.getResourceAsStream("test_structures.sdl"),
"UTF8"));
} catch(IOException ioe) {
reportException("Problem reading test_st... |
a0136367-da68-45f2-bddf-08675e528deb | 4 | private MyConnection() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (ClassNotFoundException ex) {
Logger.getLogger(MyConnection.class.getName()).
log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Lo... |
7f40e13d-769f-4b00-8b66-4253a3f84d9f | 4 | @Override
public String toString() {
String sz = "Z[";
String sy = "Y[";
for (E e : controleZ)
sz += e.toString() + ", ";
for (E e : controleY)
sy += e.toString() + ", ";
if (sz.length() > 2)
sz = sz.substring(0, sz.length() - 2);
if (sy.length() > 2)
sy = sy.substring(0, sy.length() - 2);
... |
f788a220-c2f1-4ba1-bec0-a7a0dd776e1f | 0 | public Location(double latitude , double longitude) {
this.latitude = String.valueOf(latitude);
this.longitude = String.valueOf(longitude);
} |
09b37424-6ac5-4ce3-a14c-771f56ca7bab | 8 | public int [][] multiResultsetWins(int comparisonColumn, int [][] nonSigWin)
throws Exception {
int numResultsets = getNumResultsets();
int [][] win = new int [numResultsets][numResultsets];
// int [][] nonSigWin = new int [numResultsets][numResultsets];
for (int i = 0; i < numResultsets; i++) {... |
eff57f83-856c-4ed8-b90f-ed8d6078ab81 | 3 | public void setVSBBottomCorner(Component component) {
if (mVSBBottomCorner != component) {
if (mVSBBottomCorner != null) {
remove(mVSBBottomCorner);
}
mVSBBottomCorner = component;
if (mVSBBottomCorner != null) {
add(mVSBBottomCorner);
}
}
} |
cb4a8f3c-907f-4eb5-b35d-dc5b9be55423 | 1 | protected void setColoredExes() {
ArrayList<Excel> temp = PyramidGenerator.generatePyramid4(side, base);
coloredEx.clear();
for(Excel ex: temp)
{
ex.setX(ex.getX() + Dx);
ex.setY(ex.getY() + Dy);
coloredEx.add(ex);
}
} |
20fa08f9-16f7-4f38-9c34-34fad1ecdd1d | 4 | public void tick() {
if (displayedMessage > -1) {
if (!fading) {
displayTicks++;
if (displayTicks == TICKS_PER_MESSAGE) {
displayTicks = 0;
fading = true;
}
} else {
fadingTicks++;
if (fadingTicks == FADE_TICKS) {
fadingTicks = 0;
fading = false;
displayedMessage--;
... |
38e533bd-79f2-448a-a59a-e1cd4df757c7 | 1 | public static void h() throws Exception {
try {
f();
} catch (Exception e) {
System.out.println("Inside h(),e.printStackTrace()");
e.printStackTrace(System.out);
throw (Exception) e.fillInStackTrace();
}
} |
94329cfa-a122-4bd6-af37-40576c34407c | 1 | public boolean canHaveAsBalance(BigInteger balance) {
return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0);
} |
bebe84ad-2e87-40d6-8062-bafbdd230d54 | 1 | public boolean equals(Object object) {
return object == null || object == this;
} |
f408c398-90da-4e30-b949-95618386bee0 | 3 | public static void main(String[] args) throws Exception {
Command command = processArgs(args, "OpusComment");
OpusFile op = new OpusFile(new File(command.inFile));
if (command.command == Commands.List) {
listTags(op.getTags());
} else {
// Have t... |
218c2362-400c-4a00-9421-1459cf716d3f | 8 | public static int min(int depth, int hardMin){
if (depth == MAX_DEPTH) return evaluate();
int bestScore = Integer.MAX_VALUE;
long[] tempData = data;
String moves = MoveGenerator.getMoves(data);
for (int i = 0; i < moves.length(); i += 4){
data = MoveGenerator.makeMove(moves.substring(i, i + 4), tempData... |
1feca1c0-b8af-4aaf-b4c5-1e18f7fa3f42 | 7 | @Override
public void onTakeStep()
{
// _players[0].setBehaviour(_behaviours[1]);
Queue<Message> messagelist = getTrainerMessages();
while (!messagelist.isEmpty()){
Message message = messagelist.poll();
if (message instanceof MessageEvent) {
MessageEvent messageEvent = (MessageEvent) message;
i... |
bffa9764-4434-4cf7-b9e8-788b03ec98d0 | 2 | private void colorMidTemp(int i, int j, long temp) {
for (int k = 0; k < tempRangesMid.length; k++) {
if (temp < tempRangesMid[k]) {
drawing.setRGB(i, j, colorRangesMid[k]);
break;
}
}
} |
a87a53d2-4c4d-47d0-9568-d888148a303a | 2 | public void startMaze() {
for (int i = 0; i < newRun.BOARD_MAX; i++) {
for (int j = 0; j < newRun.BOARD_MAX; j++) {
board[i][j].setBorder(null);
}
}
} |
e3229cfa-0e38-4b72-ad4e-45d5c3639f13 | 8 | public static Keyword uBaseMeasuresSpecialist(ControlFrame frame, Keyword lastmove) {
{ Proposition proposition = frame.proposition;
Stella_Object mainarg = (proposition.arguments.theArray)[0];
Stella_Object mainargvalue = Logic.argumentBoundTo(mainarg);
int value = Stella.NULL_INTEGER;
if ... |
f6ccc2b2-2693-4747-ac9f-fe0b50182588 | 0 | public static void main(String args[]){
MyDataImpl obj = new MyDataImpl();
obj.print("");
obj.isNull("abc");
} |
a8081a3d-f034-4ad5-b511-ce01ff0ddcc5 | 3 | public void searchFor(String key) throws SQLException {
if (dic != null) {
this.key = key;
if (key.isEmpty()) {
ids = dic.getAllIDs();
} else {
ids = dic.searchID(key);
}
for (TableModelListener l : listeners) {
l.tableChanged(new TableModelEvent(this));
}
}
} |
af91d91f-9f4e-4fd4-bf4b-f8e6db374a20 | 5 | public void addComment(String path, String... commentLines) {
StringBuilder commentstring = new StringBuilder();
String leadingSpaces = "";
for(int n = 0; n < path.length(); n++) {
if(path.charAt(n) == '.') {
leadingSpaces += " ";
}
}
for(String line : commentLines) {
if(!line.isEmpty()) {
l... |
5a428464-c2b4-4e03-8d39-85a0f02b5777 | 5 | public static void saveProperties(Properties props, File propertyFile, String headerText) {
OutputStream out = null;
try {
out = new FileOutputStream(propertyFile);
if (StringUtils.isNotBlank(headerText)) {
props.store(out, headerText);
}
} ca... |
82c815b7-008c-42b3-8175-0f0ce29aaa91 | 4 | public ArrayList<ArrayList<String>> partition(String s) {
isPal = new boolean[s.length()][s.length()];
this.s = s;
isPal[0][0] = true;
for (int i = 1; i < s.length(); i++) {
isPal[i][i] = true;
isPal[i - 1][i] = s.charAt(i - 1) == s.charAt(i);
}
... |
3fa6ec2c-1714-4804-a4d0-cce3795a1e71 | 6 | public void saveUndefinedStrings(String path){
if(save){
String stringsToSave = getUndefinedStringsForSave();
if(!stringsToSave.equals("")){
Path p = Paths.get(path);
Path parent = p.getParent();
boolean exists = Files.exists(p);
if(!Files.exists(parent)){
try {
Files.createDirectorie... |
ea514589-ea68-4a59-8f62-ccdd3b6367df | 2 | @Override
protected byte[] load_from_current_position(String frameId, int dataLength, RandomAccessFile openFile) throws IOException {
byte[] frameData=super.load_from_current_position(frameId, dataLength, openFile);
if(frameData==null) {
this.setValue(null);
} else if(frameData.leng... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.