text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void check() {
for (RandomEvent rand : getHandlers()) {
rand.getContext().setAccount(ctx.getBot().getLastAccount());
if (!ctx.getBot().isScriptStackEmpty() && ctx.getBot().peekScript() != rand && rand.init()) {
ctx.getBot().pushScript(rand, true, ctx.getBot().getLastAccount());
return;
}
}
... | 4 |
public String getPIDByLocation(Statement statement,String city,String district,String parkname)//根据地点获取PID
{
String result = null;
sql = "select PID from Park where city = '" + city +"' and district = '"+district+"' and parkname = '"+parkname+"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while ... | 2 |
@Override
public void update() {
if (KeyHandler.isValidationKeyPressed())
select();
if (KeyHandler.isPressed(KeyHandler.UP)) {
currentChoice--;
if (currentChoice == -1)
currentChoice = options.length - 1;
}
if (KeyHandler.isPressed(KeyHandler.DOWN)) {
currentChoice++;
if (currentChoice ==... | 5 |
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (debug) {
log("FiltradoSesion:doFilter()");
}
doBeforeProcessing(request, response);
HttpServletResponse hsr = (HttpS... | 1 |
public String pokazSzczegoly() {
pokazOsobe = osoby.getRowData();
return "szczegoly";
} | 0 |
public void run() {
int actPage = minPage;
while (actPage <= maxPage)
{
try
{
beginTransaction();
Client.sleep(1000);
write("Erster Eintrag Für Transaction " + currentTa.getTaId(),
actPage);
actPage++;
Client.sleep(1500);
write("Zweiter Eintrag Für Transaction " + currentTa.... | 2 |
@Override
protected void doAction(int option)
{
switch (option)
{
case 1:
viewSchedule();
break;
case 2:
matchResults();
break;
case 3:
scheduleMatch();
break;
... | 4 |
private void process() {
if (!GuiUtils.validUserKeyField(userKeyTextField)) {
return;
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
GuiUtils.getUserTests(testIdComboBox, mainPanel, cloudPanel, userKeyTextField.getT... | 1 |
private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_... | 9 |
@Override
public String generateCode() {
if (constant != null)
return constant.generateCode();
else if (expression != null)
return expression.generateCode();
if (id != null) {
List<Integer> dimensions = getVariable(id).getType().getDimensions();
if (dimensions != null)
lVal... | 5 |
private final void parseDispatchTable(ParseUtil.IndentableLexer lexer) throws IOException,
RuntimeException {
lexer.skipSpaces();
lexer.pass('(');
lexer.skipSpaces();
dispatchSuboffset = lexer.readUnsignedInteger("dispatch suboffset");
lexer.skipSpaces();
lexe... | 8 |
public void actionPerformed(ActionEvent e)
{
if (Integer.parseInt(e.getActionCommand()) == E5Actions.FORWARD)
{
currentItem++;
}
else if (Integer.parseInt(e.getActionCommand()) == E5Actions.BACKWARD)
{
currentItem--;
}
changePanel();
} | 2 |
protected void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
HttpSession session = req.getSession(true);
int uid = (int)((User)session.getAttribute("currentSessionUser")).getId();
List<Order> cart;
try {
cart = OrderDAO.list(uid);
//HashMap<Product,In... | 4 |
long alphaBeta(Board board, long limit, long alpha, long beta) {
long result;
//last 1 turn -> evaluate + flip count (not exec board.put)
if (board.getTurn() == Board.MAX_TURNS - 1) {
CopyOnWriteArraySet<Disc> movables = board.getMovablePos();
if (!movables.isEmpty()) {
Disc disc = (Dis... | 7 |
public static void parse(final PgDatabase database,
final String statement, final boolean outputIgnoredStatements) {
final Parser parser = new Parser(statement);
parser.expect("ALTER", "VIEW");
final String viewName = parser.parseIdentifier();
final String schemaName = Parse... | 8 |
public JTextField getRech() {
return rech;
} | 0 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = null;
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("username");
String password = request.getParameter("passw... | 9 |
public ArgsParser(String[] args) {
for (int i = 2; i < args.length; i++) {
switch (args[i]) {
case "-v":
isNeedTime = true;
break;
case "-w":
isNeedNumberWords = true;
break;
... | 5 |
public String toString(){
String str = "\n -------- \n";
str += "Festival name: " + name + "\n";
str += "Date of festival " + date + "\n";
str += "Runs from " + startTime + " to " + endTime + "\n";
if(stages.isEmpty())
str += "No stages made. \n";
else
for(Stage s : stages){
str += s.toString();
... | 6 |
@Override
public void drawRect(int fbo, int texId, BlendMode mode, double startX,
double startY, double endX, double endY, double texStartX,
double texStartY, double texEndX, double texEndY, Color c,
double transparency) {
bindRenderTarget(fbo);
glColor4f((float) c.getRed(), (float) c.getGreen(),
(fl... | 3 |
public Dado buscaDado(String label) {
Dado dadoResultado = null;
for (Dado d : listaDados) {
if (d.getName().equals(label)) {
dadoResultado = d;
}
}
return dadoResultado;
} | 2 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
return Arrays.deepEquals(m, ((Matrix) obj).m);
} | 3 |
public void generate(JFormatter f) {
if (isConstructor && type.isArray()) {
// [RESULT] new T[]{arg1,arg2,arg3,...};
f.p("new").g(type).p('{');
} else {
if (isConstructor)
f.p("new").g(type).p('(');
else {
String name = this... | 9 |
public void resetVisibility(){
if(supportBackgroundPalette){
for(int i=0;i< maxBackgroundPaletteSize;i++){
if(i < visibleBackgroundPaletteSize){
imagePalette[i].setVisible(true);
} else {
imagePalette[i].setVisible(false);
... | 6 |
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
// Save parameters from storm
this.conf = conf;
this.context = context;
this.collector = collector;
// get cursor, where we left of, for this executor
// get this task id
... | 8 |
public void run() {
try
{
String edge_id = ControllerEngine.gdb.getResourceEdgeId(resource_id, inode_id);
if(edge_id != null)
{
String pnode_node_id = ControllerEngine.gdb.getIsAssignedParam(edge_id, "out");
if(pnode_node_id != null)
{
pnode_node_id = pnod... | 9 |
private boolean jj_2_78(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_78(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(77, xla); }
} | 1 |
public static byte[] encrypt(byte[] message, int k) throws Exception {
byte[] ps = new byte[k - message.length - 3];
new Random().nextBytes(ps);
for (int i = 0; i < ps.length; i++)
if (ps[i] == 0x00) ps[i] = (byte) 0x01;
byte[] encoded_message = new byte[message.length + ps.l... | 4 |
private static Entry mergeLists(Entry one, Entry two) {
/* There are four cases depending on whether the lists are null or not.
* We consider each separately.
*/
if (one == null && two == null) { // Both null, resulting list is null.
return null;
} else if (one != n... | 7 |
public boolean processa(String string){
this.string = string;
QuantidadeChars = this.string.length();
for (int n = 0; n < QuantidadeChars; n++){
//logic to process each char
switch (EstadoAtual) {
case "q0":
if (this.string.charAt(n) ==... | 9 |
@Override
public void mousePressed(MouseEvent e)
{
Object sender = e.getSource();
if (sender == _redPrimeButton)
{
tryToPrime(_redPrimeButton, _game.getRedLauncher());
_fireButton.setOn(_game.isPrimed());
}
els... | 7 |
public static void clearComment(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree);
JoeNodeList nodeList = tree.getSelectedNodes();
for (int i = 0, limit = nodeList.size(); i < limit; i++) {
clearCommentForSingl... | 3 |
public static void sellStock(String uid, String id, int amount) {
/* May be add IF loop here with canSell to handle the condition here */
int currAmount = stocks.get(id);
UserStorageAccess xmlAccessor = new UserStorageAccess();
Stock currentStock = StockControl.queryStock(id)... | 2 |
public String toString() {
return String.format("%02d:%02d:%02d %s", (hora == 12 || hora == 0) ? 12 : hora % 12, minuto, segundo, hora < 12 ? "AM" : "PM");
} | 3 |
private String getTimestamp() {
try {
final GregorianCalendar gCalendar = new GregorianCalendar();
gCalendar.setTime(new Date(startTime));
final XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar);
return xmlCalendar.toString();
} catch (DatatypeConfigura... | 1 |
public Double extract ( String word, String pos ) {
String temp = word + "#" + pos;
if ( _dict.containsKey(temp) ) {
return _dict.get(temp);
}
return -2.0;
} | 1 |
@SuppressWarnings("unchecked")
private void addInlineDiffs(Delta delta) {
List<String> orig = (List<String>) delta.getOriginal().getLines();
List<String> rev = (List<String>) delta.getRevised().getLines();
LinkedList<String> origList = new LinkedList<String>();
for (Character charact... | 9 |
public void onPlayerMove(PlayerMoveEvent event) {
if (event.isCancelled()) {
return;
}
if (!Config.isCreativeModeEnabled()) {
return;
}
PlanArea fromArea = BuildingPlanner.plugin.areaManager.getAffectedArea(event.getFrom());
PlanArea toArea = BuildingPlanner.plugin.areaManager.getAffectedArea(event.get... | 6 |
public EncryptionPropertyType createEncryptionPropertyType() {
return new EncryptionPropertyType();
} | 0 |
public String getCode() {
return code;
} | 0 |
public String getMessage() {
String tmp = "";
int loop = 0;
if (bot.colonSplit.length >= 2) {
for (String str : bot.colonSplit) {
if (str.contains("PRIVMSG"))
loop = 1;
else if (loop == 2)
tmp = str;
else if (loop > 2) tmp = tmp + ":" + str;
loop++;
}
return tmp;
}
return ""... | 5 |
public List<Offer> listOffer(long userid, long uprofile) {
List<Offer> list = null;
String listOffer;
if (uprofile == 3) {
listOffer = "select offer_name,offer_amount,billing_cycle from trackman.defining_offer";
} else {
listOffer = "select offer_name,offer_amoun... | 8 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getSource() == btnEnterRecord) {
MainGUI.this.btnEnterRecordActionPerformed(evt);
}
else if (evt.getSource() == btnDisplayList) {
MainGUI.this.btnDisplayListActionPerformed(evt);
}
else ... | 5 |
@Override
public void select(EdaChromosome[] edaIndividuals,
EdaChromosome[] selectedIndiviuals) {
Random rand = new Random();
int max = 0;
int sum = 0;
for (int i = 0; i < edaIndividuals.length; i++) {
sum += edaIndividuals[i].getActualDuration();
if (i==0 || max < edaIndividuals[i].getActualD... | 7 |
public boolean isPalindrome1(ListNode head) {
ListNode slowp = head, fastp = head, revp = null;
while (fastp!=null && fastp.next!=null){
fastp = fastp.next.next;
ListNode tmp = slowp.next;
slowp.next = revp;
revp = slowp;
slowp = tmp;
}
if (fastp!=null)
slowp = slowp.next;
if(log){
ListNo... | 7 |
public AffinityMatrix(PrimsMST minSpanningTree){
TunableParameters parameters = TunableParameters.getInstance();
int n = parameters.getDataSetSize();
double sigma = parameters.getSigma();
//initialize the matrix
_affinityMatrix = new double[n][n];
// i know it's ridiculo... | 5 |
@Override
public boolean retainAll(Collection<?> c) {
// TODO Auto-generated method stub
return false;
} | 1 |
private void newFileButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newFileButtonActionPerformed
if (evt.getSource() == newFileButton) {
final JFileChooser fc = new JFileChooser((baseFile != null) ? baseFile.getParent() : "");
int returnVal = fc.showOpenDialog(th... | 5 |
public synchronized void doStep(boolean forward) {
if(forward){
if(pause != 0 && inpause){
//1 step
gcodepainter.interrupt();
}else if(pause == 0 ){
//10 steps
setCmd(Commands.STEP50X);
}
}else{
if(pause != 0 && inpause){
setCmd(Commands.STEPBACK);
}else if(pause == 0 ){
//10 ... | 7 |
public static void createWindow(int width, int height, String title, boolean resize)
{
Display.setTitle(title);
Display.setResizable(resize);
try
{
Display.setDisplayMode(new DisplayMode(width, height));
Display.create();
Keyboard.create();
Mouse.create();
}
catch (LWJGLExcept... | 1 |
public void setRelativeMouseMode(boolean mode) {
if (mode == isRelativeMouseMode()) {
return;
}
if (mode) {
try {
robot = new Robot();
recenterMouse();
}
catch (AWTException ex) {
// couldn't create ... | 3 |
private void transferAllCitiesTo(EU3Country country) {
final String tag = getTag();
final String otherTag = country.getTag();
((EU3SaveGame)dataSource).preloadProvinces();
for (GenericObject prov : ((EU3SaveGame)dataSource).provinces) {
if (prov.getString("owner").eq... | 4 |
public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
index.visit(visitor);
array.visit(visitor);
} else {
array.visit(visitor);
index.visit(visitor);
}
} | 1 |
public void addHoveringElement(PositionChangedObservable e) {
if (e == null || !e.getPositions().contains(position))
throw new IllegalArgumentException("The given element is invalid!");
hoveringElements.add(e);
} | 2 |
public void cleanMaxRowPedinaTab(){
int min=12;
//Recupero la riga dei pezzi più avanzati
for(int i=0;i<desmosse.length;i++)
if(desmosse[i]!=null && desmosse[i].getMossa().getStartPos().getRow()<min)
min = desmosse[i].getMossa().getStartPos().getRow();
System.out.println("Il minimo valore della ri... | 7 |
public SieveOfEratosthenes(int n)
{
a = new boolean[n + 1];
for (int i = 1; i <= n; i++) // n iterations
a[i] = true;
// An iteration marks all numbers which are multiples of i as non prime
for (int i = 2; i < n; i++)
{
// If a number, c, is already marked prime then its multiples are
// already m... | 4 |
private void handleFilesForReprocessing(Connection dbConnection) {
logger.info("Looking for files that are set to be reprocessed.");
try {
// first look for files that have the reprocess flag set and process_state as 1, and update their process_state and reset the flag
// if the process state is 2 (error)... | 9 |
public String getCp() {
return cp;
} | 0 |
HeapNode(double key, V value) {
this.index = 0;
this.key = key;
this.value = value;
this.hind = null;
try {
hind = (HeapIndex) this.value;
} catch (Exception ex) {
this.hind = null;
}
} | 1 |
private boolean setupEconomy() {
if (getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}
... | 2 |
public static String escape(String string) {
StringBuffer sb = new StringBuffer();
for (int i = 0, length = string.length(); i < length; i++) {
char c = string.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
cas... | 6 |
public final int getOnlsize() { return onlsize; } | 0 |
public static void selectUpText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
int currentPosition = textArea.getCaretPosition();
if (currentPosition == 0) {
return;
}
// Update Preferred Caret Position
int newCaretPosition = 0;
... | 2 |
public static boolean ismetabolite(PathCaseNodeRole r) {
return r == PathCaseNodeRole.SUBSTRATEORPRODUCT || r == PathCaseNodeRole.REGULATOR || r == PathCaseNodeRole.INHIBITOR || r == PathCaseNodeRole.ACTIVATOR || r == PathCaseNodeRole.COFACTOR || r == PathCaseNodeRole.COFACTORIN || r == PathCaseNodeRole.COFACTO... | 7 |
@Override
public boolean verify()
{
String sol;
if (getPhrase().core.reverse)
sol = phr1;
else
sol = phr2;
boolean answerCorrect = answerPanel.getAnswer().equals(sol);
updatePerfData(answerCorrect);
if (!answerCorrect)
{
answerPanel.setSolution(sol);
answerPanel.highlight();
}
getPhr... | 2 |
public void setSystem(StarSystem s) {
// Power
int powerSurplus = s.getSystemPowerSurplus();
Color powerColor = Color.BLACK;
if (powerSurplus >= 0) {
powerColor = Colors.SYSTEM_KPI_POSITIVE;
}
if (powerSurplus < 0) {
powerColor = Colors.SYSTEM_KPI... | 8 |
public static Credentials loadCredentials(String aFile) {
Credentials cre = null;
try {
FileInputStream fileIn = new FileInputStream(aFile);
ObjectInputStream in = new ObjectInputStream(fileIn);
Object obj = in.readObject();
if (obj instanceof DBCredent... | 6 |
private static BitSet getLiveStatesToAccept(Automaton a) {
Automaton.Builder builder = new Automaton.Builder();
// NOTE: not quite the same thing as what SpecialOperations.reverse does:
Transition t = new Transition();
int numStates = a.getNumStates();
for(int s=0;s<numStates;s++) {
builder.c... | 8 |
@BeforeClass
public static void backupContactsTxt(){
try {
Files.copy(Paths.get("contacts.txt"),Paths.get("contactsCOPY.txt"));
Files.delete(Paths.get("contacts.txt"));
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
public Rennschnecke ermittleGewinner() {
Rennschnecke gewinner = null;
for (Rennschnecke schnecke : this.schnecken) {
if (schnecke.getDist() > this.rennDist) {
if (gewinner == null) {
gewinner = schnecke;
} else {
if (schnecke.getDist() > gewinner.getDist()) {
gewinner = schnecke;
}
... | 5 |
public short getLength() {
// start with the length of the superclass
short length = super.getLength();
// add the length of the end points
length += getNumContours() * 2;
// add the length of the instructions
length += 2 + getNumInstructions();
... | 8 |
private static String convert(String text) {
StringBuffer converted = new StringBuffer(text.length());
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
((c >= '0') && (c <= '9'))) {
converted.append(c);
}
else {
... | 7 |
public static void main(String[] args)
{
Rectangle rec = new Rectangle(new MyPoint(2,4), new MyPoint(4,6), new MyPoint(2,4) ,new MyPoint(4,8));
Class recClass = rec.getClass();
Field[] recFields = recClass.getDeclaredFields();
Method[] recMethods = recClass.getDeclaredMethods();
... | 6 |
private String daysToString(Collection<? extends Integer> days) {
StringBuilder sb = new StringBuilder();
for(int d : days) {
switch(d) {
case MONDAY:
sb.append("M ");
break;
case TUESDAY:
sb.append("T ");
break;
case WEDNESDAY:
sb.append("W ");
break;
case THURSDAY:
sb.ap... | 7 |
@Override
public void deserialize(Buffer buf) {
id = buf.readShort();
if (id < 0)
throw new RuntimeException("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
int limit = buf.readUShort();
finishedObjective = new AchievementObject... | 3 |
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 void setPopNombreProveedor(String popNombreProveedor) {
this.popNombreProveedor = popNombreProveedor;
} | 0 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Banco other = (Banco) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
ret... | 6 |
public void generate() {
grid = new Color[getSize()][getSize()];
// set all cells to green by default
for (int i = 0; i < getSize(); i++) {
for (int j = 0; j < getSize(); j++) {
grid[i][j] = Color.GREEN;
}
}
int total_cells = getSize() * getSize();
int ten_percent = (int) Math.floor(total_cells ... | 5 |
public StageFlipper runLobby() {
if (saveMsg != null) {
lg.lobby.setVisible(true);
@SuppressWarnings("unused")
StageFlipper startup = saveMsg;
}
while (loop) {
try {
String mess = receiveMessage();
int id = retrieveId(mess);
decodeAndRender(id, mess);
} catch (IOException | JSONExc... | 3 |
public static final BasicGraphEditor getEditor(ActionEvent e)
{
if (e.getSource() instanceof Component)
{
Component component = (Component) e.getSource();
while (component != null
&& !(component instanceof BasicGraphEditor))
{
component = component.getParent();
}
return (BasicGraphEditor)... | 3 |
public static int insertUser(String u_name, String u_qq, String u_pwd, String u_Email, String u_dis) {// 添加用户
int uid = MstxDao.getMaxNumber("mstx_user");
MstxDao.updateMaxNumber(2);// 将该字段值加1
Connection con = DBUtil.getConnection();
Statement st = null;
try {
st = con.createStatement();
String sql = "i... | 6 |
public void addSongToPlaylist(BEPlaylistSong aPlaylist) throws Exception {
try {
ds.addSongToPlaylist(aPlaylist);
} catch (SQLException ex) {
throw new Exception("Could not insert the song into the playlist" + aPlaylist.getSongid());
}
} | 1 |
public Brick(String name, boolean fake) throws Exception {
this.name = name;
this.fake = fake;
if(fake){return;}
String pathToExe = "control.py";
if (debug) {
System.out.println(name + "(d): start with " + pathToExe);
}
process = new ProcessBuilder("python", path + "/control.py").start();
reader =... | 6 |
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 1) {
if (args[0].equalsIgnoreCase("reload")) {
Seasons.instance.reloadConfig();
Seasons.instance.loadConfig();
sender.sendMessag... | 6 |
private void populateDeclaredFields(Class<?> modelClass, HashMap<String, Field> modelFields, ArrayList<Field> idField) {
if( null != modelClass) {
// Fill from the top of the hierarchy. The duplicated ModelFields that will remain will be the
// ones which are more specific in the hierarchy.
populateDeclaredF... | 8 |
@Override
public Graph addLink(Summit<T> start, Summit<T> end) {
// TODO Auto-generated method stub
if ( ! isSummitExist(start) ) addSummit(start);
if ( ! isSummitExist(end) ) addSummit(end);
Link<T> Link = new Link<T>(start, end);
links.add(Link);
return this;
} | 2 |
public void deleteElement(String value) {
ListElement previous = head;
ListElement current = head.next();
if (previous.getValue().equals(value)) {
head = head.next();
count--;
} else {
while (current != tail.next()) {
if (current.getVal... | 3 |
public DynamicArray<Vertex> getVertices() {
return vertices;
} | 0 |
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 fe... | 6 |
public static boolean isValidName(String name) {
if (name == null)
return false;
if (name.length() < 2)
return false;
if (!Character.isUpperCase(name.charAt(0)))
return false;
for (Character ch : name.toCharArray()) {
if (!(ch == ' ' || ch == '\'' || ch == '\"' || Character.isLetterOrDigit(ch)))
... | 8 |
private void adicionarItem() {
if(limiteSelecionados < 0 ||
((Collection)this.lstSelecionados.getCollection()).size() < limiteSelecionados)
{
System.out.print("Desselecionados: ");
System.out.println(itemsDesselecionados.size());
Object it... | 7 |
public void run() {
/* You fill this in. */
setSize((COLS + 2) * (TILE_WIDTH + TILE_SPACE),
(ROWS + 2) * (TILE_HEIGH + TILE_SPACE));
int startPointX = TILE_WIDTH + TILE_SPACE;
int startPointY = TILE_HEIGH + TILE_SPACE;
for (int i = 1; i <= ROWS; i++) {
int yCoord = startPointY * i;
for (int j ... | 2 |
public static byte[] convertUnsignedIntTo24bits(long i) {
byte[] b=new byte[3];
b[0]=(byte)(((int)(i>>16))&0xFF);
b[1]=(byte)(((int)(i>>8))&0xFF);
b[2]=(byte)(((int)(i))&0xFF);
return b;
} | 0 |
private static int inCircleCnt(Point root, List<Point> points){
int cnt=0;
for (Point p : points)
if(inCircle(root.x,root.y,p.x,p.y)){
cnt++;
}
System.out.println(root.x+","+root.y+" "+cnt);
return cnt;
} | 2 |
public int getHeureEnreg(){
int heure = this.dateEnreg.get(Calendar.HOUR) ;
if(this.dateEnreg.get(Calendar.AM_PM) == Calendar.PM){
heure += 12 ;
}
return heure ;
} | 1 |
@Override
public void keyReleased(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_F1)
{
System.out.println("F1 Key Released! Toggling Debug Grid!");
if(DRAW_DEBUG_GRID == false)
{
this.showDebugGrid(true);
}
else
{
this.showDebugGrid(false);
}
}
} | 2 |
public Collection operands() {
return new AbstractCollection() {
public int size() {
return cfg.preds(block).size();
}
public boolean contains(final Object obj) {
if (obj == null) {
return operands.size() != cfg.preds(block).size();
}
return operands.containsValue(obj);
}
... | 1 |
public final static Track parseParams(
@SuppressWarnings("hiding") final MidiInstrumentDropTarget instrument,
final String[] params) throws Exception {
final Integer id;
try {
id = Integer.valueOf(params[0]);
} catch (final Exception e) {
return null;
}
final ParamSet paramSet = new ParamSet();
... | 9 |
@Override
public void layout() {
float regionWidth, regionHeight;
if (animation != null) {
regionWidth = animation.getKeyFrame(0).getRegionWidth();
regionHeight = animation.getKeyFrame(0).getRegionHeight();
} else
return;
float width = getWidth();
float height = getHeight();
Vector2 size = scali... | 5 |
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.