method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7991cc8c-4408-4e77-a6c8-da35fe7ab068 | 7 | public void subdivide(BvhNodeT node){
if( !needsSubdivision(node))
return;
ArrayList<Integer> subset_A = new ArrayList<Integer>(0);
ArrayList<Integer> subset_B = new ArrayList<Integer>(0);
float SAH = Float.MAX_VALUE;
// find best SAH
// 1) aabb max
for(int i = 0; i < ... |
611e5334-763b-4115-9473-52d0122f9e58 | 2 | public int getBlockWord(String word) {
for (int i = 0; i < names.size(); i++)
if (names.get(i).equals(word))
return i;
names.add(word);
return names.size() - 1;
} |
d9af89a0-1999-4ee7-93a6-830db123efdc | 8 | public static ArrayList<EffectBlock> generateLevelEffectBlocks(Global global, Image gridTex, Boolean removable){
System.out.println("Generating Level Effect Blocks...");
ArrayList<EffectBlock> blocks = new ArrayList<EffectBlock>();
//Each Block
int count=0;
for (int y = 30; y < 660; ... |
4712ce55-25b4-419d-b7e7-09861921429b | 5 | @Override
public boolean modifyTravelLog(String field, String toChange) {
boolean success = true;
if(field.equals("departurePoint"))
departurePoint = toChange;
else if(field.equals("travelMethod"))
travelMethod = toChange;
else if(field.equals("locationWeather"))
locationWeather = toChange;
else if(... |
0fd0e595-6fbe-4ab5-9d54-a0926dc2ea67 | 9 | void generate() {
cores = new Vertex[numCore];
for(int i=0; i<numCore; i++) {
cores[i] = new Vertex( 1, i);
}
tors = new Vertex[numTor];
for(int i=0; i<numTor; i++) {
tors[i] = new Vertex( 2, i);
}
nodes = new Vertex[numNodePerTor*numTor];
for(int i=0; ... |
e52fe2e3-7e04-487d-a6d7-b3ac87d91e00 | 8 | public void load() throws FileNotFoundException,IOException{
if(!f.exists())throw new FileNotFoundException("Couldn't find the File "+f.getAbsolutePath());
BufferedReader in = new BufferedReader(new FileReader(f));
String read = "";
int i=0;
while ((read = in.readLine())... |
521f094d-04ef-4248-9387-648a0a2d84ef | 8 | public void closeCurrentApp(DialServer dialServer) {
if (dialServer != null) {
try {
DefaultHttpClient defaultHttpClient = HttpRequestHelper.createHttpClient();
CustomRedirectHandler handler = new CustomRedirectHandler();
defaultHttpClient.setRedirectHandler(handler);
BasicHttpContext localContext ... |
41537307-cc84-469b-bd29-1b39778304bd | 8 | public void validate() throws MissingCredentialException {
if (getUserName() == null || getUserName() == "") {
throw new MissingCredentialException("username can't be empty");
}
if (getPassword() == null || getPassword() == "") {
throw new MissingCredentialException("password can't be empty");
}
if (thi... |
d2c3f878-a374-4415-9b31-78285e0f1e1e | 4 | private void optimizeTokens() {
Vector<Token> optimal = new Vector<Token>();
optim : for (Token token: tokens) {
if (!optimal.isEmpty())
for (Token t:optimal) {
if (token.equals(t))
continue optim;
}
optimal.add(token);
}
tokens = optimal;
} |
3f7b4bef-5d4a-49c5-8013-2d3ae1353e5a | 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... |
bb395336-d4b4-4d1f-9ea2-c296be0e1679 | 0 | public double getAgility() {
return agility;
} |
c0534c66-6883-43d7-8452-5f82ffab079f | 2 | public List<Position> getPositions() {
List<Position> positions = new ArrayList<Position>();
positions.add(getPosition());
for (int i = 1; i <= getLength(); i++) {
Position pos = null;
if (getDirection() == Direction.HORIZONTAL) {
pos = new Position(getPosition().getxCoordinate() + i, getPosition().g... |
d73372a9-9580-4975-9005-011c989edc1e | 8 | public Type getCastHelper(Type fromType) {
Type hintType = fromType.getHint();
switch (hintType.getTypeCode()) {
case TC_ARRAY:
if (!elementType.isClassType()
|| !((ArrayType) hintType).elementType.isClassType())
return tObject;
Type middleType = elementType
.getCastHelper(((ArrayType) hintTyp... |
c82b871c-a3bd-4a0c-8e71-285cf02dde4c | 1 | public int compareTo(Object o) {
return (equals(o) ? 0 : -1);
} |
7fc617d1-10c9-412d-bdd3-5df6efc22065 | 5 | public List<Account> getAccounts() {
List<Account> accounts = new ArrayList<>();
try (BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath)))) {
String line = br.readLine();
while (line != null) {
line = line.trim();
if (!line.isEmpty()) {
String[] spl... |
29adb1c4-a888-4711-83b8-fbf2e2d54c4c | 7 | public static void save(Player player){
int posx, posy, mapId, level, gold;
posx = player.getPosX();
posy = player.getPosY();
mapId = RPG372.gameInstance.getMap().getId();
level = player.getPD().getLevel();
gold = player.getPD().getInv().getGold();
QueryExecutor qe = new QueryExecutor();
qe.updateQuery(... |
0883f0a6-4502-41c0-8431-ccd06b1302bd | 6 | public void actionPerformed(ActionEvent e)
{
int point = moveController.move();
mapCanvas.setLocations(moveController.getPlayersLocation());
if (point > 0) {
scoreboard.pointEat();
if (point == 1) {
TrackType eat = (TURN_DURATION > 19) ? T... |
af18b82c-ea5c-4ff0-b022-c2534fdf805c | 1 | public JPanel getUsertileLayoutMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.usermenuLayoutMenu;
} |
336007e5-23fb-4e94-9580-6d9891256bd8 | 1 | public void unserializeTable(){
try{
File f = new File(TABLE_FILE);
f.createNewFile();
InputStream file = new FileInputStream(TABLE_FILE);
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new ObjectInputStream (buffer);
try{
table=(LookupTable)input.readObject();
... |
7bf17bff-8ddb-4280-a54d-65d182524ee6 | 0 | @Override
public void connectionLost(String message) {
Debugger.println("network", "[ConnectionBundle] Lost connection to client: " + message);
removeConnection(this);
} |
fec92501-4b1d-4723-bd07-6f398cd20f49 | 1 | public ResultSet selectQuery(String query){
try
{
stmt = conn.createStatement();
query.replace("TABLE_NAME", table_name);
results = stmt.executeQuery(query);
stmt.close();
}catch (SQLException sqlExcept)
{
sqlExcept.printStac... |
4cb2b526-73a5-41c7-8cff-f5d373788394 | 5 | @EventHandler
public void playerChatEvent(AsyncPlayerChatEvent e){
Player player = (Player)e.getPlayer();
String prefix = ChatColor.RED+"[@Bot("+plugin.getBotName()+")] ";
// suppressed for the time begin. Not sure why I made it, but it's here so I'll keep it...
String prefixEnd = ChatColor.RED+"[@ConsoleB... |
fd1945d2-ec67-455e-86fe-8d588a48a002 | 5 | public static void checkContagion(Actor actor) {
final Tile o = actor.origin() ;
final float squalor = actor.world().ecology().ambience.valueAt(o) / -10 ;
for (Object d : Abilities.SPONTANEOUS_DISEASE) {
final Condition c = (Condition) d ;
//
// Let's say that under average squalor, ... |
97d4f573-01c4-402f-852a-db3c01985d43 | 0 | public void center(){
xOffset = ((Base.level.width * 32) / 2) - (width / 2);
yOffset = ((Base.level.height * 32) / 2) - (height / 2);
} |
c0fa9eba-24ee-496d-80ce-844f35f0c8f1 | 3 | public static void dumplist(Collection<Resource> list, Writer dest) {
PrintWriter out = new PrintWriter(dest);
List<Resource> sorted = new ArrayList<Resource>(list);
Collections.sort(sorted);
for (Resource res : sorted) {
if (res.loading) continue;
if (!res.skip_caching) out.println(res.name + ":" + res.v... |
e909348e-b323-444e-bdcb-ecc8987d6f60 | 4 | public String getPlayerPlantAbleList(Player p){
FcPlayers fc = new FcPlayers(plugin, p);
if(fc.getPlayerJob().equalsIgnoreCase("Farmer")){
FcFarmers fm = new FcFarmers(plugin, p);
String rank = fm.getRank();
if(rank.equalsIgnoreCase("Farmer")){
String base = "OXEYE_DAISY:AZURE_BLUET:P... |
fd4e7478-5b22-433e-94c2-8f0006c3f654 | 7 | public Process getLowestProcess(){
Process process = this.currentProcess;
int cnt =0;
while(this.priorityQueue.iterator().hasNext() && cnt++ < processNumber){
Process tmp = this.priorityQueue.iterator().next();
if(tmp == process)
break;
if(proc... |
188edb89-3498-4f22-bede-cd67782d05f3 | 5 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
boolean done = false;
String s = in.next();
int n = in.nextInt();
int[] v= new int[26];
int max = 0;
for(int i=0;i<26;i++){
v[i]=in.nextInt();
max = Math.max(max, v[i]);
}
for(char c : s.toCharArray()){
if(v[c... |
3e788e48-89f1-4772-84c3-882f41ef0275 | 1 | public static void main(String[] args){
String[] suitArray = {"Spades", "Diamonds"};
String[] rankArray = {"Ace", "Jack"};
int[] pointArray = {1, 2};
List<String> suitArrays = Arrays.asList(suitArray);
ArrayList<String> a = new ArrayList(suitArrays);
for (int i = 0; i < a.size(); i++){
String item = a.ge... |
01909990-8e5e-4b4f-b47a-8be3323c851e | 4 | protected void emptyWin(){
boolean test = false;
if (test || m_test) {
System.out.println("Othello :: emptyWin() BEGIN");
}
m_win.clear();
if (test || m_test) {
System.out.println("Othello :: emptyWin() END");
}
} |
9d5ad0ae-a18e-415e-959b-bb0fdf1c468a | 2 | private static void checkInit() {
if (isInit)
return;
try {
Controllers.create();
props = new Properties();
props.load(new BufferedInputStream(new FileInputStream("default.cfg")));
isInit = true;
} catch (LWJGLException | IOException e) {
throw new RuntimeException(e);
}
} |
c2d66389-aab3-49cd-a6fe-9eb08593a542 | 3 | public byte[] EMSA_PKCS_Encoding(String file, int emLen) throws Exception {
byte[] SHA1_DER = new byte[]{(byte) 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14};
byte[] Hash = getHash(file);
byte[] T = new byte[Hash.length + SHA1_DER.length];
Syst... |
a4373a4e-628c-4eb4-8585-be7db6684276 | 1 | synchronized void classNameChanged(String oldname, CtClass clazz) {
CtClass c = (CtClass)getCached(oldname);
if (c == clazz) // must check this equation.
removeCached(oldname); // see getAndRename().
String newName = clazz.getName();
checkNotFrozen(newName);
... |
3e6afd7f-0f2c-47a6-9a5b-03b56d5fef3a | 5 | public String move(String _in)
{
String cmd[] = _in.split(" ");
int _move;
int _player;
if(cmd.length != 3)
{
return "ERROR ARGLENGTH_NOT_VALID";
}
try
{
_move = Integer.parseInt(cmd[1]);
_player = Integer.parseInt(cmd[2]);
}
catch(NumberFormatException exc_move)
{
r... |
c6954688-b802-4a0a-9a0f-89c17e6ca47e | 7 | private boolean updateScreenTodaysLabelsAndIds(final String id_actv, final int daysShownActivityRowsNum){
//Update viewable labels
showActvRows(daysShownActivityRowsNum);
if( id_actv != null && !id_actv.equals("") ){
//Fix: Case only ONE (1) activity label.
if( id_actv... |
e7587e06-5fc2-452a-938b-1d6f943a5229 | 8 | public Explorer() {
String date = (new SimpleDateFormat("EEEE, d MMMM yyyy")).format(new Date());
m_LogPanel.logMessage("Weka Explorer");
m_LogPanel.logMessage("(c) " + Copyright.getFromYear() + "-" + Copyright.getToYear()
+ " " + Copyright.getOwner() + ", " + Copyright.getAddress());
m_LogPanel.... |
71bc7231-faac-4b94-9109-c4e6a58c0faa | 6 | @Override
public int compareTo(Individual arg) {
// Compare by class name first:
String first = getClass().getSimpleName();
String argFirst = arg.getClass().getSimpleName();
int firstCompare = first.compareTo(argFirst);
if(firstCompare != 0)
return firstCompare;
... |
20dd252a-8369-4aaa-9056-6ea9608e62c4 | 8 | private String unboxedClass(Class _class) {
if (_class.equals(Boolean.TYPE)) {
return "java.lang.Boolean";
} else if (_class.equals(Character.TYPE)) {
return "java.lang.Character";
} else if (_class.equals(Byte.TYPE)) {
return "java.lang.Byte";
} else if (_class.equals(Short.TYPE)) {
... |
4a59ac8b-cfd7-4d62-aed6-3a8d6bb2b749 | 2 | private void addPanel(String remoteNum,JLabel l,JPanel p){
container.removeAll();
JLabel label = l;
JPanel panel =p;
JLabel label2 = new JLabel();
label2.setPreferredSize(new Dimension(200, 70));
label2.setFont(nameFont);
label2.setAlignmentX(CENTER_ALIGNMENT);
if(Phone... |
bcf63e2a-28d0-4b8a-92f6-de5ace55e635 | 9 | private ArrayList<Position> obtenirPositionsDesCasesDesPionsAInverser(
Position unePosition) throws AucunPionARetournerExeption
{
ArrayList<Position> positionsDesCasesDesPionsAInverser = new ArrayList<Position>();
Case laCase = this.plateau.obtenirCase(unePosition);
Couleur laCouleurDuPionPose = this.plateau.... |
ef31257d-215c-43c8-8023-59f82141f7f4 | 0 | protected boolean canBreed()
{
return getAge() >= getBreedingAge();
} |
3268e981-bed1-4d99-b484-a81059c5e23c | 8 | private void button_clean_blue_listMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_clean_blue_listMousePressed
if(frame_index_selected!=-1)
{
if(current_frame==null)
{
Element new_frame = hitboxes_doc.createElement("Frame");
new_frame.setAttribute("n... |
15b14209-26ed-4580-be8d-edaba32ab0f6 | 3 | public int getSubComponentIndex(GUIComponent component) {
if (!solidified) {
return initSubComponents.indexOf(component);
}
for (int i = 0; i < subComponents.length; i++) {
if (component == subComponents[i]) {
return i;
}
}
re... |
e1c01c1d-f2a9-4bd7-a59d-dfeeee0838bb | 9 | @Override
public LinkedList<Individual> crossover(int[] parents, Population pop) {
LinkedList<Individual> children = new LinkedList<Individual> ();
Random r = new Random();
//choose 2 parents
int r1 = r.nextInt(parents.length);
int r2 = r.nextInt(parents.length);
Individual p1 = pop.people[parents[r1]]... |
cee8bf86-42f2-4b96-b978-158e72c350f2 | 7 | protected String attributeValuesString(Instance instance) {
StringBuffer text = new StringBuffer();
if (m_Attributes != null) {
boolean firstOutput = true;
m_Attributes.setUpper(instance.numAttributes() - 1);
for (int i=0; i<instance.numAttributes(); i++)
if (m_Attributes.isInRange(i) && i !=... |
7eabe787-44a3-442a-9281-2f54431c0d11 | 8 | private static void addColumnsToCacheModel(CacheModel cModel,
CacheConfigPT cacheCfg) {
cModel.addAddColumns(new PidAddColumns());
if (cacheCfg.isDataInstrSeparated()) {
cModel.addAddColumns(new DISepAddColumns((int) Math.pow(2, cacheCfg
.getNumberEntriesNBits(true))));
} else {
cModel.addAddColumns... |
5352d31a-943a-4178-9aa8-23cdf51754c0 | 5 | public Player(File file)
{
// prend un fichier et test quel est son extention (mp3, ogg, wav, flac)
boolean b = Pattern.matches(".*\\.mp3$", file.getName());
InterfaceAudioFileDecoder result = null;
if(b)
{
result = new AbstractNonWaveReader(file);
}
b = Pattern.matches(".*\\.wav$", file.getName());
... |
f63ec0fd-0f5d-44c9-b442-2840d9b3e4bb | 3 | @Override
public void beforePhase(PhaseEvent event) {
if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE)) {
System.out.println("Depois da Fase - beforePhase" + event.getPhaseId());
Session session = FacesContextUtil.getRequestSession();
try {
session.g... |
22d54b42-4a85-42b7-9137-84726f903630 | 8 | public boolean deleteLoc(Point point){
int curr=findIndex(point);
//If not found, return false.
if(curr==-1){
return false;
}
//found.
//if curr,dirFrom,dirTo is equal to selectIndex, then set it to -1;if not, then do not change.
if(curr==selectIndex){
selectIndex=-1;
}
... |
462e691f-cbfc-4bd2-a4fc-c22ee2abb55a | 7 | private static void downloadNatives(){
try{
LauncherFrame.notificationLabel.setText("Download dei natives in corso ... 0%");
String osName = System.getProperty("os.name");
URL url = null;
if (osName.startsWith("Win"))
url = new URL(Settings.winNatives);
else if (osName.startsWith("Linux"))
url ... |
b68e086a-5aaf-4674-9e85-b26076a7cd30 | 1 | private boolean jj_2_38(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_38(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(37, xla); }
} |
49ff570c-62a8-413d-9cb6-5b2b79d2fd99 | 5 | private void modifyConstructors(ClassFile cf)
throws CannotCompileException, NotFoundException
{
if (fieldInitializers == null)
return;
ConstPool cp = cf.getConstPool();
List list = cf.getMethods();
int n = list.size();
for (int i = 0; i < n; ++i) {
... |
0022bb98-4336-4b81-9a77-86d4c23a38cf | 8 | public void prepareJump(int opCodeValue, int opData) {
// invalidate data if conditional jump is not fulfilled in the current state
if(Arrays.asList(new Integer[]{0x20,0xC0,0xC2,0xC4}).contains(opCodeValue)) // jr ret jp call: nz
if(getZero() != KNOWN_FALSE)
invalidateAll();
if(Arrays.asList(new Integer[]{... |
db3f754c-0cfa-440d-9962-efcc0e85d158 | 5 | @Override
protected Void doInBackground() {
String htmlPage = "";
try {
htmlPage = HttpDownloader.getString(rule.getRuleURL());
} catch (MalformedURLException ex) {
//this.cancel(true);
return null;
} catch (IOException ex) {
//this.ca... |
296f3e48-4bf8-41f9-b5e1-1cf23885e2db | 9 | public void excecuteCommand(String channel, String sender, String message) throws Exception {
MediaWikiBot wikipedia = new MediaWikiBot("http://en.wikipedia.org/w/");
MediaWikiBot bulbapedia = new MediaWikiBot("http://bulbapedia.bulbagarden.net/w/");
String[] args = message.split(" ");
String link = "";
St... |
8bf02431-683a-497e-ba47-0dcdb3033201 | 4 | @Override
protected void doAction(int option)
{
switch (option)
{
case 1:
updateSchool();
break;
case 2:
updateTeamCaptain();
break;
case 3:
updateEmail();
break;
... |
87e7677b-cfb6-40c7-be84-f58e14b6ee30 | 2 | public int getLevelForXP(int exp) {
int points = 0;
int output = 0;
for (int lvl = 1; lvl <= 150; lvl++) {
points += Math.floor((double)lvl + 300.0 * Math.pow(2.0, (double)lvl / 7.0));
output = (int)Math.floor(points / 4);
if (output >= exp)
return lvl;
}
return 0;
} |
cdb9ba31-ba58-4f23-bfd2-e59a12bbf06a | 2 | public boolean look(Direction direction, StringBuffer output){
if(myPosition.isCrossable(direction))
{
if(myPosition.hasCharacter(direction)){//there is a character in the direction the player wishes to move
output.append(myPosition.getCharacter(direction).toString() + " is located " + direction +" of you.")... |
f18aab48-5b18-4c62-ae17-8a99b3df573b | 5 | public String bestForm(int fraction[]){
if(fraction[1]==1 && fraction[0]!=0){
return fraction[0] + "";
}else if(fraction[0]==0 || fraction[1]==0){
return "";
}else if(fraction[1]<0){
int f[] = {fraction[0]*-1,fraction[1]*-1};
return bestForm(f);
... |
0b99aae4-ae52-41b5-88c3-ec2b0edf2429 | 3 | public int readInt(String pSection, String pKey, int pDefault)
{
//if the ini file was never loaded from memory, return the default
if (buffer == null) {return(pDefault);}
Parameters params = new Parameters();
//get the value associated with pSection and PKey
String valueText = getValue(pSection,... |
7897a75a-1ecc-4191-994b-0b87c02cd8b2 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == garageView.searchButton){
getInformation();
}
else if(e.getSource() == garageView.addDamageButton){
if(vehicleID != 0){
showAddDamage();
}else {
JOptionPane.showMessageDialog(null, "Geen geldige invoer","Ongeldig", JOp... |
07af6548-4284-49ce-bde9-bb48576a72dd | 0 | private void fillCardInfo(){
} |
233ccb82-d926-4866-bdcd-38b16bbe6022 | 7 | public static void main(String... args) throws IOException {
MyScanner sc = new MyScanner();
int n = sc.nextInt();
int[] t = new int[n];
for (int i = 0; i < n; i++) {
t[i] = sc.nextInt();
}
long sum = 0;
Pair[] sortedSums = new Pair[n];
long[]... |
3ba6f5a7-aefd-49e3-b470-be6aa25881c6 | 2 | private static String getParameterValue(CommandLine cmd, String longName, char shortName) {
String value = null;
if (cmd.hasOption(longName)) {
value = cmd.getOptionValue(longName);
} else if (cmd.hasOption(shortName)) {
value = cmd.getOptionValue(shortName);
}
return value;
} |
3df11a4e-586f-423b-85f4-f9f94c0f0ac7 | 0 | public void setSuffix(String suffix) {
this.suffix.set(suffix);
} |
f1da2487-7e80-4fb7-8de5-d6152330d015 | 1 | public void addUser(User user) {
try {
beginTransaction();
session.save(user);
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
} |
3e4a5e20-0d7e-4140-ba5b-e2771898b5e3 | 5 | void chipsCounting()
{
for (Player currentPlayer : players)
{
if (allInFlag == false) {
if (currentPlayer == victor)
{
currentPlayer.chips += bank;
... |
e4961409-009a-45b7-b5de-2d33d2c502b9 | 9 | public void renderImages()
{
for(StandAloneImage i: images)
{
if(i.isVisible())
{
int [] image = i.getImage().getPixels();
for(int xx=0;xx<i.getImage().getWidth();xx++)
{
for(int yy=0;yy<i.getImage().getHeight();yy++)
{
if(i.getY()+yy>=0 && i.getY()+yy<height && i.getX()+xx>=0 && ... |
08534e43-05e7-4b3e-99a1-5eccd7774780 | 6 | public static Forme getForme(String forme){
Forme forme1 = null;
StringTokenizer str = new StringTokenizer(forme);
socket = new String[str.countTokens()];
while (str.hasMoreTokens()) {
socket[i]= str.nextToken();
i++;
}
registre... |
8a48c948-8644-4a3b-acf5-b9a549a8776d | 9 | @Override
public void keyPressed(char key, int argKeyCode) {
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
Create(key - '1');
break;
case 'a':
for (int i = 0; i < k_maxBodies; i += 2)
{
if (m_bodies[i] != null)
{
boolean active = m_bodies[i].isActive();
... |
a43fd085-6b49-453e-a417-269d3d0da9ad | 5 | public static void saveModel(LibraryModel lmodel)
{
try
{
JsonModel jmodel = new JsonModel();
jmodel.info = lmodel.info;
List<ArrayList<JsonPiece>> pieces = new ArrayList<ArrayList<JsonPiece>>();
ArrayList<JsonPiece> current = null;
for (Level l : lmodel.model)
... |
61a49fc4-1c3a-4522-923a-1573391f96ad | 3 | public BigDecimal interQuartileMean_as_BigDecimal() {
BigDecimal mean = BigDecimal.ZERO;
switch (type) {
case 1:
case 12:
BigDecimal[] bd = this.getArray_as_BigDecimal();
mean = Stat.interQuartileMean(bd);
bd = null;
break;
case 14:
throw new IllegalArgumentException("Complex interquartile mean... |
d3bc188b-bde4-4eeb-9aa4-12a508a23146 | 6 | public ChatWindow(Connector connector, final ChatInfo chatInfo) {
this.con = connector;
this.chatInfo = chatInfo;
this.transferManager = new FileTransferManager(chatInfo, connector);
transferManager.addFileTransferObserver(transfrObserver);
setTitle(FriendsListWindow.TITLE);
setDefaultCloseOperation(JFrame.... |
f6893952-74fe-44de-b262-c44b367c7250 | 1 | private static void printGerber(ArrayList<Eisenstein> primes) throws Exception {
System.out.println(GerberPlottables.GERBER_HEADER);
System.out.println("G75*");
int scale = 1000;
// double radius = scale/2*2/Math.sqrt(3);
double radius = scale/2;
for(Eisenstein e: primes)
System.out.println(GerberPlottables.... |
6635b696-299a-4cfd-a0a7-1d4d652e0af3 | 8 | public static int literal() {
// Literals are literals or we just saw a backslash so it can be any char
if(ignore || isLiteral()) {
// Make a state for it
setState(state, expression.charAt(j), state + 1, state + 1);
state++;
// Consume it
j++;
// Reset the ignore flag
ignore = false;
return ... |
36174725-98d2-46c5-9f7c-1b8482f61dc8 | 0 | public synchronized void addUnsearchQueue(WebPage wp) {
getUnsearchQueue().add(wp);
} |
ae2dcb4f-76f9-4060-a8f0-e55b42cda7cf | 2 | private static void paintElements(Graphics2D g2d, Model m) {
for (final Element e : m.getElements()) {
if (e != null) {
e.drawSelf(g2d);
}
}
} |
a0f7590e-ac45-40af-b4e9-0fa28a076189 | 8 | public Book[] searchBooks(String word) {
Vector result = new Vector();
Iterator i = books.values().iterator();
while (i.hasNext()) {
Book book = (Book)i.next();
if (book.getBookId().indexOf(word) != -1
|| book.getTitle().indexOf(word) != -1
|| book.getAuthor().indexOf(word) != -1
|| book.getTran... |
28788853-e594-4e8e-9ae8-f1c3ee3b06c6 | 9 | private void jButtonBuscaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBuscaActionPerformed
if (jTextFieldCod.getText() == null || jTextFieldCod.getText().equals("")) {
jLabelErro.setErrorText(WORDS.getString("ERRO-CODIGO"));
} else {
try {
... |
641ecf03-8e43-4b11-812f-065f893f385f | 1 | public static void main(String[] args) {
AppGameContainer container;
rm = new ResourceManager();
ConfigurationHandler ch = new ConfigurationHandler();
ch.initialize();
try {
container = new AppGameContainer(new Main(Strings.GAME_NAME + " - " + Strings.VERSION));
container.setDisplayMode(Setting... |
3948fd0f-636a-45dc-b304-f397c8d4600b | 7 | public void updateBoard(ArrayList<Cell> toUpdate) {
for (Cell cCell : toUpdate) {
if (cCell.containsBlackAnt()) {
board[cCell.getPos()[1]][cCell.getPos()[0]].setIcon(antB);
} else if (cCell.containsRedAnt()) {
board[cCell.getPos()[1]][cCell.getPos()[0]].setIcon(antR);
} else if (cCell.isContainsFood(... |
d403370c-d3d5-4572-a586-7d580d984fe1 | 8 | @Override
public void mouseClicked(int button, int x, int y, int clickcount) {
System.out.println("clicked in a window x:" + x + " y:" + y );
boolean found = false;
for (GUIObject obj : objects.values()) {
if (!obj.isInput())
continue;
if ( x >= obj.getRealX() && x < obj.getRealX()+obj.g... |
0ca7d0d3-ce12-42a9-a78c-0f3bde6d627e | 3 | public Shell open(final Display display) {
final Shell shell = new Shell(display);
shell.setText(RESOURCE_BUNDLE.getString("AdvancedGraphics")); //$NON-NLS-1$
try {
Path path = new Path(display);
path.dispose();
} catch (SWTException e) {
MessageBox dialog = new MessageBox(shell, SWT.ICON_WARNING | SWT... |
e125717e-3127-423f-9d03-bc368f865a9d | 9 | public static void retofinv_render_sprites(osd_bitmap bitmap) {
int offs, sx, sy, flipx, flipy, tile, palette, size;
int tileofs0, tileofs1, tileofs2, tileofs3;
for (offs = 0; offs < 127; offs += 2) {
{
sx = 311 - (((retofinv_sprite_ram2.read(offs + 1) & 127) << 1)
... |
d1aadf23-2ed9-42ac-b444-935537106337 | 7 | public void sucheDatei(String name, File directory, FoundListener fnd)
{
if(directory.exists())
{
File[] files = directory.listFiles();
for(int i=0; i< files.length; i++)
{
if(files[i] != null && files[i].exists())
{
if(files[i].getName().contains(name))
{
findings.add(files[i])... |
5d35d7ac-3ca0-4b6e-8671-2e87ed1dd108 | 8 | public boolean isTree() {
if (getVertices().isEmpty()) {
return true;
}
Set<V> roots = getUnreachableVertices();
if (roots.size() != 1) {
return false;
}
V root = roots.iterator().next();
// no self-loop at root
if (inDegree(root) !... |
32788c90-abd3-4db3-9aae-67c5473ccdc9 | 3 | public static void main(String[] args) {
int num;
Scanner keyboard = new Scanner(System.in);
boolean invalid = true;
System.out.println("Question 6: Sum");
do {
try {
System.out.print("Enter an integer: ");
num = keyboard.nextInt();
invalid = false;
int temp, sum = 0;
while (num != 0) {... |
8d05676d-52d7-47ed-9982-3f04be251b81 | 0 | public Animal createNewVictim() {
return new Ostrich();
} |
aada29fe-ad5b-4b73-aefa-0e8ec745e6aa | 4 | private CtClass produceProxyClass(CtClass orgclass, Class orgRtClass)
throws CannotCompileException, NotFoundException
{
int modify = orgclass.getModifiers();
if (Modifier.isAbstract(modify) || Modifier.isNative(modify)
|| !Modifier.isPublic(modify))
throw new CannotC... |
700de0c9-eb0e-402d-a7e5-0a020e36df89 | 9 | private final static ArrayList<String> getRowColAndGapsTrimmed(String s)
{
if (s.indexOf('|') != -1)
s = s.replaceAll("\\|", "][");
ArrayList<String> retList = new ArrayList<String>(Math.max(s.length() >> 2 + 1, 3)); // Aprox return length.
int s0 = 0, s1 = 0; // '[' and ']' count.
int st = 0; // Start of ... |
07df9dac-3c92-49b9-8e63-c64a00ec730c | 4 | private static void getRotationMatrixFromVector(float[] R, float[] rotationVector) {
float q0;
float q1 = rotationVector[0];
float q2 = rotationVector[1];
float q3 = rotationVector[2];
if (rotationVector.length == 4) {
q0 = rotationVector[3];
} else {
q0 = 1 - q1 * q1 - q2 * q2 - q3 * q3;
q0 = (q0... |
d6b3c091-43ba-4a5f-9f88-cea8958038c0 | 4 | @Override
public void mouseClicked(MouseEvent e) {
Point clickedPoint = getClickedPoint(e);
if (SwingUtilities.isLeftMouseButton(e)) {
if (Main.modState == ModState.Creating) {
handlePointCreation(clickedPoint);
}
} else if (SwingUtilities.isRightMouseButton(e)) {
if (Main.modState == ModState.Editi... |
2661e5ac-c94e-48c3-a349-b8921e090263 | 4 | public static String registerComponent(String componentName, String password, String partitionName) {
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "www-proxy.cs.tcd.ie");
System.getProperties().put("proxyPort", "8080");
String output = "";
... |
8744514c-c787-4e40-b1a6-94fd748f8af9 | 4 | public boolean exclude(String path) {
for (String exclude : excludes)
if (path.startsWith(exclude))
return true;
for (Pattern excludeReg : excludeRegs)
if (excludeReg.matcher(path).matches())
return true;
return false;
} |
b3ed8935-44b5-4b39-9895-9312ebb92f41 | 2 | public void render(Graphics g) {
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
placeable.render(g);
}
} catch (ConcurrentModificationException concEx) {
... |
ad75d86c-fc70-4677-b7e8-a0d9cfc97f94 | 5 | public static void main (String[] args) {
String stringa_in = new String();
int length; // LUnghezza Stringa
int i = 0; // Variabile Di Appoggio
char charact;
int space_num = 0; // Numero Spazi
Scanner kb = new Scanner (System.in);
System.out.println ("Inserisci Una Frase: ");
stringa_in = kb.ne... |
08258af3-672c-43ce-8f5a-ebab27872591 | 3 | @RequestMapping("/findUserByNo")
public String findUserByNo(String cardno,String pages,HttpServletRequest request){
Map<Object, Object> map = new HashMap<Object, Object>();
int curPage = 0;
if (pages == null || pages.trim().equals("")) {
curPage = 1;
} else {
curPage = Integer.parseInt(pages);
}
re... |
65a5da86-da29-4fd7-9654-b8143d890f4e | 0 | public int getStepCount()
{
return karel.getSteps();
} |
c61cb88a-7579-401e-af4f-e3c664830087 | 0 | static boolean test3(int val) {
System.out.println("test3(" + val + ")");
System.out.println("result: " + (val < 3));
return val < 3;
} |
562e2238-3db3-4c37-a88e-004d4e3d1049 | 2 | private void initEditingGrammarTable() {
editingGrammarView.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
convertSelected();
}
}
});
Production[] ps = grammar.getProductions();
for (int i = 0; i < ps.length; i++)
editingGrammar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.