method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2738a1b8-02ba-40f8-8a75-33b016bc0418 | 2 | public static void clearEditableForSingleNode(Node node, CompoundUndoable undoable) {
int oldValue = node.getEditableState();
int newValue = Node.EDITABLE_INHERITED;
if (oldValue != Node.EDITABLE_INHERITED) {
node.setEditableState(Node.EDITABLE_INHERITED);
undoable.addPrimitive(new PrimitiveUndoableEdita... |
99731cbd-278d-4127-aca8-5d66db7c3444 | 5 | @SuppressWarnings({ "unchecked", "unused" })
private static LinkedList<LinkedList<Boolean>>testingList(int ln) {
if(ln<0)return null;
if(ln==0)
return new LinkedList<LinkedList<Boolean>>();
LinkedList<LinkedList<Boolean>> result= new LinkedList<LinkedList<Boolean>>();
if(ln==1){
LinkedList<Boolean> t, f;... |
9fd55675-c7d7-4c62-8845-7b13c796e806 | 8 | public boolean dispatch(CommandSender sender, org.bukkit.command.Command cmd, String[] args) {
boolean result = false;
if (!this.isRegistered(cmd.getName())) {
log("dispatched non-registered command: " + cmd.getName());
return false;
}
Method method = this.aliases.get(cmd.getName());
Object instance =... |
803e9e03-762c-46f9-b41e-81594a8e6383 | 6 | private boolean checkEmptyDocument() {
if (!(event instanceof DocumentStartEvent) || events.isEmpty()) {
return false;
}
Event event = events.peek();
if (event instanceof ScalarEvent) {
ScalarEvent e = (ScalarEvent) event;
return (e.getAnchor() == null... |
2fb2c368-4c47-4ef5-bfc9-beee2e59631a | 9 | private String getTextAsEps(String text) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
final char c = text.charAt(i);
if (c == '\\') {
sb.append("\\\\");
} else if (c == '(') {
sb.append("\\(");
} else if (c == ')') {
sb.append("\\)");
} else if... |
b986dbcd-923e-4052-b2bb-32ae9719d3a3 | 2 | private void push(int numstate, ArrayList listNode, boolean hidden) throws ParserException, LexerException, IOException
{
this.nodeList = listNode;
if(!hidden)
{
filter();
}
if(!this.stack.hasNext())
{
this.stack.add(new State(numstate, this.... |
fb472dd5-77eb-40d1-a75b-87f5d3f4c42f | 8 | public void execute() {
this.validateConnectionParams();
ExecuteAnonymousResult result = null;
try {
result = this.salesforceConnection().getApexConnection().executeAnonymous(this.m_code);
} catch (ConnectionException e) {
e.printStackTrace();
if(this.failOnError()){ System.exit(1); }
} finally {
... |
b0b816cc-c68e-492d-80e3-f4f8334de26b | 1 | public void testIncorrectlyOrderedParenthesisInsideNormalParenthesis() throws Exception {
String openParenString = "( 3 + 5 + ) 8 + 9 ( )";
try {
new Expression(openParenString);
fail("Did not throw exception");
} catch (IllegalArgumentException ile) {}
} |
9e2c0dc0-c84c-45f5-bfcc-644b63ea71c3 | 5 | public static boolean isPalindrome (LinkedListNode head) {
LinkedListNode slow = null;
LinkedListNode fast = null;
slow = head; fast = head;
Stack<Integer> half = new Stack<>();
while ( fast != null && fast.next != null) {
half.push( slow.data );
slow = slow.next;
fast = fast.next.next;
... |
300e2bea-13a6-4064-a90c-04d7b694b0a2 | 3 | * @return Returns true if the cell is sizable.
*/
public boolean isCellResizable(Object cell)
{
mxCellState state = view.getState(cell);
Map<String, Object> style = (state != null) ? state.getStyle()
: getCellStyle(cell);
return isCellsResizable() && !isCellLocked(cell)
&& mxUtils.isTrue(style, mxCon... |
f09ef46b-af66-45fc-891e-d44c1af517cb | 9 | public Integer minInReversingList(int[] array)
{
if(array==null)
return null;
int leftIndex=0;
int rightIndex=array.length-1;
int mid=1;
while(array[leftIndex]>=array[rightIndex])
{
if(rightIndex-leftIndex<=1)
{
mid=rightIndex;
break;
}
mid=(leftIndex+rightIndex)/2;
if(array[leftI... |
5bf347eb-e880-42ad-9c8b-9bf51cebc3cd | 6 | private boolean isANumber(String s){
boolean isNumeric =false;
if (s != null && !s.equals("")){
isNumeric=true;
char chars[] = s.toCharArray();
for (int i=0;i<chars.length;i++){
isNumeric &= Character.isDigit(chars[i]);
if (!isNumeric &... |
c628b42c-6cbc-40ad-98cb-ff6d6ecba80b | 9 | @Override
public String getModifiersString() {
String result = getVisibilityString();
if (result.length() != 0) {
result = result + ' ';
}
if (isStatic()) {
result = result + "static ";
}
if (isFinal()) {
result = result + "final ... |
902abb36-5a7b-4867-8148-dd483756bcf0 | 8 | public void sendCommands(ArrayList<String> commands) {
outputBuffer.setLength(0);
try
{
for (String s : commands) {
out.writeBytes(s + "\n");
out.flush();
}
// try{Thread.sleep(100);}catch(Exception ee){}
// Inpu... |
b0564bf6-7f3d-4fd4-931e-cdeafbb8656a | 3 | public void halt() {
try {
this.masterStop = true;
this.ois.close();
this.writer.close();
this.is.close();
this.os.close();
this.client.close();
this.clientList.remove(this);
System.out.println(this.getName() + " shu... |
0db1d518-8b54-4e5a-a4f8-82d7fdf978d2 | 4 | public StringBuffer format(final CommandSender target) {
// format all dates with time zone for target
TimeZone timeZone = null;
final Format[] formats = this.getFormatsByArgumentIndex();
for(int i = 0; i < formats.length; i++) {
if (!(formats[i] instanceof DateFormat)) conti... |
73a1db31-8fc1-40d5-af26-c1bce578a9e7 | 4 | public static String lengthAsString(double seconds) {
int hours = (int) seconds / 3600;
int minutes = (int) (seconds % 3600) / 60;
String response = "";
if(hours > 0) {
response += Integer.toString(hours) + ":";
}
if(minutes < 10 && hours > 0) {
... |
c0265aef-3f80-4f6b-97a8-aaacbd37b9e2 | 0 | private void placeButtonControls() {
JPanel internalPanel = new JPanel();
internalPanel.setLayout(gridBagLayout);
buttonsPanel.setLayout(gridBagLayout);
//Create GridBagConstraints
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagCon... |
8b3800ed-fddc-4fc4-9750-1d5e990428e9 | 1 | public void setGrossSales(double sales) {
if (sales >= 0.0)
grossSales = sales;
else
throw new IllegalArgumentException("Gross sales must be >= 0.0");
} |
2f5ef529-c3b5-44d2-b4a4-4247011ca645 | 7 | @Override
public GameDescription createGame(CreateGameRequest request) throws InvalidGamesRequest {
if(request == null || !request.validate()) {
throw new InvalidGamesRequest("Error: invalid create game request");
}
//
// Update gameDescriptionsList
//
GameDescription newGameDescription = new Game... |
30c68019-4cf3-4a87-97a8-253607557dc4 | 6 | public void testeSortierverfahren() {
SortierListe s = new SortierListe();
s.haengeAn("Test");
s.haengeAn("Test2");
s.zumAnfang();
System.out.println((String)s.aktuellesElement());
s.entferneAktuell();
System.out.println((String)s.aktuellesElement());
... |
f8c6a53e-c3aa-4bf2-81f0-90dd38e4800b | 1 | public static boolean isMiss(int x, int y, int[][] sea)
{
return (isTile(x, y, sea) && sea[x][y] == Sea.MISS);
} |
f7b00621-065c-44d5-af72-b7773a442f37 | 6 | public void resolve() {
try {
Stack<Coordinates> actualStack = new Stack<Coordinates>();
Stack<Coordinates> shortestStack = new Stack<Coordinates>();
Random randomGenerator = new Random();
Coordinates actual = new Coordinates(startX, startY);
cellsVis... |
7f55bd9c-5d32-40df-85e3-cdd9b8978ae3 | 1 | public EquatiansEasy()
{
plusSign = getRandomBool();
x = randomNumber(Game.getHardness().getMaxNumb());
y = randomNumber(Game.getHardness().getMaxNumb());
// result + x = y; -> result = y - x;
if (plusSign)
result = y - x;
// result - x = y; -> result = ... |
800b0a94-7193-429b-95f4-8ccf9f7196f4 | 3 | public void sendOrder(com.novativa.www.ws.streamsterapi.Order order) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[5]);
... |
7d7bd6fc-bd55-4566-9f29-b58b84bc544c | 6 | public static Connection getDBConnection(){
if ( connection == null ) {
synchronized (DBConnection.class){
if (connection == null){
try {
Class.forName(JDBC_DRIVER).newInstance();
connection = DriverManager.getConnec... |
5195e8a7-32c8-4a9f-9ae8-189498a59963 | 5 | public static Path findPathInSet(Set<Path> paths, Point2D start, Point2D end) {
Path p = new Path(start, end);
boolean reversed = false;
if (!paths.contains(p)) {
p = new Path(end, start);
if (!paths.contains(p)) {
return null;
}
reversed = true;
}
for (Path path : paths) {
if (!path.equals... |
e932582a-0382-4296-814e-fab1cd0509ae | 2 | public void onLeave(Client client) {
synchronized (players) {
if (players.containsKey(client.getName())) {
MafiaCharacter character = players.get(client.getName())
.getCharacter();
if (character != null) {
// spiel endet möglicherwiese hier
}
players.remove(client.getName());
}
}
... |
b385db29-b9ad-4335-b8fe-b28e63b88e03 | 1 | private boolean jj_3R_21() {
if (jj_3R_77()) return true;
return false;
} |
6b54cd10-655c-4c18-bae7-ba6b281e7290 | 9 | private boolean findFiles(String dirname) {
File[] dir;
File source = new File(dirname);
if (!source.exists()) {
JOptionPane.showMessageDialog(
this,
"Source directory",
"The source directory does not exist.",
JOptionPane.ERROR_MESSAGE,
null);
return false;
}
if (source.isFile()... |
f29d1d1f-a43f-4ef3-85f0-b4ac7acd7354 | 7 | public int calculoAzimute(JButton button, String grausDigitado) {
int graus = Integer.parseInt(grausDigitado);
try {
if ("Azimute".equals(button.getActionCommand())) {
System.out.println("*****************AZIMUTE*******************");
if (graus >= 0 && graus... |
1eec3843-1f24-4739-bf55-67434bcb4099 | 2 | void printSource() {
for (int i = 0; i < _source.length; i++) {
double[] row = _source[i];
for (int j = 0; j < row.length; j++) {
System.out.print(_source[i][j] + " ");
}
System.out.print("\n");
}
} |
369ade26-86fc-4415-976d-8b3509588e5a | 1 | public static double transformedRmse(double[] obs, double[] sim) {
sameArrayLen(sim, obs);
double error = 0;
double z_pred = 0.;
double z_val = 0.;
for (int i = 0; i < sim.length; i++) {
z_pred = (Math.pow((1.0 + sim[i]), 0.3) - 1.0) / 0.3;
z_val = (Math.p... |
2455fe5d-6e9d-4131-87e9-e1e551c00834 | 2 | private static File getOutputDir() {
File file = new File(properties.getProperty("usecase.outputdir") + "/state");
if (!file.mkdirs() && !file.exists()) {
throw new RuntimeException("Fail to create output directory at " + file);
}
return file;
} |
baef8a54-5280-4d16-ac3b-88f7359e7a3b | 4 | private String getEmailFromCookie(Cookie[] cookies){
String email = "";
if(cookies != null){
for (Cookie ck : cookies) {
if ("CILOGON-USER_EMAIL".equals(ck.getName()) && !ck.getValue().equals("")) {
logger.info("User Login received:" + ck.getValue());
email = ck.getValue();
}
}
}
... |
34ecdf66-cc0e-45c6-a747-815548918ccc | 0 | public static void main(String[] args) {
//Character character = CharacterFactory.getCharacter("warrior");
//character = CharacterFactory.getCharacter("mage");
//character = CharacterFactory.getCharacter("paladin");
//character = CharacterFactory.getCharacter("priest");
//character = CharacterF... |
1af5dcac-cc84-44e8-a3b5-228159a445d3 | 1 | public static void main(String[] args) {
for (int i = 1; i <= 4; i++)
f(i);
} |
efb9c0e1-5da9-492b-a4cb-3906f0a41946 | 2 | public JSONObject append(String key, Object value) throws JSONException {
testValidity(value);
Object object = opt(key);
if (object == null) {
put(key, new JSONArray().put(value));
} else if (object instanceof JSONArray) {
put(key, ((JSONArray)object).put(value));... |
9b0ec117-c9b8-4843-944b-8702410626fd | 3 | public void drawPath(List<Edge> path, Graphics g) {
for (Edge temp : path) {
Set<Node> XY = temp.getAdjacent();
Iterator<Node> it = XY.iterator();
Coordinates node1Coords, node2Coords;
Node node1 = it.next();
node1Coords = node1.getCoordinates();
int node1X = (node1Coords.col * wallSize) + pa... |
ee64368f-d58a-47ed-92bf-4a07feadaf9b | 2 | public void setAutopaint(boolean autopaint) {
if (this.autopaint == autopaint)
return;
this.autopaint = autopaint;
if (autopaint)
forceRedraw();
} |
3e04764e-1038-40b3-8541-8c357b26970c | 4 | static String getPlatformFont() {
if(SWT.getPlatform() == "win32") {
return "Arial";
} else if (SWT.getPlatform() == "motif") {
return "Helvetica";
} else if (SWT.getPlatform() == "gtk") {
return "Baekmuk Batang";
} else if (SWT.getPlatform() == "carbon") {
return "Arial";
} else { // photon, etc ...
... |
59a68744-7a78-4181-9c89-1e53aa6c27e0 | 6 | private static boolean rounds(Fighter first, Fighter second) {
// Begin for loop; Each Fighter gets 10 alternating turns to destroy their opponent
for(int turn = 1; turn < 11; turn++) {
System.out.printf("Round %d: ", turn);
// If the first fighter wins, ask the user if s/he wants to play again;
... |
a4443313-a13c-4d90-9102-6b7d55308b08 | 7 | private void readProperty(String propertyKey, Field field,
Properties properties) {
String value = properties.getProperty(propertyKey);
if (value == null)
return;
try {
Class<?> type = field.getType();
if (type.equals(int.class))
field.setInt(this, Integer.parseInt(value));
else if (type.equa... |
94134a3e-e7aa-4cb6-8dd2-5a007d527937 | 4 | Node<K, V> findByEntry(Entry<?, ?> entry) {
Node<K, V> mine = findByObject(entry.getKey());
boolean valuesEqual = mine != null && equal(mine.value, entry.getValue());
return valuesEqual ? mine : null;
} |
0947ce77-1bef-4bda-9050-edc300533df7 | 6 | public void myWorkerDone () {
switch (state) {
case READCACHEPAGES:
assert (theWorker.jm.whatToDo.equals(JobType.READCACHEPAGES));
finishPrefetch();
initScan();
break;
case UPDATEPAGES:
assert (theWorker.jm.whatToDo.equals(JobType.UPDATEPAGES));
finishScan();
initCheckSavingReq();
break;... |
63beef7e-5aaf-407b-8974-3e719498e985 | 9 | public static byte TorchFix(byte data, String kierunek)
{
if (kierunek.equals("right"))
{
if (data == 3) {
return 2;
}
if (data == 2) {
return 4;
}
if (data == 4) {
return 1;
}
if (data == 1) {
return 3;
}
}
else
{
... |
dfa5a2f2-7869-44dd-b079-ff9b58fa3297 | 5 | private int getClickedObject(int cursorX, int cursorY, Room room) {
for(Object obj : room.getObj()){
if(cursorX > obj.getPositionX() && cursorX < obj.getPositionX() + obj.getWidth()
&&
cursorY > obj.getPositionY() && cursorY < obj.getPositionY() + obj.getHeight()){
return room.getObj().index... |
7aa77b75-3cf2-45f9-aba0-b83fd2c2e90e | 2 | private Random genRandom(){
if(random==null){
try{
Class c=Class.forName(jsch.getConfig("random"));
random=(Random)(c.newInstance());
}
catch(Exception e){ System.err.println("connect: random "+e); }
}
return random;
} |
818bfcdf-9e6e-40f6-8a4d-cffc1ce4ab99 | 7 | @RequestMapping(value = "/get", method = RequestMethod.POST)
@ResponseBody
public byte[] getInfo(HttpServletRequest httpRequest) {
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
ArrayList<String> fieldList=new ArrayList<>();
fieldList.add... |
78d60c7e-235f-4a41-8080-ef705fd0b6f9 | 2 | public List obtenerEmisionSerie(Date dia, int[] siguienteCapitulo){
List infoEmision = null;
List infoEmisionTemporada;
Temporada temporada = buscarTemporada(siguienteCapitulo[0]);
if (temporada != null){
infoEmisionTemporada = temporada.obtenerEmisionTemporada(dia, ... |
a7521a8b-f429-462d-9d0a-bdd4ee945f71 | 2 | public Player(int id){
this.id = id;
if (id==BattleCity.PLAYER_ID_P1){
tank = new Tank(Tank.TANK_1P);
}
else if (id==BattleCity.PLAYER_ID_P2){
tank = new Tank(Tank.TANK_2P);
}
destroyCounter = new HashMap<Integer, Integer>();
} |
58fc4eb6-4be0-42d0-92a4-84c424101bea | 4 | public void castVote(User user, Vote v) {
if (type == DnDElectionType.ALTERNATE) {
RankedVote rankedVote = (RankedVote) v;
if (rankedVote.size() != candidateSet.size())
throw new RuntimeException("Number of votes should be equal to the number of candidates");
}
if (usersVoted.contains(user))
throw ne... |
56632b8a-0924-4625-ace1-504d756f7f58 | 0 | public String getLabel(String label) {
return languageResourceBundle.getString(label);
} |
41acced2-e459-4de1-bccc-d6446e7f7616 | 9 | private String getDSService(ServiceDescriptor service) {
Formatter formatter = Formatter.getInstance();
StringBuilder sb = new StringBuilder();
int i = 0;
sb.append(formatter.currentIndent()).append("component ").append(service.getUpperCamelCaseName()).append(" \n");
sb.append(formatter.currentIndent()).appen... |
eddb6c4c-2bb8-4b4c-a5c0-882474a5e512 | 9 | public synchronized void update( Graphics g ) {
Dimension d = getSize();
if ( (offscreen == null)
|| ( d.width != offscreensize.width )
|| ( d.height != offscreensize.height )) {
offscreen = createImage(d.width, d.height);
offscreensize = d;
... |
149f14af-863d-4600-99c6-4f0fadc874bd | 7 | private void checkToInterrupt() {
System.out.println(queue.peek().getName());
if(callee != null
&& callee.getName() != null
&& !queue.isEmpty()
&& queue.peek().getName().contains("write")
&& callee.getName().contains("read")
... |
e0f5a87e-53ff-4475-89a7-0c5087e1a32b | 9 | public void preencherComboSetor(){
List<String> setores = null;
String setor = null;
jComboBoxSetor.removeAllItems();
if(job != null){
setor = job.getCentroTrabalho().trim();
setores = new ArrayList<String>();
setores.a... |
a8fb48b6-0bb9-4eb9-95ee-87a432827bdf | 2 | private BasicComboBoxRenderer teacherRenderer()
{
BasicComboBoxRenderer renderer =
new BasicComboBoxRenderer(){
public Component getListCellRendererComponent(
JList list, Object value, int index,
boolean isSelected, boolean cellHasFocus)
{
super.getListCellRendererCompon... |
c96f4845-2c42-4288-b5c0-a12cf3107975 | 8 | void noteName(NameNameClass nc, boolean defaultable) {
String ns = nc.getNamespaceUri();
if (ns.equals("") || ns == NameClass.INHERIT_NS) {
if (defaultable)
defaultNamespaceUri = "";
return;
}
String assignedPrefix = namespaceUriMap.get(ns);
if (assignedPrefix != null)
retu... |
01e29b7f-4977-4330-a330-604b69e114c8 | 0 | public void setCode(String code) {
this.code = code;
} |
d988d4a5-53e7-499d-8399-7922479dfdae | 6 | private static BufferedImage flip(BufferedImage image, boolean horizontal, boolean vertical) {
int width = image.getWidth(), height = image.getHeight();
if (horizontal) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width / 2; ++x) {
int tmp = im... |
0768e864-4ec7-4d26-bf3f-c03968d8d105 | 0 | public LinkedOccurrence() {
head = null;
} |
593a0291-9cd1-47b9-9ee3-dbfd162fa75f | 2 | public User(String userName,
String firstName,
String lastName,
Date dateOfBirth,
String emailAddress,
Date passwordExpiryDate) {
super();
this.userName = userName;
this.firstName = firstName;
this.lastName = lastName;
//making defensive copy
if (dateOfBirth != null) {
this.d... |
c7c660a2-5366-468c-94ea-7c402ea690a7 | 7 | public void touch(String name, Path currentDirectory, Scanner scanner) {
Path path = null;
boolean succeeded = false;
path = Paths.get(name);
if (path.isAbsolute())
succeeded = true;
if (!succeeded) {
path = Paths.get(currentDirectory+"/"+name);
if (path.isAbsolute())
succeeded = true;
}
i... |
10fbece0-deec-4dc4-892f-45f1618c8c6e | 9 | public static void appendEntry(File zip, File entry) throws IOException {
ZipOutputStream moddedZip = new ZipOutputStream(new FileOutputStream(zip.getPath() + "new"));
ArrayList<ZipEntry> entryList = new ArrayList<ZipEntry>();
if (zip.exists()) {
ZipFile zipFile = new ZipFile(zip.getPath());
Enum... |
15c68063-52b4-4001-8a68-c7256f6e430b | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
0bf82cd5-b15a-4712-a2b5-04dab98315ca | 3 | private void checkReturnType(Method method) throws DaoGenerateException {
Class<?> returnType = method.getReturnType();
if (ClassHelper.isTypePrimitive(returnType)) {
returnType = ClassHelper.primitiveToWrapper(returnType);
}
if (Integer.class.equals(returnType)) {
return;
}
throw new DaoGenerateExc... |
41385935-fe5d-4960-a99b-3f22281bf42c | 2 | @SuppressWarnings("deprecation")
void stopExecuting(int agentId_)
{
for(ThreadsInformation threadInfo : ThreadsAgent)
{
if(threadInfo.agentId == agentId_) {
threadInfo.threadInfo.stop();
SendMessage("disconnect#" + threadInfo.agentId + "," + threadInfo.agentType);
}
}
} |
e06fdc22-dc88-48cd-99ad-dae5c6f6c5de | 3 | public static void pickupItem(Item floating, Player p){
Material m = floating.getItemStack().getType();
if(m == HealthPack.HealthPackMaterial){
ItemStack item = floating.getItemStack();
floating.setFireTicks(999);
List<String> lore = item.getItemMeta().getLore();
try{
String lore1 = lore.get(0);
... |
51d3dde1-395a-4aaa-aa58-c34cc58922b0 | 4 | public PasswordDialog(final JFrame parent) {
super(parent, "", true);
bundle = Application.getResourceBundle();
this.setTitle(bundle.getString("password_input"));
// Closing the window is equal to pressing the Abort-Button
WindowListener windowListener = (new WindowAdapter() {
public void... |
410e9f72-0784-43cd-a86f-73e515eb0001 | 8 | private void textCedulaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textCedulaKeyTyped
char key = evt.getKeyChar();
if (key >= '0' && key <= '9' || key == 8) {
if (textCedula.getText().length() > 8) {
evt.consume();
}
if (key != 8 && textCe... |
e29a79a9-bc17-4a72-894b-3eade1fe6ccb | 3 | public static List<String> readFile(File f) throws IOException {
if (f == null || !f.exists()) {
return null;
}
List<String> list = new ArrayList<String>();
String encoding = "UTF-16LE";
InputStreamReader read = new InputStreamReader(new FileInputStream(f),
encoding);
BufferedReader br = new Buffered... |
ebb55219-2db5-4a11-acd4-d231da070764 | 4 | public void removeCellGate(int x, int y) {
for (int i = 0; i < switchGates.length; i++) {
if (switchGates[i] == null)
continue;
for (int j = 0; j < switchGates[i].getGateSize(); j++) {
if (switchGates[i].getNearGate(x, y)) {
switchGates[i].removeNearGate(x, y);
}
}
}
} |
054214fd-30cf-4649-ab28-4256bfdb8960 | 2 | public MaquinaVirtual (JTextArea jtAreaOutput) {
this.jtAreaOutput = jtAreaOutput;
apuntadoresInstruccion = new int [1000];
for (int i = 0; i < 1000; i++)
apuntadoresInstruccion[i] = 0;
for (int i = 0; i < 8; i++)
offsets[i] = 0;
apuntador = 0;
enableOffsets = false;
useBeforeOffsetsValues = false;
... |
bb88507e-19bc-4d1e-b720-a6286d75d2a7 | 1 | public static boolean isInteger(String input)
{
try
{
Integer.parseInt(input);
return true;
}
catch(Exception e)
{
return false;
}
} |
c5e5ba2d-a5a4-4ffa-9ef3-9659dc8da033 | 1 | public static void main (String[] args) {
try {
new P2PUDPServer().launchServer();
}
catch (IOException e) {
e.printStackTrace();
}
} |
7f995e87-1517-415d-b4ff-1f68d440247d | 6 | @EventHandler
public void SlimeNausea(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.getSlimeConfig().getDouble("Slime.Nausea.Dodg... |
177ac8b3-bc08-4bef-bd2f-3454ac15f256 | 0 | public void setFesCedula(long fesCedula) {
this.fesCedula = fesCedula;
} |
ae2176ff-6fca-4981-b1d7-ad4b429e52e7 | 2 | public void remove(int id) {
Iterator<CartItem> iter = cart.iterator();
while (iter.hasNext()) {
CartItem item = iter.next();
if (item.getId() == id) {
cart.remove(item);
return;
}
}
} |
88988c1f-c456-47ff-b4ab-16ab217db2f8 | 3 | public void run() {
String data = null;
Random r = new Random();
System.out.println("启动生产者线程!");
try {
while (isRunning) {
System.out.println("正在生产数据...");
Thread.sleep(r.nextInt(DEFAULT_RANGE_FOR_SLEEP));
data = "data:" + cou... |
ba6e1bff-48cb-4a46-b267-dbfb938cbbc0 | 7 | public static void startupPowerloom() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Mo... |
f5d2cbfa-e8e2-460b-984d-b5de78d215b1 | 6 | @Test
/**
* This method simply calls the getEandomQuestion() 300 times. Becuase the
* setUp() method (see above) has added 3 word pairs we should be able to
* get them all with 300 tries. That is what is asserted at the bottom of
* this method.
*
* This does not test the distribution, ... |
66108fd3-5f64-4a54-a562-4ee68aaddb88 | 4 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == e.VK_A) {
left = true;
}
if (e.getKeyCode() == e.VK_D) {
right = true;
}
if (e.getKeyCode() == e.VK_W) {
up = true;
}
if (e.getKeyCode() == e.VK_S) {
down = ... |
7f4366f3-811e-4742-9b37-af2489436cd4 | 3 | @Override
public void ParseIn(Connection Main, Server Environment)
{
if (!Main.Data.IsStaff())
{
return;
}
int UserId = Main.DecodeInt();
String Message = Main.DecodeString();
Player Client = Environment.ClientManager.GetClient(UserId);
if (C... |
b90f5b8f-fee6-4217-a05b-1d5b6a7c68a0 | 3 | private static void SimpleIf() {
Scanner input = new Scanner(System.in);
System.out.print("Enter a number between 0 and 10: ");
int iNumber = input.nextInt();
if (iNumber > 5)
System.out.println("Number Greater Than 5");
if (iNumber == 5) {
System.out.println("Number is 5");
}
if (iNumber < 5)
... |
f37d11dd-df4f-4b8a-a18c-b191276cdcdb | 8 | protected void doTestCycAccess6(CycAccess cycAccess) {
long startMilliseconds = System.currentTimeMillis();
// Test sending a constant to Cyc.
try {
CycList command = new CycList();
command.add(makeCycSymbol("identity"));
command.add(collection);
Object obj = cycAccess.converseObje... |
6292bd52-0c5e-4c0a-a412-18394189b0a6 | 4 | public static Disc recommendDiscForBag(Bag bag) {
LOGGER.log(Level.INFO, "Selecting criteria for disc to complement bag. Here be dragons..");
Map<String, Object> criteria = new HashMap<String, Object>();
DiscType suggestDiscType = bag.getLackingDiscType();
if (suggestDiscType != DiscType.UNKNOWN) {
criteri... |
834b3b51-a712-4adb-8308-3bdfe94d5978 | 9 | private void refreshIniValues() {
// window extended state
final int state = getExtendedState();
if(state != WINDOW_EXTEND_STATE) {
INI.setInteger("window", "state", state);
}
setExtendedState(NORMAL); // get the real window bounds
final Rectangle box = getBounds();
setExtendedState(st... |
98f8de91-4418-4fe7-8ba2-911c73c4823a | 2 | public double residualCapacity(int v)
{
if (v == from) // backward edge
return flow;
else if (v == to) // forward edge
return capacity - flow;
throw new IllegalArgumentException();
} |
88f928a9-8566-4d1e-8905-55013348976e | 4 | public String mode_string()
{
switch (h_mode)
{
case STEREO:
return "Stereo";
case JOINT_STEREO:
return "Joint stereo";
case DUAL_CHANNEL:
return "Dual channel";
case SINGLE_CHANNEL:
return "Single channel";
}
return null;
} |
8dadfbda-7c75-49cb-8efa-b930112de47c | 3 | public void pierresCapturees(){
if(isCapture()){
if(pierres.get(0).getJoueur().equals(g.getPlayer1())){
g.getPlayer2().setNbPierresCapturees(g.getPlayer2().getNbPierresCapturees()+pierres.size());
} else{
g.getPlayer1().setNbPierresCapturees(g.getPlayer1()... |
80dff852-125a-44d1-9f3e-87668ffab4c7 | 8 | private void validateRange(JsonNode node, List<ErrorMessage> results) {
if (this.minimum != null) {
String nodeValueAsString = type.getValue(node).toString();
BigDecimal value = new BigDecimal(nodeValueAsString);
BigDecimal minimum = new BigDecimal(this.minimum.toString());
... |
d173dd77-c03c-458b-b003-60a2b1f5a311 | 1 | public boolean InsertarProducto(Producto p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
992cb61a-192b-4ff4-81cd-b15fa011be1d | 4 | public static double[] toUtmX(int zone, double lon, double lat) throws Exception {
double[] xy = {0, 0};
if ((lon < -180.0) || (180.0 <= lon)) {
throw new Exception("The longitude you entered is out of range. "
+ "Please enter a number in the range [-180, 180).");
... |
f56bdd18-6e83-426c-8bf7-5df347a6108a | 6 | public static void check(Deck deck) throws InvalidDeckException {
if (deck.amounts.size() != deck.names.size()) {
throw new InvalidDeckException("Number of amounts and names differ");
}
int total = 0;
for (int i = 0; i < deck.amounts.size(); i++) {
if (de... |
af6f66f0-8f89-4820-a91f-e3a79052e62d | 5 | public static boolean containsArmor(Inventory inventory) {
boolean contains = false;
for(ItemStack itemstack : inventory.getContents())
if(isArmor(itemstack))
contains = true;
if(inventory.getType() == InventoryType.PLAYER) {
PlayerInventory playerinventory = (PlayerInventory) inventory;
for(Item... |
6079ff48-adf7-4f08-b179-654174bd6251 | 9 | public void run() {
Robot.getInstance().getMotion().getPilot().rotate(odo.getPose().relativeBearing(pose.getLocation()), true);
while(Robot.getInstance().getMotion().getPilot().isMoving()) {
if(!getInterrupted()) {
Thread.yield();
}
else
break;
}
if(!getInterrupted()) {
Robot.getInstance().g... |
52b83c9d-a407-42f8-87af-71eeb039a16a | 1 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
try (PrintWriter o... |
4f03d21d-624c-4657-9197-32dc8dcc29a5 | 5 | protected void readJoinIndex(Context context, List<String> join) {
// 如果來自Fact Table直接離開
if (tableIndex < 0) {
return;
}
String first_word = DIMENSION_TABLE_INDEX[tableIndex].substring(0, 1);
for (int i = 0; i < join.size(); i++) {
for (int j = 0; j < OP.length; j++) {
if (join.get(i).indexOf(OP[j])... |
94bb078d-c303-4d04-943a-67aa59b8a617 | 1 | @Override
public void adjust() {
Saveable saveable = getTarget(Saveable.class);
setEnabled(saveable != null ? saveable.isModified() : false);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.