method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c4049fa6-a739-4ffb-9822-30d0cfbb208f | 1 | public CSVColumn getObserved() {
if (obs == null) {
throw new IllegalArgumentException("Missing 'obs' argument");
}
return obs;
} |
3abb0144-7262-4919-a94e-e1dbd0744364 | 5 | public static String SortStringUsingSort(String toSort, String sortBy) {
final HashMap<Character, Integer> orderMap = new HashMap<Character, Integer>();
int init = 1;
for (char c : sortBy.toCharArray()) {
orderMap.put(c, init++);
}
ArrayList<Character> ca = new ArrayL... |
42e2a365-b55f-412d-bc2e-83de261cbeac | 0 | public MooreMachine()
{
super();
myMap = new HashMap();
} |
df561cd1-9ac3-4358-9d42-91fdd9c0b83f | 2 | public void setAnchor(int index) {
mAnchor = index < 0 || index >= mSize ? -1 : index;
} |
2ae2cb65-5b6f-4e29-b771-6ae031a4baa6 | 8 | private void addMatch() throws IOException, SQLException {
if (addFen_choiceJ1.getSelectedItem().equals("Aucun joueur sélectionné") ||
addFen_choiceJ2.getSelectedItem().equals("Aucun joueur sélectionné") ||
addFen_choiceCourt.getSelectedItem().equals("Aucun court sélectionné") ... |
03b9655c-b186-4d29-b2c0-b196562adc07 | 6 | public Object getValueAt(int rowIndex, int columnIndex) {
StockMarketYear marketYear = market.getYearOffset(rowIndex);
switch(columnIndex){
case 0: return marketYear.year();
case 1: return marketYear.startingBalance();
case 2: return marketYear.startingCostBasis();
... |
9bcd26b5-feb0-4f09-ac4b-4438f6b74a16 | 8 | public void render(ArrayList<GameObject> list){
int x = (Game.PLAYER.getCameraX()/32);
int y = (Game.WORLD_HEIGHT-Game.PLAYER.getCameraY())/32;
int beginX;
int beginY;
beginX = x - 2*Game.SCREEN_WIDTH/32;
beginY = y - 3*Game.SCREEN_HEIGHT/32;
int endX = beginX + 5*Game.SCREEN_WIDTH/32;
... |
8eb3eee8-8144-4902-92e6-9d85f7058d9a | 0 | public Priority getByValue(String value) {
Criteria criteria = sessionFactory.getCurrentSession().createCriteria(Priority.class);
criteria.add(Restrictions.eq("value", value));
return (Priority) criteria.uniqueResult();
} |
0de253bf-b820-4f0a-b63e-d579a1f4852d | 3 | private ItemStack[] buildItemStack(String str) {
ItemStack[] items = null;
String[] itemSplit = str.split(";");
String[] itemid = itemSplit[0].split(",");
String[] amount = itemSplit[1].split(",");
String[] durability = itemSplit[2].split(",");
String[] enchants = itemSplit[3].split(",", -1);
items = new ... |
7b18cf3c-c6ad-4bc2-bdbe-41d8ccc43c4f | 1 | public Set<Matcher> findSign(Block block) {
Object metaMatcher = getMeta(block, MATCHERS);
if (metaMatcher instanceof MetaMatcher) {
return ((MetaMatcher) metaMatcher).getMatchers();
}
Set<Matcher> matchers = noCacheFindSign(block);
block.setMetadata(MATCHERS, new ... |
362175b2-761c-44a9-afc7-534781e5de06 | 3 | public static long kadane(long[] comp) {
long sum = 0, max = Long.MIN_VALUE;
startRow = endRow = 0;
for (int i = 0; i < m.length; i++) {
sum += comp[i];
if (sum < 0) {
sum = 0;
startRow = i + 1;
} else if (max < sum) {
max = sum;
endRow = i;
}
max = Math.max(max, comp[i]);
}
ret... |
efed987a-9cef-448f-87da-131859cacb10 | 7 | public void delete(int count) throws DatabaseException {
synchronized (mutex) {
int matches = 0;
Cursor cursor = null;
OperationStatus result;
DatabaseEntry key = new DatabaseEntry();
DatabaseEntry value = new DatabaseEntry();
Transaction txn;
if (resumable) {
txn = env.beginTransaction(null... |
2d46a49d-5c3f-4a2b-81e4-7ba9cdd286f3 | 1 | private boolean canHaveAsLightGrenade(LightGrenade lg) {
if (lg == null) return false;
return grid.getElementsOnPosition(lg.getPosition()).isEmpty();
} |
87093b11-1733-4892-9290-fbc1819829de | 5 | public static void main(String[] args) {
List<Future<Integer>> results = new ArrayList<>();
ThreadMethod threadMethod = new ThreadMethod();
for (int i = 0; i < 10; i++) {
Future<Integer> submit = threadMethod.runTask(5 + i);
results.add(submit);
}
for (Iterator<Future<Integer>> iterator = results.iterat... |
d108e563-7ced-4c00-990e-e9f04739e507 | 9 | private static void render(String s)
{
if (s.equals("{"))
{
buf_.append("\n");
indent();
buf_.append(s);
_n_ = _n_ + 2;
buf_.append("\n");
indent();
}
else if (s.equals("(") || s.equals("["))
buf_.append(s);
else if (s.equals(")") || s.equals("]"))
... |
e4a4663f-3bf6-427b-9fb5-c4ad37c720d0 | 6 | private static boolean isPrimitive(Object obj) {
boolean result;
result = (obj instanceof String || obj instanceof Number || obj instanceof Character || obj instanceof Boolean ||
obj instanceof java.util.Date || obj instanceof java.sql.Date || obj instanceof Timestamp);
return result;
} |
24f95884-f52d-4dd4-a8fd-61c11d3ace67 | 5 | public void DeleteResults(String TargetPHPFileSelectedComboBox) {
PreparedStatement ps = null;
int count = 0;
ResultSet rs = null;
// Adapted from http://developers.sun.com/docs/javadb/10.2.2/ref/rrefclob.html
try {
if ((conn = setConn()) != null) {
S... |
8cc353a4-8ddf-4b83-a07a-1557d667a71c | 5 | public void condense()
{
Iterator<GraphPoint> iter = points.iterator();
List<GraphPoint> pointsToRemove = new ArrayList<GraphPoint>();
while(iter.hasNext())
{
GraphPoint p = iter.next();
if(!hasNeighbourOfOtherClass(p))
{
pointsToRemove.add(p);
}
}
Iterator<GraphPo... |
e5f0ff7b-bf19-4381-aa05-3e6e7254ce32 | 9 | private void writeObject(ObjectOutputStream out) throws IOException {
// -- Create a serializable form of the RenderingHints object. --
RenderingHints hints = (RenderingHints)theObject;
// Create an empty Hashtable.
Hashtable table = new Hashtable();
// If there are hints, add them to... |
9afc814f-167f-4601-ab15-bf4b13736244 | 5 | public static void getAllEmployeeWhenStartDB() {
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Employee newEmployee = null;
Connection connect = null;
Statement statement = null;
ResultSet choiseResult = null;
try {
connect = DriverManager.getConnectio... |
2d98aa2d-342a-41fa-be99-8f60075d8a67 | 4 | private void rellenarTabla() {
TableColumnModel tcm;
jLproyecto.setText(this.proyectos.get(index).getNombre());
jBMSEstado.setEnabled(true);
switch (jCBEstado.getSelectedIndex()) {
case 1:
tableModel = new TableModel(this.proyectos.get(index).getProximo());
... |
c2f5b630-ec2d-4cdc-982f-42f8684971b4 | 8 | public void HandleNetworkMessages()
{
ArrayList<NetworkMessage> messages = mServer.GetMessages();
for (int i = 0; i < messages.size(); i++)
{
try
{
StringTokenizer st = new StringTokenizer(messages.get(i).GetMessage());
int id = Integer.parseInt(st.nextToken());
if (id == 0)
{
... |
5362a6c6-686a-42d7-a31e-1e87f6a53b9b | 3 | public static AudienceEnumeration fromString(String v) {
if (v != null) {
for (AudienceEnumeration c : AudienceEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
690ea90b-a243-4323-9a22-aea112481d99 | 2 | public static void main(String[] args) {
String urlStr = null;
try {
CentralizedExceptionHandlerApp app = new CentralizedExceptionHandlerApp();
app.openDataFile("src.txt");
app.readData();
reader.close();
} catch (IOException e) {
System.out.println("Error closing file");
} catch (Exception e) {
... |
994d4dbf-b2ff-4304-97ae-350e033fab44 | 2 | public void insertString(int offs, String str,
javax.swing.text.AttributeSet a) throws BadLocationException
{
if (Character.isDigit(str.charAt(0)))
{
if (getText(0, getLength()).equals("0"))
super.remove(0, 1);
super.insertString(getLength(), str, a);
}
} |
dd44f475-209b-4ca0-a25d-b42a4266c5b3 | 5 | public static boolean isLetter(char c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'
|| c == '\'';
} |
a95dea23-c52d-461a-b6de-d5123a945700 | 8 | private void buildInheritedSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator();
iter.hasNext();) {
ClassDoc inhclass = iter.next();... |
9fb562a0-95a7-4811-92ab-57565aa88a2b | 2 | protected void setImage(Path image) throws IOException {
if (FileUtil.control(image)) {
if (image.toAbsolutePath().getParent()
.compareTo(Constants.PROGRAM_TMPSKIN_PATH.resolve(this.name).resolve(Constants.SKIN_PREVIEWIMAGE).toAbsolutePath()) != 0) {
FileUtil.copy... |
fe2621ac-3ec8-4f4f-bf7b-0da5bf38ebe4 | 7 | private boolean inputRFCHandling(String stdInString) {
FtpServiceComImpl fservice = new FtpServiceComImpl(data, dataMsg, msg);
// split standard Input into tokens, token cut by " "
String tokenToFind = " ";
StringTokenizer token = new StringTokenizer(stdInString, tokenToFind);
int arraySize = token.countToken... |
bcb4ee6d-e40e-42ec-820a-32e4080857d6 | 7 | @Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
MethodStatistics other = (Met... |
b96a1c88-8982-49f3-85c8-2946f78d5325 | 1 | @Test public void TestImageSetter() {
try {
BufferedImage in = ImageIO.read(new File("src/test/resources/Mario.png"));
reduct.setSourceImage(in);
assertTrue(reduct.getSource() == in);
} catch (IOException e) {
e.printStackTrace();
}
} |
7945ca4f-a6d1-4086-95d6-3a9c8d385300 | 2 | public SpecialEffect(int nr){
try {
BufferedImage srcImage = ImageIO.read(getClass().getResource("resources/effects.gif"));
stoppedImg = srcImage.getSubimage(256, nr*64, 32,64);
for(int i = 0;i<=7;i++){
animImages[i]= srcImage.getSubimage(i * 32, nr * 64, 32, 64);
}
} catch (IOException e) {e.printS... |
82cd0b5c-1747-4dd8-b8a2-5509ac084d83 | 3 | public boolean isSpecial(Date date) {
calendar2.setTime(date);
for (int i = 2; i < 5; i++) {
if (calendar.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH)
&& calendar.get(Calendar.DAY_OF_MONTH) == calendar2
.get(Calendar.DAY_OF_MONTH) + i) {
... |
4947e8d8-5456-4f2a-a2f6-e3511644cb32 | 4 | public LoginController() {
loginForm = new LoginForm();
loginForm.setVisible(true);
onLoginClick = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
String username = loginForm.getUsernameText().getText();
String password = ... |
8b437f97-2c91-42c4-8cdf-4903ba42371d | 2 | public void addDefault(String path, Object value) {
Configuration root = getRoot();
if (root == null) {
throw new IllegalStateException("Cannot add default without root");
}
if (root == this) {
throw new UnsupportedOperationException("Unsupported addDefault(Strin... |
03b40730-2684-4da5-8505-a8c792b94beb | 2 | public void readFile(){
File f=file;
String temp="";
try {
Scanner sc=new Scanner(f);
while(sc.hasNext()){
temp+=sc.nextLine()+"\n";
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
text=temp;;
} |
81a28dbc-8c04-48ec-b10c-470397ff684b | 5 | public static long getBaselineTimestamp(List<Bookmark> testLines, int refID, boolean resource) {
if (testLines != null) {
long maxTimestamp = -1;
for (Bookmark data : testLines) {
int id = resource ? data.getWikiID() : data.getUserID();
if (id == refID) {
long timestamp = Long.parseLong(data.getTim... |
aedafeb9-2e2c-4f0b-93e4-3df8377cf6bb | 1 | public static void exchange(int[] array, int i,int j){
if(i != j){
int temp = array[i];
array[i] = array[j];
array[j] = temp ;
}
} |
df7380de-e5b4-46a6-912b-e6e1c2f52ad3 | 8 | public String send(String request) throws HttpRPCRequestException, HttpRPCResponseException {
URL url = null;
HttpURLConnection conn = null;
OutputStreamWriter writer = null;
StringBuffer response = new StringBuffer();
try {
url = new URL(this.url_);
} catch (MalformedURLException ex) {
throw new Http... |
d580e255-14bc-4491-a1d6-cd0d84cdf7d0 | 6 | public static boolean line_box_xyxy(double lx0, double ly0, double lx1, double ly1, double rx0, double ry0, double rx1, double ry1) {
int out1, out2;
double rectWidth = rx1 - rx0;
double rectHeight = ry1 - ry0;
if ((out2 = outcode(lx1, ly1, rx0, ry0, rectWidth, rectHeight)) == 0) {
return true;
}
whil... |
d322efd1-c222-45fe-b30c-d9a0ffb46df7 | 3 | @Override
public void setAsText(String text) throws IllegalArgumentException {
if (text == null || text.equals(""))
text = "0";
if (!StringUtils.hasText(text)) {
setValue(null);
} else {
setValue(Long.parseLong(text));// 这句话是最重要的,他的目的是通过传入参数的类型来匹配相应的databind
}
} |
a2a792ca-8522-44f6-bb23-7b7a60370376 | 9 | @Override
public void run() throws Exception {
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
String server = config.getProperty("net.server.ip");
if ( server == nu... |
33514a3f-067a-4ecd-a945-0654f8f39be5 | 3 | public void mousePressed(MouseEvent e) {
// assigning correct mouse state.
if (documentViewController != null){
DocumentViewModel documentViewModel =
documentViewController.getDocumentViewModel();
if (documentViewModel.isViewToolModeSelected(DocumentViewModel... |
77ff969b-16c9-4fe2-8501-97d3efb8aa05 | 9 | public void paintComponent(Graphics g){
g.setColor(Color.GRAY);
g.fillRect(0, 0, 1200, 800);
g.setColor(Color.WHITE);
g.fillRect(11, 11, 1169, 744);
Graphics2D g2 = (Graphics2D)g;
BasicStroke normalStroke = new BasicStroke(1);
BasicStroke wideStroke = new BasicStroke(3);
g2.setSt... |
70646975-cb57-4cc0-874b-6141afd16b81 | 4 | public String getCaptchaString(Integer stringCount) {
String excludeChars = "Ii0o";
if (stringCount <= 0) {
throw new IllegalArgumentException("Character length must be > 0");
}
Integer endAscii = new Integer(122)+ 1;
StringBuffer buf = new StringBuffer();
char randomChar;
while (stringCount-- != 0) {
... |
1aa38876-118f-4f18-a878-842f4de64c21 | 7 | treeNode selectNode(treeNode root, MTRandom clustererRandom) {
//random number between 0 and 1
double random = clustererRandom.nextDouble();
while (!isLeaf(root)) {
if (root.lc.cost == 0 && root.rc.cost == 0) {
if (root.lc.n == 0) {
root = root.r... |
90616234-4b5e-440c-b49b-2cada42fa2d8 | 7 | private static Class getAttributeTypeClass(int attributeType, String typeStr) {
Class type = RadiusAttribute.class;
if (typeStr.equalsIgnoreCase("string"))
type = StringAttribute.class;
else if (typeStr.equalsIgnoreCase("octets"))
type = RadiusAttribute.class;
else if (typeStr.equalsIgnoreCase("integer") ... |
e59eca86-2f41-423d-9e9f-135e303b4726 | 5 | public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
HashMap<String , String[]> e = null;
File f = new File("statusfile.ser");
if(f.isFile()) {
try
{
FileInputStream fileIn = new FileInputStream("statusfile.s... |
3e38793b-5808-44a0-992a-6fc80a1e3a7d | 2 | public static List<ActionType> selectActionType() throws SQLException {
String query = null;
List<ActionType> Action = new ArrayList<ActionType>();
ResultSet resultat;
try {
query = "SELECT * from ACTION_TYPE ";
PreparedStatement pStatement = (PreparedStatement)... |
cde70654-ae70-4302-8036-8ff0425f1ef0 | 3 | public ArrayList<int[]> generar() {
ArrayList<int[]> l = new ArrayList();
try {
BufferedReader in = new BufferedReader(new FileReader(this.document));
while (in.ready()) {
String tmp = in.readLine();
String[] tmpl = tmp.split(",");
... |
f35fca5d-263f-421e-90dd-627d9a7b447a | 7 | private void editSpecialAbilityDialog(SpecialAbility specialAbility) {
JLabel nameLabel = new JLabel("Name");
nameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
JTextField nameField = new JTextField(specialAbility.getName());
nameField.setAlignmentX(Component.LEFT_ALIGNMENT);
J... |
f4f744f8-e4da-4b4a-9179-98447210ac5e | 8 | public static final double extractDouble(String buffer, double def, boolean localized) {
buffer = normalizeNumber(buffer, localized);
double multiplier = 1;
if (hasBillionsSuffix(buffer)) {
multiplier = 1000000000;
buffer = removeSuffix(buffer);
} else if (hasMillionsSuffix(buffer)) {
multiplier = 1000... |
4a82bb18-cade-4eaf-8078-218b97ba3bac | 2 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns;
//Find the column.
int boardPositionColumn = boardPosition % columns;
//Position to ma... |
27a3d763-58b5-40e0-9575-c88a5ae09c25 | 9 | public double interpolate(double xx){
// check that xx and xx2 are within the limits
if(xx<x[0]){
if(xx>=x[0]-CubicInterpolation.potentialRoundingError){
xx=this.x[0];
}
else{
throw new IllegalArgumentException(xx + " is outside ... |
5f94b957-80ea-4cbb-84d7-0a7ed2e042f0 | 3 | @Override
public void run() {
int skok;
if( flaga ) skok = 1;
else skok = 2;
for ( int i=0; i < dane.dane.size(); i += skok ) {
try {
sleep( 500 );
} catch ( InterruptedException e ) {
e.printStackTrace();
}
... |
0df81624-4603-487f-9302-baed82581711 | 8 | public static void createProductFeatures(Long[] seeds)
{
System.out.println("Generating Product Features...");
ObjectBundle bundle = new ObjectBundle(serializer);
ValueGenerator valueGen = new ValueGenerator(seeds[0]);
DateGenerator publishDateGen = new DateGenerator(new GregorianCalendar(2000,05,20),new Grego... |
ab343b26-e983-4f97-8cc0-6204da468151 | 0 | private void setChatButtonClick() {
_view.send.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
Map<String, Object> m = new HashMap<String, Object>();
m.put("action", "chat");
m.put("message",
_model.user_name + ": " + _view.message.getText()... |
570170ab-ab92-4898-88dc-cb1afac8ddfa | 7 | private void startCalculation() {
if (Core.currentGame.getPlayerPos() == null) {
System.err.println("No player!");
return;
}
if (Core.currentGame.getGoalPos() == null) {
System.err.println("No Goal!");
return;
}
PathfinderAlgorithm... |
5f820835-c5ae-4d3d-8b88-408255922a04 | 0 | @After
public void tearDown() {
} |
4271a84a-a476-4275-9ec6-9e6b5d27a673 | 4 | public void getCredentials() throws IOException, GeneralSecurityException {
if (this.state != State.LOGGEDON) {
logon();
}
KeyPairGenerator localKeyPairGenerator = KeyPairGenerator
.getInstance("RSA");
localKeyPairGenerator.initialize(1024);
this.keypa... |
0df781f6-6ac3-443f-9020-c34bd9fffe0a | 8 | public String generateTerm(String id, List<TrigerState[]> signal){
BiNode start = null;
for (int i=0;i<signal.size();i++) {
int count_and = 0;
for (int j = 0; j < signal.get(i).length; j++) {
if(signal.get(i)[j] != TrigerState.DOES_NOT_MATTER){
... |
267ba10e-f759-4535-a4b2-1b7475591f65 | 7 | protected static boolean isIncomingRouteInfoBetter(int incomingSeqNum, int currentSeqNum, int incomingHopCount, int currentHopCount) {
if (Math.abs(incomingSeqNum - currentSeqNum) > Constants.SEQUENCE_NUMBER_INTERVAL) {
if ((incomingSeqNum % Constants.SEQUENCE_NUMBER_INTERVAL) >= (currentSeqNum % Constants.SEQUEN... |
e887630c-d5b2-480f-a665-7edd7e86c479 | 6 | @Override // instruct the compiler that we do indeed intend for this method to override the superclass' (Object) version
public boolean equals(Object o)
{
if(!(o instanceof Matrix)) // make sure the Object we're comparing to is a Matrix
return false;
Matrix m = (Matrix)o; // if the above was not true, we know ... |
52bfb795-db6c-4afc-9992-ed70b256d288 | 7 | private boolean checkServerButtons() {
int boxHeight = yMax / 13;
int ySpacing = yMax / 40;
int xSelectorShift = xMax / 50;
int ySelectorShift = yMax / 50;
if (checkButtonClick(xMax / 2, yMax / 10, boxHeight, xMax / 5)) {
//Row field clicked
focusedField = 1;
System.out.println("Row clicked");
ret... |
01adece2-cd4c-402c-a10f-6303ed70d1d8 | 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... |
47231419-22f2-4e89-8f51-13cd4879d319 | 2 | private void gameRender() {
if (dbImage == null) {
dbImage = createImage(pWidth, pHeight);
if (dbImage == null) {
EIError.debugMsg("dbImage is null");
return;
} else {
dbg = dbImage.getGraphics();
}
}
... |
f4cc3bc1-14f3-4a99-90db-8269114d620a | 7 | public void skipToEndOfLine() throws IOException {
char ch;
do {
ch = read();
if (hasComments) {
if (ch == lineComment) {
skipComments(ch);
break;
}
if (ch == startComment) {
... |
b6cde591-c634-4c28-9f0f-8e670cb1cb88 | 0 | @Override
public void init(ILogger logger) throws Exception {
setLogger(logger);
this.logger.info(getName() + " initialization execute.");
doInit();
this.logger.info(getName() + " initialization success.");
} |
740e24d6-b68b-4f1d-9bff-ffe3957afa4a | 9 | public int candy(int[] ratings) {
// handle the null case
if (ratings == null)
return 0;
int size = ratings.length;
// return if size is 0 or 1
if (size < 1)
return 0;
if (size == 1)
return 1;
int[] candys = new int[size];
int i;
// initialize the candy array, allocate 1 candy for each child
... |
e9b82e49-095f-437d-9394-5343afe9978d | 3 | public void setCurrentFont(Font font) {
mNoNotify = true;
mFontNameMenu.setSelectedItem(font.getName());
if (mFontNameMenu.getSelectedItem() == null) {
mFontNameMenu.setSelectedIndex(0);
}
mFontSizeMenu.setSelectedItem(new Integer(font.getSize()));
if (mFontSizeMenu.getSelectedItem() == null) {
mFontS... |
4098db24-421f-4c93-b66b-25260239b5cc | 2 | public static String readFirstLine(String urlString, int msTimeout)
{
try {
final URL url = new URL(urlString);
if (msTimeout > 0)
{
ExecutorService executor = new ForkJoinPool(1);
Future<String> result = executor.submit(new Callable<String>() {
@Override
public String call() throws Except... |
f99ba76b-3d4e-49fe-936e-767b1c62019f | 0 | public float getA() {
return a;
} |
7dc00720-c61d-4004-b722-fa20cfa36e28 | 7 | private boolean jj_3R_84() {
if (jj_scan_token(QUEST)) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_89()) {
jj_scanpos = xsp;
if (jj_3R_90()) return true;
}
xsp = jj_scanpos;
if (jj_scan_token(62)) {
jj_scanpos = xsp;
if (jj_3R_91()) return true;
}
xsp = jj_sca... |
a4cd2db9-e267-4442-85d8-7d2da7c08a93 | 5 | private void fillIndexed(Parameter parameter)
{
Class<?> clazz = parameter.getType();
if (clazz.isEnum() && FixedValues.class.isAssignableFrom(clazz))
{
if (parameter.getGreed() != 1)
{
throw new IllegalArgumentException("Fixed Values can only have a g... |
484f3b79-80d5-47a6-87a3-1ae5d06ec702 | 1 | private boolean jj_3_64() {
if (jj_scan_token(MOD)) return true;
return false;
} |
c5325bad-f661-43f7-9d0e-8824099c1002 | 9 | public static String normalizeWord(String word) {
try {
int i;
Class<?> normalizerClass = Class.forName("java.text.Normalizer");
Class<?> normalizerFormClass = null;
Class<?>[] nestedClasses = normalizerClass.getDeclaredClasses();
for (i = 0; i < neste... |
24500279-cd13-4edc-a2ad-88cb3328fa70 | 4 | @Override
public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) {
//Shrine creation for players only!
if(!(sender instanceof Player))
return false;
if(args.length < 1)
return false;
/*
* adding a shrine to cache
*/
Player player = (Player) sender;
Se... |
85d5a66f-9091-49cf-b806-d938edf30ec1 | 1 | public void setMaxRef(int maxRef) {
if (maxRef < 0) {
throw new IllegalArgumentException("A negative maxRef was given.");
}
maxRef_ = maxRef;
} |
d00026bd-af31-41db-b34a-818911d2a28a | 7 | private Enemy withinRange(int tp)
{
List<Actor> temp = getObjectsInRange(range/2, Enemy.class);
ArrayList<Enemy> enemyList = new ArrayList();
Enemy targetEnemy = null;
if (temp.size() > 0){
if (tp == 1){
Enemy e;
double hyp = range;
... |
9a7da351-9733-4fb0-915f-dd1af400aa0c | 4 | public Node findLeafToInsert(MyRecord record, Node node){
if(node.isLeaf()){
return node;
}
else{
int flag=0;
for(int i=0;i<node.getKeys().size();i++){
if(node.getKeys().get(i).getName().compareTo(record.getName())>0){
node=node.getChildren().get(i);
flag=1;
break;
}
}
if(fla... |
0b6040d1-7149-4568-8720-4561bac7509b | 1 | public void visitForceChildren(final TreeVisitor visitor) {
if (visitor.reverse()) {
right.visit(visitor);
left.visit(visitor);
} else {
left.visit(visitor);
right.visit(visitor);
}
} |
d148682d-a575-44f8-b6d3-17179fcbf9a9 | 4 | public Room getRoom(int x, int y){
//if(newRoom==null){ ?? }
if((x<0) || (x>=worldWidth)){
throw new IllegalArgumentException("Room xLocation " +x
+" out of bounds. It must be between 0 and "+(worldWidth-1)+".");
}
if((y<0) || (y>=worldWidth)){
th... |
59d3a829-fb96-4cc3-b8f5-49f834a26bb0 | 5 | private Set<String> reduceKeywordSet(String urlChunk, Set<String> fullKeywordSet) {
List<String> keywordsOrdered = new ArrayList<>(fullKeywordSet);
Collections.sort(keywordsOrdered, new KeywordComparator());
for (String keyword : keywordsOrdered) { // give preference to longer keywords.
... |
85cdf174-2d1b-4822-b6c9-fcafd7db77d7 | 8 | public void readAttribute(byte[] data, int offset, int length)
throws RadiusException {
// check length
if (length < 6)
throw new RadiusException("Vendor-Specific attribute too short: "
+ length);
int vsaCode = data[offset];
int vsaLen = ((int) data[offset + 1] & 0x000000ff) - 6;
if (vsaCode != V... |
8ce97d1d-a7ae-406d-92d4-02e452bd25df | 0 | protected String getLabel(Instrument instrument) {
String label = instrument.name();
long time = new java.util.Date().getTime();
label = label.substring(0, 2) + label.substring(3, 5);
label = label + time;
label = label.toLowerCase();
return label;
} |
d2e6387d-55f6-403f-8cbe-5b83d2ff9758 | 2 | private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
TOTALHT = TOTALHT =0F;
TOTALTVA = TOTALTVA =0F;
TOTALTTC = TOTALTTC =0F;
try {
//String datecmd,int id_entreprise,int id_commercial
Entre... |
939cfe6a-4b86-4698-ac44-49d045168392 | 8 | private void setWaveNums() {
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
boolean stop = true;
ArrayList<Cell> markedCells = new ArrayList<>();
markedCells.add(begin);
stop = true;
for (int j = 0; j < markedCells.size(); j++) {
Cell ... |
315fabca-536c-43a7-accf-d18b7d7a4db3 | 1 | public void visitStackExpr(final StackExpr expr) {
// Stack change
sideEffects |= SideEffectChecker.STACK;
if (expr.isDef()) {
sideEffects |= SideEffectChecker.STORE;
}
expr.visitChildren(this);
} |
1fb7351d-5476-4768-a11f-9c6d55e2d228 | 7 | public static boolean slotNameConflictP(Slot slot, Stella_Class renamed_Class) {
{ Symbol name = slot.slotName;
String nameString = name.symbolName;
{ Slot siblingslot = null;
Cons iter000 = renamed_Class.classLocalSlots.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.re... |
a79ab290-da3d-4132-b725-be32534f4cf8 | 6 | public static ExternalRefs fromBytes(InputStream rawBytes) throws IOException {
DataInputStream inputStream = new DataInputStream(rawBytes);
int count = inputStream.readByte();
if (count > 127) {
throw new IOException("Parse Error: count out of range [0, 127]");
}
Li... |
88b801ac-e9be-4b36-9d56-32f426c3c309 | 9 | public void revertToLastSnapshot()
{
Task revertTask;
try {
revertTask = vm.revertToCurrentSnapshot_Task(host);
if (revertTask.waitForMe() == Task.SUCCESS) {
System.out.println("Reverted Back to Snapshot");
powerOn();
}
} catch (VmConfigFault e) {
// TODO Auto-generated catch block
e.print... |
779d6565-42d5-48be-bbf0-5257b0cd9c5b | 7 | private static File extractLibraryFile(String libFolderForCurrentOS,
String libraryFileName, String targetFolder) {
String nativeLibraryFilePath = libFolderForCurrentOS + "/" + libraryFileName;
File extractedLibFile = new File(targetFolder, libraryFileName);
try {
if (extractedLibFile.exists())... |
31c576a8-4b92-4659-b08e-5de8550c892d | 6 | private String[] getDisabled() {
disabledMods.clear();
if(folder.exists()) {
for(String name : folder.list()) {
if(name.toLowerCase().endsWith(".zip.disabled")) {
disabledMods.add(name);
} else if(name.toLowerCase().endsWith(".jar.disabled")) {
disabledMods.add(name);
} else if(name.toLower... |
7b190eb9-c066-4602-9807-41c23c0a25d9 | 1 | private boolean jj_3_65() {
if (jj_scan_token(EQUALEQUAL)) return true;
return false;
} |
09edc633-d38a-4608-9e6d-dcc3c8006513 | 1 | private void writeClassInfo(final DataOutputStream out) throws IOException {
out.writeShort(thisClass);
out.writeShort(superClass);
out.writeShort(interfaces.length);
for (int i = 0; i < interfaces.length; i++) {
out.writeShort(interfaces[i]);
}
} |
398d049b-60f8-4c12-9a86-7e61eb1d3146 | 6 | @Override
public String correrAlgoritmo() {
for (Regla r : conjuntoDeReglas) {
boolean seCompletaLaRegla = true;
// La bandera de cumpliemento de regla cambiara si y sólo si el elemento
// definitivamente no está en ninguna de las tres listas
for (String s :... |
06782c9e-8788-4f8e-b6a7-ee0c0933eabb | 0 | public void onAccount(IAccount account) throws JFException {
} |
d3bab11d-af15-4208-9133-1b5b5cd88666 | 2 | public void im(Object[][] g) {
for (int i = 0; i < g.length; i++) {
for (int j = 0; j < g[0].length; j++) {
System.out.print(g[i][j] + " ");
}
System.out.println("");
}
} |
5da7c351-2fcc-49ae-9766-7227af3765a4 | 3 | * @return The starting x-coordinate for the specified column index.
*/
public int getColumnIndexStart(int columnIndex) {
int pos = getInsets().left;
for (int i = 0; i < columnIndex; i++) {
Column column = mModel.getColumnAtIndex(i);
if (column.isVisible()) {
pos += column.getWidth() + (mDrawColumnDivid... |
97c6c7c6-fcec-475f-a175-ad67442d908d | 4 | @Test
public void testGetMstxAdsImageByGpid() {
int gpid = 0;
Blob blob = MstxDao.getMstxAdsImageByGpid(gpid);
InputStream is = null;
try {
is = new BufferedInputStream(blob.getBinaryStream());
byte[] buf = new byte[1024];
int len = 0;
String PATH = "D:\\image\\face\\";
String fileName = PAT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.