text stringlengths 14 410k | label int32 0 9 |
|---|---|
public static String getErrorType(int error) {
String errorType;
switch (error) {
case GL11.GL_NO_ERROR:
errorType = "no error";
break;
case GL11.GL_INVALID_ENUM:
errorType = "invalid enum";
break;
case GL11.GL_INVALID_VALUE:
errorType = "invalid value";
break;
case GL11.GL_INVALID_OPER... | 9 |
private void setPointsAndPath() {
switch (lvl) {
case 1:
directionPoints = new ArrayList<>();
directionPoints.add(new DirectionPoint(new Vector2d(50, 50), new Vector2d(1, 0)));
directionPoints.add(new DirectionPoint(new Vector2d(800, 50), new Vector2d(0, 1)));
directionPoints.add(new DirectionPoint(new ... | 3 |
public List<Region> getSpawnableRegions(Location location)
{
// Fetch the worlds configuration
SpawnerWorldConfig cfg = getWorldConfig(location.getWorld());
// If we can't spawn mobs in this world we return an empty list
if (cfg != null && !cfg.spawnMobs)
return Collections.emptyList();
// Create a... | 5 |
public Book findByID(String bookID) {
Book foundBook = null;
try {
// Erforderlicher SQL-Befehl
String sqlStatement = "SELECT * FROM bookworm_database.books WHERE id LIKE "
+ bookID + ";";
// SQL-Befehl wird ausgeführt
myResultSet = mySQLDatabase.executeSQLQuery(sqlStatement);
// da das Sele... | 2 |
public void submitClientQuery(MiniServer player, String query) {
String move = UNENTERED_MOVE;
boolean clientRecognized = false;
if(query.toLowerCase().startsWith("/move") && isInList(player) ) {
try {
move = "";
for(int i=1; i<query.split(" ").length; i++) {
move += query.split(" ")[i] + " ";
... | 9 |
public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... | 7 |
public static Iterator<Position> get8NeighborhoodIterator(Position center) {
ArrayList<Position> list = new ArrayList<Position>();
int row = center.getRow(); int col = center.getColumn();
int r,c;
for (int dr = -1; dr <= +1; dr++) {
for (int dc = -1; dc <= +1; dc++) {
r = row+dr; c = col+d... | 8 |
@GET
@Path("pfad{pfadid}")
@Produces(MediaType.APPLICATION_JSON)
public String getPfadInJSON(@PathParam("pfadid") String paramId) {
int id = 0;
try{
id = Integer.parseInt(paramId);
}
catch (Exception e) {
return e.getStackTrace().toString();
}
ArrayList<Punktbewegung> outputPunkte = new ArrayList<P... | 3 |
public synchronized void persistSome( long targetSize )
{
boolean done = false;
long bytesSaved = 0;
int persisted = 0;
while ( !done )
{
try
{
WrappedString suggested = strategy.suggest();
if ( suggested == null )
... | 9 |
public void plotPropagationCurves() {
double[] eRange = getEnergyRange();
// X label, Y label, plot title
PlotFrame frame = new PlotFrame("Energy, eV", "Log of Propagation, arb. units", "QW Propagation Curves");
// Filling the curve data
for (double e : eRange) {
fr... | 1 |
protected JetManHeadInternals miniUpdate(
final BlargNonTile nt, long time, final World world,
MessageSet messages, NonTileUpdateContext updateContext,
JetManCoreStats stats, boolean externallyPowered
) {
float newBattery = battery;
boolean viewSendAttempted = false;
if( time == lastUpdateTime ) {
do... | 7 |
private void fillTile() {
this.tileIdMap = new int[this.pixelsOnMapImage.length];
this.tileMap = new Tile[this.pixelsOnMapImage.length];
for(int index = 0 ; index < this.tileIdMap.length ; index++) {
this.tileIdMap[index] = -1;
}
for(int i = 0 ; i < this.pixelsOnMapImage.length ; i++) {
for(int cu... | 8 |
@Override
public void keyPressed(KeyEvent e) {
if (e.getComponent() == wordSearchField) {
shouldHide = false;
switch (e.getKeyCode()) {
case KeyEvent.VK_TAB:
case KeyEvent.VK_RIGHT:
if (this.wordSearchTips.getModel().getSize() > 0) {
this.wordSearchField.setText(wordSearchTips.getModel()
... | 9 |
public Cliente buscarCliente()
{
System.out.print("entre com o nome do cliente: ");
String nome = entrada.leiaString();
for(int i=0 ; i< this.tamanhoC ; i++)
{
if( nome.equals(this.aClientes[i].getNome()))
return this.aClientes[i];
}
return... | 2 |
@Override
public void execute()
{
if (Permissions.isAdmin(p))
{
if (args.length > 1)
{
Integer capturePoint;
try {
capturePoint = Integer.parseInt(args[1]);
} catch (NumberFormatException e)
{
Chat.sendError(p, Error.INVALID_ARGUMENT, args[1]);
return;
}
cm.getMain().... | 3 |
void formatMsgCore( int formatPass, HBuffer fmtBuf)
throws HdfException
{
byte[] nameBytes = HdfUtil.encodeString( attrName, false, hdfGroup);
fmtBuf.putBufByte("MsgAttribute: attrVersion", 3);
// Flag bits:
// 0 datatype is shared
// 1 dataspace is shared
fmtBuf.putBufByte("MsgAttribute: flag", 0);
... | 8 |
@Override
public boolean equals(
Object obj )
{
if( this == obj ) return true;
if( obj == null ) return false;
if( getClass() != obj.getClass() ) return false;
RangeF other = (RangeF) obj;
if( Float.floatToIntBits( end ) != Float.floatToIntBits( other.end ) ) retu... | 5 |
public static ListNode mergeKLists(ArrayList<ListNode> lists) {
// IMPORTANT: Please reset any member data you declared, as
// the same Solution instance will be reused for each test case.
if (lists == null || lists.isEmpty())
return null;
Comparator<ListNode> mycomparator = new Comparator<ListNode>() {
... | 9 |
public void pushBack(Object obj) {
if (head == null) {
head = tail = new Node(null, null, obj);
} else {
Node newNode = new Node(tail, null, obj);
tail.setNextNode(newNode);
tail = newNode;
}
} | 1 |
@Override
public void onButtonUpdate(int controllerID, boolean buttonPressed,
Component component)
{
if(buttonPressed)
{
String buttonIndex;
buttonIndex = component.getIdentifier().toString();
if(buttonIndex.equals("0"))
{
... | 5 |
public String getUsuario() {
return usuario;
} | 0 |
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 static String cleanPath(String path) {
if (path == null) {
return null;
}
String pathToUse = replace(path, WINDOWS_FOLDER_SEPARATOR, FOLDER_SEPARATOR);
// Strip prefix from path to analyze, to not treat it as part of the
// first path element. This is necessary to correctly parse paths like
// "f... | 8 |
@Override
public void keyTyped(KeyEvent e) {
if(construct != null) {
ConstructAction action = construct.onReceivedKeyEvent(e, true);
switch(action) {
case DeleteThis:
mController.deleteSelected();
break;
case Refresh:
update();
break;
case ConsumeEv... | 4 |
public int[] parseHelper() {
if (chord!=null) {
int add = chord.getBase();
if (add == -1) return null;
if (add >= 6) add-=12;
if (currentType == 0 || currentType == 4 || currentType == 6 || currentType == 7) return new int[]{add, 0};
else return new int[]{add, 1};
} return null;
} | 7 |
public static CommunicationTypeProperty getType(String name)
{
if(name != null) {
for(Type type : Type.values()) {
if(name.equalsIgnoreCase(type.toString())) {
switch(type) {
case STREAM: return STREAM;
case DATAGRAM_STREAM: return DATAGRAM_STREAM;
case DATAGRAM: return DATAGRAM;
}... | 6 |
public void setShutdownTime(String day, String b)
throws DayNotExistException, TimeFormatNotMatchException,
TimeRangeException {
if (this.shutdown_Time.containsKey(day)) {
if (b.matches("\\d\\d:\\d\\d:\\d\\d")) {
String[] times = b.split(":");
if ((Integer.parseInt(times[0]) >= 0 && Integer.parseIn... | 8 |
public void jsonIngredientsToIngredients(){
if (jsonIngredients == null){
ingredients = null;
return;
}
ingredients = new ArrayList<Ingredient>();
Map<String, Integer> ingredientIds = new HashMap<String,Integer>();
/* first add the ingredients, keeping track of the IDs */
for(JsonIngredientWithParent ... | 5 |
@Override
public String getMessageTextAsHTML() {
String msg = "";
msg += "<font color="+participantList.getTextColorOfParticipant(getAuthorId())+">";
msg += participantList.getNameOfParticipant(getAuthorId()) + " ("+getTime()+"):<br>";
msg += getMessage().replace("\n", "<br>");
msg += "</font>";
return msg... | 0 |
public void tick() {
if(!Game.lost) {
if((y <= 0) || (y >= Game.YSIZE)) {
yspeed = -1 * yspeed;
}
if((x <= 0) || (x >= Game.XSIZE-20)) {
xspeed = -1 * xspeed;
}
if(y+20 == Game.getPaddle().y && (x >= Game.getPaddle().x && x <= Game.getPaddle().x+100)) {
yspeed = -1 * yspeed;
Game.points... | 9 |
@Override
public boolean isEmpty() {
return bestPlays.isEmpty();
} | 0 |
@Override
public void keyPressed(KeyEvent e) {
if( e.getKeyCode()==KeyEvent.VK_UP ){
selectKey = DirKey.Up;
}
else if( e.getKeyCode()==KeyEvent.VK_LEFT ){
selectKey = DirKey.Left;
}
else if( e.getKeyCode()==KeyEvent.VK_RIGHT ){
selectKey = DirKey.Right;
}
else if( e.getKeyCode()==KeyEvent.VK_... | 4 |
private static List<String> split(CharSequence s, int length) {
List<String> list = new ArrayList<String>(2);
if (s.length() > length) {
// try to split
String s1 = null, s2 = null;
// try to split inside the margin
for (int i = length - 1; i >= 0; i--) {
char c = s.charAt(i);
if (Character.isWh... | 7 |
public List<Class<? extends Pouvoir>> getPouvoirsDispo() {
return pouvoirsDispo;
} | 1 |
public DawnguardRuneAxe() {
this.name = Constants.DAWNGUARD_RUNE_AXE;
this.attackScore = 11;
this.attackSpeed = 13;
this.money = 1000;
} | 0 |
public static ArrayList<Match> getMatchAfterTime(Timestamp nowTime, int searchType, String stringToSearch, Timestamp thisTime) {
ArrayList<Match> availableMatch = new ArrayList<Match>();
try {
String sql = ("SELECT match.match_id, match.match_name, match.command1, " +
"ma... | 4 |
public void setLastUnstableBuild(Build lastUnstableBuild) {
this.lastUnstableBuild = lastUnstableBuild;
} | 0 |
public boolean removeSheet(String sheetName){
int index = workbook.getSheetIndex(sheetName);
if(index==-1)
return false;
FileOutputStream fileOut;
try {
workbook.removeSheetAt(index);
fileOut = new FileOutputStream(path);
workbook.write(fileOut);
fileOut.close();
} catch (Exceptio... | 2 |
public static void main(String[] args)
{
//通过代理访问真是角色
ProxySubject proxySubject = new ProxySubject();
proxySubject.request();
//直接访问真实角色
RealSubject realSubject = new RealSubject();
realSubject.request();
} | 0 |
public boolean checkDuplicateSave(String name)
{
File saveManifest = null;
saveManifest = new File(System.getProperty("user.dir") +"/saves/List_Of_Saves.txt");
if(saveManifest == null) System.out.println("file null");
Scanner manifestReader = null;
try
{
manifestReader = new Scanner(saveManifest);... | 5 |
private boolean feelSleepy() {
if (this.exhaustion < 2 * this.exhaustionCoefficient) {
this.exhaustion += 2 * this.exhaustionCoefficient;
} else
this.exhaustion = 100;
return true;
} | 1 |
private String makeColorString() {
StringBuilder sb = new StringBuilder();
int square = rubikSize * rubikSize;
for (int i = 0; i < square; i++) {
sb.append(buttons[i].getText());
}
for (int i = square * 2; i < square * 5; i++) {
sb.append(buttons[i].getTex... | 4 |
public static void main(String[] args) {
Node one = new Node(1, null);
int level = 0;
List<Node> lastLevel = new ArrayList<>();
lastLevel.add(one);
List<Node> currentLevel = new ArrayList<>();
Map<Integer, Integer> best = new HashMap<>();
best.put(1, level);
while (best.size() < LIMIT) {
level++;
... | 8 |
public Feed getReleaseFeed(String repositoryName, String baseUrl, int maxFeedEntries) throws IOException {
Feed feed = new Feed();
feed.setFeedType("atom_1.0");
Person author = new Person();
author.setName("BattleScribe Data");
author.setUrl(baseUrl.replace("/" + WebCons... | 4 |
@Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
Value val1 = ((AbsValueNode) getChildAt(0)).evaluate(context);
Value val2 = ((AbsValueNode) getChildAt(1)).evaluate(context);
if (getChildAt(0) instanceof ThingVNode && val1.getType() == Variab... | 5 |
private <T> boolean arrayContains( final T[] array, final T v ) {
for ( final T e : array )
if ( e == v || v != null && v.equals( e ) )
return true;
return false;
} | 4 |
private Ball getBall() {
return new Ball(100, 40, (int)(BALL_SCALE * width), (int)(BALL_SCALE * width));
} | 0 |
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... | 6 |
@Override
public void paintTop(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Rectangle bounds = getBounds();
double pixelSize = getFactory().getPixelSize();
int wt = (int) (wallthickness / pixelSize);
g2.setStroke(new BasicStroke(wt));
g2.setColor(Color.lightGray);
g2.drawRect(bounds.x - wt, bounds.y - ... | 7 |
public void buildImage() {
bi = new BufferedImage(getPreferredSize().width, getPreferredSize().height, BufferedImage.TYPE_INT_RGB);
// Fill in flat rectangles
for(int a = 0; a<flatRects.size(); a++) {
for(int x = flatRects.get(a).x; x<flatRects.get(a).getMaxX(); x++) {
for(int y = flatRects.get(a).y; y<fla... | 6 |
private void addToList(String[] row){
row[1] = str2Int(row[1])+"";
String[][] temp = new String[list.length+1][2];
for(int i=0; i<list.length; i++)
temp[i] = list[i];
temp[list.length] = row;
list = new String[temp.length][2];
list = temp;
sort();
if(temp.length>10){
list = new String[... | 3 |
@Override
public void run() {
try {
while (true) {
synchronized (this) {
if(dis.available() != 0) {
int command = dis.readInt();
if(command == TransferDeviceInformation.NEXT_DISCOVERED_DEVICE) {
... | 7 |
public void checkType(Symtab st) {
if (!Utils.isValidType(type.toString(), st))
Main.error("invalid type (" + type.toString() + ")");
boolean isNew = st.enter(ident1.toString(), new SymtabEntry(ident1.toString(), type.toString(), scope));
if (!isNew)
Main.error("Identifier " + ident1 + " defined twice in fu... | 4 |
public boolean isBanned(ProxiedPlayer p) {
for (String ban : bans) {
String nick = ban.split("!")[0];
String ident = ban.split("!")[1].split("@")[0];
String host = ban.split("@")[1];
String userhost = p.getAddress().getHostName();
if ((nick.equalsIgnor... | 7 |
private static String js_slice(String target, Object[] args) {
if (args.length != 0) {
double begin = ScriptRuntime.toInteger(args[0]);
double end;
int length = target.length();
if (begin < 0) {
begin += length;
if (begin < 0)
... | 9 |
public static long serialVersionUID(final ClassEditor ce) {
// Make sure the class implements Serializable
if (!SerialVersionUID.implementsSerializable(ce)) {
final String s = "Class " + ce.name()
+ " does not implement java.io.Serializable";
throw new IllegalArgumentException(s);
}
// If the class ... | 8 |
@Override
public void run()
{
while(true)
{
for(int i = 0; i < collidableList.size(); i++)
{
for(int j = i+1; j < collidableList.size(); j++)
{
if(collidableList.get(i).collidesWith(collidableList.get(j)))
{
System.out.println("collision");
collidableList.get(i).notify(collidab... | 4 |
@POST()
@Path("add")
@Consumes("application/json")
@Produces("application/json")
@SportService(ServiceType.MLB)
public Player addPlayer(Player p)
{
UserTransaction utx = null;
p.setId(0);
try
{
System.out.... | 3 |
public static void makeTable()
{
for(int row = 0; row < periodicTable.length; row++)
{
for(int col = 0; col < periodicTable[0].length; col++)
{
String symb = eSymbol[periodicTable[row][col]];
if(!symb.equals(eSymbol[0]))
{
System.out.print(symb);
for(int i = 0; i < 3-symb.length();... | 5 |
@Override
public void run() {
ObjectInputStream e = null;
ObjectOutputStream s = null;
try {
e = new ObjectInputStream(this.entree);
s = new ObjectOutputStream(this.sortie2);
while(true) {
Commande c = (Commande) e.rea... | 4 |
public void testConcurrent(final boolean withoutRemove) {
final UHTree map = UHTreeCreator.getNewUHTree(order);
final Random random = new Random(0);
final int keyRange = 500000; // Rango de los elementos a ingresar en el
// UHTree.
final RandomDistribution.Zipf zipf = new RandomDistribution.Zipf(
r... | 7 |
public void render(MapView mapView, MapCanvas mapCanvas, Player player) {
if (menu.hasChanged()) {
System.out.println("rendering");
int y = menu.getY();
int scrollPos = 0;//getScrollPos();
for (int i = scrollPos; i < menu.getHeader().size(); i++) {
... | 8 |
@Test
public void canDetermineTheRowFitnessOfAGrid() {
for (int sudokuPower = 1; sudokuPower < 10; sudokuPower++) {
// all rows are valid but the first one
for (int i = 0, size = sudoku.getGridLength(); i < size; i++) {
if (i == 0)
continue;
... | 3 |
private void en_passant_check()
{
for(int i=0; i<8; i++)
{
for(int j=0; j<8; j++)
{
if(checker[i][j] == Piece.En_Passant_W)
{
checker[i][j] = Piece.Pawn_W;
}
else if(checker[i][j] == Piece.En_Passant_B)
{
checker[i][j] = Piece.Pawn_B;
}
}
}
} | 4 |
private void give(Player player, String[] args) {
if (!player.hasPermission("buildingplanner.give")) {
player.sendMessage("You do not have permission to give plan areas");
return;
}
if (args.length < 2) {
player.sendMessage("You need to specify a player to give to");
return;
}
Player recipien... | 7 |
public String getHint() {
return this.hint;
} | 0 |
private void checkProbabilties(double carProb, double smallCarProb,
double mcProb) throws SimulationException {
String msg = "";
boolean throwExcept = false;
if (invalidProbability(carProb)) {
msg += " carProb ";
throwExcept = true;
}
if (invalidProbability(smallCarProb)) {
msg += " smallCarProb "... | 4 |
public String getIssuer() {
return issuer;
} | 0 |
public void run () {
//the Mac version of this native function should never return, unless there is a startup error
// it's CFRunLoop will keep watching for device changes with this thread
if(trace)
System.out.println("MacOSX Host starting device scan!\n");
if (scan... | 2 |
public String getGradelevel() {
return gradelevel;
} | 0 |
private String baseDesc(int radix) {
switch (radix) {
case 10: {
return "decimal";
}
case 8: {
return "octal";
}
case 16: {
return "hex";
}
default: {
return "base " + radix;
}
}
} | 3 |
@RequestMapping(value = {"/CuentaBancaria/"}, method = RequestMethod.POST)
public void insert(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestBody String json) throws JsonProcessingException {
try {
ObjectMapper objectMapper = new ObjectMapper();
obje... | 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 static void progress(String process, int i, int N){
double k=0;
System.out.printf("\r");
String outputString;
outputString = "\t";
for(k=0; k<=(double)i; k+=(double)N/50){
outputString+="█";
}
while(k<=N){
outputString+="-";
k+=(do... | 2 |
@Override
public void run() {
if (Main.Debug) {
System.out.println("Parsing...");
}
for (Map.Entry<String, String> entry : Main.channels.entrySet()) {
StreamStatus m = new StreamStatus();
String key = entry.getKey();
//before Check
... | 8 |
public CheckResultMessage error(String message) {
return new CheckResultMessage(message, CheckResultMessage.CHECK_ERROR);
} | 0 |
public static int raceTwoChocoSolversWithSharedWeights()
{
WeightsSynchronizer synchronizedVariablesWeights = new WeightsSynchronizer(new KeepMaxAveragingStrategy());
SharedHeuristicVariablesWeight sharedHeuristicVariablesWeight1 = new SharedHeuristicVariablesWeight(
new AddWeightTo... | 5 |
@EventHandler
public void SnowmanWither(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.getsnowgolemConfig().getDouble("Snowman.Wit... | 6 |
public Game(String mapName, GameType gameType,
LinkedList<Player> playerOrder, Player me) {
// sets the player order object = to the one given
this.playerOrder = playerOrder;
this.gameType = gameType;
this.player = me;
this.player.setGame(this);
// Set up game depending upon the gametype
if (gameType... | 9 |
private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == true && i != m... | 7 |
public void fetchPreferences() {
try {
updateInterval = preferences.getLong("updateinterval", 3);
rpcUser = preferences.get("rpcuser", "");
rpcPass = encryptor.decryptString( preferences.get("rpcpass", "") );
addURLAutoPaste = preferences.getBoolean("aurl.autopast... | 3 |
public static void main(String[] args) {
int[] test={1,1,1,2,2,3};
int k=2;
OJ347 oj347=new OJ347();
oj347.topKFrequent(test,k);
} | 0 |
public int test(GraphPoint p, boolean weighted)
{
// Start building a list of neighbours of this point
List<GraphPoint> neighbours = new ArrayList<GraphPoint>();
Iterator<GraphPoint> iter = points.iterator();
while(iter.hasNext())
{
GraphPoint point = iter.next();
if(p.equals(point))
return poi... | 5 |
public void mergeAddr(FlowBlock succ) {
if (succ.nextByAddr == this || succ.prevByAddr == null) {
/*
* Merge succ with its nextByAddr. Note: succ.nextByAddr != null,
* since this is on the nextByAddr chain.
*/
succ.nextByAddr.addr = succ.addr;
succ.nextByAddr.length += succ.length;
succ.nextB... | 4 |
private static void posisjoner(String ord, Node currentNode, int len, int index) {
if (currentNode == null) {
return;
} else if (len == index) {
returnList.addAll(currentNode.posisjoner);
return;
}
char c = ord.charAt(index);
if (c == '?') {
for (Node node : currentNode.barn.values()) {
posis... | 5 |
public void simplify() {
StructuredBlock[] subs = getSubBlocks();
for (int i = 0; i < subs.length; i++)
subs[i].simplify();
} | 1 |
public static void initComponent(Object prop) {
JComponent component = (JComponent)prop;
Border savedBorder=(Border)component.getClientProperty(CLIENT_PROPS.BORDER);
if(savedBorder==null){
component.putClientProperty(CLIENT_PROPS.BORDER,
component.getBorder()==null?BorderFactory.createEmptyBorder():... | 5 |
public FocusTraversalOnArray(Component components[]) {
m_Components = components;
} | 0 |
@Parameters(method = "provideTestData")
@Test
public void receiverShouldStoreCorrectDataToDao(List<GameEvent> events, int expectedExperience, int expectedTimestamp, int userId) {
DefaultGameEventReceiver gameEventReceiver = new DefaultGameEventReceiver();
ExperienceDao mockedDao = mock(ExperienceDao.class);
gam... | 1 |
public String getSign() {
Sign sign;
String signStr;
if(!signMap.containsKey(uri)
|| signMap.get(uri).signDate == null
|| new Date().getTime() - signMap.get(uri).signDate.getTime() > 30 * 60 * 1000
|| !method.equals(signMap.get(uri).method)
... | 5 |
public static void main(String[] args) throws IOException {
if (args.length != 3) {
System.err.println(
"Usage: java TCPForwarder <destination host> <source port> <destination port>");
System.exit(1);
}
// get the data from the console and bind it to t... | 2 |
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
Manacher m = new Manacher(line);
int max = 0;
i... | 6 |
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
if (mode == mode.BUILD && buildable) {
addTower("", mouseTileCoords.x, mouseTileCoords.y);
} else if (mode == mode.SELL) {
sellTower(m... | 4 |
public static void assign3ElementArrayFromYamlObject(float[] output, Object yamlObject)
{
if (!(yamlObject instanceof List))
throw new RuntimeException("yamlObject not a List");
List<?> yamlList = (List<?>)yamlObject;
output[0] = Float.valueOf(yamlList.get(0).toString());
output[1] = Float.valueOf(yamlList... | 3 |
public static String getDecompressedFileName(File file) throws IOException {
String fileName = file.getName();
ZipFile zipFile = null;
try {
// get file as input stream
if (isGzipped(file)) {
String compressedFileName = file.getName();
fi... | 7 |
private void toggleGVM() {
HashMap<Character, String> forces = new HashMap<Character, String>();
forces.put(G, GRAV);
forces.put(V, VISC);
forces.put(M, COM);
for (char c : forces.keySet()) {
if (mySpringies.getKey(c)) {
mySpringies.clearKey(c);
myEnvForces.toggle(forces.get(c));
}
}
} | 2 |
public void setSelectableDateRange(Date min, Date max) {
if (min == null) {
minSelectableDate = defaultMinSelectableDate;
} else {
minSelectableDate = min;
}
if (max == null) {
maxSelectableDate = defaultMaxSelectableDate;
} else {
... | 3 |
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) {
this.plugin = plugin;
this.type = type;
this.announce = announce;
this.file = file;
this.id = id;
this.updateFolder = plugin.getServer().getUpdateFolder();
final File pluginFile... | 9 |
@Override
public BMPImage apply(BMPImage image) {
BMPImage filteredImage = new BMPImage(image);
double[][] core = {{0, 0, 0},
{0, 0, 7},
{5, 3, 1}};
BMPImage.BMPColor[][] bitmap = image.getBitMap();
BMPImage.BMPColor[][] filteredBitmap = filteredImage... | 4 |
private void testReadBasic() {
// Try to read from a non-existent file.
try {
clientStub.read(absentFile, 0, 0);
Assert.fail("read method returned for non-existent file");
} catch(FileNotFoundException e) {
} catch(Throwable t) {
t.printS... | 9 |
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.