text stringlengths 14 410k | label int32 0 9 |
|---|---|
private boolean checkRawSensorData() {
if (rawSensorData.size() < sensorDataLength) {
// System.out.println("Check Failed: too short");
return false;
}
if (rawSensorData.get(0) != (byte) SENSOR_STREAM_HEADER) {
// System.out.println("Check Failed: not header");
... | 8 |
public static Position intersection(Polygon polygon, Line firstLine, Line secondLine, int distanceOfView) {
CenterPosition centerPosition = locationCenter(firstLine, positionOfCenter(polygon));
Line lineA = firstLine;
if (!firstLine.isWheather() || firstLine.length() < distanceOfView * 2)
... | 6 |
private long go(String s) {
if(s.equals("101")) {
System.out.println("hello");
}
if(s.length()==0) return 0;
long min = 100000;
if(hp.containsKey(s)) {
return hp.get(s);
}
if(s.startsWith("0")){
return 1000;
}
if(s.length()==1 && s.equals("1") ){
return 1;
} else if(s.equals("0")){ret... | 9 |
public static String encodeParameters(PostParameter[] postParams) {
StringBuffer buf = new StringBuffer();
for (int j = 0; j < postParams.length; j++) {
if (j != 0) {
buf.append("&");
}
try {
buf.append(URLEncoder.encode(postParams[j].getName(), "UTF-8"))
.append("=")
.append(URLEncoder... | 3 |
public void SSLClient(final java.util.List<String> lstUnMount)
throws UnknownHostException, IOException {
// System.setProperty("javax.net.ssl.trustStore",
// "./src/keys/clientkeys");
System.setProperty("javax.net.ssl.trustStore", "C:/clientkeys");
SocketFactory factory = SSLSocketFactory.getDefault();
... | 5 |
@PostConstruct
private void Init() {
if (mService.getTimers() != null) {
for (Timer timer: mService.getTimers()) {
if (timer.getInfo() != null) {
if (timer.getInfo().equals("dummyTimer2.1") || timer.getInfo().equals("dummyTimer2.2")) {
timer.cancel();
}
}
... | 5 |
public static void main(String[] args) throws InterruptedException {
System.out.println("Starting.");
ExecutorService executor = Executors.newCachedThreadPool();
Future<?> fu = executor.submit(new Callable<Void>() {
@Override
public Void call() throws Exception {
... | 3 |
private void loadConnections() throws IOException {
Thread highways = new Thread(new FileLoaderThread("highways", points,
connections, highwaysQT, tst), "highways");
Thread expressways = new Thread(new FileLoaderThread("expressways", points,
connections, expresswaysQT, tst), "expressways");
... | 5 |
public static String getDNSName(ByteBuffer aBuffer) throws IOException {
StringBuffer buf = new StringBuffer();
int next = -1;
int first = aBuffer.position();
int len = aBuffer.get();
while(len != 0) {
switch(len & 0xC0) {
case 0x00:
// Top two bytes 00.... | 6 |
public void addRecipe() {
if (!recipeURL.isEmpty()) {
Recipe recipe = recipeRetriverFacade.addRecipe(recipeURL);
for (Recipe recipetocheck : recipes) {
if (recipetocheck.getName().equals(recipe.getName())) {
return;
}
}
... | 3 |
public void stopServer() {
logger.fine("Stopping server...");
boolean wasRunning = false;
synchronized(CONNECTION_LOCK) {
wasRunning = isRunning;
if(isRunning) {
logger.finer("Sending disconnect packets to all clients");
for(Integer clientId : clients.keySet()) {
ClientInfo client = clients.get... | 4 |
public void run() {
while (true) {
try {
logger.debug("Waiting for new message");
permits.acquire();
Message msg = queue.peek();
if (msg == null) {
// May be a new subscriber was added
continue;
}
if (msg == poison) {
logger.info("Received close signal, closing que... | 6 |
public List<List<Integer>> fourSum(int[] num, int target) {
List<List<Integer>> list = new ArrayList<List<Integer>>();
int length = num.length;
if (length < 4)
return list;
Arrays.sort(num);
int lastA = Integer.MIN_VALUE;
int las... | 9 |
@Override
public void ioCheckClicked(boolean ioPortsEnabled) {
if (ioPortsEnabled && usingRPi) {
sendToIO = ioPortsEnabled;
/* Initialse the GPIO ports only once */
if (gpio == null) {
gpio = GpioFactory.getInstance();
piInitialseGPIO();
}
}
} | 3 |
public long calculate(final int aValue) {
if (aValue < 0) {
throw new RuntimeException("Factorial for negative number cannot be calculated here");
}
if (aValue == 0) {
return 1;
}
long counter = 1;
long result = 1;
while (counter < aValue) ... | 3 |
@Override
public void setGUITreeComponentID(String id) {this.id = id;} | 0 |
@Override
public boolean onCommand(final CommandSender sender,final Command command,final String label,final String[] args) {
if (args.length == 0) {
return false;
}
final OfflinePlayer player = this.plugin.getServer().getOfflinePlayer(args[0]);
if (player == null) {
... | 6 |
private int checkCard(String name) {
int t = names.indexOf(name);
if (t == -1) {
return 0;
}
if (amounts.get(t) < 0) {
return 1;
}
if (amounts.get(t) == 0) {
return 2;
}
if (!Card.isBasicLand(name) && amounts.get(t) > 4)... | 5 |
public String register(HttpServletRequest req, HttpServletResponse resp) {
// TODO Auto-generated method stub
try {
String queryString = req.getQueryString();
String name = queryString.split("&")[0];
String password = queryString.split("&")[1];
name = name.substring(9, name.length());
password = ... | 4 |
@Override
public boolean equals(Object obj) {
if (obj instanceof Move) {
Move otherMove = (Move)obj;
return this.start.equals(otherMove.start) &&
this.end.equals(otherMove.end);
}
return false;
} | 2 |
public ResultSet pesquisaGerente(String NomeGerente) throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatement(SQL_SELECT_TO... | 6 |
@Override
public String getMessageText() {
String msg = "";
msg += participantList.getNameOfParticipant(getAuthorId()) + " ("+getTime()+"):\n";
msg += getMessage();
return msg;
} | 0 |
public static void search(Map<String, byte[]> array, Map<String, byte[]> table, byte[][] tw) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidParameterSpecException, UnsupportedEncodingException{
... | 5 |
@PostConstruct
public void initialiseFoldersTree() {
try {
root = new DefaultTreeNode(mailBox,null);
List<FolderDTO> folders = folderService.getFoldersForMailBox(mailBox);
for (FolderDTO folder : folders) {
DefaultTreeNode node = new DefaultTreeNode(folder, root);
if (folder.getFolderName().equals("... | 3 |
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (player.getWorld().getName() != Core._spawnWorld
&& !_fightingPlayers.contains(player)) {
World spawn = WorldUtils.GetWorld(Core._spawnWorld);
player.teleport(spawn.getS... | 2 |
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof BomClosureEntity)) return false;
if (!super.equals(o)) return false;
BomClosureEntity bomClosureEntity = (BomClosureEntity) o;
if (amount != bomClosureEntity.amount) return false;
... | 9 |
private static boolean isCompact(Point[] points) {
long[] d = new long[6];
int v = 0;
for (int i = 0; i < 4; i++) {
for (int j = i + 1; j < 4; j++) {
d[v++] = dist(points[i], points[j]);
}
}
Arrays.sort(d);
return d[0] != 0
... | 7 |
public ArrayList<String> topSort() {
// Empty list that will contain the sorted elements
LinkedList<Node> sortedList = new LinkedList<Node>();
// Set s of all nodes n with no incoming edges
LinkedList<Node> s = new LinkedList<Node>();
for (Node node : nodes) {
if (node.incoming.isEmpty()) {
s.add(no... | 8 |
public static void createFolder(String realpath) {
File folder = new File(realpath);
if (!(folder.exists())) {
File parent = folder.getParentFile();
if (!(parent.exists()))
parent.mkdirs();
folder.mkdir();
}
} | 2 |
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 ht... | 6 |
private static void unescapeDoubleQuotes(ByteChunk bc) {
if (bc == null || bc.getLength() == 0 || bc.indexOf('"', 0) == -1) {
return;
}
int src = bc.getStart();
int end = bc.getEnd();
int dest = src;
byte[] buffer = bc.getBuffer();
while (src < end) {
if (buffer[src] == '\\' && src < end && buffe... | 7 |
public void displayMaxSharePrices() throws FileNotFoundException,
SharePriceReaderException {
/*
* Display error if sharePriceCsvFile does not exist
*/
if (sharePriceCsvFile == null) {
throw new SharePriceReaderException("FilePath is null");
} else if (!sharePriceCsvFile.exists()) {
throw new Share... | 9 |
public Map generateMap(int timeToWait) {
MapManager mapManager = new MapManager(width, height);
ArrayList<AgentParams> spawnEvents = (ArrayList<AgentParams>) agentComposition
.clone();
ArrayList<AgentParams> removeList = new ArrayList<AgentParams>();
int steps = 0;
while (mapManager.agentsLeft() || spawnE... | 8 |
public void startup() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ex) {
Utils.showMessage("Fout opgetreden, kan het thema van het programma niet starten.", "Fout!", ex.getMessage(), false);
}
dbManager = new Dbma... | 2 |
public static double[] getHourLineAngles(double latitude, double longitude, int date) {
double[] angleArray = new double[13];
double minutesMeridianDelta = getMeridianDelta(longitude) / 15 * 60; //minutes
double EOTDelta = EOTCorrection(date); //minutes
double netDelta = (minutesMeridianDelta + EOTDelta) / 60; ... | 5 |
private void loadEnemyPref() {
Scanner scanner = null;
try {
scanner = new Scanner(new FileInputStream("res" + File.separator + "enemyPref.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
String currentLine;
String[] currentLineArray;
ArrayList<double[]> prefList = new ArrayList<... | 4 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long firstNum = sc.nextLong();
long secondNum = sc.nextLong();
// if the numbers are negative, we turn them into positive by multiplying with -1.
if (firstNum < 0) {
firstNum *= -1;
}
if (secondNum < 0) {
secondNum *= -1;... | 8 |
public TDMatrixChainMultiplication(int p[])
{
n = p.length - 1;
m = new int[n + 1][n + 1]; // the 0'th row and column are not used
split = new int[n + 1][n + 1]; // the 0'th row and column are not used
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
{
if (i == j)
m[i][j] = 0;
else... | 3 |
@Test
public void depthest02opponent3()
{
for(int i = 0; i < BIG_INT; i++)
{
int numPlayers = 4; //assume/require > 1, < 7
Player[] playerList = new Player[numPlayers];
ArrayList<Color> factionList = Faction.allFactions();
playerList[0] = new Player(chooseFaction(factionList), new SimpleAI());
... | 5 |
public void initializeBuildOrder() {
File knowledgeBase = new File(knowledgeBasePath);
// If the file does not exist, create it and write 12 randomly generated
// build order to it
if (!knowledgeBase.isFile()) {
System.out.println("File Does not exist, creating...");
try {
generateInitialBuildOrders(... | 4 |
@Override
public String getMessage() {
String msg = super.getMessage();
if (msg != null)
return msg;
msg = getProblem();
if (msg != null)
return msg;
Object response = getParameters().get(HTTP_RESPONSE);
if (response != null) {
msg ... | 7 |
public String getUri() {
return uri;
} | 0 |
public Iterator<Item> iterator() {
return new ListIterator<Item>(first);
} | 0 |
public String getMusicForLevel(int levelNumber) {
return LEVEL_TRACKS.length >= levelNumber
|| LEVEL_TRACKS[levelNumber - 1] == null ?
DEFAULT_TRACK : LEVEL_TRACKS[levelNumber - 1];
} | 2 |
@SuppressWarnings("unchecked")
private List<?> decorateList(ClassLoader loader, Field field) {
Class<?> clazz = (Class<?>) ((ParameterizedType) field.getGenericType())
.getActualTypeArguments()[0];
List<IContainer> containers = new ArrayList<IContainer>();
List<IElement> elements = new ArrayList<IElement>()... | 8 |
public long rankSum() {
// Sanity check
if (!geneSets.isRanked()) throw new RuntimeException("Cannot calculate rank: This is not a ranked gene set ('" + name + "')!");
if (rankSum >= 0) return rankSum;
rankSum = 0;
rankedGenesCount = 0;
maxRank = 0;
GeneSetsRanked geneSetsRanked = (GeneSetsRanked) geneSe... | 5 |
@Override
public boolean okMessage(Environmental host, CMMsg msg)
{
if((msg.targetMinor()==CMMsg.TYP_ENTER)
&&(msg.amISource((MOB)host))
&&(msg.source().isMonster())
&&(msg.target() instanceof Room)
&&(msg.tool() instanceof Exit)
&&(!canBreatheHere(msg.source(), (Room)msg.target()))
&&(canBreatheHere(ms... | 7 |
public void moveInformations(int info1, int info2)
{
if (info1 < informations.size() && info2 < informations.size()) {
String temp = informations.get(info1);
informations.set(info1, informations.get(info2));
informations.set(info2, temp);
}
notifyZElement();
... | 2 |
public void onDisable()
{
try {
if (Misc.is(Constants.DatabaseType, new String[] { "sqlite", "h2", "h2sql", "h2db" })) {
Database.connectionPool().dispose();
}
System.out.println("[iConomy] Plugin disabled.");
} catch (Exception e) {
System.out.println("[iConomy] Plugin disabl... | 3 |
public Button(final Game2048 game) {
super("Go");
setBorder(null);
setBackground(new Color(0, 0, 0, 0));
setFont(Game2048.FONT.deriveFont(20f));
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(final MouseEvent e) {
... | 5 |
public Integer[] nextIntegerArray() throws Exception {
String[] line = reader.readLine().trim().split(" ");
Integer[] out = new Integer[line.length];
for (int i = 0; i < line.length; i++) {
out[i] = Integer.valueOf(line[i]);
}
return out;
... | 1 |
public Row(Combination<Colors> attempt, AnswerCombination answer) {
this.attempt = attempt;
this.answer = answer;
} | 0 |
public Cache() {
try {
File[] files = new File(Constants.getCacheDirectory()).listFiles();
dataFile = findDataFile(files);
indexFiles = findIndexFiles(files);
java.util.Arrays.sort(indexFiles);
if (dataFile == null) {
throw new IOException("Unable to locate... | 4 |
public void run() {
while (!Thread.interrupted()) {
try {
Thread.sleep(SLEEP_PERIOD);
showTable();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
} | 2 |
public static String swapCase(String str) {
if (StringUtil.isEmpty(str)) {
return str;
}
char[] buffer = str.toCharArray();
boolean whitespace = true;
for (int i = 0; i < buffer.length; i++) {
char ch = buffer[i];
if (Character.isUpperCase(ch)) {
buffer[i] = Character.toLowerCase(ch);
white... | 6 |
public static void EasternLounge() {
currentRoomName = "Eastern Lounge";
currentRoom = 4;
RoomDescription = "You walk into the room and you catch a glimps of a man wearing a cowboy hat and dark clothing as he " +
"runs out of the room through the huge eastern doors. There is a slight smell of cheap aftershav... | 0 |
@Override
public void drawShape(Graphics graphics) {
// Applies the color initially.
graphics.setColor(super.getColor());
// Local variables declarations
int xi, yi, xn, yn, p;
int dx, dy, x, y, slopeSign;
// Initialisations.
xi = super.getXi();
xn =... | 9 |
public void testToStandardHours() {
Weeks test = Weeks.weeks(2);
Hours expected = Hours.hours(2 * 7 * 24);
assertEquals(expected, test.toStandardHours());
try {
Weeks.MAX_VALUE.toStandardHours();
fail();
} catch (ArithmeticException ex) {
... | 1 |
public static int getMouseButtonCode(MouseEvent e) {
switch (e.getButton()) {
case MouseEvent.BUTTON1:
return MOUSE_BUTTON_1;
case MouseEvent.BUTTON2:
return MOUSE_BUTTON_2;
case MouseEvent.BUTTON3:
return MOUSE_BUTTON_3;
... | 3 |
public static Cons javaTranslateMethodParameters(MethodSlot method) {
{ boolean skipfirstparameterP = !MethodSlot.javaMethodObjectIsFunctionP(method);
Cons translatedparameters = Stella.NIL;
{ Symbol pname = null;
Cons iter000 = method.methodParameterNames().theConsList;
StandardObject ... | 7 |
public String getPath(String lookup) {
if (lookup != null ) {
if (lookup.contains("__")) {
String[] tmp = lookup.split("__");
if (tmp.length > 1 && !tmp[1].trim().equals("")) {
return setSuffixMatch(tmp[1].trim());
} else {
... | 6 |
@Override
public actionReturn doWork(Path filePath) {
CkRar rar = new CkRar();
if (Files.isDirectory(filePath)) {
File[] fileList = listFilesForFolder(filePath.toFile());
for (File file : fileList) {
if(getFileExtension(file).equals("rar")){
String fileString = file.toString();
if(rar.Open(file... | 8 |
public static int[] plusOne(int[] digits) {
int[] high_digit = {1};
if(digits==null||digits.length==0) return high_digit;
// Note: The Solution object is instantiated only once and is reused by each test case.
for(int i=digits.length-1;i>=0;--i) {
digits[i]++;
if(digits[i]<=9... | 5 |
private void removeDropTransfer(Transfer transfer){
if (dropTypes.length == 1) {
dropTypes = new Transfer[0];
} else {
int index = -1;
for(int i = 0; i < dropTypes.length; i++) {
if (dropTypes[i] == transfer) {
index = i;
break;
}
}
if (index == -1) return;
Transfer[] newTypes = new Transfer... | 5 |
private static byte[] readStream(AudioInputStream stream)
throws IOException {
byte[] data = new byte[stream.available()];
int bytesRead = 0;
int totalBytesRead = 0;
while ((bytesRead = stream.read(data, totalBytesRead, data.length
- totalBytesRead)) != -1
&& totalBytesRead < data.length) {
totalB... | 2 |
public void InsertNotes(String note){
Player player=new Player();
if(Composer instanceof AtonalMMC&&num <11){
Composer.InsertNotes(note);
String pl=Composer.getInstruments()+" "+note;
player.play(pl);
num++;
}else if(num==11){
Composer.InsertNotes(note);
}else{
Composer.InsertNotes(note);
... | 3 |
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Please input number of lines:");
int i = 0, j, k, n;
n = scan.nextInt();
for (k = 0; k <= n / 2; k++) {
for (i = 0; i < n - k; i++) {
System.out.print(" ");
}
for (j = 1; j < k; j++) {
Syste... | 8 |
boolean isStopped() {
final ReentrantLock l = lock;
l.lock();
try {
return stopped;
}
finally {
l.unlock();
}
} | 0 |
protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
/* For PointOpImage, srcRect = destRect. */
RenderedImage[] renderedSources =
source2Alpha == null ? new RenderedImage[3] :
... | 9 |
public ArrayList<Pair> serialise() throws MVDException
{
Pair.pairId = 1;
if ( origSize < 15 )
origSize = 15;
numParents = 0;
ArrayList<Pair> pairs = new ArrayList<Pair>( origSize );
printAcross( pairs, graph.start, allVersions );
if ( parents.size() != 0 )
throw new MVDToolException("Mismatche... | 3 |
private boolean jj_3R_82() {
if (jj_3R_94()) return true;
return false;
} | 1 |
private static String nextViableLine(RandomAccessFile r) throws IOException {
String l;
while ((l = r.readLine()) != null && ((l = l.trim()).length() == 0 || l.startsWith("//"))) {
//Reading file done in loop condition!
}
return l;
} | 3 |
public static int readVersion( Handshakedata handshakedata ) {
String vers = handshakedata.getFieldValue( "Sec-WebSocket-Version" );
if( vers.length() > 0 ) {
int v;
try {
v = new Integer( vers.trim() );
return v;
} catch ( NumberFormatException e ) {
return -1;
}
}
return -1;
} | 2 |
@Override
public void setGUITreeComponentID(String id) {this.id = id;} | 0 |
private void checkCompletion()
{
if(state == CompletionState.IN_PROGRESS)return;
if(isComplete())
{
log.complete(q, state);
if(SkyQuest.isOnServer())
{
Player p = Bukkit.getServer().getPlayerExact(player);
if(p != null && q.isVisible())
{
if(state == CompletionState.COMPLETE)
p.se... | 7 |
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 |
ServerMessage(int code, MessageHandler handler) {
m_handler = handler;
m_map.put(code, this);
} | 9 |
public boolean equals(Datum other) {
if(this.dan == other.dan && this.mjesec == other.mjesec && this.godina == other.godina)
return true;
else
return false;
} | 3 |
private void randomiseBlock() {
final boolean[] inUse = this.data.inUse;
final byte[] block = this.data.block;
final int lastShadow = this.last;
for (int i = 256; --i >= 0;)
inUse[i] = false;
int rNToGo = 0;
int rTPos = 0;
for (int i = 0, j = 1; i <=... | 5 |
public ArrayList<String[]> buscaNombreLogin(String login_nombre) {
String res = "error";
Statement statement;
ResultSet resultSet;
ArrayList<String[]> resultado = new ArrayList<>();
String[] nombre = new String[2];
try {
Connection con = DriverManager.getConn... | 2 |
private OSType getOSType()
{
String os_name = System.getProperty("os.name").toLowerCase();
if(os_name.contains("mac"))
{
return OSType.OS_MacOSX;
}
else if(os_name.contains("nix") || os_name.contains("nux"))
{
return OSType.OS_Unix;
}
else if(os_name.... | 4 |
public void run()
{
for (int i=0; i<200 && running; i++) {
try
{
thread.sleep(50);
}
catch(Exception e){ e.printStackTrace(); }
toFront();
}
hide();
} | 3 |
public Image loadImage(String imageName) {
Image img = imageCache.get(imageName);
if (img == null) {
try {
ClassLoader loader = getClass().getClassLoader();
Class[] classes = { Image.class };
URL url = loader.getResource("images/" + imageName);
img = (Image) url.openConnection().getContent(class... | 2 |
private static void maxHeapify(int[] array, int index, int heapSize) {
int left = index*2;
int right = index*2 + 1;
int largest = index ;
if(left < heapSize && array[left] > array[index])
largest = left;
if(right < heapSize && array[right] > array[largest])
largest = right; //if the array[index... | 5 |
public void saat(int saat, int dk, int sn){
String saatText = "";
if(saat < 10)
saatText = "0";
saatText += saat + ":";
if(dk < 10)
saatText += "0";
saatText += dk + ":";
if(sn < 10)
saatText += "0";... | 3 |
public HandlerImpl() {
for (int i = 0; i < wList.length; i++) {
whiteList.add(wList[i]);
}
for (String s:bList){
blackList.add(s);
}
} | 2 |
@Override
public void writeTo(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream os) throws IOException {
PropertyFiltering annotation = findPropertyFiltering(annotations);
Collection<String>... | 3 |
public int deleteNode(Point pnt) {
Circle c = new Circle(pnt);
int k = -1;
for (int i = 0; i < pnts.length; i++) {
if (c.equals(pnts[i])) {
k = i;
}
}
if (k != -1) {
g.clearRect(pnts[k].pnt.x, pnts[k].pnt.y, pnts[k].rad, pnts[k]... | 7 |
@Override
public String getStat(String code)
{
if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0)
return CMLib.coffeeMaker().getGenItemStat(this,code);
switch(getCodeNum(code))
{
case 0:
return "" + powerCapacity();
case 1:
return "" + powerRemaining();
case 2:
return "" + getGeneratedAmountPe... | 8 |
public static void removePainters(final Paintable... painters) {
if (painters == null || getPaintHandler() == null) {
return;
}
for (final Paintable p : painters) {
if (p != null) {
if (p instanceof PaintTab) {
getMainPaint().remove((PaintTab) p);
} else {
getPaintHandler().remove(p);
... | 5 |
public void setRegistro(String json) {
DefaultHttpClient clienteHttp = new DefaultHttpClient();
HttpPut requisicaoPUT;
if (json.equals("")) {
String url = getHost() + ":" + getPorta() + "/" + getNomebanco();
requisicaoPUT = new HttpPut(URI.create(url));
System.out.println("PUT : " + url);
} else {
S... | 2 |
public PNGDecoder(InputStream input) throws IOException {
this.input = input;
this.crc = new CRC32();
this.buffer = new byte[4096];
readFully(buffer, 0, SIGNATURE.length);
if(!checkSignature(buffer)) {
... | 7 |
private void jarjestetaanTunnuksia() {
if (this.kategoria.equals(TunnusTilastoKategoriat.TUNNUS)) {
Collections.sort(liittyma.getTunnukset());
} else if (this.kategoria.equals(TunnusTilastoKategoriat.PELIT)) {
Collections.sort(liittyma.getTunnukset(), new TunnuksetPelienMukaanJar... | 6 |
public ItemStack getStackInSlot(int var1) {
ItemStack var2 = null;
Slot var3 = (Slot)this.inventorySlots.get(var1);
if(var3 != null && var3.getHasStack()) {
ItemStack var4 = var3.getStack();
var2 = var4.copy();
if(var1 == 0) {
this.func_28125_a(var4, 9, 45, true)... | 9 |
String valueString() {
Object v = value();
if (v == null) {
throw new IllegalArgumentException("Missing output: " + token);
}
if (v.getClass() == Double.class) {
return String.format(Locale.US, fformat, v);
} else if (v instance... | 4 |
public List<Project> Search_file(String projectName, String fileName,
String format) {
String query1 = "SELECT distinct e.projID from project e WHERE e.projName='"
+ projectName + "'";
EntityManagerFactory emf = Persistence
.createEntityManagerFactory("PersistenceUnit");
EntityManager manager = emf.cre... | 8 |
public void ignite(MOB mob, Item I)
{
int durationOfBurn=5;
switch(I.material()&RawMaterial.MATERIAL_MASK)
{
case RawMaterial.MATERIAL_LEATHER:
durationOfBurn=20+I.phyStats().weight();
break;
case RawMaterial.MATERIAL_CLOTH:
case RawMaterial.MATERIAL_SYNTHETIC:
case RawMaterial.MATERIAL_PAPER:
d... | 8 |
@EventHandler
public void ZombieHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Zombie.Hunger.D... | 6 |
private JTable getJTableField() {
// Nom des colonnes
String[] columnNames = {"Matière enseignée"};
// On s'occupe de la ComboBox
ArrayList<Field> fields = dataStore.getFields();
//System.out.println("tp : " + fields.size());
comboData = new String[fields.size() + 1];
comboData[0] = ""; // Pre... | 1 |
public void removeVertex (int id){
int pos=-1;
for (int i=0; i<thisVert.size(); i++)
{
if (thisVert.get(i).GetId()==id)
{
//System.out.println("Removeu! o id ->" + id);
while (isArest(id))
{
for (int j=0;j<thisArest.size(); j++)
{
if ((thisArest.get(j).getTheFrom()==id) || (thisA... | 7 |
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.