text stringlengths 14 410k | label int32 0 9 |
|---|---|
private static int promptUser(String msg) {
Object[] options = {GUITreeLoader.reg.getText("yes"), GUITreeLoader.reg.getText("no")};
int result = JOptionPane.showOptionDialog(
Outliner.outliner,
msg,
GUITreeLoader.reg.getText("confirm_save"),
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
... | 1 |
public double getAverageLoss(ArrayList<DataPoint> dataPoints) {
double result = 0;
for(DataPoint dp:dataPoints) {
result += dp.sqError;
}
return result/dataPoints.size();
} | 1 |
public static LanguageIdentifier generateFromCounts(File countModelsDir, String[] languages) throws IOException {
Map<String, File> modelFileMap = Maps.newHashMap();
Map<String, CharNgramLanguageModel> modelMap = Maps.newHashMap();
File[] allFiles = countModelsDir.listFiles();
int order ... | 7 |
private ReadPreference createReadPreference(final Map<String, List<String>> optionsMap) {
Boolean slaveOk = null;
String readPreferenceType = null;
DBObject firstTagSet = null;
List<DBObject> remainingTagSets = new ArrayList<DBObject>();
for (String key : readPreferenceKeys) {
... | 7 |
@Override
public void drawSolutionk(Graphics drawingArea, int... arg) {
int diameter = arg[2];
int x = arg[0];
int y = arg[1];
int depth = arg[3];
int toDraw = DRAW_ALL;
if(arg.length == 5){
toDraw = arg[4];
}
if(depth == 0){return;}
drawingArea.drawRect(x, y, diameter, diameter);
if((... | 6 |
public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int len = s.length();
for (int i = 0; i < len; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' || c =... | 6 |
public int getHighestY()
{
int y = a[1];
if(b[1] > y)
{
y = b[1];
}
if(c[1] > y)
{
y = c[1];
}
if(d[1] > y)
{
y = d[1];
}
return(y);
} | 3 |
public String[] getSignal() {
String[] array = new String[signal.size()];
int n = 0;
for(Long key : signal.keySet()) {
array[n] = key.longValue() + "=" + signal.get(key);
n++;
}
return array;
} | 1 |
private void updateMealFound(List<Keyword> keywords, List<String> terms,
List<String> approval) {
//Since the user is asked for an approval, if he says yes, his history will be saved.
if (!approval.isEmpty()) {
if (approval.get(0).equals("yes")) {
//Save user history
//DateFormat dateFormat = new Simp... | 3 |
public Siirto suurin(){
if (koko == 0){
return null;
}
return keko[0];
} | 1 |
public static int[] leftHalf(int[] array) {
int size1 = array.length / 2;
int[] left = new int[size1];
for (int i = 0; i < size1; i++) {
left[i] = array[i];
}
return left;
} | 1 |
private File determineOutfile() {
File file;
final String fn = System.getProperty(PROPERTY_FILE_LOCATION);
if (fn != null) {
file = new File(fn);
if (file.exists()) {
file.delete();
}
try {
file.createNewFile();
... | 4 |
public boolean getBoolean(String key) throws JSONException {
Object object = get(key);
if (object.equals(Boolean.FALSE) ||
(object instanceof String &&
((String)object).equalsIgnoreCase("false"))) {
return false;
} else if (object.equals(Boolean.TRUE) ... | 6 |
public boolean comment(String comment, int imgId, String username) {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
int user_id = 0;
Calendar currenttime = Calendar.getInstance();
Date date = new Date((currenttime.getTime()).getTime());
try {
conn = DbConnection.getConne... | 8 |
@Override
public void render() {
super.render();
Player player = Application.get().getLogic().getGame().getPlayer();
InventoryComponent ic = player.getInventory();
Renderer.get().drawText("Money:" + ic.getMoney(), x + 5, y + 5);
/*
Renderer.get().drawText("C... | 1 |
public static boolean deleteDirectory(String dir) {
// 如果dir不以文件分隔符结尾,自动添加文件分隔符
if (!dir.endsWith(File.separator)) {
dir = dir + File.separator;
}
File dirFile = new File(dir);
// 如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory()) {
System.out.println("删除目录失败" + dir + "目录不存在!"... | 9 |
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try {
if (validarDatos()){
//cargo Parametros del Reporte
Map parametros = new HashMap();
parametros.put("name_empresa", r_con.getRazon_soci... | 9 |
@SuppressWarnings("unchecked")
private void addEntityRestrictions(Restriction query, ExtendedField field,
Object patternObject) {
Restriction subPart = null;
if (field.isMappedAsList()) {
List<Object> liste = (List<Object>) field.getValue(patternObject);
if (liste ... | 6 |
@Override
public void crearFichero(String ruta)
{
FileInputStream from = null;
FileOutputStream to = null;
File toFile = new File(ruta + this.getMetadato("nombre") + this.getMetadato("extension"));
try
{
from = new FileInputStream(this.video);
... | 6 |
public static <VT> int[] generateRandomHopsOut(Random r, ChiVertex<VT, Float> vertex, int n) {
int l = vertex.numOutEdges();
float[] cumDist = new float[l];
float prefix = 0.0f;
for(int i=0; i < l; i++) {
float x = vertex.getOutEdgeValue(i);
cumDist[i] = prefix +... | 6 |
public String showList(){
size = 5;
if(page == 0) page = 1;
List<Record> list = recordDAO.findPage(page, size);
recordList = new RecordList();
recordList.setList(list);
return SUCCESS;
} | 1 |
private void mouseDraw(MouseEvent e) {
int states = Goldfish.getMaxStates(rule);
if (e.getX() < 0 || e.getY() < 0 || e.getX() / scale >= width || e.getY() / scale >= height)
return;
Patch p = _grid.getPatch(e.getX() / scale, e.getY() / scale);
if (_drawState == -1) {
... | 8 |
public SortedMap<Long, Boolean> berecheneZustandsWechselVonBis(Long von, Long bis)
{
// TODO Auto-generated method stub
Calendar cal1 = new GregorianCalendar();
cal1.setTimeInMillis(von);
Calendar cal2 = new GregorianCalendar();
cal2.setTimeInMillis(bis);
SimpleDateFormat df = new SimpleDateF... | 9 |
private static boolean updateHashEquiJoinCardinality(HashEquiJoin j,
Map<String, Integer> tableAliasToId,
Map<String, TableStats> tableStats) {
DbIterator[] children = j.getChildren();
DbIterator child1 = children[0];
DbIterator child2 = children[1];
int child1Ca... | 9 |
public ClusteredMarker(Location location, float size) {
this.location = location;
this.size = size;
} | 0 |
public void compose(Raster src, Raster dstIn, WritableRaster dstOut)
{
if (_Entity == null) { throw new IllegalArgumentException("You must set an entity before drawing anything with this composite."); }
try
{
// Get the max bounds of the writable raster.
int maxX = dstOut.getMinX() + dstOut.getWidth();
... | 9 |
public boolean checkIfBinarySearchTree(Node root) {
if(root!=null) {
if(root.left != null && maxValue(root.left) > root.data)
return false;
else if(root.right != null && minValue(root.right) < root.data)
return false;
else
return (checkIfBinarySearchTree(root.left) && checkIfBinarySearchTree(root... | 6 |
public static boolean password(String pass){
if(pass.matches("(\\w){8,30}"))
return true;
return false;
} | 1 |
public void doGame() {
humanPlayer player1 = new humanPlayer();
System.out.println("\nWe need to know who Player 1 is!");
player1.getName();
player1.marker = "X";
System.out.println("\nNow for Player 2");
humanPlayer player2 = new humanPlayer();
player2.getName();
... | 5 |
public boolean hasNext() throws IOException {
while (!tokenizer.hasMoreTokens()) {
String line = reader.readLine();
if (line == null) {
return false;
}
tokenizer = new StringTokenizer(line);
}
return ... | 2 |
public void saveSettings() {
try {
properties.store(new FileOutputStream(new File(Constants.PROPERTIES_FILE)), "");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
... | 2 |
public RequestFileTransferHandler(int port, File file, String ip){
fileData = file;
ipOfPeer = ip;
portFile = port;
} | 0 |
public static void openJMX(File file) {
FileInputStream reader = null;
try {
BmLog.debug("Loading file: " + file);
reader = new FileInputStream(file);
HashTree tree = SaveService.loadTree(reader);
GuiPackage guiPackage = GuiPackage.getInstance();
... | 9 |
public Model getModelAt(int i, int j, int k, int l, int i1, int j1, int k1) {
Model model = getAnimatedModel(i, k1, j);
if (model == null)
return null;
if (adjustToTerrain || delayShading)
model = new Model(adjustToTerrain, delayShading, model);
if (adjustToTerrain) {
int l1 = (k + l + i1 + j1) / 4;
... | 5 |
public boolean intersectsInner(AABB var1) {
return var1.x1 >= this.x0 && var1.x0 <= this.x1?(var1.y1 >= this.y0 && var1.y0 <= this.y1?var1.z1 >= this.z0 && var1.z0 <= this.z1:false):false;
} | 5 |
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 |
private static void buildBasicMultiColor(Release set, List<SeperatorDefinition> seps) throws MalformedURLException {
SeperatorDefinition def = new SeperatorDefinition();
for(MagicColor c: MagicColor.values())
if (c.isBaseColor())
def.addLeftSymbol(new ImageIconDrawer(SymbolFa... | 3 |
@Test
public void arithmeticInstrOpcodeTest() {
try {
instr = new ArithmeticInstr(Opcode.BR, 10, 20);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr); //Checks instruction isn't created with invalid opcode for its format.
} | 1 |
@Override
public boolean equals(Object o) {
if (!(o instanceof ParserSettings))
return false;
ParserSettings other = (ParserSettings) o;
return (allowLists == other.allowLists) &&
(allowSingleTokens == other.allowSingleTokens) &&
... | 6 |
public String toString() {
return a + "\n" + b;
} | 0 |
public WatchKey addWatcher(String folderPath, int mask, boolean watchSubtree) throws IOException {
Watcher watcher = notifier.addWatcher(folderPath, mask, watchSubtree);
Watcher previousWatcher = registeredWatchers.put(watcher.getWatchKey(), watcher);
if (previousWatcher != null) {
LOG.warn(StringUtil.concaten... | 1 |
public static void main(String[] args){
int nodecounter=0;
Scanner sc=new Scanner(System.in);
Scanner str=new Scanner(System.in);
System.out.println("how many lines?");
int n=sc.nextInt();
Bst t=new Bst();
for(int i=0; i<n; i++)
{
String op=str.nextLine();
String temp=op.substrin... | 7 |
public String getSimpleCode(){
String str = "";
String itemCode = item.getCode();
if(itemCode != ""){
String nextTemp = Tree.getNextTemp();
str = item.getCode() +
this.printLineNumber(true) +
nextTemp + " := " + item.place + "\n";
ArgumentListExpression.argList += nextTemp + ", ";
}
else... | 2 |
void showPageContent(PageInfo page) {
try {
Desktop.getDesktop().browse(page.getURL().toURI());
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
} | 2 |
private GameState mutineerNightAction(GameState state, Card card, boolean output)
{
GameState end = new GameState(state);
Color faction = card.getFaction();
Player player = end.getPlayer(faction);
//If only the mutineer remains, the pirate can't be offered up for
//2 gold and nothing happens
if(playe... | 6 |
public void award_bonus(BigInteger threshold, BigInteger bonus) {
if (getBalance().compareTo(threshold) >= 0)
deposit(bonus);
} | 1 |
private void findRuleAndAddWords( String word, String wikiText ) {
int idxStart = wikiText.indexOf( "{{" );
int idxEnd = wikiText.indexOf( "}}", idxStart );
while( idxStart >= 0 && idxEnd >= 0 ) {
Properties props = parseRule( wikiText, idxStart + 2, idxEnd );
String rule... | 4 |
@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... | 3 |
private ArrayList<Journal> getSelectedJournals(){
int[] rows = tabel.getSelectedRows();
if (rows.length == 0) {
ActionUtils.showErrorMessage(ActionUtils.SELECT_JOURNAL_FIRST);
}
ArrayList<Journal> journalList = new ArrayList<Journal>();
for(int row : rows) {
... | 2 |
public void update(GameContainer gc, StateBasedGame sb, float delta) {
if (cooldown <= 0) {
cooldown = 0;
onCooldown = false;
} else if (onCooldown) {
if(beamTimer >=5000){
beamOn=false;
}
beamTimer+=delta;
cooldown -= delta;
}
} | 3 |
private static void supplyBeverage() {
beverage = BeverageFactory.getInstance().makeBeverage(beverageChoice);
if (beverage == null) {
System.out.println("Invalid beverage name suppplied.");
} else {
System.out.println(beverage.getName() + " will cost you Rs. " + beverage.getPrice());
}
} | 1 |
private void method95() {
for (int i = 0; i < localNpcCount; i++) {
int k = localNpcIndices[i];
Npc npc = localNpcs[k];
if (npc != null) {
method96(npc);
}
}
} | 2 |
private byte[] getDiagramBuffs(){
byte []diagramBuff = new byte[Optiums.DIAGRAM_BUFF];
if(lengthBuff != 0 && buff != null){
int needCoffe = Optiums.DIAGRAM_BUFF / lengthBuff;
needCoffe = Optiums.BUFF_SIZE / needCoffe;
for(int i = 0 , l = 0; i < lengthBuff; ++i)
for(int j = 0; j < Optiums.BUFF_SIZE - ne... | 4 |
@Override
public Key next() {
if (!hasNext())
throw new NoSuchElementException();
Node node = stack.pop();
if (node.right != null)
stack.push(node.right);
if (node.left != null)
stack.push(node.left);
return node.key;
} | 3 |
private void renumberList(List<BaseElement> list){
int index = 1;
for (BaseElement element : list) {
element.setId(index);
index++;
}
} | 1 |
private void initUI() {
setTitle("JProgressBar");
JPanel panel = new JPanel();
panel.setBorder(BorderFactory.createEmptyBorder(40, 40, 40, 40));
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
progressBar = new JProgressBar();
progressBar.setMaximumSize(new Dimension(150, 20));
progressBar.se... | 3 |
public int getPointsPerSubcomplex() {
return pointsPerSubcomplex > -1 ? pointsPerComplex : (NumOfParams + 1);
} | 1 |
public byte[] next() throws IOException {
byte[] key1 = result1.next();
byte[] key2 = result2.next();
if (key1 == null || key2 == null)
return null;
int cmp = Bytes.compareTo(key1, key2);
while (cmp != 0) {
if (cmp < 0) {
while (cmp < 0)... | 9 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(ok)){
valitseOikeaTapahtumaKunOkNappiaPainetaan();
}else if (e.getSource().equals(osasin)){
kertauspaneeli.paivitaOsaaminen(OsaamisenTila.OSATTU);
} else if (e.getSource().equals(melkein))... | 4 |
public void mousePressed(MouseEvent event) {
Transition t = getDrawer().transitionAtPoint(event.getPoint());
if (t != null)
controller.transitionCheck((FSATransition) t);
} | 1 |
public Shape get_shape() {
Shape rval = null;
if (type == TYPE_RECT) {
rval = new Shape( (int)(rect.x),
(int)(rect.y),
(int)(rect.x+rect.width),
(int)(rect.y+rect.height));
}
else if (type == TYPE_CIRCLE) {
rval = new Shape( new Point(circle_center.x,
... | 3 |
@Test
public void testGetTile() {
System.out.println("getTile");
int x = 1;
int y = 1;
Tile newtile=new Tile();
Tile[][] store=new Tile[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
store[i][j]=newtile;
}
}
... | 2 |
private static void waitForConnection() {
// waiting will be set true through notifyfreeconnection
waiting = true;
double delay = 0;
while (waiting) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// Nothing
}
delay += 0.1;
if (delay == WARN_TIME) {
System.err
... | 4 |
public void paintConfiguration(Component c, Graphics2D g, int width, int height)
{
super.paintConfiguration(c, g, width, height);
MealyConfiguration config = (MealyConfiguration) getConfiguration();
// Draw the torn tape with the rest of the input.
Torn.paintString((Graphics2D)g, con... | 0 |
public TaskRow(final ControllerInterface controller,
final EDITED_TaskScrollPanel taskScrollPanel, Task ta) {
super();
t = ta;
// this.controller = controller;
this.taskScrollPanel = taskScrollPanel;
// TODO setlenient su sdf, rimosso
// TODO layout has to be fixed a lot! I didnt mind about it now
//... | 9 |
private void btnRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoverActionPerformed
UsuarioSistema tmp = null;
try{
tmp = dao.Abrir(this.idUsuarioRemover);
}catch(Exception ex){
JOptionPane.showMessageDialog(rootPane, ex.getMess... | 4 |
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... | 5 |
@Override
public Mortgage createNewChild(TreeMap<String, String> properties) {
Mortgage mortgage = new Mortgage();
mortgage.setName(properties.get(NAME));
String startCapitalString = properties.get(Mortgages.TOTAL);
String nrPayedString = properties.get(Mortgages.NRPAYED);
if... | 4 |
@EventHandler(priority = EventPriority.HIGH)
public void InteractDamageMob(EntityDamageEvent event){
if(event.getCause() == DamageCause.ENTITY_ATTACK){
final EntityDamageByEntityEvent realEvent = (EntityDamageByEntityEvent) event;
if(realEvent.getDamager() instanceof Player){
String damagerName = ((Player)... | 5 |
public void method473() {
for (int j = 0; j < vertexCount; j++) {
int k = xVertex[j];
xVertex[j] = zVertex[j];
zVertex[j] = -k;
}
} | 1 |
public void throwInItem(Item item){
int pos = -1;
for(int i = 0; i < neededItems.length; i++){
if(item.getName().equals(neededItems[i])){
neededItems[i] = null;
}
}
if(isFinished()){
context.dropItemOnFloor(product);
}
} | 3 |
public static void endKW(String name,DateTime startTime, DateTime EndTime, Boolean x,String errorCause){
kwstart+="<tr class="+(x?"Pass":"Fail")+"><th>"+name+"</th><td>"+Seconds.secondsBetween(startTime,EndTime).getSeconds()+"</td><td>"+(x?"Pass":"Fail")+"</td><td>"+errorCause+"</td></tr>";
} | 2 |
private static void calculatePolynomialApproximation(ApparentPlace ap,
double t0, double ghapoly[], double decpoly[], double hppoly[]) {
double gha[] = new double[3];
double dec[] = new double[3];
double hp[] = new double[3];
double earthRadius = 6378137.0/ap.getObserver().getEphemeris().getAU();
boolean i... | 7 |
public static void dBoard() {
p();
System.out.println(" 0 1 2 3 4\t 0 1 2 3 4");
for (int row = 0; row < 5; row++) {
String rowStr = row + " ";
for (int col = 0; col < 5; col++) {
rowStr += board[row][col] + " ";
}
rowStr += "\t" + row + " ";
for (int col = 0; col < 5; col++) {
switch (st... | 8 |
public void start(){
running = true;
core = new Thread(this, "Core");
input = new Thread(new InputManager(), "Input");
core.run();
input.run();
} | 0 |
@Before
public void setUp() {
} | 0 |
public void setAantalpaginas(int aantalpaginas) {
this.aantalpaginas = aantalpaginas;
} | 0 |
public boolean registeredStundent(StudentVO studentVO)
throws LibraryManagementException {
PreparedStatement preparedStatement = null;
ConnectionFactory connectionFactory = new ConnectionFactory();
Connection connection = connectionFactory.getConnection();
String sqlquery = "insert into STUDENT (FIRST_NAME... | 5 |
public GuiApplication() {
// give every JList a ListModel
list1Model = new DefaultListModel<>();
list1.setModel(list1Model);
list2Model = new DefaultListModel<>();
list2.setModel(list2Model);
list3Model = new DefaultListModel<>();
list3.setModel(list3Model);
... | 9 |
public void moveCard(GameSpot fromSpot, GameSpot toSpot, int numberOfCardsToMove) {
Deck fromDeck = getDeck(fromSpot);
Deck toDeck = getDeck(toSpot);
if(ruleService.isGoingToResolutionPile(toSpot)){
movingToResPile(fromSpot, toSpot, numberOfCardsToMove);
}else{
Deck fromCards = getFromCards(fromDeck,numbe... | 7 |
static final public CreateActorStatement create_actor_stmt() throws ParseException {
CreateActorStatement result; Token typeTok; Token nameTok;
jj_consume_token(INSTANTIATE);
typeTok = jj_consume_token(TYPEIDENT);
result = new ... | 4 |
public EntityManager getEntityManager() {
return entityManager;
} | 0 |
@Test
public void testValidGroupCanBeCreated() throws Exception {
GroupObject validGroup = new GroupObject("habrahabr", "labrabar", "xerahabr");
createGroup(validGroup);
} | 0 |
static void sortWith0(double[] a, int fromIndex, int toIndex, DoubleComparator cmp) {
final int length = toIndex - fromIndex + 1;
if (length < 2)
return;
if (length == 2) {
if (cmp.gt(a[fromIndex], a[toIndex])) {
double x = a[fromIndex];
a[... | 9 |
private String getFeatureAsString(Feature feature) {
String label = Messages.message(getFeatureName(feature)) + ":";
if (feature.hasScope()) {
for (Scope scope : feature.getScopes()) {
String key = null;
if (scope.getType() != null) {
key =... | 7 |
public boolean nextToEnemy(int x, int y, int[][] activeMap) {
return ((y != activeMap.length - 1 && activeMap[y + 1][x] == -2) ||
(y != 0 && activeMap[y - 1][x] == -2) ||
(x != activeMap[0].length - 1 && activeMap[y][x + 1] == -2) ||
(x != 0 && activeMap[y][x - 1]... | 7 |
@Override
public void actionPerformed(ActionEvent e) {
String aux = "";
if (e.getSource() == this.viewTI.getAbre()) {
if (this.viewTI.getGol().isSelected()) {
aux = "VW Gol";
} else if (this.viewTI.getFox().isSelected()) {
aux = "VW ... | 8 |
public void setLength(final double newLen) {
int xFac = (x >= 0 ? 1 : -1);
int yFac = (y >= 0 ? 1 : -1);
double len = Math.sqrt(x * x + y * y);
double alpha = Math.asin(Math.abs(x) / len);
x = Math.sin(alpha) * newLen * xFac;
y = Math.cos(alpha) * newLen * yFac;
} | 2 |
@Override
public void analyse(LexicalAnalyser analyser) throws AnalyseException {
String content = analyser.getSentence();
if (content == null) {
throw new AnalyseException("Error: the sentence is null");
}
for (int index = 0; index < content.length(); index++) {
char current = content.charAt(index);
... | 4 |
@Override
protected void setReaction(Message message) {
try {
String[] messageParts = message.text.split(" ");
String profileId = messageParts[1];
String result;
switch (messageParts[2]) {
case "random": result = SelectRandomGame(profileI... | 7 |
protected void handleControlPropertyChanged(final String PROPERTY) {
if ("RESIZE".equals(PROPERTY)) {
resize();
drawBackground();
drawForeground();
} else if ("REDRAW".equals(PROPERTY)) {
drawBackground();
drawForeground();
} else if ("... | 4 |
public static String getStreamExtractor(Queue<String> parts) {
String type = next(parts);
if (type == null)
return null;
type = type.toUpperCase();
if (type.equals("SET")) {
String value = next(parts);
return String.format("new StaticExtractor(%s)", value);
}
try {
ParseType.valueOf(type);
re... | 4 |
public static boolean setValidity(Tickets.Ticket ticket, int validity) {
if (validity == 1 || validity == 2 || validity == 4 || validity == 6 || validity == 8 || validity == 10) {
ticket.setValidity(validity);
return true;
} else {
return false;
}
} | 6 |
@EventHandler
public void EndermanHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getEndermanConfig().getDouble("Enderman.Hu... | 6 |
private Map<Integer, Double> getLastUsages(List<UserData> bookmarks, double timestamp, boolean categories) {
Map<Integer, Double> usageMap = new LinkedHashMap<Integer, Double>();
for (UserData data : bookmarks) {
List<Integer> keys = (categories ? data.getCategories() : data.getTags());
double targetTimestamp... | 8 |
public static void main (String [] args) {
try {
//int reps = Integer.parseInt(args[0]);
int reps=1;
while (reps < 10) {
for(int i=0;i<reps;i++)
System.out.println("*"+"%2s");
System.out.println("\n");
reps... | 3 |
protected int getMaxAge()
{
return MAX_AGE;
} | 0 |
@Override
public void draw(List<Row> rows, ViewEventArgs args, int from){
this.setRows(rows);
// System.out.println("at main draw: " + rows.size() + " " + this.getRows().size());
if (this.getRows() != null && this.getRows().size() > 0){
int currentTop = args.getTop();
// System.out.println("at main draw:... | 3 |
public boolean monitor (final String addr_, int events_) {
boolean rc;
if (ctx_terminated) {
ZError.errno(ZError.ETERM);
return false;
}
// Support deregistering monitoring endpoints as well
if (addr_ == null) {
stop_monitor ();
re... | 8 |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockDestroy(BlockBreakEvent event) {
for (Entry<Integer, Game> en : GameAPIMain.getRunners().entrySet()) {
if (en.getValue() instanceof CTTGame) {
if (en.getValue().getPlayers().contains(event.... | 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.