text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = in.readLine();
int n = Integer.parseInt(line);
int dates[];
ArrayList<laptop> lista = new ArrayList<laptop>();
for (int i = 0; i < n; i++) {
dates = atoi(in.... | 9 |
private void processLsCommand() {
if (processClasses.isEmpty()) {
System.out.println("No migratable program ");
} else {
System.out.println("All migratable programs:");
System.out.println("-------------------------------");
Iterator<Class<? extends Migrata... | 4 |
public void setDeadZone(int index, float zone) {
deadZones[index] = zone;
} | 0 |
@EventHandler
public void GiantStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Strength.... | 6 |
public void processDamagedCells(final StyledTextConsumer consumer) {
final int startRow = 0;
final int endRow = myHeight;
final int startCol = 0;
final int endCol = myWidth;
myLock.lock();
try {
for (int row = startRow; row < endRow; row++) {
... | 9 |
private boolean charIsAlpha() throws EOSReachedException
{
char c = this.getChar();
return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
} | 3 |
public static boolean toBoolean(int value) {
boolean result;
if (value == TessAPI.TRUE) {
result = true;
} else if (value == TessAPI.FALSE) {
result = false;
} else {
throw new IllegalArgumentException("Invlid boolean value. Expected " +
... | 2 |
public void setPosition()
{
setLocation(x,y);
setImage(bondImage);
if (speed > maxSpeed)
{
speed = maxSpeed;
}
else if (movement)
{
speed++;
}
else
{
speed = 0;
}
if (x<0)
{
... | 6 |
public void redoSquares() {
for (int y = 0; y < squares.length; y++) {
for (int x = 0; x < squares[y].length; x++) {
/*for (int a = 0; a < squares[y][x].length; a++) {
squares[y][x][a] = null;
}*/
sqSizes[y][x] = 0;
}
}
int start = sliceStart * squareSize;
int end = (sliceStart + sliceWi... | 6 |
public void changeImg(String s){
if(s.equals("dead"))
curImg = dead;
else if(s.equals("left"))
curImg = left[0];
else if(s.equals("right"))
curImg = right[0];
else if(s.equals("leftHarmed"))
curImg = leftHarmed;
else if(s.equals("rightHarmed"))
curImg = rightHarmed;
} | 5 |
@Override
public void init()
{
super.init();
lc = getByteAt( 0 );
fc = getByteAt( 1 );
rowIndex = ByteTools.readShort( getByteAt( 2 ), getByteAt( 3 ) );
int pos = 4;
for( int i = 0; i < ((lc - fc) + 1); i++ )
{
try
{
int type = getByteAt( pos++ );
switch( type )
{
case 0: // em... | 8 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result + radius;
return result;
} | 1 |
@Column(name = "percent")
@Id
public double getPercent() {
return percent;
} | 0 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EmployeeUser that = (EmployeeUser) o;
return id == that.id && !(employee != null ? !employee.equals(that.employee) : that.employee != null) && !(passwo... | 9 |
public boolean editShipInBounds(Ship ship)
{
if(myTurnEditing)
return mySea.shipInBounds(ship);
else
return theirSea.shipInBounds(ship);
} | 1 |
private static int binarySearch(int[] A, int target, int l, int r) {
while (l <= r) {
int mid = l + (r - l) / 2;
if (target > A[mid]) {
l = mid + 1;
} else if (target == A[mid]) {
return mid;
} else {
r = mid - 1;
}
}
return -1;
} | 3 |
public synchronized boolean mergeIntoMemberList(Process process) {
int index = process.getGlobalList().indexOf(getAlteredNode());
MemberNode matchingNode = index == -1 ? null : process.getGlobalList().get(index);
if (checkIsIntructionJoinVariant()) {
if (matchingNode == null
&&
/* && checkHasJoinA... | 9 |
@Override
public Void doInBackground() throws IOException {
if (taskOption == TaskOptions.EXPORT) {
if (!exportStory()) {
// Show popup to user that exporting failed
JOptionPane.showMessageDialog(
Main.this,
... | 4 |
public final void SetStream(InputStream stream)
{
Stream = stream;
} | 0 |
static Object js_createAdpter(Context cx, Scriptable scope, Object[] args)
{
int N = args.length;
if (N == 0) {
throw ScriptRuntime.typeError0("msg.adapter.zero.args");
}
Class superClass = null;
Class[] intfs = new Class[N - 1];
int interfaceCount = 0;
... | 7 |
public void run() {
Thread thisThread = Thread.currentThread();
while (running) {
try {
if (reset > -1) {
clearScreenAndReset(reset);
}
offscreenGraphics.setPaintMode();
nextpoints(alg);
Thread.sleep(100);
long diff = (System.currentTimeMillis() - lastRunTime);
if (diff > 5000... | 4 |
boolean isAttackPlaceHorizontallyLeftNotHarming(int position, char[] boardElements, int dimension, int leftPosition) {
while (leftPosition > 0) {
if (isPossibleToPlaceLeft(position, dimension, leftPosition)
&& isBoardElementAnotherFigure(boardElements[position - leftPosition])) {... | 3 |
@Override
public void show () {
shapeRenderer = new ShapeRenderer();
renderer = new Box2DDebugRenderer();
playerSprite = Util.createSquareSprite(Pixels.toMeters(Gdx.graphics.getWidth() / 8), Pixels.toMeters(Gdx.graphics.getHeight() / 8), Color.BLUE);
playerSprite.setPosition(-playerSprite.getWidth() / 2 - 5... | 1 |
@Override
public boolean equals(final Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
final InnerDataSubscription that = (InnerDataSubscription)o;
if(_aspect != null ? !_aspect.equals(that._aspect) : that._aspect != null) return false;
if(_attributeGroup != ... | 9 |
public static void writeEvent(PrintWriter pw, CalendarEvent evt) {
pw.println("BEGIN:VCALENDAR");
pw.println("CALSCALE:GREGORIAN");
pw.println("VERSION:2.0");
pw.println("METHOD:PUBLISH");
pw.println("BEGIN:VEVENT");
pw.printf("UID: %s%n", evt.getUuid());
Calendar c = Calendar.getInstance();
pw.printf("... | 3 |
public int getSize() {
return size;
} | 0 |
@Override
protected Result unhandledKeyboardEvent(Key key) {
if(getSelectedIndex() == -1)
return Result.DO_NOTHING;
if(key.getKind() == Key.Kind.Enter || key.getCharacter() == ' ') {
if(itemStatus.get(getSelectedIndex()) == true)
itemStatus.set(getSel... | 4 |
static double getDaysInYearFromBasis( int basis, long date0, long date1 )
{
double r = 0;
switch( basis )
{
case 0: // 30/360
case 2: // actual/360
case 4: // 30/360 (EURO)
r = 360;
break;
case 1: // actual/actual
GregorianCalendar fromDate = (GregorianCalendar) DateConverter.... | 6 |
public static void main(String... args) {
ByteBuffer byteBuffer = ByteBuffer.allocate(10);
byteBuffer.put((byte) 3);
//此处如果不flip的话,那么取出来的就是0.
byteBuffer.flip();
System.out.println(byteBuffer.get());
byteBuffer.clear();
for (int i = 0; i < 10; i++) {
... | 4 |
private Shape mPolygonShapeParser(Shape shape){
// Obtenemos las coordenadas de cada punto del shape
for (int x = 0; x < shape.getPoligons().size(); x++){
Coordinate[] coor = shape.getCoordenadas(x);
// Miramos por cada punto si existe un nodo, si no lo creamos
for (int y = 0 ; y < coor.length; y++){
... | 9 |
public static boolean loadTreeNetworkTest(){
//!!! TEST WILL FAIL IF EQUALS COMPARES TREE IDs!!!
int portTemp=TaskClientNetDriver.SERVER_PORT;
InetAddress tempAddress=TaskClientNetDriver.SERVER_ADDRESS;
TaskClientNetDriver.SERVER_PORT=TEST_PORT;
try {TaskClientNetDriver.SERVER_AD... | 9 |
private static <T> void printDFSStack(List<Node<T>> adjList) {
Stack<Node<?>> stk = new Stack<>();
for (Node<T> node:adjList) {
Map<Node<?>, Integer> track = new HashMap<>();
System.out.print(node + "->");
track.put(node, 2);
// if (track.get(node) == null) {
// track.put(node, 1);
stk.push... | 9 |
static boolean isBoardElementAnotherFigure(char boardElement) {
return !isBoardElementEmpty(boardElement)
&& (boardElement == BISHOP.getFigure()
|| boardElement == ROOK.getFigure()
|| boardElement == KING.getFigure()
|| boardElement == KNIGHT.getFi... | 5 |
private InitialCondition makeInitialCondition(Parameters p) {
if (p.getIC().equals("ProducerCheater")) {
// One cheater in a 5x5 block of cooperators, with the rest
// of the space empty
return new ProducerCheater(p);
} else if (p.getIC().equals("ProducerCheaterClump")) {
// A 3x3 block of cheaters ... | 8 |
public Dimension getPreferredSize(JComponent c) {
String tipText = ((JToolTip)c).getTipText();
if (tipText == null)
return new Dimension(0,0);
textArea = new JTextArea(tipText );
rendererPane.removeAll();
rendererPane.add(textArea );
textArea.setWrapStyleWord(true);
int width = ((MultiLineToolTip)c).ge... | 3 |
private void clearReferences(DatabaseUpdater updater, MergeMapping mapping)
throws UpdateException {
if (mapping.isManyToMany()) {
String query = "DELETE FROM "+DB.ESCAPE+"" + mapping.getMappingTable() + ""+DB.ESCAPE+" WHERE "+DB.ESCAPE+""
+ mapping.getColumnFrom() + ""+DB.E... | 4 |
public void mousePressed(MouseEvent event)
{
if(end == false){
//x = z;
z = getCardPressed(event.getX(), event.getY());
//top.setText("" + z + "");
//Integer i = new Integer(z);
//if(i != -1 && z != x) count++;
//if(cardSelect =... | 8 |
void menu() {
Integer option;
String s;
boolean exit = false;
while (!exit) {
UI.printHeader();
System.out.println("Selecciona una acción a continuación:");
System.out.println("1) Ver conexiones establecidas");
System.out.println("2) Establecer una conexión");
System.out.println("3) Eliminar una... | 9 |
public static Tile getTileConnectedToEntity(Entity e, int location){
if (map != null) {
switch (location) {
case UP:
return map.getTile(e.getX(),e.getY()-e.getHeight());
case DOWN:
return map.getTile(e.getX(),e.getY());
case LEFT:
return map.getTile(e.getX()-e.getWidth(),e.getY()-1);
case... | 5 |
public BodypartIconPanel(BodyPart bodypart) {
super();
this.bodypart = bodypart;
} | 0 |
public Timestamp getNoteUpdateTime(int noteId) throws SQLException {
NoteDatabaseManager dm = new NoteDatabaseManager();
String s_noteId = Integer.toString(noteId);
String sql = "select update_time from note where note_id = "
+ s_noteId + ";";
ResultSet rs = dm.sqlQuery(sql);
Timestamp noteUpdateTime =... | 1 |
private Integer[][] getLogicalMap(CustomizedArena arena,
int robotDiameterInCellNum) {
int rowCount = arena.getRowCount();
int columnCount = arena.getColumnCount();
Integer[][] logicalMap = new Integer[rowCount][columnCount];
//For each obstacle cell at Row i, Col j,
//Mark logicalMap[i ~ (i + robotDiam... | 8 |
public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
if (g == null)
return;
BruteParsePane bpp = new BruteParsePane(environment, g, null);
environment.add(bpp, "Brute Parser", new CriticalTag() {
});
environment.setActive(bpp);
} | 1 |
@Override
public BurstMap parse(final String s) {
final Map<String,Object> mp = new LinkedHashMap<String,Object>();
if((s!=null)&&(s.length()>0)&&(!s.equalsIgnoreCase(origHeader))) {
final String[] flds = sepPattern.split(s,-1); // do allow trailing nulls
if(null!=flds) {
if((flds.length>0)||(flds[0].tri... | 7 |
public GregorianCalendar getHora() {
return hora;
} | 0 |
public void printBoard()
{
System.out.println("________________");
for (int row = BOARD_SIZE; row >= 1; row--) {
for (int col = 1; col <= BOARD_SIZE; col++) {
ChessPiece piece = getPiece(row, col);
String print = "x";
if (piece instanceof K... | 8 |
public synchronized void playLoop(String file) {
if (Bootstrap.MUTE) {
game.log.jukebox("Game is muted, no sound played");
} else {
String type = null;
if (file.endsWith(".wav")) type = "wav";
else if (file.endsWith(".ogg")) type = "ogg";
if (type == "ogg") {
try {
OggClip ogg = new OggClip(... | 7 |
public Vertex getPath() {
return path;
} | 0 |
private Direction convertToDirection(String direction) {
switch (direction) {
case "north":
return Direction.NORTH;
case "south":
return Direction.SOUTH;
case "west":
return Direction.WEST;
case "east":
return Direction.EAST;
case "up":
return Direction.UP;
default:
return Direction.DOWN... | 5 |
private final void method3087(BufferedStream buffer, int i, int i_3_) {
if (i_3_ != 1) {
if ((i_3_ ^ 0xffffffff) == -3) {
buffer.readUnsignedByte();
} else if ((i_3_ ^ 0xffffffff) == -4) {
anInt3157 = buffer.readInt();
anInt3166 = buffer.readInt();
anInt3150 = buffer.readInt();
} else if ((i_... | 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 |
@Override
public int hashCode() {
int hash = 0;
hash += (idUsuario != null ? idUsuario.hashCode() : 0);
return hash;
} | 1 |
protected void buildAttributes(Node node, StringBuffer buf) {
// Iterator it = node.getAttributeKeys();
// if (it != null) {
// while (it.hasNext()) {
// String key = (String) it.next();
// Object value = node.getAttribute(key);
// buf.append(" ").append(key).append("=\"").append(escapeXMLAttribute(value.t... | 0 |
private void spinner_x1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinner_x1StateChanged
if(hitbox_index_selected!=-1 || click_target_flag)
{
click_target_flag=true;
if(hitbox_index_selected!=-1)
{
int i=0;
for(Node hitboxes_node=current_fr... | 9 |
@Override
public AnnotationVisitor visitParameterAnnotation(final int parameter,
final String desc, final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
if ("Ljava/lang/Synthetic;".equals(desc)) {
... | 5 |
boolean isChromosomeMissing(Marker marker) {
// Missing chromosome in marker?
if (marker.getChromosome() == null) return true;
// Missing chromosome in genome?
String chrName = marker.getChromosomeName();
Chromosome chr = genome.getChromosome(chrName);
if (chr == null) return true;
// Chromosome length ... | 4 |
public static boolean cobreTodas(Coluna col, Solucao sol){
int x = 0;
ArrayList<Integer> cobertura = col.getCobertura();
for(Integer entradateste : cobertura){
if(!(sol.getLinhasCobertas().contains(entradateste))){
sol.getLinhasCobertas().add(entradateste);
... | 3 |
static Elements filterOut(Collection<Element> elements, Collection<Element> outs) {
Elements output = new Elements();
for (Element el : elements) {
boolean found = false;
for (Element out : outs) {
if (el.equals(out)) {
found = true;
... | 4 |
@Override
public Path shortestPath(Vertex a, Vertex b) {
Hashtable<Vertex,Color> color=new Hashtable<Vertex,Color>(graph.getVertices().size()*2);
Hashtable<Vertex,Vertex> tree=new Hashtable<Vertex,Vertex>(graph.getVertices().size()*2);
Hashtable<Vertex,Integer> distance=new Hashtable<Vertex,... | 5 |
public Checker(int team){
this.team = team;
if(team == 1) {
setImage(new GreenfootImage("Mario.png"));
} else if (team == 2) {
setImage(new GreenfootImage("Wario.png"));
}
} | 2 |
public void createAndListenSocket() {
try {
socket = new DatagramSocket(9876);
byte[] incomingData = new byte[1024 * 1000 * 50];
System.out.println("Inicio del servidor");
while (true) {
DatagramPacket incomingPacket = new DatagramPacket(incomingDa... | 6 |
public static void infoBox(String infoMessage, String location)
{
JOptionPane.showMessageDialog(null, infoMessage, "InfoBox: " + location, JOptionPane.INFORMATION_MESSAGE);
} | 0 |
DefaultPopupMenu(AtomisticView v) {
super("Default");
this.view = v;
JMenuItem mi = new JMenuItem(view.getActionMap().get(AtomisticView.PASTE));
String s = MDView.getInternationalText("Paste");
if (s != null)
mi.setText(s);
add(mi);
addSeparator();
mi = new JMenuItem(view.getActionMap().get("Model... | 7 |
private JLabel getLabel(Point point) {
JLabel label = null;
JLabel[] searchLabel;
if (whitesTurn) {
searchLabel = whites;
} else {
searchLabel = blacks;
}
for (JLabel l : searchLabel) {
if (l.getBounds().x == point.x && l.getBounds().y == point.y) {
label = l;
}
}
return label;
} | 4 |
private void receive_id() throws Exception {
status_moves++;
int field_id = readMailbox(BrickGame.bluetooth_mailboxSystem, false, -1);
if (field_id < 1 || field_id > 2) {
return;
}
if (field_id == 2) {
updatePosition();
FieldGame.setField(2, pos_x, pos_y, id);
System.out.println(name + ": receive ... | 3 |
private void jMsgSActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMsgSActionPerformed
jTable1.getColumnModel().getColumn(0).setCellRenderer(new CustomCellRender_Message());
jTable1.setModel(modele2);
jTable1.setAutoCreateRowSorter(true);
Color c = new Color... | 2 |
public void connect() {
ScheduledExecutorService spinner = Executors.newScheduledThreadPool(2);
Map<String, ScheduledFuture<?>> futures = new HashMap<>();
final Socket socket;
IO.Options opts = new IO.Options();
opts.forceNew = true;
try {
socket = IO.socket... | 5 |
@Override
public void reservarLibroAUnSocio(String codigoLibro, String codigoSocio) throws BibliotecaError{
if (codigoLibro == null || codigoLibro.equals("")){
System.out.println("Codigo Libro invalido");
throw new BibliotecaError("Codigo Libro invalido");
}
if (codi... | 8 |
public Object invokeMethod(Reference ref, boolean isVirtual,
Object cls, Object[] params) throws InterpreterException,
InvocationTargetException {
if (cls == null && ref.getClazz().equals(classSig)) {
String clazzName = ref.getClazz();
clazzName = clazzName.substring(1, ref.getClazz().length() - 1)
... | 3 |
private static boolean deleteDirectory(String dir) {
if (!dir.endsWith(File.separator)) {
dir = dir + File.separator;
}
File dirFile = new File(dir);
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
File[] files = dirFile.listFiles();
for (int i = 0; i < file... | 9 |
public void close() {
synchronized (soc) {
if (!run)
return;
run = false;
try {
out.close();
in.close();
soc.close();
} catch(IOException e) {
System.err.println("ajclient.close: failed to close the connection");
}
}
} | 2 |
public void destroy() {
hoistedNode = null;
} | 0 |
public static void wbml_backgroundrefresh(osd_bitmap bitmap, int trasp) {
int page;
int xscroll = (bg_ram[0x7c0] >> 1) + ((bg_ram[0x7c1] & 1) << 7) - 256 + 5;
int yscroll = -bg_ram[0x7ba];
for (page = 0; page < 4; page++) {
//const unsigned char *source = bg_ram + (bg_ram[0... | 9 |
public void displayLCS()
{
System.out.println("Length of Longest Common Sequence is "+
length[seq1.length-1][seq2.length-1]);
LinkedList<Integer> list = new LinkedList<Integer>();
int row = seq1.length-1, col = seq2.length - 1, temp = -1, index = -1;
whil... | 5 |
public int isActivatedBy (Trigger trigger)
{
if (trigger == null)
return -1;
for (int i = 0; i < triggers.length; i++)
{
if (triggers[i] == trigger)
return i;
}
return -1;
} | 3 |
@Test
public void doTest() {
fillIn();
for (BigInteger b : trian) {
for (BigInteger p : trian) {
if (trian.contains(p.subtract(b).abs()) && trian.contains(p.add(b))) {
System.out.println(p + " " + b + " " + p.subtract(b).abs());
}
... | 4 |
public synchronized void adicionar()
{
try
{
new AreaFormacaoView(this);
}
catch (Exception e)
{
}
} | 1 |
public static Packet read(ByteBuffer buffer) {
byte packetId = buffer.get();
if (packetId == ID_HELLO_PACKET)
return new HelloPacket(buffer);
if (packetId == ID_WORLD_UPDATE_PACKET)
return new WorldUpdatesPacket(buffer);
if (packetId == ID_WINDOW_PACKET)
... | 7 |
public static boolean fullName(String name){
String[] temp = name.split(" ");
if(name(temp[0])&&name(temp[1]))
return true;
return false;
} | 2 |
@Test
public void returnListOfStrings_whenCallPermuteAsStrings() {
List<Character> chars = new ArrayList<Character>(Arrays.asList('a', 'b', 'c'));
String expected = "[abc, acb, bac, bca, cba, cab]";
String actual = permutation.permuteAsStrings(chars).toString();
assertEquals(expected... | 0 |
public String buscarGrupoEstudioPorCurso(String curso) {
ArrayList<GrupoEstudio> geResult= new ArrayList<GrupoEstudio>();
ArrayList<GrupoEstudio> dbGE = tablaGrupoEstudio();
String result="";
try{
for (int i = 0; i < dbGE.size() ; i++){
if(dbGE.get(i).getCurso().equal... | 5 |
public ServerInfo(String ipAddress, int port, long maxClients) {
this.ipAddress = ipAddress;
this.port = port;
this.maxClients = maxClients;
} | 0 |
public JButton createButton(final int index, String text) {
JButton b = new JButton();
b.setText(text);
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
switch (index) {
case 0:
... | 6 |
final synchronized void method2817(int[] is, int i, int i_67_) {
try {
anInt8898++;
if (aClass204_8944.method1491()) {
int i_68_ = (anInt8921 * ((MidiFile) aClass204_8944).anInt2683
/ Class22.anInt339);
do {
long l = aLong8959 + (long) i_67_ * (long) i_68_;
if (aLong8957 + -l >= 0L) {... | 5 |
public final void stmtList() throws RecognitionException
{
AST ast1 = null, ast2 = null;
try {
// CPP.g:300:3: ( stmt stmtList | )
int alt18 = 2;
alt18 = this.dfa18.predict(this.input);
switch (alt18)
{
cas... | 9 |
private static void percDown( int[] a, int i, int n ){
int child;
int tmp;
for (tmp = a[i] ; leftchild( i ) < n; i = child ) {
child = leftchild(i);
if (child<=n-1 && a[child] < a[child+1]) {
child++;
if (tmp < a[child]) {
int l = a[i];
a[i... | 7 |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Connection con = null;
PreparedStatement ps = null;
String[] unameperms = request.getParameter("uname").split(";");
String uname = unameperms[0];
String perms = unameperms[1];
String enab... | 8 |
@Test
public void testStreamSkipReadMixSmallerDelegateThrows() throws IOException {
LimitedInputStream stream = streamUsingSmallStreamThrows;
int limit = HALF_LIMIT;
long total = 0;
do {
int count = (int)(Math.random() * 10);
if (total + count == limit) {
count++;
}
boolean underflow = total + ... | 8 |
public void sendQueues() {
LinkedList<Bid> bidQueue = getBidQueue();
LinkedList<SeismicRequest> seismicQueue = getSeismicQueue();
LinkedList<Drill> drillQueue = getDrillQueue();
if (!bidQueue.isEmpty()) {
for (Bid bid : bidQueue) {
((ServerMessages) socket).sendBidQueue(bid.toSocket());
}
}
if (!... | 6 |
@Override
public void setComplete(boolean complete) {
this.complete = complete;
} | 0 |
private void shutdownHook()
{
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable()
{
@Override
public void run()
{
if (FilePlayer.getSaver() != null && !FilePlayer.getSaver().isDone())
try
{
FilePlayer.getSaver().get();
} catch (Int... | 3 |
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output,Reporter reporter)
throws IOException {
String line = value.toString();
String[] words = line.split(",");
int flag = 1;
for(int j=0;j<rule[rule_no].length-1 && flag==1;j++)
... | 7 |
@Test
public void testFindAllFromCache() throws Exception {
IUserPersistence users = dbs.getDatabase1().users();
User u1 = users.create("bryand", System.currentTimeMillis(), 5, System.currentTimeMillis() + 10, System.currentTimeMillis() + 20, "this is a relatively long string", new byte[]{5, 4, 3, 2, 1}, 1.2d... | 4 |
public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
sb.append(escape(jo.getString("name")));
sb.append("=");
sb.append(escape(jo.getString("value")));
if (jo.has("expires")) {
sb.append(";expires=");
s... | 4 |
public static void main(String[] args) {
String json = "{\"name\":\"sergii\",\"age\":\"25\"}";
ObjectMapper objectMapper = new ObjectMapper();
Map<String,String> map = new HashMap<String,String>();
try{
map = objectMapper.readValue(json, new TypeReference<HashMap<String, String>>() {
... | 1 |
public void rowOpenStateChanged(Row row, boolean open) {
if (row.hasChildren() && mRows.contains(row)) {
if (open) {
addChildren(row);
} else {
removeRows(row.getChildren().toArray(new Row[0]));
}
}
} | 3 |
public static LegacyOCPMessage decodeBuffer(final ByteBuffer buffer)
throws OCPException {
if (buffer.limit() < OCP_MIN_LENGTH) {
// Too short to possibly be a valid message
throw new OCPException();
}
Class<? extends LegacyOCPMessage> implementation;
... | 9 |
private void makeLabels() {
List<JPanel> labels = new ArrayList<JPanel>();
RollingStock r = theTrain.firstCarriage();
if (r == null) {
this.labelList = labels;
} else
while (r != null) {
JPanel tmpPanel = new JPanel();
tmpPanel.setBorder(new BevelBorder(BevelBorder.RAISED, null,
null, null, ... | 5 |
public static int[] maximumSubArray(int[] input) {
// Check for invalid input
if (input == null || input.length == 0) {
throw new IllegalArgumentException("invalid input array");
}
// If input lenght is 1 then we simply return the same array
if (input.length == 1) {
return input;
}
// Initialise th... | 6 |
public void show() {
for(RadioButton rb : btns)
rb.show();
} | 1 |
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.