text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void checkLangYAML() {
File lang = new File(path + "lang.yml");
if(!lang.exists()) {
try {
lang.createNewFile();
FileConfiguration l = YamlConfiguration.loadConfiguration(lang);
l.set("Channel.Same", "&4You are already on that channel!");
l.set("Channel.Switch", "&7You have switch t... | 2 |
public void updatePosition() {
if (xPos < xDestination)
xPos++;
else if (xPos > xDestination)
xPos--;
if (yPos < yDestination)
yPos++;
else if (yPos > yDestination)
yPos--;
if (xPos == xDestination && yPos == yDestination) {
... | 7 |
public SignedInfoType createSignedInfoType() {
return new SignedInfoType();
} | 0 |
@Override
public void run() {
Loader loader = new Loader();
try {
loader.setUrl(url);
loader.load();
} catch (Exception e) {
e.printStackTrace();
}
} | 1 |
@Override
public void run() {
if (Updater.this.url != null) {
// Obtain the results of the project's file feed
if (Updater.this.read()) {
if (Updater.this.versionCheck(Updater.this.versionName)) {
if ((Updater.this.versionLi... | 6 |
public void permutation2( int[][] board ){
int n_permutation = 2 * DIGITS;
int perm = g.nextInt(n_permutation);
System.out.println( perm );
boolean horz_perm = (perm >= DIGITS);
perm %= DIGITS;
int group = perm / SQRT_DIGITS;
perm %= SQRT_DIGITS;
int x=0, ... | 6 |
@Basic
@Column(name = "hora")
public int getHora() {
return hora;
} | 0 |
public void initRoute()
{
route = new Point[getHeight()][];
for (int i=0; i<getHeight(); ++i) {
route[i] = new Point[getWidth()];
}
} | 1 |
public List<Place> findPath(Location sourceLoc, Location destinationLoc,
List<Place> lstplaces, float time, float budget) {
AssignTimeAndCost(lstplaces);
CreateGraph(sourceLoc, destinationLoc, lstplaces);
Vertex v=null;
while (!vertexQueue.isEmpty()) {
v = vertexQueue.poll();
for(Edge edge:v.getAdjacen... | 8 |
protected boolean connect(String path,String addr,int port,String username,String password ){
boolean result=false;
ftp=new FTPClient();
int reply;
try {
ftp.connect(addr, port);
ftp.login(username, password);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) { ... | 3 |
private Face connectHalfEdges (
HalfEdge hedgePrev, HalfEdge hedge)
{
Face discardedFace = null;
if (hedgePrev.oppositeFace() == hedge.oppositeFace())
{ // then there is a redundant edge that we can get rid off
Face oppFace = hedge.oppositeFace();
HalfEdge hedgeOpp;
if (hedgeP... | 4 |
public boolean ok(String[] board,int row, int col,int n){
for(int i =0 ; i < row; i++){
// 确保列上不会重复
if(board[i].charAt(col) == 'Q')
return false;
// 确保对角线不会重复
int temp = col - row +i;
if(temp >=0 && board[i].charAt(temp) == 'Q')
... | 6 |
private void searchForBiggest(){
//Postcondition: this.width and this.height are set and an array of two
// ints which contains biggestHeight and biggestWidth
// Unnecessary, but don't have time to change
String tmp[];
this.height = 0;
this.width = 0;
for(int i = 0;i < repeated.length; i+... | 5 |
private void updateCityChecksSelected() {
for (int i = 0; i < 18; i++) {
checkboxes[i].setSelected(false);
}
for (int i = 3; i < 7; i++) {
int population = gamestate.getPlayer(gamestate.getCurrentPlayer())
.getCity(i).currentPopulation();
for (int j = 0; j < population; j++) {
switch (i) {
... | 7 |
@Override
public Point[] getPath(int x1, int y1, int x2, int y2) {
startX = x1;
startY = y1;
finishX = x2;
finishY = y2;
/* here we add points, which are already marked with wave
* to spread next front of wave from them too*/
//points.add(Panel.tiles[x1][y1]... | 2 |
public SearchPerson() {
setModal(true);
setIconImage(Toolkit.getDefaultToolkit().getImage(SearchPerson.class.getResource("/InterfazGrafica/Images/Search.png")));
setTitle("BUSQUEDA");
setBounds(100, 100, 450, 210);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, ... | 7 |
public static boolean isPermutation(String a, String b) {
if(a == null || b == null)
return false;
if(a.length() != b.length() )
return false;
HashMap<Character,Integer> letters = new HashMap<Character, Integer>();
for(int i = 0; i< a.length(); i++ ) {
char c = a.charAt(i);
if(letters.conta... | 8 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
// Draw the "Difficulty" text.
g.drawImage(difficultyText, 170, 0);
// Draw the difficulties, and highlight the selected one.
if(Settings.difficulty != 1){g.drawImage(easyButton, 210, 100);}
else{g.drawImage(easyButto... | 4 |
private String indexToString(int i){
switch (i){
case 0: return "Book";
case 1: return "BookCopy";
case 2: return "Borrower";
case 3: return "BorrowerType";
case 4: return "Borrowing";
case 5: return "Fine";
case 6: return "HasAuthor";
case 7: return "HasSubject";
case 8: return "HoldRequest";
def... | 9 |
public void testStaticQueryInvalidSourceText1() {
String goal = "bad goal";
try {
Query.hasSolution(goal); // should throw exception
fail(goal + " (bad syntax) succeeded"); // shouldn't get to here
} catch (org.jpl7.PrologException e) { // expected exception
if (e.term().hasFunctor("error", 2) && e.term(... | 5 |
@Override
public String toString() {
String tyyppi = "E ";
if (this.tyyppi == EsteenTyyppi.ESTE) {
tyyppi = "E ";
} else if (this.tyyppi == EsteenTyyppi.KUOLO) {
tyyppi = "K ";
} else if (this.tyyppi == EsteenTyyppi.MAALI) {
tyyppi = "M ";
... | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WashingMachine other = (WashingMachine) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.nam... | 7 |
public static void sendData(SelectionKey key, Object dataObj) {
byte[] data = null;
byte[] lengthPacket = null;
try {
//serialize the data to be sent
data = NetworkPacketManager.serialize(dataObj);
//compute the length of the package
lengthPacket = NetworkPacketManager.packetLength(data);
... | 3 |
public static void main(String[] args) {
TicTacToe game = new TicTacToe();
System.out.println("Welcome to TicTacToe!\n");
game.setMark(5);
game.newBoard();
while (!game.isQuitGame()) {
System.out.println("\nWhat do you want to do?");
System.out.println... | 8 |
@Override
void doRotate(int lo, int mid, int hi) {
final int len1 = mid - lo;
final int len2 = hi - mid;
if (len1 == len2) {
while (mid < hi) {
swap(lo++, mid++);
}
} else if (len2 < len1 && len2 <= maxTempSlots) {
save(mid, len2);
for (int i = lo + len1 - 1, j = hi - 1... | 9 |
private void saveExpression()
{
switch(Equation.getSelectedIndex()+1)
{
case 1:
fx=getExpression();
break;
case 2:
gx=getExpression();
break;
case 3:
ax=getExpression();
... | 7 |
@SuppressWarnings("nls")
public static final Point toPoint(String encoded) throws NumberFormatException {
if (encoded == null) {
throw new NumberFormatException("Not a point");
}
String[] parts = encoded.split(",", 2);
if (parts.length != 2) {
throw new NumberFormatException("Not a point");
}
return ... | 2 |
public void move(){
super.move();
x = parent.x - Math.cos(-offset)*radius;
y = parent.y + Math.sin(offset)*radius;
offset += 1;
// removing if out of range
if(x <= -32 || y <= -32 || x-32 >= game.pfWidth() || y-32 >= game.pfHeight())
remove();
// die if parent died
if(!parent.isAlive()){
... | 5 |
public static void pagar(Cliente cli, Integer horaSaida){
Integer totalHoras = horaSaida - cli.getHorarioEntrada();
Integer totalAPagar = 0;
if(totalHoras >= 0 || totalHoras <= 2){
totalAPagar += 8;
}
else if(totalHoras > ... | 3 |
void _processDont(int option) throws IOException
{
if (debugoptions)
{
System.err.println("RECEIVED DONT: "
+ TelnetOption.getOption(option));
}
if (__notifhand != null)
{
__notifhand.receivedNegotiation(
TelnetNotificat... | 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 |
public boolean isCharData(int token) {
return (token != '<' && token != '&');
} | 1 |
public int getOffsetByChunk( String chunkID, int startOffset, int endOffset ) {
for (int i = startOffset; i < endOffset; i++) {
try {
wavFile.seek( i );
} catch (IOException e) {
Logger.writeInFile(e.toString());
}
char [ ] charBu... | 5 |
public void spatialLearning(){
if(activeColumns.size()>0){
for(Column c : activeColumns){
if(c.overlap!=0){
for(Synapse s : c.proxSegment.synapses){
if(inputMatrix[s.destCoor[0]][s.destCoor[1]]) s.permanenceInc();
else s.permanenceDec();
}
}
}
}
for(int r=0;r<row;r++){
fo... | 7 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (!plugin.canInteract(player)) {
event.setCancelled(true);
if (message != null)
message.sendMessage(player);
}
} | 2 |
public static ICacheable parse(byte[] data){
StringCache s = new StringCache();
String s1 = new String(data);
s.mContent = s1;
return s;
} | 0 |
private void calculateMultipleArrayGradient
(Color[] loColors, Color[] hiColors) {
//set the flag so we know later it is a non-simple lookup
isSimpleLookup = false;
int rgb1; //2 colors to interpolate
int rgb2;
// These are fixed point 8.16 (start with 0.5)
... | 9 |
private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyTyped
// TODO add your handling code here:
try {
clearPedidos();
clearPedHas();
String sql = "SELECT t2.idpedidos AS id_pedido , t1.nombres AS clientes, t3.nombre AS emplead... | 2 |
public String getVersion() {
return version;
} | 0 |
public static void main(String[] args)
{
fillScanShots();
for(int y = 0; y < sea[0].length; y++)
{
for(int x = 0; x < sea.length; x++)
{
String extraSpaces = "";
if((sea[x][y]+"").length() == 1)
extraSpaces = " ";
System.out.print(sea[x][y]+extraSpaces+" ");
}
System.out.println();
... | 3 |
public void set(float a, float b, float h, float k) {
this.a = a;
this.b = b;
this.h = h;
this.k = k;
} | 0 |
public void run() {
while (true) {
HW.waitClerkButton(id);
mon.clerkFree(id);
}
} | 1 |
public void edit(Periodo periodo) throws NonexistentEntityException, Exception {
EntityManager em = null;
try {
em = getEntityManager();
em.getTransaction().begin();
periodo = em.merge(periodo);
em.getTransaction().commit();
} catch (Exception ex) ... | 5 |
@Override
public String execute() {
if (databaseContext.table != null && databaseContext.getChanges() != 0) {
return Integer.toString(databaseContext.getChanges()) + " unsaved changes";
}
Table old = databaseContext.table;
databaseContext.table = databaseContext.provider... | 3 |
public boolean searchInEnglishTree(String findThis)
{
boolean found = false;
TreeNode currentNodeSearch;
TreeNode previousNodeSearch;
currentNodeSearch = rootEnglish;
previousNodeSearch = rootEnglish;
//while there are nodes in the tree and the node has not been fou... | 6 |
public static void main(String[] args) throws IOException {
// Parse the command line.
String[] manditory_args = { "mode"};
createCommandLineOptions();
CommandLineUtilities.initCommandLineParameters(args, Classify.options, manditory_args);
String mode = CommandLineUtilities.getOptionValue("mode");
String ... | 8 |
private void parse_tag() throws IOException
{
int i_ch = 0;
String _tag = "";
if(state != STATE.ENDHDR)
{
// If last state is not ENDHDR - </DOCHDR>
// set default state to STARTEL while encountering character <
state = STATE.STARTEL;
}
while((i_ch = buffer_rd.read()) != -1)
{
char ch =... | 9 |
private void render()
{
long time1 = System.nanoTime();
BufferStrategy bs = getBufferStrategy();
if (bs == null)
{
createBufferStrategy(2);
bs = getBufferStrategy();
}
if (bs != null)
{
Graphics g = bs.getDrawGraphics();
if (rendering)
renderableObject... | 6 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label,
String[] args) {
if(cmd.getName().equalsIgnoreCase("cheat")) {
if(sender instanceof Player) {
Player p = (Player) sender;
PlayerUtil pu = new PlayerUtil(p);
if(pu.hasPermission("Nostalgia.Command.cheat", PermissionT... | 7 |
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = mapDestRect(destRect,0);
// Hack: derive the source format tag as if it was writing to
// a destinati... | 9 |
public boolean contraintesRespectees(int indicePile1, int indicePile2) {
boolean contraintesRespectees = true;
if(indiceNonValide(indicePile1)) {
System.out.println("[ERREUR] La Pile "+indicePile1+" n'existe pas");
contraintesRespectees = false;
}
else if(indiceNo... | 4 |
public ATMInterface() {
getContentPane().setBackground(Color.LIGHT_GRAY);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(450, 150, 500, 500);
getContentPane().setLayout(null);
setResizable(false);
setFont(new Font("Arial", Font.PLAIN, 15));
JButton btnNum1 = new JButton("1");
btnNum1.set... | 9 |
protected char[] escapeData( char[] chars )
{
StringBuilder sb= new StringBuilder();
for ( int i=0;i<chars.length;i++ )
{
if ( chars[i] == '\\' )
{
sb.append( '\\' );
sb.append( '\\' );
}
else if ( chars[i] == ']' )
{
sb.append( '\\' );
sb.append( ']' );
}
else
sb.append(... | 3 |
private void mainMenu() {
System.out.println("Main menu:");
System.out.println("0. Wait a few days");
System.out.println("1. Send ship to barter");
System.out.println("2. Build a new ship");
System.out.println("3. Send ship out for repair");
System.out.println("4. Send ship out for combat");
System.out.pr... | 5 |
public void keyPressed(KeyEvent e){
int code = e.getKeyCode();
if (code == KeyEvent.VK_RIGHT) {
myPinko.setCurrentDirection(RIGHT);
} else if (code == KeyEvent.VK_LEFT){
myPinko.setCurrentDirection(LEFT);
} else if (code == KeyEvent.VK_UP){
... | 6 |
public int ladderLength(String start, String end, HashSet<String> dict) {
if (start.equals(end) || !dict.contains(start) || !dict.contains(end) || dict.size() < 2) {
return 0;
}
buildNet(start, end, dict);
Queue<Node> q = new LinkedList<Node>();
q.add(startNode);
... | 9 |
public static Schema constructedFromString(String schemaStr)
throws InvalidObjectStringException {
String name;
SortedSet<Dimension> dimensions = new TreeSet<Dimension>();
if (!schemaStr.matches(regex)) {
throw new InvalidObjectStringException("object string(" + schemaStr... | 4 |
int inflate_trees_bits(int[] c, // 19 code lengths
int[] bb, // bits tree desired/actual depth
int[] tb, // bits tree result
int[] hp, // space for trees
ZStream z // for messages
){
int res... | 3 |
public boolean similar(Object other) {
if (!(other instanceof JSONArray)) {
return false;
}
int len = this.length();
if (len != ((JSONArray)other).length()) {
return false;
}
for (int i = 0; i < len; i += 1) {
Object valueThis = this.ge... | 8 |
private void lookForNPCAction() {
Character nearbyCharacter = checkWhoIsNear();
if (nearbyCharacter == null) {
System.out.println();
return;
}
if (nearbyCharacter.getHostile() && nearbyCharacter.getLocation() == player.getLocation()) {
// allows the ch... | 3 |
public void setLibelle(String libelle) {
this.libelle = libelle;
} | 0 |
public byte[] getHash(String file) throws Exception {
MessageDigest md = MessageDigest.getInstance("SHA1");
FileInputStream input_file = new FileInputStream(file);
byte[] data_bytes = new byte[1024];
for (int i = 0; i < data_bytes.length && i < sign_header.length; ++i)
data_b... | 3 |
public void propertyChange(PropertyChangeEvent e) {
String prop = e.getPropertyName();
if (isVisible()
&& (e.getSource() == optionPane)
&& (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY
.equals(prop))) {
Object value = optionPane.getValue();
if (value == JOptionPa... | 9 |
@Override
public boolean setBoots(Wearable boots) throws NoSuchItemException, WrongItemTypeException {
if (boots != null) {
if (boots instanceof Boots) {
if (boots.getLevelRequirement() > level || boots.getStrengthRequirement() > stats[0]
|| boots.getDexterityRequirement() > stats[1] || boots.getMagicRe... | 8 |
private boolean writeToSocket () throws IOException {
SocketChannel socketChannel = this.socketChannel;
if (socketChannel == null) throw new SocketException("Connection is closed.");
ByteBuffer buffer = writeBuffer;
buffer.flip();
while (buffer.hasRemaining()) {
if (bufferPositionFix) {
buffer.compact... | 4 |
@Override
public void mouseDragged(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (Main.modState == ModState.Editing) {
if (selectedPoint != -1) {
Point draggedPoint = getClickedPoint(e);
handlePointMovement(draggedPoint);
}
}
}
} | 3 |
public ajclient(String hn, int port, ajclientdata data, boolean usetrans)
throws IOException, ClassNotFoundException{
hostname = new String(hn);
prt = port;
cdata = data;
soc = new Socket(hostname, prt);
out = new ObjectOutputStream(soc.getOutputStream());
in = new ObjectInputStream(soc.getInputStre... | 1 |
public static double[] getColor(double n, double range) {
//0 to range
n = n % range;
double mag = 255.0/2;
System.out.println(n);
//lightness goes from 0 to 100
//each color then oscillates from -100 to 155
double[] r = new double[3];
//each color offset ... | 2 |
private static void exportTable(Connection connect, List<String> names, String zipName) throws SQLException, FileNotFoundException, IOException {
FileOutputStream fos = null;
ZipOutputStream zos = null;
ZipEntry ze = null;
try {
fos = new FileOutputStream(zi... | 4 |
public static void setHandle(boolean handle)
{
isHandle = handle;
} | 0 |
public int getMax(int npc) {
switch (npc) {
case 2627:
return 4;
case 2630:
return 7;
case 2631:
return 13;
case 2741:
return 28;
case 2743:
return 54;
case 2745:
return 97;
}
return 5;
} | 6 |
private void updateGate(String A, String B, String G, String Y0, String Y1, String Y2, String Y3) throws InvalidPinException {
if (this.isHigh(G)) {
this.resetGate(Y0, Y1, Y2, Y3);
} else {
int count = 0;
if (this.isHigh(B)) {
count += 2;
} else if (this.isHigh(A)) {
count += 1;
}
switch (... | 7 |
@Override
public void run() {
try {
ServerSocket servsock = new ServerSocket(SERVER_PORT);
System.out.printf("ImageListener listening on port %s.\n", SERVER_PORT);
File myFile = new File(IMAGE_FILE);
FileOutputStream fos = null;
BufferedInputStream bis = null;
while (true) {
Socket sock = servs... | 5 |
private void checkScrollBar(AdjustmentEvent e)
{
// The scroll bar listModel contains information needed to determine
// whether the viewport should be repositioned or not.
JScrollBar scrollBar = (JScrollBar)e.getSource();
BoundedRangeModel listModel = scrollBar.getModel();
int value = listModel.getValue(... | 7 |
@Override
public void unInvoke()
{
// undo the affects of this spell
if((affected==null)||(!(affected instanceof MOB))||(recurse))
return;
recurse=true;
final MOB mob=(MOB)affected;
super.unInvoke();
if(canBeUninvoked())
{
if(statue!=null)
statue.destroy();
if((mob.location()!=null)&&(!mob... | 8 |
@Override
public void hello(String name) {
log.debug("Hello " + name);
} | 0 |
public String getSrcTermid() {
return SrcTermid;
} | 0 |
public TriangleDivisionNormalDistributedOrdersGenerator(
int numberOfForerunPeriods, int offSet) {
if (numberOfForerunPeriods < 1 || offSet < 0) throw new IllegalArgumentException();
this.numberOfOrderPeriods = numberOfForerunPeriods;
this.offSet = offSet;
} | 2 |
public final double getAngleChange() {
return angleChange;
} | 0 |
protected void onDeathUpdate()
{
++this.deathTicks;
if (this.deathTicks >= 180 && this.deathTicks <= 200)
{
float var1 = (this.rand.nextFloat() - 0.5F) * 8.0F;
float var2 = (this.rand.nextFloat() - 0.5F) * 4.0F;
float var3 = (this.rand.nextFloat() - 0.5F)... | 8 |
private static int countSlots(Expression[] exprs, int length) {
int slots = 0;
for (int i = 0; i < length; i++)
slots += exprs[i].getType().stackSize();
return slots;
} | 1 |
public List<List<Double>> readData() {
List<List<Double>> data = new ArrayList<List<Double>>();
HSSFSheet sheet = wb.getSheetAt(0);
Iterator<Row> rowIt = sheet.iterator();
if (rowIt.hasNext()) {
rowIt.next(); //skip caption row
}
while (rowIt.hasNext()) {
... | 3 |
public ArrayList<Producao> concatenaProducoes(ProducoesForParser linhaColuna, ProducoesForParser LinhaColunaAnt) throws Exception{
try{
ArrayList<Producao> concatenados = new ArrayList<Producao>();
if(!(linhaColuna.getProducoes().isEmpty()) && !(LinhaColunaAnt.getProducoes().isEmpty())){//Se ninguem for va... | 9 |
private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
// TODO add your handling code here:
String s = (String) listaProfesori.getSelectedValue();
liceu.Administrator admin = new liceu.Administrator();
admin.delUser(s);
... | 5 |
public int getTileHeightMax() {
int maxHeight = tileHeight;
for (TileSet tileset : tileSets) {
int height = tileset.getTileHeight();
if (height > maxHeight) {
maxHeight = height;
}
}
return maxHeight;
} | 2 |
public void renew(){
long deltaTime = System.currentTimeMillis() - lastLoopTime;
this.lastLoopTime = System.currentTimeMillis();
player.move(deltaTime);
} | 0 |
boolean navigateNextAnchor(int direction) {
EditPart focus = getCurrentViewer().getFocusEditPart();
AccessibleAnchorProvider provider;
provider = (AccessibleAnchorProvider) focus
.getAdapter(AccessibleAnchorProvider.class);
if (provider == null)
return false;
List list;
if (isTarget())
list = pro... | 8 |
@Override
public void update(GameContainer gc, double delta) throws SlickException {
AdvGraphics g = Client.getClient().getGC();
Input in = gc.getInput();
double turnspeed = 1.5;
if (in.isKeyDown(Input.KEY_UP)) {
// Accelerate
}
if (in.isKeyDown(Input.KEY_DOWN)) {
// De-Accelerate
}
i... | 9 |
private static void dateAuPlutTot(Tache t){
ArrayList<Tache> dependances = t.getDependances();
Tache max = dependances.get(0);
double tmpMax = max.getDatePlusTot();
for(Tache dependence : dependances){
if(dependence.getDatePlusTard() == -1){
dateAuPlu... | 4 |
private void filterAndSort()
{
// First for each coordinate, get the most probable circle
Map<Coordinate2D, Map.Entry<Integer, MutableFloat>> topRadiusPerCoord = new HashMap<Coordinate2D, Map.Entry<Integer, MutableFloat>>();
{
for(Map.Entry<Coordinate2D, Map<Integer, MutableFloat>> entry : data.entryS... | 6 |
public String toString() {
StringBuffer buf = new StringBuffer("{");
if (values != null) {
for (int i = 0; i < values.length; i++) {
buf.append(values[i].toString());
if (i + 1 < values.length)
buf.append(", ");
}
}
... | 3 |
private void startWritingTxt(String filename) {
try {
fw = new FileWriter(filename);
}
catch (Exception e) {
e.printStackTrace();
}
} | 1 |
public void addVertex(DirectedNode vertex) {
if (!this.vertices.contains(vertex)) {
this.vertices.add(vertex);
}
} | 1 |
void show(final Parameter[] p) {
final XYGrapher graph = new XYGrapher();
graph.addSnapshotListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JComponent c = (JComponent) e.getSource();
Object g = c.getClientProperty("graph");
if (g instanceof XYGrapher) {
model.notifyPa... | 9 |
* @param tile The Tile to draw.
*/
private void displayTileItems(Graphics2D g, Tile tile) {
// ATTENTION: we assume that only overlays and forests
// might be taller than a tile.
if (!tile.isExplored()) {
g.drawImage(lib.getTerrainImage(null, tile.getX(), tile.getY()), 0, 0,... | 9 |
private static RoutingTable createRemoteRT(Host host, Case CASE) throws UnknownHostException {
// the following are stored in the REMOTE host
RoutingTable remoteRT = new RoutingTable();
remoteRT.setLocalhost(host);
if (CASE.compareTo(Case.BOOTSTRAP_1) == 0 || CASE.compareTo(Case.BOOTSTR... | 4 |
public String generateRequestUrl() throws Exception
{
int i = 0;
StringBuilder commandString = new StringBuilder();
commandString.append("apiKey=").append(apiKey);
commandString.append("&").append("command=").append(command);
Map<String, String> paramsLowerCase = new HashMap<String, String>();
paramsLowe... | 3 |
@Override
public void commitTrans() throws Exception {
try {
oConexionMySQL.commit();
} catch (SQLException e) {
throw new Exception("Mysql.commitTrans: Error en commit: " + e.getMessage());
}
} | 1 |
public void printSelf(){
StringBuilder b = new StringBuilder();
//Dangers
b.append("Dangers:\n");
for(Danger d : dangers){
b.append(" "+d.getName()+": ");
for(int i=0;i<10;i++){
if(i<d.getLevel()*10) b.append("*");
else b.append("-");
}
b.append("\n");
}
//Nodes
b.append("Complete:\n... | 8 |
@Override
public boolean absolute(int row) {
ensureOpen("absolute");
if ((row < 1) || (row > rs.size())) {
waitTillProcessingDone();
if (row < 0) {
row = rs.size() + row + 1;
}
}
if (row < 0) {
row = 0;
}
if (row > rs.size()) {
row = rs.size() + 1;
c... | 5 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.