text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static Pair<Boolean, Integer> huntDown(ChemistryUnit in, ChemistryUnit inExpression,
ChemistryUnit outExpression){
if(inExpression != null && in.equals(inExpression)){
return Pair.make(true, 1);
}
else if(outExpression != null && in.equals(outExpression)){
return Pair.make(false, 1);
}
else i... | 7 |
public void run() {
AudioFormat format =new AudioFormat(8000,16,2,true,true);//AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian
BufferedInputStream playbackInputStream;
try {
playbackInputStream=new BufferedInputStream(ne... | 5 |
@AfterGroups("Insertion")
@Test(groups = "Random BST")
public void testRandomBSTSearch() throws KeyNotFoundException,
EmptyCollectionException {
Integer count = 0;
Reporter.log("[ ** Random BST Search ** ]\n");
try {
timeKeeper = System.currentTimeMillis();
for (Integer i = 0; i < seed; i++) {
r... | 5 |
@Override
public void update(long deltaMs) {
super.update(deltaMs);
for(ShopItemButton sib : itemSlots) {
sib.update(deltaMs);
}
} | 1 |
public static ListNode reverseBetween(ListNode head, int m, int n) {
ListNode newHead = new ListNode(0);
if(head == null) {
return head;
}
if(head.next == null) {
return head;
}
if(m==n) {
return head;
}
ListNode currentNode = head;... | 9 |
private void renderTex(float fadeVal) {
//
//You draw a diamond-shaped area around the four points-
final float
w = xdim(),
h = ydim(),
x = xpos(),
y = ypos() ;
GL11.glBegin(GL11.GL_QUADS) ;
if (fadeVal == -1) GL11.glTexCoord2f(0, 0) ;
else GL11.glTexCoord3f(0, 0, fa... | 4 |
* @return String
*/
public static String stringTrim(String string) {
{ int start = 0;
int last = string.length() - 1;
int end = last;
while ((start <= end) &&
(Stella.$CHARACTER_TYPE_TABLE$[(int) (string.charAt(start))] == Stella.KWD_WHITE_SPACE)) {
start = start + 1;
... | 6 |
public void crossover() {
// Chromosome lengths
int chr_length_1 = chromosome1.getBrainStates().length;
int chr_length_2 = chromosome2.getBrainStates().length;
// Longest length
int shortest = (chr_length_1 < chr_length_2) ? chr_length_1 : chr_length_2;
// Determine crossover point
int cr_point =... | 5 |
public Matrix solve(Matrix B) {
if (B.getRowDimension() != m) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!this.isNonsingular()) {
throw new RuntimeException("Matrix is singular.");
}
// Copy right hand side with pivoting
int nx = B.getColumnDime... | 9 |
public void confirmMessage() {
if(pendingMessage == null) {
throw new IllegalStateException("Message was confirmed although messageBuffer was not waiting for a confirmation.");
} else {
pendingMessage = null;
deliveredPackages++;
if(messageBuffer.isEmpty()) {
long interval = System.currentTim... | 2 |
private int ten(String num)
{
switch(num)
{
case "twenty": return 20;
case "thirty": return 30;
case "forty": return 40;
case "fifty": return 50;
case "sixty": return 60;
case "seventy": return 70;
case "eighty": return 80;
case "ninety": return 90;
}
return 0;
} | 8 |
public Encargo getEncargo() {
return encargo;
} | 0 |
public synchronized void stop() {
running = false;
} | 0 |
@EventHandler(priority=EventPriority.MONITOR)
void onPlayerLogin(PlayerJoinEvent e) {
String group = mPlugin.getPermissionsManager()
.getPrimaryGroup((String) null,
e.getPlayer().getName());
if(group == null) return;
mData.put(e.getPlayer().getName(), group);
if(mPlugin.syncPlayerGroups(mDa... | 2 |
public Table parseTable(String statement) {
String[] statementSplit = statement.split("\"");
Table table = new Table();
table.setName(statementSplit[1]);
for (String line : statement.split("\r\n")) {
line = line.trim();
String keyField = line.split(" ")[0];
String[] splitValues = lin... | 8 |
private void setNextDestination() {
lastDest ++;
if(lastDest == 70) {
lastDest = 0;
destInverted = !destInverted;
}
if(lastDest == 35) {
currentX = !currentX;
}
int xDiff = destInverted ? 5 : -5;
int yDiff = destInverted ? 5 : -5;
if(currentX)
yDiff = 0;
else
xDiff = 0;
//this.... | 5 |
public void setNode(Node node) {
this.node = node;
} | 0 |
private void load(final List<String> clientSuites, final List<String> serverSuites) throws IOException {
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(
Constants.SUITES_FILE)));
String line = null;
while ((line = in.readLine()) != nul... | 8 |
void hide() {
lblDate.getScene().getWindow().hide();
} | 0 |
public void SaveNews(News[] news){
try{
File xmlFile = new File(xmlFileName);
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder xmlBulder = dFactory.newDocumentBuilder();
Document doc;
doc = xmlBulder.newDocument();
Node wrap = doc.createElement("items");
Str... | 9 |
protected void save() {
try {
File fFile = new File("test.jpeg");
this.setCursor(new Cursor(Cursor.WAIT_CURSOR));
JFileChooser fc = new JFileChooser();
// Start in current directory
fc.setCurrentDirectory(new File("."));
// Set to a default name for save.
fc.setSelectedFile... | 5 |
public SkillsMain getSkill1() {
return skill1;
} | 0 |
public void actionPerformed(ActionEvent actionEvent) {
if (actionEvent.getActionCommand().equals("Cut")) {
if (tf != null) {
tf.cut();
} else {
ta.cut();
}
}
if (actionEvent.getActionCommand().equals("Copy")) {
if (t... | 6 |
public Texture getSlickTexture(String resourceName) throws FailedTextureException {
Texture tex = (Texture) table.get(resourceName);
if (tex != null) {
return tex;
}
try {
tex = org.newdawn.slick.opengl.TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(resourceName));
... | 3 |
private void RemoverEquipa_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverEquipa_ButtonActionPerformed
try {
if (EquipaSelecionada_Label.getText().equals("nenhuma")) {
JOptionPane.showMessageDialog(null, "Não está nenhuma equipa seleccionada! Tem que ... | 5 |
public static String sortedWord(String s) {
int size = StringDemo.wordCount(s);
String s1[] = new String[size];
String temp;
for (int i = 0; i < size; i++) {
if (i == (size - 1)) {
s1[i] = s.substring(0);
} else {
s1[i] = s.substring(0, s.indexOf(' '));
s = s.substring(s.indexOf(' ') + 1);
... | 6 |
@Override
public void process(GameContext context) {
if (name.length() >= 15) {
client.receivedChatMessage("That's a terribly long name. Choose a shorter name.");
} else if (client.getName() == null) {
if (name.toLowerCase().equals("boss") || name.toLowerCase().equals("dragon") || name.startsWith("#")) {
... | 9 |
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException {
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
try{
String s = request.getParameter("n");
DataModel dataModel = new DataModel(s);
dataModel.setAll();
response.getWriter().println(dat... | 9 |
public boolean setDirection(String directionArg){
if(directionArg.equals("up") || directionArg.equals("down")
|| directionArg.equals("left-up") || directionArg.equals("left-down")
|| directionArg.equals("right-up") || directionArg.equals("right-down")){
direction = directionArg;
return true;
}
else... | 6 |
public int rate(String from, String to) {
if(from.equals(to)) return 1;
Integer rate = rates.get(new Pair(from, to));
return rate.intValue();
} | 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 |
public Vector2f findNearestIntesection(Vector2f a, Vector2f b, Vector2f posRel)
{
if(b != null && (a == null || a.sub(posRel).length() > b.sub(posRel).length()))
{
return b;
}
return a;
} | 3 |
public static String transactionIsolationToString(int txisolation) {
switch(txisolation) {
case Connection.TRANSACTION_NONE:
// transactions not supported.
return "TRANSACTION_NONE";
case Connection.TRANSACTION_READ_UNCOMMITTED:
// All three phenomena can occur
return "TRANSACTION_NONE";
ca... | 5 |
public static void addRepresentationCaddie (String numS, String dateRep, String zone, String nofp) throws BDException {
String requete = null;
PreparedStatement pstmt = null;
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
try {
conn = BDConnexion.getConnexion();
BDRequetesTest.t... | 5 |
@Override
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
getAisha().stopUp();
break;
case KeyEvent.VK_DOWN:
getAisha().stopDown();
break;
case KeyEvent.VK_LEFT:
getAisha().stopLeft();
break;
case KeyEvent.VK_RIGHT:
getAisha().stopRight();
break... | 5 |
public void body()
{
LinkedList resList;
// waiting to get list of resources. Since GridSim package uses
// multi-threaded environment, your request might arrive earlier
// before one or more grid resource entities manage to register
// themselves to GridInformationService (... | 6 |
public static void main(String[] args) throws IOException {
//make a TCP server socket
final ServerSocket TCP_Socket = new ServerSocket(7007);
//make UDP server socket
final DatagramSocket UDP_Socket = new DatagramSocket(7007);
//thread to handle TCP specific connections
... | 2 |
@Override
public void characters(char ch[], int start, int length) throws SAXException {
super.characters(ch, start, length);
} | 0 |
private void renderIntersections(Graphics2D g2)
{
Viewport gameViewport = ((pathXMiniGame)game).getGameViewport();
Iterator<Intersection> it = data.intersectionsIterator();
while (it.hasNext())
{
Intersection intersection = it.next();
// ONLY RENDER IT THIS W... | 6 |
public CommandWords()
{
validCommands = new HashMap<String, CommandWord>();
for(CommandWord command : CommandWord.values()) {
if(command != CommandWord.UNKNOWN) {
validCommands.put(command.toString(), command);
}
}
} | 2 |
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
this.setBorderPainted(false);
String name="/images/";
... | 5 |
public void loadElements(VisibleElements type) {
this.visibleElements = type;
// ZOrder index
int index = 0;
// Remove all drawed elements.
draw.removeAll();
List<GenericTreeNode<LayoutParserTreeElement>> list = this.layoutParser.XMLTree
.build(GenericTreeTraversalOrderEnum.PRE_ORDER);
// Go thro... | 8 |
public static Date getTriggerTime(Boolean morning) {
int hour;
if(morning) {
hour = 7;
} else {
hour = 13;
}
Date currentTime = new Date();
Calendar cal = new GregorianCalendar();
cal.setTime(currentTime);
cal.set(Calendar.HOUR_OF_... | 2 |
public static int compareTo(byte[] lhs, byte[] rhs) {
if (lhs == rhs) {
return 0;
}
if (lhs == null) {
return -1;
}
if (rhs == null) {
return +1;
}
if (lhs.length != rhs.length) {
return ((lhs.length < rhs.length) ? ... | 8 |
public int countOpenChains()
{
int chainCount = 0;
for(int i = 0; i < height; i++)
{
for(int j = 0; j < width; j++)
{
int vertex = j + i * width;
List<List<Integer>> chains = getAllChains(vertex);
for(int chainIndex = 0; chainIndex < chains.size(); chainIndex++)
{
if(chains.get(chai... | 4 |
File[] getRoots() {
/*
* On JDK 1.22 only...
*/
// return File.listRoots();
/*
* On JDK 1.1.7 and beyond...
* -- PORTABILITY ISSUES HERE --
*/
if (System.getProperty ("os.name").indexOf ("Windows") != -1) {
Vector /* of File */ list = new Vector();
list.add(new File(DRIVE_A));
list.add(... | 7 |
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 |
public Graph() {
} | 0 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(tickID==Tickable.TICKID_MOB)
{
if((affected!=null)
&&(affected instanceof MOB)
&&(invoker!=null))
{
final MOB mob=(MOB)affected;
if(((mob.amFollowing()==null)
||(mob.amDead())
||(!mob.isInCombat())
||(mob.location()!=... | 8 |
public static void e117(long n) {
if(counts[(int)n] != 0)
count += counts[(int)n];
else if(n <= 4)
switch((int)n){
case 1 : count += 1; break;
case 2 : count += 2; break;
case 3 : count += 4; break;
case 4 : count += 8; break;
}
else {
e117(n-1);
e117(n-2);
e117(n-3);
e117(n-... | 6 |
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[][] grid = new int[n][n];
for (int y = 0; y < n; y++) for (int z = 0; z < n; z++) {
grid[y][z] = in.nextInt();
if (z > 0) grid[y][z] += grid[y][z - 1]; // pre-processing
}
int maxSubRect = -127 * ... | 8 |
public boolean equals(Object obj) {
if (obj == this) return true;
if (obj == null) return false;
if (obj.getClass() != this.getClass()) return false;
Picture that = (Picture) obj;
if (this.width() != that.width()) return false;
if (this.height() != that.height()) return... | 8 |
private void Accept(Socket connection) throws IOException {
DataInputStream reader = new DataInputStream(connection.getInputStream());
byte firstsend = reader.readByte();
switch (firstsend) {
case 0: //Minecraft player
new Player(connection, this, firstsend, server);
break;
case (by... | 4 |
@Override
public void move()
{
Grid<Actor> grid = getGrid();
if(grid == null)
return;
Location loc = getLocation();
Location next = loc.getAdjacentLocation(getDirection());
if (grid.isValid(next))
moveTo(next);
else
removeSelfFromGrid();
Uranium uranium = new Uranium(super.getColor());
uraniu... | 2 |
@Override
public TexInfo getTexInfo(int metadata){
switch(metadata){
default:
case 0:
return normal;
case 1:
return striped;
}
} | 2 |
private void jBDescartesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDescartesActionPerformed
if(!bicho || (bicho && combatido && !muerto)){
if(tesorosVisiblesSeleccionados.isEmpty() && tesorosOcultosSeleccionados.isEmpty())
dialogo = new Dialogo(this,true, "¡Muy bien! Pe... | 9 |
public int read(InputStream outputStream) throws IOException {
long l = 0;
int in = 0;
for( int i = 0; i < 8; i++ ) {
in = outputStream.read();
if( in < 0 ) return in;
l = (l << 8) | (in & 0xff);
}
nmer = l;
return in;
} | 2 |
@Override
public void actionPerformed(ActionEvent e)
{
if ("Timer".equals(e.getActionCommand())) {doTimerActions();}
if ("Display Log".equals(e.getActionCommand())) {displayLog();}
if ("Display Help".equals(e.getActionCommand())) {displayHelp();}
if ("Display About".equals(e.getActionCommand())) {di... | 8 |
public static void deleteObject(RestS3Service ss, S3Bucket sb, String key) {
try {
ss.deleteObject(sb, key);
} catch (S3ServiceException e) {
e.printStackTrace();
}
} | 1 |
public static void main(String[] args) {
/**
* Creating an array of Shapes with random number of cells;
*/
Shape[] shapes = new Shape[getRandomNumber(1, 100)];
/**
* Filling an array cells with random Shapes.
*/
for (Shape shape : shapes){
... | 1 |
public void fireSelectEvent(final SelectEvent EVENT) {
final EventHandler<SelectEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (SelectEvent.SELECT == TYPE) {
HANDLER = getOnSelect();
} else if (SelectEvent.DESELECT == TYPE) {
... | 3 |
public void putAll( Map<? extends K, ? extends Byte> map ) {
Iterator<? extends Entry<? extends K,? extends Byte>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Byte> e = it.next();
this.put( e.getKey(), e.getValue() );
... | 8 |
public void actualizarQuantum(Proceso p) {
Boolean asigno = false;
int prioridadEstatica = p.getPrioridadEstatica();
int quantum = p.getQuantum();
int tcpu = p.getTiemposCPU();
p.setQuantum(--quantum);
// Disminuye num de Ticks que necesita para terminar ejecucion
... | 7 |
public List<Short> getShortList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Short>(0);
}
List<Short> result = new ArrayList<Short>();
for (Object object : list) {
if (object instanceof Short) {
r... | 8 |
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
Validaciones v = new Validaciones();
if (jCheckBox1.isSelected()){
jLabel4.setVisible(false);
Cargar_Tabla("SELECT * FROM "... | 9 |
private void processMessage(String s){
String[] tokens = s.split(" ");
for(int i = 0; i < tokens.length; i++){
//System.out.println(tokens[i]);
}
if (tokens[0] != null && tokens[0].contains("GET")){
PageServer ps = new PageServer();
sendMessage(ps.getPage(tokens[1].substring(1)));
}
} | 3 |
public static void main(String[] tArgs) throws IOException {
File f = null;
JFrame frame = new JFrame();
if(tArgs.length>0&&tArgs[0] != null) {
f = new File(tArgs[0]).getAbsoluteFile();
} else {
f = FileChooser.chooseFile(frame, "Load", JFileChooser.FILES_ONLY);
}
FileWriter FW = new FileWriter();... | 6 |
public static boolean isActive(JComponent c) {
if (c == null) {
return false;
}
boolean active = true;
if (c instanceof JInternalFrame) {
active = ((JInternalFrame) c).isSelected();
}
if (active) {
Container parent = c.getParent();
... | 6 |
public static void home(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
// Record the EditingNode, Mark and CursorPosition
tree.setCursorMarkPosition(0);
tree.setCursorPosition(0, false);
tree.getDocument().setPreferredCaretPosition(0);
// Redraw and Set Focus
layout.draw(currentNode, Outlin... | 0 |
public void eliminarBD()
{
File basedatos= new File(this.ruta);
if(basedatos.exists())basedatos.delete();
} | 1 |
public static boolean correctISBNFormat(String isbn) {
String regex = "\\d+";
if (isbn.length() == 10) return isbn.matches(regex);
if (isbn.length() == 14) {
String i[] = isbn.split("\\-");
if (i[0].length() != 3) return false;
return i[0].matches(reg... | 4 |
public boolean update(float tslf, LinkedList<Bullet> bullets)
{
if(path.size() > 0)
{
float absx = path.get(path.size() - 1).getX() * Texture.tilesize + Texture.tilesize / 2 - (xpos + look.getWidth() / 2);
float absy = path.get(path.size() - 1).getY() * Texture.tilesize + Texture.tilesize / 2 - (ypos + look.... | 6 |
@Override
public void actionPerformed(ActionEvent e) {
Random r = new Random();
int d = r.nextInt() % 5;
switch (d) {
case 0:
break;
case 1:
// move right
if (dx < 0) {
dx = -dx; // if moving left, m... | 9 |
public ChangePwdServlet() {
super();
// TODO Auto-generated constructor stub
} | 0 |
public boolean ajout(Personne pers){
boolean exists = false;
if (!this.estVide())
{
int i = 0;
while (i<contacts.size() && !exists)
{
if (contacts.get(i) instanceof Particulier && pers instanceof Particulier)
{
Particulier part = (Particulier) pers;
P... | 8 |
private void debug()
{
if ( Input.getKey( Input.KEY_F5 ) )
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
else if ( Input.getKey( Input.KEY_F6 ) )
glPolygonMode( GL_FRONT_AND_BACK, GL_POINT );
else
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
} | 2 |
public void actionPerformed(ActionEvent event){
//set string equal to nothing in it.
String string = "";
//so basically we do here is we look to see if anyone typed
//Anything into any of these text boxes and hits enter, we want to
//set string equal to field (whatever one you entered in),... | 4 |
public void update(double mod){
for (int i = 0; i < points.size(); i++){
if (!points.get(i).isFrozen()){
points.get(i).setY(points.get(i).getY()+mod*speed);
//freeze point if it reaches the bottom
if (points.get(i).getY() > maxHeight){
... | 9 |
private void setupRepeatRun(BigInteger numPrunedConfsToAllow, int numRotForResNonPruned[],
int numLevels, int numMutable){
BigInteger totalNumConfsUnpruned = new BigInteger("0");
Iterator<RotInfo<Boolean>> elimRotIter = eliminatedRotAtRes.iterator();
Iterator<RotInfo<Boolean>> prunedStericIter = prunedIsSt... | 8 |
public boolean handleInput(String line) {
// start new Game
if (line.matches("start[0-9]+")) {
String param = line;
param = param.replaceAll("start", "");
int cash = Integer.parseInt(param);
controller.start(cash);
} else if (line.equalsIgnoreCase(... | 9 |
public static void main(String[] args)throws Exception{
if(args.length < 1){
System.out.println("Usage: java ThreadRequest <u=url> <t=threads> <r=runs> <f=foundReturnMessage> <s=sleep>");
return;
}
for(int i=0;i<args.length;i++){
if(args[i].startsWith("u=")){
spec = args[i].substring(2);
}else
... | 9 |
public Color unique(Object o) {
if (!uniqueColors.containsKey(o)) {
Random rand = new Random();
Color bestColor = null;
double bestDelta = -1;
for(int x = 0; x < 10; x++) {
Color unique = colorFromHash(rand.nextInt());
int delta = 0;
for(Color other : uniqueColors.values()) {
delta +... | 4 |
private static Path processPoly(Element element, StringTokenizer tokens) throws ParsingException {
int count = 0;
ArrayList pts = new ArrayList();
boolean moved = false;
boolean reasonToBePath = false;
Path path = null;
while (tokens.hasMoreTokens()) {
try {
String nextToken = tokens.nextToken(... | 8 |
public void render(Graphics2D g) {
Graphics2D g2d = (Graphics2D) finalBoard.getGraphics();
g2d.drawImage(gameBoard, 0, 0, null);
for (int row = 0; row < ROWS; row++) {
for (int col = 0; col < ROWS; col++) {
Tile current = board[row][col];
if (current == null)
continue;
current.render(g2d);
... | 3 |
public static String decrypt3DES(byte[] message, String encrKey)
{
try
{
final MessageDigest md = MessageDigest.getInstance("md5");
final byte[] digestOfPassword = md.digest(encrKey.getBytes("utf-8"));
final byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24);
... | 2 |
private ApplyDeletesResult closeSegmentStates(IndexWriter.ReaderPool pool, SegmentState[] segStates, boolean success, long gen) throws IOException {
int numReaders = segStates.length;
Throwable firstExc = null;
List<SegmentCommitInfo> allDeleted = null;
long totDelCount = 0;
for (int j=0;j<numReader... | 8 |
public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (int t = 0, T = parseInt(in.readLine().trim()); t++ < T;) {
StringTokenizer st = new StringTokenizer(in.readLine());
int C = parseIn... | 8 |
public void secondThread() throws InterruptedException {
Random random = new Random();
for (int i = 0; i < 10000; i++) {
acquireLocks(lock2, lock1);
try {
Account.transfer(acc2, acc1, random.nextInt(100));
} finally {
lock1.unlock();
... | 1 |
private void addItem(int numToAdd, ArrayList<Location> locations, boolean checkTargets)
{
Random rand = new Random(); //Random number generate to determine locations of spaces randomly
for(int i = 0; i < numToAdd; i++)
{
//Generate random location
Location newItem = new Location(rand.nextInt(MAX_X),rand.... | 9 |
private boolean jj_2_59(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_59(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(58, xla); }
} | 1 |
public static void main( String[] args ) {
Scanner input = new Scanner( System.in );
int number1;
int number2;
System.out.println( "Enter The First Integer: " );
number1 = input.nextInt();
System.out.println( "Enter The Second Integer: " );
... | 6 |
private void readObject(ObjectInputStream stream) throws java.io.IOException,
java.lang.ClassNotFoundException {
stream.defaultReadObject();
int size = stream.readInt();
this.bytes = new byte[size];
int index = 0, remainder = size;
while (index < size) {
int numOfBytes = stream.read(bytes, ... | 2 |
public Map getMyCustomEvent() {
return myCustomEvent;
} | 0 |
void setModuleManager(ModuleManager manager){
this.manager = manager;
} | 0 |
public static String[] search(String[][] clientArray, String queryString) {
// Durch das Array iterieren und schauen, ob der Suchstring
// in den Spalten 1 und 2 eines Datensatzes vorkommt
for(String[] client: clientArray) {
if(client[1].toLowerCase().indexOf(queryString.toLowerCase())!=-1 ||
client[2].to... | 3 |
public void setjButtonOK(JButton jButtonOK) {
this.jButtonOK = jButtonOK;
} | 0 |
public static String act(String text) {
text = text.replace("{{עשר המכות}}", "");
text = text.replace("{{אבני החושן}}", "");
text = text.replace("{{פירוש לקוי}}", "");
text = text.replace("{{תחבורה ציבורית}}", "");
// line break - we dont need them
text = text.replaceAl... | 2 |
public double rateBoard(Board board) {
final int width = board.getWidth();
final int maxHeight = board.getMaxHeight();
int sumHeight = 0;
int holes = 0;
// Count the holes, and sum up the heights
for (int x=0; x<width; x++) {
final int colHei... | 3 |
public static double atom(char s) {
switch (s) {
case 'C':
return C;
case 'H':
return H;
case 'O':
return O;
}
return N;
} | 3 |
private Map<ProcessModel, Set<Action>> getNoActivityInputActions() {
Map<ProcessModel, Set<Action>> noActivityInputActions = new HashMap<ProcessModel, Set<Action>>();
Set<Action> mainSTSActions = new HashSet<Action>();
for (Action action : mainSTS.getInputActions()) {
if (!action.isRelatedToAnActivity() && !ac... | 7 |
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.