text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void read(){
try {
FileInputStream fis1;
fis1 = new FileInputStream("Datas/AccountPO.out");
FileInputStream fis2 = new FileInputStream("Datas/CollectionOrPaymentPO.out") ;
FileInputStream fis3 = new FileInputStream("Datas/CashPO.out");
if(fis1.available()>0 ){
ObjectInputStream oin1 ;
... | 6 |
public void actionPerformed(ActionEvent ae) {
double x = 0.0, y = 0.0;
Double d;
try {
d = new Double(eastings.getText());
x = d.doubleValue();
} catch (NumberFormatException nfe) {
eastings.setText("0");
x = 0.0;
}
try {
d = new Double(northings.getText());
y = d.doubleValue();
} catc... | 4 |
public void dropCourseFromAll(String course) {
if (root == null) {
System.out.println("Roster is empty, can't drop course " + course);
return;
}
Queue<StudentNode> queue = new LinkedList<StudentNode>();
queue.add(root);
while (queue.size() != 0) {
StudentNode temp = queue.remove();
if (temp.cou... | 5 |
public void run() {
int counter = 0;
while (!maze.allRatsOnTarget()
&& counter < maze.getMaxSimulationStep()) {
for (MazeRat rat : maze.getRats()) {
if (!maze.isRatOnTarget(rat))
rat.performStep();
}
mazePanel.repaint();
try {
Thread.sleep(100);
} catch (InterruptedExcepti... | 6 |
@Override
public <Y> Y convert(IntNode node, Class<Y> cls) {
if (Object.class.equals(cls) || Number.class.equals(cls)) {
cls = (Class<Y>) Long.class;
} else if (cls.isPrimitive()) {
cls = (Class<Y>) WRAPPERS.get((Class<? extends Number>) cls);
if (cls == null) {
... | 7 |
@Override
public void run()
{
if(!EntityConcentrationMap.isRunning())
mPlugin.runGroups(false);
} | 1 |
protected void closeStatements(String Closer)
{
try
{
if(!Closer.equals(""))
{
if(myStatement!=null)
{
lastSQL=Closer;
lastQueryTime=System.currentTimeMillis();
myStatement.executeUpdate(Closer);
}
}
if(myResultSet!=null)
{
myResultSet.close();
myResultSet=null;
... | 9 |
public void test_collapseZeroGap() {
initRand();
int numMarkers = 20;
Chromosome chr = genome.getChromosome("1");
for (int num = 1; num < 1000; num++) {
// Create markers
Tuple<Markers, Markers> tupleMarkers = createMarkers(chr, numMarkers);
Markers markersOri = tupleMarkers.first;
Markers markersC... | 8 |
public void testRemoveBadIndex2() {
Converter[] array = new Converter[] {
c1, c2, c3, c4,
};
ConverterSet set = new ConverterSet(array);
try {
set.remove(-1, null);
fail();
} catch (IndexOutOfBoundsException ex) {}
assertEquals(4, set.s... | 1 |
public static void main(String[] args) {
int width = 20;
int height = width;
Node[][] grid = new Node[width + 1][height + 1];
for (int y = 0; y <= height; y++) {
for (int x = 0; x <= width; x++) {
Node left = null;
Node above = null;
if (x > 0) {
left = grid[x - 1][y];
}
if (y > 0) ... | 4 |
public Grid(int x, int y){
boolean test = false;
if (test || m_test) {
System.out.println("Grid :: Grid() BEGIN");
}
setGrid(new Game.PlayerTurn[x][y]);
for (int i = 0; i < x; i++) {
for (int j = 0; j < y; j++) {
setCoordinate(new Coordinate(i, j, Game.PlayerTurn.NONE));
if ... | 6 |
private void adjustVolume(IAudioSamplesEvent event) {
ShortBuffer buffer = event.getAudioSamples().getByteBuffer().asShortBuffer();
for (int i = 0; i < buffer.limit(); ++i) {
buffer.put(i, (short) (buffer.get(i) * volumeScale));
}
} | 1 |
@Override
public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from,
HantoCoordinate to) throws HantoException {
MoveResult result;
HantoPlayerColor color;
// use copy constructor on given HantoCoordinates
PieceCoordinate newFrom = from == null? null : new PieceCoordinate(from);
PieceC... | 4 |
public void initGraphicData() {
final int W = 200;
final int H = 100;
boolean changed = false;
int x = 10;
int y = 10;
if (x < 0) x = 0;
if (y < 0) y = 0;
for (int i = 0; i < nodeList.size(); i++) {
y = y + H + 10;
Rectangle rect = new Rectangle(x, y, W, H);
circles.addElement(rect);
drawing... | 5 |
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
Map params=request.getParameterMap();
boolean show=false;
String env="ppe";
Strin... | 9 |
public Set<Map.Entry<Short,Byte>> entrySet() {
return new AbstractSet<Map.Entry<Short,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortByteMapDecorator.this.isEmpty();
}
publ... | 8 |
public WindowsRegistry(boolean user) {
if (!Platform.isWindows()) {
throw new IllegalStateException("Only avaliable on a Windows platform");
}
if (user) {
mRoot = Preferences.userRoot();
mRootKey = Integer.valueOf(0x80000001);
} else {
mRoot = Preferences.systemRoot();
mRootKey = Integer.valueOf(... | 2 |
@Override
public void run() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM HH:mm");
do {
try {
trayIcon.setToolTip("Busy...");
trayIcon.setImage(imageBusy);
TemperatureStatus t=controller.invoke();
t.save(orm);
trayIcon.setToolTip("Last sample: " ... | 6 |
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
Customer customer = customers.get(rowIndex);
switch (columnIndex) {
case 0:
customer.setId((Long) aValue);
break;
case 1:
customer.setFirstname((String) aValue);
break;
case 2:
customer.setLastname((String) a... | 6 |
@Override
public void rightMultiply(IMatrix other) {
// TODO Auto-generated method stub
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
copy[i][j]=0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
for (int k = 0; k < 4; k++) {
copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k);
... | 7 |
public void keyPressed(int k) {
if(player.getMovable()){
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
}
} | 6 |
@Override
public double calculateJuliaWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[0] = new Complex(pixel);//z
complex[1] = new Complex(seed);//c
comp... | 8 |
public String testStartLocal(String appKey, String userKey, String testId) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
} catch (UnsupportedEncodingException e) {
... | 1 |
public void setTitle(String title) {
this.title = title;
} | 0 |
public Document createDocument(final List<Student> students) {
Document doc = null;
try {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(true);
final DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.newDocument();
final Element root = doc.createElem... | 6 |
private final void split() {
if (isLeaf()) {
int hw = mWidth / 2;
int hh = mHeight / 2;
mNorthWest = new Node<>(mX, mY, hw, hh, mMaxCapacity);
mNorthEast = new Node<>(mX + hw, mY, mWidth - hw, hh, mMaxCapacity);
mSouthWest = new Node<>(mX, mY + hh, hw, mHeight - hh, mMaxCapacity);
mSouthEast ... | 2 |
private boolean hasAppropriateFirstTerminal() {
return peekTypeMatches("ID") || peekTypeMatches("LPAREN")
|| peekTypeMatches("INTLIT") || peekTypeMatches("STRLIT")
|| peekTypeMatches("NIL");
} | 4 |
@Override
protected void paint(Graphics2D g2) {
if (debug) {
paintDebuggingFrame(g2);
}
super.paint(g2);
} | 1 |
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Jump other = (Jump) obj;
if (captureX != other.captureX) {
return false;
}
if (captureY != other.captureY) {... | 9 |
public static void restoreGODatabase(){
for (File file: new File("C:/Users/hgabr/Desktop/go_201207-assocdb-tables").listFiles()){
if (file.getName().indexOf(".sql") > 0){
try {
Process process = Runtime.getRuntime().exec("cmd /c mysql -u root go < " + "c:\\Users\\hgabr\\Desktop\\go_201207-assocdb-tables\\... | 8 |
public Message<?> debug(Message<?> message) {
StringBuilder builder = new StringBuilder();
builder.append("\n############################## DEBUG HOOK ##############################\n");
builder.append("Payload:"+message.getPayload()+"\n");
builder.append("Headers:"+message.getHeaders(... | 2 |
private void registerJobs(){
List<String> list =getJobsConf().getStringList("enabled-jobs");
for(String job : list){
registerJob(job);
}
} | 1 |
public void setSelected(TreeNode node, boolean select) {
if (select)
selectedNodes.put(node, null);
else
selectedNodes.remove(node);
} | 1 |
public static void main(String args[]) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for(int t=0,T=parseInt(in.readLine().trim());t++<T;){
int N=parseInt(in.readLine().trim());
int arr[][]=new int[N][2];
long s1=0,s3=0;
... | 8 |
@Override
public void addUser(User user) throws SQLException {
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}finally{
if(session!... | 3 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
public JPanel createSettings() {
JPanel settings = new JPanel();
settings.setLayout(new GridBagLayout());
settings.setBackground(new Color(255, 231, 186));
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(5,5,5,5);
JLabel set = new JLabel("Settings");
... | 4 |
protected PseudoSequencePair getLastInstanceOfPrefixSequenceNEW(List<Itemset> prefix, int i){
int remainingToMatchFromPrefix = i;
List<Position> listPositions = new ArrayList<Position>();
int prefixItemsetPosition = prefix.size() -1;
// for each itemset of sequence
for(int j = size() -1; j>=0; j--){... | 8 |
public static void main(String[] args) throws UnknownHostException, SocketException{
Enumeration e = NetworkInterface.getNetworkInterfaces();
while (e.hasMoreElements()) {
NetworkInterface n = (NetworkInterface) e.nextElement();
Enumeration ee = n.getInetAddresses();
while(ee.hasMoreElements()) {
... | 2 |
public List<Endereco> listarTodos(int idPessoa){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("SELECT * FROM enderecos WHERE id_pessoa = ? "
+ "AND ativo = 1");
comando.setInt(1, idPessoa);
ResultSet consulta = ... | 2 |
public void shiftLeft(boolean isJump){
reDrawIndex = reDrawIndex - 5;
if(reDrawIndex < 0){
reDrawIndex = files.size() + reDrawIndex;
}
if(isJump){
listPosition = listPosition - 5;
if(listPosition < 0){
listPosition = files.size() + listPosition;
}
}
} | 3 |
public int insert(List<DBRow> rows) throws Exception{
File table = new File("Databases/" + name + ".xml");
if(!table.exists())
throw new Exception("The table " + name + " doesn't exist.");
SAXBuilder builder = new SAXBuilder();
Document document = null;
try {
document = (Document) builder.build... | 8 |
public RQHTTPHandler(RemoteQuery plugin, RQSchedulerHandler schedHandler)
{
this.plugin = plugin;
this.schedHandler = schedHandler;
try
{
cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); // must match with remote PHP scripts encryption scheme
}
catch (NoSuchAlgorithm... | 2 |
public Set<Map.Entry<Double,Character>> entrySet() {
return new AbstractSet<Map.Entry<Double,Character>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TDoubleCharMapDecorator.this.isEmpty();
}
... | 8 |
protected long encodeBinary(OutputStream objOut, RPCObject rpcObj) throws IOException {
long byteSent = 0L;
RPCBinaryObject rcpbinary = (RPCBinaryObject)rpcObj;
Object val = rpcObj.getValue();
File f = null;
byte[] data = null;
if(val instanceof File){
f = (File) val;
}else if(val instanceof String){
... | 9 |
private void changeViewMode()
{
viewModeCounter++;
if(viewModeCounter==4){viewModeCounter=0;}
MapGetter.setMapType(viewMode[viewModeCounter]);
MapGetter.getMapImage(MapGetter.createUrl(0, 0));
buttonViewMode.setText(viewMode[viewModeCounter].toUpperCase());
... | 1 |
public void handlePacket(LoginPacket packet) {
final IoBuffer buf = packet.getPayload();
switch (packet.getOpcode()) {
case LoginPacket.CHECK_LOGIN: {
final String name = NameUtils.formatNameForProtocol(IoBufferUtils
.getRS2String(buf));
final String password = IoBufferUtils.getRS2String(buf);
final... | 9 |
public boolean collides(Ship someShip)
{
for(int i = 0; i < fleet.size(); i++)
{
Ship ship = fleet.get(i);
if(someShip.contains(ship))
return true;
}
return false;
} | 2 |
public static final BruteParams<?>[] valuesGlobal() {
final BruteParams<?>[] values_ = values();
for (int i = 0; i < values_.length; i++) {
if (!values_[i].global) {
values_[i] = null;
}
}
return values_;
} | 4 |
public Matrix getBack() {
return cam.getBack();
} | 0 |
private void acao111() throws SemanticError {
try{
IdentificadorMetodo idMetodo = pilhaMetodosAtuais.peek();
for(Identificador id : listaParametros){
IdentificadorParametro idParametro = completarIdParametro(id);
idMetodo.getParametros().add(idParametro);
tabela.override(idParametro, nivelAtual);
... | 2 |
void drawObject(Graphics g, JGObject o) {
if (!o.is_suspended) {
//o.prepareForFrame();
drawImage(g,(int)o.x,(int)o.y,o.getImageName(),true);
try {
o.paint();
} catch (JGameError ex) {
exitEngine(dbgExceptionToString(ex));
} catch (Exception e) {
dbgShowException(o.getName(),e);
}
}
... | 6 |
public String getCampoVenta(String clave, beansVentas venta){
if(clave.trim().equals("nombre"))
return venta.getNombre();
if(clave.trim().equals("nick"))
return venta.getNick();
if(clave.trim().equals( "precio"))
return Integer.toString(venta.getPrecio());
if(clave.trim().equals("fecha"))
return ven... | 7 |
private void toFastboot_fastbootMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toFastboot_fastbootMenuActionPerformed
try {
adbController.getFastbootController().rebootDeviceFastboot(deviceManager.getSelectedFastbootDevice(), RebootTo.BOOTLOADER);
} catch (IOException... | 1 |
public void play(int numGames, int numPlayer, int numCard, int itemsPerLine, boolean shuffle) {
for (int i = 0; i < numGames; i++) {
System.out.println("=== Game " + (i+1) + " ===");
System.out.println();
if (shuffle) {
cardDeck.shuffle();
}
... | 3 |
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS-... | 8 |
public Cuboid getFace(CuboidDirection dir) {
switch (dir) {
case Down:
return new Cuboid(this.worldName, this.x1, this.y1, this.z1, this.x2, this.y1, this.z2);
case Up:
return new Cuboid(this.worldName, this.x1, this.y2, thi... | 6 |
public static void OrdiVsOrdi(Parametre param){
// Faire des statistiques sur plusieurs parties
Ligne ligneOrdi1 = new Ligne(param, true);
Ligne ligneOrdi2 = new Ligne(param, false);
LigneMarqueur liMarq = new LigneMarqueur(param.getTailleLigne());
String esp = ... | 4 |
public FenetreVisualiserRaster(){
//maintenant la fenêtre de visualisation
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setTitle("Visualisation de Raster");
this.setSize(500, 240);
// this.connexion=connexion;
if(FenetreVisualiserRaster.nomShape1.size(... | 8 |
private RepositoryConfig createRepositoryConfig(Properties properties) throws MojoExecutionException{
String driverClass = this.databaseDriverClass;
String username = this.databaseUsername;
String password = this.databasePassword;
String url = this.databaseUrl;
if (Strings.isNullOrEmpty(driverClass) && ... | 9 |
public CloudController(String componentName, Config config, InputStream userRequestStream, PrintStream userResponseStream) {
this.componentName = componentName;
this.controllerConfig = config;
this.userRequestStream = userRequestStream;
this.userResponseStream = userResponseStream;
/*
* Initialize the use... | 8 |
public Object[][] bacaDaftar(){
boolean adaKesalahan = false;
Connection cn = null;
Object[][] daftarPembeli = new Object[0][0];
try{
Class.forName(Koneksi.driver);
} catch (Exception ex){
adaKesalahan = true;
JOptionPane.showMessageDialog(null... | 7 |
public void setK(double K) {
assert K >= 0 && K <= 1;
this.K = K;
} | 1 |
public void drawGridLines(Graphics g) {
if (gridLines) {
g.setColor(new Color(0, 0, 200));
for (int i = 0; i < GameConstants.HEIGHT; i++) {
g.drawLine((finalFormatX + padding) - (wallSize / 2), i
* wallSize + padding + finalFormatY,
(finalFormatX + padding) + wallSize
* GameConstants.WID... | 3 |
private void setBreakableLines() {
for (int i = 0; i < program.size(); i++) {
if (program.getCode(i).getClass() == LineCode.class && ((LineCode) program.
getCode(i)).
getLineNumber() > 0) {
source... | 3 |
private List<PhaseField> getPhasesStatuses(DaySchedule daySchedule,
List<TaskRow> tasksData) {
List<PhaseField> tmpPhaseFields = new ArrayList<PhaseField>();
String prevProjectName = tasksData.get(0).getProjectName();
String prevPhaseName = tasksData.get(0).getPhaseName();
int phaseStatus = 0;
int row =... | 7 |
private byte[] readInputStreamSlowMode(InputStream is) {
boolean lastByteWasReturnByte = false;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
while (true) {
int intB = is.read();
byte b = (byte) intB;
/**
* prevent OutOfMemory exceptions, per leopoldkot
*/
if (intB ... | 7 |
public static Node transplant(Node root,Node u, Node v){
if(u.p == null){
root = v;
}
else if(u == u.p.left)
u.p.left = v;
else
u.p.right = v;
if(v != null)
v.p = u.p;
return root;
} | 3 |
public String truncate(String string, int maxLength)
{
if(null == string) return null;
if(_trimFirst)
{
string = string.trim();
}
if(_compressWhiteSpace)
{
string = string.replaceAll("\\s{2,}", " ");
}
... | 7 |
private void updateVersion(Object[] args) throws CacheUnreachableException {
List<VersionUpdateDefinition> updates = cacheDefinitionCollection.getVersionUpdateDefinitions();
if (updates == null) {
return;
}
// 根据cacheDefinitionCollection中配置的所有更新版本操作,循环调用,更新版本号
for (VersionUpdateDefinition definition : upd... | 5 |
protected void fireReceiveDataEvent(ReceiveDataOnServerEvent evt) {
if (receiveDataOnServerListenerList != null) {
Object[] listeners = receiveDataOnServerListenerList.getListenerList();
for (int i=0; i<listeners.length; i+=2) {
if (listeners[i]==ReceiveDataOnServerListener.class) {
((... | 3 |
private int findMinIndex( )
{
int i;
int minIndex;
for( i = 0; theTrees[ i ] == null; i++ )
;
for( minIndex = i; i < theTrees.length; i++ )
if( theTrees[ i ] != null &&
theTrees[ i ].element.compareTo( theTrees[ minIndex ].element ) < 0 )
minIndex = i;
... | 4 |
private void clean()
{
for(int i=0; i<mapHeight; i++)
for(int j=0; j<mapWidth; j++)
{
buttons[i][j].setText("");
buttons[i][j].setBackground(Color.WHITE);
}
} | 2 |
@SuppressWarnings("unchecked")
public static BaseJob createJob(ClassLoader classLoader,
Map<String, Object> map, JQlessClient client) {
try {
// Guarantee "data" is a Map
if (map.containsKey("data") && map.get("data") instanceof String) {
try {
Map<String, Object> data = JsonHelper.parseMap((String... | 9 |
private void makeHouse(int y, int x, int h, int w) {
for(int i=y; i<y+h; i++)
{
for(int j=x; j<x+w; j++)
{
if(i==y || j==x || i==y+h-1 || j==x+w-1)
{
if(i==y+h/2)
tiles.get(j+i*width).switchType(2);
... | 7 |
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode()== KeyEvent.VK_LEFT){
if(mainMenuShowing==false){
showPreviousSlide();
}
}
if(e.getKeyCode()== KeyEvent.VK_RIGHT){
if(mainMenuShowing==false){
showNextSlide();
}
}
} | 4 |
private boolean areEqual(String string1, String string2) {
if (string1 == "")
string1 = null;
if (string2 == "")
string2 = null;
if ((string1 == null && string2 != null) ||
(string1 != null && string2 == null)) {
return false;
}
else if (string1 != null && string2 != null && !string1.equalsI... | 9 |
@SuppressWarnings({ "rawtypes", "unchecked" })
private static File[] createFileArray(final BufferedReader bReader, final PrintStream out) {
try {
java.util.List list = new java.util.ArrayList();
java.lang.String line = null;
while ((line = bReader.readLine()) != null) {
... | 4 |
public void step(boolean blockStep) {
Configuration[] configs = configurations.getValidConfigurations();
ArrayList list = new ArrayList();
HashSet reject = new HashSet();
// Clear out old states.
configurations.clearThawed();
if (!blockStep){ //for ordinary automaton
for (int i = 0; i < ... | 6 |
public void heapSort() { // decreasing order, since this is maxHeap
for (int i = 0; i < heap.size(); i++) {
BTPosition<T> tmp = remove();
System.out.println("Removed: " + tmp.element());
}
} | 1 |
private boolean castlingPossible(final boolean kingside) {
// First check whether castling is generally allowed in this position.
boolean result = this.getPos().isCastlingAvailable(kingside,
this.getColor());
if (result) {
// Castling to the specified side is generall... | 7 |
@EventHandler(priority = EventPriority.NORMAL)
public void onInteract(PlayerInteractEvent e)
{
Player player = e.getPlayer();
if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
{
if (e.getClickedBlock().getState() instanceof Sign)
{
Sign s = (Sign) e.getClickedBlock().getState();
if (s.getLine(0).eq... | 7 |
public boolean begin() {
try {
//Sanity check
if(filename == null || filename.isEmpty()) {
throw new Exception("File name must be set");
}
//Ready the output writer
Charset charset = Charset.forName("UTF-8");
bW... | 9 |
public String getParameterString(){
String retString = super.getParameterString();
try{
if(sourceText!=null) retString+="&sourceText="+sourceText;
if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8");
if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8");
if(baseUrl!=... | 5 |
public void sanityCheck() {
if (DEBUG) {
System.out.print(this);
int[] widthsCheck = new int[height];
int maxHeightCheck =0;
for(int i =0; i< width;i++){
int heightCheck = 0;
for(int j =0; j< height;j++){
if(grid[i][j])
{
heightCheck = j+1;
widthsCheck[j]++;
if(maxHe... | 8 |
@EventHandler
public void IronGolemWeakness(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.getIronGolemConfig().getDouble("IronGol... | 6 |
@Override
public void unInvoke()
{
// undo the affects of this spell
final Environmental E=affected;
if(E==null)
return;
super.unInvoke();
if(canBeUninvoked())
{
if(E instanceof MOB)
{
final MOB mob=(MOB)E;
mob.tell(L("You are no longer soiled."));
final MOB following=((MOB)E).amFollo... | 9 |
public String getDefault_() {
return default_;
} | 0 |
public static Class<?> getInterfaceGenericType(Class<?> clazz) {
Type genericType = clazz.getGenericInterfaces()[0];
Class<?>[] classes = getActualClass(genericType);
if (classes.length == 0) {
return null;
} else {
return classes[0];
}
} | 4 |
public NetWork(int inputPopulation, int middlePopulation, int outputPopulation, double learningRate, double momentum) {
_inputz = new InputNode[inputPopulation];
for (int ii = 0; ii < _inputz.length; ii++) {
_inputz[ii] = new InputNode();
}
_middlez = new MiddleNode[middlePopulation];
for (in... | 8 |
int parseInt(String s) throws NumberFormatException {
int radix;
int i;
if( s.startsWith("0x") || s.startsWith("0X") ) {
radix = 16;
i = 2;
} else if( s.startsWith("0") && s.length() > 1 ) {
... | 7 |
private void putCardInFromStack() {
if(cardStackFrom != null && card != null) {
cardStackFrom.addCardRandomly(card);
cardStackFromPanel.setCurrentCount(cardStackFrom.getCount());
card = null;
}
} | 2 |
@EventHandler
public void PigZombieStrength(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.getPigZombieConfig().getDouble("PigZomb... | 6 |
private Window() {
// Sets the title for this frame.
this.setTitle("Race Car Game");
// Sets size of the frame, checks for full screen
if (false) // Full screen mode
{
// Disables decorations for this frame.
this.setUndecorated(true);
// Puts ... | 1 |
private void startCollectionSelection() {
ImageButton editCollection = new ImageButton(parent, "Edit collection",
((int) posX + 85), ((int) posY + 150), 100, 25, 1) {
@Override
public void onMousePress(int x, int y) {
if (collectionSelected) {
editingCollection = true;
stopEditingCollection()... | 3 |
private static float sqrt(int n){
float l = 0;
float r = n;
while(l<r){
float mid = l + (r-l)/2;
float curr = mid*mid;
if(curr < n){
l=(float) (mid+0.001);
} else if (curr == n) {
return mid;
} else {
r=(float) (mid-0.001);
}
}
return l;
} | 3 |
public Laptop(FabrykaPodzespolowLaptop fabrykaPodzespolowLaptop){
this.fabrykaPodzespolowLaptop = fabrykaPodzespolowLaptop;
skladanie();
} | 0 |
public boolean addAll(SimpleSet<? extends E> s) {
Iterator<? extends E> itr = s.iterator();
int temp = set.size();
while (itr.hasNext()) {
add(itr.next());
}
if(set.size()==temp){
return false;
}
return true;
} | 4 |
public void setFinal(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int modifiers = fieldInfo.modifiers();
if (flag) {
modifiers |= Modifiers.FINAL;
} else {
modifiers &= ~... | 2 |
static double incompleteBetaFraction2(double a, double b, double x) throws ArithmeticException {
double xk, pk, pkm1, pkm2, qk, qkm1, qkm2;
double k1, k2, k3, k4, k5, k6, k7, k8;
double r, t, ans, z, thresh;
int n;
k1 = a;
k2 = b - 1.0;
k3 = a;
k4 = a + 1... | 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.