text stringlengths 14 410k | label int32 0 9 |
|---|---|
public String strStr(String haystack, String needle) {
// Start typing your Java solution below
// DO NOT write main() function
int m = haystack.length();
int n = needle.length();
if (n == 0)
return haystack;
if (m == 0 || m < n)
return null;
int[] next = getNext(needle);
int i = 0, j = 0;
whil... | 7 |
@Override
public boolean execute(MOB mob, List<String> commands, int metaFlags)
throws java.io.IOException
{
if((mob==null)||(mob.playerStats()==null))
return false;
if(commands.size()<2)
{
final String wrap=(mob.playerStats().getWrap()!=0)?(""+mob.playerStats().getWrap()):"Disabled";
mob.tell(L("Ch... | 8 |
public void getImportLines( String fileName ) {
File exportFile = new File( fileName );
BufferedReader br = null;
try {
br = new BufferedReader( new FileReader( exportFile ) );
String line = "";
// find start of protected imports
while ( !line.... | 5 |
private void processLine(RdpPacket_Localised data, LineOrder line,
int present, boolean delta) {
if ((present & 0x01) != 0)
line.setMixmode(data.getLittleEndian16());
if ((present & 0x02) != 0)
line.setStartX(setCoordinate(data, line.getStartX(), delta));
if (... | 9 |
public void mouseDragged(MouseEvent e)
{
if (mouseDown == true)
{
if (e.getX() < mouseX)
cube.rotateXZ(ROTATIONSPEED);
else if (e.getX() > mouseX)
cube.rotateXZ(-ROTATIONSPEED);
mouseX = e.getX();
if (e.getY() < mouseY)
cube.rotateYZ(ROTATIONSPEED);
else if (e.getY() > mouseY)
... | 5 |
public static void sendRemainingTime(CommandSender sender, Main main)
{
Date date = main.getDM().getNextArena();
String time = "";
if (!date.isTomorrow())
{
Time comparedTime = Time.compareInaccurate(date.getInaccurateTime(), Time.currentInnacurateTime());
System.out.println(comparedTime);
if (compare... | 3 |
private boolean touchWall(double xt, double yt) {
return (xt <= (Board.WIDTH - this.width)) && (xt > this.width) && (yt <= Board.HEIGHT - this.height) && (yt > 0);
} | 3 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final WhoHasRequest other = (WhoHasRequest) obj;
if (limits == null) {
if... | 9 |
private String useRbondVariables(String s, int frame) {
int n = model.getRBondCount();
if (n <= 0)
return s;
int lb = s.indexOf("%rbond[");
int rb = s.indexOf("].", lb);
int lb0 = -1;
String v;
int i;
RBond bond;
while (lb != -1 && rb != -1) {
v = s.substring(lb + 7, rb);
double x = parseMath... | 7 |
void setImage(Path image, Brandingsize size) {
switch (size) {
case SMALL:
this.imgSmall = image;
break;
case MEDIUM:
this.imgMedium = image;
break;
case LARGE:
this.imgLarge = image;
... | 3 |
public static void main(String[] args) {
boolean check;
long i = 21;
while(true)
{
check = true;
for(int j = 1; j < 21; j++)
{
if(i % j != 0)
check = false;
}
if(check)
{
System.out.println(i);
break;
}
i++;
}
} | 4 |
public void print()
{
while (q.size() != 0)
{
System.out.println(getNumber());
}
} | 1 |
@Override
public void paintComponents(Graphics g) {
if (!this.skin.getAccButtonPosition().equals(Position.NONE)) {
Graphics g2 = g.create();
int x, y;
int w, h;
Rectangle bounds = this.parent.getBounds();
if (this.skin.isChanged() || (this.ground... | 5 |
@Override
public void run() {
while (runGameLoop) {
if (traced()) {
System.out.println("game loop:");
}
updateGameStatus();
handleCollisions();
frame.repaint();
if (is(TraceFlag.DRAWS)) {
System.out.println("\trepaint");
}
try {
Thread.sleep(frameTime);
} catch (InterruptedExce... | 4 |
private void convertPixelToRGB() {
rgbArray = new int[height][width][3];
int rgb;
for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
rgb = img.getRGB(col, row);
rgbArray[row][col][0] = (rgb >> 16) & 0xff; //red
... | 2 |
public int f() {
return 1;
} | 0 |
public MemberValue getMemberValue(String name) {
if (members == null)
return null;
else {
Pair p = (Pair)members.get(name);
if (p == null)
return null;
else
return p.value;
}
} | 2 |
public static TUnit doLeverage(TUnit inputUnit, ArrayList<TUnit> translationMemories, int fuzzyLimit, boolean checkFile, boolean checkID) {
//Check fuzzy limit
if (fuzzyLimit<0) {
fuzzyLimit=0;
}else if (fuzzyLimit>100) {
fuzzyLimit=100;
}
if (inputUnit==null || translationMemories==null ) return inputU... | 9 |
public static Cons cppGetStaticVariableDefinitions(Stella_Class renamed_Class) {
{ Cons staticmembervardefs = Stella.NIL;
{ Slot slot = null;
Iterator iter000 = renamed_Class.classSlots();
while (iter000.nextP()) {
slot = ((Slot)(iter000.value));
if (Stella_Object.storage... | 7 |
String exceptionMessage(ExceptionEvent event) {
ObjectReference exc = event.exception();
ReferenceType excType = exc.referenceType();
try {
// this is the logical approach, but gives "Unexpected JDWP Error: 502" in invokeMethod
// even if we suspend-and-resume the thread ... | 8 |
private void pushTerm(BytesRef text) throws IOException {
int limit = Math.min(lastTerm.length(), text.length);
//if (DEBUG) System.out.println("\nterm: " + text.utf8ToString());
// Find common prefix between last term and current term:
int pos = 0;
while (pos < limit && lastTerm.byteAt(pos) == tex... | 8 |
@Test
public void depthest11opponent5()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 6; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... | 5 |
public static void allocateHuffmanCodeLengths (final int[] array, final int maximumLength) {
switch (array.length) {
case 2:
array[1] = 1;
case 1:
array[0] = 1;
return;
}
/* Pass 1 : Set extended parent pointers */
setExtendedParentPointers (array);
/* Pass 2 : Find number of nodes to rel... | 3 |
private void addJob(ArrayList<String> players, String job, CommandSender sender) {
job = job.toLowerCase();
if (PlayerJobs.getJobsList().get(job) == null) {
sender.sendMessage(ChatColor.RED + _modText.getAdminCommand("exist", PlayerCache.getLang(sender.getName())).addVariables(job, "", sende... | 5 |
public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... | 2 |
public static void main(String[] args) {
Display.setTitle("This is a game.");
try {
Display.setDisplayMode(new DisplayMode(1280, 720));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.out.println("Failed to initialize the display");
}
GL11.glDisable(GL11.GL_DEPTH_T... | 3 |
public int getMarq(int indice){
return tabMarq[indice];
} | 0 |
public static boolean anyKeyPress(){
for(int i = 0; i < NUM_KEYS; i++)
if(keys[i]) return true;
return false;
} | 2 |
private void toFastboot_adbMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toFastboot_adbMenuActionPerformed
try {
adbController.rebootDevice(selectedDevice, RebootTo.BOOTLOADER);
} catch (IOException ex) {
logger.log(Level.ERROR, "An error occurred while r... | 1 |
public static void main(String[] args) throws Exception //TODO handle exception differently?
{
engine = GameEngine.getInstance();
MapFactory mf = new MapFactory(50, 50);
//this method is where an exception could, but won't, be thrown.
GameMap map = mf.createDefaultSizeMap("LargeSwamp");
engine.bindMap(map);
... | 7 |
public static ArrayList<Fine> getAllFines(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ArrayList<Fine> fineList = new ArrayList<Fine>();
t... | 5 |
private static int partition(int[] a, int lo, int hi) {
int i = lo;
int j = hi;
while(true) {
while(a[++i] < a[lo]) {
if(i == hi)
break;
}
while(a[lo] < a[--j]) {
if(j == lo)
break;
}
if(i >= j)
break;
exch(a, i, j);
}
exch(a, lo, j); // Puts the low thin... | 6 |
@Override
public void actionPerformed(int ID) {
switch(ID){
case 0:
this.setVisible(false);
guiManager.startGame();
break;
case 1:
this.setVisible(false);
guiManager.showOptionsMenu();
break;
case 2:
guiManager.closeGame();
break;
}
} | 3 |
public int remap(int oldDocID) {
if (oldDocID < minDocID)
// Unaffected by merge
return oldDocID;
else if (oldDocID >= maxDocID)
// This doc was "after" the merge, so simple shift
return oldDocID - docShift;
else {
// Binary search to locate this document & find its new docID
... | 9 |
@Override
protected void refreshFromRemote() throws IOException {
CachedUrlResolver urlResolver = new CachedUrlResolver();
String urlRef = getUrl().getRef();
String partNum = PartFactory.getInstance().scrapeText(urlRef, startId, endId).toUpperCase();
String queryUrl = queryUrlTemplate.replaceAll("\\{P... | 8 |
private static int show(int t[]) {
final char VIDE = '*'; // constante du charactère lorsque la case est vide
int i; // contient un compteur
String output = ""; // contient le tableau à être afficher
// première ligne
for(i = 0; i < t.length; i++) {
out... | 5 |
public void start(ClassPool pool) throws NotFoundException {
classPool = pool;
final String msg
= "javassist.tools.reflect.Sample is not found or broken.";
try {
CtClass c = classPool.get("javassist.tools.reflect.Sample");
trapMethod = c.getDeclaredMethod("tra... | 1 |
public static HashSet<Row> collectContainerRows(List<Row> rows, HashSet<Row> containers) {
for (Row row : rows) {
if (row.canHaveChildren()) {
containers.add(row);
if (row.hasChildren()) {
collectContainerRows(row.getChildren(), containers);
}
}
}
return containers;
} | 3 |
public PrimaryApproach()
{
numGraph = new ArrayList<PositionGraph>();
boxProbability = new Probability [9][9];
for(int j=0;j<9;j++)
{
for(int k=0;k<9;k++)
{
boxProbability[j][k]=new Probability ();
}
}
for(int i=0; i < 9; i++){
PositionGraph temp = new PositionGraph();
numGraph... | 3 |
@Override
public void updateIngredient(Ingredient c) throws IngredientRepositoryException {
validate(c);
for(int i = 0; i<ingredientRepository.size(); i++){
if(ingredientRepository.get(i).getIngredientId() == c.getIngredientId()){
c.setName(c.getName().toUpperCase());
ingredientRepository.set(i, c);
... | 2 |
private double calNocturnas(int h1, int m1, double h) {
int horaEnt = h1;
double minutoEnt = m1;
double nocturnas;
double horas = h;
double ent = horaEnt + (minutoEnt / 60);
if (ent <= 6) {
nocturnas = (6 - ent);
if (nocturnas > horas) {
... | 5 |
public void generateWave() {
int numStars,starPosX=0,starPosY=0,starWidth,starHeight,starVelocity, starHgap;
int r,g,b;
Color starColor;
//generate num of stars
numStars = MIN_NUM_STARS + (int) (Math.random()*(MAX_NUM_STARS-MIN_NUM_STARS));
//generate stars wave
... | 4 |
public void setCtrFormaPago(String ctrFormaPago) {
this.ctrFormaPago = ctrFormaPago;
} | 0 |
public void addViewListener(final YController controller) {
this.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ev) {
if (ev.getStateChange() == ItemEvent.SELECTED) {
// checking if event is really triggered by user...
if (!sett... | 8 |
private void writeBit(int bit) throws IOException
{
if (bit == 0)
this.bits <<= 1;
else
this.bits = this.bits << 1|1;
this.offSet++;
if (this.offSet == 8) {
this.ecrire.write(this.bits);
this.bits = 0;
thi... | 2 |
public void ejecutarComputadora(String mov){
if(mov != null){
switch(mov){
case "up":
this.arriba();
break;
case "down":
this.abajo();
break;
case "left":
... | 5 |
protected void _processWalks(WalkArray walkArray, int[] atVertices) {
long[] walks = ((LongWalkArray)walkArray).getArray();
long t1 = System.currentTimeMillis();
for(int i=0; i < walks.length; i++) {
long w = walks[i];
if (ignoreWalk(w)) {
continue;
... | 3 |
public MovingObjectPosition collisionRayTrace(World par1World, int par2, int par3, int par4, Vec3 par5Vec3, Vec3 par6Vec3)
{
MovingObjectPosition amovingobjectposition[] = new MovingObjectPosition[8];
int i = par1World.getBlockMetadata(par2, par3, par4);
int j = i & 3;
boolean flag =... | 8 |
public static int arrayEqualUntil(char[] a, char[] b, int aStart, int bStart, int length) {
for(int i=0;i<length;i++) {
if(a[aStart+i] != b[bStart+i]) {
return i-1;
}
}
return length-1;
} | 2 |
public void addToGroup(GroupAi g, Piece p)
{
if (p == null || g.pieces.contains(p) || (g.pieces.size() > 0 && g.pieces.toArray(new Piece[0])[0].team != p.team))
{
return;
}
int row = p.where.row;
int col = p.where.col;
g.pieces.add(p);
if (col > 0)
{
addToGroup(g, squares[row][col - 1].piece);
... | 8 |
public void runMenu ()
{
//do while loop for the menu
do
{
// initialise instance variables
displayMainMenu ();
promptChoice();
if (choice == 1)
{
//navigates the user to English to BLISS
System.... | 6 |
public static int getTotalGamesPlayed() {
return totalGamesPlayed;
} | 0 |
public void onTick(Instrument instrument, ITick tick) throws JFException {
} | 0 |
public static void checkVersion(){
if(!global.checkUpdate) return;
URLDownloader url=new URLDownloader("http://javablock.sourceforge.net/version", "");
//url.get1();
String v;
v=url.get1();
String ver=""+global.version;
if(true) return ;
if(v!=null)
... | 7 |
private boolean legalMove(int from_x,int from_y,int to_x, int to_y)
{
int dir_x, dir_y;
int dist;
dir_x=(int)Math.signum(to_x-from_x);
dir_y=(int)Math.signum(to_y-from_y);
if ((dir_x==0) && (dir_y==0)) return false;
dist=computeDistance(from_x,from_y,dir_x,dir_y);
if (dir_x==0) re... | 5 |
public Board generateFromCharArray(char[][] input)
{
AState[][] map = new AState[input.length][input[0].length];
for(int rowNum = 0; rowNum < input.length; rowNum++)
{
for(int colNum = 0; colNum < input[rowNum].length; colNum++)
{
boolean block = input[rowNum][colNum] == 'x';
boolean start = inp... | 2 |
public static Double[] calculatePrecisionAndRecall() {
Double[] precisionAndRecall = new Double[2];
double relevantDocumentsRetrieved = 0;
double totalRetrievedDocuments = resultsDocPairs.size();
Iterator it = resultsDocPairs.entrySet().iterator();
while (it.hasNext()) {
... | 3 |
private static void manageExtends(ClassDiagram system, Map<String, RegexPartialMatch> arg, final Entity entity) {
if (arg.get("EXTENDS").get(1) != null) {
final Mode mode = arg.get("EXTENDS").get(1).equalsIgnoreCase("extends") ? Mode.EXTENDS : Mode.IMPLEMENTS;
final String other = arg.get("EXTENDS").get(2);
... | 7 |
public synchronized void checkThread(Callable workToDo, Callable callback, Integer limitRate) throws DropCountExceededException {
if (workToDo != null) {
try {
this.checkThread(null, callback, null);
workToDo.call();
this.releaseThread();
... | 9 |
public void init(){
String incoming = null;
int currentIndex = 0;
BufferedReader input;
Socket connectionSocket;
boolean rulesSend = false;
try{
serverSocket = new ServerSocket(port);
System.out.println("Server is running at port " +port);
while(true){
try{
if(serverSocket.isClosed(... | 9 |
public final AbstractHash<K> getHash() { return hash; } | 0 |
private Color verticalWinner() {
for (int i = 0; i < board.length; i++) {
Color current = Color.NONE;
int length = 0;
for (int j = 0; j < board[0].length; j++) {
if (current == board[i][j]) {
length += 1;
} else {
... | 5 |
public ArrayList<SalesStaticsBean> querySales(String main_type,String name,String issue_date_begin ,String issue_date_end){
ArrayList<SalesStaticsBean> al = new ArrayList<SalesStaticsBean>();
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
SalesStaticsBean s = null;
try {
con... | 8 |
public void actionPerformed(ActionEvent event) {
// ActionEvent from "connect" Button
if(event.getSource() == buttonConnect) {
String host = txtHost.getText();
int port = Integer.parseInt(txtPort.getText());
try {
// Generate a TCP Client and start it as a Thread
tcpclient = new TCPClient(new So... | 3 |
public static void main(String[] args) {
// ResultSetHandler<Object[]> resultSetHandler = new ResultSetHandler<Object[]>() {
// public Object[] handle(ResultSet rs) throws SQLException {
// if (!rs.next()) {
// return null;
// }
//
// ResultSetMetaData meta = rs.ge... | 3 |
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
} | 1 |
public static void main(String[] args) {
Assert.checkNonNull(inputFileName, "InputFileName cannot be null");
try {
// String buffer for storing the output
StringBuilder output = new StringBuilder();
// read and parse input file
URL fileUrl = classLoader... | 8 |
private byte[] loadCompressedBinaryData(InputStream is) throws IOException,
UnsupportedEncodingException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int bytesRead;
// load md5 sum
MessageDigest md;
try {
md = MessageDigest.getInstance(DIGEST_MD52);
... | 9 |
public void close() {
if (_isAlive){
try {
_clientSocket.close();
if (_in != null){
_clientSocket.shutdownInput();
_in.close();
}
if (_out != null){
_clientSocket.shutdownOutput();
_out.close();
}
} catch (IOException e){
if (!_serverStop.getValue())
System.out.p... | 5 |
public Status getByValue(String value) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Status.class);
criteria.add(Restrictions.eq("value", value));
return (Status) criteria.uniqueResult();
} | 0 |
public boolean ColumnExists(Connection conn, String tname, String cname) {
DatabaseMetaData md;
ResultSet rs;
try {
md = conn.getMetaData();
} catch (SQLException e) {
// This shouldn't really happen
plugin.Warn("Unable to read DatabaseMetaData from DB connection!");
e.printStackTrace();
retur... | 4 |
public void addMacro(String name, String command){
if(!macros.containsKey(name)) { // we have a new macro
println("/"+name+" {"+command+"} def");
macros.put(name, command);
} else {
if(!macros.get(name).equals(command)){
//print it as it is different to the one specified before with the same name
p... | 2 |
* @param unit The <code>Unit</code> to load.
* @param goods The <code>Goods</code> to load.
* @return An <code>Element</code> encapsulating this action.
*/
public Element loadCargo(ServerPlayer serverPlayer, Unit unit,
Goods goods) {
ChangeSet cs = new ChangeSet()... | 6 |
@Override
public ByteBuffer getMessage() {
buffer.clear();
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 0xaaa6); // sig
buffer.putShort((short) 40); // byte len
buffer.put((byte) 1); // rcmNodeId;
buffer.put((byte) 0); // reserved
for (short val : pwm) {
buffer.putShort(val)... | 4 |
AbstractNode term() {
AbstractNode node = factor();
while (test(MUL) || test(DIV)) {
if (test(MUL)) {
read(MUL, "*");
node = new BinOpNode(MUL_OP, node, factor());
} else if (test(DIV)) {
read(DIV, "/");
node = new BinOpNode(DIV_OP, node, factor());
}
}
return node;
} | 4 |
@Override
public void actionPerformed(ActionEvent e) {
try {
if (e.getSource() == this.view.getJbCancel()) {
this.view.dispose();
} else if (e.getSource() == this.view.getJbLoad()) {
if (this.view.getJtTable().getSelectedRow() >= 0) {
i... | 5 |
@Override
public boolean save(News news) throws DaoException
{
if (null == news)
{
return false;
}
PooledConnection connection = null;
PreparedStatement pStatement = null;
try
{
connection = (PooledConnection) cp.takeConnection();
pStatement = connection.prepareStatement(NewsDaoStatement.crea... | 7 |
@Override
public void cover(ImageBit[][] list) {
ImageBit ib = new ImageBit();
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
ib = list[i][j];
if (ib.isCovered()) {
continue;
}
Leg... | 8 |
@Override
public void buttonClicked(ButtonEvent event) {
switch (event.getButton().getType()) {
case SERVER:
if (event.getButton().isActive())
networkHandler.shutDown();
else
networkHandler.startServer(port);
break;
case CLIENT:
if (event.getButton().isActive())
networkHandler.shutDown();... | 6 |
public Shape(SimpleFeature f, String tipo){
// Algunos conversores de DATUM cambian el formato de double a int en el .shp
// FECHAALATA y FECHABAJA siempre existen
if (f.getAttribute("FECHAALTA") instanceof Double){
double fa = (Double) f.getAttribute("FECHAALTA");
fechaAlta = (long) fa;
}
else if (f.g... | 6 |
public static void getTraitDescription(Tidy tidy, Document doc, Trait[] traits) {
try {
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression expr = xpath.compile("//div[@id = 'bodyContent']/p/text() |" +
"//div[@id = 'bodyContent']/p/a/text()");
NodeList nodes = (Node... | 3 |
public MWUizer(String resource) {
InputStream myResource = getClass().getResourceAsStream(resource);
if (myResource == null) {
MWUSet=new HashSet<String>();
System.err.println("I couldn't open the resource "+resource);
System.exit(0);
}
else {
MWUSet = loadResource(myResource);
... | 2 |
public FromFileGridFactory(String filename) {
this.filename = filename;
} | 0 |
public final void unlink() {
if (previous == null) {
} else {
previous.next = next;
next.previous = previous;
next = null;
previous = null;
}
} | 1 |
public static void parse(File csvFile) {
BufferedReader br = null;
String line = "";
String cvsSplitBy = " = ";
try {
HashMap<String, String> map = new HashMap<String, String>();
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
String[] property = l... | 9 |
@Override
public void keyTyped(KeyEvent e) {
unprocessedEvents.add(e);
} | 0 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tests = sc.nextInt();
String []in = new String[tests];
int i=0;
while(tests>0 && i<in.length){
tests--;
in[i] = sc.next();
i++;
}
for (String str : in){
System.out.println(solve(str));
}
sc.close()... | 3 |
public static LinkedList addlists(LinkedList a, LinkedList b){
LinkedList result=new LinkedList();
//Logic is to iterate node by node and do simple addition of the digits as you iterate through the nodes
//create two iterator nodes
Node ita=a.head;
Node itb=b.head;
int carry=0;
while(ita!=null || itb!=nul... | 7 |
private int italicHandler(char[] chars, int i) {
basicText.append("\\i ");
String plainWord = "";
while (chars[i] != ' ') i++;
i++;
while (chars[i] != '}' && i < chars.length) {
plainWord = plainWord + chars[i];
i++;
}
basicText.append(pla... | 3 |
public synchronized void recordAndAddSequenceNumberToOutgoingPacket(Packet packet) {
//ignore null packets
if(packet == null)
return;
//add sequence number to packet
lastSentPacketSequenceNumber = Packet.nextSequenceNumber(lastSentPacketSequenceNumber);
packet.setSequenceNumber(lastSentPacketSequenceNumbe... | 2 |
public boolean validationSplit(String input)
{
// initialise instance variables
boolean validated = false;
String[] firstValidationArray = input.split(";");
//for loop that has an array to validate bliss numbers.
for(int i=0;i< firstValidationArray.length;i++)
... | 6 |
public void setColumnValue(Object columnValue) {
this.columnValue = columnValue;
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TeamMapKey other = (TeamMapKey) obj;
if (map == null) {
if (other.map != null) {
return false;
}
} else if (!map.eq... | 9 |
@Test
public void testTwitter() throws InterruptedException {
try {
loadDocument();
} catch (ParserConfigurationException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} catch (IOException e) {
e.pri... | 4 |
public TaskList read(File importFile) throws TaskIOException {
if (importFile == null) {
log.warn(ApplicationSettings.getInstance().getLocalizedMessage("log.err.file"));
return new TaskList("Empty");
}
m_taskList = new TaskList(importFile.getName());
log.info(ApplicationSettings.getInstance().getLocaliz... | 5 |
public static void main(String[] args) {
Random rand = new Random(47);
Map<Integer, Integer> m = new HashMap<Integer, Integer>();
for (int i = 0; i < 10000; i++) {
// Produce a number between 0 and 20:
int r = rand.nextInt(20);
Integer freq = m.get(r);
m.put(r, freq == null ? 1 : freq + 1);
}
Syst... | 2 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public static FavoritesWindow getInstance() {
if (instance == null)
instance = new FavoritesWindow();
return instance;
} | 1 |
public ReachableFieldsOnChessboard()
{
Chessboard chessBoard = new Chessboard ();
Chessboard.Chesspiece[] pieces = new Chessboard.Chesspiece[6];
pieces[0] = chessBoard.new Pawn ('w', 'P');
pieces[1] = chessBoard.new Rook ('b', 'R');
pieces[2] = chessBoard.new Queen ('w', 'Q');
pieces[3] = chessBoard.new B... | 2 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.