text stringlengths 14 410k | label int32 0 9 |
|---|---|
public boolean removeLastOccurrence(Object o) {
checkNotNull(o);
for (;;) {
Node<E> s = trailer;
for (;;) {
Node<E> n = s.back();
if (s.isDeleted() || (n != null && n.successor() != s))
break; // restart if pred link is suspect.... | 8 |
public static Solucao VizinhoOneFlip(Solucao inicio){
for(Coluna col : inicio.getColunas()){
for(Integer colx : inicio.getLinhasX().keySet()){
if(col.getNome()!=inicio.getLinhasX().get(colx).getNome()){
Solucao testarsolucao = new Solucao(inicio);
... | 5 |
private static String getValue(JSONTokener x) throws JSONException {
char c;
do {
c = x.next();
} while (c == ' ' || c == '\t');
switch (c) {
case 0:
return null;
case '"':
case '\'':
return x.nextString(c);
case ',':
... | 6 |
public void setMap(String stageName)
{
if (stageName.equals("yoshi's house"))
{
map = new YoshiHouseStart(marioWorld);
}
if (stageName.equals("yoshi's house end"))
{
map = new YoshiHouseEnd(marioWorld);
}
if (stageName.equals("Waterfall... | 4 |
public ExportSelectionFileMenuItem(FileProtocol protocol) {
setProtocol(protocol);
addActionListener(this);
} | 0 |
final public void PairExp() throws ParseException {/*@bgen(jjtree) PairExp */
SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTPAIREXP);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
try {
jj_consume_token(LEFTB);
Expression();
jj_consume_token(COMMA);
Expression... | 8 |
@Test
public void testCount() throws Exception
{
PersistenceManager persist = new PersistenceManager(driver, database, login, password);
persist.dropTable(Object.class);
ConnectionWrapper cw = persist.getConnectionWrapper();
// add a large number of entries
for (int x = 0; x < 200; x++)
{
SimplestObje... | 2 |
@Override
public <N, T> QualifiedValue<T> getFirstQualifiedValue(TKey<N, T> key, Enum<?>... qualifiers) {
QualifiedValue<T> result = null;
List<QualifiedValue<?>> values = fields.get(key);
if (values != null && values.size() > 0) {
for (QualifiedValue<?> value : values) {
... | 7 |
private void endWritingTxt() {
try {
fw.close();
} catch (Exception e)
{
e.printStackTrace();
}
} | 1 |
public boolean eliminarProceso(Proceso p) {
int prioridad = p.getPrioridadDinamica();
boolean elimino = this.listas[prioridad].remove(p);
if (elimino) {
this.numProcesos--;
if (this.numProcesos == 0) {
this.menorPrioridadNoVacia = 140;
} else... | 5 |
public ItemSet getSelectedItemSet() throws Exception {
if (this.cache==null) {
Iterator<HypertopicMap.Viewpoint.Topic> t =
this.selectedTopics.iterator();
if (t.hasNext()) {
HypertopicMap.Viewpoint.Topic topic = t.next();
this.cache = new ItemSet(topic);
while (t.hasNext()) {
topic = t.next();
... | 4 |
public void toXML (XMLWriter xmlWriter, int indent, boolean relative)
throws IOException {
xmlWriter.printXMLStartTag(byteVectorXMLTag, indent, relative, true);
xmlWriter.printXMLStartTag(lengthXMLTag, indentLength, true, false);
xmlWriter.print(Integer.toString(bytes.length));
x... | 1 |
public String longestPalindrome(String s) {
int n = s.length();
int maxLength = 0;
String maxString = "";
for (int i = 0; i < n; i++) {
int j = 0;
while (i - j >= 0 && i + j < n
&& s.charAt(i - j) == s.charAt(i + j)) {
if (j * 2 + 1 > maxLength) {
maxLength = j * 2 + 1;
maxString = s.su... | 9 |
public boolean inRadius(int x, int y) {
int dx = (int) Math.abs(x - getWorldPosition().x);
int dy = (int) Math.abs(y - getWorldPosition().y);
if (dx > RADIUS || dy > RADIUS) return false;
if (dx + dy <= RADIUS
|| Math.pow(dx, 2) + Math.pow(dy, 2) <= Math.pow(RADIUS, 2)) return true;
return false;
} | 4 |
public DictionarySource() {
this.dictionaryWords = new LinkedList<>();
this.dictionaryWords.add("jetblue"); // supplementing dictionary for passing testing.
try (
InputStream dictStream = this.getClass().getResourceAsStream("american-english.txt");
BufferedReader ... | 4 |
@Override
public boolean stopCellEditing() {
isPushed = false;
return super.stopCellEditing();
} | 0 |
public void paint(Graphics g){//Does all the paintings
super.paint(g);
Graphics2D g2d = (Graphics2D)g;
if(inGame){
for(int i=0;i<grasList.size();i++){
Gras gras;
gras = (Gras) grasList.get(i);
Image image = imageLo... | 3 |
protected T fetchContainingInterval(U queryPoint) {
Node<U, T> node = (Node<U, T>) binarySearchTree.getRoot();
while (node != null) {
if (node.getValue().contains(queryPoint)) {
return node.getValue();
}
Node<U, T> leftChild = node.getLeft();
node = node.getRight();
if (lef... | 6 |
public static List<Laureate> filterByLongName(List<Laureate> inputList, List<String> ListOfTerms) {
List<Laureate> outputList = new ArrayList<Laureate>();
// parse input, keep what matchs the terms.
for (Laureate Awinner : inputList) {
if (ListOfTerms.contains(Awinner.getLongName())... | 2 |
protected CachedEntry findSub(String key)
{
if(!key.startsWith(getKey()))
return null;
if(children != null)
{
for (int x = children.size() - 1; x >= 0; x--)
{
CachedEntry tmp = (CachedEntry) children.get(x);
if(key.startsWith(tmp.getKey()))
{
return tmp.... | 5 |
public static String getFullPinName(String name, byte[] subBus) {
StringBuffer result = new StringBuffer(name);
if (subBus != null
&& !name.equals(CompositeGateClass.TRUE_NODE_INFO.name)
&& !name.equals(CompositeGateClass.FALSE_NODE_INFO.name)) {
result.append("[");... | 4 |
@Test
public void testCommon()
throws Exception
{
byte[] expectedZero = concat(new byte[1] /* magic placeholder */,
fragment(0, new byte[] { 0 }), new byte[] { -0x80, 0, 0, 0, 0, 1 });
byte[] expectedCommon = new byte[] { COMMON_MAGIC, 0, 0, 12, -0x80, 0, 0, 0, 0, 1 };
for (byte[] withOwnData : new byte[]... | 7 |
public static int[] primeList2(int maximum) {
boolean[] list = new boolean[maximum + 1];
int primes = 0;
for (int i = 2; i <= maximum; i++) {
list[i] = true;
}
list[0] = false;
list[1] = false;
double wurzel = Math.sqrt(maximum);
for (int i = 0... | 7 |
public void startGame() {
int round = 1;
boolean gameover = false;
while (!gameover) {
System.out.println("Runda " + round++);
for (int i = 0; i < playersCount && !gameover; i++) {
char randomLetter = buildRandomLetter();
players[i].addLet... | 5 |
private void test(String testPath) throws IOException {
int hit = 0;
int total = 0;
BufferedReader scanner = null;
try {
scanner = new BufferedReader(new FileReader(new File(testPath))); //new Scanner(new File(testPath));
} catch (FileNotFoundException e) {
... | 7 |
@Override
public void windowClosing(java.awt.event.WindowEvent event) {
Object object = event.getSource();
if (object == MonitorConsole.this) {
System.exit(0);
}
} | 1 |
private void deleteFile_fileManagerButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteFile_fileManagerButtonActionPerformed
try {
selectedDevice.getFileSystem().delete(directoryLabel_fileManagerLabel.getText() + jList1.getSelectedValue());
} catch (IOException | D... | 1 |
@Override
public boolean equals(Object obj)
{
if (obj != null && obj instanceof MarketOrder)
{
MarketOrder other = (MarketOrder) obj;
if (other.response.equals(this.response) && other.account.equals(this.account))
{
for (Entry<OrderField, String> ent : map.entrySet())
{
if (!other.hasField(e... | 7 |
private void deleteCase5(RBNode n) {
if (n == n.parent.left &&
nodeColor(n.sibling()) == NodeColor.BLACK &&
nodeColor(n.sibling().left) == NodeColor.RED &&
nodeColor(n.sibling().right) == NodeColor.BLACK)
{
n.sibling().color = NodeColor.RED;
n.... | 8 |
private boolean transmit() {
FileInputStream fis = null;
try {
byte[] data = new byte[1024];
fis = new FileInputStream(file);
byte[] buf = new byte[512];
int i = 1;
while (fis.read(buf) != -1) {
if (!transmitPacket(buf, i)) {
... | 6 |
protected void ExpandBuff(boolean wrapAround)
{
char[] newbuffer = new char[bufsize + 2048];
int newbufline[] = new int[bufsize + 2048];
int newbufcolumn[] = new int[bufsize + 2048];
try
{
if (wrapAround)
{
System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegi... | 2 |
public void setConnectedState(final ConnectionState state) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
switch (state) {
case CONNECTED:
mntmConnect.setEnabled(false);
mntmDisconnect.setEnabled(true);
mntmDownloadData.setEnabled(true);
mntmEraseLogger.setEnabled(t... | 6 |
public String getName(String IP){
try {
resultSet = statement.executeQuery("SELECT name, status FROM "+Table+" WHERE IP ='"+IP+"'");
while(resultSet.next()){
System.out.println(resultSet.getString("name"));
if(resultSet.getString("status").equals("alive"))... | 3 |
@Override
public Integer save(T entity) throws DaoException {
waitCompete();
Integer id = getIdForNewEntity();
entity.setId(id);
getEntities().put(id, entity);
return id;
} | 0 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
setEnabled(false);
addActionListener(this);
Outliner.documents.addDocumentRepositoryListener(this);
} | 0 |
public static void nofailAssertTrue(boolean testExpression,
String message) {
if (!testExpression) {
System.out.println("Test expression not true\n" + message);
}
} | 1 |
public void setSlotNumber(Tray tray) {
int slotNumber = -1;
List<Integer> numbers = new ArrayList<Integer>();
for (Tray t : this.trays) {
numbers.add(t.getSlotNumber());
}
Collections.sort(numbers);
for (Integer num : numbers) {
if (num > slotNumber + 1) {
tray.setSlotNumber(slotNumber + 1);
r... | 3 |
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0 :
return Integer.class;
case 1 :
return String.class;
case 2 :
return String.class;
case 3 :
return String... | 7 |
@Override
public String getMessageTextAsHTML() {
String msg = "";
msg += "<font color="+Constants.NOTIFICATION_COLOR+">";
msg += oldName + " " + settings.getLanguage().getLabel("text_rename") + " " + newName;
msg += "</font>";
return msg;
} | 0 |
public void displayView()
{
myMainView = new JFrame();
myMainView.setSize(1150, 700);
myMainView.setTitle("Queue Simulation");
myMainView.setDefaultCloseOperation(EXIT_ON_CLOSE);
myMainView.setResizable(false);
myContainer = myMainView.getContentPane();
myUserInputView = new JF... | 9 |
int clear(){
vb.clear();
vd.clear();
os.clear();
if(vi!=null&&links!=0){
for(int i=0; i<links; i++){
vi[i].clear();
vc[i].clear();
}
vi=null;
vc=null;
}
if(dataoffsets!=null)
dataoffsets=null;
if(pcmlengths!=null)
pcmlengths=null;
if(s... | 7 |
private void checkForActivity() throws MqttException {
final String methodName = "checkForActivity";
if(this.isMyControll && connected && this.keepAlive > 0) { //
pingOutstanding = true;
lastPing = System.currentTimeMillis();;
MqttToken token = new MqttToken(clientComms.getClient().getClientId());
toke... | 9 |
@Override
public double unsafe_get(int row, int col) {
if( row == 0 ) {
if( col == 0 ) {
return a11;
} else if( col == 1 ) {
return a12;
}
} else if( row == 1 ) {
if( col == 0 ) {
return a21;
... | 6 |
@EventHandler
public void killObj(EntityDeathEvent ev)
{
LivingEntity ent = ev.getEntity();
if(ent.getKiller() == null)return;
Player player = ent.getKiller();
PlayerQuestLog log = qm.getQuestLog(player.getName());
for(Quest q:log.getAssigned())
{
QuestData qd = log.getProgress(q);
for(Objective o:q... | 7 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
boolean success=false;
i... | 9 |
public static void main(String[] args) {
if (apiKey.isEmpty() || geckoOMeterWidgetKey.isEmpty() || lineChartWidgetKey.isEmpty()) {
System.out.println("Please add API and widget keys to the code example");
return;
}
GeckoboardTemplate template = new GeckoboardTemplate();
... | 9 |
public boolean blockIsNotSafe(World world, double x, double y, double z) {
if (world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1.0D),
(int) Math.floor(z)).getType() == Material.LAVA)
return true;
if (world.getBlockAt((int) Math.floor(x), (int) Math.floor(y - 1.0D),
(int) Math.floor(z)).getType... | 4 |
public boolean dialogueModelsCached(int gender) {
int head = maleDialogue;
int hat = maleHat;
if (gender == 1) {
head = femaleDialogue;
hat = femaleHat;
}
if (head == -1) {
return true;
}
boolean flag = true;
if (!Model.isCached(head)) {
flag = false;
}
if (hat != -1 && !Model.isCached(h... | 5 |
public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... | 8 |
public void addWarnMessage(String message) {
Document docs = textArea.getDocument();
SimpleAttributeSet attrSet = new SimpleAttributeSet();
StyleConstants.setForeground(attrSet, Color.ORANGE);
try {
docs.insertString(docs.getLength(), "\r\n" + lineNumber++ + ":【警告】"
+ message, attrSet);
} catch (Bad... | 1 |
public void render(int xScroll, int yScroll, Renderer screen) {
screen.setOffset(xScroll, yScroll);
int x0, y0, x1, y1;
x0 = xScroll >> 4;
x1 = (xScroll + screen.width + 16) >> 4; //change to Sprite.SIZE in the future
y0 = yScroll >> 4;
y1 = (yScroll + screen.height + 16... | 5 |
private void handleMouseMoveAt(int xCoord, int yCoord) {
final int tileSizeInPixels = ModelManager.getInstance().getTileSizeInPixels();
final int oldSelectedX = selectedX;
final int oldSelectedY = selectedY;
if (coordinateBounds(xCoord, yCoord)) {
selectedX = getTileXByAbsolu... | 5 |
public Bid(String amount, Account Buyer) {
amountInt = amount;
buyerInt = Buyer;
} | 0 |
public StrungDocumentInfo(
String someString,
DocumentInfo someDocInfo
){
docInfo = someDocInfo;
string = someString;
} | 0 |
public void tableWrite(Prop p, StringBuilder sb1, StringBuilder sb2)
throws IOException {
switch (p) {
case single_Head:
sb1.append("<div id=\"wrap\"><div id=\"contents\"><h2>")
.append(nameArray[1].split("_\\(")[0])
.append(" 出演リスト</h2>");
sb2.append(
"<table border=\"1\" cellspacing=\"0\">... | 4 |
private void TimeLeft(Player player) {
if (_currentPhase.equals(Phase.Registration)) {
if (_registeredPlayers.size() < 2) {
_initialRegistrationDate = new Date();
player.sendMessage("You need more then 1 player before the countdown will start");
}
long secondsRemains = secondsLeft(_initialRegistrat... | 3 |
private static boolean isWhitespace(Token t) {
if (t.isCharacter()) {
String data = t.asCharacter().getData();
// todo: this checks more than spec - "\t", "\n", "\f", "\r", " "
for (int i = 0; i < data.length(); i++) {
char c = data.charAt(i);
... | 3 |
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{ boolean ok = false;
// Get data flavors being dragged
java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
// See if any of the flavors are a file ... | 7 |
public final void update(Level level, int x, int y, int z, Random rand) {
if(rand.nextInt(4) == 0) {
if(!level.isLit(x, y, z)) {
level.setTile(x, y, z, Block.DIRT.id);
} else {
for(int var9 = 0; var9 < 4; ++var9) {
int var6 = x + rand.nextInt(3) - 1;
... | 5 |
public final TLParser.elseIfStat_return elseIfStat() throws RecognitionException {
TLParser.elseIfStat_return retval = new TLParser.elseIfStat_return();
retval.start = input.LT(1);
Object root_0 = null;
Token Else67=null;
Token If68=null;
Token Do70=null;
TLPars... | 2 |
public final SymbolraetselASTParser.arith_return arith() throws RecognitionException {
SymbolraetselASTParser.arith_return retval = new SymbolraetselASTParser.arith_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token set2=null;
CommonTree set2_tree=null;
... | 3 |
public boolean move(int dx, int dy) {
Cell destination = this.landlord.getGridPanel().getGrid()[this.x + dx][this.y
+ dy];
if (destination instanceof Fence) {
this.destroy(dx, dy);
return true;
}
this.x = landlord.getX() + dx;
this.y = landlord.getY() + dy;
destination.occupy((Mob<? extends Mob>) ... | 2 |
protected Class determineClass(String name) throws Exception {
Class result;
if (name.equals(Boolean.TYPE.getName()))
result = Boolean.TYPE;
else
if (name.equals(Byte.TYPE.getName()))
result = Byte.TYPE;
else
if (name.equals(Character.TYPE.getName()))
... | 8 |
private void joinTokens(final CobolToken token) {
boolean codeToken = false;
CobolToken prevToken = null;
CobolType type = CobolType.UNDEFINED;
// Skips last (continuation), and comments and other non-code tokens.
int index = tokens.size() - 2;
while (index >= 0 && !cod... | 8 |
public static String checkFontSize(JTextPane pane)
{
AttributeSet attributes = pane.getInputAttributes();
if (attributes.isDefined(StyleConstants.FontSize))
{
return attributes.getAttribute(StyleConstants.FontSize).toString();
}
if (attributes.isDefined(CSS.Attribute.FONT_SIZE))
{
return attributes... | 2 |
@Override
public String validateIntruction() {
if(getOperand(0) == null || getOperand(1) == null){
return "Has no operand";
}
if(this.position == null){
return "Choose position";
}
if(getNextUnit() == null){
return "Choose next unit";
... | 4 |
public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... | 4 |
public DataOut deleteData(int index){
if(listDataOut != null)
return listDataOut.remove(index);
else return null;
} | 1 |
public static MarketClockField getFieldFromAbbreviation(String a)
{
for (MarketClockField field : MarketClockField.values())
{
if (field.toString().equals(a))
{
return field;
}
}
return null;
} | 2 |
private void initChildrens(ICPBrasilCertificate cert) {
if ((cert.getBasicConstraints() != null && !cert.getBasicConstraints().isCA()) || cert.getBasicConstraints() == null) {
return;
}
ICPBrasilCACertificate ca = (ICPBrasilCACertificate) cert;
try {
for (ICPBrasi... | 7 |
@Override
public Product readObject() throws IOException {
Product readObject = null ;
if(!connectionInStatus){
startInputConnection();
}
if(connectionInStatus){
try{
readObject = (Product)is.readObject();
}catch(EOFException ex){
return null;
} catch(ClassNotFoundException|IOException e ) ... | 4 |
private static void generateNumber(int[] lotto) {
for (int i = 0; i < lotto.length; i++) {
lotto[i] = (int) (Math.random() * 45 + 1);
for (int j = 0; j < i; j++) {
if (lotto[i] == lotto[j]) {
i--;
break;
}
}
}
} | 3 |
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PairNode pairNode = (PairNode) o;
return !(element != null ? !element.equals(pairNode.element) : pair... | 4 |
public void setForecast(String name, int forecast) throws IOException {
if (!order.isCurrentPlayer(pm.getPlayerWithName(name))) {
pm.sendErrorPacket(name, "It is not your turn!", ErrorReason.NOT_YOUR_TURN);
return;
}
if (stats.allForecastsMade()) {
pm.sendErro... | 4 |
public void menuSelected(MenuEvent arg0) {
// System.out.println("Selected menu items " + arg0);
for (Iterator i = menuItemHolder.iterator(); i.hasNext(); ) {
StructuredMenuItemHolder holder = (StructuredMenuItemHolder) i
.next();
Action action = hol... | 7 |
private boolean displayPlayAgain(String message, boolean win) {
int reply = JOptionPane.showConfirmDialog(null, message, message,
JOptionPane.YES_NO_OPTION);
if (reply == JOptionPane.YES_OPTION) {
resetTimer();
Player playerOne;
... | 7 |
public Patron getPatron(int cardNumber) throws SQLException {
openPatronsDatabase();
PreparedStatement statement = patronsConnection.prepareStatement(
"SELECT * FROM Patrons WHERE CardNumber = ?");
statement.setInt(1, cardNumber);
ResultSet resultSet = statement.executeQuery();
Patron result;
... | 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 static void encryptChallenge(byte[] challenge, String passwd) {
byte[] key = new byte[8];
for (int i = 0; i < 8 && i < passwd.length(); i++) {
key[i] = (byte)passwd.charAt(i);
}
DesCipher des = new DesCipher(key);
for (int j = 0; j < CHALLENGE_SIZE; j += 8)
des.encrypt(challenge... | 3 |
private void checkValue()
{
if (mvalue > mmax)
mvalue = mmax;
if (mvalue < mmin)
mvalue = mmin;
} | 2 |
public static void find(String s, int i) {
// 保存上一次的字符串
String temp = s;
//判断是否符合要求
if (s.length() == n) {
count++;
System.out.print(s + " ");
if (count % 10 == 0)
System.out.println();
return;
}
... | 3 |
public ArgSet fetchList() throws InputMismatchException {
if(!hasListArg()) {
throw new InputMismatchException("There are no list arguments to fetch from.");
} else {
String s = pop();
return new ArgSet(s.substring(1, s.length() - 1));
}
} | 1 |
public static void assign_position(Vector<AlignmentTriplet> triplets) {
for (AlignmentTriplet triplet : triplets) {
FlaggableCharacterString stream = triplet.getInputstream();
int pos = 0;
for (int i = 0; i < stream.size(); i++) {
FlaggableCharacter c = stream.charAt(i);
if (c.isFlagged()) {
... | 6 |
private boolean validWordLength(String[] words, String word, int length)
throws IOException {
String firstWord = words[0].trim().toLowerCase();
if (firstWord.equals(word)) {
if (words.length == length) {
return true;
} else {
throw new ... | 2 |
@Override
public boolean getUserMatchesPassword(String username, String password) {
boolean userMatchesPassword = false;
// Find an user record in the entity bean User, passing a primary key of
// username.
User user = emgr.find(entity.User.class, username);
// Determine whether the user exists and matches... | 2 |
@Override
public void run() {
do {
// Keep working on tasks
if(null != rateGuaranteedJob)
task = taskScheduler.nextTask(rateGuaranteedJob);
else
task = taskScheduler.nextTask();
if(null == task) {
addExclusiveJob(nu... | 8 |
@Override
public void mouseDragged(MouseEvent e) {
unprocessedEvents.add(e);
mouse = e.getPoint();
} | 0 |
void prune(File[] files) {
int size = 0;
for(File file : files) {
if(file.isFile() && !file.getName().equals("FAT")) {
size += file.length();
}
}
int cnt = 0;
int limit = Globals.getCacheLimit();
while(size > limit && cnt < files.length) {
File current = files[cnt++];
if(current.isFile()... | 7 |
public byte[] getPlainValue() {
return plainValue;
} | 0 |
static private String unicodeEncode(String word) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < word.length(); ++i) {
char ch = word.charAt(i);
if (ch >= '\u0080') {
String st = Integer.toHexString(0x10000 + (int) ch);
while (st.lengt... | 3 |
public String format(long logid, Map<String, ValueGenerator> generators, Map<String, String> staticParams) {
StringBuffer sb = new StringBuffer();
for (String token: tokens) {
if (isPlaceholder(token)) {
String key = token.substring(2, token.length() - 2);
String param = null;
if (key.contains(":")) ... | 7 |
public int read(int width) throws IOException {
if (width == 0) {
return 0;
}
if (width < 0 || width > 32) {
throw new IOException("Bad read width.");
}
int result = 0;
while (width > 0) {
if (this.available == 0) {
this... | 7 |
public void addWorkshopToSchedule(Workshop w){
Workshop workshop = w;
for(int i = 0; i < data.length; i++){
if(data[i][0].equals(workshop.getTime())){
if(day == 1 && workshop.getDate().equals(conference.getStartDate())){
data[i][1] = w.getTitle();
}else if(day == 2 && workshop.getDate().equals(confe... | 6 |
public final void setQuestion(Question question) {
String answerString = "";
ArrayList<String> order = new ArrayList<>();
order.add(question.getCorrectAnswer());
order.add(question.getOtherAnswers()[0]);
order.add(question.getOtherAnswers()[1]);
order.add(question.getOthe... | 6 |
public String getClientID() {
return clientID;
} | 0 |
public void itemStateChanged(ItemEvent e) {
if (e.getSource() == comboLaser1 || e.getSource() == comboLaser2){
if(("" + comboLaser1.getSelectedItem()).compareTo("Wavelength L1") != 0 && ("" + comboLaser2.getSelectedItem()).compareTo("Wavelength L2") != 0){
System.out.println("" + comboLaser1.getSelecte... | 8 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Answer)) return false;
Answer answer = (Answer) o;
if (isCorrect != null ? !isCorrect.equals(answer.isCorrect) : answer.isCorrect != null) return false;
if (text != null ? !text.equal... | 6 |
private static void printWords(Map<String, List<GridPosition>> foundWords) {
Set<String> words = foundWords.keySet();
for ( String word : words) {
List<GridPosition> path = foundWords.get(word);
StringBuilder sb = new StringBuilder();
for ( GridPosition position : path){
sb.append(position.toString());... | 2 |
@Override
public Cible postCible(Cible c) throws JSONException, BadResponseException {
Representation r = new JsonRepresentation(c.toJSON());
r = serv.postResource("intervention/" + interId + "/cible", c.getUniqueID(), r);
Cible cible = null;
try {
cible = new Cible(new JsonRepresentation(r).getJsonObjec... | 2 |
public void start()
{
worker = new Thread()
{
// necessary to count frames per secound
long fpsCounter = 0;
long timeCounter = 0;
@Override
public void run()
{
while (!... | 4 |
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.