text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void debugOutput(int topK, String filePrefix) {
File parentTopicFolder = new File(filePrefix + "parentTopicAssignment");
File childTopicFolder = new File(filePrefix + "childTopicAssignment");
File childLocalWordTopicFolder = new File(filePrefix
+ "childLocalTopic");
if (!parentTopicFolder.exists()... | 9 |
static final public int Sentence() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case create:
Create();
{if (true) return 0;}
break;
case insert:
Insert();
{if (true) return 0;}
break;
case select:
Select();
{if (true) return 0;}
break;
... | 9 |
public ArrayList<String> getDomains() {
ArrayList<String> result = new ArrayList<String>(this.amount);
String domainName;
long beforeExec;
long afterExec;
boolean isRegistered;
for (int i = 1; i <= this.amount; i++) {
domainName = this.gen.generate() + this.tld;
beforeExec = System.currentTimeMillis... | 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 AbstractMob NPCAtLocation(int x, int y){
for (int i = 0; i < mobs.size(); i++){
AbstractMob mob = mobs.get(i);
if (mob.getX() == x && mob.getY() == y){
return mob;
}
}
return null;
} | 3 |
public static Integer getGirlToBoyNakshatraDistance(Nakshatra boyStar, Nakshatra girlStar) {
int boyNumber = boyStar.ordinal() + 1;
int girlNumber = girlStar.ordinal() + 1;
int distance = 0;
if (boyNumber > girlNumber) {
distance = boyNumber - (girlNumber - 1);
}
if (boyNumber < girlNumber) {
distanc... | 3 |
public TVC(int id, double intencity) {
this.id = id;
this.intencity = intencity;
} | 0 |
public void startMultipulLearning(){
double error = 1;
int flag=1;
int incValuesPos=0;
while(flag!=0){
flag=0;
for(incValuesPos = 0;incValuesPos<incomeParamsArrLearn.size();incValuesPos++){
for(int i=0;i<incomeLayoutNeuronCount;i++){
... | 5 |
private void decodeHeader(final BufferedReader in, final Map<String, String> pre, final Map<String, String> parms, final Map<String, String> header) throws InterruptedException {
try {
// Read the request line
final String inLine = in.readLine();
if (inLine == null) {
return;
}
final... | 9 |
public void initDataDir() {
File dataDir = new File(VCNConstants.WORK_FOLDER);
boolean dirAndExist = dataDir.isDirectory();
if (!dirAndExist) {
dataDir.mkdir();
}
} | 1 |
public static String reverse(String s) {
if(s.length() <= 1) {
return s;
}
// initialize array and pointers
char[] c = s.toCharArray();
int start = 0;
int end = s.length() - 1;
while(start < end) {
// swap characters
... | 2 |
@Override
public void deserialize(Buffer buf) {
spouseAccountId = buf.readInt();
if (spouseAccountId < 0)
throw new RuntimeException("Forbidden value on spouseAccountId = " + spouseAccountId + ", it doesn't respect the following condition : spouseAccountId < 0");
spouseId = buf.r... | 4 |
public void printWithMask() {
System.out.println(" A B C D E F G H I J");
for (int x = 0 ; x < size ; x++) {
if (x == size) {
System.out.print(x + "|");
} else {
System.out.print(x + " |");
}
for (int y = 0; y < size; y++) {
if (y == (size - 1)) {
if (board[x][y].isHit()) {
if (... | 8 |
public static void printAncestors(Class<?> clazz) {
Class<?> superClass = clazz.getSuperclass();
print(clazz.getSimpleName());
Field[] fields = clazz.getDeclaredFields();
for(Field field : fields) {
print("\t" + field);
}
if(superClass != null) {
p... | 4 |
public boolean isIgnore() throws InterruptedException {
return false;
} | 0 |
@Override
public void readData(byte[] data) {
String gameData = new String(data);
String[] parts = gameData.split("\\@");
String gameState = parts[0];
String[] properties = gameState.split("\\'");
// System.out.println("gamestate: " + gameState);
Tank player1;
Tank player2;
if (level != null && leve... | 7 |
@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 SubscriptionPK)) {
return false;
}
SubscriptionPK other = (SubscriptionPK) object;
if ((this.uid == null && oth... | 9 |
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 addTableToJoin(String tableName, String asName)
{
if (!joinTableIds.contains(asName)
&& !joinPropertyTableIds.contains(asName))
{
joinTables.add(tableName);
joinTableIds.add(asName);
}
} | 2 |
public void pushTasset() {
int len = this.tassetMaintQueue.size();
Tasset t;
// Flush out the maintenance queue, move ready tassets to free queue
for (int i=0; i<len; i++) {
t = this.tassetMaintQueue.remove(0);
if (t.getDelay() > 0)
t.setDelay(t.getDelay() - 1);
// If the maintenance delay expires,... | 9 |
public Coordinate addDirection(DIRECTION d) {
int newX = 0, newY = 0;
if (d == DIRECTION.NORTH) {
newY--;
} else if (d == DIRECTION.EAST) {
newX++;
} else if (d == DIRECTION.SOUTH) {
newY++;
} else if (d == DIRECTION.WEST) {
newX--;... | 8 |
public void recursivePrint(TreeNode root, int parentPosition, Node innerNode, Node p, int i) {
Node innerParent;
int position;
if (root != null) {
int height = heightRootToNode(root);
int nextTop = getRectNextTop(height);
if (innerNode != null)
... | 4 |
public static void main(String args[])
{
Logger log = Logger.getLogger("MAIN");
Properties ptSource = new Properties();
ptSource.setProperty("connection.host","172.25.13.149");
ptSource.setProperty("connection.port","21");
ptSource.setProperty("user.login","ftpuser")... | 4 |
public Matrix(int n) {
if (n < 0)
throw new IllegalArgumentException("n = " + n);
HashMap<Integer, HashMap<Integer, Node>> a = new HashMap<Integer, HashMap<Integer, Node>>();
matrix = a;
size = n;
// Initiates all x-coordinates and each x-coordinate's HashMap
// (y-dimension, each coordinate features ... | 3 |
static double grad (int hash, double x, double y, double z)
{
int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE
double u = h < 8 ? x : y, // INTO 12 GRADIENT DIRECTIONS.
v = h < 4 ? y : h == 12 || h == 14 ? x : z;
return ((h & 1) == 0 ? u : -u) + ((h & 2) == 0 ? ... | 6 |
public static void writeBytesToFile(File theFile, byte[] bytes) throws IOException {
BufferedOutputStream bos = null;
try {
FileOutputStream fos = new FileOutputStream(theFile);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
} finally {
if... | 2 |
public static void process(Process process, String[] cmd, IoSession session)
throws IOException {
try {
BufferedReader infoBr = null;
BufferedReader errorBr = null;
sendNormalMsgToClient(process, infoBr, session);
sendErrorMsgToClient(process, errorBr, session);
int val = process.waitFor();
if... | 4 |
public void hyperlinkUpdate(HyperlinkEvent event)
{
if(event.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
try
{
if(!Desktop.isDesktopSupported())
return;
Desktop desktop = Desktop.getDesktop();
if(desktop.isSupported(Desktop.Action.BROWSE))
{
... | 5 |
public boolean equals( Vertex3f r )
{
return x == r.getX() && y == r.getY() && z == r.getZ();
} | 2 |
private static byte[][] generateSubkeys(byte[] key) {
byte[][] tmp = new byte[Nb * (Nr + 1)][4];
int i = 0;
while (i < Nk) {
tmp[i][0] = key[i * 4];
tmp[i][1] = key[i * 4 + 1];
tmp[i][2] = key[i * 4 + 2];
tmp[i][3] = key[i * 4 + 3];
i++;
}
i = Nk;
while (i < Nb * (Nr + 1)) {
byte[] temp ... | 6 |
public String getRandomSequence(int length) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < length; ++i) {
double rand = Math.random();
if (rand > 0.75) {
builder.append("C");
} else if (rand > 0.5) {
builder.append("G");
} else if (rand > 0.25) {
builder.append("T");
}... | 4 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Deal deals[] = new Deal[10];
for(int i = 0 ; i < 10 ; i++ ){
int type = (int) (Math.random() * 3);
int amount = (int) (Math.random() * 2000 + 3000);
int year = (int)(Math.random()*13 + 10);
int month = (int)(Math.random()*12);... | 7 |
private void loadDataFromSparseFile(String file, InstanceType type, int featureCount) throws IOException
{
FileReader fr = new FileReader(file);
BufferedReader br = new BufferedReader(fr);
ArrayList<Double> features = new ArrayList<Double>();
String line = null;
while((line = br.readLine()) != null)
{
... | 4 |
@Override
protected void handleActionRequestInternal(ActionRequest request, ActionResponse response) throws Exception {
final String entryIndex = StringUtils.defaultIfEmpty(request.getParameter("entryIndex"), null);
//Get the BookmarkSet from the store
final BookmarkSet bs = this.bo... | 4 |
public static void readFile(String fileName) {
if (fileName == null) // Go back to reading standard input
readStandardInput();
else {
BufferedReader newin;
try {
newin = new BufferedReader( new FileReader(fileName) );
}
catch (Exception e) {
... | 4 |
void undump(StringTokenizer st) {
reset();
int e = new Integer(st.nextToken()).intValue();
if (e == -1)
return;
elm = sim.getElm(e);
speed = new Integer(st.nextToken()).intValue();
value = new Integer(st.nextToken()).intValue();
int flags = new Integer(st.nextToken()).intValue();
minMaxV = new Double(st.ne... | 8 |
@Override
public String getPlotString() {
String dataString = "";
synchronized (data) {
if (data.size() > 0 && data.get(0).getMetaData().containsKey("StdDev")) {
for (LinkInfo i : data) {
dataString += i.timestamp + " " + i.power + " " + (Double) i.get... | 4 |
public String toString()
{
int l = getPortalLevel();
StringBuilder sb = new StringBuilder(8);
int[] sresos = new int[resos.length];
System.arraycopy(resos, 0, sresos, 0, resos.length);
Arrays.sort(sresos);
for ( int i = 7; i >= 0; i--) sb.append(sresos[i]);
int hackLevel = Mat... | 4 |
static public int count(String a, String contains) {
int i = 0;
int count = 0;
while (a.contains(contains)) {
i = a.indexOf(contains);
a = a.substring(0, i)
+ a.substring(i + contains.length(), a.length());
count++;
}
return count;
} | 1 |
@Override
public void update(long deltaMs) {
if(getTargetedActor() == null)
checkEnemies();
target();
} | 1 |
public String toString(){
StringBuffer sb = new StringBuffer();
switch(type){
case TYPE_VALUE:
sb.append("VALUE(").append(value).append(")");
break;
case TYPE_LEFT_BRACE:
sb.append("LEFT BRACE({)");
break;
case TYPE_RIGHT_BRACE:
sb.append("RIGHT BRACE(})");
break;
case TYPE_LEFT_SQUARE:
... | 8 |
public static File findJavaFolder() {
//"where" on Windows and "whereis" on Linux/Mac
if (System.getProperty("os.name").contains("win") || System.getProperty("os.name").contains("Win")) {
String path = getCommandOutput("where javac");
if (path == null || path.isEmpty()) {
... | 6 |
public int V() {
return V;
} | 0 |
@Override
public boolean equals(Object o )
{
if(o == null)
return false;
if(!(o instanceof BauteilDTO))
return false;
BauteilDTO b = (BauteilDTO)o;
if(b.getNr() != this.getNr())
return false;
if(!b.getName().equals(this.getName()))
... | 5 |
public void clearCells() {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
for (int k = 0; k < depth; k++) {
cells[i][j][k].clearParticles();
}
}
}
} | 3 |
private Point findClosestEnding(Point start, int rivnum) {
Point closest = null;
for (Point p : riverEndings) {
Tile t = MyzoGEN.getOutput().getTile(p);
if (t != null && t.riverID != rivnum) {
if (closest == null) {
closest = p;
} else {
if (Utils.getManhattanDistance(start, p) < Utils.getMa... | 5 |
public ArrayList<Track> returnTracks()
{
ArrayList<Track> trackList = new ArrayList<Track>();
int nextID = 1;
ArrayList<String> paths = new ArrayList<String>();
System.err.println("[INFO] Begin scanning filesystem at " + musicFolderPath);
pathRecurse(musicFolderPath, paths);
System.err... | 4 |
private static void generateQueryFiles(String file) {
HashSet<String> hs = new HashSet<String>();
try {
BufferedReader bReader = new BufferedReader(new FileReader(file));
String line = bReader.readLine();
while ((line = bReader.readLine()) != null) {
String[] lineArray = line.split(",");
if (lineAr... | 6 |
public String buyStock(Stock st, int numShares){
if (money > numShares * st.getPrice()){ // they have enough money
money = money - st.getPrice() * numShares; // decrement money
portfolio = qs.qsort(portfolio, 0); // 0 sorts by ticker name
int index = -1;
// check if they already own some shares in ... | 4 |
private void botonCrearPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCrearPersonaActionPerformed
borrando = false;
// Crea una nueva persona en la lista actual NO en el map, para que sea permante hay que guardar
DefaultTableModel modelo = ((DefaultTableModel) jTa... | 9 |
private Connection getConnectionByName(String aDbName) throws DAOException {
Connection result = null;
String dbConnString = getConnectionString(aDbName);
if( ! Util.textHasContent(dbConnString) ){
throw new IllegalArgumentException("Unknown database name : " + Util.quote(aDbName));
}
... | 5 |
public void moveRight() {
if (StartingClass.gameMode.equals("halloween")) {
if (centerX < 610)
centerX += speed;
} else if (centerX < 650)
centerX += speed;
} | 3 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
lbNome = new javax.swing.JLabel();
lbCidade = new javax.swing.JLabel();
tfNome = new javax.swing.JTextField();
tfEndereco = ne... | 6 |
private StringBuilder createSelectStatement(String cf, Object key,
List<Object> params) {
TableMetadata def = ContextFactory.getMapTableMetadata().get(cf);
StringBuilder selectSql = new StringBuilder("select * from " + Utils.getFullOriginalCF(cf) + " where ");
Boolean isHashMap = false;
HashMap<String, Objec... | 9 |
public void displaygrade() {
System.out.println("Grade report:");
if (counter != 0) {
double average = (double) total / counter;
System.out.println("Average:" + average);
System.out
.printf("Number of students whos received each grade:\nA:%d \nB:%d \nC:%d \nD:%d \nF:%d",
acount, bcount, ccount,... | 1 |
private void setIllegalMonumentsDisabled() {
switch (gamestate.getNumPlayers()) {
case 1:
for (int i = 8; i <= 14; i++) {
checkboxes[i].setEnabled(false);
}
for (int i = 24; i <= 34; i++) {
checkboxes[i].setEnabled(false);
}
for (int i = 48; i <= 62; i++) {
checkboxes[i].setEnabled(false)... | 9 |
public static void main(String[] args)
{
while (true)
{
Scanner keyIn = new Scanner(System.in);
String c = "J";
c = keyIn.nextLine();
if (c.equals("exit") || c.equals("quit"))
break;
if(c.contains("->")) //is reaction (Reaction)
{
R... | 6 |
public void deleteNode(CircularNode node){
CircularNode last=listHead;
CircularNode current=listHead;
if(listHead==null){
return;
}
else if(listHead.equals(node)){
while(last.getNextNode()!=listHead){
last=last.getNextNode();
}
... | 5 |
public void Solve() {
List<Integer> primes = Euler.GetPrimes(_max);
ArrayList<Integer> circularPrimes = new ArrayList<Integer>();
for (int i = 0; i < primes.size(); i++) {
int prime = primes.get(i);
if (prime < 10) {
System.out.println(prime);
... | 5 |
public static void Select_Size_R(String Size_Main) {
String xPath_Start = "html/body/ul[1]/li[";
String xPath_End = "]/a";
int i =2;
boolean end=false;
while (true) {
try {
String Size_Val = driver.findElement(By.xpath(xPath_Start+i+xPath_End)).getText();
double temp1 = Double.parseDoubl... | 4 |
public void lock()
{
if (lockCount++ == 0) {
//QMessageBox.about(this, "LOCK", "");
QCursor cursor = new QCursor();
cursor.setShape(CursorShape.WaitCursor);
QApplication.setOverrideCursor(cursor);
statusPlayer.setText("-");
statusGold.setText("-");
statusOre.setText("-");
statusWood.setText("... | 1 |
private static int decodeSequenceNumber(short sequenceNumber) {
return (int) (sequenceNumber < 0 ? sequenceNumber - 2*Short.MIN_VALUE : sequenceNumber);
} | 1 |
public void parse(String[] args) {
int from = 0;
int to = 1;
while(from < args.length) {
to = from + 1;
if (isKey(args[from]) && isThisKey(args[from])) {
while(to < args.length && !isKey(args[to])) {
to++;
}
doParse(removeKey(Arrays.copyOfRange(args, from, to)))... | 5 |
@Override
public Class<?> getColumnClass( int column ) {
switch( column ){
case 0: return Integer.class;
case 5: return Integer.class;
default: return String.class;
}
} | 3 |
public String potwierdzOsobe(){
return "Potwierdzenie1";
} | 0 |
private Tree jumpConditionPro(){
Tree expression = null;
if(accept(Symbol.Id.PUNCTUATORS,"\\(")!=null){
if((expression = expressionPro()) != null){
if(accept(Symbol.Id.PUNCTUATORS,"\\)")!=null){
return expression;
}
}
}
return null;
} | 3 |
private void renderAcePile(Graphics2D g) {
double x = X_BOARD_OFFSET + CARD_WIDTH * 6 + CARD_X_GAP * 6;
double y = Y_BOARD_OFFSET;
g.setColor(Color.white);
g.drawString("Ace Up", (int) x, (int) y - 1);
for (List<Card> acePile : game.getAcePiles()) {
if (acePile.size()... | 2 |
private void originalKrislet() {
ObjectInfo object;
// first put it somewhere on my side
if (Pattern.matches("^before_kick_off.*", m_playMode))
m_krislet.move(-Math.random() * 52.5, 34 - Math.random() * 68.0);
while (!m_timeOver) {
object = m_memory.getObject("b... | 8 |
public int wrap(final Body s, final int sides) {
Vector2D pos = s.getPosition();
double px = pos.getX();
double py = pos.getY();
int event = 0;
boolean pChange = false;
if (px < -s.getWidth()) {
if ((sides & SIDE_WEST) != 0) {
px = width;
pChange = true;
}
event = SIDE_WEST;
} else if (p... | 9 |
public int read( int lo, int hi ) {
BufferedReader input =
new BufferedReader( new InputStreamReader(System.in) );
int response = -1;
while ( response < lo || response > hi ) {
//************Reads input.**************************
try {
response = Integer.parseInt(input.readLine());
... | 6 |
public static void addByChance(LivingEntity entity, MobAbilityConfig ma)
{
if (ma == null || !isValid(entity))
return;
if (ma.sunProofRate <= 1.0 && ma.sunProofRate != 0.0)
{
// If the random number is lower than the sunproof rate we make the entity sun proof :D
if (ma.sunProofRate == 1.0F || RandomU... | 6 |
public BinaryNode getSuccessor()
{
if(hasChildren()){
if(getLeft() == null && getRight() != null)
return getRight();
else if(getLeft() != null && getRight() == null)
return getLeft();
else // the two children case
return getRight().getLeftmostNode();
}
return null;
} | 5 |
public static XLSRecord getPrototype( int type )
{
FrtWrapper frt = new FrtWrapper();
frt.type = type; // save wrapped type
frt.setOpcode( FRTWRAPPER );
byte[] b = null;
switch( type )
{
case DEFAULTTEXT:
b = frt.P_0; // generate a default text record with 0=show labels
bre... | 8 |
public void insert(String tabName, ArrayList arguments) {
connect();
if(msg.equals("OK")) {
ShowTableBean stb = new ShowTableBean();
int size = arguments.size() * 2;
stb.connect();
ArrayList fields = stb.getAttributies(tabName, "Field");
//Arra... | 8 |
@Reflectable
public static Boolean isActivePID(Integer pid)
{
Map<String, List<String>> result = null;
String windows_cmds[] = SyscallCreatorUtils.generate("tasklist /FO CSV | findstr \"java\"");
String unix_cmds[] = SyscallCreatorUtils.generate("ps -A -o pid,command | grep -i \"java\"" );
try {
if(... | 7 |
@Override
protected Void doInBackground()
{
JSONArray arr = null;
if (directURL != null)
return directDownload();
try
{
String search = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=";
if (customSearch != null)
search += customSearch.replace(" ", "+");
... | 7 |
public static void main(String[] args) {
ThirteensBoard board = new ThirteensBoard();
int wins = 0;
for (int k = 0; k < GAMES_TO_PLAY; k++) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
while (board.playIfPossible()) {
if (I_AM_DEBUGGING) {
System.out.println(board);
}
}
if... | 5 |
protected void addTrees( GridNode64 terrain, double x, double y, double size, List<double[]> atCoords ) {
double subSize = size/8;
if( size <= 8 ) {
for( int sy=0; sy<8; ++sy ) {
for( int sx=0; sx<8; ++sx ) {
Block[] stack = terrain.blockStacks[sx + 8 * sy];
boolean canPlaceHere = false;
for( ... | 9 |
public double[] vectorize() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
/*
* if ((nRows == 0) || (nCols == 0)) { throw new MatrixIndexException(
* "Matrix: either number of rows or number of columns is 0."); }
*/
double data[][] = getDat... | 2 |
private void loadPrefs(boolean sortOnly)
{
if (!sortOnly)
{
DefaultComboBoxModel<String> model = (DefaultComboBoxModel<String>) cmbFilter.getModel();
for (int i = 0; i < 20; i++)
{
String item = prefs.get(PREFS_KEY_FILTER + i, " ");
... | 9 |
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
String elementName = localName;
if ("".equals(elementName)) {
elementName = qName;
}
if(elementName.equals("systemlist")){
currentElement = ProcessingElement.SYSTEMLIST;
collection = new... | 7 |
public static void startupRdbms() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/RDBMS", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module... | 6 |
private String makeComment(){
String c=((ComboText)command.getSelectedItem()).getValue();
String t=((ComboText)command.getSelectedItem()).getText();
String ico=((ComboText)command.getSelectedItem()).getIcon();
String obj=logoObj.getText();
//if(global.useJLabels)
// t=... | 8 |
private static boolean isDiffLegal(long toCheck, long ref) {
return ((toCheck - ref) % TIME_UNIT) == 0;
} | 0 |
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result
+ ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((login == null) ? 0 : login.hashCode());
result = ... | 4 |
public static byte[] stringToBytes(String str) {
if (str.length() % 2 == 1) {
throw new IllegalArgumentException("Invalid length");
}
int len = str.length() / 2;
byte[] bytes = new byte[len];
for (int i = 0; i < len; i++) {
int i... | 2 |
private JoinList deSerializza()
{
FileInputStream fin;
ObjectInputStream input = null;
JoinList letto = null; //file che deve essere letto dal .dat
File f = new File("plugins/" + name + "/giocatori.dat");
if(f.exists())
{
//System.out.println("File dati giocatori esiste");
try{
fin = new F... | 5 |
public static Integer calculateFactorial(Integer n) {
Integer factorial = 1;
for (int i=1; i<=n; i++) {
factorial *= i;
}
return factorial;
} | 1 |
public Set<Map.Entry<Short,Short>> entrySet() {
return new AbstractSet<Map.Entry<Short,Short>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortShortMapDecorator.this.isEmpty();
}
p... | 8 |
public void ouvrirFichier() {
JFileChooser jFileChooserXML = new JFileChooser();
jFileChooserXML.setDialogTitle(title);
jFileChooserXML.setCurrentDirectory(new File(starting_directory));
if(is_saving_mode) {
jFileChooserXML.setDialogType(JFileChooser.SAVE_DIALOG);
if (jFileChooserXML.showSaveDialo... | 3 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... | 6 |
public void viewAutomaton(JTableExtender table){
InputTableModel model = (InputTableModel) table.getModel();
if(model.isMultiple){
int row = table.getSelectedRow();
if(row < 0) return;
String machineFileName = (String)model.getValueAt(row, 0);
updateV... | 4 |
@Override
public String adiciona(HttpServletRequest request,
HttpServletResponse response) {
String filtro = request.getParameter("filtro");
EmpresaDAO empresa = new EmpresaDAO();
Collection<Empresa> empresas = empresa.buscaPorSimilaridade(filtro);
request.setAttribute("empresas", empresas);
return "WE... | 0 |
public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException
{
if(!isGameOver)
{
if(!isPause)
{
}
else
{
}
}
else
{
}
} | 2 |
public boolean playerHasItemAmount(int itemID, int itemAmount) {
//if(itemID == 0 || itemAmount == 0) return true;
playerItemAmountCount = 0;
for (int i=0; i<playerItems.length; i++)
{
if (playerItems[i] == itemID+1)
{
playerItemAmountCount = playerItemsN[i];
}
if(playerItemAmountCount >=... | 3 |
private void updateTestdataValue(TestcaseStep tcStep , Map<String, String> testdataRow) {
String testdataValue;
logger.info("UpdateTestdata value - \n TestcaseID:"+ tcStep.getTestcaseID() + " , StepID:"+tcStep.getStepID());
logger.info("TestdataName::" + tcStep.getTestDataName()+ " , TestdataType::"+tcStep.getTes... | 7 |
@Override
public boolean tick(Tickable ticking, int tickID)
{
if(!(affected instanceof MOB))
return super.tick(ticking,tickID);
if((tickID==Tickable.TICKID_MOB)&&(STEPS!=null))
{
if((STEPS!=null)&&((STEPS.size()==0)||(STEPS.isDone())))
{
if(((MOB)ticking).isInCombat())
return true; // let them... | 7 |
public static void testSeqWrite() throws IOException{
Write wr = new Write();
wr.startTest();
} | 0 |
private void stopRealServer() throws Exception {
if ( _itpServer != null ) {
_itpServer.stop();
}
} | 1 |
public void act(){
if (clicked){
this.setImage (bg[2]);
}
else if (selected){
selected = false;
this.setImage (bg[1]);
}
else{
this.setImage (bg[0]);
}
} | 2 |
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.