text stringlengths 14 410k | label int32 0 9 |
|---|---|
public Object next() {
if(this.selection.size() == 0 || this.weight.size() == 0 || this.weightsum.size() == 0) return null;
Integer j = r.nextInt(this.weightsum.get(this.weightsum.size()-1));
Integer i;
for(i = 0; j > this.weightsum.get(i); i++);
return this.selection.get(i);
} | 4 |
public static void benchmarkByteLargeArrayInANewThread()
{
System.out.println("Benchmarking ByteLargeArray in a new thread.");
final long length = (long) Math.pow(2, 32);
long start = System.nanoTime();
final ByteLargeArray array = new ByteLargeArray(length);
System.out.print... | 3 |
public byte[] toByteArray(){
try{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = null;
out = new ObjectOutputStream(bos);
out.writeObject(this);
byte[] yourBytes = bos.toByteArray();
try{
bos.close();
out.close();
}catch(Exception e){System.out.println("A M... | 2 |
static int[] f(int N){
int a=(int)sqrt(N);
if(abs(a-sqrt(N))<1e-10)return new int[]{a%2==0?a:1,a%2==0?1:a};
if(a%2==0)return new int[]{N-a*a<=a+1?a+1:(a+1)*(a+1)-N+1,N-a*a<=a+1?N-a*a:a+1};
return new int[]{N-a*a<=a+1?N-a*a:a+1,N-a*a<=a+1?a+1:(a+1)*(a+1)-N+1};
} | 8 |
* @param password Character-array containing the password
* @return true if the login-data is correct, false otherwise
*/
private boolean checkLogIn(String accountname, char[] password) {
if (accountname.equals(_adminName) & new String(password).equals(_adminPass)) {
adminLogin();
... | 6 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String arg2,
String[] args) {
if (args.length < 1) {
// No args, display list
sender.sendMessage(ChatColor.YELLOW + "Muted players:");
String plrs = "";
for (String plr : plugin.mutedplrs.keySet()) {
plrs += plr + ", ";
}
... | 8 |
public void omniRandSet(){
rover = head;
while(rover != null){
int a = 0;
while(a < 25){
rover.randlist[a] = randlist[a];
a++;
}
rover = rover.next;
}
} | 2 |
private static void readDataFile(String fname) {
Scanner inFile;
File readIn=new File(fname);
try {
inFile = new Scanner(readIn);
int i=0;
while(inFile.hasNextLine()){
inFile.nextLine();
i++;//just counting number of lines in file
}
sequences=new String[i];
i=0;
inFile.close();
in... | 3 |
public static int maxDepth(TreeNode root) {
if (root == null)
return 0;
Queue<TreeNode> currentLevel = new LinkedList<TreeNode>();
currentLevel.add(root);
int count = 0;
while (!currentLevel.isEmpty()) {
Queue<TreeNode> nextLevel = new LinkedList<TreeNode>();
while (!currentLevel.isEmpty()) {
Tre... | 5 |
static int process(String line) {
int cases = Integer.parseInt(line.trim());
int[][] data = {
{21, 0},
{20, 1},
{21, 2},
{21, 3},
{22, 4},
{22, 5},
{23, 6},
{22, 7},
{24, 8},
{24, 9},
{23, 10},
{23, 11}
};
String[] sign= {"Aquarius", "Pisces", "Aries", "Taurus", ... | 8 |
public ArrayList<Proveedores> obtenerProveedores(String Identificacion , String nombreIn) {
String selection[] = {"Identificacion", "nombre","ID"};
String selection_type[] = {"varchar", "varchar","int"};
String table = "Proveedores";
boolean nombreVacio = !nombreIn.equals("");
b... | 7 |
public boolean pickAndExecuteAnAction() {
if(!paused) {
// if(orderFood) {
// OrderFoodThatIsLow();
// return true;
// }
// for(Food f : foods.values())
// if(f.state == FoodState.Rejected) {
// OrderRejectedFood(f);
// return true;
// }
synchronized(orders) {
for(Order o : orders)
... | 6 |
static public void add(String name, GameState gs) {
if (!states.containsKey(name)) {
states.put(name,gs);
}
} | 1 |
@Test
public void testContainsOnlyAdd()
{
ArrayList<String> operations = new ArrayList<String>();
ArrayList<Integer> vals = new ArrayList<Integer>();
// Add a bunch of values
for (int i = 0; i < 100; i++)
{
int rand = random.nextInt(200);
vals.add(rand);
operations.add(... | 4 |
public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
int contador = 10;
int seccion;
int asiento;
boolean[] asientos = new boolean[10];
for(int i=0;i<10;i++)
asientos[i] = false;
do{
System.out.printf("\nBienvenido al sistema de reservaciones.\n");
System.out.p... | 8 |
public void rotate(int[][] matrix) {
int n = matrix.length;
int tmp;
for (int i = 0; i < n / 2; i++) {
for (int j = i; j < n - i - 1; j++) {
tmp = matrix[i][j];
matrix[i][j] = matrix[n - j - 1][i];
matrix[n - j - 1][i] = matrix[n - i - ... | 2 |
@EventHandler
public void onPostLogin(PostLoginEvent event) {
if (!IRC.sock.isConnected()) return;
ProxiedPlayer p = event.getPlayer();
Util.sendUserConnect(p);
Util.incrementUid();
String chan = BungeeRelay.getConfig().getString("server.channel");
if (!chan.isEmpty()... | 2 |
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(super.toString());
buffer.append('\n');
/** print variables. */
buffer.append("V: ");
String[] variables = getVariables();
for (int v = 0; v < variables.length; v++) {
buffer.append(variables[v]);
buffer.append(" ");
... | 3 |
public static boolean isValid(Position start, Position temp, ChessBoard board) {
Coin c = board.getCoinAt(start);
int tem = (c.getColor() == CoinColor.WHITE) ? 1 : -1;
if (c instanceof Pawn && ((Pawn) c).readyForPromote()) {
if (start.getFile() == temp.getFile()) {
re... | 9 |
private void sendAsFixedLength(OutputStream outputStream, PrintWriter pw) throws IOException {
int pending = data != null ? data.available() : 0; // This is to support partial sends, see serveFile()
pw.print("Content-Length: "+pending+"\r\n");
pw.print("\r\n");
pw.flush(... | 6 |
public void run() {
Socket socket=null;
ObjectOutputStream toClient;
MazewarPacket packetToClient;
MazewarPacket headPacketFromQueue;
try{
synchronized(ClientList){
ClientList.wait();
}
//System.out.println("Sending STR to...");
synchronized(ClientList){
for(int i=0;i<ClientList.size();... | 8 |
@Override
public boolean suspendAccount(String pAdminUsername, String pAdminPassword, String pIPAddress, String pUsernameToSuspend)
{
if(!pAdminUsername.equals("Admin"))
{
aLog.info("Error Suspending Account : Incorrect Administrator Username");
return false;
}
if(!pAdminPassword.equals("Admin"))
{
... | 9 |
public void visitInitStmt(final InitStmt stmt) {
final LocalExpr[] targets = stmt.targets();
for (int i = 0; i < targets.length; i++) {
if (targets[i] == previous) {
if (i > 0) {
check(targets[i - 1]);
} else {
break;
}
}
}
} | 3 |
public static void filter()
{
splitString = ConfigFileReader.text.split("I:");
for (int i = 1; i < 141; ++i)
{
//splitString[i] = splitString[i].replaceAll( "[^\\d]", "" );
splitString[i] = splitString[i].replaceFirst(".*?(?=[a-z]?=)", "");
splitString[i] = splitString[i].replace("=", "");
splitS... | 3 |
public Solution dumbCrossover(Solution s1, Solution s2) {
int numLectures = environment.getLectureList().size();
int numFixed = environment.getFixedAssignments().size();
// Determine which solution is better
Solution better, worse;
if (s1.getPenalty() < s2.getPenalty()) {
better = s1;
worse = s2;
... | 9 |
public void putAll( Map<? extends Short, ? extends Float> map ) {
Iterator<? extends Entry<? extends Short,? extends Float>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Short,? extends Float> e = it.next();
this.put( e.getKey... | 8 |
public List<NewsItem> getPage(int page){
String baseURL = "https://www.kettering.edu";
List<NewsItem> newsPage = new ArrayList<NewsItem>();
if(page < 2) return newsPage;
try{
DefaultHttpClient client = new DefaultHttpClient();
HttpGet newsGet = new HttpGet("https://www.kettering.edu/news/c... | 8 |
public hasChosenItemsState(GameMachine gumballMachine) {
this.gumballMachine = gumballMachine;
} | 0 |
public static void main(String[] args) {
try {
System.out.println("[开始执行]");
logger.info("[开始执行]");
initBloomFilter();
ReadConfig readConfig = new ReadConfig();
List<?> configList = readConfig.readConfig();
GetData getData = new GetData();
... | 4 |
private void printToFiles(){
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(("Data/TagTableData/tagFrequencies.txt")));
BufferedWriter writer2 = new BufferedWriter(new FileWriter("Data/TagTableData/wordTagFrequencies.txt"));
BufferedWriter writer3 = new BufferedWriter(new FileWriter("Data/Ta... | 9 |
public static void main(String[] args) {
String a = "aaa";
Class<?> processor = null;
Object obj = null;
try {
processor = Class.forName("common.reflection.LineDistributorExample");
Method method = processor.getMethod("distribute", String.class);
obj = method.invoke(processor.newInstance(), a);
} cat... | 9 |
private static List<Element> merge(List<Element> left, List<Element> right) {
List<Element> merged = new ArrayList<Element>();
int temp;
while (left.size() > 0 || right.size() > 0) {
if (left.size() > 0 && right.size() > 0) {
// Update Comparison when if condition is... | 7 |
private static Date cvtDate(String s, String fmt) {
Date d = null;
Calendar cal = null;
int year = 0;
int month = 0;
int day = 0;
// Organize logic for faster decisions, so most common
// things up front...
if(fmt == null || fmt.equals("YYYY-MM-DD")) {
year = Utils.buildNumber(s, 0, 4);
month =... | 9 |
private static void createAndSendInitialMessageToAllBots(Match m, IBomber[] bombers) throws IOException {
// Lets give initial details to bombers:
String initialMessage = "BEGIN MSG\n"
+ "map width: " + m.getMapWidth() + "\n"
+ "map height: " + m.getMapHeight() + "\n"
... | 0 |
public double[] getY(double[] result, double x) {
double v = Math.sqrt((r + x - a) * (r - x + a));
if (result == null) {
result = new double[2];
}
result[0] = v + b;
result[1] = v - b;
return result;
} | 1 |
public void moveToEnd(Board board, Direction dir) {
while (tryMove(board, dir));
} | 1 |
public void checkDeclaration(Set declareSet) {
if (initInstr instanceof StoreInstruction
&& (((StoreInstruction) initInstr).getLValue() instanceof LocalStoreOperator)) {
StoreInstruction storeOp = (StoreInstruction) initInstr;
LocalInfo local = ((LocalStoreOperator) storeOp.getLValue())
.getLocalInfo()... | 3 |
private void testEmptyCycListAdd() {
UnsupportedOperationException x = null;
try {
CycList.EMPTY_CYC_LIST.add(4);
} catch (UnsupportedOperationException e) {
x = e;
}
assertNotNull(x);
} | 1 |
@Deprecated public void setLocation(Location location) {
if(location == null)
throw new IllegalArgumentException("Null location sent to setLocation");
if(dead) return;
if(this.location != null) {
heading = this.location.getDirectionToLocation(location);
this.location = location;
}
else {
th... | 4 |
private boolean read() {
try {
final URLConnection conn = this.url.openConnection();
conn.setConnectTimeout(5000);
if (this.apiKey != null) {
conn.addRequestProperty("X-API-Key", this.apiKey);
}
conn.addRequestProperty("User-Agent", Up... | 4 |
public void setLayout(int pos){
switch(pos){
case 0:
labels[INDEX_ZERO] = projectile; labels[INDEX_ONE] = pendulum;
labels[INDEX_TWO] = thirdChoice; labels[INDEX_THREE] = back;
temporaryButtonSet = mechanicsButtonSet; break;
case 1:
... | 5 |
static CharTrie ahoCorasickBuild(String[] pats) {
CharTrie root = new CharTrie();
for (int i = 0; i < pats.length; i++) {
CharTrie cur = root;
for (int j = 0; j < pats[i].length(); j++) {
char c = pats[i].charAt(j);
if (cur.children[c] == null) cur... | 9 |
public void run() {
ServerSocket serversocket = null;
Socket s;
InputStreamReader input;
BufferedReader b;
String message = null;
boolean done = false;
try {
serversocket = new ServerSocket(process.getPort(), 1);
serversocket.setSoTimeout(0);
} catch (IOException e) {
String msg =
String.... | 5 |
public Box getAdjacentBox(Direction d, Box b) {
Pair<Integer> position = getBoxPosition(b);
int w = position.getFirst();
int h = position.getSecond();
switch (d) {
case North:
if (h + 1 < height) {
return chart[w][h+1];
} else {
return null;
}
case South:
if (h - 1 >= 0) {
retu... | 8 |
public static void main(String[] args) {
// Create a variable for the connection string.
String connectionUrl = "jdbc:sqlserver://localhost:1433;" +
"databaseName=AdventureWorks;integratedSecurity=true;";
// Declare the JDBC objects.
Connection con = null;
Stateme... | 7 |
public RPChromosomeRegion getExtremes(RPChromosomeRegion testRegion) {
RPChromosomeRegion newRegion = new RPChromosomeRegion(this);
// update node bounds
if (testRegion.startChromID < newRegion.startChromID ||
(testRegion.startChromID == newRegion.startChromID &&
... | 6 |
public String strStr(String haystack, String needle) {
if (needle.isEmpty())
return haystack;
if (haystack.isEmpty())
return null;
int m = 0; // the beginning of the current match in haystack
int i = 0; // the position of the current character in needle
int[] T = kmpTable(needle);
while (m + i < hay... | 5 |
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
boolean left = true;
while (input.hasNext()) {
String line = input.nextLine();
for (int i = 0; i < line.length(); ++i) {
char c = line.charAt(i);
if (c == '\"') {
if (left) {
System.out.print("``");
le... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TradingData other = (TradingData) obj;
if (planets == null) {
if (other.planets != null)
return false;
} else if (!planets.equals(other.... | 9 |
public static void removeConnectedClient(String btN)
{
for(int i = 0;i<=5;i++)
{
if(clientsTable.getModel().getValueAt(i, 0) != null)
{
if(clientsTable.getModel().getValueAt(i, 0).toString().equals(btN))
{
//Clear Device
clientsTable.getModel().setValueAt(null, i, 0);
clientsTable.getM... | 3 |
public void popularCB() {
ArrayList<String> Departamentos = new ArrayList<>();
DepartamentoBO depBO = new DepartamentoBO();
try {
Departamentos = depBO.CMBDepartamento(usuarioLogado.getDepartamento().getCodigo());
} catch (SQLException ex) {
JOptionPane.showMessa... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
JenkinsServer that = (JenkinsServer) o;
if (name != null ? !name.equals(that.name) : that.name != null)... | 7 |
public static void main(String[] args){
_port = initParser(args);
try {
try {
_server = new ServerTCP(_port);
} catch (SocketException e) {
System.err.println(Errors.SOCKET_PROBLEM);
System.exit(-1);
} catch (IOException e) {
System.err.println(Errors.IO_PROBLEM);
System.exit(... | 6 |
public Rectangle getEditorBounds(mxCellState state, double scale)
{
mxIGraphModel model = state.getView().getGraph().getModel();
Rectangle bounds = null;
if (useLabelBounds(state))
{
bounds = state.getLabelBounds().getRectangle();
bounds.height += 10;
}
else
{
bounds = state.getRectangle();
}... | 6 |
public static String decrypt(String hash){
// The hash for the password that was generated by the encryption program
String rands = ""; // Houses the concatenated random values from the encryption program
Str... | 9 |
@SuppressWarnings({ "unchecked", "rawtypes" })
public final void prune() {
onl = new ArrayList[this.m];
for (int i=0; i<this.m; i++) { onl[i] = new ArrayList<Entry<K,V>>(1); }
cam = new Hashtable<K,Entry<K,V>>();
for (int i=0; i<off.length; i++) {
for (Entry<K,V> e : off[i]) {
final HashCounter hc = new... | 4 |
public void firstArrayOrdering()
{
// set whichOrder in order to sort the RefereeClass array
// by match allocations
RefereeClass.setWhichOrder("matches");
Arrays.sort(refereeProgram.getrefereeClassArray());
// create new array
arrayFirstOrdering = new RefereeClass[refereeProgram.getelementsInArray()];
... | 6 |
private void algorithmLine(int max, int min) {
// Let's use the other algorithm to approximate the tiles that we need to check.
algorithmWrap(max, min);
// After calling the above function, the approximation is stored in this.result
// These variables are explained when they are first set.
// They are decl... | 9 |
public static int getAbilityPower(AbilityType type) { //How much the ability deals/heals/etc
switch (type) {
case abil_tar_heal:
break;
case abil_aim_fire:
return 10;
case abil_dir_cleave:
break;
case abil_inv_mele... | 4 |
public static Account unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Account)
return (Account)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
_AccountStub stub... | 2 |
public boolean addDialog(DialogCategory category, Dialog dialog){
if(editor.controller.dialogs.containsKey(dialog.id)){
String[] buttons = {"Overwrite", "Increment", "Cancel"};
int result = JOptionPane.showOptionDialog(this, dialog + "\nDialog found with the same id", "Conflict warning", JOptionPane.WARNING_MES... | 9 |
public void addPropertyChangeListener(PropertyChangeListener listener) {
this.rosterChangeSupport.addPropertyChangeListener(listener);
for (Roster r: rosters) {
r.addPropertyChangeListener(this);
}
} | 1 |
private boolean iscontainsDuplicate(int[] nums, int i, int j) {
int length = j - i + 1;
if (length == 1)
return false;
if (length == 2 && nums[i] == nums[j])
return true;
if (length == 2 && nums[i] != nums[j])
return false;
int mid = (i + j) / 2;
HashSet<Integer> set = new HashSet<>();
for (int k... | 9 |
protected void onChannelOpen(Message msg) throws IOException {
String type = msg.readString();
int remoteid = (int) msg.readInt();
// #ifdef DEBUG
if(log.isDebugEnabled())
log.debug("Open channel '" + type + "' [" + remoteid + "]");
// #endif
int remotepacket... | 9 |
public void CheckFile(String temp, String GlobalName){
String line;
int noLine = 0;
int flag = 0;
GlobalCont = 0;
ReadFile();
//######### SET FIRST CONTLOC TO 0000 ##########
/*Formatter fmt = new Formatter();
fmt.format("%04d",GlobalCont);
String fmtPass = fmt.toString();
//System.out.... | 8 |
public int compareTo(MACPacket p)
{
int seconds = 0;
int pSeconds = 0;
int milliSeconds = 0;
int pMilliSeconds = 0;
int microSeconds = 0;
int pMicroSeconds = 0;
for(int i = 0 ; i < this.seconds.length ; i++){
seconds += (this.seconds[i] << ((this.seconds.length-1-i)*8)) & 0xFF;
}
for(int i = 0 ... | 6 |
public void setRemoveSurroundingSpaces(String tagList) {
if(tagList != null && tagList.length() == 0) {
tagList = null;
}
this.removeSurroundingSpaces = tagList;
} | 2 |
@Override
public void run() {
try {
while (true) {
mServer.send(new ConduitMessage(mClientInput));
}
} catch (Exception exception) {
// An exception here can be ignored, as its just the connection
// going away, which we deal with later.
}
shutdown();
} | 2 |
public static EquipmentType getEquipmentType(ItemStack is) {
if (ArrayUtils.contains(mats.get(EquipmentType.HELM), is.getType())) return EquipmentType.HELM;
else if (ArrayUtils.contains(mats.get(EquipmentType.CHESTPLATE), is.getType())) return EquipmentType.CHESTPLATE;
else if (ArrayUtils.contai... | 6 |
private boolean isCode(String sourceString) {
if (sourceString.isEmpty()) {
return false;
} else if (sourceString.contains("{") && !sourceString.contains("}")) {
braceCount++;
return true;
} else if (sourceString.contains("}") && !sourceString.contains("{")) {... | 6 |
protected void updatePersonnel(int numUpdates) {
if (numUpdates % REFRESH_INTERVAL == 0) {
final Base base = employs.base() ;
//
// Clear out the office for anyone dead-
for (Actor a : workers ) if (a.destroyed()) setWorker(a, false) ;
for (Actor a : residents) if (a.destroyed()) set... | 9 |
public Block(int blockID) {
if(blockID == World.AIR || blockID == World.STONE || blockID == World.DIRT || blockID == World.WOOD || blockID == World.LEAF) {
this.blockID = blockID;
}
else {
blockID = World.INVALID;
}
} | 5 |
public SignalStructure(Class<?>[] params, List<Slot> arrayList, Class<?> returnParam)
{
this.invokerParameters = params;
this.registeredListeners = arrayList;
this.returnParam = returnParam;
} | 2 |
public Production[] getProductionsToAddToGrammar(Grammar grammar,
Set lambdaSet) {
ArrayList list = new ArrayList();
Production[] productions = grammar.getProductions();
for (int k = 0; k < productions.length; k++) {
Production[] prods = getProductionsToAddForProduction(
productions[k], lambdaSet);
... | 2 |
@Override
public void endSetup(Attributes atts) {} | 0 |
private void refill() throws IOException {
final int token = in.readByte() & 0xFF;
final boolean minEquals0 = (token & MIN_VALUE_EQUALS_0) != 0;
final int bitsPerValue = token >>> BPV_SHIFT;
if (bitsPerValue > 64) {
throw new IOException("Corrupted");
}
final long minValue = minEquals0 ? 0... | 8 |
private void drawPaths(Graphics g) {
for (VortexSpace space : vortexes) {
double[] location = space.getLocation();
ArrayList<Integer> neighbors = space.getNeighbors();
ArrayList<Integer> paths = space.getPaths();
for (int i=0; i<neighbors.size(); i++) {
int corridor = paths.get(i);
g.setColor(new ... | 7 |
public boolean setJumpheight(int jumpheight) {
if (jumpheight > 0 && jumpheight < 4) {
this.jumpheight = jumpheight;
return true;
}
else {
return false;
}
} | 2 |
static void set_ordinals_in_plausible_commit_order(Map<String, Set<String>> graph,
OrdinalMapper ordinals) {
// Make a list of all parent to child edges.
// Each edge represents the constraint "the ordinal of this parent is less
// than th... | 7 |
/* */ @EventHandler(priority=EventPriority.HIGHEST)
/* */ public void onFoodLevelChange(FoodLevelChangeEvent event)
/* */ {
/* 252 */ if ((event.getEntity() instanceof Player))
/* */ {
/* 254 */ Player player = (Player)event.getEntity();
/* */
/* 256 */ if (!event.isCancel... | 4 |
@Override
public boolean keyup(KeyEvent ev) {
if (ev.getKeyCode() == KeyEvent.VK_UP)
APXUtils.wPressed = false;
if (ev.getKeyCode() == KeyEvent.VK_LEFT)
APXUtils.aPressed = false;
if (ev.getKeyCode() == KeyEvent.VK_DOWN)
APXUtils.sPressed = false;
... | 8 |
@Override
public void mouseDragged (MouseEvent e) {
if (alg.isProcess()) {
return;
}
int i = getRowByMouseX(e.getX());
int j = getColumnByMouseY(e.getY());
if (e.getModifiersEx() == MouseEvent.BUTTON1_DOWN_MASK) {
if (draggedCell != null) {
... | 7 |
public double rawAverageCorrelationCoefficients(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
return this.rawMeanRhoWithoutTotals;
} | 2 |
public String addUser() throws Exception {
DBConnection dbcon = new DBConnection();
Connection con = dbcon.connect();
String check = "failure";
String result=null;
String query="SELECT COUNT(username) FROM users WHERE username='"+username+"';";
PreparedStatement ... | 6 |
public void imprimirTable(JTable table) {
for (int i = 0; i < table.getRowCount(); i++) {
for (int j = 1; j < table.getColumnCount(); j++) {
System.out.print(table.getValueAt(i, j) + " ");
}
System.out.println("");
}
} | 2 |
@Override
public void logicUpdate(GameTime gameTime) {
// Call any 'startUps' required
updateGameQueue(gameTime);
for (IHudItem item : hudItemQueue) {
item.logicUpdate(gameTime);
}
} | 1 |
boolean contains(int[] arr, int x) {
for (int i : arr)
if (x == i)
return true;
return false;
} | 2 |
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
Customer customer = customers.get(rowIndex);
switch (columnIndex) {
case 0:
return customer.getId();
case 1:
return customer.getFirstname();
case 2:
... | 5 |
public void loadImage(String key, String path) {
File sourceImage = new File(path);
Image image = null;
try {
image = ImageIO.read(sourceImage);
} catch (IOException e) {
e.printStackTrace();
}
if(image != null) {
loadedImages.put(key, image);
}
} | 2 |
public void updateFinderBounds(Rectangle bounds, boolean repaint)
{
if (bounds != null && !bounds.equals(finderBounds))
{
Rectangle old = new Rectangle(finderBounds);
finderBounds = bounds;
// LATER: Fix repaint region to be smaller
if (repaint)
{
old = old.union(finderBounds);
old.grow(3, ... | 3 |
public MusicLoudness getMusicLoudness() {
return musicLoudness;
} | 0 |
@Override
public void setRank(int newRank) {
rank = newRank;
} | 0 |
private JSONObject getModel(String format){
JSONObject models = null, model = null;
ArrayList<String> keyList = new ArrayList<String>();
try{
models = new JSONObject(getModelFileData());
if(format.equals("random") || format.length() <= 0){
Iterator<?> keys = models.keys();
while(keys.hasNext()){
... | 5 |
public boolean input(Instance instance) {
if (getInputFormat() == null) {
throw new IllegalStateException("No input instance format defined");
}
if (m_NewBatch) {
resetQueue();
m_NewBatch = false;
}
Instances outputFormat = outputFormatPeek();
double[] vals = new double[outpu... | 9 |
public void sendMessage(Message message)
{
try{
writer.writeObject(message);
writer.flush();
}
catch(NullPointerException e)
{
ServerHelper.log(LogType.ERROR, "Kein Outputstream für " + ip + ":" + port + " vorhanden");
}
catch(IOExc... | 2 |
public String showList(){
List<Problem> list = problemDAO.findPage(page, size);
problemList = new ProblemList();
problemList.setList(list);
return SUCCESS;
} | 0 |
public void checkReady() {
if ((points==0) && (ground != null) && (name != null)) {
status = "Nomad";
}
} | 3 |
@Override
public boolean onMouseDown(int mX, int mY, int button) {
if(super.onMouseDown(mX, mY, button)) {
return true;
}
for(ResearchItemButton rib : itemSlots) {
if(rib.onMouseDown(mX, mY, button)) {
researchDone = true;
return true;
... | 3 |
public void run() {
try {
// populate warehouse with goodies
populateWarehouse();
System.out.println("===========================");
System.out.println("= Sales System =");
System.out.println("===========================");
printUsage();
BufferedReader in = new BufferedReader(new Inpu... | 2 |
@Override
public String toString() {
return name;
} | 0 |
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.