text stringlengths 14 410k | label int32 0 9 |
|---|---|
public AdminClient() {
this.getContentPane().setPreferredSize(new Dimension(width, height));
this.setBackground(Color.BLACK);
if(System.getProperty("os.name").startsWith("Mac")) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
acceleratorKey = ActionEvent.META_MASK;
} else {
accelerato... | 1 |
protected boolean isImageFlavor(DataFlavor flavor)
{
int nFlavors = (imageFlavors != null) ? imageFlavors.length : 0;
for (int i = 0; i < nFlavors; i++)
{
if (imageFlavors[i].equals(flavor))
{
return true;
}
}
return false;
} | 3 |
public void getInput() {
if (Keyboard.isKeyDown(Keyboard.KEY_W) || Keyboard.isKeyDown(Keyboard.KEY_UP)) {
if (player.yPos < ((Display.getHeight() - topWall.getSizeY()) - player.sizeY))
player.move(1);
} else if (Keyboard.isKeyDown(Keyboard.KEY_S) || Keyboard.isKeyDown(Keyboar... | 6 |
@Test
public void getMaxDiagonal2Product() {
String expected = "[0, 0][1, 1] [0, 1][1, 2] [1, 0][2, 1] [1, 1][2, 2] ";
int numbers = 2;
String actual = "";
for (int x = 0; x + numbers <= DATA.length; x++) {
for (int y = 0; y + numbers <= DATA.length; y++) {
... | 3 |
public void close () {
Connection[] connections = this.connections;
if (INFO && connections.length > 0) info("kryonet", "Closing server connections...");
for (int i = 0, n = connections.length; i < n; i++)
connections[i].close();
connections = new Connection[0];
ServerSocketChannel serverChannel = this.se... | 9 |
private ArrayList<Integer> factor(long n) {
ArrayList<Integer> ret = new ArrayList<>();
int i = 0;
while (n > 1) {
int prime = nthPrime(i);
while (n % prime == 0) {
ret.add(prime);
n /= prime;
}
++i;
}
... | 2 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == 10) {
setVisible(false);
}
} | 1 |
public void deleteElement(int value) {
ListElement current = head.next;
ListElement previous = head;
if (previous.value == value) {
head = head.next;
count--;
} else {
while (current != tail.next) {
if (current.value == value) {
... | 3 |
public void move(Room r, int deltaTime) {
if (tl.isLocked() == false) {
randomizeDirection();
}
switch (getDirection()) {
case LEFT:
if (moveX(-1, r, false, deltaTime) == -1) {
randomizeDirection();
}
break;
case RIGHT:
if (moveX(1, r, true, deltaTime) == -1) {
randomizeDirection();
... | 9 |
public static void dcopy_f77 (int n, double dx[], int incx, double
dy[], int incy) {
double dtemp;
int i,ix,iy,m;
if (n <= 0) return;
if ((incx == 1) && (incy == 1)) {
// both increments equal to 1
m = n%7;
for (i = 1; i <= m; i++) {
d... | 8 |
public boolean isImpassable(Position position, double radius) {
double step = 0.1 * radius;
//scale = meter per pixel => row&column = pixels
double startRow = (position.getY() - radius);
double startColumn = (position.getX() - radius);
double endRow = (position.getY() + radius);
double endColumn = (position... | 7 |
public static void main(String[] args) {
int contCandidate = 0,
contEntry = 0,
contReserved = 0,
contReject = 0,
contDisputed = 0,
contEqual = 0;
String last = "";
try {
File csvData = new File("dataset/bas... | 8 |
public static void main(String[] args)
{
Node1 node1 = new Node1("node1");
Node1 node2 = new Node1("node2");
Node1 node3 = new Node1("node3");
node1.next = node2;
node2.previous = node1;
node2.next = node3;
node3.previous = node2;
node3.next = node1;
node1.previous = node3;
System.out.... | 0 |
public boolean encryptSerializedTable(){
//In a real world application, we could use a smartcard as the source of the pass, this is a just a proof of concept
String smartcard="verysecurepassword";
try {
File f = new File(TABLE_FILE);
File fe = new File(ENCRYPTED_TABLE_FILE);
f.createNewFile();
f... | 1 |
public void addParticleEffect(String effectName, ParticleEffect effect) {
if (effectName == null || effect == null) {
throw new IllegalArgumentException("Cannot add a null ParticleEffect!");
}
particleEffects.put(effectName, effect);
} | 2 |
public AnnotationVisitor visitAnnotationDefault() {
if (!ClassReader.ANNOTATIONS) {
return null;
}
annd = new ByteVector();
return new AnnotationWriter(cw, false, annd, null, 0);
} | 1 |
public ArrayList<Ticket> getTicket(Ticket tic_in) throws SQLException{
Statement stm = getConnection().createStatement();
String campos = "id,pnr,num_file,ticket,old_ticket,cod_emd,convert(varchar, fecha_emision, 103) as fecha_emisionb,convert(varchar, fecha_anula, 103) as fecha_anula ,convert(varchar, ... | 2 |
public Edge getEdge(int i)
{
Edge retval;
if (i < 0 || i > 5)
throw new IllegalArgumentException(
"Requested hex edge must be in range [0,5], was " + i);
else if (myEdge[i] != null)
{
retval = myEdge[i];
}
else
{
Edge cur;
boo... | 5 |
private int maxLength()
{
HashMap <Integer,Integer> lengths = new HashMap<Integer,Integer>();
SimpleQueue<Node> queue = new SimpleQueue<Node>();
HashSet<Node> printed = new HashSet<Node>();
queue.add( start );
while ( !queue.isEmpty() )
{
Node node = queue.poll();
ListIterator<Arc> iter = node.outgoi... | 9 |
public int getPriParkChargeByPID(Statement statement,String PID)//根据PID获取优惠后停车费用
{
int result = -1;
sql = "select priparkcharge from Park where PID = '" + PID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getInt("priparkcharge");
}
}
catch (SQLExcept... | 2 |
public static void botones(int valor){
switch(valor){
case 1:
Interfaz.delD.setEnabled(true);
Interfaz.bajar.setEnabled(false);
Interfaz.del.setEnabled(false);
break;
case 2:
Interfaz.delD.setEnabled(false);
... | 2 |
public void stopNPCGather(Player p) {
if (registry.getGameController().multiplayerMode != registry.getGameController().multiplayerMode.CLIENT) {
Resource resource = null;
try {
for (String key : resources.keySet()) {
resource = (Resource) resources.get... | 7 |
public void loadArenas() {
XMLConfig arenaConfig = new XMLConfig("plugins/lmsArenas.xml");
XMLNode node = arenaConfig.getRootNode();
if (!node.nodeExists("defaults")) {
XMLNode defaults = new XMLNode("defaults");
XMLNode cubePadding = new XMLNode("option");
cubePadding.addAttribute("name", "cubePadding")... | 7 |
@Override
public void execute() {
String msg = Widgets.get(13, 28).getText();
if (msg.contains("FIRST")) {
Widgets.get(13, Character.getNumericValue(Settings.pin[0]) + 6).click(true);
Task.sleep(750, 1200);
}
if (msg.contains("SECOND")) {
Widgets.get(13, Character.getNumericValue... | 4 |
public static void main(String[] args) {
try {
Display.setDisplayMode(new DisplayMode(800, 600));
Display.create();
Display.setTitle("TWL Login Panel Demo");
Display.setVSyncEnabled(true);
TestGui demo = new TestGui();
LWJGLRe... | 3 |
public static HashSet<Point> getAnthillPoints() {
/*
* The first part of the algorithm traces the outline of a hexagon on
* the grid
*/
// Pull out side length
int sideLength = AntGame.CONFIG.CONTEST_MAP_ANTHILL_SIDE_LENGTH;
// Height of hexagon = (2n - 1) where n = side length
int height = ( 2 ... | 8 |
public ArrayList<String> lista() throws RemoteException,
NenhumServidorDisponivelException
{
ArrayList<String> list = new ArrayList<String>();
Set<String> objs = objects.keySet();
//Add all object names into 'list'
for(String s: objs)
{
list.add(s);
}
return list;
} | 1 |
public static void endAllWithName(String name){
for(ScheduleData data : schedules){
if(data.getName().equalsIgnoreCase(name)) endSchedule(data.getScheduleID());
}
} | 2 |
void a1(int p1, int p2) {
boolean invite = false;
if (p1 + p2 > 120 || p1 + p2 < 15 || p1 > 85 || p2 > 85) {
invite = true;
}
} | 4 |
public static int readInt() {
String line = null;
int value = 0;
try {
BufferedReader is = new BufferedReader(new InputStreamReader(
System.in));
line = is.readLine();
value = Integer.parseInt(line);
} catch (NumberFormatException e... | 2 |
public void displayRoomInfo(Player player) {
RoomType roomType = grid[player.getLocationX()][player.getLocationY()]
.getRoomType();
if (roomType.equals(RoomType.entrance)) {
System.out
.println("This is the entrance. You leaving already? Head inside!");
... | 8 |
private static String treat(final String line) {
int cpt = 0;
int cpt2 = line.length() - 1;
char prov;
//System.out.println(line);
prov = line.charAt(cpt);
while ((prov == ' ' || prov == '\t') && cpt != cpt2) {
prov = line.charAt(++cpt);
}
... | 8 |
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... | 6 |
private void setImage(String name) {
BufferedImage im = registry.getImageLoader().getImage(name);
if (im != null) {
AffineTransform tx = null;
AffineTransformOp op = null;
if (direction == Direction.LEFT) {
//rotate the image based on where you're sho... | 2 |
public void draw(GOut g) {
super.draw(g);
if(busy) {
g.chcolor(busycolor);
g.frect(Coord.z, sz);
g.chcolor();
}
} | 1 |
public static void savePomo() throws DataFileNotFoundException {
File dataStore = new File("PomoData");
try {
if(dataStore.exists()) {
String line;
FileReader fileReader = new FileReader(dataStore);
BufferedReader bufferedReader = new Buffered... | 5 |
public boolean onCommand(Player player, String[] args) {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
if(player.hasPermission(getPermission())){
if(args.length ... | 5 |
@Override
public void update(float dt) {
if (speed.x > 0) {
speed.x -= drag;
} else if (speed.x < 0) {
speed.x += drag;
}
if (Math.abs(speed.x) <= drag / 2f) {
speed.x = 0;
}
speed.y -= universe.gravity;
if (Math.abs(spee... | 7 |
private static Integer createPostingList(long featureId, StringTokenizer tokenizer, File postingFile,
File compressedPostingFile) {
TreeMap<Integer, Integer> postingInput = new TreeMap<Integer, Integer>();
BasicPostingList posting = new BasicPostingList(featureId);
CompressedPostingList compressedPosting = n... | 8 |
public int posMax()
{
int MaxValPos = -1; //position of maximum value
char MaxVal; //maximum value
char []SeqArray; //array of chars for looping through
if(SeqValue.length() == 0) //if sequence is empty
return MaxValPos;
SeqArray= SeqValue.toCharArray();
MaxVal = SeqArray[0]; //... | 3 |
public HandlerList getHandlers() {
return handlers;
} | 0 |
private void isGreaterThanEqualsToDate(Date param, Object value) {
if (value instanceof Date) {
if (!(param.after((Date) value) || param.equals(value))) {
throw new IllegalStateException("Given Date does not lie after the supplied date.");
}
} else {
throw new IllegalArgumentException();
}
} | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProcDescriptor other = (ProcDescriptor) obj;
if (labelInAssembler != other.labelInAssembler)
return false;
if (lokal == null) {
if (other... | 7 |
void iterateArrayList()
{
try
{
System.out.println("starting iterate");
Iterator b= al.iterator();
while(b.hasNext())
{
try
{
Thread.sleep(5000);
b.next();
} catch (InterruptedException e)
{
System.out.println(e);
}
}
System.out.println("ending iterate");
}... | 3 |
public void putScenery(Scenery scenery, int x, int y) {
if ((x < width && y < height) && (x >= 0 && y >= 0)) {
data[y][x] = scenery;
} else {
throw new AssertionError("placed a scenery off the map");
}
} | 4 |
public boolean subsEquals(Operator other) {
if (this == other)
return true;
if (other.subExpressions == null)
return (subExpressions == null);
if (subExpressions.length != other.subExpressions.length)
return false;
for (int i = 0; i < subExpressions.length; i++) {
if (!subExpressions[i].equals(oth... | 5 |
final private boolean jj_3R_95() {
if (jj_3R_42()) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_130()) {
jj_scanpos = xsp;
if (jj_3R_131()) return true;
}
if (jj_3R_44()) return true;
xsp = jj_scanpos;
if (jj_3R_180()) jj_scanpos = xsp;
xsp = jj_scanpos;
if (jj_3R_... | 7 |
private boolean isWinner() {
Player[][] locations = this.board.getBoardLocations();
for (int row = 0; row < locations.length; row++) {
Player[] rowLocations = locations[row];
for (int col = 0; col < rowLocations.length; col++) {
if (fourInARow(row, col, location... | 3 |
public static void main(String[] args) {
ExecutorService exec = Executors.newCachedThreadPool();
ArrayList<Future<String>> results = new ArrayList<Future<String>>();
for (int i = 0; i < 10; i++)
results.add(exec.submit(new TaskWithResult(i)));
for (Future<String> fs : results... | 4 |
public static File getAppDir(String dirname) {
String s = System.getProperty("user.home", ".");
File file;
switch (getOs()) {
case linux:
case solaris:
file = new File(s, "." + dirname + '/');
break;
case windows:
String s1 = System.getenv("APPDATA");
if (s1 != null) {
file = new ... | 7 |
@Override
public void motorsCommand(boolean sideBrush, boolean sideBrushClockwise,
boolean mainBrush, boolean mainBrushOutward, boolean vacuum)
throws RoombaIFException {
checkIsOpened("driveCommand");
byte d = 0;
d += ((sideBrush) ? 0 : 1);
d += ((vacuum) ? 0... | 5 |
String getMissingChannelsMsg() {
if (MissingChannels.isEmpty()) {
return null;
}
String msg = null;
if (MissingChannels.size() == 1) {
msg = "Channel " + MissingChannels.first() + " is";
} else {
msg = "Channels ";
for (Integer i : MissingChannels) {
if (i == MissingChannels.last()) ... | 5 |
public void extendTreeHeight() {
//build the alloweChars array
String[] allowedChars = new String[Oracle.allowedChars.length - globalPrefix.length()];
int index = 0;
for (String e : Oracle.allowedChars) {
if (!globalPrefix.contains(e)) {
allowedChars[index++] ... | 8 |
protected static String getListTagForString(String str) {
char chr = str.charAt(0);
switch (chr) {
case '#':
return "ol";
case '*':
return "ul";
case ':':
case ';':
return "dl";
}
return null;... | 4 |
public void update(int delta)
{
if(switchedWaypoints)
{
if(targetWaypoint == null) {
//done
finished = true;
return;
} else {
//recalculate dx and dy
float diffX, diffY;
diffX = targetWaypoint.getX() - this.x;
diffY = targetWaypoint.getY() - this.y;
float magnitude = (float)Ma... | 5 |
public static final void main( String[] args ) throws Exception {
try {
String output_file = "mets.zip";
String metadata_file = "metadata.txt";
Vector input_filenames = new Vector();
Vector input_filetypes = new Vector();
Vector archive_filenames = new Vector();
Hashtable metadata = new Hashtable();
for( in... | 8 |
private void jButton_ExchangeActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ExchangeActionPerformed1
try {
if(true){
JOptionPane.showMessageDialog(null, "Exchange is currently not supported","Error",JOptionPane.ERROR_MESSAGE);
return;
... | 8 |
public static AbstractEvent parse(ObjectNode node) {
final String method = node.get("method").getTextValue();
final ObjectNode params = (ObjectNode)node.get("params");
if (method.equals(PlayerEvent.Play.METHOD)) {
return new PlayerEvent.Play(params);
} else if (method.equals(PlayerEvent.Pause.METHOD)) {
r... | 9 |
public Shell[] getShells() {
checkWidget();
int count = 0;
Shell[] shells = display.getShells();
for (int i = 0; i < shells.length; i++) {
Control shell = shells[i];
do {
shell = shell.getParent();
} while (shell != null && shell != this);
if (shell == this)
count++;
}
int index = 0;
S... | 8 |
public void uploadImage(){
try {
//Print out the image path when debugging
if(debug){
System.out.println("Image path: "+image_path);
}
//Initialize the string name to null
String fileName ="";
//Get the file na... | 8 |
public String getMobName(LivingEntity entity)
{
if (showMobName)
{
String name = entity.getCustomName();
if (name != null)
return name;
if (entity instanceof Player)
return ((Player) entity).getName();
}
if (showAbilitySetName && MMComponent.getAbilities().isEnabled())
{
String name = Abi... | 6 |
private synchronized void dropPacketFIFO(Packet pnp)
{
// If the queue is full, we have to drop a packet, giving priority to the control packets
// Control packets will be those packets sent between the broker or the GIS.
// Normal packets are those belonging to a gridlet.
// Control... | 5 |
@Override
public void run() {
while (!stopped && worker.isAlive()) {
int nextLen = list.size();
if (lastLen != nextLen) {
model.refreshDisplay(lastLen);
lastLen = nextLen;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
model.refreshDispla... | 4 |
@Test
public void testServerSetQueueTimeoutErrorIndividualHashEx() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutErrorIndividualHashEx -----");
boolean exception_other = false;
String client_hash = "";
try {
server2.setUseMessageQueues(true);
... | 5 |
public void zipIt(String zipFile) {
byte[] buffer = new byte[1024];
try {
FileOutputStream fos = new FileOutputStream(zipFile);
ZipOutputStream zos = new ZipOutputStream(fos);
System.out.println("[ZIP] Output to Zip : " + zipFile);
for (String file : this.fileList) {
//System.out.println("[ZIP] Fi... | 3 |
public void checkReproduce() {
int currFishsSize = fishies.size();
//you may want to add additional new baby reproduction limits
for (int i = 0; i < currFishsSize; i++) {
for (int j = i + 1; j < currFishsSize; j++) {
//don't want double reproduction
if (fi... | 6 |
public void exportItems(EDCHARACTER edCharakter, File outFile) throws IOException {
CharacterContainer character = new CharacterContainer(edCharakter);
PrintStream out = new PrintStream(new FileOutputStream(outFile), false, encoding);
int pursecounter=0;
String[] header = {"Name","Location","Weight","In Use","K... | 9 |
@Override
public BasicValue naryOperation(AbstractInsnNode insn, List<? extends BasicValue> values) throws AnalyzerException {
BasicValue value = super.naryOperation(insn, values);
int opcode = insn.getOpcode();
if (opcode == Opcodes.INVOKESTATIC &&
isClassBox(((MethodInsnN... | 8 |
public static boolean isFactorial(int n) {
int i, j;
i=1; j=1;
do {
if (i==n)
return true;
j++;
i = i*j;
}
while (i<=n);
return false;
} | 2 |
public static int angleFromDirection(Utility.Direction direction){
switch(direction){
case NORTH:
return 0;
case NORTHEAST:
return 45;
case EAST:
return 90;
case SOUTHEAST:
return 135;
cas... | 8 |
public float getY(float x) {
if (isVertical) {
return Float.NaN;
} else if (isHorizontal) {
return value;
} else {
return this.k * x + b;
}
} | 2 |
private String getLine(int index) {
// get the line that contains input[index]. Assume input[index] is at a
// token, not
// a white space or newline
int i;
if (input.length <= 1) {
return "";
}
i = index;
if (i <= 0) {
i = 1;
... | 9 |
@Override
public boolean containsAll(Collection<?> c) {
Iterator<?> iterator = c.iterator();
while (iterator.hasNext()) {
if (!contains(iterator.next())) {
return false;
}
}
return true;
} | 4 |
public void remove(int id) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(this.getById(id));
session.getTransaction().commit();
} catch (Exce... | 3 |
private void boutonMondeDesTenebresMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boutonMondeDesTenebresMouseClicked
// TODO add your handling code here:
if (partie.getMdt().isActif()) {
if (!partie.getDieuActuel().isaJouerEnMondeDesTenebres()
|| ((partie.... | 5 |
private void loadImage(String path) {
try {
Image img = new Image(path);
img.setFilter(Image.FILTER_NEAREST);
spriteSheet = new SpriteSheet(img, x, y);
} catch (SlickException e) {
System.out.println("Cannot find Image for SpriteMap!...or maybe there's a ... | 1 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Set<MOB> h=properTargets(mob,givenTarget,false);
if(h==null)
{
mob.tell(L("There doesn't appear to be anyone here worth speeding up."));
return false;
}
if(!super.invoke(mob,comman... | 9 |
private static Map<String, Field> commontField(Cg cg, Map<String, Field> fieldMap){
Pattern commentPattern = Pattern.compile("\\s*COMMENT\\s+?ON\\s+?COLUMN\\s+?.*\\.(.*) IS '(.*)'\\s*;");
String tableSql = formartSql(cg.getTableSql());
String[] temps=tableSql.split("\r|\n");
List<String> tempList = new Array... | 7 |
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
stream.writeObject(execCommand);
stream.writeObject(remoteCallObjectType);
} | 0 |
@Override
public void run() {
ResultSet ids = GetCitedIDS();
String insert = "insert into citedList(paperid,citedlist) values(?,?)";
int num = 0;
try {
PreparedStatement statement = sqLconnection.conn
.prepareStatement(insert);
while (ids.next()) {
int id = ids.getInt("citationid");
if(!isID... | 4 |
public void deleteItem(int slot) {
if(slot >= 0 && slot < items.length)
items[slot] = null;
} | 2 |
public void setSID(int sid) {
switch (sid) {
case RESID_6581:
case RESID_8580:
if (!(sidChip instanceof RESIDChip)) {
if (sidChip != null) sidChip.stop();
sidChip = new RESIDChip(cpu, audioDriver);
}
((RESIDChip) sidChip).setChipVersion(sid);
break;
case JACSID:
if... | 7 |
@Override
public ArrayList<STTPoint> getWrappedData() {
ArrayList<STTPoint> pointList = new ArrayList<STTPoint>();
try{
URL url = new URL(getWrapperParams().getSource());
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String fileLine;
whil... | 4 |
public static void main(String[] args)
{
new Run();
} | 0 |
public Item dequeue() {
if (isEmpty())
throw new NoSuchElementException();
if (size() < N / 2)
q = resize(N / 2);
// Remove from the front.
Item t = q[front];
front = (front + 1) % N;
nItems--;
return t;
} | 2 |
@Override
public final void mouseReleased(final MouseEvent e) {
synchronized (this.abcMapPlugin.state) {
if (this.abcMapPlugin.state.loadingMap) {
return;
}
while (this.abcMapPlugin.state.running) {
try {
this.abcMapPlugin.state.wait();
} catch (final InterruptedException ie) {
ie.prin... | 5 |
public void giveWarning(Account account){ account.giveWarning(); } | 0 |
@Test
public void branchInstrInvalidFormatSKZ() { //Tests SKZ won't accept fields
try {
instr = new BranchInstr(Opcode.SKZ, 70);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr); //Instruction should not be instantiated with invalid arguments
} | 1 |
public static ArrayList<QuizTakenAchievement> getAllAchievements() {
if (allAchievements.isEmpty())
loadAllAchievements();
return allAchievements;
} | 1 |
public Dictionary(String path) {
this.path = path;
this.trie = new Trie();
this.sortedTrie = new Trie();
} | 0 |
private void fireIOException(IOException ioe) {
for (PeerActivityListener listener : this.listeners) {
listener.handleIOException(this, ioe);
}
} | 1 |
public void simulateOneStep()
{
Random randomgetal = new Random();
step++;
if(randomgetal.nextDouble() <= getHunterCreationProb())
{
createHunter();
}
createHunter();
// Provide space for newborn animals.
List<Actor> newActors = new Array... | 8 |
private static Integer getNextInstanceOfNegation(LinkedList<Token> tokens, int startingAtIndex) {
for(int i=startingAtIndex; i<tokens.size();i++) {
Token t = tokens.get(i);
if(t.getUnderlyingObject()==Operation.NEGATION) {
return i;
}
}
return null;
} | 2 |
private void readbuttonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_readbuttonMouseClicked
// TODO add your handling code here:
int address=dec.NumberParser(readaddress.getText());
if(address!=-100000){
readvalue.setText(""+mm.readMemory(address));
reada... | 1 |
public boolean equals(Object configuration) {
Configuration config = (Configuration) configuration;
if (parent != config.parent)
return false;
return config.myCurrentState == myCurrentState;
} | 1 |
public double calculateProbability(String s) {
int stringLength = s.length();
double probability = 1;
for (int i = 0; i < stringLength; i++) {
Character character = s.charAt(i);
switch (character) {
case 'A':
probability = probability ... | 5 |
@Override
public Problem parse(String URL) throws ParserException, InterruptedException {
URL = URL.trim();
FilterBean fb = new FilterBean();
fb.setURL(URL);
// extract problem name
fb.setFilters(new NodeFilter[] {
new CssSelectorNodeFilter("div... | 8 |
public void visit_ifnull(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} | 1 |
@Before
public void setUp()
throws Exception
{
createInjector( new QuartzModule()
{
@Override
protected void schedule()
{
scheduleJob( TimedTask.class );
}
} ).getMembersInjector( GuartzTimerTestCase.class ).inject... | 0 |
public String toString() {
String res = this.a==0? "": ""+this.a;
switch(this.b) {
case 0: return res;
case 1: return res + "+w";
case -1: return res + "-w";
default: return res + (this.b>0? "+": "") + this.b + "w";
}
} | 5 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.