text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void add(String word) {
if (word == null || word.isEmpty())
return;
Node localRoot = root;
for (int i = 0; i < word.length(); i ++) {
Character c = word.charAt(i);
if (localRoot.children.containsKey(c)) {
localRoot = localRoot.children.g... | 4 |
public static void main(String[] args) {
Random random = new Random();
for(int i=1;i<=100;i++){
if(i%10 == 0){
try {
Thread.sleep(random.nextInt(5)*1000);
System.out.println();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.print(i + "\t");
}
} | 3 |
EditDialog(Editable ce, CircuitSimulator f) {
super((Frame)null, "Edit Component", false);
cframe = f;
elm = ce;
setLayout(new EditDialogLayout());
einfos = new EditInfo[10];
noCommaFormat = DecimalFormat.getInstance();
noCommaFormat.setMaximumFractionDigits(10);
... | 6 |
void makeEquiv(final Node node1, final Node node2) {
final Set s1 = equivalent(node1);
final Set s2 = equivalent(node2);
if (s1 != s2) {
s1.addAll(s2);
final Iterator iter = s2.iterator();
while (iter.hasNext()) {
final Node n = (Node) iter.next();
equiv.put(n, s1);
}
}
} | 2 |
public Dispatcher () throws InterruptedException {
workers = new ArrayList<Worker>();
for (int x=0;x<10;x++){
JobImpl1 j = new JobImpl1();
j.id="Job-"+x;
qManager.push("Queue1",j);
}
for (int x=0;x<10;x++){
Worker w1 = new Worker1(qManager,x);
workers.add(w1);
w1.start();
}... | 4 |
public final GalaxyXDefinitionParser.expression_return expression() throws RecognitionException {
GalaxyXDefinitionParser.expression_return retval = new GalaxyXDefinitionParser.expression_return();
retval.start = input.LT(1);
int expression_StartIndex = input.index();
CommonTree root_0 =... | 9 |
public Cabin getCabin(int cabin_id) {
Cabin cabin = new Cabin();
ResultSet rs = null;
try{
statement = connection.createStatement();
String sql = "select * from cabins where cabin_id = " + cabin_id + ";";
rs = statement.executeQuery(sql);
while(rs.next()){
cabin.setName(rs.getString("cabin_name")... | 6 |
@Override
public EventCommentType getTypeByName(final String name) throws WrongTypeNameException {
if (name == null) {
throw new WrongTypeNameException("Type name is empty");
}
switch (name) {
case BEFORE_COMMENT_TYPE_NAME:
case AFTER_COMMENT_TYPE_NAME:
... | 3 |
public boolean verificarMovimientoValido(Operador operador){
char direccion=operador.getDireccion();
int[] coordenada=matriz.retornarCoordenadaDe(matriz.getSortingRobot().getId());
if(coordenada!=null){
//Izquierda
if(direccion=='l'){
... | 9 |
public static String tempban(String muter, String mutedPlayerName, double days){
// Initial message
String regex = RPSystem.chatConfig.getString("format.ban");
int realDays = 0;
// Token replacement
regex = regex.replaceAll("%t", Timestamp.NOW());
regex = regex.replaceAll("%banner", muter);
if(days >= ... | 6 |
public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... | 7 |
public static Colour lightValue(World world) {
final float dayValue = dayValue(world) ;
if (dayValue == 1) return DAY_LIGHT ;
if (dayValue == 0) return NIGHT_LIGHT ;
final Colour a, b ;
final float w ;
if (dayValue > 0.5f) {
a = DAY_LIGHT ;
b = isMorning(world) ? MORNING_LIGHT :... | 5 |
public synchronized int addPlayer(Player player) {
if (game != null && playerCount < players.length) {
player.setSeatNumber(game.addPlayer(player));
players[playerCount++] = player;
addGameListener((GameListener) player.getUser().getGameSocket());
if (playerCount == 1) {
for (GameLawEnforcer game : ga... | 4 |
public String buscarDocumentoPorTipoNumero(String tipo, String numero) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
try{
for (int i = 0; i < dbVentas.size() ; i++){
if (dbVentas.get(i).getTi... | 5 |
public void move(Box toBox) {
if (!(this instanceof gameLogic.Movable)) {
return;
}
if (!getBox().isAdjacentTo(toBox)) {
return;
}
Box oldBox = getBox();
try {
getBox().getChart().place(this, toBox);
} catch (BoxBusyException e) {
return;
// TODO: handle exception
}
// Strea... | 7 |
public void createUnits(int gridXlength, int gridZlength, Grid grid, float gridHeight){
if (side){
lines = 0; // the variable lines is added to check if it's player 1 or player 2 position, if it's player 2 it starts on the other edge of the grid
} else {
lines = gridXlength;
lineStart = lines; // lineS... | 8 |
private void adjustVolume(boolean volumeOn, int volume) {
Signlink.midivol = volume;
if (volumeOn) {
Signlink.midi = "voladjust";
}
} | 1 |
public ActivityManagementWindow(MainWindow mainWindow, Student stu) {
setTitle("Modificar actividades de un alumno");
setResizable(false);
this.mainWindow = mainWindow;
this.student = stu;
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 457, 326);
contentPane = new JPanel();
con... | 2 |
@Override
public void mousePressed(MouseEvent e)
{
try{
double childX =0;
double childY =0;
double parentX=0;
double parentY=0;
double childW=0;
double childH=0;
double parentW=0;
double parentH=0;
Object child = graphComponent.getGraph().getSelectionCell();
Object ... | 8 |
public String addParameter(int position, String parameter){
String lastParameter = IVPValue.NULL;
if(arguments.size() >= position && position != 0){
lastParameter = (String) arguments.get(position);
}
if(arguments.size() <= position && position != 0){
arguments.add(position, parameter);... | 5 |
public Wave35CinnabarGym(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 1700; i++){
if(i < 2000){
if(i % 17 == 0)
add(m.buildMob(MobID.RAPIDASH));
else if(i % 11 == 0)
add(m.buildMob(MobID.NINETALES));
else if(1 % 3 == 0)
add(m.buildMob(MobID.VULPIX));
else if(i ... | 9 |
public static void main(String args[]){
ArrayList<String> lines=new ArrayList();
lines.add("First line");
lines.add("Second line");
lines.add("Third line");
Iterator iter=(Iterator) lines.iterator();
while(iter.hasNext()){
System.out.println(iter.next());
}
Collections.reverse(lines);
i... | 2 |
private void doShowContextMenu(MouseEvent event) {
// grab the item or category under the mouse events point if there is
// there is an item or category under this point.
Object itemOrCategory = getItemOrCategoryUnderPoint(event.getPoint());
// if there was no item under the click, then... | 5 |
private static int printSourceNumber(String source, int offset,
StringBuffer sb)
{
double number = 0.0;
char type = source.charAt(offset);
++offset;
if (type == 'S') {
if (sb != null) {
int ival = source.charAt(offs... | 7 |
public void CaptureBlackPiece(int r1, int c1, int r2, int c2)
{
// Check Valid Capture
assert(Math.abs(r2-r1)==2 && Math.abs(c2-c1)==2);
// Obtain the capture direction
MoveDir dir = r2>r1?(c2>c1?MoveDir.forwardRight:MoveDir.forwardLeft)
:(c2>c1?MoveDir.ba... | 8 |
public void genEnergyType(){
rand = new Random();
energyRoll = (rand.nextInt(5)+1);
if(energyRoll == 1){
energyType = "Acid";
} else if(energyRoll == 2){
energyType = "Cold";
} else if(energyRoll == 3){
energyType = "Fire";
} else if(energyRoll == 4){
energyType = "Electricity";
} else if(e... | 5 |
public static Singleton getInstancia()
{
if (singleton==null)
{
singleton= new Singleton();
}
return singleton;
} | 1 |
public void update()
{
} | 0 |
@Override
public int compare(Invocation c1, Invocation c2) {
MethodCall o1 = c1.getMethodCall();
MethodCall o2 = c2.getMethodCall();
// First compare on names
{
int value = comp(nameMatches(o1), nameMatches(o2));
if (value != 0) {
return value;
}
}
// Compare on method signature
{
int va... | 9 |
private static Long seatClassToLong(Ticket.seatClass sc) {
if (sc == Ticket.seatClass.SEAT_CLASS_ECONOMIC) return 1L;
else if (sc == Ticket.seatClass.SEAT_CLASS_BUSINESS) return 2L;
else if (sc == Ticket.seatClass.SEAT_CLASS_FIRST) return 3L;
else return 1L;
} | 3 |
public static void pprintQuantifiedVariables(Vector variables, boolean includetypesP, org.powerloom.PrintableStringWriter stream) {
if (variables == null) {
return;
}
stream.print("(");
Native.setIntSpecial(OntosaurusUtil.$PPRINT_INDENT$, ((Integer)(OntosaurusUtil.$PPRINT_INDENT$.get())).intValue(... | 8 |
public boolean surLeSol(Body body) {
if (world == null) {
return false;
}
// collision avec le perso est apparu?
CollisionEvent[] evenementCollision = world.getContacts(body);
for (int i = 0; i < evenementCollision.length; i++) {
// si le point de la collision est proche des pieds
if (evenementColl... | 7 |
public JSONArray getJSONArray(String key) throws JSONException {
Object o = get(key);
if (o instanceof JSONArray) {
return (JSONArray)o;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONArray.");
} | 1 |
public boolean metaValid() {
return !(this.title.isEmpty() ||
this.artist.isEmpty() ||
this.creator.isEmpty() ||
this.version.isEmpty() ||
this.source.isEmpty());
} | 4 |
@Override
public void run() {
//System.out.println("Log thread started");
while (!terminated || (strings.size() != 0)) {
if (strings.size() != 0) {
try {
out.write(strings.get(0));
out.newLine();
} catch (IOException... | 5 |
public void changeHairAllFemales() {
createHairListsOutOfWhiteLists();
int counter = 0;
int max = SkyProcStarter.merger.getNPCs().getRecords().size();
for (NPC_ n : SkyProcStarter.merger.getNPCs()) {
counter++;
SPProgressBarPlug.setStatusNumbered(counter, max, "de... | 7 |
@EventHandler
public void onInventoryClick(InventoryClickEvent e){
Player p = (Player) e.getWhoClicked(); // Player who clicked
ItemStack clicked = e.getCurrentItem(); // Item clicked
Inventory inventory = e.getInventory(); // Inventory clicked
// Cosmetics Menu
if (inventory.getName().equals(CosmeticM... | 6 |
@Override
public void run() {
int compteur = 0;
FileReader fr;
try {
fr = new FileReader(new File(Common.DIRRSC + corpus));
BufferedReader br = new BufferedReader(fr);
String line = br.readLine();
while (line != null) {
try {
HashMap<String, Short> tf_doc;
String[] doc = line.split("\... | 8 |
public Object get(Object key) {
processQueue();
SoftReference ref = (SoftReference)hash.get(key);
if (ref != null)
return ref.get();
return null;
} | 1 |
private void initExistingBonus() {
List<BonusQuestion> list = Bonus.getAllQuestions();
GameData g = GameData.getCurrentGame();
setWeekSpinner(Bonus.getMaxWeek(), g.getCurrentWeek());
if (list == null || list.size() == 0) {
return; // nothing to load
}
setQuestionSpinner(1, Bonus.getNumQuestionsI... | 2 |
private void run()
{
long time = 0, lastTime = 0, currentFPSSample = 0, lastFPSTime = 0;
isRunning = true;
while(isRunning)
{
if(Window.isCloseRequested())
isRunning = false;
// Input Stuff
game.input();
if(Input.isKeyPressed(Input.KEY_F1))
screenshot();
Input... | 5 |
@Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if (localName.equalsIgnoreCase("node")) {
inNode = true;
CoastlineNode node = getNodeInformation(attributes);
if (node != null) {
// ... | 9 |
public void renderProjectile(int xp, int yp, Projectile p)
{
xp -= xOffset;
yp -= yOffset;
for(int y = 0; y < p.getSpriteSize(); y++)
{
int ya = y + yp;
for(int x = 0; x < p.getSpriteSize(); x++)
{
int xa = x + xp;
if(xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) { break; ... | 8 |
public boolean isValidPosition(Point p){
if (p.x < 0 || p.x >= width || p.y < 0 || p.y >= height)
return false;
if (map.get(p.y).get(p.x) == BLOCK || map.get(p.y).get(p.x) == START || map.get(p.y).get(p.x) == EXIT)
return false;
return true;
} | 7 |
private Raum waehleNeuenRaum(ServerKontext kontext, Raum raum)
{
// Normaler Weise zwei Felder weiter, es sei denn, im ersten Feld ist
// der Spieler
Raum neuerRaum1 = selectRaumOhneKatze(raum.getAusgaenge());
// Kann sich die Katze nicht bewegen?
if(neuerRaum1 == null)
return raum;
// Katze auf Spiel... | 3 |
public void start() throws IOException {
myServerSocket = new ServerSocket();
myServerSocket.bind((hostname != null) ? new InetSocketAddress(hostname, myPort) : new InetSocketAddress(myPort));
myThread = new Thread(new Runnable() {
@Override
public void run() {
... | 7 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ObjectFields)) {
return false;
}
ObjectFields other = (ObjectFields) object;
if ((this.id == null && other.id !... | 5 |
public void updateSharkHealth(){
if(sharkCanTakeDamage) {
for (int i = 0; i < sharks.size(); i++) {
sharks.get(i).updateHealth();
if (sharks.get(i).getDead() == true) {
killshark = true;
updateScore('a');
bui... | 3 |
public int run()
{
String indexValue = "0";
// Get the index value.
if (register.equalsIgnoreCase("1"))
indexValue = ASCView.getIndex1();
else if (register.equalsIgnoreCase("2"))
indexValue = ASCView.getIndex2();
else if (register.equalsIgnore... | 8 |
public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... | 9 |
public double calculate(Accession a1, Accession a2) {
double value = getMemoizedValue(a1.getId(), a2.getId());
if (value != MISSING_VAL) {
return value;
}
ListIterator<List<Double>> m1Itr = a1.getSSRValues().listIterator();
ListIterator<List<Double>> m2Itr = a2.getSSRValues().listIterator();
double marker... | 7 |
void setStateFromLocalConnState(int localCallState) {
switch (localCallState) {
case 1:
setConnectionState(84, null);
setTermConnState(98, null);
break;
case 2:
setConnectionState(83, null);
setTermConnState(97, null);
break;
case 3:
setConnectionState(88, null);
setTermConnState(98, nul... | 9 |
public AbstractInsnNode[][] findGroups(String regex) {
try {
Matcher regexMatcher = Pattern.compile(processRegex(regex),
Pattern.MULTILINE).matcher(representation);
if (regexMatcher.find()) {
AbstractInsnNode[][] result = new AbstractInsnNode[regexMatcher
.groupCount() + 1][0];
for (int i = 0... | 3 |
public int findMaximum(ArrayList <Employee> employee, int i)
{
int j, max = i;
for(j = i + 1; j < employee.size(); j++)
{
if (employee.get(j).getGrossPay() > employee.get(max).getGrossPay())
max = j;
}
return max;
} | 2 |
public boolean method577(int i) {
if (anIntArray776 == null) {
if (anIntArray773 == null)
return true;
if (i != 10)
return true;
boolean flag1 = true;
for (int k = 0; k < anIntArray773.length; k++)
flag1 &= Model.method463(anIntArray773[k] & 0xffff);
return flag1;
}
for (int j = 0; j <... | 6 |
public static List<Tile> loadMap(String filename) {
ArrayList<String> lines = new ArrayList<String>();
int width = 0;
InputStream is = MapLoader.class.getClassLoader().getResourceAsStream(
filename);
System.out.println(is.toString());
BufferedReader reader = new BufferedReader(new InputStreamReader(is));... | 7 |
private void createRivers() {
for (int i = 0; i < bounds.width / 2; i++) {
Corner c = corners.get(r.nextInt(corners.size()));
if (c.ocean || c.elevation < 0.3 || c.elevation > 0.9) {
continue;
}
// Bias rivers to go west: if (q.downslope.x > q.x) c... | 8 |
public static void cleanAll() {
for (Shit s: shitList) {
s.remove();
}
for (Vomit v: vomitList) {
v.remove();
}
for (ObjEX oex: Food.objEXList) {
if (((Food)oex).isEmpty())
oex.remove();
}
for (Body b: bodyList) {
if (b.isDead())
b.remove();
}
for (ObjEX oex: Stalk.objEXList) {
... | 8 |
public int PosToInt(int x, int y, int z) {
if (x < 0) { return -1; }
if (x >= width) { return -1; }
if (y < 0) { return -1; }
if (y >= height) { return -1; }
if (z < 0) { return -1; }
if (z >= depth) { return -1; }
return x + z * width + y * width * depth;
} | 6 |
private boolean execLoadFeatures(VectorMap queryParam, StringBuffer respBody, DBAccess dbAccess) throws Exception {
boolean success = true;
int clntIdx = queryParam.qpIndexOfKeyNoCase("clnt");
String clientName = (String) queryParam.getVal(clntIdx);
//System.out.println( "clnt = " + clie... | 8 |
public static void write(String outFilePath, int start, int end, String inFilePath) throws Exception
{
HashSet<String> set = new HashSet<String>();
BufferedReader reader = new BufferedReader(new FileReader(new File(inFilePath)));
BufferedWriter writer = new BufferedWriter(new FileWriter(new File( outFilePa... | 6 |
public DwgObject getDwgSuperEntity(DwgObject entity) {
if(entity.hasSubEntityHandle()){
int handleCode = entity.subEntityHandle.getCode();
int offset = entity.subEntityHandle.getOffset();
int handle = -1;
DwgObject object;
switch(handleCode){
// TODO: case 0x2:
// TODO: case 0x3:
case 0x4:
... | 8 |
public void setExecute(boolean execute) {
this.execute = execute;
} | 0 |
private static void connectOption()
throws UnspecifiedErrorException, IOException, InvalidHeaderException {
final Pattern pattern = Pattern.compile("(.+):(\\d+)");
System.out.println(String.format("\n%s > %s >\n" , SHELL_TITLE, Options.CONNECT.getTitle()));
boolean validInput;
Matcher input = null;;
... | 7 |
public DataProcessor(int option) {
// polymorphism
switch (option) {
case 0:
// initialize as a string processor
cp = new StringCompressor();
ep = new StringEncryptor();
break;
case 1:
// initialze as a file processor
cp = new FileCompressor();
ep = new FileEncryptor();
break;
}
} | 2 |
@Override
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
return orientation == SwingConstants.VERTICAL ? visibleRect.height : visibleRect.width;
} | 1 |
public PathManager() {
if (System.getProperty("os.name").equals("Linux")) {
standardPath = "/" + standardPath.substring(0, standardPath.length() - 1);
} else if (System.getProperty("os.name").toLowerCase().equals("mac")) {
standardPath = "/" + standardPath.substring(0, standardPath.length() - 1);
}
} | 2 |
public void testFactory_parseMinutes_String() {
assertEquals(0, Minutes.parseMinutes((String) null).getMinutes());
assertEquals(0, Minutes.parseMinutes("PT0M").getMinutes());
assertEquals(1, Minutes.parseMinutes("PT1M").getMinutes());
assertEquals(-3, Minutes.parseMinutes("PT-3M").getMin... | 2 |
public void setzeMaeuse(int anzahlMaeuse)
{
ArrayList<Raum> kannMausEnthaltenRaum = new ArrayList<Raum>();
for(Raum raum : _connections.keySet())
{
if(raum.getRaumart() != RaumArt.Ende
&& raum.getRaumart() != RaumArt.Start)
kannMausEnthaltenRaum.add(raum);
}
if(kannMausEnthaltenRaum.size() > 0)... | 4 |
final protected boolean dropChild(PropertyTree childMatch) {
boolean found=false;
for(Iterator<PropertyTree> c=children.iterator();c.hasNext();) {
if(c.next() == childMatch) {
c.remove();
}
}
return found;
} | 2 |
public static void readFile(){
File file=new File("monsters.dat");
FileInputStream fin;
ObjectInputStream in;
try {
fin = new FileInputStream(file);
in=new ObjectInputStream(fin);
int numMonsters=in.readInt();
current_id=numMonsters+2;
for(int i=0; i<numMonsters; i++){
Monster m=(Monster... | 4 |
public void damageTile(int hitpoints, AIConnection dealingPlayer){
Debug.highlight(coords.getCompactString(), 255, 0, 0);
if(playerOnTile == null){
return;
}
else {
if(tileType == TileType.SPAWN){
Debug.info("Hit spawn tile, no damage received.");
}
else {
playerOnTile.damagePlayer(hitp... | 2 |
public static boolean azionePossibile(ICard card, List<ICard> tableCards, List<ICard> presa)
{
//Butto una carta e non faccio prese
if(presa.size() == 0)
{
boolean esistePresa = existPresa(card, tableCards);
if(esistePresa){
log("Non puoi usare la carta " + card.getCardStr() + ", una presa e' possibile... | 5 |
public static String getPhotoList(String date, String keyword)
{
DB db = _mongo.getDB(DATABASE_NAME);
DBCollection coll = db.getCollection(COLLECTION_PHOTOSEARCH);
BasicDBObject query = new BasicDBObject();
if (date != null && !date.equals("")) {
query.put("startDate", "" + getYear(dat... | 7 |
private void DFS(List<Integer>[] adjacentVertices,
Integer vertex, List<Integer> currentComponent) {
explored[vertex] = true;
if(currentComponent != null)
currentComponent.add(vertex);
List<Integer> adjacentVertexList = adjacentVertices[vertex];
if(adjac... | 4 |
private void writeName(String uri, String localName, String qualifiedName) throws SAXException {
try {
if (uri == null || uri.length() == 0) {
if (qualifiedName == null || qualifiedName.length() == 0) {
output.write(localName.getBytes("UTF-8"));
} ... | 9 |
public static void main(String[] args) {
BufferedImage bi = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.getGraphics();
g.setColor(new Color(0, 0, 0));
g.fillRect(0, 0, 128, 128);
try {
ImageIO.write(bi, "PNG", new FileOutputStream(new File("terrain.png")))... | 6 |
public static void DividiFileR()
{
RegistraTempo rt = new RegistraTempo();
rt.Start();
try
{
Scanner scanner = new Scanner(System.in);
System.out.println("Divisione file puliti da R");
System.out.println("Sicuro?");
String sel ... | 6 |
public CheckResultMessage checkJ03(int day) {
int r1 = get(17, 2);
int c1 = get(18, 2);
int r2 = get(20, 2);
int c2 = get(21, 2);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r2 ... | 5 |
private void writeObject(String name, Object obj, StringBuffer sb, String prepend) {
if( name != null) {
sb.append(prepend+_json_quote+name+_json_quote+":");
}
if(obj instanceof JSONObject) {
JSONObject o = (JSONObject)obj;
o.pre_serialize();
if( name == null) {
sb.append(prepend);
}
sb.appe... | 8 |
public String getReadableName() {
if ((firstname==null)||(firstname.isEmpty())
|| (lastname==null)||(lastname.isEmpty())) {
return username;
}
return MessageFormat.format("{0} {1}", firstname, lastname);
} | 4 |
@Override
public void innerRun() {
while (true) {
printShell();
String queryString = readQuery();
if (queryString == null || queryString.equals("")) {
continue;
} else if (queryString.equals(QUIT_COMMAND)) {
return;
... | 6 |
@Override
public String toString() {
String ret = String.format("%s - %s", id, name);
if (error != null)
ret += "error: " + error;
return ret;
} | 1 |
private FormData readFormData_wwwFormURLEncoded( String contentType,
HeaderParams headerParams )
throws IOException,
HeaderFormatException,
DataFormatException,
UnsupportedFormatException {
// Retrieve the Content-Length header from the request to determine the number of bytes ex... | 4 |
@Test
public void dequeueTest() {
for (int i = 1; i < 8; i++) {
System.out.println("");
printTime(testArrayDequeDequeue(100000 * (int) Math.pow(2, i)));
printTime(testQueueDequeue(100000 * (int) Math.pow(2, i)));
}
} | 1 |
private void writeJSON(Object value) throws JSONException {
if (JSONObject.NULL.equals(value)) {
write(zipNull, 3);
} else if (Boolean.FALSE.equals(value)) {
write(zipFalse, 3);
} else if (Boolean.TRUE.equals(value)) {
write(zipTrue, 3);
} else {
... | 8 |
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
// 生成公用的随机向量文件
RandomGeneration.randomVector(conf);
FileSystem hdfs = FileSystem.get(conf);
hdfs.delete(outputFolder, true);
hdfs.delete(outputFolder2, true);
// 获取分布式缓存文件路径
DistributedCache.addCacheF... | 8 |
private void writeLights(Document document) {
for (int i = 0; i < lights.size(); i++) {
Element lightNode = document.createElement("light");
Element color = document.createElement("color");
color.appendChild(document.createTextNode(write3Tuple(lights.get(i)
.getColor())));
lightNode.appendChild(color... | 4 |
@BeforeClass
public static void setUpClass() {
} | 0 |
public UnionFind(int N)
{
componentCount = N; // Initially assume that all nodes are in different
// components, components containing just themselves
id = new int[N]; // allocate memory
height = new int[N];
sz = new int[N];
// Initialise
for (int i = 0; i < N; i++)
{
id[i] = i;
height[i] = 0;
... | 1 |
public String getLogin(){
return login;
} | 0 |
public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... | 6 |
@Override
public void shoot(Point targetPoint) {
if (actionMode != ActionMode.ATTACKING) {
actionMode = ActionMode.ATTACKING;
}
if (canFire) {
registry.getProjectileManager().createProjectile(this,
"FireBall",
10,
... | 3 |
public List<Producto> getProductos() {
Connection connection = null;
Statement stmt = null;
ResultSet rs = null;
try {
connection = pool.getConnection();
stmt = connection.createStatement();
rs = stmt.executeQuery("select... | 7 |
private void adaptNewSetsMembership() throws ServerException {
Connection conn = null;
boolean startedTransaction = false;
Iterator<SetInfo> newUserDefinedSetInfosIterator =
this.newUserDefinedSetsMap.values().iterator();
while (newUserDefinedSetInfosIterator.hasNext()) {
... | 9 |
@Override
public int hashCode()
{
int hash = 5;
hash = 79 * hash + ( this.left != null ? this.left.hashCode() : 0 );
hash = 79 * hash + ( this.right != null ? this.right.hashCode() : 0 );
return hash;
} | 2 |
private HashMap<Integer, String> LoadTimestampDiffsFromFile() {
try (
InputStream file = new FileInputStream("timestamps.ser");
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new ObjectInputStream(buffer);) {
//deserialize the ... | 2 |
public String toString() {
return newObj != null ? newObj.toString() : "" + value;
} | 1 |
public ByteBuffer loadIcon(String filename, int width, int height) throws IOException {
BufferedImage image = ImageIO.read(new File("./res/icons/"+filename)); // load image
// convert image to byte array
byte[] imageBytes = new byte[width * height * 4];
for (int i = 0; i < height; i++) ... | 3 |
public boolean execute(Closure closure){
// get the internal thread number
int i = getInternalThreadId();
// #######################################################################
// guard stage
// #######################################################################
// mark this thread as active
a... | 8 |
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.