method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f550b31a-eac8-45bf-9c5b-be062d408147 | 8 | public String toStringSummary() {
String result;
String titles;
int resultsetLength;
int i;
int j;
String content;
if (m_NonSigWins == null)
return "-summary data not set-";
result = "<table border=\"1\" cellpadding=\"3\" cellspacing=\"0... |
ccc54888-0be7-4a94-9ff2-c5fa960ca49d | 3 | @Override
public boolean equals(Object obj) {
if (obj instanceof IautosCarInfo) {
IautosCarInfo ici = (IautosCarInfo) obj;
if (null != ici.getSeqID() && null != this.getSeqID()) {
return ici.getSeqID().equals(this.getSeqID());
}
}
return false;
}; |
b4665523-5cb1-484a-a917-9e4410ccd09a | 4 | private void buildSettings(String jarFile)
{
ArrayList<Class<?>> classes;
try {
classes = getClasses(jarFile);
} catch (IOException e) {
logger.severe("Could not retrieve classes from specified .jar file.");
e.printStackTrace();
return;
... |
0ba1b284-1ba8-4f59-a0ab-a97dde57848e | 4 | public void registerIcons(IconRegister iconReg)
{
if(itemID == ArmorProperties.ScarecrowBoots.itemID)
{
itemIcon = iconReg.registerIcon("costumemod:rubyboots");
}
else if(itemID == ArmorProperties.ScarecrowLeggings.itemID)
{
itemIcon = iconReg.registerIcon("costumemod:rubypants");
}
else if(item... |
4c7757f3-2cce-4b14-985d-a7380612faea | 6 | public void checkIfNeedClean(Row row,Column col,String tableName){
BigTable table=TableManager.getTable(tableName);
NewRowTransaction tr=buffertr;
ValueWithTimestamp lock=tr.read(new Column("lock"), 0,start_ts,1);
//If it exist with a non null value
if(lock!=null&&lock.getValue()!=null){
System.out.println... |
932e4a68-63cf-4102-a880-f3ddca3a176c | 9 | private Tag generateResource(File file, Map<String, String> config) throws Exception {
JarResource resource = new JarResource(file);
List<Capability> caps = new AddOnlyList<Capability>(new LinkedList<Capability>());
List<Requirement> reqs = new AddOnlyList<Requirement>(new LinkedList<Requirement>());
// R... |
c40a9f4e-5eac-499a-83c3-2f89ac095387 | 5 | public static String decToBase(String num, int base)
{
/**
* Oltre 9999999999999990 il double non riesce a gestire con precisione tutti i decimali
*/
String valore = ERRORE;
try
{
if (numeroValido_privato(num, 10)) //Assicuriamoci che il numero inserito ... |
0204e122-8b44-48a8-961e-c0678adf96c9 | 9 | float[][] getCameraVectors(int resX, int resY){ //returns resX*resY camera vectors
float vectors[][]=new float[resX*resY][3];//first vector index, second the components of the vector
float[] vect2=rotateYVector(dir);
vect2[1]=0;
vect2=normalize(vect2);
float[] vect3=normalize(vec... |
4cfcb806-4ab2-4442-aaf8-ccbc43b940aa | 8 | @Override
public Range findRangeBounds(XYDataset dataset) {
if (dataset == null) {
throw new IllegalArgumentException("Null 'dataset' argument.");
}
double minimum = Double.POSITIVE_INFINITY;
double maximum = Double.NEGATIVE_INFINITY;
int seriesCount = dataset.get... |
634315c2-cddf-4b3e-95d9-badf76cf18de | 8 | private static int HuffmanReCode(ZiFu node,int place) {
if(node.left==-1&&node.right==-1){
node.code = Integer.toString(place)+node.code;
// 表示此节点是一个叶节点
return 1;
}else{
if(node.left==-1&&node.right!=-1){
HuffmanReCode(hutree[node.right], place);
}
if(node.left!=-1&&node.right==-1){
Huff... |
2e40c3ef-f3e8-448f-acc7-b5851574c0b2 | 7 | public static TruthValue vectorSatisfiesDescriptionP(Vector vector, Description description) {
if (!(vector.length() == description.arity())) {
if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue()) {
return (Logic.TRUE_TRUTH_VALUE);
}
else {
return (Logic.FALSE_TRUTH_VALU... |
6262a041-2a5c-4950-b043-eb2832f0f789 | 0 | public ClusterNode getRightBranch() {
return this.rightBranch;
} |
18c53d0c-e9f9-40d0-8566-9e643b9498fe | 9 | private List<List<Double>> getPredOutcome(double[] features) throws PerceptronException{
int numPossibleOutputs = nodesList.get((nodesList.size()-1)).size();
List<List<Double>> activations = new ArrayList<List<Double>>();
//initialize the arraylist of the lists of activations
for(int i = 0; i < numHiddenLay... |
be3397e1-c291-4f6c-a572-17ec26bbb028 | 0 | public AuthFrame() {
super("Chat - Login");
doAesthetics();
setVisible(true);
} |
1ae6c8be-9a94-46da-aa82-5636bcfafccb | 3 | protected Object[] getGettersAndIndexes(Method method, List<String> parameterNames,
Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexes) throws DaoGenerateException {
Class<?>[] paramTypes = method.getParameterTypes();
if (batchParamIndexes == null || batchParamIndexes.isEmpty()) {
retur... |
2b45db2d-94eb-4f36-a956-a5ce3217b9c9 | 3 | public List<String> getAllDefinitions(Collection<PearsonDictionaryEntry> entries) {
List<String> definitions = new ArrayList<String>();
for (PearsonDictionaryEntry entry : entries) {
for (PearsonWordSense sense : entry.getSenses()) {
if (!SparkUtils.isBlank(sense.getDefinition())) {
definitions.add(sens... |
94c7c372-c21d-46d7-ba5c-7f9d4375f9a6 | 0 | private static void quit() {
stillPlaying = false;
} |
d7857a7c-636e-4df7-9da3-e4f7f868613b | 6 | public boolean equals(Object o)
{
if(!(o instanceof Login))
return false;
Login login = (Login)o;
return login.getName().equals(name)
&& login.getDriver().equals(driver)
&& login.getUrl().equals(url)
&& login.getUserName().equals(userName)
&& login.getPassWord().equals(passWord)
... |
2235b632-db33-4627-bd7d-28b889d1d890 | 5 | public Object [][] getDatos(){
Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length];
//realizamos la consulta sql y llenamos los datos en "Object"
try{
if (colum_names.length>=0){
r_con.Connection();
String c... |
78828806-7fb3-44b9-99c6-8d631c9b6343 | 9 | private boolean check() {
if (!isBST())
StdOut.println("Not in symmetric order");
if (!isSizeConsistent())
StdOut.println("Subtree counts not consistent");
if (!isRankConsistent())
StdOut.println("Ranks not consistent");
if (!is23())
StdOut.println("Not a 2-3 tree");
if (!isBalanced())
StdOut.p... |
6b422044-b336-4950-ad8e-e3ed7adb9a7b | 9 | public void map(LongWritable key, Text values,Context cont) {
book = p.getBook(values.toString(),book);
if(!p.needtoParse(values.toString()))
return;
/** For the parsing lines **/
if(values.toString().indexOf(p.getParseWordStart()) != -1 ||
... |
fccd2e8b-9a4e-4f4f-8886-3f45f1b77033 | 2 | List<Download.File> getFiles() throws InvalidRpcDataException {
List<Download.File> list = new ArrayList<Download.File>();
Object object = rawMap.get("files");
if (object instanceof Object[]) {
Object[] objectArray = (Object[]) object;
for (Object fileObject : objectA... |
c9d40765-ac90-4e68-b257-c0271617a7de | 0 | public void setProgressMonitor(ProgressMonitor monitor) {
this.monitor = monitor;
} |
c4553679-2654-414e-97bb-f09b4663d669 | 3 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (!sender.hasPermission("under50.list")) {
sender.sendMessage(ChatColor.RED + "No access");
return true;
}
String list = "";
if (Bukkit.getServer().getOn... |
f14c4641-a682-4ae7-b217-f26d1a6f4984 | 1 | @Override
public void commitTrans() throws Exception {
try {
oConexionMySQL.commit();
} catch (SQLException e) {
throw new Exception("Mysql.commitTrans: Error en commit: " + e.getMessage());
}
} |
4deab21c-41f4-4802-a5df-f8e9bf20fc3b | 0 | public void setSeqNum(int seqNum){
this.seqNum = seqNum;
} |
4cf554f0-c174-43b1-b887-af01184bf3e6 | 8 | private double getMaxHeightRatio(ScanfReader scanReader, String attrName) throws IOException{
String frac = scanReader.scanString();
double hr = -1;
if(!frac.equals("*")){
if(!maxWeightMap.isEmpty() && !davidAvgGVC){
if(maxWeightMap.containsKey(attrName)){
hr = maxWeightMap.get(att... |
6b7e9b8b-15d7-4354-9937-720535281f21 | 9 | static protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos... |
a4c9a709-1058-4eea-a037-b377d5566134 | 5 | private void merge(int low, int middle, int high) {
// Copy both parts into the helper array
for (int i = low; i <= high; i++) {
helper[i] = numbers[i];
}
int i = low;
int j = middle + 1;
int k = low;
// Copy the smallest values from either the left ... |
8450677b-ce9c-41e3-9ca9-705a304e5ab4 | 7 | private void updateCommandCard(){
switch(interactionState){
case mapScrolling:
case menu:
case placeTower:
case scrolling:
case zooming:
displayEmptyCommandCard();
break;
case normal:
displayBuyCommandCard();
break;
case selected:
displayTowerCommandCard();
break;
}
} |
df0dd7f4-54c1-4ae8-a6e0-0c52ecce3c81 | 1 | public void detach() {
ClassPool cp = getClassPool();
CtClass obj = cp.removeCached(getName());
if (obj != this)
cp.cacheCtClass(getName(), obj, false);
} |
5199dc9c-111c-4e3d-b275-313540f8fb0d | 7 | @Override
public void onMessage(MessageEvent e) {
if (!RUtils.isFantasyCommand(e.getMessage())) return;
final String command = RUtils.getFantasyCommand(e.getMessage());
if (!command.equalsIgnoreCase("kick")) return;
final User u = e.getUser();
if (!PermissionHandler.atLeastMo... |
7b600dda-fd01-4be6-a68a-f532bbb89583 | 8 | private int stencilOpSanitise(int op) {
switch (op) {
case ZERO:
return 0;
case KEEP:
return 1;
case REPLACE:
return 2;
case INCR:
return 3;
case INCR_WRAP:
return 4;
case DECR:
return 5;
case DECR_WRAP:
return 6;
case INVERT:
return 7;
default:
throw no... |
1a34cd71-fc43-42eb-9136-940ab12b6dad | 0 | public EditCanvas getAutomatonPane() {
return pane;
} |
3d95d4ea-08c5-4928-affe-fd87b8bdee97 | 9 | public static Ability[] EFFECTA(int code)
{
final CODES c = c();
final int cd = code & RESOURCE_MASK;
Ability[] As = c.effectAs[cd];
if (As != null)
return As;
synchronized (c.effectAs)
{
As = c.effectAs[cd];
if (As != null)
return As;
final List<String> effectsV = CMParms.parse... |
88ab8934-baca-4d93-bbe4-44719e5f3cd8 | 7 | public DesignerView(final AlphaForm form,
final ApplicationController controller) {
super(controller);
this.model = form;
this.setLayout(new BorderLayout());
final JSplitPane jsp1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
final JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
jsp1.se... |
52396434-0fb9-4cb9-89e8-c3856ad1a74f | 3 | public static void main(String[] args)
{
Server Server = null;
try
{
String Config = ".\\config.ini";
if(args.length == 1)
{
Config = args[0];
}
Server = new Server(Config);
}
catch (Exception ex)
... |
88f412b4-e658-432c-966e-499ed1b21bca | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AttributeStorageType)) {
return false;
}
AttributeStorageType other = (AttributeStorageType) object;
if ((this.... |
66378528-f97f-4f3c-9bad-4cf251246610 | 7 | @Override
public void emitCode(GluonOutput code) {
if (exp2 == null) {
exp1.emitCode(code);
return;
}
exp1.emitCode(code);
code.code("PUSH EAX");
exp2.emitCode(code);
code.code("POP EBX");
code.code("CMP EAX, EBX");
switch (compare){
case EQUALS:
code.code("SETE AL");
break;
... |
146ebc22-ce9f-41e9-a02d-62e9edf6d063 | 7 | private void renderActorInfo(Actor actor) {
this.fill(this.actorSpace, this.menuBackgroundColor);
this.border(this.actorSpace, this.menuBorderColor, ScreenRenderer.TEXT_BORDERS);
if (actor == null) {
return;
}
// Setup
this.graphics.setColor(this.textColor);
this.graphics.setFont(new Font("Courier Ne... |
b3596ef1-8994-4ac8-a53e-b3d65c3f2a74 | 7 | public String getCellStringData(String SheetName,int RowNum,int ColNum){
try{
XSSFSheet sheet = workbook.getSheet(SheetName);
Cell cell = sheet.getRow(RowNum).getCell(ColNum);
switch(sheet.getRow(RowNum).getCell(ColNum).getCellType()){
case Cell.CELL_TYPE_STRING:
return cell.getRichStringC... |
4a8652eb-fd86-49ff-ab45-04dd34bab3f6 | 9 | private void mark(int ar[][], int x, int y) {
if (prompt) {
ar[x][y] = 1;
if (x == y) {
ways[6][counts[6]] = 1;
counts[6]++;
}
if (Math.abs(y - x) == 2 || (x == 1 && y == 1)) {
ways[7][counts[7]] = 1;
... |
1faa2343-35d7-4781-8d82-8927bb970b7b | 5 | private MenuItem createEditMenu(Menu menuBar) {
//Edit menu.
MenuItem item = new MenuItem(menuBar, SWT.CASCADE);
item.setText(resAddressBook.getString("Edit_menu_title"));
Menu menu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(menu);
/**
* Add a listener to handle enabling and disabling
* some items in ... |
33e9ab4b-e61a-45e4-86d1-7dc79507a02e | 4 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, Exception {
Contexto oContexto = new Contexto();
ContextParam oContextParam = new ContextParam(request);
oContexto=oContextParam.loadSession(oContexto);
oContexto... |
4405f15a-7ff7-436f-80af-4830d726f51c | 5 | public String encrypt (String word) {
if(word == null||word.length()==0) throw new IllegalArgumentException();
String result = "";
String wordLower = word.toLowerCase();
for(int i=0; i<wordLower.length(); i++){
if(wordLower.charAt(i)<97 || wordLower.charAt(i)>122)
throw new IllegalArgumentException();
... |
7d339a3d-cc7e-45fa-873b-3fa5282214f9 | 4 | public int getNextInt(int colNum){
int resultInt;
try{
if(result.next()){
//check if colnum is not greater than the returned columns
if(0 < colNum && colNum <= rsmd.getColumnCount()){
resultInt = result.getInt(colNum);
return resultInt;
}
}
return -9999;
}
catch(SQLException e){
... |
29db33e4-f8ba-4d64-9000-b95186332eba | 8 | protected int takeStep(int i1, int i2, double alpha2, double alpha2Star, double phi2) throws Exception {
//procedure takeStep(i1, i2)
//
// if (i1 == i2)
// return 0
if (i1 == i2) {
return 0;
}
double C1 = m_C * m_data.instance(i1).weight();
double C2 = m_C * m_data.instance(... |
9ef2300e-0a54-4434-bd7f-cfde66862a5f | 8 | public final int partitionByPrice(int lb, int ub)
{ // for an outline of how this works, see the partition method for name
Product pivotElement = allProducts[lb];
int max = logicalSize;
int left = lb, right = ub;
Product temp;
while (left < right)
{
while((allProducts[left].productPrice() <= pivotElem... |
bc466653-1488-46d3-a335-eb10c79734eb | 7 | public int compareTo(Object o) {
int row1 = modelIndex;
int row2 = ((Row) o).modelIndex;
for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
Directive directive = (Directive) it.next();
int column = directive.column;
Object ... |
fe32e728-ecae-412f-a070-0b020a385cda | 4 | boolean saveCharacter (Character character) {
File file = new File("characters", character.name.toLowerCase());
file.getParentFile().mkdirs();
if (character.id == 0) {
String[] children = file.getParentFile().list();
if (children == null) return false;
character.id = children.length + 1;
}
DataOutp... |
cc9ffc84-2efc-4e6a-98ea-956c7594356e | 9 | public static Mode forBits(int bits) {
switch (bits) {
case 0x0:
return TERMINATOR;
case 0x1:
return NUMERIC;
case 0x2:
return ALPHANUMERIC;
case 0x3:
return STRUCTURED_APPEND;
case 0x4:
return BYTE;
case 0x5:
return FNC1_FIRST_POSI... |
ba517788-759a-4fe7-adb0-56a11340c2f3 | 7 | public static LinkedHashMap<String,Object> processArray(Map<String,Object> array) {
LinkedHashMap<String,Object> retArr = new LinkedHashMap<String,Object>();
if (array == null) return retArr;
for (Map.Entry<String,Object> entry: array.entrySet()) {
String key = (String) entry.getKey();
Object value = (Objec... |
33f80630-7680-4a58-a5c8-af1dcf5df9cb | 5 | @Override
public void run() {
try{
MathLogic mathLogic = new MathLogic();
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader in =
new BufferedReader(new InputStreamReader(clientSocket.getInpu... |
ceabb09b-2105-4a9a-874f-75237d44a61d | 2 | protected int byteArrayToInt(byte[] bytes) {
int result = 0;
int l = bytes.length - 1;
for (int i = 0; i < bytes.length; i++) {
if (i == l) result += bytes[i] << i * 8;
else result += (bytes[i] & 0xFF) << i * 8;
}
return result;
} |
30273ea4-d30d-4d6f-acae-5c7ef6467b02 | 7 | public void plusBlock(SparseRowBlockWritable bOther) {
/*
* since we maintained row indices in a sorted order, we can run sort merge
* to expedite this operation
*/
int i = 0;
int j = 0;
while (i < numRows && j < bOther.numRows) {
while (i < numRows && rowIndices[i] < bOther.rowIndi... |
7243ceea-cb85-4b3b-9f5e-fa37557cf0f4 | 7 | public static void main(String[] args) {
// TODO Auto-generated method stub
FileReader fr = null;
FileWriter fw = null;
BufferedReader br = null;
BufferedWriter bw = null;
String s = null;
try{
fr = new FileReader("c://myclass/figureinformation.txt");
br = new BufferedReader(fr... |
ebb25a16-d604-40e5-85b9-48295704f0fe | 6 | public boolean searchMatrix(int[][] matrix, int target) {
if (matrix == null || matrix.length == 0 || matrix[0].length == 0)
return false;
int m = matrix.length;
int n = matrix[0].length;
int start = 0;
int end = m * n - 1;
while (start <= end) {
int mid = (start + end) / 2;
int midX = mid / n; ... |
6b4e3461-d8e1-45f8-a05d-ce7972fe9fef | 5 | public void listEmployees() {
Session session = sessionFactory.openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
List<Employee> employees = session.createQuery("FROM Employee").list();
allEmployees = new ArrayList<Employ... |
6c61db9a-2f73-4c7a-9b69-f780433d66b6 | 8 | public static int f(String s, String t) {
if (s.equals(t)) {
return 0;
}
if (s.isEmpty()) {
return t.length();
}
if (t.isEmpty()) {
return s.length();
}
int[] v0 = new int[t.length() + 1];
int[] v1 = new int[t.length() + 1];
for (int i = 0; i < v0.length; i++) {
v0[i] = i;
}
for... |
50a997eb-0f36-4fcf-bf12-ed73113d21b8 | 0 | private boolean checkOverLimit(){
return characterList.size() >= max ;
} |
78e54ad7-0693-4a35-8705-cccbeed463be | 0 | public static void debuggerInit() {
codes.put("FUNCTION", "debuggerbytecodes.FunctionCode");
codes.put("FORMAL", "debuggerbytecodes.FormalCode");
codes.put("LINE", "debuggerbytecodes.LineCode");
codes.put("CALL", "debuggerbytecodes.DebuggerCallCode");
codes.put("HALT", "debuggerb... |
cb53b94d-aa8e-42ad-8216-47a130329a0d | 3 | @SuppressWarnings("unchecked")
public void Print()
{
Entry<E> e= null;
String k=null;
for (int i=0;i<SIZE;i++){
e = (Entry<E>) table[i];
while(e != null) {
if (k!=e.key){
k=e.key;
System.out.print(e.key+" ");
}
e = e.next;
}
... |
3258f544-112e-467c-bc77-3f9381e171c2 | 3 | public static List<School> constructSchool(Response res) throws WeiboException {
try {
JSONArray list = res.asJSONArray();
int size = list.length();
List<School> schools = new ArrayList<School>(size);
for (int i = 0; i < size; i++) {
schools.add(new School(list.getJSONObject(i)));
}
return schoo... |
d98f7416-3292-4d33-a1cd-cde31db11e77 | 8 | public LoadPermissions() {
final File permissionsFolder = new File(plugin.getDataFolder(), "permissions/");
if (!permissionsFolder.exists()) {
permissionsFolder.mkdirs();
}
permissionsFile = new File(plugin.getDataFolder(), "permissions/permissions.yml");
if (!permissionsFile.exists()) {
try ... |
7fd12464-108e-4128-b5f7-60f0be495928 | 3 | public static void selectNoneText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
// Clear Text Selection
int caretPosition = textArea.getCaretPosition();
tree.setCursorPosition(caretPosition);
textArea.setCaretPosition(caretPosition);
tex... |
7560b0e2-53d3-484b-952d-c8b65677aa49 | 2 | public static final long extractDate(String text) {
if (text != null) {
Matcher matcher = DATE_PATTERN.matcher(text);
if (matcher.find()) {
Calendar cal = Calendar.getInstance();
cal.clear();
int year = Numbers.extractInteger(matcher.group(1), 0, false);
int month = Numbers.extractInteger(matche... |
c0f09c2e-f608-4bf2-9af4-95a4c431b3b4 | 2 | public static String getFilename(String path) {
if (path == null) {
return null;
}
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
return (separatorIndex != -1 ? path.substring(separatorIndex + 1)
: path);
} |
da023623-9fa8-4fc2-8d1e-9bd00dd25db4 | 7 | private boolean foundPath(Block currentBlock, Orientation currentOrientation,Block goalBlock) {
if(currentBlock.equals(goalBlock)){
return true;
}
if(cellAtBlock(currentBlock) == null ||
cellAtBlock(currentBlock).equals(new Integer(1))){
return false;
}
if(isExplored(currentBlock)){
retur... |
cbcce6fc-7cfe-4f09-b4b4-db0c4ddefcba | 3 | private boolean isThreeCardBadugi()
{
if (isColour() || isStreet() || isThree())
{
return false;
}
else
{
return true;
}
} |
11c56e92-4895-4bf7-b358-e43c2806f26e | 0 | public MessageBuffer(int payloadSize) {
messageBuffer = new LinkedList<byte[]>();
// Subtract 1 for 10 padding
this.payloadSize = payloadSize;
this.messageSize = payloadSize - 1;
currentMessage = new byte[messageSize];
writePointer = 0;
} |
f42c2a78-a785-4b00-832b-e1295ef87155 | 8 | public static Node sumHelper(Node head, Node result, Node one, Node two) {
if(one == null && two == null ) {
if( lastNode(head).data == 0 ) {
return lastRemove(head);
} else {
return head;
}
}
if(result == null) {
... |
dbe4afb2-c0f2-48ff-b2fd-9908f80287db | 5 | public static void main (String args[]) {
System.out.println("Добро пожаловать в BlowKeeper");
System.out.println("Доступны следующие команды: add, help и report");
DBHelper helper = DBHelper.getInstance();
Connection connection = helper.getConnection();
String pref = "blow_k... |
dfae09db-f68a-4dc3-8592-7f36c199297d | 9 | private void scanAndAddIndexes(BeanProperty parent,
boolean checkBeforeIndexing) {
Class<?> clazz = getPropertyClass(parent);
Index classIndex = clazz.getAnnotation(Index.class);
if (checkBeforeIndexing ? (classIndex != null && classIndex.contents())
: true) {
for (BeanProperty property : getAllProperti... |
1196578d-1ea9-4d1a-bff5-7f41ba7d6220 | 2 | public void revealIfMine() {
if ( (isRevealed() == false) && (isMine()) ) {
imageView.setImage(Images.Type.SQUARE_MINE.getImage());
isRevealed = true;
}
} |
c4c50a39-25fa-48c4-bf17-c01656efff4d | 4 | public boolean isThreeOfaKind(String cards[], int n) {
int count = 0;
for (int i=0; i<n-2; i++) {
if (cards[i].charAt(1) == cards[i+1].charAt(1) &&
cards[i+1].charAt(1) == cards[i+2].charAt(1))
count++; }
//return true;
if (count == 1)
return true;
else
return false;
} |
8e55c7d8-c858-46f2-8f42-dbeda8216d6a | 3 | public int setOthersCurrency(int amount)
{
othersCurrency = amount;
int overflow = othersCurrency - 3904;
int large = (int)Math.floor(othersCurrency / largeCurrency);
if (large > 0)
inventory.setItem(8, new ItemStack(largeCurrencyItem.getType(), large));
else {
inventory.clear(8);
... |
30442b51-1c80-4bce-970e-0f4db085bfb3 | 2 | public void putAll(Map<? extends K, ? extends V> arg0) {
throw new UnsupportedOperationException();
} |
afe88006-a0fc-40e3-a0d9-d3f5c997e4be | 8 | @Override
public void nextStep() {
Resource res;
switch (this.step) {
case (0):
// Blokuotas, laukiam resurso "Pakrovimo paketas"
res = Core.resourceList.searchResource(ResourceType.LOAD_PACK);
if (res != null) {
LoaderPacketDescriptor descriptor = (LoaderPacketDescriptor) res.getDescriptor();
t... |
332133fe-4eb6-4721-adfe-9d218c952880 | 8 | public void send(String message) {
System.err.println(message);
if (socket != null && socket.isConnected()) {
try {
if(Server.get().getHuffman()) {
out.write(Protocol.encode(Huffman.getEncoder().encode(message, 0)));
} else {
out.write(Protocol.encode(message.getBytes()));
}
} ca... |
e21d756d-c930-45d8-bd7a-a47fac9f3c49 | 3 | public boolean deleteBipolarQuesion(BipolarQuestion bipolarQuestion) {
Element bipolarQuestionE;
boolean flag = false;
for (Iterator i = root.elementIterator("bipolarQuestion"); i.hasNext();) {
bipolarQuestionE = (Element)i.next();
if (bipolarQuestionE.element("id").getText().equals(bipolarQuestion.getId())... |
9200c66a-b0d0-4b3f-8f64-16f9bc8fa70d | 8 | protected static Ptg calcYieldDisc( Ptg[] operands )
{
if( operands.length < 4 )
{
PtgErr perr = new PtgErr( PtgErr.ERROR_NULL );
return perr;
}
debugOperands( operands, "calcYIELDDISC" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getValu... |
c5774d27-4f98-400c-af73-4b932f020223 | 8 | protected void buildModel2() {
for (int iter = 1; iter <= numIters; iter++) {
// Step 1: update W by fixing H
DenseMatrix trH = H.transpose();
// V * trH
DenseMatrix V_trH = DenseMatrix.mult(V, trH);
// W * H * trH
DenseMatrix W_H_trH = W.mult(H.mult(trH));
// update: W_ij = W_ij * (V_trH)_ij... |
d7f44c9c-ee00-48b1-986b-4c461292ad93 | 3 | public void addSelection(Noeud n, boolean is_on_itineraire) {
// on ajoute le noeud � la liste des noeud selectionne
if (!remanent && !control_key) {
// En ayant auparavant supprimer l'ancienne selection
// si le parametre remanent n'est pas active
// (ou si la touche control n'est pas presse)
selectedN... |
6431c4ee-2836-4730-a392-80aefc7be80e | 1 | public AnnotationVisitor visitArray(final String name) {
if (name != null) {
cp.newUTF8(name);
}
return new AnnotationConstantsCollector(av.visitArray(name), cp);
} |
0a02123d-eb6b-434b-ba4c-8415463e6954 | 7 | private Tuple<Float, HeuristicData> max(LongBoard state, HeuristicData data, float alpha,
float beta, int action, int depth) {
Winner win = gameFinished(state);
statesChecked++;
Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MIN_VALUE, nul... |
3bc2543b-32bb-4bf3-bb1b-bfb3d97904f0 | 3 | public int betaLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 5;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod;
} |
982ad1c0-f61a-427e-b1b2-9da41b335389 | 1 | private void initSaveData() {
if (theWorker == null) {
state = UIState.SAVEDATA;
lblStatus.setText("Downloading files");
theWorker = new MyWorker(rootPage, JobType.SAVEDATA, false);
theWorker.execute();
disableButtons();
}
} |
4e143b3d-a8a9-4914-8bb5-45d332409222 | 9 | private boolean isXingFrame(byte[] bytes, int offset) {
if (bytes.length >= offset + XING_MARKER_OFFSET_1 + 3) {
if ("Xing".equals(BufferTools.byteBufferToStringIgnoringEncodingIssues(bytes, offset + XING_MARKER_OFFSET_1, 4))) return true;
if ("Info".equals(BufferTools.byteBufferToStringIgnoringEncodingIssues(b... |
11ddab49-d98a-4513-af6c-bc54cb016ee8 | 4 | public void setOrientation(int orientation) {
this.orientation = orientation;
switch(orientation) {
case (UP) : {
offTextureId = TextureManager.getTextureID("arrow_up");
onTextureId = TextureManager.getTextureID("arrow_up_hover");
break;
... |
b3f4ef55-192e-48cb-9c6d-243e806a8114 | 8 | public boolean sonRegistrosIguales(HistorialVehiculo hv1, HistorialVehiculo hv2) {
if (hv1.getPlaca().equals(hv2.getPlaca())) {
if (hv1.getDatoEvento().equals(hv2.getDatoEvento())) {
if (hv1.getEstadogps().equals(hv2.getEstadogps())) {
if (hv1.getEvento().equals(h... |
201abe3b-8c9e-4845-be75-e4de2c4f01f1 | 8 | @Override
public void performCSE() throws Exception {
Instruction i = getDominating();
while(i != null) {
if(this.isCommonSubexpression(i)) {
this.delete((Instruction)i.getSubstitute());
return;
} else if (i instanceof Store) {
... |
96658a16-c03a-4458-9886-aa8092cd1f0f | 3 | public void dfs(UndirectedNode root) {
Stack<UndirectedNode> stack = new Stack<UndirectedNode>();
stack.push(root);
root.visited = true;
while (!stack.isEmpty()) {
UndirectedNode node = stack.pop();
for (UndirectedNode nodes : node.edgeNodes) {
if ... |
fc2176d8-40c8-4878-bd58-fe63a62cb16a | 2 | private static void writeLeftAlignedValue(FileImageOutputStream stream,
TiffType type, int val)
throws IOException {
switch (type) {
case SHORT:
stream.writeShort(val);
stream.writeShort(0);
break;
case ... |
a231b93e-5a30-48f1-981c-9b83263ea869 | 3 | public static void computePaths(Vertex source) {
source.setMinDistance(0.);
System.out.println("source = " + source);
// Using PriorityQueue class with minDistance as a priority (see the comparator of Vertex)
PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>();
vertexQueue.add(source);
... |
76195928-5dee-4ced-a24e-ccd9a875ace9 | 9 | private Map<Object, Object> seekMap() {
String key = null;
char ch = 0;
Object value;
StringBuilder strBuilder = new StringBuilder();
Map<Object, Object> map = new LinkedHashMap<Object, Object>();
for (index++; index < length; index++) {
if (!vali.isPass()) {
... |
90615904-4659-4123-84dd-aca08e4deb54 | 2 | @Override
public void onPrivmsg(String chan, IRCUserInfo user, String msg) {
if(chan.equals("#"+channelName))
if(user.equals(main.getNick()))
chatLog.append("\nYou: "+ msg+"\n");
else
chatLog.append("\n" + user.getNick() +": "+ msg+"\n");
} |
13ca06f2-07b7-405d-9ac0-20b93eefcc12 | 0 | public MyListItemWrapper(URL url) {
this.url = url;
} |
a7db76c6-d5c5-4f44-a289-663c78b3cc01 | 1 | public void processEntity(Entity entity, long elapsedTime) {
TimedDelete deleteComponent = entity.getComponent(TimedDelete.class);
deleteComponent.lifeDuration -= elapsedTime;
if (deleteComponent.lifeDuration < 0) {
entityManager.removeEntity(entity);
}
} |
bf779a48-0f73-4ed7-96e2-23d77bc033df | 5 | public boolean shapeValido (){
if (!Cat2OsmUtils.getOnlyEntrances()){
// Modo todos los elemtex de Parajes y Comarcas, Informacion urbana
// y rustica y Vegetacion y Accidentes demograficos
if (ttggss.equals("189203"))
return Rules.isValid(rotulo);
else if (ttggss.equals("189300"))
return Rules.... |
c47e1428-c75b-4fd4-91d7-ae73696ea5dc | 7 | @Override
public void executeCommand(CommandSender sender, Command cmd, String[] args){
CommandHelper helper = new CommandHelper(sender, cmd);
int pageLength = plugin.commandHelp.size() + 1;
if(args.length == 1){
if(args[0].equalsIgnoreCase("help")){
Utilities.paginate(sender, plugin.commandHelp, 1,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.