text stringlengths 14 410k | label int32 0 9 |
|---|---|
final boolean method2247(int i) {
if (i != -4)
method2245(null, 50);
if (!((Signlink) this).allowsFileOperations)
return false;
if (((Signlink) this).aBoolean3794) {
if (aClass134_3802 == null)
return false;
return true;
}
if (anObject3793 == null)
return false;
return true;
} | 5 |
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 |
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 |
public void set() {
ConnectMySQL.connSQL();
String selectDate = dc.sdf2.format(dc.select.getTime());
String str1 = null, str2 = null, str3 = null, str4 = null;
if ((Integer) staHourSpinner.getValue() < 10) {
str1 = '0' + staHourSpinner.getValue().toString();
} else {
str1 = staHourSpinner.getValue().toS... | 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 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final Vector<Room> V=new Vector<Room>();
TrackingLibrary.TrackingFlags flags;
flags = CMLib.tracking().newFlags()
.p... | 9 |
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 updateTextFieldFormat() {
if( timeSpinner == null ) return;
JFormattedTextField tf = ((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField();
DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory();
DateFormatter formatter = (DateFormat... | 1 |
@Override
public synchronized void addTermDocument(String term, String document) throws RuntimeException {
if (!documents.containsKey(document)) {
long documentId = addDocument(document);
documents.put(document, documentId);
}
if (!terms.containsKey(term)) {
... | 3 |
protected void setStock(int stock) throws Exception{
if(stock<0){
throw new Exception("El stock tiene que ser 0 o superior.");
}else{
this.stock = stock;
}
} | 1 |
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 inActivityCluster(double[] tempTimeVector, String user) {
double[] post_count = tempTimeVector;
boolean contains = false;
if (post_count[0] + post_count[1] + post_count[2] + post_count[3] == 0) {
users0004.add(user);
contains = true;
}
if (post_count[4] + post_count[5] + post_count[6] + po... | 7 |
public void start() {
try {
Socket socket;
try {
socket = new Socket(HOSTNAME, PORT);
} catch (ConnectException e) {
System.err.println("Error connecting");
System.exit(-1);
return;
}
out = new ObjectOutputStream(socket.getOutputStream());
in = new ObjectInputStream(socket.getInputSt... | 7 |
private final boolean cons(int i)
{
switch (b[i])
{
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
return false;
case 'y':
return (i == 0) ? true : !cons(i - 1);
default:
... | 7 |
@Test
public void firstMowerTest() throws MowerOutOfLawnBoundaryException {
try {
this.lawnMowerController = new LawnMowerController("1 2 N", "GAGAGAGAA",lawnConfiguration);
} catch (NumberFormatException e1) {
fail();
} catch (NegativeNumberException e1) {
fail();
} catch (UnrecognizedCommandExcept... | 5 |
@Override
public RgbColor getRgb() {
double red = 0;
double green = 0;
double blue = 0;
double h = ChromaUtil.clamp(hue, 0, 360);
double s = ChromaUtil.clamp(saturationV, 0, 1);
double v = ChromaUtil.clamp(value, 0, 1);
double c = s * v;
double sector = h / 60; // Sector of the color ... | 6 |
private void checkPauseMenu() {
if (input.back()) {
running = true;
stage.clear();
} else if (input.up()) {
pauseButtons[selectedButton].setStyle(buttonStyle);
selectedButton = (selectedButton == 0) ? 0 : selectedButton - 1;
pauseButtons[select... | 6 |
public Tooltip HUDCollide(){
CollisionResults results = new CollisionResults();
Vector3f origin = new Vector3f(inputManager.getCursorPosition().x, inputManager.getCursorPosition().y, 0);
Ray ray = new Ray(origin, new Vector3f(0, 0, 1));
guiNode.collideWith(ray, results);
for(int a=0... | 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... | 6 |
public int[] getViewerCounts()
{
return viewerCounts;
} | 0 |
public static void main(String args[]) {
// (NxN) chessboard. from (x,y) to (p,q), find a minimum number of moves
// Knight can move relatively (1, 2), (-1, 2), (1, -2), (-1, -2), (2, 1), (-2, 1), (2, -1), (-2, -1)
// move named as m0 m1 m2 m3 m4 m5 m6 m... | 9 |
@EventHandler
public void GiantMiningFatigue(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.Mini... | 6 |
@Override
protected boolean checkCollision(float xx, float yy) {
for (int corner = 0; corner < 4; corner++) {
int xc = (int) (((x + xx) + corner % 2 * 13 + 1) / Tile.SIZE);
int yc = (int) (((y + yy) + corner / 2 * 13 + 1) / Tile.SIZE);
if (world.getTile(xc, yc).isSolid())... | 5 |
public void setFillWidth(boolean b) {
if (this.fillWidth == b) {
return;
}
this.fillWidth = b;
installGUI();
} | 1 |
public void run() {
while (true) {
try {
Runnable runnable = queue.take();
runnable.run();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
}
} | 3 |
private void button5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button5ActionPerformed
if (order1code5tf.getText().equals("1001"))
{
o1c5destf.setText("Chicken Nugget");
}
if (order1code5tf.getText().equals("1002"))
{
o1c5de... | 9 |
public int hasTile(int x, int y) {
for (int i = 0; i < tiles.size(); i++) {
if (tiles.get(i).getX() == x && tiles.get(i).getY() == y) {
return i;
}
}
return -1;
} | 3 |
public static ClienteDTO convertToClienteDTO(Cliente cliente) {
if (cliente == null) {
return new ClienteDTO();
}
return new ClienteDTO(cliente .getId(), cliente.getNome(), cliente.getSobrenome(),
cliente.getEndereco(), cliente.getCep(),
cliente.getDtNascimento(), cliente.getTelefone());
} | 1 |
public static ArrayList<AchievementRecord> getAchievementRecordByUserID(int userID) {
ArrayList<AchievementRecord> records = new ArrayList<AchievementRecord>();
String statement = new String("SELECT * FROM " + DBTable + " WHERE userid = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatem... | 2 |
public String getRoomDescription() {
String temp = "";
String roomDescription;
roomDescription = description;
roomDescription = roomDescription + "Items:";
Enumeration<Item> e = items.elements();
while (e.hasMoreElements()) {
Item i = (Item) e.nextElement();
if (!(i.getIsInvisable())) {
roomDescri... | 9 |
public void close()
{
/* First check if the Session is even open. */
status = Status.DISCONNECTED;
if (sender != null)
sender.send("DIS:", outStream);
try
{
Thread.sleep(2000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
try
{
if (socket != null)
socket.close();
... | 5 |
public void learn(DataSet dataSet) {
if (this.initialized) {
this.neuralNetwork.learn(dataSet);
}
} | 1 |
private void checkForForwardRun(Object n, ArrayList array, int[] arrayTotal){
if (array.isEmpty()) {
array.add(n);
} else {
if (c2I((char)array.get(array.size()-1)) == c2I((char)n)-1
|| ((char)n == 'A' && c2I((char)array.get(array.size()-1)) == 3)){
... | 6 |
@Test
public void testPlayerCapturesFlagAndIsReturnedToStartingPosition() throws InvalidActionException {
factory.setPlayerOneFlagOneSquareUp();
PlayerFlag pf1 = null;
for (Element e : grid.getElementsOnGrid()) {
if (e instanceof PlayerFlag) {
PlayerFlag pf = (PlayerFlag) e;
if (pf.getPlayerInfo().... | 3 |
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Welcome frame = new Welcome();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} | 1 |
public void setSliderMax(int i)
{
mySlider.setMaximum(i);
} | 0 |
public int maximumProductCuttingTS(int N) {
if(N==0 || N==1)
return 0;
int max = 1;
if(N==2)
return max;
else if(N==3)
return max*2;
else {
while(N>4) {
max = max * 3;
N = N-3;
}
return max*N;
}
} | 5 |
@Test
public void testDates() throws Exception{
SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String dateReceived = "2014-06-18T06:22:17+00:00";
StringBuilder sb = new StringBuilder("2014-06-18T06:22:17+00:00");
if(dateReceived.length()==25)
... | 1 |
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int m = sc.nextInt(), pos = sc.nextInt();
List<Integer> vi = new ArrayList<Integer>();
for (int j = 0; j < m; j++... | 9 |
private static String getMessage(ResourceBundle resource, String messageTag, Object... args) {
if (!resource.containsKey(messageTag)) return messageTag;
String message = resource.getString(messageTag);
MessageFormat format = new MessageFormat("");
format.setLocale(currentLocale);
format.applyPattern(message)... | 5 |
@Override
protected void sort(T[] array, int leftIndex, int rightIndex) {
if (array.length > 1) {
T aux = array[leftIndex];
for (int i = leftIndex; i < rightIndex; i++) {
for (int j = leftIndex; j < rightIndex; j++) {
if (array[j].compareTo(array[j+1]) > 0) {
aux = array[j];
... | 4 |
public void showView(){
if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
this.setExtendedState(Frame.MAXIMIZED_BOTH);
}
this.setVisible(true);
init();
} | 1 |
@Test
public void mCracklePop(){
for(int i=1 ;i<=100 ;i++ ){
String m = "";
if( i%3==0 && i%5 !=0){
m = "crackle";
}else if(i%5==0 && i%3 !=0){
m ="pop";
}else if(i%5==0 && i%3 ==0){
m = "CracklePop";
} else... | 7 |
private void mapExecutable(ExecutableMemberDoc em) {
Parameter[] params = em.parameters();
boolean isConstructor = em.isConstructor();
List<Type> classArgs = new ArrayList<Type>();
for (int k = 0; k < params.length; k++) {
Type pcd = params[k].type();
// primitive... | 9 |
@Override
public void reset() {
Fonts.restoreDefaults();
mIgnore = true;
for (FontPanel panel : mFontPanels) {
panel.setCurrentFont(UIManager.getFont(panel.getActionCommand()));
}
mIgnore = false;
GraphicsUtilities.forceRepaintAndInvalidate();
Fonts.notifyOfFontChanges();
} | 1 |
private boolean checkStericsBBonly(int strandNum, int resNum) {
Residue res = m.strand[strandNum].residue[resNum];
Atom tmpAtm = null;
int resToCheck = 0;
for(int i=0;i<res.numberOfAtoms;i++) {
if (isBBatom(res.atom[i])){ //backbone atom
resToCheck = resNum;
for(int w=0;w<resToCheck;w... | 8 |
public static void main(String[] args){
if (args.length > 0){
CommandLineMode commandLineMode = new CommandLineMode(args[0],
new RectangleController());
}
else{
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run()... | 1 |
public synchronized Object put(Object obj) {
// This implementation is based on the IdentityMap.put method.
if (obj == null) {
return null;
}
Entry tab[] = mTable;
int hash = hashCode(obj);
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e ... | 9 |
public static ArrayList<String> readFileContent(String filename)
{
ArrayList <String> input = new ArrayList<String>();
try
{
FileReader fr = new FileReader(filename);
BufferedReader buffreader = new BufferedReader(fr);
String line;
int ... | 3 |
@SuppressWarnings("unchecked")
public synchronized void partialUpdate(String myEpisodesUsername, String pwdmd5, String cookie) {
log.info("Starting partialUpdate");
MyEpisodesHTTPClient myEpisodesHTTPClient = new MyEpisodesHTTPClient(cookie);
try {
List<Show> currentShows = myEpi... | 9 |
public LambdaHighlightAction(Automaton automaton, Environment environment) {
super("Highlight "+Universe.curProfile.getEmptyString()+"-Transitions", null);
this.automaton = automaton;
this.environment = environment;
} | 0 |
private void parseObjectFromFile( final File file )
{
int pos = file.getName().lastIndexOf( "." );
String name = pos > 0 ? file.getName().substring( 0, pos ) : file.getName();
if (!file.getName().endsWith( ".json" ))
return;
System.out.println("Trying to parse " + file.getName());
try
{
JsonObject... | 7 |
public boolean interact(EntityPlayer par1EntityPlayer)
{
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
if (var2 != null && var2.itemID == Item.bowlEmpty.shiftedIndex && this.getGrowingAge() >= 0)
{
if (var2.stackSize == 1)
{
par1Entity... | 6 |
public void showSupplyOrders() {
textArea.setText("");
for (int i = 0; i < driver.getOrderDB().getSupplyOrderList().size(); i++) {
Order order = (driver.getOrderDB().getSupplyOrderList().get(i));
textArea.append("Order " + order.getId() + " was created by "
+ order.getCurrentlyLoggedInStaff().getName() +... | 2 |
public static void main(String[] args) {
//Load the problem from csv file
NormalDistributedStochasticLotsizingProblem problem = new NormalDistributedStochasticLotsizingProblem(new File("examples/example_problem_Tempelmeier2012_p319.csv"));
//Create a static uncertainty solver
StaticUncertaintySolver solver =... | 1 |
@Override
public boolean execute(String action, JSONArray args,
final CallbackContext callbackContext) throws JSONException {
// TODO Auto-generated method stub
super.execute(action, args, callbackContext);
Log.v("iGreet", "iGreet: execute");
try {
String baseUrl = null, consumerKey = null, secretKey = ... | 8 |
static Object accessArray(String name, Object val, int idx[]) {
if (!val.getClass().isArray()) {
throw new IllegalArgumentException("Not an array : " + name + " " + val);
}
for (int i : idx) {
val = Array.get(val, i);
}
return val;
} | 2 |
public AbstractGameObject createObject(GameObjectType type, Coordinate coordinate) {
AbstractGameObject obj = null;
switch (type) {
case NOTHING: {
obj = new Nothing(coordinate);
break;
}
case WALL: {
obj = new Wall(coo... | 7 |
public static void main(String ... args){
byte [] bytes = {1,2,3,4,5,6,7,8,9};
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
byteBuffer.position(3);
byteBuffer.limit(6);
ByteBuffer _byteBuffer = byteBuffer.slice();
for(int i=0;i<_byteBuffer.capacity();i++){
... | 3 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Client client = (Client) o;
if (firstName != null ? !firstName.equals(client.firstName) : client.firstN... | 9 |
private void allocate_page (PageId pageno, int num) throws
BufMgrException {
try {
SystemDefs.JavabaseDB.allocate_page(pageno, num);
} catch (Exception e) {
throw new BufMgrException(e, "BUFMGR: allocate_page() failed");
} // end try
} // end allocate_page() | 1 |
private void turnTowardsTarget(double targetAngle) {
double angleDifference = angle - targetAngle;
if (Math.min(Math.abs(angleDifference), 2 * Math.PI - Math.abs(angleDifference)) < da) {
angle = targetAngle;
} else if (angleDifference > Math.PI) {
angle += da;
... | 4 |
private static boolean less(String v, String w, int d) {
return v.substring(d).compareTo(w.substring(d)) < 0;
} | 0 |
@SuppressWarnings("unchecked")
public static <E> void mergeArrayIntoCollection(Object array, Collection<E> collection) {
if (collection == null) {
throw new IllegalArgumentException("Collection must not be null");
}
Object[] arr = ObjectUtils.toObjectArray(array);
for (Object elem : ... | 2 |
public Unit findNewTargetInCurrentRoom() {
Unit new_target = null;
double smallest_angle_to_target = max_angle_to_target;
switch (target_type) {
case PYRO:
for (Pyro pyro : current_room.getPyros()) {
if (!pyro.isHomable()) {
continue;
}
double abs_angl... | 8 |
static final String method1909(byte i, String string) {
if (i != 31)
method1911((byte) 87);
anInt3222++;
String string_0_ = null;
int i_1_ = string.indexOf("--> ");
if ((i_1_ ^ 0xffffffff) <= -1) {
string_0_ = string.substring(0, 4 + i_1_);
string = string.substring(i_1_ + 4);
}
if (string.startsW... | 6 |
public void testLabelSearch()
{
try
{
Collection<Label> labels = GetLabels.create().search("Slampt");
for (Label l : labels)
assert (l.getName().contains("lampt"));
}
catch (SQLException e)
{
e.printStackTrace();
assert (false);
}
... | 2 |
public static Point getClosestUnexplored(int x, int y, int[][] map, int target){
double distance;
double prev = 1000;
Point coordinates =null;
for(int i=0;i<map.length;i++)
for(int j=0;j<map[0].length;j++)
if(map[i][j] == target && (i!= x || j!= y)){
distance = Math.sqrt(((i - x)* (i - x)) + ((j - y)* (j -... | 6 |
public static double hydratedRadius(String ion){
ion = ion.trim();
boolean test0 = true;
boolean test1 = false;
int i = 0;
double radius = 0.0D;
// check entered ion against ion list
while(test0){
if(IonicRadii.compareHydrated(ion, i)){
... | 4 |
private void setFailTransitions() {
Queue<Node> q=new LinkedList<Node>();
for(int i = 0; i < 256; i++)
if (this.root.get((byte) i) != null) {
this.root.get((byte) i).setFail(this.root);
q.add(this.root.get((byte) i));
}
this.prepareRoot();
while (!q.isEmpty()) {
Node state = q.poll();
byte[]... | 5 |
public String toString()
{
if (palavra != null)
return palavra.toString();
return id + "";
} | 1 |
@EventHandler
public void onPlayerMoveEvent(PlayerMoveEvent event) {
if (master.getMBWorldManager().isBoxel(event.getTo().getWorld())[0]) {
int maxBoxelSize = master.getConfig().getInt("max-boxel-size");
if (maxBoxelSize == 0)
return;
Player player = event.getPlayer();
Location targetLocati... | 8 |
@Override
public void handleBeforeOp(int currentAddress, OpCode opCode, int opData, CPUState s) {
if(currentAddress == 0x68b)
s.loadedBank = 0x1;
if(currentAddress == 0x3daf)
s.loadedBank = 0x3a;
if(currentAddress == 0x3760)
s.loadedBank = 0x9;
if(currentAddress == 0x2e8f)
s.loadedBank = 0x1;
if(... | 5 |
private List<Endpoint> parseEndpoints(NodeList endpointsList,
Element serviceDiscoveryElement) {
List<Endpoint> result = new LinkedList<Endpoint>();
for (int i = 0; i < endpointsList.getLength(); i++) {
Node endpointNode = endpointsList.item(i);
if (endpointNode.getNodeType() == Node.ELEMENT_NODE) {
El... | 7 |
public String getContentOfSelectionAsPageNumberBlock(int x, int y, int height, int width) throws DoenstFitException, BadPageNumber {
//Outside of image
if (x > img.getWidth() || y > img.getHeight())
return null;
if (height + y > img.getHeight())
height = img.getHeight() ... | 8 |
private void jList2ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList2ValueChanged
try {
String str = jList2.getSelectedValue().toString();
String delimiter = " / ";
String[] temp;
temp = str.split(delimiter, 2);
for(int i ... | 7 |
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String email = request.getParameter("email");
String password = request.getParameter("password");
String username = new... | 3 |
public static double getPredictedScore(String user, Business business, Map<String, User> userMap){
//String u_id = user.u_id;
String b_id = business.id;
String ubKey = user + ";" + b_id;
Double star = ubStar.get(ubKey);
if (star == null)
return -2.0;
for (HashSet<String> cluster : clusters.values()){
... | 6 |
public void mouseClicked(MouseEvent e) {
if(e.getButton()==BUTTON3){
mouseX=e.getX();
mouseY=e.getY();
System.out.println("X:"+Integer.toString(mouseX));
System.out.println("Y:"+Integer.toString(mouseY));
System.out.println("Koordynaty: "+MapGetter.addMarke... | 2 |
@Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp)
{
final java.util.Map<String,String> parms=parseParms(parm);
final String last=httpReq.getUrlParameter("ABILITYTYPE");
if(parms.containsKey("RESET"))
{
if(last!=null)
httpReq.removeUrlParameter("ABILITYTYPE");
... | 8 |
public void initField() {
for (int i = 0; i < sizeField; i++) f1.add(new ArrayList<Value>());
for (int i = 0; i < sizeField; i++) {
for (int j = 0; j < sizeField; j++) {
f1.get(j).add(Value.empty);
}
}
} | 3 |
public double standardizedAllResponsesVariance(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedAllResponsesVariance;
} | 2 |
public boolean crearAuditoriaPorTabla(String schema, String nombre) {
borrarTriggers(schema, nombre);
try {
Connection con = this.connecting();
String sql;
if (con != null) {
try (Statement stmt = con.createStatement()) {
int cont =... | 8 |
@Override
public void execute() {
switch (Settings.location.getBankerId()) {
case 6200:
Constants.FALADOR_WALK_BANK.traverse();
break;
case 2759:
Constants.EDGEVILLE_WALK_BANK.traverse();
break;
case 496:
Constants.AL_KHARID_WALK_BANK.traverse();
break;
case 21301:
Walking.walk(Constants.NEITIZNOT... | 4 |
private static DBConnection searchConnection() {
while (true) {
DBConnection conn = getFreeConnection();
if (conn != null) {
conn.setInUse();
return conn;
}
// no free connection found
if (connections.size() < ConnectionFactory.poolsizeMax) {
conn = buildConnection();
connections.a... | 3 |
@Override
public int compareTo(Object o) {
Codon c = (Codon)o;
if (c.getN1() == n1) {
if (c.getN2() == n2) {
if (c.getN3() == n3) {
return 0;
} else if (c.getN3() < n3) {
return 1;
} else {
... | 6 |
public void checkForFlag() {
try {
File dir = new File("characters");
if(dir.exists()) {
String read;
File files[] = dir.listFiles();
for (int j = 0; j < files.length; j++) {
File loaded = files[j];
if (loaded.getName().endsWith(".txt")) {
Scanner s = new Scanner (loaded);
whi... | 6 |
public static void deleteStation(Station station) {
Statement stat;
try {
stat = ConnexionDB.getConnection().createStatement();
stat.executeUpdate("delete from station where id_station="+ station.getId_station());
} catch (SQLException e) {
while (e != null) ... | 2 |
public void drop(DropTargetDropEvent evt) {
// Called when the user finishes or cancels the drag operation
try {
Transferable transferable = evt.getTransferable();
if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);... | 7 |
static LinkedList<Region> sort(LinkedList<Region> unsorted)
{
if (unsorted.size() <= 1)
return unsorted;
int mid = unsorted.size()/2;
int size = unsorted.size();
LinkedList<Region> sorted = new LinkedList<Region>();
LinkedList<Region> first = new LinkedList<Region>();
LinkedList<Region> second = new Lin... | 8 |
@EventHandler
public void onChunkPopulateEvent(ChunkPopulateEvent e)
{
Chunk c = e.getChunk();
List<String> genWorlds = Config.getStringList("generate-lifestone-worlds");
for (int i=0; i<genWorlds.size(); i++)
{
if (genWorlds.get(i).equalsIgnoreCase(c.getWorld().getName()))
{
break;
}
else ... | 7 |
public void run()
{
try
{
boolean running = true;
while (running)
{
try
{
String line = null;
while ((line = _breader.readLine()) != null)
{
try
{
_bot.handleLine(line);
}
catch (Throwable t)
{
// Stick the whole stack trace into a... | 8 |
public void newGame() {
String s;
String name = "";
int choice = 0;
s = "Welcome to Ye Olde RPG!\n";
s += "\nChoose your difficulty: \n";
s += "\t1: Easy\n";
s += "\t2: Not so easy\n";
s += "\t3: Beowulf hath nothing on me. Bring it on.\n";
s += "Selection: ";
System.out.print( s );
try {
difficulty ... | 8 |
@Override
public void Parse(Session Session, EventRequest Request) throws Exception
{
int Count = Request.PopInt();
for (int i = 0; i < Count; i++)
{
User mUser = UserHandler.GenerateUser(Request.PopInt());
Grizzly.GrabDatabase().RunFastQuery(
"INSERT INTO server_friendships (friend_one_id, f... | 2 |
public static String putp(String str)
{
mystr="";
int l=str.length(),s;
if(l<3)
s=17;
else if(l%2==0)
s=3*l;
else
s=4*l;
//System.out.println("s="+s);
for(int k=0;k<l;k++)
{
int d=str.charAt(k)+s;
//System.out.println("here d="+d);
if(d>126)
{
d=d-86;
// System.out.println("ya ... | 6 |
private double testArrayListInserts(int inserts) {
System.out.println("Testing arrayList with " + inserts + " inserts");
long[] times = new long[20];
long startTime;
long endTime;
for (int i = 0; i < 20; i++) {
arrayList = new ArrayList();
startTime = Sy... | 3 |
private void SetNewUtilityWithBellman(State currState)
{
double maxExpectedUtility = Integer.MIN_VALUE;
for(ACTION action : ACTION.values())
{
double sumU = 0.0;
for(State nextState: this.game.GetNeighborStates(currState))
{
if(!this.game.IsOutBound(nextState) && !nextState.IsWall){
sumU... | 5 |
public AnswerCombination answer(Combination<Colors> attempt) {
List<Token<AnswerColors>> answerTokens = new ArrayList<Token<AnswerColors>>();
List<Colors> attemptColorList = attempt.getColorsList();
List<Colors> targetColorList = target.getColorsList();
//Black and white number calculation
... | 8 |
public static boolean typed(int keyEvent){
return !pressed[keyEvent] && prev[keyEvent];
} | 1 |
@Test
public void testEnum(){
Method fromCodeMethod;
try {
for(Class<? extends StateProvinceEnum> clazz : enumToTest){
assertTrue(clazz.isEnum());
fromCodeMethod = clazz.getMethod("fromCode", String.class);
//test that null is returned
assertNull(fromCodeMethod.invoke(null,(Object)null));
... | 3 |
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.