text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void render(Level level, ScreenEngine2D screen, int y0, int y1, int x0, int x1) {
for (int y = y0; y < y1; y++) {
for (int x = x0; x < x1; x++) {
if(type.equals(LayerType.DEFAULT_LAYER)) {
level.getTileLayer(this,x,y).render(x, y, screen, this);
} else if(type.equals(LayerType.COLLISION_LAYER))... | 7 |
public static void main(String[] args) throws Exception
{
loadAll();
String source = "EidanSp/dota";
boolean findTopics = true;
long curTime = System.currentTimeMillis();
long refreshRate = 300000; // 300k ms is 5 minutes
DotaBot bot = new DotaBot();
connect(bot);
//TwitterClient client = new... | 8 |
private RGB[][] getBlockFromRef(int x, int y)
{
RGB[][] t = new RGB[16][16];
for(int i = 0; i < 16; i++)
for(int j = 0; j < 16; j++)
t[i][j] = new RGB(0,0,0);
for(int yy = 0; yy < 16; yy++)
{
for(int xx = 0; xx < 16; xx++)
{
int[] rgb = new int[3];
rfr.getPixel(x+xx, y+yy, rgb);
t[x... | 4 |
public FeatureCollection add(Feature feature)
{
features.add(feature);
return this;
} | 0 |
private boolean clickInteractiveObject(int hash, int y, int x) {
int objectId = hash >> 14 & 0x7fff;
int config = worldController.getConfig(hash, x, y, plane);
if (config == -1)
return false;
int type = config & 0x1f;
int rotation = config >> 6 & 3;
if (type == 10 || type == 11 || type == 22) {
GameOb... | 7 |
boolean handleOldJvm10Event(Event e) {
int x = e.x, y = e.y, modifiers = e.modifiers;
long time = e.when;
modifiers = applyLeftMouse(modifiers);
switch (e.id) {
case Event.MOUSE_DOWN:
xWhenPressed = x; yWhenPressed = y; modifiersWhenPressed10 = modifiers;
mousePressed(time, x, y, modifie... | 9 |
public boolean equals(Object object) {
try {
ProductionComparator c = (ProductionComparator) object;
return c.start.equals(start);
} catch (ClassCastException e) {
return false;
}
} | 1 |
public void setQuality(Fleet fleet) {
for (int x = 0; x < size; x++) {
for (int y = 0; y < size; y++) {
if (!board[x][y].isHit()) {
int quality = 0;
int horLeft = countNoHitFields(x, y, Directions.LEFT);
int horRight = countNoHitFields(x, y, Directions.RIGHT);
int verDown = countNoHitFields... | 8 |
public static StraightPathOptions swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue =... | 5 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Row)) return false;
Row row = (Row) o;
if (employeeID != row.employeeID) return false;
if (department != null ? !department.equals(row.department) : row.depart... | 7 |
private static void roberts() {
ImageData imageData = original.getImageData();
int[][] ttt = new int[3][3];
ttt[0][0] = 0;
ttt[0][1] = -1;
ttt[0][2] = 0;
ttt[1][0] = -1;
ttt[1][1] = 0;
ttt[1][2] = 1;
ttt[2][0] = 0;
ttt[2][1] = 1;
ttt[2][2] = 0;
int[][] sobelV = new int[3][3];
sobel... | 8 |
public boolean run(){
serverSocket = null;
logger.logMessage("Starting Server...");
while(true){
try {
serverSocket = new ServerSocket(port);
}
catch (IOException e) {
logger.logMessage(Level.SEVERE,"Could not listen on port: " + port,e);
System.exit(-1);
}
logger.logMes... | 3 |
public Resource getNearestResource(Tile tile, Dude dude) {
int x = tile.getX();
int y = tile.getY();
int bestSquaredDistance = Integer.MAX_VALUE;
Resource bestResource = null;
for (Resource r : resources) {
if (!dude.canMine(r))
continue;
Tile restile = getTile(r.getX(), r.getY());
if (restile.... | 7 |
public Node(int value) {
this.value = value;
this.nodeCnt=1;
} | 0 |
@SuppressWarnings("CallToThreadDumpStack")
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
if(emp != null && !emp.isVisible()){
lPane.remove(emp);
emp = null;
}
if (emp == null) {
emp = new Fr... | 4 |
@Override
public void setConnectionValues(GoogleDocs googleDocs, ConnectionValues values)
{
MetadataEntry entry = null;
try
{
entry = this.getUserMetadata(googleDocs);
}
catch (ServiceException error)
{
throw new ApiException(ServiceExcepti... | 2 |
private void drawEast(Terrain[][] currentBoard,
Entities[][] currentObjects, Graphics g) {
//Starts getting a little trickier here. You have to flip the j and i for x, y, while
//j corresponds to the inverse position in the arrays! *Whew* So much math!
Location playerDir = boardState.getPlayerCoords();
for (... | 6 |
public boolean equals(Object object) {
if (object instanceof Guid &&
this.guid.equals(((Guid) object).guid)) {
return true;
}
else
return false;
} | 2 |
public double[] nextDoubleArray() throws Exception {
String[] line = reader.readLine().trim().split(" ");
double[] out = new double[line.length];
for (int i = 0; i < line.length; i++) {
out[i] = Double.valueOf(line[i]);
}
return out;
} | 1 |
@Override
public void run() {
while(true){
try {
// Create input and output streams for this client.
ObjectInputStream is = new ObjectInputStream(clientSocket.getInputStream());
while (true) {
... | 6 |
public double[] run(double[] pixels) {
for (int i = 0; i < pixels.length; i++) {
input[i].setOutput(pixels[i]);
}
for (SigmoidNeuron neuron : hidden) {
neuron.update();
}
for (SigmoidNeuron neuron : output) {
neuron.update();
}
double[] results = new double[output.length];
for (int i = 0; i < o... | 4 |
public String GenerateMsgID(){
return this.Emsnum+DateUtil.GetTimeString() + getFourNum();
} | 0 |
final public int compareTo(Object rhs)
{
int rtn;
TaFuncSignature that = (TaFuncSignature) rhs;
if ((rtn = name.compareTo(that.name)) != 0)
{
return rtn;
} else
{
if (inVarTypes.length != that.inVarTypes.length)
{
return inVarTypes.length - t... | 4 |
public void onScannedRobot(ScannedRobotEvent event) {
// If we currently have no target, target the scanned robot
if (Observer.TARGET == null) {
Observer.TARGET = event.getName();
}
} | 1 |
public static boolean esSolucionable(int[] estado){
int sum = 0;
int[] posiciones = new int[16];
for (int i = 0; i < estado.length; i++)
if (estado[i] != 0) posiciones[(estado[i]) - 1] = i + 1;
else posiciones[15] = i + 1;
for (int i = 0; i < estado.length; i++) {
if (estado[i] == 0)
if (((i/4) +... | 9 |
@Override
public Iterator<Map.Entry<byte[], byte[]>> iterator(){
return new Iterator<Map.Entry<byte[],byte[]>>() {
BucketView nextBucket = new BucketView(0),
prevBucket = null;
int nextIdx = 0, nextSubIdx = -1, prevSubIdx = -1;
{
advance();
}
private void advance(){
prevSubIdx = ... | 7 |
@Override
public int hashCode() {
int hash = 3;
hash = 97 * hash + (this.number != null ? this.number.hashCode() : 0);
return hash;
} | 1 |
public static Player playerMatch(String name)
{
Player[] online = iConomy.getBukkitServer().getOnlinePlayers();
Player lastPlayer = null;
for (Player player : online) {
String playerName = player.getName();
if (playerName.equalsIgnoreCase(name)) {
lastPlayer = player;
break;
... | 4 |
public Set<String> getPermissions() {
return this.permissions;
} | 0 |
@Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length != 1) {
return false;
}
GameSession session = plugin.getGameManager().getGameSession(args[0]);
if (session == null) {
sender.sendMessage(plugin.getBroadcaster().styleMessage(
"... | 5 |
public Usuario logar(Usuario usuario) {
try {
for (Usuario user : usuarioDao.listarTodosUsuarios()) {
if (usuario.getUsername().toUpperCase().equals(user.getUsername().toUpperCase())
&& usuario.getSenha().equals(user.getSenha())) {
return user;
}
}
} catch (ValidationException e) {
thro... | 4 |
public Board(List<Player> players){
//Add warps.
study.setWarp(new int[]{0,3}, kitchen);
kitchen.setWarp(new int[]{18,23}, study);
conservatory.setWarp(new int[]{1,19}, lounge);
lounge.setWarp(new int[]{23,5}, conservatory);
//Each room is composed of rectangles declared above. Add each square in each rec... | 7 |
public static void main(String[] args)
{
MycomplexLayout mycomplexLayout = new MycomplexLayout();
mycomplexLayout.go();
} | 0 |
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
{
UserManager UM = new UserManager(ds);
String path = req.getRequestURI();
String[] pathComponents = path.split("/");
ArrayList<UserDetails> userList = new ArrayList<UserDetails>();
boolean querySucce... | 8 |
public void loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters)
throws KettleXMLException {
try {
inputField = XMLHandler.getTagValue(stepnode, "INPUT_FIELD");
Node classpathNode = XMLHandler.getSubNode(stepnode, "CLASSPATH");
if (classpathNode != null) {
int nrfields... | 5 |
private void resizeText() {
value.setFont(Font.font("Open Sans", FontWeight.BOLD, size * 0.145));
if (value.getLayoutBounds().getWidth() > 0.38 * size) {
double decrement = 0d;
while (value.getLayoutBounds().getWidth() > 0.38 * size && value.getFont().getSize() > 0) {
... | 7 |
private void storeStats()
/*
* The statistics: - the summed periods for all the iterations in this
* interval (period is the amount of time a single frame iteration should
* take), the actual elapsed time in this interval, the error between these
* two numbers;
*
* - the total frame count, which is the to... | 4 |
public void loadList(String fileName) {
String line;
BufferedReader inFile = null;
HiddenMarkovModel hmm=new HiddenMarkovModel(myModel);
try {
InputStream in = new FileInputStream(fileName);
InputStreamReader reader = new InputStreamReader(in, "UTF-8");
inFile = new BufferedRea... | 4 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Funcionario other = (Funcionario) obj;
if (!Objects.equals(this.Expedientenome, other.Expedientenome)) {
... | 7 |
public static void main(String[] args) {
Bakery bakeryCtrl = new Bakery(Inventory.emptyInventory(),
CustomerRoll.emptyRoll(), OrderList.emptyOrder());
/**********************************************************************
* Gather user input to load the Scanners for inventory/cust... | 9 |
@Override
public byte[] convert() {
ByteBuffer inBuf = ByteBuffer.wrap(data);
inBuf.order(ByteOrder.BIG_ENDIAN);
inBuf.clear();
ByteBuffer dataBuf = ByteBuffer.allocate(data.length * 2);
dataBuf.order(ByteOrder.BIG_ENDIAN);
dataBuf.clear();
while (inBuf.hasR... | 4 |
public int getRowCount() {
boolean isSummary = getUnitData().isSummary();
int rows = 0;
if (workingProfessionals.getColonists() > 0) rows++;
if (workingAmateurs > 0) rows++;
if (!isSummary && otherWorkingAmateurs.getColonists() > 0) rows++;
if (te... | 9 |
public void put(String key, Object value) {
symbols.put(key, new Binder(value, top, symbols.get(key)));
top = key;
} | 0 |
public void anst(double AusgWert){
String zahl=String.valueOf(AusgWert)+" ";
if (zahl.contains("-")&&zahl.contains("."))
zahl=zahl.substring(0,10);
else if (zahl.contains("-")||zahl.contains("."))
zahl=zahl.substring(0,9);
else zahl=zahl.substring(0,8);
System.out.println(zahl);
seg.... | 9 |
private void printFinalPath(){
System.out.println();
int [][] tempMap = new int [25][50];
for (int i = 0; i < path.size(); i++){
Node temp = path.get (i);
tempMap[temp.getY()][temp.getX()] = temp.getStartCost();
}
tempMap[endY][endX] = -1;
... | 4 |
public void addRelic(Relic relic) {
if (!getRelics().contains(relic)) {
getRelics().add(relic);
}
} | 1 |
public boolean isCellEditable(int row, int column) {
return false;
} | 0 |
public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader( new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int tc = 1;
for (String line ; (line = in.readLine()) != null ; tc++) {
StringTokenizer st = new StringTokenizer(line);
int A = Integ... | 7 |
public void cleanUpForQuit() {
Signlink.reporterror = false;
try {
if (socketStream != null) {
socketStream.close();
}
} catch (Exception exception) {
}
socketStream = null;
stopMidi();
if (mouseRecorder != null) {
... | 3 |
public void run()
{
//deserialize data and check the validity of message
DHTMessage received = null;
try
{
received = deserialize(packet.getData());
}
catch(IOException ioe)
{
System.err.println("Error in data deserialization");
return;
}
catch(ClassNotFoundException cnfe)
{
System.err.... | 4 |
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 int parsePositiveInt(String str) {
if (str == null || (str = str.trim()).length() == 0) {
return 0;
}
int result;
try {
result = Integer.parseInt(str);
} catch (NumberFormatException ex) {
return 0;
}
return (resu... | 4 |
public String processInputDisconnect() throws IOException
{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(isr);
String inputLine = br.readLine();
String[] part = inputLine.split(" ");
switch(Integer.decode(part[0]))
{
case 1:
return loginBis();
... | 4 |
@Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
calculateEnabledState((OutlinerDocument) e.getDocument());
} | 0 |
private void actionPlay( )
{
DefaultMutableTreeNode
selNd = getSelectedNode();
if ( selNd != null )
{
int[] selIdxs = getNodeIndexList(selNd);
if ( selIdxs.length == 2 )
{
try
{
Clip clip = AudioSystem.getClip();
clip.open(
AudioVector.toAudioInputStream(
audioVectors.get(selIdxs[0])... | 3 |
@Override
public void execute(P plugin, CommandHandler<P> handler, CommandSender sender, String label, String[] parameters) {
int page = 1;
if (parameters.length == 1) {
String input = parameters[0];
try {
page = Integer.parseInt(input);
} catch (NumberFormatException exception) {
plugin.d... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
NameData nd = (NameData) obj;
boolean ... | 7 |
@Override
public void updatePhysics() {
super.updatePhysics();
clock++;
if(clock%(2*30) == 0) {
vx = - vx;
updateStateBasedOnVelocity();
}
} | 1 |
public void bounce(Direction d) {
if (d == null) return;
switch (d) {
case UP: v_y = Math.abs(v_y); break;
case DOWN: v_y = -Math.abs(v_y); break;
case LEFT: v_x = Math.abs(v_x); break;
case RIGHT: v_x = -Math.abs(v_x); break;
}
} | 5 |
public Iterator<Integer> calculateLosingScores(int numberOfTurns){
int numberOfScores = (numberOfTurns%2==0)? ((numberOfTurns/2)-1):(numberOfTurns/2);
ArrayList<Integer> scores = new ArrayList<Integer>();
int multiplier = -1;
return scores.iterator();
} | 1 |
public static UnitValue[] parseInsets(String s, boolean acceptPanel) {
if (s.length() == 0 || s.equals("dialog") || s.equals("panel")) {
if (acceptPanel == false) {
throw new IllegalAccessError("Insets now allowed: " + s + "\n");
}
boolean isPanel = s.startsWi... | 9 |
private void drawCoordinateStroke(int x0, int y0, int x1, int y1)
{
for(int x = x0; x <= x1; x++)
{
for(int y = y0; y <= y1; y++)
{
if(x < width && x > 0 && y < height && y > 0)
{
image.setRGB(x, y, Color.black.getRGB());
... | 6 |
@Test
public void test_DivisionByZero() throws DivideByZeroException {
exception.expect(DivideByZeroException.class);
simpleObject.divide(1,0);
} | 0 |
private static PixImage buffer2PixImage(BufferedImage bImage) {
PixImage pImage = new PixImage(bImage.getWidth(), bImage.getHeight());
for (int x = 0; x < bImage.getWidth(); x++) {
for (int y = 0; y < bImage.getHeight(); y++) {
Color color = new Color(bImage.getRGB(x, y));
pImage.setPixel(x, y, (short) c... | 2 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
TEXT = atts.getValue(A_TEXT);
setEnabled(false);
addActionListener(this);
Outliner.documents.addUndoQueueListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} | 0 |
public static LogoDocument fromFile(File file)
throws IOException{
BufferedReader reader = new BufferedReader(new FileReader(file));
LogoDocument document = new LogoDocument();
for (String line = reader.readLine(); line != null;line = reader.readLine()){
try {
document.insertString(document.getLength(... | 2 |
@Override
protected void buildActions() {
super.buildActions();
btnAddNew.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
clickSaveButton();
setPanelPerson(null, true);
}
});
btnGenID.addActionListener(new ActionListener() {
@Overr... | 2 |
private static void addStudentToTable() {
String lName = new String();
String fName = new String();
lName = JOptionPane
.showInputDialog("Please enter the last name of the student to add.");
fName = JOptionPane.showInputDialog("Now enter his/her first name.");
int indexOfStu = studentExists(lName, fName... | 3 |
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
throw new IllegalStateException ();
nsSupport.reset();
if (uris)
nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
parser.setEntityResolver(entityResolver);
}
if (dtdHandler !... | 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 static String hits2str(ScoreDoc[] hits1, ScoreDoc[] hits2, int start, int end) throws IOException {
StringBuilder sb = new StringBuilder();
int len1=hits1==null ? 0 : hits1.length;
int len2=hits2==null ? 0 : hits2.length;
if (end<=0) {
end = Math.max(len1,len2);
}
sb.append("Hits... | 6 |
final boolean method784(byte b, Interface17 interface17) {
if (b <= 75) {
aByteArray1057 = null;
}
anInt1073++;
int i;
if ((anInt1091 ^ 0xffffffff) == 0) {
if (anInt1069 == -1) {
return true;
}
i = interface17.method64(anInt1069, (byte) -42);
} else {
i = interface17.method65(anInt1091, -... | 9 |
@Override
public String toString(){
return "Hero : " + hero.toString() + "\n"+
"Weapon : " + weaponSlot.toString() + "\n"+
"head armor : " + headArmorSlot.toString() + "\n" +
"Body armor : " + bodyArmorSlot.toString() + "\n";
} | 0 |
public BreadthFirstSearch(Graph graph) {
this.graph = graph;
this.adjacency = graph.getAdjacencyList();
this.vertices = graph.getVertices();
this.edges = graph.getEdges();
} | 0 |
protected void invalidate()
{
for(ComponentListener cl: componentListeners)
cl.onComponentInvalidated(this);
if(parent != null && parent instanceof AbstractContainer) {
((AbstractContainer)parent).invalidate();
}
} | 3 |
private static int partition(int[] arr, int left, int right) {
int pivot = arr[left];
while(left < right) {
while(left < right && arr[right] >= pivot)
right --;
swap(arr, left, right);
while(left < right && arr[left] <= pivot)
left ++;
swap(arr, left, right);
}
return right;
} | 5 |
private void readLuminance() {
int type = sourceImage.getType();
if (type == BufferedImage.TYPE_INT_RGB || type == BufferedImage.TYPE_INT_ARGB) {
int[] pixels = (int[]) sourceImage.getData().getDataElements(0, 0, width, height, null);
for (int i = 0; i < picsize; i++) {
int p = pixels[i];
int r = (p &... | 9 |
public ProposedApproach(File uniFile, File triFile)
throws IOException, ProcessException
{
// Load unigram data.
Unigram.Data unigramData = Unigram.read(WordrtPreproc.BINARY, new File[] {uniFile});
idMap = unigramData.unigramIDMap;
freqs = unigramData.unigramCount;
... | 9 |
public int func_27297_a(StatCrafting var1, StatCrafting var2) {
int var3 = var1.func_25072_b();
int var4 = var2.func_25072_b();
StatBase var5 = null;
StatBase var6 = null;
if(this.slotStatsBlockGUI.field_27271_e == 2) {
var5 = StatList.mineBlockStatArray[var3];
var6 = Sta... | 8 |
public void events(int xLoc, int yLoc) {
boolean auto = false;
boolean special = false;
if (xLoc == 11 && yLoc == 3) {
auto = true;
msg = new String[] { "There is something suspicious going on...",
"the other bed hasnt been made", "but noone is in it!" };
//special = true;
}
// if (xLoc == 1 &&... | 9 |
private RGBColor parseHexColor(String colorStr) throws JTMXParseException {
long value = 0;
boolean fail = false;
try {
value = Long.parseLong(colorStr, 16);
} catch (NumberFormatException e) {
fail = true;
}
if (value < 0 || value > 0xFFFFFF) {
fail = true;
}
if (fail) throw new JTMXParseExcep... | 4 |
public ClassOptionSelectionPanel(Class<?> requiredType,
String initialCLIString, String nullString) {
// Class<?>[] classesFound = AutoClassDiscovery.findClassesOfType("moa",
// requiredType);
Class<?>[] classesFound = findSuitableClasses(requiredType);
... | 8 |
private void addSave(Customer customer){
ArrayList<Customer> customers = new ArrayList<>();
try
{
FileInputStream fis = new FileInputStream("customerfile");
ObjectInputStream ois = new ObjectInputStream(fis);
customers = (ArrayList) ois.readObject();
... | 4 |
@Override
public ServerModel finishTurn(FinishTurnRequest request, CookieParams cookie) {
ServerModel serverGameModel = serverModels.get(cookie.getGameID());
int owner=request.getPlayerIndex();
Player player = serverGameModel.getPlayers().get(owner);
DevCards newCards=player.getNewDevCards();
DevCards old... | 4 |
@Override
public void keyTyped(KeyEvent event) {
if (!VALID_INPUTS.contains(event.getKeyChar())) {
event.consume();
Toolkit.getDefaultToolkit().beep();
}
} | 1 |
public void setWireframe(Wireframe wireframe){
if(wireframe != null){
this.wireframe = null;
nameTextBox.setText(wireframe.getName());
multilineTextEntry.setText(wireframe.getName());
if(wireframe.getTypeOfWireframe().equals("Label")){
sizeLabel.... | 8 |
public void updateSubTypes() {
if (!isVoid()) {
subExpressions[0].setType(type);
subExpressions[1].setType(Type.tSubType(type));
}
} | 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 |
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (value == null) {
return null;
}
try {
if (value != null && (value.equals("-") || value.equals(""))) {
value = "-1";
}
Colaborad... | 5 |
private int zeroExplore(int startPostion, int depth, int dicrection, int lastFoundPlayer, LongBoard state) {
if(depth == 0) {
return lastFoundPlayer;
}
long mask = 1l <<(startPostion + dicrection);
if((state.boards[0] & mask) != 0) {
if(la... | 7 |
private Object readJSON() throws JSONException {
switch (read(3)) {
case zipObject:
return readObject();
case zipArrayString:
return readArray(true);
case zipArrayValue:
return readArray(false);
case zipEmptyObject:
return new JSONO... | 7 |
public void setInitialPaths(ArrayList<Plane> planes, LocationList[] allPlaneLocs) {
//looks for straight-line path to each destination; assumes simultaneous start times
for(int i = 0; i < planes.size(); i++) {
allPlaneLocs[i] = new LocationList();
double distance = allPlaneLocs[i].flighttime;
allPlan... | 8 |
@Override
public void actionAuCombat(APersonnage persoPrincipal, APersonnage adversaire)
{
// Afin d'éviter des combats infinis si le personnage se soigne tout le temps,
// fait en sorte que la probabilité que
// personnage se soigne est de 2/3, et 1/3 il attaquera à la place
Ran... | 7 |
public int retrieveId(String mess) {
try {
JSONObject obj = new JSONObject(mess);
return obj.getInt("PacketID");
} catch (JSONException e) {
}
return 0;
} | 1 |
public static final boolean Remove(Inventory inventory, ItemStack item) {
ItemStack[] stacks = inventory.getContents();
for (int i = 0; i < stacks.length; i++) {
ItemStack s = stacks[i];
if (s == null)
continue;
if (s.getTypeId() == item.getTypeId()
... | 6 |
public boolean isMatch(String s, String p) {
// Start typing your Java solution below
// DO NOT write main() function
if (p.length() == 0)
return (s.length() == 0);
if (p.charAt(0) != '*')
if (s.length() > 0
&& (p.charAt(0) == '?' || s.charAt(0) == p.charAt(0)))
return isMatch(s.substring(1), p.... | 9 |
public boolean getScrollableTracksViewportHeight() {
return getPreferredSize().height < getParent().getSize().height;
} | 0 |
private void listaDeCamposRegistro() {
System.out.println("ENTROU3");
int contadorR = 0;
if (tipoDoToken[1].equals(" }")) {
for (int i = 0; i < listaDeBlocos.size(); i++) {
String nomeRegistroC = listaDeBlocos.get(i).split("~")[1];
System.out.println("... | 5 |
@EventHandler(priority=EventPriority.HIGH, ignoreCancelled=true)
public void onPlace(BlockPlaceEvent event)
{
if(!event.getBlock().getWorld().getName().equals(p.getWorld())) return;
Player player = event.getPlayer();
Location loc = event.getBlock().getLocation();
Chunk c = loc.ge... | 7 |
public byte[] intEnBytes(int[] intable){
byte[] aRetourner=new byte[intable.length/8];
int curseurInt = 0;
byte tmp = 0;
for(int curseurOctet = 0;curseurOctet<aRetourner.length;curseurOctet++){
for(int curseurBits=0;curseurBits<8;curseurBits++){
tmp = (byte) (tmp + (byte) (intable[curseurInt]*Mat... | 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.