text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void afficherComptesRendus(){
CtrlPrincipal ctrlP = new CtrlPrincipal();
ctrlP.action(EnumAction.COMPTESRENDUS_AFFICHER);
} | 0 |
private Player getPlayer(String target, CommandSender searcher) throws BadPlayerMatchException {
final List<Player> players = new ArrayList<Player>();
for (final Player player : plugin.getServer().getOnlinePlayers()) {
if (searcher instanceof Player && !((Player) searcher).canSee(player)) ... | 8 |
private static boolean isPrime(int n) {
if (n < 10) {
return n == 2 || n == 3 || n == 5 || n == 7;
}
if (n % 2 == 0 || n % 3 == 0)
return false;
int end = (int) Math.ceil(Math.sqrt(n));
for (int i = 5; i <= end; i += 6)
if (n ... | 9 |
public void update(int id, TravelTrip travelTrip){
travelTripDao.update(id, travelTrip);
} | 0 |
public void clearBreakpoint() {
breakpointSet = false;
} | 0 |
private boolean isColWin(int col){
if(model.getField().getCell(col, 0)==Field.DEFAULT_VALUE) return false;
if(model.getField().getCell(col, 0) == model.getField().getCell(col, 1) &&
model.getField().getCell(col, 0) == model.getField().getCell(col, 2))
return true;
els... | 3 |
@Override
public Object get(long i)
{
if (ptr != 0) {
short objLen = objectLengths.getShort(i);
if (objLen < 0) return null;
long offset = sizeof * i * maxObjectLength;
for (int j = 0; j < objLen; j++) {
byteArray[j] = Utilities.UNSAFE.getB... | 4 |
protected static String getStringOutputLine(String titel, String referenz, JSONObject obj) throws JSONException,
IOException {
if (obj.has(referenz)) {
if (obj.get(referenz).toString().length() < 35) {
return titel + ": " + obj.get(referenz) + "\n";
} else {
// JSONObject childobj = fetchObject(refer... | 2 |
public static Move[] possibleMoves(Board bd, int col){
Move[] possibleMoves = new Move[500];
Chip[] currentChips = bd.getCurrChips(col);
int counter = 0;
int x = 0;
Move currMove;
//ADD moves
if(bd.getPieces(col) < 10){
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
currMove = ne... | 8 |
public static void main(String[] args) {
/*
1
12
123
1234
1234
12345
*/
for(i=1;i<=10;i++)
{
if(i%2!=0) {
for(j=1;j<=i;j++)
System.out.print(j);
System.out.println("");
}
{
}
}
} | 3 |
@Test
public void testMultiThreadedBehaviorIsFair() throws InterruptedException {
simpleTestSetup();
final AtomicInteger www1 = new AtomicInteger(0);
final AtomicInteger www2 = new AtomicInteger(0);
final AtomicInteger www3 = new AtomicInteger(0);
int numThreads = 100;
Thread[] threads = new Thread[numThr... | 8 |
public void visit_lstore(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_lstore);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... | 8 |
private boolean parseExample(BufferedReader reader,
Collection<RankInput> exampleInputs,
Collection<RankOutput> exampleOutputs) throws DatasetException,
NumberFormatException, IOException {
// List of items of this query. Each item is a list of features.
LinkedList<LinkedList<Integer>> items = new LinkedLi... | 8 |
@Override
public VersionAlgorithm createAlgorithme(final String line) {
if (isEmpty(line.trim())) {
return new IdentityAlgo();
}
final StringTokenizer tokenizer = new StringTokenizer(explodeLine(line), BLANK_SPACE);
final List<AlgoNode> nodes = new ArrayList<AlgoNode>();
... | 9 |
private String getOtherPlayerId(List<String> ids, String cId) {
String result = "";
for (String id: ids){
if (!id.equals(cId)){
result = id;
break;
}
}
return result;
} | 2 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final Physical target=(givenTarget instanceof MOB) ? givenTarget : mob;
if(target==null)
return false;
if(!(target instanceof MOB))
{
mob.tell(L("You can't cast this spell on that."));
... | 9 |
public void remove(Activity activity) throws InstanceNotFoundException {
boolean found = false;
Iterator<Activity> iter;
Activity aux;
iter = activities.iterator();
while (iter.hasNext() && !found) {
if ((aux = iter.next()).equals(activity)) {
found = true;
activities.remove(aux);
Persistence.g... | 4 |
protected void checkBuffer(){
int touch = _buffer.indexOf("Touch");
int end = _buffer.indexOf("End");
Matcher m = _pattern.matcher(_buffer.toString());
if(touch != -1){
//System.out.println("Touch");
_buffer.delete(0, touch+ "Touch".length() + 1);
_touched = true;
}
else if (m.find()) {
... | 8 |
public void drawPanel2() {
panel2 = new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.Y_AXIS));
registerPanel = new JPanel();
registerPanel.setMaximumSize(new Dimension(400, 400));
registerPanel.setAlignmentX(CENTER_ALIGNMENT);
registerPanel.setAlignmentY(TOP_ALIGNMENT);
registerPanel.s... | 1 |
public int compareTo(Gaussian that) {
if(this.equals(that))
return 0;
else if(this.norm2() == that.norm2())
return this.argument() > that.argument()? 1: -1;
else
return this.norm2()-that.norm2();
} | 3 |
private void initTablasClientes(){
tabCli = (DefaultTableModel) tablaClientes.getModel();
clientes = taller.searchClientes("");
tabCli.setNumRows(clientes.size());
for(int i=0; i<clientes.size(); ++i){
tablaClientes.setValueAt(clientes.get(i).getNombre(), i, ... | 1 |
public void setZoom(double zoom) {
this.zoom = zoom;
if (zoom < 0.1) {
this.zoom = 0.1;
} else if (zoom > 90.0) {
this.zoom = 90;
}
} | 2 |
static public String composeApiCommand(String function, Object... arguments) {
StringBuilder apiCmd = new StringBuilder(256);
apiCmd.append('(');
apiCmd.append(function);
for (Object arg : arguments) {
apiCmd.append(" ");
apiCmd.append(DefaultCycObject.stringApiValue(arg));
}
apiCmd.... | 1 |
private String obten_tabla_usuarios(String login) {
ConexionBD con = new ConexionBD();
ArrayList<String[]> usuarios = con.buscaNombreLogin(login);
String tabla = "";
tabla += "<center><table style=\"width:100%\" id=\"tablaResultado\">\n"
+ " <tr>\n"
... | 2 |
public ArrowAction(Game game, String cmd) {
this.game = game;
this.cmd = cmd;
} | 0 |
public static void saveBound() throws FileNotFoundException,
UnsupportedEncodingException {
PrintWriter w = new PrintWriter(boundFile, "UTF-8");
for (int i = 0; i < 4; i++) {
w.println(poolUpperBound[i]);
w.println(poolLowerBound[i]);
}
w.close();
} | 1 |
private String generateReply(String message) {
String[] s = message.split("\\s+");
String reply = message.replaceFirst(s[0], " ").trim();
switch (s[0]) {
case ("LOWERCASE"):
reply = reply.toLowerCase();
break;
case ("UPPERCASE"):
... | 7 |
final int method3785(int i, int i_253_) {
anInt7682++;
if ((i ^ 0xffffffff) == -5122 || i == 5120)
return 1;
if (i_253_ != 4)
((OpenGlToolkit) this).aBoolean7793 = false;
if (i == 5123 || i == 5122)
return 2;
if (i == 5125 || i == 5124 || (i ^ 0xffffffff) == -5127)
return 4;
throw new IllegalA... | 8 |
public void loadLegend(String legendFile) throws FileNotFoundException, BadConfigFormatException {
//setup filereader and scanner
FileReader reader = new FileReader(legendFile);
Scanner scan = new Scanner(reader);
String temp = null;
//loop through to add rooms
while( scan.hasNextLine() ) {
if( scan.has... | 4 |
public void set(Unit ally, Unit enemy)
{
this.type = 1;
this.ally = ally;
this.enemy = enemy;
//might want to render hp/mp values to 100 before loading so the bars decrease to current hp/mp instead of random
allyBar[0].set(ally.getHPRatio());
allyBar[1].set(a... | 0 |
@Override
public Candidato inserir(IEntidade entidade) throws SQLException {
if (entidade instanceof Candidato) {
Candidato candidato = (Candidato) entidade;
PessoaDao pdao = new PessoaDao();
pdao.inserir(candidato);
String sql = "INSERT into candidato ("
... | 6 |
public void executeTask() {
Validator valid = new Validator();
List<String> invalidValues = null;
if (isModifyAction()) {
} else {
String COURSE_TYPE = getSelectedCourse().getType();
if(getSelectedStudentRegisteredCourse()==null){
showError("To s... | 9 |
*/
public void iniciar() {
/* 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 int getCriticalityByName(String name, List<Partition> lop) {
for (Partition p : lop) {
if (p.getName().equals(name))
return p.getCriticality();
}
return -1;
} | 2 |
public void applyPreserveRule(IdentifierMatcher preserveRule) {
if (preserveRule.matches(this)) {
System.err.println("preserving: " + this);
setReachable();
Identifier ident = this;
while (ident != null) {
ident.setPreserved();
ident = ident.getParent();
}
}
for (Iterator i = getChilds(); i... | 3 |
protected DrawableTree readFile(BufferedReader buf) throws IOException, FileParseException {
StringBuffer treeString = new StringBuffer();
int parenDepth = 0;
char[] c = new char[1];
boolean reading = false;
DrawableTree tree;
while( buf.read(c) > -1) {
if (reading) {
treeString.append(c);
if ... | 7 |
@Override
public void undo() {
// Shorthand
Node youngestNode = ((PrimitiveUndoableMove) primitives.get(0)).getNode();
JoeTree tree = youngestNode.getTree();
if (isUpdatingGui()) {
// Store nodeToDrawFrom if neccessary. Used when the selection is dissconnected.
OutlineLayoutManager layout = tree.getDocu... | 7 |
public void countDimmension()
{
width = (y2Coordinate - yCoordinate);
height = (x2Coordinate - xCoordinate);
} | 0 |
private static int method187(int arg0, int arg1) {
if (arg0 == -1) {
return 12345678;
}
arg1 = arg1 * (arg0 & 0x7f) / 128;
if (arg1 < 2) {
arg1 = 2;
} else if (arg1 > 126) {
arg1 = 126;
}
return (arg0 & 0xff80) + arg1;
} | 3 |
private ArrayList<Card> easyStrategy(ArrayList<Card> cards) {
ArrayList<Card> toExchange;
do {
toExchange = new ArrayList<>();
for (int i = 0; i < cards.size(); i++) {
if (random.nextBoolean()) {
// losuj karte o indeksie i
... | 3 |
private JsonNode getLastTrackNode() {
JsonNode result = null;
// setup API url
URI uri = null;
try {
uri = getApiUri().addParameter("method", "user.getrecenttracks").addParameter("user", config.getUser())
.addParameter("api_key", config.getApiKey()).addParameter("format", "json")
.addParameter("li... | 8 |
private void addIcon(String path, String filename, String trueFilename, boolean disabledVersion){
try{
ImageIcon icon = null;
if(!cache.containsKey(trueFilename)){
if(disabledVersion){
ImageIcon baseicon = new ImageIcon(getClass().getResource(pat... | 3 |
public static void removeLineFromFile(String file, String lineToRemove)
{
try
{
File inFile = new File(file);
File tempFile = new File(inFile.getAbsolutePath() + ".tmp");
BufferedReader br = new BufferedReader(new FileReader(file));
PrintWriter pw = new PrintWriter(new FileWriter(tempFile))... | 7 |
static void waitClerkButton(int id) {
long sleep = (long)(Math.random() * 60000);
try {
Thread.sleep(sleep);
} catch (InterruptedException e) {
e.printStackTrace();
}
} | 1 |
public DataCalc(DataStructures dataIn, int numberOfPoints){
this.dataIn = dataIn;
this.numberOfPoints = numberOfPoints;
} | 0 |
public Double getExpressionValue() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
if(hasBeenEvaluated) {
return this.expressionValue;
} else {
return calculateExpressionValue();
}
} | 1 |
@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 Department)) {
return false;
}
Department other = (Department) object;
if ((this.idDepartment == null && other.... | 9 |
private void addMTWCs(MTWData data, int x, int y, int dx, int dy) {
// Create set of tuples with coordinates - with annoying syntax
Set<Tuple<Integer, Integer>> set = new HashSet<Tuple<Integer, Integer>>();
// Trace in the given direction and it's opposite direction
Tuple... | 5 |
private void resolveConflict(int row, int column, ArrayList<HumanAgent> humans,
ArrayList<ZombieAgent> zombies) {
final double zombieDefaultWinLoseRatio, zombieWinLoseRatioAgainstArmedHuman,
zombieKillInfectRatio, humanKillEscapeRatio;
dou... | 9 |
@Override
public String getColumnName(int column) {
return columnNames.get(column);
} | 0 |
private List<FSQEvent> processEventData(List<FSQEvent> events, List<Foursquare> fsqData) throws ParseException {
// TODO Auto-generated method stub
List<FSQEvent> list=new ArrayList<FSQEvent>();
try {
for (Foursquare fsq : fsqData) {
JSONObject eventJson=new JSONObject(fsq.getData());
long dateEpoch=... | 6 |
private boolean add() throws UnsupportedEncodingException {
if(addStoreName == null || addStoreName.isEmpty())
return false ;
if(addStoreAddr == null || addStoreAddr.isEmpty())
return false ;
String tempName = new String(addStoreName.getBytes("ISO-8859-1"),"UTF-8") ;
Session se = HibernateSessionFactor... | 6 |
public static List<TileSprite> autoConstructSprites(Image[][] image) {
List<TileSprite> sprites = new ArrayList<TileSprite>();
for(int y = 0 ; y < image.length ; y++) {
for(int x = 0 ; x < image.length ; x++) {
sprites.add(new TileSprite(image[x][y]));
}
}
return sprites;
} | 2 |
public void close() {
EIError.debugMsg("Closing");
if (serverSocket != null) {
try {
sendData("goodbye");
serverSocket.close();
} catch (IOException e) {
//oh well, ain't no thang
}
}
keepRunning = false;... | 2 |
@Override
public PersonInterface createPerson() {
String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
/* save all arguments into an array */
Object[] args = new Object[0];
Class<?>[] argsType = new Class<?>[0];
PersonInterface ret = null;
try {
ret = (PersonInterface)super.... | 5 |
* @return Cons
*/
public static Cons listModules(boolean kbOnlyP) {
if (kbOnlyP) {
{ Cons value000 = Stella.NIL;
{ Module m = null;
Iterator iter000 = Stella.allModules();
Cons collect000 = null;
while (iter000.nextP()) {
m = ((Module)(iter000.value));
... | 9 |
private void scaleByMax() {
//ammendment to what i may have commented before
//this takes the lowest x and highest x and uses that as the scaling
//factor
double l_x = 5000,h_x = -5000;
for (int noa = 0;noa < m_groupNum;noa++) {
if (l_x > m_groups[noa].m_left) {
l_x = m_groups[noa].m_left;
... | 7 |
public void fill(int x, int y, int bw, int bh, int color){
//Fills in a colored rectangle of width = bw, heigth = bh
int x0 = x;
int x1 = x + bw;
int y0 = y;
int y1 = y + bh;
if (x0 < 0) x0 = 0;
if (y0 < 0) y0 = 0;
if (x1 > this.width) x1 = this.width;
if (y1 ... | 6 |
@Override
public void deleteUser(UserDTO user) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.delete(user);
session.getTransaction().commit();
}... | 3 |
public void update(boolean force) {
//boolean DEBUG= false;
if (isDirty() || force) {
if (statusLineExist()) {
statusLine.setRedraw(false);
// NOTE: the update algorithm is non-incremental.
// An incremental algorithm requires that SWT item... | 8 |
public double imposeForces() {
double[] forces = new double[DIMENSIONS];
sumError = 0.0;
for (int j = 0; j < numberOfTerms; j++) {
Term term = terms.get(identifiers[j]);
Arrays.fill(forces, 0); //initialize result
double[] coord = term.getPosition(); //get coords for distance
int ar... | 8 |
private void genMj(int itemId) {
int itemRatedNumber = DataInfo.itemlist[itemId].length; //项目被评过分的个数
if (itemRatedNumber == 0) {
for (int j = 0; j != DataInfo.featureNumber; j++) {
DataInfo.itemFeature[itemId][j] = 0;
}
return;
}
int[] columnIndexes = new int[itemRatedNumber];
doub... | 4 |
@Command(cmd = {"ftc", "fairytailcraft", "ft", "fairytail"},
firstArg = {"mymagics"})
public boolean returnSenderMagics(CommandSender sender, String cmd, String[] args) {
if (sender instanceof Player) {
Player sent = (Player) sender;
String magic = Util.getPlayerConfig(sent).getM... | 7 |
public static void main(String[] args) {
Integer n1 = 129;
Integer n2 = 129;
System.out.println(n1 == n2);
System.out.println(n1 != n2);
// Do this for String
} | 0 |
private void decodeEntries() {
int entryCount = data.getReferenceTableSmart();
ids = getIds(entryCount);
addEntries();
if (hasIdentifiers())
decodeEntryIdentifiers();
decodeCrcs();
if (hasUnknown2())
decodeUnknown2();
if (hasWhirlpool())
decodeWhirlpools();
if (hasUnknown1())
decodeUnknown1(... | 4 |
@Override
public boolean process(Player player) {
if (ingredients == Ingredients.TORSTOL && otherItem.getId() != VIAL) {
if (!player.getInventory().containsOneItem(15309)
|| !player.getInventory().containsOneItem(15313)
|| !player.getInventory().containsOneItem(15317)
|| !player.getInventory().cont... | 9 |
public int nextInt() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
int result;
if (p == PEEKED_LONG) {
result = (int) peekedLong;
if (peekedLong != result) { // Make sure no precision was lost casting to 'int'.
throw new NumberFormatException... | 9 |
public String postRequest(String request, String uri, String data) {
StringBuffer response = new StringBuffer();
try
{
String url = uri;
java.net.URL obj = new java.net.URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
//add request h... | 4 |
private final void method291(int i, int i_1_,
ByteBuffer class348_sub49) {
if ((i ^ 0xffffffff) != -2) {
if (i == 2) {
((Class22) this).anInt331
= class348_sub49.getShort();
if (((Class22) this).anInt331 == 65535)
((Class22) this).anInt331 = -1;
} else if ((i ^ 0xffffffff) != -4) {
if ... | 7 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((center == null) ? 0 : center.hashCode());
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result +
((lightColor == null) ? 0 : lightColor.hashCode());
result = prime ... | 3 |
private Object getValeur(int index, String nom) throws Exception {
Object res;
JComponent champ = listeChamps.get(nom);
int type = listeAttributs.get(index).getType();
try {
switch (type) {
case Constantes.INTEGER : res = strToInt(((JTextField)champ).getText()); break;
case Constantes.DOUBLE : res = str... | 7 |
public teacher getT1() {
return t1;
} | 0 |
public void update() {
checkTileMapCollision();
setPosition(xtemp, ytemp);
if(dx == 0 && !hit) {
setHit();
}
animation.update();
if(hit && animation.hasPlayedOnce()) {
remove = true;
}
} | 4 |
@Test(timeout = 1000)
public void randomQuestion() throws Exception {
ExcSet excSet = Jcp1ExcSet.getInstance();
QuestionGeneratorImpl rnd = new QuestionGeneratorImpl(excSet);
Set<Class> wasQuestionClass = new HashSet<>(4);
while (wasQuestionClass.size() != 4) {
Question q... | 1 |
private String request(String url, String... params) {
String per_page = params.length > 0 ? params[0] : "none";
String page = params.length > 1 ? params[1] : "none";
String label = params.length > 2 ? params[2] : "none";
url = this.url + "/tickets.json?auth_token=" + this.auth_token
+ "&per_page=" + per_pa... | 3 |
public static int[] getScanTable(int dim, boolean zigzag)
{
switch (dim)
{
case 4 :
return (zigzag == true) ? ZIGZAG_SCAN_4x4 : MORTON_SCAN_4x4;
case 8 :
return (zigzag == true) ? ZIGZAG_SCAN_8x8 : MORTON_SCAN_8x8;
case 16 :
return (zigzag... | 8 |
public void saveItem(ItemStack toSave, ConfigurationSection configSection, String searchPrefix) {
if (toSave != null && toSave.getItemMeta() != null) {
configSection.set(searchPrefix + "name", toSave.getItemMeta().getDisplayName().replace(ChatColor.COLOR_CHAR, '&'));
configSection.set(se... | 2 |
private void jComboBoxSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxSearchActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxSearchActionPerformed | 0 |
private static void oldJavaWay() {
Collections.sort(users, new Comparator<User>() {
public int compare(User u1, User u2) {
return u1.id.compareTo(u2.id);
}
});
printListOldWay("by ID");
Collections.sort(users, new Comparator<User>() {
... | 0 |
public String checkConjecture(Automata<String> automata) {
if (!this.automata.equals(automata)) {
String[] charAlphabet = new String[alphabet.size() - 1];
for (int i = 1; i < alphabet.size(); i++) {
charAlphabet[i-1] = alphabet.get(i);
}
for (int j = 1; j < 5; j++)... | 8 |
@Override
public void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
;
g = (Graphics2D) graphics;
// super.paintComponent(graphics);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
R... | 1 |
private BeanstreamApiException handleException(Exception ex, HttpsURLConnection connection) {
String message = "";
if (connection != null) {
try {
int responseCode = connection.getResponseCode();
message = responseCode+" "+connection.getContent().toString();
... | 2 |
private static void addSomeMetadata(BufferedReader reader,
BufferedWriter writer,
HashMap<String, List<RawDesignMatrixParser>> metaMap,
HashMap<String, MBQC_SampleParser> mbqcSampleMetaMap) throws Exception
{
writer.write("fromRDPsampleID\tmbqcSampleID\tr1OrR2\thasLookup\tmbqcID\twetlabID\twetlabExtr... | 8 |
WordDefinition getWord(Token t) throws CompileError {
switch( t.type ) {
case DOUBLE_QUOTED_STRING:
return new ConstantValue(t.text);
default:
Matcher m;
if( (m = DEC_INT_PATTERN.matcher(t.text)).matches() ) {
return new ConstantValue(Long.valueOf(("-".equals(m.group(1)) ? -1 : 1) * Long.parseLong(m.... | 5 |
public Properties toProperties() {
Properties ret = new Properties();
if (applicationUri != null) {
ret.setProperty(APPLICATION_URI, applicationUri);
}
if (applicationTarget != null) {
ret.setProperty(APPLICATION_TARGET, applicationTarget);
}
St... | 9 |
public void run()
{
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
lastTimer = System.currentTimeMillis();
double i1 = 0;
while (running == true)
{
long now = System.nanoTime();
i1 += (now - lastTime) / nsPerTick;
... | 5 |
@Override
public List<ValidateException> validate(String parameter) {
List<ValidateException> validateExceptionList = new LinkedList<>();
final int passportNumberLength = 8;
if (!ValidateUtils.stringLengthValidation(parameter, passportNumberLength)) {
String exMsg = "entered wro... | 1 |
public void loadData(String filePath, Long offset, Long count) throws RemoteException{
log("loadData(" + filePath + ", " + offset + ", " + count);
if(working>0 || workQueue.size()>0){
throw new RemoteException("Work queued for loaded data, cannot load new data");
}
Runnable t... | 7 |
public ContrastDialog(final Panel panel) {
setBounds(1, 1, 270, 230);
Toolkit toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation(size.width / 3 - getWidth() / 3, size.height / 3
- getHeight() / 3);
this.setResizable(false);
setLayout(null);
JPanel panR = new JPanel();
pan... | 7 |
@Override
protected String fetchArticleHtml(HtmlPage page, List<IResource> resources) {
HtmlDivision articleDiv = page.getFirstByXPath("//div[contains(@class,'nopaddings')]");
HtmlElement head = page.getFirstByXPath("/html/head");
StringBuilder newHtml = new StringBuilder();
newHtml.... | 1 |
public void endElement(String namespaceURI, String localName, String rawName)
{
if(Debug.debugLevel() >= 5)
{
Debug.println("End of element received:", 5);
Debug.println(" Namespace URI: " + namespaceURI, 5);
Debug.println(" Local Name: " + localName, 5);
Debug.println(" Raw Name: " + rawName, 5);
... | 2 |
public PanelBiseccion(){
c1Field = new JTextField(5);
c2Field = new JTextField(5);
expField= new JTextField(5);
c3Field = new JTextField(5);
aField = new JTextField(5);
bField = new JTextField(5);
errorField = new JTextField(5);
c1Label = new JLabel("Coeficiente del termino cuadratico");
expLa... | 3 |
private boolean ruleInvocation(final int pos) {
boolean change = false;
for(int i = pos; i < chart.size(); i++) {
final Edge e = chart.get(i);
if(!e.isActive()) {
for(final String lhs : grammar.withLeftmost(e.lhs)) {
for(final String[] rhs : grammar.rhs(lhs)) {
if(!rhs[... | 7 |
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 Boolean teamIsWipedOut(String matchName, String teamName){
try {
cs = con.prepareCall("{call GET_TEAMNAME_AND_ALIVECOUNT(?,?)}");
cs.setString(1, matchName);
cs.setString(2, teamName);
ResultSet rs = cs.executeQuery();
if(!rs.next()){
return true;
}
} catch (SQLException e) {
... | 2 |
@Override
public boolean isValid(File file) {
// Get the extension of the file
String filename = file.getName();
int seperatorIndex = filename.lastIndexOf(EXTENSION_SEPERATOR);
String extension = "";
if (seperatorIndex > 0) {
extension = filename.substring(seperatorIndex + 1,filename.length());
}
... | 5 |
public static EnvironmentFrame frameForEnvironment(Environment environment) {
return (EnvironmentFrame) environmentToFrame.get(environment);
} | 0 |
public String getUserStringWithURL(boolean isNewpage) {
StringBuilder sb = new StringBuilder();
sb.append("<a class=\"link-style-dominant\" href=\"/QuizWebsite/userpage.jsp?id=");
sb.append(userID + "\"");
if (isNewpage) {
sb.append("target=\"_blank\"");
}
sb.append(">" + username + "</a>");
return sb.... | 1 |
@Override
public void spring(MOB mob)
{
final MOB invoker=(invoker()!=null) ? invoker() : CMLib.map().deity();
if((!invoker.mayIFight(mob))
||(invoker.getGroupMembers(new HashSet<MOB>()).contains(mob))
||(CMLib.dice().rollPercentage()<mob.charStats().getSave(CharStats.STAT_SAVE_TRAPS)))
mob.location().show... | 8 |
public static String getFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
FileInputStream in = new FileInputStream(filename);
Exception exception = null;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in,"UTF-8"));
Exception innerEx... | 9 |
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.