text stringlengths 14 410k | label int32 0 9 |
|---|---|
public int getNowYear() {
return Integer.parseInt(sysNowTime[5]);
} | 0 |
public static void main(String[] args) {
if (args.length >= 2 && args[0].endsWith("output:xml")) {
File in = new File(args[1]);
if (!in.exists()) {
printUsage();
System.exit(1);
}
File out;
if (args.length >= 3) {
... | 6 |
public void updateItem(HttpServletRequest arequest) throws Exception
{
for (int idx = this.getCount()-1; idx >= 0; idx--)
{
CNonadItem myitem = (CNonadItem) this.getItem(idx);
String datid = "Ndate" + myitem.nonadmid;
String serid = "NonSeries" + myitem.nonadmid;
Strin... | 7 |
public List<Player> getPlayersInRegion() {
List<Player> rangeList = new ArrayList<Player>();
for (Player p : FFA.getServer().getOnlinePlayers()) {
Location loc = p.getLocation();
Vector vec = new Vector(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if (this.contains(p.getWorld(), vec)) {
rangeLis... | 2 |
@Override
public List<Framedata> translateFrame( ByteBuffer buffer ) throws InvalidDataException {
buffer.mark();
List<Framedata> frames = super.translateRegularFrame( buffer );
if( frames == null ) {
buffer.reset();
frames = readyframes;
readingState = true;
if( currentFrame == null )
currentFra... | 5 |
public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope,
Scriptable thisObj, Object[] args)
{
if (!f.hasTag(FUNCTION_TAG)) {
return super.execIdCall(f, cx, scope, thisObj, args);
}
int id = f.methodId();
switch (id) {
... | 8 |
public void showPage(int page) {
if (!hasPage(page))
page = 1;
int start = elementsPerPage * (page - 1);
System.out.println("====[" + title + " Page " + page + "/" + pages + titleContainer + "]====");
if (subtitle != null && !subtitle.isEmpty())
System.out.println(subtitle);
for (int i = start; i < star... | 5 |
public int largestRectangleArea(int[] height) {
Stack<Integer> stk = new Stack<Integer>();
int index = 0;
int result = 0;
while (index<height.length) {
if (stk.isEmpty()||height[stk.peek()]<=height[index]) {
stk.push(index);
index++;
... | 6 |
private String getHeaderCaseInsensitive(String name) {
Validate.notNull(name, "Header name must not be null");
// quick evals for common case of title case, lower case, then scan for mixed
String value = headers.get(name);
if (value == null)
value = header... | 3 |
public static void startupPropositions() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, (... | 7 |
public void GenerateTiles(){
for(int l=0;l<WrittenBlockID.length;l++){
for(int h=0;h<WrittenBlockID[l].length;h++){
for(int w=0;w<WrittenBlockID[l][h].length;w++){
if(l==0){
WrittenBlockID[l][h][w]=1;
}else{
if(h==0){
WrittenBlockID[l][h][w]=2;
}else if(h==WrittenWorldH-... | 8 |
private void displayReview() {
ArrayList<Task> tasks = calendar.getTasks();
for (Task t : tasks) {
if (TaskService.isTaskToday(t)) {
System.out.println(t.toString());
}
}
} | 2 |
public ArrayList moves(Point point)
{
ArrayList a = new ArrayList();
Iterator it = point.neighbors().iterator();
while(true)
{
if (!it.hasNext())
break;
Point point1 = (Point) it.next();
if (isInBounds(point1) && isOpen(point1) && !... | 5 |
public void setEmail(String email) {
this.email = email;
} | 0 |
private static void writeTextFile(Path path){
BufferedWriter bufferWriter=null;
try{
//apertura del stream. StandardOpenOption.CREATE->si el fichero no existe se crea
bufferWriter=Files.newBufferedWriter(path,
java.nio.charset.StandardCharsets.UTF_8, java.nio... | 4 |
private String assembleAuthority(
String host,
int port,
String userInfo,
String authority
) {
if (authority != null) {
return authority;
}
StringBuffer buf = new StringBuffer();
// UserInfo
if (userInfo != null) {
buf.append(userInfo);
buf.append(USERINFO_DELIM);
}
// Host. Not... | 4 |
public int yCoordToRowNumber(int y) {
Insets insets = getInsets();
if (y < insets.top)
return -1;
double rowHeight = (double)(getHeight()-insets.top-insets.bottom) / rows;
int row = (int)( (y-insets.top) / rowHeight);
if (row >= rows)
return rows;
else
retu... | 2 |
public TSValue abstractRelationalComparison(final TSValue right)
{
TSNumber ny = right.toNumber();
// if nx is NaN return undefined
if (Double.isNaN(this.getInternal())){
return TSUndefined.value;
}
// if ny is NaN return undefined
else if (Double.isNaN(ny.getInternal()))
{
return TSUndefined.va... | 8 |
private static int parseInt(String s) {
if (s.startsWith("0x")) {
return Integer.parseInt(s.substring(2), 16);
}
else {
return Integer.parseInt(s);
}
} | 1 |
public static void render(Entity e, Graphics2D g) {
Color oldColor = g.getColor();
Font oldFont = g.getFont();
if (e instanceof Asteroid) {
renderAsteroid((Asteroid) e, g);
} else if (e instanceof Ship) {
renderShip((Ship) e, g);
} else if (e instanceof Bullet) {
renderBullet((Bullet) e, g);
} e... | 6 |
private void activateRow()
{
// Make sure the file exists (and that something is selected)
if(MainFrame.getInstance().selectedFile != null
&& MainFrame.getInstance().selectedFile.toFile().exists())
{
// Go into directories
if(MainFrame.getInstance().selectedFile.toFile().isDirectory())
{
logger.... | 4 |
public boolean resetPasswordWithToken(Token t, User u, Map<String,String> parameters)
{
if (!parameters.containsKey("password") || !parameters.containsKey("reset_token"))
{
GoCoin.log(new Exception("Invalid parameters for resetPasswordWithToken!"));
return false;
}
//TODO: pull out map keys a... | 3 |
public boolean hasChild(String child_key) {
String[] split = child_key.split("[.]", 2);
// This should never occur but just in case
if (split.length == 0) {
return false;
} else if (split.length == 1) { // child key was a single name
return children.containsKey(child_key);
} else if ((split.length ... | 8 |
public final double nextDouble()
{
if(mti >= 624)
{
int i2;
for(i2 = 0; i2 < 227; i2++)
{
int i = mt[i2] & 0x80000000 | mt[i2 + 1] & 0x7fffffff;
mt[i2] = mt[i2 + 397] ^ i >>> 1 ^ mag01[i & 1];
}
for(; i2 < 6... | 6 |
public void launch(int threads){
service = Executors.newFixedThreadPool(threads);
for (int i = 0; i < tblData.size(); i++) {
String url = tblData.get(i)[0];
Runnable worker = new WebWorker(url, i, frame);
if (!Thread.interrupted()) {
service.submit(worker);
} else {
break;
}
}
service.... | 2 |
public void put(String key, Object value) {
// если корня нет - вставить в корень
if (root == null) {
Node newNode = new Node(key, value);
root = newNode;
} else {
boolean inserted = false;
Node currentNode = root;
while (!inserted) {
int compare = key.compareTo(current... | 7 |
private int hash(PageId pageNo) {
return (pageNo.pid % HTSIZE);
} // end hash() | 0 |
public int threeSumClosest(int[] num, int target) {
Arrays.sort(num);
int mx =num[0]+num[1]+num[2];
int sum =0;
int length = num.length;
for (int i = 0; i < length-2; i++) {
int j = i + 1;
int k = length - 1;
while (j < k) {
sum... | 5 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Prescale other = (Prescale) obj;
if (moduloDivide == null) {
if (ot... | 9 |
private void grow() {
Bucket[] oldBuckets = buckets;
int newCap = buckets.length * 2 + 1;
threshold = (int) (loadFactor * newCap);
buckets = new Bucket[newCap];
for (int i = 0; i < oldBuckets.length; i++) {
Bucket nextBucket;
for (Bucket b = oldBuckets[i]; b != null; b = nextBucket) {
if (i != Math.... | 3 |
public World getCurrentWorld() {
return currentWorld;
} | 0 |
private void noloteFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_noloteFieldKeyTyped
// TODO add your handling code here:
if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && evt.getKeyChar() !='-' && evt.getKeyChar() != '.')
{... | 5 |
public static void inputFleet(Player p){
String nameBoat = "";
for(int i=0; i<GameConfiguration.gameConfiguration_NBSHIP; i++){
boolean add = false;
while(!add) {
Ship s = null;
System.out.println(Game.display(p.myGrid.displayOwnGrid()));
switch(i) {
case 0:
nameBoat = "Get ready... | 9 |
public void optionsChangedListener() {
volume = Application.get().getOptions().soundVolume();
musicVolume = Application.get().getOptions().musicVolume();
for(IntBuffer source : sources) {
AL10.alSourcef(source.get(0), AL10.AL_GAIN, volume);
}
if(currentMusic ... | 2 |
public static void main(String arguments[]){
try{
if(arguments != null && arguments.length > 0 && "--help".equalsIgnoreCase(arguments[0])){
log.info(ArgsParser.help);
return;
}
Args args = new ArgsParser().parse(arguments);
printArg... | 5 |
final public Sort[] CobSortsDecl(Module module) throws ParseException {
Sort[] sorts;
Vector vec = new Vector();
Sort sort;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SORT:
jj_consume_token(SORT);
break;
case SORTS:
jj_consume_token(SORTS);
break;
default:
jj_... | 8 |
TetrisPiece()
{
int type = (int) (NumBrickTypes * Math.random() ); //rand() % globals.NumBrickTypes;
int pose = (int) (NumPoses * Math.random() );//rand() % globals.NumPoses;
brickType = type;
brickPose = pose;
width = bricks[type][pose].w;
height = bricks[type][pose].h;
xposition = COLS/2 - 1;
yposit... | 3 |
public FileChangeEvent(Environment environment, File oldFile) {
super(environment);
this.oldFile = oldFile;
} | 0 |
@Override
//public int getDistribution(double standardDeviation)
public int getDistribution()
{
//*********************
//mean = this.mean();
//*********************
//keeps track of packets created
int PacketCounter = 0;... | 4 |
@Override
public void keyPressed(KeyEvent paramKeyEvent) {
int id = paramKeyEvent.getKeyCode();
if (id == KeyEvent.VK_Q) {
currenth = "blackmage";
}
else if (id == KeyEvent.VK_W) {
currenth = "ninja";
}
else if (id == KeyEvent.VK_E) {
currenth = "warrior";
}
else if (id == KeyEvent.VK_R) {
... | 5 |
public Server() {
ExecutorService executor = null;
ServerSocket serverSocket = null;
try {
/**
* Создание сокета сервера для заданного порта
* */
serverSocket = new ServerSocket(PORT);
System.out.println("Waiting");
/**
* Создание пула с числом потоков, равному AMOUNT_OF_THREADS
* *... | 3 |
private List<Itemset> aprioriGen(List<Itemset> seed, int k) {
List<Itemset> candidateList;
// Populate candidate large itemsets by either a sql query
// or hand-written main-memory join algorithm
if (usesql) {
DBAccess db = new DBAccess();
//this returns a new candidate list
candidateList = db.po... | 7 |
protected TextIDPair readNextDocText(BufferedReader docIn) throws IOException{
String line = docIn.readLine();
// find the beginning of the document
while( line != null &&
!line.startsWith(".I") ){
line = docIn.readLine();
}
if( line == null ){
return null;
}else{
// figure out what the... | 9 |
public CharSeqHelper(CharSequence... charSequences)
{
s = new StringBuilder();
for(CharSequence c : charSequences)
{
s.append(c);
}
} | 1 |
public static void main(String[] args) throws Exception {
//Verify arguments
if (args.length != 5) {
usage();
}
DatagramSocket mailbox = null;
String serverHost = null;
int serverPort = 0;
String clientHost = null;
int clientPort = 0;
String name = null;
try {
//Create the socket
... | 2 |
public synchronized void bake() {
if (events != null) return; // don't re-bake when still valid
List<RegisteredListener> entries = new ArrayList<RegisteredListener>();
for (Entry<Priority, ArrayList<RegisteredListener>> entry : muffinbag.entrySet()) {
entries.addAll(entry.getValue());
}
events = entries.to... | 2 |
public JDBCConnect() {
String driver = "com.mysql.jdbc.Driver";
String artlcle_url = "jdbc:mysql://localhost:3306/zhangyu_sca";
String user = "root";
String password = "root";
try {
Class.forName(driver);
Connection article_conn = DriverManager.getConnecti... | 2 |
private void CheckViolentSpeech(String message, String sender, String channel)
{
for(String word: m_ViolentWords)
{
if(message.toLowerCase().contains(word))
{
sendMessage(channel, "Nana, sowas sagt man aber nicht, " + sender);
break;
... | 2 |
public boolean exist2Rec(char[][] board, String word, int pos, int i, int j){
if(pos == word.length()) return true;
if(isValidIdx(i, j) && !visited[i][j] && pos < word.length() && board[i][j] == word.charAt(pos)){
visited[i][j] = true;
if(exist2Rec(board, word, pos+1, i-1, j)) re... | 9 |
static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... | 9 |
public Pair getCrossoverPoints(int delta){
Pair pair = new Pair();
int len = this.bins.size();
if(len == 0)
return null;
pair.x = randRange(0, len - 1);
if(pair.x == (len - 1 )){
pair.y = len;
} else {
pair.y = randRange(pair.x, pair.x + delta);
}
return pair;
} | 2 |
public void InsertaInicio (int ElemInser)
{
if (VaciaLista())
{
PrimerNodo = new NodosProcesos (ElemInser);
PrimerNodo.siguiente = PrimerNodo;
}
else
{
NodosProcesos Nuevo = new NodosProcesos(ElemInser);
NodosProcesos Aux = PrimerNodo;
while (Aux.siguiente !=PrimerNodo)
Aux = Aux.siguiente;
... | 2 |
public Causa ingresoTestigoPorTeclado(){
@SuppressWarnings("resource")
Scanner scanner = new Scanner (System.in);
String texto;
int expediente;
Long dni;
Causa causa = new Causa();
try {
System.out.println("Agregar Testigo a Causa");
System.out.println("-----------------------");
while (true) {
... | 9 |
public static TextBuffer listToJava(List<Exprent> lst, int indent, BytecodeMappingTracer tracer) {
if (lst == null || lst.isEmpty()) {
return new TextBuffer();
}
TextBuffer buf = new TextBuffer();
for (Exprent expr : lst) {
TextBuffer content = expr.toJava(indent, tracer);
if (conten... | 9 |
@GET
@Path("/{repoName}/prime")
@Produces(MediaType.TEXT_PLAIN)
public String primeRepositoryCache(
@PathParam("repoName") String repoName,
@Context HttpServletRequest request) {
try {
dao.primeCache(getBaseUrl(request), repoName);
}
catch (Except... | 1 |
@Override
public void displayLog(String[] presentStatusLog) {
for (String s : presentStatusLog) {
logModel.addElement(s);
}
} | 1 |
public boolean validBlackMovement(double x1, double y1, double x2, double y2, Square newSquare)
{
boolean move = false;
if( ((x2 == x1) && (y2 == y1 - PAWN_MOVEMENT_RESTRICTION)) && newSquare.getPiece().getPieceType() == "-")
{
move = true;
super.setHasMoved(true);
}
else if( ((x2 == x1 && (y1 == B... | 8 |
@Override
public void mouseDragged(MouseEvent e)
{
if (graphComponent.isEnabled() && isEnabled() && !e.isConsumed()
&& first != null)
{
mxRectangle dirty = current;
current = new mxRectangle(first.x, first.y, 0, 0);
current.add(new mxRectangle(e.getX(), e.getY(), 0, 0));
if (dirty != null)
{
... | 5 |
protected void onUpdateTetris( int keyCode ) {
long time = System.currentTimeMillis();
if ( keyCode != 0 ) {
int dir = Block.DOWN;
switch ( keyCode ) {
case KeyEvent.VK_LEFT:
dir = Block.LEFT;
break;
case KeyEvent.VK_RIGHT:
dir = Block.RIGHT;
break;
case KeyEvent.VK_D... | 6 |
protected double[] makeDistribution() throws Exception {
double total = 0;
double[] distribution = new double[m_TrainBags.numClasses()];
boolean debug = false;
total = (double)m_TrainBags.numClasses() / Math.max(1, m_TrainBags.numInstances());
for(int i = 0; i < m_TrainBags.numClasses(); i++)... | 8 |
private QueueInterface<T> checkPostfix(QueueInterface<T> postfix) throws DAIllegalArgumentException, DAIndexOutOfBoundsException, BadPostfixException
{
if(postfix.getSize() < 3 && (postfix.getSize()%2) == 1)//makes sure the size of infix is greater than 3 and is an odd number
{
throw new BadPostfixException();
... | 8 |
public boolean checkPasswd(String id, String passwd) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
conn = getConnection();
pstmt = conn
.prepareStatement("select password from member where id=?");
pstmt.setString(1, id);
rs = pstmt.executeQuery();
if ... | 9 |
private void initializeArrayField(JimpleBody new_body, SootField f, String type, Local local2, Value prev_val) {
if( type!= null && type.equals("int")){
Stmt assStmt = Jimple.v().newAssignStmt( prev_val,
Jimple.v().newInstanceFieldRef(local2, f.makeRef()));
SootMethod m = Scene.v().getMethod("<java.uti... | 4 |
public void print_classifier() {
int c, f, i, j;
for (c = 0; c < classes; c++) {
System.out.println(data.classlist[c]+":");
for (f = 0; f < features; f++) {
System.out.print(" "+f+"{");
for (i = 0; i < iterations; i++) {
System.out.print(i+"[");
for (j = 0; j < classifiers[c][f][i].... | 4 |
public void addPointObject(SVGCircleElement graphic) throws XPathExpressionException, DOMException {
String osmNamespace = xpath.getNamespaceContext().getNamespaceURI("osm");
SVGOMTextElement text = (SVGOMTextElement) xpath.evaluate("//svg:g[@id='map']/svg:text[(@k='species' or contains(@class, 'caption-core') or c... | 1 |
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == submit) {
// Window work
game.getControlPanel().setSubmitted(true);
HumanPlayer humanPlayer = (HumanPlayer) game.getPlayers().get(0);
humanPlayer.setHumanMustFinish(false);
setVisible(false);
game.getBoard().unhighl... | 3 |
private float calculateTBonds() {
int n = model.tBonds.size();
if (n <= 0)
return 0;
TBond tBond;
float energy = 0;
synchronized (model.tBonds) {
for (int i = 0; i < n; i++) {
tBond = model.tBonds.get(i);
atom1 = tBond.getAtom1();
atom2 = tBond.getAtom2();
atom3 = tBond.getAtom3();
... | 8 |
public Frame3() {
try{
Class.forName(JDBC_DRIVER);
conn = DriverManager.getConnection(DB_URL,USER, PASS);
statement = conn.createStatement();
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}
setTitle("KutaRaya, 19 - 31");
setDefaultCloseOperation(J... | 8 |
public Boolean parse(final boolean current) {
for (String s : TOGGLE_VALUES) {
if (string.equalsIgnoreCase(s)) {
return !current;
}
}
for (String s : POSITIVE_VALUES) {
if (string.equalsIgnoreCase(s)) {
return true;
... | 6 |
private long readNumber ( int side, int l, boolean FF )
{
long r = 0, b = 1;
int q=0;
byte[] g = new byte[l];
try { fcdx.read(g); }
catch (IOException e) { e.printStackTrace(); }
if(side>0 && l>1) b<<=((l-1)<<3);
for(int i=0;i<l;i++)
{
q = g[i]; if(q<0) q+=0x100;
if(q!=0xff) FF=false;
r|= ... | 8 |
@Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.directions");
String prevPage = (String) request.getSessionAttribute(JSP_PAGE);
resaveParamsShowDirections(request);
formDirectionLi... | 2 |
public ArrayList<Move> whiteUrgentMoves(ArrayList<Move> allWhiteMoves) {
ArrayList<Move> rez = new ArrayList<Move>();
// if black king isn't near any pieces, it can't eat them
if (this.piecesNearPosition(this.piecePosition[28]).size() == 0) { return rez; }
for (Move currMove : allWhite... | 9 |
public Info() {
setTitle("Info");
//this.setLocationRelativeTo(null);
this.setIconImage(new ImageUtil().getLogo());
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 575, 409);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5))... | 3 |
public static void main(String[] args) {
int t;
int SIZE = 5;
int[] inputArray = new int[SIZE];
//-----------Take user input---------------//
Scanner element = new Scanner(System.in);
System.out.println("Enter Element : ");
for (int i = 0; i < SIZE; i++) {
inputArray[i] = element.nextInt();
}
... | 4 |
private static int getOlympianNumber(String pathToFile) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(
pathToFile));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
System.out.println("file not found");
}
String line = null;
int i = 0;
try {... | 4 |
public void obfuscateProject() {
if (variablePanel.getVariableListSize() == 0) {
MessageDialog.displayMessageDialog(this, "INFORMATION_DIALOG", "NO_VAR_TO_OBF");
return;
}
if (!destinationDirectory.equals("")) {
setActionButtonsEnabled(false);
tabbedPanel.setSelectedComponent(variablePanel);
Thread... | 2 |
public void exec(){
try {
ArrayList<String> erg = util.networkCommand("ps -e | wc -l");
count = Integer.parseInt(erg.get(0));
System.out.println(count);
} catch (Exception e) {
System.out.println(e.getMessage());
}
} | 1 |
public void move() {
Random generator = new Random();
int num1 = generator.nextInt(4);
if (num1 == 0) {
x -= 5;
y -= 5;
} else if (num1 == 1) {
x -= 5;
y += 5;
} else if (num1 == 2) {
x += 5;
y -= 5;
... | 7 |
public int etsiVasenX(){
int vasX = 9;
for (Palikka palikka : palikat) {
if (palikka.getX() < vasX){
vasX = palikka.getX();
}
}
return vasX;
} | 2 |
@Override
public boolean isValid(Object value, ConstraintValidatorContext context) {
if (!new RequiredValidator().isValid(value, context)) {
return true;
}
Date dateValue = (Date) value;
if (!util.isValid(annotation, dateValue, context)) {
if (annotation.message().isEmpty()) {
buildConstraintViolat... | 7 |
public List<Step> getSteps() {
return steps;
} | 0 |
private void addWordTop(String word, int occur) {
if (occur > 255) occur = 255;
char firstChar = word.charAt(0);
int index = indexOf(roots, firstChar);
if (index == -1) {
CharNode newNode = new CharNode();
newNode.data = firstChar;
newNode.freq = occur... | 3 |
public void manage() {
super.manage();
List<Evenement> events = new ArrayList<Evenement>();
List<Incendie> incendies = this.donnees.getIncendies();
List<Robot> robots = this.donnees.getRobots();
long dateSimulation = this.simul.getDateSimulation();
int indiceIncendie = 0;
while(indiceIncendie < incendies... | 9 |
public final void waitForTasks() {
synchronized (this.taskPool) {
while ((this.runningTasks > 0) || !this.taskPool.isEmpty()) {
try {
this.taskPool.wait();
} catch (final InterruptedException e) {
this.master.interrupt();
}
}
}
} | 3 |
@Override
public void actionPerformed(ActionEvent e) {
// If the new game button was pushed, reinitialize everything and repaint
if (e.getSource() == newGame){
fPanel.proj = new Projectile(90,400);
fPanel.targetLeft.setHit(false);
fPanel.targetMid.setHit(false);
fPanel.targetRight.setHit(false);... | 5 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
TCPAddress other = (TCPAddress) obj;
if (inetAddress == null) {
if (other.inetAddress != null) {
return false;
... | 7 |
public Map<String, Integer> getGenreCounts() throws Exception {
Connection connect = null;
Statement statement = null;
ResultSet resultSet = null;
// Each element of the collection genreMap contains the name of a genre and its count
Map<String, Integer> genreMap = new HashMap<String, Integer>();
tr... | 6 |
public void visitIfCmpStmt(final IfCmpStmt stmt) {
stmt.left().visit(this); // search the left branch
if (!found) { // if nothing has been found
exchangeFactor++; // increase the exchange factor,
if (stmt.left().type().isWide()) {
exchangeFactor++; // twice to get
}
// around wides
if (exchangeFa... | 3 |
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String outputJson = "";
PrintWriter out = response.getWriter();
try {
String method = request.getParameter("method").toLowerCase(
Locale.ENGLISH);
... | 4 |
public void setTooltipZeroText(String zeroTip)
throws IllegalStateException
{
if ((ttip_text == null) && (zeroTip != null))
throw new IllegalStateException("Must call setTooltipText first");
boolean isZero = (intValue == 0);
ttip_text_zero = zeroTip; // Remember new ze... | 9 |
public TestArray7x7(){
arr7x7 = new Array7x7();
colLeftPanel = new JPanel();
colRightPanel = new JPanel();
arrayPanel = new JPanel();
commandPanel = new JPanel();
moveLeftButton = new JButton("moveLeft");
moveRightButton = new JButton("moveRight");
colLeft = new JTextField[7];
colRight = n... | 4 |
public void svgPath(double x, double y, UPath path, double deltaShadow) {
manageShadow(deltaShadow);
ensureVisible(x, y);
final StringBuilder sb = new StringBuilder();
for (USegment seg : path) {
final USegmentType type = seg.getSegmentType();
final double coord[] = seg.getCoord();
if (type == USegment... | 9 |
public static void handle(String[] tokens, Client client) {
if(tokens[1].equals("-")) {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
/* Do Nothing */
}
client.send(PacketCreator.pong());
}
} | 2 |
@SuppressWarnings("deprecation")
@EventHandler(priority=EventPriority.LOWEST)
public void onItemDrop(final PlayerDropItemEvent event) {
if(opposite.containsKey(event.getPlayer().getName())) {
event.setCancelled(true);
Bukkit.getScheduler().runTaskLater(instance, new Runnable() {
public void run() {
... | 1 |
public void run()
{
try {
s = new ServerSocket(port);
synchronized (this) {
notifyAll();
}
while (!quit) {
try {
r = s.accept();
final BufferedReader in =
new BufferedReader(new InputStreamReader(r.getInputStream()));
String str = in.readLine();
for (; str !... | 7 |
public static void startupUnitSupport() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/UNIT-SUPPORT", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTE... | 7 |
public void repondre(HttpServletRequest requete, HttpServletResponse reponse, String action)
throws ServletException, IOException {
Utilisateur u = UtilisateurService.utilisateur(requete);
Role roleUtilisateur = u != null ? u.getRole() : Role.Visiteur;
if (roleUti... | 2 |
private void removeListener() throws NoSuchMethodException,
SecurityException, IllegalArgumentException, IllegalAccessException {
Class<?> guiType = getGui().getClass();
Class<?> type = guiType;
while (type != null && !type.equals(Object.class)) {
for (Field field : type.getDeclaredFields()) {
if (JCom... | 8 |
public static void main(String[] args) throws IOException {
ArrayList<Img<Color>> els = new ArrayList<Img<Color>>();
Random r = new Random(/*2413*/);
String[] FONTS = { "Times", "Georgia", "Optima", "Times New Roman" };
for (int i = 0; i < 200; i++) {
TreePredict.Img<Color> timg = TreePredict.getImg("a", new... | 8 |
public void visitAttribute(final Attribute attr) {
super.visitAttribute(attr);
if (fv != null) {
fv.visitAttribute(attr);
}
} | 1 |
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.