text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void put(Object o)
{
queueList.addLast(o);
} | 0 |
public final Section build() {
final Section SECTION = new Section();
for (String key : properties.keySet()) {
if ("start".equals(key)) {
SECTION.setStart(((DoubleProperty) properties.get(key)).get());
} else if("stop".equals(key)) {
SECTION.setSto... | 6 |
public void run() {
while (active) {
int mod = timeElapsed % 7;
switch(mod)
{
case 0:
log.info("info level log.");
break;
case 1:
log.debug("debug level log.");
break;
case 2:
log.error("error level log");
break;
case 3:
log.warn("warn level log");
break;
case 5... | 7 |
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scanner = new Scanner(System.in);
int m=scanner.nextInt();//灯的数目
int array[]=new int[m+1];
for(int i=0;i<m+1;i++){
array[i]=0;
}
for(int i=1;i<m+1;i++){
int flag=i;
int flag1=flag;
while(flag1 < m+1){... | 6 |
public int tsfLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod-1;
} | 3 |
public void checkCbolOriginalDirV2() {
Path dir = Paths.get(CBOL_HOME);
//
//http://docs.oracle.com/javase/tutorial/essential/io/dirs.html
String str;
String str2;
String str3;
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
for (... | 3 |
public boolean removeHotkeyBinding(String key) {
if (!this.fileLoaded) {
return false;
}
try {
XMLNode hotkeysNode = this.rootNode.getChildNodesByType("hotkeys")[0];
XMLNode[] hotkeys = hotkeysNode.getChildNodesByType("hotkey");
for (XMLNode node... | 4 |
public Report getReportById(int report_id) {
Report r = new Report();
ResultSet rs = null;
try {
statement = connection.createStatement();
String sql = "select * from reports where id = " + report_id;
rs = statement.executeQuery(sql);
if(rs.next()) {
r.setCabin_id(rs.getInt("cabin_id"));
r.se... | 6 |
private GsSong[] readFile(File f) {
if(!f.exists())
return null;
try {
int size=0;
GsSong[] res=new GsSong[1];
res[0]=null;
BufferedReader in=new BufferedReader(new FileReader(f));
String line;
while((line=in.readLine())!=null) {
if(line.length()==0) // skip empty lines
continue;
i... | 7 |
private void downloadSW(String url) {
String fileSizeString = "";
long fileSize = 1;
_percent = 0;
try {
_builder = new ProcessBuilder(_downloadcmd, "-c", "--progress=bar",
url);
_builder = _builder.redirectErrorStream(true);
_process = _builder.start();
InputStream stdout = _process.getInputS... | 7 |
public static ReservedWords parseCommand(String command) {
if (command.equalsIgnoreCase("add"))
return ReservedWords.ADD;
if (command.equalsIgnoreCase("create"))
return ReservedWords.CREATE;
if (command.equalsIgnoreCase("remove"))
return ReservedWords.REMOVE;
... | 7 |
public float getRZAxisDeadZone() {
if (rzaxis == -1) {
return 0;
}
return getDeadZone(rzaxis);
} | 1 |
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 SaveGraphJPGAction(Environment environment, JMenu menu) {
super("Save Graph as JPG", null);
this.environment = environment;
this.myMenu = menu;
} | 0 |
@Override
public void paintBorder(final Component c, Graphics g, int x, int y, int width, int height) {
Color saveColor = g.getColor();
try {
final Rectangle r = c.getBounds();
if (options.top > 0) {
int colorIndex = startIndex;
for (int i = r.x; i < (r.x + r.width); i += options.top) {
g.setC... | 9 |
public void updatePositions(){
dyingParticles.clear();
for(Particle p: aliveParticles){
if( checkCollision( p.getxPosition(), p.getyPosition() ) == true ){
for( int newx = (p.getxPosition() - 2) ; newx <= (p.getxPosition() + 2) ; newx++){
for( int newy = (p.getyPosition() - 2) ; newy <= (... | 9 |
private void runClient() {
try {
System.out.println("Client: Ready for commands (hit 'enter' for command list)");
BufferedReader bufferedPromptReader = new BufferedReader(new InputStreamReader(System.in));
// Loop taking input until exit
while(!exit) {
System.out.print(">>> ");
parseInput(b... | 4 |
@Override
public Cliente getByCpf(Cliente cliente) {
Cliente clienteLido = null;
try{
conn = ConnectionFactory.getConnection();
String sql = "SELECT nome FROM cliente WHERE cpf LIKE ?";
ps = conn.prepareStatement(sql);
ps.setString(1, cliente.getCpf()... | 3 |
private void showIfInfo (StringBuffer buf, Configuration config)
{
int numIf = config.getNumInterfaces ();
byte epStatus [] = new byte [2];
for (int i = 0; i < numIf; i++) {
try {
Interface intf = config.getInterface (i, 0);
// some devices don't expose these when configured
if (intf == null) {
... | 9 |
public static void main(String[] args) throws InterruptedException {
int loadedLevel = 0;
startMenu();
while (true) {
if (loadedLevel != level && level > 0) {
loadedLevel = level;
if (level > 0 && !LevelSet.levelExists(level)) {
Sys... | 8 |
private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
ClienteController control = new ClienteController(mode);
try {
if (!textCodigo.getText().isEmpty()) {
int codigo = Integer.parseInt(textCodigo.getText());
if (c... | 7 |
void updateColumnWidth (CTableColumn column, GC gc) {
int columnIndex = column.getIndex ();
gc.setFont (getFont (columnIndex, false));
String oldDisplayText = displayTexts [columnIndex];
computeDisplayText (columnIndex, gc);
/* the cell must be damaged if there is custom drawing being done or if the alignment is ... | 6 |
private int[] totals(int[][] values) {
int[] totals = {0,0,0,0,0,0,0};
for (int i=0; i<7; i++) {
for (int in=0; i<4; i++) {
if (in%2 == 0) {
totals[i] = totals[i]+values[i][in];
} else {
totals[i] = totals[i]-values[i][in];
}
}
}
return totals;
} | 3 |
public void fillRandomly() {
for (int i = 0; i < rows; i++)
for (int j = 0; j < columns; j++) {
int r = (int)(256*Math.random());
int g = (int)(256*Math.random());
int b = (int)(256*Math.random());
grid[i][j] = new Color(r,g,b);
}
forceRedraw... | 2 |
public void histogram(Graphics g) {
g.drawLine(rightOffset, 0, rightOffset, getHeight() - bottomOffset);
g.drawLine(rightOffset, getHeight() - bottomOffset, getWidth()-rightOffset, getHeight() - bottomOffset);
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_AN... | 9 |
public Matrix plus(Matrix B) {
Matrix A = this;
if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions.");
Matrix C = new Matrix(M, N);
for (int i = 0; i < M; i++)
for (int j = 0; j < N; j++)
C.data[i][j] = A.data[i][j] + B.data[i]... | 4 |
@Override
public void generate() throws GeneratorException {
Options options = Options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
try {
report.generate(options, report.getOutput()+".pdf");
} catch (XDocConverterException e) {
throw new GeneratorException(GeneratorError.PDF_CONVERTION_ERROR,"Err... | 2 |
public static void simpleKMeans(Instances data, Instances originalData) throws Exception {
// create a KMeans clusterer
SimpleKMeans skm = new SimpleKMeans();
skm.setNumClusters(3);
skm.buildClusterer(data);
// evaluate the KMeans clusterer
ClusterEvaluation skmEvaluation = new ClusterEvaluation();
skmEv... | 5 |
private void resizeScreenIfNeeded() {
TerminalSize newSize;
synchronized(resizeQueue) {
if(resizeQueue.isEmpty())
return;
newSize = resizeQueue.getLast();
resizeQueue.clear();
}
int height = newSize.getRows();
int width = newS... | 9 |
private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... | 7 |
public RandomDateGenerator(String tableName, String columnName, Date start, Date end) {
super(tableName, columnName);
this.start = start;
this.end = end;
sdf = new SimpleDateFormat("yyyy-MM-dd");
} | 0 |
private void xmlBuildRootNode(org.w3c.dom.Node node) throws SAXNotRecognizedException, SAXException {
if(node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element elt = (Element) node;
String name = elt.getNodeName();
if(name.equals("DockingPanel")) {
// only one child at most
NodeList children ... | 7 |
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._const_ == oldChild)
{
setConst((TConst) newChild);
return;
}
if(this._var_ == oldChild)
{
... | 3 |
byte[] readCodewords() throws FormatException {
FormatInformation formatInfo = readFormatInformation();
Version version = readVersion();
// Get the data mask for the format used in this QR Code. This will exclude
// some bits from reading as we wind through the bit matrix.
DataMask dataMask = Data... | 9 |
private ArrayList<Piece> getBlackTeamPieces()
{
ArrayList<Piece> blackTeam = new ArrayList<>();
// adds all pieces, except kings, to their appropriate teams in an ArrayList
for(int y = 0; y < maxHeight; y++)
{
for(int x = 0; x < maxWidth; x++)
{
Piece currentPiece = board.getChessBoardSquare(x, y)... | 4 |
public static void main(String[] args) throws IOException {
try {
BufferedReader br = new BufferedReader(new FileReader("Data/Prediction_Similarities/sim.dat"));
String line;
while ((line = br.readLine()) != null) { // while loop begins here
String[] splitLine = line.split("\t");
int userId = Intege... | 7 |
public void checkObject () {
Object object = (Object)getOneIntersectingObject(Object.class);
if( object != null ) {
if ( object instanceof CharPlayer ) {
//CharBot.setSlowSpeed(4);
//destroy();
}
else if ( object instanceof CharBot ) {
... | 4 |
public void setMonths(ArrayList <Month> m)
{
months = m;
} | 0 |
public int Expect(String Data, int NumBytes )
{
byte target = 0;
int cnt = 0;
try
{
while ((NumBytes--) != 0)
{
target = file.readByte();
if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR;
}
} catch (IOException ioe)
{
return DDC_FILE_ERRO... | 3 |
public void setMimeType(String mimeType) {
this.mimeType = mimeType;
} | 0 |
final public void Relation_operator() throws ParseException {
/*@bgen(jjtree) Relation_operator */
SimpleNode jjtn000 = new SimpleNode(JJTRELATION_OPERATOR);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
if (jj_2_65(3)) {
... | 7 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
if (idmessage != message.idmessage) return false;
if (content != null ? !content.equals(message.content) : messa... | 8 |
private Tuple<Float, HeuristicData> min(LongBoard state, HeuristicData data, float alpha,
float beta, int action, int depth) {
statesChecked++;
Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MAX_VALUE, data);
Winner win = gameFinished(sta... | 8 |
public Occurrence(String name){
this.docName = name;
this.termFrequency = 1;
} | 0 |
@Override
protected void processTask() {
String visitingUrl = _url.toString();
Document page = null;
try {
// Wikipedia's robots.txt advises a crawl-delay of atleast 1 sec
Thread.sleep(1000);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
... | 9 |
public static String pedirDni(){
boolean correcto=false;
String dni="";
try{
do{
System.out.print("DNI => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
dni=stdin.readLine();
correcto=Operaciones.isdni(dni);
}while(correcto==false);
}catch(Exception e){
Syste... | 2 |
public static Object getJsonContent(URL url, String method, Type classToConvert){
HttpURLConnection conn=null;
Object obj=null;
try {
conn = HTTPConnector.HTTPConnect(url,method, null);
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//set the json file content
ob... | 1 |
private boolean post2Qc()
{
boolean uploaded = true;
List<String> logFilePaths = testRunInfo.getClientLogFilePaths();
TestRunInfo newTestRun = null;
try {
newTestRun = qcConnector.postResult2Qc(testRunInfo);
if (newTestRun != null) {... | 9 |
public static UncertainPlayer fromConfiguration(String configuration) {
String name = "uncertain";
int sample_size = -1;
int decision_time = 5000;
long seed = System.currentTimeMillis();
double alpha = 1;
boolean verbose = true;
for (Map.Entry<String,String> entry: Util.parseConfiguration(configuration).... | 7 |
public boolean validarConexion (String n_url, String n_port, boolean seg_int, String n_usu, String n_cla){
boolean valida = false;
if (! n_port.equals("")){
port = n_port;
}
else{
port = "1433";
}
String urlConexion = jdbc+n_u... | 6 |
private static int isFullHouse(ArrayList<Card> list) {
assert(list.size() == EFFECTIVE_CARD_NUM);
int setPos = containSet(list);
if (setPos < 0 || setPos == 1 ){
return -1;
}
if (setPos == 0 && list.get(3).getPoint() == list.get(4).getPoint()){
return list.get(0).getPoint();
}
if (setPos... | 6 |
public Connection getConnection()
{
try
{
if ((MySQLCore.connection == null) || (MySQLCore.connection.isClosed()))
{
initialize();
}
}
catch (SQLException e)
{
initialize();
}
return MySQLCore.connection;
} | 3 |
public void remove()
{
q.clear();
} | 0 |
public void soften() {
RadialBondCollection rbc = model.getBonds();
RadialBond rb;
synchronized (rbc.getSynchronizationLock()) {
for (Iterator it = rbc.iterator(); it.hasNext();) {
rb = (RadialBond) it.next();
if (contains(rb.getAtom1()) && contains(rb.getAtom2())) {
rb.setBondStrength(SOFT_BOND);... | 7 |
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
PrintWriter cout = new PrintWriter(System.out);
int number, len;
HashMap<String, Integer> hashcount = new HashMap<String, Integer>();
while (true) {
number = sc.nextInt();
len = sc.... | 7 |
@Override
public T next()
{
try
{
resultSet.next();
// Instantiate T to fill be able to fill it with result data
T instance = c.newInstance();
// Column names are stored in the metaData
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
for (int columnIndex = 1; true; col... | 5 |
@Override
public BlocService getBloc(int i, int j){
BlocService b;
if(!(0<=i && i<super.getNombreColonnes() && 0<=j && j<super.getNombreLignes()))
throw new PreConditionError("unboud i or j");
checkInvariants();
b = super.getBloc(i, j);
checkInvariants();
return b;
} | 4 |
public String GetLaunchUrlWithTags(String registrationId, String redirectOnExitUrl, String cssUrl, String debugLogPointerUrl, String learnerTags, String courseTags, String registrationTags) throws Exception
{
ServiceRequest request = new ServiceRequest(configuration);
request.getParameters().add("re... | 6 |
public static boolean saveNewWord(ArrayList<WordsPair> stringArray, String filename) {
if (stringArray == null) {
return false;
} //Checking parameter for null.
FileWriter output; //Creating reference for filewriter.
try {
output = new FileWriter(new File(filen... | 3 |
public static void main(String[] args) {
Terrain mount1 = Terrain.getMountain();
Terrain mount2 = Terrain.getMountain();
if (mount1.equals(mount2)) {
System.out.println("Son la misma montaña");
}
GridCell map[][] = new GridCell[33][38];
System.out.println("La... | 8 |
protected static Ptg calcDAverage( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.find... | 9 |
public void setJSONDataInArray(int id_cod, String cod_rastreio){
JSONParser parser = new JSONParser();
JSONArray a;
all = "";
try
{
String url_link = "http://developers.agenciaideias.com.br/correios/rastreamento/json/" + cod_rastreio;
this.url = new URL(ur... | 4 |
protected void keyTyped(char par1, int par2)
{
if (par2 == 15)
{
this.completePlayerName();
}
else
{
this.field_50060_d = false;
}
if (par2 == 1)
{
this.mc.displayGuiScreen((GuiScreen)null);
}
else i... | 9 |
public ShadingPattern(Library library, Hashtable entries) {
super(library, entries);
type = library.getName(entries, "Type");
patternType = library.getInt(entries, "PatternType");
Object attribute = library.getObject(entries, "ExtGState");
if (attribute instanceof Hashtable) {... | 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 |
@Override
public Component getTreeCellRendererComponent(JTree tree,
Object value, boolean selected, boolean expanded,
boolean leaf, int row, boolean hasFocus) {
super.getTreeCellRendererComponent(tree, value, selected,expanded, leaf, row, hasFocus);
if(value instanceof SPFile... | 3 |
public void produceEmails(){
emails.removeAll(emails);
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
}
PreparedStatement ps = nul... | 6 |
public void visitCallMethodExpr(final CallMethodExpr expr) {
if (expr.receiver() != null) {
expr.receiver().visit(this);
}
print(".");
if (expr.method() != null) {
print(expr.method().nameAndType().name());
}
print("(");
if (expr.params() != null) {
for (int i = 0; i < expr.params().length; i++... | 5 |
public static boolean intersect(Rectangle a,Rectangle b) {
// boolean x = (a.left() <= b.right() && a.right() >= b.left()) || (a.left() >= b.left() && a.right() <= b.right()) || (a.left() <= b.right() && a.right() >= b.right());
// boolean y = (a.top() <= b.bottom() && a.bottom() >= b.top()) || (a.top() >= b.top() &... | 3 |
public void nextHit() {
if (current == "Registration") {
if (helpy.isSelected()) {
NewUser newbie = new NewUser();
Helpy helpMe = new Helpy(newbie.txuser.toString(), newbie.pass1.getText());
} else if (needy.isSelected()) {
NewUser newbie = new NewUser();
Needy meNeed = new Needy(newbie.txus... | 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 fe... | 6 |
private void MergeSortParts(int low, int mid, int high) {
for (int i = low; i <= high; i++) {
tempArray[i] = array[i];
}
int i = low;
int j = mid + 1;
int k = low;
while (i <= mid && j <= high) {
if (tempArray[i] <= tempArray[j]) {
... | 5 |
public ChatServer() {
try {
ssocket = new ServerSocket(port);
} catch (IOException e) {
e.printStackTrace();
}
} | 1 |
public void test() throws ModelException
{
Account a = new Account();
FIXMLBuilder builder = new FIXMLBuilder(a);
builder.timeInForce(TimeInForceField.DAY_ORDER);
builder.symbol("OCQLF");
builder.priceType(PriceType.LIMIT);
builder.securityType(SecurityType.STOCK);
builder.quantity(1);
builder.executio... | 2 |
public boolean containsTag(Tag tag)
{
if (hasTag(tag))
return true;
else
{
for (GenericTreeNode child : getChildren())
if (((Area) child).hasTag(tag))
return true;
return false;
}
} | 3 |
void readAtoms(int modelAtomCount) throws Exception {
for (int i = 0; i < modelAtomCount; ++i) {
readLine();
Atom atom = atomSetCollection.addNewAtom();
int isotope = parseInt(line);
String str = parseToken(line);
// xyzI
if (isotope == Integer.MIN_VALUE) {
atom.elementSy... | 9 |
public float getDelay(Component cmp) {
return delays.containsKey(cmp) ? delays.get(cmp) : 0;
} | 1 |
public void lazilyExit() {
Thread thread = new Thread() {
public void run() {
// first, wait for the VM exit on its own.
try {
Thread.sleep(2000);
}
catch (InterruptedException ex) { }
// system is st... | 1 |
public void checkConsistent() {
super.checkConsistent();
if (trueBlock.jump == null || !(trueBlock instanceof EmptyBlock))
throw new jode.AssertError("Inconsistency");
} | 2 |
public static ArrayList<UserStocks> getUserStocks() {
ArrayList<UserStocks> usersStocks = new ArrayList<UserStocks>();
File f = new File("userstocks.txt");
try {
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
String s = "";
while ((s = br.readLine()) != null) {
S... | 2 |
@Override
public List<Image> getImages() {
if(images != null)
return images;
File[] imageFiles = directory.listFiles();
Arrays.sort(imageFiles);
images = new ArrayList<Image>();
for(File f : imageFiles)
if(f.isFile() && !f.ge... | 4 |
private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... | 8 |
@Override
public TrackerResponse sendRequest (TrackerRequest request, long time, TimeUnit unit) {
long remaining = unit.toNanos(time);
int left = trackers.size();
for (Iterator<Tracker> it = trackers.iterator(); it.hasNext() && remaining > 0;) {
long stTime = System.nanoTime();
... | 3 |
public void setLoc(Atom new_loc)
{
if(location != null)
{
location.contents.remove(this);
}
location = new_loc;
this.outdated |= Atom.positionOutdated;
if(new_loc != null)
{
new_loc.contents.add(this);
}
} | 2 |
@Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... | 1 |
@Override
public void update(GameContainer container, int delta) throws SlickException {
if(wturn){
wturn = !players[0].go(container, board);
}
else{
wturn = players[1].go(container, board);
}
} | 1 |
public ArrayList<String> getTags() {
ArrayList<String> tagList = new ArrayList<String>();
String statement = new String("SELECT * FROM " + TagDBTable + " WHERE qid = ?");
PreparedStatement stmt;
try {
stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, quizID);
ResultSet rs = stmt.execu... | 2 |
private static Person getPerson(String[] personInfo) {
Integer classValue = 0;
if ("50000+".equals(personInfo[41])) {
classValue = 1;
}
Person person = new Person(classValue);
person.addAttribute(0, Double.parseDouble(personInfo[0]));
person.addAttribute(1, D... | 3 |
public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out"... | 2 |
public synchronized void shutdown(){
if(!shutdown)
shutdown = true;
//Poll the queue and release all objects left in the queue.
while(true){
Reference<?> ref = queue.poll();
if(ref != null){
Resource res = refs.get(ref);//Get the resource by the reference.
refs.remove(ref);//Remove the object ... | 4 |
public ArrayList<String> personToTopicPopulate(String name) {
// arraylist that will populate the topic list based on person selected
ArrayList<String> personToTopic = new ArrayList();
try {
// open the file
File xmlPerson = new File(fileName);
DocumentBuilder... | 6 |
private DelegateGroupVotes createDelegateGroupVotes(
EntityUserAndVote delegate,
Map<Key, DelegateGroupVotes> allVotesMap,
Map<Key, List<EntityUserAndVote>> delegateVotes) {
Key delegateKey = Key.EMPTY;
if (delegate != null) {
delegateKey = delegate.getUser().getId().getKey();
}
... | 5 |
public Expr Shift_Expr() throws ParseException {
Expr e, et;
Token tok;
e = Add_Expr();
label_23:
while (true) {
switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case SHIFTLEFT:
case SHIFTRIGHT:
break;
d... | 7 |
@Override
public float isContextMenuEnabledAt( int x, int y ) {
SelectableCapability selection = getCapability( CapabilityName.SELECTABLE );
if( selection != null ) {
return selection.contains( x, y );
} else {
return 0.f;
}
} | 1 |
private String receiveThinking(long time, LineEval finalEval) {
// Built the pv line
String pvString = "";
for(int i = 0; i < 128; i++) {
if(i == 0) {
pvString += (Move.inputNotation(finalEval.line[0]) + " ");
} else if(finalEval.line[i] == 0) break;
else pvString += (Move.inputNotation(finalEval.lin... | 6 |
public int compareTo( Object obj ) {
if( obj == null ) {
return( 1 );
}
else if( obj instanceof GenKbAddressByUDescrIdxKey ) {
GenKbAddressByUDescrIdxKey rhs = (GenKbAddressByUDescrIdxKey)obj;
if( getRequiredContactId() < rhs.getRequiredContactId() ) {
return( -1 );
}
else if( getRequiredContac... | 9 |
public void keyPressed (KeyEvent e) {
int key = e.getKeyCode();
// Implemented boolean switches for the collider. Player can't move unless these are true.
if ((key == KeyEvent.VK_W) && (directy == true)) dy = -1;
if ((key == KeyEvent.VK_S) && (directy == true)) dy = 1;
if ((key == KeyEvent.VK_... | 8 |
private void activity_submitModify_buttonActionPerformed(ActionEvent evt,
String courseID, String actName) {
boolean prog; boolean group;
if(activity_type_combo.getSelectedItem().toString().equalsIgnoreCase("Programming"))
prog = true;
else
prog = false;
if(activity_group_checkbox.isSelected())
gro... | 3 |
public static boolean lostOnlyPart(Robot paramRobot, Class paramClass) {
Enumeration localEnumeration = GameApplet.thisApplet.getGameState().getRobotPartPatterns().elements();
while (localEnumeration.hasMoreElements())
if (paramClass.isInstance(localEnumeration.nextElement()))
return false;
Ro... | 4 |
public static SignalAspect mostRestrictive(SignalAspect first, SignalAspect second) {
if (first == null && second == null)
return RED;
if (first == null)
return second;
if (second == null)
return first;
if (first.ordinal() > second.ordinal())
... | 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.