text stringlengths 14 410k | label int32 0 9 |
|---|---|
public void validateSetPassword(ChangePasswordBean changePasswordBean,
ValidationContext context) {
MessageContext messageContext = context.getMessageContext();
String newPassword = changePasswordBean.getNewPassword();
String confirmNewPassword = changePasswordBean.getConfirmNewPassword();
if(newPasswo... | 5 |
@Test
public void corridorConnectionTests(){
getNewBoard();
for (int row = 0; row < 29; row++ ){
for (int col = 0; col < 25; col++){
Square s = board.getSquare(new Point(col, row));
if (s instanceof CorridorCell){
CorridorCell corCell = (CorridorCell) s;
Set<Cell> neighs = corCell.get... | 8 |
public static byte[] decodeFromFile( String filename )
{
byte[] decodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] buffer = null;
int length ... | 4 |
public void addScore(String name, int score) {
date = new Date();
if (isNewHighscore(score)) {
leaderboard[9][0] = name;
leaderboard[9][1] = Integer.toString(score);
leaderboard[9][2] = dateFormat.format(date);
sortLeaderboards();
repaint();
... | 1 |
private static double getEuclidDistance ( double[] x
, double[] y
, Matrix features) {
assert(x.length == y.length);
double distance = 0;
for (int k = 1; k < x.length; k++) {
if (x[k] == MISSING || y[k] == MISSING) {
distance += 1;
}
else {
int attributeValues = featu... | 5 |
private int readChar()
{
try
{
int readVal;
while(true)
{
readVal = input.read();
//if(readVal == (int)'\n')
// continue;
nextReadColumnNumber++;
if(readVal == (int)'\n')
{
nextReadLineNumber++;
nextReadColumnNumber = 1;
}
return readVal;
}
}
catch (IO... | 3 |
synchronized void setFullImage(BufferedImage img,ImageType type){
MultiSizeImage setter;
if(type==ImageType.Icon) setter=iconImage;
else setter=originalImage;
setter.fullImage =img;
if(img!=null) setter.fullDimensions=new Dimension(img.getWidth(),img.getHeight());
else {
... | 5 |
public static String getXMLDeclaration() {
return getXmlDeclaration(null);
} | 0 |
@Override
public String get(Object keyObject)
{
String key = (String) keyObject;
for (Map.Entry<String, String> e : entries)
{
if (key == null)
{
if (e.getKey() == null)
{
return e.getValue();
}
}
else if (key.equalsIgnoreCase(e.getKey()))
{
return e.getValue();
}
}
re... | 4 |
@Override
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
if (isResolvable(base)) {
Map<?, ?> map = (Map<?, ?>) base;
final Iterator<?> keys = map.keySet().iterator();
return new Iterator<FeatureDescriptor>() {
public boolean hasNext() {
return keys.hasNex... | 8 |
public void setPoint(Point p, int value) {
int oldVal = getPoint(p);
if (oldVal == WHITE || oldVal == WHITE_GRAY)
{
white--;
}
else if (oldVal == BLACK || oldVal == BLACK_GRAY)
{
black--;
}
if (value == WHITE || value == WHITE_GRAY)
{
white++;
}
else if (value == BLACK || value == BLACK... | 8 |
public void create(UnidadeMedida unidadeMedida) {
if (unidadeMedida.getQualificadorAplicacaoCollection() == null) {
unidadeMedida.setQualificadorAplicacaoCollection(new ArrayList<QualificadorAplicacao>());
}
if (unidadeMedida.getQualificadorProdutoCollection() == null) {
... | 9 |
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 |
private static Problem constructProblem(List<Double> vy, List<Feature[]> vx, int max_index, double bias) {
Problem prob = new Problem();
prob.bias = bias;
prob.l = vy.size();
prob.n = max_index;
if (bias >= 0) {
prob.n++;
}
prob.x = new Feature[prob.l]... | 4 |
public void shutdown() {
if (this.getHttpClient() != null) {
try {
this.getHttpClient().getConnectionManager().shutdown();
} catch (Exception ignored) {
// ignored
}
}
} | 2 |
private ObjectConverter chooseConverter(Class cls) {
if (cls.equals(Float.class) || cls.equals(Double.class)) {
throw new SerializationException("Float values should not be serialized!");
} else if (Number.class.isAssignableFrom(cls)) {
return numberConverter;
} else if (... | 9 |
public void tournamentsort(int[] a){
int nNodes = 1;
int nTreeSize;
while(nNodes < a.length){
nNodes *= 2;
}
nTreeSize = 2 * nNodes - 1;
Node[] nodes = new Node[nTreeSize];
int i;
int idx;
for( i = nNodes - 1; i < nTreeSize; i++){
idx = i - (nNodes - 1);
if(idx < a.length){
... | 6 |
public static boolean isOpCritical(SourcePackage pkg, ArrayList<Operation> code, int begin, Operation op) {
switch (op.op) {
case RET:
case WHILE:
case IF:
case REP:
case FOR:
case ITER:
return true;
case CALL:
if (!Directives.has(pkg.getFunction(op.args[1]),"pure")) {
return true;
... | 9 |
final public int Conjunction() throws ParseException {
int ret = CONJ_NONE;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AND:
case OR:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AND:
jj_consume_token(AND);
ret = CONJ_AND;
break;
case OR:
jj_consume_t... | 7 |
@Override
public void onInvalidCommand(CommandSender sender, String[] args, String command) {
tickets = plugin.getTicketHandler();
if (sender instanceof Player) {
Player p = (Player) sender;
if (args.length == 1) {
int id;
try {
... | 5 |
private void eigenSort(){
int k = 0;
double holdingElement;
this.sortedEigenValues = Conv.copy(this.eigenValues);
this.sortedEigenVector = Conv.copy(this.eigenVector);
this.eigenIndices = new int[this.numberOfRows];
for(int i=0; i<this.numberOfRows-1; i++){
... | 8 |
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
Block block = e.getClickedBlock();
if ((e.getItem() != null)
&& (player.getGameMode().equals(GameMode.SURVIVAL))) {
if ((e.getAction().equals(Action.RIGHT_CLICK_BLOCK))
... | 7 |
public static void main(String[] args) {
boolean pago_fisico = false;
boolean pago_libro = false;
boolean pago_membrecia = false;
boolean pago_actualizar_membrecia = false;
boolean pago_video = true;
boolean pago_comision = false;
//++++++++++++++ INGRES... | 8 |
public static void main(String[] args) {
if(args.length == 2){
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
System.out.println((a>b)? a : b);
}
} | 2 |
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
try{
newNeuronButton.removeActionListener(newNeuronL);
newNeuron.removeActionListener(newNeuronL);
setCursor(defaultCursor);
int posX = e.getX()-15;... | 7 |
public Path getImgPath_SliderBar(Imagetype type) {
Path ret = null;
switch (type) {
case DEFAULT:
ret = this.imgSlider_Def;
break;
case FOCUS:
ret = this.imgSlider_Foc;
break;
case PRESSED:
... | 3 |
@Override
public boolean removeComment(Comment comment)
{
/*
* function gets an POST ID of the specific comment we want to remove and the user name
* we make sure to update the number of comments we have i that specific post
* we update also the number of posts this user have minus 1
* we save all to th... | 3 |
public void writeBeacon( OutputStream out, BeaconState beacon ) throws IOException {
writeBool( out, beacon.isVisited() );
if ( beacon.isVisited() ) {
writeString( out, beacon.getBgStarscapeImageInnerPath() );
writeString( out, beacon.getBgSpriteImageInnerPath() );
writeInt( out, beacon.getBgSpritePosX() )... | 7 |
protected void interrupted() {
end();
} | 0 |
public Double getMedia(){
if(!notas.isEmpty()){
Double somaNotasPonderadas = 0.0;
Double somaPesos = 0.0;
for(int i=0; i < 3; ++i){
if(this.notas.get(i) != null){
somaNotasPonderadas += notas.get(i) * pesos[i];
... | 4 |
public static void main(String[] args) {
// DatagramSocket socket;
// DatagramPacket packet;
//
// String msg = "hello";
// try {
// packet = new DatagramPacket(msg.getBytes(), msg.getBytes().length,
// InetAddress.getByName("192.168.212.14"),80... | 1 |
private void executeDynamicCommand(String commandName, Connection conn, Parameter p) {
assert commandName != null && !commandName.contains(" ");
final String fqcn;
if (commandName.indexOf('.') > 0) {
fqcn = commandName;
} else {
fqcn = "net.argius.stew.command."
... | 7 |
public static ArrayList<Excel> move(int a,int b,int c, ArrayList<Excel> toScale)
{
return Move.move(a,b,c, toScale);
} | 0 |
public void displaySettingsPanel() {
//Leave the current match intact until a new one is created, just in case the user forgot to save.
if (this.currentMatch != null) {
this.currentMatch.getPanel().setVisible(false);
}
this.newGamePanel.setVisible(true);
super.pack(); //Makes the window resize to mat... | 1 |
@Override
public void flush() {
super.flush();
out.flush();
} | 0 |
@SuppressWarnings("unchecked")
public static <T> Set<T> getNominalSet(Class< T> classdef) {
if (classdef == null) {
return null;
}
Class<?> classdef2 = getWrapper(classdef);
if (classdef2 == Boolean.class) {
return (Set<T>) BooleanSet.Instance;
} else ... | 6 |
private static final void parseCmdLine(String args[])
{
int i = 0;
String arg;
while (i < args.length && args[i].startsWith("-")) {
arg = args[i++];
if (arg.equals("-c")) {
if (i < args.length)
cities = new Integer(args[i++]).intValue();
else throw new Error("-c requires the size of tre... | 8 |
public void setQuery(String query) {this.query = query;} | 0 |
private void parseComputationalUnit(Node currentNode)
{
String currentTag = currentNode.getNodeName();
switch (currentTag.toLowerCase ( ))
{
case "nodename":
{
parseNode(currentNode);
break;
}
case "internodeconn... | 7 |
public JSONObject asJSONObject() {
JSONObject result = new JSONObject();
try {
result.put("cardNumber", cardNumber);
result.put("name", name);
} catch (JSONException e) {
e.printStackTrace();
}
return result;
} | 1 |
public ProcessorHandler(Class<? extends Processor>... processors) throws ProcessorException {
// Check if 'processors' is NULL
Objects.requireNonNull(processors, "The specified processors must not be Null");
// Check if 'processors' is empty array
if (processors.length <= 0) throw new Il... | 5 |
public boolean exists(String[] names)
{
boolean valid = true;
boolean[] play =
{ true, true, true, true };
for (int i = 0; i < names.length; i++)
{
boolean exist = false;
for (int j = 0; j < players.length; j++)
if (players[j].name.equalsIgnoreCase(names[i]))
if (play[j])
{
play[j] ... | 5 |
private void maintainRouteTable() throws IOException {
long currentTime = System.currentTimeMillis();
for (Bucket bucket : routeTable.buckets) {
if (currentTime - bucket.lastChangeTime > 900000) {
byte[] randomId = Util.randomId(bucket.min, bucket.max);
findNo... | 6 |
public Rule parseRule(String input) throws ParseException {
Matcher matcher = rulePattern.matcher(input);
if (!matcher.matches()) {
throw new ParseException(
"The given input '" + input + "' is not a valid rule.");
}
List<Predicate> conditions = new ArrayList... | 3 |
public void draw(Graphics2D g){
super.draw(g);
if(Alpha.selected != this||Alpha.selection!=5)
g.setColor(Color.lightGray);
else {
g.setColor(new Color(0,255,255,15));
g.fillOval(getX() - User.basefield / 2, getY() - User.basefield / 2, User.basefield, User.bas... | 3 |
private void sendStatusInfoToOtherUsers(StatusInfoMessage message) {
final Collection<ChatConnection> otherUsersConnections = getAllChatConnectionsExceptThis();
for (ChatConnection connection : otherUsersConnections) {
try {
connection.getWsOutbound().writeTex... | 2 |
private static ExternalFinderItemCommand generateFinderCommand(Node commandNode) {
String command = commandNode.getTextContent();
ExternalFinderItem.TARGET target = ExternalFinderItem.TARGET.BOTH;
ExternalFinderItem.ENCODING encoding = ExternalFinderItem.ENCODING.NONE;
String delimiter =... | 8 |
public static GeneralizedSymbol internRigidSymbolCaseSensitively(String name, int kindofsym, boolean tryupcasingP) {
{ GeneralizedSymbol symbol = null;
symbol = GeneralizedSymbol.lookupRigidSymbol(name, kindofsym);
if (symbol != null) {
return (symbol);
}
if (((Boolean)(Stella.$TRAN... | 9 |
public Image getTile(int x, int y) {
if (x < 0 || x >= getWidth() ||
y < 0 || y >= getHeight())
{
return null;
}
else {
return tiles[x][y];
}
} | 4 |
public boolean isAxicollinear(Vector other) {
boolean x = this.getX() == other.getX(),
y = this.getY() == other.getY(),
z = this.getZ() == other.getZ();
return (x && (y || z)) || (y && z);
} | 4 |
public void initialize(NeuralNetwork nn) {
List<ConnectionCandidate> ccs = new BreadthFirstOrderStrategy(nn, nn.getInputLayer()).order();
for (ConnectionCandidate cc : ccs) {
if (cc.connection instanceof FullyConnected) {
FullyConnected fc = (FullyConnected) cc.connection;
if (Util.isBias(fc.getInputLayer())... | 9 |
public static void backupExtract (String zipLocation, String outputLocation) {
Logger.logInfo("Extracting (Backup way)");
byte[] buffer = new byte[1024];
ZipInputStream zis = null;
ZipEntry ze;
try {
File folder = new File(outputLocation);
if (!folder.exis... | 6 |
public void actionPerformed(ActionEvent e)
{
JButton source = (JButton)e.getSource();
if(source.equals(executeButton))
executeCode();
else if(source.equals(saveCodeAsButton))
saveCodeAs();
else if(source.equals(saveCodeButton))
saveCode();
else if(source.equals(openExistingFileButton))
openExis... | 8 |
public void mouseClicked(double x, double y, int modifiers) {
SortedSet<Net> clickedNets = new TreeSet<Net>();
model.getNetsAtPoint(x, y, 1.0/display.getDPI(), clickedNets);
if (manualTopology.isSelected()) {
clearSelection();
TopologyProcessor.mergeNets(clickedNets);
return;
}
if ((selectedNet !... | 7 |
public static boolean isSubInterface(Class<?> sup, Class<?> sub) {
if (sup.isInterface() && sub.isInterface()) {
if (sup.equals(sub))
return true;
for (Class<?> c : sub.getInterfaces())
if (isSubInterface(sup, c))
return true;
}
return false;
} | 8 |
public void submit3()
{
//Declaring variables
int num = 0;
int index = 0;
boolean won = false;
Team temp;
Exception wl = new Exception();
//Check if valid team number is entered
try
{
//Pull number from label, throwing exception if... | 6 |
public static int getPreviousStop(int busStop, int route)
{
if (busStop == 0) throw new InvalidQueryException("Nonexistent bus stop");
if (route == 0) throw new InvalidQueryException("Nonexistent route");
database db = database.busDatabase;
String source = "path As path1 Inner Join path As... | 3 |
public void setLink( String link )
{
String l = null;
// Have a shape with an embed?
OOXMLElement oe = getObject( SP );
if( oe != null )
{
l = ((Sp) oe).getLink();
}
if( l != null )
{
((Sp) oe).setLink( link );
return;
}
// how's about a picture?
oe = getObject( PIC );
if( oe != null )... | 6 |
@Override
public void removeComponent(int index) throws ComponentException {
if (index > components.size()) {
throw new ComponentException(
"Index is larger than the size of the list");
} else if (index < 0) {
throw new ComponentException("Index is under zero");
}
components.remove(index);
} | 2 |
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Ship other = (Ship) obj;
if (this.cargo != other.cargo) {
return false;
}
if ... | 6 |
public long compute(int xGridNum, int yGridNum)
{
//分母の階乗の配列を取得
int[] numeratorArray = MyMathUtil.factorialArray(xGridNum + yGridNum);
//分子左の階乗の配列を取得
int[] denoLeftArray = MyMathUtil.factorialArray(xGridNum);
//分子右の階乗の配列を取得
int[] denoRightArray = MyMathUtil.factorialArray(yGridNum);
//各要素を素因数分解して、分母、分... | 7 |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession();
Player user = (Player)session.getAttribute("user");
String name1 = request.getParameter("name1");
String player2Name = request.getParameter("name2"... | 7 |
public NewsReader(String name) {
this.name = name;
} | 0 |
public int inserir(Autor a){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, a.getNome());
... | 3 |
private void renderGame() {
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
this.createBufferStrategy(3);
return;
}
Graphics g = bs.getDrawGraphics();
Graphics2D g2d = (Graphics2D) g;
g.setColor(Color.black);
g.fillRect(0, 0, getWidth(), getHeight());
g2d.translate(cam.getX(), cam.... | 1 |
public void update(final int index, final DataTableObject dataTableObject) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if(index >= _firstRow && index <= _lastRow) {
int upperHeight = _emptyDummyUpperViewportPanel.getSize().height;
int viewportHeight = _viewportPanel.getSize().he... | 7 |
public void _testMultipleThreadsFailure(MockRAMDirectory.Failure failure) throws Exception {
int NUM_THREADS = 3;
for(int iter=0;iter<5;iter++) {
MockRAMDirectory dir = new MockRAMDirectory();
IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
... | 8 |
public void setPWFieldFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.pWFieldFontStyle = UIFontInits.PWFIELD.getStyle();
} else {
this.pWFieldFontStyle = fontstyle;
}
somethingChanged();
} | 1 |
public void fcc(double n) {
int col = toInt(n) % 8;
switch(col) {
case 1:
g2d.setColor(Color.RED);
break;
case 2:
g2d.setColor(Color.GREEN);
break;
case 3:
g2d.setColor(Color.YELLOW);
break;
case 4:
g2d.setColor(Color.BLUE);
break;
case 5:
g2d.setColor(Color.CYAN);
break; ... | 8 |
public void EnvoyeAClient(Socket socket, String reponse) {
try {
PrintWriter printWriter = new PrintWriter(socket.getOutputStream(),
true);
printWriter.println(reponse);
} catch (IOException ioe) {
System.out.println(ioe);
ioe.printStackTrace();
}
} | 1 |
private void osmLoadCoastline(String lowDetailedFile, String highDetailedFile) {
CoastlineLoader clPinkGreen = new CoastlineLoader(10000000, 20000000) {
@Override
public void processNode(CoastlineNode nd) {
if (nd != null) {
loadingbarCounter(73221);
... | 4 |
public static long gcd(long x, long y) {
if (x == 0) {
return y;
} else if (y == 0) {
return x;
} else if ((x & 1) == 0 && (y & 1) == 0) { // x and y are even.
return gcd(x >> 1, y >> 1) << 1;
} else if ((x & 1) == 0 && (y & 1) == 1) { // x is even, and y is odd.
return gcd(x >> 1, y);
} else if (... | 9 |
public String[] sendJobSearch(String s) throws IOException{
String str = new String("jobsearch"+ "," + s );
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
... | 7 |
private void statement(){
if( first(f_assignment) )
assignment();
else if( first(f_print) )
print();
else if( first(f_if) )
ifproc();
else if( first(f_while) )
whileproc();
else if( first(f_for) )
forproc();
else... | 5 |
@Override
public JSONObject getValueForOutput() {
try
{
return this.user.toJson();
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return new JSONObject();
}
} | 1 |
@Override
public void valueRecived(SlotInterface s, Value v) {
if (s.getLabel().equals(Trigger)) {
if (!input_.isFree()){
Value vv= input_.pullValue();
if (vv!=null){
if (getMode()==EditorMode.DEBUG)
input_.getLine((OVNode)input_.getConnections().get(0)).debugDisplay(vv.getString());
outpu... | 4 |
private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... | 7 |
public ArrayList searchRoomNumber(Date checkin, Date checkout) {
ArrayList temp = new ArrayList();
//find all room first
Query q = em.createQuery("SELECT t from RoomEntity t");
for (Object o : q.getResultList()) {
RoomEntity p = (RoomEntity) o;
temp.add(p.getRoom... | 7 |
public int evaluate_int(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return 0;
}; | 1 |
private void jbGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbGuardarActionPerformed
ResultSet rs;
error1(false);
// Si no eligió fecha
if (fecha == null) {
error(true);
} else {
try {
rs = st.executeQuery("SELE... | 9 |
public void setKeyboardNavigable(boolean enabled, UIElement startIndex) {
if(selection != -1) {
get(selection).setSelected(false);
}
selection = (enabled ? indexOf(startIndex) : -1);
if(selection != -1 && get(selection) != null) {
get(selection).setSelected(true);
} else {
if(pointer != null) {
... | 5 |
public void setPort(String port) {
this.port = port;
} | 0 |
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result
+ ((carClass == null) ? 0 : carClass.hashCode());
result = prime * result + ((carcase == null) ? 0 : carcase.hashCode());
result = prime * result + ((color == null) ? 0 : color.hashCode());
result ... | 8 |
private String extractHTML(String currentPageURL){
//System.err.println("Extract HTML : " + currentPageURL);
String theLine = "";
try {
URL u = new URL(currentPageURL);
InputStream is = u.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new B... | 4 |
public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.g... | 4 |
public void act(List<Actor> newRabbits)
{
incrementAge();
if(isAlive()) {
giveBirth(newRabbits);
// Move towards a source of food if found.
Location newLocation = findFood();
if(newLocation == null) {
// No food found - try... | 3 |
public static Element nodeListTag(NodeList nl, String tag)
{
if (nl != null)
{
int length = nl.getLength();
boolean has = false;
for (int i = 0; (i < length) && !has; i++)
{
has = (nl.item(i)).getNodeName().equals(tag);
if (has)
{
return (Element) nl.item(i);
}
}
}
retu... | 4 |
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... | 6 |
@Override
public String toString() {
StringBuilder command = new StringBuilder();
if (sender != null) {
command.append(":").append(sender).append(" ");
}
if (recipient != null) {
command.append("PRIVMSG ");
command.append(recipient).append(" ");
command.append(":").append(contents).append("\n");
... | 2 |
@Subscribe
public void login(LoginEvent event) throws SQLException {
if(!plugin.bansEnabled)return;
if(plugin.IPbans.contains(event.getConnection().getAddress().getAddress().toString())){
event.setCancelReason("Your IP is banned from this server, please appeal on the server website");
event.setCancelled(true... | 5 |
public double groupObjects() {
partitionedObjects = new HashMap<>();
for (int i = 0; i < Feature.possibleFeatures.size(); i++) {
for (String value : Feature.possibleFeatures.get(i).getPossibleValues()) {
partitionedObjects.put(value, new ArrayList<ClassifiableObject>());
for (ClassifiableObject oc : trai... | 4 |
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
if (key == null) {
key = new LongWritable();
}
key.set(pos);
if (value == null) {
value = new Text();
}
value.clear();
final Text endline = new Text("\n"... | 7 |
public static BufferedImage detectHorizontalEdges(BufferedImage image, int amount) {
int width = image.getWidth();
int height = image.getHeight();
BufferedImage edgeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
for(int x = 0; x < width; x++)
for(int y = ... | 9 |
@Override
protected void onButtonReleased(GuiButton button)
{
switch (button.id)
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
this.parent.setPreviousGui();
break;
}
} | 5 |
private boolean initKarte() {
pfadList = new ArrayList<>();
laenderList = new VertexSet();
laenderList.addVertex(new Land(0, 150, 200, Fraktion.Grau, 2));
laenderList.addVertex(new Land(1, 400, 200, Fraktion.Grau, 10));
laenderList.addVertex(new Land(2, 200, 400, Fraktion.Grau, 0));
laenderList.addVertex(... | 0 |
private void updateCursor(MouseEvent event) {
DockLayoutNode over = over(event.getX(), event.getY());
setCursor(over instanceof DockLayout ? ((DockLayout) over).isHorizontal() ? Cursors.HORIZONTAL_RESIZE : Cursors.VERTICAL_RESIZE : null);
} | 2 |
public void addElement(Element e) {
if (! this.elements.contains(e)) { // TODO: Ne marche pas : Pourquoi ?!
this.elements.add(e);
}
} | 1 |
public String encodeDictionary(Map<?,?> encodeDictionary) {
StringBuilder sb = new StringBuilder();
sb.append(BencodingToken.START_DICT_TOKEN);
for(Entry<?,?> entry : encodeDictionary.entrySet()) {
Object entryKey = entry.getKey();
Object entryValue = entry.getValue();
sb.append(determineEncoding(ent... | 5 |
public final void useType(Type type) {
if (type instanceof ArrayType)
useType(((ArrayType) type).getElementType());
else if (type instanceof ClassInterfacesType)
useClass(((ClassInterfacesType) type).getClassInfo());
} | 2 |
private static Double performOp(String i1, String i2, String sop) {
char op = sop.charAt(0);
double a = Double.valueOf(i1);
double b = Double.valueOf(i2);
switch (op)
{
case '+':
return (double) (a + b);
case '-':
return (double) (b - a);
case '*':
... | 6 |
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.