method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
af4673bc-6c2b-4181-8fc1-3a7b8bf8ec60 | 9 | public static void main( String [ ] args )
{
BinarySearchTree t = new BinarySearchTree( );
final int NUMS = 4000;
final int GAP = 37;
System.out.println( "Checking... (no more output means success)" );
for( int i = GAP; i != 0; i = ( i + GAP ) % NUMS )
t.inse... |
4e9e2250-5721-4fb1-bb7e-8f30cfc6dc06 | 2 | private void startGame() {
if (animator == null || !isRunning) {
animator = new Thread(this);
animator.start();
}
} |
80a71c48-84ec-4089-9700-d3ed0213541a | 9 | public Stats computeBlockStats() throws IOException {
// TODO: add total auto-prefix term count
Stats stats = new Stats(fr.parent.segment, fr.fieldInfo.name);
if (fr.index != null) {
stats.indexNumBytes = fr.index.ramBytesUsed();
}
currentFrame = staticFrame;
FST.Arc<BytesRef> a... |
f027d89a-a35e-4d53-ac61-d335dd1e33e1 | 8 | public static void main(String[] args) {
List<Pattern> patternList = new LinkedList<Pattern>();
try{
if (args[0].startsWith("http://"))
{patternList = PatternLoader.loadFromURL(args[0]);}
else
{patternList = PatternLoader.loadFromDisk(args[0]);}
try{
int index = Integer.parseInt(args[1]);
if... |
131a506a-93b0-4d31-a5b1-6fb701211bcc | 1 | @Override
public long spawnBoss(String bossData) {
super.spawnBoss(bossData);
GameActor a = Application.get().getLogic().createActor(bossData);
PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent");
pc.setLocation(x - 200, y + 200);
pc.setAngleRad(MathUti... |
4c53662f-c34a-464c-88c0-e4ad39cfd582 | 5 | private BufferedImage shiftColor(BufferedImage img, int rShift, int gShift, int bShift)
{
int width = img.getWidth();
int height = img.getHeight();
for(int i = 0; i < height; i++)
for(int j = 0; j < width; j++)
{
int c = img.getRGB(j, i);
int alpha = c >> 24 & 0xff;
int red = (c >> 16 & 0xff) -... |
4a2570c6-c851-4ff4-b772-0c3727c57348 | 7 | public static <A> Ord<Array<A>> arrayOrd(final Ord<A> oa) {
return ord(a1 -> a2 -> {
int i = 0;
//noinspection ForLoopWithMissingComponent
for (; i < a1.length() && i < a2.length(); i++) {
final Ordering c = oa.compare(a1.get(i), a2.get(i));
if (c == Ordering.GT || c ... |
16bc1ba1-7a41-4164-8b7d-68e107d98e8f | 5 | @Override
public Card chooseCard(Player player, Card[] cards, GameState state) {
//If it's the start of a new week, we need a fresh cache
if(state.getDay() == 0)
{
cache = new HashMap<GameState, Integer>();
}
//If there's only one choice, we have no choice but to do it
if(cards.length == 1)
{
... |
6f88e80f-8965-4872-8e61-dc8912a82eba | 4 | public final T getNoodi(int x, int y) {
if (x >= 0 && x <= this.leveys && y >= 0 && y <= this.korkeus){
return noodit[x][y];
} else {
return null;
}
} |
7b252085-16c5-48d3-bf69-30464e5cc802 | 3 | boolean checkIfInWater(LivingEntity entity)
{
boolean entityIsInWater = false;
if(null != entity)
{
Material mat = entity.getLocation().getBlock().getType();
if(mat == Material.STATIONARY_WATER || mat == Material.WATER)
{
entityIsInWater = true;
}
... |
5817c572-acad-4a2b-b328-394a28363967 | 3 | public void toFile(String filename) throws FileNotFoundException, UnsupportedEncodingException {
PrintWriter writer = new PrintWriter(filename, "UTF-8");
writer.println(h + " " + w);
for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
writer.print(cells[x][y] ? "#" : ".");
writer.println();
}
... |
0580eada-ec1f-45b4-b08d-1c9d430893fc | 9 | private static double computePitchValue(int frameLength, float sampleRate,
Matrix rowMatrix) {
/**
* computes the pitch of one frame of a speech signal. no logger was
* placed here since this is called many times for one audio file
*/
try {
/** find the clipping level */
/** get the location of A... |
c908fee8-ccdd-4a7f-9bc4-595ff1eb3e80 | 7 | private byte ok() {
String name = nameField.getText();
if (!name.matches("\\w{4,}")) {
return NAME_ERROR;
}
if (task == null) {
if (job.containsName(name))
return NAME_EXISTS;
Loadable l = new AbstractLoadable(intervalField.getValue()) {
public void execute() {
job.runScript(getScript());... |
af374194-719b-44ee-a791-e2ae5caf1841 | 6 | @Override
public Map<Integer, Double> calculate(File experimentDir) throws Exception{
System.out.println("Generating average uptime for "+experimentDir);
Map<Integer, List<Double>> averageUptime = new HashMap<Integer, List<Double>>();
for (File experiment: experimentDir.listFiles()) {
... |
c203b2ed-7dd8-4cb4-bdc7-4a07a5c59c82 | 5 | public void setType(Type type){
long now, then, delta;
then = System.nanoTime();
this.type = type;
try{
this.texture = TextureLoader.getTexture("PNG", new FileInputStream(new File(type.location)));
}catch(FileNotFoundException e){
e.printStackTrace();
if(doLog){
log.writeToLog("CRITICAL ERROR:... |
ad3504c9-7cf1-4b11-bb66-b5e68744fab4 | 2 | public static ObjectOutputStream getOut() {
if(out==null){
try {
out = new ObjectOutputStream(socket.getOutputStream());
} catch (IOException e) {
throw new ConexionException("Error al crear el object out: "
+ e.getMessage(), e);
}
}
return out;
} |
beb0d531-fdbc-4480-8160-b8b1b9c745ae | 0 | public void setjTextFieldPrenom(JTextField jTextFieldPrenom) {
this.jTextFieldPrenom = jTextFieldPrenom;
} |
f186144a-2f4d-494b-87a1-169ee60c173a | 1 | protected void editarCrlv(){
int index = gCrlv.getTableGerenciarCrlvs().getSelectionModel().getLeadSelectionIndex();
if(index > -1){
//gCrlv.getCrlv().get(index);
ViewCrlv jifCrlv = new ViewCrlv();
ControllerCrlv conCrlv = new ControllerCrlv(jifCrlv, gCrlv.getCrlv().g... |
aa33286e-a496-45f1-b452-90b80651d5f9 | 8 | public static void main(String[] args){
Scanner console = new Scanner(System.in);
System.out.println("Give me temperature values!");
String input = console.nextLine();
String[] inputArray = input.split(" ");
double[] values = new double[inputArray.length];
try{
for ( int i = 0; i < valu... |
b3f2fdf9-a59c-4686-8701-22c72fd3a5ee | 4 | public Lcd() {
getStyleClass().add("lcd");
value = new DoublePropertyBase(0) {
@Override protected void invalidated() {
set(clamp(getMinValue(), getMaxValue(), get()));
}
@Override public Object getBean() { return this; }
... |
ececbc7e-0e39-45cf-bb26-ae50da782813 | 3 | public static String getResult(String urlStr){
URL url = null;
HttpURLConnection connection = null;
try {
url = new URL(urlStr);
connection = (HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("GET");
connection.setUse... |
d3a98968-99f3-4b8e-99c8-805557956c29 | 2 | public static Markers readTxt(String fileName, Genome genome, int positionBase) {
if (genome == null) genome = new Genome();
Markers markers = new Markers();
// Parse lines
LineFileIterator lfi = new LineFileIterator(fileName);
int lineNum = 1;
for (String line : lfi) {
Marker interval = new Marker();
... |
9faccd33-48f4-4fb4-a1d6-61bdc9687dbe | 8 | private void startInputMonitor(){
while(noStopRequested){
try{
//this.processRegisteAndOps();// 处理通道监听注册和读取事件注册
int num = 0;
//this.selector.selectedKeys().clear();// 清除所有key
// Wait for an event one of the registered channels
num = this.selector.select(50);
//num = t... |
9eb82a9a-7713-4d87-b8a1-3584f21b96d4 | 0 | @Override
public synchronized void handleIOException(SharingPeer peer,
IOException ioe) { /* Do nothing */ } |
c637937a-8a0a-499d-b388-c358febc5610 | 9 | public static final int getLevel(final String levelName) {
String _levelName = levelName;
if (levelName == null) {
return -1;
} else {
_levelName = levelName.trim();
}
if("DEBUG".equalsIgnoreCase(_levelName)) { return LEVEL_DEBUG;
} else if("INFO".equalsIgnoreCase(_levelName)) { return L... |
888286fd-2c9c-44c9-835e-89d6b2ad394a | 1 | public MainFrame() {
super("Kingdoms");
this.nextTurnButton = new JButton("next turn");
nextTurnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
game.nextTeamTurn();
}
});
GameModel model = null;
GameView game = null;
try {
model = ... |
689001d9-8735-43ea-8325-79ece672bd97 | 4 | private void create() {
int width = 1000;
int depth = 700;
try {
if(width < 0 || depth < 0){
throw new Exception("Ein Ozean mit diesen Groessen kann leider nicht erstellt werden, da min. ein Wert(Breite oder Tiefe) kleiner als 0 ist." + "\n" +
"Bitte geben Sie zulaessige Werte ein." + "Bei ... |
bcb5d318-7a5a-4468-9f59-2b19f9a3c595 | 1 | public boolean add(Object o) {
LocalInfo li = (LocalInfo) o;
LocalInfo contained = findSlot(li.getSlot());
if (contained != null) {
li.combineWith(contained);
return false;
} else {
grow(1);
locals[count++] = li;
return true;
}
} |
87787958-a0b6-4ee7-b61e-e53c6b58d49f | 2 | public void multiEq(String block, int mode, int shift) throws IOException {
for (String div_block : block.split("<br />={" + mode + "} ")) {
status[mode - 2 - shift] = div_block.split("=", 2)[0].replaceAll(
" $", "").replaceAll("^.*<br />.*$", "");
if (mode == 4 + shift)
tripleQuot(div_block);
else
... |
76a70bce-2a42-4f59-9ded-146eb066a3ec | 9 | public static void computeStats(String directoryName) {
try {
if(!ghosteryFile.equals("")) {
// TRACKERS
BufferedWriter trackersStatsFile = new BufferedWriter(new FileWriter(new File(directoryName+"/logs/stats_trackers.csv"), false));
Map<String, Integer> sortedTrackersGhosteryStats = sortByValueInDes... |
e26f0ef5-0fff-4652-b116-a58abffd58b9 | 3 | public void update(Ship ship ,int delta) {
if (state == States.MISSILE) {
setX(getX() - delta * speed);
anims[States.MISSILE.ordinal()].update(delta);
check_collisions(ship);
} else if (state == States.EXPLOSION) {
if (anims[States.EXPLOSION.ordinal()].is_stopped()) {
state = Sta... |
924c4700-f8cd-4134-909f-9ff1ce0a18b4 | 7 | public static void main(String[] args) {
// Current scanning point
int[] cifre = new int[numeroCifreDaMoltiplicare];
Arrays.fill(cifre, 1); // should put the real digits, but if result is > 0 then it is fine all 1s
long prod = 1;
// Keep current solution
long maxProd = 0;
int posMax = 0;
int[] cifre... |
9ca71634-ad85-4b61-8691-5840b7a12f57 | 2 | public static void main(String args[]) {
try {
int a = args.length;
System.out.println("a = " + a);
int b = 42 / a;
int c[] = { 1 };
c[42] = 99;
} catch(ArithmeticException e) {
System.out.println("Divide by 0: " + e);
} catch(ArrayIndexOutOfBoundsException e) {
... |
a449bf34-3cc1-4bcb-af2b-d74978d5246b | 5 | public void act(){
if(currentDelay==0){
int index=bulletsFired.length-bulletsLeft;
for(int a=0; a<baseBullet.length; a++){
bulletsFired[index]=new Bullet(baseBullet[a]);
bulletsFired[index].addAngle(bulletAngle);
getWorld().addObject(bulletsFired[index], x, y);
bulletsLeft--;
index++;
}
... |
db1edd6d-abeb-4d4f-ac0a-e4d589204fcc | 7 | public static void main(String args[]) {
switch (args.length) {
case 0:
// Run tests normally.
junit.textui.TestRunner.run(suite());
break;
case 2:
// Run registry, test server or client process.
int config = new Integer(args[1]).intVal... |
951ce767-46a9-4eff-a631-d29ea083345f | 1 | public void lifeCycle(int counts) {
for (int i = 1; i <= counts; i++) {
moveAllAnimals();
birthNewVictim(i);
death();
}
} |
e6c31a2a-cbb3-4176-9563-f71d72c93c44 | 6 | public void createTextureFromBytes(int[] par1ArrayOfInteger, int par2, int par3, int par4)
{
GL11.glBindTexture(GL11.GL_TEXTURE_2D, par4);
if (useMipmaps)
{
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
GL11.glTe... |
1bac82b3-26bc-4926-8150-05075d33127d | 0 | public void setTimeInterval(IntDataType value) {
this.timeInterval = value;
} |
384e1d58-51fc-4e98-8cd3-3208601bb3be | 2 | public boolean getBooleanProperty(String prop, boolean defaultValue) {
String value = getProperty(prop);
boolean returnValue = defaultValue;
if (value != null) {
try {
returnValue = Boolean.getBoolean(value);
} catch (NumberFormatException e) {
LOG.error("getBooleanProperty: Property value not a boo... |
b5edbfa4-f992-44ba-ae20-e72742e38e70 | 0 | @Column(name = "PRP_MOA_TIPO")
@Id
public BigInteger getPrpMoaTipo() {
return prpMoaTipo;
} |
b6137761-5935-4e15-a4ef-2b9f3e9dbcfc | 6 | @Test
public void randomGenerateTest() {
Board b = new Board(4, 4);
int temp[][] = new int[][]{{2, 2, 0, 4}, {0, 0, 0, 4}, {4, 0, 0, 16}, {0, 4, 128, 0}};
int original[][] = new int[temp.length][];
for (int i = 0; i < original.length; i++) {
original[i] = new int[temp[i].... |
0cfd3077-ee83-45e7-814e-3ce69513ae39 | 2 | public boolean hasEmpty(Object... values) {
int length = ArrayUtil.getLength(values, true);
do {
if (isEmpty(values[--length])) {
return true;
}
} while (length > 0);
return false;
} |
256c121e-0110-49b7-bebf-2118b0ea599e | 3 | @Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage.getBitMap();
for(int i = 1; i <= filteredImage.getHeight(); i++) {
for(i... |
79fafacb-0a92-4a1a-864f-3eb972126f86 | 1 | public MonitorAction produceStatsListForTime(String time) throws Exception {
init();
Date date = parseTime(time);
Stat[] latest = db.getLatestStats();
for (int i = 0; i < latest.length; i++) {
latest[i] = db.getStatsForTime(latest[i].getName(), date.getTime());
}
... |
20266710-1314-41e7-8e9a-39ba67fd9828 | 5 | private void initPanel(){
JPanel p = new JPanel();
p.setLayout(null);
for (int i=0;i<9;i++){
createLabel(p,i);
createTextField(p,i);
}
// Add confirm button
JButton confirmButton = new JButton("Confirm");
confirmButton.setBounds(WIDTH/4, 9*HEIGHT/11, WIDTH/2, HEIGHT/13);
confirmButton.addActionLi... |
78d520c5-6c88-45fd-accf-d579b5c39c11 | 4 | public ShutdownHook()
{
super(new Runnable()
{
@Override
public void run()
{
final File natives = new File(Vars.NATIVES_DIR);
if (Files.exists(natives.toPath()))
{
System.out.println("Deleting Native: " + natives.getPath());
FileHelper.deleteDirectory(natives);
}
Loader.addE... |
2d20a3a5-59d3-49e0-9bcb-23e14d2714a2 | 6 | private static int runInputPastAddressHiOrLoNoLimit(int move, int joypadInputAdd, int addressToPass) {
while (true) {
State initial = curGb.newState();
runToAddressNoLimit(0, 0, addressToPass);
int stepsToAddress = curGb.stepCount;
curGb.restore(initial);
runToNextInputFrameHiOrLoLimi... |
6d2e5c58-9a49-483f-9a1d-ba39af23cdc8 | 4 | @Override
public void createFile(String parent, String newfile, FileBase thedata)
{
if (!dirEntries.containsKey(parent.toLowerCase())) return;
if (fileEntries.containsKey((parent + "/" + newfile).toLowerCase())) return;
if (dirEntries.containsKey((parent + "/" + newfile).toLowerCase())) ... |
b5da28b1-a196-4b71-bec5-4f7740a0342e | 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... |
d3c2b011-3300-48c6-8316-0ffdd950ac97 | 4 | private boolean isPrime(long pNumber){
boolean check = false;
long n = pNumber;
for(long i : primes ){
if(i > Math.sqrt(n)){
break;
}
while (n%i == 0) {
n /= i;
break;
}
}
if(pNumber == n){
check = true;
}
return check;
} |
a80bd217-aca0-4b0b-a5c3-2b7df52f4f9b | 9 | @Override
public void run()
{
try
{
while (true)
{
WorldGenerator.GeneratorTask t = gen.taskQueue.take();
if (t.op == -1)
break;
// System.out.println(t.x+" "+t.z+" "+t.op);
switch (t.op)
... |
e5ace7b3-3cae-42de-a675-36d0f838539b | 4 | public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals(EXIT_BUT))
{
System.exit(0);
}
else if (e.getActionCommand().equals(ACTION_1))
{
}
else if (e.getActionCommand().equals(ACTION_2))
{
}
else if (e.getActionCommand().equals(ACTION_3))
{
}
} |
0a60100e-7fbd-4a5c-9e5a-b4395a2260c2 | 2 | public void test_05_choking_on_dot_slash_dot() {
initSnpEffPredictor("testCase");
String fileName = "./tests/choking_on_dot_slash_dot.vcf";
VcfFileIterator vcf = new VcfFileIterator(fileName, genome);
vcf.setCreateChromos(true);
for (VcfEntry vcfEntry : vcf) {
for (VcfGenotype gen : vcfEntry) {
boolea... |
dbf1e180-e55d-4758-bbcc-9039cf11b523 | 0 | public void setId(Integer id) {
this.id = id;
} |
61b79564-93b3-4f8f-8625-e55cc041a252 | 0 | @Override
public String getName() {
return this.name;
} |
0d5529b9-9955-47a9-a227-98ee1f9259fe | 8 | public ArrayList DoubleMajor(ArrayList primary, ArrayList secondary){
ArrayList<String> majorOne = primary;
ArrayList<String> majorTwo = secondary;
boolean matchFound = false;
for(int i = 0; i<majorOne.size();i++){
for(int j = 0; j<majorTwo.size();j++){
if(majorOne.get(i).substring(majorOne.get(i).sub... |
bac6e322-1383-4dec-95e1-1e1155bc86ea | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
312ce44c-fd46-41ca-ba44-b1df6a831d4d | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((sortIds() == null) ? 0 : sortIds().hashCode());
return result;
} |
a74da91d-5cc4-4ef1-aecf-ce118a08d426 | 6 | public boolean hasPick() {
if(playerHasItem2(1275) || playerHasItem2(1271) || playerHasItem2(1273) || playerHasItem2(1269) || playerHasItem2(1267) || playerHasItem2(1265))
{
return true;
}
return false;
} |
30876646-4c33-4ebb-81da-688bd1008efe | 4 | public boolean isSameTreeR(TreeNode p, TreeNode q) {
if (p==null || q==null)
return p==q;
return (p.val == q.val) && isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
} |
11a1efd4-c729-4012-a572-669d966ca3f7 | 2 | public static void putIntUnsigned(ByteBuffer out, int x)
{
int more, a;
do
{
a = (x & 0x7F);
more = (x >>= 7) != 0 ? BYTE_MORE : 0;
out.put( (byte)(more | a) );
}
while (more != 0);
} |
416ba176-66bd-4557-aaa6-a4b3a5d8e163 | 7 | public void handleConnect(String pathInContext, String pathParams, HttpRequest request, HttpResponse response) throws HttpException, IOException
{
URI uri = request.getURI();
try
{
if (log.isDebugEnabled())
log.debug("CONNECT: " + uri);
InetAddrPort a... |
59949c9a-f8b3-4e6d-9e86-746e5df313a8 | 4 | @Override
public List<SkinPreviewVO> getAvailableSkins() {
cleanModel();
List<SkinPreviewVO> previews = new LinkedList<SkinPreviewVO>();
try (DirectoryStream<Path> dir = Files.newDirectoryStream(Constants.PROGRAM_SKINS_PATH)) {
for (Path path : dir) {
if (path.ge... |
456d89cf-068b-4377-8f85-420308e6d698 | 6 | public void start(BundleContext context) throws Exception {
m_context = context;
// Create a service tracker to monitor dictionary services.
m_tracker = new ServiceTracker(m_context, m_context.createFilter("(objectClass=" + SpellChecker.class.getName() + ")"), null);
m_tracker.open();
try {
System.out.pr... |
f1ad3b4c-3be6-47b3-8827-faa389e5339c | 4 | @SuppressWarnings("unused")
private void setupInterestingNodes() {
// Random number generator
Random rand = new Random();
// Coordinates for the 4 important nodes
int scannerColumn, scannerRow, predatorColumn, predatorRow, controlRow, controlColu... |
e23c6ab4-a549-4e3e-b075-cd59bb5767fd | 0 | public final String getCurrentDataTime()
{
Date oCurrentDate = new Date();
SimpleDateFormat oSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss.SSSS");
return oSimpleDateFormat.format(oCurrentDate);
} |
77eea57f-9f3d-4dc6-8182-7e49ea7ec36c | 2 | public static void main(String[] args) throws InterruptedException {
Thread thread = new Thread(new MyRunnable1());
thread.start();
try {
TimeUnit.MILLISECONDS.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
MyRunnable1.sleepN... |
7b2c40d4-519b-4b9b-a524-a3c3021eb448 | 5 | public static void writeBytes(final OutputStream outs, final byte[] content) throws IOException {
int currLoc = 0;
int contentLen = content.length;
BufferedOutputStream out = null;
try {
out = new BufferedOutputStream(outs, BUFFER_SIZE);
while (currLoc < contentLen) {
int len = (contentLen > currLoc +... |
d8cb313d-e2e0-4521-8040-4248ffcc7d52 | 2 | public USBHost ()
throws IOException
{
super (null, null);
if ((host = HostFactory.getHost ()) == null)
throw new RuntimeException ("USB is not available");
busses = new Bus [0]; // NPE guard
host.addUSBListener (new USBListenerProxy (this));
busses = host.getBusses ();
// XXX want r... |
3e9ae0c9-64fe-4972-92d7-9ccb084bb236 | 6 | protected static void setRoomPart1() {
if (current != null) {
ArrayList<Entity> entities = Entity.getEntities();
for (Entity entity : entities) entity.onRoomEnd();
current.onEnd();
if (changeTo == null) for (Entity entity : entities) entity.onAppEnd();
Render.clear();
Entity.clear();
View.cle... |
fa55cfe7-833f-4564-b7bc-a436ac89e23f | 4 | public void grabdata()
{
try
{
BufferedReader in = new BufferedReader(new FileReader("masterlist.txt"));
String str;
while ((str = in.readLine()) != null)
{
Player p = readprofile(str);
if (p != null)
{
everyone.put(str.toLowerCase(), p);
norder.add(p);
}
}
in.close();
... |
45c8325d-7a4e-4d52-b243-85ccea028698 | 2 | private static void addTrees(String[] paths, String[] folders, String[] name, String type){
for(int i=0;i<paths.length;i++){
try {
@SuppressWarnings("unused")
TreeWorker tree = new TreeWorker( paths[i], folders[i], name[i], type, true, true);//save=true ,it saves itself
} catch (IOException e) {
... |
8309bcd3-15d2-4f25-86b6-e3d2bf487c68 | 6 | public static void startupRules() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module... |
2268f284-8cd7-455a-852c-9179a25bf74c | 3 | public Canvas(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "height":
height = Height.parse(this, v);
break;
case "width":
width = Width.parse(this, v);
br... |
cdb14cf9-834a-4310-8a95-b7ae4914d442 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof UserOrganisationMembership)) {
return false;
}
UserOrganisationMembership other = (UserOrganisationMembership) object;
... |
d5208e68-0603-489c-ba8e-2e12aa447d48 | 2 | public float[][] Fillzero2D(float[][] fill){
int ii = fill.length;
int jj = fill[0].length;
for (int i= 0; i< ii; i ++){
for (int j=0; j<jj; j++){
fill[i][j] = 0;
}
}
return fill;
} |
4e1422bd-43d6-4a1a-96bb-9180f1f76532 | 9 | private static boolean testBasicNodeMethods() {
try {
if ( PhylogenyNode.getNodeCount() != 0 ) {
return false;
}
final PhylogenyNode n1 = new PhylogenyNode();
final PhylogenyNode n2 = new PhylogenyNode( "", TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
... |
26e29fdd-bbb2-4f2d-be88-d79af7454f5e | 9 | @Override
protected CommandExecutionResult executeArg(Map<String, RegexPartialMatch> arg) {
final String ent1 = arg.get("ENT1").get(1);
final String ent2 = arg.get("ENT2").get(1);
final Entity cl1;
final Entity cl2;
final Entity normalEntity;
final String suffix = "lol" + UniqueSequence.getValue();
if... |
4d4ed77c-5d17-4ce1-9788-4b3c06d87392 | 2 | public static Float getFltParam(SessionRequestContent request, String name){
String param = (String) request.getParameter(name);
if (param != null && !param.isEmpty()) {
Float currParam = Float.parseFloat(param);
return currParam;
}
return null;
} |
4f8e4179-2e65-4b38-8b85-72996584b3b4 | 4 | @Override
public int read(String path, Object fh, ByteBuffer buf, long offset) throws FuseException {
FileHandle handle = (FileHandle)fh;
//a workaround (for a bug?)
if (handle == null)
return Errno.EBADSLT;
if (handle.hasClosed)
return Errno.EBADSLT;
if (handle.isEmptyFile)
return 0;
if (!handle.... |
448e6a46-3a76-4b15-a8fc-0025639f4ff1 | 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... |
a9013dd6-eada-494f-8f20-e3d2800173b9 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
76304e8f-5a50-4c89-8a26-3182a5a90f1f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Token other = (Token) obj;
if (token == null) {
if (other.token != null)
return false;
} else if (!token.equals(other.token))
return ... |
7993c92e-0533-4127-8c5d-623b607c6c02 | 3 | public synchronized void close() {
// lock the thread for closing
closingLock.writeLock().lock();
List<Callable<Boolean>> taskList = new ArrayList<>();
int size = queue.size();
final CountDownLatch count = new CountDownLatch(queue.size());
for(int i=0;i<size;i++)
{
taskList.add(new Callable<Boolean>() ... |
3fc61277-e02e-436b-8c75-b77e1cccbb36 | 5 | @Override public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s==Quit) {
MenuHandler.CloseMenu();
Game.gui.LoginScreen();
}
else if (s==EndTurn) {
MenuHandler.CloseMenu();
Game.btl.EndTurn();
}
else if (s==Resume) {MenuHandler.CloseMenu();}
else if (s==Save) {Game.save.S... |
ad4da118-33ba-4651-86a6-3a61cb92ea85 | 3 | @Override
protected String makeString(String t, boolean structured) {
String n = ""; //new line
String tt = ""; //tabulators
//create new stuff, if structured
if(structured){
n = "\n";
tt = t+"\t";
}
//temp storage
StringBuilder objsb = new StringBuilder();
//trick to h... |
5add4126-b5c2-4890-b30b-afbf53d0f2d1 | 3 | public Point2D getNormalAt( double position ) {
if( position < 0 || position > 1 ) {
throw new IllegalArgumentException( "position out ouf range: " + position );
}
int segment = segmentAt( position );
Point2D start = segments[segment];
Point2D end = segments[segment + 1];
double distance = segmentLeng... |
0bea2b4e-fec6-44f5-a11f-6ec171e101e6 | 9 | public void Run () throws InvalidFileFormatException, IOException
{
// Menu actions
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("List action: ");
System.out.println("1. Go to Angry Bird");
System.out.println("2. Action Robot");
System.out.println("3. Visual... |
95001425-ec8d-4c80-8ef3-dcc9c6362c8d | 4 | private boolean valueSearchNull(Entry n) {
if (n.value == null)
return true;
// Check left and right subtrees for value
return (n.left != null && valueSearchNull(n.left)) ||
(n.right != null && valueSearchNull(n.right));
} |
3971c48d-9f81-442c-a20b-1b389fe08d95 | 2 | private String wordToString(AbstractComponent component)
throws BookException {
StringBuilder sb = new StringBuilder();
try {
Iterator<AbstractComponent> iterator = component.getIterator();
while (iterator.hasNext()) {
AbstractComponent c = iterator.next();
sb.append(characterToString(c));
}
}... |
cb86b2f0-0482-4445-b368-e1067b2593c6 | 4 | private void PrintCurrentRoomItems() {
Iterator<String> iter = currentRoom.GetItems().iterator();
while (iter.hasNext()) {
System.out.print(iter.next());
if (iter.hasNext()) {
System.out.print(", ");
}
}
// Set up to print the containers
if (! currentRoom.GetContainers().isEmpty()) {
if (! cur... |
4fe965c6-04b4-48b5-98f4-527525a4c474 | 4 | public DefaultComboBoxModel<String> buildSlotList(int type) {
Equipment equipment = new Equipment();
DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>();
switch(type) {
case(1):
for(int x = 0; x<equipment.getArmor().getSlotNames().length; x++) {
comboBoxModel.addElement(equipm... |
b48efc70-15cc-4e7c-8a9c-d8fb154dc093 | 9 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
args = CommandLineTokenizer.tokenize(args);
if (sender instanceof Player) {
xAuthPlayer p = plugin.getPlyrMngr().getPlayer((Player) sender);
if (args.length < 1) {
plugin.getMsgHndlr().sendMessage("login.usage... |
a8bae22a-3329-4b70-8ffa-94ba5b877f61 | 6 | @EventHandler
public void GiantResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Resista... |
8ce10184-1842-448e-afd4-3f0b9dfcca69 | 4 | @MethodInformation(author="Wolfgang", date="09.12.2012", description="Gives back a double that describes the average of all used Diesel of all fertilizing DieselTraktor")
protected double avgDieselTraktorFertilizing() throws DivideByZeroException {
MyIterator it = (MyIterator) traktoren.iterator();
double sum = 0;... |
70667628-40f4-4e99-9e3d-d926d0f2489c | 9 | public static boolean checkLength(long length, WSDLColType colType) {
switch (colType) {
case DESCRIPTION:
if (length < 10000) {
return true;
} else {
return false;
}
case TITLE:
if (l... |
0d8ef4a5-ce52-4b02-8c27-966c561d47ef | 1 | private void updateList(String path) {
File[] files = new File(path).listFiles();
this.path = path;
if (files != null)
((FileTable) FileView).addFiles(files);
} |
8610eb70-414e-4874-a551-4dcc579f9500 | 0 | public double getAmountPaid() {
return amountPaid;
} |
eba76670-3850-493e-921d-57e4bb4686f2 | 4 | @Override
public List<Double> untransform(List<Double> in) {
if (in.size() != inputMins.size()) {
throw new MLException(String.format(
"Unexpected in-vector size. Expected: %d, Got: %d", inputMins.size(), in.size()));
}
List<Double> out = new ArrayList<Double>... |
ca1068f3-aaf5-486e-9aa2-f658a51b098a | 6 | int getNextNonWhitespace(int start)
{
char curChar;
int offset = -1;
int retOffset = -1;
do
{
offset ++;
retOffset ++;
if(start + offset >= input.getText().length()) return retOffset-1;
curChar = input.getText().charAt(start + offset);
if(curChar == '\r') retOffset --;
}
while(cu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.