method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7915d711-f6cd-48fd-a9f2-a4a36640c08c | 9 | @Override
public <T> T generate(Class<T> spec, DBObject dbObject) {
if(dbObject == null) return null;
Constructor constructor = getDefaultConstructor(spec);
Object entity = invoke(constructor);
for (Field field : spec.getDeclaredFields()) {
if (!dbObject.containsField(field.getName())) {
continue... |
67b8244a-188f-4d40-a9b6-4b5755244411 | 3 | public static void main(String[] args) {
User user = new User();
try {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.writeValue(new File("D:\\Java SE\\src\\json\\object\\user.json"), user);
User user2 = objectMapper.readValue(new File("D:\\Java SE\\src\\json\\o... |
512c4b5c-4de8-4c4a-8eea-cc08eb0b4bf7 | 3 | @Test(timeout = 200)
public void testReceiveTimeout_MessageArrivesAfterTime() {
try {
consumer = new AbstractMessageConsumer(mockTopic) {
};
} catch (DestinationClosedException e) {
fail("Unexpected exception on constructor");
}
assertNotNull(mockTopic.getTopicSubscriber());
try {
Message msg = n... |
3b211110-5035-4cf5-9ab0-fc7f746e765d | 1 | public void rewindNbits(int N)
{
totbit -= N;
buf_byte_idx -= N;
if (buf_byte_idx<0)
buf_byte_idx += BUFSIZE;
} |
c9c9b668-8a78-4324-b344-5e03e666c7ee | 7 | public void iTunes(String[] args) {
if(args.length < 2) {
bot.errorMessage(channel, sender, "incorrect parameters. !help for details");
return;
}
args = argsPrepare(args);
args[1] = platformAlias(args[1]);
String response;
// return both 32 and 64 bit urls for windows
if(args[1].toLowerCase().eq... |
4b653613-0220-44d7-b1ce-a18beeb7e84b | 8 | @Override
public Boolean visitIf(IfTree node, Context p) {
IfTree currentTree = node;
StatementTree endingTree;
int count = 0;
while (true) {
if (currentTree.getElseStatement() == null) {
count++;
StatementTree thenTree = currentTree.getThenStatement();
if (thenTree insta... |
38273f36-aca4-45d7-8a47-76c84b06053c | 4 | public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int cases = 1;
while (true) {
// input
m = input.nextInt();
n = input.nextInt();
if (m + n == 0) return;
x1 = input.nextInt();
... |
d1a3bd6c-ac1c-4613-908c-776c0bdfd4f3 | 3 | public void register(final Region region) {
this.regions.add(region);
this.references.put(region, 0L);
if (!region.active) return;
// load region into applicable loaded chunk index entries
for (final ChunkCoordinates coords : region.chunks())
if (this.world.isChunkLo... |
81063164-d53c-4d5e-be93-d1bd3ac5de50 | 3 | public Serializable decode(File file, Map parameters) {
Serializable object = null;
try {
ObjectInputStream stream = new ObjectInputStream(
new BufferedInputStream(new FileInputStream(file)));
object = (Serializable) stream.readObject();
stream.close();
} catch (IOException e) {
throw new ParseEx... |
211172d2-40cb-4432-b2c3-fed7f84c2577 | 9 | int insertKeyRehash(int val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look un... |
fcef2b8a-11d5-461b-aeeb-007e5d78195e | 7 | public static void dump_grammar() throws internal_error
{
System.err.println("===== Terminals =====");
for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++)
{
System.err.print("["+tidx+"]"+terminal.find(tidx).name()+" ");
if ((cnt+1) % 5 == 0) System.err.println();
}
System.err.... |
964f0661-ea4b-42b6-a4de-07df0e23152d | 0 | public void setItemId(int itemId) {
this.itemId = itemId;
} |
defec82f-bfff-400a-b53a-0d23469e9838 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final Physical target = mob.location();
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(mob,null,null,L("An Ice S... |
ebbc2b2b-f11f-47f0-bea2-2878794bb3b6 | 2 | @Override
public void draw() {
if (hidden) {
return;
}
super.draw();
for (GUIComponent component : subComponents) {
component.draw();
}
} |
fa482dd4-70e5-4210-9290-0ac514c96977 | 8 | public Map<String, ArrayList<RowData>> getObjectsFromTable(
String tableName, String columnFamily, String startRange,
String endRange, String... retrieveColumns) throws IOException {
// Validate the tableName
if (!validateStringIfNullOrEmpty(tableName)) {
throw new IllegalArgumentException(
"Invalid ... |
f00cd556-591e-413e-9cd2-231ebc8489ae | 4 | public double simulateHandWithSharedCards(ArrayList<Card> holeCards, ArrayList<Card> sharedCards, int players) throws Exception {
if (sharedCards.size() < 3) {
throw new Exception("Less then 3 shared cards");
}
Deck deck = new Deck();
deck.removeCards(holeCards);
deck.removeCards(sharedCards);
ArrayLi... |
287b0d92-7b55-437d-82e8-f8dd6e122bcc | 4 | private boolean testLocation(XYLocation location) {
if (location.getXCoOrdinate()<0 || location.getXCoOrdinate()>rowBoard-1)
return false;
if (location.getYCoOrdinate()<0 || location.getYCoOrdinate()>colBoard-1)
return false;
return true;
} |
ef179f87-2234-49b3-954f-41e0feba9309 | 4 | public static PGM difference(PGM img1, PGM img2){
try{
if (img1.getHauteur() != img2.getHauteur() || img1.getLargeur() != img2.getLargeur()){
throw (new DifferentSizeException());
}
} catch (Exception e){
System.out.println("Les deux images doivent êtr... |
384731b0-ca1b-4c3f-b284-3a607a6b1a7d | 2 | private void drawString(Graphics2D g2d, String text, int startAngle, int angle){
double percent = (double) Math.round((double) angle/360*100*1000)/1000;
if(percent > 5 || text.equalsIgnoreCase("Other")){
g2d.setColor(Color.BLACK);
g2d.setFont(getFont().deriveFont(9.0f));
g2d.drawString(text, (float) Math.c... |
439a93f0-8969-497a-87c5-cfdc14e1b006 | 2 | public void createPath() {
if (dir.exists()) {
return;
}
if (!dir.mkdir()) {
throw new DataBaseException("Cannot create directory!");
}
} |
93c9edf3-6b37-4e4c-851e-036918b4a266 | 8 | private static String solve(char[][] x, int N) {
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
if (x[i][j] == '#') {
if (!remove(x, N, i, j)) return "NO";
if (!remove(x, N, i+1, j-1)) return "NO";
if (!remove(x... |
d01e7b96-d57c-4a17-9110-4055fc078ca1 | 7 | public void formatStringOne(char[] str, int length) {
boolean isWord = false;
int start = 0, end = 0, wordCount = 0;
for (int i = 0; i < length; i++) {
if (str[i] != ' ' && isWord == false) {
isWord = true;
start = i;
} else if (str[i] == ' ' && isWord == true) {
isWord = false;
end = i - 1;... |
a4b98270-0672-432b-b292-49add63b3a2f | 3 | @Override
public void Handle(byte[] message, Server server, IOClient p) {
Player player;
if (p instanceof Player) {
player = (Player)p;
}
else
return;
ByteBuffer bb = ByteBuffer.allocate(9);
bb.put(message);
//byte ID = bb.get(0);
short X = bb.getShort(1);
short Y = bb.getShort(3);
short Z = ... |
7f67448a-58b7-4c7f-81f7-114430ee4a79 | 0 | @Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
} |
bbe14990-61bb-4a2d-8286-ec0988497cb8 | 0 | public Product() {
} |
e292e4ee-d263-4d56-a4a1-20442b874328 | 3 | private void requestUpdatesPath() {
boolean valid = false;
File f;
while (!valid) {
String path = requestInput("SQL Updates Folder");
Path p = Paths.get(path);
f = p.toFile();
if (f.canRead() && f.isDirectory()) {
// path found
updatesfolder = p;
return;
} else {
console.printf("Pl... |
e57e1404-cab6-4cbc-8a8e-f1b5626e72f5 | 9 | public static void normalizeNotProposition(Proposition self) {
{ Stella_Object argument = (self.arguments.theArray)[0];
Proposition proposition = null;
if (Logic.variableP(argument)) {
{ OutputStringStream stream000 = OutputStringStream.newOutputStringStream();
{ Object old$Printread... |
a9a6c3b9-37e6-432e-9ae1-206275a1fe26 | 1 | public String getString(String key) {
Object value = get(key);
return value != null ? value.toString() : ""; //$NON-NLS-1$
} |
249f793d-ca77-40db-b38d-af370994c1bf | 7 | private void generateLabelPositions() {
boolean addedCandidate = false;
// Start off with label that is in the middle of the line
LineTextParameter candidate = new LineTextParameter(use, 50);
try {
candidate.getGeometry();
addCandidate(candidate);
addedCandidate=true;
} catch (FalloffException e){
... |
cf71e64b-360d-425c-b460-66a16e0fbe9a | 1 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
handler.beforeStart();
if (method.getAnnotation(Sql.class) != null) {
return sql(method, args, method.getAnnotation(Sql.class));
}
return null;
} |
83826a8e-500b-4dff-b3cf-2f0dde8fae16 | 5 | public void fileReader() {
try {
File fileComplete = getFile();
Scanner lineRead = new Scanner(fileComplete);
while (lineRead.hasNextLine() == true) {
String lineTemp = lineRead.nextLine();
// "Items:" = storeLine, "~" = itemLine, "=" = fusionL... |
03d58f04-0a48-4e93-9d7f-eb62269430b2 | 5 | @Override
public Command planNextMove(Info info) {
// you can NONE, MOVE_FORWARD, MOVE_BACK, TURN_LEFT, TURN_RIGHT, SHOOT
InfoDetail myInfo = new InfoDetail(info.getX(), info.getY(), info.getDirection());
if(info.getEnemies().isEmpty() && info.getGrenades().isEmpty()){
r... |
661d2149-0399-44a0-b7a7-a8326498b721 | 1 | public static void main(String[] args) throws IOException {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Title frame = new Title();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
956bfa6f-707f-4e6b-a0fb-396ef2a073de | 5 | private void createJFinalConfig(String configClass) {
if (configClass == null) {
throw new RuntimeException("please set configClass in the web.xml");
}
try {
Object o = Class.forName(configClass).newInstance();
if (o instanceof JFinalConfig) {
jfinalConfig = (JFinalConfig) o;
}
else {
th... |
971a3c86-15f2-48bc-bd9f-25cf31b07c1e | 2 | public Boolean loginUser(String login, String password){
PreparedStatement pStmt = null;
ResultSet rs = null;
Boolean returnLogin = false;
try {
pStmt = conn.prepareStatement("SELECT * FROM USER WHERE login = ? AND password = ?;");
pStmt.setString(1, login);
pStmt.setString(2, getMD5Hash(pass... |
60621a54-e670-4ed3-b279-1cc2bfc5f4a4 | 5 | public void load(){
synchronized(options){
try {
options.load(new FileInputStream("timers.conf"));
synchronized (timers){
timers.clear();
for(Object key : options.keySet()){
String str = key.toString();
if(str.indexOf("Name")>0){
continue;
}
String tmp[] = options.getProperty(st... |
e8f16b00-b230-4f55-99f6-7ad6eb3b4ca6 | 9 | static private final 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)
{
... |
bd3eaa50-bccb-452a-9f77-5413d9b4e472 | 1 | private String signup(String[] msg) {
String ans =null;
user.User user = forumSystem.signup(msg[1], msg[2], msg[3],msg[4], msg[5]);
if (user!=null) {
this.user=user;
ans="SUCC_SIGNUP";
}
else ans="ERR_SIGNUP";
return ans;
} |
2dbdf381-ac7a-42af-bace-c3ee50c43761 | 0 | public void centerViewOnPoint(int index)
{
//MapGetter.getMapImage(MapGetter.createUrl(markerRect.getLongtitude(index), markerRect.getLatitude(index)));
//repaint();
} |
ebdd0711-0d85-44f4-8d95-7ee5b67f72fe | 6 | public static void main(String[] args) {
int i;
for ( i = 0; i < 10; i++)
switch(i) {
case 0:
System.out.println("i is zero");
break;
case 1:
System.out.println("i is one");
b... |
dc8924e3-3111-4d60-ad2f-06f5378a794a | 3 | public void initializeKeySet()
{
int i1;
int j1;
int k1;
int l1;
int i2;
int j2;
int k2;
int l = i1 = j1 = k1 = l1 = i2 = j2 = k2 = 0x9e3779b9;
for(int i = 0; i < 4; i++)
{
l ^= i1 << 11;
k1 += l;
i1 ... |
d559a86a-fca3-4908-939d-aadd00f7e07e | 1 | public void run() {
try {
WebServer webServer = new WebServer(port);
XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
PropertyHandlerMapping phm = new PropertyHandlerMapping();
phm.addHandler( "StockProcedure", MyWebServer.class);
xmlRpcServer.setHandlerMapping(p... |
a53fc540-f27f-473d-8bd0-9176abaa2791 | 6 | private static final int method2894
(int i, int i_16_, byte[] is, int[] is_17_, int i_18_, int i_19_,
int i_20_, int i_21_, int i_22_, int i_23_, int i_24_,
Class348_Sub16_Sub5 class348_sub16_sub5, int i_25_, int i_26_) {
if (i_25_ == 0
|| (i_22_ = i_19_ + (i_24_ + 256 - i_18_ + i_25_) / i_25_) > i_23_)
... |
d10ae50b-52f6-45a2-a2ad-5a84a92885e6 | 6 | public static void main(String[] args)
{
// Load GUI by default
boolean headless = false;
// Folder to log stuff to
String logFolderPath = System.getProperty("user.dir") + File.separator;
/*
* Parse arguments
*/
String arguments = "";
for(String string : args)
{
arguments += " " + ... |
38196eef-5f98-45de-a572-8b6cbc60f67b | 1 | protected void layoutChildren(Rectangle[] bounds) {
for (int i = 0; i < bounds.length; i++) {
mChildren.get(i).layout(bounds[i]);
}
} |
f7fc3001-51ba-45e4-89b9-f3c9987d1f88 | 1 | static String readFieldId(RandomAccessFile raf, int length, VorbisCommentBlock block) throws IOException {
StringBuilder fieldId = new StringBuilder();
char c;
while( (c=(char)MediaFileUtil.read_sure(raf))!= '=' ) {
fieldId.append(c);
}
return new String(fieldId);
... |
e9bd5df4-2a90-44f2-ad92-f97e2affeaec | 7 | @Test
public void reTest7() {
userInput.add("hi");
userInput.add("my name is meng meng");
userInput.add("can you bring me something");
userInput.add("knife");
userInput.add("errorhandling");
userInput.add("errorhandling");
userInput.add("errorhandling");
userInput.add("errorhandling");
userInput.add(... |
e574897c-877a-4dd3-b84b-8c006f70fa3f | 3 | public void readDB(String path, String styleYear){
// check to see if the style guide is in the DB already
dbPath = path;
styleFileName = "styleguide" + styleYear + ".xml";
File styleFile = new File(path, styleFileName);
if(styleFile != null && !styleFile.exists()){
Frame window = new Frame();
... |
0217daf1-834c-43c3-b20a-8b5c3916c3c6 | 3 | public static void main(String[] args) throws IOException {
Socket sock = parseArgs(args);
if (sock == null)
return;
AI solver = new SimpleAI();
Game game = new Game(NAME, sock);
int gameResult = game.solve(solver);
if(gameResult == game.getID())
System.out.println("Congratz");
else if(gameRe... |
4b6d4777-2357-4081-a0f4-304e23217c2c | 4 | public boolean isAvailable(Date start, Date end) {
if(!start.before(end))
throw new IllegalArgumentException("Illegal given period");
for(Reservation reservation : reservations) {
if(reservation.getEndDate().before(start) || reservation.getStartDate().after(end))
... |
9125115c-4053-4937-a936-0ce9ab21bc5c | 8 | public void update(){
for(Map.Entry<Memorable,JLabel> entry:labels.entrySet()){
Memorable memorable = entry.getKey();
float hp = memorable.hasHistory();
Color color=new Color(hp,hp,hp);
if(hp==1){
boolean wasBetter=false;
float er=m... |
a2c21b99-15e9-4b69-86a0-95e3fafd2be1 | 4 | public void method357() {
if (imageWidth == libWidth && imageHeight == anInt1457)
return;
byte abyte0[] = new byte[libWidth * anInt1457];
int i = 0;
for (int j = 0; j < imageHeight; j++) {
for (int k = 0; k < imageWidth; k++)
abyte0[k + drawOffsetX + (j + drawOffsetY) * libWidth] = imagePixels[i++];
... |
3fe705e7-bdb1-4684-b3c5-92b8505039c4 | 9 | public static String getIpAddr(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip))
ip = request.getHeader("Proxy-Client-IP");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnore... |
f289595c-f664-4c59-8480-481502e294d1 | 7 | public Funcion(String nombre){
ArrayList<String> expresion;
ArrayList<Arbol> operandos;
puntos = new ArrayList<Punto>();
expresion = new ArrayList<String>();
operandos = new ArrayList<Arbol>();
LeerArchivo archivoIn = new LeerArchivo(nombre);
String [] linea;
try{
linea=archivoIn.readLine().split(" "... |
56c029d0-a47f-48c6-a256-d2e189573830 | 2 | boolean isPalindorme(String s, int start, int end) {
for (int i = start, j = end; i < j; i++, j--)
if (s.charAt(i) != s.charAt(j))
return false;
return true;
} |
2c9c1b6b-e402-43fc-8a4a-10afd072d8da | 3 | public void initialDeal(ArrayList<Player> players, Dealer dealer, int numPlayers){
for (int i=0;i<numPlayers;i++)
{//This loop goes through an array and deals initial cards to each player in the array
for (int j=0;j<2;j++)//this interior loop makes sure that 2 cards are dealt since this is initial hand
player... |
dd634a62-ef0d-4a63-9239-dc92f030ba0b | 2 | public Fruit(Player[] players, int bowlsize, int[] dist)
{
this.players = players;
this.bowlsize = bowlsize;
this.nfruits = bowlsize * players.length;
this.fruitDist = dist;
// generate the preference for each player
preference = new int[players.length][];
fo... |
9933682c-96a7-4cac-aa08-46a0382827e8 | 3 | public void test(String script)
throws EugeneException {
try {
// first, we need to parse the script
this.parse(script);
} catch(Exception e) {
throw new EugeneException(e.getMessage());
}
Map<String, List<CompositePredicate>> predicates =
this.parser.getPredicateRepository().getPredicat... |
87897706-c2b3-44f2-8e68-86c17e3500df | 3 | private Thread searchThreadsInGroup(final String threadName, final ThreadGroup group, final int level) {
Thread thread = null;
Thread[] threads = new Thread[group.activeCount() * 2];
int numThreads = group.enumerate(threads, false);
for (int i = 0; i < numThreads; i++) {
if (threads[i].getName().equals(thr... |
abcb00c1-4ca3-450d-8989-a2fc4685d962 | 5 | private void checkType(Class<?> actual, Class<?> expected) {
if(expected==actual || expected.isAssignableFrom(actual))
return; // no problem
if( expected==JCodeModel.boxToPrimitive.get(actual) )
return; // no problem
throw new IllegalArgumentException("Expected "+expect... |
f715514f-bc39-409f-a2b7-1f012d2d14cd | 4 | @Override
public void execute(CommandSender sender, String[] args) {
if (args.length < 2) {
sender.sendMessage(new TextComponent(ChatColor.RED + "Usage: /mode <channel> <mode ...>"));
return;
}
if (!IRC.sock.isConnected()) {
sender.sendMessage(new TextComp... |
c261753e-9daf-4f64-b1b4-2262381d54ac | 7 | protected void sendResponses() {
if(responses != null) {
Object obj;
for(int i=0; i < responses.length; i++) {
if(delay > 0)
Util.sleep(delay);
obj=responses[i];
if(obj == null) {
... |
a242ab1e-e199-4752-891d-bb66c2203101 | 1 | private void persistResources(IArticle article) throws IOException {
for (IResource resource : article.getResources()) {
em.persist(resource);
}
} |
22a2a381-dddf-4970-ad02-bbb050b23bf1 | 2 | private boolean PlayerHidden(int posX, int poY)
{
for (Polygon p : ps)
{
if (p.contains(posX, poY))
return true;
}
return false;
} |
39f94560-a792-4fe7-bb45-9e9d3e50a30e | 5 | public static String reverseWords1(String s) {
if (s == null || s.length() == 0) {
return "";
}
String[] arrayStr = s.split(" ");
int length = arrayStr.length;
StringBuffer newStr = new StringBuffer();
for (int i = length - 1; i >= 0; i--) {
if (!arrayStr[i].trim().equals("")) {
newStr.append(... |
1e2bcf71-0c0a-42b1-9129-5f44c5c832cf | 3 | public static String getFilenameExtension(String path) {
if (path == null) {
return null;
}
int extIndex = path.lastIndexOf(EXTENSION_SEPARATOR);
if (extIndex == -1) {
return null;
}
int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR);
if (folderIndex > extIndex) {
return null;
}
return path... |
e414384d-19be-422a-afa8-8358b20d2e6e | 9 | public static BufferedImage getTexture(String texture) {
switch(texture) {
case "grass":
return grass;
case "grassLeft":
return grassLeft;
case "grassRight":
return grassRight;
case "dirt":
return dirt;
case "log":
return log;
case "tree":
return tree;
case "bigTree":
return bigTree... |
bf6ae2b3-a38a-445a-8219-351d01bb5d0c | 1 | public boolean isEmpty() {
boolean retVal = false;
if (topPtr == CAPACITY) {
retVal = true;
}
return retVal;
} |
4db41d98-eaef-4fc2-9516-ccfc0ce2c79a | 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++)
... |
bfedc226-3fdd-402a-aeed-e7a2b4256f84 | 5 | void receive() throws IOException {
if (this.closed) throw new SocketClosedException();
class Container {
public IOException exception = null;
public boolean isClosed = false;
}
final Container container = new Container();
this.listener.onData(new IBuff... |
55cc14f3-95b0-4122-a0d8-307471056792 | 3 | public CardStack(String file, String name) throws StorageReaderException {
stack = new ArrayList<Card>();
top = 0;
Random random = new Random();
int index;
ArrayList<Card> temp = new CardCreator(file, name).cardArray();
while(!temp.isEmpty()) {
index = random.nextInt(temp.size());
index = index - (i... |
9502524c-ce5a-48c6-bc31-5aa8800875f9 | 0 | public void setTree(JoeTree tree) {this.tree = tree;} |
3a52cbcc-f8bd-4187-91f1-99dae8ef1f3c | 8 | @Override
public boolean update() {
finishButton.update();
fundsTextbox.update();
boolean blockFinish = false;
for(PartySelectButton selector : partySelectors) {
selector.update();
if(selector.blockFinish) {
blockFinish = true;
}
}
if(!finishButton.isImpossible && (blockFinish || (numSelect... |
d7c35e3a-70e3-4d26-9c89-7b6813211234 | 6 | public void calculerVoisinage(Node current){
ArrayList<Node> voisins = findVoisin(current);
for(Node voisin : voisins){
if(voisin.getState() != BLOCK && !closedList.contains(voisin)){
voisin.setColor(Color.gray);
int newG = current.getG_movementCost() + COU... |
98bf166e-7aab-4f2b-a112-5bfdfcef8b0b | 2 | public Object clone() {
try {
VariableSet other = (VariableSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new jode.AssertError("Clone?");
}
} |
ace15e59-1e7f-4fb6-9756-e40ff013a121 | 9 | public void render(Screen screen) {
// Where the player is found on the spritesheet
int xTile = 0;
int yTile = 28;
int walkingSpeed = 3;
// Number between 0 and 1
// top part of the body
int flipTop = (numSteps >> walkingSpeed) & 1;
// bottom part of the body
int flipBottom = (numSteps >> walkingSpeed) & 1... |
00d029dd-254d-42c7-83a4-4dbc8e8d8266 | 1 | private void printResults() {
for (int i = 0;i<VALUE_ITERATIONS_NUMBER;i++) {
System.out.println(results[i]);
}
} |
19ba066e-91f0-418b-bc63-a2e38badd3bd | 2 | private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
// TODO add your handling code here:
if (saveMenuItemIsUsed == false)
{ int n = JOptionPane.showConfirmDialog(null,"Are you sure that you want to exit without saving\nAll unsav... |
c7e00346-751c-4656-bb6e-e692e0b55ac9 | 3 | private void paintScreen()
// use active rendering to put the buffered image on-screen
{
Graphics g;
try {
g = this.getGraphics();
if ((g != null) && (dbImage != null))
g.drawImage(dbImage, 0, 0, null);
// Sync the display on some systems.
// (on Linux, this fixes e... |
b9d2e2f9-25dd-4045-9df5-f760e65994bc | 8 | protected void buildClassifierWithWeights(Instances data)
throws Exception {
Instances trainData, training;
double epsilon, reweight;
Evaluation evaluation;
int numInstances = data.numInstances();
Random randomInstance = new Random(m_Seed);
// Initialize data
m_Betas = new double [m_C... |
90ea5a20-c9c7-48ab-9d8e-52eaef20dcfb | 6 | public boolean getStudentIdByBookId(IssueBookVO issueBookVO)
throws LibraryManagementException {
boolean returnValue = true;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection;
try {
connection = connectionFactory.getConnection();
} catch (LibraryManagementException e)... |
4d9ad8f2-e35f-48c0-a403-8b110d4e748a | 1 | public void setShutdownFontsize(int fontsize) {
if (fontsize <= 0) {
this.shutdownFontSize = UIFontInits.SHDBTN.getSize();
} else {
this.shutdownFontSize = fontsize;
}
somethingChanged();
} |
342535fd-2f79-4eb8-8c5a-ec849179f38b | 5 | public AtomVerbs getVerbs(Movable player)
{
AtomVerbs rval = new AtomVerbs();
rval.atomUID = this.UID;
rval.verbs = new ArrayList<VerbSignature>();
// Check all the class' methods
for(Method m : this.getClass().getMethods())
{
// TODO: Check if this verb is accessible by the the player atom
... |
5cf8494e-40aa-4570-97ab-f0c5c7d7db46 | 2 | private boolean isDrawRound() {
if(drawRound) {
return true;
}
if(getColor().equals(Color.YELLOW)) {
return true;
}
return false;
} |
ba8e5a63-0ddf-4e9b-b7ba-320ab6065ad8 | 2 | public void saveXml() {
if (!vermilionCascadeNotebook.getModified()) {
return;
}
File file = new File(VCNConstants.WORK_FILE_PATH);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
Document xml =... |
06613993-59f6-48f2-b587-5a42b7cb37ef | 3 | @Override
public String toString() {
StringBuffer s = new StringBuffer("Graph mit " + vertexIndex.size() + " Knoten\n");
int i = 0;
for (V v : vertices) {
if (v != null) {
s.append(v + ": ");
for (E e : adjList.get(i)) {
s.append(e.getVertexB() + " ");
}
s.a... |
cd88419e-834e-4ae7-abe1-a8ae17e8b35e | 2 | public void pauseDownload(final int gid) {
switch (downloads.get(gid).getStatus()) {
case ACTIVE:
case WAITING:
taskManager.pause(gid);
break;
default:
break;
}
} |
317df2e4-9e85-429f-a969-8ddf7d319e99 | 0 | public float getTotalPrice() {
return totalPrice;
} |
a6f76a4e-97bf-4656-be6e-4f4f242c55fd | 9 | public static Constants.ResponseType update(Client client, UpdateDataRequestMessage updateDataRequestMessage) {
boolean update = false;
Constants.ResponseType responseType = Constants.ResponseType.failed;
EntityManager entityManager = PersistenceManager.getInstance().getEntityManager();
... |
1ab803fa-67f6-4ceb-859f-ad22e61da85c | 4 | public MetricSet<E> search(E e, Metric<? super E> m) {
int leastDistance = Integer.MAX_VALUE;
for (E elem : this) {
leastDistance = Math.min(leastDistance, m.distance(elem, e));
}
MetricSet<E> newSet = new MetricSet<E>();
for (E elem : this) {
if (m.dis... |
841453f4-76c1-49b2-b108-c0045ca3c527 | 9 | public static void main(String args[]) {
int size = 4;
int[][][] cube = new int[size][size][size];
TicTacToe tictactoe = new TicTacToe(cube);
boolean gameOver = false;
int PLAYER=1;
List<Long> runTime = new LinkedList<Long>();
while (!gameOver) {
System.out
.println("Instruction:Layer1(bot)->Layer... |
9f8b47aa-ca88-47e3-ad9b-d4c9d0d90ed0 | 7 | @Override
public void configure(JobConf conf) {
try {
FileSystem hdfs = FileSystem.get(conf);
FileUtil.copyMerge(hdfs, new Path(IOInfo.TEMP_MOVIE_OUTPUT), hdfs, new Path(IOInfo.TEMP_MOVIE_MERGE)
, false, conf, null);
FileUtil.copyMerge(hdfs, new Path(IOInfo.TEMP_USER_OUTPUT), hdfs, new Path... |
1d3d520d-437a-4869-baf3-e7de481216fa | 6 | @Override
public final void setModelStatus(ModelStatus modelStatus) {
CheckUtils.isNotNull(modelStatus);
if (!this.checkBeforeSet(this.getModelStatus(), modelStatus))
return;
if (this.modelStatus != null
&& this.modelStatus.equals(ModelStatus.DELETED)) {
throw new IllegalStateException(
"You... |
c5d4d520-6906-4ba6-971b-043a42bbde75 | 5 | @SuppressWarnings("resource")
public Connection getConn() {
Statement stmt = null;
try {
Class.forName("org.sqlite.JDBC");
String databaseUrl = "jdbc:sqlite:mydatabase.db";
conn = DriverManager.getConnection(databaseUrl);
String sqlQuery = new Scanner(new File(CREATETABLES_SQL_PATH)).useDelim... |
4207f774-c9ef-4bcc-9f8d-844fa401d5da | 8 | public static List<Message> parseMessages(String resultString){
List<Message> messages = new ArrayList<Message>();
JSONObject base;
try {
base = new JSONObject(resultString);
int retcode = base.optInt("retcode",-1);
if (retcode == 0) {
JSONArray messageArray = base.optJSONArray("result");
for (in... |
6295b753-22af-42f4-b4ba-bd0702ee65f8 | 3 | public void setTable() {
// Centering the first two column's cell content
DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
centerRenderer.setHorizontalAlignment( JLabel.CENTER );
questionTable.getColumnModel().getColumn(0).setCellRenderer( centerRenderer );
... |
114b148c-9dbb-4088-a5bd-dfe7375d7911 | 0 | public void setCrs(Crs crs)
{
this.crs = crs;
} |
731329c6-0303-4d41-aa84-8989de28ae7a | 0 | @Override
public void setIdleTimeout(long idleTimeout) {
this.idleTimeout = idleTimeout;
} |
dff25430-5f2c-4345-95d1-ce05edc43973 | 8 | public void neighborLightPropagationChanged(EnumSkyBlock var1, int var2, int var3, int var4, int var5) {
if (!this.worldProvider.hasNoSky || var1 != EnumSkyBlock.Sky) {
if (this.blockExists(var2, var3, var4)) {
if (var1 == EnumSkyBlock.Sky) {
if (this.canExistingB... |
1f5851b6-aae0-4214-b780-8dc91faebaa9 | 0 | public Iterator<Land> iterator() {
return laenderList.iterator();
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.