text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ArrayList<Team> CreateTeams() {
for (int i = 0; i < NumOfTeams; i++) {
Team t = new Team();
teams.add(t);
}
return teams;
} | 1 |
@Override
public void update() {
// Consider player input and create more ribbons if requested
if( inputEvent.keyTyped( KeyEvent.VK_1 ) )
createRibbons( 1 );
else if( inputEvent.keyTyped( KeyEvent.VK_2 ) )
createRibbons( 10 );
else if( inputEvent.keyTyped( Key... | 4 |
public AutomatonGraph(Automaton automaton) {
super();
State[] states = automaton.getStates();
Transition[] transitions = automaton.getTransitions();
for (int i = 0; i < states.length; i++)
addVertex(states[i], states[i].getPoint());
for (int i = 0; i < transitions.length; i++)
addEdge(transitions[i].get... | 2 |
@Override
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null || obj.getClass() != getClass()) return false;
Vector3 other = (Vector3) obj;
return x == other.x && y == other.y && z == other.z;
} | 5 |
private void BtGravarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtGravarActionPerformed
if (camposobrigatoriospreenchidos()) {
if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja Gravar esta compra e de que todas as informações estão corretas?", "Deseja gravar?", ... | 8 |
public Document modifyDocumentFrom(InstanceCheckerEngine logic, Document document, InstanceCheckerParser problem) {
Element functionsElement = XMLManager.getElementByTagNameFrom(document.getDocumentElement(), InstanceTokens.FUNCTIONS, 0);
if (functionsElement != null)
document.getDocumentElement().removeChild(fu... | 9 |
private void dfs(Digraph G, int v) {
count++;
marked[v] = true;
for (int w : G.adj(v)) {
if (!marked[w]) dfs(G, w);
}
} | 2 |
public String getDescriptor(int r, int c) {
switch (currentTurn) {
case 1:
if (c < unitsP1.length )
return unitsP1[r][c].getDescriptor();
else
return terrainP1[r][c - unitsP1.length].getDescriptor();
case 2:
if (c < unitsP2.length )
return unitsP2[r][c].getDescriptor();
else
return ter... | 7 |
@Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
String parm = (commands.size() > 1) ? CMParms.combine(commands,1) : "";
if((mob.isAttributeSet(MOB.Attrib.AUTOASSIST) && (parm.length()==0))||(parm.equalsIgnoreCase("ON")))
{
mob.setAttribute(MOB.At... | 8 |
public void startgame() {
if (running)
return;
h = new HavenPanel(800, 600);
add(h);
h.init();
try {
p = new haven.error.ErrorHandler(new ErrorPanel(), new URL("http", getCodeBase().getHost(), 80, "/java/error"));
} catch (java.net.MalformedURLExce... | 6 |
public void setTrain(Train value) {
this._train = value;
} | 0 |
public void setAccount(String account) {
this.account = account;
} | 0 |
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_A) { degrees--; }
if (e.getKeyCode() == KeyEvent.VK_O) { degrees++; }
if (e.getKeyCode() == KeyEvent.VK_RIGHT) { x++; }
if (e.getKeyCode() == KeyEvent.VK_LEFT) { x--; }
if (e.getKeyCode() == KeyEvent.VK_DOWN) { y++; }
if (e.getKeyCode... | 6 |
public boolean retirar(double cantidad){
if(cantidad > saldo){
if(cuentaAhorro == null)
return false;
else if((cantidad-saldo) > cuentaAhorro.getSaldo() )
return false;
else{
cantidad-=saldo;
saldo=0;
cuentaAhorro.retirar(cantidad);
return true;
}
}
else{
saldo... | 3 |
public static String getFileNameByFilePathJudgeSuffix(String filePath,boolean flag){
String name = null;
if(null != filePath && filePath.length() > 0){
String temp[] = filePath.replaceAll("\\\\","/").split("/");
if (temp.length >= 1) {
name = temp[temp.length - 1];
}
}
if(null != name && na... | 7 |
void keepAlive () {
if (!isConnected) return;
long time = System.currentTimeMillis();
if (tcp.needsKeepAlive(time)) sendTCP(FrameworkMessage.keepAlive);
if (udp != null && udpRegistered && udp.needsKeepAlive(time)) sendUDP(FrameworkMessage.keepAlive);
} | 5 |
public Behaviour jobFor(Actor actor) {
//if ((! structure.intact()) || (! personnel.onShift(actor))) return null ;
final Choice choice = new Choice(actor) ;
//
// See if any new datalinks need to be installed or manufactured-
final Delivery baseC = Deliveries.nextCollectionFor(
actor, this, n... | 7 |
@Override
public void propertyChange(PropertyChangeEvent e) {
JTable table = (JTable)e.getSource();
if (table == null) {
return;
}
String propertyName = e.getPropertyName();
if (propertyName.equals("enabled")) {
boolean ... | 8 |
public void AddStopMenuElement() {
if (elementStop != null)
return;
elementStop = APXUtils.addResource("stop_" + scrUniq, scrName,
scrTooltip, scrHotkey, APXUtils.resScript4, APXUtils.scriptRootRem,
new MenuElemetUseListener(new String(filename)) {
@Override
public void use(int button) {
... | 2 |
public TreeContainerRow overDisclosureControl(int x, int y) {
if (mShowDisclosureControls && !mColumns.isEmpty()) {
if (x < mColumns.get(0).getWidth() + getColumnDividerWidth()) {
TreeRow row = overRow(y);
if (row instanceof TreeContainerRow) {
int right = INDENT * row.getDepth();
if (x <= right ... | 6 |
@Test
public void testJoinGame() {
// valid join
try {
games.joinGame(new JoinGameRequest(0, "blue"), "TestUser", 999);
assertEquals("Failed to add player name to empty game in games list.", "TestUser", games.listGames().get(0).getPlayerDescriptions().get(0).getName());
} catch (InvalidGamesRequest e) {
... | 4 |
public StringBuffer format(double number, StringBuffer toAppendTo,
FieldPosition pos) {
StringBuffer s = new StringBuffer( nf.format(number) );
if( s.length() > width ) {
if( s.charAt(0) == ' ' && s.length() == width + 1 ) {
s.deleteCharAt(0);
}
else {
s.setLength( width );
for( in... | 9 |
public void updateAll( float delta )
{
update( delta );
for ( GameObject child : children )
child.updateAll( delta );
} | 1 |
private Expression cons( List<Expression> args, String caller ) {
if ( args.size() != 2 ) {
System.err.println("cons expected exactly two argument and got " + args.size() );
return new Void();
}
Expression evaledArg = args.get(0).eval(defSubst, caller);
Expression... | 2 |
public EvolscriptView(SingleFrameApplication app) {
super(app);
initComponents();
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
if( e.getSource() == boton_alta_departamento ){
Controlador.getInstance().accion(EventoNegocio.GUI_ALTA_DEPARTAMENTO,GUIPrincipal_Departamento.this);
}
else if( e.getSource() == boton_baja_departament... | 6 |
private static int pivot(int[] a, int low, int high) {
int i1 = low, i2 = high - 1, i3 = (low + high) / 2;
int a1 = a[i1], a2 = a[i2], a3 = a[i3];
int n = (a1 > a2) ? a1 : a2;
int m = (a2 > a3) ? a2 : a3;
if (m > n) {
return (a1 > a2) ? i1 : i2;
} else if (n... | 8 |
@ChattingAnnotation(feature="Attachment", type="method")
@Override
public void fileSent(String sender, String fileName, byte[] fileData) {
if (!sender.equals(this.getTitle())) {
tvTranscript.setText("Recived a file " + fileName + "\n");
try {
saveFile(filePath + fileName, fileData);
} catch (Exception ... | 2 |
public boolean isEvenlyDivisible(int num) {
boolean isIt = true;
for (int i = 2; i <= 20 && isIt; i++) {
if (!(num % i == 0)) {
isIt = false;
}
}
return isIt;
} | 3 |
public void dispose() {
if (edgeListLeftNeighbor != null || edgeListRightNeighbor != null) {
// still in EdgeList
return;
}
if (nextInPriorityQueue != null) {
// still in PriorityQueue
return;
}
edge = null;
leftRight = null... | 3 |
private Square[][] createArrayBoard()
{
int height, width;
height = inputBoard.size();
width = 0;
for(int x = 0; x < height; x++)
{
if(width < inputBoard.get(x).size())
{
width = inputBoard.get(x).size();
}
}
Square[][] board = new Square[height][width];
for(int x = 0; x < height; x++)
{... | 5 |
private static String getAllowedCharacters() {
StringBuilder sb;
InputStreamReader isr = new InputStreamReader(ChatAllowedCharacters.class.getResourceAsStream("/font.txt"), Charset.forName("UTF-8"));
try (BufferedReader var1 = new BufferedReader(isr)) {
String tmp;
sb = n... | 3 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
long n = Long.parseLong(line.trim()), ans[] = new lon... | 6 |
public static void main(final String[] args) {
boolean displayConsole = true;
if (args.length > 0) {
// it has arguments
if (args.length == 1 && args[0].equalsIgnoreCase(Main.help)) {
System.out.println("Starts the KOI server");
System.out.println("\nArguments:");
System.out.println(Main.noConsol... | 8 |
public ListNode rotateRight(ListNode head, int n) {
if (head == null || head.next == null || n == 0) {
return head;
}
int length = 0;
int steps = 0;
ListNode first = head;
ListNode second = head;
while (first != null) {
first = first.next... | 8 |
public LinkedList<Field> getAttackBorder() {
LinkedList<Field> fields = this.field.getAttackBorder();
if (fields == null) {
fields = new LinkedList<Field>();
for (Offset offset : Ant.attackBorder) {
boolean found = false;
if (!offset.getField(this.field).hasWater()) {
for (Offset o : Ant.attackOf... | 7 |
public boolean nextTo( Point p ){
if( equals(p) ){
return true;
}
if( _x == p._x ){
if( _y == p._y+1 || _y == p._y-1 ){
return true;
}
}
if( _y == p._y ){
if( _x == p._x+1 || _x == p._x-1 ){
return true;
}
}
return false;
} | 7 |
public static Action create(String action){
Action actionObject = null;
String nomeClasse = "br.com.implementacaoObserverWeb.action." + action + "Action";
Class classe = null;
Object object = null;
try{
classe = Class.forName(nomeClasse);
object = classe.n... | 2 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
//Position de la souris
int posX = Mouse.getX();
int posY = Mouse.getY();
//background
bg.draw();
//positions et mouvements des projectiles
for (int i = 0; i < listAn... | 3 |
@Test
public void testCheckLabChoices(){
//Initialize a boolean saying there are no students who have no first choices and aren't flagged.
boolean startEmptyFirstChoices = true;
//For each student
for(Student s: students){
//If a student has no first choices and isn't flagged
if(s.getFirstChoiceLabs().is... | 8 |
@Override
public void actionPerformed(ActionEvent e) {
if (held) {
if (this.pressed) {
heldStatus.put(this.name, true);
} else {
heldStatus.put(this.name, false);
}
} else {
if (this.pressed && !toggleStatus.get(this.name)) {
toggleStatus.put(this.name, true);
action();
}... | 5 |
private void pullStack(){
NetworkMessage m = messageQueue.poll();
if(m == null)
return;
try
{
Socket client = new Socket(m.getReceiver() , m.getPort() );
OutputStream outToServer = client.getOutputStream();
DataOutputStream out = new DataOutputStream(... | 3 |
public CtrlVisiteurs getCtrl() {
return ctrlV;
} | 0 |
public ContentResponse send() throws InterruptedException, ExecutionException, TimeoutException, IOException {
String urlRequest = baseUri + resource;
Request httpRequest = httpClient
.newRequest(urlRequest)
.param("access_token", token);
for (String key : headers... | 5 |
private static void traverseTree(Tree tree) {
TreeItem[] treeItems = tree.getItems();
for (TreeItem treeItem : treeItems) {
traverseNode(treeItem);
}
} | 1 |
public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) throws Exception {
Move m = null; // placeholder for return value
// this player selects randomly
int direction = rand.nextInt(6);
switch (direction) {
case 0: m = new Move(STAYPUT); break;
case 1: m = new Move(WES... | 9 |
public Proffession getProffession() {return proffession;} | 0 |
public String encodeValues() throws EncodeException {
StringBuilder res = new StringBuilder();
if (this.values != null && this.values.length > 0) {
for (Object value : this.values) {
if (value instanceof Integer) {
res.append("int:");
} els... | 9 |
@Override
public void run() {
do{
field.repaint();
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(1/ticks));
} catch (InterruptedException e) {
e.printStackTrace();
}
}while(running);
} | 2 |
@Override
protected boolean judgeResult(CardGroup cardGroup) {
cardGroup.doSort(CardGroupSortType.DECREASE);
boolean result = true;
int score = cardGroup.getCard(0).getType();
for(int i = 0; i <cardGroup.size()-1 ; i += 2 , score --) {
if( score != cardGroup.getCard(i+1).getType() || ((i + 2)<cardGroup.size... | 4 |
private void createInverter(String in, String out)
{
Inverter inverter = new Inverter();
// Connect the input
// Check if the in wire is an input
if (stringToInput.containsKey(in))
{
Wire inWire = new Wire();
stringToInput.get(in).connectOutput(inWire);
inverter.connectInput(inWire);
}
// Check... | 5 |
private void updateGcCapacity(GcCapacity gcCapacity) {
if(gcCap == null)
this.gcCap = gcCapacity;
else {
if(gcCap.getEC() > gcCapacity.getEC())
gcCap.setEC(gcCapacity.getEC());
if(gcCap.getNGC() > gcCapacity.getNGC())
gcCap.setNGC(gcCapacity.getNGC());
if(gcCap.getOGC() > gcCapacity.getOGC(... | 7 |
private int getControlPosition(int controlType) throws Exception{
ArrayList<Integer> controls = new ArrayList<Integer>();
for(Surface surface: this.getSurfaces()){
for(Section section: surface.getSections()){
for(Control control: section.getControls()){
if... | 5 |
public void update(GameContainer gc, int delta) {
Input input = gc.getInput();
if (input.isKeyDown(Input.KEY_W))
{
position.add(new Vector2f(0,-MOTION_SPEED*delta));
body.setPosition(position.getX(),position.getY());
if (sprites.get("reverse") != null)
curImage = sprites.get("reverse");
}
if (i... | 8 |
public void replacePast() {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Entity past_string = null;
try {
past_string = datastore.get(KeyFactory.createKey("past_string",
"onlyOne"));
} catch (EntityNotFoundException e) {
}
String[] string_box = ((Text) past_string... | 5 |
public void collisionUpdate(int i, int j, int k, int l) {
Obstacle[][] obs = level.getObstacles();
boolean collideBad = true;
if (i+(height/Obstacle.getHeight())+ 1>=obs.length) { // Out of the drawing.
dead = true;
System.out.println("Below the box");
} else {
collisionSide(obs,i,j,k,l);
collideBad... | 2 |
public Frame parse(ByteBuffer downloadBuffer) throws WebSocketException {
ByteBuffer buffer = null;
try {
if (State.DONE.equals(state)) {
transitionTo(State.HEADER);
buffer = downloadBuffer;
} else {
buffer = bufferManager.getBuffer(downloadBuffer);
}
if (State.HEADER.equals(state)) {
i... | 8 |
public void setSolEstado(String solEstado) {
this.solEstado = solEstado;
} | 0 |
@Override
public boolean equals(Object obj)
{
if(this == obj)
{
return true;
}
if(obj == null)
{
return false;
}
if(!(obj instanceof TSLObject))
{
return false;
}
TSLObject other = (TSLObject) obj;
return objects_map.equals(other.objects_map) && strings_... | 4 |
private void popWall(MansionArea room, boolean isRoom){
//each wall can contain only one item, and must contain one item
if (isRoom){
if (room.getNorth() == null){
room.addItem(wallItems.getItem(Face.NORTHERN));
}
if (room.getEast() == null){
room.addItem(wallItems.getItem(Face.EASTERN));
}
i... | 9 |
public static SampleSet generateData(final int bits, final Random rnd) {
//
final SampleSet result = new SampleSet();
//
final double[] input = new double[bits];
final double[] output = new double[2];
//
final int samples = 1 << bits;
//
for (int ... | 6 |
public Map<Long, Link> getLinks(AreaBox box) {
String queryString;
ResultSet resultSet = null;
HashMap<Long, Link> links;
links = new HashMap<Long, Link>();
queryString = String.format("SELECT id, crossing_id_from, crossing_id_to, meters, lsiclass, tag, maxspeed, long_from, lat_... | 4 |
public void onEnable() {
//Basic plugin setup
Server = getServer();
log = Server.getLogger();
setPdfFile(this.getDescription());
//load up our files if they don't exist
moveFiles();
setupPermissions();
//Load our flat file player DB
questPlayerStorage = new iProperty("plugins/uQuest/uQuest_Play... | 7 |
public void create(Cliente cliente) throws PreexistingEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
em.persist(cliente);
em.getTransaction().commit();
} catch (Exception ex) {
... | 3 |
public static DataSource inputDataFrom(final Object object) throws IOException {
if (object instanceof DataSource) return (DataSource)object;
if (object instanceof File) return IO._inputDataFrom_((File)object);
if (object instanceof RandomAccessFile) return IO._inputDataFrom_((RandomAccessFile)object);
if (obje... | 9 |
private void createOutput(){
double maxLog2Score = 0;
double minLog2Score = 0;
//Determine maximum and minimum score
for(BedLine bl: bedLines){
if(bl.getLog2() > maxLog2Score){
maxLog2Score = bl.getLog2();
}
if(bl.getLog2() < minLog2Score){
minLog2Score = bl.getLog2();
}
}
//Set each l... | 7 |
public synchronized void add(Range r) {
Set<Range> toDelete = new HashSet<Range>();
boolean span = false;
for(Range currentRange: this.ranges) {
if (r.getLow() <= currentRange.getHigh() + 1 && r.getLow() >= currentRange.getLow()) {
// if the current range will merge with the low-end of r, se... | 7 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
MethodParamBinding other = (MethodParamBinding) obj;
if (argumentCount != other.argumentCount)
return false;
if (message != other... | 8 |
public double getGeneration() {
return generation;
} | 0 |
@Override
public boolean click(int mx, int my, boolean click)
{
if (mouseIn(mx, my) && click)
{
if (!clicked)
{
formDown=!formDown;
clicked = true;
return true;
}
clicked = true;
return false;
}
if(formDown)
{
mouseOver(mx,my);
if(click==true&&overSel>=0)
... | 7 |
public void delete(Juego juego){
Partida partida = selectPartida(juego);
List<Nave> naves = partida.getNaves();
List<Escudo> escudos = partida.getEscudos();
List<Invasor> invasores = partida.getInvasores();
try {
label.setText(format("Borrando juego ..."));
... | 4 |
private void createDB() {
Connection connection = null;
PreparedStatement statement = null;
try{
Class.forName("org.gjt.mm.mysql.Driver");
connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1/xmltojdbc", "root", "root");
statement = (PreparedStatem... | 6 |
@Override
public boolean equals(Object obj){
if (obj instanceof Circle){
Circle o = (Circle)obj;
if (pnt.x-rad/2<o.pnt.x && pnt.x+rad/2>o.pnt.x && pnt.y-rad/2<o.pnt.y && pnt.y+rad/2>o.pnt.y ||
pnt.x-rad/2>o.pnt.x && pnt.x+rad/2<o.pnt.x && pnt.y-rad/2>o.pnt.y && p... | 9 |
private void runStatement(Map<Point, Set<Integer>> geoTags, Map<GeoTag, PointTag> tagMap){
GeospatialData [] data = null;
// get multi-data from DB:
if (loader.loadingFeatures){
data = db.getMultiHorizons(geoTags, loader.srdsSource.srdsSrcID);
... | 7 |
private static ArrayList<Integer> getPredictor(int windowLen, int[] finalCluster, int VERBOSE) {
int logFlag = Constants.LOG_PREDICTOR;
// get the last W
int[] keySequence = new int[windowLen];
for (int i=finalCluster.length-windowLen; i<finalCluster.length; i++) {
keySequence[i-finalCluster.length+windowLen... | 4 |
private void compute_pcm_samples5(Obuffer buffer)
{
final float[] vp = actual_v;
//int inc = v_inc;
final float[] tmpOut = _tmpOut;
int dvp =0;
// fat chance of having this loop unroll
for( int i=0; i<32; i++)
{
final float[] dp = d16[i];
float pcm_sample;
pcm_sample = (float)(((vp[5 + ... | 1 |
public double getDouble(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).doubleValue()
: Double.parseDouble((String) object);
} catch (Exception e) {
throw new JSONException("J... | 2 |
public static void main(String args []){
Board b = new Board();
Move m = new Move();
boolean player1 = true;
//A loop that runs until the board is full or someone has won.
//In each iteration we print the board, call insertMove and change whos turn it is.
whil... | 6 |
public void popularCmbDepartamentoBuscar() {
ArrayList<String> Departamentos = new ArrayList<>();
DepartamentoBO departamentoBO = new DepartamentoBO();
if (userLogado.getTipo().equals("Diretor")) {
try {
Departamentos = departamentoBO.ComboBoxDepartamentos();
... | 4 |
public Point[] fast (Point[] ptArr, int numPoints, int pointer){
Point origin = ptArr[0];
ptArr[0] = null;
int slope;
Hashtable<Integer, ArrayList<Point>> table = new Hashtable<Integer, ArrayList<Point>>();
for( int i = 1; i < numPoints; i++ ){
if(ptArr[i] == null) continue;
slope = (int) (100.0 * or... | 7 |
public static int findMin(int[] num) {
if (null == num || 0 == num.length) return -1;
int low = 0, high = num.length - 1;
if (1 == num.length) return num[0];
if (num[low] < num[high]) return num[low];
while (low <= high) {
if (low + 1 == high)
return num[low] ... | 8 |
private void btnSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarActionPerformed
int confirmar = JOptionPane.showConfirmDialog(null, "Deseja Salvar?","Deseja Salvar?", JOptionPane.OK_CANCEL_OPTION);
if (JOptionPane.OK_OPTION == confirmar){
if(txtD... | 9 |
private int handleR(String value,
DoubleMetaphoneResult result,
int index,
boolean slavoGermanic) {
if (index == value.length() - 1 && !slavoGermanic &&
contains(value, index - 2, 2, "IE") &&
!contains(value, in... | 5 |
public boolean sendData(Object data) {
boolean status = true;
TCPServer tcpServer;
for (int i = 0; i < tcpServers.size(); i++) {
tcpServer = tcpServers.get(i);
if (tcpServer != null) {
if (tcpServer.readyForUpdates) {
if (!tcpServer.s... | 4 |
public boolean permGen(int[] array) {
// Find longest non-increasing suffix
int i = array.length - 1;
while (i > 0 && array[i - 1] >= array[i])
i--;
// Now i is the head index of the suffix
// Are we at the last permutation already?
if (i <= 0)
return false;
... | 5 |
public void checkGroup(GroupSettings settings, CheckReport report)
{
EntityConcentrationMap map = new EntityConcentrationMap(settings, this);
report.waitForGroup(settings);
for(World world : Bukkit.getWorlds())
{
if(allowWorldGlobal(world) && settings.allowWorld(world))
map.queueWorld(world);
}
... | 3 |
@Override
protected boolean finishTask() throws Throwable
{
URL url = ParseHelper.asURL(this.getAddress());
if (url == null)
{
this.response = 404;
return true;
}
URLConnection con = url.openConnection();
HttpURLConnection http = (con instanceof HttpURLConnection) ? (HttpURLConnection)con ... | 6 |
public ListadoPartidosPosibles(ArrayList<Jugador> jugadores, boolean idaV){
listado = new ArrayList<Partido>();
marcador = new HashMap<Partido, Boolean>();
Partido p, pAux;
total = 0;
idaVuelta = idaV;
boolean anadir = false;
for (Jugador j1: jugadores)
for (Jugador j2: jugadores)
if (!j1.equ... | 7 |
public void lossyFilterTriple(int lim) {
System.out.println("Determinating filters and applying lossy filter...");
long initTime = System.currentTimeMillis();
lossy = lim;
if (lineFilter == null) { filterDeterminate(); }
int slim = 1 << (lim - 1);
int mod = (1 << lim) + 1;
int exL = mod - 1;... | 9 |
@Override
public void deserialize(Buffer buf) {
lifePoints = buf.readInt();
if (lifePoints < 0)
throw new RuntimeException("Forbidden value on lifePoints = " + lifePoints + ", it doesn't respect the following condition : lifePoints < 0");
maxLifePoints = buf.readInt();
if... | 7 |
private int newHole(int hole, T element){
int left = (hole * 2) +1; //left child
int right = (hole * 2) +2; //right child
if(left > lastIndex)
//hole has no childern
return hole;
else
if(left == lastIndex)
//left child only
... | 6 |
@Override
public MapConnector<String, Integer> putAll(final Map<? extends String, ? extends Integer> map) throws Exception {
super.addSQLJob(new SQLJob<String, Integer>() {
@Override
public void executeJob(Connection con, Map<String, Integer> internalMap) throws SQLException {
... | 7 |
public static ArrayList<ArrayList<String>> createListFromSameLetterString(
String s, ArrayList<ArrayList<String>> allLists, int length) {
if (length == 0) {
return new ArrayList<ArrayList<String>>();
}
String letter = s.substring(0, 1);
allLists = createListFromSameLetterString(s, allLists, length - 1);
... | 7 |
@Test
public void ifSpotNotFreePlaceNearBy()
{
Positioned p = new Positioned(64,64,1,1);
list.addEntity(p);
list.addEntity(new Positioned(64,64,1,1));
p.findNearestFreeSpot();
assertTrue( (p.X() == 66 && p.Y() == 64) ||
(p.X() == 64 && p.Y() == 66) ||
... | 7 |
@Override
public void mouseMoved(MouseEvent e) {
for(CButton btn : buttons){
if(btn.isEnabled() && isBetween(btn.getX(), e.getX(), btn.x1) && isBetween(btn.getY(), e.getY(), btn.y1)){
btn.showHover = true;
}else
btn.showHover = false;
}for(CTextBox txt : textboxes){
if(txt.isEnabled() && ((txt.has... | 9 |
private static void reverse(String player, int row, int col, int[][] revList, int countRev) {
for (int i=0; i<countRev; i++) {
switch (revList[i][2]) {
case 0: reverse0(revList, row, col, player, i); break;
case 1: reverse1(revList, row, col, player, i); break;
case 2: reverse2(revList, row, col, p... | 9 |
public void testBean(Object instance) throws Exception {
List<Field> fields = getFields(instance);
StringBuilder message = new StringBuilder();
boolean alert = false;
message.append("Testing " + instance.getClass().getSimpleName() + "\n");
for (Field field : fields) {
field.setAccessible(true);
Meth... | 8 |
public static String getIpInfo(String ip) {
if (ip.equals("本地")) {
ip = "127.0.0.1";
}
String info = "";
try {
URL url = new URL("http://ip.taobao.com/service/getIpInfo.php?ip=" + ip);
HttpURLConnection htpcon = (HttpURLConnection) url.openConnection();
htpcon.setRequestMethod("GET");
htpcon.setD... | 6 |
@Override
public void setDbDriverNname(String dbdrivername) {
this.dbdrivername = dbdrivername;
} | 0 |
private byte[] encodeBase64 (File file, boolean isChunked)
throws IOException {
byte[] buf = null;
if (!file.isFile())
throw new IOException(file.getAbsolutePath() + ": is not a file.");
buf = new byte[(int) file.length()];
FileInputStream in = new FileInputStre... | 2 |
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.