method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1e527332-c956-42cb-af32-92690b97cf7b | 6 | private String contentMix(ArrayList<String> bodyTxt,ArrayList<String> bodyPic,String IP_PORT,String apiKey,String curl){
String cont = "";
FileService fileService = new FileService();
int i;
for(i=0;i<bodyTxt.size() && i<bodyPic.size();i++){
String paragraph = bodyTxt.get(i).... |
9caa75c4-7604-4f22-a151-c9ced8741fa7 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
} |
75daeb02-96cf-45b8-86a9-da81c4467802 | 8 | void select() throws ScriptException {
// NOTE this is called by restrict()
if (statementLength == 5 && statement[2].tok == Token.bonds && statement[3].tok == Token.bitset) {
viewer.selectBonds((BitSet) statement[3].value);
return;
}
if (statementLength == 5 && statement[2].tok == Token.monitor && statem... |
713a8d46-e208-44ec-9a41-e1fd37c6d5f5 | 3 | @Override
public void removeTable(final String tableName) throws IOException {
checkName(tableName);
String fullPath = tableDir + File.separator + tableName;
File file = new File(fullPath);
if (!file.exists()) {
throw new IllegalStateException("Table not exist already!")... |
b59864ce-c293-423f-ba67-3e3e9ed79771 | 5 | public static float calcCommission (float salesAmount){
double dcommission = 0;
float fcommission = 0;
if (salesAmount < 200) {
dcommission = salesAmount * 0.03;
fcommission = (float)dcommission;
} else if (salesAmount >= 200 && salesAmount < 500) {
dcommission = salesAmount *... |
22470756-2cc3-4372-9b3e-7064cc0974af | 2 | protected void die() {
super.die();
int count = random.nextInt(2) + 1;
for (int i = 0; i < count; i++) {
level.add(new ItemEntity(new ResourceItem(Resource.cloth), x + random.nextInt(11) - 5, y + random.nextInt(11) - 5));
}
if (level.player != null) {
level.player.score += 50 * lvl;
}
} |
f33a7840-4844-407a-a80a-8a0045225b54 | 9 | public EditInvoiceDialog(java.awt.Frame parent, boolean modal, EditInvoiceDelegate delegate, Invoice oldinvoice) {
super(parent, modal);
initComponents();
datepicker.setEditable(false);
this.delegate = delegate;
setTitle("Factuur wijzigen");
comboPriceClass.addI... |
9bd37edc-5316-42d4-bb72-f57bfc4e4544 | 6 | public void doExperiment()
{
for(Node n : graph.getNodes())
{
int n_out = n.getToNode().size();
int n_in = n.getFromNode().size();
if(n_out == 0)
num_of_sinks++;
if(n_in == 0)
num_of_sources++;
if(n_out != n_in)
is_balanced = false;
if(n_out+n_in > highest_degree)
high... |
12a88c6b-cc2e-4b0f-bd3f-c05da261cc7b | 8 | public static FilterConfig XML2java(Element root) {
FilterConfig filterConfig = new FilterConfig();
Iterator rootIter = root.elementIterator();
while (rootIter.hasNext()) {
Element element = (Element) rootIter.next();
if (element.getName().equals("source")) {
filterConfig.setSource(ParserUtil.parserSou... |
952176d7-f10c-4bb5-93e5-e3da2a6bed4c | 6 | public void display(Graphics g){
// Affichage wallpaper
if(display)
g.drawImage(i, 0, 0, this);
// Actualisation affichage Jtf/Jb
jtf.repaint();
jb.repaint();
jb2.repaint();
// Affichage Chrono
g.setFont(new Font("serif", Font.PLAIN, 41));
g.setColor(new Color(255,255,240));
g.fillRect(789, 60... |
5c247d9a-805a-4151-b144-3f0692136841 | 9 | public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
throws SAXException {
//Handle accumulated text
finishText();
insideElement = localName;
int i;
if (VariableXmlNames.ELEMENT_Parameters.equals(localName)) {
variables = new VariableMap()... |
cde5a7fd-b41d-4faa-8c40-969f534a601e | 0 | public static void increment() {
value.set(value.get() + 1);
} |
7488c061-cd37-4db2-a7c5-1e37d59feb30 | 1 | public int getElement(int i, int j) throws MatrixError {
try {
return array2d[j][i];
} catch(IndexOutOfBoundsException e) {
throw new MatrixError();
}
} |
a7a37653-0a22-44d7-9dc9-079efea1f602 | 8 | static void readTestFile(String fname){
Scanner inFile;
File readIn=new File(fname);
try {
inFile = new Scanner(readIn);
int i=0;
String[]temp;
int count=0;
while(inFile.hasNextLine()){
inFile.nextLine();
count++;
}
testData=new double[count-1][totalGenes.length];
inFile.close();
... |
a9b1c1fc-c00d-4e9b-ba95-d135c256bd46 | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!CMLib.flags().isAnimalIntelligence(mob)))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||(mob==killer)))
return t... |
c45e6f9a-85b1-4e9e-80a3-f99c3633655c | 9 | public static void loadLocal(final List<ScriptInfo> scripts, final File directory) throws ClassNotFoundException, InstantiationException, IllegalAccessException, FileNotFoundException, IOException {
final List<File> classes = new ArrayList<File>();
for (final File file : directory.listFiles()) {
... |
1cdef3e9-58bd-4179-9e7d-8aa7a51bffe9 | 7 | public static void main(String[] args)
{
//process the input first
//if the input is from the console
Scanner in = null;
if (args.length == 0)
{
in = new Scanner(System.in);
}
else if (args.length == 1)
{
File file = new File(args[0]);
if (!file.exists() || !file.canRead()) {
System.err... |
bb3d7a16-d729-4eba-86a3-2c70f829eff4 | 5 | private String showSeedPrompt(String title)
{
final String blankText = "A random seed will be generated if left blank.";
final String leadingSpaceText = "Warning: There is a space at the start!";
final String trailingSpaceText = "Warning: There is a space at the end!";
... |
28125bf0-1887-48be-bff2-58450259987b | 2 | private double[][] oneToTwo(double[] errors, int nCols){
int nRows = errors.length;
double[][] ret = new double[nRows][nCols];
for(int i=0; i<nRows; i++){
for(int j=0; j<nCols; j++){
ret[i][j] = errors[i];
}
}
return ret;
} |
bcf89bed-a64d-49c0-814e-1bbc7e6b7ff1 | 2 | private void insertPartsupps(int numInserts, int firstPartNode,
int numParts, int firstSupplierNode, int numSuppliers) {
for (int i = 0; i < numInserts; i++) {
ArrayList<Integer> pk;
int partNode, supplierNode;
do {
pk = new ArrayList<Integer>(2);
partNode = firstPartNode + r.nextInt(numParts);
... |
a8cbcd7b-841f-4ce8-905c-a1f75547d7d5 | 0 | public PropertyNotFoundException(String propertyName, String msg) {
super(msg);
this.propertyName = propertyName;
} |
71bae8be-9a6a-4dc1-baf8-6720a799b70b | 3 | public static void mouseToggle(MouseEvent e, boolean toggle)
{
if(e.getButton() == MouseEvent.BUTTON1) //left click
Main.isMouseLeft = toggle;
else if(e.getButton() == MouseEvent.BUTTON2) //middle click
Main.isMouseMiddle = toggle;
else if(e.getButton() == MouseEvent.BUTTON3) //right click
Main.isMous... |
d1f76788-a8b7-4e1f-84c4-e7216a83ddda | 3 | public SpriteList() {
setTitle("Sprite List");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 325, 500);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLa... |
66243962-1208-4962-92ec-439c6fc1a55b | 7 | public static RegistrationData parseFromXmlElement (Element elem) {
String regId = elem.getAttribute("id");
String courseId = elem.getAttribute("courseid");
RegistrationData data = new RegistrationData();
data.setRegistrationId(regId);
data.setCourseId(courseId);
ArrayList instances = data.getInsta... |
00086c3a-6dac-4345-a93e-36808dec7318 | 1 | public void atira() {
if (quantMunicao > 0) {
this.municao.add(new Municao(pos.x + largura / 2, pos.y, 0, -5));
this.municao.add(new Municao(pos.x + 9, pos.y + 24, 0, -5));
this.municao.add(new Municao(pos.x + largura - 9, pos.y + 24, 0, -5));
quantMunicao -- ;
... |
b04e44cc-e68f-477a-ae57-71766c54fad3 | 2 | public void handleCommand(){
String text = input.getText();
try {
log.getDocument().insertString(log.getSelectionEnd(), text+"\n", new SimpleAttributeSet());
} catch (BadLocationException e1) {
e1.printStackTrace();
}
input.setText("");
entries.add(0,text);
index = -1;
if (!text.trim().equals(""))... |
22919900-f655-42af-8f73-82b3420c873b | 7 | public ArrayList< Move > playerOneMove( Coordinate current )
{
ArrayList< Move > moves = new ArrayList< Move >( );
//gets player 1 king moves
if( isPlayerOne( current ) )
{
//checks move to the bottom right of current checker
if( isEmpty( current.bottomRight( ) ) )
{
//adds the possible move to... |
50c6b872-cba6-4fb2-95cf-3e9ed7f9e1e2 | 7 | public double targetFunctionValue(int k, int n, Point[] centres, Point[] points) {
int i = 0;
double sum = 0.0;
for (i = 0; i < n; i++) {
double nearestCost = -1.0;
int j = 0;
for (j = 0; j < k; j++) {
double distance = 0.0;
int... |
87096ce5-fab7-4a47-8b9a-c25dce90902b | 0 | private void refreshLabels() {
openGuiMenuItem.setLabel(constsAndProps.getLanguage().getLabel("menu_openchatview"));
settingsMenuItem.setLabel(constsAndProps.getLanguage().getLabel("menu_file_settings"));
quitMenuItem.setLabel(constsAndProps.getLanguage().getLabel("menu_file_quit"));
} |
89d21971-5df5-4e24-8076-ab6c5dc4dbe6 | 2 | public boolean hasBettedOnBlock(Player player, Block bet) {
if(! bets.containsKey(player))
return false;
if(bets.get(player).contains(bet))
return true;
return false;
} |
d02b183b-5b79-4873-8f9d-a43430a52446 | 7 | public static void main(String[] args) {
Generator generator = new Generator();
boolean showTree = false;
if (args.length > 0 && args[0].equalsIgnoreCase("-t")) {
showTree = true;
}
try {
String input = generator.in.readLine();
while (input != ... |
d8c8a875-e7e1-4b9e-ae18-664fe436b7e1 | 1 | public void atNewExpr(NewExpr expr) throws CompileError {
if (expr.isArray())
atNewArrayExpr(expr);
else {
CtClass clazz = resolver.lookupClassByName(expr.getClassName());
String cname = clazz.getName();
ASTList args = expr.getArguments();
atMe... |
66505877-274f-4461-9dd8-6a2af559d1e0 | 9 | private void loadProperties() {
Properties prop = new Properties();
try (InputStream stream = new FileInputStream(PROPFILE_PATH)) {
prop.loadFromXML(stream);
} catch (IOException e) {
// ignore this
}
String[] bounds = prop.getProperty(PROPKEY_WINDOW_BOUNDS, "")
.split(",");
if (bounds.length == 4 && ... |
3c5de8be-1718-4160-a455-29e2546c2df5 | 6 | public void close() throws IOException {
if (out != null) {
if (!finished) {
try {
writeEndMarker();
} catch (IOException e) {}
}
try {
out.close();
} catch (IOException e) {
if (... |
243bbc90-0b5f-4a83-8ee3-06dfba5e2905 | 6 | public FirstWin() {
initComponents();
try {
mapModel = new MapModel ();
mapView = new MapView ( mapModel );
windowModel = new WindowModel ( mapView );
} catch ( Exception e ) {
e.printStackTrace ( System.err );
}
//drawSpace.setBac... |
9a4daf7f-49cf-4369-b572-7d494cf82be5 | 0 | public Boolean setDealerWin(Boolean dealerWin) {
this.dealerWin = dealerWin;
return dealerWin;
} |
48d39eaa-102a-49f4-86bd-de001fcdcde6 | 2 | private void composeEventList(){
Iterator<Event> eventIter = Runtime.eventQueue.iterator();
for(int i = 0; i < queueElements.length; i++){
if(eventIter.hasNext()){
Event e = eventIter.next();
queueElements[i].setText(e.getEventListText(false));
queueElements[i].setToolTipText(e.getEventListToolTipTex... |
b98e8d68-9dd3-4cf2-ae7c-fd0729d3dd6c | 5 | @Override
public String comer(int fila, int columna, int turno) {
if(columna-1==this.columna||columna+1==this.columna){
if(turno == 1){
if(this.fila>fila){
return "|PB|";
}
}
else{
if(this.fila<fila){
... |
f6470529-006d-4b98-8ab3-010cd94acea3 | 2 | @Override
public boolean execute(Player player) {
if(!this.hasSecondWord()) {
// if there is no second word, we disable the seed...
GameEngine.gui.println("Random enabled.");
RoomRandomizer.setSeed(null);
}
else
{
try{
RoomRandomizer.setS... |
97074637-5023-4967-8b1f-3152ae92b7c6 | 5 | public static int find(String str) {
if (str.isEmpty()) {
return -1;
} else if (str.charAt(0) == '1') {
return 0;
} else if (str.charAt(str.length() - 1) == '0') {
return -1;
}
int low = 0;
int high = str.length() - 1;
while (lo... |
e8e3f687-c48a-4eef-9147-4c0279fa12e8 | 8 | @Override
public Component getTableCellEditorComponent(JTable table, Object value,
boolean isSelected, int row, int column) {
component = new JTextField("");
if(column == BeanTreeTableModel.ColNames.CUR_VAL.ordinal()) {
Object pathCompon... |
d9abbfd7-26e4-4d81-9036-b62342dd8eab | 2 | @Override
public void caseAMinusOp(AMinusOp node)
{
for(int i=0;i<indent;i++) System.out.print(" ");
indent++;
System.out.println("(Minus");
inAMinusOp(node);
if(node.getMinus() != null)
{
node.getMinus().apply(this);
}
outAMinusOp(node);
... |
36c325b5-150e-42d2-844e-eded9aa5be1b | 2 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if(args.length==0){
TeleportsManager.tpAll(sender,sender.getName());
return true;
}
if(args.length==1){
TeleportsManager.tpAll(sender,args[0]);
return true;
}
return false;
} |
5c12b740-d6ea-4b27-af2c-ee142d9d4dd6 | 4 | public void update(){
if(beginningAnimation){
AffineTransform transform = new AffineTransform();
transform.translate(WIDTH/2-scaleFirst*WIDTH/2, HEIGHT/2-scaleFirst*HEIGHT/2);
transform.scale(scaleFirst,scaleFirst);
Graphics2D g2d = (Graphics2D)beginningImage.getGraphics();
g2d.setRenderingHint(Renderi... |
310e2ed1-5262-4280-8afe-bbecda70f3c2 | 5 | public static void main(String[] args) throws Exception {
SMPLEnvironment environment = new SMPLEnvironment();
SMPLEvaluator visitor = new SMPLEvaluator();
System.out.println("SMPL Interpreter.");
System.out.println("Press Ctrl-C to exit");
if (args.length == 0) {
w... |
22771c3f-d946-4f1e-b324-2ae8241342b1 | 1 | public void prune() {
if (wasPruned)
return;
wasPruned = wasFrozen = true;
getClassFile2().prune();
} |
05082e88-0311-4434-aeeb-c3fc19c251a6 | 0 | @Override
public String getAcademicLevel() {
return super.getAcademicLevel();
} |
11f6e6ce-2289-4a35-9d24-bc421dc4c211 | 7 | public void browseForFile() {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setAcceptAllFileFilterUsed(true);
String extension = this.editedOption.getDefaultFileExtension();
if (extension != null) {
fileChooser.addChoosableFileFilter(new FileExtensionFilter(
... |
88ef6369-54c6-4c90-b99c-dbcbf2067dd0 | 8 | @Override
public String assembleFilePath(HTTPRequest request)
{
final String[] url = request.getUrlPath().split("/");
final StringBuilder fullPath = new StringBuilder("/");
if(url.length > 1)
{
final List<String> fixedUrl=new ArrayList<String>(url.length-1);
for(int i=1;i<url.length;i++)
if(url[i].e... |
b45814e2-8aa2-4683-baef-b832dac67c81 | 2 | @Override
public int compareTo(Card card) {
if (value.ordinal() > card.value.ordinal())
return 1;
else if (value.ordinal() < card.value.ordinal())
return -1;
return 0;
} |
3f479e80-e2e0-417a-a359-e313d256276c | 6 | public void parseAttributeElements(Element element, Object target, IElementParser parser) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, InstantiationException, ClassNotFoundException {
Class clazz = target.getClass();
NodeList children = element.getChildNodes();
... |
b4ff3810-bbf7-4966-af1e-82ce53b870dd | 8 | private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed
if (lab_modo.getText().equals("Alta")){
if (camposCompletos()){
ocultar_Msj();
insertarCta();
camposEditables(false);
... |
886b4ada-a928-4b3a-9b4b-d2d61d1dad7c | 1 | @Override
public void removeServerStartListener(ServerStartListener listener) {
if (serverStartListenerList != null) serverStartListenerList.remove(ServerStartListener.class, listener);
} |
372677ea-7668-4fe4-b413-01febbb8eb43 | 4 | protected boolean in_grouping(char [] s, int min, int max)
{
if (cursor >= limit) return false;
char ch = current.charAt(cursor);
if (ch > max || ch < min) return false;
ch -= min;
if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false;
cursor++;
return true;
} |
a6055aee-a50a-4c1d-9c14-58448b427a5c | 8 | private Set<TKey<?, ?>> setupPortalKeys() {
Set<TKey<?, ?>> portalKeys = new HashSet<>();
portalKeys.add(DatasetKeys.PORTAL_STATUS);
portalKeys.add(DatasetKeys.LINK);
portalKeys.add(DatasetKeys.NOTE);
validQualifiers.put(DatasetKeys.LINK, new HashSet<Class<? extends Enum<?>>>()... |
8a131b78-6aea-4c3f-9211-029ff7bc0697 | 1 | public void readFileIntoMemory(String fileName, int lineNum)
throws IOException {
File file = new File(fileName);
BufferedReader br = new BufferedReader(new FileReader(file));
String line = br.readLine();
int headVertex = 0;
int tailVertex = 0;
// int lineNo =0;
while (line != null) {
// lineNo++;
... |
e3a38045-812c-4efc-a97b-90062cf71677 | 1 | private void increment() {
for (int i = 0; i < 10000; i++) {
count++;
}
} |
577250cd-365b-4fff-a54a-fed327e4497c | 3 | public boolean adjacentTo(Point p) {
int dx = x - p.getX();
int dy = y - p.getY();
return dx >= -1 && dy >= -1 && dx <= 1 && dy <= 1;
} |
c1973f03-84fb-4b4e-a7e0-b96da0e1a581 | 2 | protected Rectangle getCropRect (Node contNode) throws ParseException {
logger.entering(getClass().getName(), "getCropRect", contNode);
Rectangle cropRect = null;
String strValue = getProcessingInstructionValue(contNode, "crop-rect");
if (strValue != null) {
String[] s = strV... |
4256f3e8-a8f3-4754-8bc3-2ad61a7268c3 | 7 | public float getY(float percent) {
// No movement
if(pattern[1] == 0) { return (float)(0+offset[1]); }
// Top to bottom
if(pattern[1] == 1) { return (float)(percent*600.0-50.0+offset[1]); }
// Moves downward, stops for a while, then continues on downward
if(pattern[1] == 2) {
if(percent <... |
32bd8d4e-923b-4781-97b4-064e77a56b89 | 2 | public boolean getWparamAsBoolean() {
int intValue = byteArrayToInt(this.wparam);
if(intValue == 1) {
return true;
} else if(intValue == 0) {
return false;
} else {
throw new IllegalArgumentException("The wParam should be 0 or 1, but was ");
}
... |
78c96441-89aa-4153-8635-2ced457c1edc | 0 | @Test
public void runTestLibrary2() throws IOException {
InfoflowResults res = analyzeAPKFile("AndroidSpecific_Library2.apk");
Assert.assertEquals(1, res.size());
} |
ba828d0a-f5ce-43f5-90e4-84ac0b84e54f | 5 | @Override
public Iterator<E> iterator() {
switch (type) {
case NEIGHBOURS: return new ItrNeigh<E>(grid, size, row, column, inc);
case ALL: return new ItrAll<E>(grid, size, row, column, inc);
case ROW: return new ItrRow<E>(grid, size, row, column, inc);
case CO... |
dea66017-9970-4ba2-872d-512323afeec9 | 2 | private void extractValues(HttpServletRequest request) {
for (Enumeration<String> e = request.getAttributeNames(); e.hasMoreElements();) {
String attrName = e.nextElement();
this.requestAttributes.put(attrName, request.getAttribute(attrName));
}
this.requestParameters.put... |
e2392c42-f072-4e77-b68a-0fe6e564a46a | 6 | public void validarRutasSalida(String[] rutas) throws FileNotFoundException, CancellationException {
for (String ruta : rutas){
File f = new File(ruta);
File dir = f.getParentFile();
if (!dir.exists() || !dir.isDirectory()){
throw new FileNotFoundException("El directorio " + dir.getPath() + " no existe."... |
180f3059-bd1c-4be8-b811-31a6586c3c09 | 9 | private static String[] restoreLIrregular(String start, String end) throws MorphException {
if(start.length()<2) return null;
char ch1 = start.charAt(start.length()-2);
char ch2 = start.charAt(start.length()-1);
char[] jasos1 = MorphUtil.decompose(ch1);
if(((jasos1.length==3&&jasos1[... |
16195ccf-8b38-4d35-8197-76a9b794f953 | 5 | private Menu createPopUpMenu() {
Menu popUpMenu = new Menu(shell, SWT.POP_UP);
/**
* Adds a listener to handle enabling and disabling
* some items in the Edit submenu.
*/
popUpMenu.addMenuListener(new MenuAdapter() {
public void menuShown(MenuEvent e) {
Menu menu = (Menu)e.widget;
MenuItem[] items =... |
d0ca0df3-380a-4396-bb85-cabbbc8f3f1f | 8 | void loopGetCommandFromInteractiveForExec(WriteLog writeLog,List<ServerInfo> objects){
HelpPrompt.printAskExecCommand();
String command = getInputContent();
if (! FunctionKit.checkStringLengthIsZero(command)) {
HelpPrompt.printInputError();
} else if ("q".equals(command) || "... |
147f22c0-8db7-484f-8506-0885cdf3194e | 7 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(vue.getAjouterButton())) {
actionAjouter();
} else if(e.getSource().equals(vue.getRetirerButton())) {
actionRetirer();
} else if(e.getSource().equals(vue.getRecettesButton())) {
... |
70724cb7-a8f0-4716-8ea8-4fb9e3a16bec | 0 | @Override
public void testRunFinished(Result result) throws Exception {
super.testRunFinished(result);
final String valueOf = String.valueOf(getResults());
try {
IOUtil.copy(valueOf.getBytes(UTF8), out);
} finally {
out.close();
}
} |
4a08d0e6-795f-4698-a025-8dc7fc53cf58 | 7 | public DependencyStructure parse(DependencyStructure goldDependencyGraph, DependencyStructure parseDependencyGraph) throws MaltChainedException {
parserState.clear();
parserState.initialize(parseDependencyGraph);
currentParserConfiguration = parserState.getConfiguration();
parseCount++;
if (diagnostics == tru... |
8cbd5873-dd54-475e-ae00-a72db482a3fe | 7 | public void handleDocumentEnd(final long endTimeNanos, final long totalTimeNanos, final int line, final int col)
throws ParseException {
if (this.requireBalancedElements && this.elementStackSize > 0) {
final char[] popped = popFromStack();
throw new ParseException(
... |
7503b5d5-8103-4e25-a518-e5406015c6f1 | 8 | private Entry<K,V> getCeilEntry(K key) {
Entry<K,V> p = root;
if (p==null)
return null;
while (true) {
int cmp = compare(key, p.key);
if (cmp == 0) {
return p;
} else if (cmp < 0) {
if (p.left != null)
... |
69e442db-5b77-4255-8d53-4d36be9bf24b | 8 | public Object calculate(SecuredTaskBean task) throws GranException {
HashMap<String, SecuredUDFValueBean> m = task.getUDFValues();
SecuredUDFValueBean faq = m.get(INCIDENT_PRODUCT_UDFID);
StringBuffer bf = new StringBuffer();
boolean emptyFAQ = true;
if (faq != null) {
... |
8aed873b-b049-4a58-abef-51063961419b | 0 | public static void main(String[] args) {
Inner.InnerClass innera = new Inner.InnerClass();
innera.run();
} |
d079a907-7e3d-4740-8b1a-2a90800e2604 | 0 | public static Forme U() {
ArrayList<Vecteur> liste = new ArrayList<>();
liste.add(new Vecteur(0, 0));
liste.add(new Vecteur(1, 0));
liste.add(new Vecteur(1, 1));
liste.add(new Vecteur(1, 2));
liste.add(new Vecteur(0, 2));
Vecteur<Integer> _centre = new Vecteur(1, ... |
ff28f218-2319-41a0-9a0f-c072e1d5e90a | 5 | @Test
public void testWriteLegacyFromScratch() {
//Reset schemas
try {
PageXmlInputOutput.setAdditionalSchemaLocation(null, null);
} catch (NoSchemasException e1) {
e1.printStackTrace();
}
Page pageFromScratch = new Page();
//Try to write without conversion
PageWriter writer;
try {
write... |
f8592f34-3253-4931-99de-8a97a884b13a | 1 | @BeforeClass
public static void beforeClass() throws IOException {
persistenceDelegate_ = new XMLPersistencyService();
RoutingTable routingTable = new RoutingTable();
localpeer_ = new PGridHost("localhost", 3000);
localpeer_.setHostPath("000");
localpeer_.setTimestamp(10000... |
58fd6878-0da9-4ffb-93e1-c0e0b6e1d666 | 4 | public static void removeStaff(String staffID){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
Prepared... |
fe61b22a-df2e-4ba5-9e15-08511a769513 | 7 | static private final boolean cons(int i)
{ switch (b[i])
{ case 'a': case 'e': case 'i': case 'o': case 'u': return false;
case 'y': return (i==0) ? true : !cons(i-1);
default: return true;
}
} |
c2c01407-a232-4656-bdb6-d330007f1a79 | 4 | public Response service(HashMap<String, String> requestData){
if(requestData == null){
return null;
}
Response responseMessage = null;
try{
String request = requestData.get(HttpConstants.REQUEST);// 获取请求接口
if(compareService(request,VANK_PUBLISH_ARTICLE)){//上传图片
String fileName = requestData.... |
ab78c374-b4d5-4548-a437-00e1e311075b | 0 | public String getRNC() {
return RNC;
} |
f1cb857b-2e63-4e4e-9a9e-324c36ebb0db | 3 | public void drawEnemies(Graphics2D g2d, Enemy enemies[], int[] screen) {
for(int i = 0; i < enemies.length; i++) {
try{
if(enemies[i].living) {
enemies[i].draw(g2d, screen, this);
}
} catch (NullPointerException e) {
// we don't need to do anything here, but let's brea... |
23681247-3693-4d62-9756-079bfab9c813 | 7 | public int flips(int row, int column, int rowOffset, int columnOffset) {
int count = 0;
while (true) {
row += rowOffset;
column += columnOffset;
if (row < 0 || row >= WIDTH || column < 0 || column >= WIDTH) {
return 0; // Edge of board
}
if (squares[row][column] == '.') {
return 0; // Vacant ... |
0cbfca1b-6106-4c9e-9a4d-68cf19e9bfd3 | 6 | private boolean checkTypes(Value v1, Value v2, Value v3, Value v4){
boolean valid = false;
if((v1.getType() == v2.getType()) && (v1.getType() == v3.getType())
&& (v1.getType() == v4.getType())){
if(v1.getType() == "integer" || v1.getType() == "real" || v1.getType() == "exponential"){
valid... |
acfe1bd1-86c2-4e20-8b70-9986cc81f0bc | 8 | public ArrayList<Integer> playVisual(int frame_height, boolean fog, boolean show_fog, int team) {
if (agents.size() != pgs.numberOfPlayers()) {
System.out.println("Not the right number of players. Expected "+pgs.numberOfPlayers()+" but got "+agents.size()+" players");
return new ArrayList<Integer>();
}
pgs.... |
9d710d38-66d3-4abd-95e9-6ef667b332a6 | 8 | public static Boolean enumNext(Object enumObj)
{
// OPT this could be more efficient
boolean result;
IdEnumeration x = (IdEnumeration)enumObj;
for (;;) {
if (x.obj == null) {
result = false;
break;
}
if (x.index == x... |
30634d5c-3f6f-493c-a350-87c603b76629 | 5 | final void method2470(int i, byte i_47_) {
if (i_47_ <= -14) {
anInt10333++;
if (!((Class318_Sub1_Sub3_Sub4) this).aBoolean10345) {
anInt10339 += i;
while ((anInt10339 ^ 0xffffffff)
< (((AnimationDefinition) aClass17_10332).anIntArray267[anInt10335]
^ 0xffffffff)) {
anInt10339 -= (((A... |
5a2caf35-2286-440d-96f9-dc230f681777 | 9 | public void saveResource(String resourcePath, boolean replace) {
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace('\\', '/');
InputStream in = getResourceA... |
86914600-d7ed-4650-98b9-d5f872eed963 | 3 | protected Figure createFigure(Point a, Point b) {
switch (settings.commonFillType) {
default:
case ToolSettings.ftNone:
return new RectangleFigure(settings.commonForegroundColor, settings.commonBackgroundColor, settings.commonLineStyle,
a.x, a.y, b.x, b.y);
case ToolSettings.ftSolid:
return new ... |
4c6a0c05-d75d-4647-89fa-668755a5bfbc | 1 | private void resetArray(int[] a, int i, int count,int length) {
for(int j =i; j<= length;j++){
a[j-count] = a[j];
}
} |
e3fd1b4f-80be-4481-ad47-70ae074b1a54 | 1 | public XmlBuilder(String tName)
{
try {
name=tName;
docFactory=DocumentBuilderFactory.newInstance();
docBuilder=docFactory.newDocumentBuilder();
doc = docBuilder.newDocument();
gameModule = doc.createElement("game");
doc.appendChild(gameModule... |
4fa2202a-21fe-4a1b-82da-d8a1bf84a1ab | 8 | public Object enable(String section, String tool, boolean active) {
int i;
for (i = 0; i < _tb.size() && !_tb.get(i).name().equals(section); i++)
;
if (i == _tb.size()) {
return null;
} else {
toolbarSection sec = _tb.get(i);
for (i = 0; i < sec.size()
&& (sec.get(i) == null ? true : (!sec.get(... |
d74417d5-57d9-4da4-8c7a-697dd9a8e1f8 | 2 | public SummaryData(Collection<? extends Coverable> files) {
for (Coverable file : files) {
codeLineCount += file.getCodeLineCount();
codeLinesCoveredCount += file.getCodeLinesCoveredCount();
branchCount += file.getBranchCount();
branchesCoveredCount += file.getBra... |
dc8ef443-9970-48af-a879-7b6397993d70 | 3 | public static String donwloadFile(String urlPath, boolean rewrite) {
int pos = urlPath.lastIndexOf("/");
String file = urlPath.substring(pos + 1);
try {
URL url = new URL(urlPath);
HttpURLConnection connection = (HttpURLConnection) url
.openConnection();
float totalDataRead = 0;
java.io.Buffered... |
bf8b2ffd-bcdd-4eed-82d1-31b7cd6e98c2 | 6 | public double compareFeatureVectors(List<Float> featVector1, List<Float> featVector2) {
if (featVector1.isEmpty() || featVector2.isEmpty()) {
return 0;
}
List<Float> floatList = featVector1;
float[] floatArray1 = new float[floatList.size()];
for (int i = 0; i < float... |
6cb98084-ed96-437d-b194-59898a47f108 | 4 | 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) {
if (line.trim().equals("0"))
break;
a = readIn... |
72c55d1d-0525-463a-9937-13c204283902 | 3 | static double[][] multiply(double[][] A, double[][] B){
double[][] AB = new double[A.length][B[0].length];
for(int i = 0; i < A.length; i++){
for(int j = 0; j < B[i].length; j++){
for(int k = 0; k < B.length ; k++){
AB[i][j] += A[i][k]*B[k][j];
}
}
}
return AB;
} |
5f9a3967-3276-40cd-84d9-eda5878eb57e | 9 | public FileVo listFileInfo(String fileName) throws UpYunExcetion {
try {
StringBuffer url = new StringBuffer();
for (String str : fileName.split("/")) {
if (str == null || str.length() == 0) {
continue;
}
url.append(UrlC... |
3255208e-95cf-461d-9a13-92413d44cd64 | 8 | @Override
public boolean equals(Object obj)
{
if (obj == this) return true;
if (!(obj instanceof ArrayRef<?>)) return false;
ArrayRef<?> ah2 = (ArrayRef<?>)obj;
return (ah2.ar_buf == ar_buf && ah2.ar_off == ar_off && ah2.ar_len == ar_len && ah2.canEqual(this));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.