text stringlengths 14 410k | label int32 0 9 |
|---|---|
public ArrayList<Integer> preorderTraversal(treeNode root) {
ArrayList<Integer> valsInPreOrder = new ArrayList<Integer>();
Stack<treeNode> nodesInPreOrder = new Stack<treeNode>();
if (root == null)
return valsInPreOrder;
// push root in to begin with
nodesInPreOrder.push(root);
// for each node in sta... | 4 |
public void onClicked(Interactable i)
{
if(clicked < clicks)
{
i.hide();
Interactable i2 = getInteractable(new Location(i.getX(), i.getY() - maze.getyWallScale()));
if(i2!=null)
{
i2.hide();
map[i2.getX()/i2.getWidth()][i2.getY()/i2.getHeight()] = 1;
}
i2 = getInteractable(new Location... | 5 |
private void onClickLogin(){
MySession sess = (MySession)getSession();
// -------------------
// ユーザ名
// -------------------
String username = _openidname.getModelObjectAsString();
// -------------------
// コンシューマ名
// -------------------
SelectOption op = (SelectOption)_openidprovider.getModelO... | 8 |
@Override
public void run()
{
long lastT = 0;
while(true)
{
if(lastT != file.lastModified())
{
try
{
List<String> lines = Files.readAllLines(file.toPath(), Charset.defaultCharset());
... | 6 |
void output( int code, OutputStream outs ) throws IOException
{
cur_accum &= masks[cur_bits];
if ( cur_bits > 0 )
cur_accum |= ( code << cur_bits );
else
cur_accum = code;
cur_bits += n_bits;
while ( cur_bits >= 8 )
... | 8 |
public boolean isFree(int gridX,int gridY){
switch(Screen.land[gridY][gridX]){
//all the solids:
case 1:
case 2:
case 3:
case 4:
case 8:
return false;
}
return true;
} | 5 |
private TagPos findTag(String tagName) {
if (tagName != null) {
ListIterator<TagPos> it = list.listIterator(list.size());
String fatalTag = null;
TagInfo fatalInfo = getTagInfoProvider().getTagInfo(tagName);
if (fatalInfo != null) {
... | 6 |
@SuppressWarnings("resource")
public static void copy(File src, File dest) throws IOException {
if (!src.exists()) return;
if (!dest.exists()) dest.mkdir();
for (File f : src.listFiles()) {
File target = new File(dest, f.getName());
if (f.isDirectory()) copy(f, target);
if (f.isFile()) {
FileChannel... | 5 |
private PDestination(String whereTo) {
label = whereTo;
} | 0 |
private void bindJNDIConfig(EnvConfigBean envConfig, Document document)
{
NodeList jndiNodes = document.getElementsByTagName("jndi");
if(null != jndiNodes && jndiNodes.getLength() > 0)
{
Node node = jndiNodes.item(0);
NodeList jndiProps = node.getChildNodes();
... | 8 |
public static void setNimbus() {
/* 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://download.ora... | 6 |
public static Stella_Object generateOneVariable(PatternVariable self, boolean typedP) {
{ Stella_Object value = null;
if (((Justification)(Logic.$CURRENTJUSTIFICATION$.get())) != null) {
value = Logic.justificationArgumentBoundTo(self, null);
}
if (value == null) {
value = Logic.s... | 6 |
public void move(int spot, char symbol) {
switch (spot) {
case 1 : field[0][0] = symbol;
break;
case 2 : field[0][1] = symbol;
break;
case 3 : field[0][2] = symbol;
break;
case 4 : field[1][0] = symbol;
... | 9 |
public String getNick() {
int i = prefix.indexOf('!');
if (i != -1 || (i = prefix.indexOf('@')) != -1)
return prefix.substring(0, i);
return (prefix.length() != 0) ? prefix : null;
} | 3 |
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Room1)) {
return false;
}
Room1 other = (Room1) object;
if ((this.id == null && other.id != null) || (this.id !... | 5 |
@Override
public void focusLost(FocusEvent e) {
handleUpdate();
} | 0 |
@Override
public void setPricing(Character productCode, int productQuantity, float productPackPrice) {
Product product = null;
product = this.locateProductByCode(productCode);
if (product==null) {
product = new Product(productCode);
product.writePriceForQuantity(productQuantity, BigDecimal.valueOf(product... | 1 |
public void dropFlagOnAdjacentPosition(Position position) {
if (position == null)
throw new IllegalArgumentException("The given arguments are invalid!");
final PlayerFlag inventoryFlag = getInventory().findFlag();
if (inventoryFlag != null) {
List<Position> positionsAroundPlayer = getGrid().getPositions... | 2 |
@Override
public void mouseDragged(MouseEvent event) {
if (pos == -1)
return;
/*Point loc = getLocation();
displacement = event.getPoint();
points[1].setRect(points[1].getX()-displacement.x,points[1].getY()-displacement.y,points[1].getWidth(),points[1].getHeight());*/
... | 1 |
private void uploadSkinFile(String url) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httppost = new HttpPost(url);
FileBody skin = new FileBody(skinFile);
StringBody user = new StringBody(this.username, ContentType.T... | 2 |
public FirstFollowTable(Grammar grammar) {
super(new FirstFollowModel(grammar));
model = (FirstFollowModel) getModel();
getColumnModel().getColumn(1).setCellRenderer(RENDERER);
getColumnModel().getColumn(2).setCellRenderer(RENDERER);
setCellSelectionEnabled(true);
} | 0 |
public void reload() {
try {
this.yml.save(configFile);
this.yml.load(configFile);
} catch (Exception e) {
System.out.println("[BurningCS] Could not read config file!");
e.printStackTrace();
}
} | 1 |
public static void main(String[] args) throws Exception
{
final SwingTerminal swingTerminal = new SwingTerminal();
final GUIScreen guiScreen = new GUIScreen(new Screen(swingTerminal));
guiScreen.getScreen().startScreen();
final Window window1 = new Window("Palette Switcher");
... | 3 |
public Coordinate move( Move move )
{
Coordinate jumped = null;
int jumpedPiece = 0;
int movePiece = 0;
//makes sure the move is valid
if( isValidCoordinate( move.getStart( ) ) &&
isValidCoordinate( move.getEnd( ) ) &&
!isEmpty( move.getStart( ) ) &&
isEmpty( move.getEnd( ) ) )
{
/... | 7 |
public String stComposeEmailForOutlookEmailService(int dataId,int ExpVal,String flow )
{
int actVal=1000;
String returnVal=null;
hm.clear();
hm=STFunctionLibrary.stMakeData(dataId, "ExternalEmail");
String to = hm.get("To");
String subject = hm.get("Subject");
String message = hm.get("Message... | 6 |
public static void main(String[] args) throws UnsupportedEncodingException {
Map<String, Double> orderList = new HashMap<String, Double>();
double result = 0;
try {
Scanner fileScanner = new Scanner(new File("input.txt"));
while(fileScanner.hasNext()){
String[] tokens = fileScanner.nextLine().split("\\s... | 5 |
public SpikeCollection getRandom(int numberOfRandomSpikesToAnalyse) {
SpikeCollection randomSpikes = new SpikeCollection();
RandomDataImpl generator = new RandomDataImpl();
// find total number of spikes
int total = 0;
for (SingleASspikes asSpikes : allUpdates.values()) {
total = total + asSpikes.getNum... | 7 |
public static void main(String[] args)
{
AddStrategy addStrategy = new AddStrategy();
Environment environment = new Environment(addStrategy);
System.out.println(environment.calculate(3, 4));
SubStrategy subtractStrategy = new SubStrategy();
environment.setStrategy(subtractStrategy);
System.out.println... | 0 |
public short getId() {
return id;
} | 0 |
private Object invoke(Object thiz, String name, Object... args)
throws ScriptException, NoSuchMethodException {
Context cx = enterContext();
try {
if (name == null) {
throw new NullPointerException("method name is null");
}
if (thiz != nul... | 9 |
ArrayList<ArrayList<Integer>> permuteUnit(int[] num, int[] pre, int[] post,
ArrayList<ArrayList<Integer>> permutation) {
// base case
if (pre.length == num.length) {
ArrayList<Integer> unit = new ArrayList<Integer>();
for (int i = 0; i < pre.length; i++) {
unit.add(pre[i]);
}
permutation.add(uni... | 6 |
public ArrayList<ArrayList<String>> splitString(String input) {
sentence = input;
ArrayList<String> sentenceArray, tokenizedSentence = new ArrayList<>(), charIdentifier = new ArrayList<>();
// splits sentence into single words at spaces
// Note: will also bring punctuation with word (if applic... | 8 |
public static void ChooseNan ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Nan";
Game.CharacterOneHP = CharacterStats.NanHP;
Game.CharacterOneAttack = CharacterStats.NanAttack;
Game.CharacterOneMana = CharacterStats.NanMana;
Game.CharacterOneRegen = CharacterStats.NanRegen;
... | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=getAnyTarget(mob,commands,givenTarget,Wearable.FILTER_UNWORNONLY);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;... | 8 |
@SuppressWarnings("CallToThreadDumpStack")
private void miFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miFornecedorActionPerformed
if (getCadFornecedor() != null && !cadFornecedor.isVisible()) {
deskPane.remove(getCadFornecedor());
setCadFornecedor(nul... | 4 |
@Override
public boolean resetDeckBackTo52Cards()
{
if((cardsCache==null)||(cardsCache.size()==0))
return false;
// first retreive all our cards by looping
// through our cached list. If we already
// have a card, make sure its faced-down
for(int i=0;i<cardsCache.size();i++)
{
final PlayingCard ca... | 8 |
public List<Section> parseData(String[] cleanedTimetable)
{
Section currentSection;
List<Section> sectionList = new LinkedList<Section>();
int index = 0;
int nextCRNIndex;
//parse sections
//while there is another section
while ((index = nextCRN(cleanedTimet... | 5 |
public Tweet(final Status tweet) {
setBorder(new LineBorder(Color.CYAN, 2));
setLayout(new BorderLayout(0, 0));
JTextArea txtrYourTweet = new JTextArea();
txtrYourTweet.setText(tweet.getText());
add(txtrYourTweet);
JPanel panel = new JPanel();
add(panel, BorderLayout.SOUTH);
JButton btnNewButton = ne... | 4 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (x == null) {
if (other.x != null)
return false;
} else if (!x.equals(other.x))
return false;
if (y =... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Category other = (Category) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
retur... | 6 |
private void skipCommon() {
char ch = jsonStr.charAt(++index);
if (ch == '/') {
for (index++; index < length; index++) {
ch = jsonStr.charAt(index);
if (ch == '\n' || ch == '\r') {
break;
}
}
} else if (c... | 9 |
private static <T> Letter<?> createRandomLetter(Inhabitant senderI,
Inhabitant receiverI) {
Random rand = new Random();
Letter<?> letter;
Random rand2 = new Random();
switch (rand.nextInt(5)) {
case 0:
letter = new PromissoryNote(senderI, receiverI, new Money(
rand2.nextInt(100)));
break;
case... | 7 |
public int getMax(int start, int end) {
if (this.start == start && this.end == end)
return maxVal;
int mid = (this.start + this.end) / 2;
if (start <= mid && end <= mid)
return left.getMax(start, end);
if (start > mid && end > mid)
return right.getMax(start, end);
return Math.max(left.getMax(start, m... | 6 |
public void pickCode() {
codeNum1 = (int) (Math.random()*10);
do {
codeNum2 = (int) (Math.random()*10);
} while (codeNum2==codeNum1);
do {
codeNum3 = (int) (Math.random()*10);
} while ((codeNum3==codeNum1)||(codeNum3==codeNum2));
do {
codeNum4 = (int) (Math.random()*10);
} while ((codeNum4==codeN... | 6 |
public void saveExpression(String fileName, String expression) {
if (!fileName.contains(".txt")) {
fileName += ".txt";
}
FileWriter writer = null;
try {
writer = new FileWriter(fileName);
PrintWriter fout = new PrintWriter(writer);
fout.printf(expression,(Object) null);
} catch (IOException e) {
... | 3 |
public static String mySqlStringLiteral(String value) {
StringBuilder sql = new StringBuilder();
sql.append('\'');
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
switch (c) {
case '\0':
sql.append("\\0");
... | 8 |
public MapleAlliance(MapleClient c, int id) {
guilds = new ArrayList<MapleGuild>();
this.id = id;
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM alliances WHERE id = ? ");
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
... | 8 |
public void repaintCommon() {
if(activeTrayIcon.isSelected()) {
windowActionBox.setEnabled(true);
windowClosing.setEnabled(true);
}
else {
windowActionBox.setEnabled(false);
windowClosing.setEnabled(false);
//set status: close when click on x
windowActionBox.setSelectedIndex(1);
}
if(useA... | 3 |
public void add (Object answer){
Integer answerInstances = answers.get(answer);
answerInstances = answerInstances==null?0:answerInstances;
answers.put(answer, answerInstances+1);
} | 1 |
private ArrayList<PiezaArqueologica> generarLista(int civilizacion)
{
ArrayList<PiezaArqueologica> milistaObjetos=new ArrayList<>();
PiezaArqueologica artefacto;
try
{
FileInputStream fstream = new FileInputStream("items.txt");
DataInputStream e... | 4 |
void playSound(int intSFX,int intLocX, int intLocY)
{
int i,
i2,
i3;
DuskObject objStore;
LivingThing thnStore;
i=0;
intLocX = intLocX-viewrange;
intLocY = intLocY-viewrange;
if (intLocX<0)
{
i = -1*(intLocX);
}
i2=0;
if (intLocY<0)
{
i2 = -1*(intLocY);... | 9 |
public void shiftIndex(int lessThan, int delta) {
int size = info.length;
for (int i = 2; i < size; i += 10){
int org = ByteArray.readU16bit(info, i + 8);
if (org >= lessThan)
ByteArray.write16bit(org + delta, info, i + 8);
}
} | 2 |
public void move(int pX, int pY)
{
if(alive)
{
if(pY < row)
super.move(NORTH);
else if(pY > row)
super.move(SOUTH);
if(pX < column)
super.move(WEST);
else if(pX > column)
super.move(EAST);
}
} | 5 |
public int hashCode() {
int lHashCode = 0;
if ( this.getCod_Jornada() != null ) {
lHashCode += this.getCod_Jornada().hashCode();
}
if ( this.getCod_Competicao() != null ) {
lHashCode += this.getCod_Competicao().hashCode();
}
if ( lHashCode == 0 ) {
lHashCode = super.hashCode();
}
return lHas... | 3 |
public static void update() {
mouseScroll = 0;
if(canvas != null && canvas.getMousePosition() != null)
mousePoint = canvas.getMousePosition();
for(int i = 0; i < 3; i++) {
if(mouseEvents[i] == TYPE_RELEASED)
mouseEvents[i] = TYPE_NONE;
if(mouseEvents[i] == TYPE_PRESSED)
mouseEvents[i] ... | 8 |
public static GrammarTreeMonitor getGrammarTreeBySentenceKeyWord(
String value) {
if (value == null || value.length() < 1) {
return null;
}
String monitorName = value.toLowerCase();
monitorName = packageName + "."
+ monitorName.substring(0, 1).toUpperCase()
+ monitorName.substring(1) + "WordMonito... | 6 |
private void dropIndex(String sql, StringTokenizer tokenizer) throws Exception {
try {
//get index name
String idxName = tokenizer.nextToken();
// Check for the semicolon
String tok = tokenizer.nextToken();
if (! ";".equalsIgnoreCase(tok)) {
throw new NoSuchElementException();
}
// Ch... | 8 |
private void closeClientSocket() {
try {
this.clientSocket.close();
this.log.info("close client Socket " + this.clientSocket.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
this.log.info("close client Socket: fail");
}
} | 1 |
public boolean isAllPlayersFullyAsleep() {
if (this.allPlayersSleeping && !this.multiplayerWorld) {
Iterator var1 = this.playerEntities.iterator();
EntityPlayer var2;
do {
if (!var1.hasNext()) {
return true;
}
... | 4 |
public void disconnect()
{
try
{
if(out != null)
out.close();
if(in != null)
in.close();
if(socket != null)
socket.close();
if(ssl_socket != null)
ssl_socket.close();
}
catch(IOException e)
{
}
out = null;
in = null;
socket =... | 5 |
@Override
public DamageReport hit(double damage, Class<? extends Tower> towerClass) {
if(!alive) {
return null;
}
damage *= calculateMultiTowerBonus(towerClass);
double adjustedDamage = damage;
if(adjustedDamageTicksLeft > 0) {
adjustedDamage *= damageMultiplier;
... | 9 |
@Override
public void run() {
while (cont) {
try {
Thread.sleep(100);
rotateTicker();
this.repaint();
} catch (InterruptedException e) {
e.printStackTrace();
}
synchronized (this) {
if (!isShowing()) {
cont = false;
}
}
}
} | 3 |
@Override
public UrlPair generateShortUrl(String longUrl) throws GenerateShortUrlFailureException {
if (longUrl == null || longUrl.length() == 0) {
throw new IllegalArgumentException("[generateShortUrl] longUrl is empty.");
}
/* If the UrlPair of the given longUrl has already existed, return it directly. */
... | 9 |
private boolean modificaUsuario(HttpServletRequest request, HttpServletResponse response) {
String nombre = request.getParameter("nombre");
String apellidos = request.getParameter("apellidos");
String dni = request.getParameter("dni");
String direccion = request.getParameter("direccion")... | 5 |
@Override
public void tick(EnemyWave allEnemies) {
super.tick(allEnemies);
//send action to all objects
for (Placeable obj : getPlacablesWithinRangeOfThisTower()) {
if (!obj.equals(this)) {
for (GameAction currentAction : getGameActions()) {
i... | 4 |
private BufferedImage getCroppedImage( String innerPath, int x, int y, int w, int h) {
Rectangle keyRect = new Rectangle( x, y, w, h );
BufferedImage result = null;
HashMap<Rectangle, BufferedImage> cacheMap = cachedImages.get(innerPath);
if ( cacheMap != null ) result = cacheMap.get(keyRect);
if (result != n... | 8 |
public Parameter getLiblinearParameters() throws MaltChainedException {
Parameter param = new Parameter(SolverType.MCSVM_CS, 0.1, 0.1);
String type = liblinearOptions.get("s");
if (type.equals("0")) {
param.setSolverType(SolverType.L2R_LR);
} else if (type.equals("1")) {
param.setSolverType(SolverType.... | 9 |
public static final boolean AABB_AABB(Box a, Box b) {
return b.x <= a.getXMax()
&& b.getXMax() >= a.x
&& b.y <= a.getYMax()
&& b.getYMax() >= a.y;
} | 3 |
public java.net.Socket openSocket(int socketId) throws IOException {
if (Signlink.mainapp != null) {
return Signlink.opensocket(socketId);
} else {
return new java.net.Socket(InetAddress.getByName(getCodeBase().getHost()), socketId);
}
} | 1 |
public void setLocale(Locale locale)
{
if (locale == null || isCommitted())
return;
_locale = locale;
setHeader(HttpFields.__ContentLanguage,locale.toString().replace('_','-'));
if (this._outputState==0)
{
/* get current MIM... | 9 |
private void updateClient()
{
try
{
if(Long.parseLong(txtPhoneNo.getText()) != _client.getPhoneNo())
{
if(_cliCtrl.getClientByPhone(Long.parseLong(txtPhoneNo.getText())) != null)
{
throw new Exception();
}
}
}
catch (Exception e)
{
... | 4 |
public static String full2HalfChange(String QJstr) throws Exception {
StringBuffer outStrBuf = new StringBuffer("");
String Tstr = "";
byte[] b = null;
for (int i = 0; i < QJstr.length(); i++) {
Tstr = QJstr.substring(i, i + 1);
// 全角空格转换成半角空格
if (Tst... | 3 |
public synchronized void endThreadAccess() {
Object requestingUser = Thread.currentThread();
if (m_oCurrentUser == null) {
this.notifyAll();
} else if (m_oCurrentUser == requestingUser) {
m_oCurrentUser = null;
this.notifyAll();
} else { // Some other ... | 3 |
public double[][] form() {
//muodostaa alkutilanteen mukaisen 2D-arrayn
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
initialGrid[i][j] = tempInitial;
if (i == 0) {
initialGrid[i][j] = tempUp;
} else i... | 6 |
public void writeTermsToFile(String strNumber,
Hashtable<String, Double> oTermVsTFIDF) throws IOException {
String strKey = null;
Double maxValue = Double.MIN_VALUE;
String strTerms = "";
int len = oTermVsTFIDF.size() < 5 ? oTermVsTFIDF.size() : 5;
for (int i = 0; i < len; ++i) {
for (Map.Entry<String,... | 7 |
public void setExpLogica(PExpLogica node)
{
if(this._expLogica_ != null)
{
this._expLogica_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.par... | 3 |
public boolean metodoCompare(Pessoa u ){
{
if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome())
&& this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha())
&&this.instituicao.equals(getInstituicao())){
return true;
}
return false;
}
} | 5 |
public void collect()
{
if ( scannerData == null)
return ;
Vector fileList = scannerData.getFileList() ;
fileList.clear() ;
File file = new File( scannerData.getSourcePath() ) ;
if ( file.exists() )
{
Stack stack = new Stack() ;
stack.push( file ) ;
while ( !stack.e... | 7 |
private static BPRMF getBprmf(CommandLine cmd) {
BPRMF bprmf = new BPRMF();
String learnRate = cmd.getOptionValue(CommandLineOptions.LEARNRATE);
if (learnRate != null) {
bprmf.setLearnRate(Float.parseFloat(learnRate));
}
String iters = cmd.getOptionValue(CommandLine... | 8 |
public String getRHS() {
return myRHS;
} | 0 |
public static Cons optimizeOrderOfApplicableRules(Cons rules, boolean tailP) {
{ Cons cursor = rules;
Cons result = Stella.NIL;
Description antecedent = null;
int antecedentindex = (tailP ? 0 : 1);
if (rules.rest == Stella.NIL) {
return (rules);
}
{ int i = Stella.NULL_I... | 6 |
public List<VcfLof> parseLof() {
String lofStr = getInfo(LossOfFunction.VCF_INFO_LOF_NAME);
ArrayList<VcfLof> lofList = new ArrayList<VcfLof>();
if (lofStr == null || lofStr.isEmpty()) return lofList;
// Split comma separated list
String lofs[] = lofStr.split(",");
for (String lof : lofs)
lofList.add(n... | 3 |
protected void assertEquals(String tekst, Object verwacht, Object werkelijk) {
boolean gelijk;
if (verwacht == null) {
gelijk = werkelijk == null;
} else {
gelijk = werkelijk != null && verwacht.equals(werkelijk);
}
if (! gelijk) {
if (! isPrin... | 4 |
public static boolean validateTimeZone(double timeZone)
{
int MIN_GMT = -12;
int MAX_GMT = 13;
if (timeZone < MIN_GMT || timeZone > MAX_GMT) {
return false;
}
double decimal = timeZone - (int) timeZone;
if (decimal >= 0.60) {
return false;
... | 3 |
public void drawBasicString(String string, int x, int y, int color) {
if (string == null) {
return;
}
y -= baseHeight;
for (int index = 0; index < string.length(); index++) {
char c = string.charAt(index);
if (c != ' ') {
drawCharacter(characterPixels[c], x + characterOffsetX[c], y + characterOffse... | 3 |
@Override
public void deserialize(Buffer buf) {
presetId = buf.readByte();
if (presetId < 0)
throw new RuntimeException("Forbidden value on presetId = " + presetId + ", it doesn't respect the following condition : presetId < 0");
code = buf.readByte();
if (code < 0)
... | 3 |
@SuppressWarnings("unchecked")
private void collectCourseChanges(CourseModel model, ArrayList<Change> list) {
// Copy list and prune
ArrayList<HashMap<String, Object>> newCourses = new ArrayList<HashMap<String, Object>>();
for (Object c : courses)
newCourses.add((HashMap<String, Object>) c);
for (CourseRec... | 9 |
@Override
public Class getColumnClass(int columnIndex) {
if (columnIndex == 0) {
return Person.class;
} else if (columnIndex == 1 || columnIndex == 3) {
return Integer.class;
}
return String.class;
} | 3 |
private void playerStatusAction(Player user, PlayerStatusData actionData) {
switch(actionData.getStatus()) {
case GIVEUP:
removePlayer(user, actionData);
break;
case FINANCIAL:
for(Thread thread : actions.get(actionData.getUserId()).values()) {
synchronized(thread) {
if(thread.getState() ... | 4 |
public static void spawnHellSkeleton (Location loc, int amount) {
int i = 0;
while (i < amount) {
Skeleton HS = (Skeleton) loc.getWorld().spawnEntity(loc,
EntityType.SKELETON);
LeatherArmorMeta legMeta;
ItemStack HSLeg = new ItemStack(Material.LEAT... | 1 |
public static boolean isProperYoutubeChannel(String channelName) {
try {
URL url = new URL("http://gdata.youtube.com/feeds/base/users/" + channelName + "/uploads");
BufferedReader in = new BufferedReader(
new InputStreamReader(url.openStream()));
String i... | 4 |
public final void setV(final V v) { this.v = v; } | 0 |
public boolean write(aos.apib.OutStream out, aos.apib.Base o) {
HeartBeatTimer v = (HeartBeatTimer)o;
int i = -1;
while ((i = out.nextField(i, this)) >= 0) {
switch (i) {
case 0:
out.putInt(v.peerID, i, __def.peerID, this);
break;
case 1:
out.putInt(v.upload, i, __def.upload, this)... | 7 |
public boolean remove(Object o) {
if (o == null) {
for (int i = 0; i < size; i++) {
if (taulu[i] == null) {
int numMoved = size - i - 1;
if (numMoved > 0) {
System.arraycopy(taulu, i + 1, taulu, i, numMoved);
... | 7 |
public static CanvasMouse getInstance(Component component) {
if (instance == null)
instance = new CanvasMouse(component);
return instance;
} | 1 |
public static boolean idInArr(String[] param, String id)
{
boolean result = false;
if ((param != null) && (param.length > 0) && (!isEmpty(id))) {
int i = 0; for (int len = param.length; i < len; i++) {
if (id.equals(param[i]) == true) {
result = true;
break;
}
}... | 5 |
private static String executeRemoveCommand(DataBaseManager dbManager, Command command) {
List<String> args = command.getArgs();
String tableName = args.get(0);
String key = args.get(1);
String msg = "";
try {
boolean modified = dbManager.removeByKey(tableName, key);... | 4 |
public static void main(String[] args) {
String series = "73167176531330624919225119674426574742355349194934"
+ "96983520312774506326239578318016984801869478851843"
+ "85861560789112949495459501737958331952853208805511"
+ "12540698747158523863050715693290963295227443043557"
+ "668966489504452445231617... | 2 |
private void updateWorkerDay(ACTION action, String imsi, long startTime, Set days) {
int oldSize = days.size();
switch (action) {
case ADD:
days.add(startTime);
break;
case REMOVE:
days.remove(startTime);
break;
... | 8 |
@Override
public String toString() {
String result = getName() + ", average=" + getAverage()
+ ", " + getProgram() + ", " + getDegree() + ", ";
if (this.universityOne != null)
result += this.universityOne + "-" + (this.universityOneAccept ? "admitted" : "rejected") ;
if (this.universityTwo != null) ... | 6 |
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.