text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void setDecimalformat(String format) {
dformat = (!format.startsWith("%")) ? ('%' + format) : format;
} | 1 |
/* */ public void damageCheck() {
/* 40 */ Random r = new Random();
/* 41 */ for (int i = 0; i < Core.units.size(); i++) {
/* 42 */ Unit u = (Unit)Core.units.get(i);
/* */
/* 44 */ if (!this.hitUnits.contains(u)) {
/* 45 */ if (u.collision.intersects(this.highDamage)) {
/* 4... | 8 |
public static void main(String[] args) {
int max = Integer.MAX_VALUE;
System.out.println("Overflow:");
System.out.println(max); // 2147483647
System.out.println(max + 1); // -2147483648
System.out.println(max + 2); // -2147483647
int min = Integer.MIN_VALUE;
... | 0 |
private void drawNanopostImage() {
try {
File imgFile = np.getNanoPostFile(np.isFromOutbox());
if (!imgFile.exists()) {
panAttach.setVisible(false);
return;
}
BufferedImage image = ImageIO.read(imgFile);
if (image != nu... | 5 |
public static FelixString tryParse(ParserReader in) throws IOException {
in.mark(1); // Prepare to roll back if we don't see a quote character.
int quote = in.read();
boolean isQuote = quote == S || quote == D;
if(!isQuote) {
in.reset();
return null; // Not a string
}
StringBuffer buf = new String... | 8 |
private boolean checkTable() {
String sql = "";
try {
Statement state = con.createStatement();
sql = "DESC " + database + "." + table;
ResultSet rs = state.executeQuery(sql);
int size = 0;
while (rs.next()) {
String field = rs.getString("Field");
String type = rs.getString("Type");
if (!t... | 6 |
public List<Collidable> retrieve(List<Collidable> returnStuff,Collidable c) {
int index = getIndex(c);
if (index != -1 && nodes.get(0) != null) {
nodes.get(index).retrieve(returnStuff, c);
}
returnStuff.addAll(stuff);
return returnStuff;
} | 2 |
KeepAliveThread() {
lock = new ReentrantLock();
setName("KeepAliveThread");
setDaemon(true);
} | 0 |
final public CommandControl isValid(List<String> lines) {
if (isCommandForbidden()) {
return CommandControl.NOT_OK;
}
final Matcher m1 = starting.matcher(lines.get(0).trim());
if (m1.matches() == false) {
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
return CommandControl.OK_PARTIAL;
}... | 9 |
public ListEnemy DeserializationListEnemy(String songTitle)
{
ListEnemy LE=null;
try {
FileInputStream fis = new FileInputStream(songTitle);
ObjectInputStream ois= new ObjectInputStream(fis);
try
{
LE = (ListEnemy) ois.readObject();
... | 3 |
@Override
public String getName() {
return this.name;
} | 0 |
private void jaaPisteet(Siirto ensimmaisen, Siirto toisen, AI eka, AI toka) {
if (ensimmaisen == Siirto.YHTEISTYO && toisen == Siirto.YHTEISTYO) {
eka.lisaaPisteita(yhteistyonPalkinto);
toka.lisaaPisteita(yhteistyonPalkinto);
} else if (ensimmaisen == Siirto.YHTEISTYO && toisen =... | 6 |
public StatFileWriter(Session var1, File var2) {
File var3 = new File(var2, "stats");
if (!var3.exists()) {
var3.mkdirs();
}
File[] var4 = var2.listFiles();
int var5 = var4.length;
for (int var6 = 0; var6 < var5; ++var6) {
File var7 = var4[var6];... | 5 |
@RequestMapping(method = RequestMethod.DELETE, value = "{id}")
public void deleteTask(@PathVariable("id") Integer id) {
tasksService.deleteById(id);
} | 0 |
public void visitInnerClass(final String aname, final String outerName, final String innerName, final int attr_access) {
if ((name != null) && name.equals(aname)) {
this.access = attr_access;
}
super.visitInnerClass(aname, outerName, innerName, attr_access);
} | 2 |
public int hashCode() {
int result;
result = (street != null ? street.hashCode() : 0);
result = 29 * result + (city != null ? city.hashCode() : 0);
result = 29 * result + (country != null ? country.hashCode() : 0);
result = 29 * result + (state != null ? state.hashCode() : 0);
... | 5 |
public static String toHtml(String text, String url) throws Exception {
ParserConverter oParserConverter = new ParserConverter();
try {
if (text != null) {
if (!text.equals("")) {
text = oParserConverter.tag(text, "======", "h6");
text ... | 3 |
@Override
protected void loadDatabase() throws DataLoadFailedException {
try {
Class.forName("org.sqlite.JDBC");
} catch (ClassNotFoundException ex) {
throw new DataLoadFailedException(ex);
}
try {
connection = DriverManager.getConnection("jdbc:sql... | 2 |
public void start(BundleContext context) throws Exception {
m_context = context;
// We synchronize while registering the service listener and
// performing our initial dictionary service lookup since we
// don't want to receive service events when looking up the
// dictionary service, if one exists.
synchr... | 6 |
public static void copyFile(String fileFrom, String fileTo) {
File srcFile = new File(fileFrom);
if (!srcFile.exists()) {
return;
}
File destFile = new File(fileTo);
if (destFile.exists()) {
destFile.delete();
}
try {
destFile.createNewFile();
} catch (IOException e) {
// TODO Auto-generated... | 8 |
public Address getAddressCompany() {
return addressCompany;
} | 0 |
public boolean equalsExpr(final Expr other) {
return (other != null) && (other instanceof ShiftExpr)
&& (((ShiftExpr) other).dir == dir)
&& ((ShiftExpr) other).expr.equalsExpr(expr)
&& ((ShiftExpr) other).bits.equalsExpr(bits);
} | 4 |
public static DataTag getPlayerData(){
Object obj = read("player/player");
if(obj == null)
return null;
JSONObject data = (JSONObject) obj;
return new DataTag(data);
} | 1 |
@AroundInvoke
public Object invoke(InvocationContext context) throws Exception {
EntityTransaction trx = manager.getTransaction();
boolean criador = false;
try {
if (!trx.isActive()) {
// truque para fazer rollback no que já passou
// (senão, um futuro commit confirmaria até mesmo operações sem trans... | 7 |
public void setRap_num(int rap_num) {
this.rap_num = rap_num;
} | 0 |
private void recurseClick(int x, int y) {
Square square = board.getSquare(x, y);
if (square.isRevealed() || square.isFlagged() || square.isQuestioned()) return;
//first click square
square.setClicked();
listener.squareRevealed(x, y, square.numMines());
unclickedNonmines--;
//then check if it has any adj... | 8 |
public void merge(int low, int mid, int high){
//copy the entire array in the Auxilary array
for(int i=low;i<=high;i++){
arrAux[i] = arrInput[i];
}
int i = low;
int j = mid+1;
int k = low;
while(i<=mid && j<=high){
if(arrAux[i]<=arrAux[j]){
arrInput[k]=arrAux[i];
i++;
}
else{
ar... | 5 |
public StringBuilder getText() {
return text;
} | 0 |
@Override
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
p.doYourThing(gc,gameplayEnvironment);
gameplayEnvironment.doYourThing(gc);
if((System.currentTimeMillis() - lastKITick) > 300){
for(objekt a : gameplayEnvironment.getEnvironment()){
lastKITick = System.c... | 8 |
public static void main(String[] args) {
// wap to find square root of number
ky = new Scanner(System.in);
System.out.println("enter the number");
double k=ky.nextDouble();
System.out.println("the square root is" +Math.sqrt(k));
} | 0 |
public void testMergeWithDifferentPartitions() throws Exception {
d=createChannel(a);
d.setName("D");
rd=new MyReceiver("D", d);
d.setReceiver(rd);
modifyConfigs(d);
d.connect("OverlappingMergeTest");
// Inject view {A,C,B} into A, B and C:
View new_view=... | 9 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Group other = (Group) obj;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.... | 9 |
private static void closeStatement(Statement stmt) {
if( stmt != null ) {
try {
if( !stmt.isClosed() ) {
stmt.close();
}
} catch (SQLException e) {
logger.error("Error closing the statement.", e);
}
}
} | 3 |
@Override
public int getCurrentBall()
{
assert !isGameOver();
int currentBall = 10;
for (int i = 0; i < rollCount; i++)
{
int pinsKnockedDown = pinsKnockedDownArray[i];
if (getCurrentFrame() == 10)
{
currentBall += 3.33;
}
else
{
if (pinsKnockedDown == 0)
{
currentBall += ... | 7 |
@Override
public int match(String[] argsToTest) {
// args must contain one of the required pairs
int errorCount = 0;
for (String[] requiredElem : required) {
boolean found = false;
for (String testArg : argsToTest) {
if (isCommandArg(testArg)) {
if (matches(testArg, requiredElem)) {
found ... | 6 |
public int findKth(int[] nums1, int[] nums2, int k) {
int p1 = 0;
int p2 = 0;
System.out.println("p1: " + p1 + "p2: " + p2 + "k: " + k);
while (p1 < nums1.length && p2 < nums2.length) {
if (nums1[p1] > nums2[p2]) {
if (k == 1) {
return nums... | 7 |
public void ajErrorOutputNode() {
setMisalignment(this.getPotential() * (1 - this.getPotential()) * (this.getAnswer() - this.getPotential()));
//Adjustment of synaptic weights on the output layer
double lErr = this.getMisalignment();
for (int t = 0; t < this.getIncomingLinksNumber(); t+... | 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://... | 6 |
private void updateGrid(ClientUI client) {
Iterator<Integer> iter = client.net.getTerritoriesLayout().keySet().iterator();
TerritoriesLayout territories = client.net.getTerritoriesLayout();
while (iter.hasNext()) {
Integer key = iter.next();
Button button = client.buttonsMap.get(territories.get(key).getId(... | 2 |
public void mouseEntered(MouseEvent arg0) {
setBorder(bigBord);
double coutAttaque = Partie.getInstance().coutAttaque(territoire);
List<Element> elements = territoire.getElements();
String txt = "";
String occupantName;
Peuple occupant = this.territoire.getOccupant();
int nbUnite = this.territoi... | 5 |
@Override
public void connect(T t1, T t2, String s, int weight){
if (!nodes.containsKey(t1) || !nodes.containsKey(t2)){
throw new NoSuchElementException("Node finns ej vid connect");
}
if (nodes.get(t1) == nodes.get(t2)){
//this shouldn't happen as y... | 7 |
public 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://download.or... | 6 |
public void addMessage(String user, String message) throws ChatRoomInvalidStateException {
try {
ChatRoomMessage msg = dbConnector.addMessage(user, chatRoomName, message);
ChatRoomMessage stub = (ChatRoomMessage) UnicastRemoteObject.exportObject(msg, 0);
for(Chat... | 3 |
@Override
public HashMap<String, Float> getWeightsForQuery(HashMap<String, Integer> query) {
try {
HashMap<String, Float> weights = new HashMap<String, Float>();
float total = 0.0f;
for (int n : query.values()){
total += n;
}
if (to... | 9 |
private void changeSelection(Item.Pocket newPocket)
{
if (state == State.BUY)
{
pocket = newPocket;
currentDisplay.clear();
for (Item aFullInventory : fullInventory) {
if (aFullInventory.pocket == newPocket)
currentDisplay.add(aFullInventory);
}
... | 5 |
public Wave23(){
super();
MobBuilder m = super.mobBuilder;
for(int i = 0; i < 615; i++){
if(i % 5 == 0)
add(m.buildMob(MobID.ODDISH));
else if(i % 4 == 0)
add(m.buildMob(MobID.BELLSPROUT));
else if(i % 3 == 0)
add(m.buildMob(MobID.MEOWTH));
else if(i % 2 == 0)
add(m.buildMob(MobID.MANK... | 5 |
public EulerCamera(KeyboardBuffer kb, Vector3f position, Vector3f rotation) {
super(kb);
this.position = position;
this.rotation = rotation;
// Enable Depth clamping if supported
if (GLContext.getCapabilities().GL_ARB_depth_clamp) {
GL11.glEnable(ARBDepthClamp.GL_DEPTH_CLAMP);
}
//Instance the Mou... | 3 |
public static boolean LoadNatives() {
String OS = System.getProperty("os.name").toLowerCase();
String os_res = "";
if (isWindows(OS)) {
os_res = "windows";
} else if (isMac(OS)) {
os_res = "macosx";
} else if (isUnix(OS)) {
os_res = "linux";
} else if (isSolaris(OS)) {
os_res = "solaris";
}... | 5 |
public Class<?> getCollectionOrArrayType() {
if (propertyDescriptor.getReadMethod().getReturnType().isArray()) {
return propertyDescriptor.getReadMethod().getReturnType()
.getComponentType();
}
if (!Collection.class.isAssignableFrom(getPropertyType())) {
throw new UnsupportedOperationException(
... | 6 |
public void map(LongWritable key, Text values, Context context) throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
long numofSeqs = Long.valueOf(conf.get("numofSeqs"));
Double Support = Double.valueOf(conf.get("Support"));
//only one reducer as is... | 6 |
public void calculateEntitesCount(DatasetLoader datasetHandler) throws Exception{
Hashtable<String, Document> documentsHash = datasetHandler.loadDocuments();
int numberOfUniqueWords = 0;
int numberOfEdges = 0;
long startTime = System.currentTimeMillis();
Enumeration ids = documentsHash.keys();
ArrayList<Str... | 7 |
@Override
public String toString() {
return "Remarks {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (idx != null ? " idx [" + idx + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue +... | 9 |
@Override
public void withdraw(String accountId, double amount) throws InvalidParamException, OverdraftException {
MethodResponse response = this.stub.sendMethodRequest("withdraw",
new Class[]{String.class, double.class},
new Object[]{accountId, amount});
Throwable t... | 3 |
public static void startupCppTranslate() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
... | 6 |
public void leesQuizzenVanBestand(OpdrachtCatalogus opdrachtCatalogus, QuizCatalogus quizCatalogus){
File file = new File("bestanden/quizzen");
//
try{
Scanner scanner = new Scanner(file);
while (scanner.hasNext()){
List<Opdracht> opdrachten = new ArrayList<Opdracht>();
String lijn ... | 6 |
public Produto getProduto(String nomeOUcodigo) {
for (Produto p : produtos) {
if (p.getNome().equalsIgnoreCase(nomeOUcodigo) || p.getCodigo().equalsIgnoreCase(nomeOUcodigo)) {
return p;
}
}
return null;
} | 3 |
public static void rename(Automaton a) {
State[] s = a.getStates();
int maxId = s.length - 1;
Set untaken = new HashSet(), reassign = new HashSet(Arrays.asList(s));
for (int i = 0; i <= maxId; i++)
untaken.add(new Integer(i));
for (int i = 0; i < s.length; i++)
if (untaken.remove(new Integer(s[i].getID(... | 4 |
public static Collection<User> getUsers()
{
List<User> users = new LinkedList<User>();
try
{
String sql = "SELECT user_id,name from user_table";
PreparedStatement ps = Connect.getConnection().getPreparedStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.... | 2 |
@Override
public void createFromXML(NodeList attributes) {
for(int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
Node value = node.getFirstChild();
if(node.getNodeNa... | 6 |
public static void rowStringValues(String row[], int[] idx, String[] vals) {
for (int i = 0; i < vals.length; i++) {
vals[i] = row[idx[i]];
}
} | 1 |
public static boolean literalEqlP(Stella_Object x, Stella_Object y) {
if (((x != null) &&
Stella_Object.isaP(x, Stella.SGT_STELLA_BOOLEAN_WRAPPER)) ||
((y != null) &&
Stella_Object.isaP(y, Stella.SGT_STELLA_BOOLEAN_WRAPPER))) {
return (((((BooleanWrapper)(x)) == null) &&
(!B... | 8 |
public void setName(String value) {
this.name = value;
} | 0 |
public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000.0 / 60.0;
double time = 0;
long lastSecond = System.currentTimeMillis();
this.requestFocus();
while(running){
long now = System.nanoTime();
time += (now - lastTime) / nsPerTick;
lastTime = now;
boole... | 4 |
public String printParkInfo() {
String txt="";
if(ParkManage.getInstance().getParkList().size() == 0) {
txt="目前没有创建任何停车场,请先创建停车场!";
return txt;
}
int emptyNum = 0;
int totalNum = 0;
txt= txt + "-----------------------------------------"+ "\n";
for(int i = 0; i < ParkManage.getInstance().getParkList(... | 2 |
public CtConstructor[] getDeclaredConstructors() {
CtMember.Cache memCache = getMembers();
CtMember cons = memCache.consHead();
CtMember consTail = memCache.lastCons();
int n = 0;
CtMember mem = cons;
while (mem != consTail) {
mem = mem.next();
Ct... | 4 |
public static void clearBodies(){
Array<Body> bodies = new Array<Body>();
Objects.world.getBodies(bodies);
for(int i = 0; i < bodies.size; i++){
if(bodies.get(i) != null ){
if(bodies.get(i).getUserData() != null){
Objects.world.destroyBody(bodies.get(i));
}
}
}
} | 3 |
private long getTime() {
switch (type) {
case WALL_TIME:
return getWallTime();
case CPU_TIME:
return getCpuTime();
case USER_TIME:
return getUserTime();
default:
break;
}
return get... | 3 |
private void jBtnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnDeleteActionPerformed
// TODO add your handling code here:
try {
String sql = "DELETE FROM productos_has_pedidos WHERE pedidos_idpedidos = ? AND productos_idproductos = ? ";
String sql1 ... | 3 |
private void createGameSelector(java.util.List<GameToSelect> gamesToSelect) {
JPanel container = new JPanel(new FlowLayout());
final JComboBox<GameToSelect> combo = new JComboBox<GameToSelect>();
combo.setSize(100, 20);
for(GameToSelect gameToSelect : gamesToSelect)
combo.ad... | 2 |
public boolean crearConexion(String db) {
boolean encontrado = false;
if (db.equals(ControladorServidor.BD_PERSONAL)) {
factory = new ConnectionFactory(
ControladorServidor.ARCHIVO_POSTGRESQL);
System.out.println("DEBUG: Creada connectionFactory con Postgres!");
encontrado = true;
} else if (db.equa... | 2 |
@Override
public String toString() {
return "[Object of " + getClass().getName() + "]";
} | 0 |
@Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_UP:
System.out.println("Move up");
break;
case KeyEvent.VK_DOWN:
currentSprite = characterDown;
if (robot.isJumped() == false) {
robot.setDucked(true);
robot.setSpeedX(0);
}
break;
case KeyEven... | 9 |
public boolean IsSimilarTo(Cluster other, double overlapDegree) {
assert(other != null);
// ------------------------------------------------
// Find the common documents. If there are only a few documents,
// a linear search is used; otherwise the search uses a hash table.
int co... | 8 |
public static void main(String args[]) {
Game g = new Othello();
Timer t = new Timer(g);
Timer t2 = new Timer(null);
t.setHours(t.m_hour_test);
if (t.getHours() == t.m_hour_test) {
System.out.println("Hour Set Success " + t.getHours());
}
t.setMinutes(t.m_minute_test);
if (t.getHours() == t.m_minute... | 5 |
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
switch (getDirectionMeta(var5))
{
case 0:
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F... | 6 |
@Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
JSONObject rtn = new JSONObject();
long day = Long.parseLong(params.get("timestamp"));
day = DateUtil.getStartOfDay(day);
rtn.put("rtnCode", this.getRtnCode(200));
List<Appointment> aAppt = Appointment.f... | 1 |
public boolean isInCorrectFormForConversion(Automaton automaton) {
if (hasSingleFinalState(automaton)
&& hasTransitionsInCorrectForm(automaton)) {
return true;
}
return false;
} | 2 |
public void FillRectW(int X, int Y, int H, int W, byte with)
{
for (int i1 = Math.max(X,0); i1 < Math.min(X+W,w); i1 ++)
{
for (int i2 = Math.max(Y,0); i2 < Math.min(Y+H,h); i2 ++)
{
if (cellData[i1][i2]!=CRYSTAL&&cellData[i1][i2]!=ETHE... | 4 |
private void file_search(String nickname, String query) throws IOException {
/* (Re)build list of files in directory */
File directory = new File(folder);
if (!directory.isDirectory()) {
gui.update("[Client] ERROR: Not a directory.");
return;
}
if (directory.listFiles().length == 0 || !open) {
retu... | 9 |
public byte[] read(int begin, int length) throws IOException {
if (!isAvaiable(begin, length)) {
throw new EOFException("Data not available " + "begin: " + begin + " length: " + length);
}
int filePieceIndex = findFilePieceIndex(begin);
FilePieceMapper filePiece = files.get(... | 5 |
private Token tokenFromXml(int status, String content) {
Token token = new Token();
try {
Error error = errorFromXml(status, content);
if(error != null) {
token.setError(error);
return token;
}
JAXBContext context = JAXBContext.newInstance(Hash.class);
Unmarshaller unmarshaller = cont... | 3 |
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... | 6 |
public void initConnection()
{
//---Get Connection----
try
{
//JNDI Lookups for connection to database through JDBC
Context ic = new InitialContext();
datasource = (DataSource) ic.lookup("java:comp/env/" + DATA_SOURCE_NAME);
connection = datasource.getConnection();
}
catch (NamingExceptio... | 2 |
private void applyHighlighting(String content, int line) throws BadLocationException {
int startOffset = rootElement.getElement(line).getStartOffset();
int endOffset = rootElement.getElement(line).getEndOffset() - 1;
int lineLength = endOffset - startOffset;
int contentLength = content.... | 9 |
synchronized void startLogging() {
if (fLoggingEnabled)
return;
//
// If the first log file doesn't exist or its content length is 0,
// then don't shit files. [V1.85]
//
if (!fFiles[0].exists() || readContent(0).length() == 0)
fFiles[0].delete();... | 7 |
public Wrapping(int x) {
i = x;
} | 0 |
public double Cldj(int iy, int im, int id) throws palError {
long iyL, imL;
/* Month lengths in days */
final int mtab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
TRACE("Cldj");
/* Validate year */
if (iy < -4699) {
Status = 1;
throw n... | 8 |
public SimpleFind(String args[]) {
// Get input from the console
String startingPath = ConsoleTools.getNonEmptyInput("Enter starting path: ");
String query = ConsoleTools.getNonEmptyInput("Enter string to find: ");
String[] fileExtensions = ConsoleTools.getSeriesOfInputs("Enter file extension to match: ");
... | 2 |
public static void stop(String s) {
if (clips.get(s) == null)
return;
if (clips.get(s).isRunning())
clips.get(s).stop();
} | 2 |
public Boolean teamIDExists(String userTeam, String userMatch){
try {
cs = con.prepareCall("{call GET_TEAMID(?,?)}");
cs.setString(1, userTeam);
cs.setString(2, userMatch);
if(!cs.executeQuery().next()){
return false;
}
} catch (SQLException e) {
e.printStackTrace();
}
return true;
} | 2 |
private void assignStudentToCourse(Scanner sn) {
sn = new Scanner(new InputStreamReader(System.in));
Student newStudent = new Student();
System.out.print("Student first name: ");
String firstName = sn.next();
System.out.print("Student last name: ");
String lastName = sn.next();
System.out.print("Student i... | 8 |
void setGreen(States newState, int duration) {
if (currentState == NONE) {
if(!constructionRoad.isEmpty()) {
Iterator<Pair<States,Car>> iter = constructionRoad.values().iterator();
iter.hasNext();
if(newState == iter.next().getKey(... | 5 |
public Creature(int t) {
super(true, 0);
type = t;
if(type == 1){
ManaCost = 2;
attack = 1;
toughness = 1;
Name = "Pig";
Description ="This is a Pig, it has 1 attack and 1 toughness. It has the ability 'Floop to disable Corn'.";
} else if(type == 2){
ManaCost = 2;
attack = 1;
toughness =... | 7 |
@EventHandler(priority = EventPriority.MONITOR)
public void onSignBreak(BlockBreakEvent event) {
Material block = event.getBlock().getType();
Player player = event.getPlayer();
if ((block.equals(Material.SIGN_POST)) || (block.equals(Material.WALL_SIGN))) {
Sign sign = (Sign) event.getBlock().getState();
St... | 7 |
private int readZoomHeaders(SeekableStream fis, long fileOffset, int zoomLevels, boolean isLowToHigh) {
int level = 0;
BBZoomLevelHeader zoomLevelHeader;
if(zoomLevels < 1)
return 0;
// create zoom headers and data containers
zoomLevelHeaders = new ArrayList<BBZoomL... | 2 |
@Override
public boolean isSoundbankSupported(Soundbank soundbank) {
for (Synthesizer s : theSynths)
if (!s.isSoundbankSupported(soundbank))
return false;
return true;
} | 2 |
public int getSearchCount(String colName, String search) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuilder sb = new StringBuilder();
sb.append("select count(*) from member where ");
sb.append(colName);
sb.append(" like '%");
sb.append(search);
sb.append("%'")... | 8 |
private static List<TimeSerie> getNeighboursWithinRange(int index) {
List<TimeSerie> neighbours = new ArrayList<TimeSerie>();
for (int i = 0; i < distanceMatrix.length; i++) {
if (i != index) {
double distance = distanceMatrix[index][i];
if (distance < eps) {
neighbours.add(timeSeries.get(i)... | 3 |
@Override
public void endConnecting() {
if( itemShown ){
parent.removeItem( line );
}
itemShown = false;
} | 1 |
public Object clone() {
return new Animation(frames, totalDuration);
} | 0 |
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.