method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a15f816c-bcb3-4dbc-8ca0-4c283ecf5378 | 7 | @Override
public void update(Observable o, Object arg) {
if (arg != null) {
if (arg.equals("drawBoard")) {
resetGUI();
menuModel.getBoardModel().generateNewBoard();
drawGameBoard();
}
else if (arg.equals("loadBoard")) {
menuModel.getBoardModel().addObserver(boardView); //when a board i... |
8b1fe41c-5730-451e-a0b4-5309f337e4df | 6 | private String getDatabaseStructureInfo() {
ResultSet schemaRs = null;
ResultSet catalogRs = null;
String nl = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer(nl);
sb.append("Configured schema:").append(schema).append(nl);
sb.append("Configured catalog:").append(catalog).append(nl);... |
720a8dd5-6b4d-4d06-bf57-7216c5839e1b | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
1cacae44-ac16-4abb-81ae-198102117ed2 | 6 | @Override
public void onStatusMessage(NetworkEvent event) {
if (getType() == Type.CLIENT) {
if (event.getEvent() == NetworkEvents.START_CLIENT)
setActive(true);
else if (event.getEvent() == NetworkEvents.SHUTDOWN_CLIENT)
setActive(false);
} else if (getType() == Type.SERVER) {
if (event.getEvent()... |
da06db7c-8523-40f0-ac49-13a6c4146735 | 4 | public Character() {
_level = 1;
_generator = new NormalSpread();
_race = new Deva();
_class = new Ardent();
_classMap = new Vector<>();
BaseGenerator g = new SpecialSpread();
for (BaseClass bc : CLASSES) {
for (BaseRace br : RACES) {
... |
fe5122d7-44fb-4e4a-80f3-cbb2d9b21cc0 | 8 | private final void giveExpToCharacter(final MapleCharacter attacker, int exp, final boolean highestDamage, final int numExpSharers, final byte pty) {
if (highestDamage) {
if (eventInstance != null) {
eventInstance.monsterKilled(attacker, this);
} else {
final EventInstanceManager em = attacker.getEventIn... |
2b00a63a-aabb-43b8-b055-12a71672c2e8 | 1 | public Ip parser(String ipStr){
String[] split = ipStr.split("\\.");
short[] ip = new short[split.length];
for(int i=0;i<split.length;i++){
ip[i] = Short.parseShort(split[i]);
}
return new Ip(ip);
} |
98281264-c029-4271-901a-370f578ead98 | 2 | private static ArrayList<Point> setPoints(int n)
{
Random r = new Random();
ArrayList<Point> points = new ArrayList<Point>();
ArrayList<Point> available = new ArrayList<Point>();
points.add(new Point(0, 0));
while (n > 0)
{
for (Point location : points)
{
add(points, availa... |
6961cc1f-628d-4463-a7ed-3cae6594d129 | 3 | @Override
public void buy(Command cmd)
{
cmd.execute();
if(Storage.getInstance().getRevenue() < 10000.0)
{
restaurant.setState(restaurant.getBadstate());
}else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0)
{
restaurant.setState(restaurant.getNormalst... |
e308a837-4424-40ca-a2d5-55857bbd0245 | 2 | public String getAcceptKey() {
String key = this.getValue() + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
Base64 base64 = new Base64();
key = new String(base64.encode(md.digest(key.getBytes("UTF-8"))));
return key;
}
catch(NoSuchAlgorithmExcep... |
5268b63c-db62-446a-8701-89bdb2c5b76d | 9 | public static void main(String[] args) {
//System.out.println("Pakkausalgoritmi: " + );
long aloitusAika = System.currentTimeMillis();
String algoritmi = System.getProperty("pakkausalgoritmi");
if (algoritmi == null)
algoritmi = "huffman";
if (args.length != 3) {
System.out.println("Vr mr argumentteja.... |
e652c12e-ed89-424f-b11f-e80098b84c09 | 1 | private static void shuffle(int[] arr)
{
for (int i = 0 ; i != arr.length ; ++i) {
int j = random.nextInt(arr.length - i) + i;
int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
} |
db5e74c3-df99-4274-882c-0e14cd00f8c4 | 0 | public void doCancel(){} |
e5651276-6429-4340-9144-9c6c803e8a29 | 1 | public static void main(String[] args)
{
Song song = new Song(new File("Eine_Kleine_Nachtmusik.mid"));
try {
evaluate(new File("test.ff"), song);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
3b48328d-149e-4418-bcf5-3e5d5b87cad6 | 2 | protected void move(){
if (target!= null && m.checkEnemy(target) == true)
{
//System.out.println(target);
turnTowards(target.getX(), target.getY());
move(speed) ;
}//IllegalActor here making it turn when its not there (DID JAMES ADDD THIS?)
else
... |
d5cd0f96-584f-49f7-bfc7-a5bfa6d43df9 | 1 | private final List<String> getStringList (Object[] objList) {
List<String> list = new ArrayList<String>();
for (int i = 0; i < objList.length; i++) {
list.add((String)objList[i]);
}
return list;
} |
586a57a0-3115-48c3-aeaa-5db315343fbd | 1 | public List<String[]> getAttributes(){
List <String[]> l = new ArrayList<String[]>();
String[] s = new String[2];
if (masa != null){
s[0] = "masa"; s[1] = masa;
l.add(s);
}
s = new String[2];
s[0] = "CAT2OSMSHAPEID"; s[1] = getShapeId();
l.add(s);
return l;
} |
9d14b701-5b11-40e7-99cb-02e9a3181b3e | 1 | private void handleChannelCountResponse(String response) {
String count = response.split(" ", 3)[1];
if (serverEventsListener != null)
serverEventsListener.channelCountReceived(count);
} |
02b8c123-1bd3-4663-a50c-c8409e5004b5 | 2 | private static boolean isDinheiro(String valor) {
final String NUMEROS = "0123456789.";
for (int i = 0; i < valor.length(); i++) {
char caracter = valor.charAt(i);
if (NUMEROS.indexOf(caracter) == -1) {
return false;
}
}
return true;
... |
fb13f895-c9cc-4064-ac8e-830ddaa899a3 | 7 | private void update_info(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
this.bowl = deepCopyArray( bowl );
this.bowlId = bowlId;
this.round = round;
this.canPick = canPick;
this.musTake = musTake;
//... |
f25ea2a8-3da4-4c0f-8dd9-92f0a3fea08c | 2 | public void move()
{
Grid<Actor> gr = getGrid();
if (gr == null)
return;
Location loc = getLocation();
Location next = loc.getAdjacentLocation(getDirection());
if (gr.isValid(next))
moveTo(next);
else
removeSelfFromGrid();
F... |
d5ded535-1831-4d51-86a7-6c89bd14a995 | 5 | private String escapeString(String string)
{
if (
"and".equalsIgnoreCase(string)
|| "or".equalsIgnoreCase(string)
|| "not".equalsIgnoreCase(string)
) {
return '"' + string + '"';
}
String[] characters = { "\\", "(", ")", "\"" };
... |
12c396d0-ca72-45a7-876b-eb628291e007 | 2 | public static int countLines(File cardfile) {
try {
LineNumberReader reader = new LineNumberReader(new FileReader(cardfile));
int cnt = 0;
while (reader.readLine() != null) {}
cnt = reader.getLineNumber();
reader.close();
return cnt;
} catch (Exception e) {
return 0;
}
} |
816836cc-9c14-496f-b7af-d5cfd4e47c0a | 0 | public AlgorithmParametersType.ChallengeFormat createAlgorithmParametersTypeChallengeFormat() {
return new AlgorithmParametersType.ChallengeFormat();
} |
95c16cfc-a087-4cf3-a3c2-9ddb91f8f309 | 2 | public void DFSforReversedG(int nodeIndex) {
// push to stack, and mark explored;
pushToStack(nodeIndex);
nodesStatus.set(nodeIndex);
// printNodesStack();
// find next node this node has an directed edge to,that's not explored
// yet and do DFS on it, startBit to mark the index from which we
// should s... |
e6bb1971-bc76-4a40-b073-88431ecd1718 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
final MOB mob=msg.source();
if(((msg.amITarget(this))||(msg.tool()==this))
&&(msg.targetMinor()==CMMsg.TYP_ENTER)
&&(!CMLib.flags().isInFlight(mob))
&&(!CMLib.flags().isFalli... |
9291c51b-b063-4328-8b4c-b273fe4d2d79 | 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... |
9f05f9fc-68d6-42a7-aaac-2ad2ed5ee99a | 4 | public List<Point> getAvailablePositions(Player player) {
List<Point> positions = new ArrayList<Point>();
int skippedCaseW = Engine.WIDTH/2 / Tile.SIZE;
int skippedCaseH = Engine.HEIGHT/2 / Tile.SIZE;
Point p = new Point(0,0);
Point posPlayer = new Point( (int) player.getX()/Tile.SIZE, (int) player.getY()/... |
1d2e153e-413b-4c8d-b58f-f64209b623da | 1 | @Before
public void setup () throws IOException {
String explicitFile = System.getProperty("org.newsclub.net.unix.testsocket");
if ( explicitFile != null ) {
this.socketFile = new File(explicitFile);
}
else {
this.socketFile = new File(new File(System.getPrope... |
810702f5-9da4-45c2-8f22-5bfa48058acf | 3 | private void loadState(int state) {
if (state == STARTMENU) {
gameStates[state] = new StartMenu(this);
} else if (state == CHARACTERSELECT) {
gameStates[state] = new CharacterSelect(this);
} else if (state == GAME) {
gameStates[state] = new Game(this, character);
}
} |
1ddfb288-dff7-4b0e-a229-1185d4979fdc | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SimpleEmailAddress other = (SimpleEmailAddress) obj;
if (email == null) {
... |
39b6c74e-5c67-44fe-96d6-3d7d416844f0 | 6 | private boolean safe(Room room) {
if(!wumpusKB.known(room) || wumpusKB.evaluate(room)) { return false; }
if(!batKB.known(room) || batKB.evaluate(room) ) { return false; }
if(!pitKB.known(room) || pitKB.evaluate(room) ) { return false; }
return true;
} |
03048fbf-9f9e-4bed-b2f1-6b8a7a3ab365 | 0 | public static condition condFromString(String name) {
return getEnumFromString(condition.class, name);
} |
214c1998-163c-40a7-b412-5aa15af78d00 | 9 | public void updateAutoSize(CellView view) {
if (view != null && !isEditing()) {
Rectangle2D bounds = (view.getAttributes() != null) ? GraphConstants
.getBounds(view.getAttributes())
: null;
AttributeMap attrs = getModel().getAttributes(view.getCell());
if (bounds == null)
bounds = GraphConstant... |
0d1a668b-c3a9-45f1-a6b7-403b287636bc | 2 | public static void main(String[] args) {
int i; // 循环计数变量
int Index = a.length;// 数据索引变量
System.out.print("排序前: ");
for (i = 0; i < Index - 1; i++)
System.out.printf("%3s ", a[i]);
System.out.println("");
ShellSort(Index - 1); // 选择排序
// 排序后结果
System.out.print("排序后: ");
for (i = 0; i < Index - 1; i... |
6fcf7ae3-efe0-4c5d-9231-729764a815e7 | 1 | public void mute() {
if(masterVolume == 0f)
masterVolume = 2f;
else
masterVolume = 0f;
adjustVolume = true;
} |
c1f2559d-552b-4241-b266-0bc792eb71d6 | 1 | public static void init(final String initCode) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainWindow window = new MainWindow(initCode);
window.frmCompreterA.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
c852241e-328f-4fd5-b0ff-e7dc3f2e4a26 | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
2741eff5-00d0-4b4a-a8df-f3e19fedc514 | 2 | private double rowAdd(Double[][] mat, int rowTo, int rowFrom, double scaleFactor)
{
if (rowTo == rowFrom)
return rowScale(mat, rowTo, scaleFactor + 1);
for (int i = 0; i < mat[0].length; i++)
{
mat[rowTo][i] = mat[rowTo][i] + mat[rowFrom][i] * scaleFactor + 0.0;
}
return 1.0;
} |
d30d696a-b504-4e76-a472-c9dd9df06b87 | 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... |
f4227356-f271-4177-a117-a9b19abfb5ea | 5 | public void execute(Nodo inicio)
{
fila.add(inicio);
distancias[inicio.getId()]=0;
pred[inicio.getId()]=inicio.getId();
for(Link a: inicio.getLinks()){
distancias[a.getDestino().getId()]=a.getPeso();
pred[a.getDestino().getId()]= inicio.getId();
}
while(!fila.isEmpty())
{
Nodo work= nexter(); ... |
457d3d20-2446-4195-81d0-5fa03d9621de | 7 | public static Vector<String> findPackages() {
Vector<String> result;
StringTokenizer tok;
String part;
File file;
JarFile jar;
JarEntry entry;
Enumeration<JarEntry> enm;
HashSet<String> set;
result = new Vector<String>();
set = new HashSet<String>();
// check ... |
4091c186-0e57-4a94-acb6-0e5227b82868 | 0 | public Combinacion(int idCombinacion, int claveles, int margaritas, int gladiolos, int rosas, int gerberas, int verdes, int lilium, int alstromeria, int anturium, int lisiantus, int paniculata, int ruscus) {
this.idCombinacion = idCombinacion;
this.claveles = claveles;
this.margaritas = margarit... |
f863a547-69c5-4d54-8151-376152501578 | 3 | private List<IdentityDisc> getIdentityDiscsOfGrid(Grid grid) {
final List<IdentityDisc> identityDiscs = new ArrayList<IdentityDisc>();
for (Element e : grid.getElementsOnGrid())
if (e instanceof IdentityDisc && !(e instanceof ChargedIdentityDisc))
identityDiscs.add((IdentityDisc) e);
return identityD... |
79492a72-0e7a-47d3-af8e-f47887a1f73b | 7 | public Boolean cadastarNovo(Cidadao cidadao) {
Boolean sucesso = false;
Connection connection = conexao.getConnection();
try {
String valorDoComandoUm = comandos.get("cadastarNovo" + 1);
String valorDoComandoDois = comandos.get("cadastarNovo" + 2);
StringBuild... |
99a893c2-f336-4264-afc3-a56db57f81b7 | 0 | private void initialize(){
frame.setIconImage(MAIN_ICON.getImage());
frame.setSize(WINDOW_SIZE);
frame.setResizable(false);
frame.setLocation((int) (SCREEN_SIZE.getWidth() / 2 - frame.getWidth() / 2),
(int) (SCREEN_SIZE.getHeight() / 2 - frame.getHeight() / 2));
... |
550bb6be-560c-4ce7-9e57-b8fb6149439f | 7 | private final void diff(final Git session, final RevWalk walk,
final RevCommit commitNew, final ObjectReader reader)
throws MissingObjectException, IncorrectObjectTypeException,
IOException {
int i = 0;
if (commitNew.getParentCount() == 0) {
final RevTree treeNew = commitNew.getTree();
this.treePars... |
52c1481a-a418-448f-9b08-1236da237240 | 2 | public void RunTest() throws Exception {
System.out.println("RunTest.");
Long id = (Long)conn.call(new CommandContent().addMethod("getClientId"));
System.out.println("Client connection id " + id);
System.out.println("Start calls.");
for (int i = 0; i < callcount; i++) {
String ans = (String)co... |
5e482f43-861a-4817-8b12-59e75c591ec5 | 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... |
6b46b24d-4f7a-4e0f-b8bb-cd6769fcf053 | 2 | @Override
public void dealDamage(int amount, Object source) {
if (source instanceof Projectile) {
Projectile p = (Projectile) source;
if (p.getImageName().equals("arrow")) return;
}
super.dealDamage(amount, source);
} |
0390a3a4-5cc8-49e9-81ed-740d50df75e3 | 8 | public void printMovieInfo(Movie movie) {
int index = 0;
_showTimes = new ArrayList<ShowTime>();
System.out.println();
System.out.println(movie.getTitle());
System.out.println("=================================");
System.out.println("AVAILABLE IN\t: " + movie.getType());
System.out.println("CAST\t\t: "... |
4d72495b-e3fc-4379-aba6-a3e26a1bda37 | 6 | public Ticket retrieveTicket(int id) {
Ticket result = null;
ResultSet rs = null;
PreparedStatement statement = null;
try {
statement = conn.prepareStatement("select * from Tickets where TicketID = ?");
statement.setInt(1, id);
int workerid_fk;
int ticketid;
String subject;
boolean pendi... |
d90ec9e4-3b7f-4d4f-98fd-41adc632d77a | 1 | public void calculateWeights(){
for(int i = 0; i < itemIds.length; i++){
weightsUserId1[i] = pearson * ratings1[i];
weightsUserId2[i] = pearson * ratings2[i];
}
} |
6f2e89a1-2df6-4bab-9225-632a1f097d83 | 9 | private boolean fn_arr_member() {
// check format: "(" [ argument_list ] ")" | "[" expression "]"
if (lexicalAnalyzer.getToken().getType().equals(LexicalAnalyzer.tokenTypesEnum.PAREN_OPEN.name())) {
//check format: "(" [ argument_list ] ")"
if (!operatorPush(new Opr_SAR(lexicalAn... |
3f8ca680-fa2b-44bd-b983-246b0d531ddb | 6 | public synchronized boolean split(Bucket bucket)
{
boolean containsLocalNode = bucket.containsBucketContact(getLocalNode().getNodeId());
if ((containsLocalNode || bucket.equals(smallestSubtreeBucket)) && !bucket.isTooDeep())
{
List<Bucket> buckets = bucket.split();
... |
9f0521be-51e3-4fb6-93d7-e1921fb8519f | 2 | public void weeklyBonus(Player player)
{
if (color == player.getColor()) {
for(CastleBuilding b: buildings) {
b.weeklyBonus(player, this);
}
}
} |
d9ca7609-3231-4754-aa6b-3a6816636532 | 4 | public static void main(String[] args) {
GameKeitai1 taro = new GameKeitai1(
"太郎", "012-1234-5678", "taro@test.jp");
GameKeitai2 hanako = new GameKeitai2(
"花子", "999-8888-7777", "hanako@test.jp");
for(int i=0; i<3; i++){
taro.denwaSuru();
}
for(int i=0; i<3; i++){
hanako.denwaSuru();
}
... |
9ef93061-663e-41bf-9742-861b9484fead | 5 | public void Commands_time() {
if(args.length == 1) {
if(args[0].equalsIgnoreCase("day")) {
player.getWorld().setTime(0);
}
else if(args[0].equalsIgnoreCase("night")) {
player.getWorld().setTime(12000);
}
else {
player.sendMessage(ChatColor.RED + "Argument invialide");
... |
69bf5970-e0df-4b1d-b4fb-267ccccb1993 | 8 | public void initAStar() {
if (startX<0||startX>=width||endX<0||endX>=width
||startY<0||startY>=height||endY<0||endY>=height) {
log("ERROR: invalid initialization values!");
}
setHeuristicAll();
openqueue.clear();
grid[startY][startX].G = 0.0;
grid[startY][startX].calcF();
grid[startY][startX].paren... |
f249af31-ba7c-40cd-86c0-f0ee15eadd10 | 6 | @Override
public ExplicitMod deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
for (String s : Constants.ESCAPED_MODS) {
Pattern p = Pattern.compile(s);
Matcher m = p.matcher(jsonElement.getAsString());
... |
aeff30e3-bd7b-4064-94d7-9244ece1514f | 8 | public LinkedList<Moneys> take(int am,String player,String game)
{
if(this==printer.pot && score < am)//the pot will always give itself money out of air rather than go negative
{
LinkedList<Moneys> temp=new LinkedList<Moneys>();
temp.add(new Moneys(this.name,am-score));
this.give(temp,game);
}
LinkedL... |
fe4f536f-710e-4597-88de-ba7ee73a369a | 4 | public void deleteBookLanguage(long id) {
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCon.... |
47149457-6d83-4c28-a798-bd7397de0eea | 1 | @Override
public void removeClickListener(ClickListener listener) {
if (listener != null) this.clickListeners.remove(listener);
} |
a5625ff5-c7cc-4f77-ac67-364bf2c1ccf8 | 7 | public String toString() {
String s = "lastCheckpoint : int = " + String.valueOf(this.lastCheckPoint) + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
s = s + "identifierStack : char["+(this.identifierPtr + 1)+"][] = {"; //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i <= this.identifierPtr; i++) {
s = s + "\"" + String.valueOf... |
c8d8ff2a-4f30-46c4-b222-fa26653eef9b | 7 | public static void main (String [] args) throws Exception {
try {
System.out.println(System.getProperty("user.dir"));
CatalogReader foo = new CatalogReader ("Catalog.xml");
Map <String, CountedTableData> res = foo.getCatalog ();
System.out.println (foo.printCatalog (res));
... |
20913143-afe1-4465-9241-d0c97240f862 | 0 | void setAsPossibleBreakPoint() {
possibleBreakpoint = true;
} |
bcbaf167-c719-4d71-820c-ca34707ce998 | 2 | public static void destroySession(int sessionId) {
Actions.addAction(new Action(ActionType.INFO, "Attempting to kick session id: 0x" + Integer.toHexString(sessionId) + " from the Server..."));
Session sess = sessions.get(sessionId);
if(sess != null) {
final Channel c = sess.getChannel();
BroadcastMessage ki... |
7633f956-aa0d-469a-99cc-326d2abbf2b8 | 0 | public void setLength(long value) {
this.length = value;
} |
ef635bef-48b2-45c0-bb87-ed0f99890333 | 2 | public BeansContainer() {
registry = new HashMap<Class<?>, Class<?>>();
interceptors = new Interceptor[] {
new TransactionableInterceptor(),
new BeanInterceptor()
};
} |
f844ba2b-3626-4460-8ca0-c0c47342a1d8 | 0 | public AssetManager getAssetManager(){
return assetManager;
} |
20f24890-77f3-4830-8767-fad8c3ccd5cd | 4 | public GLWindow() throws InterruptedException {
try {
Display.setDisplayMode(new DisplayMode(800, 600));
Display.setTitle("Renderer");
Display.setResizable(false);
Display.create();
} catch (LWJGLException e) { // Fix for old Computers | Nvidia Processors
if(e.getMessage() == "Pixel Format Not Acce... |
3c87f70d-e11a-4157-931d-b6aacbbed084 | 3 | public void createWindow() throws Exception {
Display.setFullscreen(false);
this.theWorld.generate();
/*
* DisplayMode d[] = Display.getAvailableDisplayModes(); for (int i = 0;
* i < d.length; i++) { if (d[i].getWidth() == 640 && d[i].getHeight()
* == 480 && d[i].getBitsPerPixel() == 32) { displayMode = ... |
5397d80a-cf37-4093-9625-6410fac3faf3 | 5 | public CheckResultMessage check4(int day) {
BigDecimal a1 = new BigDecimal(0);
int r3 = get(13, 5);
int c3 = get(14, 5);
if (version.equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
a1 = getValue(r3 + day, c3 + 1, 3).subtract(
getValue(r3 + day, c3, ... |
c7448f71-4af4-49d8-b2ef-47473392a029 | 8 | public static int[] quickSort(int[] array, int start, int end) {
int s = start;
int e = end;
if(end-start < 1) {
return array;
}
if(end-start == 1) {
if(array[start] > array[end]) {
int tmp = array[start];
array[start] = array[end];
array[end] = tmp;
}
return array;
}
int key ... |
53d8797a-2d24-456c-b124-bbcd85ded8ed | 1 | public static void main(String[] args) {
ConcreteAggregate aggregate = new ConcreteAggregate();
aggregate.addObject("1");
aggregate.addObject("3");
aggregate.addObject("5");
aggregate.addObject("7");
aggregate.addObject("9");
Iterator iterator = new ConcreteItera... |
e2f08d21-ee15-4de6-a322-a03ff1f2dc2d | 6 | public ListNode deleteDuplicates(ListNode head) {
// Start typing your Java solution below
// DO NOT write main() function
if (head == null || head.next == null)
return head;
ListNode prev = new ListNode(0); // 当前的前驱节点
ListNode root = prev; // 整体的前驱节点
int preVal = head.val;
ListNode cur = head;
boole... |
9d194506-1c72-4589-bbf8-abc2201b611a | 1 | @Override
public final String toString()
{
return "Bencoding Exception:\n"+(this.message == null ? "" : this.message);
} |
db4d9319-ff88-4a77-b342-c186aa8f9f26 | 6 | GenericGFPoly(GenericGF field, int[] coefficients) {
if (coefficients.length == 0) {
throw new IllegalArgumentException();
}
this.field = field;
int coefficientsLength = coefficients.length;
if (coefficientsLength > 1 && coefficients[0] == 0) {
// Leading term must be non-zero for anythi... |
606bb29d-2ef5-4ea5-8bf8-2b12d9b95705 | 1 | private void preencheTabela(List<UsuarioSistema> lista){
this.modelo = new DefaultTableModel();
modelo.addColumn("Id");
modelo.addColumn("Nome");
modelo.addColumn("Cpf");
modelo.addColumn("Rg");
modelo.addColumn("Data de Nascimento");
modelo.addColumn("Usuario");
... |
f28b1720-ecec-41f5-926b-306301e4a772 | 1 | private int getNumero(int[] datos, int i) {
if (i < datos.length) {
return datos[i];
} else {
return 0;
}
} |
0da69e3f-938e-4bff-b041-54b045393ab9 | 6 | public static Collection<IndexCommit> listCommits(Directory dir) throws IOException {
final String[] files = dir.listAll();
Collection<IndexCommit> commits = new ArrayList<IndexCommit>();
SegmentInfos latest = new SegmentInfos();
latest.read(dir);
final long currentGen = latest.getGeneration();
... |
025304c5-a03c-4c5e-a1e5-b27c7c0e4637 | 1 | public Document buildUpdateStatus(Document document, Element root, ReversiBoard board, boolean update){
Element currentPlayerElement = document.createElement("update_status");
String updateString;
if(update) updateString = "completed";
else updateString = "failed";
Text text = do... |
d7936819-b650-4487-ba31-73a2a9bc778c | 4 | private boolean isCastleLocationSafe(int baseYPos, int direction){
Position rookInitPos = (direction == 1) ? new Position(7, baseYPos) : new Position(0, baseYPos);
int xPos = 3+direction;
Position gonnaInspectPos = new Position(xPos, baseYPos);
while(!rookInitPos.equals(gonnaInspectPos)){
//킹과 캐슬 사이는 비... |
116c512f-3ada-48e0-b3a2-255c0442ef20 | 5 | protected void loadMap(String name, String fileName, HashMap<String, String> map) {
if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'");
int i = 1;
for (String line : Gpr.readFile(fileName).split("\n")) {
String rec[] = line.split("\t");
String id = rec[0];
String componentId =... |
2448ab61-7a94-4bfa-8c8e-9ac1c4dfbf72 | 9 | public void actionPerformed(ActionEvent e){
String option = e.getActionCommand();
if(option.equals("add another")){
JTextField TxtF = new JTextField(10);
TxtF.setFont(Themes.componentsFont);
TxtF.setAlignmentX(Component.CENTER_ALIGNMENT);
tagsPanel.add(TxtF);
JTextField TxtF2 = new JTe... |
e871db00-51cb-467f-8cd7-c6affdc348a3 | 4 | public void acquaireIngridient(Dish dish) {
Vector<Ingredient> dishIngredients= dish.getDishIngredients();
for (int i= 0; i < dishIngredients.size(); i++) {
boolean found= false;
int location= 0;
for (int j= 0; ((!found) && (j < this._availableIngredients.size())); j++) {
found= (this._availableIngredi... |
a8b5a6b1-b71f-4800-85c7-06a626cdbe67 | 0 | public T getSecond() { return second; } |
2b784c42-b269-4c0b-a9da-032078a38d15 | 2 | private String get(String variable, String lookahead) {
try {
return (String) pane.table.get(variable, lookahead).first();
} catch (IllegalArgumentException e) {
return null;
} catch (NoSuchElementException e) {
return null;
}
} |
c4a847e4-6159-4270-8e71-3016f8f4eb80 | 5 | private void drawTile(Tile t, Graphics g, int x, int y, int width,
int height) {
if (t.isCollidable()) {
g.setColor(ColorDirector.getCurrentPrimary((t.isSlowWall() ? ColorType.SLOW_WALL
: ColorType.WALL)));
g.fillRect(x, y, width, height);
if (x < scaledXDistLeft || x > scaledXDistRight)
return;... |
f1f7de71-2073-4880-b0ed-4cef354145c6 | 1 | public void addQuizToDB() {
try {
String statement = new String("INSERT INTO " + DBTable
+ " (name, url, description, category, userid, israndom, isonepage, opfeedback, oppractice, raternumber, rating)"
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepare... |
e3ad1414-ef7c-4a7e-ba79-6cae321c5c1e | 6 | public boolean dealerHit() {
if (this.hand.totalvalues()[0] < 17 && this.hand.totalvalues()[0] == this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[0] <= 17 && this.hand.totalvalues()[0] != this.hand.totalvalues()[1]) {
return true;
} else if (this.hand.totalvalues()[1] < 17 && t... |
f37359bc-32f9-4967-8a4f-78a97b8e0bee | 4 | public final synchronized boolean readBoolean(){
boolean retB = true;
String retS = this.readWord();
if(retS.equals("false") || retS.equals("FALSE")){
retB = false;
}
else{
if(retS.equals("true") || ... |
d84f3573-09f7-45fb-8822-54895a5c376d | 8 | private boolean searchUpForPrevSupersetNode( Node node, K key, Object[] ret ) {
if( node.mLeft != null && mComp.compareMaxes( key, node.mLeft.mMaxStop.mKey ) <= 0 ) {
ret[0] = node.mLeft;
return false;
}
while( node.mParent != null ) {
if( node == node.mParen... |
15fd271d-1563-4c2b-bed5-3a7f0a1f213c | 0 | void foo3() {
} |
1047ed44-c93c-441e-8469-d0d95d166fe5 | 0 | public void displayScreen(Screen screen) {
this.currentScreen = screen;
} |
88904aaf-a728-4ddb-8f6b-2487bcee3a38 | 2 | static boolean isZin(String reeks) {
boolean spatie = false;
for(int i = 0; i < reeks.length(); i++) {
if(reeks.charAt(i) == ' ') {
spatie = true;
break;
}
}
return spatie;
} |
83fba600-c1eb-41b6-a49a-9d28703f6ccd | 9 | public boolean move(int dx, int dy, Set<RenderObject> allObjects) {
// Did we encounter a collision during the movement?
boolean collision = false;
if (hasCollision) {
// We need to check for collision.
// Create a set for all possible collision targets.
Set<RenderObject> collisionTargets = new... |
0d3406c0-63d9-4897-aca7-838ddc31a2b3 | 0 | private void hidePanels(Container lastOpen)
{
buttonPanel.setVisible(false);
manualPanel.setVisible(false);
programmerFrame.setVisible(false);
lastOpen.setVisible(true);
} |
20053f3d-a26a-45d3-8b82-d6f47817dfa3 | 9 | private static EntropyDecoder getDecoder(String name, InputBitStream ibs)
{
switch(name)
{
case "FPAQ":
case "CM":
case "PAQ":
case "TPAQ":
return new BinaryEntropyDecoder(ibs, getPredictor(name));
case "HUFFMAN":
... |
b664378e-4697-4f2e-8757-134b6fff9c48 | 2 | public void done() {
done = false;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
closebtn.setEnabled(true);
status.setText("The error has been reported.");
pack();
}
});
synchronized(this) {
try {
while(!done)
wait();
} catch(InterruptedException e) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.