method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9597aaf3-f468-420e-abb6-b36bb33acb6b | 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... |
72ed3822-ca5d-47e8-ae35-32cce439d2a0 | 3 | 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 ... |
c647a4f2-c89a-4473-87fc-41681d38d75b | 5 | 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... |
cdfd5a14-ee55-40bf-b888-69536a5588e4 | 2 | 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... |
4aed75b2-6365-4e2b-aabd-b8a83978a157 | 9 | 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] + " ";
... |
9902a4a2-5be8-4cd5-a4ab-4ada867f3e67 | 7 | 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... |
cfacfd2a-b075-40d1-8f34-8bf8ba14600c | 8 | 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... |
7a3d33aa-7c88-4bf0-83e2-e5d81ec0fbd8 | 3 | @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... |
033ecfdd-71f3-49e5-9bfb-f7b7713569a5 | 9 | 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 )
... |
47eefeff-d4fe-435a-941d-75df23a4739e | 1 | 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... |
e1767f41-7bf4-4ee5-9a0c-ec0d4de4a891 | 7 | 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... |
8aaeb081-6158-430e-8ebd-1d2062fa1556 | 8 | 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... |
8febea7a-988b-43ef-93cf-dc268b661b1d | 9 | @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()
... |
f75fc096-559b-4eac-8d9b-39b1cd7a7b74 | 2 | 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... |
f2225b95-2562-4e9e-9f23-115e88eed10a | 3 | @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().... |
844a8b32-60be-42f5-95a3-3aa8f4abafc6 | 8 | 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);
... |
d72147e4-5ee2-4683-af50-0642ed22e3c5 | 5 | @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... |
811ed380-1c05-42db-99f6-dbf4f1b00c4f | 9 | 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>() {
... |
8cc36cd8-aa7a-414f-a3b3-f2bc78b330ad | 1 | 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;
}
} |
ef91cce9-c808-4eae-bfa7-57424fa1da4a | 5 | @Override
public void onButtonUpdate(int controllerID, boolean buttonPressed,
Component component)
{
if(buttonPressed)
{
String buttonIndex;
buttonIndex = component.getIdentifier().toString();
if(buttonIndex.equals("0"))
{
... |
6fee93f1-5e22-4e05-92e0-09bfd28c39e2 | 0 | public String getUsuario() {
return usuario;
} |
c733e7b7-9026-4e3e-9d48-e2da76b758c9 | 6 | 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... |
fa671e53-cc32-4fa2-865b-e7448706e063 | 8 | 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... |
cd76f293-79de-4b45-94ec-4f1ea64c2097 | 4 | @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... |
692dc2d0-4c0c-497e-a9ff-ca5b16e89ae2 | 7 | 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;
} |
e29c54ab-72c5-419f-bbfc-2da5f2062e99 | 6 | 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;
}... |
182f2f21-3f79-4452-85de-4b40ac6797f6 | 8 | 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... |
55a2ba4f-304f-46fc-9ad6-0a9afc332ecf | 5 | 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 ... |
b306d433-f552-4c54-bf21-03afc474ec45 | 0 | @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... |
3ae82126-20cf-4e92-8d57-5cbaf39c0038 | 9 | 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... |
ea0a9edf-c0e2-4397-b666-64565c341648 | 0 | @Override
public boolean isEmpty() {
return bestPlays.isEmpty();
} |
aacb7f6c-ec64-439d-9d3c-d39ad84e8779 | 4 | @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_... |
ef2ff0d4-e3b9-4e5a-bb58-f6970d2145a0 | 7 | 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... |
4c9b9229-bd28-4e89-9021-be756deb6c71 | 1 | public List<Class<? extends Pouvoir>> getPouvoirsDispo() {
return pouvoirsDispo;
} |
2df4872c-de8e-450a-bdb3-58420a77d7eb | 0 | public DawnguardRuneAxe() {
this.name = Constants.DAWNGUARD_RUNE_AXE;
this.attackScore = 11;
this.attackSpeed = 13;
this.money = 1000;
} |
282e93f4-08e1-4299-af05-fcf2e73102da | 4 | 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... |
3f8024eb-8ff7-4702-a6ac-2ac0da963fb6 | 0 | public void setLastUnstableBuild(Build lastUnstableBuild) {
this.lastUnstableBuild = lastUnstableBuild;
} |
3f00843d-7dba-401d-90c0-dad910cd5353 | 2 | 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... |
5693ec67-93b5-445f-bbcc-8ded7d800be4 | 0 | public static void main(String[] args)
{
//通过代理访问真是角色
ProxySubject proxySubject = new ProxySubject();
proxySubject.request();
//直接访问真实角色
RealSubject realSubject = new RealSubject();
realSubject.request();
} |
ccff571b-4be9-429d-9d2b-86b55e6cca48 | 5 | 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);... |
c6dc7bb5-6da2-4b21-9af6-2aca6a90d0ab | 1 | private boolean feelSleepy() {
if (this.exhaustion < 2 * this.exhaustionCoefficient) {
this.exhaustion += 2 * this.exhaustionCoefficient;
} else
this.exhaustion = 100;
return true;
} |
91fef5b1-faee-4623-aebc-c1140d3eab25 | 4 | 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... |
76f38236-4966-4206-bdc7-733d9830c542 | 8 | 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++;
... |
aa7b38b3-ca5f-4b31-bf6c-a0d08aaa2b44 | 4 | 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... |
f339eb14-3186-44db-aebe-f028c95ee9f0 | 5 | @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... |
7d452820-4458-4c5d-ab58-c6e6c89826d1 | 4 | 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;
} |
59478a03-9cd7-4577-982c-aa95386c5677 | 0 | private Ball getBall() {
return new Ball(100, 40, (int)(BALL_SCALE * width), (int)(BALL_SCALE * width));
} |
ef03997f-6de4-4836-968b-a81e0579cc6e | 6 | 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());
... |
abb1a3ec-39ec-465c-9fe4-586a3f1c5302 | 7 | @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 - ... |
8bad57d9-179d-4e15-9f04-baf5b57ecf61 | 6 | 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... |
6a98a1d4-3000-4fd6-a362-9da1c583e301 | 3 | 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[... |
3012c096-755b-4ec5-ba08-b44755593e08 | 7 | @Override
public void run() {
try {
while (true) {
synchronized (this) {
if(dis.available() != 0) {
int command = dis.readInt();
if(command == TransferDeviceInformation.NEXT_DISCOVERED_DEVICE) {
... |
5b91357b-34a0-455e-a750-0d9e6bd32061 | 4 | 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... |
4fa3284f-a4a9-445a-8843-9f81fd5f451a | 7 | 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... |
c4cc2504-0ac4-4ac8-90a5-3f0885494b64 | 9 | 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)
... |
66974c8a-356b-4fba-9066-d64c935cbdbc | 8 | 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 ... |
52b80312-5e04-4744-b855-181396bb87fb | 4 | @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... |
e0b6f471-4b26-4917-8200-1340015e286e | 3 | @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.... |
fd0691ef-1ae0-4411-92a7-45d9a386344c | 5 | 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();... |
fdc7643c-fd9c-435f-9907-6c58e4006eff | 4 | @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... |
5507a5f7-c7ef-4098-9e23-f79fadaae30d | 7 | 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... |
accf7d24-c008-467c-a389-e29cc1fda92a | 8 | 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++) {
... |
d8e3d76e-da45-49e4-a502-c89379e45dcf | 3 | @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;
... |
37dc2826-88b1-4f03-92ad-de32311146fd | 4 | 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;
}
}
}
} |
f8b7ef5b-7209-422f-9857-a4c2116e9e66 | 7 | 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... |
b4eca021-f5aa-49f3-b77b-169abf0c5b9c | 0 | public String getHint() {
return this.hint;
} |
f9542ffb-e146-451a-9dcb-c02f1d6497b8 | 4 | 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 "... |
73caf27d-718b-4313-b858-5f105000c2f3 | 0 | public String getIssuer() {
return issuer;
} |
8ade68cd-d106-462d-97f2-5e6fd4bac73e | 2 | 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... |
aa6e3b29-36c7-4388-80a0-c4ac64fbbff1 | 0 | public String getGradelevel() {
return gradelevel;
} |
bf591de7-ff5a-4da8-9205-2489948d4892 | 3 | private String baseDesc(int radix) {
switch (radix) {
case 10: {
return "decimal";
}
case 8: {
return "octal";
}
case 16: {
return "hex";
}
default: {
return "base " + radix;
}
}
} |
3ca8d297-7132-4dba-b42c-7478a98147e3 | 4 | @RequestMapping(value = {"/CuentaBancaria/"}, method = RequestMethod.POST)
public void insert(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestBody String json) throws JsonProcessingException {
try {
ObjectMapper objectMapper = new ObjectMapper();
obje... |
77297a1c-235b-4815-8419-903cf5e66839 | 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... |
598822ac-e1e6-4478-b4b5-bcc976495043 | 2 | 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... |
2c015e2b-0f67-482e-9ff8-b9c01b4da084 | 8 | @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
... |
798631c6-6390-4dbc-a515-daf87d99dfe9 | 0 | public CheckResultMessage error(String message) {
return new CheckResultMessage(message, CheckResultMessage.CHECK_ERROR);
} |
422e3631-cc1f-4995-8299-718b4b6bf025 | 5 | public static int raceTwoChocoSolversWithSharedWeights()
{
WeightsSynchronizer synchronizedVariablesWeights = new WeightsSynchronizer(new KeepMaxAveragingStrategy());
SharedHeuristicVariablesWeight sharedHeuristicVariablesWeight1 = new SharedHeuristicVariablesWeight(
new AddWeightTo... |
fea9a073-6251-4a89-a17a-4046257fc638 | 6 | @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... |
3c876e8e-4993-4dd3-889b-81b52bcdc220 | 9 | 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... |
c05d12c1-4319-4d7b-aa88-c8fdeef883e5 | 7 | 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... |
ebd24d75-f5ca-4b93-b609-f1c39a596ed9 | 3 | public void fetchPreferences() {
try {
updateInterval = preferences.getLong("updateinterval", 3);
rpcUser = preferences.get("rpcuser", "");
rpcPass = encryptor.decryptString( preferences.get("rpcpass", "") );
addURLAutoPaste = preferences.getBoolean("aurl.autopast... |
0b41600f-84b2-48ed-8d07-cad4ae743aab | 0 | 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);
} |
0914a867-db8b-46e3-a0de-5b3d880d6fe9 | 5 | 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... |
0af98a77-96a5-42a5-a4ce-e47b64790393 | 4 | 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... |
ca2226f5-f7f2-4de1-b59b-0ae92f3ad8db | 5 | 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... |
d2684220-0c99-49de-978b-c6e0708c51e1 | 1 | public void simplify() {
StructuredBlock[] subs = getSubBlocks();
for (int i = 0; i < subs.length; i++)
subs[i].simplify();
} |
3270068b-982d-4f9d-8bc8-3d14bd57f266 | 5 | 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():... |
4d719d9b-6e28-4525-b3d7-8912efd47f0a | 0 | public FocusTraversalOnArray(Component components[]) {
m_Components = components;
} |
b0d579c6-6572-4ad5-ac71-1c4b24674b4a | 1 | @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... |
c48b7ffd-cc43-4cd3-ad82-ec65efcadcb0 | 5 | 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)
... |
68c2611a-5fc3-4c96-88f7-ceb8e5b3e812 | 2 | 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... |
90d1ee3b-67ee-4f99-aa8a-9dde6449027e | 6 | 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... |
ef035e6b-ca1d-4a9a-824b-dd407d3511f8 | 4 | @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... |
f78f7c8f-4121-4b8f-9867-09a1b01d59d1 | 3 | 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... |
6cb47e5b-1bee-4277-9a29-9fc1821a77d6 | 7 | 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... |
bd22e4f1-da64-47e2-afe3-66f105714ee1 | 2 | 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));
}
}
} |
9b07cb67-a074-4024-9b24-bdebdf18b789 | 3 | public void setSelectableDateRange(Date min, Date max) {
if (min == null) {
minSelectableDate = defaultMinSelectableDate;
} else {
minSelectableDate = min;
}
if (max == null) {
maxSelectableDate = defaultMaxSelectableDate;
} else {
... |
6b90d372-e15b-4086-8bba-fbfae968dc42 | 9 | 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... |
7b31d402-47fb-4900-bc62-549d1e2b5531 | 4 | @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... |
dce387ab-380e-4d69-a562-686e79873b84 | 9 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.